@@ -73,6 +73,8 @@ static void rxe_init_device_param(struct rxe_dev *rxe)
rxe->ndev->dev_addr);
rxe->max_ucontext = RXE_MAX_UCONTEXT;
+
+ rxe->driver_cap = RXE_CAP_NONE;
}
/* initialize port attributes */
@@ -110,6 +110,29 @@ static int rxe_alloc_ucontext(struct ib_ucontext *uctx, struct ib_udata *udata)
{
struct rxe_dev *rxe = to_rdev(uctx->device);
struct rxe_ucontext *uc = to_ruc(uctx);
+ struct rxe_alloc_context_cmd cmd = {};
+ struct rxe_alloc_context_resp __user *resp = NULL;
+ int err;
+
+ if (udata) {
+ if (udata->inlen >= sizeof(cmd)) {
+ err = ib_copy_from_udata(&cmd, udata, sizeof(cmd));
+ if (err)
+ return err;
+ }
+
+ if (udata->outlen >= sizeof(resp))
+ resp = udata->outbuf;
+ }
+
+ uc->provider_cap = cmd.provider_cap;
+
+ if (resp) {
+ err = copy_to_user(&resp->driver_cap, &rxe->driver_cap,
+ sizeof(resp->driver_cap));
+ if (err)
+ return err;
+ }
return rxe_add_to_pool(&rxe->uc_pool, &uc->pelem);
}
@@ -36,6 +36,7 @@ static inline int psn_compare(u32 psn_a, u32 psn_b)
struct rxe_ucontext {
struct ib_ucontext ibuc;
struct rxe_pool_entry pelem;
+ u64 provider_cap;
};
struct rxe_pd {
@@ -358,6 +359,8 @@ struct rxe_dev {
struct net_device *ndev;
+ u64 driver_cap;
+
int xmit_errors;
struct rxe_pool uc_pool;
@@ -158,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;
};
Exchange provider and driver capabilities during alloc_ucontext verb. Default is none. Will allow more flexibility in ABI extensions without breaking compatibility. Signed-off-by: Bob Pearson <rpearson@hpe.com> --- drivers/infiniband/sw/rxe/rxe.c | 2 ++ drivers/infiniband/sw/rxe/rxe_verbs.c | 23 +++++++++++++++++++++++ drivers/infiniband/sw/rxe/rxe_verbs.h | 3 +++ include/uapi/rdma/rdma_user_rxe.h | 12 ++++++++++++ 4 files changed, 40 insertions(+)