diff options
author | Vladimir Oltean <vladimir.oltean@nxp.com> | 2021-01-15 04:11:18 +0200 |
---|---|---|
committer | Jakub Kicinski <kuba@kernel.org> | 2021-01-15 20:02:34 -0800 |
commit | 6c30384eb1dec96b678ff9c01c15134b1a0e81f4 (patch) | |
tree | e9b1f735f126545b66be24f6752c070ff72b4323 /include/soc | |
parent | c6c65d47ddebe82cf32f98ea56f10daf82dab16c (diff) | |
download | linux-6c30384eb1dec96b678ff9c01c15134b1a0e81f4.tar.gz linux-6c30384eb1dec96b678ff9c01c15134b1a0e81f4.tar.bz2 linux-6c30384eb1dec96b678ff9c01c15134b1a0e81f4.zip |
net: mscc: ocelot: register devlink ports
Add devlink integration into the mscc_ocelot switchdev driver. All
physical ports (i.e. the unused ones as well) except the CPU port module
at ocelot->num_phys_ports are registered with devlink, and that requires
keeping the devlink_port structure outside struct ocelot_port_private,
since the latter has a 1:1 mapping with a struct net_device (which does
not exist for unused ports).
Since we use devlink_port_type_eth_set to link the devlink port to the
net_device, we can as well remove the .ndo_get_phys_port_name and
.ndo_get_port_parent_id implementations, since devlink takes care of
retrieving the port name and number automatically, once
.ndo_get_devlink_port is implemented.
Note that the felix DSA driver is already integrated with devlink by
default, since that is a thing that the DSA core takes care of. This is
the reason why these devlink stubs were put in ocelot_net.c and not in
the common library. It is also the reason why ocelot::devlink is a
pointer and not a full structure embedded inside struct ocelot: because
the mscc_ocelot driver allocates that by itself (as the container of
struct ocelot, in fact), but in the case of felix, it is DSA who
allocates the devlink, and felix just propagates the pointer towards
struct ocelot.
Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'include/soc')
-rw-r--r-- | include/soc/mscc/ocelot.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/include/soc/mscc/ocelot.h b/include/soc/mscc/ocelot.h index 1dc0c6d0671a..fc7dc6679739 100644 --- a/include/soc/mscc/ocelot.h +++ b/include/soc/mscc/ocelot.h @@ -602,6 +602,8 @@ struct ocelot_port { struct ocelot { struct device *dev; + struct devlink *devlink; + struct devlink_port *devlink_ports; const struct ocelot_ops *ops; struct regmap *targets[TARGET_MAX]; |