Skip to contentSkip to conversation

lan78xx: Don't reset the interface on open

PATCH In review Phil Elwell 3 participants 5 messages Apr 10, 2018 – Apr 11, 2018

Subsystems (5)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 lan78xx: Don't reset the interface on open

Commit 92571a1aae40 ("lan78xx: Connect phy early") moves the PHY initialisation into lan78xx_probe, but lan78xx_open subsequently calls lan78xx_reset. As well as forcing a second round of link negotiation, this reset frequently prevents the phy interrupt from being generated (even though the link is up), rendering the interface unusable.

Fix this issue by removing the lan78xx_reset call from lan78xx_open.

Fixes 92571a1aae40 ("lan78xx: Connect phy early")
---
 drivers/net/usb/lan78xx.c | 4 ----
 1 file changed, 4 deletions(-)
drivers/net/usb/lan78xx.c +0 -4
index aff105f..108f04a 100644
@@ -2514,10 +2514,6 @@ static int lan78xx_open(struct net_device *net)
 	if (ret < 0)
 		goto out;
 
-	ret = lan78xx_reset(dev);
-	if (ret < 0)
-		goto done;
-
 	phy_start(net->phydev);
 
 	netif_dbg(dev, ifup, dev->net, "phy initialised successfully");
#1 lore raw

Thanks Phil, for identifying the issues.

drivers/net/usb/lan78xx.c static int lan78xx_open(struct net_device *net)

Quoted 8 lines
drivers/net/usb/lan78xx.c +0 -5
-	ret = lan78xx_reset(dev);
-	if (ret < 0)
-		goto done;
-
 	phy_start(net->phydev);
 
 	netif_dbg(dev, ifup, dev->net, "phy initialised successfully");
--

You may need to start the interrupts before "phy_start" instead of suppressing call to "lan78xx_reset".

+ if (dev->domain_data.phyirq > 0)
+ phy_start_interrupts(dev->net->phydev);

- Nisar
---
To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#2 lore raw

Hi Nisar,

Quoted 13 lines · On 10/04/2018 15:16, [email protected] wrote:

Thanks Phil, for identifying the issues.

drivers/net/usb/lan78xx.c static int lan78xx_open(struct net_device *net)

Quoted 8 lines
drivers/net/usb/lan78xx.c +0 -5
-	ret = lan78xx_reset(dev);
-	if (ret < 0)
-		goto done;
-
 	phy_start(net->phydev);
 
 	netif_dbg(dev, ifup, dev->net, "phy initialised successfully");
--

You may need to start the interrupts before "phy_start" instead of suppressing call to "lan78xx_reset".

Review

Quoted 2 lines
(quoted diff) +2 -0
+             if (dev->domain_data.phyirq > 0)
+                             phy_start_interrupts(dev->net->phydev);

Shouldn't phy_connect_direct, called from lan78xx_phy_init, already have enabled interrupts for us?

This patch addresses two problems - time wasted by renegotiating the link after the reset and the missed interrupt - and I'd like both to be fixed. Unless you can come up with a good reason for performing the reset from the open handler I think it should be removed.

Phil
---
To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#3 lore raw

Hi Phil,

Quoted 23 lines

Hi Nisar,

Quoted 8 lines · On 10/04/2018 15:16, [email protected] wrote:

Thanks Phil, for identifying the issues.

Quoted 6 lines
drivers/net/usb/lan78xx.c +0 -4
-	ret = lan78xx_reset(dev);
-	if (ret < 0)
-		goto done;
-
 	phy_start(net->phydev);
Quoted 4 lines
Quoted 2 lines

netif_dbg(dev, ifup, dev->net, "phy initialised successfully");
--

You may need to start the interrupts before "phy_start" instead of

suppressing call to "lan78xx_reset".

Review

Quoted 3 lines
(quoted diff) +2 -0
+             if (dev->domain_data.phyirq > 0)
+                             phy_start_interrupts(dev->net->phydev);

Shouldn't phy_connect_direct, called from lan78xx_phy_init, already have enabled interrupts for us?

Quoted 6 lines

This patch addresses two problems - time wasted by renegotiating the link after the reset and the missed interrupt - and I'd like both to be fixed. Unless you can come up with a good reason for performing the reset from the open handler I think it should be removed.

Phil

Thanks, we have verified suspected test cases and these are passed, the changes are good to go.

- Nisar

maintainer
#4 lore raw
In reply to Phil Elwell

From: Phil Elwell <[email protected]>
Date: Tue, 10 Apr 2018 13:18:25 +0100

Quoted 10 lines

Commit 92571a1aae40 ("lan78xx: Connect phy early") moves the PHY initialisation into lan78xx_probe, but lan78xx_open subsequently calls lan78xx_reset. As well as forcing a second round of link negotiation, this reset frequently prevents the phy interrupt from being generated (even though the link is up), rendering the interface unusable.

Fix this issue by removing the lan78xx_reset call from lan78xx_open.

Fixes 92571a1aae40 ("lan78xx: Connect phy early")

Applied and queued up for -stable, thanks.
---
To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html