Re: [PATCH 02/18] RDMA/core: Save the MR type in the ib_mr structure

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Mar 7, 2019 at 2:27 PM Bart Van Assche <bvanassche@xxxxxxx> wrote:
>
> On Thu, 2019-03-07 at 20:02 +0200, Max Gurtovoy wrote:
> > This is a preparation for the signature verbs API change. This change is
> > needed since the MR type will define, in the upcoming patches, the need
> > for allocating internal resources in LLD for signature handover related
> > operations. It will also help to make sure that signature related
> > functions are called with an appropriate MR type and fail otherwise.
> >
> > Signed-off-by: Max Gurtovoy <maxg@xxxxxxxxxxxx>
> > Signed-off-by: Israel Rukshin <israelr@xxxxxxxxxxxx>
> > Reviewed-by: Sagi Grimberg <sagi@xxxxxxxxxxx>
> > ---
> >  drivers/infiniband/core/uverbs_cmd.c | 1 +
> >  drivers/infiniband/core/verbs.c      | 1 +
> >  include/rdma/ib_verbs.h              | 1 +
> >  3 files changed, 3 insertions(+)
> >
> > diff --git a/drivers/infiniband/core/uverbs_cmd.c b/drivers/infiniband/core/uverbs_cmd.c
> > index 3317300ab036..72c5a8daf558 100644
> > --- a/drivers/infiniband/core/uverbs_cmd.c
> > +++ b/drivers/infiniband/core/uverbs_cmd.c
> > @@ -737,6 +737,7 @@ static int ib_uverbs_reg_mr(struct uverbs_attr_bundle *attrs)
> >
> >       mr->device  = pd->device;
> >       mr->pd      = pd;
> > +     mr->type    = IB_MR_TYPE_MEM_REG;
> >       mr->dm      = NULL;
> >       mr->uobject = uobj;
> >       atomic_inc(&pd->usecnt);
> > diff --git a/drivers/infiniband/core/verbs.c b/drivers/infiniband/core/verbs.c
> > index ac011836bb54..4588b933d4b4 100644
> > --- a/drivers/infiniband/core/verbs.c
> > +++ b/drivers/infiniband/core/verbs.c
> > @@ -1992,6 +1992,7 @@ struct ib_mr *ib_alloc_mr(struct ib_pd *pd,
> >               mr->need_inval = false;
> >               mr->res.type = RDMA_RESTRACK_MR;
> >               rdma_restrack_kadd(&mr->res);
> > +             mr->type = mr_type;
> >       }
> >
> >       return mr;
> > diff --git a/include/rdma/ib_verbs.h b/include/rdma/ib_verbs.h
> > index f89b521245ec..42a9e297c21f 100644
> > --- a/include/rdma/ib_verbs.h
> > +++ b/include/rdma/ib_verbs.h
> > @@ -1695,6 +1695,7 @@ struct ib_mr {
> >       u64                iova;
> >       u64                length;
> >       unsigned int       page_size;
> > +     enum ib_mr_type    type;
> >       bool               need_inval;
> >       union {
> >               struct ib_uobject       *uobject;       /* user */
>
> How about __ib_alloc_pd() and UVERBS_HANDLER(UVERBS_METHOD_DM_MR_REG)()?
> I think those functions also create a memory region. Shouldn't mr->type
> be initialized from these functions too?

Max??

Jason



[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Photo]     [Yosemite News]     [Yosemite Photos]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux