Fix buggy brport flags offload for SJA1105 DSA
Vladimir Oltean
maintainercover Fix buggy brport flags offload for SJA1105 DSA
From: Vladimir Oltean <[email protected]>
While testing the "Software fallback for bridging in DSA" 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
Vladimir Oltean
maintainerPATCH 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.
--- drivers/net/dsa/sja1105/sja1105_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/dsa/sja1105/sja1105_main.c +1 -1
@@ -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
Vladimir Oltean
maintainerPATCH 2/2 net: dsa: sja1105: fix leakage of flooded frames outside bridging domain
In reply to Vladimir OlteanFrom: 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.
--- 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
@@ -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