net: mscc: ocelot: rebalance LAGs on link up/down events
authorVladimir Oltean <vladimir.oltean@nxp.com>
Fri, 5 Feb 2021 22:02:19 +0000 (00:02 +0200)
committerJakub Kicinski <kuba@kernel.org>
Sat, 6 Feb 2021 22:51:51 +0000 (14:51 -0800)
commit23ca3b727ee6b432166391607b614d3a6beb6784
tree3dd53f46f04d8e8d9dc9dad7a3b12d356c3d5a1b
parent21357b614d3fcf8203b32468d1c8e6332ea25aa1
net: mscc: ocelot: rebalance LAGs on link up/down events

At present there is an issue when ocelot is offloading a bonding
interface, but one of the links of the physical ports goes down. Traffic
keeps being hashed towards that destination, and of course gets dropped
on egress.

Monitor the netdev notifier events emitted by the bonding driver for
changes in the physical state of lower interfaces, to determine which
ports are active and which ones are no longer.

Then extend ocelot_get_bond_mask to return either the configured bonding
interfaces, or the active ones, depending on a boolean argument. The
code that does rebalancing only needs to do so among the active ports,
whereas the bridge forwarding mask and the logical port IDs still need
to look at the permanently bonded ports.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/mscc/ocelot.c
drivers/net/ethernet/mscc/ocelot.h
drivers/net/ethernet/mscc/ocelot_net.c
include/soc/mscc/ocelot.h