[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20231027065054.3808352-1-yi.fang.gan@intel.com>
Date: Fri, 27 Oct 2023 14:50:54 +0800
From: Gan Yi Fang <yi.fang.gan@...el.com>
To: Alexandre Torgue <alexandre.torgue@...s.st.com>,
Jose Abreu <joabreu@...opsys.com>,
"David S . Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>,
Paolo Abeni <pabeni@...hat.com>,
Maxime Coquelin <mcoquelin.stm32@...il.com>,
Russell King <linux@...linux.org.uk>,
netdev@...r.kernel.org,
linux-stm32@...md-mailman.stormreply.com,
linux-arm-kernel@...ts.infradead.org,
linux-kernel@...r.kernel.org
Cc: Looi Hong Aun <hong.aun.looi@...el.com>,
Voon Weifeng <weifeng.voon@...el.com>,
Song Yoong Siang <yoong.siang.song@...el.com>,
Ahmad Tarmizi Noor Azura <noor.azura.ahmad.tarmizi@...el.com>,
Gan Yi Fang <yi.fang.gan@...el.com>
Subject: [PATCH net-next 1/1] net: stmmac: add check for advertising linkmode request for set-eee
From: Noor Azura Ahmad Tarmizi <noor.azura.ahmad.tarmizi@...el.com>
Add check for advertising linkmode set request with what is currently
being supported by PHY before configuring the EEE. Unsupported setting
will be rejected and a message will be prompted. No checking is
required while setting the EEE to off.
Signed-off-by: Noor Azura Ahmad Tarmizi <noor.azura.ahmad.tarmizi@...el.com>
Signed-off-by: Gan, Yi Fang <yi.fang.gan@...el.com>
---
.../ethernet/stmicro/stmmac/stmmac_ethtool.c | 18 +++++++++++++++++-
1 file changed, 17 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c
index f628411ae4ae..6c090d4b7117 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c
@@ -867,8 +867,24 @@ static int stmmac_ethtool_op_set_eee(struct net_device *dev,
netdev_warn(priv->dev,
"Setting EEE tx-lpi is not supported\n");
- if (!edata->eee_enabled)
+ if (!edata->eee_enabled) {
stmmac_disable_eee_mode(priv);
+ } else {
+ __ETHTOOL_DECLARE_LINK_MODE_MASK(supported);
+ __ETHTOOL_DECLARE_LINK_MODE_MASK(advertised);
+
+ ethtool_convert_legacy_u32_to_link_mode(supported,
+ edata->supported);
+ ethtool_convert_legacy_u32_to_link_mode(advertised,
+ edata->advertised);
+
+ /*Check if the advertise speed is supported.*/
+ if (!bitmap_subset(advertised,
+ supported,
+ __ETHTOOL_LINK_MODE_MASK_NBITS)){
+ return -EOPNOTSUPP;
+ }
+ }
ret = phylink_ethtool_set_eee(priv->phylink, edata);
if (ret)
--
2.34.1
Powered by blists - more mailing lists