diff mbox series

[3/4] amd-xgbe: Reset link when the link never comes back

Message ID 20210212180010.221129-4-Shyam-sundar.S-k@amd.com (mailing list archive)
State Superseded
Delegated to: Netdev Maintainers
Headers show
Series Bug fixes to amd-xgbe driver | expand

Checks

Context Check Description
netdev/cover_letter success Link
netdev/fixes_present success Link
netdev/patch_count success Link
netdev/tree_selection success Guessed tree name to be net-next
netdev/subject_prefix warning Target tree name not specified in the subject
netdev/cc_maintainers success CCed 4 of 4 maintainers
netdev/source_inline success Was 0 now: 0
netdev/verify_signedoff success Link
netdev/module_param success Was 0 now: 0
netdev/build_32bit success Errors and warnings before: 0 this patch: 0
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/verify_fixes success Link
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 22 lines checked
netdev/build_allmodconfig_warn success Errors and warnings before: 0 this patch: 0
netdev/header_inline success Link
netdev/stable success Stable not CCed

Commit Message

Shyam Sundar S K Feb. 12, 2021, 6 p.m. UTC
Normally, auto negotiation and reconnect should be automatically done by
the hardware. But there seems to be an issue where auto negotiation has
to be restarted manually. This happens because of link training and so
even though still connected to the partner the link never "comes back".
This would need a reset to recover.

Also, a change in xgbe-mdio is needed to get ethtool to recognize the
link down and get the link change message.

Signed-off-by: Sudheesh Mavila <sudheesh.mavila@amd.com>
Signed-off-by: Shyam Sundar S K <Shyam-sundar.S-k@amd.com>
---
 drivers/net/ethernet/amd/xgbe/xgbe-mdio.c   | 2 +-
 drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c | 8 ++++++++
 2 files changed, 9 insertions(+), 1 deletion(-)

Comments

Tom Lendacky Feb. 12, 2021, 7:01 p.m. UTC | #1
On 2/12/21 12:00 PM, Shyam Sundar S K wrote:
> Normally, auto negotiation and reconnect should be automatically done by
> the hardware. But there seems to be an issue where auto negotiation has
> to be restarted manually. This happens because of link training and so
> even though still connected to the partner the link never "comes back".
> This would need a reset to recover.

This last sentence is strange. Are you meaning to say this needs to 
restart auto-negotiation?

Please mention this pertains only to a backplane connection mode.

> 
> Also, a change in xgbe-mdio is needed to get ethtool to recognize the
> link down and get the link change message.
> 
> Signed-off-by: Sudheesh Mavila <sudheesh.mavila@amd.com>
> Signed-off-by: Shyam Sundar S K <Shyam-sundar.S-k@amd.com>

Same comment about Co-developed-by: as previous patch.

With those addressed,

Acked-by: Tom Lendacky <thomas.lendacky@amd.com>

> ---
>   drivers/net/ethernet/amd/xgbe/xgbe-mdio.c   | 2 +-
>   drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c | 8 ++++++++
>   2 files changed, 9 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/ethernet/amd/xgbe/xgbe-mdio.c b/drivers/net/ethernet/amd/xgbe/xgbe-mdio.c
> index 19ee4db0156d..4e97b4869522 100644
> --- a/drivers/net/ethernet/amd/xgbe/xgbe-mdio.c
> +++ b/drivers/net/ethernet/amd/xgbe/xgbe-mdio.c
> @@ -1345,7 +1345,7 @@ static void xgbe_phy_status(struct xgbe_prv_data *pdata)
>   							     &an_restart);
>   	if (an_restart) {
>   		xgbe_phy_config_aneg(pdata);
> -		return;
> +		goto adjust_link;
>   	}
>   
>   	if (pdata->phy.link) {
> diff --git a/drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c b/drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c
> index 489f1f86df99..1bb468ac9635 100644
> --- a/drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c
> +++ b/drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c
> @@ -2607,6 +2607,14 @@ static int xgbe_phy_link_status(struct xgbe_prv_data *pdata, int *an_restart)
>   	if (reg & MDIO_STAT1_LSTATUS)
>   		return 1;
>   
> +	if (pdata->phy.autoneg == AUTONEG_ENABLE &&
> +	    phy_data->port_mode == XGBE_PORT_MODE_BACKPLANE) {
> +		if (!test_bit(XGBE_LINK_INIT, &pdata->dev_state)) {
> +			netif_carrier_off(pdata->netdev);
> +			*an_restart = 1;
> +		}
> +	}
> +
>   	/* No link, attempt a receiver reset cycle */
>   	if (phy_data->rrc_count++ > XGBE_RRC_FREQUENCY) {
>   		phy_data->rrc_count = 0;
>
diff mbox series

Patch

diff --git a/drivers/net/ethernet/amd/xgbe/xgbe-mdio.c b/drivers/net/ethernet/amd/xgbe/xgbe-mdio.c
index 19ee4db0156d..4e97b4869522 100644
--- a/drivers/net/ethernet/amd/xgbe/xgbe-mdio.c
+++ b/drivers/net/ethernet/amd/xgbe/xgbe-mdio.c
@@ -1345,7 +1345,7 @@  static void xgbe_phy_status(struct xgbe_prv_data *pdata)
 							     &an_restart);
 	if (an_restart) {
 		xgbe_phy_config_aneg(pdata);
-		return;
+		goto adjust_link;
 	}
 
 	if (pdata->phy.link) {
diff --git a/drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c b/drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c
index 489f1f86df99..1bb468ac9635 100644
--- a/drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c
+++ b/drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c
@@ -2607,6 +2607,14 @@  static int xgbe_phy_link_status(struct xgbe_prv_data *pdata, int *an_restart)
 	if (reg & MDIO_STAT1_LSTATUS)
 		return 1;
 
+	if (pdata->phy.autoneg == AUTONEG_ENABLE &&
+	    phy_data->port_mode == XGBE_PORT_MODE_BACKPLANE) {
+		if (!test_bit(XGBE_LINK_INIT, &pdata->dev_state)) {
+			netif_carrier_off(pdata->netdev);
+			*an_restart = 1;
+		}
+	}
+
 	/* No link, attempt a receiver reset cycle */
 	if (phy_data->rrc_count++ > XGBE_RRC_FREQUENCY) {
 		phy_data->rrc_count = 0;