Skip to contentSkip to conversation

net/axgbe: fix PHY auto-negotiation advertisement

PATCH Superseded Ashok Kumar Natarajan 2 participants 6 messages Mar 31 – Apr 16 Network drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net/axgbe: fix PHY auto-negotiation advertisement

Correct the programming of PHY auto-negotiation advertisement registers.

Configure Clause 22 PHY registers according to IEEE 802.3 by advertising 10/100 link capabilities and flow control through MII_ADVERTISE, and 1000BASE-T capabilities through MII_CTRL1000. This avoids advertising unsupported or unintended features such as unconditional full-duplex and pause.

Fixes 7ba7d89890ab ("net/axgbe: support Marvell M88E1512 PHY")
---
 drivers/net/axgbe/axgbe_phy.h      |  5 +++++
 drivers/net/axgbe/axgbe_phy_impl.c | 29 +++++++++++++++++++++++------
 2 files changed, 28 insertions(+), 6 deletions(-)
drivers/net/axgbe/axgbe_phy.h +5 -0
index e5568cce5f..12b1d47244 100644
@@ -156,6 +156,11 @@
 #define AXGBE_M88E1512_MODE_RGMII_SGMII		4
 #define AXGBE_M88E1512_MODE_SW_RESET		0x8000
 
+#define AXGBE_PHY_MII_CTRL1000_1000T_HALF   0x0100
+#define AXGBE_PHY_MII_CTRL1000_1000T_FULL   0x0200
+#define AXGBE_PHY_MII_CTRL1000_MS_VALUE     0x0800
+#define AXGBE_PHY_MII_CTRL1000_MS_MANUAL    0x1000
+
 
 /* Control register 1. */
 /* Enable extended speed selection */
drivers/net/axgbe/axgbe_phy_impl.c +23 -6
index 369d766884..b340ce02dd 100644
@@ -303,21 +303,38 @@ static int axgbe_phy_write(struct axgbe_port *pdata, u16 reg, u16 value)
 
 static int axgbe_phy_config_advert(struct axgbe_port *pdata)
 {
+	u32 adv = pdata->phy.advertising;
 	u16 advert;
+	u16 ctrl1000;
 	int ret;
 
-	ret = pdata->phy_if.phy_impl.read(pdata, MII_ADVERTISE, &advert);
+	advert = ADVERTISE_CSMA;
+
+	if (adv & ADVERTISED_10baseT_Full)
+		advert |= ADVERTISE_10FULL;
+
+	if (adv & ADVERTISED_100baseT_Full)
+		advert |= ADVERTISE_100FULL;
+
+	if (adv & ADVERTISED_Pause)
+		advert |= ADVERTISE_PAUSE_CAP;
+
+	if (adv & ADVERTISED_Asym_Pause)
+		advert |= ADVERTISE_PAUSE_ASYM;
+
+	ret = pdata->phy_if.phy_impl.write(pdata, MII_ADVERTISE, advert);
 	if (ret) {
-		PMD_DRV_LOG_LINE(ERR, "Failed to read ADVERTISE register");
+		PMD_DRV_LOG_LINE(ERR, "Failed to write ADVERTISE register");
 		return ret;
 	}
 
-	advert |= ADVERTISE_FULL;
-	advert |= ADVERTISE_PAUSE_CAP;
+	ctrl1000 = 0;
+	if (adv & ADVERTISED_1000baseT_Full)
+		ctrl1000 |= AXGBE_PHY_MII_CTRL1000_1000T_FULL;
 
-	ret = pdata->phy_if.phy_impl.write(pdata, MII_ADVERTISE, advert);
+	ret = pdata->phy_if.phy_impl.write(pdata, MII_CTRL1000, ctrl1000);
 	if (ret) {
-		PMD_DRV_LOG_LINE(ERR, "Failed to write ADVERTISE register");
+		PMD_DRV_LOG_LINE(ERR, "Failed to write MII_CTRL1000 register");
 		return ret;
 	}
 	return 0;
Signature · 1 line
2.34.1
#1 lore raw

PATCH v2 1/1 net/axgbe: fix PHY auto-negotiation advertisement

Correct the programming of PHY auto-negotiation advertisement registers.

AXGBE supports 10/100/1000BASE-T operation in full-duplex mode only. Since half-duplex operation (CSMA/CD) is not supported by the MAC, half-duplex capabilities are intentionally not advertised. Only supported full-duplex and pause capabilities are programmed into MII_ADVERTISE and MII_CTRL1000.

This ensures Clause 22 PHY registers are programmed according to IEEE 802.3 and prevents advertising unsupported or unintended capabilities.

Fixes 7ba7d89890ab ("net/axgbe: support Marvell M88E1512 PHY")
---
 drivers/net/axgbe/axgbe_phy.h      |  1 +
 drivers/net/axgbe/axgbe_phy_impl.c | 43 +++++++++++++++++++++++++-----
 2 files changed, 38 insertions(+), 6 deletions(-)
drivers/net/axgbe/axgbe_phy.h +1 -0
index e5568cce5f..ab9c692d47 100644
@@ -156,6 +156,7 @@
 #define AXGBE_M88E1512_MODE_RGMII_SGMII		4
 #define AXGBE_M88E1512_MODE_SW_RESET		0x8000
 
+#define AXGBE_PHY_MII_CTRL1000_1000T_FULL	0x0200
 
 /* Control register 1. */
 /* Enable extended speed selection */
drivers/net/axgbe/axgbe_phy_impl.c +37 -6

58 lines not on this page · raw message

Signature · 1 line
2.43.0
#2 lore raw

PATCH v3 1/1 net/axgbe: mask unsupported PHY half-duplex modes

The AXGBE MAC supports only full-duplex operation at all speeds. However, the PHY auto-negotiation configuration could advertise half-duplex modes, including 10BASE-T, 100BASE-TX, and 1000BASE-T, which are not supported by the MAC.

Update the Clause 22 and Clause 40 PHY advertisement handling to mask all half-duplex modes while preserving existing PHY, strap, and vendor-specific configuration using read-modify-write.

To maintain backward compatibility, full-duplex advertisement for 10/100 and 1000BASE-T is preserved by default when no explicit PHY advertising mask is provided.

This ensures IEEE 802.3 compliant PHY advertisement while avoiding regressions on platforms relying on PHY default configuration.

---
 drivers/net/axgbe/axgbe_phy.h      |   3 +
 drivers/net/axgbe/axgbe_phy_impl.c | 102 +++++++++++++++++++++++++++--
 2 files changed, 99 insertions(+), 6 deletions(-)
drivers/net/axgbe/axgbe_phy.h +3 -0
index e5568cce5f..3c00adfebc 100644
@@ -156,6 +156,9 @@
 #define AXGBE_M88E1512_MODE_RGMII_SGMII		4
 #define AXGBE_M88E1512_MODE_SW_RESET		0x8000
 
+/* IEEE 802.3 Clause 40: 1000BASE-T Advertisement Control */
+#define AXGBE_PHY_MII_CTRL1000_1000T_FULL	0x0200
+#define AXGBE_PHY_MII_CTRL1000_1000T_HALF	0x0100
 
 /* Control register 1. */
 /* Enable extended speed selection */
drivers/net/axgbe/axgbe_phy_impl.c +96 -6

119 lines not on this page · raw message

Signature · 1 line
2.43.0
#3 lore raw

Re: [PATCH v3] net/axgbe: mask unsupported PHY half-duplex modes

Quoted 13 lines · On Thu, 2 Apr 2026 12:24:49 +0530 Ashok Kumar Natarajan…

The AXGBE MAC supports only full-duplex operation at all speeds. However, the PHY auto-negotiation configuration could advertise half-duplex modes, including 10BASE-T, 100BASE-TX, and 1000BASE-T, which are not supported by the MAC.

Update the Clause 22 and Clause 40 PHY advertisement handling to mask all half-duplex modes while preserving existing PHY, strap, and vendor-specific configuration using read-modify-write.

To maintain backward compatibility, full-duplex advertisement for 10/100 and 1000BASE-T is preserved by default when no explicit PHY advertising mask is provided.

Quoted 5 lines

This ensures IEEE 802.3 compliant PHY advertisement while avoiding regressions on platforms relying on PHY default configuration.

---

AI review noticed possible issues with thsi.
Which may be an issue, or false positive.

Quoted 8 lines

The AXGBE MAC supports only full-duplex operation at all speeds. However, the PHY auto-negotiation configuration could advertise half-duplex modes, including 10BASE-T, 100BASE-TX, and 1000BASE-T, which are not supported by the MAC.

Update the Clause 22 and Clause 40 PHY advertisement handling to mask all half-duplex modes while preserving existing PHY, strap, and vendor-specific configuration using read-modify-write.

The read-modify-write approach is good, and the Clause 22 / Clause 40 separation is clean.

drivers/net/axgbe/axgbe_phy_impl.c static int axgbe_phy_write(struct axgbe_port *pdata, u16 reg, u16 value) · line 340

Quoted 3 lines
drivers/net/axgbe/axgbe_phy_impl.c +3 -0
+	if (!adv) {
+		advert |= ADVERTISE_10FULL | ADVERTISE_100FULL;
+	} else {

The original code unconditionally sets ADVERTISE_PAUSE_CAP:

	advert |= ADVERTISE_FULL;
	advert |= ADVERTISE_PAUSE_CAP;

In the legacy path (adv == 0), the new code advertises 10/100 full-duplex but drops pause advertisement. This is a behavioral regression for platforms relying on the default configuration -- exactly the scenario the commit message says should avoid regressions. The !adv block should also set ADVERTISE_PAUSE_CAP to match the old behavior.

drivers/net/axgbe/axgbe_phy.h line 161

Quoted 2 lines
drivers/net/axgbe/axgbe_phy.h +2 -0
+#define AXGBE_PHY_MII_CTRL1000_1000T_FULL	0x0200
+#define AXGBE_PHY_MII_CTRL1000_1000T_HALF	0x0100

These are standard IEEE 802.3 Clause 40 bits. Since axgbe_phy.h already mirrors the Linux MII defines for Clause 22, consider adding these as ADVERTISE_1000FULL / ADVERTISE_1000HALF in the existing MII section for consistency rather than under the M88E1512-specific block.

#4 lore raw

PATCH v4 1/1 net/axgbe: mask unsupported PHY half-duplex modes

In reply to Ashok Kumar Natarajan

The AXGBE MAC supports only full-duplex operation at all speeds. However, the PHY auto-negotiation configuration could advertise half-duplex modes, including 10BASE-T, 100BASE-TX, and 1000BASE-T, which are not supported by the MAC.

Update the Clause 22 and Clause 40 PHY advertisement handling to mask all half-duplex modes while preserving existing PHY, strap, and vendor-specific configuration using read-modify-write.

To maintain backward compatibility, full-duplex advertisement for 10/100 and 1000BASE-T is preserved by default when no explicit PHY advertising mask is provided.

This ensures IEEE 802.3 compliant PHY advertisement while avoiding regressions on platforms relying on PHY default configuration.

---
 drivers/net/axgbe/axgbe_phy.h      |   4 ++
 drivers/net/axgbe/axgbe_phy_impl.c | 103 +++++++++++++++++++++++++++--
 2 files changed, 101 insertions(+), 6 deletions(-)
drivers/net/axgbe/axgbe_phy.h +4 -0
index e5568cce5f..9d6496c3cf 100644
@@ -82,6 +82,10 @@
 #define ADVERTISE_LPACK         0x4000  /* Ack link partners response  */
 #define ADVERTISE_NPAGE         0x8000  /* Next page bit               */
 
+/* IEEE 802.3 Clause 40: 1000BASE-T Advertisement Control */
+#define ADVERTISE_1000FULL	0x0200
+#define ADVERTISE_1000HALF	0x0100
+
 #define ADVERTISE_FULL          (ADVERTISE_100FULL | ADVERTISE_10FULL | \
 		ADVERTISE_CSMA)
 #define ADVERTISE_ALL           (ADVERTISE_10HALF | ADVERTISE_10FULL | \
drivers/net/axgbe/axgbe_phy_impl.c +97 -6

120 lines not on this page · raw message

Signature · 1 line
2.43.0
#5 lore raw

Re: [PATCH v4] net/axgbe: mask unsupported PHY half-duplex modes

Quoted 13 lines · On Thu, 16 Apr 2026 12:35:24 +0530 Ashok Kumar Natarajan…

The AXGBE MAC supports only full-duplex operation at all speeds. However, the PHY auto-negotiation configuration could advertise half-duplex modes, including 10BASE-T, 100BASE-TX, and 1000BASE-T, which are not supported by the MAC.

Update the Clause 22 and Clause 40 PHY advertisement handling to mask all half-duplex modes while preserving existing PHY, strap, and vendor-specific configuration using read-modify-write.

To maintain backward compatibility, full-duplex advertisement for 10/100 and 1000BASE-T is preserved by default when no explicit PHY advertising mask is provided.

Quoted 5 lines

This ensures IEEE 802.3 compliant PHY advertisement while avoiding regressions on platforms relying on PHY default configuration.

---

Looks good, applied to next-net