Subject: Re: [PATCH mlx5-next 02/24] net/mlx5: Update cq.c to new cmd interface

From: Leon Romanovsky <[email-masked]>
Date: Wed, 22 Apr 2020 21:36:27 +0300

On Wed, Apr 22, 2020 at 03:32:14PM -0300, Jason Gunthorpe wrote:
> On Wed, Apr 22, 2020 at 07:49:48PM +0300, Leon Romanovsky wrote:
> > >  int mlx5_core_modify_cq(struct mlx5_core_dev *dev, struct mlx5_core_cq *cq,
> > >  			u32 *in, int inlen)
> > >  {
> > > -	u32 out[MLX5_ST_SZ_DW(modify_cq_out)] = {0};
> > > -
> > >  	MLX5_SET(modify_cq_in, in, opcode, MLX5_CMD_OP_MODIFY_CQ);
> > >  	MLX5_SET(modify_cq_in, in, uid, cq->uid);
> > > -	return mlx5_cmd_exec(dev, in, inlen, out, sizeof(out));
> > > +	return mlx5_cmd_exec_in(dev, modify_cq, in);
> > >  }
> > >  EXPORT_SYMBOL(mlx5_core_modify_cq);
> > >
> >
> > This hunk needs this fixup:
> >
> > diff --git a/drivers/net/ethernet/mellanox/mlx5/core/cq.c b/drivers/net/ethernet/mellanox/mlx5/core/cq.c
> > index 1a6f1f14da97..8379b24cb838 100644
> > +++ b/drivers/net/ethernet/mellanox/mlx5/core/cq.c
> > @@ -187,9 +187,11 @@ EXPORT_SYMBOL(mlx5_core_query_cq);
> >  int mlx5_core_modify_cq(struct mlx5_core_dev *dev, struct mlx5_core_cq *cq,
> >                         u32 *in, int inlen)
> >  {
> > +       u32 out[MLX5_ST_SZ_DW(modify_cq_out)] = {};
> > +
> >         MLX5_SET(modify_cq_in, in, opcode, MLX5_CMD_OP_MODIFY_CQ);
> >         MLX5_SET(modify_cq_in, in, uid, cq->uid);
> > -       return mlx5_cmd_exec_in(dev, modify_cq, in);
> > +       return mlx5_cmd_exec(dev, in, inlen, out, sizeof(out));
> >  }
> >  EXPORT_SYMBOL(mlx5_core_modify_cq);
>
> Why doesn't this one work with the helper?

In the mlx5_ib_resize_cq() function inlen is equal to

1290         inlen = MLX5_ST_SZ_BYTES(modify_cq_in) +
1291                 MLX5_FLD_SZ_BYTES(modify_cq_in, pas[0]) * npas;

and not to MLX5_ST_SZ_BYTES(modify_cq_in) like helper assumes.

Thanks

> Jason