diff mbox series

[RFC/RFTv3,09/24] net: stmmac: Simplify ethtool get eee

Message ID 20230331005518.2134652-10-andrew@lunn.ch (mailing list archive)
State RFC
Delegated to: Netdev Maintainers
Headers show
Series net: ethernet: Rework EEE | expand

Checks

Context Check Description
netdev/series_format fail Series longer than 15 patches (and no cover letter); Target tree name not specified in the subject
netdev/tree_selection success Guessed tree name to be net-next
netdev/fixes_present success Fixes tag not required for -next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 46 this patch: 46
netdev/cc_maintainers warning 10 maintainers not CCed: alexandre.torgue@foss.st.com pabeni@redhat.com peppe.cavallaro@st.com joabreu@synopsys.com kuba@kernel.org edumazet@google.com linux-stm32@st-md-mailman.stormreply.com linux-arm-kernel@lists.infradead.org mcoquelin.stm32@gmail.com davem@davemloft.net
netdev/build_clang success Errors and warnings before: 20 this patch: 20
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 46 this patch: 46
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 41 lines checked
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

Andrew Lunn March 31, 2023, 12:55 a.m. UTC
phylink_ethtool_get_eee() fills in eee_enabled, eee_active and
tx_lpi_enabled.  So there is no need for the MAC driver to do it as
well.

Signed-off-by: Andrew Lunn <andrew@lunn.ch>
---
 drivers/net/ethernet/stmicro/stmmac/stmmac.h         | 1 -
 drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c | 7 -------
 drivers/net/ethernet/stmicro/stmmac/stmmac_main.c    | 2 --
 3 files changed, 10 deletions(-)

Comments

Oleksij Rempel May 19, 2023, 7:11 a.m. UTC | #1
On Fri, Mar 31, 2023 at 02:55:03AM +0200, Andrew Lunn wrote:
> phylink_ethtool_get_eee() fills in eee_enabled, eee_active and
> tx_lpi_enabled.  So there is no need for the MAC driver to do it as
> well.
> 
> Signed-off-by: Andrew Lunn <andrew@lunn.ch>

Complete patch set is tested on stmmac interface of Polyhex Debix Model A
i.MX8MPlus board.

The only thing that's changed from before is that we're not advertising
EEE as a default anymore.

Tested-by: Oleksij Rempel <o.rempel@pengutronix.de>

> ---
>  drivers/net/ethernet/stmicro/stmmac/stmmac.h         | 1 -
>  drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c | 7 -------
>  drivers/net/ethernet/stmicro/stmmac/stmmac_main.c    | 2 --
>  3 files changed, 10 deletions(-)
> 
> diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac.h b/drivers/net/ethernet/stmicro/stmmac/stmmac.h
> index 3d15e1e92e18..a0f6e58fc622 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/stmmac.h
> +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac.h
> @@ -253,7 +253,6 @@ struct stmmac_priv {
>  	int eee_enabled;
>  	int eee_active;
>  	int tx_lpi_timer;
> -	int tx_lpi_enabled;
>  	int eee_tw_timer;
>  	bool eee_sw_timer_en;
>  	unsigned int mode;
> diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c
> index 35c8dd92d369..fd97cdbb6797 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c
> @@ -782,10 +782,7 @@ static int stmmac_ethtool_op_get_eee(struct net_device *dev,
>  	if (!priv->dma_cap.eee)
>  		return -EOPNOTSUPP;
>  
> -	edata->eee_enabled = priv->eee_enabled;
> -	edata->eee_active = priv->eee_active;
>  	edata->tx_lpi_timer = priv->tx_lpi_timer;
> -	edata->tx_lpi_enabled = priv->tx_lpi_enabled;
>  
>  	return phylink_ethtool_get_eee(priv->phylink, edata);
>  }
> @@ -799,10 +796,6 @@ static int stmmac_ethtool_op_set_eee(struct net_device *dev,
>  	if (!priv->dma_cap.eee)
>  		return -EOPNOTSUPP;
>  
> -	if (priv->tx_lpi_enabled != edata->tx_lpi_enabled)
> -		netdev_warn(priv->dev,
> -			    "Setting EEE tx-lpi is not supported\n");
> -
>  	if (!edata->eee_enabled)
>  		stmmac_disable_eee_mode(priv);
>  
> diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> index dd2488998993..190b74d7f4e7 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> @@ -971,7 +971,6 @@ static void stmmac_mac_link_down(struct phylink_config *config,
>  
>  	stmmac_mac_set(priv, priv->ioaddr, false);
>  	priv->eee_active = false;
> -	priv->tx_lpi_enabled = false;
>  	priv->eee_enabled = stmmac_eee_init(priv);
>  	stmmac_set_eee_pls(priv, priv->hw, false);
>  
> @@ -1084,7 +1083,6 @@ static void stmmac_mac_link_up(struct phylink_config *config,
>  		if (!priv->plat->rx_clk_runs_in_lpi)
>  			phy_eee_clk_stop_enable(phy);
>  		priv->eee_enabled = stmmac_eee_init(priv);
> -		priv->tx_lpi_enabled = priv->eee_enabled;
>  		stmmac_set_eee_pls(priv, priv->hw, true);
>  	}
>  
> -- 
> 2.40.0
> 
>
diff mbox series

Patch

diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac.h b/drivers/net/ethernet/stmicro/stmmac/stmmac.h
index 3d15e1e92e18..a0f6e58fc622 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac.h
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac.h
@@ -253,7 +253,6 @@  struct stmmac_priv {
 	int eee_enabled;
 	int eee_active;
 	int tx_lpi_timer;
-	int tx_lpi_enabled;
 	int eee_tw_timer;
 	bool eee_sw_timer_en;
 	unsigned int mode;
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c
index 35c8dd92d369..fd97cdbb6797 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c
@@ -782,10 +782,7 @@  static int stmmac_ethtool_op_get_eee(struct net_device *dev,
 	if (!priv->dma_cap.eee)
 		return -EOPNOTSUPP;
 
-	edata->eee_enabled = priv->eee_enabled;
-	edata->eee_active = priv->eee_active;
 	edata->tx_lpi_timer = priv->tx_lpi_timer;
-	edata->tx_lpi_enabled = priv->tx_lpi_enabled;
 
 	return phylink_ethtool_get_eee(priv->phylink, edata);
 }
@@ -799,10 +796,6 @@  static int stmmac_ethtool_op_set_eee(struct net_device *dev,
 	if (!priv->dma_cap.eee)
 		return -EOPNOTSUPP;
 
-	if (priv->tx_lpi_enabled != edata->tx_lpi_enabled)
-		netdev_warn(priv->dev,
-			    "Setting EEE tx-lpi is not supported\n");
-
 	if (!edata->eee_enabled)
 		stmmac_disable_eee_mode(priv);
 
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index dd2488998993..190b74d7f4e7 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -971,7 +971,6 @@  static void stmmac_mac_link_down(struct phylink_config *config,
 
 	stmmac_mac_set(priv, priv->ioaddr, false);
 	priv->eee_active = false;
-	priv->tx_lpi_enabled = false;
 	priv->eee_enabled = stmmac_eee_init(priv);
 	stmmac_set_eee_pls(priv, priv->hw, false);
 
@@ -1084,7 +1083,6 @@  static void stmmac_mac_link_up(struct phylink_config *config,
 		if (!priv->plat->rx_clk_runs_in_lpi)
 			phy_eee_clk_stop_enable(phy);
 		priv->eee_enabled = stmmac_eee_init(priv);
-		priv->tx_lpi_enabled = priv->eee_enabled;
 		stmmac_set_eee_pls(priv, priv->hw, true);
 	}