[PATCH] vhost: fix net header settings in vhost datapath

Wenwu Ma wenwux.ma at intel.com
Wed Jan 4 03:31:15 CET 2023


In vhost sync batch enqueue, the "num_buffers" of
virtio net header is not be set, but it should be
set to 1 if the mrg_rxbuf feature is turned on,
This patch fix the issue.

Fixes: ef861692c398 ("vhost: add packed ring batch enqueue")
Cc: stable at dpdk.org

Signed-off-by: Wenwu Ma <wenwux.ma at intel.com>
---
 lib/vhost/virtio_net.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/lib/vhost/virtio_net.c b/lib/vhost/virtio_net.c
index cf796183a0..61d9052a57 100644
--- a/lib/vhost/virtio_net.c
+++ b/lib/vhost/virtio_net.c
@@ -1493,6 +1493,12 @@ virtio_dev_rx_batch_packed_copy(struct virtio_net *dev,
 			sizeof(struct virtio_net_hdr_mrg_rxbuf);
 	}
 
+	if (rxvq_is_mergeable(dev)) {
+		vhost_for_each_try_unroll(i, 0, PACKED_BATCH_SIZE) {
+			ASSIGN_UNLESS_EQUAL(hdrs[i]->num_buffers, 1);
+		}
+	}
+
 	vhost_for_each_try_unroll(i, 0, PACKED_BATCH_SIZE)
 		virtio_enqueue_offload(pkts[i], &hdrs[i]->hdr);
 
-- 
2.25.1



More information about the stable mailing list