netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] net: usb: asix: replace mii_nway_restart in resume path
@ 2018-07-17 11:17 Alexander Couzens
  2018-07-18 20:43 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Alexander Couzens @ 2018-07-17 11:17 UTC (permalink / raw)
  To: linux-usb; +Cc: Robert Foss, netdev, David S. Miller, Alexander Couzens

mii_nway_restart is not pm aware which results in a rtnl deadlock.
Implement mii_nway_restart manual by setting BMCR_ANRESTART if
BMCR_ANENABLE is set.

To reproduce:
* plug an asix based usb network interface
* wait until the device enters PM (~5 sec)
* `ip link set eth1 up` will never return

Fixes: d9fe64e51114 ("net: asix: Add in_pm parameter")
Signed-off-by: Alexander Couzens <lynxis@fe80.eu>
---
 drivers/net/usb/asix_devices.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/net/usb/asix_devices.c b/drivers/net/usb/asix_devices.c
index 3d4f7959dabb..b1b3d8f7e67d 100644
--- a/drivers/net/usb/asix_devices.c
+++ b/drivers/net/usb/asix_devices.c
@@ -642,10 +642,12 @@ static void ax88772_restore_phy(struct usbnet *dev)
 				     priv->presvd_phy_advertise);
 
 		/* Restore BMCR */
+		if (priv->presvd_phy_bmcr & BMCR_ANENABLE)
+			priv->presvd_phy_bmcr |= BMCR_ANRESTART;
+
 		asix_mdio_write_nopm(dev->net, dev->mii.phy_id, MII_BMCR,
 				     priv->presvd_phy_bmcr);
 
-		mii_nway_restart(&dev->mii);
 		priv->presvd_phy_advertise = 0;
 		priv->presvd_phy_bmcr = 0;
 	}
-- 
2.18.0

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] net: usb: asix: replace mii_nway_restart in resume path
  2018-07-17 11:17 [PATCH] net: usb: asix: replace mii_nway_restart in resume path Alexander Couzens
@ 2018-07-18 20:43 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2018-07-18 20:43 UTC (permalink / raw)
  To: lynxis; +Cc: linux-usb, robert.foss, netdev

From: Alexander Couzens <lynxis@fe80.eu>
Date: Tue, 17 Jul 2018 13:17:09 +0200

> mii_nway_restart is not pm aware which results in a rtnl deadlock.
> Implement mii_nway_restart manual by setting BMCR_ANRESTART if
> BMCR_ANENABLE is set.
> 
> To reproduce:
> * plug an asix based usb network interface
> * wait until the device enters PM (~5 sec)
> * `ip link set eth1 up` will never return
> 
> Fixes: d9fe64e51114 ("net: asix: Add in_pm parameter")
> Signed-off-by: Alexander Couzens <lynxis@fe80.eu>

Applied and queued up for -stable, thank you.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-07-18 21:23 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-07-17 11:17 [PATCH] net: usb: asix: replace mii_nway_restart in resume path Alexander Couzens
2018-07-18 20:43 ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).