Skip to contentSkip to conversation

net: phy: xpcs: Improvements for -next

PATCH In review Jose Abreu 2 participants 6 messages Mar 20, 2020 – Mar 24, 2020

Subsystems (3)
lore
Share & tools
lore

Jose Abreu

author
#0 lore raw

cover net: phy: xpcs: Improvements for -next

Misc set of improvements for XPCS. All for net-next.

Patch 1/4, returns link error upon 10GKR faults are detected.

Patch 2/4, resets XPCS upon probe so that we start from well known state.

Patch 3/4, sets Link as down if AutoNeg is enabled but did not finish with success.

Patch 4/4, restarts AutoNeg process if previous outcome was not valid.

---
Cc: Jose Abreu <[email protected]>
Cc: Andrew Lunn <[email protected]>
Cc: Florian Fainelli <[email protected]>
Cc: Heiner Kallweit <[email protected]>
Cc: Russell King <[email protected]>
Cc: "David S. Miller" <[email protected]>
Cc: [email protected]
Cc: [email protected]
---

Jose Abreu (4):
net: phy: xpcs: Return error when 10GKR link errors are found
net: phy: xpcs: Reset XPCS upon probe
net: phy: xpcs: Set Link down if AutoNeg is enabled and did not finish
net: phy: xpcs: Restart AutoNeg if outcome was invalid

 drivers/net/phy/mdio-xpcs.c | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)
Signature · 1 line
2.7.4
author
#1 lore raw

PATCH 1/4 net: phy: xpcs: Return error when 10GKR link errors are found

For 10GKR rate, when link errors are found we need to return fault status so that XPCS is correctly resumed.

---
Cc: Jose Abreu <[email protected]>
Cc: Andrew Lunn <[email protected]>
Cc: Florian Fainelli <[email protected]>
Cc: Heiner Kallweit <[email protected]>
Cc: Russell King <[email protected]>
Cc: "David S. Miller" <[email protected]>
Cc: [email protected]
Cc: [email protected]

---
 drivers/net/phy/mdio-xpcs.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/net/phy/mdio-xpcs.c +3 -1
index 2f4cdf807160..c04e9bf40180 100644
@@ -255,8 +255,10 @@ static int xpcs_read_fault(struct mdio_xpcs_args *xpcs,
 	if (ret < 0)
 		return ret;
 
-	if (ret & MDIO_PCS_10GBRT_STAT2_ERR)
+	if (ret & MDIO_PCS_10GBRT_STAT2_ERR) {
 		xpcs_warn(xpcs, state, "Link has errors!\n");
+		return -EFAULT;
+	}
 
 	return 0;
 }
Signature · 1 line
2.7.4
author
#2 lore raw

PATCH 2/4 net: phy: xpcs: Reset XPCS upon probe

In reply to Jose Abreu

Reset the XPCS upon probe stage so that we start it from well known state.

---
Cc: Jose Abreu <[email protected]>
Cc: Andrew Lunn <[email protected]>
Cc: Florian Fainelli <[email protected]>
Cc: Heiner Kallweit <[email protected]>
Cc: Russell King <[email protected]>
Cc: "David S. Miller" <[email protected]>
Cc: [email protected]
Cc: [email protected]

---
 drivers/net/phy/mdio-xpcs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/phy/mdio-xpcs.c +1 -1
index c04e9bf40180..54976047dcb9 100644
@@ -688,7 +688,7 @@ static int xpcs_probe(struct mdio_xpcs_args *xpcs, phy_interface_t interface)
 			match = entry;
 
 			if (xpcs_check_features(xpcs, match, interface))
-				return 0;
+				return xpcs_soft_reset(xpcs, MDIO_MMD_PCS);
 		}
 	}
 
Signature · 1 line
2.7.4
author
#3 lore raw

PATCH 3/4 net: phy: xpcs: Set Link down if AutoNeg is enabled and did not finish

In reply to Jose Abreu

Set XPCS Link as down when AutoNeg is enabled but it didn't finish with success.

---
Cc: Jose Abreu <[email protected]>
Cc: Andrew Lunn <[email protected]>
Cc: Florian Fainelli <[email protected]>
Cc: Heiner Kallweit <[email protected]>
Cc: Russell King <[email protected]>
Cc: "David S. Miller" <[email protected]>
Cc: [email protected]
Cc: [email protected]

---
 drivers/net/phy/mdio-xpcs.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/net/phy/mdio-xpcs.c +3 -1
index 54976047dcb9..f10d86b85fbd 100644
@@ -617,10 +617,12 @@ static int xpcs_get_state(struct mdio_xpcs_args *xpcs,
 		return xpcs_config(xpcs, state);
 	}
 
-	if (state->link && state->an_enabled && xpcs_aneg_done(xpcs, state)) {
+	if (state->an_enabled && xpcs_aneg_done(xpcs, state)) {
 		state->an_complete = true;
 		xpcs_read_lpa(xpcs, state);
 		xpcs_resolve_lpa(xpcs, state);
+	} else if (state->an_enabled) {
+		state->link = 0;
 	} else if (state->link) {
 		xpcs_resolve_pma(xpcs, state);
 	}
Signature · 1 line
2.7.4
author
#4 lore raw

PATCH 4/4 net: phy: xpcs: Restart AutoNeg if outcome was invalid

In reply to Jose Abreu

Restart AutoNeg if we didn't get a valid result from previous run.

---
Cc: Jose Abreu <[email protected]>
Cc: Andrew Lunn <[email protected]>
Cc: Florian Fainelli <[email protected]>
Cc: Heiner Kallweit <[email protected]>
Cc: Russell King <[email protected]>
Cc: "David S. Miller" <[email protected]>
Cc: [email protected]
Cc: [email protected]

---
 drivers/net/phy/mdio-xpcs.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/net/phy/mdio-xpcs.c +3 -1
index f10d86b85fbd..0d66a8ba7eb6 100644
@@ -433,8 +433,10 @@ static int xpcs_aneg_done(struct mdio_xpcs_args *xpcs,
 			return ret;
 
 		/* Check if Aneg outcome is valid */
-		if (!(ret & DW_C73_AN_ADV_SF))
+		if (!(ret & DW_C73_AN_ADV_SF)) {
+			xpcs_config_aneg(xpcs);
 			return 0;
+		}
 
 		return 1;
 	}
Signature · 1 line
2.7.4
maintainer
#5 lore raw
In reply to Jose Abreu

From: Jose Abreu <[email protected]>
Date: Fri, 20 Mar 2020 10:53:33 +0100

Quoted 10 lines

Misc set of improvements for XPCS. All for net-next.

Patch 1/4, returns link error upon 10GKR faults are detected.

Patch 2/4, resets XPCS upon probe so that we start from well known state.

Patch 3/4, sets Link as down if AutoNeg is enabled but did not finish with success.

Patch 4/4, restarts AutoNeg process if previous outcome was not valid.

Series applied, thanks Jose.