linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next 0/4] net: phy: xpcs: Improvements for -next
@ 2020-03-20  9:53 Jose Abreu
  2020-03-20  9:53 ` [PATCH net-next 1/4] net: phy: xpcs: Return error when 10GKR link errors are found Jose Abreu
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Jose Abreu @ 2020-03-20  9:53 UTC (permalink / raw)
  To: netdev
  Cc: Joao Pinto, Jose Abreu, Andrew Lunn, Florian Fainelli,
	Heiner Kallweit, Russell King, David S. Miller, linux-kernel

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 <Jose.Abreu@synopsys.com>
Cc: Andrew Lunn <andrew@lunn.ch>
Cc: Florian Fainelli <f.fainelli@gmail.com>
Cc: Heiner Kallweit <hkallweit1@gmail.com>
Cc: Russell King <linux@armlinux.org.uk>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: netdev@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
---

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(-)

-- 
2.7.4


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH net-next 1/4] net: phy: xpcs: Return error when 10GKR link errors are found
  2020-03-20  9:53 [PATCH net-next 0/4] net: phy: xpcs: Improvements for -next Jose Abreu
@ 2020-03-20  9:53 ` Jose Abreu
  2020-03-20  9:53 ` [PATCH net-next 2/4] net: phy: xpcs: Reset XPCS upon probe Jose Abreu
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Jose Abreu @ 2020-03-20  9:53 UTC (permalink / raw)
  To: netdev
  Cc: Joao Pinto, Jose Abreu, Andrew Lunn, Florian Fainelli,
	Heiner Kallweit, Russell King, David S. Miller, linux-kernel

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

Signed-off-by: Jose Abreu <Jose.Abreu@synopsys.com>

---
Cc: Jose Abreu <Jose.Abreu@synopsys.com>
Cc: Andrew Lunn <andrew@lunn.ch>
Cc: Florian Fainelli <f.fainelli@gmail.com>
Cc: Heiner Kallweit <hkallweit1@gmail.com>
Cc: Russell King <linux@armlinux.org.uk>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: netdev@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
---
 drivers/net/phy/mdio-xpcs.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/net/phy/mdio-xpcs.c b/drivers/net/phy/mdio-xpcs.c
index 2f4cdf807160..c04e9bf40180 100644
--- a/drivers/net/phy/mdio-xpcs.c
+++ b/drivers/net/phy/mdio-xpcs.c
@@ -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;
 }
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH net-next 2/4] net: phy: xpcs: Reset XPCS upon probe
  2020-03-20  9:53 [PATCH net-next 0/4] net: phy: xpcs: Improvements for -next Jose Abreu
  2020-03-20  9:53 ` [PATCH net-next 1/4] net: phy: xpcs: Return error when 10GKR link errors are found Jose Abreu
@ 2020-03-20  9:53 ` Jose Abreu
  2020-03-20  9:53 ` [PATCH net-next 3/4] net: phy: xpcs: Set Link down if AutoNeg is enabled and did not finish Jose Abreu
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Jose Abreu @ 2020-03-20  9:53 UTC (permalink / raw)
  To: netdev
  Cc: Joao Pinto, Jose Abreu, Andrew Lunn, Florian Fainelli,
	Heiner Kallweit, Russell King, David S. Miller, linux-kernel

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

Signed-off-by: Jose Abreu <Jose.Abreu@synopsys.com>

---
Cc: Jose Abreu <Jose.Abreu@synopsys.com>
Cc: Andrew Lunn <andrew@lunn.ch>
Cc: Florian Fainelli <f.fainelli@gmail.com>
Cc: Heiner Kallweit <hkallweit1@gmail.com>
Cc: Russell King <linux@armlinux.org.uk>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: netdev@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
---
 drivers/net/phy/mdio-xpcs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/phy/mdio-xpcs.c b/drivers/net/phy/mdio-xpcs.c
index c04e9bf40180..54976047dcb9 100644
--- a/drivers/net/phy/mdio-xpcs.c
+++ b/drivers/net/phy/mdio-xpcs.c
@@ -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);
 		}
 	}
 
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH net-next 3/4] net: phy: xpcs: Set Link down if AutoNeg is enabled and did not finish
  2020-03-20  9:53 [PATCH net-next 0/4] net: phy: xpcs: Improvements for -next Jose Abreu
  2020-03-20  9:53 ` [PATCH net-next 1/4] net: phy: xpcs: Return error when 10GKR link errors are found Jose Abreu
  2020-03-20  9:53 ` [PATCH net-next 2/4] net: phy: xpcs: Reset XPCS upon probe Jose Abreu
@ 2020-03-20  9:53 ` Jose Abreu
  2020-03-20  9:53 ` [PATCH net-next 4/4] net: phy: xpcs: Restart AutoNeg if outcome was invalid Jose Abreu
  2020-03-24  4:02 ` [PATCH net-next 0/4] net: phy: xpcs: Improvements for -next David Miller
  4 siblings, 0 replies; 6+ messages in thread
From: Jose Abreu @ 2020-03-20  9:53 UTC (permalink / raw)
  To: netdev
  Cc: Joao Pinto, Jose Abreu, Andrew Lunn, Florian Fainelli,
	Heiner Kallweit, Russell King, David S. Miller, linux-kernel

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

Signed-off-by: Jose Abreu <Jose.Abreu@synopsys.com>

---
Cc: Jose Abreu <Jose.Abreu@synopsys.com>
Cc: Andrew Lunn <andrew@lunn.ch>
Cc: Florian Fainelli <f.fainelli@gmail.com>
Cc: Heiner Kallweit <hkallweit1@gmail.com>
Cc: Russell King <linux@armlinux.org.uk>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: netdev@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
---
 drivers/net/phy/mdio-xpcs.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/net/phy/mdio-xpcs.c b/drivers/net/phy/mdio-xpcs.c
index 54976047dcb9..f10d86b85fbd 100644
--- a/drivers/net/phy/mdio-xpcs.c
+++ b/drivers/net/phy/mdio-xpcs.c
@@ -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);
 	}
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH net-next 4/4] net: phy: xpcs: Restart AutoNeg if outcome was invalid
  2020-03-20  9:53 [PATCH net-next 0/4] net: phy: xpcs: Improvements for -next Jose Abreu
                   ` (2 preceding siblings ...)
  2020-03-20  9:53 ` [PATCH net-next 3/4] net: phy: xpcs: Set Link down if AutoNeg is enabled and did not finish Jose Abreu
@ 2020-03-20  9:53 ` Jose Abreu
  2020-03-24  4:02 ` [PATCH net-next 0/4] net: phy: xpcs: Improvements for -next David Miller
  4 siblings, 0 replies; 6+ messages in thread
From: Jose Abreu @ 2020-03-20  9:53 UTC (permalink / raw)
  To: netdev
  Cc: Joao Pinto, Jose Abreu, Andrew Lunn, Florian Fainelli,
	Heiner Kallweit, Russell King, David S. Miller, linux-kernel

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

Signed-off-by: Jose Abreu <Jose.Abreu@synopsys.com>

---
Cc: Jose Abreu <Jose.Abreu@synopsys.com>
Cc: Andrew Lunn <andrew@lunn.ch>
Cc: Florian Fainelli <f.fainelli@gmail.com>
Cc: Heiner Kallweit <hkallweit1@gmail.com>
Cc: Russell King <linux@armlinux.org.uk>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: netdev@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
---
 drivers/net/phy/mdio-xpcs.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/net/phy/mdio-xpcs.c b/drivers/net/phy/mdio-xpcs.c
index f10d86b85fbd..0d66a8ba7eb6 100644
--- a/drivers/net/phy/mdio-xpcs.c
+++ b/drivers/net/phy/mdio-xpcs.c
@@ -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;
 	}
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH net-next 0/4] net: phy: xpcs: Improvements for -next
  2020-03-20  9:53 [PATCH net-next 0/4] net: phy: xpcs: Improvements for -next Jose Abreu
                   ` (3 preceding siblings ...)
  2020-03-20  9:53 ` [PATCH net-next 4/4] net: phy: xpcs: Restart AutoNeg if outcome was invalid Jose Abreu
@ 2020-03-24  4:02 ` David Miller
  4 siblings, 0 replies; 6+ messages in thread
From: David Miller @ 2020-03-24  4:02 UTC (permalink / raw)
  To: Jose.Abreu
  Cc: netdev, Joao.Pinto, andrew, f.fainelli, hkallweit1, linux, linux-kernel

From: Jose Abreu <Jose.Abreu@synopsys.com>
Date: Fri, 20 Mar 2020 10:53:33 +0100

> 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.

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2020-03-24  4:02 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-20  9:53 [PATCH net-next 0/4] net: phy: xpcs: Improvements for -next Jose Abreu
2020-03-20  9:53 ` [PATCH net-next 1/4] net: phy: xpcs: Return error when 10GKR link errors are found Jose Abreu
2020-03-20  9:53 ` [PATCH net-next 2/4] net: phy: xpcs: Reset XPCS upon probe Jose Abreu
2020-03-20  9:53 ` [PATCH net-next 3/4] net: phy: xpcs: Set Link down if AutoNeg is enabled and did not finish Jose Abreu
2020-03-20  9:53 ` [PATCH net-next 4/4] net: phy: xpcs: Restart AutoNeg if outcome was invalid Jose Abreu
2020-03-24  4:02 ` [PATCH net-next 0/4] net: phy: xpcs: Improvements for -next David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).