DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] net/mlx5: fix CQ interrupt handling and cleanup
@ 2020-07-27  8:50 Dekel Peled
  2020-07-27 13:42 ` Raslan Darawsheh
  0 siblings, 1 reply; 2+ messages in thread
From: Dekel Peled @ 2020-07-27  8:50 UTC (permalink / raw)
  To: matan, viacheslavo, rasland; +Cc: dev

Recent patch added creation of Rx CQ using DevX API.
The reading of events from DevX channel was not done correctly.
This patch fixes the event reading, using the correct data structure.
Cleanup after CQ creation, in case of error, is also updated.

Fixes: 08d1838f645a ("net/mlx5: implement CQ for Rx using DevX API")

Signed-off-by: Dekel Peled <dekelp@mellanox.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
---
 drivers/net/mlx5/mlx5_rxq.c | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/drivers/net/mlx5/mlx5_rxq.c b/drivers/net/mlx5/mlx5_rxq.c
index c78e522..79eb8f8 100644
--- a/drivers/net/mlx5/mlx5_rxq.c
+++ b/drivers/net/mlx5/mlx5_rxq.c
@@ -1193,12 +1193,16 @@
 		mlx5_glue->ack_cq_events(rxq_obj->ibv_cq, 1);
 	} else if (rxq_obj->type == MLX5_RXQ_OBJ_TYPE_DEVX_RQ) {
 #ifdef HAVE_IBV_DEVX_EVENT
-		struct mlx5dv_devx_async_event_hdr *event_data = NULL;
+		union {
+			struct mlx5dv_devx_async_event_hdr event_resp;
+			uint8_t buf[sizeof(struct mlx5dv_devx_async_event_hdr)
+				    + 128];
+		} out;
 
 		ret = mlx5_glue->devx_get_event
-				(rxq_obj->devx_channel, event_data,
-				 sizeof(struct mlx5dv_devx_async_event_hdr));
-		if (ret < 0 || event_data->cookie !=
+				(rxq_obj->devx_channel, &out.event_resp,
+				 sizeof(out.buf));
+		if (ret < 0 || out.event_resp.cookie !=
 				(uint64_t)(uintptr_t)rxq_obj->devx_cq)
 			goto exit;
 #endif /* HAVE_IBV_DEVX_EVENT */
@@ -1646,6 +1650,8 @@
 	memset((void *)(uintptr_t)rxq_data->cqes, 0xFF, cq_size);
 	return cq_obj;
 error:
+	if (cq_obj)
+		mlx5_devx_cmd_destroy(cq_obj);
 	rxq_release_devx_cq_resources(rxq_ctrl);
 	return NULL;
 }
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [dpdk-dev] [PATCH] net/mlx5: fix CQ interrupt handling and cleanup
  2020-07-27  8:50 [dpdk-dev] [PATCH] net/mlx5: fix CQ interrupt handling and cleanup Dekel Peled
@ 2020-07-27 13:42 ` Raslan Darawsheh
  0 siblings, 0 replies; 2+ messages in thread
From: Raslan Darawsheh @ 2020-07-27 13:42 UTC (permalink / raw)
  To: Dekel Peled, Matan Azrad, Slava Ovsiienko; +Cc: dev

Hi,

> -----Original Message-----
> From: Dekel Peled <dekelp@mellanox.com>
> Sent: Monday, July 27, 2020 11:51 AM
> To: Matan Azrad <matan@mellanox.com>; Slava Ovsiienko
> <viacheslavo@mellanox.com>; Raslan Darawsheh <rasland@mellanox.com>
> Cc: dev@dpdk.org
> Subject: [PATCH] net/mlx5: fix CQ interrupt handling and cleanup
> 
> Recent patch added creation of Rx CQ using DevX API.
> The reading of events from DevX channel was not done correctly.
> This patch fixes the event reading, using the correct data structure.
> Cleanup after CQ creation, in case of error, is also updated.
> 
> Fixes: 08d1838f645a ("net/mlx5: implement CQ for Rx using DevX API")
> 
> Signed-off-by: Dekel Peled <dekelp@mellanox.com>
> Acked-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
> ---
>  drivers/net/mlx5/mlx5_rxq.c | 14 ++++++++++----
>  1 file changed, 10 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/net/mlx5/mlx5_rxq.c b/drivers/net/mlx5/mlx5_rxq.c
> index c78e522..79eb8f8 100644
> --- a/drivers/net/mlx5/mlx5_rxq.c
> +++ b/drivers/net/mlx5/mlx5_rxq.c
> @@ -1193,12 +1193,16 @@
>  		mlx5_glue->ack_cq_events(rxq_obj->ibv_cq, 1);
>  	} else if (rxq_obj->type == MLX5_RXQ_OBJ_TYPE_DEVX_RQ) {
>  #ifdef HAVE_IBV_DEVX_EVENT
> -		struct mlx5dv_devx_async_event_hdr *event_data = NULL;
> +		union {
> +			struct mlx5dv_devx_async_event_hdr event_resp;
> +			uint8_t buf[sizeof(struct
> mlx5dv_devx_async_event_hdr)
> +				    + 128];
> +		} out;
> 
>  		ret = mlx5_glue->devx_get_event
> -				(rxq_obj->devx_channel, event_data,
> -				 sizeof(struct
> mlx5dv_devx_async_event_hdr));
> -		if (ret < 0 || event_data->cookie !=
> +				(rxq_obj->devx_channel, &out.event_resp,
> +				 sizeof(out.buf));
> +		if (ret < 0 || out.event_resp.cookie !=
>  				(uint64_t)(uintptr_t)rxq_obj->devx_cq)
>  			goto exit;
>  #endif /* HAVE_IBV_DEVX_EVENT */
> @@ -1646,6 +1650,8 @@
>  	memset((void *)(uintptr_t)rxq_data->cqes, 0xFF, cq_size);
>  	return cq_obj;
>  error:
> +	if (cq_obj)
> +		mlx5_devx_cmd_destroy(cq_obj);
>  	rxq_release_devx_cq_resources(rxq_ctrl);
>  	return NULL;
>  }
> --
> 1.8.3.1

Patch applied to next-net-mlx,

Kindest regards,
Raslan Darawsheh

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-07-27 13:42 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-27  8:50 [dpdk-dev] [PATCH] net/mlx5: fix CQ interrupt handling and cleanup Dekel Peled
2020-07-27 13:42 ` Raslan Darawsheh

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).