Exchange capability masks between provider and driver during alloc_context verb. Signed-off-by: Bob Pearson <rpearson@xxxxxxx> --- kernel-headers/rdma/rdma_user_rxe.h | 18 ++++++++++++++++++ providers/rxe/rxe-abi.h | 2 ++ providers/rxe/rxe.c | 12 ++++++++---- providers/rxe/rxe.h | 5 +++++ 4 files changed, 33 insertions(+), 4 deletions(-) diff --git a/kernel-headers/rdma/rdma_user_rxe.h b/kernel-headers/rdma/rdma_user_rxe.h index d8f2e0e4..70ac031e 100644 --- a/kernel-headers/rdma/rdma_user_rxe.h +++ b/kernel-headers/rdma/rdma_user_rxe.h @@ -152,6 +158,18 @@ struct rxe_recv_wqe { struct rxe_dma_info dma; }; +enum rxe_capabilities { + RXE_CAP_NONE = 0, +}; + +struct rxe_alloc_context_cmd { + __aligned_u64 provider_cap; +}; + +struct rxe_alloc_context_resp { + __aligned_u64 driver_cap; +}; + struct rxe_create_cq_resp { struct mminfo mi; }; diff --git a/providers/rxe/rxe-abi.h b/providers/rxe/rxe-abi.h index b4680a24..0b0b4b38 100644 --- a/providers/rxe/rxe-abi.h +++ b/providers/rxe/rxe-abi.h @@ -39,6 +39,8 @@ #include <rdma/rdma_user_rxe.h> #include <kernel-abi/rdma_user_rxe.h> +DECLARE_DRV_CMD(urxe_alloc_context, IB_USER_VERBS_CMD_GET_CONTEXT, + rxe_alloc_context_cmd, rxe_alloc_context_resp); DECLARE_DRV_CMD(urxe_create_cq, IB_USER_VERBS_CMD_CREATE_CQ, empty, rxe_create_cq_resp); DECLARE_DRV_CMD(urxe_create_qp, IB_USER_VERBS_CMD_CREATE_QP, diff --git a/providers/rxe/rxe.c b/providers/rxe/rxe.c index ca881304..c29b7de5 100644 --- a/providers/rxe/rxe.c +++ b/providers/rxe/rxe.c @@ -865,18 +865,22 @@ static struct verbs_context *rxe_alloc_context(struct ibv_device *ibdev, void *private_data) { struct rxe_context *context; - struct ibv_get_context cmd; - struct ib_uverbs_get_context_resp resp; + struct urxe_alloc_context cmd = {}; + struct urxe_alloc_context_resp resp = {}; context = verbs_init_and_alloc_context(ibdev, cmd_fd, context, ibv_ctx, RDMA_DRIVER_RXE); if (!context) return NULL; - if (ibv_cmd_get_context(&context->ibv_ctx, &cmd, sizeof(cmd), - &resp, sizeof(resp))) + cmd.provider_cap = RXE_PROVIDER_CAP; + + if (ibv_cmd_get_context(&context->ibv_ctx, &cmd.ibv_cmd, sizeof(cmd), + &resp.ibv_resp, sizeof(resp))) goto out; + context->capabilities = cmd.provider_cap & resp.driver_cap; + verbs_set_ops(&context->ibv_ctx, &rxe_ctx_ops); return &context->ibv_ctx; diff --git a/providers/rxe/rxe.h b/providers/rxe/rxe.h index 96f4ee9c..736cc30e 100644 --- a/providers/rxe/rxe.h +++ b/providers/rxe/rxe.h @@ -48,6 +48,10 @@ enum rdma_network_type { RDMA_NETWORK_IPV6 }; +enum rxe_provider_cap { + RXE_PROVIDER_CAP = RXE_CAP_NONE, +}; + struct rxe_device { struct verbs_device ibv_dev; int abi_version; @@ -55,6 +59,7 @@ struct rxe_device { struct rxe_context { struct verbs_context ibv_ctx; + uint64_t capabilities; }; struct rxe_cq { -- 2.27.0