Skip to content

Commit 1baf2e5

Browse files
iwishguodavem330
authored andcommitted
drivers/net/ftgmac100: fix DHCP potential failure with systemd
DHCP failures were observed with systemd 247.6. The issue could be reproduced by rebooting Aspeed 2600 and then running ifconfig ethX down/up. It is caused by below procedures in the driver: 1. ftgmac100_open() enables net interface and call phy_start() 2. When PHY is link up, it calls netif_carrier_on() and then adjust_link callback 3. ftgmac100_adjust_link() will schedule the reset task 4. ftgmac100_reset_task() will then reset the MAC in another schedule After step 2, systemd will be notified to send DHCP discover packet, while the packet might be corrupted by MAC reset operation in step 4. Call ftgmac100_reset() directly instead of scheduling task to fix the issue. Signed-off-by: Heyi Guo <guoheyi@linux.alibaba.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 3c773db commit 1baf2e5

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

drivers/net/ethernet/faraday/ftgmac100.c

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1402,8 +1402,17 @@ static void ftgmac100_adjust_link(struct net_device *netdev)
14021402
/* Disable all interrupts */
14031403
iowrite32(0, priv->base + FTGMAC100_OFFSET_IER);
14041404

1405-
/* Reset the adapter asynchronously */
1406-
schedule_work(&priv->reset_task);
1405+
/* Release phy lock to allow ftgmac100_reset to aquire it, keeping lock
1406+
* order consistent to prevent dead lock.
1407+
*/
1408+
if (netdev->phydev)
1409+
mutex_unlock(&netdev->phydev->lock);
1410+
1411+
ftgmac100_reset(priv);
1412+
1413+
if (netdev->phydev)
1414+
mutex_lock(&netdev->phydev->lock);
1415+
14071416
}
14081417

14091418
static int ftgmac100_mii_probe(struct net_device *netdev)

0 commit comments

Comments
 (0)