Skip to contentSkip to conversation

net: au1000: Bug fixes

PATCH Superseded Florian Fainelli 3 participants 23 messages Nov 17 – Nov 21

Subsystems (3)

v3 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

v3 cover net: au1000: Bug fixes

This series fixes RX descriptor recycling, receive filtering, MDIO error reporting, TX ring synchronization, MAC/PHY lifecycle ordering, and TX bounce-buffer bounds in the Au1xxx Ethernet driver. It also adds the LAN83C183 PHY resume delay needed for MII clock recovery on the MTX-1.

Changes in v3:
- Drop the no-platform-data MAC-address patch: in-tree platform devices always supply platform data, so this is defensive hardening rather than a fix for an in-tree configuration.
- Drop the buffer descriptor free-list insertion patch: the affected list is only rebuilt during teardown and is never consumed again. The series now contains 10 patches instead of 12.
- Distinguish MDIO write-completion timeouts from pre-write busy timeouts in the diagnostic message.
- Clarify that the LAN83C183 recovery-delay patch and the following au1000 MAC/PHY sequencing patch are both required to fix MTX-1 reopen. Keep the PHY patch first so its delay is available to the MAC fix.
- Remove the unreachable initialization-error branch and PHY rollback from au1000_open(). Correct the commit message to distinguish the new synchronous PHY resume from the existing initialization-before- phy_start() ordering, and reconcile the reset comments.
- Expand the TX bounds-check commit message to cover plain AF_PACKET sendmsg(), PACKET_TX_RING, and oversized software-GSO segments.
- Rebuild the kernel and root filesystem and repeat MTX-1 regression testing after the review changes.

Changes in v2:
- Rebase onto net.
- Reset the MAC after PHY/MDIO teardown, and avoid MAC control accesses when its clock is already disabled.
- Use sleepable polling for MDIO write completion.
- Advance tx_tail when submission reclaims a completed TX descriptor, and consume transmitted skbs outside the lock with an IRQ-safe helper.
- Restore receive filtering before enabling RX, with the address-list and device locks held to keep the programmed filter consistent.
- Resume the PHY synchronously before MAC initialization, clear cached link state on open, and use acknowledged link/duplex state under the device lock. Place the LAN83C183 recovery-delay patch before this fix.
- Add a TX length check to prevent overflowing the DMA bounce buffer.

Testing:
The current series was rebuilt with Buildroot and tested on a Meshcube MTX-1, using the Alchemy PROM Ethernet-address lifetime fix as a separate boot prerequisite. That prerequisite is not included in this series. All 11 boot-smoke checks passed, including 15 down/up cycles across normal, promiscuous and all-multicast modes, removal/rebind after an opened/closed interface and a never-opened interface, and connectivity recovery. No kernel findings were reported. The final 10-packet ping lost one reply; a subsequent 100-packet test had zero loss. The cause of the isolated loss was not established.

These hardware tests cover boot and Ethernet lifecycle behavior; full AF_PACKET overflow triggers and fault injection were not exercised.

Sashiko AI review identified issues addressed in the revisions. OpenAI Codex assisted source analysis, code and changelog revisions, patch consolidation, and regression testing.

Florian Fainelli (10):
net: au1000: recycle RX descriptors on allocation failure
net: au1000: clear all-multicast mode when restoring hash filtering
net: au1000: disconnect the PHY before freeing the MDIO bus
net: au1000: report MDIO transaction timeouts
net: au1000: serialize TX completion with packet submission
net: au1000: restore receive filtering before enabling RX
net: au1000: restore RX buffer addresses when restarting the MAC
net: phy: smsc: wait for LAN83C183 power-down recovery
net: au1000: keep the MAC stopped until the PHY link is ready
net: au1000: reject frames larger than the TX bounce buffer

 drivers/net/ethernet/amd/au1000_eth.c | 145 +++++++++++++++++++-------
 drivers/net/phy/Kconfig               |   2 +-
 drivers/net/phy/smsc.c                |  26 +++++
 3 files changed, 133 insertions(+), 40 deletions(-)

base-commit: 145480b28ca82e9fae789427cc4569e596515a32

Signature · 1 line
2.53.0
#1 lore raw

PATCH v3 1/10 net: au1000: recycle RX descriptors on allocation failure

An skb allocation failure retries the same completed descriptor forever in hard IRQ context. Return the buffer to DMA and advance the ring even when the packet must be dropped.

Fixes 1da177e4c3f4 ("Linux-2.6.12-rc2")
---
 drivers/net/ethernet/amd/au1000_eth.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/ethernet/amd/au1000_eth.c +2 -1
index 8682323d693f..cd25248f4e3a 100644
@@ -788,7 +788,7 @@ static int au1000_rx(struct net_device *dev)
 			skb = netdev_alloc_skb(dev, frmlen + 2);
 			if (!skb) {
 				dev->stats.rx_dropped++;
-				continue;
+				goto next;
 			}
 			skb_reserve(skb, 2);	/* 16 byte IP header align */
 			skb_copy_to_linear_data(skb,
@@ -820,6 +820,7 @@ static int au1000_rx(struct net_device *dev)
 				pr_cont("\n");
 			}
 		}
+next:
 		prxd->buff_stat = lower_32_bits(pDB->dma_addr) | RX_DMA_ENABLE;
 		aup->rx_head = (aup->rx_head + 1) & (NUM_RX_DMA - 1);
 		wmb(); /* drain writebuffer */
Signature · 1 line
2.53.0
#2 lore raw

PATCH v3 2/10 net: au1000: clear all-multicast mode when restoring hash filtering

In reply to Florian Fainelli

MAC_PASS_ALL_MULTI remains set after IFF_ALLMULTI is cleared or the multicast list shrinks below the filter limit. Clear it when programming the selective multicast hash so unwanted multicast traffic is filtered again.

Fixes 1da177e4c3f4 ("Linux-2.6.12-rc2")
---
 drivers/net/ethernet/amd/au1000_eth.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/amd/au1000_eth.c +1 -1
index cd25248f4e3a..58bc8e1b539d 100644
@@ -1042,7 +1042,7 @@ static void au1000_multicast_list(struct net_device *dev)
 					(long *)mc_filter);
 		writel(mc_filter[1], &aup->mac->multi_hash_high);
 		writel(mc_filter[0], &aup->mac->multi_hash_low);
-		reg &= ~MAC_PROMISCUOUS;
+		reg &= ~(MAC_PROMISCUOUS | MAC_PASS_ALL_MULTI);
 		reg |= MAC_HASH_MODE;
 	}
 	writel(reg, &aup->mac->control);
Signature · 1 line
2.53.0
#3 lore raw

PATCH v3 3/10 net: au1000: disconnect the PHY before freeing the MDIO bus

In reply to Florian Fainelli

Balance phy_connect() on probe failure and removal. Otherwise PHY interrupts, device references and the attachment to the freed netdev survive teardown. Disconnect before unregistering the bus while its MDIO callbacks and MAC registers remain usable.

PHY teardown can re-enable the MAC for MDIO even if the interface was never opened. Reset the MAC after PHY and MDIO bus teardown, before releasing descriptors and register mappings. Skip MAC control accesses when mac_enabled is clear, since stopping an already clock-gated MAC hangs MTX-1. Always clear the DMA descriptor control bits and TX state.

Fixes 0638dec01e89 ("[PATCH] net: au1000_eth: PHY framework conversion")
---
 drivers/net/ethernet/amd/au1000_eth.c | 26 +++++++++++++++++---------
 1 file changed, 17 insertions(+), 9 deletions(-)
drivers/net/ethernet/amd/au1000_eth.c +17 -9
index 58bc8e1b539d..7063f9e5bc7c 100644
@@ -584,14 +584,17 @@ static void au1000_reset_mac_unlocked(struct net_device *dev)
 	struct au1000_private *const aup = netdev_priv(dev);
 	int i;
 
-	au1000_hard_stop(dev);
+	if (aup->mac_enabled) {
+		au1000_hard_stop(dev);
 
-	writel(MAC_EN_CLOCK_ENABLE, aup->enable);
-	wmb(); /* drain writebuffer */
-	mdelay(2);
-	writel(0, aup->enable);
-	wmb(); /* drain writebuffer */
-	mdelay(2);
+		writel(MAC_EN_CLOCK_ENABLE, aup->enable);
+		wmb(); /* drain writebuffer */
+		mdelay(2);
+		writel(0, aup->enable);
+		wmb(); /* drain writebuffer */
+		mdelay(2);
+		aup->mac_enabled = 0;
+	}
 
 	aup->tx_full = 0;
 	for (i = 0; i < NUM_RX_DMA; i++) {
@@ -603,8 +606,6 @@ static void au1000_reset_mac_unlocked(struct net_device *dev)
 		aup->tx_dma_ring[i]->buff_stat &= ~0xf;
 	}
 
-	aup->mac_enabled = 0;
-
 }
 
 static void au1000_reset_mac(struct net_device *dev)
@@ -1287,6 +1288,8 @@ static int au1000_probe(struct platform_device *pdev)
 	return 0;
 
 err_out:
+	if (dev->phydev)
+		phy_disconnect(dev->phydev);
 	if (aup->mii_bus)
 		mdiobus_unregister(aup->mii_bus);
 
@@ -1334,9 +1337,14 @@ static void au1000_remove(struct platform_device *pdev)
 	struct resource *base, *macen;
 
 	unregister_netdev(dev);
+	if (dev->phydev)
+		phy_disconnect(dev->phydev);
 	mdiobus_unregister(aup->mii_bus);
 	mdiobus_free(aup->mii_bus);
 
+	/* PHY teardown may have re-enabled the MAC for MDIO accesses. */
+	au1000_reset_mac(dev);
+
 	for (i = 0; i < NUM_RX_DMA; i++)
 		if (aup->rx_db_inuse[i])
 			au1000_ReleaseDB(aup, aup->rx_db_inuse[i]);
Signature · 1 line
2.53.0
#4 lore raw

Re: [PATCH net v3 03/10] net: au1000: disconnect the PHY before freeing the MDIO bus

Thank you for your contribution! Sashiko AI review found more severe issue(s) in other patches of this series. This mail is only an FYI, in case you want to address the nit picks below when you…

Thank you for your contribution! Sashiko AI review found more severe issue(s) in other patches of this series. This mail is only an FYI, in case you want to address the nit picks below when you respin.

Low priority / nit picks for your consideration:

- [Low] The commit message of "net: au1000: disconnect the PHY before freeing the MDIO bus" partly misstates what the patch fixes, and…

--

net: au1000: disconnect the PHY before freeing the MDIO bus

This commit adds phy_disconnect() calls to the au1000_probe() error path and to au1000_remove(), so that phy_connect() is balanced. It also makes au1000_reset_mac_unlocked() skip MAC control register accesses when mac_enabled is clear. It also resets the MAC in au1000_remove() after the PHY and MDIO bus are torn down.

Quoted 3 lines

Balance phy_connect() on probe failure and removal. Otherwise PHY interrupts, device references and the attachment to the freed netdev survive teardown.

[Severity: Low]
Can a PHY interrupt actually survive teardown in this driver?

mdiobus_alloc_size() sets every bus->irq[i] to PHY_POLL. au1000_probe() only writes a real IRQ into mii_bus->irq[] when aup->phy_static_config is set:

    if (aup->phy_static_config)
        if (aup->phy_irq && aup->phy_busid == aup->mac_id)
            aup->mii_bus->irq[aup->phy_addr] = aup->phy_irq;

In that same case, au1000_mii_probe() returns before it reaches phy_connect():

    if (aup->phy_static_config) {
        ...
        if (aup->phy_addr)
            phydev = mdiobus_get_phy(aup->mii_bus, aup->phy_addr);
        else
            netdev_info(dev, "using PHY-less setup\n");
        return 0;
    }

That leaves dev->phydev NULL, so the new phy_disconnect() calls are skipped.

On the dynamic search path, which is the only one that calls phy_connect(), the PHY's irq is still PHY_POLL. That means no interrupt is ever requested, and phy_disconnect() never reaches phy_free_interrupt().

The device and module references taken in phy_attach_direct(), and the attached_dev pointer to the freed netdev, do look like real leaks. Should the "PHY interrupts" part be dropped from the message?

Quoted 5 lines

PHY teardown can re-enable the MAC for MDIO even if the interface was never opened. Reset the MAC after PHY and MDIO bus teardown, before releasing descriptors and register mappings. Skip MAC control accesses when mac_enabled is clear, since stopping an already clock-gated MAC hangs MTX-1.

Would it help to say that the new mac_enabled check also fixes an existing hang when register_netdev() fails in au1000_probe()?

Before this patch, the au1000_reset_mac() call just before register_netdev() gated the MAC clock and cleared mac_enabled. If register_netdev() then failed, the err_out path called mdiobus_unregister(), which does no MDIO access, and then called au1000_reset_mac() again:

au1000_probe()
au1000_reset_mac(dev); <- clock gated, mac_enabled = 0
register_netdev(dev) fails
goto err_out

    mdiobus_unregister()
    au1000_reset_mac(dev)
      au1000_hard_stop(dev)
        readl(&aup->mac->control)   <- MAC already clock-gated

According to the commit message, this access hangs MTX-1. The message describes the PHY teardown case but not this change in the register_netdev() failure path. Mentioning it would show backporters which failure modes this patch fixes.

Signature · 1 line
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261117193223.2795612-1-f.fainelli%40gmail.com
#5 lore raw

Re: [PATCH net v3 03/10] net: au1000: disconnect the PHY before freeing the MDIO bus

Quoted 82 lines · On 11/20/26 02:32, [email protected] wrote:

Thank you for your contribution! Sashiko AI review found more severe issue(s) in other patches of this series. This mail is only an FYI, in case you want to address the nit picks below when you respin.

Low priority / nit picks for your consideration:

- [Low] The commit message of "net: au1000: disconnect the PHY before freeing the MDIO bus" partly misstates what the patch fixes, and…

--

net: au1000: disconnect the PHY before freeing the MDIO bus

This commit adds phy_disconnect() calls to the au1000_probe() error path and to au1000_remove(), so that phy_connect() is balanced. It also makes au1000_reset_mac_unlocked() skip MAC control register accesses when mac_enabled is clear. It also resets the MAC in au1000_remove() after the PHY and MDIO bus are torn down.

Quoted 3 lines

Balance phy_connect() on probe failure and removal. Otherwise PHY interrupts, device references and the attachment to the freed netdev survive teardown.

[Severity: Low]
Can a PHY interrupt actually survive teardown in this driver?

mdiobus_alloc_size() sets every bus->irq[i] to PHY_POLL. au1000_probe() only writes a real IRQ into mii_bus->irq[] when aup->phy_static_config is set:

     if (aup->phy_static_config)
         if (aup->phy_irq && aup->phy_busid == aup->mac_id)
             aup->mii_bus->irq[aup->phy_addr] = aup->phy_irq;

In that same case, au1000_mii_probe() returns before it reaches phy_connect():

     if (aup->phy_static_config) {
         ...
         if (aup->phy_addr)
             phydev = mdiobus_get_phy(aup->mii_bus, aup->phy_addr);
         else
             netdev_info(dev, "using PHY-less setup\n");
         return 0;
     }

That leaves dev->phydev NULL, so the new phy_disconnect() calls are skipped.

On the dynamic search path, which is the only one that calls phy_connect(), the PHY's irq is still PHY_POLL. That means no interrupt is ever requested, and phy_disconnect() never reaches phy_free_interrupt().

The device and module references taken in phy_attach_direct(), and the attached_dev pointer to the freed netdev, do look like real leaks. Should the "PHY interrupts" part be dropped from the message?

Quoted 5 lines

PHY teardown can re-enable the MAC for MDIO even if the interface was never opened. Reset the MAC after PHY and MDIO bus teardown, before releasing descriptors and register mappings. Skip MAC control accesses when mac_enabled is clear, since stopping an already clock-gated MAC hangs MTX-1.

Would it help to say that the new mac_enabled check also fixes an existing hang when register_netdev() fails in au1000_probe()?

Before this patch, the au1000_reset_mac() call just before register_netdev() gated the MAC clock and cleared mac_enabled. If register_netdev() then failed, the err_out path called mdiobus_unregister(), which does no MDIO access, and then called au1000_reset_mac() again:

au1000_probe()
au1000_reset_mac(dev); <- clock gated, mac_enabled = 0
register_netdev(dev) fails
goto err_out

     mdiobus_unregister()
     au1000_reset_mac(dev)
       au1000_hard_stop(dev)
         readl(&aup->mac->control)   <- MAC already clock-gated
Quoted 5 lines

According to the commit message, this access hangs MTX-1. The message describes the PHY teardown case but not this change in the register_netdev() failure path. Mentioning it would show backporters which failure modes this patch fixes.

Agreed on both points. I have updated the commit message to remove the PHY-interrupt claim: the path that calls phy_connect() uses polling. The message now describes the leaked device/module references and the stale attached_dev pointer.

I also added the existing register_netdev() failure case. Probe gates the MAC clock before registration, and the error unwind resets it again. The mac_enabled guard prevents that second reset from accessing clock-gated MAC control registers if no intervening MDIO access has re-enabled the MAC.

This is a commit-message-only revision; the code is unchanged. The registration-failure path was verified by source inspection, not fault injection.

pw-bot: cr

Signature · 1 line
Florian
#6 lore raw

PATCH v3 4/10 net: au1000: report MDIO transaction timeouts

In reply to Florian Fainelli

The MDIO write callback reports success even if the controller stays busy and no write is issued. Propagate timeout errors and wait for write completion so failure of the final transaction is reported to phylib as well. Return ETIMEDOUT for read timeouts too.

Use readl_poll_timeout() for write completion with a 20 microsecond sleep interval and a 20 millisecond timeout. The MDIO callback runs in sleepable context, so avoid adding millisecond busy-waits for completion.

Fixes 0638dec01e89 ("[PATCH] net: au1000_eth: PHY framework conversion")
---
 drivers/net/ethernet/amd/au1000_eth.c | 22 +++++++++++++++-------
 1 file changed, 15 insertions(+), 7 deletions(-)
drivers/net/ethernet/amd/au1000_eth.c +15 -7
index 7063f9e5bc7c..1935b1d4b173 100644
@@ -41,6 +41,7 @@
 #include <linux/platform_device.h>
 #include <linux/cpu.h>
 #include <linux/io.h>
+#include <linux/iopoll.h>
 
 #include <asm/mipsregs.h>
 #include <asm/irq.h>
@@ -278,7 +279,7 @@ static int au1000_mdio_read(struct net_device *dev, int phy_addr, int reg)
 		mdelay(1);
 		if (--timedout == 0) {
 			netdev_err(dev, "read_MII busy timeout!!\n");
-			return -1;
+			return -ETIMEDOUT;
 		}
 	}
 
@@ -292,26 +293,27 @@ static int au1000_mdio_read(struct net_device *dev, int phy_addr, int reg)
 		mdelay(1);
 		if (--timedout == 0) {
 			netdev_err(dev, "mdio_read busy timeout!!\n");
-			return -1;
+			return -ETIMEDOUT;
 		}
 	}
 	return readl(mii_data_reg);
 }
 
-static void au1000_mdio_write(struct net_device *dev, int phy_addr,
-			      int reg, u16 value)
+static int au1000_mdio_write(struct net_device *dev, int phy_addr,
+			     int reg, u16 value)
 {
 	struct au1000_private *aup = netdev_priv(dev);
 	u32 *const mii_control_reg = &aup->mac->mii_control;
 	u32 *const mii_data_reg = &aup->mac->mii_data;
 	u32 timedout = 20;
 	u32 mii_control;
+	int ret;
 
 	while (readl(mii_control_reg) & MAC_MII_BUSY) {
 		mdelay(1);
 		if (--timedout == 0) {
 			netdev_err(dev, "mdio_write busy timeout!!\n");
-			return;
+			return -ETIMEDOUT;
 		}
 	}
 
@@ -320,6 +322,13 @@ static void au1000_mdio_write(struct net_device *dev, int phy_addr,
 
 	writel(value, mii_data_reg);
 	writel(mii_control, mii_control_reg);
+
+	ret = readl_poll_timeout(mii_control_reg, mii_control,
+				 !(mii_control & MAC_MII_BUSY), 20, 20000);
+	if (ret)
+		netdev_err(dev, "mdio_write completion timeout\n");
+
+	return ret;
 }
 
 static int au1000_mdiobus_read(struct mii_bus *bus, int phy_addr, int regnum)
@@ -344,8 +353,7 @@ static int au1000_mdiobus_write(struct mii_bus *bus, int phy_addr, int regnum,
 	 */
 	au1000_enable_mac(dev, 0);
 
-	au1000_mdio_write(dev, phy_addr, regnum, value);
-	return 0;
+	return au1000_mdio_write(dev, phy_addr, regnum, value);
 }
 
 static int au1000_mdiobus_reset(struct mii_bus *bus)
Signature · 1 line
2.53.0
#7 lore raw

PATCH v3 5/10 net: au1000: serialize TX completion with packet submission

In reply to Florian Fainelli

TX completion runs in hard IRQ context while ndo_start_xmit updates the same descriptors and ring state without locking. An interrupt between netif_stop_queue() and setting tx_full can miss the wakeup and leave the queue stopped until the watchdog runs. Use the existing IRQ-safe device lock in both paths to serialize reclamation and queue state changes.

When submission reclaims a completed descriptor at tx_head, advance tx_tail before reusing it so the interrupt handler does not wait on the new packet while older completions remain pending. Consume the copied skb after releasing the lock with dev_consume_skb_any(), which also handles netpoll entry with hardware interrupts disabled.

Fixes 1da177e4c3f4 ("Linux-2.6.12-rc2")
---
 drivers/net/ethernet/amd/au1000_eth.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)
drivers/net/ethernet/amd/au1000_eth.c +10 -1
index 1935b1d4b173..805aabc6721b 100644
@@ -872,7 +872,9 @@ static void au1000_tx_ack(struct net_device *dev)
 {
 	struct au1000_private *aup = netdev_priv(dev);
 	struct tx_dma *ptxd;
+	unsigned long flags;
 
+	spin_lock_irqsave(&aup->lock, flags);
 	ptxd = aup->tx_dma_ring[aup->tx_tail];
 
 	while (ptxd->buff_stat & TX_T_DONE) {
@@ -889,6 +891,8 @@ static void au1000_tx_ack(struct net_device *dev)
 			netif_wake_queue(dev);
 		}
 	}
+
+	spin_unlock_irqrestore(&aup->lock, flags);
 }
 
 /*
@@ -972,21 +976,25 @@ static netdev_tx_t au1000_tx(struct sk_buff *skb, struct net_device *dev)
 	u32 buff_stat;
 	struct db_dest *pDB;
 	int i;
+	unsigned long flags;
 
 	netif_dbg(aup, tx_queued, dev, "tx: aup %x len=%d, data=%p, head %d\n",
 				(unsigned)aup, skb->len,
 				skb->data, aup->tx_head);
 
+	spin_lock_irqsave(&aup->lock, flags);
 	ptxd = aup->tx_dma_ring[aup->tx_head];
 	buff_stat = ptxd->buff_stat;
 	if (buff_stat & TX_DMA_ENABLE) {
 		/* We've wrapped around and the transmitter is still busy */
 		netif_stop_queue(dev);
 		aup->tx_full = 1;
+		spin_unlock_irqrestore(&aup->lock, flags);
 		return NETDEV_TX_BUSY;
 	} else if (buff_stat & TX_T_DONE) {
 		au1000_update_tx_stats(dev, ptxd->status);
 		ptxd->len = 0;
+		aup->tx_tail = (aup->tx_tail + 1) & (NUM_TX_DMA - 1);
 	}
 
 	if (aup->tx_full) {
@@ -1009,8 +1017,9 @@ static netdev_tx_t au1000_tx(struct sk_buff *skb, struct net_device *dev)
 
 	ptxd->buff_stat = lower_32_bits(pDB->dma_addr) | TX_DMA_ENABLE;
 	wmb(); /* drain writebuffer */
-	dev_kfree_skb(skb);
 	aup->tx_head = (aup->tx_head + 1) & (NUM_TX_DMA - 1);
+	spin_unlock_irqrestore(&aup->lock, flags);
+	dev_consume_skb_any(skb);
 	return NETDEV_TX_OK;
 }
 
Signature · 1 line
2.53.0
#8 lore raw

Re: [PATCH net v3 05/10] net: au1000: serialize TX completion with packet submission

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider.

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider.

Critical: 0 · High: 0 · Medium: 1 · Low: 0

If you believe none of the issues are legitimate, please reply to each issue of Medium severity or higher and explain why the AI is wrong. If any of them are legitimate and you plan to respin, please let patchwork know by including "pw-bot: cr" as a separate line at the end of your reply (one such reply per series is enough).

- [Medium] au1000_tx() (drivers/net/ethernet/amd/au1000_eth.c) now holds spin_lock_irqsave(&aup->lock) for the whole transmit path.

--

net: au1000: serialize TX completion with packet submission

This patch takes the IRQ-safe aup->lock in both au1000_tx_ack() and au1000_tx(), so TX descriptor reclamation and queue state changes are serialized. When au1000_tx() reclaims a completed descriptor at tx_head, it now also advances tx_tail. The skb is now freed with dev_consume_skb_any() after the lock is released.

Quoted 4 lines
drivers/net/ethernet/amd/au1000_eth.c +0 -0
index 1935b1d4b1738..805aabc6721b8 100644

[ ... ]

drivers/net/ethernet/amd/au1000_eth.c static netdev_tx_t au1000_tx(struct sk_buff *skb, struct net_device *dev) · line 985

Quoted 11 lines
drivers/net/ethernet/amd/au1000_eth.c +2 -0
@@ -972,21 +976,25 @@ static netdev_tx_t au1000_tx(struct sk_buff *skb, struct net_device *dev)
 	u32 buff_stat;
 	struct db_dest *pDB;
 	int i;
+	unsigned long flags;
 
 	netif_dbg(aup, tx_queued, dev, "tx: aup %x len=%d, data=%p, head %d\n",
 				(unsigned)aup, skb->len,
 				skb->data, aup->tx_head);
 
+	spin_lock_irqsave(&aup->lock, flags);

[Severity: Medium]
With this lock taken here, the rest of au1000_tx() runs with local hard IRQs disabled until the spin_unlock_irqrestore() at the end. That includes the packet copy and the zero padding loop:

	pDB = aup->tx_db_inuse[aup->tx_head];
	skb_copy_from_linear_data(skb, (void *)pDB->vaddr, skb->len);
	if (skb->len < ETH_ZLEN) {
		for (i = skb->len; i < ETH_ZLEN; i++)
			((char *)pDB->vaddr)[i] = 0;
	...

On Au1000/Au1500/Au1100, MIPS_ALCHEMY selects DMA_NONCOHERENT. That makes the dma_alloc_coherent() buffer uncached, so every store into pDB->vaddr is an uncached bus write. A full frame is up to about 1514 bytes.

The RX side has only NUM_RX_DMA (4) hardware buffers, and they are serviced only from au1000_interrupt()->au1000_rx(). Before this patch, the RX interrupt could preempt the copy.

Could this longer IRQ-off window on every transmit lead to more RX overruns (RX_MISSED_FRAME) under combined TX/RX load? It would also add interrupt latency for the rest of the system on these single-core parts.

The copy does not appear to need the lock. Suppose au1000_tx() has checked, under the lock, that TX_DMA_ENABLE and TX_T_DONE are clear at tx_head:

- au1000_tx_ack() stops at the first descriptor without TX_T_DONE.
- It never touches the tx_db_inuse[] buffers or tx_head.
- ndo_start_xmit is already serialized by the TX queue lock.

Would it be enough to hold aup->lock only for the descriptor state check, the tx_tail/tx_full handling, and the final len, buff_stat and tx_head updates, and do the copy and padding outside it?

Quoted 3 lines
drivers/net/ethernet/amd/au1000_eth.c +0 -0
 	ptxd = aup->tx_dma_ring[aup->tx_head];
 	buff_stat = ptxd->buff_stat;
 	if (buff_stat & TX_DMA_ENABLE) {

[ ... ]

Signature · 1 line
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261117193223.2795612-1-f.fainelli%40gmail.com
#9 lore raw

Re: [PATCH net v3 05/10] net: au1000: serialize TX completion with packet submission

Quoted 81 lines · On 11/20/26 02:32, [email protected] wrote:

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider.

Critical: 0 · High: 0 · Medium: 1 · Low: 0

If you believe none of the issues are legitimate, please reply to each issue of Medium severity or higher and explain why the AI is wrong. If any of them are legitimate and you plan to respin, please let patchwork know by including "pw-bot: cr" as a separate line at the end of your reply (one such reply per series is enough).

- [Medium] au1000_tx() (drivers/net/ethernet/amd/au1000_eth.c) now holds spin_lock_irqsave(&aup->lock) for the whole transmit path.

--

net: au1000: serialize TX completion with packet submission

This patch takes the IRQ-safe aup->lock in both au1000_tx_ack() and au1000_tx(), so TX descriptor reclamation and queue state changes are serialized. When au1000_tx() reclaims a completed descriptor at tx_head, it now also advances tx_tail. The skb is now freed with dev_consume_skb_any() after the lock is released.

Quoted 4 lines
drivers/net/ethernet/amd/au1000_eth.c +0 -0
index 1935b1d4b1738..805aabc6721b8 100644

[ ... ]

drivers/net/ethernet/amd/au1000_eth.c static netdev_tx_t au1000_tx(struct sk_buff *skb, struct net_device *dev) · line 985

Quoted 11 lines
drivers/net/ethernet/amd/au1000_eth.c +2 -0
@@ -972,21 +976,25 @@ static netdev_tx_t au1000_tx(struct sk_buff *skb, struct net_device *dev)
  	u32 buff_stat;
  	struct db_dest *pDB;
  	int i;
+	unsigned long flags;
 
  	netif_dbg(aup, tx_queued, dev, "tx: aup %x len=%d, data=%p, head %d\n",
  				(unsigned)aup, skb->len,
  				skb->data, aup->tx_head);
 
+	spin_lock_irqsave(&aup->lock, flags);

[Severity: Medium]
With this lock taken here, the rest of au1000_tx() runs with local hard IRQs disabled until the spin_unlock_irqrestore() at the end. That includes the packet copy and the zero padding loop:

	pDB = aup->tx_db_inuse[aup->tx_head];
	skb_copy_from_linear_data(skb, (void *)pDB->vaddr, skb->len);
	if (skb->len < ETH_ZLEN) {
		for (i = skb->len; i < ETH_ZLEN; i++)
			((char *)pDB->vaddr)[i] = 0;
	...

On Au1000/Au1500/Au1100, MIPS_ALCHEMY selects DMA_NONCOHERENT. That makes the dma_alloc_coherent() buffer uncached, so every store into pDB->vaddr is an uncached bus write. A full frame is up to about 1514 bytes.

The RX side has only NUM_RX_DMA (4) hardware buffers, and they are serviced only from au1000_interrupt()->au1000_rx(). Before this patch, the RX interrupt could preempt the copy.

Could this longer IRQ-off window on every transmit lead to more RX overruns (RX_MISSED_FRAME) under combined TX/RX load? It would also add interrupt latency for the rest of the system on these single-core parts.

The copy does not appear to need the lock. Suppose au1000_tx() has checked, under the lock, that TX_DMA_ENABLE and TX_T_DONE are clear at tx_head:

- au1000_tx_ack() stops at the first descriptor without TX_T_DONE.
- It never touches the tx_db_inuse[] buffers or tx_head.
- ndo_start_xmit is already serialized by the TX queue lock.

Would it be enough to hold aup->lock only for the descriptor state check, the tx_tail/tx_full handling, and the final len, buff_stat and tx_head updates, and do the copy and padding outside it?

Quoted 6 lines
Quoted 3 lines
drivers/net/ethernet/amd/au1000_eth.c +0 -0
  	ptxd = aup->tx_dma_ring[aup->tx_head];
  	buff_stat = ptxd->buff_stat;
  	if (buff_stat & TX_DMA_ENABLE) {

[ ... ]

Agreed. I have narrowed aup->lock to descriptor reservation and final publication, moving the packet copy and padding outside the IRQ-disabled critical sections.

When submission reclaims a completed descriptor, it now clears TX_T_DONE and advances tx_tail before dropping the lock. The TX queue lock reserves that idle descriptor during the copy, while au1000_tx_ack() stops at it because TX_T_DONE is clear.

pw-bot: cr

Signature · 1 line
Florian
#10 lore raw

PATCH v3 6/10 net: au1000: restore receive filtering before enabling RX

In reply to Florian Fainelli

MAC initialization overwrites the receive mode, dropping promiscuous and multicast settings after a watchdog reset without notifying the network stack. Restore the requested filtering before the control write that enables RX, avoiding a window with the wrong filter.

Factor receive-mode programming into a helper shared by initialization and the receive-mode callback. Hold the address-list lock before the device lock through initialization so the filter snapshot stays current. Protect callback control-register updates with the device lock as well.

Fixes 1da177e4c3f4 ("Linux-2.6.12-rc2")
---
 drivers/net/ethernet/amd/au1000_eth.c | 23 ++++++++++++++++++++---
 1 file changed, 20 insertions(+), 3 deletions(-)
drivers/net/ethernet/amd/au1000_eth.c +20 -3
index 805aabc6721b..0e9226ea05e1 100644
@@ -685,6 +685,8 @@ static const struct ethtool_ops au1000_ethtool_ops = {
 	.set_link_ksettings = phy_ethtool_set_link_ksettings,
 };
 
+static u32 au1000_rx_mode(struct net_device *dev, u32 reg);
+
 /*
  * Initialize the interface.
  *
@@ -706,6 +708,7 @@ static int au1000_init(struct net_device *dev)
 	/* bring the device out of reset */
 	au1000_enable_mac(dev, 1);
 
+	netif_addr_lock_bh(dev);
 	spin_lock_irqsave(&aup->lock, flags);
 
 	writel(0, &aup->mac->control);
@@ -738,11 +741,14 @@ static int au1000_init(struct net_device *dev)
 		control |= MAC_FULL_DUPLEX;
 	}
 
+	control = au1000_rx_mode(dev, control);
+
 	writel(control, &aup->mac->control);
 	writel(0x8100, &aup->mac->vlan1_tag); /* activate vlan support */
 	wmb(); /* drain writebuffer */
 
 	spin_unlock_irqrestore(&aup->lock, flags);
+	netif_addr_unlock_bh(dev);
 	return 0;
 }
 
@@ -1036,13 +1042,12 @@ static void au1000_tx_timeout(struct net_device *dev, unsigned int txqueue)
 	netif_wake_queue(dev);
 }
 
-static void au1000_multicast_list(struct net_device *dev)
+/* Caller holds the address-list lock and aup->lock. */
+static u32 au1000_rx_mode(struct net_device *dev, u32 reg)
 {
 	struct au1000_private *aup = netdev_priv(dev);
-	u32 reg;
 
 	netif_dbg(aup, drv, dev, "%s: flags=%x\n", __func__, dev->flags);
-	reg = readl(&aup->mac->control);
 	if (dev->flags & IFF_PROMISC) {			/* Set promiscuous. */
 		reg |= MAC_PROMISCUOUS;
 	} else if ((dev->flags & IFF_ALLMULTI)  ||
@@ -1063,7 +1068,19 @@ static void au1000_multicast_list(struct net_device *dev)
 		reg &= ~(MAC_PROMISCUOUS | MAC_PASS_ALL_MULTI);
 		reg |= MAC_HASH_MODE;
 	}
+	return reg;
+}
+
+static void au1000_multicast_list(struct net_device *dev)
+{
+	struct au1000_private *aup = netdev_priv(dev);
+	unsigned long flags;
+	u32 reg;
+
+	spin_lock_irqsave(&aup->lock, flags);
+	reg = au1000_rx_mode(dev, readl(&aup->mac->control));
 	writel(reg, &aup->mac->control);
+	spin_unlock_irqrestore(&aup->lock, flags);
 }
 
 static const struct net_device_ops au1000_netdev_ops = {
Signature · 1 line
2.53.0
#11 lore raw

PATCH v3 7/10 net: au1000: restore RX buffer addresses when restarting the MAC

In reply to Florian Fainelli

The MAC DMA engine updates each receive descriptor's address as it transfers data. Clearing the descriptor control bits during reset does not restore the buffer's starting address.

au1000_init() only set RX_DMA_ENABLE on the address left in the descriptor. After closing and reopening the interface, a receive could therefore start partway through its buffer and overwrite memory beyond the allocation.

Reload each RX descriptor from rx_db_inuse before enabling it, as the receive completion path already does.

Fixes 1da177e4c3f4 ("Linux-2.6.12-rc2")
---
 drivers/net/ethernet/amd/au1000_eth.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/ethernet/amd/au1000_eth.c +2 -1
index 0e9226ea05e1..cb2f3333ba9f 100644
@@ -724,7 +724,8 @@ static int au1000_init(struct net_device *dev)
 
 
 	for (i = 0; i < NUM_RX_DMA; i++)
-		aup->rx_dma_ring[i]->buff_stat |= RX_DMA_ENABLE;
+		writel(lower_32_bits(aup->rx_db_inuse[i]->dma_addr) |
+		       RX_DMA_ENABLE, &aup->rx_dma_ring[i]->buff_stat);
 
 	wmb(); /* drain writebuffer */
 
Signature · 1 line
2.53.0
#12 lore raw

Re: [PATCH net v3 07/10] net: au1000: restore RX buffer addresses when restarting the MAC

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider.

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider.

Critical: 0 · High: 0 · Medium: 1 · Low: 0

If you believe none of the issues are legitimate, please reply to each issue of Medium severity or higher and explain why the AI is wrong. If any of them are legitimate and you plan to respin, please let patchwork know by including "pw-bot: cr" as a separate line at the end of your reply (one such reply per series is enough).

- [Medium] The patch puts each RX descriptor's buffer address back to rx_db_inuse[i]->dma_addr only in au1000_init()…

--

net: au1000: restore RX buffer addresses when restarting the MAC

au1000_init() now rewrites each RX descriptor with its buffer's start address from rx_db_inuse[] before setting RX_DMA_ENABLE. Before this, it only set the enable bit on whatever address the DMA engine had left behind. That could let a receive after close/open start partway through its buffer.

drivers/net/ethernet/amd/au1000_eth.c static int au1000_init(struct net_device *dev) · line 728

Quoted 11 lines
drivers/net/ethernet/amd/au1000_eth.c +2 -1
index 0e9226ea05e18..cb2f3333ba9fd 100644
@@ -724,7 +724,8 @@ static int au1000_init(struct net_device *dev)
 
 
 	for (i = 0; i < NUM_RX_DMA; i++)
-		aup->rx_dma_ring[i]->buff_stat |= RX_DMA_ENABLE;
+		writel(lower_32_bits(aup->rx_db_inuse[i]->dma_addr) |
+		       RX_DMA_ENABLE, &aup->rx_dma_ring[i]->buff_stat);

[Severity: Medium]
Is au1000_init() the only place the receiver gets restarted?

au1000_adjust_link() also stops and restarts RX on every duplex change, and it does not go through au1000_init() or au1000_reset_mac_unlocked():

drivers/net/ethernet/amd/au1000_eth.c:au1000_adjust_link() {
    ...
	if (phydev->link && (aup->old_duplex != phydev->duplex)) {
		/* duplex mode changed */

		/* switching duplex mode requires to disable rx and tx! */
		au1000_hard_stop(dev);
		...
		au1000_enable_rx_tx(dev);
    ...
}

On link down, old_duplex is set to -1, so this path runs on every link-up after a link-down. au1000_hard_stop() only clears MAC_RX_ENABLE and MAC_TX_ENABLE in mac->control. It leaves rx_dma_ring[i]->buff_stat alone.

Suppose clearing RE stops a frame partway through. The descriptor would keep RX_DMA_ENABLE with RX_T_DONE still clear. au1000_rx() only reloads the address inside its while (buff_stat & RX_T_DONE) loop, so it would not reset this descriptor:

	prxd->buff_stat = lower_32_bits(pDB->dma_addr) | RX_DMA_ENABLE;

Could the next frame then start at the advanced address, partway into the MAX_BUF_SIZE buffer? The free list is LIFO, so rx_db_inuse[0] at probe is the last slot of the dma_alloc_coherent() region. An overrun from that slot would land outside the allocation.

A later patch in this series, "net: au1000: keep the MAC stopped until the PHY link is ready", adds another au1000_hard_stop() on link-down in au1000_adjust_link(). Each link flap would then stop RX twice, and the restart on link-up still skips the reload.

This depends on what the MAC does when RE is cleared mid-frame. If it always finishes the frame and sets RX_T_DONE, au1000_rx() covers it. Nothing in the driver documents that behaviour.

Would it make sense to put the descriptor reload in a helper that both au1000_init() and the au1000_adjust_link() stop/start sequence call?

Quoted 3 lines
drivers/net/ethernet/amd/au1000_eth.c +0 -0
 	wmb(); /* drain writebuffer */
 
Signature · 1 line
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261117193223.2795612-1-f.fainelli%40gmail.com
#13 lore raw

Re: [PATCH net v3 07/10] net: au1000: restore RX buffer addresses when restarting the MAC

Quoted 75 lines · On 11/20/26 02:32, [email protected] wrote:

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider.

Critical: 0 · High: 0 · Medium: 1 · Low: 0

If you believe none of the issues are legitimate, please reply to each issue of Medium severity or higher and explain why the AI is wrong. If any of them are legitimate and you plan to respin, please let patchwork know by including "pw-bot: cr" as a separate line at the end of your reply (one such reply per series is enough).

- [Medium] The patch puts each RX descriptor's buffer address back to rx_db_inuse[i]->dma_addr only in au1000_init()…

--

net: au1000: restore RX buffer addresses when restarting the MAC

au1000_init() now rewrites each RX descriptor with its buffer's start address from rx_db_inuse[] before setting RX_DMA_ENABLE. Before this, it only set the enable bit on whatever address the DMA engine had left behind. That could let a receive after close/open start partway through its buffer.

drivers/net/ethernet/amd/au1000_eth.c static int au1000_init(struct net_device *dev) · line 728

Quoted 11 lines
drivers/net/ethernet/amd/au1000_eth.c +2 -1
index 0e9226ea05e18..cb2f3333ba9fd 100644
@@ -724,7 +724,8 @@ static int au1000_init(struct net_device *dev)
 
 
  	for (i = 0; i < NUM_RX_DMA; i++)
-		aup->rx_dma_ring[i]->buff_stat |= RX_DMA_ENABLE;
+		writel(lower_32_bits(aup->rx_db_inuse[i]->dma_addr) |
+		       RX_DMA_ENABLE, &aup->rx_dma_ring[i]->buff_stat);

[Severity: Medium]
Is au1000_init() the only place the receiver gets restarted?

au1000_adjust_link() also stops and restarts RX on every duplex change, and it does not go through au1000_init() or au1000_reset_mac_unlocked():

drivers/net/ethernet/amd/au1000_eth.c:au1000_adjust_link() {
     ...
	if (phydev->link && (aup->old_duplex != phydev->duplex)) {
		/* duplex mode changed */

		/* switching duplex mode requires to disable rx and tx! */
		au1000_hard_stop(dev);
		...
		au1000_enable_rx_tx(dev);
     ...
}

On link down, old_duplex is set to -1, so this path runs on every link-up after a link-down. au1000_hard_stop() only clears MAC_RX_ENABLE and MAC_TX_ENABLE in mac->control. It leaves rx_dma_ring[i]->buff_stat alone.

Suppose clearing RE stops a frame partway through. The descriptor would keep RX_DMA_ENABLE with RX_T_DONE still clear. au1000_rx() only reloads the address inside its while (buff_stat & RX_T_DONE) loop, so it would not reset this descriptor:

	prxd->buff_stat = lower_32_bits(pDB->dma_addr) | RX_DMA_ENABLE;

Could the next frame then start at the advanced address, partway into the MAX_BUF_SIZE buffer? The free list is LIFO, so rx_db_inuse[0] at probe is the last slot of the dma_alloc_coherent() region. An overrun from that slot would land outside the allocation.

A later patch in this series, "net: au1000: keep the MAC stopped until the PHY link is ready", adds another au1000_hard_stop() on link-down in au1000_adjust_link(). Each link flap would then stop RX twice, and the restart on link-up still skips the reload.

Quoted 11 lines

This depends on what the MAC does when RE is cleared mid-frame. If it always finishes the frame and sets RX_T_DONE, au1000_rx() covers it. Nothing in the driver documents that behaviour.

Would it make sense to put the descriptor reload in a helper that both au1000_init() and the au1000_adjust_link() stop/start sequence call?

Quoted 3 lines
drivers/net/ethernet/amd/au1000_eth.c +0 -0
  	wmb(); /* drain writebuffer */
 

Thanks for pointing out the additional restart path. I checked it on MTX-1 using a temporary instrumented kernel, switching duplex modes under incoming traffic and recording RX descriptor state before clearing RE and after the existing 10 ms wait in au1000_hard_stop().

Across 11 stops and 44 descriptor snapshots, nine descriptors had advanced addresses with EN set and DN clear before stopping. All nine had DN set after the wait. No descriptor retained an advanced address with DN clear afterward. Those completed descriptors can therefore be processed and rearmed by au1000_rx().

The Au1500 databook, section 7.4.4.1, page 134 (https://assets.sourcengine.com/datasheets/e176e7fe-d2b8-4143-8002-16670131c1ce.pdf#page=134) also specifies that an enabled RX address register must not be rewritten until DN is set. Moving an unconditional reload into the link-change path would need a demonstrated safe DMA quiesce point.

I have not reproduced the proposed failure on the tested hardware, so I am leaving this patch scoped to restoring addresses after a full MAC reset. This finite test does not establish the behavior of every silicon revision or every link-loss timing, but it provides evidence that the in-flight receive completes during the existing stop delay on MTX-1.

pw-bot: cr

Signature · 1 line
Florian
#14 lore raw

PATCH v3 8/10 net: phy: smsc: wait for LAN83C183 power-down recovery

In reply to Florian Fainelli

The LAN83C183 uses the generic PHY driver, which returns immediately after clearing BMCR_PDOWN. Section 1.11 of the datasheet allows 500 ms before normal operation is restored. Starting the Au1000 MAC before the MII clocks recover can hang the MTX-1 when reopening its interface.

Add a LAN83C183 driver entry and resume callback. Wait for recovery only when BMCR_PDOWN was actually cleared, and propagate MDIO errors without waiting. Resuming an already awake PHY does not incur the delay.

This supplies the PHY recovery delay; it does not by itself fix the Au1000 MAC/PHY ordering on reopen. The companion patch, "net: au1000:
keep the MAC stopped until the PHY link is ready", resumes the PHY synchronously before MAC initialization and stops the MAC before PHY suspend. Both changes are needed to address the MTX-1 reopen hang. Keep this PHY change first so the recovery delay is available when the MAC sequencing fix is applied.

Fixes be9dad1f9f26 ("net: phy: suspend phydev when going to HALTED")
---
 drivers/net/phy/Kconfig |  2 +-
 drivers/net/phy/smsc.c  | 26 ++++++++++++++++++++++++++
 2 files changed, 27 insertions(+), 1 deletion(-)
drivers/net/phy/Kconfig +1 -1
index 30e9d22c8d1a..10466b2574eb 100644
@@ -421,7 +421,7 @@ config SMSC_PHY
 	tristate "SMSC PHYs"
 	select CRC16
 	help
-	  Currently supports the LAN83C185, LAN8187 and LAN8700 PHYs
+	  Currently supports the LAN83C183, LAN83C185, LAN8187 and LAN8700 PHYs
 
 config STE10XP
 	tristate "STMicroelectronics STe10Xp PHYs"
drivers/net/phy/smsc.c +26 -0
index 48487149c225..c3b51afd4b1e 100644
@@ -13,6 +13,7 @@
  */
 
 #include <linux/clk.h>
+#include <linux/delay.h>
 #include <linux/kernel.h>
 #include <linux/module.h>
 #include <linux/mii.h>
@@ -684,8 +685,32 @@ int smsc_phy_probe(struct phy_device *phydev)
 }
 EXPORT_SYMBOL_GPL(smsc_phy_probe);
 
+static int lan83c183_resume(struct phy_device *phydev)
+{
+	int ret;
+
+	ret = phy_modify_changed(phydev, MII_BMCR, BMCR_PDOWN, 0);
+	if (ret < 0)
+		return ret;
+
+	/* The PHY needs up to 500 ms to restore operation after power-down. */
+	if (ret)
+		msleep(500);
+
+	return 0;
+}
+
 static struct phy_driver smsc_phy_driver[] = {
 {
+	.phy_id		= 0x0016f840,
+	.phy_id_mask	= 0xfffffff0,
+	.name		= "SMSC LAN83C183",
+
+	.get_features	= genphy_read_abilities,
+	.suspend	= genphy_suspend,
+	.resume		= lan83c183_resume,
+	.set_loopback	= genphy_loopback,
+}, {
 	.phy_id		= 0x0007c0a0, /* OUI=0x00800f, Model#=0x0a */
 	.phy_id_mask	= 0xfffffff0,
 	.name		= "SMSC LAN83C185",
@@ -887,6 +912,7 @@ MODULE_AUTHOR("Herbert Valerio Riedel");
 MODULE_LICENSE("GPL");
 
 static const struct mdio_device_id __maybe_unused smsc_tbl[] = {
+	{ 0x0016f840, 0xfffffff0 },
 	{ 0x0007c0a0, 0xfffffff0 },
 	{ 0x0007c0b0, 0xfffffff0 },
 	{ 0x0007c0c0, 0xfffffff0 },
Signature · 1 line
2.53.0
#15 lore raw

Re: [PATCH net v3 08/10] net: phy: smsc: wait for LAN83C183 power-down recovery

Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider.

Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider.

Critical: 0 · High: 0 · Medium: 1 · Low: 1

If you believe none of the issues are legitimate, please reply to each issue of Medium severity or higher and explain why the AI is wrong. If any of them are legitimate and you plan to respin, please let patchwork know by including "pw-bot: cr" as a separate line at the end of your reply (one such reply per series is enough).

- [Medium] The 500 ms recovery delay in lan83c183_resume() only runs if drivers/net/phy/smsc.c is the driver bound to the PHY when au1000_eth…
- [Low] The new smsc_phy_driver[] entry and smsc_tbl alias match phy_id 0x0016f840 with mask 0xfffffff0.

--

net: phy: smsc: wait for LAN83C183 power-down recovery

This adds a LAN83C183 entry to the smsc PHY driver. Its resume callback sleeps 500 ms after clearing BMCR_PDOWN, which is the power-down recovery time given in the datasheet. Together with a companion au1000 patch, it is meant to fix an interface reopen hang on the MTX-1 board.

Quoted 4 lines
drivers/net/phy/smsc.c +0 -0
index 48487149c2252..c3b51afd4b1e5 100644

[ ... ]

Quoted 5 lines
drivers/net/phy/smsc.c +1 -0
@@ -684,8 +685,32 @@ int smsc_phy_probe(struct phy_device *phydev)
 }
 EXPORT_SYMBOL_GPL(smsc_phy_probe);
 
+static int lan83c183_resume(struct phy_device *phydev)

drivers/net/phy/smsc.c int smsc_phy_probe(struct phy_device *phydev) · line 698

Quoted 10 lines
drivers/net/phy/smsc.c +10 -0
+{
+	int ret;
+
+	ret = phy_modify_changed(phydev, MII_BMCR, BMCR_PDOWN, 0);
+	if (ret < 0)
+		return ret;
+
+	/* The PHY needs up to 500 ms to restore operation after power-down. */
+	if (ret)
+		msleep(500);

[Severity: Medium]
Does this delay actually run on the MTX-1 board that the series targets?

lan83c183_resume() only runs if smsc.c is the driver bound to the PHY when au1000_eth attaches it. The attach happens at MAC probe time. That is still true after the companion patch, which only adds phy_resume() in au1000_open():

au1000_probe()
au1000_mii_probe()
phy_connect()
phy_attach_direct()

If no specific driver is bound yet, phy_attach_direct() falls back to genphy:

	if (!d->driver) {
		if (phydev->is_c45)
			d->driver = &genphy_c45_driver.mdiodrv.driver;
		else
			d->driver = &genphy_driver.mdiodrv.driver;

arch/mips/configs/mtx1_defconfig sets CONFIG_SMSC_PHY=m and does not enable CONFIG_MIPS_AU1X00_ENET at all. Other Alchemy defconfigs, such as gpr_defconfig, set the MAC to =y alongside SMSC_PHY=m.

Take a built-in MAC with no initramfs. At probe time, the request_module() in phy_request_driver_module() can't load smsc.ko. genphy then stays bound until detach, and loading smsc.ko later does not rebind the PHY.

In that case resume goes through genphy_resume() with no wait, and the reopen hang would still be there.

Should the commit message or the series say that SMSC_PHY has to be built in (or included in the initramfs)? Or should mtx1_defconfig be updated to match?

drivers/net/phy/smsc.c int smsc_phy_probe(struct phy_device *phydev) · line 707

Quoted 9 lines
drivers/net/phy/smsc.c +7 -0
+
+	return 0;
+}
+
 static struct phy_driver smsc_phy_driver[] = {
 {
+	.phy_id		= 0x0016f840,
+	.phy_id_mask	= 0xfffffff0,
+	.name		= "SMSC LAN83C183",

[Severity: Low]
Is 0x0016f840 specific enough to SMSC parts?

This ID does not carry SMSC's OUI, unlike the neighbouring entries. phy_id >> 10 gives 0x5be, which corresponds to SEEQ Technology's OUI 00:a0:7d. The existing SMSC entries give 0x1f0 (00:80:0f). The model number is 4.

The ID is correct for the LAN83C183. drivers/net/ethernet/smsc/smc91x.h defines:

#define PHY_LAN83C183 0x0016f840

That looks like a licensed SEEQ/LSI core inside the LAN91C111.

Any other SEEQ/LSI PHY that reports the same OUI and model 4 would now autoload smsc.ko through the new smsc_tbl entry. It would bind as "SMSC LAN83C183" instead of genphy. It would also get the 500 ms msleep() in lan83c183_resume() every time BMCR_PDOWN is cleared. The LSI 80227 may be one such part, though this tree does not confirm it.

Also, this isn't a bug, but the new entry has no OUI/Model# comment, while the other entries do.

Quoted 6 lines
drivers/net/phy/smsc.c +6 -0
+
+	.get_features	= genphy_read_abilities,
+	.suspend	= genphy_suspend,
+	.resume		= lan83c183_resume,
+	.set_loopback	= genphy_loopback,
+}, {

[ ... ]

Signature · 1 line
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261117193223.2795612-1-f.fainelli%40gmail.com
#16 lore raw

Re: [PATCH net v3 08/10] net: phy: smsc: wait for LAN83C183 power-down recovery

Quoted 121 lines · On 11/20/26 02:32, [email protected] wrote:

Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider.

Critical: 0 · High: 0 · Medium: 1 · Low: 1

If you believe none of the issues are legitimate, please reply to each issue of Medium severity or higher and explain why the AI is wrong. If any of them are legitimate and you plan to respin, please let patchwork know by including "pw-bot: cr" as a separate line at the end of your reply (one such reply per series is enough).

- [Medium] The 500 ms recovery delay in lan83c183_resume() only runs if drivers/net/phy/smsc.c is the driver bound to the PHY when au1000_eth…
- [Low] The new smsc_phy_driver[] entry and smsc_tbl alias match phy_id 0x0016f840 with mask 0xfffffff0.

--

net: phy: smsc: wait for LAN83C183 power-down recovery

This adds a LAN83C183 entry to the smsc PHY driver. Its resume callback sleeps 500 ms after clearing BMCR_PDOWN, which is the power-down recovery time given in the datasheet. Together with a companion au1000 patch, it is meant to fix an interface reopen hang on the MTX-1 board.

Quoted 4 lines
drivers/net/phy/smsc.c +0 -0
index 48487149c2252..c3b51afd4b1e5 100644

[ ... ]

Quoted 5 lines
drivers/net/phy/smsc.c +1 -0
@@ -684,8 +685,32 @@ int smsc_phy_probe(struct phy_device *phydev)
  }
  EXPORT_SYMBOL_GPL(smsc_phy_probe);
 
+static int lan83c183_resume(struct phy_device *phydev)

drivers/net/phy/smsc.c int smsc_phy_probe(struct phy_device *phydev) · line 698

Quoted 10 lines
drivers/net/phy/smsc.c +10 -0
+{
+	int ret;
+
+	ret = phy_modify_changed(phydev, MII_BMCR, BMCR_PDOWN, 0);
+	if (ret < 0)
+		return ret;
+
+	/* The PHY needs up to 500 ms to restore operation after power-down. */
+	if (ret)
+		msleep(500);

[Severity: Medium]
Does this delay actually run on the MTX-1 board that the series targets?

lan83c183_resume() only runs if smsc.c is the driver bound to the PHY when au1000_eth attaches it. The attach happens at MAC probe time. That is still true after the companion patch, which only adds phy_resume() in au1000_open():

au1000_probe()
au1000_mii_probe()
phy_connect()
phy_attach_direct()

If no specific driver is bound yet, phy_attach_direct() falls back to genphy:

	if (!d->driver) {
		if (phydev->is_c45)
			d->driver = &genphy_c45_driver.mdiodrv.driver;
		else
			d->driver = &genphy_driver.mdiodrv.driver;

arch/mips/configs/mtx1_defconfig sets CONFIG_SMSC_PHY=m and does not enable CONFIG_MIPS_AU1X00_ENET at all. Other Alchemy defconfigs, such as gpr_defconfig, set the MAC to =y alongside SMSC_PHY=m.

Take a built-in MAC with no initramfs. At probe time, the request_module() in phy_request_driver_module() can't load smsc.ko. genphy then stays bound until detach, and loading smsc.ko later does not rebind the PHY.

In that case resume goes through genphy_resume() with no wait, and the reopen hang would still be there.

Should the commit message or the series say that SMSC_PHY has to be built in (or included in the initramfs)? Or should mtx1_defconfig be updated to match?

drivers/net/phy/smsc.c int smsc_phy_probe(struct phy_device *phydev) · line 707

Quoted 9 lines
drivers/net/phy/smsc.c +7 -0
+
+	return 0;
+}
+
  static struct phy_driver smsc_phy_driver[] = {
  {
+	.phy_id		= 0x0016f840,
+	.phy_id_mask	= 0xfffffff0,
+	.name		= "SMSC LAN83C183",

[Severity: Low]
Is 0x0016f840 specific enough to SMSC parts?

This ID does not carry SMSC's OUI, unlike the neighbouring entries. phy_id >> 10 gives 0x5be, which corresponds to SEEQ Technology's OUI 00:a0:7d. The existing SMSC entries give 0x1f0 (00:80:0f). The model number is 4.

The ID is correct for the LAN83C183. drivers/net/ethernet/smsc/smc91x.h defines:

#define PHY_LAN83C183 0x0016f840

That looks like a licensed SEEQ/LSI core inside the LAN91C111.

Any other SEEQ/LSI PHY that reports the same OUI and model 4 would now autoload smsc.ko through the new smsc_tbl entry. It would bind as "SMSC LAN83C183" instead of genphy. It would also get the 500 ms msleep() in lan83c183_resume() every time BMCR_PDOWN is cleared. The LSI 80227 may be one such part, though this tree does not confirm it.

Also, this isn't a bug, but the new entry has no OUI/Model# comment, while the other entries do.

Quoted 9 lines
Quoted 6 lines
drivers/net/phy/smsc.c +6 -0
+
+	.get_features	= genphy_read_abilities,
+	.suspend	= genphy_suspend,
+	.resume		= lan83c183_resume,
+	.set_loopback	= genphy_loopback,
+}, {

[ ... ]

Agreed on the binding prerequisite. Our MTX-1 tests used CONFIG_MIPS_AU1X00_ENET=y and CONFIG_SMSC_PHY=y, and the boot logs confirmed attachment to the SMSC LAN83C183 driver.

I have updated the commit message to make this requirement explicit. For early boot with a built-in MAC, SMSC_PHY should also be built in. Modular configurations must ensure that smsc.ko is loaded before PHY attachment; merely including it in the initramfs or loading it after genphy has attached is insufficient.

Regarding the ID, the LAN83C183 and L80227 manuals both specify OUI 00:a0:7d and model 4, so the overlap is real. I added a comment and documented that the match also applies the conservative 500 ms power-down recovery delay to the L80227. The entry otherwise uses generic PHY helpers and performs no SMSC-specific register programming. Hardware validation remains limited to the LAN83C183; I have not tested the L80227.

pw-bot: cr

Signature · 1 line
Florian
#17 lore raw

PATCH v3 9/10 net: au1000: keep the MAC stopped until the PHY link is ready

In reply to Florian Fainelli

phy_stop() powers down the PHY when the interface is closed. The driver leaves MAC receive/transmit enabled on link-down and enables them during initialization before the PHY resumes. MTX-1 can hang when the MAC runs while its MII clocks are absent or still recovering.

Stop the MAC on link-down before phylib suspends the PHY. On open, clear the driver's acknowledged link cache and synchronously resume the PHY to restore its MII clocks and honor its recovery delay before MAC initialization. Preserve the existing au1000_init() before phy_start() ordering so the PHY worker cannot access MDIO or enable traffic during setup. Leave RX/TX stopped until a link-up callback configures duplex and enables traffic.

Use the acknowledged link and duplex cache under the device lock during initialization, retaining it for watchdog recovery. Keep the reset-time hard stop for paths without a preceding link-down callback. On resume failure reset the MAC and release the IRQ. Remove the unreachable initialization-error branch, since au1000_init() always returns zero. Reconcile the initialization and probe comments: initialization forces a reset itself, and PHY resume may already have enabled the MAC for MDIO accesses.

Fixes be9dad1f9f26 ("net: phy: suspend phydev when going to HALTED")
---
 drivers/net/ethernet/amd/au1000_eth.c | 49 ++++++++++++++++++---------
 1 file changed, 33 insertions(+), 16 deletions(-)
drivers/net/ethernet/amd/au1000_eth.c +33 -16
index cb2f3333ba9f..98a75aba92e1 100644
@@ -456,7 +456,8 @@ au1000_adjust_link(struct net_device *dev)
 		/* link state changed */
 
 		if (!phydev->link) {
-			/* link went down */
+			/* Stop the MAC before the PHY can remove its clocks. */
+			au1000_hard_stop(dev);
 			aup->old_speed = 0;
 			aup->old_duplex = -1;
 		}
@@ -688,13 +689,11 @@ static const struct ethtool_ops au1000_ethtool_ops = {
 static u32 au1000_rx_mode(struct net_device *dev, u32 reg);
 
 /*
- * Initialize the interface.
+ * Reset and initialize the interface.
  *
- * When the device powers up, the clocks are disabled and the
- * mac is in reset state.  When the interface is closed, we
- * do the same -- reset the device and disable the clocks to
- * conserve power. Thus, whenever au1000_init() is called,
- * the device should already be in reset state.
+ * The PHY must be resumed before initializing the MAC. MDIO accesses
+ * during PHY resume may have already enabled the MAC clocks and released
+ * reset; au1000_enable_mac(dev, 1) forces a reset regardless of that state.
  */
 static int au1000_init(struct net_device *dev)
 {
@@ -729,12 +728,12 @@ static int au1000_init(struct net_device *dev)
 
 	wmb(); /* drain writebuffer */
 
-	control = MAC_RX_ENABLE | MAC_TX_ENABLE;
+	control = 0;
 #ifndef CONFIG_CPU_LITTLE_ENDIAN
 	control |= MAC_BIG_ENDIAN;
 #endif
 	if (dev->phydev) {
-		if (dev->phydev->link && (DUPLEX_FULL == dev->phydev->duplex))
+		if (aup->old_link && aup->old_duplex == DUPLEX_FULL)
 			control |= MAC_FULL_DUPLEX;
 		else
 			control |= MAC_DISABLE_RX_OWN;
@@ -744,6 +743,10 @@ static int au1000_init(struct net_device *dev)
 
 	control = au1000_rx_mode(dev, control);
 
+	/* Only use link state acknowledged by au1000_adjust_link(). */
+	if (!dev->phydev || aup->old_link)
+		control |= MAC_RX_ENABLE | MAC_TX_ENABLE;
+
 	writel(control, &aup->mac->control);
 	writel(0x8100, &aup->mac->vlan1_tag); /* activate vlan support */
 	wmb(); /* drain writebuffer */
@@ -918,6 +921,7 @@ static irqreturn_t au1000_interrupt(int irq, void *dev_id)
 
 static int au1000_open(struct net_device *dev)
 {
+	unsigned long flags;
 	int retval;
 	struct au1000_private *aup = netdev_priv(dev);
 
@@ -930,13 +934,21 @@ static int au1000_open(struct net_device *dev)
 		return retval;
 	}
 
-	retval = au1000_init(dev);
-	if (retval) {
-		netdev_err(dev, "error in au1000_init\n");
-		free_irq(dev->irq, dev);
-		return retval;
+	spin_lock_irqsave(&aup->lock, flags);
+	aup->old_link = 0;
+	aup->old_speed = 0;
+	aup->old_duplex = -1;
+	spin_unlock_irqrestore(&aup->lock, flags);
+
+	/* Restore the MII clocks without starting the PHY state machine. */
+	if (dev->phydev) {
+		retval = phy_resume(dev->phydev);
+		if (retval)
+			goto err_reset;
 	}
 
+	au1000_init(dev);
+
 	if (dev->phydev)
 		phy_start(dev->phydev);
 
@@ -945,6 +957,11 @@ static int au1000_open(struct net_device *dev)
 	netif_dbg(aup, drv, dev, "open: Initialization done.\n");
 
 	return 0;
+
+err_reset:
+	au1000_reset_mac(dev);
+	free_irq(dev->irq, dev);
+	return retval;
 }
 
 static int au1000_close(struct net_device *dev)
@@ -1306,8 +1323,8 @@ static int au1000_probe(struct platform_device *pdev)
 	dev->watchdog_timeo = ETH_TX_TIMEOUT;
 
 	/*
-	 * The boot code uses the ethernet controller, so reset it to start
-	 * fresh.  au1000_init() expects that the device is in reset state.
+	 * The boot code uses the ethernet controller, so stop it and gate
+	 * its clock until the driver needs it.
 	 */
 	au1000_reset_mac(dev);
 
Signature · 1 line
2.53.0
#18 lore raw

Re: [PATCH net v3 09/10] net: au1000: keep the MAC stopped until the PHY link is ready

Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider.

Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider.

Critical: 0 · High: 1 · Medium: 0 · Low: 1

If you believe none of the issues are legitimate, please reply to each issue of Medium severity or higher and explain why the AI is wrong. If any of them are legitimate and you plan to respin, please let patchwork know by including "pw-bot: cr" as a separate line at the end of your reply (one such reply per series is enough).

- [High] The fix stops MAC RX/TX in only one place: the link-down branch of au1000_adjust_link()…
- [Low] The new au1000_hard_stop(dev) call in the link-down branch of au1000_adjust_link() (au1000_eth.c:460) runs inside…

--

net: au1000: keep the MAC stopped until the PHY link is ready

This patch stops MAC RX/TX in the link-down branch of au1000_adjust_link(). In au1000_open() it resumes the PHY synchronously before au1000_init(). It also changes au1000_init() to leave RX/TX disabled until au1000_adjust_link() has acknowledged a link.

drivers/net/ethernet/amd/au1000_eth.c au1000_adjust_link(struct net_device *dev) · line 460

Quoted 11 lines
drivers/net/ethernet/amd/au1000_eth.c +2 -1
index cb2f3333ba9fd..98a75aba92e1a 100644
@@ -456,7 +456,8 @@ au1000_adjust_link(struct net_device *dev)
 		/* link state changed */
 
 		if (!phydev->link) {
-			/* link went down */
+			/* Stop the MAC before the PHY can remove its clocks. */
+			au1000_hard_stop(dev);

[Severity: High]
This covers phy_stop() on close. Is there a path that powers the PHY down without ever calling adjust_link, though?

During system sleep, mdio_bus_phy_suspend() only skips the PHY when mac_managed_pm is set, and au1000_eth never sets it:

drivers/net/phy/phy_device.c:mdio_bus_phy_suspend() {
    ...
	if (phydev->mac_managed_pm)
		return 0;
    ...
	if (phy_uses_state_machine(phydev))
		phy_stop_machine(phydev);
    ...
	return phy_suspend(phydev);
}

phy_stop_machine() only cancels the work and moves the state to PHY_UP, so it never reaches the PHY_HALTED path that calls phy_link_down():

drivers/net/phy/phy.c:phy_stop_machine() {
	cancel_delayed_work_sync(&phydev->state_queue);
	mutex_lock(&phydev->lock);
	if (phy_is_started(phydev))
		phydev->state = PHY_UP;
    ...
}

On MTX-1 the LAN83C183 then gets genphy_suspend(), which sets BMCR_PDOWN. au1000_eth_driver has no .driver.pm callbacks. With the interface up and the link up, the MAC appears to keep MAC_RX_ENABLE | MAC_TX_ENABLE set for the whole sleep.

On resume, mdio_bus_phy_resume()->lan83c183_resume() waits 500 ms, and the MAC is still running during that wait.

Those are the two conditions the commit message describes: "MTX-1 can hang when the MAC runs while its MII clocks are absent or still recovering."

This looks reachable on MTX-1 itself through s2idle, because pm_states_init() always offers "freeze" even without platform suspend_ops. Alchemy db1x boards can also reach it through suspend-to-mem, via the db1x_pm_ops registered in arch/mips/alchemy/devboards/pm.c.

The last patch in the series ("net: au1000: reject frames larger than the TX bounce buffer") only touches au1000_tx(), so this gap is still there at the end of the series.

Would it make sense to add MAC-side suspend/resume handling here? Another option is to set mac_managed_pm and stop and start the MAC explicitly.

[Severity: Low]
This call runs inside the spin_lock_irqsave(&aup->lock, flags) region of au1000_adjust_link(), and au1000_hard_stop() ends with a busy-wait:

au1000_hard_stop() {
    ...
	writel(reg, &aup->mac->control);
	wmb(); /* drain writebuffer */
	mdelay(10);
}

Doesn't this mean every link-down event now spins for 10 ms with local interrupts disabled? Before this change the link-down branch did no MMIO and had no delay.

On close the wait also seems to happen twice. phy_stop() leads to phy_link_down()->au1000_adjust_link(), which does the first hard stop.

au1000_close() then takes aup->lock with irqsave and calls au1000_reset_mac_unlocked(). Since MDIO accesses have re-enabled the MAC, mac_enabled is still 1, so au1000_hard_stop() runs again with RX/TX already cleared:

au1000_reset_mac_unlocked() {
    ...
	if (aup->mac_enabled) {
		au1000_hard_stop(dev);
    ...
}

The delay is only there so the MAC can quiesce before phylib suspends the PHY, and that suspend happens after adjust_link returns.

Could the register write stay under the lock, with the mdelay() moved after spin_unlock_irqrestore()?

Quoted 3 lines
drivers/net/ethernet/amd/au1000_eth.c +0 -0
 			aup->old_speed = 0;
 			aup->old_duplex = -1;
 		}

[ ... ]

Signature · 1 line
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261117193223.2795612-1-f.fainelli%40gmail.com
#19 lore raw

Re: [PATCH net v3 09/10] net: au1000: keep the MAC stopped until the PHY link is ready

Quoted 123 lines · On 11/20/26 02:32, [email protected] wrote:

Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider.

Critical: 0 · High: 1 · Medium: 0 · Low: 1

If you believe none of the issues are legitimate, please reply to each issue of Medium severity or higher and explain why the AI is wrong. If any of them are legitimate and you plan to respin, please let patchwork know by including "pw-bot: cr" as a separate line at the end of your reply (one such reply per series is enough).

- [High] The fix stops MAC RX/TX in only one place: the link-down branch of au1000_adjust_link()…
- [Low] The new au1000_hard_stop(dev) call in the link-down branch of au1000_adjust_link() (au1000_eth.c:460) runs inside…

--

net: au1000: keep the MAC stopped until the PHY link is ready

This patch stops MAC RX/TX in the link-down branch of au1000_adjust_link(). In au1000_open() it resumes the PHY synchronously before au1000_init(). It also changes au1000_init() to leave RX/TX disabled until au1000_adjust_link() has acknowledged a link.

drivers/net/ethernet/amd/au1000_eth.c au1000_adjust_link(struct net_device *dev) · line 460

Quoted 11 lines
drivers/net/ethernet/amd/au1000_eth.c +2 -1
index cb2f3333ba9fd..98a75aba92e1a 100644
@@ -456,7 +456,8 @@ au1000_adjust_link(struct net_device *dev)
  		/* link state changed */
 
  		if (!phydev->link) {
-			/* link went down */
+			/* Stop the MAC before the PHY can remove its clocks. */
+			au1000_hard_stop(dev);

[Severity: High]
This covers phy_stop() on close. Is there a path that powers the PHY down without ever calling adjust_link, though?

During system sleep, mdio_bus_phy_suspend() only skips the PHY when mac_managed_pm is set, and au1000_eth never sets it:

drivers/net/phy/phy_device.c:mdio_bus_phy_suspend() {
     ...
	if (phydev->mac_managed_pm)
		return 0;
     ...
	if (phy_uses_state_machine(phydev))
		phy_stop_machine(phydev);
     ...
	return phy_suspend(phydev);
}

phy_stop_machine() only cancels the work and moves the state to PHY_UP, so it never reaches the PHY_HALTED path that calls phy_link_down():

drivers/net/phy/phy.c:phy_stop_machine() {
	cancel_delayed_work_sync(&phydev->state_queue);
	mutex_lock(&phydev->lock);
	if (phy_is_started(phydev))
		phydev->state = PHY_UP;
     ...
}

On MTX-1 the LAN83C183 then gets genphy_suspend(), which sets BMCR_PDOWN. au1000_eth_driver has no .driver.pm callbacks. With the interface up and the link up, the MAC appears to keep MAC_RX_ENABLE | MAC_TX_ENABLE set for the whole sleep.

On resume, mdio_bus_phy_resume()->lan83c183_resume() waits 500 ms, and the MAC is still running during that wait.

Those are the two conditions the commit message describes: "MTX-1 can hang when the MAC runs while its MII clocks are absent or still recovering."

This looks reachable on MTX-1 itself through s2idle, because pm_states_init() always offers "freeze" even without platform suspend_ops. Alchemy db1x boards can also reach it through suspend-to-mem, via the db1x_pm_ops registered in arch/mips/alchemy/devboards/pm.c.

The last patch in the series ("net: au1000: reject frames larger than the TX bounce buffer") only touches au1000_tx(), so this gap is still there at the end of the series.

Would it make sense to add MAC-side suspend/resume handling here? Another option is to set mac_managed_pm and stop and start the MAC explicitly.

[Severity: Low]
This call runs inside the spin_lock_irqsave(&aup->lock, flags) region of au1000_adjust_link(), and au1000_hard_stop() ends with a busy-wait:

au1000_hard_stop() {
     ...
	writel(reg, &aup->mac->control);
	wmb(); /* drain writebuffer */
	mdelay(10);
}

Doesn't this mean every link-down event now spins for 10 ms with local interrupts disabled? Before this change the link-down branch did no MMIO and had no delay.

On close the wait also seems to happen twice. phy_stop() leads to phy_link_down()->au1000_adjust_link(), which does the first hard stop.

au1000_close() then takes aup->lock with irqsave and calls au1000_reset_mac_unlocked(). Since MDIO accesses have re-enabled the MAC, mac_enabled is still 1, so au1000_hard_stop() runs again with RX/TX already cleared:

au1000_reset_mac_unlocked() {
     ...
	if (aup->mac_enabled) {
		au1000_hard_stop(dev);
     ...
}

The delay is only there so the MAC can quiesce before phylib suspends the PHY, and that suspend happens after adjust_link returns.

Quoted 9 lines

Could the register write stay under the lock, with the mdelay() moved after spin_unlock_irqrestore()?

Quoted 3 lines
drivers/net/ethernet/amd/au1000_eth.c +0 -0
  			aup->old_speed = 0;
  			aup->old_duplex = -1;
  		}

[ ... ]

Agreed. The MDIO bus system-suspend path can power down the PHY without delivering a link-down callback, so the original fix did not cover that path.

I have added MAC-side system-sleep callbacks and set mac_managed_pm. Suspend now detaches and drains TX, disables the device IRQ, and explicitly stops and quiesces MAC RX/TX before stopping the PHY. Resume restores the PHY before initializing the MAC, then restores the IRQ, PHY state machine and network-device attachment. Inactive interfaces remain stopped, and failed resumes leave the MAC reset and the interface detached.

For the IRQ-latency concern, the link-down register update remains under aup->lock, but its quiesce wait now runs after releasing the lock and restoring local interrupts. Existing atomic waits in the reset and duplex-change paths remain.

MTX-1 testing passed 15 down/up cycles and five device-suspend/resume cycles covering up, down and never-opened interfaces. These used pm_test=devices; actual platform suspend-to-RAM was not tested.

pw-bot: cr

Signature · 1 line
Florian
#20 lore raw

PATCH v3 10/10 net: au1000: reject frames larger than the TX bounce buffer

In reply to Florian Fainelli

au1000_tx() copies skb->len bytes into a MAX_BUF_SIZE coherent buffer without checking the length. The copy can corrupt neighboring DMA buffers or run beyond the coherent allocation.

AF_PACKET with PACKET_VNET_HDR can deliver oversized frames through both plain sendmsg() and PACKET_TX_RING. In packet_snd(), a nonzero virtio GSO type bypasses the MTU checks, even when the supplied gso_size is large enough that virtio_net_hdr_to_skb() leaves the skb non-GSO. Genuine GSO packets can also reach the driver as oversized frames:
au1000 has no TSO, and software segmentation using a user-supplied gso_size can produce segments larger than MAX_BUF_SIZE.

Drop oversized packets before touching the ring or copying any data, and account them in tx_dropped. Use an IRQ-safe skb free for netpoll.

Fixes 1da177e4c3f4 ("Linux-2.6.12-rc2")
---
 drivers/net/ethernet/amd/au1000_eth.c | 6 ++++++
 1 file changed, 6 insertions(+)
drivers/net/ethernet/amd/au1000_eth.c +6 -0
index 98a75aba92e1..3b40843d0499 100644
@@ -1002,6 +1002,12 @@ static netdev_tx_t au1000_tx(struct sk_buff *skb, struct net_device *dev)
 	int i;
 	unsigned long flags;
 
+	if (unlikely(skb->len > MAX_BUF_SIZE)) {
+		dev->stats.tx_dropped++;
+		dev_kfree_skb_any(skb);
+		return NETDEV_TX_OK;
+	}
+
 	netif_dbg(aup, tx_queued, dev, "tx: aup %x len=%d, data=%p, head %d\n",
 				(unsigned)aup, skb->len,
 				skb->data, aup->tx_head);
Signature · 1 line
2.53.0
#21 lore raw
In reply to Florian Fainelli
This is an automated message. This series looks like a fix, but its commit messages seem to be missing some information:

Hi!

This is an automated message. This series looks like a fix, but its commit messages seem to be missing some information:

- Whether the issue was actually triggered, or is only theoretical (e.g. found by LLM and not proven at runtime). If it was triggered please include the symptoms, like the stack trace or kernel messages.

Please do not repost the series just to address the above. Instead, reply to this email with the missing information, so that reviewers can take it into account.

*IMPORTANT*: If you do repost (for other reasons) - please include the relevant info in the cover letter or commit messages.

Signature · 2 lines
The evaluation is done by an LLM so it may be wrong, if you think
that is the case please reply and explain.
#22 lore raw
Quoted 8 lines · On 11/17/26 11:38, [email protected] wrote:

Hi!

This is an automated message. This series looks like a fix, but its commit messages seem to be missing some information:

- Whether the issue was actually triggered, or is only theoretical (e.g. found by LLM and not proven at runtime). If it was triggered please include the symptoms, like the stack trace or kernel messages.

The issue that was found during testing is that doing an interface open/close/open would hang, every other issue was a result of code inspection hunting for other bugs.

Quoted 7 lines

Please do not repost the series just to address the above. Instead, reply to this email with the missing information, so that reviewers can take it into account.

*IMPORTANT*: If you do repost (for other reasons) - please include the relevant info in the cover letter or commit messages.

Signature · 1 line
Florian