Skip to contentSkip to conversation

net: dsa: cleanup EEE (part 2)

PATCH Applied Russell King (Oracle) 4 participants 14 messages Jan 6, 2025 – Jan 8, 2025

Subsystems (9)
lore
Share & tools
lore
#0 lore raw

cover net: dsa: cleanup EEE (part 2)

This is part 2 of the DSA EEE cleanups, removing what has become dead code as a result of the EEE management phylib now does.

Patch 1 removes the useless setting of tx_lpi parameters in the ksz driver.

Patch 2 does the same for mt753x.

Patch 3 removes the DSA core code that calls the get_mac_eee() operation. This needs to be done before removing the implementations because doing otherwise would cause dsa_user_get_eee() to return -EOPNOTSUPP.

Patches 4..8 remove the trivial get_mac_eee() implementations from DSA drivers.

Patch 9 finally removes the get_mac_eee() method from struct dsa_switch_ops.

 drivers/net/dsa/b53/b53_common.c       |  7 -------
 drivers/net/dsa/b53/b53_priv.h         |  1 -
 drivers/net/dsa/bcm_sf2.c              |  1 -
 drivers/net/dsa/microchip/ksz_common.c | 15 ---------------
 drivers/net/dsa/mt7530.c               | 13 -------------
 drivers/net/dsa/mv88e6xxx/chip.c       |  8 --------
 drivers/net/dsa/qca/qca8k-8xxx.c       |  1 -
 drivers/net/dsa/qca/qca8k-common.c     |  7 -------
 drivers/net/dsa/qca/qca8k.h            |  1 -
 include/net/dsa.h                      |  2 --
 net/dsa/user.c                         |  8 --------
 11 files changed, 64 deletions(-)

Changes since RFC:
- Removed removal of phydev check in net/dsa/user.c
- Addition of mt753x changes

Signature · 2 lines
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!
#1 lore raw

PATCH 1/9 net: dsa: ksz: remove setting of tx_lpi parameters

dsa_user_get_eee() calls the DSA switch get_mac_eee() method followed by phylink_ethtool_get_eee(), which goes on to call phy_ethtool_get_eee(). This overwrites all members of the passed ethtool_keee, which means anything written by the DSA switch get_mac_eee() method will be discarded.

Remove setting any members in ksz_get_mac_eee().

---
 drivers/net/dsa/microchip/ksz_common.c | 8 --------
 1 file changed, 8 deletions(-)
drivers/net/dsa/microchip/ksz_common.c +0 -8
index e3512e324572..60a4630dd7ba 100644
@@ -3492,14 +3492,6 @@ static bool ksz_support_eee(struct dsa_switch *ds, int port)
 static int ksz_get_mac_eee(struct dsa_switch *ds, int port,
 			   struct ethtool_keee *e)
 {
-	/* There is no documented control of Tx LPI configuration. */
-	e->tx_lpi_enabled = true;
-
-	/* There is no documented control of Tx LPI timer. According to tests
-	 * Tx LPI timer seems to be set by default to minimal value.
-	 */
-	e->tx_lpi_timer = 0;
-
 	return 0;
 }
 
Signature · 1 line
2.30.2
#2 lore raw

PATCH 2/9 net: dsa: mt753x: remove setting of tx_lpi parameters

In reply to Russell King (Oracle)

dsa_user_get_eee() calls the DSA switch get_mac_eee() method followed by phylink_ethtool_get_eee(), which goes on to call phy_ethtool_get_eee(). This overwrites all members of the passed ethtool_keee, which means anything written by the DSA switch get_mac_eee() method will be discarded.

Remove setting any members in mt753x_get_mac_eee().

---
 drivers/net/dsa/mt7530.c | 6 ------
 1 file changed, 6 deletions(-)
drivers/net/dsa/mt7530.c +0 -6
index 9605febd3573..4c78d049b9f4 100644
@@ -3088,12 +3088,6 @@ mt753x_setup(struct dsa_switch *ds)
 static int mt753x_get_mac_eee(struct dsa_switch *ds, int port,
 			      struct ethtool_keee *e)
 {
-	struct mt7530_priv *priv = ds->priv;
-	u32 eeecr = mt7530_read(priv, MT753X_PMEEECR_P(port));
-
-	e->tx_lpi_enabled = !(eeecr & LPI_MODE_EN);
-	e->tx_lpi_timer = LPI_THRESH_GET(eeecr);
-
 	return 0;
 }
 
Signature · 1 line
2.30.2
maintainer Reviewed-by on v1 2/9
#3 lore raw

Re: [PATCH net-next 2/9] net: dsa: mt753x: remove setting of tx_lpi parameters

Quoted 9 lines · Russell King (Oracle)

dsa_user_get_eee() calls the DSA switch get_mac_eee() method followed by phylink_ethtool_get_eee(), which goes on to call phy_ethtool_get_eee(). This overwrites all members of the passed ethtool_keee, which means anything written by the DSA switch get_mac_eee() method will be discarded.

Remove setting any members in mt753x_get_mac_eee().

Chester A.

#4 lore raw

PATCH 3/9 net: dsa: no longer call ds->ops->get_mac_eee()

In reply to Russell King (Oracle)

All implementations of get_mac_eee() now just return zero without doing anything useful. Remove the call to this method in preparation to removing the method from each DSA driver.

---
 net/dsa/user.c | 8 --------
 1 file changed, 8 deletions(-)
net/dsa/user.c +0 -8
index 4a8de48a6f24..c74f2b2b92de 100644
@@ -1251,7 +1251,6 @@ static int dsa_user_get_eee(struct net_device *dev, struct ethtool_keee *e)
 {
 	struct dsa_port *dp = dsa_user_to_port(dev);
 	struct dsa_switch *ds = dp->ds;
-	int ret;
 
 	/* Check whether the switch supports EEE */
 	if (!ds->ops->support_eee || !ds->ops->support_eee(ds, dp->index))
@@ -1261,13 +1260,6 @@ static int dsa_user_get_eee(struct net_device *dev, struct ethtool_keee *e)
 	if (!dev->phydev)
 		return -ENODEV;
 
-	if (!ds->ops->get_mac_eee)
-		return -EOPNOTSUPP;
-
-	ret = ds->ops->get_mac_eee(ds, dp->index, e);
-	if (ret)
-		return ret;
-
 	return phylink_ethtool_get_eee(dp->pl, e);
 }
 
Signature · 1 line
2.30.2
#5 lore raw

PATCH 4/9 net: dsa: b53/bcm_sf2: remove b53_get_mac_eee()

In reply to Russell King (Oracle)

b53_get_mac_eee() is no longer called by the core DSA code. Remove it.

---
 drivers/net/dsa/b53/b53_common.c | 7 -------
 drivers/net/dsa/b53/b53_priv.h   | 1 -
 drivers/net/dsa/bcm_sf2.c        | 1 -
 3 files changed, 9 deletions(-)
drivers/net/dsa/b53/b53_common.c +0 -7
index 0561b60f668f..79dc77835681 100644
@@ -2232,12 +2232,6 @@ bool b53_support_eee(struct dsa_switch *ds, int port)
 }
 EXPORT_SYMBOL(b53_support_eee);
 
-int b53_get_mac_eee(struct dsa_switch *ds, int port, struct ethtool_keee *e)
-{
-	return 0;
-}
-EXPORT_SYMBOL(b53_get_mac_eee);
-
 int b53_set_mac_eee(struct dsa_switch *ds, int port, struct ethtool_keee *e)
 {
 	struct b53_device *dev = ds->priv;
@@ -2299,7 +2293,6 @@ static const struct dsa_switch_ops b53_switch_ops = {
 	.port_enable		= b53_enable_port,
 	.port_disable		= b53_disable_port,
 	.support_eee		= b53_support_eee,
-	.get_mac_eee		= b53_get_mac_eee,
 	.set_mac_eee		= b53_set_mac_eee,
 	.port_bridge_join	= b53_br_join,
 	.port_bridge_leave	= b53_br_leave,
drivers/net/dsa/b53/b53_priv.h +0 -1
index 99e5cfc98ae8..9e9b5bc0c5d6 100644
@@ -385,7 +385,6 @@ void b53_disable_port(struct dsa_switch *ds, int port);
 void b53_brcm_hdr_setup(struct dsa_switch *ds, int port);
 int b53_eee_init(struct dsa_switch *ds, int port, struct phy_device *phy);
 bool b53_support_eee(struct dsa_switch *ds, int port);
-int b53_get_mac_eee(struct dsa_switch *ds, int port, struct ethtool_keee *e);
 int b53_set_mac_eee(struct dsa_switch *ds, int port, struct ethtool_keee *e);
 
 #endif
drivers/net/dsa/bcm_sf2.c +0 -1
index a53fb6191e6b..fa2bf3fa9019 100644
@@ -1233,7 +1233,6 @@ static const struct dsa_switch_ops bcm_sf2_ops = {
 	.port_enable		= bcm_sf2_port_setup,
 	.port_disable		= bcm_sf2_port_disable,
 	.support_eee		= b53_support_eee,
-	.get_mac_eee		= b53_get_mac_eee,
 	.set_mac_eee		= b53_set_mac_eee,
 	.port_bridge_join	= b53_br_join,
 	.port_bridge_leave	= b53_br_leave,
Signature · 1 line
2.30.2
#6 lore raw

PATCH 5/9 net: dsa: ksz: remove ksz_get_mac_eee()

In reply to Russell King (Oracle)

ksz_get_mac_eee() is no longer called by the core DSA code. Remove it.

---
 drivers/net/dsa/microchip/ksz_common.c | 7 -------
 1 file changed, 7 deletions(-)
drivers/net/dsa/microchip/ksz_common.c +0 -7
index 60a4630dd7ba..89f0796894af 100644
@@ -3489,12 +3489,6 @@ static bool ksz_support_eee(struct dsa_switch *ds, int port)
 	return false;
 }
 
-static int ksz_get_mac_eee(struct dsa_switch *ds, int port,
-			   struct ethtool_keee *e)
-{
-	return 0;
-}
-
 static int ksz_set_mac_eee(struct dsa_switch *ds, int port,
 			   struct ethtool_keee *e)
 {
@@ -4664,7 +4658,6 @@ static const struct dsa_switch_ops ksz_switch_ops = {
 	.cls_flower_del		= ksz_cls_flower_del,
 	.port_setup_tc		= ksz_setup_tc,
 	.support_eee		= ksz_support_eee,
-	.get_mac_eee		= ksz_get_mac_eee,
 	.set_mac_eee		= ksz_set_mac_eee,
 	.port_get_default_prio	= ksz_port_get_default_prio,
 	.port_set_default_prio	= ksz_port_set_default_prio,
Signature · 1 line
2.30.2
#7 lore raw

PATCH 6/9 net: dsa: mt753x: remove ksz_get_mac_eee()

In reply to Russell King (Oracle)

mt753x_get_mac_eee() is no longer called by the core DSA code. Remove it.

---
 drivers/net/dsa/mt7530.c | 7 -------
 1 file changed, 7 deletions(-)
drivers/net/dsa/mt7530.c +0 -7
index 4c78d049b9f4..d2d0f091e49e 100644
@@ -3085,12 +3085,6 @@ mt753x_setup(struct dsa_switch *ds)
 	return ret;
 }
 
-static int mt753x_get_mac_eee(struct dsa_switch *ds, int port,
-			      struct ethtool_keee *e)
-{
-	return 0;
-}
-
 static int mt753x_set_mac_eee(struct dsa_switch *ds, int port,
 			      struct ethtool_keee *e)
 {
@@ -3233,7 +3227,6 @@ const struct dsa_switch_ops mt7530_switch_ops = {
 	.port_mirror_del	= mt753x_port_mirror_del,
 	.phylink_get_caps	= mt753x_phylink_get_caps,
 	.support_eee		= dsa_supports_eee,
-	.get_mac_eee		= mt753x_get_mac_eee,
 	.set_mac_eee		= mt753x_set_mac_eee,
 	.conduit_state_change	= mt753x_conduit_state_change,
 	.port_setup_tc		= mt753x_setup_tc,
Signature · 1 line
2.30.2
maintainer Reviewed-by on v1 6/9
#8 lore raw

Re: [PATCH net-next 6/9] net: dsa: mt753x: remove ksz_get_mac_eee()

Hey Russell.

The patch subject mentions ksz_get_mac_eee() instead of mt753x_get_mac_eee(). Keep that in mind if you happen to submit a new version of this series; this is not enough as the sole reason to submit a new version, in my opinion.

Quoted 4 lines · Russell King (Oracle)

mt753x_get_mac_eee() is no longer called by the core DSA code. Remove it.

Cheers.
Chester A.

#9 lore raw

Re: [PATCH net-next 6/9] net: dsa: mt753x: remove ksz_get_mac_eee()

Quoted 4 lines · Chester A. Unal

The patch subject mentions ksz_get_mac_eee() instead of mt753x_get_mac_eee(). Keep that in mind if you happen to submit a new version of this series; this is not enough as the sole reason to submit a new version, in my opinion.

Thanks for spotting that, I've fixed it for the next posting!

Signature · 2 lines
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!
#10 lore raw

PATCH 7/9 net: dsa: mv88e6xxx: remove mv88e6xxx_get_mac_eee()

In reply to Russell King (Oracle)

mv88e6xxx_get_mac_eee() is no longer called by the core DSA code. Remove it.

---
 drivers/net/dsa/mv88e6xxx/chip.c | 8 --------
 1 file changed, 8 deletions(-)
drivers/net/dsa/mv88e6xxx/chip.c +0 -8
index 570c8642d387..35ae084af166 100644
@@ -1513,13 +1513,6 @@ static void mv88e6xxx_get_regs(struct dsa_switch *ds, int port,
 	mv88e6xxx_reg_unlock(chip);
 }
 
-static int mv88e6xxx_get_mac_eee(struct dsa_switch *ds, int port,
-				 struct ethtool_keee *e)
-{
-	/* Nothing to do on the port's MAC */
-	return 0;
-}
-
 static int mv88e6xxx_set_mac_eee(struct dsa_switch *ds, int port,
 				 struct ethtool_keee *e)
 {
@@ -7100,7 +7093,6 @@ static const struct dsa_switch_ops mv88e6xxx_switch_ops = {
 	.port_max_mtu		= mv88e6xxx_get_max_mtu,
 	.port_change_mtu	= mv88e6xxx_change_mtu,
 	.support_eee		= dsa_supports_eee,
-	.get_mac_eee		= mv88e6xxx_get_mac_eee,
 	.set_mac_eee		= mv88e6xxx_set_mac_eee,
 	.get_eeprom_len		= mv88e6xxx_get_eeprom_len,
 	.get_eeprom		= mv88e6xxx_get_eeprom,
Signature · 1 line
2.30.2
#11 lore raw

PATCH 8/9 net: dsa: qca: remove qca8k_get_mac_eee()

In reply to Russell King (Oracle)

qca8k_get_mac_eee() is no longer called by the core DSA code. Remove it.

---
 drivers/net/dsa/qca/qca8k-8xxx.c   | 1 -
 drivers/net/dsa/qca/qca8k-common.c | 7 -------
 drivers/net/dsa/qca/qca8k.h        | 1 -
 3 files changed, 9 deletions(-)
drivers/net/dsa/qca/qca8k-8xxx.c +0 -1
index 90e24bc00b99..2d56a8152420 100644
@@ -2017,7 +2017,6 @@ static const struct dsa_switch_ops qca8k_switch_ops = {
 	.get_sset_count		= qca8k_get_sset_count,
 	.set_ageing_time	= qca8k_set_ageing_time,
 	.support_eee		= dsa_supports_eee,
-	.get_mac_eee		= qca8k_get_mac_eee,
 	.set_mac_eee		= qca8k_set_mac_eee,
 	.port_enable		= qca8k_port_enable,
 	.port_disable		= qca8k_port_disable,
drivers/net/dsa/qca/qca8k-common.c +0 -7
index 560c74c4ac3d..13005f10edb7 100644
@@ -557,13 +557,6 @@ int qca8k_set_mac_eee(struct dsa_switch *ds, int port,
 	return ret;
 }
 
-int qca8k_get_mac_eee(struct dsa_switch *ds, int port,
-		      struct ethtool_keee *e)
-{
-	/* Nothing to do on the port's MAC */
-	return 0;
-}
-
 static int qca8k_port_configure_learning(struct dsa_switch *ds, int port,
 					 bool learning)
 {
drivers/net/dsa/qca/qca8k.h +0 -1
index 24962a395754..d046679265fa 100644
@@ -520,7 +520,6 @@ int qca8k_get_sset_count(struct dsa_switch *ds, int port, int sset);
 
 /* Common eee function */
 int qca8k_set_mac_eee(struct dsa_switch *ds, int port, struct ethtool_keee *eee);
-int qca8k_get_mac_eee(struct dsa_switch *ds, int port, struct ethtool_keee *e);
 
 /* Common bridge function */
 void qca8k_port_stp_state_set(struct dsa_switch *ds, int port, u8 state);
Signature · 1 line
2.30.2
#12 lore raw

PATCH 9/9 net: dsa: remove get_mac_eee() method

In reply to Russell King (Oracle)

The get_mac_eee() is no longer called by the core DSA code, nor are there any implementations of this method. Remove it.

---
 include/net/dsa.h | 2 --
 1 file changed, 2 deletions(-)
include/net/dsa.h +0 -2
index 4aeedb296d67..9640d5c67f56 100644
@@ -991,8 +991,6 @@ struct dsa_switch_ops {
 	bool	(*support_eee)(struct dsa_switch *ds, int port);
 	int	(*set_mac_eee)(struct dsa_switch *ds, int port,
 			       struct ethtool_keee *e);
-	int	(*get_mac_eee)(struct dsa_switch *ds, int port,
-			       struct ethtool_keee *e);
 
 	/* EEPROM access */
 	int	(*get_eeprom_len)(struct dsa_switch *ds);
Signature · 1 line
2.30.2
#13 lore raw
In reply to Russell King (Oracle)
This series was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:

Hello:

This series was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:

Quoted 9 lines · On Mon, 6 Jan 2025 11:51:31 +0000 you wrote:

This is part 2 of the DSA EEE cleanups, removing what has become dead code as a result of the EEE management phylib now does.

Patch 1 removes the useless setting of tx_lpi parameters in the ksz driver.

Patch 2 does the same for mt753x.

[...]

Here is the summary with links:
- [net-next,1/9] net: dsa: ksz: remove setting of tx_lpi parameters

    https://git.kernel.org/netdev/net-next/c/0945a7b44220
  - [net-next,2/9] net: dsa: mt753x: remove setting of tx_lpi parameters
    https://git.kernel.org/netdev/net-next/c/22cedc609759
  - [net-next,3/9] net: dsa: no longer call ds->ops->get_mac_eee()
    https://git.kernel.org/netdev/net-next/c/60c6e3a59299
  - [net-next,4/9] net: dsa: b53/bcm_sf2: remove b53_get_mac_eee()
    https://git.kernel.org/netdev/net-next/c/08cef9e1b083
  - [net-next,5/9] net: dsa: ksz: remove ksz_get_mac_eee()
    https://git.kernel.org/netdev/net-next/c/e2d1b8090b69
  - [net-next,6/9] net: dsa: mt753x: remove ksz_get_mac_eee()
    https://git.kernel.org/netdev/net-next/c/9e66e8ebe7a9
  - [net-next,7/9] net: dsa: mv88e6xxx: remove mv88e6xxx_get_mac_eee()
    https://git.kernel.org/netdev/net-next/c/d3889a3d1351
  - [net-next,8/9] net: dsa: qca: remove qca8k_get_mac_eee()
    https://git.kernel.org/netdev/net-next/c/d19be79a67b3
  - [net-next,9/9] net: dsa: remove get_mac_eee() method
    https://git.kernel.org/netdev/net-next/c/2fa8b4383d24

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html