]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
RDMA/nldev: Share with user-space object IDs
authorLeon Romanovsky <leonro@mellanox.com>
Mon, 18 Feb 2019 20:25:49 +0000 (22:25 +0200)
committerJason Gunthorpe <jgg@mellanox.com>
Tue, 19 Feb 2019 17:13:39 +0000 (10:13 -0700)
Give to the user space tools unique identifier for PD, MR, CQ and CM_ID
objects, so they can be able to query on them with .doit callbacks.

QP .doit is not supported yet, till all drivers will be updated to provide
their LQPN to be equal to their restrack ID.

Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
drivers/infiniband/core/nldev.c
include/uapi/rdma/rdma_netlink.h

index 9b4f891771c45c773f2d9cf8eb016fd94d8e322d..81d7ee3dcb20b05e4c601dafe82b283f3b9c177c 100644 (file)
@@ -108,6 +108,10 @@ static const struct nla_policy nldev_policy[RDMA_NLDEV_ATTR_MAX] = {
        [RDMA_NLDEV_ATTR_DRIVER_U32]            = { .type = NLA_U32 },
        [RDMA_NLDEV_ATTR_DRIVER_S64]            = { .type = NLA_S64 },
        [RDMA_NLDEV_ATTR_DRIVER_U64]            = { .type = NLA_U64 },
+       [RDMA_NLDEV_ATTR_RES_PDN]               = { .type = NLA_U32 },
+       [RDMA_NLDEV_ATTR_RES_CQN]               = { .type = NLA_U32 },
+       [RDMA_NLDEV_ATTR_RES_MRN]               = { .type = NLA_U32 },
+       [RDMA_NLDEV_ATTR_RES_CM_IDN]            = { .type = NLA_U32 },
 };
 
 static int put_driver_name_print_type(struct sk_buff *msg, const char *name,
@@ -466,6 +470,9 @@ static int fill_res_cm_id_entry(struct sk_buff *msg, bool has_cap_net_admin,
                    &cm_id->route.addr.dst_addr))
                goto err;
 
+       if (nla_put_u32(msg, RDMA_NLDEV_ATTR_RES_CM_IDN, res->id))
+               goto err;
+
        if (fill_res_name_pid(msg, res))
                goto err;
 
@@ -494,6 +501,9 @@ static int fill_res_cq_entry(struct sk_buff *msg, bool has_cap_net_admin,
            nla_put_u8(msg, RDMA_NLDEV_ATTR_RES_POLL_CTX, cq->poll_ctx))
                goto err;
 
+       if (nla_put_u32(msg, RDMA_NLDEV_ATTR_RES_CQN, res->id))
+               goto err;
+
        if (fill_res_name_pid(msg, res))
                goto err;
 
@@ -522,6 +532,9 @@ static int fill_res_mr_entry(struct sk_buff *msg, bool has_cap_net_admin,
                              RDMA_NLDEV_ATTR_PAD))
                goto err;
 
+       if (nla_put_u32(msg, RDMA_NLDEV_ATTR_RES_MRN, res->id))
+               goto err;
+
        if (fill_res_name_pid(msg, res))
                goto err;
 
@@ -552,6 +565,9 @@ static int fill_res_pd_entry(struct sk_buff *msg, bool has_cap_net_admin,
                              atomic_read(&pd->usecnt), RDMA_NLDEV_ATTR_PAD))
                goto err;
 
+       if (nla_put_u32(msg, RDMA_NLDEV_ATTR_RES_PDN, res->id))
+               goto err;
+
        if (fill_res_name_pid(msg, res))
                goto err;
 
@@ -893,6 +909,7 @@ static const struct nldev_fill_res_entry fill_entries[RDMA_RESTRACK_MAX] = {
                .nldev_cmd = RDMA_NLDEV_CMD_RES_CM_ID_GET,
                .nldev_attr = RDMA_NLDEV_ATTR_RES_CM_ID,
                .entry = RDMA_NLDEV_ATTR_RES_CM_ID_ENTRY,
+               .id = RDMA_NLDEV_ATTR_RES_CM_IDN,
        },
        [RDMA_RESTRACK_CQ] = {
                .fill_res_func = fill_res_cq_entry,
@@ -900,6 +917,7 @@ static const struct nldev_fill_res_entry fill_entries[RDMA_RESTRACK_MAX] = {
                .nldev_attr = RDMA_NLDEV_ATTR_RES_CQ,
                .flags = NLDEV_PER_DEV,
                .entry = RDMA_NLDEV_ATTR_RES_CQ_ENTRY,
+               .id = RDMA_NLDEV_ATTR_RES_CQN,
        },
        [RDMA_RESTRACK_MR] = {
                .fill_res_func = fill_res_mr_entry,
@@ -907,6 +925,7 @@ static const struct nldev_fill_res_entry fill_entries[RDMA_RESTRACK_MAX] = {
                .nldev_attr = RDMA_NLDEV_ATTR_RES_MR,
                .flags = NLDEV_PER_DEV,
                .entry = RDMA_NLDEV_ATTR_RES_MR_ENTRY,
+               .id = RDMA_NLDEV_ATTR_RES_MRN,
        },
        [RDMA_RESTRACK_PD] = {
                .fill_res_func = fill_res_pd_entry,
@@ -914,6 +933,7 @@ static const struct nldev_fill_res_entry fill_entries[RDMA_RESTRACK_MAX] = {
                .nldev_attr = RDMA_NLDEV_ATTR_RES_PD,
                .flags = NLDEV_PER_DEV,
                .entry = RDMA_NLDEV_ATTR_RES_PD_ENTRY,
+               .id = RDMA_NLDEV_ATTR_RES_PDN,
        },
 };
 
index 3a9e681e4257be750f695ad88722af5848637011..43362132e0d7357e29f00fe1e21639d179ebbb7f 100644 (file)
@@ -456,6 +456,15 @@ enum rdma_nldev_attr {
        RDMA_NLDEV_ATTR_DRIVER_S64,             /* s64 */
        RDMA_NLDEV_ATTR_DRIVER_U64,             /* u64 */
 
+       /*
+        * Indexes to get/set secific entry,
+        * for QP use RDMA_NLDEV_ATTR_RES_LQPN
+        */
+       RDMA_NLDEV_ATTR_RES_PDN,               /* u32 */
+       RDMA_NLDEV_ATTR_RES_CQN,               /* u32 */
+       RDMA_NLDEV_ATTR_RES_MRN,               /* u32 */
+       RDMA_NLDEV_ATTR_RES_CM_IDN,            /* u32 */
+
        /*
         * Always the end
         */