Thread (32 messages) flat view 32 messages, 3 authors, 11h ago

Re: [PATCH net-next v5 06/11] net: pcs: xpcs: add ANRESTART support for SGMII link recovery

From: sashiko-bot@kernel.org
Date: 2026-09-14 19:44:22
Also in: linux-phy

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] Unconditionally applying the RK3568 SGMII AN restart quirk causes an infinite interrupt storm or workqueue loop on standard interrupt-driven DW XPCS configurations.
--

commit 78eb5488d0c0d3fe9f609e56e59710ced52856fa
Author: Coia Prant [off-list ref]

net: pcs: xpcs: add ANRESTART support for SGMII link recovery

This patch adds BMCR_ANRESTART to DW XPCS when configuring auto-negotiation
and when the link goes down. This is intended to resolve an issue on some
platforms (like RK3568) where the PCS does not automatically restart
auto-negotiation when the link goes down and comes back up.
quoted hunk ↗ jump to hunk
diff --git a/drivers/net/pcs/pcs-xpcs.c b/drivers/net/pcs/pcs-xpcs.c
index 0337e2bcc0125..8c3875b6985b9 100644
--- a/drivers/net/pcs/pcs-xpcs.c
+++ b/drivers/net/pcs/pcs-xpcs.c
[ ... ]
quoted hunk ↗ jump to hunk
@@ -1093,9 +1107,18 @@ static int xpcs_get_state_c37_sgmii(struct dw_xpcs *xpcs,
 		return 0;
 	}
 
-	/* Clear AN complete status or interrupt */
-	if (state->an_complete)
-		xpcs_write(xpcs, MDIO_MMD_VEND2, DW_VR_MII_AN_INTR_STS, 0);
+	if (state->an_complete) {
+		/* Clear AN complete status or interrupt */
+		ret = xpcs_write(xpcs, MDIO_MMD_VEND2, DW_VR_MII_AN_INTR_STS, 0);
+		if (ret < 0)
+			return ret;
+
+		/* Initiate the next round of AN */
+		ret = xpcs_modify(xpcs, MDIO_MMD_VEND2, MII_BMCR, BMCR_ANRESTART,
+				  BMCR_ANRESTART);
[Severity: Medium]
Could unconditionally applying this AN restart quirk cause an infinite
interrupt storm or MDIO polling loop on standard DW XPCS configurations?

If a cable is disconnected on an SGMII port, the PHY may continuously transmit
the 'Link Down' AN configuration word. When the MAC completes AN and generates
an interrupt, xpcs_get_state_c37_sgmii() is called. It clears the interrupt
and unconditionally sets BMCR_ANRESTART.

Will this cause the hardware to reset its AN state machine, immediately
complete AN again with the PHY's continuous 'Link Down' word, and fire another
interrupt, creating an endless loop?

Should this behavior be isolated to only the platforms that require the quirk
(like RK3568), rather than applied to all hardware using the DesignWare XPCS IP?
+		if (ret < 0)
+			return ret;
+	}
 
 	return 0;
 }
-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260913185849.907479-1-coiaprant@gmail.com?part=6
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help