From 1c14a1be69449d063fe8bb1c9b346b72fcf68f5c Mon Sep 17 00:00:00 2001 From: Sean Hefty Date: Tue, 25 Sep 2012 17:06:45 -0700 Subject: [PATCH] Refresh of xrcd --- include/infiniband/verbs.h | 14 +++++++------- src/cmd.c | 2 +- src/verbs.c | 27 --------------------------- 3 files changed, 8 insertions(+), 35 deletions(-) diff --git a/include/infiniband/verbs.h b/include/infiniband/verbs.h index 317e725..186bcec 100644 --- a/include/infiniband/verbs.h +++ b/include/infiniband/verbs.h @@ -757,11 +757,10 @@ static inline struct verbs_context *verbs_get_ctx( return container_of(ctx, struct verbs_context, context); } -#define verbs_get_ctx_op(ctx, op) { \ - struct verbs_context *vctx = verbs_get_ctx(xrcd->context); \ - return (!vctx || \ - (vctx->sz < sizeof(*vctx) - offsetof(struct verbs_context, op)) || \ - !vctx->op) ? NULL : vctx; } +#define verbs_get_ctx_op(ctx, op) ({ \ + struct verbs_context *vctx = verbs_get_ctx(ctx); \ + (!vctx || (vctx->sz < sizeof(*vctx) - offsetof(struct verbs_context, op)) || \ + !vctx->op) ? NULL : vctx; }) static inline struct verbs_device *verbs_get_device( const struct ibv_device *dev) @@ -882,7 +881,8 @@ int ibv_dealloc_pd(struct ibv_pd *pd); /** * ibv_open_xrcd - Open an extended connection domain */ -struct ibv_xrcd *ibv_open_xrcd(struct ibv_context *context, int fd, int oflags) +static inline struct ibv_xrcd * +ibv_open_xrcd(struct ibv_context *context, int fd, int oflags) { struct verbs_context *vctx = verbs_get_ctx_op(context, open_xrcd); return vctx ? vctx->open_xrcd(context, fd, oflags) : NULL; @@ -891,7 +891,7 @@ struct ibv_xrcd *ibv_open_xrcd(struct ibv_context *context, int fd, int oflags) /** * ibv_close_xrcd - Close an extended connection domain */ -int ibv_close_xrcd(struct ibv_xrcd *xrcd) +static inline int ibv_close_xrcd(struct ibv_xrcd *xrcd) { struct verbs_context *vctx = verbs_get_ctx(xrcd->context); return vctx->close_xrcd(xrcd); diff --git a/src/cmd.c b/src/cmd.c index ae8a239..14ffbac 100644 --- a/src/cmd.c +++ b/src/cmd.c @@ -208,7 +208,7 @@ int ibv_cmd_open_xrcd(struct verbs_context *context, struct verbs_xrcd *xrcd, VALGRIND_MAKE_MEM_DEFINED(resp, resp_size); - xrcd->xrcd.context = context; + xrcd->xrcd.context = &context->context; xrcd->comp_mask = IBV_XRCD_HANDLE; xrcd->handle = resp->xrcd_handle; diff --git a/src/verbs.c b/src/verbs.c index d2479e8..b5938f2 100644 --- a/src/verbs.c +++ b/src/verbs.c @@ -154,33 +154,6 @@ int __ibv_dealloc_pd(struct ibv_pd *pd) } default_symver(__ibv_dealloc_pd, ibv_dealloc_pd); -struct ibv_xrcd *__ibv_open_xrcd(struct ibv_context *context, int fd, int oflags) -{ - struct verbs_context *context_ex = verbs_get_ctx(context); - struct verbs_xrcd *xrcd; - - if (!context_ex->open_xrcd) { - errno = ENOSYS; - return NULL; - } - - xrcd = context_ex->open_xrcd(context, fd, oflags); - if (xrcd) - xrcd->xrcd.context = context; - - return &xrcd.xrcd; -} -default_symver(__ibv_open_xrcd, ibv_open_xrcd); - -int __ibv_close_xrcd(struct ibv_xrcd *xrcd) -{ - struct verbs_context *context_ex = verbs_get_ctx(xrcd->context); - struct verbs_xrcd *vxrcd = container_of(xrcd, struct verbs_xrcc, xrcd); - - return context_ex->close_xrcd(vxrcd); -} -default_symver(__ibv_close_xrcd, ibv_close_xrcd); - struct ibv_mr *__ibv_reg_mr(struct ibv_pd *pd, void *addr, size_t length, int access) { -- 2.41.0