tap: add gro support
Type: feature
Change-Id: I5868dd267aa26aa97aec5fd70e70c5956ac52277
Signed-off-by: Mohsin Kazmi <sykazmi@cisco.com>
diff --git a/src/vnet/devices/tap/tap.c b/src/vnet/devices/tap/tap.c
index fa5eef1..a76b4e0 100644
--- a/src/vnet/devices/tap/tap.c
+++ b/src/vnet/devices/tap/tap.c
@@ -730,6 +730,12 @@
{
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 @@
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 @@
}
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 @@
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 @@
hw->flags &= ~(VNET_HW_INTERFACE_FLAG_SUPPORTS_GSO |
VNET_HW_INTERFACE_FLAG_SUPPORTS_TX_L4_CKSUM_OFFLOAD);
}
+ vif->packet_coalesce = 0;
}
error: