vdpa/mlx5: fix completion queue initialization

Message ID 1595860193-2771-1-git-send-email-xuemingl@mellanox.com (mailing list archive)
State Accepted, archived
Delegated to: Maxime Coquelin
Headers
Series vdpa/mlx5: fix completion queue initialization |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/iol-broadcom-Performance success Performance Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/travis-robot success Travis build: passed
ci/Intel-compilation success Compilation OK
ci/iol-testing success Testing PASS
ci/iol-mellanox-Performance success Performance Testing PASS

Commit Message

Xueming Li July 27, 2020, 2:29 p.m. UTC
  Vdpa device failed to initialize 2nd VQ during setup. From FW syndrome,
unsupported CQE size was specified in CQ initialization attributes.

The unsupported CQE size comes from uninitialized stack struct data, and
the struct has new fields defined recently which are not initialized in
vdpa code.

This patch initializes cq creation attributes with zero to avoid such
random data.

Fixes: 79a7e409a2f6 ("common/mlx5: prepare support of packet pacing")
Cc: viacheslavo@mellanox.com

Signed-off-by: Xueming Li <xuemingl@mellanox.com>
Acked-by: Matan Azrad <matan@mellanox.com>
---
 drivers/vdpa/mlx5/mlx5_vdpa_event.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Comments

Maxime Coquelin July 28, 2020, 1:44 p.m. UTC | #1
On 7/27/20 4:29 PM, Xueming Li wrote:
> Vdpa device failed to initialize 2nd VQ during setup. From FW syndrome,
> unsupported CQE size was specified in CQ initialization attributes.
> 
> The unsupported CQE size comes from uninitialized stack struct data, and
> the struct has new fields defined recently which are not initialized in
> vdpa code.
> 
> This patch initializes cq creation attributes with zero to avoid such
> random data.
> 
> Fixes: 79a7e409a2f6 ("common/mlx5: prepare support of packet pacing")
> Cc: viacheslavo@mellanox.com
> 
> Signed-off-by: Xueming Li <xuemingl@mellanox.com>
> Acked-by: Matan Azrad <matan@mellanox.com>
> ---
>  drivers/vdpa/mlx5/mlx5_vdpa_event.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/vdpa/mlx5/mlx5_vdpa_event.c b/drivers/vdpa/mlx5/mlx5_vdpa_event.c
> index e14b380f19..13ad43611e 100644
> --- a/drivers/vdpa/mlx5/mlx5_vdpa_event.c
> +++ b/drivers/vdpa/mlx5/mlx5_vdpa_event.c
> @@ -121,7 +121,7 @@ static int
>  mlx5_vdpa_cq_create(struct mlx5_vdpa_priv *priv, uint16_t log_desc_n,
>  		    int callfd, struct mlx5_vdpa_cq *cq)
>  {
> -	struct mlx5_devx_cq_attr attr;
> +	struct mlx5_devx_cq_attr attr = {0};
>  	size_t pgsize = sysconf(_SC_PAGESIZE);
>  	uint32_t umem_size;
>  	uint16_t event_nums[1] = {0};
> 

Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
  
Maxime Coquelin July 28, 2020, 3:49 p.m. UTC | #2
On 7/27/20 4:29 PM, Xueming Li wrote:
> Vdpa device failed to initialize 2nd VQ during setup. From FW syndrome,
> unsupported CQE size was specified in CQ initialization attributes.
> 
> The unsupported CQE size comes from uninitialized stack struct data, and
> the struct has new fields defined recently which are not initialized in
> vdpa code.
> 
> This patch initializes cq creation attributes with zero to avoid such
> random data.
> 
> Fixes: 79a7e409a2f6 ("common/mlx5: prepare support of packet pacing")
> Cc: viacheslavo@mellanox.com
> 
> Signed-off-by: Xueming Li <xuemingl@mellanox.com>
> Acked-by: Matan Azrad <matan@mellanox.com>


Applied to dpdk-next-virtio/master

Thanks,
Maxime
  

Patch

diff --git a/drivers/vdpa/mlx5/mlx5_vdpa_event.c b/drivers/vdpa/mlx5/mlx5_vdpa_event.c
index e14b380f19..13ad43611e 100644
--- a/drivers/vdpa/mlx5/mlx5_vdpa_event.c
+++ b/drivers/vdpa/mlx5/mlx5_vdpa_event.c
@@ -121,7 +121,7 @@  static int
 mlx5_vdpa_cq_create(struct mlx5_vdpa_priv *priv, uint16_t log_desc_n,
 		    int callfd, struct mlx5_vdpa_cq *cq)
 {
-	struct mlx5_devx_cq_attr attr;
+	struct mlx5_devx_cq_attr attr = {0};
 	size_t pgsize = sysconf(_SC_PAGESIZE);
 	uint32_t umem_size;
 	uint16_t event_nums[1] = {0};