virtio: add packet buffering on tx
Type: feature
This patch adds packet buffering on tx for
slow backend which have some jitter/delays
in freeing the vrings.
There are some limitations to the current design:
1) It only works in poll mode.
2) Atleast 1 rx queue of an interface (with buffering
enabled) should be placed on each worker and main thread.
Signed-off-by: Mohsin Kazmi <sykazmi@cisco.com>
Change-Id: Ib93c350298b228e80426e58ac77f3bbc93b8be27
diff --git a/src/vnet/devices/virtio/pci.c b/src/vnet/devices/virtio/pci.c
index df8e2bd..71d813a 100644
--- a/src/vnet/devices/virtio/pci.c
+++ b/src/vnet/devices/virtio/pci.c
@@ -1154,6 +1154,19 @@
vnet_hw_interface_t *hw = vnet_get_hw_interface (vnm, vif->hw_if_index);
hw->flags |= VNET_HW_INTERFACE_FLAG_SUPPORTS_INT_MODE;
+
+ if (args->virtio_flags & VIRTIO_FLAG_BUFFERING)
+ {
+ error = virtio_set_packet_buffering (vif, args->buffering_size);
+ if (error)
+ {
+ args->rv = VNET_API_ERROR_INIT_FAILED;
+ virtio_log_error (vif,
+ "error encountered during packet buffering init");
+ goto error;
+ }
+ }
+
vnet_hw_interface_set_input_node (vnm, vif->hw_if_index,
virtio_input_node.index);
u32 i = 0;