Skip to contentSkip to conversation

Fix buggy brport flags offload for SJA1105 DSA

PATCH RESEND Applied Vladimir Oltean 3 participants 5 messages Feb 16, 2021

Subsystems (4)
lore
Share & tools
lore

Vladimir Oltean

author maintainer
#0 lore raw

cover Fix buggy brport flags offload for SJA1105 DSA

From: Vladimir Oltean <[email protected]>

I am resending this series because the title and the patches were mixed up and these patches were lost. This series' cover letter was used as the merge commit for the unrelated "Fixing build breakage after "Merge branch 'Propagate-extack-for-switchdev-LANs-from-DSA'"" series, as can be seen below:
https://git.kernel.org/pub/scm/linux/kernel/git/netdev/net-next.git/commit/?id=ca04422afd6998611a81d0ea1b61d5a5f4923f84

while the actual patches from the "Fix buggy brport flags offload for SJA1105 DSA" series were marked as superseded and not applied:
https://patchwork.kernel.org/project/netdevbpf/cover/[email protected]/
which they should have.

I know with so many bugs I introduced it's hard to keep track, I'm sorry.

Original series description:

While testing software bridging on sja1105, I discovered that I managed to introduce two bugs in a single patch submitted recently to net-next.

Vladimir Oltean (2):
net: dsa: sja1105: fix configuration of source address learning
net: dsa: sja1105: fix leakage of flooded frames outside bridging
domain

 drivers/net/dsa/sja1105/sja1105.h      |   2 +
 drivers/net/dsa/sja1105/sja1105_main.c | 117 ++++++++++++++++---------
 2 files changed, 77 insertions(+), 42 deletions(-)
Signature · 1 line
2.25.1
author maintainer
#1 lore raw

PATCH RESEND 1/2 net: dsa: sja1105: fix configuration of source address learning

From: Vladimir Oltean <[email protected]>

Due to a mistake, the driver always sets the address learning flag to the previously stored value, and not to the currently configured one. The bug is visible only in standalone ports mode, because when the port is bridged, the issue is masked by .port_stp_state_set which overwrites the address learning state to the proper value.

Fixes 4d9423549501 ("net: dsa: sja1105: offload bridge port flags to device")
---
 drivers/net/dsa/sja1105/sja1105_main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/dsa/sja1105/sja1105_main.c +1 -1
index 1dad94540cc9..3d3e2794655d 100644
@@ -3282,7 +3282,7 @@ static int sja1105_port_set_learning(struct sja1105_private *priv, int port,
 
 	mac = priv->static_config.tables[BLK_IDX_MAC_CONFIG].entries;
 
-	mac[port].dyn_learn = !!(priv->learn_ena & BIT(port));
+	mac[port].dyn_learn = enabled;
 
 	rc = sja1105_dynamic_config_write(priv, BLK_IDX_MAC_CONFIG, port,
 					  &mac[port], true);
Signature · 1 line
2.25.1
Reviewed-by on v1 1/2
#2 lore raw

Re: [PATCH RESEND net-next 1/2] net: dsa: sja1105: fix configuration of source address learning

Quoted 10 lines · Vladimir Oltean

From: Vladimir Oltean <[email protected]>

Due to a mistake, the driver always sets the address learning flag to the previously stored value, and not to the currently configured one. The bug is visible only in standalone ports mode, because when the port is bridged, the issue is masked by .port_stp_state_set which overwrites the address learning state to the proper value.

Fixes 4d9423549501 ("net: dsa: sja1105: offload bridge port flags to device")
Signature · 1 line
Florian
author maintainer
#3 lore raw

PATCH RESEND 2/2 net: dsa: sja1105: fix leakage of flooded frames outside bridging domain

In reply to Vladimir Oltean

From: Vladimir Oltean <[email protected]>

Quite embarrasingly, I managed to fool myself into thinking that the flooding domain of sja1105 source ports is restricted by the forwarding domain, which it isn't. Frames which match an FDB entry are forwarded towards that entry's DESTPORTS restricted by REACH_PORT[SRC_PORT], while frames that don't match any FDB entry are forwarded towards FL_DOMAIN[SRC_PORT] or BC_DOMAIN[SRC_PORT].

This means we can't get away with doing the simple thing, and we must manage the flooding domain ourselves such that it is restricted by the forwarding domain. This new function must be called from the .port_bridge_join and .port_bridge_leave methods too, not just from .port_bridge_flags as we did before.

Fixes 4d9423549501 ("net: dsa: sja1105: offload bridge port flags to device")
---
 drivers/net/dsa/sja1105/sja1105.h      |   2 +
 drivers/net/dsa/sja1105/sja1105_main.c | 115 ++++++++++++++++---------
 2 files changed, 76 insertions(+), 41 deletions(-)
drivers/net/dsa/sja1105/sja1105.h +2 -0
index 15a0893d0ff1..494d17117b94 100644
@@ -206,6 +206,8 @@ struct sja1105_private {
 	bool rgmii_tx_delay[SJA1105_NUM_PORTS];
 	bool best_effort_vlan_filtering;
 	unsigned long learn_ena;
+	unsigned long ucast_egress_floods;
+	unsigned long bcast_egress_floods;
 	const struct sja1105_info *info;
 	struct gpio_desc *reset_gpio;
 	struct spi_device *spidev;
drivers/net/dsa/sja1105/sja1105_main.c +74 -41

151 lines not on this page · raw message

Signature · 1 line
2.25.1
#4 lore raw
In reply to Vladimir Oltean
This series was applied to netdev/net-next.git (refs/heads/master):

Hello:

This series was applied to netdev/net-next.git (refs/heads/master):

Quoted 10 lines · On Tue, 16 Feb 2021 13:41:17 +0200 you wrote:

From: Vladimir Oltean <[email protected]>

I am resending this series because the title and the patches were mixed up and these patches were lost. This series' cover letter was used as the merge commit for the unrelated "Fixing build breakage after "Merge branch 'Propagate-extack-for-switchdev-LANs-from-DSA'"" series, as can be seen below:
https://git.kernel.org/pub/scm/linux/kernel/git/netdev/net-next.git/commit/?id=ca04422afd6998611a81d0ea1b61d5a5f4923f84

[...]

Here is the summary with links:
- [RESEND,net-next,1/2] net: dsa: sja1105: fix configuration of source address learning

    https://git.kernel.org/netdev/net-next/c/4c44fc5e9400
  - [RESEND,net-next,2/2] net: dsa: sja1105: fix leakage of flooded frames outside bridging domain
    https://git.kernel.org/netdev/net-next/c/7f7ccdea8c73

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