diff options
author | Jiri Pirko <jiri@mellanox.com> | 2018-05-18 09:29:03 +0200 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2018-05-19 22:30:39 +0200 |
commit | da077392486b2f87c384bc12b27a16b29620c5e4 (patch) | |
tree | b5571aff818c72eafdf067aec4ad4b89b44038e9 /net/dsa | |
parent | devlink: introduce a helper to generate physical port names (diff) | |
download | linux-da077392486b2f87c384bc12b27a16b29620c5e4.tar.xz linux-da077392486b2f87c384bc12b27a16b29620c5e4.zip |
dsa: set devlink port attrs for dsa ports
Set the attrs and allow to expose port flavour to user via devlink.
Signed-off-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/dsa')
-rw-r--r-- | net/dsa/dsa2.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/net/dsa/dsa2.c b/net/dsa/dsa2.c index adf50fbc4c13..00126cda4319 100644 --- a/net/dsa/dsa2.c +++ b/net/dsa/dsa2.c @@ -270,7 +270,28 @@ static int dsa_port_setup(struct dsa_port *dp) case DSA_PORT_TYPE_UNUSED: break; case DSA_PORT_TYPE_CPU: + /* dp->index is used now as port_number. However + * CPU ports should have separate numbering + * independent from front panel port numbers. + */ + devlink_port_attrs_set(&dp->devlink_port, + DEVLINK_PORT_FLAVOUR_CPU, + dp->index, false, 0); + err = dsa_port_link_register_of(dp); + if (err) { + dev_err(ds->dev, "failed to setup link for port %d.%d\n", + ds->index, dp->index); + return err; + } + break; case DSA_PORT_TYPE_DSA: + /* dp->index is used now as port_number. However + * DSA ports should have separate numbering + * independent from front panel port numbers. + */ + devlink_port_attrs_set(&dp->devlink_port, + DEVLINK_PORT_FLAVOUR_DSA, + dp->index, false, 0); err = dsa_port_link_register_of(dp); if (err) { dev_err(ds->dev, "failed to setup link for port %d.%d\n", @@ -279,6 +300,9 @@ static int dsa_port_setup(struct dsa_port *dp) } break; case DSA_PORT_TYPE_USER: + devlink_port_attrs_set(&dp->devlink_port, + DEVLINK_PORT_FLAVOUR_PHYSICAL, + dp->index, false, 0); err = dsa_slave_create(dp); if (err) dev_err(ds->dev, "failed to create slave for port %d.%d\n", |