devlink: Introduce PCI PF and VF port flavour and attribute
Introduce PCI PF and VF port flavour and port attributes such as PF number and VF number. $ devlink port show pci/0000:05:00.0/0: type eth netdev eth0 flavour pcipf pfnum 0 pci/0000:05:00.0/1: type eth netdev eth1 flavour pcivf pfnum 0 vfnum 0 pci/0000:05:00.0/2: type eth netdev eth2 flavour pcivf pfnum 0 vfnum 1 Signed-off-by: Parav Pandit <parav@mellanox.com> Acked-by: Jiri Pirko <jiri@mellanox.com> Signed-off-by: David Ahern <dsahern@gmail.com>
This commit is contained in:
parent
eb105e0d94
commit
056399399a
|
|
@ -2794,11 +2794,29 @@ static const char *port_flavour_name(uint16_t flavour)
|
|||
return "cpu";
|
||||
case DEVLINK_PORT_FLAVOUR_DSA:
|
||||
return "dsa";
|
||||
case DEVLINK_PORT_FLAVOUR_PCI_PF:
|
||||
return "pcipf";
|
||||
case DEVLINK_PORT_FLAVOUR_PCI_VF:
|
||||
return "pcivf";
|
||||
default:
|
||||
return "<unknown flavour>";
|
||||
}
|
||||
}
|
||||
|
||||
static void pr_out_port_pfvf_num(struct dl *dl, struct nlattr **tb)
|
||||
{
|
||||
uint16_t fn_num;
|
||||
|
||||
if (tb[DEVLINK_ATTR_PORT_PCI_PF_NUMBER]) {
|
||||
fn_num = mnl_attr_get_u16(tb[DEVLINK_ATTR_PORT_PCI_PF_NUMBER]);
|
||||
pr_out_uint(dl, "pfnum", fn_num);
|
||||
}
|
||||
if (tb[DEVLINK_ATTR_PORT_PCI_VF_NUMBER]) {
|
||||
fn_num = mnl_attr_get_u16(tb[DEVLINK_ATTR_PORT_PCI_VF_NUMBER]);
|
||||
pr_out_uint(dl, "vfnum", fn_num);
|
||||
}
|
||||
}
|
||||
|
||||
static void pr_out_port(struct dl *dl, struct nlattr **tb)
|
||||
{
|
||||
struct nlattr *pt_attr = tb[DEVLINK_ATTR_PORT_TYPE];
|
||||
|
|
@ -2828,6 +2846,15 @@ static void pr_out_port(struct dl *dl, struct nlattr **tb)
|
|||
mnl_attr_get_u16(tb[DEVLINK_ATTR_PORT_FLAVOUR]);
|
||||
|
||||
pr_out_str(dl, "flavour", port_flavour_name(port_flavour));
|
||||
|
||||
switch (port_flavour) {
|
||||
case DEVLINK_PORT_FLAVOUR_PCI_PF:
|
||||
case DEVLINK_PORT_FLAVOUR_PCI_VF:
|
||||
pr_out_port_pfvf_num(dl, tb);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (tb[DEVLINK_ATTR_PORT_NUMBER]) {
|
||||
uint32_t port_number;
|
||||
|
|
|
|||
Loading…
Reference in New Issue