net: dsa: sja1105: fix SGMII PCS being forced to SPEED_UNKNOWN instead of SPEED_10
Vladimir Oltean
maintainerPATCH 1/2 net: dsa: sja1105: fix SGMII PCS being forced to SPEED_UNKNOWN instead of SPEED_10
From: Vladimir Oltean <[email protected]>
When using MLO_AN_PHY or MLO_AN_FIXED, the MII_BMCR of the SGMII PCS is read before resetting the switch so it can be reprogrammed afterwards. This works for the speeds of 1Gbps and 100Mbps, but not for 10Mbps, because SPEED_10 is actually 0, so AND-ing anything with 0 is false, therefore that last branch is dead code.
Do what others do (genphy_read_status_fixed, phy_mii_ioctl) and just remove the check for SPEED_10, let it fall into the default case.
--- drivers/net/dsa/sja1105/sja1105_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/dsa/sja1105/sja1105_main.c +1 -1
@@ -1922,7 +1922,7 @@ int sja1105_static_config_reload(struct sja1105_private *priv, speed =SPEED_1000 ; else if (bmcr & BMCR_SPEED100) speed =SPEED_100 ; - else if (bmcr & BMCR_SPEED10) + else speed =SPEED_10 ;sja1105_sgmii_pcs_force_speed (priv, speed);
Signature · 1 line
2.25.1
Vladimir Oltean
maintainerPATCH 2/2 net: dsa: sja1105: fix ucast/bcast flooding always remaining enabled
From: Vladimir Oltean <[email protected]>
In the blamed patch I managed to introduce a bug while moving code
around: the same logic is applied to the ucast_egress_floods and bcast_egress_floods variables both on the "if" and the "else" branches.
This is clearly an unintended change compared to how the code used to be prior to that bugfix, so restore it.
--- drivers/net/dsa/sja1105/sja1105_main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/dsa/sja1105/sja1105_main.c +2 -2
@@ -3369,14 +3369,14 @@ static int sja1105_port_ucast_bcast_flood(struct sja1105_private *priv, int to,if (flags.val &BR_FLOOD ) priv->ucast_egress_floods |=BIT (to);else - priv->ucast_egress_floods |=BIT (to); + priv->ucast_egress_floods &= ~BIT (to); }if (flags.mask &BR_BCAST_FLOOD ) {if (flags.val &BR_BCAST_FLOOD ) priv->bcast_egress_floods |=BIT (to);else - priv->bcast_egress_floods |=BIT (to); + priv->bcast_egress_floods &= ~BIT (to); }return sja1105_manage_flood_domains (priv);
Signature · 1 line
2.25.1
Re: [PATCH net 2/2] net: dsa: sja1105: fix ucast/bcast flooding always remaining enabled
Quoted 5 lines · Vladimir Oltean
From: Vladimir Oltean <[email protected]>
In the blamed patch I managed to introduce a bug while moving code
around: the same logic is applied to theucast_egress_floodsandbcast_egress_floodsvariables both on the "if" and the "else" branches.
Some static analysers will report this.
Quoted 5 lines
This is clearly an unintended change compared to how the code used to be prior to that bugfix, so restore it.
Fixes 7f7ccdea8c73 ("net: dsa: sja1105: fix leakage of flooded frames outside bridging domain")Signed-off-by Vladimir Oltean <[email protected]>
Andrew
Quoted 8 lines · Vladimir Oltean
From: Vladimir Oltean <[email protected]>
When using
MLO_AN_PHYorMLO_AN_FIXED, theMII_BMCRof the SGMII PCS is read before resetting the switch so it can be reprogrammed afterwards. This works for the speeds of 1Gbps and 100Mbps, but not for 10Mbps, becauseSPEED_10is actually 0, so AND-ing anything with 0 is false, therefore that last branch is dead code.
Quoted 5 lines
Do what others do (
genphy_read_status_fixed,phy_mii_ioctl) and just remove the check forSPEED_10, let it fall into the default case.Fixes ffe10e679cec ("net: dsa: sja1105: Add support for the SGMII port")Signed-off-by Vladimir Oltean <[email protected]>
Andrew
This series was applied to netdev/net.git (refs/heads/master):
Hello:
This series was applied to netdev/net.git (refs/heads/master):
Quoted 9 lines · On Thu, 4 Mar 2021 12:56:53 +0200 you wrote:
From: Vladimir Oltean <[email protected]>
When using
MLO_AN_PHYorMLO_AN_FIXED, theMII_BMCRof the SGMII PCS is read before resetting the switch so it can be reprogrammed afterwards. This works for the speeds of 1Gbps and 100Mbps, but not for 10Mbps, becauseSPEED_10is actually 0, so AND-ing anything with 0 is false, therefore that last branch is dead code.[...]
Here is the summary with links:
- [net,1/2] net: dsa: sja1105: fix SGMII PCS being forced to SPEED_UNKNOWN instead of SPEED_10
https://git.kernel.org/netdev/net/c/053d8ad10d58 - [net,2/2] net: dsa: sja1105: fix ucast/bcast flooding always remaining enabled https://git.kernel.org/netdev/net/c/6a5166e07c02
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html