summaryrefslogtreecommitdiffstats
path: root/src/vnet/devices/virtio/virtio.c
diff options
context:
space:
mode:
authorMohsin Kazmi <sykazmi@cisco.com>2021-04-28 18:55:45 +0200
committerBeno�t Ganne <bganne@cisco.com>2021-05-04 16:48:11 +0000
commit6799f9b45379a8188bf418c61fe0e0aed5c14f01 (patch)
tree4126cb0f07f9f3ca0fa9592bc640b63b91e5b24b /src/vnet/devices/virtio/virtio.c
parentdb023809043f1dc64ed8c30dd5a575763df6045b (diff)
virtio: fix the interrupt
Type: fix virtio/tap interfaces set the empty buffers in the input node for receiving data. Backend uses those buffers, fills them with data and notifies the virtio/tap driver. But virtio/tap driver gets into stall state if interface is created and configured through exec script on VPP startup.conf and put the interface in interrupt mode while VPP is only configured with main thread. This patch fixes the problem by prefilling buffers during the interface creation. Change-Id: Ibc4d0e70e127ccc4b7cf8b2b18406ae4b02c73b4 Signed-off-by: Mohsin Kazmi <sykazmi@cisco.com>
Diffstat (limited to 'src/vnet/devices/virtio/virtio.c')
-rw-r--r--src/vnet/devices/virtio/virtio.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/vnet/devices/virtio/virtio.c b/src/vnet/devices/virtio/virtio.c
index 4f812b1e7aa..b8054d13e5b 100644
--- a/src/vnet/devices/virtio/virtio.c
+++ b/src/vnet/devices/virtio/virtio.c
@@ -30,6 +30,7 @@
#include <vnet/ip/ip4_packet.h>
#include <vnet/ip/ip6_packet.h>
#include <vnet/devices/virtio/virtio.h>
+#include <vnet/devices/virtio/virtio_inline.h>
#include <vnet/devices/virtio/pci.h>
#include <vnet/interface/rx_queue_funcs.h>
@@ -220,6 +221,19 @@ virtio_set_packet_buffering (virtio_if_t * vif, u16 buffering_size)
return error;
}
+static void
+virtio_vring_fill (vlib_main_t *vm, virtio_if_t *vif, virtio_vring_t *vring)
+{
+ if (vif->is_packed)
+ virtio_refill_vring_packed (vm, vif, vif->type, vring,
+ vif->virtio_net_hdr_sz,
+ virtio_input_node.index);
+ else
+ virtio_refill_vring_split (vm, vif, vif->type, vring,
+ vif->virtio_net_hdr_sz,
+ virtio_input_node.index);
+}
+
void
virtio_vring_set_rx_queues (vlib_main_t *vm, virtio_if_t *vif)
{
@@ -262,6 +276,10 @@ virtio_vring_set_rx_queues (vlib_main_t *vm, virtio_if_t *vif)
file_index);
i++;
}
+ vnet_hw_if_set_rx_queue_mode (vnm, vring->queue_index,
+ VNET_HW_IF_RX_MODE_POLLING);
+ vring->mode = VNET_HW_IF_RX_MODE_POLLING;
+ virtio_vring_fill (vm, vif, vring);
}
vnet_hw_if_update_runtime_data (vnm, vif->hw_if_index);
}