public inbox for linux-rdma@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH for-next] RDMA/nldev: Add parent bdf to device information dump
@ 2020-11-03 13:26 Gal Pressman
  2020-11-03 13:31 ` Parav Pandit
  2020-11-03 13:45 ` Jason Gunthorpe
  0 siblings, 2 replies; 25+ messages in thread
From: Gal Pressman @ 2020-11-03 13:26 UTC (permalink / raw)
  To: Jason Gunthorpe, Doug Ledford; +Cc: linux-rdma, Leon Romanovsky, Gal Pressman

Add the ability to query the device's bdf through rdma tool netlink
command (in addition to the sysfs infra).

In case of virtual devices (rxe/siw), the netdev bdf will be shown.

Signed-off-by: Gal Pressman <galpress@amazon.com>
---
 drivers/infiniband/core/nldev.c  | 10 +++++++++-
 include/uapi/rdma/rdma_netlink.h |  5 +++++
 2 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/drivers/infiniband/core/nldev.c b/drivers/infiniband/core/nldev.c
index 12d29d54a081..9704b1449c01 100644
--- a/drivers/infiniband/core/nldev.c
+++ b/drivers/infiniband/core/nldev.c
@@ -291,7 +291,15 @@ static int fill_dev_info(struct sk_buff *msg, struct ib_device *device)
 	else if (rdma_protocol_usnic(device, port))
 		ret = nla_put_string(msg, RDMA_NLDEV_ATTR_DEV_PROTOCOL,
 				     "usnic");
-	return ret;
+	if (ret)
+		return ret;
+
+	if (device->dev.parent)
+		if (nla_put_string(msg, RDMA_NLDEV_PARENT_BDF,
+				   dev_name(device->dev.parent)))
+			return -EMSGSIZE;
+
+	return 0;
 }
 
 static int fill_port_info(struct sk_buff *msg,
diff --git a/include/uapi/rdma/rdma_netlink.h b/include/uapi/rdma/rdma_netlink.h
index d2f5b8396243..7495104668eb 100644
--- a/include/uapi/rdma/rdma_netlink.h
+++ b/include/uapi/rdma/rdma_netlink.h
@@ -533,6 +533,11 @@ enum rdma_nldev_attr {
 
 	RDMA_NLDEV_ATTR_RES_RAW,	/* binary */
 
+	/*
+	 * Parent device BDF (bus, device, function).
+	 */
+	RDMA_NLDEV_PARENT_BDF,			/* string */
+
 	/*
 	 * Always the end
 	 */
-- 
2.29.1


^ permalink raw reply related	[flat|nested] 25+ messages in thread

end of thread, other threads:[~2020-11-10 13:54 UTC | newest]

Thread overview: 25+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-11-03 13:26 [PATCH for-next] RDMA/nldev: Add parent bdf to device information dump Gal Pressman
2020-11-03 13:31 ` Parav Pandit
2020-11-03 13:45 ` Jason Gunthorpe
2020-11-03 13:57   ` Leon Romanovsky
2020-11-03 14:11     ` Gal Pressman
2020-11-03 14:22       ` Jason Gunthorpe
2020-11-03 15:45         ` Gal Pressman
2020-11-05 20:00           ` Jason Gunthorpe
2020-11-08 13:03             ` Gal Pressman
2020-11-08 14:36               ` Parav Pandit
2020-11-08 23:49               ` Jason Gunthorpe
2020-11-09  5:09                 ` Leon Romanovsky
2020-11-09  9:03                   ` Gal Pressman
2020-11-09 11:55                     ` Leon Romanovsky
2020-11-09 12:27                       ` Gal Pressman
2020-11-09 12:32                         ` Leon Romanovsky
2020-11-09 12:47                           ` Gal Pressman
2020-11-09 13:02                             ` Leon Romanovsky
2020-11-09 13:52                               ` Gal Pressman
2020-11-09 14:12                                 ` Leon Romanovsky
2020-11-09  9:03                 ` Gal Pressman
2020-11-09 17:57                   ` Jason Gunthorpe
2020-11-10  7:49                     ` Gal Pressman
2020-11-10 13:41                       ` Jason Gunthorpe
2020-11-10 13:54                         ` Leon Romanovsky

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox