Linux-RDMA Archive on lore.kernel.org
 help / color / Atom feed
From: Leon Romanovsky <leon@kernel.org>
To: Zhu Yanjun <zyjzyj2000@gmail.com>
Cc: Bob Pearson <rpearsonhpe@gmail.com>,
	Jason Gunthorpe <jgg@nvidia.com>,
	RDMA mailing list <linux-rdma@vger.kernel.org>,
	Bob Pearson <rpearson@hpe.com>
Subject: Re: [PATCH for-next v3 4/9] RDMA/rxe: Add ib_alloc_mw and ib_dealloc_mw verbs
Date: Wed, 21 Apr 2021 09:20:30 +0300
Message-ID: <YH/ELqtyNUB1DHeh@unreal> (raw)
In-Reply-To: <CAD=hENe-Xw2L46=U2uLO4evmFfgNNMWJBLtSYid=SNrJ9W75Yw@mail.gmail.com>

On Wed, Apr 21, 2021 at 01:54:49PM +0800, Zhu Yanjun wrote:
> On Wed, Apr 21, 2021 at 1:20 PM Bob Pearson <rpearsonhpe@gmail.com> wrote:
> >
> > Add ib_alloc_mw and ib_dealloc_mw verbs APIs.
> >
> > Added new file rxe_mw.c focused on MWs.
> > Changed the 8 bit random key generator.
> > Added a cleanup routine for MWs.
> > Added verbs routines to ib_device_ops.
> >
> > Signed-off-by: Bob Pearson <rpearson@hpe.com>
> > ---
> >  drivers/infiniband/sw/rxe/Makefile    |  1 +
> >  drivers/infiniband/sw/rxe/rxe_loc.h   |  6 +++
> >  drivers/infiniband/sw/rxe/rxe_mr.c    | 20 +++++-----
> >  drivers/infiniband/sw/rxe/rxe_mw.c    | 53 +++++++++++++++++++++++++++
> >  drivers/infiniband/sw/rxe/rxe_pool.c  |  1 +
> >  drivers/infiniband/sw/rxe/rxe_verbs.c |  3 ++
> >  drivers/infiniband/sw/rxe/rxe_verbs.h |  2 +
> >  7 files changed, 75 insertions(+), 11 deletions(-)
> >  create mode 100644 drivers/infiniband/sw/rxe/rxe_mw.c
> >
> > diff --git a/drivers/infiniband/sw/rxe/Makefile b/drivers/infiniband/sw/rxe/Makefile
> > index 66af72dca759..1e24673e9318 100644
> > --- a/drivers/infiniband/sw/rxe/Makefile
> > +++ b/drivers/infiniband/sw/rxe/Makefile
> > @@ -15,6 +15,7 @@ rdma_rxe-y := \
> >         rxe_qp.o \
> >         rxe_cq.o \
> >         rxe_mr.o \
> > +       rxe_mw.o \
> >         rxe_opcode.o \
> >         rxe_mmap.o \
> >         rxe_icrc.o \
> > diff --git a/drivers/infiniband/sw/rxe/rxe_loc.h b/drivers/infiniband/sw/rxe/rxe_loc.h
> > index ef8061d2fbe0..edf575930a98 100644
> > --- a/drivers/infiniband/sw/rxe/rxe_loc.h
> > +++ b/drivers/infiniband/sw/rxe/rxe_loc.h
> > @@ -76,6 +76,7 @@ enum copy_direction {
> >         from_mr_obj,
> >  };
> >
> > +u8 rxe_get_next_key(u32 last_key);
> >  void rxe_mr_init_dma(struct rxe_pd *pd, int access, struct rxe_mr *mr);
> >
> >  int rxe_mr_init_user(struct rxe_pd *pd, u64 start, u64 length, u64 iova,
> > @@ -106,6 +107,11 @@ void rxe_mr_cleanup(struct rxe_pool_entry *arg);
> >
> >  int advance_dma_data(struct rxe_dma_info *dma, unsigned int length);
> >
> > +/* rxe_mw.c */
> > +int rxe_alloc_mw(struct ib_mw *ibmw, struct ib_udata *udata);
> > +int rxe_dealloc_mw(struct ib_mw *ibmw);
> > +void rxe_mw_cleanup(struct rxe_pool_entry *arg);
> > +
> >  /* rxe_net.c */
> >  void rxe_loopback(struct sk_buff *skb);
> >  int rxe_send(struct rxe_pkt_info *pkt, struct sk_buff *skb);
> > diff --git a/drivers/infiniband/sw/rxe/rxe_mr.c b/drivers/infiniband/sw/rxe/rxe_mr.c
> > index 9f63947bab12..7f2cfc1ce659 100644
> > --- a/drivers/infiniband/sw/rxe/rxe_mr.c
> > +++ b/drivers/infiniband/sw/rxe/rxe_mr.c
> > @@ -7,19 +7,17 @@
> >  #include "rxe.h"
> >  #include "rxe_loc.h"
> >
> > -/*
> > - * lfsr (linear feedback shift register) with period 255
> > +/* Return a random 8 bit key value that is
> > + * different than the last_key. Set last_key to -1
> > + * if this is the first key for an MR or MW
> >   */
> > -static u8 rxe_get_key(void)
> > +u8 rxe_get_next_key(u32 last_key)
> >  {
> > -       static u32 key = 1;
> > -
> > -       key = key << 1;
> > -
> > -       key |= (0 != (key & 0x100)) ^ (0 != (key & 0x10))
> > -               ^ (0 != (key & 0x80)) ^ (0 != (key & 0x40));
> > +       u8 key;
> >
> > -       key &= 0xff;
> > +       do {
> > +               get_random_bytes(&key, 1);
> > +       } while (key == last_key);
> >
> >         return key;
> >  }
> > @@ -47,7 +45,7 @@ int mr_check_range(struct rxe_mr *mr, u64 iova, size_t length)
> >
> >  static void rxe_mr_init(int access, struct rxe_mr *mr)
> >  {
> > -       u32 lkey = mr->pelem.index << 8 | rxe_get_key();
> > +       u32 lkey = mr->pelem.index << 8 | rxe_get_next_key(-1);
> >         u32 rkey = (access & IB_ACCESS_REMOTE) ? lkey : 0;
> >
> >         mr->ibmr.lkey = lkey;
> > diff --git a/drivers/infiniband/sw/rxe/rxe_mw.c b/drivers/infiniband/sw/rxe/rxe_mw.c
> > new file mode 100644
> > index 000000000000..69128e298d44
> > --- /dev/null
> > +++ b/drivers/infiniband/sw/rxe/rxe_mw.c
> > @@ -0,0 +1,53 @@
> > +// SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB
> > +/*
> > + * Copyright (c) 2020 Hewlett Packard Enterprise, Inc. All rights reserved.
> > + */
> 
> The above is different with the following:
> "
> // SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB
> /*
>  * Copyright (c) 2016 Mellanox Technologies Ltd. All rights reserved.
>  * Copyright (c) 2015 System Fabric Works, Inc. All rights reserved.
>  */
> "
> 
> One is Hewlett Packard Enterprise, Inc, the other is Mellanox Technologies Ltd.
> 
> I am not sure whether it is a legal problem.
>

It is not an issue, because Bob created new file together with adding
enough new code in it.

Thanks

  reply index

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-21  5:20 [PATCH for-next v3 0/9] RDMA/rxe: Implement memory windows Bob Pearson
2021-04-21  5:20 ` [PATCH for-next v3 1/9] RDMA/rxe: Add bind MW fields to rxe_send_wr Bob Pearson
2021-04-21  5:20 ` [PATCH for-next v3 2/9] RDMA/rxe: Return errors for add index and key Bob Pearson
2021-04-21  5:20 ` [PATCH for-next v3 3/9] RDMA/rxe: Enable MW object pool Bob Pearson
2021-04-21  5:20 ` [PATCH for-next v3 4/9] RDMA/rxe: Add ib_alloc_mw and ib_dealloc_mw verbs Bob Pearson
2021-04-21  5:54   ` Zhu Yanjun
2021-04-21  6:20     ` Leon Romanovsky [this message]
2021-04-21  6:26       ` Zhu Yanjun
2021-04-21  5:20 ` [PATCH for-next v3 5/9] RDMA/rxe: Replace WR_REG_MASK by WR_LOCAL_OP_MASK Bob Pearson
2021-04-21  5:20 ` [PATCH for-next v3 6/9] RDMA/rxe: Move local ops to subroutine Bob Pearson
2021-04-21  5:20 ` [PATCH for-next v3 7/9] RDMA/rxe: Add support for bind MW work requests Bob Pearson
2021-04-21  9:36   ` Zhu Yanjun
2021-04-21 15:21     ` Robert Pearson
2021-04-22  5:33     ` Bob Pearson
2021-04-21  5:20 ` [PATCH for-next v3 8/9] RDMA/rxe: Implement invalidate MW operations Bob Pearson
2021-04-21  5:20 ` [PATCH for-next v3 9/9] RDMA/rxe: Implement memory access through MWs Bob Pearson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YH/ELqtyNUB1DHeh@unreal \
    --to=leon@kernel.org \
    --cc=jgg@nvidia.com \
    --cc=linux-rdma@vger.kernel.org \
    --cc=rpearson@hpe.com \
    --cc=rpearsonhpe@gmail.com \
    --cc=zyjzyj2000@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Linux-RDMA Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-rdma/0 linux-rdma/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-rdma linux-rdma/ https://lore.kernel.org/linux-rdma \
		linux-rdma@vger.kernel.org
	public-inbox-index linux-rdma

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-rdma


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git