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)
/**
* 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;
/**
* 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);
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;
}
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)
{