History

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

Parav Pandit committed 6 years ago

Commit acf1ee41 parent c04d1022 files · +3 −0Browse files

Unified · Split

2 files
  1. include/uapi/linux/devlink.h +1 −0
  2. net/core/devlink.c +2 −0
include/uapi/linux/devlink.h+1−0
@@ -187,6 +187,7 @@ enum devlink_port_flavour { · 186 unmodified lines
187 * for the PCI VF. It is an internal187 * for the PCI VF. It is an internal
188 * port that faces the PCI VF.188 * port that faces the PCI VF.
189 */189 */
190 DEVLINK_PORT_FLAVOUR_VIRTUAL, /* Any virtual port facing the user. */
190};191};
191 192
192enum devlink_param_cmode {193enum devlink_param_cmode {
net/core/devlink.c+2−0
@@ -545,6 +545,7 @@ static int devlink_nl_port_attrs_put(struct sk_buff *msg, · 544 unmodified lines
545 case DEVLINK_PORT_FLAVOUR_PHYSICAL:545 case DEVLINK_PORT_FLAVOUR_PHYSICAL:
546 case DEVLINK_PORT_FLAVOUR_CPU:546 case DEVLINK_PORT_FLAVOUR_CPU:
547 case DEVLINK_PORT_FLAVOUR_DSA:547 case DEVLINK_PORT_FLAVOUR_DSA:
548 case DEVLINK_PORT_FLAVOUR_VIRTUAL:
548 if (nla_put_u32(msg, DEVLINK_ATTR_PORT_NUMBER,549 if (nla_put_u32(msg, DEVLINK_ATTR_PORT_NUMBER,
549 attrs->phys.port_number))550 attrs->phys.port_number))
550 return -EMSGSIZE;551 return -EMSGSIZE;
@@ -6806,6 +6807,7 @@ static int __devlink_port_phys_port_name_get(struct devlink_port *devlink_port, · 6255 unmodified lines
6806 6807
6807 switch (attrs->flavour) {6808 switch (attrs->flavour) {
6808 case DEVLINK_PORT_FLAVOUR_PHYSICAL:6809 case DEVLINK_PORT_FLAVOUR_PHYSICAL:
6810 case DEVLINK_PORT_FLAVOUR_VIRTUAL:
6809 if (!attrs->split)6811 if (!attrs->split)
6810 n = snprintf(name, len, "p%u", attrs->phys.port_number);6812 n = snprintf(name, len, "p%u", attrs->phys.port_number);
6811 else6813 else