OSDN Git Service

net: ocelot: support multiple bridges
authorVladimir Oltean <vladimir.oltean@nxp.com>
Thu, 18 Mar 2021 23:36:36 +0000 (01:36 +0200)
committerDavid S. Miller <davem@davemloft.net>
Fri, 19 Mar 2021 02:13:42 +0000 (19:13 -0700)
commitdf291e54ccca0ef357f07a7b89263f7918d6ed7a
tree77686b1c5d1b263488120b918892a4eeeb6657ef
parentd25fde64d1c271277b801c57a954037f80babbd1
net: ocelot: support multiple bridges

The ocelot switches are a bit odd in that they do not have an STP state
to put the ports into. Instead, the forwarding configuration is delayed
from the typical port_bridge_join into stp_state_set, when the port enters
the BR_STATE_FORWARDING state.

I can only guess that the implementation of this quirk is the reason that
led to the simplification of the driver such that only one bridge could
be offloaded at a time.

We can simplify the data structures somewhat, and introduce a per-port
bridge device pointer and STP state, similar to how the LAG offload
works now (there we have a per-port bonding device pointer and TX
enabled state). This allows offloading multiple bridges with relative
ease, while still keeping in place the quirk to delay the programming of
the PGIDs.

We actually need this change now because we need to remove the bogus
restriction from ocelot_bridge_stp_state_set that ocelot->bridge_mask
needs to contain BIT(port), otherwise that function is a no-op.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/mscc/ocelot.c
include/soc/mscc/ocelot.h