summaryrefslogtreecommitdiffstats
path: root/src/vnet/devices/tap
diff options
context:
space:
mode:
authorMohsin Kazmi <sykazmi@cisco.com>2020-08-13 18:57:26 +0200
committerBenoƮt Ganne <bganne@cisco.com>2020-08-17 08:46:53 +0000
commit9e2a78564f0fc07f1ea3d15a31fa7ca3a0f6424d (patch)
tree03387739672584357b7038b67e998d8824de5d01 /src/vnet/devices/tap
parent00dd39044e64b4a7a33d204ef7d19aac819d71f5 (diff)
tap: add gro support
Type: feature Change-Id: I5868dd267aa26aa97aec5fd70e70c5956ac52277 Signed-off-by: Mohsin Kazmi <sykazmi@cisco.com>
Diffstat (limited to 'src/vnet/devices/tap')
-rw-r--r--src/vnet/devices/tap/cli.c15
-rw-r--r--src/vnet/devices/tap/tap.c16
-rw-r--r--src/vnet/devices/tap/tap.h2
3 files changed, 26 insertions, 7 deletions
diff --git a/src/vnet/devices/tap/cli.c b/src/vnet/devices/tap/cli.c
index 34897ea7c5d..fa5fa91e7a6 100644
--- a/src/vnet/devices/tap/cli.c
+++ b/src/vnet/devices/tap/cli.c
@@ -201,7 +201,7 @@ tap_offload_command_fn (vlib_main_t * vm, unformat_input_t * input,
unformat_input_t _line_input, *line_input = &_line_input;
u32 sw_if_index = ~0;
vnet_main_t *vnm = vnet_get_main ();
- int gso_enable = 0, gso_disable = 0;
+ int gso_enable = 0, gso_disable = 0, is_gro_coalesce = 0;
int csum_offload_enable = 0, csum_offload_disable = 0;
int rv = 0;
@@ -217,7 +217,11 @@ tap_offload_command_fn (vlib_main_t * vm, unformat_input_t * input,
vnm, &sw_if_index))
;
else if (unformat (line_input, "gso-enable"))
- gso_enable = 1;
+ {
+ gso_enable = 1;
+ if (unformat (line_input, "gro-coalesce"))
+ is_gro_coalesce = 1;
+ }
else if (unformat (line_input, "gso-disable"))
gso_disable = 1;
else if (unformat (line_input, "csum-offload-enable"))
@@ -235,11 +239,11 @@ tap_offload_command_fn (vlib_main_t * vm, unformat_input_t * input,
"please specify interface name or sw_if_index");
if (gso_enable)
- rv = tap_gso_enable_disable (vm, sw_if_index, 1);
+ rv = tap_gso_enable_disable (vm, sw_if_index, 1, is_gro_coalesce);
else if (csum_offload_enable)
rv = tap_csum_offload_enable_disable (vm, sw_if_index, 1);
else if (gso_disable)
- rv = tap_gso_enable_disable (vm, sw_if_index, 0);
+ rv = tap_gso_enable_disable (vm, sw_if_index, 0, 0);
else if (csum_offload_disable)
rv = tap_csum_offload_enable_disable (vm, sw_if_index, 0);
@@ -256,7 +260,8 @@ VLIB_CLI_COMMAND (tap_offload_command, static) =
{
.path = "set tap offload",
.short_help = "set tap offload {<interface> | sw_if_index <sw_idx>}"
- " <gso-enable | gso-disable | csum-offload-enable | csum-offload-disable>",
+ " <gso-enable [gro-coalesce] | gso-disable | csum-offload-enable |"
+ "csum-offload-disable>",
.function = tap_offload_command_fn,
};
/* *INDENT-ON* */
diff --git a/src/vnet/devices/tap/tap.c b/src/vnet/devices/tap/tap.c
index fa5eef19c0d..a76b4e0c16a 100644
--- a/src/vnet/devices/tap/tap.c
+++ b/src/vnet/devices/tap/tap.c
@@ -730,6 +730,12 @@ tap_create_if (vlib_main_t * vm, tap_create_if_args_t * args)
{
hw->flags |= VNET_HW_INTERFACE_FLAG_SUPPORTS_TX_L4_CKSUM_OFFLOAD;
}
+ if ((args->tap_flags & TAP_FLAG_GSO)
+ && (args->tap_flags & TAP_FLAG_GRO_COALESCE))
+ {
+ vif->packet_coalesce = 1;
+ virtio_set_packet_coalesce (vif);
+ }
vnet_hw_interface_set_input_node (vnm, vif->hw_if_index,
virtio_input_node.index);
@@ -827,6 +833,7 @@ tap_csum_offload_enable_disable (vlib_main_t * vm, u32 sw_if_index,
vec_foreach_index (i, vif->tap_fds)
_IOCTL (vif->tap_fds[i], TUNSETOFFLOAD, offload);
vif->gso_enabled = 0;
+ vif->packet_coalesce = 0;
vif->csum_offload_enabled = enable_disable ? 1 : 0;
if ((hw->flags & VNET_HW_INTERFACE_FLAG_SUPPORTS_GSO) != 0)
@@ -862,7 +869,8 @@ error:
}
int
-tap_gso_enable_disable (vlib_main_t * vm, u32 sw_if_index, int enable_disable)
+tap_gso_enable_disable (vlib_main_t * vm, u32 sw_if_index, int enable_disable,
+ int is_packet_coalesce)
{
vnet_main_t *vnm = vnet_get_main ();
virtio_main_t *mm = &virtio_main;
@@ -892,6 +900,11 @@ tap_gso_enable_disable (vlib_main_t * vm, u32 sw_if_index, int enable_disable)
hw->flags |= VNET_HW_INTERFACE_FLAG_SUPPORTS_GSO |
VNET_HW_INTERFACE_FLAG_SUPPORTS_TX_L4_CKSUM_OFFLOAD;
}
+ if (is_packet_coalesce)
+ {
+ vif->packet_coalesce = 1;
+ virtio_set_packet_coalesce (vif);
+ }
}
else
{
@@ -900,6 +913,7 @@ tap_gso_enable_disable (vlib_main_t * vm, u32 sw_if_index, int enable_disable)
hw->flags &= ~(VNET_HW_INTERFACE_FLAG_SUPPORTS_GSO |
VNET_HW_INTERFACE_FLAG_SUPPORTS_TX_L4_CKSUM_OFFLOAD);
}
+ vif->packet_coalesce = 0;
}
error:
diff --git a/src/vnet/devices/tap/tap.h b/src/vnet/devices/tap/tap.h
index a9cd4766c3c..93b5da51dc5 100644
--- a/src/vnet/devices/tap/tap.h
+++ b/src/vnet/devices/tap/tap.h
@@ -101,7 +101,7 @@ typedef struct
void tap_create_if (vlib_main_t * vm, tap_create_if_args_t * args);
int tap_delete_if (vlib_main_t * vm, u32 sw_if_index);
int tap_gso_enable_disable (vlib_main_t * vm, u32 sw_if_index,
- int enable_disable);
+ int enable_disable, int packet_coalesce);
int
tap_csum_offload_enable_disable (vlib_main_t * vm, u32 sw_if_index,
int enable_disable);