[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20240528092010.439089-1-xiaolei.wang@windriver.com>
Date: Tue, 28 May 2024 17:20:10 +0800
From: Xiaolei Wang <xiaolei.wang@...driver.com>
To: alexandre.torgue@...s.st.com, joabreu@...opsys.com, davem@...emloft.net,
edumazet@...gle.com, kuba@...nel.org, pabeni@...hat.com,
mcoquelin.stm32@...il.com
Cc: netdev@...r.kernel.org, linux-arm-kernel@...ts.infradead.org,
linux-kernel@...r.kernel.org
Subject: [net PATCH] net: stmmac: update priv->speed to SPEED_UNKNOWN when link down
The CBS parameter can still be configured when the port is
currently disconnected and link down. This is unreasonable.
The current speed_div and ptr parameters depend on the negotiated
speed after uplinking. So When the link is down, update priv->speed
to SPEED_UNKNOWN and an error log should be added.
Signed-off-by: Xiaolei Wang <xiaolei.wang@...driver.com>
---
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 1 +
drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c | 1 +
2 files changed, 2 insertions(+)
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index b3afc7cb7d72..604e2e053852 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -995,6 +995,7 @@ static void stmmac_mac_link_down(struct phylink_config *config,
priv->tx_lpi_enabled = false;
priv->eee_enabled = stmmac_eee_init(priv);
stmmac_set_eee_pls(priv, priv->hw, false);
+ priv->speed = SPEED_UNKNOWN;
if (priv->dma_cap.fpesel)
stmmac_fpe_link_state_handle(priv, false);
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c
index 222540b55480..1e60033c6fbb 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c
@@ -378,6 +378,7 @@ static int tc_setup_cbs(struct stmmac_priv *priv,
speed_div = 100000;
break;
default:
+ dev_err(priv->device, "Link speed is not known");
return -EOPNOTSUPP;
}
--
2.25.1
Powered by blists - more mailing lists