[PATCH] vhost: fix external buffer in VDUSE

David Marchand david.marchand at redhat.com
Tue Oct 28 13:34:53 CET 2025


extbuf and linearbuf features are required for (enhanced) TSO support
in OVS.

VDUSE ports were generating multi-segments mbufs in case of "TSO"
buffers which resulted in OVS generating wrong packets after tunnel
encapsulation.

Enable the missing datapath features.

Fixes: 0adb8eccc6a6 ("vhost: add VDUSE device creation and destruction")
Cc: stable at dpdk.org

Signed-off-by: David Marchand <david.marchand at redhat.com>
---
 lib/vhost/socket.c | 3 ++-
 lib/vhost/vduse.c  | 8 +++++++-
 lib/vhost/vduse.h  | 2 +-
 3 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/lib/vhost/socket.c b/lib/vhost/socket.c
index 9b4f332f94..ae95e7e6b0 100644
--- a/lib/vhost/socket.c
+++ b/lib/vhost/socket.c
@@ -1194,7 +1194,8 @@ rte_vhost_driver_start(const char *path)
 		return -1;
 
 	if (vsocket->is_vduse)
-		return vduse_device_create(path, vsocket->net_compliant_ol_flags);
+		return vduse_device_create(path, vsocket->net_compliant_ol_flags,
+			vsocket->extbuf, vsocket->linearbuf);
 
 	if (vhost_user.fdset == NULL) {
 		vhost_user.fdset = fdset_init("vhost-evt");
diff --git a/lib/vhost/vduse.c b/lib/vhost/vduse.c
index 68e56843fd..897dee9f1b 100644
--- a/lib/vhost/vduse.c
+++ b/lib/vhost/vduse.c
@@ -672,7 +672,7 @@ vduse_reconnect_start_device(struct virtio_net *dev)
 }
 
 int
-vduse_device_create(const char *path, bool compliant_ol_flags)
+vduse_device_create(const char *path, bool compliant_ol_flags, bool extbuf, bool linearbuf)
 {
 	int control_fd, dev_fd, vid, ret;
 	uint32_t i, max_queue_pairs, total_queues;
@@ -817,6 +817,12 @@ vduse_device_create(const char *path, bool compliant_ol_flags)
 
 	vhost_setup_virtio_net(dev->vid, true, compliant_ol_flags, true, true);
 
+	if (extbuf)
+		vhost_enable_extbuf(dev->vid);
+
+	if (linearbuf)
+		vhost_enable_linearbuf(dev->vid);
+
 	for (i = 0; i < total_queues; i++) {
 		struct vduse_vq_config vq_cfg = { 0 };
 		struct vhost_virtqueue *vq;
diff --git a/lib/vhost/vduse.h b/lib/vhost/vduse.h
index 47ca97a064..b2515bb9df 100644
--- a/lib/vhost/vduse.h
+++ b/lib/vhost/vduse.h
@@ -9,7 +9,7 @@
 
 #define VDUSE_NET_SUPPORTED_FEATURES VIRTIO_NET_SUPPORTED_FEATURES
 
-int vduse_device_create(const char *path, bool compliant_ol_flags);
+int vduse_device_create(const char *path, bool compliant_ol_flags, bool extbuf, bool linearbuf);
 int vduse_device_destroy(const char *path);
 
 #endif /* _VDUSE_H */
-- 
2.51.0



More information about the stable mailing list