[v2] net/virtio: fix check scatter on all Rx queues

Message ID 20211008054945.368548-1-zhihongx.peng@intel.com (mailing list archive)
State Accepted, archived
Delegated to: Maxime Coquelin
Headers
Series [v2] net/virtio: fix check scatter on all Rx queues |

Checks

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

Commit Message

Peng, ZhihongX Oct. 8, 2021, 5:49 a.m. UTC
  From: Zhihong Peng <zhihongx.peng@intel.com>

This patch fixes the wrong way to obtain virtqueue.
The end of virtqueue cannot be judged based on whether
the array is NULL.

Fixes: 4e8169eb0d2d (net/virtio: fix Rx scatter offload)
Cc: stable@dpdk.org

Signed-off-by: Zhihong Peng <zhihongx.peng@intel.com>
---
 drivers/net/virtio/virtio_ethdev.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
  

Comments

Peng, ZhihongX Oct. 11, 2021, 2:22 a.m. UTC | #1
> -----Original Message-----
> From: Peng, ZhihongX <zhihongx.peng@intel.com>
> Sent: Friday, October 8, 2021 1:50 PM
> To: Xia, Chenbo <chenbo.xia@intel.com>; maxime.coquelin@redhat.com
> Cc: dev@dpdk.org; ivan.ilchenko@oktetlabs.ru; Peng, ZhihongX
> <zhihongx.peng@intel.com>; stable@dpdk.org
> Subject: [PATCH v2] net/virtio: fix check scatter on all Rx queues
> 
> From: Zhihong Peng <zhihongx.peng@intel.com>
> 
> This patch fixes the wrong way to obtain virtqueue.
> The end of virtqueue cannot be judged based on whether the array is NULL.
> 
> Fixes: 4e8169eb0d2d (net/virtio: fix Rx scatter offload)
> Cc: stable@dpdk.org
> 
> Signed-off-by: Zhihong Peng <zhihongx.peng@intel.com>
> ---
>  drivers/net/virtio/virtio_ethdev.c | 7 +++++--
>  1 file changed, 5 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/virtio/virtio_ethdev.c
> b/drivers/net/virtio/virtio_ethdev.c
> index b60eeb24ab..213110cff4 100644
> --- a/drivers/net/virtio/virtio_ethdev.c
> +++ b/drivers/net/virtio/virtio_ethdev.c
> @@ -888,8 +888,11 @@ virtio_check_scatter_on_all_rx_queues(struct
> rte_eth_dev *dev,
>  	if (hw->vqs == NULL)
>  		return true;
> 
> -	for (qidx = 0; (vq = hw->vqs[2 * qidx +
> VTNET_SQ_RQ_QUEUE_IDX]) != NULL;
> -	     qidx++) {
> +	for (qidx = 0; qidx < hw->max_queue_pairs; qidx++) {
> +		vq = hw->vqs[2 * qidx + VTNET_SQ_RQ_QUEUE_IDX];
> +		if (vq == NULL)
> +			continue;
> +
>  		rxvq = &vq->rxq;
>  		if (rxvq->mpool == NULL)
>  			continue;
> --
> 2.25.1

Hi Maxime,
Can you give me an ack?
  
Peng, ZhihongX Oct. 11, 2021, 2:25 a.m. UTC | #2
> -----Original Message-----
> From: Peng, ZhihongX <zhihongx.peng@intel.com>
> Sent: Friday, October 8, 2021 1:50 PM
> To: Xia, Chenbo <chenbo.xia@intel.com>; maxime.coquelin@redhat.com
> Cc: dev@dpdk.org; ivan.ilchenko@oktetlabs.ru; Peng, ZhihongX
> <zhihongx.peng@intel.com>; stable@dpdk.org
> Subject: [PATCH v2] net/virtio: fix check scatter on all Rx queues
> 
> From: Zhihong Peng <zhihongx.peng@intel.com>
> 
> This patch fixes the wrong way to obtain virtqueue.
> The end of virtqueue cannot be judged based on whether the array is NULL.
> 
> Fixes: 4e8169eb0d2d (net/virtio: fix Rx scatter offload)
> Cc: stable@dpdk.org
> 
> Signed-off-by: Zhihong Peng <zhihongx.peng@intel.com>
> ---
>  drivers/net/virtio/virtio_ethdev.c | 7 +++++--
>  1 file changed, 5 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/virtio/virtio_ethdev.c
> b/drivers/net/virtio/virtio_ethdev.c
> index b60eeb24ab..213110cff4 100644
> --- a/drivers/net/virtio/virtio_ethdev.c
> +++ b/drivers/net/virtio/virtio_ethdev.c
> @@ -888,8 +888,11 @@ virtio_check_scatter_on_all_rx_queues(struct
> rte_eth_dev *dev,
>  	if (hw->vqs == NULL)
>  		return true;
> 
> -	for (qidx = 0; (vq = hw->vqs[2 * qidx +
> VTNET_SQ_RQ_QUEUE_IDX]) != NULL;
> -	     qidx++) {
> +	for (qidx = 0; qidx < hw->max_queue_pairs; qidx++) {
> +		vq = hw->vqs[2 * qidx + VTNET_SQ_RQ_QUEUE_IDX];
> +		if (vq == NULL)
> +			continue;
> +
>  		rxvq = &vq->rxq;
>  		if (rxvq->mpool == NULL)
>  			continue;
> --
> 2.25.1

Tested-by: Zhihong Peng <zhihongx.peng@intel.com>
  
Maxime Coquelin Oct. 12, 2021, 7:44 a.m. UTC | #3
On 10/8/21 07:49, zhihongx.peng@intel.com wrote:
> From: Zhihong Peng <zhihongx.peng@intel.com>
> 
> This patch fixes the wrong way to obtain virtqueue.
> The end of virtqueue cannot be judged based on whether
> the array is NULL.
> 
> Fixes: 4e8169eb0d2d (net/virtio: fix Rx scatter offload)
> Cc: stable@dpdk.org
> 
> Signed-off-by: Zhihong Peng <zhihongx.peng@intel.com>
> ---
>   drivers/net/virtio/virtio_ethdev.c | 7 +++++--
>   1 file changed, 5 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c
> index b60eeb24ab..213110cff4 100644
> --- a/drivers/net/virtio/virtio_ethdev.c
> +++ b/drivers/net/virtio/virtio_ethdev.c
> @@ -888,8 +888,11 @@ virtio_check_scatter_on_all_rx_queues(struct rte_eth_dev *dev,
>   	if (hw->vqs == NULL)
>   		return true;
>   
> -	for (qidx = 0; (vq = hw->vqs[2 * qidx + VTNET_SQ_RQ_QUEUE_IDX]) != NULL;
> -	     qidx++) {
> +	for (qidx = 0; qidx < hw->max_queue_pairs; qidx++) {
> +		vq = hw->vqs[2 * qidx + VTNET_SQ_RQ_QUEUE_IDX];
> +		if (vq == NULL)
> +			continue;
> +
>   		rxvq = &vq->rxq;
>   		if (rxvq->mpool == NULL)
>   			continue;
> 

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

Thanks,
Maxime
  
Maxime Coquelin Oct. 21, 2021, 12:26 p.m. UTC | #4
On 10/8/21 07:49, zhihongx.peng@intel.com wrote:
> From: Zhihong Peng <zhihongx.peng@intel.com>
> 
> This patch fixes the wrong way to obtain virtqueue.
> The end of virtqueue cannot be judged based on whether
> the array is NULL.
> 
> Fixes: 4e8169eb0d2d (net/virtio: fix Rx scatter offload)
> Cc: stable@dpdk.org
> 
> Signed-off-by: Zhihong Peng <zhihongx.peng@intel.com>
> ---
>   drivers/net/virtio/virtio_ethdev.c | 7 +++++--
>   1 file changed, 5 insertions(+), 2 deletions(-)
> 

Applied to dpdk-next-virtio/main.

Thanks,
Maxime
  

Patch

diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c
index b60eeb24ab..213110cff4 100644
--- a/drivers/net/virtio/virtio_ethdev.c
+++ b/drivers/net/virtio/virtio_ethdev.c
@@ -888,8 +888,11 @@  virtio_check_scatter_on_all_rx_queues(struct rte_eth_dev *dev,
 	if (hw->vqs == NULL)
 		return true;
 
-	for (qidx = 0; (vq = hw->vqs[2 * qidx + VTNET_SQ_RQ_QUEUE_IDX]) != NULL;
-	     qidx++) {
+	for (qidx = 0; qidx < hw->max_queue_pairs; qidx++) {
+		vq = hw->vqs[2 * qidx + VTNET_SQ_RQ_QUEUE_IDX];
+		if (vq == NULL)
+			continue;
+
 		rxvq = &vq->rxq;
 		if (rxvq->mpool == NULL)
 			continue;