* [PATCH net] amd-xgbe: fix MAC_AUTO_SW handling in CL37 AN
@ 2026-07-09 9:50 Prashanth Kumar KR
2026-07-09 23:16 ` Patrick Oppenlander
0 siblings, 1 reply; 3+ messages in thread
From: Prashanth Kumar KR @ 2026-07-09 9:50 UTC (permalink / raw)
To: Andrew Lunn, David S . Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, netdev, linux-kernel, stable, Shyam Sundar S K
Cc: Patrick Oppenlander, Thorsten Leemhuis, Prashanth Kumar KR
From: Prashanth Kumar KR <PrashanthKumar.K.R@amd.com>
MAC_AUTO_SW (VR_MII_DIG_CTRL1 bit 9) enables automatic XPCS speed
mode switching after CL37 auto-negotiation and is only meaningful in
SGMII MAC mode. The original code unconditionally set this bit on
every call to xgbe_an37_set(), including when called from
xgbe_an37_disable() with enable=false. This left MAC_AUTO_SW=1 after
AN was disabled, causing the XPCS to autonomously switch speed from
stale AN state during subsequent mode changes, breaking SGMII speed
negotiation on 1G copper SFP modules.
Fixes: 42fd432fe6d3 ("amd-xgbe: align CL37 AN sequence as per databook")
Reported-by: Patrick Oppenlander <patrick.oppenlander@gmail.com>
Link: https://lore.kernel.org/netdev/CAEg67GmFS0Q4oSZkz8zWdOzckSth9_vBPiOy6a7-d697C2w2Xg@mail.gmail.com
Signed-off-by: Prashanth Kumar KR <PrashanthKumar.K.R@amd.com>
---
drivers/net/ethernet/amd/xgbe/xgbe-mdio.c | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/drivers/net/ethernet/amd/xgbe/xgbe-mdio.c b/drivers/net/ethernet/amd/xgbe/xgbe-mdio.c
index fa0df6181207..12770af031eb 100644
--- a/drivers/net/ethernet/amd/xgbe/xgbe-mdio.c
+++ b/drivers/net/ethernet/amd/xgbe/xgbe-mdio.c
@@ -267,9 +267,14 @@ static void xgbe_an37_set(struct xgbe_prv_data *pdata, bool enable,
XMDIO_WRITE(pdata, MDIO_MMD_VEND2, MDIO_CTRL1, reg);
- reg = XMDIO_READ(pdata, MDIO_MMD_VEND2, MDIO_PCS_DIG_CTRL);
- reg |= XGBE_VEND2_MAC_AUTO_SW;
- XMDIO_WRITE(pdata, MDIO_MMD_VEND2, MDIO_PCS_DIG_CTRL, reg);
+ if (pdata->an_mode == XGBE_AN_MODE_CL37_SGMII) {
+ reg = XMDIO_READ(pdata, MDIO_MMD_VEND2, MDIO_PCS_DIG_CTRL);
+ if (enable)
+ reg |= XGBE_VEND2_MAC_AUTO_SW;
+ else
+ reg &= ~XGBE_VEND2_MAC_AUTO_SW;
+ XMDIO_WRITE(pdata, MDIO_MMD_VEND2, MDIO_PCS_DIG_CTRL, reg);
+ }
}
static void xgbe_an37_restart(struct xgbe_prv_data *pdata)
--
2.34.1
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH net] amd-xgbe: fix MAC_AUTO_SW handling in CL37 AN
2026-07-09 9:50 [PATCH net] amd-xgbe: fix MAC_AUTO_SW handling in CL37 AN Prashanth Kumar KR
@ 2026-07-09 23:16 ` Patrick Oppenlander
2026-07-13 0:30 ` Patrick Oppenlander
0 siblings, 1 reply; 3+ messages in thread
From: Patrick Oppenlander @ 2026-07-09 23:16 UTC (permalink / raw)
To: Prashanth Kumar KR
Cc: Andrew Lunn, David S . Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, netdev, linux-kernel, stable, Shyam Sundar S K,
Thorsten Leemhuis
Hi Prashanth,
thank you for addressing the bug. I will test your patch on our
hardware next week.
On Thu, 9 Jul 2026 at 19:50, Prashanth Kumar KR
<prashanthkumar.k.r@amd.com> wrote:
>
> From: Prashanth Kumar KR <PrashanthKumar.K.R@amd.com>
>
> MAC_AUTO_SW (VR_MII_DIG_CTRL1 bit 9) enables automatic XPCS speed
> mode switching after CL37 auto-negotiation and is only meaningful in
> SGMII MAC mode. The original code unconditionally set this bit on
> every call to xgbe_an37_set(), including when called from
> xgbe_an37_disable() with enable=false. This left MAC_AUTO_SW=1 after
> AN was disabled, causing the XPCS to autonomously switch speed from
> stale AN state during subsequent mode changes, breaking SGMII speed
> negotiation on 1G copper SFP modules.
In my testing this was breaking negotiation for all 1G SFP modules,
not just copper modules.
Patrick
> Fixes: 42fd432fe6d3 ("amd-xgbe: align CL37 AN sequence as per databook")
> Reported-by: Patrick Oppenlander <patrick.oppenlander@gmail.com>
> Link: https://lore.kernel.org/netdev/CAEg67GmFS0Q4oSZkz8zWdOzckSth9_vBPiOy6a7-d697C2w2Xg@mail.gmail.com
> Signed-off-by: Prashanth Kumar KR <PrashanthKumar.K.R@amd.com>
> ---
> drivers/net/ethernet/amd/xgbe/xgbe-mdio.c | 11 ++++++++---
> 1 file changed, 8 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/net/ethernet/amd/xgbe/xgbe-mdio.c b/drivers/net/ethernet/amd/xgbe/xgbe-mdio.c
> index fa0df6181207..12770af031eb 100644
> --- a/drivers/net/ethernet/amd/xgbe/xgbe-mdio.c
> +++ b/drivers/net/ethernet/amd/xgbe/xgbe-mdio.c
> @@ -267,9 +267,14 @@ static void xgbe_an37_set(struct xgbe_prv_data *pdata, bool enable,
>
> XMDIO_WRITE(pdata, MDIO_MMD_VEND2, MDIO_CTRL1, reg);
>
> - reg = XMDIO_READ(pdata, MDIO_MMD_VEND2, MDIO_PCS_DIG_CTRL);
> - reg |= XGBE_VEND2_MAC_AUTO_SW;
> - XMDIO_WRITE(pdata, MDIO_MMD_VEND2, MDIO_PCS_DIG_CTRL, reg);
> + if (pdata->an_mode == XGBE_AN_MODE_CL37_SGMII) {
> + reg = XMDIO_READ(pdata, MDIO_MMD_VEND2, MDIO_PCS_DIG_CTRL);
> + if (enable)
> + reg |= XGBE_VEND2_MAC_AUTO_SW;
> + else
> + reg &= ~XGBE_VEND2_MAC_AUTO_SW;
> + XMDIO_WRITE(pdata, MDIO_MMD_VEND2, MDIO_PCS_DIG_CTRL, reg);
> + }
> }
>
> static void xgbe_an37_restart(struct xgbe_prv_data *pdata)
> --
> 2.34.1
>
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH net] amd-xgbe: fix MAC_AUTO_SW handling in CL37 AN
2026-07-09 23:16 ` Patrick Oppenlander
@ 2026-07-13 0:30 ` Patrick Oppenlander
0 siblings, 0 replies; 3+ messages in thread
From: Patrick Oppenlander @ 2026-07-13 0:30 UTC (permalink / raw)
To: Prashanth Kumar KR
Cc: Andrew Lunn, David S . Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, netdev, linux-kernel, stable, Shyam Sundar S K,
Thorsten Leemhuis
On Fri, 10 Jul 2026 at 09:16, Patrick Oppenlander
<patrick.oppenlander@gmail.com> wrote:
>
> Hi Prashanth,
>
> thank you for addressing the bug. I will test your patch on our
> hardware next week.
Tested working on 7.0.1 with your patch applied. Thank you.
Patrick
> On Thu, 9 Jul 2026 at 19:50, Prashanth Kumar KR
> <prashanthkumar.k.r@amd.com> wrote:
> >
> > From: Prashanth Kumar KR <PrashanthKumar.K.R@amd.com>
> >
> > MAC_AUTO_SW (VR_MII_DIG_CTRL1 bit 9) enables automatic XPCS speed
> > mode switching after CL37 auto-negotiation and is only meaningful in
> > SGMII MAC mode. The original code unconditionally set this bit on
> > every call to xgbe_an37_set(), including when called from
> > xgbe_an37_disable() with enable=false. This left MAC_AUTO_SW=1 after
> > AN was disabled, causing the XPCS to autonomously switch speed from
> > stale AN state during subsequent mode changes, breaking SGMII speed
> > negotiation on 1G copper SFP modules.
>
> In my testing this was breaking negotiation for all 1G SFP modules,
> not just copper modules.
>
> Patrick
>
> > Fixes: 42fd432fe6d3 ("amd-xgbe: align CL37 AN sequence as per databook")
> > Reported-by: Patrick Oppenlander <patrick.oppenlander@gmail.com>
> > Link: https://lore.kernel.org/netdev/CAEg67GmFS0Q4oSZkz8zWdOzckSth9_vBPiOy6a7-d697C2w2Xg@mail.gmail.com
> > Signed-off-by: Prashanth Kumar KR <PrashanthKumar.K.R@amd.com>
Tested-by: Patrick Oppenlander <patrick.oppenlander@gmail.com>
> > ---
> > drivers/net/ethernet/amd/xgbe/xgbe-mdio.c | 11 ++++++++---
> > 1 file changed, 8 insertions(+), 3 deletions(-)
> >
> > diff --git a/drivers/net/ethernet/amd/xgbe/xgbe-mdio.c b/drivers/net/ethernet/amd/xgbe/xgbe-mdio.c
> > index fa0df6181207..12770af031eb 100644
> > --- a/drivers/net/ethernet/amd/xgbe/xgbe-mdio.c
> > +++ b/drivers/net/ethernet/amd/xgbe/xgbe-mdio.c
> > @@ -267,9 +267,14 @@ static void xgbe_an37_set(struct xgbe_prv_data *pdata, bool enable,
> >
> > XMDIO_WRITE(pdata, MDIO_MMD_VEND2, MDIO_CTRL1, reg);
> >
> > - reg = XMDIO_READ(pdata, MDIO_MMD_VEND2, MDIO_PCS_DIG_CTRL);
> > - reg |= XGBE_VEND2_MAC_AUTO_SW;
> > - XMDIO_WRITE(pdata, MDIO_MMD_VEND2, MDIO_PCS_DIG_CTRL, reg);
> > + if (pdata->an_mode == XGBE_AN_MODE_CL37_SGMII) {
> > + reg = XMDIO_READ(pdata, MDIO_MMD_VEND2, MDIO_PCS_DIG_CTRL);
> > + if (enable)
> > + reg |= XGBE_VEND2_MAC_AUTO_SW;
> > + else
> > + reg &= ~XGBE_VEND2_MAC_AUTO_SW;
> > + XMDIO_WRITE(pdata, MDIO_MMD_VEND2, MDIO_PCS_DIG_CTRL, reg);
> > + }
> > }
> >
> > static void xgbe_an37_restart(struct xgbe_prv_data *pdata)
> > --
> > 2.34.1
> >
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-07-13 0:30 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-09 9:50 [PATCH net] amd-xgbe: fix MAC_AUTO_SW handling in CL37 AN Prashanth Kumar KR
2026-07-09 23:16 ` Patrick Oppenlander
2026-07-13 0:30 ` Patrick Oppenlander
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox