Commit acf1ee44ca5da39755d2aa9080392eae46a0eb34

Authored by Parav Pandit
Committed by David S. Miller
1 parent c04d102ba5

devlink: Introduce devlink port flavour virtual

Currently mlx5 PCI PF and VF devlink devices register their ports as
physical port in non-representors mode.

Introduce a new port flavour as virtual so that virtual devices can
register 'virtual' flavour to make it more clear to users.

An example of one PCI PF and 2 PCI virtual functions, each having
one devlink port.

$ devlink port show
pci/0000:06:00.0/1: type eth netdev ens2f0 flavour physical port 0
pci/0000:06:00.2/1: type eth netdev ens2f2 flavour virtual port 0
pci/0000:06:00.3/1: type eth netdev ens2f3 flavour virtual port 0

Reviewed-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: Parav Pandit <parav@mellanox.com>
Acked-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>

Showing 2 changed files with 3 additions and 0 deletions Side-by-side Diff

include/uapi/linux/devlink.h
... ... @@ -187,6 +187,7 @@
187 187 * for the PCI VF. It is an internal
188 188 * port that faces the PCI VF.
189 189 */
  190 + DEVLINK_PORT_FLAVOUR_VIRTUAL, /* Any virtual port facing the user. */
190 191 };
191 192  
192 193 enum devlink_param_cmode {
... ... @@ -545,6 +545,7 @@
545 545 case DEVLINK_PORT_FLAVOUR_PHYSICAL:
546 546 case DEVLINK_PORT_FLAVOUR_CPU:
547 547 case DEVLINK_PORT_FLAVOUR_DSA:
  548 + case DEVLINK_PORT_FLAVOUR_VIRTUAL:
548 549 if (nla_put_u32(msg, DEVLINK_ATTR_PORT_NUMBER,
549 550 attrs->phys.port_number))
550 551 return -EMSGSIZE;
... ... @@ -6806,6 +6807,7 @@
6806 6807  
6807 6808 switch (attrs->flavour) {
6808 6809 case DEVLINK_PORT_FLAVOUR_PHYSICAL:
  6810 + case DEVLINK_PORT_FLAVOUR_VIRTUAL:
6809 6811 if (!attrs->split)
6810 6812 n = snprintf(name, len, "p%u", attrs->phys.port_number);
6811 6813 else