Skip to content

Commit acf1ee4

Browse files
paravmellanoxdavem330
authored andcommitted
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 <[email protected]> Signed-off-by: Parav Pandit <[email protected]> Acked-by: Jakub Kicinski <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent c04d102 commit acf1ee4

File tree

2 files changed

+3
-0
lines changed

2 files changed

+3
-0
lines changed

include/uapi/linux/devlink.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,7 @@ enum devlink_port_flavour {
187187
* for the PCI VF. It is an internal
188188
* port that faces the PCI VF.
189189
*/
190+
DEVLINK_PORT_FLAVOUR_VIRTUAL, /* Any virtual port facing the user. */
190191
};
191192

192193
enum devlink_param_cmode {

net/core/devlink.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -545,6 +545,7 @@ static int devlink_nl_port_attrs_put(struct sk_buff *msg,
545545
case DEVLINK_PORT_FLAVOUR_PHYSICAL:
546546
case DEVLINK_PORT_FLAVOUR_CPU:
547547
case DEVLINK_PORT_FLAVOUR_DSA:
548+
case DEVLINK_PORT_FLAVOUR_VIRTUAL:
548549
if (nla_put_u32(msg, DEVLINK_ATTR_PORT_NUMBER,
549550
attrs->phys.port_number))
550551
return -EMSGSIZE;
@@ -6806,6 +6807,7 @@ static int __devlink_port_phys_port_name_get(struct devlink_port *devlink_port,
68066807

68076808
switch (attrs->flavour) {
68086809
case DEVLINK_PORT_FLAVOUR_PHYSICAL:
6810+
case DEVLINK_PORT_FLAVOUR_VIRTUAL:
68096811
if (!attrs->split)
68106812
n = snprintf(name, len, "p%u", attrs->phys.port_number);
68116813
else

0 commit comments

Comments
 (0)