netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next 0/6] net: eee network driver cleanups
@ 2024-02-02  9:33 Russell King (Oracle)
  2024-02-02  9:33 ` [PATCH net-next 1/6] net: stmmac: remove eee_enabled/eee_active in stmmac_ethtool_op_get_eee() Russell King (Oracle)
                   ` (5 more replies)
  0 siblings, 6 replies; 20+ messages in thread
From: Russell King (Oracle) @ 2024-02-02  9:33 UTC (permalink / raw)
  To: Andrew Lunn, Heiner Kallweit
  Cc: Alexandre Torgue, bcm-kernel-feedback-list, Byungho An,
	Clark Wang, David S. Miller, Doug Berger, Eric Dumazet,
	Florian Fainelli, Jakub Kicinski, Jose Abreu, Justin Chen,
	linux-arm-kernel, linux-stm32, Maxime Coquelin, netdev,
	NXP Linux Team, Paolo Abeni, Shenwei Wang, Vladimir Oltean,
	Wei Fang

Hi,

Since commit d1420bb99515 ("net: phy: improve generic EEE ethtool
functions") changed phylib to set eee->eee_active and eee->eee_enabled,
overriding anything that drivers have set these to prior to calling
phy_ethtool_get_eee().

Therefore, drivers setting these members becomes redundant, since
phylib overwrites the values they set. This series finishes off
Heiner's work in the referenced commit by removing these redundant
writes in various drivers and any associated code or structure members
that become unnecessary.

 drivers/net/dsa/b53/b53_common.c                     | 6 ------
 drivers/net/ethernet/broadcom/asp2/bcmasp_ethtool.c  | 4 ----
 drivers/net/ethernet/broadcom/asp2/bcmasp_intf.c     | 5 +++--
 drivers/net/ethernet/broadcom/genet/bcmgenet.c       | 8 +++-----
 drivers/net/ethernet/broadcom/genet/bcmmii.c         | 5 +++--
 drivers/net/ethernet/freescale/fec_main.c            | 3 ---
 drivers/net/ethernet/samsung/sxgbe/sxgbe_common.h    | 1 -
 drivers/net/ethernet/samsung/sxgbe/sxgbe_ethtool.c   | 2 --
 drivers/net/ethernet/samsung/sxgbe/sxgbe_main.c      | 1 -
 drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c | 2 --
 10 files changed, 9 insertions(+), 28 deletions(-)

-- 
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!

^ permalink raw reply	[flat|nested] 20+ messages in thread

* [PATCH net-next 1/6] net: stmmac: remove eee_enabled/eee_active in stmmac_ethtool_op_get_eee()
  2024-02-02  9:33 [PATCH net-next 0/6] net: eee network driver cleanups Russell King (Oracle)
@ 2024-02-02  9:33 ` Russell King (Oracle)
  2024-02-02 13:15   ` Andrew Lunn
  2024-02-03  1:22   ` Florian Fainelli
  2024-02-02  9:33 ` [PATCH net-next 2/6] net: sxgbe: remove eee_enabled/eee_active in sxgbe_get_eee() Russell King (Oracle)
                   ` (4 subsequent siblings)
  5 siblings, 2 replies; 20+ messages in thread
From: Russell King (Oracle) @ 2024-02-02  9:33 UTC (permalink / raw)
  To: Andrew Lunn, Heiner Kallweit
  Cc: Alexandre Torgue, bcm-kernel-feedback-list,
	Broadcom internal kernel review list, Byungho An, Clark Wang,
	David S. Miller, Doug Berger, Eric Dumazet, Florian Fainelli,
	Jakub Kicinski, Jose Abreu, Justin Chen, linux-arm-kernel,
	linux-stm32, Maxime Coquelin, netdev, NXP Linux Team, Paolo Abeni,
	Shenwei Wang, Vladimir Oltean, Wei Fang

stmmac_ethtool_op_get_eee() sets both eee_enabled and eee_active, and
then goes on to call phylink_ethtool_get_eee().

phylink_ethtool_get_eee() will return -EOPNOTSUPP if there is no PHY
present, otherwise calling phy_ethtool_get_eee() which in turn will call
genphy_c45_ethtool_get_eee().

genphy_c45_ethtool_get_eee() will overwrite eee_enabled and eee_active
with its own interpretation from the PHYs settings and negotiation
result.

Thus, when there is no PHY, stmmac_ethtool_op_get_eee() will fail with
-EOPNOTSUPP, meaning eee_enabled and eee_active will not be returned to
userspace. When there is a PHY, eee_enabled and eee_active will be
overwritten by phylib, making the setting of these members in
stmmac_ethtool_op_get_eee() entirely unnecessary.

Remove this code, thus simplifying stmmac_ethtool_op_get_eee().

Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
---
 drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c
index bbecb3b89535..411c3ac8cb17 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c
@@ -859,8 +859,6 @@ 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;
 
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH net-next 2/6] net: sxgbe: remove eee_enabled/eee_active in sxgbe_get_eee()
  2024-02-02  9:33 [PATCH net-next 0/6] net: eee network driver cleanups Russell King (Oracle)
  2024-02-02  9:33 ` [PATCH net-next 1/6] net: stmmac: remove eee_enabled/eee_active in stmmac_ethtool_op_get_eee() Russell King (Oracle)
@ 2024-02-02  9:33 ` Russell King (Oracle)
  2024-02-02 13:18   ` Andrew Lunn
  2024-02-02  9:33 ` [PATCH net-next 3/6] net: fec: remove eee_enabled/eee_active in fec_enet_get_eee() Russell King (Oracle)
                   ` (3 subsequent siblings)
  5 siblings, 1 reply; 20+ messages in thread
From: Russell King (Oracle) @ 2024-02-02  9:33 UTC (permalink / raw)
  To: Andrew Lunn, Heiner Kallweit
  Cc: Alexandre Torgue, bcm-kernel-feedback-list,
	Broadcom internal kernel review list, Byungho An, Clark Wang,
	David S. Miller, Doug Berger, Eric Dumazet, Florian Fainelli,
	Jakub Kicinski, Jose Abreu, Justin Chen, linux-arm-kernel,
	linux-stm32, Maxime Coquelin, netdev, NXP Linux Team, Paolo Abeni,
	Shenwei Wang, Vladimir Oltean, Wei Fang

sxgbe_get_eee() sets edata->eee_active and edata->eee_enabled from its
own copy, and then calls phy_ethtool_get_eee() which in turn will call
genphy_c45_ethtool_get_eee().

genphy_c45_ethtool_get_eee() will overwrite eee_enabled and eee_active
with its own interpretation from the PHYs settings and negotiation
result.

Therefore, setting these members in sxgbe_get_eee() is redundant.
Remove this, and remove the priv->eee_active member which then becomes
a write-only variable.

Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
---
 drivers/net/ethernet/samsung/sxgbe/sxgbe_common.h  | 1 -
 drivers/net/ethernet/samsung/sxgbe/sxgbe_ethtool.c | 2 --
 drivers/net/ethernet/samsung/sxgbe/sxgbe_main.c    | 1 -
 3 files changed, 4 deletions(-)

diff --git a/drivers/net/ethernet/samsung/sxgbe/sxgbe_common.h b/drivers/net/ethernet/samsung/sxgbe/sxgbe_common.h
index d14e0cfc3a6b..1458939c3bf5 100644
--- a/drivers/net/ethernet/samsung/sxgbe/sxgbe_common.h
+++ b/drivers/net/ethernet/samsung/sxgbe/sxgbe_common.h
@@ -503,7 +503,6 @@ struct sxgbe_priv_data {
 	bool tx_path_in_lpi_mode;
 	int lpi_irq;
 	int eee_enabled;
-	int eee_active;
 	int tx_lpi_timer;
 };
 
diff --git a/drivers/net/ethernet/samsung/sxgbe/sxgbe_ethtool.c b/drivers/net/ethernet/samsung/sxgbe/sxgbe_ethtool.c
index d93b628b7046..4a439b34114d 100644
--- a/drivers/net/ethernet/samsung/sxgbe/sxgbe_ethtool.c
+++ b/drivers/net/ethernet/samsung/sxgbe/sxgbe_ethtool.c
@@ -140,8 +140,6 @@ static int sxgbe_get_eee(struct net_device *dev,
 	if (!priv->hw_cap.eee)
 		return -EOPNOTSUPP;
 
-	edata->eee_enabled = priv->eee_enabled;
-	edata->eee_active = priv->eee_active;
 	edata->tx_lpi_timer = priv->tx_lpi_timer;
 
 	return phy_ethtool_get_eee(dev->phydev, edata);
diff --git a/drivers/net/ethernet/samsung/sxgbe/sxgbe_main.c b/drivers/net/ethernet/samsung/sxgbe/sxgbe_main.c
index 71439825ea4e..ecbe3994f2b1 100644
--- a/drivers/net/ethernet/samsung/sxgbe/sxgbe_main.c
+++ b/drivers/net/ethernet/samsung/sxgbe/sxgbe_main.c
@@ -130,7 +130,6 @@ bool sxgbe_eee_init(struct sxgbe_priv_data * const priv)
 		if (phy_init_eee(ndev->phydev, true))
 			return false;
 
-		priv->eee_active = 1;
 		timer_setup(&priv->eee_ctrl_timer, sxgbe_eee_ctrl_timer, 0);
 		priv->eee_ctrl_timer.expires = SXGBE_LPI_TIMER(eee_timer);
 		add_timer(&priv->eee_ctrl_timer);
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH net-next 3/6] net: fec: remove eee_enabled/eee_active in fec_enet_get_eee()
  2024-02-02  9:33 [PATCH net-next 0/6] net: eee network driver cleanups Russell King (Oracle)
  2024-02-02  9:33 ` [PATCH net-next 1/6] net: stmmac: remove eee_enabled/eee_active in stmmac_ethtool_op_get_eee() Russell King (Oracle)
  2024-02-02  9:33 ` [PATCH net-next 2/6] net: sxgbe: remove eee_enabled/eee_active in sxgbe_get_eee() Russell King (Oracle)
@ 2024-02-02  9:33 ` Russell King (Oracle)
  2024-02-02 13:22   ` Andrew Lunn
  2024-02-02  9:34 ` [PATCH net-next 4/6] net: bcmgenet: remove eee_enabled/eee_active in bcmgenet_get_eee() Russell King (Oracle)
                   ` (2 subsequent siblings)
  5 siblings, 1 reply; 20+ messages in thread
From: Russell King (Oracle) @ 2024-02-02  9:33 UTC (permalink / raw)
  To: Andrew Lunn, Heiner Kallweit
  Cc: Alexandre Torgue, bcm-kernel-feedback-list,
	Broadcom internal kernel review list, Byungho An, Clark Wang,
	David S. Miller, Doug Berger, Eric Dumazet, Florian Fainelli,
	Jakub Kicinski, Jose Abreu, Justin Chen, linux-arm-kernel,
	linux-stm32, Maxime Coquelin, netdev, NXP Linux Team, Paolo Abeni,
	Shenwei Wang, Vladimir Oltean, Wei Fang

fec_enet_get_eee() sets edata->eee_active and edata->eee_enabled from
its own copy, and then calls phy_ethtool_get_eee() which in turn will
call genphy_c45_ethtool_get_eee().

genphy_c45_ethtool_get_eee() will overwrite eee_enabled and eee_active
with its own interpretation from the PHYs settings and negotiation
result.

Therefore, setting these members in fec_enet_get_eee() is redundant.
Remove this, and remove the setting of fep->eee.eee_active member which
becomes a write-only variable.

Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
---
 drivers/net/ethernet/freescale/fec_main.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c
index 63707e065141..38dcf0989e3f 100644
--- a/drivers/net/ethernet/freescale/fec_main.c
+++ b/drivers/net/ethernet/freescale/fec_main.c
@@ -3140,7 +3140,6 @@ static int fec_enet_eee_mode_set(struct net_device *ndev, bool enable)
 
 	p->tx_lpi_enabled = enable;
 	p->eee_enabled = enable;
-	p->eee_active = enable;
 
 	writel(sleep_cycle, fep->hwp + FEC_LPI_SLEEP);
 	writel(wake_cycle, fep->hwp + FEC_LPI_WAKE);
@@ -3160,8 +3159,6 @@ fec_enet_get_eee(struct net_device *ndev, struct ethtool_keee *edata)
 	if (!netif_running(ndev))
 		return -ENETDOWN;
 
-	edata->eee_enabled = p->eee_enabled;
-	edata->eee_active = p->eee_active;
 	edata->tx_lpi_timer = p->tx_lpi_timer;
 	edata->tx_lpi_enabled = p->tx_lpi_enabled;
 
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH net-next 4/6] net: bcmgenet: remove eee_enabled/eee_active in bcmgenet_get_eee()
  2024-02-02  9:33 [PATCH net-next 0/6] net: eee network driver cleanups Russell King (Oracle)
                   ` (2 preceding siblings ...)
  2024-02-02  9:33 ` [PATCH net-next 3/6] net: fec: remove eee_enabled/eee_active in fec_enet_get_eee() Russell King (Oracle)
@ 2024-02-02  9:34 ` Russell King (Oracle)
  2024-02-02 13:25   ` Andrew Lunn
  2024-02-03  1:17   ` Florian Fainelli
  2024-02-02  9:34 ` [PATCH net-next 5/6] net: bcmasp: remove eee_enabled/eee_active in bcmasp_get_eee() Russell King (Oracle)
  2024-02-02  9:34 ` [PATCH net-next 6/6] net: dsa: b53: remove eee_enabled/eee_active in b53_get_mac_eee() Russell King (Oracle)
  5 siblings, 2 replies; 20+ messages in thread
From: Russell King (Oracle) @ 2024-02-02  9:34 UTC (permalink / raw)
  To: Andrew Lunn, Heiner Kallweit
  Cc: Alexandre Torgue, bcm-kernel-feedback-list,
	Broadcom internal kernel review list, Byungho An, Clark Wang,
	David S. Miller, Doug Berger, Eric Dumazet, Florian Fainelli,
	Jakub Kicinski, Jose Abreu, Justin Chen, linux-arm-kernel,
	linux-stm32, Maxime Coquelin, netdev, NXP Linux Team, Paolo Abeni,
	Shenwei Wang, Vladimir Oltean, Wei Fang

bcmgenet_get_eee() sets edata->eee_active and edata->eee_enabled from
its own copy, and then calls phy_ethtool_get_eee() which in turn will
call genphy_c45_ethtool_get_eee().

genphy_c45_ethtool_get_eee() will overwrite eee_enabled and eee_active
with its own interpretation from the PHYs settings and negotiation
result.

Therefore, setting these members in bcmgenet_get_eee() is redundant,
and can be removed. This also makes priv->eee.eee_active unnecessary,
so remove this and use a local variable where appropriate.

Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
---
 drivers/net/ethernet/broadcom/genet/bcmgenet.c | 8 +++-----
 drivers/net/ethernet/broadcom/genet/bcmmii.c   | 5 +++--
 2 files changed, 6 insertions(+), 7 deletions(-)

diff --git a/drivers/net/ethernet/broadcom/genet/bcmgenet.c b/drivers/net/ethernet/broadcom/genet/bcmgenet.c
index 051c31fb17c2..7396e2823e32 100644
--- a/drivers/net/ethernet/broadcom/genet/bcmgenet.c
+++ b/drivers/net/ethernet/broadcom/genet/bcmgenet.c
@@ -1313,7 +1313,6 @@ void bcmgenet_eee_enable_set(struct net_device *dev, bool enable,
 	}
 
 	priv->eee.eee_enabled = enable;
-	priv->eee.eee_active = enable;
 	priv->eee.tx_lpi_enabled = tx_lpi_enabled;
 }
 
@@ -1328,8 +1327,6 @@ static int bcmgenet_get_eee(struct net_device *dev, struct ethtool_keee *e)
 	if (!dev->phydev)
 		return -ENODEV;
 
-	e->eee_enabled = p->eee_enabled;
-	e->eee_active = p->eee_active;
 	e->tx_lpi_enabled = p->tx_lpi_enabled;
 	e->tx_lpi_timer = bcmgenet_umac_readl(priv, UMAC_EEE_LPI_TIMER);
 
@@ -1340,6 +1337,7 @@ static int bcmgenet_set_eee(struct net_device *dev, struct ethtool_keee *e)
 {
 	struct bcmgenet_priv *priv = netdev_priv(dev);
 	struct ethtool_keee *p = &priv->eee;
+	bool active;
 
 	if (GENET_IS_V1(priv))
 		return -EOPNOTSUPP;
@@ -1352,9 +1350,9 @@ static int bcmgenet_set_eee(struct net_device *dev, struct ethtool_keee *e)
 	if (!p->eee_enabled) {
 		bcmgenet_eee_enable_set(dev, false, false);
 	} else {
-		p->eee_active = phy_init_eee(dev->phydev, false) >= 0;
+		active = phy_init_eee(dev->phydev, false) >= 0;
 		bcmgenet_umac_writel(priv, e->tx_lpi_timer, UMAC_EEE_LPI_TIMER);
-		bcmgenet_eee_enable_set(dev, p->eee_active, e->tx_lpi_enabled);
+		bcmgenet_eee_enable_set(dev, active, e->tx_lpi_enabled);
 	}
 
 	return phy_ethtool_set_eee(dev->phydev, e);
diff --git a/drivers/net/ethernet/broadcom/genet/bcmmii.c b/drivers/net/ethernet/broadcom/genet/bcmmii.c
index 97ea76d443ab..cbbe004621bc 100644
--- a/drivers/net/ethernet/broadcom/genet/bcmmii.c
+++ b/drivers/net/ethernet/broadcom/genet/bcmmii.c
@@ -30,6 +30,7 @@ static void bcmgenet_mac_config(struct net_device *dev)
 	struct bcmgenet_priv *priv = netdev_priv(dev);
 	struct phy_device *phydev = dev->phydev;
 	u32 reg, cmd_bits = 0;
+	bool active;
 
 	/* speed */
 	if (phydev->speed == SPEED_1000)
@@ -88,9 +89,9 @@ static void bcmgenet_mac_config(struct net_device *dev)
 	}
 	bcmgenet_umac_writel(priv, reg, UMAC_CMD);
 
-	priv->eee.eee_active = phy_init_eee(phydev, 0) >= 0;
+	active = phy_init_eee(phydev, 0) >= 0;
 	bcmgenet_eee_enable_set(dev,
-				priv->eee.eee_enabled && priv->eee.eee_active,
+				priv->eee.eee_enabled && active,
 				priv->eee.tx_lpi_enabled);
 }
 
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH net-next 5/6] net: bcmasp: remove eee_enabled/eee_active in bcmasp_get_eee()
  2024-02-02  9:33 [PATCH net-next 0/6] net: eee network driver cleanups Russell King (Oracle)
                   ` (3 preceding siblings ...)
  2024-02-02  9:34 ` [PATCH net-next 4/6] net: bcmgenet: remove eee_enabled/eee_active in bcmgenet_get_eee() Russell King (Oracle)
@ 2024-02-02  9:34 ` Russell King (Oracle)
  2024-02-02 13:26   ` Andrew Lunn
  2024-02-03  1:18   ` Florian Fainelli
  2024-02-02  9:34 ` [PATCH net-next 6/6] net: dsa: b53: remove eee_enabled/eee_active in b53_get_mac_eee() Russell King (Oracle)
  5 siblings, 2 replies; 20+ messages in thread
From: Russell King (Oracle) @ 2024-02-02  9:34 UTC (permalink / raw)
  To: Andrew Lunn, Heiner Kallweit
  Cc: Alexandre Torgue, bcm-kernel-feedback-list,
	Broadcom internal kernel review list, Byungho An, Clark Wang,
	David S. Miller, Doug Berger, Eric Dumazet, Florian Fainelli,
	Jakub Kicinski, Jose Abreu, Justin Chen, linux-arm-kernel,
	linux-stm32, Maxime Coquelin, netdev, NXP Linux Team, Paolo Abeni,
	Shenwei Wang, Vladimir Oltean, Wei Fang

bcmasp_get_eee() sets edata->eee_active and edata->eee_enabled from
its own copy, and then calls phy_ethtool_get_eee() which in turn will
call genphy_c45_ethtool_get_eee().

genphy_c45_ethtool_get_eee() will overwrite eee_enabled and eee_active
with its own interpretation from the PHYs settings and negotiation
result.

Therefore, setting these members in bcmasp_get_eee() is redundant, and
can be removed. This also makes intf->eee.eee_active unnecessary, so
remove this and use a local variable where appropriate.

Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
---
 drivers/net/ethernet/broadcom/asp2/bcmasp_ethtool.c | 4 ----
 drivers/net/ethernet/broadcom/asp2/bcmasp_intf.c    | 5 +++--
 2 files changed, 3 insertions(+), 6 deletions(-)

diff --git a/drivers/net/ethernet/broadcom/asp2/bcmasp_ethtool.c b/drivers/net/ethernet/broadcom/asp2/bcmasp_ethtool.c
index 2851bed153e6..484fc2b5626f 100644
--- a/drivers/net/ethernet/broadcom/asp2/bcmasp_ethtool.c
+++ b/drivers/net/ethernet/broadcom/asp2/bcmasp_ethtool.c
@@ -360,7 +360,6 @@ void bcmasp_eee_enable_set(struct bcmasp_intf *intf, bool enable)
 	umac_wl(intf, reg, UMC_EEE_CTRL);
 
 	intf->eee.eee_enabled = enable;
-	intf->eee.eee_active = enable;
 }
 
 static int bcmasp_get_eee(struct net_device *dev, struct ethtool_keee *e)
@@ -371,8 +370,6 @@ static int bcmasp_get_eee(struct net_device *dev, struct ethtool_keee *e)
 	if (!dev->phydev)
 		return -ENODEV;
 
-	e->eee_enabled = p->eee_enabled;
-	e->eee_active = p->eee_active;
 	e->tx_lpi_enabled = p->tx_lpi_enabled;
 	e->tx_lpi_timer = umac_rl(intf, UMC_EEE_LPI_TIMER);
 
@@ -399,7 +396,6 @@ static int bcmasp_set_eee(struct net_device *dev, struct ethtool_keee *e)
 		}
 
 		umac_wl(intf, e->tx_lpi_timer, UMC_EEE_LPI_TIMER);
-		intf->eee.eee_active = ret >= 0;
 		intf->eee.tx_lpi_enabled = e->tx_lpi_enabled;
 		bcmasp_eee_enable_set(intf, true);
 	}
diff --git a/drivers/net/ethernet/broadcom/asp2/bcmasp_intf.c b/drivers/net/ethernet/broadcom/asp2/bcmasp_intf.c
index 53e542881255..3a15f269c7d1 100644
--- a/drivers/net/ethernet/broadcom/asp2/bcmasp_intf.c
+++ b/drivers/net/ethernet/broadcom/asp2/bcmasp_intf.c
@@ -607,6 +607,7 @@ static void bcmasp_adj_link(struct net_device *dev)
 	struct phy_device *phydev = dev->phydev;
 	u32 cmd_bits = 0, reg;
 	int changed = 0;
+	bool active;
 
 	if (intf->old_link != phydev->link) {
 		changed = 1;
@@ -658,8 +659,8 @@ static void bcmasp_adj_link(struct net_device *dev)
 		reg |= cmd_bits;
 		umac_wl(intf, reg, UMC_CMD);
 
-		intf->eee.eee_active = phy_init_eee(phydev, 0) >= 0;
-		bcmasp_eee_enable_set(intf, intf->eee.eee_active);
+		active = phy_init_eee(phydev, 0) >= 0;
+		bcmasp_eee_enable_set(intf, active);
 	}
 
 	reg = rgmii_rl(intf, RGMII_OOB_CNTRL);
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH net-next 6/6] net: dsa: b53: remove eee_enabled/eee_active in b53_get_mac_eee()
  2024-02-02  9:33 [PATCH net-next 0/6] net: eee network driver cleanups Russell King (Oracle)
                   ` (4 preceding siblings ...)
  2024-02-02  9:34 ` [PATCH net-next 5/6] net: bcmasp: remove eee_enabled/eee_active in bcmasp_get_eee() Russell King (Oracle)
@ 2024-02-02  9:34 ` Russell King (Oracle)
  2024-02-02 13:27   ` Andrew Lunn
  2024-02-03  1:22   ` Florian Fainelli
  5 siblings, 2 replies; 20+ messages in thread
From: Russell King (Oracle) @ 2024-02-02  9:34 UTC (permalink / raw)
  To: Andrew Lunn, Heiner Kallweit
  Cc: Alexandre Torgue, bcm-kernel-feedback-list,
	Broadcom internal kernel review list, Byungho An, Clark Wang,
	David S. Miller, Doug Berger, Eric Dumazet, Florian Fainelli,
	Jakub Kicinski, Jose Abreu, Justin Chen, linux-arm-kernel,
	linux-stm32, Maxime Coquelin, netdev, NXP Linux Team, Paolo Abeni,
	Shenwei Wang, Vladimir Oltean, Wei Fang

b53_get_mac_eee() sets both eee_enabled and eee_active, and then
returns zero.

dsa_slave_get_eee(), which calls this function, will then continue to
call phylink_ethtool_get_eee(), which will return -EOPNOTSUPP if there
is no PHY present, otherwise calling phy_ethtool_get_eee() which in
turn will call genphy_c45_ethtool_get_eee().

genphy_c45_ethtool_get_eee() will overwrite eee_enabled and eee_active
with its own interpretation from the PHYs settings and negotiation
result.

Thus, when there is no PHY, dsa_slave_get_eee() will fail with
-EOPNOTSUPP, meaning eee_enabled and eee_active will not be returned to
userspace. When there is a PHY, eee_enabled and eee_active will be
overwritten by phylib, making the setting of these members in
b53_get_mac_eee() entirely unnecessary.

Remove this code, thus simplifying b53_get_mac_eee().

Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
---
 drivers/net/dsa/b53/b53_common.c | 6 ------
 1 file changed, 6 deletions(-)

diff --git a/drivers/net/dsa/b53/b53_common.c b/drivers/net/dsa/b53/b53_common.c
index adc93abf4551..9e4c9bd6abcc 100644
--- a/drivers/net/dsa/b53/b53_common.c
+++ b/drivers/net/dsa/b53/b53_common.c
@@ -2227,16 +2227,10 @@ EXPORT_SYMBOL(b53_eee_init);
 int b53_get_mac_eee(struct dsa_switch *ds, int port, struct ethtool_keee *e)
 {
 	struct b53_device *dev = ds->priv;
-	struct ethtool_keee *p = &dev->ports[port].eee;
-	u16 reg;
 
 	if (is5325(dev) || is5365(dev))
 		return -EOPNOTSUPP;
 
-	b53_read16(dev, B53_EEE_PAGE, B53_EEE_LPI_INDICATE, &reg);
-	e->eee_enabled = p->eee_enabled;
-	e->eee_active = !!(reg & BIT(port));
-
 	return 0;
 }
 EXPORT_SYMBOL(b53_get_mac_eee);
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 20+ messages in thread

* Re: [PATCH net-next 1/6] net: stmmac: remove eee_enabled/eee_active in stmmac_ethtool_op_get_eee()
  2024-02-02  9:33 ` [PATCH net-next 1/6] net: stmmac: remove eee_enabled/eee_active in stmmac_ethtool_op_get_eee() Russell King (Oracle)
@ 2024-02-02 13:15   ` Andrew Lunn
  2024-02-03  1:22   ` Florian Fainelli
  1 sibling, 0 replies; 20+ messages in thread
From: Andrew Lunn @ 2024-02-02 13:15 UTC (permalink / raw)
  To: Russell King (Oracle)
  Cc: Heiner Kallweit, Alexandre Torgue, bcm-kernel-feedback-list,
	Byungho An, Clark Wang, David S. Miller, Doug Berger,
	Eric Dumazet, Florian Fainelli, Jakub Kicinski, Jose Abreu,
	Justin Chen, linux-arm-kernel, linux-stm32, Maxime Coquelin,
	netdev, NXP Linux Team, Paolo Abeni, Shenwei Wang,
	Vladimir Oltean, Wei Fang

On Fri, Feb 02, 2024 at 09:33:44AM +0000, Russell King (Oracle) wrote:
> stmmac_ethtool_op_get_eee() sets both eee_enabled and eee_active, and
> then goes on to call phylink_ethtool_get_eee().
> 
> phylink_ethtool_get_eee() will return -EOPNOTSUPP if there is no PHY
> present, otherwise calling phy_ethtool_get_eee() which in turn will call
> genphy_c45_ethtool_get_eee().
> 
> genphy_c45_ethtool_get_eee() will overwrite eee_enabled and eee_active
> with its own interpretation from the PHYs settings and negotiation
> result.
> 
> Thus, when there is no PHY, stmmac_ethtool_op_get_eee() will fail with
> -EOPNOTSUPP, meaning eee_enabled and eee_active will not be returned to
> userspace. When there is a PHY, eee_enabled and eee_active will be
> overwritten by phylib, making the setting of these members in
> stmmac_ethtool_op_get_eee() entirely unnecessary.
> 
> Remove this code, thus simplifying stmmac_ethtool_op_get_eee().
> 
> Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>

Reviewed-by: Andrew Lunn <andrew@lunn.ch>

    Andrew

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH net-next 2/6] net: sxgbe: remove eee_enabled/eee_active in sxgbe_get_eee()
  2024-02-02  9:33 ` [PATCH net-next 2/6] net: sxgbe: remove eee_enabled/eee_active in sxgbe_get_eee() Russell King (Oracle)
@ 2024-02-02 13:18   ` Andrew Lunn
  0 siblings, 0 replies; 20+ messages in thread
From: Andrew Lunn @ 2024-02-02 13:18 UTC (permalink / raw)
  To: Russell King (Oracle)
  Cc: Heiner Kallweit, Alexandre Torgue, bcm-kernel-feedback-list,
	Byungho An, Clark Wang, David S. Miller, Doug Berger,
	Eric Dumazet, Florian Fainelli, Jakub Kicinski, Jose Abreu,
	Justin Chen, linux-arm-kernel, linux-stm32, Maxime Coquelin,
	netdev, NXP Linux Team, Paolo Abeni, Shenwei Wang,
	Vladimir Oltean, Wei Fang

On Fri, Feb 02, 2024 at 09:33:49AM +0000, Russell King (Oracle) wrote:
> sxgbe_get_eee() sets edata->eee_active and edata->eee_enabled from its
> own copy, and then calls phy_ethtool_get_eee() which in turn will call
> genphy_c45_ethtool_get_eee().
> 
> genphy_c45_ethtool_get_eee() will overwrite eee_enabled and eee_active
> with its own interpretation from the PHYs settings and negotiation
> result.
> 
> Therefore, setting these members in sxgbe_get_eee() is redundant.
> Remove this, and remove the priv->eee_active member which then becomes
> a write-only variable.
> 
> Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>

Reviewed-by: Andrew Lunn <andrew@lunn.ch>

    Andrew

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH net-next 3/6] net: fec: remove eee_enabled/eee_active in fec_enet_get_eee()
  2024-02-02  9:33 ` [PATCH net-next 3/6] net: fec: remove eee_enabled/eee_active in fec_enet_get_eee() Russell King (Oracle)
@ 2024-02-02 13:22   ` Andrew Lunn
  2024-02-02 13:45     ` Russell King (Oracle)
  0 siblings, 1 reply; 20+ messages in thread
From: Andrew Lunn @ 2024-02-02 13:22 UTC (permalink / raw)
  To: Russell King (Oracle), g
  Cc: Heiner Kallweit, Alexandre Torgue, bcm-kernel-feedback-list,
	Byungho An, Clark Wang, David S. Miller, Doug Berger,
	Eric Dumazet, Florian Fainelli, Jakub Kicinski, Jose Abreu,
	Justin Chen, linux-arm-kernel, linux-stm32, Maxime Coquelin,
	netdev, NXP Linux Team, Paolo Abeni, Shenwei Wang,
	Vladimir Oltean, Wei Fang

On Fri, Feb 02, 2024 at 09:33:54AM +0000, Russell King (Oracle) wrote:
> fec_enet_get_eee() sets edata->eee_active and edata->eee_enabled from
> its own copy, and then calls phy_ethtool_get_eee() which in turn will
> call genphy_c45_ethtool_get_eee().
> 
> genphy_c45_ethtool_get_eee() will overwrite eee_enabled and eee_active
> with its own interpretation from the PHYs settings and negotiation
> result.
> 
> Therefore, setting these members in fec_enet_get_eee() is redundant.
> Remove this, and remove the setting of fep->eee.eee_active member which
> becomes a write-only variable.

I _think_ p->eee_enabled becomes write only as well?

	Andrew

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH net-next 4/6] net: bcmgenet: remove eee_enabled/eee_active in bcmgenet_get_eee()
  2024-02-02  9:34 ` [PATCH net-next 4/6] net: bcmgenet: remove eee_enabled/eee_active in bcmgenet_get_eee() Russell King (Oracle)
@ 2024-02-02 13:25   ` Andrew Lunn
  2024-02-03  1:17   ` Florian Fainelli
  1 sibling, 0 replies; 20+ messages in thread
From: Andrew Lunn @ 2024-02-02 13:25 UTC (permalink / raw)
  To: Russell King (Oracle)
  Cc: Heiner Kallweit, Alexandre Torgue, bcm-kernel-feedback-list,
	Byungho An, Clark Wang, David S. Miller, Doug Berger,
	Eric Dumazet, Florian Fainelli, Jakub Kicinski, Jose Abreu,
	Justin Chen, linux-arm-kernel, linux-stm32, Maxime Coquelin,
	netdev, NXP Linux Team, Paolo Abeni, Shenwei Wang,
	Vladimir Oltean, Wei Fang

On Fri, Feb 02, 2024 at 09:34:00AM +0000, Russell King (Oracle) wrote:
> bcmgenet_get_eee() sets edata->eee_active and edata->eee_enabled from
> its own copy, and then calls phy_ethtool_get_eee() which in turn will
> call genphy_c45_ethtool_get_eee().
> 
> genphy_c45_ethtool_get_eee() will overwrite eee_enabled and eee_active
> with its own interpretation from the PHYs settings and negotiation
> result.
> 
> Therefore, setting these members in bcmgenet_get_eee() is redundant,
> and can be removed. This also makes priv->eee.eee_active unnecessary,
> so remove this and use a local variable where appropriate.
> 
> Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>

Reviewed-by: Andrew Lunn <andrew@lunn.ch>

    Andrew

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH net-next 5/6] net: bcmasp: remove eee_enabled/eee_active in bcmasp_get_eee()
  2024-02-02  9:34 ` [PATCH net-next 5/6] net: bcmasp: remove eee_enabled/eee_active in bcmasp_get_eee() Russell King (Oracle)
@ 2024-02-02 13:26   ` Andrew Lunn
  2024-02-03  1:18   ` Florian Fainelli
  1 sibling, 0 replies; 20+ messages in thread
From: Andrew Lunn @ 2024-02-02 13:26 UTC (permalink / raw)
  To: Russell King (Oracle)
  Cc: Heiner Kallweit, Alexandre Torgue, bcm-kernel-feedback-list,
	Byungho An, Clark Wang, David S. Miller, Doug Berger,
	Eric Dumazet, Florian Fainelli, Jakub Kicinski, Jose Abreu,
	Justin Chen, linux-arm-kernel, linux-stm32, Maxime Coquelin,
	netdev, NXP Linux Team, Paolo Abeni, Shenwei Wang,
	Vladimir Oltean, Wei Fang

On Fri, Feb 02, 2024 at 09:34:05AM +0000, Russell King (Oracle) wrote:
> bcmasp_get_eee() sets edata->eee_active and edata->eee_enabled from
> its own copy, and then calls phy_ethtool_get_eee() which in turn will
> call genphy_c45_ethtool_get_eee().
> 
> genphy_c45_ethtool_get_eee() will overwrite eee_enabled and eee_active
> with its own interpretation from the PHYs settings and negotiation
> result.
> 
> Therefore, setting these members in bcmasp_get_eee() is redundant, and
> can be removed. This also makes intf->eee.eee_active unnecessary, so
> remove this and use a local variable where appropriate.
> 
> Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>

Reviewed-by: Andrew Lunn <andrew@lunn.ch>

    Andrew

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH net-next 6/6] net: dsa: b53: remove eee_enabled/eee_active in b53_get_mac_eee()
  2024-02-02  9:34 ` [PATCH net-next 6/6] net: dsa: b53: remove eee_enabled/eee_active in b53_get_mac_eee() Russell King (Oracle)
@ 2024-02-02 13:27   ` Andrew Lunn
  2024-02-03  1:22   ` Florian Fainelli
  1 sibling, 0 replies; 20+ messages in thread
From: Andrew Lunn @ 2024-02-02 13:27 UTC (permalink / raw)
  To: Russell King (Oracle)
  Cc: Heiner Kallweit, Alexandre Torgue, bcm-kernel-feedback-list,
	Byungho An, Clark Wang, David S. Miller, Doug Berger,
	Eric Dumazet, Florian Fainelli, Jakub Kicinski, Jose Abreu,
	Justin Chen, linux-arm-kernel, linux-stm32, Maxime Coquelin,
	netdev, NXP Linux Team, Paolo Abeni, Shenwei Wang,
	Vladimir Oltean, Wei Fang

On Fri, Feb 02, 2024 at 09:34:10AM +0000, Russell King (Oracle) wrote:
> b53_get_mac_eee() sets both eee_enabled and eee_active, and then
> returns zero.
> 
> dsa_slave_get_eee(), which calls this function, will then continue to
> call phylink_ethtool_get_eee(), which will return -EOPNOTSUPP if there
> is no PHY present, otherwise calling phy_ethtool_get_eee() which in
> turn will call genphy_c45_ethtool_get_eee().
> 
> genphy_c45_ethtool_get_eee() will overwrite eee_enabled and eee_active
> with its own interpretation from the PHYs settings and negotiation
> result.
> 
> Thus, when there is no PHY, dsa_slave_get_eee() will fail with
> -EOPNOTSUPP, meaning eee_enabled and eee_active will not be returned to
> userspace. When there is a PHY, eee_enabled and eee_active will be
> overwritten by phylib, making the setting of these members in
> b53_get_mac_eee() entirely unnecessary.
> 
> Remove this code, thus simplifying b53_get_mac_eee().
> 
> Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>

Reviewed-by: Andrew Lunn <andrew@lunn.ch>

    Andrew

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH net-next 3/6] net: fec: remove eee_enabled/eee_active in fec_enet_get_eee()
  2024-02-02 13:22   ` Andrew Lunn
@ 2024-02-02 13:45     ` Russell King (Oracle)
  0 siblings, 0 replies; 20+ messages in thread
From: Russell King (Oracle) @ 2024-02-02 13:45 UTC (permalink / raw)
  To: Andrew Lunn
  Cc: g, Heiner Kallweit, Alexandre Torgue, bcm-kernel-feedback-list,
	Byungho An, Clark Wang, David S. Miller, Doug Berger,
	Eric Dumazet, Florian Fainelli, Jakub Kicinski, Jose Abreu,
	Justin Chen, linux-arm-kernel, linux-stm32, Maxime Coquelin,
	netdev, NXP Linux Team, Paolo Abeni, Shenwei Wang,
	Vladimir Oltean, Wei Fang

On Fri, Feb 02, 2024 at 02:22:02PM +0100, Andrew Lunn wrote:
> On Fri, Feb 02, 2024 at 09:33:54AM +0000, Russell King (Oracle) wrote:
> > fec_enet_get_eee() sets edata->eee_active and edata->eee_enabled from
> > its own copy, and then calls phy_ethtool_get_eee() which in turn will
> > call genphy_c45_ethtool_get_eee().
> > 
> > genphy_c45_ethtool_get_eee() will overwrite eee_enabled and eee_active
> > with its own interpretation from the PHYs settings and negotiation
> > result.
> > 
> > Therefore, setting these members in fec_enet_get_eee() is redundant.
> > Remove this, and remove the setting of fep->eee.eee_active member which
> > becomes a write-only variable.
> 
> I _think_ p->eee_enabled becomes write only as well?

Thanks for spotting, I'll remove it in v2!

-- 
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH net-next 4/6] net: bcmgenet: remove eee_enabled/eee_active in bcmgenet_get_eee()
  2024-02-02  9:34 ` [PATCH net-next 4/6] net: bcmgenet: remove eee_enabled/eee_active in bcmgenet_get_eee() Russell King (Oracle)
  2024-02-02 13:25   ` Andrew Lunn
@ 2024-02-03  1:17   ` Florian Fainelli
  2024-02-03  1:21     ` Florian Fainelli
  1 sibling, 1 reply; 20+ messages in thread
From: Florian Fainelli @ 2024-02-03  1:17 UTC (permalink / raw)
  To: Russell King (Oracle), Andrew Lunn, Heiner Kallweit
  Cc: Alexandre Torgue, bcm-kernel-feedback-list, Byungho An,
	Clark Wang, David S. Miller, Doug Berger, Eric Dumazet,
	Jakub Kicinski, Jose Abreu, Justin Chen, linux-arm-kernel,
	linux-stm32, Maxime Coquelin, netdev, NXP Linux Team, Paolo Abeni,
	Shenwei Wang, Vladimir Oltean, Wei Fang

[-- Attachment #1: Type: text/plain, Size: 879 bytes --]



On 2/2/2024 1:34 AM, Russell King (Oracle) wrote:
> bcmgenet_get_eee() sets edata->eee_active and edata->eee_enabled from
> its own copy, and then calls phy_ethtool_get_eee() which in turn will
> call genphy_c45_ethtool_get_eee().
> 
> genphy_c45_ethtool_get_eee() will overwrite eee_enabled and eee_active
> with its own interpretation from the PHYs settings and negotiation
> result.
> 
> Therefore, setting these members in bcmgenet_get_eee() is redundant,
> and can be removed. This also makes priv->eee.eee_active unnecessary,
> so remove this and use a local variable where appropriate.
> 
> Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>

Reviewed-by: Florian Fainelli <florian.fainelli@broadcom.com>

Is not there an opportunity for no longer overriding eee_enabled as well 
since genphy_c45_ethtool_get_eee() will set that variable too?
-- 
Florian

[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 4221 bytes --]

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH net-next 5/6] net: bcmasp: remove eee_enabled/eee_active in bcmasp_get_eee()
  2024-02-02  9:34 ` [PATCH net-next 5/6] net: bcmasp: remove eee_enabled/eee_active in bcmasp_get_eee() Russell King (Oracle)
  2024-02-02 13:26   ` Andrew Lunn
@ 2024-02-03  1:18   ` Florian Fainelli
  1 sibling, 0 replies; 20+ messages in thread
From: Florian Fainelli @ 2024-02-03  1:18 UTC (permalink / raw)
  To: Russell King (Oracle), Andrew Lunn, Heiner Kallweit
  Cc: Alexandre Torgue, bcm-kernel-feedback-list, Byungho An,
	Clark Wang, David S. Miller, Doug Berger, Eric Dumazet,
	Jakub Kicinski, Jose Abreu, Justin Chen, linux-arm-kernel,
	linux-stm32, Maxime Coquelin, netdev, NXP Linux Team, Paolo Abeni,
	Shenwei Wang, Vladimir Oltean, Wei Fang

[-- Attachment #1: Type: text/plain, Size: 737 bytes --]



On 2/2/2024 1:34 AM, Russell King (Oracle) wrote:
> bcmasp_get_eee() sets edata->eee_active and edata->eee_enabled from
> its own copy, and then calls phy_ethtool_get_eee() which in turn will
> call genphy_c45_ethtool_get_eee().
> 
> genphy_c45_ethtool_get_eee() will overwrite eee_enabled and eee_active
> with its own interpretation from the PHYs settings and negotiation
> result.
> 
> Therefore, setting these members in bcmasp_get_eee() is redundant, and
> can be removed. This also makes intf->eee.eee_active unnecessary, so
> remove this and use a local variable where appropriate.
> 
> Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>

Reviewed-by: Florian Fainelli <florian.fainelli@broadcom.com>
-- 
Florian

[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 4221 bytes --]

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH net-next 4/6] net: bcmgenet: remove eee_enabled/eee_active in bcmgenet_get_eee()
  2024-02-03  1:17   ` Florian Fainelli
@ 2024-02-03  1:21     ` Florian Fainelli
  2024-02-04 12:02       ` Russell King (Oracle)
  0 siblings, 1 reply; 20+ messages in thread
From: Florian Fainelli @ 2024-02-03  1:21 UTC (permalink / raw)
  To: Russell King (Oracle), Andrew Lunn, Heiner Kallweit
  Cc: Alexandre Torgue, bcm-kernel-feedback-list, Byungho An,
	Clark Wang, David S. Miller, Doug Berger, Eric Dumazet,
	Jakub Kicinski, Jose Abreu, Justin Chen, linux-arm-kernel,
	linux-stm32, Maxime Coquelin, netdev, NXP Linux Team, Paolo Abeni,
	Shenwei Wang, Vladimir Oltean, Wei Fang

[-- Attachment #1: Type: text/plain, Size: 1007 bytes --]



On 2/2/2024 5:17 PM, Florian Fainelli wrote:
> 
> 
> On 2/2/2024 1:34 AM, Russell King (Oracle) wrote:
>> bcmgenet_get_eee() sets edata->eee_active and edata->eee_enabled from
>> its own copy, and then calls phy_ethtool_get_eee() which in turn will
>> call genphy_c45_ethtool_get_eee().
>>
>> genphy_c45_ethtool_get_eee() will overwrite eee_enabled and eee_active
>> with its own interpretation from the PHYs settings and negotiation
>> result.
>>
>> Therefore, setting these members in bcmgenet_get_eee() is redundant,
>> and can be removed. This also makes priv->eee.eee_active unnecessary,
>> so remove this and use a local variable where appropriate.
>>
>> Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
> 
> Reviewed-by: Florian Fainelli <florian.fainelli@broadcom.com>
> 
> Is not there an opportunity for no longer overriding eee_enabled as well 
> since genphy_c45_ethtool_get_eee() will set that variable too?

Scratch that comment, you are doing it in the getter.
-- 
Florian

[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 4221 bytes --]

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH net-next 6/6] net: dsa: b53: remove eee_enabled/eee_active in b53_get_mac_eee()
  2024-02-02  9:34 ` [PATCH net-next 6/6] net: dsa: b53: remove eee_enabled/eee_active in b53_get_mac_eee() Russell King (Oracle)
  2024-02-02 13:27   ` Andrew Lunn
@ 2024-02-03  1:22   ` Florian Fainelli
  1 sibling, 0 replies; 20+ messages in thread
From: Florian Fainelli @ 2024-02-03  1:22 UTC (permalink / raw)
  To: Russell King (Oracle), Andrew Lunn, Heiner Kallweit
  Cc: Alexandre Torgue, bcm-kernel-feedback-list, Byungho An,
	Clark Wang, David S. Miller, Doug Berger, Eric Dumazet,
	Jakub Kicinski, Jose Abreu, Justin Chen, linux-arm-kernel,
	linux-stm32, Maxime Coquelin, netdev, NXP Linux Team, Paolo Abeni,
	Shenwei Wang, Vladimir Oltean, Wei Fang

[-- Attachment #1: Type: text/plain, Size: 1077 bytes --]



On 2/2/2024 1:34 AM, Russell King (Oracle) wrote:
> b53_get_mac_eee() sets both eee_enabled and eee_active, and then
> returns zero.
> 
> dsa_slave_get_eee(), which calls this function, will then continue to
> call phylink_ethtool_get_eee(), which will return -EOPNOTSUPP if there
> is no PHY present, otherwise calling phy_ethtool_get_eee() which in
> turn will call genphy_c45_ethtool_get_eee().
> 
> genphy_c45_ethtool_get_eee() will overwrite eee_enabled and eee_active
> with its own interpretation from the PHYs settings and negotiation
> result.
> 
> Thus, when there is no PHY, dsa_slave_get_eee() will fail with
> -EOPNOTSUPP, meaning eee_enabled and eee_active will not be returned to
> userspace. When there is a PHY, eee_enabled and eee_active will be
> overwritten by phylib, making the setting of these members in
> b53_get_mac_eee() entirely unnecessary.
> 
> Remove this code, thus simplifying b53_get_mac_eee().
> 
> Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>

Reviewed-by: Florian Fainelli <florian.fainelli@broadcom.com>
-- 
Florian

[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 4221 bytes --]

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH net-next 1/6] net: stmmac: remove eee_enabled/eee_active in stmmac_ethtool_op_get_eee()
  2024-02-02  9:33 ` [PATCH net-next 1/6] net: stmmac: remove eee_enabled/eee_active in stmmac_ethtool_op_get_eee() Russell King (Oracle)
  2024-02-02 13:15   ` Andrew Lunn
@ 2024-02-03  1:22   ` Florian Fainelli
  1 sibling, 0 replies; 20+ messages in thread
From: Florian Fainelli @ 2024-02-03  1:22 UTC (permalink / raw)
  To: Russell King (Oracle), Andrew Lunn, Heiner Kallweit
  Cc: Alexandre Torgue, bcm-kernel-feedback-list, Byungho An,
	Clark Wang, David S. Miller, Doug Berger, Eric Dumazet,
	Jakub Kicinski, Jose Abreu, Justin Chen, linux-arm-kernel,
	linux-stm32, Maxime Coquelin, netdev, NXP Linux Team, Paolo Abeni,
	Shenwei Wang, Vladimir Oltean, Wei Fang

[-- Attachment #1: Type: text/plain, Size: 1060 bytes --]



On 2/2/2024 1:33 AM, Russell King (Oracle) wrote:
> stmmac_ethtool_op_get_eee() sets both eee_enabled and eee_active, and
> then goes on to call phylink_ethtool_get_eee().
> 
> phylink_ethtool_get_eee() will return -EOPNOTSUPP if there is no PHY
> present, otherwise calling phy_ethtool_get_eee() which in turn will call
> genphy_c45_ethtool_get_eee().
> 
> genphy_c45_ethtool_get_eee() will overwrite eee_enabled and eee_active
> with its own interpretation from the PHYs settings and negotiation
> result.
> 
> Thus, when there is no PHY, stmmac_ethtool_op_get_eee() will fail with
> -EOPNOTSUPP, meaning eee_enabled and eee_active will not be returned to
> userspace. When there is a PHY, eee_enabled and eee_active will be
> overwritten by phylib, making the setting of these members in
> stmmac_ethtool_op_get_eee() entirely unnecessary.
> 
> Remove this code, thus simplifying stmmac_ethtool_op_get_eee().
> 
> Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>

Reviewed-by: Florian Fainelli <florian.fainelli@broadcom.com>
-- 
Florian

[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 4221 bytes --]

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH net-next 4/6] net: bcmgenet: remove eee_enabled/eee_active in bcmgenet_get_eee()
  2024-02-03  1:21     ` Florian Fainelli
@ 2024-02-04 12:02       ` Russell King (Oracle)
  0 siblings, 0 replies; 20+ messages in thread
From: Russell King (Oracle) @ 2024-02-04 12:02 UTC (permalink / raw)
  To: Florian Fainelli
  Cc: Andrew Lunn, Heiner Kallweit, Alexandre Torgue,
	bcm-kernel-feedback-list, Byungho An, Clark Wang, David S. Miller,
	Doug Berger, Eric Dumazet, Jakub Kicinski, Jose Abreu,
	Justin Chen, linux-arm-kernel, linux-stm32, Maxime Coquelin,
	netdev, NXP Linux Team, Paolo Abeni, Shenwei Wang,
	Vladimir Oltean, Wei Fang

On Fri, Feb 02, 2024 at 05:21:57PM -0800, Florian Fainelli wrote:
> 
> 
> On 2/2/2024 5:17 PM, Florian Fainelli wrote:
> > 
> > 
> > On 2/2/2024 1:34 AM, Russell King (Oracle) wrote:
> > > bcmgenet_get_eee() sets edata->eee_active and edata->eee_enabled from
> > > its own copy, and then calls phy_ethtool_get_eee() which in turn will
> > > call genphy_c45_ethtool_get_eee().
> > > 
> > > genphy_c45_ethtool_get_eee() will overwrite eee_enabled and eee_active
> > > with its own interpretation from the PHYs settings and negotiation
> > > result.
> > > 
> > > Therefore, setting these members in bcmgenet_get_eee() is redundant,
> > > and can be removed. This also makes priv->eee.eee_active unnecessary,
> > > so remove this and use a local variable where appropriate.
> > > 
> > > Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
> > 
> > Reviewed-by: Florian Fainelli <florian.fainelli@broadcom.com>
> > 
> > Is not there an opportunity for no longer overriding eee_enabled as well
> > since genphy_c45_ethtool_get_eee() will set that variable too?
> 
> Scratch that comment, you are doing it in the getter.

Also, priv->eee.eee_enabled is used in bcmmii.c, so we can't get rid of
it in the setter.

-- 
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!

^ permalink raw reply	[flat|nested] 20+ messages in thread

end of thread, other threads:[~2024-02-04 12:02 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-02-02  9:33 [PATCH net-next 0/6] net: eee network driver cleanups Russell King (Oracle)
2024-02-02  9:33 ` [PATCH net-next 1/6] net: stmmac: remove eee_enabled/eee_active in stmmac_ethtool_op_get_eee() Russell King (Oracle)
2024-02-02 13:15   ` Andrew Lunn
2024-02-03  1:22   ` Florian Fainelli
2024-02-02  9:33 ` [PATCH net-next 2/6] net: sxgbe: remove eee_enabled/eee_active in sxgbe_get_eee() Russell King (Oracle)
2024-02-02 13:18   ` Andrew Lunn
2024-02-02  9:33 ` [PATCH net-next 3/6] net: fec: remove eee_enabled/eee_active in fec_enet_get_eee() Russell King (Oracle)
2024-02-02 13:22   ` Andrew Lunn
2024-02-02 13:45     ` Russell King (Oracle)
2024-02-02  9:34 ` [PATCH net-next 4/6] net: bcmgenet: remove eee_enabled/eee_active in bcmgenet_get_eee() Russell King (Oracle)
2024-02-02 13:25   ` Andrew Lunn
2024-02-03  1:17   ` Florian Fainelli
2024-02-03  1:21     ` Florian Fainelli
2024-02-04 12:02       ` Russell King (Oracle)
2024-02-02  9:34 ` [PATCH net-next 5/6] net: bcmasp: remove eee_enabled/eee_active in bcmasp_get_eee() Russell King (Oracle)
2024-02-02 13:26   ` Andrew Lunn
2024-02-03  1:18   ` Florian Fainelli
2024-02-02  9:34 ` [PATCH net-next 6/6] net: dsa: b53: remove eee_enabled/eee_active in b53_get_mac_eee() Russell King (Oracle)
2024-02-02 13:27   ` Andrew Lunn
2024-02-03  1:22   ` Florian Fainelli

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).