Netdev List
 help / color / mirror / Atom feed
* [PATCH net-next iproute2] devlink: Show devlink port number
@ 2019-07-09 16:33 Parav Pandit
  2019-07-09 17:11 ` David Ahern
  2019-07-09 17:26 ` [PATCH net-next iproute2 v1] " Parav Pandit
  0 siblings, 2 replies; 5+ messages in thread
From: Parav Pandit @ 2019-07-09 16:33 UTC (permalink / raw)
  To: netdev; +Cc: stephen, jiri, dsahern, Parav Pandit

Show devlink port number whenever kernel reports that attribute.

An example output for a physical port.
$ devlink port show
pci/0000:06:00.1/65535: type eth netdev eth1_p1 flavour physical port 1

Acked-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: Parav Pandit <parav@mellanox.com>
---
 devlink/devlink.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/devlink/devlink.c b/devlink/devlink.c
index 559f624e..dba74e04 100644
--- a/devlink/devlink.c
+++ b/devlink/devlink.c
@@ -2806,6 +2806,11 @@ static void pr_out_port(struct dl *dl, struct nlattr **tb)
 
 		pr_out_str(dl, "flavour", port_flavour_name(port_flavour));
 	}
+	if (tb[DEVLINK_ATTR_PORT_NUMBER]) {
+		uint32_t port_number =
+			mnl_attr_get_u32(tb[DEVLINK_ATTR_PORT_NUMBER]);
+		pr_out_uint(dl, "port", port_number);
+	}
 	if (tb[DEVLINK_ATTR_PORT_SPLIT_GROUP])
 		pr_out_uint(dl, "split_group",
 			    mnl_attr_get_u32(tb[DEVLINK_ATTR_PORT_SPLIT_GROUP]));
-- 
2.19.2


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

end of thread, other threads:[~2019-07-09 22:34 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-07-09 16:33 [PATCH net-next iproute2] devlink: Show devlink port number Parav Pandit
2019-07-09 17:11 ` David Ahern
2019-07-09 17:21   ` Parav Pandit
2019-07-09 17:26 ` [PATCH net-next iproute2 v1] " Parav Pandit
2019-07-09 22:33   ` David Ahern

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