net/mlx5: fix Rx queue release assertions

Message ID 1574241676-14807-1-git-send-email-matan@mellanox.com (mailing list archive)
State Accepted, archived
Delegated to: Raslan Darawsheh
Headers
Series net/mlx5: fix Rx queue release assertions |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-compilation success Compile Testing PASS
ci/iol-mellanox-Performance success Performance Testing PASS
ci/travis-robot success Travis build: passed
ci/Intel-compilation fail apply issues

Commit Message

Matan Azrad Nov. 20, 2019, 9:21 a.m. UTC
  In debug mode, there is assertion to validate the CQ object before the
release.

Wrongly, the assertion is done for any type of RX queue even if it
doesn't use CQ at all, for example in hairpin Rx queue.

Ignore CQ assertion when hairpin queue is released.

Fixes: e79c9be91515 ("net/mlx5: support Rx hairpin queues")
Cc: orika@mellanox.com

Signed-off-by: Matan Azrad <matan@mellanox.com>
---
 drivers/net/mlx5/mlx5_rxq.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
  

Comments

Ori Kam Nov. 20, 2019, 10:53 a.m. UTC | #1
> -----Original Message-----
> From: dev <dev-bounces@dpdk.org> On Behalf Of Matan Azrad
> Sent: Wednesday, November 20, 2019 11:21 AM
> To: dev@dpdk.org
> Cc: Slava Ovsiienko <viacheslavo@mellanox.com>; Ori Kam
> <orika@mellanox.com>
> Subject: [dpdk-dev] [PATCH] net/mlx5: fix Rx queue release assertions
> 
> In debug mode, there is assertion to validate the CQ object before the
> release.
> 
> Wrongly, the assertion is done for any type of RX queue even if it
> doesn't use CQ at all, for example in hairpin Rx queue.
> 
> Ignore CQ assertion when hairpin queue is released.
> 
> Fixes: e79c9be91515 ("net/mlx5: support Rx hairpin queues")
> Cc: orika@mellanox.com
> 
> Signed-off-by: Matan Azrad <matan@mellanox.com>
> ---

Acked-by: Ori Kam <orika@mellanox.com>
Thanks,
Ori
  
Raslan Darawsheh Nov. 20, 2019, 2:25 p.m. UTC | #2
Hi,

> -----Original Message-----
> From: dev <dev-bounces@dpdk.org> On Behalf Of Matan Azrad
> Sent: Wednesday, November 20, 2019 11:21 AM
> To: dev@dpdk.org
> Cc: Slava Ovsiienko <viacheslavo@mellanox.com>; Ori Kam
> <orika@mellanox.com>
> Subject: [dpdk-dev] [PATCH] net/mlx5: fix Rx queue release assertions
> 
> In debug mode, there is assertion to validate the CQ object before the
> release.
> 
> Wrongly, the assertion is done for any type of RX queue even if it
> doesn't use CQ at all, for example in hairpin Rx queue.
> 
> Ignore CQ assertion when hairpin queue is released.
> 
> Fixes: e79c9be91515 ("net/mlx5: support Rx hairpin queues")
> Cc: orika@mellanox.com
> 
> Signed-off-by: Matan Azrad <matan@mellanox.com>
> ---
>  drivers/net/mlx5/mlx5_rxq.c | 8 +++++---
>  1 file changed, 5 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/net/mlx5/mlx5_rxq.c b/drivers/net/mlx5/mlx5_rxq.c
> index 2a12d5f..986ec01 100644
> --- a/drivers/net/mlx5/mlx5_rxq.c
> +++ b/drivers/net/mlx5/mlx5_rxq.c
> @@ -671,23 +671,25 @@
>  mlx5_rxq_obj_release(struct mlx5_rxq_obj *rxq_obj)
>  {
>  	assert(rxq_obj);
> -	if (rxq_obj->type == MLX5_RXQ_OBJ_TYPE_IBV)
> -		assert(rxq_obj->wq);
> -	assert(rxq_obj->cq);
>  	if (rte_atomic32_dec_and_test(&rxq_obj->refcnt)) {
>  		switch (rxq_obj->type) {
>  		case MLX5_RXQ_OBJ_TYPE_IBV:
> +			assert(rxq_obj->wq);
> +			assert(rxq_obj->cq);
>  			rxq_free_elts(rxq_obj->rxq_ctrl);
>  			claim_zero(mlx5_glue->destroy_wq(rxq_obj->wq));
>  			claim_zero(mlx5_glue->destroy_cq(rxq_obj->cq));
>  			break;
>  		case MLX5_RXQ_OBJ_TYPE_DEVX_RQ:
> +			assert(rxq_obj->cq);
> +			assert(rxq_obj->rq);
>  			rxq_free_elts(rxq_obj->rxq_ctrl);
>  			claim_zero(mlx5_devx_cmd_destroy(rxq_obj->rq));
>  			rxq_release_rq_resources(rxq_obj->rxq_ctrl);
>  			claim_zero(mlx5_glue->destroy_cq(rxq_obj->cq));
>  			break;
>  		case MLX5_RXQ_OBJ_TYPE_DEVX_HAIRPIN:
> +			assert(rxq_obj->rq);
>  			rxq_obj_hairpin_release(rxq_obj);
>  			break;
>  		}
> --
> 1.8.3.1


Patch applied to next-net-mlx,

Kindest regards,
Raslan Darawsheh
  

Patch

diff --git a/drivers/net/mlx5/mlx5_rxq.c b/drivers/net/mlx5/mlx5_rxq.c
index 2a12d5f..986ec01 100644
--- a/drivers/net/mlx5/mlx5_rxq.c
+++ b/drivers/net/mlx5/mlx5_rxq.c
@@ -671,23 +671,25 @@ 
 mlx5_rxq_obj_release(struct mlx5_rxq_obj *rxq_obj)
 {
 	assert(rxq_obj);
-	if (rxq_obj->type == MLX5_RXQ_OBJ_TYPE_IBV)
-		assert(rxq_obj->wq);
-	assert(rxq_obj->cq);
 	if (rte_atomic32_dec_and_test(&rxq_obj->refcnt)) {
 		switch (rxq_obj->type) {
 		case MLX5_RXQ_OBJ_TYPE_IBV:
+			assert(rxq_obj->wq);
+			assert(rxq_obj->cq);
 			rxq_free_elts(rxq_obj->rxq_ctrl);
 			claim_zero(mlx5_glue->destroy_wq(rxq_obj->wq));
 			claim_zero(mlx5_glue->destroy_cq(rxq_obj->cq));
 			break;
 		case MLX5_RXQ_OBJ_TYPE_DEVX_RQ:
+			assert(rxq_obj->cq);
+			assert(rxq_obj->rq);
 			rxq_free_elts(rxq_obj->rxq_ctrl);
 			claim_zero(mlx5_devx_cmd_destroy(rxq_obj->rq));
 			rxq_release_rq_resources(rxq_obj->rxq_ctrl);
 			claim_zero(mlx5_glue->destroy_cq(rxq_obj->cq));
 			break;
 		case MLX5_RXQ_OBJ_TYPE_DEVX_HAIRPIN:
+			assert(rxq_obj->rq);
 			rxq_obj_hairpin_release(rxq_obj);
 			break;
 		}