Add support for ibv_alloc_xrcd and ibv_dealloc_xrcd verbs. Signed-off-by: Bob Pearson <rpearsonhpe@xxxxxxxxx> --- providers/rxe/rxe.c | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/providers/rxe/rxe.c b/providers/rxe/rxe.c index 0776279c..3bb9f01c 100644 --- a/providers/rxe/rxe.c +++ b/providers/rxe/rxe.c @@ -128,6 +128,44 @@ static int rxe_dealloc_pd(struct ibv_pd *pd) return ret; } +static struct ibv_xrcd *rxe_open_xrcd(struct ibv_context *context, + struct ibv_xrcd_init_attr *attr) +{ + struct verbs_xrcd *xrcd; + int xrcd_size = sizeof(*xrcd); + struct ibv_open_xrcd cmd = {}; + size_t cmd_size = sizeof(cmd); + struct ib_uverbs_open_xrcd_resp resp = {}; + size_t resp_size = sizeof(resp); + int ret; + + xrcd = calloc(1, sizeof(*xrcd)); + if (!xrcd) + return NULL; + + ret = ibv_cmd_open_xrcd(context, xrcd, xrcd_size, attr, + &cmd, cmd_size, &resp, resp_size); + if (ret) { + free(xrcd); + return NULL; + } + + return &xrcd->xrcd; +} + +static int rxe_close_xrcd(struct ibv_xrcd *ibxrcd) +{ + struct verbs_xrcd *xrcd = container_of(ibxrcd, + struct verbs_xrcd, xrcd); + int ret; + + ret = ibv_cmd_close_xrcd(xrcd); + if (!ret) + free(xrcd); + + return ret; +} + static struct ibv_mw *rxe_alloc_mw(struct ibv_pd *ibpd, enum ibv_mw_type type) { int ret; @@ -1742,6 +1780,8 @@ static const struct verbs_context_ops rxe_ctx_ops = { .query_port = rxe_query_port, .alloc_pd = rxe_alloc_pd, .dealloc_pd = rxe_dealloc_pd, + .open_xrcd = rxe_open_xrcd, + .close_xrcd = rxe_close_xrcd, .reg_mr = rxe_reg_mr, .dereg_mr = rxe_dereg_mr, .alloc_mw = rxe_alloc_mw, -- 2.30.2