[RFC rdma-next 02/11] RDMA/nldev: Export unique identifier for PD objects

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Leon Romanovsky <leonro@xxxxxxxxxxxx>

Allow user space applications directly ask for a PD object
by exporting unique identifier.

Signed-off-by: Leon Romanovsky <leonro@xxxxxxxxxxxx>
---
 drivers/infiniband/core/nldev.c  | 4 ++++
 include/uapi/rdma/rdma_netlink.h | 4 ++++
 2 files changed, 8 insertions(+)

diff --git a/drivers/infiniband/core/nldev.c b/drivers/infiniband/core/nldev.c
index ba8ce8058178..68f9a630dfaa 100644
--- a/drivers/infiniband/core/nldev.c
+++ b/drivers/infiniband/core/nldev.c
@@ -107,6 +107,7 @@ 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 },
 };

 static int put_driver_name_print_type(struct sk_buff *msg, const char *name,
@@ -589,6 +590,9 @@ static int fill_res_pd_entry(struct sk_buff *msg, struct netlink_callback *cb,
 			pd->unsafe_global_rkey))
 		goto err;

+	if (nla_put_u32(msg, RDMA_NLDEV_ATTR_RES_PDN, pd->pdn))
+		goto err;
+
 	if (fill_res_name_pid(msg, res))
 		goto err;

diff --git a/include/uapi/rdma/rdma_netlink.h b/include/uapi/rdma/rdma_netlink.h
index 2e18b77a817f..97e82991fcee 100644
--- a/include/uapi/rdma/rdma_netlink.h
+++ b/include/uapi/rdma/rdma_netlink.h
@@ -430,6 +430,10 @@ enum rdma_nldev_attr {
 	RDMA_NLDEV_ATTR_DRIVER_S64,		/* s64 */
 	RDMA_NLDEV_ATTR_DRIVER_U64,		/* u64 */

+	/*
+	 * PD identifier, unique across IB device
+	 */
+	RDMA_NLDEV_ATTR_RES_PDN,		/* u32 */
 	/*
 	 * Always the end
 	 */
--
2.19.1




[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Photo]     [Yosemite News]     [Yosemite Photos]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux