Skip to contentSkip to conversation

vhost: fix net header settings in vhost datapath

PATCH Applied Wenwu Ma 4 participants 5 messages Jan 4, 2023 – Feb 3, 2023

lore
Share & tools
lore

Wenwu Ma

author
#0 lore raw

PATCH 1/1 vhost: fix net header settings in vhost datapath

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")
---
 lib/vhost/virtio_net.c | 6 ++++++
 1 file changed, 6 insertions(+)
lib/vhost/virtio_net.c +6 -0
index cf796183a0..61d9052a57 100644
@@ -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);
 
Signature · 1 line
2.25.1
Tested-by on v1 1/1
#1 lore raw
Quoted 11 lines

-----Original Message-----
From: Wenwu Ma <[email protected]>
Sent: Wednesday, January 4, 2023 10:40 AM
To: [email protected]
Cc: Ma, WenwuX <[email protected]>; [email protected]
Subject: [PATCH] vhost: fix net header settings in vhost datapath

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.

Quoted 5 lines
Fixes ef861692c398 ("vhost: add packed ring batch enqueue")

---

Acked-by on v1 1/1
#2 lore raw
In reply to Wenwu Ma

Hi Wenwu,

Quoted 38 lines

-----Original Message-----
From: Wenwu Ma <[email protected]>
Sent: Wednesday, January 4, 2023 10:40 AM
To: [email protected]
Cc: Ma, WenwuX <[email protected]>; [email protected]
Subject: [PATCH] vhost: fix net header settings in vhost datapath

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")
---
 lib/vhost/virtio_net.c | 6 ++++++
 1 file changed, 6 insertions(+)
lib/vhost/virtio_net.c index renamed from lib/vhost/virtio_net.c +0 -0

cf796183a0..61d9052a57 100644

lib/vhost/virtio_net.c +6 -1
@@ -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);
 
--
Quoted 1 line

2.25.1

Thanks,
Cheng

Reviewed-by on v1 1/1
#3 lore raw
In reply to Wenwu Ma
Quoted 20 lines · Wenwu Ma

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")
---
  lib/vhost/virtio_net.c | 6 ++++++
  1 file changed, 6 insertions(+)
lib/vhost/virtio_net.c +0 -0
index cf796183a0..61d9052a57 100644
@@ -1493,6 +1493,12 @@ virtio_dev_rx_batch_packed_copy(struct virtio_net *dev,
  			sizeof(struct virtio_net_hdr_mrg_rxbuf);
  	}

lib/vhost/virtio_net.c virtio_dev_rx_batch_packed_copy(struct virtio_net *dev, · line 1504

Quoted 10 lines
lib/vhost/virtio_net.c +6 -0
 
+	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);
 

Thanks,
Maxime

#4 lore raw
In reply to Wenwu Ma
Quoted 20 lines · Wenwu Ma

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")
---
  lib/vhost/virtio_net.c | 6 ++++++
  1 file changed, 6 insertions(+)
lib/vhost/virtio_net.c +0 -0
index cf796183a0..61d9052a57 100644
@@ -1493,6 +1493,12 @@ virtio_dev_rx_batch_packed_copy(struct virtio_net *dev,
  			sizeof(struct virtio_net_hdr_mrg_rxbuf);
  	}

lib/vhost/virtio_net.c virtio_dev_rx_batch_packed_copy(struct virtio_net *dev, · line 1504

Quoted 10 lines
lib/vhost/virtio_net.c +6 -0
 
+	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);
 

Applied to dpdk-next-virtio/main.

Thanks,
Maxime