net: dsa: microchip: implement multi-bridge support

Linux Kernel / Linux Kernel - Oleksij Rempel [pengutronix.de] - 26 November 2021 20:46 UTC

Current driver version is able to handle only one bridge at time. Configuring two bridges on two different ports would end up shorting this bridges by HW. To reproduce it:

ip l a name br0 type bridge ip l a name br1 type bridge ip l s dev br0 up ip l s dev br1 up ip l s lan1 master br0 ip l s dev lan1 up ip l s lan2 master br1 ip l s dev lan2 up

Ping on lan1 and get response on lan2, which should not happen.

This happened, because current driver version is storing one global "Port VLAN Membership" and applying it to all ports which are members of any bridge. To solve this issue, we need to handle each port separately.

This patch is dropping the global port member storage and calculating membership dynamically depending on STP state and bridge participation.

Note: STP support was broken before this patch and should be fixed separately.

Fixes: c2e866911e25 ("net: dsa: microchip: break KSZ9477 DSA driver into two files")

b3612ccdf284 net: dsa: microchip: implement multi-bridge support
drivers/net/dsa/microchip/ksz8795.c | 56 ++++-------------------------
drivers/net/dsa/microchip/ksz9477.c | 66 +++++-----------------------------
drivers/net/dsa/microchip/ksz_common.c | 50 ++++++++++++++------------
drivers/net/dsa/microchip/ksz_common.h | 4 ---
4 files changed, 43 insertions(+), 133 deletions(-)

Upstream: git.kernel.org


  • Share