aboutsummaryrefslogtreecommitdiffstats
path: root/src/vnet/devices/virtio/device.c
diff options
context:
space:
mode:
authorMohsin Kazmi <sykazmi@cisco.com>2020-09-25 15:36:19 +0200
committerAndrew Yourtchenko <ayourtch@gmail.com>2020-09-30 11:30:25 +0000
commit36e657032c4d77c2657cf5c14d3b5dfa3c13d48c (patch)
treeb7bf8e4802b41cc3f377568aa1216d7c59a9623b /src/vnet/devices/virtio/device.c
parentc6f50a3e3eba16fcc77ca009d2eb7fe224c1912b (diff)
virtio: fix the gro enable/disable on tx-vrings
Type: fix Change-Id: I96c30baaf34fe7b0cd899966a507501e58cde934 Signed-off-by: Mohsin Kazmi <sykazmi@cisco.com> (cherry picked from commit 1017a1d360cc1c38e2aee4b5f19ff1f2869a8cd9)
Diffstat (limited to 'src/vnet/devices/virtio/device.c')
-rw-r--r--src/vnet/devices/virtio/device.c28
1 files changed, 21 insertions, 7 deletions
diff --git a/src/vnet/devices/virtio/device.c b/src/vnet/devices/virtio/device.c
index 56c0a98491e..7fa4dde4ea3 100644
--- a/src/vnet/devices/virtio/device.c
+++ b/src/vnet/devices/virtio/device.c
@@ -719,24 +719,38 @@ virtio_interface_rx_mode_change (vnet_main_t * vnm, u32 hw_if_index, u32 qid,
virtio_main_t *mm = &virtio_main;
vnet_hw_interface_t *hw = vnet_get_hw_interface (vnm, hw_if_index);
virtio_if_t *vif = pool_elt_at_index (mm->interfaces, hw->dev_instance);
- virtio_vring_t *vring = vec_elt_at_index (vif->rxq_vrings, qid);
+ virtio_vring_t *rx_vring = vec_elt_at_index (vif->rxq_vrings, qid);
+ virtio_vring_t *tx_vring = 0;
if (vif->type == VIRTIO_IF_TYPE_PCI && !(vif->support_int_mode))
{
- vring->avail->flags |= VRING_AVAIL_F_NO_INTERRUPT;
+ rx_vring->avail->flags |= VRING_AVAIL_F_NO_INTERRUPT;
return clib_error_return (0, "interrupt mode is not supported");
}
if (mode == VNET_HW_INTERFACE_RX_MODE_POLLING)
{
- /* only enable packet coalesce in poll mode */
- gro_flow_table_set_is_enable (vring->flow_table, 1);
- vring->avail->flags |= VRING_AVAIL_F_NO_INTERRUPT;
+ vec_foreach (tx_vring, vif->txq_vrings)
+ {
+ /* only enable packet coalesce in poll mode */
+ gro_flow_table_set_is_enable (tx_vring->flow_table, 1);
+ }
+ rx_vring->avail->flags |= VRING_AVAIL_F_NO_INTERRUPT;
}
else
{
- gro_flow_table_set_is_enable (vring->flow_table, 0);
- vring->avail->flags &= ~VRING_AVAIL_F_NO_INTERRUPT;
+ if (vif->packet_coalesce)
+ {
+ virtio_log_warning (vif,
+ "interface %U is in interrupt mode, disabling packet coalescing",
+ format_vnet_sw_if_index_name, vnet_get_main (),
+ vif->sw_if_index);
+ vec_foreach (tx_vring, vif->txq_vrings)
+ {
+ gro_flow_table_set_is_enable (tx_vring->flow_table, 0);
+ }
+ }
+ rx_vring->avail->flags &= ~VRING_AVAIL_F_NO_INTERRUPT;
}
return 0;