* [PATCH net-next] net: fec: use phydev->eee_cfg.tx_lpi_timer
@ 2024-12-10 12:38 Russell King (Oracle)
2024-12-10 12:39 ` Russell King (Oracle)
2024-12-12 4:30 ` patchwork-bot+netdevbpf
0 siblings, 2 replies; 5+ messages in thread
From: Russell King (Oracle) @ 2024-12-10 12:38 UTC (permalink / raw)
To: Andrew Lunn, Heiner Kallweit
Cc: Wei Fang, Shenwei Wang, Clark Wang, Andrew Lunn, David S. Miller,
Eric Dumazet, Jakub Kicinski, Paolo Abeni, imx, netdev
Rather than maintaining a private copy of the LPI timer, make use of
the LPI timer maintained by phylib. In any case, phylib overwrites the
value of tx_lpi_timer set by the driver in phy_ethtool_get_eee().
Note that feb->eee.tx_lpi_timer is initialised to zero, which is just
the same with phylib's copy, so there should be no functional change.
Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
---
drivers/net/ethernet/freescale/fec.h | 2 --
drivers/net/ethernet/freescale/fec_main.c | 16 ++++++----------
2 files changed, 6 insertions(+), 12 deletions(-)
diff --git a/drivers/net/ethernet/freescale/fec.h b/drivers/net/ethernet/freescale/fec.h
index 1cca0425d493..c81f2ea588f2 100644
--- a/drivers/net/ethernet/freescale/fec.h
+++ b/drivers/net/ethernet/freescale/fec.h
@@ -671,8 +671,6 @@ struct fec_enet_private {
unsigned int tx_time_itr;
unsigned int itr_clk_rate;
- /* tx lpi eee mode */
- struct ethtool_keee eee;
unsigned int clk_ref_rate;
/* ptp clock period in ns*/
diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c
index 1b55047c0237..b2daed55bf6c 100644
--- a/drivers/net/ethernet/freescale/fec_main.c
+++ b/drivers/net/ethernet/freescale/fec_main.c
@@ -2045,14 +2045,14 @@ static int fec_enet_us_to_tx_cycle(struct net_device *ndev, int us)
return us * (fep->clk_ref_rate / 1000) / 1000;
}
-static int fec_enet_eee_mode_set(struct net_device *ndev, bool enable)
+static int fec_enet_eee_mode_set(struct net_device *ndev, u32 lpi_timer,
+ bool enable)
{
struct fec_enet_private *fep = netdev_priv(ndev);
- struct ethtool_keee *p = &fep->eee;
unsigned int sleep_cycle, wake_cycle;
if (enable) {
- sleep_cycle = fec_enet_us_to_tx_cycle(ndev, p->tx_lpi_timer);
+ sleep_cycle = fec_enet_us_to_tx_cycle(ndev, lpi_timer);
wake_cycle = sleep_cycle;
} else {
sleep_cycle = 0;
@@ -2105,7 +2105,9 @@ static void fec_enet_adjust_link(struct net_device *ndev)
napi_enable(&fep->napi);
}
if (fep->quirks & FEC_QUIRK_HAS_EEE)
- fec_enet_eee_mode_set(ndev, phy_dev->enable_tx_lpi);
+ fec_enet_eee_mode_set(ndev,
+ phy_dev->eee_cfg.tx_lpi_timer,
+ phy_dev->enable_tx_lpi);
} else {
if (fep->link) {
netif_stop_queue(ndev);
@@ -3181,7 +3183,6 @@ static int
fec_enet_get_eee(struct net_device *ndev, struct ethtool_keee *edata)
{
struct fec_enet_private *fep = netdev_priv(ndev);
- struct ethtool_keee *p = &fep->eee;
if (!(fep->quirks & FEC_QUIRK_HAS_EEE))
return -EOPNOTSUPP;
@@ -3189,8 +3190,6 @@ fec_enet_get_eee(struct net_device *ndev, struct ethtool_keee *edata)
if (!netif_running(ndev))
return -ENETDOWN;
- edata->tx_lpi_timer = p->tx_lpi_timer;
-
return phy_ethtool_get_eee(ndev->phydev, edata);
}
@@ -3198,7 +3197,6 @@ static int
fec_enet_set_eee(struct net_device *ndev, struct ethtool_keee *edata)
{
struct fec_enet_private *fep = netdev_priv(ndev);
- struct ethtool_keee *p = &fep->eee;
if (!(fep->quirks & FEC_QUIRK_HAS_EEE))
return -EOPNOTSUPP;
@@ -3206,8 +3204,6 @@ fec_enet_set_eee(struct net_device *ndev, struct ethtool_keee *edata)
if (!netif_running(ndev))
return -ENETDOWN;
- p->tx_lpi_timer = edata->tx_lpi_timer;
-
return phy_ethtool_set_eee(ndev->phydev, edata);
}
--
2.30.2
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH net-next] net: fec: use phydev->eee_cfg.tx_lpi_timer
2024-12-10 12:38 [PATCH net-next] net: fec: use phydev->eee_cfg.tx_lpi_timer Russell King (Oracle)
@ 2024-12-10 12:39 ` Russell King (Oracle)
2024-12-10 13:44 ` Andrew Lunn
2024-12-11 2:27 ` Wei Fang
2024-12-12 4:30 ` patchwork-bot+netdevbpf
1 sibling, 2 replies; 5+ messages in thread
From: Russell King (Oracle) @ 2024-12-10 12:39 UTC (permalink / raw)
To: Andrew Lunn, Heiner Kallweit
Cc: Wei Fang, Shenwei Wang, Clark Wang, Andrew Lunn, David S. Miller,
Eric Dumazet, Jakub Kicinski, Paolo Abeni, imx, netdev
On Tue, Dec 10, 2024 at 12:38:26PM +0000, Russell King (Oracle) wrote:
> Rather than maintaining a private copy of the LPI timer, make use of
> the LPI timer maintained by phylib. In any case, phylib overwrites the
> value of tx_lpi_timer set by the driver in phy_ethtool_get_eee().
>
> Note that feb->eee.tx_lpi_timer is initialised to zero, which is just
> the same with phylib's copy, so there should be no functional change.
>
> Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Note that this need testing on compatible hardware - I only have iMX6
which doesn't have EEE support in FEC.
I'm particularly interested in any change of output from
# ethtool --show-eee $if
with/without this patch. Also testing that it doesn't cause any
regression.
Thanks.
> ---
> drivers/net/ethernet/freescale/fec.h | 2 --
> drivers/net/ethernet/freescale/fec_main.c | 16 ++++++----------
> 2 files changed, 6 insertions(+), 12 deletions(-)
>
> diff --git a/drivers/net/ethernet/freescale/fec.h b/drivers/net/ethernet/freescale/fec.h
> index 1cca0425d493..c81f2ea588f2 100644
> --- a/drivers/net/ethernet/freescale/fec.h
> +++ b/drivers/net/ethernet/freescale/fec.h
> @@ -671,8 +671,6 @@ struct fec_enet_private {
> unsigned int tx_time_itr;
> unsigned int itr_clk_rate;
>
> - /* tx lpi eee mode */
> - struct ethtool_keee eee;
> unsigned int clk_ref_rate;
>
> /* ptp clock period in ns*/
> diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c
> index 1b55047c0237..b2daed55bf6c 100644
> --- a/drivers/net/ethernet/freescale/fec_main.c
> +++ b/drivers/net/ethernet/freescale/fec_main.c
> @@ -2045,14 +2045,14 @@ static int fec_enet_us_to_tx_cycle(struct net_device *ndev, int us)
> return us * (fep->clk_ref_rate / 1000) / 1000;
> }
>
> -static int fec_enet_eee_mode_set(struct net_device *ndev, bool enable)
> +static int fec_enet_eee_mode_set(struct net_device *ndev, u32 lpi_timer,
> + bool enable)
> {
> struct fec_enet_private *fep = netdev_priv(ndev);
> - struct ethtool_keee *p = &fep->eee;
> unsigned int sleep_cycle, wake_cycle;
>
> if (enable) {
> - sleep_cycle = fec_enet_us_to_tx_cycle(ndev, p->tx_lpi_timer);
> + sleep_cycle = fec_enet_us_to_tx_cycle(ndev, lpi_timer);
> wake_cycle = sleep_cycle;
> } else {
> sleep_cycle = 0;
> @@ -2105,7 +2105,9 @@ static void fec_enet_adjust_link(struct net_device *ndev)
> napi_enable(&fep->napi);
> }
> if (fep->quirks & FEC_QUIRK_HAS_EEE)
> - fec_enet_eee_mode_set(ndev, phy_dev->enable_tx_lpi);
> + fec_enet_eee_mode_set(ndev,
> + phy_dev->eee_cfg.tx_lpi_timer,
> + phy_dev->enable_tx_lpi);
> } else {
> if (fep->link) {
> netif_stop_queue(ndev);
> @@ -3181,7 +3183,6 @@ static int
> fec_enet_get_eee(struct net_device *ndev, struct ethtool_keee *edata)
> {
> struct fec_enet_private *fep = netdev_priv(ndev);
> - struct ethtool_keee *p = &fep->eee;
>
> if (!(fep->quirks & FEC_QUIRK_HAS_EEE))
> return -EOPNOTSUPP;
> @@ -3189,8 +3190,6 @@ fec_enet_get_eee(struct net_device *ndev, struct ethtool_keee *edata)
> if (!netif_running(ndev))
> return -ENETDOWN;
>
> - edata->tx_lpi_timer = p->tx_lpi_timer;
> -
> return phy_ethtool_get_eee(ndev->phydev, edata);
> }
>
> @@ -3198,7 +3197,6 @@ static int
> fec_enet_set_eee(struct net_device *ndev, struct ethtool_keee *edata)
> {
> struct fec_enet_private *fep = netdev_priv(ndev);
> - struct ethtool_keee *p = &fep->eee;
>
> if (!(fep->quirks & FEC_QUIRK_HAS_EEE))
> return -EOPNOTSUPP;
> @@ -3206,8 +3204,6 @@ fec_enet_set_eee(struct net_device *ndev, struct ethtool_keee *edata)
> if (!netif_running(ndev))
> return -ENETDOWN;
>
> - p->tx_lpi_timer = edata->tx_lpi_timer;
> -
> return phy_ethtool_set_eee(ndev->phydev, edata);
> }
>
> --
> 2.30.2
>
>
--
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] 5+ messages in thread
* Re: [PATCH net-next] net: fec: use phydev->eee_cfg.tx_lpi_timer
2024-12-10 12:39 ` Russell King (Oracle)
@ 2024-12-10 13:44 ` Andrew Lunn
2024-12-11 2:27 ` Wei Fang
1 sibling, 0 replies; 5+ messages in thread
From: Andrew Lunn @ 2024-12-10 13:44 UTC (permalink / raw)
To: Russell King (Oracle)
Cc: Heiner Kallweit, Wei Fang, Shenwei Wang, Clark Wang, Andrew Lunn,
David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni, imx,
netdev
On Tue, Dec 10, 2024 at 12:39:53PM +0000, Russell King (Oracle) wrote:
> On Tue, Dec 10, 2024 at 12:38:26PM +0000, Russell King (Oracle) wrote:
> > Rather than maintaining a private copy of the LPI timer, make use of
> > the LPI timer maintained by phylib. In any case, phylib overwrites the
> > value of tx_lpi_timer set by the driver in phy_ethtool_get_eee().
> >
> > Note that feb->eee.tx_lpi_timer is initialised to zero, which is just
> > the same with phylib's copy, so there should be no functional change.
> >
> > Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
>
> Note that this need testing on compatible hardware - I only have iMX6
> which doesn't have EEE support in FEC.
The FEC hardware i have does not have EEE either. Sorry.
Andrew
^ permalink raw reply [flat|nested] 5+ messages in thread
* RE: [PATCH net-next] net: fec: use phydev->eee_cfg.tx_lpi_timer
2024-12-10 12:39 ` Russell King (Oracle)
2024-12-10 13:44 ` Andrew Lunn
@ 2024-12-11 2:27 ` Wei Fang
1 sibling, 0 replies; 5+ messages in thread
From: Wei Fang @ 2024-12-11 2:27 UTC (permalink / raw)
To: Russell King
Cc: Shenwei Wang, Clark Wang, Andrew Lunn, David S. Miller,
Eric Dumazet, Jakub Kicinski, Paolo Abeni, imx@lists.linux.dev,
netdev@vger.kernel.org, Andrew Lunn, Heiner Kallweit
> On Tue, Dec 10, 2024 at 12:38:26PM +0000, Russell King (Oracle) wrote:
> > Rather than maintaining a private copy of the LPI timer, make use of
> > the LPI timer maintained by phylib. In any case, phylib overwrites the
> > value of tx_lpi_timer set by the driver in phy_ethtool_get_eee().
> >
> > Note that feb->eee.tx_lpi_timer is initialised to zero, which is just
> > the same with phylib's copy, so there should be no functional change.
> >
> > Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
>
> Note that this need testing on compatible hardware - I only have iMX6 which
> doesn't have EEE support in FEC.
>
> I'm particularly interested in any change of output from
>
> # ethtool --show-eee $if
>
> with/without this patch. Also testing that it doesn't cause any regression.
>
> Thanks.
>
Hi Russell,
There are no changes after applying this patch.
Before:
root@imx8mqevk:~# ethtool --show-eee eth0
EEE settings for eth0:
EEE status: enabled - active
Tx LPI: 0 (us)
Supported EEE link modes: 100baseT/Full
1000baseT/Full
Advertised EEE link modes: 100baseT/Full
1000baseT/Full
Link partner advertised EEE link modes: 100baseT/Full
1000baseT/Full
root@imx8mqevk:~# ethtool --set-eee eth0 eee on tx-lpi on tx-timer 5000
root@imx8mqevk:~# ethtool --show-eee eth0
EEE settings for eth0:
EEE status: enabled - active
Tx LPI: 5000 (us)
Supported EEE link modes: 100baseT/Full
1000baseT/Full
Advertised EEE link modes: 100baseT/Full
1000baseT/Full
Link partner advertised EEE link modes: 100baseT/Full
1000baseT/Full
After applying the patch:
root@imx8mqevk:~# ethtool --show-eee eth0
EEE settings for eth0:
EEE status: enabled - active
Tx LPI: 0 (us)
Supported EEE link modes: 100baseT/Full
1000baseT/Full
Advertised EEE link modes: 100baseT/Full
1000baseT/Full
Link partner advertised EEE link modes: 100baseT/Full
1000baseT/Full
root@imx8mqevk:~# ethtool --set-eee eth0 eee on tx-lpi on tx-timer 5000
root@imx8mqevk:~# ethtool --show-eee eth0
EEE settings for eth0:
EEE status: enabled - active
Tx LPI: 5000 (us)
Supported EEE link modes: 100baseT/Full
1000baseT/Full
Advertised EEE link modes: 100baseT/Full
1000baseT/Full
Link partner advertised EEE link modes: 100baseT/Full
1000baseT/Full
So,
Tested-by: Wei Fang <wei.fang@nxp.com>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH net-next] net: fec: use phydev->eee_cfg.tx_lpi_timer
2024-12-10 12:38 [PATCH net-next] net: fec: use phydev->eee_cfg.tx_lpi_timer Russell King (Oracle)
2024-12-10 12:39 ` Russell King (Oracle)
@ 2024-12-12 4:30 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 5+ messages in thread
From: patchwork-bot+netdevbpf @ 2024-12-12 4:30 UTC (permalink / raw)
To: Russell King
Cc: andrew, hkallweit1, wei.fang, shenwei.wang, xiaoning.wang,
andrew+netdev, davem, edumazet, kuba, pabeni, imx, netdev
Hello:
This patch was applied to netdev/net-next.git (main)
by Jakub Kicinski <kuba@kernel.org>:
On Tue, 10 Dec 2024 12:38:26 +0000 you wrote:
> Rather than maintaining a private copy of the LPI timer, make use of
> the LPI timer maintained by phylib. In any case, phylib overwrites the
> value of tx_lpi_timer set by the driver in phy_ethtool_get_eee().
>
> Note that feb->eee.tx_lpi_timer is initialised to zero, which is just
> the same with phylib's copy, so there should be no functional change.
>
> [...]
Here is the summary with links:
- [net-next] net: fec: use phydev->eee_cfg.tx_lpi_timer
https://git.kernel.org/netdev/net-next/c/3fa2540d93d8
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2024-12-12 4:30 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-12-10 12:38 [PATCH net-next] net: fec: use phydev->eee_cfg.tx_lpi_timer Russell King (Oracle)
2024-12-10 12:39 ` Russell King (Oracle)
2024-12-10 13:44 ` Andrew Lunn
2024-12-11 2:27 ` Wei Fang
2024-12-12 4:30 ` patchwork-bot+netdevbpf
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).