[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200918101649.60086-4-parav@nvidia.com>
Date: Fri, 18 Sep 2020 13:16:49 +0300
From: Parav Pandit <parav@...dia.com>
To: <netdev@...r.kernel.org>, <stephen@...workplumber.org>,
<dsahern@...nel.org>
CC: Parav Pandit <parav@...dia.com>, Jiri Pirko <jiri@...dia.com>
Subject: [PATCH iproute2-next RESEND 3/3] devlink: Show controller number of a devlink port
Show the controller number of the devlink port whenever kernel reports
it.
Example of a PCI VF port for an external controller number 1:
$ devlink port show pci/0000:06:00.0/2
pci/0000:06:00.0/2: type eth netdev ens2f0c1pf0vf1 flavour pcivf controller 1 pfnum 0 vfnum 1 external true splittable false
function:
hw_addr 00:00:00:00:00:00
$ devlink port show pci/0000:06:00.0/2 -jp
{
"port": {
"pci/0000:06:00.0/2": {
"type": "eth",
"netdev": "ens2f0c1pf0vf1",
"flavour": "pcivf",
"controller": 1,
"pfnum": 0,
"vfnum": 1,
"external": true,
"splittable": false,
"function": {
"hw_addr": "00:00:00:00:00:00"
}
}
}
}
Signed-off-by: Parav Pandit <parav@...dia.com>
Reviewed-by: Jiri Pirko <jiri@...dia.com>
---
devlink/devlink.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/devlink/devlink.c b/devlink/devlink.c
index 9f99c031..0374175e 100644
--- a/devlink/devlink.c
+++ b/devlink/devlink.c
@@ -3343,6 +3343,9 @@ static void pr_out_port_pfvf_num(struct dl *dl, struct nlattr **tb)
{
uint16_t fn_num;
+ if (tb[DEVLINK_ATTR_PORT_CONTROLLER_NUMBER])
+ print_uint(PRINT_ANY, "controller", " controller %u",
+ mnl_attr_get_u32(tb[DEVLINK_ATTR_PORT_CONTROLLER_NUMBER]));
if (tb[DEVLINK_ATTR_PORT_PCI_PF_NUMBER]) {
fn_num = mnl_attr_get_u16(tb[DEVLINK_ATTR_PORT_PCI_PF_NUMBER]);
print_uint(PRINT_ANY, "pfnum", " pfnum %u", fn_num);
--
2.26.2
Powered by blists - more mailing lists