Skip to contentSkip to conversation

net: phy: qcom: at803x: Use the correct bit to disable extended next page

PATCH Applied Maxime Chevallier 3 participants 5 messages Apr 10 – Apr 13

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net: phy: qcom: at803x: Use the correct bit to disable extended next page

As noted in the blamed commit, the AR8035 and other PHYs from this family advertise the Extended Next Page support by default, which may be understood by some partners as this PHY being multi-gig capable.

The fix is to disable XNP advertising, which is done by setting bit 12 of the Auto-Negotiation Advertisement Register (MII_ADVERTISE).

The blamed commit incorrectly uses MDIO_AN_CTRL1_XNP, which is bit 13 as per 802.3 : 45.2.7.1 AN control register (Register 7.0)

BIT 12 in MII_ADVERTISE is wrapped by ADVERTISE_RESV, used by some drivers such as the aquantia one. 802.3 Clause 28 defines bit 12 as Extended Next Page ability, at least in recent versions of the standard.

Let's add a define for it and use it in the at803x driver.

Fixes 3c51fa5d2afe ("net: phy: ar803x: disable extended next page bit")

---
Some further driver cleanup can be done to remove the use of ADVERTISE_RESV, but the macro is uapi now so it'll have to stay.

 drivers/net/phy/qcom/at803x.c | 2 +-
 include/uapi/linux/mii.h      | 3 ++-
 2 files changed, 3 insertions(+), 2 deletions(-)
drivers/net/phy/qcom/at803x.c +1 -1
index 338acd11a9b6..023c1fe0cd14 100644
@@ -524,7 +524,7 @@ static int at803x_config_init(struct phy_device *phydev)
 	 * behaviour but we still need to accommodate it. XNP is only needed
 	 * for 10Gbps support, so disable XNP.
 	 */
-	return phy_modify(phydev, MII_ADVERTISE, MDIO_AN_CTRL1_XNP, 0);
+	return phy_modify(phydev, MII_ADVERTISE, ADVERTISE_XNP, 0);
 }
 
 static void at803x_link_change_notify(struct phy_device *phydev)
include/uapi/linux/mii.h +2 -1
index 39f7c44baf53..61d6edad4b94 100644
@@ -82,7 +82,8 @@
 #define ADVERTISE_100BASE4	0x0200	/* Try for 100mbps 4k packets  */
 #define ADVERTISE_PAUSE_CAP	0x0400	/* Try for pause               */
 #define ADVERTISE_PAUSE_ASYM	0x0800	/* Try for asymetric pause     */
-#define ADVERTISE_RESV		0x1000	/* Unused...                   */
+#define ADVERTISE_XNP		0x1000  /* Extended Next Page */
+#define ADVERTISE_RESV		ADVERTISE_XNP /* Used to be reserved */
 #define ADVERTISE_RFAULT	0x2000	/* Say we can detect faults    */
 #define ADVERTISE_LPACK		0x4000	/* Ack link partners response  */
 #define ADVERTISE_NPAGE		0x8000	/* Next page bit               */
Signature · 1 line
2.49.0
maintainer
#1 lore raw
Quoted 7 lines · Maxime Chevallier

As noted in the blamed commit, the AR8035 and other PHYs from this family advertise the Extended Next Page support by default, which may be understood by some partners as this PHY being multi-gig capable.

The fix is to disable XNP advertising, which is done by setting bit 12 of the Auto-Negotiation Advertisement Register (MII_ADVERTISE).

Quoted 8 lines

The blamed commit incorrectly uses MDIO_AN_CTRL1_XNP, which is bit 13 as per 802.3 : 45.2.7.1 AN control register (Register 7.0)

BIT 12 in MII_ADVERTISE is wrapped by ADVERTISE_RESV, used by some drivers such as the aquantia one. 802.3 Clause 28 defines bit 12 as Extended Next Page ability, at least in recent versions of the standard.

Let's add a define for it and use it in the at803x driver.

I agree with this, it defines the C22 4.12 bit. And this is what the at803x driver is using it for.

include/uapi/linux/mii.h line 86

Quoted 12 lines

static void at803x_link_change_notify(struct phy_device *phydev)

include/uapi/linux/mii.h +2 -1
index 39f7c44baf53..61d6edad4b94 100644
@@ -82,7 +82,8 @@
 #define ADVERTISE_100BASE4	0x0200	/* Try for 100mbps 4k packets  */
 #define ADVERTISE_PAUSE_CAP	0x0400	/* Try for pause               */
 #define ADVERTISE_PAUSE_ASYM	0x0800	/* Try for asymetric pause     */
-#define ADVERTISE_RESV		0x1000	/* Unused...                   */
+#define ADVERTISE_XNP		0x1000  /* Extended Next Page */
+#define ADVERTISE_RESV		ADVERTISE_XNP /* Used to be reserved */

Should we keep ADVERTISE_RESV?

45.2.7.6 AN advertisement register

If the Auto-Negotiation advertisement register (register 4) is present, (see 28.2.4.1.3), then this register is a copy of the Auto-Negotiation advertisement register (register 4). In this case, reads to the AN advertisement register (7.16) report the value of the Auto-Negotiation advertisement register (register 4); writes to the AN advertisement register (7.16) cause a write to occur to the Auto-Negotiation advertisement register.

So MDIO_MMD_AN:MDIO_AN_ADVERTISE is a straight copy of MII_ADVERTISE.

        ef4_mdio_write(efx, MDIO_MMD_AN, MDIO_AN_ADVERTISE, reg);
        ret = phy_write_mmd(phydev, MDIO_MMD_AN, MDIO_AN_ADVERTISE, adv);

So ADVERTISE_XNP is just as valid in the other two drivers using ADVERTISE_RESV. I think we should change those as well to ADVERTISE_XNP and remove ADVERTISE_RESV?

Andrew

#2 lore raw

Hi Andrew,

Quoted 47 lines · Andrew Lunn
Quoted 7 lines · Maxime Chevallier

As noted in the blamed commit, the AR8035 and other PHYs from this family advertise the Extended Next Page support by default, which may be understood by some partners as this PHY being multi-gig capable.

The fix is to disable XNP advertising, which is done by setting bit 12 of the Auto-Negotiation Advertisement Register (MII_ADVERTISE).

Quoted 8 lines

The blamed commit incorrectly uses MDIO_AN_CTRL1_XNP, which is bit 13 as per 802.3 : 45.2.7.1 AN control register (Register 7.0)

BIT 12 in MII_ADVERTISE is wrapped by ADVERTISE_RESV, used by some drivers such as the aquantia one. 802.3 Clause 28 defines bit 12 as Extended Next Page ability, at least in recent versions of the standard.

Let's add a define for it and use it in the at803x driver.

I agree with this, it defines the C22 4.12 bit. And this is what the at803x driver is using it for.

include/uapi/linux/mii.h line 86

Quoted 12 lines

static void at803x_link_change_notify(struct phy_device *phydev)

include/uapi/linux/mii.h +2 -1
index 39f7c44baf53..61d6edad4b94 100644
@@ -82,7 +82,8 @@
 #define ADVERTISE_100BASE4	0x0200	/* Try for 100mbps 4k packets  */
 #define ADVERTISE_PAUSE_CAP	0x0400	/* Try for pause               */
 #define ADVERTISE_PAUSE_ASYM	0x0800	/* Try for asymetric pause     */
-#define ADVERTISE_RESV		0x1000	/* Unused...                   */
+#define ADVERTISE_XNP		0x1000  /* Extended Next Page */
+#define ADVERTISE_RESV		ADVERTISE_XNP /* Used to be reserved */

Should we keep ADVERTISE_RESV?

45.2.7.6 AN advertisement register

If the Auto-Negotiation advertisement register (register 4) is present, (see 28.2.4.1.3), then this register is a copy of the Auto-Negotiation advertisement register (register 4). In this case, reads to the AN advertisement register (7.16) report the value of the Auto-Negotiation advertisement register (register 4); writes to the AN advertisement register (7.16) cause a write to occur to the Auto-Negotiation advertisement register.

So MDIO_MMD_AN:MDIO_AN_ADVERTISE is a straight copy of MII_ADVERTISE.

Quoted 8 lines
        ef4_mdio_write(efx, MDIO_MMD_AN, MDIO_AN_ADVERTISE, reg);
        ret = phy_write_mmd(phydev, MDIO_MMD_AN, MDIO_AN_ADVERTISE, adv);

So ADVERTISE_XNP is just as valid in the other two drivers using ADVERTISE_RESV. I think we should change those as well to ADVERTISE_XNP and remove ADVERTISE_RESV?

Andrew

I agree with that yes and I've considered converting these drivers once we have net merged into net-next should this patch be applied :)

That said, ADVERTISE_RESV is in uapi, is it even possible to remove it ?

I think the best we can hope for is to no longer have in-tree users of ADVERTISE_RESV :(

Maxime

maintainer Reviewed-by
#3 lore raw
Quoted 17 lines
Quoted 17 lines

Should we keep ADVERTISE_RESV?

45.2.7.6 AN advertisement register

If the Auto-Negotiation advertisement register (register 4) is present, (see 28.2.4.1.3), then this register is a copy of the Auto-Negotiation advertisement register (register 4). In this case, reads to the AN advertisement register (7.16) report the value of the Auto-Negotiation advertisement register (register 4); writes to the AN advertisement register (7.16) cause a write to occur to the Auto-Negotiation advertisement register.

So MDIO_MMD_AN:MDIO_AN_ADVERTISE is a straight copy of MII_ADVERTISE.

        ef4_mdio_write(efx, MDIO_MMD_AN, MDIO_AN_ADVERTISE, reg);
        ret = phy_write_mmd(phydev, MDIO_MMD_AN, MDIO_AN_ADVERTISE, adv);
Quoted 8 lines
Quoted 5 lines

So ADVERTISE_XNP is just as valid in the other two drivers using ADVERTISE_RESV. I think we should change those as well to ADVERTISE_XNP and remove ADVERTISE_RESV?

Andrew

I agree with that yes and I've considered converting these drivers once we have net merged into net-next should this patch be applied :)

Ah, sorry, missed the patch was targeting net. Please do submit a cleanup for net-next later on.

Quoted 1 line

That said, ADVERTISE_RESV is in uapi, is it even possible to remove it ?

Good point. It probably does have to stay.

Andrew

#4 lore raw
In reply to Maxime Chevallier
This patch was applied to netdev/net.git (main) by Jakub Kicinski <[email protected]>:

Hello:

This patch was applied to netdev/net.git (main)
by Jakub Kicinski <[email protected]>:

Quoted 8 lines · On Fri, 10 Apr 2026 19:10:20 +0200 you wrote:

As noted in the blamed commit, the AR8035 and other PHYs from this family advertise the Extended Next Page support by default, which may be understood by some partners as this PHY being multi-gig capable.

The fix is to disable XNP advertising, which is done by setting bit 12 of the Auto-Negotiation Advertisement Register (MII_ADVERTISE).

[...]

Here is the summary with links:
- [net] net: phy: qcom: at803x: Use the correct bit to disable extended next page

    https://git.kernel.org/netdev/net/c/e7a62edd34b1

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html