linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v1 net 0/1] net: mscc: ocelot: broadcast storm fixup
@ 2021-09-23  2:03 Colin Foster
  2021-09-23  2:03 ` [PATCH v1 net 1/1] net: mscc: ocelot: fix forwarding from BLOCKING ports remaining enabled Colin Foster
  2021-09-23 12:20 ` [PATCH v1 net 0/1] net: mscc: ocelot: broadcast storm fixup patchwork-bot+netdevbpf
  0 siblings, 2 replies; 3+ messages in thread
From: Colin Foster @ 2021-09-23  2:03 UTC (permalink / raw)
  To: netdev, linux-kernel
  Cc: Vladimir Oltean, Claudiu Manoil, Alexandre Belloni,
	UNGLinuxDriver, David S. Miller, Jakub Kicinski

Ocelot ports would still forward out ethernet broadcasts when they were
in the LEARNING or BLOCKING state. This is due to the
ocelot_get_bridge_fwd_mask, which would tell disabled ports to forward
packets out all FORWARDING ports. Broadcast storms would insue.

This patch restores the functionality of disabling forwarding for ports 
that aren't in the FORWARDING state. No more broadcast storms.

Tested and verified on an in-development driver, and Vladimir has done
independent testing and verification on supported hardware.


Vladimir Oltean (1):
  net: mscc: ocelot: fix forwarding from BLOCKING ports remaining
    enabled

 drivers/net/ethernet/mscc/ocelot.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

-- 
2.25.1


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH v1 net 1/1] net: mscc: ocelot: fix forwarding from BLOCKING ports remaining enabled
  2021-09-23  2:03 [PATCH v1 net 0/1] net: mscc: ocelot: broadcast storm fixup Colin Foster
@ 2021-09-23  2:03 ` Colin Foster
  2021-09-23 12:20 ` [PATCH v1 net 0/1] net: mscc: ocelot: broadcast storm fixup patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: Colin Foster @ 2021-09-23  2:03 UTC (permalink / raw)
  To: netdev, linux-kernel
  Cc: Vladimir Oltean, Claudiu Manoil, Alexandre Belloni,
	UNGLinuxDriver, David S. Miller, Jakub Kicinski

From: Vladimir Oltean <vladimir.oltean@nxp.com>

The blamed commit made the fatally incorrect assumption that ports which
aren't in the FORWARDING STP state should not have packets forwarded
towards them, and that is all that needs to be done.

However, that logic alone permits BLOCKING ports to forward to
FORWARDING ports, which of course allows packet storms to occur when
there is an L2 loop.

The ocelot_get_bridge_fwd_mask should not only ask "what can the bridge
do for you", but "what can you do for the bridge". This way, only
FORWARDING ports forward to the other FORWARDING ports from the same
bridging domain, and we are still compatible with the idea of multiple
bridges.

Fixes: df291e54ccca ("net: ocelot: support multiple bridges")
Suggested-by: Colin Foster <colin.foster@in-advantage.com>
Reported-by: Colin Foster <colin.foster@in-advantage.com>
Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Signed-off-by: Colin Foster <colin.foster@in-advantage.com>
---
 drivers/net/ethernet/mscc/ocelot.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/drivers/net/ethernet/mscc/ocelot.c b/drivers/net/ethernet/mscc/ocelot.c
index c581b955efb3..94d80b0f0274 100644
--- a/drivers/net/ethernet/mscc/ocelot.c
+++ b/drivers/net/ethernet/mscc/ocelot.c
@@ -1303,14 +1303,19 @@ static u32 ocelot_get_bond_mask(struct ocelot *ocelot, struct net_device *bond,
 	return mask;
 }
 
-static u32 ocelot_get_bridge_fwd_mask(struct ocelot *ocelot,
+static u32 ocelot_get_bridge_fwd_mask(struct ocelot *ocelot, int src_port,
 				      struct net_device *bridge)
 {
+	struct ocelot_port *ocelot_port = ocelot->ports[src_port];
 	u32 mask = 0;
 	int port;
 
+	if (!ocelot_port || ocelot_port->bridge != bridge ||
+	    ocelot_port->stp_state != BR_STATE_FORWARDING)
+		return 0;
+
 	for (port = 0; port < ocelot->num_phys_ports; port++) {
-		struct ocelot_port *ocelot_port = ocelot->ports[port];
+		ocelot_port = ocelot->ports[port];
 
 		if (!ocelot_port)
 			continue;
@@ -1376,7 +1381,7 @@ void ocelot_apply_bridge_fwd_mask(struct ocelot *ocelot)
 			struct net_device *bridge = ocelot_port->bridge;
 			struct net_device *bond = ocelot_port->bond;
 
-			mask = ocelot_get_bridge_fwd_mask(ocelot, bridge);
+			mask = ocelot_get_bridge_fwd_mask(ocelot, port, bridge);
 			mask |= cpu_fwd_mask;
 			mask &= ~BIT(port);
 			if (bond) {
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH v1 net 0/1] net: mscc: ocelot: broadcast storm fixup
  2021-09-23  2:03 [PATCH v1 net 0/1] net: mscc: ocelot: broadcast storm fixup Colin Foster
  2021-09-23  2:03 ` [PATCH v1 net 1/1] net: mscc: ocelot: fix forwarding from BLOCKING ports remaining enabled Colin Foster
@ 2021-09-23 12:20 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2021-09-23 12:20 UTC (permalink / raw)
  To: Colin Foster
  Cc: netdev, linux-kernel, vladimir.oltean, claudiu.manoil,
	alexandre.belloni, UNGLinuxDriver, davem, kuba

Hello:

This patch was applied to netdev/net.git (refs/heads/master):

On Wed, 22 Sep 2021 19:03:37 -0700 you wrote:
> Ocelot ports would still forward out ethernet broadcasts when they were
> in the LEARNING or BLOCKING state. This is due to the
> ocelot_get_bridge_fwd_mask, which would tell disabled ports to forward
> packets out all FORWARDING ports. Broadcast storms would insue.
> 
> This patch restores the functionality of disabling forwarding for ports
> that aren't in the FORWARDING state. No more broadcast storms.
> 
> [...]

Here is the summary with links:
  - [v1,net,1/1] net: mscc: ocelot: fix forwarding from BLOCKING ports remaining enabled
    https://git.kernel.org/netdev/net/c/acc64f52afac

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-09-23 12:20 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-23  2:03 [PATCH v1 net 0/1] net: mscc: ocelot: broadcast storm fixup Colin Foster
2021-09-23  2:03 ` [PATCH v1 net 1/1] net: mscc: ocelot: fix forwarding from BLOCKING ports remaining enabled Colin Foster
2021-09-23 12:20 ` [PATCH v1 net 0/1] net: mscc: ocelot: broadcast storm fixup patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).