@@ -416,6 +416,7 @@ static const enum mnl_attr_data_type devlink_policy[DEVLINK_ATTR_MAX + 1] = {
[DEVLINK_ATTR_HEALTH_REPORTER_GRACEFUL_PERIOD] = MNL_TYPE_U64,
[DEVLINK_ATTR_PORT_PCI_PF_NUMBER] = MNL_TYPE_U32,
[DEVLINK_ATTR_PORT_PCI_VF_NUMBER] = MNL_TYPE_U32,
+ [DEVLINK_ATTR_PORT_PCI_SUBPORT] = MNL_TYPE_U32,
};
static int attr_cb(const struct nlattr *attr, void *data)
@@ -2821,7 +2822,9 @@ static void pr_out_port(struct dl *dl, struct nlattr **tb)
if (tb[DEVLINK_ATTR_PORT_PCI_VF_NUMBER])
pr_out_uint(dl, "vf",
mnl_attr_get_u32(tb[DEVLINK_ATTR_PORT_PCI_VF_NUMBER]));
-
+ if (tb[DEVLINK_ATTR_PORT_PCI_SUBPORT])
+ pr_out_uint(dl, "subport",
+ mnl_attr_get_u32(tb[DEVLINK_ATTR_PORT_PCI_SUBPORT]));
pr_out_port_handle_end(dl);
}
Add support for reporting PCIe subports. Example (bus 05 device has subports, bus 82 has only one port per function): $ devlink port pci/0000:05:00.0/0: type eth netdev enp5s0np0 flavour physical pci/0000:05:00.0/10000: type eth netdev enp5s0npf0s0 flavour pci_pf pf 0 subport 0 pci/0000:05:00.0/4: type eth netdev enp5s0np1 flavour physical pci/0000:05:00.0/11000: type eth netdev enp5s0npf0s1 flavour pci_pf pf 0 subport 1 pci/0000:82:00.0/0: type eth netdev p4p1 flavour physical pci/0000:82:00.0/10000: type eth netdev eth0 flavour pci_pf pf 0 $ devlink -jp port { "port": { "pci/0000:05:00.0/0": { "type": "eth", "netdev": "enp5s0np0", "flavour": "physical" }, "pci/0000:05:00.0/10000": { "type": "eth", "netdev": "enp5s0npf0s0", "flavour": "pci_pf", "pf": 0, "subport": 0 }, "pci/0000:05:00.0/4": { "type": "eth", "netdev": "enp5s0np1", "flavour": "physical" }, "pci/0000:05:00.0/11000": { "type": "eth", "netdev": "enp5s0npf0s1", "flavour": "pci_pf", "pf": 0, "subport": 1 }, "pci/0000:82:00.0/0": { "type": "eth", "netdev": "p4p1", "flavour": "physical" }, "pci/0000:82:00.0/10000": { "type": "eth", "netdev": "eth0", "flavour": "pci_pf", "pf": 0 } } } Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com> --- devlink/devlink.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)