On Thu, 2020-02-27 at 16:00 -0400, Jason Gunthorpe wrote: > On Thu, Feb 27, 2020 at 07:41:24PM +0000, Saeed Mahameed wrote: > > On Thu, 2020-02-27 at 14:33 +0200, Leon Romanovsky wrote: > > > From: Michael Guralnik <michaelgur@xxxxxxxxxxxx> > > > > > > As mlx5_ib is the only user of the mlx5_core_create_mkey_cb, move > > > the > > > logic inside mlx5_ib and cleanup the code in mlx5_core. > > > > > > > I have a WIP series that is moving the whole mr.c to mlx5_ib. > > https://git.kernel.org/pub/scm/linux/kernel/git/saeed/linux.git/log/?h=topic/mr-relocate > > > > > > > Signed-off-by: Michael Guralnik <michaelgur@xxxxxxxxxxxx> > > > Signed-off-by: Leon Romanovsky <leonro@xxxxxxxxxxxx> > > > drivers/infiniband/hw/mlx5/mr.c | 25 > > > ++++++++++++++++ > > > drivers/net/ethernet/mellanox/mlx5/core/mr.c | 22 +++----------- > > > --- > > > include/linux/mlx5/driver.h | 6 ----- > > > 3 files changed, 24 insertions(+), 29 deletions(-) > > > > > > diff --git a/drivers/infiniband/hw/mlx5/mr.c > > > b/drivers/infiniband/hw/mlx5/mr.c > > > index 6fa0a83c19de..dea14477a676 100644 > > > +++ b/drivers/infiniband/hw/mlx5/mr.c > > > @@ -79,6 +79,25 @@ static bool use_umr_mtt_update(struct > > > mlx5_ib_mr > > > *mr, u64 start, u64 length) > > > length + (start & (MLX5_ADAPTER_PAGE_SIZE - 1)); > > > } > > > > > > +static int create_mkey_cb(struct mlx5_core_dev *dev, struct > > > mlx5_ib_mr *mr, > > > + struct mlx5_async_ctx *async_ctx, u32 *in, > > > int inlen, > > > + mlx5_async_cbk_t callback) > > > +{ > > > + void *mkc; > > > + u8 key; > > > + > > > + spin_lock_irq(&dev->priv.mkey_lock); > > > + key = dev->priv.mkey_key++; > > > > you know i don't like mlx5_ib sniffing around mlx5_core->priv .. > > > > this is handled correctly in my series, i can rebase it and make it > > ready in a couple of days.. let me know if this will be good enough > > for > > you. > > How about Michael just take the two relevant patches into this series > > {IB,net}/mlx5: Setup mkey variant before mr create command invocation > {IB,net}/mlx5: Assign mkey variant in mlx5_ib only > Also, IB/mlx5: Replace spinlock protected write with atomic var it is a good one :) > And this partially moves toward your series. It will be more than a > few days to rebase and check all the parts of your series I think. Okay. -Saeed.