Skip to contentSkip to conversation

net: ethernet: ti/cpsw: do not crash on single-MAC machines during resume

PATCH Superseded Daniel Mack 3 participants 6 messages Nov 13, 2013 – Nov 15, 2013

Subsystems (3)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net: ethernet: ti/cpsw: do not crash on single-MAC machines during resume

To prevent Oopses, cpsw_suspend() should only soft-reset sliver 1 on dual MAC enabled machines.

---
 drivers/net/ethernet/ti/cpsw.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/net/ethernet/ti/cpsw.c +4 -1
index edd3e79..702b063 100644
@@ -2173,8 +2173,11 @@ static int cpsw_suspend(struct device *dev)
 
 	if (netif_running(ndev))
 		cpsw_ndo_stop(ndev);
+
 	soft_reset("sliver 0", &priv->slaves[0].sliver->soft_reset);
-	soft_reset("sliver 1", &priv->slaves[1].sliver->soft_reset);
+	if (priv->data.dual_emac)
+		soft_reset("sliver 1", &priv->slaves[1].sliver->soft_reset);
+
 	pm_runtime_put_sync(&pdev->dev);
 
 	/* Select sleep pin state */
Signature · 1 line
1.8.4.2
#1 lore raw
Quoted 13 lines · Daniel Mack

To prevent Oopses, cpsw_suspend() should only soft-reset sliver 1 on dual MAC enabled machines.

---
 drivers/net/ethernet/ti/cpsw.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/net/ethernet/ti/cpsw.c +0 -0
index edd3e79..702b063 100644

drivers/net/ethernet/ti/cpsw.c static int cpsw_suspend(struct device *dev) · line 2179

Quoted 8 lines
drivers/net/ethernet/ti/cpsw.c +3 -1
@@ -2173,8 +2173,11 @@ static int cpsw_suspend(struct device *dev)
 
 	if (netif_running(ndev))
 		cpsw_ndo_stop(ndev);
+
 	soft_reset("sliver 0", &priv->slaves[0].sliver->soft_reset);
-	soft_reset("sliver 1", &priv->slaves[1].sliver->soft_reset);
+	if (priv->data.dual_emac)
+		soft_reset("sliver 1", &priv->slaves[1].sliver->soft_reset);

Is this tested on a system with both ports in switch mode? I don't think this will not work with both ports in switch mode.

Regards
Mugunthan V N

#2 lore raw
Quoted 15 lines · Mugunthan V N
Quoted 14 lines · Daniel Mack

To prevent Oopses, cpsw_suspend() should only soft-reset sliver 1 on dual MAC enabled machines.

---
 drivers/net/ethernet/ti/cpsw.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/net/ethernet/ti/cpsw.c +0 -0
index edd3e79..702b063 100644
@@ -2173,8 +2173,11 @@ static int cpsw_suspend(struct device *dev)
 
Quoted 9 lines

drivers/net/ethernet/ti/cpsw.c static int cpsw_suspend(struct device *dev) · line 2179

Quoted 7 lines
drivers/net/ethernet/ti/cpsw.c +3 -1
 	if (netif_running(ndev))
 		cpsw_ndo_stop(ndev);
+
 	soft_reset("sliver 0", &priv->slaves[0].sliver->soft_reset);
-	soft_reset("sliver 1", &priv->slaves[1].sliver->soft_reset);
+	if (priv->data.dual_emac)
+		soft_reset("sliver 1", &priv->slaves[1].sliver->soft_reset);

Is this tested on a system with both ports in switch mode?

Nope. I got an Ooops when I tried to suspend a machine that has only one slave configured in DTS.

Quoted 1 line

I don't think this will not work with both ports in switch mode.

Why? Isn't priv->data.dual_emac in that case? The same condition is checked for in cpsw_remove().

Thanks,
Daniel

#3 lore raw
Quoted 24 lines · Daniel Mack
Quoted 15 lines · Mugunthan V N
Quoted 14 lines · Daniel Mack

To prevent Oopses, cpsw_suspend() should only soft-reset sliver 1 on dual MAC enabled machines.

---
 drivers/net/ethernet/ti/cpsw.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/net/ethernet/ti/cpsw.c +0 -0
index edd3e79..702b063 100644
@@ -2173,8 +2173,11 @@ static int cpsw_suspend(struct device *dev)
 
Quoted 8 lines

drivers/net/ethernet/ti/cpsw.c static int cpsw_suspend(struct device *dev) · line 2179

Quoted 7 lines
drivers/net/ethernet/ti/cpsw.c +3 -1
 	if (netif_running(ndev))
 		cpsw_ndo_stop(ndev);
+
 	soft_reset("sliver 0", &priv->slaves[0].sliver->soft_reset);
-	soft_reset("sliver 1", &priv->slaves[1].sliver->soft_reset);
+	if (priv->data.dual_emac)
+		soft_reset("sliver 1", &priv->slaves[1].sliver->soft_reset);

Is this tested on a system with both ports in switch mode?

Quoted 2 lines

Nope. I got an Ooops when I tried to suspend a machine that has only one slave configured in DTS.

But the changes above will fail with system with two ports and in switch mode.

Quoted 4 lines
Quoted 2 lines

I don't think this will not work with both ports in switch mode.

Why? Isn't priv->data.dual_emac in that case? The same condition is checked for in cpsw_remove().

In cpsw_remove that check is used to unregister the second network interface registered for same device for port 2. Now I got the issue, this has to be done via for_each_slave().

Regards
Mugunthan V N

#4 lore raw
Quoted 32 lines · Mugunthan V N
Quoted 24 lines · Daniel Mack
Quoted 15 lines · Mugunthan V N
Quoted 14 lines · Daniel Mack

To prevent Oopses, cpsw_suspend() should only soft-reset sliver 1 on dual MAC enabled machines.

---
 drivers/net/ethernet/ti/cpsw.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/net/ethernet/ti/cpsw.c +0 -0
index edd3e79..702b063 100644
@@ -2173,8 +2173,11 @@ static int cpsw_suspend(struct device *dev)
 
Quoted 8 lines

drivers/net/ethernet/ti/cpsw.c static int cpsw_suspend(struct device *dev) · line 2179

Quoted 7 lines
drivers/net/ethernet/ti/cpsw.c +3 -1
 	if (netif_running(ndev))
 		cpsw_ndo_stop(ndev);
+
 	soft_reset("sliver 0", &priv->slaves[0].sliver->soft_reset);
-	soft_reset("sliver 1", &priv->slaves[1].sliver->soft_reset);
+	if (priv->data.dual_emac)
+		soft_reset("sliver 1", &priv->slaves[1].sliver->soft_reset);

Is this tested on a system with both ports in switch mode?

Quoted 2 lines

Nope. I got an Ooops when I tried to suspend a machine that has only one slave configured in DTS.

But the changes above will fail with system with two ports and in switch mode.

Quoted 1 line
Quoted 6 lines
Quoted 3 lines
Quoted 1 line

I don't think this will not work with both ports in switch mode.

Why? Isn't priv->data.dual_emac in that case? The same condition is checked for in cpsw_remove().

In cpsw_remove that check is used to unregister the second network interface registered for same device for port 2. Now I got the issue, this has to be done via for_each_slave().

Aah, right, thanks :) Will repost.

Daniel