[dpdk-dev] [PATCH] vhost: notify guest to fill buffer when there is no buffer

linhaifeng haifeng.lin at huawei.com
Thu Jan 29 11:30:04 CET 2015


From: Linhaifeng <haifeng.lin at huawei.com>

If we found there is no buffer we should notify virtio_net to
fill buffers.

We use mz send buffers from VM to VM,found that the other VM
stop to receive data after many hours.

Signed-off-by: Linhaifeng <haifeng.lin at huawei.com>
---
 lib/librte_vhost/vhost_rxtx.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/lib/librte_vhost/vhost_rxtx.c b/lib/librte_vhost/vhost_rxtx.c
index ccfd82f..013c526 100644
--- a/lib/librte_vhost/vhost_rxtx.c
+++ b/lib/librte_vhost/vhost_rxtx.c
@@ -87,9 +87,14 @@ virtio_dev_rx(struct virtio_net *dev, uint16_t queue_id,
 		/*check that we have enough buffers*/
 		if (unlikely(count > free_entries))
 			count = free_entries;
-
-		if (count == 0)
+		/* If there is no buffers we should notify guest to fill. 
+		* This is need when guest use virtio_net driver(not pmd).
+		*/
+		if (count == 0) {
+			if (!(vq->avail->flags & VRING_AVAIL_F_NO_INTERRUPT))
+				eventfd_write((int)vq->kickfd, 1);	
 			return 0;
+		}
 
 		res_end_idx = res_base_idx + count;
 		/* vq->last_used_idx_res is atomically updated. */
-- 
1.9.0




More information about the dev mailing list