Commit acf1ee44 authored by Parav Pandit's avatar Parav Pandit Committed by David S. Miller

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: default avatarJiri Pirko <jiri@mellanox.com>
Signed-off-by: default avatarParav Pandit <parav@mellanox.com>
Acked-by: default avatarJakub Kicinski <kuba@kernel.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent c04d102b
...@@ -187,6 +187,7 @@ enum devlink_port_flavour { ...@@ -187,6 +187,7 @@ enum devlink_port_flavour {
* for the PCI VF. It is an internal * for the PCI VF. It is an internal
* port that faces the PCI VF. * port that faces the PCI VF.
*/ */
DEVLINK_PORT_FLAVOUR_VIRTUAL, /* Any virtual port facing the user. */
}; };
enum devlink_param_cmode { enum devlink_param_cmode {
......
...@@ -545,6 +545,7 @@ static int devlink_nl_port_attrs_put(struct sk_buff *msg, ...@@ -545,6 +545,7 @@ static int devlink_nl_port_attrs_put(struct sk_buff *msg,
case DEVLINK_PORT_FLAVOUR_PHYSICAL: case DEVLINK_PORT_FLAVOUR_PHYSICAL:
case DEVLINK_PORT_FLAVOUR_CPU: case DEVLINK_PORT_FLAVOUR_CPU:
case DEVLINK_PORT_FLAVOUR_DSA: case DEVLINK_PORT_FLAVOUR_DSA:
case DEVLINK_PORT_FLAVOUR_VIRTUAL:
if (nla_put_u32(msg, DEVLINK_ATTR_PORT_NUMBER, if (nla_put_u32(msg, DEVLINK_ATTR_PORT_NUMBER,
attrs->phys.port_number)) attrs->phys.port_number))
return -EMSGSIZE; return -EMSGSIZE;
...@@ -6806,6 +6807,7 @@ static int __devlink_port_phys_port_name_get(struct devlink_port *devlink_port, ...@@ -6806,6 +6807,7 @@ static int __devlink_port_phys_port_name_get(struct devlink_port *devlink_port,
switch (attrs->flavour) { switch (attrs->flavour) {
case DEVLINK_PORT_FLAVOUR_PHYSICAL: case DEVLINK_PORT_FLAVOUR_PHYSICAL:
case DEVLINK_PORT_FLAVOUR_VIRTUAL:
if (!attrs->split) if (!attrs->split)
n = snprintf(name, len, "p%u", attrs->phys.port_number); n = snprintf(name, len, "p%u", attrs->phys.port_number);
else else
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment