* [PATCH rdma-core] libhns: Add rereg mr interface in userspace
@ 2017-11-21 12:20 Lijun Ou
[not found] ` <1511266846-137693-1-git-send-email-oulijun-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
0 siblings, 1 reply; 6+ messages in thread
From: Lijun Ou @ 2017-11-21 12:20 UTC (permalink / raw)
To: dledford-H+wXaHxf7aLQT0dZR+AlfA, leon-DgEjT+Ai2ygdnm+yROfE0A,
jgg-uk2M96/98Pc
Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA
This patch adds the rereg mr verbs in userspace.
Signed-off-by: Shaobo Xu <xushaobo2-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
Signed-off-by: Lijun Ou <oulijun-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
Signed-off-by: Wei Hu (Xavier) <xavier.huwei-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
---
providers/hns/hns_roce_u.c | 1 +
providers/hns/hns_roce_u.h | 2 ++
providers/hns/hns_roce_u_verbs.c | 14 ++++++++++++++
3 files changed, 17 insertions(+)
diff --git a/providers/hns/hns_roce_u.c b/providers/hns/hns_roce_u.c
index ababd9c..9b5de44 100644
--- a/providers/hns/hns_roce_u.c
+++ b/providers/hns/hns_roce_u.c
@@ -118,6 +118,7 @@ static struct ibv_context *hns_roce_alloc_context(struct ibv_device *ibdev,
context->ibv_ctx.ops.alloc_pd = hns_roce_u_alloc_pd;
context->ibv_ctx.ops.dealloc_pd = hns_roce_u_free_pd;
context->ibv_ctx.ops.reg_mr = hns_roce_u_reg_mr;
+ context->ibv_ctx.ops.rereg_mr = hns_roce_u_rereg_mr;
context->ibv_ctx.ops.dereg_mr = hns_roce_u_dereg_mr;
context->ibv_ctx.ops.create_cq = hns_roce_u_create_cq;
diff --git a/providers/hns/hns_roce_u.h b/providers/hns/hns_roce_u.h
index 0e98f22..2f4f3dc 100644
--- a/providers/hns/hns_roce_u.h
+++ b/providers/hns/hns_roce_u.h
@@ -254,6 +254,8 @@ int hns_roce_u_free_pd(struct ibv_pd *pd);
struct ibv_mr *hns_roce_u_reg_mr(struct ibv_pd *pd, void *addr, size_t length,
int access);
+int hns_roce_u_rereg_mr(struct ibv_mr *mr, int flags, struct ibv_pd *pd,
+ void *addr, size_t length, int access);
int hns_roce_u_dereg_mr(struct ibv_mr *mr);
struct ibv_cq *hns_roce_u_create_cq(struct ibv_context *context, int cqe,
diff --git a/providers/hns/hns_roce_u_verbs.c b/providers/hns/hns_roce_u_verbs.c
index d0ab10a..4fa188f 100644
--- a/providers/hns/hns_roce_u_verbs.c
+++ b/providers/hns/hns_roce_u_verbs.c
@@ -150,6 +150,20 @@ struct ibv_mr *hns_roce_u_reg_mr(struct ibv_pd *pd, void *addr, size_t length,
return mr;
}
+int hns_roce_u_rereg_mr(struct ibv_mr *mr, int flags, struct ibv_pd *pd,
+ void *addr, size_t length, int access)
+{
+ struct ibv_rereg_mr cmd;
+ struct ibv_rereg_mr_resp resp;
+
+ if (flags & IBV_REREG_MR_KEEP_VALID)
+ return ENOTSUP;
+
+ return ibv_cmd_rereg_mr(mr, flags, addr, length, (uintptr_t)addr,
+ access, pd, &cmd, sizeof(cmd), &resp,
+ sizeof(resp));
+}
+
int hns_roce_u_dereg_mr(struct ibv_mr *mr)
{
int ret;
--
1.9.1
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 6+ messages in thread[parent not found: <1511266846-137693-1-git-send-email-oulijun-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>]
* Re: [PATCH rdma-core] libhns: Add rereg mr interface in userspace [not found] ` <1511266846-137693-1-git-send-email-oulijun-hv44wF8Li93QT0dZR+AlfA@public.gmane.org> @ 2017-11-21 13:53 ` Leon Romanovsky [not found] ` <20171121135310.GV18825-U/DQcQFIOTAAJjI8aNfphQ@public.gmane.org> 0 siblings, 1 reply; 6+ messages in thread From: Leon Romanovsky @ 2017-11-21 13:53 UTC (permalink / raw) To: Lijun Ou Cc: dledford-H+wXaHxf7aLQT0dZR+AlfA, jgg-uk2M96/98Pc, linux-rdma-u79uwXL29TY76Z2rM5mHXA [-- Attachment #1: Type: text/plain, Size: 2943 bytes --] On Tue, Nov 21, 2017 at 08:20:46PM +0800, Lijun Ou wrote: > This patch adds the rereg mr verbs in userspace. > > Signed-off-by: Shaobo Xu <xushaobo2-hv44wF8Li93QT0dZR+AlfA@public.gmane.org> > Signed-off-by: Lijun Ou <oulijun-hv44wF8Li93QT0dZR+AlfA@public.gmane.org> > Signed-off-by: Wei Hu (Xavier) <xavier.huwei-hv44wF8Li93QT0dZR+AlfA@public.gmane.org> > --- > providers/hns/hns_roce_u.c | 1 + > providers/hns/hns_roce_u.h | 2 ++ > providers/hns/hns_roce_u_verbs.c | 14 ++++++++++++++ > 3 files changed, 17 insertions(+) > > diff --git a/providers/hns/hns_roce_u.c b/providers/hns/hns_roce_u.c > index ababd9c..9b5de44 100644 > --- a/providers/hns/hns_roce_u.c > +++ b/providers/hns/hns_roce_u.c > @@ -118,6 +118,7 @@ static struct ibv_context *hns_roce_alloc_context(struct ibv_device *ibdev, > context->ibv_ctx.ops.alloc_pd = hns_roce_u_alloc_pd; > context->ibv_ctx.ops.dealloc_pd = hns_roce_u_free_pd; > context->ibv_ctx.ops.reg_mr = hns_roce_u_reg_mr; > + context->ibv_ctx.ops.rereg_mr = hns_roce_u_rereg_mr; > context->ibv_ctx.ops.dereg_mr = hns_roce_u_dereg_mr; > > context->ibv_ctx.ops.create_cq = hns_roce_u_create_cq; > diff --git a/providers/hns/hns_roce_u.h b/providers/hns/hns_roce_u.h > index 0e98f22..2f4f3dc 100644 > --- a/providers/hns/hns_roce_u.h > +++ b/providers/hns/hns_roce_u.h > @@ -254,6 +254,8 @@ int hns_roce_u_free_pd(struct ibv_pd *pd); > > struct ibv_mr *hns_roce_u_reg_mr(struct ibv_pd *pd, void *addr, size_t length, > int access); > +int hns_roce_u_rereg_mr(struct ibv_mr *mr, int flags, struct ibv_pd *pd, > + void *addr, size_t length, int access); > int hns_roce_u_dereg_mr(struct ibv_mr *mr); > > struct ibv_cq *hns_roce_u_create_cq(struct ibv_context *context, int cqe, > diff --git a/providers/hns/hns_roce_u_verbs.c b/providers/hns/hns_roce_u_verbs.c > index d0ab10a..4fa188f 100644 > --- a/providers/hns/hns_roce_u_verbs.c > +++ b/providers/hns/hns_roce_u_verbs.c > @@ -150,6 +150,20 @@ struct ibv_mr *hns_roce_u_reg_mr(struct ibv_pd *pd, void *addr, size_t length, > return mr; > } > > +int hns_roce_u_rereg_mr(struct ibv_mr *mr, int flags, struct ibv_pd *pd, > + void *addr, size_t length, int access) > +{ > + struct ibv_rereg_mr cmd; > + struct ibv_rereg_mr_resp resp; > + > + if (flags & IBV_REREG_MR_KEEP_VALID) > + return ENOTSUP; You need to write the supported flags here, so the people will be able to extend ibv_rereg_mr_flags without worries about your driver. Thanks > + > + return ibv_cmd_rereg_mr(mr, flags, addr, length, (uintptr_t)addr, > + access, pd, &cmd, sizeof(cmd), &resp, > + sizeof(resp)); > +} > + > int hns_roce_u_dereg_mr(struct ibv_mr *mr) > { > int ret; > -- > 1.9.1 > > -- > To unsubscribe from this list: send the line "unsubscribe linux-rdma" in > the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org > More majordomo info at http://vger.kernel.org/majordomo-info.html [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 833 bytes --] ^ permalink raw reply [flat|nested] 6+ messages in thread
[parent not found: <20171121135310.GV18825-U/DQcQFIOTAAJjI8aNfphQ@public.gmane.org>]
* Re: [PATCH rdma-core] libhns: Add rereg mr interface in userspace [not found] ` <20171121135310.GV18825-U/DQcQFIOTAAJjI8aNfphQ@public.gmane.org> @ 2017-11-21 15:18 ` Jason Gunthorpe 2017-11-24 8:38 ` oulijun 1 sibling, 0 replies; 6+ messages in thread From: Jason Gunthorpe @ 2017-11-21 15:18 UTC (permalink / raw) To: Leon Romanovsky Cc: Lijun Ou, dledford-H+wXaHxf7aLQT0dZR+AlfA, linux-rdma-u79uwXL29TY76Z2rM5mHXA On Tue, Nov 21, 2017 at 03:53:10PM +0200, Leon Romanovsky wrote: > > + if (flags & IBV_REREG_MR_KEEP_VALID) > > + return ENOTSUP; > > You need to write the supported flags here, so the people will > be able to extend ibv_rereg_mr_flags without worries about your driver. And doesn't the kernel check flags anyhow? Why do you need to also check it in userspace? Jason -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH rdma-core] libhns: Add rereg mr interface in userspace [not found] ` <20171121135310.GV18825-U/DQcQFIOTAAJjI8aNfphQ@public.gmane.org> 2017-11-21 15:18 ` Jason Gunthorpe @ 2017-11-24 8:38 ` oulijun [not found] ` <facbc654-30ad-1bb7-f066-6dff2d5deaca-hv44wF8Li93QT0dZR+AlfA@public.gmane.org> 1 sibling, 1 reply; 6+ messages in thread From: oulijun @ 2017-11-24 8:38 UTC (permalink / raw) To: Leon Romanovsky Cc: dledford-H+wXaHxf7aLQT0dZR+AlfA, jgg-uk2M96/98Pc, linux-rdma-u79uwXL29TY76Z2rM5mHXA 在 2017/11/21 21:53, Leon Romanovsky 写道: > On Tue, Nov 21, 2017 at 08:20:46PM +0800, Lijun Ou wrote: >> This patch adds the rereg mr verbs in userspace. >> >> Signed-off-by: Shaobo Xu <xushaobo2-hv44wF8Li93QT0dZR+AlfA@public.gmane.org> >> Signed-off-by: Lijun Ou <oulijun-hv44wF8Li93QT0dZR+AlfA@public.gmane.org> >> Signed-off-by: Wei Hu (Xavier) <xavier.huwei-hv44wF8Li93QT0dZR+AlfA@public.gmane.org> >> --- >> providers/hns/hns_roce_u.c | 1 + >> providers/hns/hns_roce_u.h | 2 ++ >> providers/hns/hns_roce_u_verbs.c | 14 ++++++++++++++ >> 3 files changed, 17 insertions(+) >> >> diff --git a/providers/hns/hns_roce_u.c b/providers/hns/hns_roce_u.c >> index ababd9c..9b5de44 100644 >> --- a/providers/hns/hns_roce_u.c >> +++ b/providers/hns/hns_roce_u.c >> @@ -118,6 +118,7 @@ static struct ibv_context *hns_roce_alloc_context(struct ibv_device *ibdev, >> context->ibv_ctx.ops.alloc_pd = hns_roce_u_alloc_pd; >> context->ibv_ctx.ops.dealloc_pd = hns_roce_u_free_pd; >> context->ibv_ctx.ops.reg_mr = hns_roce_u_reg_mr; >> + context->ibv_ctx.ops.rereg_mr = hns_roce_u_rereg_mr; >> context->ibv_ctx.ops.dereg_mr = hns_roce_u_dereg_mr; >> >> context->ibv_ctx.ops.create_cq = hns_roce_u_create_cq; >> diff --git a/providers/hns/hns_roce_u.h b/providers/hns/hns_roce_u.h >> index 0e98f22..2f4f3dc 100644 >> --- a/providers/hns/hns_roce_u.h >> +++ b/providers/hns/hns_roce_u.h >> @@ -254,6 +254,8 @@ int hns_roce_u_free_pd(struct ibv_pd *pd); >> >> struct ibv_mr *hns_roce_u_reg_mr(struct ibv_pd *pd, void *addr, size_t length, >> int access); >> +int hns_roce_u_rereg_mr(struct ibv_mr *mr, int flags, struct ibv_pd *pd, >> + void *addr, size_t length, int access); >> int hns_roce_u_dereg_mr(struct ibv_mr *mr); >> >> struct ibv_cq *hns_roce_u_create_cq(struct ibv_context *context, int cqe, >> diff --git a/providers/hns/hns_roce_u_verbs.c b/providers/hns/hns_roce_u_verbs.c >> index d0ab10a..4fa188f 100644 >> --- a/providers/hns/hns_roce_u_verbs.c >> +++ b/providers/hns/hns_roce_u_verbs.c >> @@ -150,6 +150,20 @@ struct ibv_mr *hns_roce_u_reg_mr(struct ibv_pd *pd, void *addr, size_t length, >> return mr; >> } >> >> +int hns_roce_u_rereg_mr(struct ibv_mr *mr, int flags, struct ibv_pd *pd, >> + void *addr, size_t length, int access) >> +{ >> + struct ibv_rereg_mr cmd; >> + struct ibv_rereg_mr_resp resp; >> + >> + if (flags & IBV_REREG_MR_KEEP_VALID) >> + return ENOTSUP; > > You need to write the supported flags here, so the people will > be able to extend ibv_rereg_mr_flags without worries about your driver. > > Thanks I think that it maybe not write. if the hw is not supported, the user will not call ibv_rereg_mr and don't configure flags for IBV_REREG_MR_KEEP_VALID besides, the kernel will check the flags. > >> + >> + return ibv_cmd_rereg_mr(mr, flags, addr, length, (uintptr_t)addr, >> + access, pd, &cmd, sizeof(cmd), &resp, >> + sizeof(resp)); >> +} >> + >> int hns_roce_u_dereg_mr(struct ibv_mr *mr) >> { >> int ret; >> -- >> 1.9.1 >> >> -- >> To unsubscribe from this list: send the line "unsubscribe linux-rdma" in >> the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org >> More majordomo info at http://vger.kernel.org/majordomo-info.html -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 6+ messages in thread
[parent not found: <facbc654-30ad-1bb7-f066-6dff2d5deaca-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>]
* Re: [PATCH rdma-core] libhns: Add rereg mr interface in userspace [not found] ` <facbc654-30ad-1bb7-f066-6dff2d5deaca-hv44wF8Li93QT0dZR+AlfA@public.gmane.org> @ 2017-11-24 16:03 ` Jason Gunthorpe [not found] ` <20171124160347.GA3552-uk2M96/98Pc@public.gmane.org> 0 siblings, 1 reply; 6+ messages in thread From: Jason Gunthorpe @ 2017-11-24 16:03 UTC (permalink / raw) To: oulijun Cc: Leon Romanovsky, dledford-H+wXaHxf7aLQT0dZR+AlfA, linux-rdma-u79uwXL29TY76Z2rM5mHXA On Fri, Nov 24, 2017 at 04:38:28PM +0800, oulijun wrote: > >> +int hns_roce_u_rereg_mr(struct ibv_mr *mr, int flags, struct ibv_pd *pd, > >> + void *addr, size_t length, int access) > >> +{ > >> + struct ibv_rereg_mr cmd; > >> + struct ibv_rereg_mr_resp resp; > >> + > >> + if (flags & IBV_REREG_MR_KEEP_VALID) > >> + return ENOTSUP; > > > > You need to write the supported flags here, so the people will > > be able to extend ibv_rereg_mr_flags without worries about your driver. > > > > Thanks > I think that it maybe not write. if the hw is not supported, the user will > not call ibv_rereg_mr and don't configure flags for IBV_REREG_MR_KEEP_VALID > besides, the kernel will check the flags. Since the kernel checks it just get rid of the if statement. Jason -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 6+ messages in thread
[parent not found: <20171124160347.GA3552-uk2M96/98Pc@public.gmane.org>]
* Re: [PATCH rdma-core] libhns: Add rereg mr interface in userspace [not found] ` <20171124160347.GA3552-uk2M96/98Pc@public.gmane.org> @ 2017-11-25 1:23 ` oulijun 0 siblings, 0 replies; 6+ messages in thread From: oulijun @ 2017-11-25 1:23 UTC (permalink / raw) To: Jason Gunthorpe Cc: Leon Romanovsky, dledford-H+wXaHxf7aLQT0dZR+AlfA, linux-rdma-u79uwXL29TY76Z2rM5mHXA 在 2017/11/25 0:03, Jason Gunthorpe 写道: > On Fri, Nov 24, 2017 at 04:38:28PM +0800, oulijun wrote: > >>>> +int hns_roce_u_rereg_mr(struct ibv_mr *mr, int flags, struct ibv_pd *pd, >>>> + void *addr, size_t length, int access) >>>> +{ >>>> + struct ibv_rereg_mr cmd; >>>> + struct ibv_rereg_mr_resp resp; >>>> + >>>> + if (flags & IBV_REREG_MR_KEEP_VALID) >>>> + return ENOTSUP; >>> >>> You need to write the supported flags here, so the people will >>> be able to extend ibv_rereg_mr_flags without worries about your driver. >>> >>> Thanks >> I think that it maybe not write. if the hw is not supported, the user will >> not call ibv_rereg_mr and don't configure flags for IBV_REREG_MR_KEEP_VALID >> besides, the kernel will check the flags. > > Since the kernel checks it just get rid of the if statement. > > Jason > Thanks. it may be more simple. Lijun Ou > -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2017-11-25 1:23 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-11-21 12:20 [PATCH rdma-core] libhns: Add rereg mr interface in userspace Lijun Ou
[not found] ` <1511266846-137693-1-git-send-email-oulijun-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
2017-11-21 13:53 ` Leon Romanovsky
[not found] ` <20171121135310.GV18825-U/DQcQFIOTAAJjI8aNfphQ@public.gmane.org>
2017-11-21 15:18 ` Jason Gunthorpe
2017-11-24 8:38 ` oulijun
[not found] ` <facbc654-30ad-1bb7-f066-6dff2d5deaca-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
2017-11-24 16:03 ` Jason Gunthorpe
[not found] ` <20171124160347.GA3552-uk2M96/98Pc@public.gmane.org>
2017-11-25 1:23 ` oulijun
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox