Subject: Re: [PATCH mlx5-next 1/5] RDMA/mlx5: Replace struct mlx5_core_mkey by u32 key

From: Leon Romanovsky <[email-masked]>
Date: Thu, 29 Jul 2021 20:27:07 +0300

On Thu, Jul 29, 2021 at 12:28:03PM -0300, Jason Gunthorpe wrote:
> On Tue, Jun 22, 2021 at 03:08:19PM +0300, Leon Romanovsky wrote:
> 
> > diff --git a/drivers/net/ethernet/mellanox/mlx5/core/mr.c b/drivers/net/ethernet/mellanox/mlx5/core/mr.c
> > index 50af84e76fb6..7a76b5eb1c1a 100644
> > +++ b/drivers/net/ethernet/mellanox/mlx5/core/mr.c
> > @@ -35,13 +35,11 @@
> >  #include <linux/mlx5/driver.h>
> >  #include "mlx5_core.h"
> >  
> > -int mlx5_core_create_mkey(struct mlx5_core_dev *dev,
> > -			  struct mlx5_core_mkey *mkey,
> > -			  u32 *in, int inlen)
> > +int mlx5_core_create_mkey(struct mlx5_core_dev *dev, u32 *mkey, u32 *in,
> > +			  int inlen)
> >  {
> >  	u32 lout[MLX5_ST_SZ_DW(create_mkey_out)] = {};
> >  	u32 mkey_index;
> > -	void *mkc;
> >  	int err;
> >  
> >  	MLX5_SET(create_mkey_in, in, opcode, MLX5_CMD_OP_CREATE_MKEY);
> > @@ -50,38 +48,32 @@ int mlx5_core_create_mkey(struct mlx5_core_dev *dev,
> >  	if (err)
> >  		return err;
> >  
> > -	mkc = MLX5_ADDR_OF(create_mkey_in, in, memory_key_mkey_entry);
> >  	mkey_index = MLX5_GET(create_mkey_out, lout, mkey_index);
> > -	mkey->iova = MLX5_GET64(mkc, mkc, start_addr);
> > -	mkey->size = MLX5_GET64(mkc, mkc, len);
> > -	mkey->key |= mlx5_idx_to_mkey(mkey_index);
> > -	mkey->pd = MLX5_GET(mkc, mkc, pd);
> > -	init_waitqueue_head(&mkey->wait);
> > +	*mkey |= mlx5_idx_to_mkey(mkey_index);
> 
> 
> This conflicts with 0232fc2ddcf4 ("net/mlx5: Reset mkey index on creation")
> 
> Please resend/rebase. I think it should be fixed like
> 
> 	mkey_index = MLX5_GET(create_mkey_out, lout, mkey_index);
> 	*mkey = (u32)mlx5_mkey_variant(mkey->key) | mlx5_idx_to_mkey(mkey_index);
> 
> 	mlx5_core_dbg(dev, "out 0x%x, mkey 0x%x\n", mkey_index,	*mkey);
> ?

Yes, this is how it is fixed in my tree. I just waited till you finish the review.

> 
> (though I will look at the rest of the series today, so don't rush on
> this)
> 
> Jason