Skip to contentSkip to conversation

vhost: fix external buffer in VDUSE

PATCH Applied David Marchand 2 participants 3 messages Oct 28, 2025 – Nov 3, 2025

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 vhost: fix external buffer in VDUSE

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")
---
 lib/vhost/socket.c | 3 ++-
 lib/vhost/vduse.c  | 8 +++++++-
 lib/vhost/vduse.h  | 2 +-
 3 files changed, 10 insertions(+), 3 deletions(-)
lib/vhost/socket.c +2 -1
index 9b4f332f94..ae95e7e6b0 100644
@@ -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");
lib/vhost/vduse.c +7 -1
index 68e56843fd..897dee9f1b 100644
@@ -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;
lib/vhost/vduse.h +1 -1
index 47ca97a064..b2515bb9df 100644
@@ -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 */
Signature · 1 line
2.51.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 13 lines · David Marchand

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")
Quoted 7 lines
---
 lib/vhost/socket.c | 3 ++-
 lib/vhost/vduse.c  | 8 +++++++-
 lib/vhost/vduse.h  | 2 +-
 3 files changed, 10 insertions(+), 3 deletions(-)

Thanks for working on this!

Maxime

#2 lore raw
In reply to David Marchand
Quoted 13 lines · David Marchand

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")
Quoted 7 lines
---
 lib/vhost/socket.c | 3 ++-
 lib/vhost/vduse.c  | 8 +++++++-
 lib/vhost/vduse.h  | 2 +-
 3 files changed, 10 insertions(+), 3 deletions(-)

Applied to next-virtio/for-net-next.

Thanks,
Maxime