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/node.c b/src/vnet/devices/virtio/node.c
index 1c9cfd0..42b2590 100644
--- a/src/vnet/devices/virtio/node.c
+++ b/src/vnet/devices/virtio/node.c
@@ -279,11 +279,14 @@
   u16 last = vring->last_used_idx;
   u16 n_left = vring->used->idx - last;
 
-  if (vif->packet_coalesce
-      && clib_spinlock_trylock_if_init (&txq_vring->lockp))
+  if (clib_spinlock_trylock_if_init (&txq_vring->lockp))
     {
-      vnet_gro_flow_table_schedule_node_on_dispatcher (vm,
-						       txq_vring->flow_table);
+      if (vif->packet_coalesce)
+	vnet_gro_flow_table_schedule_node_on_dispatcher (vm,
+							 txq_vring->flow_table);
+      else if (vif->packet_buffering)
+	virtio_vring_buffering_schedule_node_on_dispatcher (vm,
+							    txq_vring->buffering);
       clib_spinlock_unlock_if_init (&txq_vring->lockp);
     }