vhost: fix net header settings in vhost datapath

Message ID 20230104023945.6669-1-wenwux.ma@intel.com (mailing list archive)
State Accepted, archived
Delegated to: Maxime Coquelin
Headers
Series vhost: fix net header settings in vhost datapath |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK
ci/iol-broadcom-Performance success Performance Testing PASS
ci/intel-Testing success Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/loongarch-compilation success Compilation OK
ci/iol-intel-Functional success Functional Testing PASS
ci/loongarch-unit-testing success Unit Testing PASS
ci/github-robot: build success github build: passed
ci/iol-aarch64-unit-testing success Testing PASS
ci/iol-testing success Testing PASS
ci/iol-x86_64-unit-testing success Testing PASS
ci/iol-abi-testing success Testing PASS
ci/iol-x86_64-compile-testing success Testing PASS
ci/iol-aarch64-compile-testing success Testing PASS

Commit Message

Ma, WenwuX Jan. 4, 2023, 2:39 a.m. UTC
  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@dpdk.org

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

Comments

Ling, WeiX Jan. 13, 2023, 3:06 a.m. UTC | #1
> -----Original Message-----
> From: Wenwu Ma <wenwux.ma@intel.com>
> Sent: Wednesday, January 4, 2023 10:40 AM
> To: dev@dpdk.org
> Cc: Ma, WenwuX <wenwux.ma@intel.com>; stable@dpdk.org
> 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")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Wenwu Ma <wenwux.ma@intel.com>
> ---

Tested-by: Wei Ling <weix.ling@intel.com>
  
Jiang, Cheng1 Jan. 13, 2023, 3:16 a.m. UTC | #2
Hi Wenwu,

> -----Original Message-----
> From: Wenwu Ma <wenwux.ma@intel.com>
> Sent: Wednesday, January 4, 2023 10:40 AM
> To: dev@dpdk.org
> Cc: Ma, WenwuX <wenwux.ma@intel.com>; stable@dpdk.org
> 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")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Wenwu Ma <wenwux.ma@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

Acked-by: Cheng Jiang <cheng1.jiang@intel.com>

Thanks,
Cheng
  
Maxime Coquelin Feb. 3, 2023, 2:43 p.m. UTC | #3
On 1/4/23 03:39, Wenwu Ma wrote:
> 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@dpdk.org
> 
> Signed-off-by: Wenwu Ma <wenwux.ma@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);
>   

Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>

Thanks,
Maxime
  
Maxime Coquelin Feb. 3, 2023, 2:58 p.m. UTC | #4
On 1/4/23 03:39, Wenwu Ma wrote:
> 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@dpdk.org
> 
> Signed-off-by: Wenwu Ma <wenwux.ma@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);
>   

Applied to dpdk-next-virtio/main.

Thanks,
Maxime
  

Patch

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);