Commit da077392 authored by Jiri Pirko's avatar Jiri Pirko Committed by David S. Miller

dsa: set devlink port attrs for dsa ports

Set the attrs and allow to expose port flavour to user via devlink.
Signed-off-by: default avatarJiri Pirko <jiri@mellanox.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 08474c1a
...@@ -270,7 +270,28 @@ static int dsa_port_setup(struct dsa_port *dp) ...@@ -270,7 +270,28 @@ static int dsa_port_setup(struct dsa_port *dp)
case DSA_PORT_TYPE_UNUSED: case DSA_PORT_TYPE_UNUSED:
break; break;
case DSA_PORT_TYPE_CPU: 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: 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); err = dsa_port_link_register_of(dp);
if (err) { if (err) {
dev_err(ds->dev, "failed to setup link for port %d.%d\n", 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) ...@@ -279,6 +300,9 @@ static int dsa_port_setup(struct dsa_port *dp)
} }
break; break;
case DSA_PORT_TYPE_USER: 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); err = dsa_slave_create(dp);
if (err) if (err)
dev_err(ds->dev, "failed to create slave for port %d.%d\n", dev_err(ds->dev, "failed to create slave for port %d.%d\n",
......
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