* [PATCH] libmlx5: Implement missing open_qp verb @ 2015-05-18 9:02 Sébastien Dugué 2015-05-26 15:47 ` Doug Ledford 0 siblings, 1 reply; 3+ messages in thread From: Sébastien Dugué @ 2015-05-18 9:02 UTC (permalink / raw) To: Eli Cohen; +Cc: linux-rdma, OF EWG Commit 0c7ac1083831 added XRC support for mlx5, however this is missing the open_qp verb. Signed-off-by: Sébastien Dugué <sebastien.dugue-6ktuUTfB/bM@public.gmane.org> --- src/mlx5.c | 1 + src/mlx5.h | 2 ++ src/verbs.c | 38 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 41 insertions(+) diff --git a/src/mlx5.c b/src/mlx5.c index d02328881992..39f59975d3d2 100644 --- a/src/mlx5.c +++ b/src/mlx5.c @@ -579,6 +579,7 @@ static int mlx5_init_context(struct verbs_device *vdev, context->ibv_ctx.ops = mlx5_ctx_ops; verbs_set_ctx_op(v_ctx, create_qp_ex, mlx5_create_qp_ex); + verbs_set_ctx_op(v_ctx, open_qp, mlx5_open_qp); verbs_set_ctx_op(v_ctx, open_xrcd, mlx5_open_xrcd); verbs_set_ctx_op(v_ctx, close_xrcd, mlx5_close_xrcd); verbs_set_ctx_op(v_ctx, create_srq_ex, mlx5_create_srq_ex); diff --git a/src/mlx5.h b/src/mlx5.h index 6ad79fe324d3..f548e51ee338 100644 --- a/src/mlx5.h +++ b/src/mlx5.h @@ -613,6 +613,8 @@ void *mlx5_get_send_wqe(struct mlx5_qp *qp, int n); int mlx5_copy_to_recv_wqe(struct mlx5_qp *qp, int idx, void *buf, int size); int mlx5_copy_to_send_wqe(struct mlx5_qp *qp, int idx, void *buf, int size); int mlx5_copy_to_recv_srq(struct mlx5_srq *srq, int idx, void *buf, int size); +struct ibv_qp *mlx5_open_qp(struct ibv_context *context, + struct ibv_qp_open_attr *attr); struct ibv_xrcd *mlx5_open_xrcd(struct ibv_context *context, struct ibv_xrcd_init_attr *xrcd_init_attr); int mlx5_get_srq_num(struct ibv_srq *srq, uint32_t *srq_num); diff --git a/src/verbs.c b/src/verbs.c index 8ddf4e631c9f..dc899bce4e00 100644 --- a/src/verbs.c +++ b/src/verbs.c @@ -1122,6 +1122,44 @@ int mlx5_modify_qp(struct ibv_qp *qp, struct ibv_qp_attr *attr, return ret; } +struct ibv_qp *mlx5_open_qp(struct ibv_context *context, + struct ibv_qp_open_attr *attr) +{ + struct ibv_open_qp cmd; + struct ibv_create_qp_resp resp; + struct mlx5_qp *qp; + int ret; + struct mlx5_context *ctx = to_mctx(context); + + qp = calloc(1, sizeof(*qp)); + + if (!qp) + return NULL; + + ret = ibv_cmd_open_qp(context, &qp->verbs_qp, sizeof(qp->verbs_qp), + attr, &cmd, sizeof(cmd), &resp, sizeof(resp)); + if (ret) + goto err; + + pthread_mutex_lock(&ctx->qp_table_mutex); + ret = mlx5_store_qp(ctx, qp->verbs_qp.qp.qp_num, qp); + + if (ret) { + pthread_mutex_unlock(&ctx->qp_table_mutex); + fprintf(stderr, "mlx5_store_qp failed ret=%d\n", ret); + goto destroy; + } + pthread_mutex_unlock(&ctx->qp_table_mutex); + + return (struct ibv_qp *)&qp->verbs_qp; + +destroy: + ibv_cmd_destroy_qp(&qp->verbs_qp.qp); +err: + free(qp); + return NULL; +} + struct ibv_ah *mlx5_create_ah(struct ibv_pd *pd, struct ibv_ah_attr *attr) { struct mlx5_ah *ah; -- 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] 3+ messages in thread
* Re: [PATCH] libmlx5: Implement missing open_qp verb 2015-05-18 9:02 [PATCH] libmlx5: Implement missing open_qp verb Sébastien Dugué @ 2015-05-26 15:47 ` Doug Ledford [not found] ` <1432655263.28905.115.camel-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org> 0 siblings, 1 reply; 3+ messages in thread From: Doug Ledford @ 2015-05-26 15:47 UTC (permalink / raw) To: Sébastien Dugué; +Cc: linux-rdma, OF EWG [-- Attachment #1.1: Type: text/plain, Size: 3690 bytes --] On Mon, 2015-05-18 at 11:02 +0200, Sébastien Dugué wrote: > Commit 0c7ac1083831 added XRC support for mlx5, however this is missing > the open_qp verb. > > Signed-off-by: Sébastien Dugué <sebastien.dugue-6ktuUTfB/bM@public.gmane.org> Patch looks reasonable. However, I didn't review it to make sure that it interacts with other libmlx5 internals properly, just for the obvious things (locks handled properly, proper error unwind, etc). I'm assuming Eli will process this, for now I'm removing it from patchworks (Eli isn't listed as a maintainer there so he can't remove it, which highlights one of the difficulties of this list being used for both kernel and user space patches...there are lots of user space maintainers and most of them aren't list as such in patchworks). > --- > src/mlx5.c | 1 + > src/mlx5.h | 2 ++ > src/verbs.c | 38 ++++++++++++++++++++++++++++++++++++++ > 3 files changed, 41 insertions(+) > > diff --git a/src/mlx5.c b/src/mlx5.c > index d02328881992..39f59975d3d2 100644 > --- a/src/mlx5.c > +++ b/src/mlx5.c > @@ -579,6 +579,7 @@ static int mlx5_init_context(struct verbs_device *vdev, > context->ibv_ctx.ops = mlx5_ctx_ops; > > verbs_set_ctx_op(v_ctx, create_qp_ex, mlx5_create_qp_ex); > + verbs_set_ctx_op(v_ctx, open_qp, mlx5_open_qp); > verbs_set_ctx_op(v_ctx, open_xrcd, mlx5_open_xrcd); > verbs_set_ctx_op(v_ctx, close_xrcd, mlx5_close_xrcd); > verbs_set_ctx_op(v_ctx, create_srq_ex, mlx5_create_srq_ex); > diff --git a/src/mlx5.h b/src/mlx5.h > index 6ad79fe324d3..f548e51ee338 100644 > --- a/src/mlx5.h > +++ b/src/mlx5.h > @@ -613,6 +613,8 @@ void *mlx5_get_send_wqe(struct mlx5_qp *qp, int n); > int mlx5_copy_to_recv_wqe(struct mlx5_qp *qp, int idx, void *buf, int size); > int mlx5_copy_to_send_wqe(struct mlx5_qp *qp, int idx, void *buf, int size); > int mlx5_copy_to_recv_srq(struct mlx5_srq *srq, int idx, void *buf, int size); > +struct ibv_qp *mlx5_open_qp(struct ibv_context *context, > + struct ibv_qp_open_attr *attr); > struct ibv_xrcd *mlx5_open_xrcd(struct ibv_context *context, > struct ibv_xrcd_init_attr *xrcd_init_attr); > int mlx5_get_srq_num(struct ibv_srq *srq, uint32_t *srq_num); > diff --git a/src/verbs.c b/src/verbs.c > index 8ddf4e631c9f..dc899bce4e00 100644 > --- a/src/verbs.c > +++ b/src/verbs.c > @@ -1122,6 +1122,44 @@ int mlx5_modify_qp(struct ibv_qp *qp, struct ibv_qp_attr *attr, > return ret; > } > > +struct ibv_qp *mlx5_open_qp(struct ibv_context *context, > + struct ibv_qp_open_attr *attr) > +{ > + struct ibv_open_qp cmd; > + struct ibv_create_qp_resp resp; > + struct mlx5_qp *qp; > + int ret; > + struct mlx5_context *ctx = to_mctx(context); > + > + qp = calloc(1, sizeof(*qp)); > + > + if (!qp) > + return NULL; > + > + ret = ibv_cmd_open_qp(context, &qp->verbs_qp, sizeof(qp->verbs_qp), > + attr, &cmd, sizeof(cmd), &resp, sizeof(resp)); > + if (ret) > + goto err; > + > + pthread_mutex_lock(&ctx->qp_table_mutex); > + ret = mlx5_store_qp(ctx, qp->verbs_qp.qp.qp_num, qp); > + > + if (ret) { > + pthread_mutex_unlock(&ctx->qp_table_mutex); > + fprintf(stderr, "mlx5_store_qp failed ret=%d\n", ret); > + goto destroy; > + } > + pthread_mutex_unlock(&ctx->qp_table_mutex); > + > + return (struct ibv_qp *)&qp->verbs_qp; > + > +destroy: > + ibv_cmd_destroy_qp(&qp->verbs_qp.qp); > +err: > + free(qp); > + return NULL; > +} > + > struct ibv_ah *mlx5_create_ah(struct ibv_pd *pd, struct ibv_ah_attr *attr) > { > struct mlx5_ah *ah; -- Doug Ledford <dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org> GPG KeyID: 0E572FDD [-- Attachment #1.2: This is a digitally signed message part --] [-- Type: application/pgp-signature, Size: 819 bytes --] [-- Attachment #2: Type: text/plain, Size: 168 bytes --] _______________________________________________ ewg mailing list ewg-ZwoEplunGu1OwGhvXhtEPSCwEArCW2h5@public.gmane.org http://lists.openfabrics.org/mailman/listinfo/ewg ^ permalink raw reply [flat|nested] 3+ messages in thread
[parent not found: <1432655263.28905.115.camel-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>]
* Re: [PATCH] libmlx5: Implement missing open_qp verb [not found] ` <1432655263.28905.115.camel-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org> @ 2015-05-26 16:48 ` Sébastien Dugué 0 siblings, 0 replies; 3+ messages in thread From: Sébastien Dugué @ 2015-05-26 16:48 UTC (permalink / raw) To: Doug Ledford; +Cc: Sébastien Dugué, Eli Cohen, linux-rdma, OF EWG Hi Doug, On Tue, 26 May 2015 11:47:43 -0400 Doug Ledford <dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org> wrote: > On Mon, 2015-05-18 at 11:02 +0200, Sébastien Dugué wrote: > > Commit 0c7ac1083831 added XRC support for mlx5, however this is missing > > the open_qp verb. > > > > Signed-off-by: Sébastien Dugué <sebastien.dugue-6ktuUTfB/bM@public.gmane.org> > > Patch looks reasonable. However, I didn't review it to make sure that > it interacts with other libmlx5 internals properly, just for the obvious > things (locks handled properly, proper error unwind, etc). I'm assuming > Eli will process this, for now I'm removing it from patchworks (Eli > isn't listed as a maintainer there so he can't remove it, which > highlights one of the difficulties of this list being used for both > kernel and user space patches...there are lots of user space maintainers > and most of them aren't list as such in patchworks). Yep, I was hoping for Eli to acknowledge it one way or the other, but still no news so far. Thanks. Sébastien. > > > --- > > src/mlx5.c | 1 + > > src/mlx5.h | 2 ++ > > src/verbs.c | 38 ++++++++++++++++++++++++++++++++++++++ > > 3 files changed, 41 insertions(+) > > > > diff --git a/src/mlx5.c b/src/mlx5.c > > index d02328881992..39f59975d3d2 100644 > > --- a/src/mlx5.c > > +++ b/src/mlx5.c > > @@ -579,6 +579,7 @@ static int mlx5_init_context(struct verbs_device *vdev, > > context->ibv_ctx.ops = mlx5_ctx_ops; > > > > verbs_set_ctx_op(v_ctx, create_qp_ex, mlx5_create_qp_ex); > > + verbs_set_ctx_op(v_ctx, open_qp, mlx5_open_qp); > > verbs_set_ctx_op(v_ctx, open_xrcd, mlx5_open_xrcd); > > verbs_set_ctx_op(v_ctx, close_xrcd, mlx5_close_xrcd); > > verbs_set_ctx_op(v_ctx, create_srq_ex, mlx5_create_srq_ex); > > diff --git a/src/mlx5.h b/src/mlx5.h > > index 6ad79fe324d3..f548e51ee338 100644 > > --- a/src/mlx5.h > > +++ b/src/mlx5.h > > @@ -613,6 +613,8 @@ void *mlx5_get_send_wqe(struct mlx5_qp *qp, int n); > > int mlx5_copy_to_recv_wqe(struct mlx5_qp *qp, int idx, void *buf, int size); > > int mlx5_copy_to_send_wqe(struct mlx5_qp *qp, int idx, void *buf, int size); > > int mlx5_copy_to_recv_srq(struct mlx5_srq *srq, int idx, void *buf, int size); > > +struct ibv_qp *mlx5_open_qp(struct ibv_context *context, > > + struct ibv_qp_open_attr *attr); > > struct ibv_xrcd *mlx5_open_xrcd(struct ibv_context *context, > > struct ibv_xrcd_init_attr *xrcd_init_attr); > > int mlx5_get_srq_num(struct ibv_srq *srq, uint32_t *srq_num); > > diff --git a/src/verbs.c b/src/verbs.c > > index 8ddf4e631c9f..dc899bce4e00 100644 > > --- a/src/verbs.c > > +++ b/src/verbs.c > > @@ -1122,6 +1122,44 @@ int mlx5_modify_qp(struct ibv_qp *qp, struct ibv_qp_attr *attr, > > return ret; > > } > > > > +struct ibv_qp *mlx5_open_qp(struct ibv_context *context, > > + struct ibv_qp_open_attr *attr) > > +{ > > + struct ibv_open_qp cmd; > > + struct ibv_create_qp_resp resp; > > + struct mlx5_qp *qp; > > + int ret; > > + struct mlx5_context *ctx = to_mctx(context); > > + > > + qp = calloc(1, sizeof(*qp)); > > + > > + if (!qp) > > + return NULL; > > + > > + ret = ibv_cmd_open_qp(context, &qp->verbs_qp, sizeof(qp->verbs_qp), > > + attr, &cmd, sizeof(cmd), &resp, sizeof(resp)); > > + if (ret) > > + goto err; > > + > > + pthread_mutex_lock(&ctx->qp_table_mutex); > > + ret = mlx5_store_qp(ctx, qp->verbs_qp.qp.qp_num, qp); > > + > > + if (ret) { > > + pthread_mutex_unlock(&ctx->qp_table_mutex); > > + fprintf(stderr, "mlx5_store_qp failed ret=%d\n", ret); > > + goto destroy; > > + } > > + pthread_mutex_unlock(&ctx->qp_table_mutex); > > + > > + return (struct ibv_qp *)&qp->verbs_qp; > > + > > +destroy: > > + ibv_cmd_destroy_qp(&qp->verbs_qp.qp); > > +err: > > + free(qp); > > + return NULL; > > +} > > + > > struct ibv_ah *mlx5_create_ah(struct ibv_pd *pd, struct ibv_ah_attr *attr) > > { > > struct mlx5_ah *ah; > > -- 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] 3+ messages in thread
end of thread, other threads:[~2015-05-26 16:48 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-05-18 9:02 [PATCH] libmlx5: Implement missing open_qp verb Sébastien Dugué
2015-05-26 15:47 ` Doug Ledford
[not found] ` <1432655263.28905.115.camel-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2015-05-26 16:48 ` Sébastien Dugué
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox