* [PATCH RFC net-next 00/23] net: phylink managed EEE support
@ 2024-11-26 12:51 Russell King (Oracle)
2024-11-26 12:52 ` [PATCH RFC net-next 01/23] net: phy: ensure that genphy_c45_an_config_eee_aneg() sees new value of phydev->eee_cfg.eee_enabled Russell King
` (27 more replies)
0 siblings, 28 replies; 39+ messages in thread
From: Russell King (Oracle) @ 2024-11-26 12:51 UTC (permalink / raw)
To: Andrew Lunn, Heiner Kallweit
Cc: Alexandre Torgue, Andrew Lunn, Bryan Whitehead, David S. Miller,
Eric Dumazet, Florian Fainelli, Jakub Kicinski, Jose Abreu,
linux-arm-kernel, linux-stm32, Marcin Wojtas, Maxime Coquelin,
netdev, Oleksij Rempel, Paolo Abeni, UNGLinuxDriver
Hi,
Adding managed EEE support to phylink has been on the cards ever since
the idea in phylib was mooted. This overly large series attempts to do
so. I've included all the patches as it's important to get the driver
patches out there.
In doing this, I came across the fact that the addition of phylib
managed EEE support has actually broken a huge number of drivers -
phylib will now overwrite all members of struct ethtool_keee whether
the netdev driver wants it or not. This leads to weird scenarios where
doing a get_eee() op followed by a set_eee() op results in e.g.
tx_lpi_timer being zeroed, because the MAC driver doesn't know it needs
to initialise phylib's phydev->eee_cfg.tx_lpi_timer member. This mess
really needs urgently addressing, and I believe it came about because
Andrew's patches were only partly merged via another party - I guess
highlighting the inherent danger of "thou shalt limit your patch series
to no more than 15 patches" when one has a subsystem who's in-kernel
API is changing.
I am ignoring that limit for this posting precisely because of this.
I think we need to have a discussion about it, because if it ends up
causing breakage, then we're doing something wrong.
One of the drivers that got broken was stmmac, so this series also
includes a number of patches that fix it before converting stmmac to
phylink managed EEE. I can point to many many more that are similarly
broken.
Also inflating this series are two important patches that have been
submitted for the NET tree, but which aren't yet part of the net-next
tree - thus making this series larger than really necessary. If it
weren't for both of these issues, then this series would be exactly
15 patches.
Anyway, these patches...
Patch 1 and 2 are patches that have been submitted and possibly applied
to the net tree.
Patch 3 changes the Marvell driver to use the state we store in
struct phy_device, rather than manually calling
phydev->eee_cfg.eee_enabled.
Patch 4 avoids genphy_c45_ethtool_get_eee() setting ->eee_enabled, as
we copy that from phydev->eee_cfg.eee_enabled later, and after patch 3
mo one uses this after calling genphy_c45_ethtool_get_eee(). In fact,
the only caller of this function now is phy_ethtool_get_eee().
As all callers to genphy_c45_eee_is_active() now pass NULL as its
is_enabled flag, this is no longer useful. Remove the argument in
patch 5.
Patch 6 updates the phylib documentation to make it absolutely clear
that phy_ethtool_get_eee() now fills in all members of struct
ethtool_keee, which is why we now have so many buggy network drivers.
We need to decide how to fix this mess.
Patch 7 adds a definition for the clock stop capable bit in the PCS
MMD status register.
Patch 8 adds a phylib API to query whether the PHY allows the transmit
xMII clock to be stopped while in LPI mode. This capability is for MAC
drivers to save power when LPI is active, to allow them to stop their
transmit clock.
Patch 9 adds another phylib API to configure whether the receive xMII
clock may be disabled by the PHY. We do have an existing API,
phy_init_eee(), but... it only allows the control bit to be set which
is weird - what if a boot firmware or previous kernel has set this bit
and we want it clear?
Patch 10 finally starts on the phylink parts of this, extracting from
phylink_resolve() the detection of link-up. (Yes, okay, I could've
dropped this patch, but with 23 patches, it's not going to make that
much difference.)
Patch 11 adds phylink managed EEE support. Two new MAC APIs are added,
to enable and disable LPI. The enable method is passed the LPI timer
setting which it is expected to program into the hardware, and also a
flag ehther the transmit clock should be stopped.
*** There are open questions here. Eagle eyed reviewers will notice
pl->config->lpi_interfaces. There are MACs out there which only
support LPI signalling on a subset of their interface types. Phylib
doesn't understand this. I'm handling this at the moment by simply
not activating LPI at the MAC, but that leads to ethtool --show-eee
suggesting that EEE is active when it isn't.
*** Should we pass the phy_interface_t to these functions?
*** Should mac_enable_tx_lpi() be allowed to fail if the MAC doesn't
support the interface mode?
An example of a MAC that this is the case are the Marvell ones - both
NETA and PP2 only support LPI signalling when connected via SGMII,
which makes being connected to a PHY which changes its link mode
problematical.
The remainder of the patches address the driver sides, which are
necessary to actually test this stuff out. The exception are the stmmac
patches.
The first four stmmac patches show what is necessary across many drivers
to fix the current phylib EEE mess.
The 5th stmmac patch makes reporting of EEE errors dependent on whether
EEE is supported by stmmac or not - I can't see why one would want
anything else (maybe someone can enlighten me?)
The 6th stmmac patch converts to use phy_eee_rx_clock_stop(), thereby
ensuring that, if desired, the RX clock will not be stopped by the PHY
when in LPI mode (which as noted above is something that phy_init_eee()
doesn't do.) Given that we know stmmac has issues if the RX clock is
stopped, this could be a bug fix.
The final patch converts stmmac to phylink managed EEE.
drivers/net/ethernet/marvell/mvneta.c | 118 ++++++++++--------
drivers/net/ethernet/marvell/mvpp2/mvpp2.h | 5 +
drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c | 88 ++++++++++++++
drivers/net/ethernet/microchip/lan743x_ethtool.c | 21 ----
drivers/net/ethernet/microchip/lan743x_main.c | 39 ++++--
drivers/net/ethernet/microchip/lan743x_main.h | 1 -
drivers/net/ethernet/stmicro/stmmac/stmmac.h | 1 -
.../net/ethernet/stmicro/stmmac/stmmac_ethtool.c | 25 +---
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 68 ++++++++---
drivers/net/phy/marvell.c | 4 +-
drivers/net/phy/phy-c45.c | 15 +--
drivers/net/phy/phy.c | 106 +++++++++++-----
drivers/net/phy/phylink.c | 134 +++++++++++++++++++--
include/linux/phy.h | 6 +-
include/linux/phylink.h | 44 +++++++
include/uapi/linux/mdio.h | 1 +
16 files changed, 505 insertions(+), 171 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] 39+ messages in thread
* [PATCH RFC net-next 01/23] net: phy: ensure that genphy_c45_an_config_eee_aneg() sees new value of phydev->eee_cfg.eee_enabled
2024-11-26 12:51 [PATCH RFC net-next 00/23] net: phylink managed EEE support Russell King (Oracle)
@ 2024-11-26 12:52 ` Russell King
2024-11-26 12:52 ` [PATCH RFC net-next 02/23] net: phy: fix phy_ethtool_set_eee() incorrectly enabling LPI Russell King (Oracle)
` (26 subsequent siblings)
27 siblings, 0 replies; 39+ messages in thread
From: Russell King @ 2024-11-26 12:52 UTC (permalink / raw)
To: Andrew Lunn, Heiner Kallweit
Cc: Alexandre Torgue, Andrew Lunn, Bryan Whitehead, David S. Miller,
Eric Dumazet, Florian Fainelli, Jakub Kicinski, Jose Abreu,
linux-arm-kernel, linux-stm32, Marcin Wojtas, Maxime Coquelin,
netdev, Oleksij Rempel, Paolo Abeni, UNGLinuxDriver
From: Heiner Kallweit <hkallweit1@gmail.com>
This is a follow-up to 41ffcd95015f ("net: phy: fix phylib's dual
eee_enabled") and resolves an issue with genphy_c45_an_config_eee_aneg()
(called from genphy_c45_ethtool_set_eee) not seeing the new value of
phydev->eee_cfg.eee_enabled.
Fixes: 49168d1980e2 ("net: phy: Add phy_support_eee() indicating MAC support EEE")
Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Reported-by: Choong Yong Liang <yong.liang.choong@linux.intel.com>
Reviewed-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
---
drivers/net/phy/phy.c | 24 ++++++++++++++----------
1 file changed, 14 insertions(+), 10 deletions(-)
diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c
index 4f3e742907cb..a660a80f34b7 100644
--- a/drivers/net/phy/phy.c
+++ b/drivers/net/phy/phy.c
@@ -1672,7 +1672,7 @@ EXPORT_SYMBOL(phy_ethtool_get_eee);
* phy_ethtool_set_eee_noneg - Adjusts MAC LPI configuration without PHY
* renegotiation
* @phydev: pointer to the target PHY device structure
- * @data: pointer to the ethtool_keee structure containing the new EEE settings
+ * @old_cfg: pointer to the eee_config structure containing the old EEE settings
*
* This function updates the Energy Efficient Ethernet (EEE) configuration
* for cases where only the MAC's Low Power Idle (LPI) configuration changes,
@@ -1683,11 +1683,10 @@ EXPORT_SYMBOL(phy_ethtool_get_eee);
* configuration.
*/
static void phy_ethtool_set_eee_noneg(struct phy_device *phydev,
- struct ethtool_keee *data)
+ const struct eee_config *old_cfg)
{
- if (phydev->eee_cfg.tx_lpi_enabled != data->tx_lpi_enabled ||
- phydev->eee_cfg.tx_lpi_timer != data->tx_lpi_timer) {
- eee_to_eeecfg(&phydev->eee_cfg, data);
+ if (phydev->eee_cfg.tx_lpi_enabled != old_cfg->tx_lpi_enabled ||
+ phydev->eee_cfg.tx_lpi_timer != old_cfg->tx_lpi_timer) {
phydev->enable_tx_lpi = eeecfg_mac_can_tx_lpi(&phydev->eee_cfg);
if (phydev->link) {
phydev->link = false;
@@ -1707,18 +1706,23 @@ static void phy_ethtool_set_eee_noneg(struct phy_device *phydev,
*/
int phy_ethtool_set_eee(struct phy_device *phydev, struct ethtool_keee *data)
{
+ struct eee_config old_cfg;
int ret;
if (!phydev->drv)
return -EIO;
mutex_lock(&phydev->lock);
+
+ old_cfg = phydev->eee_cfg;
+ eee_to_eeecfg(&phydev->eee_cfg, data);
+
ret = genphy_c45_ethtool_set_eee(phydev, data);
- if (ret >= 0) {
- if (ret == 0)
- phy_ethtool_set_eee_noneg(phydev, data);
- eee_to_eeecfg(&phydev->eee_cfg, data);
- }
+ if (ret == 0)
+ phy_ethtool_set_eee_noneg(phydev, &old_cfg);
+ else if (ret < 0)
+ phydev->eee_cfg = old_cfg;
+
mutex_unlock(&phydev->lock);
return ret < 0 ? ret : 0;
--
2.30.2
^ permalink raw reply related [flat|nested] 39+ messages in thread
* [PATCH RFC net-next 02/23] net: phy: fix phy_ethtool_set_eee() incorrectly enabling LPI
2024-11-26 12:51 [PATCH RFC net-next 00/23] net: phylink managed EEE support Russell King (Oracle)
2024-11-26 12:52 ` [PATCH RFC net-next 01/23] net: phy: ensure that genphy_c45_an_config_eee_aneg() sees new value of phydev->eee_cfg.eee_enabled Russell King
@ 2024-11-26 12:52 ` Russell King (Oracle)
2024-11-27 11:12 ` Russell King (Oracle)
2024-11-26 12:52 ` [PATCH RFC net-next 03/23] net: phy: marvell: use phydev->eee_cfg.eee_enabled Russell King (Oracle)
` (25 subsequent siblings)
27 siblings, 1 reply; 39+ messages in thread
From: Russell King (Oracle) @ 2024-11-26 12:52 UTC (permalink / raw)
To: Andrew Lunn, Heiner Kallweit
Cc: Alexandre Torgue, Andrew Lunn, Bryan Whitehead, David S. Miller,
Eric Dumazet, Florian Fainelli, Jakub Kicinski, Jose Abreu,
linux-arm-kernel, linux-stm32, Marcin Wojtas, Maxime Coquelin,
netdev, Oleksij Rempel, Paolo Abeni, UNGLinuxDriver
When phy_ethtool_set_eee_noneg() detects a change in the LPI
parameters, it attempts to update phylib state and trigger the link
to cycle so the MAC sees the updated parameters.
However, in doing so, it sets phydev->enable_tx_lpi depending on
whether the EEE configuration allows the MAC to generate LPI without
taking into account the result of negotiation.
This can be demonstrated with a 1000base-T FD interface by:
# ethtool --set-eee eno0 advertise 8 # cause EEE to be not negotiated
# ethtool --set-eee eno0 tx-lpi off
# ethtool --set-eee eno0 tx-lpi on
This results in being true, despite EEE not having been negotiated and:
# ethtool --show-eee eno0
EEE status: enabled - inactive
Tx LPI: 250 (us)
Supported EEE link modes: 100baseT/Full
1000baseT/Full
Advertised EEE link modes: 100baseT/Full
1000baseT/Full
Fix this by keeping track of whether EEE was negotiated via a new
eee_active member in struct phy_device, and include this state in
the decision whether phydev->enable_tx_lpi should be set.
Fixes: 3e43b903da04 ("net: phy: Immediately call adjust_link if only tx_lpi_enabled changes")
Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
---
drivers/net/phy/phy-c45.c | 2 +-
drivers/net/phy/phy.c | 30 ++++++++++++++++++------------
include/linux/phy.h | 2 ++
3 files changed, 21 insertions(+), 13 deletions(-)
diff --git a/drivers/net/phy/phy-c45.c b/drivers/net/phy/phy-c45.c
index 96d0b3a5a9d3..944ae98ad110 100644
--- a/drivers/net/phy/phy-c45.c
+++ b/drivers/net/phy/phy-c45.c
@@ -1530,7 +1530,7 @@ int genphy_c45_ethtool_get_eee(struct phy_device *phydev,
return ret;
data->eee_enabled = is_enabled;
- data->eee_active = ret;
+ data->eee_active = phydev->eee_active;
linkmode_copy(data->supported, phydev->supported_eee);
return 0;
diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c
index a660a80f34b7..0d20b534122b 100644
--- a/drivers/net/phy/phy.c
+++ b/drivers/net/phy/phy.c
@@ -990,14 +990,14 @@ static int phy_check_link_status(struct phy_device *phydev)
phydev->state = PHY_RUNNING;
err = genphy_c45_eee_is_active(phydev,
NULL, NULL, NULL);
- if (err <= 0)
- phydev->enable_tx_lpi = false;
- else
- phydev->enable_tx_lpi = phydev->eee_cfg.tx_lpi_enabled;
+ phydev->eee_active = err > 0;
+ phydev->enable_tx_lpi = phydev->eee_cfg.tx_lpi_enabled &&
+ phydev->eee_active;
phy_link_up(phydev);
} else if (!phydev->link && phydev->state != PHY_NOLINK) {
phydev->state = PHY_NOLINK;
+ phydev->eee_active = false;
phydev->enable_tx_lpi = false;
phy_link_down(phydev);
}
@@ -1685,15 +1685,21 @@ EXPORT_SYMBOL(phy_ethtool_get_eee);
static void phy_ethtool_set_eee_noneg(struct phy_device *phydev,
const struct eee_config *old_cfg)
{
- if (phydev->eee_cfg.tx_lpi_enabled != old_cfg->tx_lpi_enabled ||
+ bool enable_tx_lpi;
+
+ if (!phydev->link)
+ return;
+
+ enable_tx_lpi = phydev->eee_cfg.tx_lpi_enabled && phydev->eee_active;
+
+ if (phydev->enable_tx_lpi != enable_tx_lpi ||
phydev->eee_cfg.tx_lpi_timer != old_cfg->tx_lpi_timer) {
- phydev->enable_tx_lpi = eeecfg_mac_can_tx_lpi(&phydev->eee_cfg);
- if (phydev->link) {
- phydev->link = false;
- phy_link_down(phydev);
- phydev->link = true;
- phy_link_up(phydev);
- }
+ phydev->enable_tx_lpi = false;
+ phydev->link = false;
+ phy_link_down(phydev);
+ phydev->enable_tx_lpi = enable_tx_lpi;
+ phydev->link = true;
+ phy_link_up(phydev);
}
}
diff --git a/include/linux/phy.h b/include/linux/phy.h
index 77c6d6451638..563c46205685 100644
--- a/include/linux/phy.h
+++ b/include/linux/phy.h
@@ -602,6 +602,7 @@ struct macsec_ops;
* @supported_eee: supported PHY EEE linkmodes
* @advertising_eee: Currently advertised EEE linkmodes
* @enable_tx_lpi: When True, MAC should transmit LPI to PHY
+ * @eee_active: phylib private state, indicating that EEE has been negotiated
* @eee_cfg: User configuration of EEE
* @lp_advertising: Current link partner advertised linkmodes
* @host_interfaces: PHY interface modes supported by host
@@ -723,6 +724,7 @@ struct phy_device {
/* Energy efficient ethernet modes which should be prohibited */
__ETHTOOL_DECLARE_LINK_MODE_MASK(eee_broken_modes);
bool enable_tx_lpi;
+ bool eee_active;
struct eee_config eee_cfg;
/* Host supported PHY interface types. Should be ignored if empty. */
--
2.30.2
^ permalink raw reply related [flat|nested] 39+ messages in thread
* [PATCH RFC net-next 03/23] net: phy: marvell: use phydev->eee_cfg.eee_enabled
2024-11-26 12:51 [PATCH RFC net-next 00/23] net: phylink managed EEE support Russell King (Oracle)
2024-11-26 12:52 ` [PATCH RFC net-next 01/23] net: phy: ensure that genphy_c45_an_config_eee_aneg() sees new value of phydev->eee_cfg.eee_enabled Russell King
2024-11-26 12:52 ` [PATCH RFC net-next 02/23] net: phy: fix phy_ethtool_set_eee() incorrectly enabling LPI Russell King (Oracle)
@ 2024-11-26 12:52 ` Russell King (Oracle)
2024-11-26 20:19 ` Heiner Kallweit
2024-11-26 12:52 ` [PATCH RFC net-next 04/23] net: phy: avoid genphy_c45_ethtool_get_eee() setting eee_enabled Russell King (Oracle)
` (24 subsequent siblings)
27 siblings, 1 reply; 39+ messages in thread
From: Russell King (Oracle) @ 2024-11-26 12:52 UTC (permalink / raw)
To: Andrew Lunn, Heiner Kallweit
Cc: Alexandre Torgue, Andrew Lunn, Bryan Whitehead, David S. Miller,
Eric Dumazet, Florian Fainelli, Jakub Kicinski, Jose Abreu,
linux-arm-kernel, linux-stm32, Marcin Wojtas, Maxime Coquelin,
netdev, Oleksij Rempel, Paolo Abeni, UNGLinuxDriver
Rather than calling genphy_c45_ethtool_get_eee() to retrieve whether
EEE is enabled, use the value stored in the phy_device eee_cfg
structure.
Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
---
drivers/net/phy/marvell.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/drivers/net/phy/marvell.c b/drivers/net/phy/marvell.c
index cd50cd6a7f75..1d117fa8c564 100644
--- a/drivers/net/phy/marvell.c
+++ b/drivers/net/phy/marvell.c
@@ -1508,7 +1508,6 @@ static int m88e1540_get_fld(struct phy_device *phydev, u8 *msecs)
static int m88e1540_set_fld(struct phy_device *phydev, const u8 *msecs)
{
- struct ethtool_keee eee;
int val, ret;
if (*msecs == ETHTOOL_PHY_FAST_LINK_DOWN_OFF)
@@ -1518,8 +1517,7 @@ static int m88e1540_set_fld(struct phy_device *phydev, const u8 *msecs)
/* According to the Marvell data sheet EEE must be disabled for
* Fast Link Down detection to work properly
*/
- ret = genphy_c45_ethtool_get_eee(phydev, &eee);
- if (!ret && eee.eee_enabled) {
+ if (phydev->eee_cfg.eee_enabled) {
phydev_warn(phydev, "Fast Link Down detection requires EEE to be disabled!\n");
return -EBUSY;
}
--
2.30.2
^ permalink raw reply related [flat|nested] 39+ messages in thread
* [PATCH RFC net-next 04/23] net: phy: avoid genphy_c45_ethtool_get_eee() setting eee_enabled
2024-11-26 12:51 [PATCH RFC net-next 00/23] net: phylink managed EEE support Russell King (Oracle)
` (2 preceding siblings ...)
2024-11-26 12:52 ` [PATCH RFC net-next 03/23] net: phy: marvell: use phydev->eee_cfg.eee_enabled Russell King (Oracle)
@ 2024-11-26 12:52 ` Russell King (Oracle)
2024-11-26 20:20 ` Heiner Kallweit
2024-11-26 12:52 ` [PATCH RFC net-next 05/23] net: phy: remove genphy_c45_eee_is_active()'s is_enabled arg Russell King (Oracle)
` (23 subsequent siblings)
27 siblings, 1 reply; 39+ messages in thread
From: Russell King (Oracle) @ 2024-11-26 12:52 UTC (permalink / raw)
To: Andrew Lunn, Heiner Kallweit
Cc: Alexandre Torgue, Andrew Lunn, Bryan Whitehead, David S. Miller,
Eric Dumazet, Florian Fainelli, Jakub Kicinski, Jose Abreu,
linux-arm-kernel, linux-stm32, Marcin Wojtas, Maxime Coquelin,
netdev, Oleksij Rempel, Paolo Abeni, UNGLinuxDriver
genphy_c45_ethtool_get_eee() is only called from phy_ethtool_get_eee(),
which then calls eeecfg_to_eee(). eeecfg_to_eee() will overwrite
keee.eee_enabled, so there's no point setting keee.eee_enabled in
genphy_c45_ethtool_get_eee(). Remove this assignment.
Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
---
drivers/net/phy/phy-c45.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/drivers/net/phy/phy-c45.c b/drivers/net/phy/phy-c45.c
index 944ae98ad110..d162f78bc68d 100644
--- a/drivers/net/phy/phy-c45.c
+++ b/drivers/net/phy/phy-c45.c
@@ -1521,15 +1521,13 @@ EXPORT_SYMBOL(genphy_c45_eee_is_active);
int genphy_c45_ethtool_get_eee(struct phy_device *phydev,
struct ethtool_keee *data)
{
- bool is_enabled;
int ret;
ret = genphy_c45_eee_is_active(phydev, data->advertised,
- data->lp_advertised, &is_enabled);
+ data->lp_advertised, NULL);
if (ret < 0)
return ret;
- data->eee_enabled = is_enabled;
data->eee_active = phydev->eee_active;
linkmode_copy(data->supported, phydev->supported_eee);
--
2.30.2
^ permalink raw reply related [flat|nested] 39+ messages in thread
* [PATCH RFC net-next 05/23] net: phy: remove genphy_c45_eee_is_active()'s is_enabled arg
2024-11-26 12:51 [PATCH RFC net-next 00/23] net: phylink managed EEE support Russell King (Oracle)
` (3 preceding siblings ...)
2024-11-26 12:52 ` [PATCH RFC net-next 04/23] net: phy: avoid genphy_c45_ethtool_get_eee() setting eee_enabled Russell King (Oracle)
@ 2024-11-26 12:52 ` Russell King (Oracle)
2024-11-26 20:24 ` Heiner Kallweit
2024-11-26 12:52 ` [PATCH RFC net-next 06/23] net: phy: update phy_ethtool_get_eee() documentation Russell King (Oracle)
` (22 subsequent siblings)
27 siblings, 1 reply; 39+ messages in thread
From: Russell King (Oracle) @ 2024-11-26 12:52 UTC (permalink / raw)
To: Andrew Lunn, Heiner Kallweit
Cc: Alexandre Torgue, Andrew Lunn, Bryan Whitehead, David S. Miller,
Eric Dumazet, Florian Fainelli, Jakub Kicinski, Jose Abreu,
linux-arm-kernel, linux-stm32, Marcin Wojtas, Maxime Coquelin,
netdev, Oleksij Rempel, Paolo Abeni, UNGLinuxDriver
All callers to genphy_c45_eee_is_active() now pass NULL as the
is_enabled argument, which means we never use the value computed
in this function. Remove the argument and clean up this function.
Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
---
drivers/net/phy/phy-c45.c | 11 ++++-------
drivers/net/phy/phy.c | 5 ++---
include/linux/phy.h | 2 +-
3 files changed, 7 insertions(+), 11 deletions(-)
diff --git a/drivers/net/phy/phy-c45.c b/drivers/net/phy/phy-c45.c
index d162f78bc68d..e799e7ddd6fb 100644
--- a/drivers/net/phy/phy-c45.c
+++ b/drivers/net/phy/phy-c45.c
@@ -1475,12 +1475,12 @@ EXPORT_SYMBOL_GPL(genphy_c45_plca_get_status);
* advertisements. Compare them return current EEE state.
*/
int genphy_c45_eee_is_active(struct phy_device *phydev, unsigned long *adv,
- unsigned long *lp, bool *is_enabled)
+ unsigned long *lp)
{
__ETHTOOL_DECLARE_LINK_MODE_MASK(tmp_adv) = {};
__ETHTOOL_DECLARE_LINK_MODE_MASK(tmp_lp) = {};
__ETHTOOL_DECLARE_LINK_MODE_MASK(common);
- bool eee_enabled, eee_active;
+ bool eee_active;
int ret;
ret = genphy_c45_read_eee_adv(phydev, tmp_adv);
@@ -1491,9 +1491,8 @@ int genphy_c45_eee_is_active(struct phy_device *phydev, unsigned long *adv,
if (ret)
return ret;
- eee_enabled = !linkmode_empty(tmp_adv);
linkmode_and(common, tmp_adv, tmp_lp);
- if (eee_enabled && !linkmode_empty(common))
+ if (!linkmode_empty(tmp_adv) && !linkmode_empty(common))
eee_active = phy_check_valid(phydev->speed, phydev->duplex,
common);
else
@@ -1503,8 +1502,6 @@ int genphy_c45_eee_is_active(struct phy_device *phydev, unsigned long *adv,
linkmode_copy(adv, tmp_adv);
if (lp)
linkmode_copy(lp, tmp_lp);
- if (is_enabled)
- *is_enabled = eee_enabled;
return eee_active;
}
@@ -1524,7 +1521,7 @@ int genphy_c45_ethtool_get_eee(struct phy_device *phydev,
int ret;
ret = genphy_c45_eee_is_active(phydev, data->advertised,
- data->lp_advertised, NULL);
+ data->lp_advertised);
if (ret < 0)
return ret;
diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c
index 0d20b534122b..18109f843e39 100644
--- a/drivers/net/phy/phy.c
+++ b/drivers/net/phy/phy.c
@@ -988,8 +988,7 @@ static int phy_check_link_status(struct phy_device *phydev)
if (phydev->link && phydev->state != PHY_RUNNING) {
phy_check_downshift(phydev);
phydev->state = PHY_RUNNING;
- err = genphy_c45_eee_is_active(phydev,
- NULL, NULL, NULL);
+ err = genphy_c45_eee_is_active(phydev, NULL, NULL);
phydev->eee_active = err > 0;
phydev->enable_tx_lpi = phydev->eee_cfg.tx_lpi_enabled &&
phydev->eee_active;
@@ -1605,7 +1604,7 @@ int phy_init_eee(struct phy_device *phydev, bool clk_stop_enable)
if (!phydev->drv)
return -EIO;
- ret = genphy_c45_eee_is_active(phydev, NULL, NULL, NULL);
+ ret = genphy_c45_eee_is_active(phydev, NULL, NULL);
if (ret < 0)
return ret;
if (!ret)
diff --git a/include/linux/phy.h b/include/linux/phy.h
index 563c46205685..09a47116994c 100644
--- a/include/linux/phy.h
+++ b/include/linux/phy.h
@@ -1957,7 +1957,7 @@ int genphy_c45_plca_set_cfg(struct phy_device *phydev,
int genphy_c45_plca_get_status(struct phy_device *phydev,
struct phy_plca_status *plca_st);
int genphy_c45_eee_is_active(struct phy_device *phydev, unsigned long *adv,
- unsigned long *lp, bool *is_enabled);
+ unsigned long *lp);
int genphy_c45_ethtool_get_eee(struct phy_device *phydev,
struct ethtool_keee *data);
int genphy_c45_ethtool_set_eee(struct phy_device *phydev,
--
2.30.2
^ permalink raw reply related [flat|nested] 39+ messages in thread
* [PATCH RFC net-next 06/23] net: phy: update phy_ethtool_get_eee() documentation
2024-11-26 12:51 [PATCH RFC net-next 00/23] net: phylink managed EEE support Russell King (Oracle)
` (4 preceding siblings ...)
2024-11-26 12:52 ` [PATCH RFC net-next 05/23] net: phy: remove genphy_c45_eee_is_active()'s is_enabled arg Russell King (Oracle)
@ 2024-11-26 12:52 ` Russell King (Oracle)
2024-11-26 12:52 ` [PATCH RFC net-next 07/23] net: mdio: add definition for clock stop capable bit Russell King (Oracle)
` (21 subsequent siblings)
27 siblings, 0 replies; 39+ messages in thread
From: Russell King (Oracle) @ 2024-11-26 12:52 UTC (permalink / raw)
To: Andrew Lunn, Heiner Kallweit
Cc: Alexandre Torgue, Andrew Lunn, Bryan Whitehead, David S. Miller,
Eric Dumazet, Florian Fainelli, Jakub Kicinski, Jose Abreu,
linux-arm-kernel, linux-stm32, Marcin Wojtas, Maxime Coquelin,
netdev, Oleksij Rempel, Paolo Abeni, UNGLinuxDriver
Update the phy_ethtool_get_eee() documentation to make it clear that
all members of struct ethtool_keee are written by this function.
keee.supported, keee.advertised, keee.lp_advertised and keee.eee_active
are all written by genphy_c45_ethtool_get_eee().
keee.tx_lpi_timer, keee.tx_lpi_enabled and keee.eee_enabled are all
written by eeecfg_to_eee().
Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
---
drivers/net/phy/phy.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c
index 18109f843e39..8caef54a60e0 100644
--- a/drivers/net/phy/phy.c
+++ b/drivers/net/phy/phy.c
@@ -1648,8 +1648,8 @@ EXPORT_SYMBOL(phy_get_eee_err);
* @phydev: target phy_device struct
* @data: ethtool_keee data
*
- * Description: reports the Supported/Advertisement/LP Advertisement
- * capabilities, etc.
+ * Description: get the current EEE settings, filling in all members of
+ * @data.
*/
int phy_ethtool_get_eee(struct phy_device *phydev, struct ethtool_keee *data)
{
--
2.30.2
^ permalink raw reply related [flat|nested] 39+ messages in thread
* [PATCH RFC net-next 07/23] net: mdio: add definition for clock stop capable bit
2024-11-26 12:51 [PATCH RFC net-next 00/23] net: phylink managed EEE support Russell King (Oracle)
` (5 preceding siblings ...)
2024-11-26 12:52 ` [PATCH RFC net-next 06/23] net: phy: update phy_ethtool_get_eee() documentation Russell King (Oracle)
@ 2024-11-26 12:52 ` Russell King (Oracle)
2024-11-26 12:52 ` [PATCH RFC net-next 08/23] net: phy: add support for querying PHY clock stop capability Russell King (Oracle)
` (20 subsequent siblings)
27 siblings, 0 replies; 39+ messages in thread
From: Russell King (Oracle) @ 2024-11-26 12:52 UTC (permalink / raw)
To: Andrew Lunn, Heiner Kallweit
Cc: Alexandre Torgue, Andrew Lunn, Bryan Whitehead, David S. Miller,
Eric Dumazet, Florian Fainelli, Jakub Kicinski, Jose Abreu,
linux-arm-kernel, linux-stm32, Marcin Wojtas, Maxime Coquelin,
netdev, Oleksij Rempel, Paolo Abeni, UNGLinuxDriver
Add a definition for the clock stop capable bit in the PCS MMD. This
bit indicates whether the MAC is able to stop the transmit xMII clock
while it is signalling LPI.
Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
---
include/uapi/linux/mdio.h | 1 +
1 file changed, 1 insertion(+)
diff --git a/include/uapi/linux/mdio.h b/include/uapi/linux/mdio.h
index f0d3f268240d..6975f182b22c 100644
--- a/include/uapi/linux/mdio.h
+++ b/include/uapi/linux/mdio.h
@@ -125,6 +125,7 @@
#define MDIO_STAT1_LPOWERABLE 0x0002 /* Low-power ability */
#define MDIO_STAT1_LSTATUS BMSR_LSTATUS
#define MDIO_STAT1_FAULT 0x0080 /* Fault */
+#define MDIO_PCS_STAT1_CLKSTOP_CAP 0x0040
#define MDIO_AN_STAT1_LPABLE 0x0001 /* Link partner AN ability */
#define MDIO_AN_STAT1_ABLE BMSR_ANEGCAPABLE
#define MDIO_AN_STAT1_RFAULT BMSR_RFAULT
--
2.30.2
^ permalink raw reply related [flat|nested] 39+ messages in thread
* [PATCH RFC net-next 08/23] net: phy: add support for querying PHY clock stop capability
2024-11-26 12:51 [PATCH RFC net-next 00/23] net: phylink managed EEE support Russell King (Oracle)
` (6 preceding siblings ...)
2024-11-26 12:52 ` [PATCH RFC net-next 07/23] net: mdio: add definition for clock stop capable bit Russell King (Oracle)
@ 2024-11-26 12:52 ` Russell King (Oracle)
2024-11-26 12:52 ` [PATCH RFC net-next 09/23] net: phy: add configuration of rx clock stop mode Russell King (Oracle)
` (19 subsequent siblings)
27 siblings, 0 replies; 39+ messages in thread
From: Russell King (Oracle) @ 2024-11-26 12:52 UTC (permalink / raw)
To: Andrew Lunn, Heiner Kallweit
Cc: Alexandre Torgue, Andrew Lunn, Bryan Whitehead, David S. Miller,
Eric Dumazet, Florian Fainelli, Jakub Kicinski, Jose Abreu,
linux-arm-kernel, linux-stm32, Marcin Wojtas, Maxime Coquelin,
netdev, Oleksij Rempel, Paolo Abeni, UNGLinuxDriver
Add support for querying whether the PHY allows the transmit xMII clock
to be stopped while in LPI mode. This will be used by phylink to pass
to the MAC driver so it can configure the generation of the xMII clock
appropriately.
Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
---
drivers/net/phy/phy.c | 20 ++++++++++++++++++++
include/linux/phy.h | 1 +
2 files changed, 21 insertions(+)
diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c
index 8caef54a60e0..21e0fc9a6f09 100644
--- a/drivers/net/phy/phy.c
+++ b/drivers/net/phy/phy.c
@@ -1587,6 +1587,26 @@ void phy_mac_interrupt(struct phy_device *phydev)
}
EXPORT_SYMBOL(phy_mac_interrupt);
+/**
+ * phy_eee_tx_clock_stop_capable() - indicate whether the MAC can stop tx clock
+ * @phydev: target phy_device struct
+ *
+ * Indicate whether the MAC can disable the transmit xMII clock while in LPI
+ * state. Returns 1 if the MAC may stop the transmit clock, 0 if the MAC must
+ * not stop the transmit clock, or negative error.
+ */
+int phy_eee_tx_clock_stop_capable(struct phy_device *phydev)
+{
+ int stat1;
+
+ stat1 = phy_read_mmd(phydev, MDIO_MMD_PCS, MDIO_STAT1);
+ if (stat1 < 0)
+ return stat1;
+
+ return !!(stat1 & MDIO_PCS_STAT1_CLKSTOP_CAP);
+}
+EXPORT_SYMBOL_GPL(phy_eee_tx_clock_stop_capable);
+
/**
* phy_init_eee - init and check the EEE feature
* @phydev: target phy_device struct
diff --git a/include/linux/phy.h b/include/linux/phy.h
index 09a47116994c..d0491cdf54b6 100644
--- a/include/linux/phy.h
+++ b/include/linux/phy.h
@@ -2038,6 +2038,7 @@ int phy_unregister_fixup(const char *bus_id, u32 phy_uid, u32 phy_uid_mask);
int phy_unregister_fixup_for_id(const char *bus_id);
int phy_unregister_fixup_for_uid(u32 phy_uid, u32 phy_uid_mask);
+int phy_eee_tx_clock_stop_capable(struct phy_device *phydev);
int phy_init_eee(struct phy_device *phydev, bool clk_stop_enable);
int phy_get_eee_err(struct phy_device *phydev);
int phy_ethtool_set_eee(struct phy_device *phydev, struct ethtool_keee *data);
--
2.30.2
^ permalink raw reply related [flat|nested] 39+ messages in thread
* [PATCH RFC net-next 09/23] net: phy: add configuration of rx clock stop mode
2024-11-26 12:51 [PATCH RFC net-next 00/23] net: phylink managed EEE support Russell King (Oracle)
` (7 preceding siblings ...)
2024-11-26 12:52 ` [PATCH RFC net-next 08/23] net: phy: add support for querying PHY clock stop capability Russell King (Oracle)
@ 2024-11-26 12:52 ` Russell King (Oracle)
2024-11-26 12:53 ` [PATCH RFC net-next 10/23] net: phylink: add phylink_link_is_up() helper Russell King (Oracle)
` (18 subsequent siblings)
27 siblings, 0 replies; 39+ messages in thread
From: Russell King (Oracle) @ 2024-11-26 12:52 UTC (permalink / raw)
To: Andrew Lunn, Heiner Kallweit
Cc: Alexandre Torgue, Andrew Lunn, Bryan Whitehead, David S. Miller,
Eric Dumazet, Florian Fainelli, Jakub Kicinski, Jose Abreu,
linux-arm-kernel, linux-stm32, Marcin Wojtas, Maxime Coquelin,
netdev, Oleksij Rempel, Paolo Abeni, UNGLinuxDriver
Add a function to allow configuration of the PCS's clock stop enable
bit, used to configure whether the xMII receive clock can be stopped
during LPI mode.
Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
---
drivers/net/phy/phy.c | 25 ++++++++++++++++++++-----
include/linux/phy.h | 1 +
2 files changed, 21 insertions(+), 5 deletions(-)
diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c
index 21e0fc9a6f09..d0a9d807d48f 100644
--- a/drivers/net/phy/phy.c
+++ b/drivers/net/phy/phy.c
@@ -1607,6 +1607,25 @@ int phy_eee_tx_clock_stop_capable(struct phy_device *phydev)
}
EXPORT_SYMBOL_GPL(phy_eee_tx_clock_stop_capable);
+/**
+ * phy_eee_rx_clock_stop() - configure PHY receive clock in LPI
+ * phydev: target phy_device struct
+ *
+ * Configure whether the PHY may disable its receive clock during LPI mode,
+ * See IEEE 802.3 sections 22.2.2.2, 35.2.2.10, and 45.2.3.1.4. Returns 0 or
+ * negative error.
+ */
+int phy_eee_rx_clock_stop(struct phy_device *phydev, bool clk_stop_enable)
+{
+ /* Configure the PHY to stop receiving xMII
+ * clock while it is signaling LPI.
+ */
+ return phy_modify_mmd(phydev, MDIO_MMD_PCS, MDIO_CTRL1,
+ MDIO_PCS_CTRL1_CLKSTOP_EN,
+ clk_stop_enable ? MDIO_PCS_CTRL1_CLKSTOP_EN : 0);
+}
+EXPORT_SYMBOL_GPL(phy_eee_rx_clock_stop);
+
/**
* phy_init_eee - init and check the EEE feature
* @phydev: target phy_device struct
@@ -1631,11 +1650,7 @@ int phy_init_eee(struct phy_device *phydev, bool clk_stop_enable)
return -EPROTONOSUPPORT;
if (clk_stop_enable)
- /* Configure the PHY to stop receiving xMII
- * clock while it is signaling LPI.
- */
- ret = phy_set_bits_mmd(phydev, MDIO_MMD_PCS, MDIO_CTRL1,
- MDIO_PCS_CTRL1_CLKSTOP_EN);
+ ret = phy_eee_rx_clock_stop(phydev, true);
return ret < 0 ? ret : 0;
}
diff --git a/include/linux/phy.h b/include/linux/phy.h
index d0491cdf54b6..467149b44a8e 100644
--- a/include/linux/phy.h
+++ b/include/linux/phy.h
@@ -2039,6 +2039,7 @@ int phy_unregister_fixup_for_id(const char *bus_id);
int phy_unregister_fixup_for_uid(u32 phy_uid, u32 phy_uid_mask);
int phy_eee_tx_clock_stop_capable(struct phy_device *phydev);
+int phy_eee_rx_clock_stop(struct phy_device *phydev, bool clk_stop_enable);
int phy_init_eee(struct phy_device *phydev, bool clk_stop_enable);
int phy_get_eee_err(struct phy_device *phydev);
int phy_ethtool_set_eee(struct phy_device *phydev, struct ethtool_keee *data);
--
2.30.2
^ permalink raw reply related [flat|nested] 39+ messages in thread
* [PATCH RFC net-next 10/23] net: phylink: add phylink_link_is_up() helper
2024-11-26 12:51 [PATCH RFC net-next 00/23] net: phylink managed EEE support Russell King (Oracle)
` (8 preceding siblings ...)
2024-11-26 12:52 ` [PATCH RFC net-next 09/23] net: phy: add configuration of rx clock stop mode Russell King (Oracle)
@ 2024-11-26 12:53 ` Russell King (Oracle)
2024-11-26 12:53 ` [PATCH RFC net-next 11/23] net: phylink: add EEE management Russell King (Oracle)
` (17 subsequent siblings)
27 siblings, 0 replies; 39+ messages in thread
From: Russell King (Oracle) @ 2024-11-26 12:53 UTC (permalink / raw)
To: Andrew Lunn, Heiner Kallweit
Cc: Alexandre Torgue, Andrew Lunn, Bryan Whitehead, David S. Miller,
Eric Dumazet, Florian Fainelli, Jakub Kicinski, Jose Abreu,
linux-arm-kernel, linux-stm32, Marcin Wojtas, Maxime Coquelin,
netdev, Oleksij Rempel, Paolo Abeni, UNGLinuxDriver
Add a helper to determine whether the link is up or down. Currently
this is only used in one location, but becomes necessary to test
when reconfiguring EEE.
Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
---
drivers/net/phy/phylink.c | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/drivers/net/phy/phylink.c b/drivers/net/phy/phylink.c
index 30a654e98352..1d68809403de 100644
--- a/drivers/net/phy/phylink.c
+++ b/drivers/net/phy/phylink.c
@@ -1442,20 +1442,21 @@ static void phylink_link_down(struct phylink *pl)
phylink_info(pl, "Link is Down\n");
}
+static bool phylink_link_is_up(struct phylink *pl)
+{
+ return pl->netdev ? netif_carrier_ok(pl->netdev) : pl->old_link_state;
+}
+
static void phylink_resolve(struct work_struct *w)
{
struct phylink *pl = container_of(w, struct phylink, resolve);
struct phylink_link_state link_state;
- struct net_device *ndev = pl->netdev;
bool mac_config = false;
bool retrigger = false;
bool cur_link_state;
mutex_lock(&pl->state_mutex);
- if (pl->netdev)
- cur_link_state = netif_carrier_ok(ndev);
- else
- cur_link_state = pl->old_link_state;
+ cur_link_state = phylink_link_is_up(pl);
if (pl->phylink_disable_state) {
pl->link_failed = false;
--
2.30.2
^ permalink raw reply related [flat|nested] 39+ messages in thread
* [PATCH RFC net-next 11/23] net: phylink: add EEE management
2024-11-26 12:51 [PATCH RFC net-next 00/23] net: phylink managed EEE support Russell King (Oracle)
` (9 preceding siblings ...)
2024-11-26 12:53 ` [PATCH RFC net-next 10/23] net: phylink: add phylink_link_is_up() helper Russell King (Oracle)
@ 2024-11-26 12:53 ` Russell King (Oracle)
2024-11-26 12:53 ` [PATCH RFC net-next 12/23] net: mvneta: convert to phylink EEE implementation Russell King (Oracle)
` (16 subsequent siblings)
27 siblings, 0 replies; 39+ messages in thread
From: Russell King (Oracle) @ 2024-11-26 12:53 UTC (permalink / raw)
To: Andrew Lunn, Heiner Kallweit
Cc: Alexandre Torgue, Andrew Lunn, Bryan Whitehead, David S. Miller,
Eric Dumazet, Florian Fainelli, Jakub Kicinski, Jose Abreu,
linux-arm-kernel, linux-stm32, Marcin Wojtas, Maxime Coquelin,
netdev, Oleksij Rempel, Paolo Abeni, UNGLinuxDriver
Add EEE management to phylink, making use of the phylib implementation.
This will only be used where a MAC driver populates the methods and
capabilities bitfield, otherwise we keep our old behaviour.
Phylink will keep track of the EEE configuration, including the clock
stop abilities at each end of the MAC to PHY link, programming the PHY
appropriately and preserving the EEE configuration should the PHY go
away.
It will also call into the MAC driver when LPI needs to be enabled or
disabled, with the expectation that the MAC have LPI disabled during
probe.
Support for phylink managed EEE is enabled by populating both tx_lpi
MAC operations method pointers.
Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
---
drivers/net/phy/phylink.c | 123 ++++++++++++++++++++++++++++++++++++--
include/linux/phylink.h | 44 ++++++++++++++
2 files changed, 163 insertions(+), 4 deletions(-)
diff --git a/drivers/net/phy/phylink.c b/drivers/net/phy/phylink.c
index 1d68809403de..d8d288b121a8 100644
--- a/drivers/net/phy/phylink.c
+++ b/drivers/net/phy/phylink.c
@@ -79,12 +79,19 @@ struct phylink {
unsigned int pcs_state;
bool link_failed;
+ bool mac_supports_eee;
+ bool phy_enable_tx_lpi;
+ bool mac_enable_tx_lpi;
+ bool mac_tx_clk_stop;
+ u32 mac_tx_lpi_timer;
struct sfp_bus *sfp_bus;
bool sfp_may_have_phy;
DECLARE_PHY_INTERFACE_MASK(sfp_interfaces);
__ETHTOOL_DECLARE_LINK_MODE_MASK(sfp_support);
u8 sfp_port;
+
+ struct eee_config eee_cfg;
};
#define phylink_printk(level, pl, fmt, ...) \
@@ -1375,6 +1382,47 @@ static const char *phylink_pause_to_str(int pause)
}
}
+static void phylink_deactivate_lpi(struct phylink *pl)
+{
+ if (pl->mac_enable_tx_lpi) {
+ pl->mac_enable_tx_lpi = false;
+
+ phylink_dbg(pl, "disabling LPI\n");
+
+ pl->mac_ops->mac_disable_tx_lpi(pl->config);
+ }
+}
+
+static void phylink_activate_lpi(struct phylink *pl)
+{
+ if (!test_bit(pl->cur_interface, pl->config->lpi_interfaces)) {
+ phylink_dbg(pl, "MAC does not support LPI with %s\n",
+ phy_modes(pl->cur_interface));
+ return;
+ }
+
+ phylink_dbg(pl, "LPI timer %uus, tx clock stop %u\n",
+ pl->mac_tx_lpi_timer, pl->mac_tx_clk_stop);
+
+ pl->mac_ops->mac_enable_tx_lpi(pl->config, pl->mac_tx_lpi_timer,
+ pl->mac_tx_clk_stop);
+
+ pl->mac_enable_tx_lpi = true;
+}
+
+static void phylink_phy_restrict_eee(struct phylink *pl, struct phy_device *phy)
+{
+ __ETHTOOL_DECLARE_LINK_MODE_MASK(eee_supported);
+
+ /* Convert the MAC's LPI capabilities to linkmodes */
+ linkmode_zero(eee_supported);
+ phylink_caps_to_linkmodes(eee_supported, pl->config->lpi_capabilities);
+
+ /* Mask out EEE modes that are not supported */
+ linkmode_and(phy->supported_eee, phy->supported_eee, eee_supported);
+ linkmode_and(phy->advertising_eee, phy->advertising_eee, eee_supported);
+}
+
static void phylink_link_up(struct phylink *pl,
struct phylink_link_state link_state)
{
@@ -1421,6 +1469,9 @@ static void phylink_link_up(struct phylink *pl,
pl->cur_interface, speed, duplex,
!!(link_state.pause & MLO_PAUSE_TX), rx_pause);
+ if (pl->mac_supports_eee && pl->phy_enable_tx_lpi)
+ phylink_activate_lpi(pl);
+
if (ndev)
netif_carrier_on(ndev);
@@ -1437,6 +1488,9 @@ static void phylink_link_down(struct phylink *pl)
if (ndev)
netif_carrier_off(ndev);
+
+ phylink_deactivate_lpi(pl);
+
pl->mac_ops->mac_link_down(pl->config, pl->cur_link_an_mode,
pl->cur_interface);
phylink_info(pl, "Link is Down\n");
@@ -1700,6 +1754,14 @@ struct phylink *phylink_create(struct phylink_config *config,
return ERR_PTR(-EINVAL);
}
+ pl->mac_supports_eee = mac_ops->mac_disable_tx_lpi &&
+ mac_ops->mac_enable_tx_lpi;
+
+ /* Set the default EEE configuration */
+ pl->eee_cfg.eee_enabled = pl->config->eee_enabled_default;
+ pl->eee_cfg.tx_lpi_enabled = pl->eee_cfg.eee_enabled;
+ pl->eee_cfg.tx_lpi_timer = pl->config->lpi_timer_default;
+
pl->phy_state.interface = iface;
pl->link_interface = iface;
if (iface == PHY_INTERFACE_MODE_MOCA)
@@ -1804,16 +1866,22 @@ static void phylink_phy_change(struct phy_device *phydev, bool up)
pl->phy_state.link = up;
if (!up)
pl->link_failed = true;
+
+ /* Get the LPI state from phylib */
+ pl->phy_enable_tx_lpi = phydev->enable_tx_lpi;
+ pl->mac_tx_lpi_timer = phydev->eee_cfg.tx_lpi_timer;
mutex_unlock(&pl->state_mutex);
phylink_run_resolve(pl);
- phylink_dbg(pl, "phy link %s %s/%s/%s/%s/%s\n", up ? "up" : "down",
+ phylink_dbg(pl, "phy link %s %s/%s/%s/%s/%s/%slpi\n",
+ up ? "up" : "down",
phy_modes(phydev->interface),
phy_speed_to_str(phydev->speed),
phy_duplex_to_str(phydev->duplex),
phy_rate_matching_to_str(phydev->rate_matching),
- phylink_pause_to_str(pl->phy_state.pause));
+ phylink_pause_to_str(pl->phy_state.pause),
+ phydev->enable_tx_lpi ? "" : "no");
}
static int phylink_validate_phy(struct phylink *pl, struct phy_device *phy,
@@ -1943,6 +2011,28 @@ static int phylink_bringup_phy(struct phylink *pl, struct phy_device *phy,
/* Restrict the phy advertisement according to the MAC support. */
linkmode_copy(phy->advertising, config.advertising);
+
+ /* If the MAC supports phylink managed EEE, restrict the EEE
+ * advertisement according to the MAC's LPI capabilities.
+ */
+ if (pl->mac_supports_eee) {
+ phy->eee_cfg.eee_enabled = pl->eee_cfg.eee_enabled;
+
+ /* If EEE is enabled, then we need to call phy_support_eee()
+ * to ensure that the advertising mask is appropriately set.
+ */
+ if (pl->eee_cfg.eee_enabled)
+ phy_support_eee(phy);
+
+ phy->eee_cfg.tx_lpi_enabled = pl->eee_cfg.tx_lpi_enabled;
+ phy->eee_cfg.tx_lpi_timer = pl->eee_cfg.tx_lpi_timer;
+
+ /* Restrict the PHYs EEE support/advertisement to the modes
+ * that the MAC supports.
+ */
+ phylink_phy_restrict_eee(pl, phy);
+ }
+
mutex_unlock(&pl->state_mutex);
mutex_unlock(&phy->lock);
@@ -1958,7 +2048,13 @@ static int phylink_bringup_phy(struct phylink *pl, struct phy_device *phy,
if (pl->config->mac_managed_pm)
phy->mac_managed_pm = true;
- return 0;
+ /* Allow the MAC to stop its clock if the PHY has the capability */
+ pl->mac_tx_clk_stop = phy_eee_tx_clock_stop_capable(phy) > 0;
+
+ /* Explicitly configure whether the PHY is allowed to stop it's
+ * receive clock.
+ */
+ return phy_eee_rx_clock_stop(phy, pl->config->eee_rx_clk_stop_enable);
}
static int phylink_attach_phy(struct phylink *pl, struct phy_device *phy,
@@ -2115,6 +2211,8 @@ void phylink_disconnect_phy(struct phylink *pl)
mutex_lock(&phy->lock);
mutex_lock(&pl->state_mutex);
pl->phydev = NULL;
+ pl->phy_enable_tx_lpi = false;
+ pl->mac_tx_clk_stop = false;
mutex_unlock(&pl->state_mutex);
mutex_unlock(&phy->lock);
flush_work(&pl->resolve);
@@ -2856,12 +2954,29 @@ EXPORT_SYMBOL_GPL(phylink_ethtool_get_eee);
*/
int phylink_ethtool_set_eee(struct phylink *pl, struct ethtool_keee *eee)
{
+ bool mac_eee = pl->mac_supports_eee;
int ret = -EOPNOTSUPP;
ASSERT_RTNL();
- if (pl->phydev)
+ phylink_dbg(pl, "mac %s phylink EEE%s, adv %*pbl, LPI%s timer %uus\n",
+ mac_eee ? "supports" : "does not support",
+ eee->eee_enabled ? ", enabled" : "",
+ __ETHTOOL_LINK_MODE_MASK_NBITS, eee->advertised,
+ eee->tx_lpi_enabled ? " enabled" : "", eee->tx_lpi_timer);
+
+ /* Clamp the LPI timer maximum value */
+ if (mac_eee && eee->tx_lpi_timer > pl->config->lpi_timer_limit_us) {
+ eee->tx_lpi_timer = pl->config->lpi_timer_limit_us;
+ phylink_dbg(pl, "LPI timer limited to %uus\n",
+ eee->tx_lpi_timer);
+ }
+
+ if (pl->phydev) {
ret = phy_ethtool_set_eee(pl->phydev, eee);
+ if (ret == 0)
+ eee_to_eeecfg(&pl->eee_cfg, eee);
+ }
return ret;
}
diff --git a/include/linux/phylink.h b/include/linux/phylink.h
index 5c01048860c4..df469fdda040 100644
--- a/include/linux/phylink.h
+++ b/include/linux/phylink.h
@@ -5,6 +5,8 @@
#include <linux/spinlock.h>
#include <linux/workqueue.h>
+#include <net/eee.h>
+
struct device_node;
struct ethtool_cmd;
struct fwnode_handle;
@@ -143,11 +145,17 @@ enum phylink_op_type {
* possible and avoid stopping it during suspend events.
* @default_an_inband: if true, defaults to MLO_AN_INBAND rather than
* MLO_AN_PHY. A fixed-link specification will override.
+ * @eee_rx_clk_stop_enable: if true, PHY can stop the receive clock during LPI
* @get_fixed_state: callback to execute to determine the fixed link state,
* if MAC link is at %MLO_AN_FIXED mode.
* @supported_interfaces: bitmap describing which PHY_INTERFACE_MODE_xxx
* are supported by the MAC/PCS.
+ * @lpi_interfaces: bitmap describing which PHY interface modes can support
+ * LPI signalling.
* @mac_capabilities: MAC pause/speed/duplex capabilities.
+ * @lpi_capabilities: MAC speeds which can support LPI signalling
+ * @eee: default EEE configuration.
+ * @lpi_timer_limit_us: Maximum (inclusive) value of the EEE LPI timer.
*/
struct phylink_config {
struct device *dev;
@@ -156,10 +164,16 @@ struct phylink_config {
bool mac_managed_pm;
bool mac_requires_rxc;
bool default_an_inband;
+ bool eee_rx_clk_stop_enable;
void (*get_fixed_state)(struct phylink_config *config,
struct phylink_link_state *state);
DECLARE_PHY_INTERFACE_MASK(supported_interfaces);
+ DECLARE_PHY_INTERFACE_MASK(lpi_interfaces);
unsigned long mac_capabilities;
+ unsigned long lpi_capabilities;
+ u32 lpi_timer_limit_us;
+ u32 lpi_timer_default;
+ bool eee_enabled_default;
};
void phylink_limit_mac_speed(struct phylink_config *config, u32 max_speed);
@@ -173,6 +187,8 @@ void phylink_limit_mac_speed(struct phylink_config *config, u32 max_speed);
* @mac_finish: finish a major reconfiguration of the interface.
* @mac_link_down: take the link down.
* @mac_link_up: allow the link to come up.
+ * @mac_disable_tx_lpi: disable LPI.
+ * @mac_enable_tx_lpi: enable and configure LPI.
*
* The individual methods are described more fully below.
*/
@@ -193,6 +209,9 @@ struct phylink_mac_ops {
struct phy_device *phy, unsigned int mode,
phy_interface_t interface, int speed, int duplex,
bool tx_pause, bool rx_pause);
+ void (*mac_disable_tx_lpi)(struct phylink_config *config);
+ void (*mac_enable_tx_lpi)(struct phylink_config *config, u32 timer,
+ bool tx_clk_stop);
};
#if 0 /* For kernel-doc purposes only. */
@@ -387,6 +406,31 @@ void mac_link_down(struct phylink_config *config, unsigned int mode,
void mac_link_up(struct phylink_config *config, struct phy_device *phy,
unsigned int mode, phy_interface_t interface,
int speed, int duplex, bool tx_pause, bool rx_pause);
+
+/**
+ * mac_disable_tx_lpi() - disable LPI generation at the MAC
+ * @config: a pointer to a &struct phylink_config.
+ *
+ * Disable generation of LPI at the MAC, effectively preventing the MAC
+ * from indicating that it is idle.
+ */
+void mac_disable_tx_lpi(struct phylink_config *config);
+
+/**
+ * mac_enable_tx_lpi() - configure and enable LPI generation at the MAC
+ * @config: a pointer to a &struct phylink_config.
+ * @timer: LPI timeout in microseconds.
+ * @tx_clk_stop: allow xMII transmit clock to be stopped during LPI
+ *
+ * Configure the LPI timeout accordingly. This will only be called when
+ * the link is already up, to cater for situations where the hardware
+ * needs to be programmed according to the link speed.
+ *
+ * Enable LPI generation at the MAC, and configure whether the xMII transmit
+ * clock may be stopped.
+ */
+void mac_enable_tx_lpi(struct phylink_config *config, u32 timer,
+ bool tx_clk_stop);
#endif
struct phylink_pcs_ops;
--
2.30.2
^ permalink raw reply related [flat|nested] 39+ messages in thread
* [PATCH RFC net-next 12/23] net: mvneta: convert to phylink EEE implementation
2024-11-26 12:51 [PATCH RFC net-next 00/23] net: phylink managed EEE support Russell King (Oracle)
` (10 preceding siblings ...)
2024-11-26 12:53 ` [PATCH RFC net-next 11/23] net: phylink: add EEE management Russell King (Oracle)
@ 2024-11-26 12:53 ` Russell King (Oracle)
2024-11-26 12:53 ` [PATCH RFC net-next 13/23] net: mvneta: only allow EEE to be used in "SGMII" modes Russell King (Oracle)
` (15 subsequent siblings)
27 siblings, 0 replies; 39+ messages in thread
From: Russell King (Oracle) @ 2024-11-26 12:53 UTC (permalink / raw)
To: Andrew Lunn, Heiner Kallweit
Cc: Alexandre Torgue, Andrew Lunn, Bryan Whitehead, David S. Miller,
Eric Dumazet, Florian Fainelli, Jakub Kicinski, Jose Abreu,
linux-arm-kernel, linux-stm32, Marcin Wojtas, Maxime Coquelin,
netdev, Oleksij Rempel, Paolo Abeni, UNGLinuxDriver
Convert mvneta to use phylink's EEE implementation, which means we just
need to implement the two methods for LPI control, and adding the
initial configuration.
Disabling LPI requires clearing a single bit. Enabling LPI needs a full
configuration of several values, as the timer values are dependent on
the MAC operating speed.
Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
---
drivers/net/ethernet/marvell/mvneta.c | 116 +++++++++++++++-----------
1 file changed, 68 insertions(+), 48 deletions(-)
diff --git a/drivers/net/ethernet/marvell/mvneta.c b/drivers/net/ethernet/marvell/mvneta.c
index 1fb285fa0bdb..976ce8d6dabf 100644
--- a/drivers/net/ethernet/marvell/mvneta.c
+++ b/drivers/net/ethernet/marvell/mvneta.c
@@ -284,8 +284,12 @@
MVNETA_TXQ_BUCKET_REFILL_PERIOD))
#define MVNETA_LPI_CTRL_0 0x2cc0
+#define MVNETA_LPI_CTRL_0_TS (0xff << 8)
#define MVNETA_LPI_CTRL_1 0x2cc4
-#define MVNETA_LPI_REQUEST_ENABLE BIT(0)
+#define MVNETA_LPI_CTRL_1_REQUEST_ENABLE BIT(0)
+#define MVNETA_LPI_CTRL_1_REQUEST_FORCE BIT(1)
+#define MVNETA_LPI_CTRL_1_MANUAL_MODE BIT(2)
+#define MVNETA_LPI_CTRL_1_TW (0xfff << 4)
#define MVNETA_LPI_CTRL_2 0x2cc8
#define MVNETA_LPI_STATUS 0x2ccc
@@ -541,10 +545,6 @@ struct mvneta_port {
struct mvneta_bm_pool *pool_short;
int bm_win_id;
- bool eee_enabled;
- bool eee_active;
- bool tx_lpi_enabled;
-
u64 ethtool_stats[ARRAY_SIZE(mvneta_statistics)];
u32 indir[MVNETA_RSS_LU_TABLE_SIZE];
@@ -1354,6 +1354,13 @@ static void mvneta_port_enable(struct mvneta_port *pp)
val = mvreg_read(pp, MVNETA_GMAC_CTRL_0);
val |= MVNETA_GMAC0_PORT_ENABLE;
mvreg_write(pp, MVNETA_GMAC_CTRL_0, val);
+
+ /* Ensure LPI is disabled */
+ val = mvreg_read(pp, MVNETA_LPI_CTRL_1);
+ val &= ~(MVNETA_LPI_CTRL_1_REQUEST_ENABLE |
+ MVNETA_LPI_CTRL_1_REQUEST_FORCE |
+ MVNETA_LPI_CTRL_1_MANUAL_MODE);
+ mvreg_write(pp, MVNETA_LPI_CTRL_1, val);
}
/* Disable the port and wait for about 200 usec before retuning */
@@ -4206,18 +4213,6 @@ static int mvneta_mac_finish(struct phylink_config *config, unsigned int mode,
return 0;
}
-static void mvneta_set_eee(struct mvneta_port *pp, bool enable)
-{
- u32 lpi_ctl1;
-
- lpi_ctl1 = mvreg_read(pp, MVNETA_LPI_CTRL_1);
- if (enable)
- lpi_ctl1 |= MVNETA_LPI_REQUEST_ENABLE;
- else
- lpi_ctl1 &= ~MVNETA_LPI_REQUEST_ENABLE;
- mvreg_write(pp, MVNETA_LPI_CTRL_1, lpi_ctl1);
-}
-
static void mvneta_mac_link_down(struct phylink_config *config,
unsigned int mode, phy_interface_t interface)
{
@@ -4233,9 +4228,6 @@ static void mvneta_mac_link_down(struct phylink_config *config,
val |= MVNETA_GMAC_FORCE_LINK_DOWN;
mvreg_write(pp, MVNETA_GMAC_AUTONEG_CONFIG, val);
}
-
- pp->eee_active = false;
- mvneta_set_eee(pp, false);
}
static void mvneta_mac_link_up(struct phylink_config *config,
@@ -4284,11 +4276,53 @@ static void mvneta_mac_link_up(struct phylink_config *config,
}
mvneta_port_up(pp);
+}
+
+static void mvneta_mac_disable_tx_lpi(struct phylink_config *config)
+{
+ struct mvneta_port *pp = netdev_priv(to_net_dev(config->dev));
+ u32 lpi1;
+
+ lpi1 = mvreg_read(pp, MVNETA_LPI_CTRL_1);
+ lpi1 &= ~MVNETA_LPI_CTRL_1_REQUEST_ENABLE;
+ mvreg_write(pp, MVNETA_LPI_CTRL_1, lpi1);
+}
+
+static void mvneta_mac_enable_tx_lpi(struct phylink_config *config, u32 timer,
+ bool tx_clk_stop)
+{
+ struct mvneta_port *pp = netdev_priv(to_net_dev(config->dev));
+ u32 ts, tw, lpi0, lpi1, status;
- if (phy && pp->eee_enabled) {
- pp->eee_active = phy_init_eee(phy, false) >= 0;
- mvneta_set_eee(pp, pp->eee_active && pp->tx_lpi_enabled);
+ status = mvreg_read(pp, MVNETA_GMAC_STATUS);
+ if (status & MVNETA_GMAC_SPEED_1000) {
+ /* At 1G speeds, the timer resolution are 1us, and
+ * 802.3 says tw is 16.5us. Round up to 17us.
+ */
+ tw = 17;
+ ts = timer;
+ } else {
+ /* At 100M speeds, the timer resolutions are 10us, and
+ * 802.3 says tw is 30us.
+ */
+ tw = 3;
+ ts = DIV_ROUND_UP(timer, 10);
}
+
+ if (ts > 255)
+ ts = 255;
+
+
+ /* Configure ts */
+ lpi0 = mvreg_read(pp, MVNETA_LPI_CTRL_0);
+ lpi0 = u32_replace_bits(lpi0, MVNETA_LPI_CTRL_0_TS, ts);
+ mvreg_write(pp, MVNETA_LPI_CTRL_0, lpi0);
+
+ /* Configure tw and enable LPI generation */
+ lpi1 = mvreg_read(pp, MVNETA_LPI_CTRL_1);
+ lpi1 = u32_replace_bits(lpi1, MVNETA_LPI_CTRL_1_TW, tw);
+ lpi1 |= MVNETA_LPI_CTRL_1_REQUEST_ENABLE;
+ mvreg_write(pp, MVNETA_LPI_CTRL_1, lpi1);
}
static const struct phylink_mac_ops mvneta_phylink_ops = {
@@ -4298,6 +4332,8 @@ static const struct phylink_mac_ops mvneta_phylink_ops = {
.mac_finish = mvneta_mac_finish,
.mac_link_down = mvneta_mac_link_down,
.mac_link_up = mvneta_mac_link_up,
+ .mac_disable_tx_lpi = mvneta_mac_disable_tx_lpi,
+ .mac_enable_tx_lpi = mvneta_mac_enable_tx_lpi,
};
static int mvneta_mdio_probe(struct mvneta_port *pp)
@@ -5099,14 +5135,6 @@ static int mvneta_ethtool_get_eee(struct net_device *dev,
struct ethtool_keee *eee)
{
struct mvneta_port *pp = netdev_priv(dev);
- u32 lpi_ctl0;
-
- lpi_ctl0 = mvreg_read(pp, MVNETA_LPI_CTRL_0);
-
- eee->eee_enabled = pp->eee_enabled;
- eee->eee_active = pp->eee_active;
- eee->tx_lpi_enabled = pp->tx_lpi_enabled;
- eee->tx_lpi_timer = (lpi_ctl0) >> 8; // * scale;
return phylink_ethtool_get_eee(pp->phylink, eee);
}
@@ -5115,23 +5143,6 @@ static int mvneta_ethtool_set_eee(struct net_device *dev,
struct ethtool_keee *eee)
{
struct mvneta_port *pp = netdev_priv(dev);
- u32 lpi_ctl0;
-
- /* The Armada 37x documents do not give limits for this other than
- * it being an 8-bit register.
- */
- if (eee->tx_lpi_enabled && eee->tx_lpi_timer > 255)
- return -EINVAL;
-
- lpi_ctl0 = mvreg_read(pp, MVNETA_LPI_CTRL_0);
- lpi_ctl0 &= ~(0xff << 8);
- lpi_ctl0 |= eee->tx_lpi_timer << 8;
- mvreg_write(pp, MVNETA_LPI_CTRL_0, lpi_ctl0);
-
- pp->eee_enabled = eee->eee_enabled;
- pp->tx_lpi_enabled = eee->tx_lpi_enabled;
-
- mvneta_set_eee(pp, eee->tx_lpi_enabled && eee->eee_enabled);
return phylink_ethtool_set_eee(pp->phylink, eee);
}
@@ -5446,6 +5457,9 @@ static int mvneta_port_power_up(struct mvneta_port *pp, int phy_mode)
!phy_interface_mode_is_rgmii(phy_mode))
return -EINVAL;
+ /* Ensure LPI is disabled */
+ mvneta_mac_disable_tx_lpi(&pp->phylink_config);
+
return 0;
}
@@ -5537,6 +5551,12 @@ static int mvneta_probe(struct platform_device *pdev)
pp->phylink_config.mac_capabilities = MAC_SYM_PAUSE | MAC_10 |
MAC_100 | MAC_1000FD | MAC_2500FD;
+ /* Setup EEE. Choose 250us idle. */
+ pp->phylink_config.lpi_capabilities = MAC_100FD | MAC_1000FD;
+ pp->phylink_config.lpi_timer_limit_us = 255;
+ pp->phylink_config.lpi_timer_default = 250;
+ pp->phylink_config.eee_enabled_default = true;
+
phy_interface_set_rgmii(pp->phylink_config.supported_interfaces);
__set_bit(PHY_INTERFACE_MODE_QSGMII,
pp->phylink_config.supported_interfaces);
--
2.30.2
^ permalink raw reply related [flat|nested] 39+ messages in thread
* [PATCH RFC net-next 13/23] net: mvneta: only allow EEE to be used in "SGMII" modes
2024-11-26 12:51 [PATCH RFC net-next 00/23] net: phylink managed EEE support Russell King (Oracle)
` (11 preceding siblings ...)
2024-11-26 12:53 ` [PATCH RFC net-next 12/23] net: mvneta: convert to phylink EEE implementation Russell King (Oracle)
@ 2024-11-26 12:53 ` Russell King (Oracle)
2024-11-26 12:53 ` [PATCH RFC net-next 14/23] net: mvpp2: add EEE implementation Russell King (Oracle)
` (14 subsequent siblings)
27 siblings, 0 replies; 39+ messages in thread
From: Russell King (Oracle) @ 2024-11-26 12:53 UTC (permalink / raw)
To: Andrew Lunn, Heiner Kallweit
Cc: Alexandre Torgue, Andrew Lunn, Bryan Whitehead, David S. Miller,
Eric Dumazet, Florian Fainelli, Jakub Kicinski, Jose Abreu,
linux-arm-kernel, linux-stm32, Marcin Wojtas, Maxime Coquelin,
netdev, Oleksij Rempel, Paolo Abeni, UNGLinuxDriver
The Armada 388 manual states that EEE is only supported in "SGMII"
modes. As mvneta only supports serdes modes and RGMII, we can
satisfy this by excluding it for RGMII.
Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
---
drivers/net/ethernet/marvell/mvneta.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/marvell/mvneta.c b/drivers/net/ethernet/marvell/mvneta.c
index 976ce8d6dabf..01bedf0a55f6 100644
--- a/drivers/net/ethernet/marvell/mvneta.c
+++ b/drivers/net/ethernet/marvell/mvneta.c
@@ -5551,7 +5551,9 @@ static int mvneta_probe(struct platform_device *pdev)
pp->phylink_config.mac_capabilities = MAC_SYM_PAUSE | MAC_10 |
MAC_100 | MAC_1000FD | MAC_2500FD;
- /* Setup EEE. Choose 250us idle. */
+ /* Setup EEE. Choose 250us idle. Only supported in SGMII modes. */
+ __set_bit(PHY_INTERFACE_MODE_QSGMII, pp->phylink_config.lpi_interfaces);
+ __set_bit(PHY_INTERFACE_MODE_SGMII, pp->phylink_config.lpi_interfaces);
pp->phylink_config.lpi_capabilities = MAC_100FD | MAC_1000FD;
pp->phylink_config.lpi_timer_limit_us = 255;
pp->phylink_config.lpi_timer_default = 250;
--
2.30.2
^ permalink raw reply related [flat|nested] 39+ messages in thread
* [PATCH RFC net-next 14/23] net: mvpp2: add EEE implementation
2024-11-26 12:51 [PATCH RFC net-next 00/23] net: phylink managed EEE support Russell King (Oracle)
` (12 preceding siblings ...)
2024-11-26 12:53 ` [PATCH RFC net-next 13/23] net: mvneta: only allow EEE to be used in "SGMII" modes Russell King (Oracle)
@ 2024-11-26 12:53 ` Russell King (Oracle)
2024-11-26 12:53 ` [PATCH RFC net-next 15/23] net: lan743x: use netdev in lan743x_phylink_mac_link_down() Russell King (Oracle)
` (13 subsequent siblings)
27 siblings, 0 replies; 39+ messages in thread
From: Russell King (Oracle) @ 2024-11-26 12:53 UTC (permalink / raw)
To: Andrew Lunn, Heiner Kallweit
Cc: Alexandre Torgue, Andrew Lunn, Bryan Whitehead, David S. Miller,
Eric Dumazet, Florian Fainelli, Jakub Kicinski, Jose Abreu,
linux-arm-kernel, linux-stm32, Marcin Wojtas, Maxime Coquelin,
netdev, Oleksij Rempel, Paolo Abeni, UNGLinuxDriver
Add EEE support for mvpp2, using phylink's EEE implementation, which
means we just need to implement the two methods for LPI control, and
with the initial configuration. Only SGMII mode is supported, so only
100M and 1G speeds.
Disabling LPI requires clearing a single bit. Enabling LPI needs a full
configuration of several values, as the timer values are dependent on
the MAC operating speed.
Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
---
drivers/net/ethernet/marvell/mvpp2/mvpp2.h | 5 ++
.../net/ethernet/marvell/mvpp2/mvpp2_main.c | 88 +++++++++++++++++++
2 files changed, 93 insertions(+)
diff --git a/drivers/net/ethernet/marvell/mvpp2/mvpp2.h b/drivers/net/ethernet/marvell/mvpp2/mvpp2.h
index 9e02e4367bec..364d038da7ea 100644
--- a/drivers/net/ethernet/marvell/mvpp2/mvpp2.h
+++ b/drivers/net/ethernet/marvell/mvpp2/mvpp2.h
@@ -481,6 +481,11 @@
#define MVPP22_GMAC_INT_SUM_MASK 0xa4
#define MVPP22_GMAC_INT_SUM_MASK_LINK_STAT BIT(1)
#define MVPP22_GMAC_INT_SUM_MASK_PTP BIT(2)
+#define MVPP2_GMAC_LPI_CTRL0 0xc0
+#define MVPP2_GMAC_LPI_CTRL0_TS_MASK GENMASK(8, 8)
+#define MVPP2_GMAC_LPI_CTRL1 0xc4
+#define MVPP2_GMAC_LPI_CTRL1_REQ_EN BIT(0)
+#define MVPP2_GMAC_LPI_CTRL1_TW_MASK GENMASK(15, 4)
/* Per-port XGMAC registers. PPv2.2 and PPv2.3, only for GOP port 0,
* relative to port->base.
diff --git a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
index 571631a30320..d840819abcd4 100644
--- a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
+++ b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
@@ -5757,6 +5757,28 @@ static int mvpp2_ethtool_set_rxfh(struct net_device *dev,
return mvpp2_modify_rxfh_context(dev, NULL, rxfh, extack);
}
+static int mvpp2_ethtool_get_eee(struct net_device *dev,
+ struct ethtool_keee *eee)
+{
+ struct mvpp2_port *port = netdev_priv(dev);
+
+ if (!port->phylink)
+ return -EOPNOTSUPP;
+
+ return phylink_ethtool_get_eee(port->phylink, eee);
+}
+
+static int mvpp2_ethtool_set_eee(struct net_device *dev,
+ struct ethtool_keee *eee)
+{
+ struct mvpp2_port *port = netdev_priv(dev);
+
+ if (!port->phylink)
+ return -EOPNOTSUPP;
+
+ return phylink_ethtool_set_eee(port->phylink, eee);
+}
+
/* Device ops */
static const struct net_device_ops mvpp2_netdev_ops = {
@@ -5802,6 +5824,8 @@ static const struct ethtool_ops mvpp2_eth_tool_ops = {
.create_rxfh_context = mvpp2_create_rxfh_context,
.modify_rxfh_context = mvpp2_modify_rxfh_context,
.remove_rxfh_context = mvpp2_remove_rxfh_context,
+ .get_eee = mvpp2_ethtool_get_eee,
+ .set_eee = mvpp2_ethtool_set_eee,
};
/* Used for PPv2.1, or PPv2.2 with the old Device Tree binding that
@@ -6665,6 +6689,56 @@ static void mvpp2_mac_link_down(struct phylink_config *config,
mvpp2_port_disable(port);
}
+static void mvpp2_mac_disable_tx_lpi(struct phylink_config *config)
+{
+ struct mvpp2_port *port = mvpp2_phylink_to_port(config);
+
+ mvpp2_modify(port->base + MVPP2_GMAC_LPI_CTRL1,
+ MVPP2_GMAC_LPI_CTRL1_REQ_EN, 0);
+}
+
+static void mvpp2_mac_enable_tx_lpi(struct phylink_config *config, u32 timer,
+ bool tx_clk_stop)
+{
+ struct mvpp2_port *port = mvpp2_phylink_to_port(config);
+ u32 ts, tw, lpi1, status;
+
+ status = readl(port->base + MVPP2_GMAC_STATUS0);
+ if (status & MVPP2_GMAC_STATUS0_GMII_SPEED) {
+ /* At 1G speeds, the timer resolution are 1us, and
+ * 802.3 says tw is 16.5us. Round up to 17us.
+ */
+ tw = 17;
+ ts = timer;
+ } else {
+ /* At 100M speeds, the timer resolutions are 10us, and
+ * 802.3 says tw is 30us.
+ */
+ tw = 3;
+ ts = DIV_ROUND_UP(timer, 10);
+ }
+
+ if (ts > 255)
+ ts = 255;
+
+ /* Ensure LPI generation is disabled */
+ lpi1 = readl(port->base + MVPP2_GMAC_LPI_CTRL1);
+ writel(lpi1 & ~MVPP2_GMAC_LPI_CTRL1_REQ_EN,
+ port->base + MVPP2_GMAC_LPI_CTRL1);
+
+ /* Configure ts */
+ mvpp2_modify(port->base + MVPP2_GMAC_LPI_CTRL0,
+ MVPP2_GMAC_LPI_CTRL0_TS_MASK,
+ FIELD_PREP(MVPP2_GMAC_LPI_CTRL0_TS_MASK, ts));
+
+ /* Configure tw */
+ lpi1 = u32_replace_bits(lpi1, MVPP2_GMAC_LPI_CTRL1_TW_MASK, tw);
+
+ /* Enable LPI generation */
+ writel(lpi1 | MVPP2_GMAC_LPI_CTRL1_REQ_EN,
+ port->base + MVPP2_GMAC_LPI_CTRL1);
+}
+
static const struct phylink_mac_ops mvpp2_phylink_ops = {
.mac_select_pcs = mvpp2_select_pcs,
.mac_prepare = mvpp2_mac_prepare,
@@ -6672,6 +6746,8 @@ static const struct phylink_mac_ops mvpp2_phylink_ops = {
.mac_finish = mvpp2_mac_finish,
.mac_link_up = mvpp2_mac_link_up,
.mac_link_down = mvpp2_mac_link_down,
+ .mac_enable_tx_lpi = mvpp2_mac_enable_tx_lpi,
+ .mac_disable_tx_lpi = mvpp2_mac_disable_tx_lpi,
};
/* Work-around for ACPI */
@@ -6950,6 +7026,16 @@ static int mvpp2_port_probe(struct platform_device *pdev,
port->phylink_config.mac_capabilities =
MAC_2500FD | MAC_1000FD | MAC_100 | MAC_10;
+ __set_bit(PHY_INTERFACE_MODE_SGMII,
+ port->phylink_config.lpi_interfaces);
+
+ port->phylink_config.lpi_capabilities = MAC_1000FD | MAC_100FD;
+
+ /* Setup EEE. Choose 250us idle. */
+ port->phylink_config.lpi_timer_limit_us = 255;
+ port->phylink_config.lpi_timer_default = 250;
+ port->phylink_config.eee_enabled_default = true;
+
if (port->priv->global_tx_fc)
port->phylink_config.mac_capabilities |=
MAC_SYM_PAUSE | MAC_ASYM_PAUSE;
@@ -7024,6 +7110,8 @@ static int mvpp2_port_probe(struct platform_device *pdev,
goto err_free_port_pcpu;
}
port->phylink = phylink;
+
+ mvpp2_mac_disable_tx_lpi(&port->phylink_config);
} else {
dev_warn(&pdev->dev, "Use link irqs for port#%d. FW update required\n", port->id);
port->phylink = NULL;
--
2.30.2
^ permalink raw reply related [flat|nested] 39+ messages in thread
* [PATCH RFC net-next 15/23] net: lan743x: use netdev in lan743x_phylink_mac_link_down()
2024-11-26 12:51 [PATCH RFC net-next 00/23] net: phylink managed EEE support Russell King (Oracle)
` (13 preceding siblings ...)
2024-11-26 12:53 ` [PATCH RFC net-next 14/23] net: mvpp2: add EEE implementation Russell King (Oracle)
@ 2024-11-26 12:53 ` Russell King (Oracle)
2024-11-26 12:53 ` [PATCH RFC net-next 16/23] net: lan743x: convert to phylink managed EEE Russell King (Oracle)
` (12 subsequent siblings)
27 siblings, 0 replies; 39+ messages in thread
From: Russell King (Oracle) @ 2024-11-26 12:53 UTC (permalink / raw)
To: Andrew Lunn, Heiner Kallweit
Cc: Alexandre Torgue, Andrew Lunn, Bryan Whitehead, David S. Miller,
Eric Dumazet, Florian Fainelli, Jakub Kicinski, Jose Abreu,
linux-arm-kernel, linux-stm32, Marcin Wojtas, Maxime Coquelin,
netdev, Oleksij Rempel, Paolo Abeni, UNGLinuxDriver
Use the netdev that we already have in lan743x_phylink_mac_link_down().
Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
---
drivers/net/ethernet/microchip/lan743x_main.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/microchip/lan743x_main.c b/drivers/net/ethernet/microchip/lan743x_main.c
index 4dc5adcda6a3..8d7ad021ac70 100644
--- a/drivers/net/ethernet/microchip/lan743x_main.c
+++ b/drivers/net/ethernet/microchip/lan743x_main.c
@@ -3029,7 +3029,7 @@ static void lan743x_phylink_mac_link_down(struct phylink_config *config,
struct net_device *netdev = to_net_dev(config->dev);
struct lan743x_adapter *adapter = netdev_priv(netdev);
- netif_tx_stop_all_queues(to_net_dev(config->dev));
+ netif_tx_stop_all_queues(netdev);
lan743x_mac_eee_enable(adapter, false);
}
--
2.30.2
^ permalink raw reply related [flat|nested] 39+ messages in thread
* [PATCH RFC net-next 16/23] net: lan743x: convert to phylink managed EEE
2024-11-26 12:51 [PATCH RFC net-next 00/23] net: phylink managed EEE support Russell King (Oracle)
` (14 preceding siblings ...)
2024-11-26 12:53 ` [PATCH RFC net-next 15/23] net: lan743x: use netdev in lan743x_phylink_mac_link_down() Russell King (Oracle)
@ 2024-11-26 12:53 ` Russell King (Oracle)
2024-11-26 12:53 ` [PATCH RFC net-next 17/23] net: stmmac: move tx_lpi_timer tracking to phylib Russell King (Oracle)
` (11 subsequent siblings)
27 siblings, 0 replies; 39+ messages in thread
From: Russell King (Oracle) @ 2024-11-26 12:53 UTC (permalink / raw)
To: Andrew Lunn, Heiner Kallweit
Cc: Alexandre Torgue, Andrew Lunn, Bryan Whitehead, David S. Miller,
Eric Dumazet, Florian Fainelli, Jakub Kicinski, Jose Abreu,
linux-arm-kernel, linux-stm32, Marcin Wojtas, Maxime Coquelin,
netdev, Oleksij Rempel, Paolo Abeni, UNGLinuxDriver
Convert lan743x to phylink managed EEE:
- Set the lpi_capabilties.
- Move the call to lan743x_mac_eee_enable() into the enable/disable
tx_lpi functions.
- Ensure that EEEEN is clear during probe.
- Move the setting of the LPI timer into mac_enable_tx_lpi().
- Move reading of LPI timer to phylink initialisation to set the
default timer value.
Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
---
.../net/ethernet/microchip/lan743x_ethtool.c | 21 -----------
drivers/net/ethernet/microchip/lan743x_main.c | 37 ++++++++++++++++---
drivers/net/ethernet/microchip/lan743x_main.h | 1 -
3 files changed, 31 insertions(+), 28 deletions(-)
diff --git a/drivers/net/ethernet/microchip/lan743x_ethtool.c b/drivers/net/ethernet/microchip/lan743x_ethtool.c
index 1a1cbd034eda..1459acfb1e61 100644
--- a/drivers/net/ethernet/microchip/lan743x_ethtool.c
+++ b/drivers/net/ethernet/microchip/lan743x_ethtool.c
@@ -1055,9 +1055,6 @@ static int lan743x_ethtool_get_eee(struct net_device *netdev,
{
struct lan743x_adapter *adapter = netdev_priv(netdev);
- eee->tx_lpi_timer = lan743x_csr_read(adapter,
- MAC_EEE_TX_LPI_REQ_DLY_CNT);
-
return phylink_ethtool_get_eee(adapter->phylink, eee);
}
@@ -1065,24 +1062,6 @@ static int lan743x_ethtool_set_eee(struct net_device *netdev,
struct ethtool_keee *eee)
{
struct lan743x_adapter *adapter = netdev_priv(netdev);
- u32 tx_lpi_timer;
-
- tx_lpi_timer = lan743x_csr_read(adapter, MAC_EEE_TX_LPI_REQ_DLY_CNT);
- if (tx_lpi_timer != eee->tx_lpi_timer) {
- u32 mac_cr = lan743x_csr_read(adapter, MAC_CR);
-
- /* Software should only change this field when Energy Efficient
- * Ethernet Enable (EEEEN) is cleared.
- * This function will trigger an autonegotiation restart and
- * eee will be reenabled during link up if eee was negotiated.
- */
- lan743x_mac_eee_enable(adapter, false);
- lan743x_csr_write(adapter, MAC_EEE_TX_LPI_REQ_DLY_CNT,
- eee->tx_lpi_timer);
-
- if (mac_cr & MAC_CR_EEE_EN_)
- lan743x_mac_eee_enable(adapter, true);
- }
return phylink_ethtool_set_eee(adapter->phylink, eee);
}
diff --git a/drivers/net/ethernet/microchip/lan743x_main.c b/drivers/net/ethernet/microchip/lan743x_main.c
index 8d7ad021ac70..25d37a2cb4a6 100644
--- a/drivers/net/ethernet/microchip/lan743x_main.c
+++ b/drivers/net/ethernet/microchip/lan743x_main.c
@@ -2966,7 +2966,7 @@ static int lan743x_phylink_2500basex_config(struct lan743x_adapter *adapter)
return lan743x_pcs_power_reset(adapter);
}
-void lan743x_mac_eee_enable(struct lan743x_adapter *adapter, bool enable)
+static void lan743x_mac_eee_enable(struct lan743x_adapter *adapter, bool enable)
{
u32 mac_cr;
@@ -3027,10 +3027,8 @@ static void lan743x_phylink_mac_link_down(struct phylink_config *config,
phy_interface_t interface)
{
struct net_device *netdev = to_net_dev(config->dev);
- struct lan743x_adapter *adapter = netdev_priv(netdev);
netif_tx_stop_all_queues(netdev);
- lan743x_mac_eee_enable(adapter, false);
}
static void lan743x_phylink_mac_link_up(struct phylink_config *config,
@@ -3072,16 +3070,32 @@ static void lan743x_phylink_mac_link_up(struct phylink_config *config,
cap & FLOW_CTRL_TX,
cap & FLOW_CTRL_RX);
- if (phydev)
- lan743x_mac_eee_enable(adapter, phydev->enable_tx_lpi);
-
netif_tx_wake_all_queues(netdev);
}
+static void mac_disable_tx_lpi(struct phylink_config *config)
+{
+ lan743x_mac_eee_enable(adapter, false);
+}
+
+static void mac_enable_tx_lpi(struct phylink_config *config, u32 timer,
+ bool tx_clk_stop)
+{
+ /* Software should only change this field when Energy Efficient
+ * Ethernet Enable (EEEEN) is cleared. We ensure that by clearing
+ * EEEEN during probe, and phylink itself guarantees that
+ * mac_disable_tx_lpi() will have been previously called.
+ */
+ lan743x_csr_write(adapter, MAC_EEE_TX_LPI_REQ_DLY_CNT, timer);
+ lan743x_mac_eee_enable(adapter, true);
+}
+
static const struct phylink_mac_ops lan743x_phylink_mac_ops = {
.mac_config = lan743x_phylink_mac_config,
.mac_link_down = lan743x_phylink_mac_link_down,
.mac_link_up = lan743x_phylink_mac_link_up,
+ .mac_disable_tx_lpi = lan743x_mac_disable_tx_lpi,
+ .mac_enable_tx_lpi = lan743x_mac_enable_tx_lpi,
};
static int lan743x_phylink_create(struct lan743x_adapter *adapter)
@@ -3095,6 +3109,10 @@ static int lan743x_phylink_create(struct lan743x_adapter *adapter)
adapter->phylink_config.mac_capabilities = MAC_ASYM_PAUSE |
MAC_SYM_PAUSE | MAC_10 | MAC_100 | MAC_1000FD;
+ adapter->phylink_config.lpi_capabilities = MAC_100FD | MAC_1000FD;
+ adapter->phylink_config.lpi_timer_max = U32_MAX;
+ adapter->phylink_config.lpi_timer_default =
+ lan743x_csr_read(adapter, MAC_EEE_TX_LPI_REQ_DLY_CNT);
lan743x_phy_interface_select(adapter);
@@ -3120,6 +3138,10 @@ static int lan743x_phylink_create(struct lan743x_adapter *adapter)
phy_interface_set_rgmii(adapter->phylink_config.supported_interfaces);
}
+ memcpy(adapter->phylink_config.lpi_interfaces,
+ adapter->phylink_config.supported_interfaces,
+ sizeof(adapter->phylink_config.lpi_interfaces));
+
pl = phylink_create(&adapter->phylink_config, NULL,
adapter->phy_interface, &lan743x_phylink_mac_ops);
@@ -3517,6 +3539,9 @@ static int lan743x_hardware_init(struct lan743x_adapter *adapter,
spin_lock_init(&tx->ring_lock);
}
+ /* Ensure EEEEN is clear */
+ lan743x_mac_eee_enable(adapter, false);
+
return 0;
}
diff --git a/drivers/net/ethernet/microchip/lan743x_main.h b/drivers/net/ethernet/microchip/lan743x_main.h
index 8ef897c114d3..7f73d66854be 100644
--- a/drivers/net/ethernet/microchip/lan743x_main.h
+++ b/drivers/net/ethernet/microchip/lan743x_main.h
@@ -1206,6 +1206,5 @@ void lan743x_hs_syslock_release(struct lan743x_adapter *adapter);
void lan743x_mac_flow_ctrl_set_enables(struct lan743x_adapter *adapter,
bool tx_enable, bool rx_enable);
int lan743x_sgmii_read(struct lan743x_adapter *adapter, u8 mmd, u16 addr);
-void lan743x_mac_eee_enable(struct lan743x_adapter *adapter, bool enable);
#endif /* _LAN743X_H */
--
2.30.2
^ permalink raw reply related [flat|nested] 39+ messages in thread
* [PATCH RFC net-next 17/23] net: stmmac: move tx_lpi_timer tracking to phylib
2024-11-26 12:51 [PATCH RFC net-next 00/23] net: phylink managed EEE support Russell King (Oracle)
` (15 preceding siblings ...)
2024-11-26 12:53 ` [PATCH RFC net-next 16/23] net: lan743x: convert to phylink managed EEE Russell King (Oracle)
@ 2024-11-26 12:53 ` Russell King (Oracle)
2024-11-26 12:53 ` [PATCH RFC net-next 18/23] net: stmmac: make EEE depend on phy->enable_tx_lpi Russell King (Oracle)
` (10 subsequent siblings)
27 siblings, 0 replies; 39+ messages in thread
From: Russell King (Oracle) @ 2024-11-26 12:53 UTC (permalink / raw)
To: Andrew Lunn, Heiner Kallweit
Cc: Alexandre Torgue, Andrew Lunn, Bryan Whitehead, David S. Miller,
Eric Dumazet, Florian Fainelli, Jakub Kicinski, Jose Abreu,
linux-arm-kernel, linux-stm32, Marcin Wojtas, Maxime Coquelin,
netdev, Oleksij Rempel, Paolo Abeni, UNGLinuxDriver
When stmmac_ethtool_op_get_eee() is called, stmmac sets the tx_lpi_timer
and tx_lpi_enabled members, and then calls into phylink and thus phylib.
phylib overwrites these members.
phylib will also cause a link down/link up transition when settings
that impact the MAC have been changed.
Convert stmmac to use the tx_lpi_timer setting in struct phy_device,
updating priv->tx_lpi_timer each time when the link comes up, rather
than trying to maintain this user setting itself. We initialise the
phylib tx_lpi_timer setting by doing a get_ee-modify-set_eee sequence
with the last known priv->tx_lpi_timer value. In order for this to work
correctly, we also need this member to be initialised earlier.
Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
---
.../ethernet/stmicro/stmmac/stmmac_ethtool.c | 14 +-------------
.../net/ethernet/stmicro/stmmac/stmmac_main.c | 18 ++++++++++++++----
2 files changed, 15 insertions(+), 17 deletions(-)
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c
index 1d77389ce953..5ce095a62feb 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c
@@ -898,7 +898,6 @@ static int stmmac_ethtool_op_get_eee(struct net_device *dev,
if (!priv->dma_cap.eee)
return -EOPNOTSUPP;
- edata->tx_lpi_timer = priv->tx_lpi_timer;
edata->tx_lpi_enabled = priv->tx_lpi_enabled;
return phylink_ethtool_get_eee(priv->phylink, edata);
@@ -908,7 +907,6 @@ static int stmmac_ethtool_op_set_eee(struct net_device *dev,
struct ethtool_keee *edata)
{
struct stmmac_priv *priv = netdev_priv(dev);
- int ret;
if (!priv->dma_cap.eee)
return -EOPNOTSUPP;
@@ -920,17 +918,7 @@ static int stmmac_ethtool_op_set_eee(struct net_device *dev,
if (!edata->eee_enabled)
stmmac_disable_eee_mode(priv);
- ret = phylink_ethtool_set_eee(priv->phylink, edata);
- if (ret)
- return ret;
-
- if (edata->eee_enabled &&
- priv->tx_lpi_timer != edata->tx_lpi_timer) {
- priv->tx_lpi_timer = edata->tx_lpi_timer;
- stmmac_eee_init(priv);
- }
-
- return 0;
+ return phylink_ethtool_set_eee(priv->phylink, edata);
}
static u32 stmmac_usec2riwt(u32 usec, struct stmmac_priv *priv)
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index 3cdc3910f3a0..61d85281d75b 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -1088,6 +1088,7 @@ static void stmmac_mac_link_up(struct phylink_config *config,
phy_init_eee(phy, !(priv->plat->flags &
STMMAC_FLAG_RX_CLK_RUNS_IN_LPI)) >= 0;
priv->eee_enabled = stmmac_eee_init(priv);
+ priv->tx_lpi_timer = phy->eee_cfg.tx_lpi_timer;
priv->tx_lpi_enabled = priv->eee_enabled;
stmmac_set_eee_pls(priv, priv->hw, true);
}
@@ -1183,6 +1184,15 @@ static int stmmac_init_phy(struct net_device *dev)
ret = phylink_fwnode_phy_connect(priv->phylink, fwnode, 0);
}
+ if (ret == 0) {
+ struct ethtool_keee eee;
+
+ if (phylink_ethtool_get_eee(priv->phylink, &eee)) {
+ eee.tx_lpi_timer = priv->tx_lpi_timer;
+ phylink_ethtool_set_eee(priv->phylink, &eee);
+ }
+ }
+
if (!priv->plat->pmt) {
struct ethtool_wolinfo wol = { .cmd = ETHTOOL_GWOL };
@@ -3435,10 +3445,6 @@ static int stmmac_hw_setup(struct net_device *dev, bool ptp_register)
priv->eee_tw_timer = STMMAC_DEFAULT_TWT_LS;
- /* Convert the timer from msec to usec */
- if (!priv->tx_lpi_timer)
- priv->tx_lpi_timer = eee_timer * 1000;
-
if (priv->use_riwt) {
u32 queue;
@@ -3905,6 +3911,10 @@ static int __stmmac_open(struct net_device *dev,
u32 chan;
int ret;
+ /* Initialise the tx lpi timer, converting from msec to usec */
+ if (!priv->tx_lpi_timer)
+ priv->tx_lpi_timer = eee_timer * 1000;
+
ret = pm_runtime_resume_and_get(priv->device);
if (ret < 0)
return ret;
--
2.30.2
^ permalink raw reply related [flat|nested] 39+ messages in thread
* [PATCH RFC net-next 18/23] net: stmmac: make EEE depend on phy->enable_tx_lpi
2024-11-26 12:51 [PATCH RFC net-next 00/23] net: phylink managed EEE support Russell King (Oracle)
` (16 preceding siblings ...)
2024-11-26 12:53 ` [PATCH RFC net-next 17/23] net: stmmac: move tx_lpi_timer tracking to phylib Russell King (Oracle)
@ 2024-11-26 12:53 ` Russell King (Oracle)
2024-11-26 12:53 ` [PATCH RFC net-next 19/23] net: stmmac: remove redundant code from ethtool EEE ops Russell King (Oracle)
` (9 subsequent siblings)
27 siblings, 0 replies; 39+ messages in thread
From: Russell King (Oracle) @ 2024-11-26 12:53 UTC (permalink / raw)
To: Andrew Lunn, Heiner Kallweit
Cc: Alexandre Torgue, Andrew Lunn, Bryan Whitehead, David S. Miller,
Eric Dumazet, Florian Fainelli, Jakub Kicinski, Jose Abreu,
linux-arm-kernel, linux-stm32, Marcin Wojtas, Maxime Coquelin,
netdev, Oleksij Rempel, Paolo Abeni, UNGLinuxDriver
Make stmmac EEE depend on phylib's evaluation of user settings and PHY
negotiation, as indicated by phy->enable_tx_lpi. This will ensure when
phylib has evaluated that the user has disabled LPI, phy_init_eee()
will not be called, and priv->eee_active will be false, causing LPI/EEE
to be disabled.
Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
---
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index 61d85281d75b..8bdf8bc9a728 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -1084,7 +1084,7 @@ static void stmmac_mac_link_up(struct phylink_config *config,
stmmac_mac_set(priv, priv->ioaddr, true);
if (phy && priv->dma_cap.eee) {
- priv->eee_active =
+ priv->eee_active = phy->enable_tx_lpi &&
phy_init_eee(phy, !(priv->plat->flags &
STMMAC_FLAG_RX_CLK_RUNS_IN_LPI)) >= 0;
priv->eee_enabled = stmmac_eee_init(priv);
--
2.30.2
^ permalink raw reply related [flat|nested] 39+ messages in thread
* [PATCH RFC net-next 19/23] net: stmmac: remove redundant code from ethtool EEE ops
2024-11-26 12:51 [PATCH RFC net-next 00/23] net: phylink managed EEE support Russell King (Oracle)
` (17 preceding siblings ...)
2024-11-26 12:53 ` [PATCH RFC net-next 18/23] net: stmmac: make EEE depend on phy->enable_tx_lpi Russell King (Oracle)
@ 2024-11-26 12:53 ` Russell King (Oracle)
2024-11-26 12:53 ` [PATCH RFC net-next 20/23] net: stmmac: remove priv->tx_lpi_enabled Russell King (Oracle)
` (8 subsequent siblings)
27 siblings, 0 replies; 39+ messages in thread
From: Russell King (Oracle) @ 2024-11-26 12:53 UTC (permalink / raw)
To: Andrew Lunn, Heiner Kallweit
Cc: Alexandre Torgue, Andrew Lunn, Bryan Whitehead, David S. Miller,
Eric Dumazet, Florian Fainelli, Jakub Kicinski, Jose Abreu,
linux-arm-kernel, linux-stm32, Marcin Wojtas, Maxime Coquelin,
netdev, Oleksij Rempel, Paolo Abeni, UNGLinuxDriver
Now that stmmac is using the result of phylib's evaluation of EEE,
there is no need to handle anything in the ethtool EEE ops other than
calling through to the appropriate phylink function, which will pass
on to phylib the users request.
Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
---
drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c | 9 ---------
1 file changed, 9 deletions(-)
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c
index 5ce095a62feb..3a10788bb210 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c
@@ -898,8 +898,6 @@ static int stmmac_ethtool_op_get_eee(struct net_device *dev,
if (!priv->dma_cap.eee)
return -EOPNOTSUPP;
- edata->tx_lpi_enabled = priv->tx_lpi_enabled;
-
return phylink_ethtool_get_eee(priv->phylink, edata);
}
@@ -911,13 +909,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);
-
return phylink_ethtool_set_eee(priv->phylink, edata);
}
--
2.30.2
^ permalink raw reply related [flat|nested] 39+ messages in thread
* [PATCH RFC net-next 20/23] net: stmmac: remove priv->tx_lpi_enabled
2024-11-26 12:51 [PATCH RFC net-next 00/23] net: phylink managed EEE support Russell King (Oracle)
` (18 preceding siblings ...)
2024-11-26 12:53 ` [PATCH RFC net-next 19/23] net: stmmac: remove redundant code from ethtool EEE ops Russell King (Oracle)
@ 2024-11-26 12:53 ` Russell King (Oracle)
2024-11-26 12:53 ` [PATCH RFC net-next 21/23] net: stmmac: report EEE errors if EEE is supported Russell King (Oracle)
` (7 subsequent siblings)
27 siblings, 0 replies; 39+ messages in thread
From: Russell King (Oracle) @ 2024-11-26 12:53 UTC (permalink / raw)
To: Andrew Lunn, Heiner Kallweit
Cc: Alexandre Torgue, Andrew Lunn, Bryan Whitehead, David S. Miller,
Eric Dumazet, Florian Fainelli, Jakub Kicinski, Jose Abreu,
linux-arm-kernel, linux-stm32, Marcin Wojtas, Maxime Coquelin,
netdev, Oleksij Rempel, Paolo Abeni, UNGLinuxDriver
Through using phylib's EEE state, priv->tx_lpi_enabled has become a
write-only variable. Remove it.
Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
---
drivers/net/ethernet/stmicro/stmmac/stmmac.h | 1 -
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 2 --
2 files changed, 3 deletions(-)
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac.h b/drivers/net/ethernet/stmicro/stmmac/stmmac.h
index 1d86439b8a14..77a7a098ebd1 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac.h
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac.h
@@ -310,7 +310,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_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index 8bdf8bc9a728..7924808fec08 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -974,7 +974,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);
@@ -1089,7 +1088,6 @@ static void stmmac_mac_link_up(struct phylink_config *config,
STMMAC_FLAG_RX_CLK_RUNS_IN_LPI)) >= 0;
priv->eee_enabled = stmmac_eee_init(priv);
priv->tx_lpi_timer = phy->eee_cfg.tx_lpi_timer;
- priv->tx_lpi_enabled = priv->eee_enabled;
stmmac_set_eee_pls(priv, priv->hw, true);
}
--
2.30.2
^ permalink raw reply related [flat|nested] 39+ messages in thread
* [PATCH RFC net-next 21/23] net: stmmac: report EEE errors if EEE is supported
2024-11-26 12:51 [PATCH RFC net-next 00/23] net: phylink managed EEE support Russell King (Oracle)
` (19 preceding siblings ...)
2024-11-26 12:53 ` [PATCH RFC net-next 20/23] net: stmmac: remove priv->tx_lpi_enabled Russell King (Oracle)
@ 2024-11-26 12:53 ` Russell King (Oracle)
2024-11-26 12:54 ` [PATCH RFC net-next 22/23] net: stmmac: convert to use phy_eee_rx_clock_stop() Russell King (Oracle)
` (6 subsequent siblings)
27 siblings, 0 replies; 39+ messages in thread
From: Russell King (Oracle) @ 2024-11-26 12:53 UTC (permalink / raw)
To: Andrew Lunn, Heiner Kallweit
Cc: Alexandre Torgue, Andrew Lunn, Bryan Whitehead, David S. Miller,
Eric Dumazet, Florian Fainelli, Jakub Kicinski, Jose Abreu,
linux-arm-kernel, linux-stm32, Marcin Wojtas, Maxime Coquelin,
netdev, Oleksij Rempel, Paolo Abeni, UNGLinuxDriver
Report the number of EEE errors in the xstats even when EEE is not
enabled in hardware, but is supported. The PHY maintains this counter
even when EEE is not enabled.
Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
---
drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c
index 3a10788bb210..a33d7db810f0 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c
@@ -654,7 +654,7 @@ static void stmmac_get_ethtool_stats(struct net_device *dev,
(*(u32 *)p);
}
}
- if (priv->eee_enabled) {
+ if (priv->dma_cap.eee) {
int val = phylink_get_eee_err(priv->phylink);
if (val)
priv->xstats.phy_eee_wakeup_error_n = val;
--
2.30.2
^ permalink raw reply related [flat|nested] 39+ messages in thread
* [PATCH RFC net-next 22/23] net: stmmac: convert to use phy_eee_rx_clock_stop()
2024-11-26 12:51 [PATCH RFC net-next 00/23] net: phylink managed EEE support Russell King (Oracle)
` (20 preceding siblings ...)
2024-11-26 12:53 ` [PATCH RFC net-next 21/23] net: stmmac: report EEE errors if EEE is supported Russell King (Oracle)
@ 2024-11-26 12:54 ` Russell King (Oracle)
2024-11-26 12:54 ` [PATCH RFC net-next 23/23] net: stmmac: convert to phylink managed EEE support Russell King (Oracle)
` (5 subsequent siblings)
27 siblings, 0 replies; 39+ messages in thread
From: Russell King (Oracle) @ 2024-11-26 12:54 UTC (permalink / raw)
To: Andrew Lunn, Heiner Kallweit
Cc: Alexandre Torgue, Andrew Lunn, Bryan Whitehead, David S. Miller,
Eric Dumazet, Florian Fainelli, Jakub Kicinski, Jose Abreu,
linux-arm-kernel, linux-stm32, Marcin Wojtas, Maxime Coquelin,
netdev, Oleksij Rempel, Paolo Abeni, UNGLinuxDriver
Convert stmmac to use phy_eee_rx_clock_stop() to set the PHY receive
clock stop in LPI setting, rather than calling the legacy
phy_init_eee() function.
Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
---
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index 7924808fec08..66a43a9aa469 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -1083,9 +1083,9 @@ static void stmmac_mac_link_up(struct phylink_config *config,
stmmac_mac_set(priv, priv->ioaddr, true);
if (phy && priv->dma_cap.eee) {
- priv->eee_active = phy->enable_tx_lpi &&
- phy_init_eee(phy, !(priv->plat->flags &
- STMMAC_FLAG_RX_CLK_RUNS_IN_LPI)) >= 0;
+ phy_eee_rx_clock_stop(phy, !(priv->plat->flags &
+ STMMAC_FLAG_RX_CLK_RUNS_IN_LPI));
+ priv->eee_active = phy->enable_tx_lpi;
priv->eee_enabled = stmmac_eee_init(priv);
priv->tx_lpi_timer = phy->eee_cfg.tx_lpi_timer;
stmmac_set_eee_pls(priv, priv->hw, true);
--
2.30.2
^ permalink raw reply related [flat|nested] 39+ messages in thread
* [PATCH RFC net-next 23/23] net: stmmac: convert to phylink managed EEE support
2024-11-26 12:51 [PATCH RFC net-next 00/23] net: phylink managed EEE support Russell King (Oracle)
` (21 preceding siblings ...)
2024-11-26 12:54 ` [PATCH RFC net-next 22/23] net: stmmac: convert to use phy_eee_rx_clock_stop() Russell King (Oracle)
@ 2024-11-26 12:54 ` Russell King (Oracle)
2024-11-26 13:01 ` [PATCH RFC net-next 00/23] net: " Russell King (Oracle)
` (4 subsequent siblings)
27 siblings, 0 replies; 39+ messages in thread
From: Russell King (Oracle) @ 2024-11-26 12:54 UTC (permalink / raw)
To: Andrew Lunn, Heiner Kallweit
Cc: Alexandre Torgue, Andrew Lunn, Bryan Whitehead, David S. Miller,
Eric Dumazet, Florian Fainelli, Jakub Kicinski, Jose Abreu,
linux-arm-kernel, linux-stm32, Marcin Wojtas, Maxime Coquelin,
netdev, Oleksij Rempel, Paolo Abeni, UNGLinuxDriver
Convert stmmac to use phylink managed EEE support rather than delving
into phylib.
Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
---
.../net/ethernet/stmicro/stmmac/stmmac_main.c | 50 +++++++++++++++----
1 file changed, 39 insertions(+), 11 deletions(-)
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index 66a43a9aa469..39a4f0da82e5 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -973,9 +973,6 @@ static void stmmac_mac_link_down(struct phylink_config *config,
struct stmmac_priv *priv = netdev_priv(to_net_dev(config->dev));
stmmac_mac_set(priv, priv->ioaddr, false);
- priv->eee_active = false;
- priv->eee_enabled = stmmac_eee_init(priv);
- stmmac_set_eee_pls(priv, priv->hw, false);
if (stmmac_fpe_supported(priv))
stmmac_fpe_link_state_handle(priv, false);
@@ -1082,14 +1079,6 @@ static void stmmac_mac_link_up(struct phylink_config *config,
writel(ctrl, priv->ioaddr + MAC_CTRL_REG);
stmmac_mac_set(priv, priv->ioaddr, true);
- if (phy && priv->dma_cap.eee) {
- phy_eee_rx_clock_stop(phy, !(priv->plat->flags &
- STMMAC_FLAG_RX_CLK_RUNS_IN_LPI));
- priv->eee_active = phy->enable_tx_lpi;
- priv->eee_enabled = stmmac_eee_init(priv);
- priv->tx_lpi_timer = phy->eee_cfg.tx_lpi_timer;
- stmmac_set_eee_pls(priv, priv->hw, true);
- }
if (stmmac_fpe_supported(priv))
stmmac_fpe_link_state_handle(priv, true);
@@ -1098,12 +1087,34 @@ static void stmmac_mac_link_up(struct phylink_config *config,
stmmac_hwtstamp_correct_latency(priv, priv);
}
+static void stmmac_mac_disable_tx_lpi(struct phylink_config *config)
+{
+ struct stmmac_priv *priv = netdev_priv(to_net_dev(config->dev));
+
+ priv->eee_active = false;
+ priv->eee_enabled = stmmac_eee_init(priv);
+ stmmac_set_eee_pls(priv, priv->hw, false);
+}
+
+static void stmmac_mac_enable_tx_lpi(struct phylink_config *config, u32 timer,
+ bool tx_clk_stop)
+{
+ struct stmmac_priv *priv = netdev_priv(to_net_dev(config->dev));
+
+ priv->eee_active = true;
+ priv->eee_enabled = stmmac_eee_init(priv);
+ priv->tx_lpi_timer = timer;
+ stmmac_set_eee_pls(priv, priv->hw, true);
+}
+
static const struct phylink_mac_ops stmmac_phylink_mac_ops = {
.mac_get_caps = stmmac_mac_get_caps,
.mac_select_pcs = stmmac_mac_select_pcs,
.mac_config = stmmac_mac_config,
.mac_link_down = stmmac_mac_link_down,
.mac_link_up = stmmac_mac_link_up,
+ .mac_disable_tx_lpi = stmmac_mac_disable_tx_lpi,
+ .mac_mac_enable_tx_lpi = stmmac_mac_enable_tx_lpi,
};
/**
@@ -1216,6 +1227,18 @@ static int stmmac_phy_setup(struct stmmac_priv *priv)
/* Stmmac always requires an RX clock for hardware initialization */
priv->phylink_config.mac_requires_rxc = true;
+ if (!(priv->plat->flags & STMMAC_FLAG_RX_CLK_RUNS_IN_LPI))
+ priv->phylink_config.eee_rx_clk_stop_enable = true;
+
+ if (priv->dma_cap.eee) {
+ /* All full duplex speeds above 100Mbps are supported */
+ priv->phylink_config.lpi_capabilities = ~(MAC_1000FD - 1) |
+ MAC_100FD;
+ priv->phylink_config.lpi_timer_limit_us = U32_MAX;
+ priv->phylink_config.lpi_timer_default = eee_timer * 1000;
+ priv->phylink_config.eee_enabled_default = false;
+ }
+
mdio_bus_data = priv->plat->mdio_bus_data;
if (mdio_bus_data)
priv->phylink_config.default_an_inband =
@@ -1231,6 +1254,11 @@ static int stmmac_phy_setup(struct stmmac_priv *priv)
xpcs_get_interfaces(priv->hw->xpcs,
priv->phylink_config.supported_interfaces);
+ /* Assume all supported interfaces also support LPI */
+ memcpy(priv->phylink_config.lpi_interfaces,
+ priv->phylink_config.supported_interfaces,
+ sizeof(priv->phylink_config.lpi_interfaces));
+
fwnode = priv->plat->port_node;
if (!fwnode)
fwnode = dev_fwnode(priv->device);
--
2.30.2
^ permalink raw reply related [flat|nested] 39+ messages in thread
* Re: [PATCH RFC net-next 00/23] net: phylink managed EEE support
2024-11-26 12:51 [PATCH RFC net-next 00/23] net: phylink managed EEE support Russell King (Oracle)
` (22 preceding siblings ...)
2024-11-26 12:54 ` [PATCH RFC net-next 23/23] net: stmmac: convert to phylink managed EEE support Russell King (Oracle)
@ 2024-11-26 13:01 ` Russell King (Oracle)
2024-11-26 14:21 ` Oleksij Rempel
2024-11-26 16:55 ` Russell King (Oracle)
` (3 subsequent siblings)
27 siblings, 1 reply; 39+ messages in thread
From: Russell King (Oracle) @ 2024-11-26 13:01 UTC (permalink / raw)
To: Andrew Lunn, Heiner Kallweit
Cc: Alexandre Torgue, Andrew Lunn, Bryan Whitehead, David S. Miller,
Eric Dumazet, Florian Fainelli, Jakub Kicinski, Jose Abreu,
linux-arm-kernel, linux-stm32, Marcin Wojtas, Maxime Coquelin,
netdev, Oleksij Rempel, Paolo Abeni, UNGLinuxDriver
On Tue, Nov 26, 2024 at 12:51:36PM +0000, Russell King (Oracle) wrote:
> Patch 11 adds phylink managed EEE support. Two new MAC APIs are added,
> to enable and disable LPI. The enable method is passed the LPI timer
> setting which it is expected to program into the hardware, and also a
> flag ehther the transmit clock should be stopped.
>
> *** There are open questions here. Eagle eyed reviewers will notice
> pl->config->lpi_interfaces. There are MACs out there which only
> support LPI signalling on a subset of their interface types. Phylib
> doesn't understand this. I'm handling this at the moment by simply
> not activating LPI at the MAC, but that leads to ethtool --show-eee
> suggesting that EEE is active when it isn't.
> *** Should we pass the phy_interface_t to these functions?
> *** Should mac_enable_tx_lpi() be allowed to fail if the MAC doesn't
> support the interface mode?
There is another point to raise here - should we have a "validate_eee"
method in struct phylink_mac_ops so that MAC drivers can validate
settings such as the tx_lpi_timer value can be programmed into the
hardware?
We do have the situation on Marvell platforms where the programmed
value depends on the MAC speed, and is only 8 bit, which makes
validating its value rather difficult - at 1G speeds, it's a
resolution of 1us so we can support up to 255us. At 100M speeds,
it's 10us, supporting up to 2.55ms. This makes it awkward to be able
to validate the set_eee() settings are sane for the hardware. Should
Marvell platforms instead implement a hrtimer above this? That sounds
a bit problematical to manage sanely.
--
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] 39+ messages in thread
* Re: [PATCH RFC net-next 00/23] net: phylink managed EEE support
2024-11-26 13:01 ` [PATCH RFC net-next 00/23] net: " Russell King (Oracle)
@ 2024-11-26 14:21 ` Oleksij Rempel
2024-11-26 16:14 ` Russell King (Oracle)
0 siblings, 1 reply; 39+ messages in thread
From: Oleksij Rempel @ 2024-11-26 14:21 UTC (permalink / raw)
To: Russell King (Oracle)
Cc: Andrew Lunn, Heiner Kallweit, Alexandre Torgue, Andrew Lunn,
Bryan Whitehead, David S. Miller, Eric Dumazet, Florian Fainelli,
Jakub Kicinski, Jose Abreu, linux-arm-kernel, linux-stm32,
Marcin Wojtas, Maxime Coquelin, netdev, Paolo Abeni,
UNGLinuxDriver
Hi Russell,
On Tue, Nov 26, 2024 at 01:01:11PM +0000, Russell King (Oracle) wrote:
> On Tue, Nov 26, 2024 at 12:51:36PM +0000, Russell King (Oracle) wrote:
> > Patch 11 adds phylink managed EEE support. Two new MAC APIs are added,
> > to enable and disable LPI. The enable method is passed the LPI timer
> > setting which it is expected to program into the hardware, and also a
> > flag ehther the transmit clock should be stopped.
> >
> > *** There are open questions here. Eagle eyed reviewers will notice
> > pl->config->lpi_interfaces. There are MACs out there which only
> > support LPI signalling on a subset of their interface types. Phylib
> > doesn't understand this. I'm handling this at the moment by simply
> > not activating LPI at the MAC, but that leads to ethtool --show-eee
> > suggesting that EEE is active when it isn't.
> > *** Should we pass the phy_interface_t to these functions?
> > *** Should mac_enable_tx_lpi() be allowed to fail if the MAC doesn't
> > support the interface mode?
>
> There is another point to raise here - should we have a "validate_eee"
> method in struct phylink_mac_ops so that MAC drivers can validate
> settings such as the tx_lpi_timer value can be programmed into the
> hardware?
>
> We do have the situation on Marvell platforms where the programmed
> value depends on the MAC speed, and is only 8 bit, which makes
> validating its value rather difficult - at 1G speeds, it's a
> resolution of 1us so we can support up to 255us. At 100M speeds,
> it's 10us, supporting up to 2.55ms. This makes it awkward to be able
> to validate the set_eee() settings are sane for the hardware. Should
> Marvell platforms instead implement a hrtimer above this? That sounds
> a bit problematical to manage sanely.
I agree that tx_lpi_timer can be a problem, and this is not just a
Marvell issue. For example, I think the FEC MAC on i.MX8MP might also
be affected. But I can't confirm this because I don't have an i.MX8MP
board with a PHY that supports MAC-controlled EEE mode. The Realtek PHY
I have uses PHY-controlled EEE (SmartEEE).
Except for this, I think there should be sane default values for
tx_lpi_timer. The IEEE 802.3-2022 standard (Section 78.2) describes EEE
timing, but it doesn’t give a clear recommendation for tx_lpi_timer.
IMO, the best value for tx_lpi_timer should be the sum of the time
needed to put the full chain (MAC -> PHY -> remote PHY) into sleep mode
and the time needed to wake the chain. These times are link-speed
specific, so defaults should consider PHY timings for each link speed.
Except for tx_lpi_timer, some MACs also allow configuration of the Twake
timer. For example, the FEC driver uses the lpi_timer value to
configure the Twake timer, and the LAN78xx driver also provides a
configurable Twake timer register.
If the Twake timer is not configured properly, or if the system has
quirks causing the actual Twake time to be longer than expected, it can
result in frame corruption.
Regards,
Oleksij
--
Pengutronix e.K. | |
Steuerwalder Str. 21 | http://www.pengutronix.de/ |
31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
^ permalink raw reply [flat|nested] 39+ messages in thread
* Re: [PATCH RFC net-next 00/23] net: phylink managed EEE support
2024-11-26 14:21 ` Oleksij Rempel
@ 2024-11-26 16:14 ` Russell King (Oracle)
0 siblings, 0 replies; 39+ messages in thread
From: Russell King (Oracle) @ 2024-11-26 16:14 UTC (permalink / raw)
To: Oleksij Rempel
Cc: Andrew Lunn, Heiner Kallweit, Alexandre Torgue, Andrew Lunn,
Bryan Whitehead, David S. Miller, Eric Dumazet, Florian Fainelli,
Jakub Kicinski, Jose Abreu, linux-arm-kernel, linux-stm32,
Marcin Wojtas, Maxime Coquelin, netdev, Paolo Abeni,
UNGLinuxDriver
On Tue, Nov 26, 2024 at 03:21:26PM +0100, Oleksij Rempel wrote:
> Hi Russell,
>
> On Tue, Nov 26, 2024 at 01:01:11PM +0000, Russell King (Oracle) wrote:
> > On Tue, Nov 26, 2024 at 12:51:36PM +0000, Russell King (Oracle) wrote:
> > > Patch 11 adds phylink managed EEE support. Two new MAC APIs are added,
> > > to enable and disable LPI. The enable method is passed the LPI timer
> > > setting which it is expected to program into the hardware, and also a
> > > flag ehther the transmit clock should be stopped.
> > >
> > > *** There are open questions here. Eagle eyed reviewers will notice
> > > pl->config->lpi_interfaces. There are MACs out there which only
> > > support LPI signalling on a subset of their interface types. Phylib
> > > doesn't understand this. I'm handling this at the moment by simply
> > > not activating LPI at the MAC, but that leads to ethtool --show-eee
> > > suggesting that EEE is active when it isn't.
> > > *** Should we pass the phy_interface_t to these functions?
> > > *** Should mac_enable_tx_lpi() be allowed to fail if the MAC doesn't
> > > support the interface mode?
> >
> > There is another point to raise here - should we have a "validate_eee"
> > method in struct phylink_mac_ops so that MAC drivers can validate
> > settings such as the tx_lpi_timer value can be programmed into the
> > hardware?
> >
> > We do have the situation on Marvell platforms where the programmed
> > value depends on the MAC speed, and is only 8 bit, which makes
> > validating its value rather difficult - at 1G speeds, it's a
> > resolution of 1us so we can support up to 255us. At 100M speeds,
> > it's 10us, supporting up to 2.55ms. This makes it awkward to be able
> > to validate the set_eee() settings are sane for the hardware. Should
> > Marvell platforms instead implement a hrtimer above this? That sounds
> > a bit problematical to manage sanely.
>
> I agree that tx_lpi_timer can be a problem, and this is not just a
> Marvell issue. For example, I think the FEC MAC on i.MX8MP might also
> be affected. But I can't confirm this because I don't have an i.MX8MP
> board with a PHY that supports MAC-controlled EEE mode. The Realtek PHY
> I have uses PHY-controlled EEE (SmartEEE).
>
> Except for this, I think there should be sane default values for
> tx_lpi_timer. The IEEE 802.3-2022 standard (Section 78.2) describes EEE
> timing, but it doesn’t give a clear recommendation for tx_lpi_timer.
There are of course some parameters of EEE that should be fixed, and
IEEE specifies them in that section. These are Ts, Tq and Tr, and IEEE
gives a range of values for these which need to be conformed with in a
compliant implementation.
Please don't get confused by the mvneta/mvpp2 implementation, there are
parameters for Ts and Tw, but the Ts value is not the same as Ts in
IEEE. IEEE defines it as the period of time between the PHY transmitting
sleep and turning all transmitters off. Marvell define it as the minimum
time from the Tx FIFO being empty to asserting LPI - quite different!
Other parameters depend on the implementation, such as the propagation
delay of data through the PHY. These, we don't currently take account
of. I don't recall off-hand whether there's any standards defined
registers describing these parameters in the PHY (I need to delve into
802.3...) That's all needed for computing Tw.
> IMO, the best value for tx_lpi_timer should be the sum of the time
> needed to put the full chain (MAC -> PHY -> remote PHY) into sleep mode
> and the time needed to wake the chain. These times are link-speed
> specific, so defaults should consider PHY timings for each link speed.
One can only make a set of defaults that depend on the speed if we also
give the user the ability to set the tx_lpi_timer values on a per-speed
basis, otherwise how do we update the values when set_eee() gets called?
Also how do we know what the requirements of the remote PHY are? I think
the only way that could be known is by exchanging the EEE TLV with the
link partner as described in section 78.
> Except for tx_lpi_timer, some MACs also allow configuration of the Twake
> timer. For example, the FEC driver uses the lpi_timer value to
> configure the Twake timer, and the LAN78xx driver also provides a
> configurable Twake timer register.
>
> If the Twake timer is not configured properly, or if the system has
> quirks causing the actual Twake time to be longer than expected, it can
> result in frame corruption.
I have been aware of it, and to me it sounds like another can of worms
that right now I'd rather not open until we have solved the basics of
EEE and got MAC drivers into better shape for the basics. I had been
wondering whether we would eventually need phylink to pass Tw along
with the LPI timer, and I think eventually we would need to - and we
also need some infrastructure for the EEE TLV, both sending it at the
appropriate time, and processing it when received. I don't think we
have any of that at the moment, so it would be another chunk of
development.
--
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] 39+ messages in thread
* Re: [PATCH RFC net-next 00/23] net: phylink managed EEE support
2024-11-26 12:51 [PATCH RFC net-next 00/23] net: phylink managed EEE support Russell King (Oracle)
` (23 preceding siblings ...)
2024-11-26 13:01 ` [PATCH RFC net-next 00/23] net: " Russell King (Oracle)
@ 2024-11-26 16:55 ` Russell King (Oracle)
2024-11-27 10:49 ` net: rtl8169: EEE seems to be ok (was: Re: [PATCH RFC net-next 00/23] net: phylink managed EEE support) Russell King (Oracle)
` (2 subsequent siblings)
27 siblings, 0 replies; 39+ messages in thread
From: Russell King (Oracle) @ 2024-11-26 16:55 UTC (permalink / raw)
To: Andrew Lunn, Heiner Kallweit
Cc: Alexandre Torgue, Andrew Lunn, Bryan Whitehead, David S. Miller,
Eric Dumazet, Florian Fainelli, Jakub Kicinski, Jose Abreu,
linux-arm-kernel, linux-stm32, Marcin Wojtas, Maxime Coquelin,
netdev, Oleksij Rempel, Paolo Abeni, UNGLinuxDriver
On Tue, Nov 26, 2024 at 12:51:36PM +0000, Russell King (Oracle) wrote:
> In doing this, I came across the fact that the addition of phylib
> managed EEE support has actually broken a huge number of drivers -
> phylib will now overwrite all members of struct ethtool_keee whether
> the netdev driver wants it or not. This leads to weird scenarios where
> doing a get_eee() op followed by a set_eee() op results in e.g.
> tx_lpi_timer being zeroed, because the MAC driver doesn't know it needs
> to initialise phylib's phydev->eee_cfg.tx_lpi_timer member. This mess
> really needs urgently addressing, and I believe it came about because
> Andrew's patches were only partly merged via another party - I guess
> highlighting the inherent danger of "thou shalt limit your patch series
> to no more than 15 patches" when one has a subsystem who's in-kernel
> API is changing.
Note that, I think, fec_main.c isn't broken, although a quick review
only looking at fec_enet_get_eee() may suggest otherwise:
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;
if (!netif_running(ndev))
return -ENETDOWN;
edata->tx_lpi_timer = p->tx_lpi_timer; // <===========================
return phy_ethtool_get_eee(ndev->phydev, edata);
}
static int
fec_enet_set_eee(struct net_device *ndev, struct ethtool_keee *edata)
{
...
p->tx_lpi_timer = edata->tx_lpi_timer;
Since the driver does not touch phydev->eee_cfg.tx_lpi_timer,
phy_ethtool_get_eee() above will overwrite edata->tx_lpi_timer with
zero. If ethtool does a read-modify-write on the EEE settings, then
fec_enet_set_eee() will be passed a value of zero for
edata->tx_lpi_timer.
This will result in FEC_LPI_SLEEP and FEC_LPI_WAKE being written with
zero, and from what I can see in fec_enet_eee_mode_set(), that disables
EEE.
The saving grace for this driver is that p->tx_lpi_timer also starts
off as zero.
A better implementation would be to get rid of p->tx_lpi_timer
entirely, and instead rely on phydev->eee_cfg.tx_lpi_timer to be
managed by phylib, obtaining its value from there in
fec_enet_eee_mode_set(). At least the driver doesn't attempt to
maintain any other EEE state!
So something like this:
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..25c842835d52 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(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);
}
Another patch to be added to my stack...
--
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 related [flat|nested] 39+ messages in thread
* Re: [PATCH RFC net-next 03/23] net: phy: marvell: use phydev->eee_cfg.eee_enabled
2024-11-26 12:52 ` [PATCH RFC net-next 03/23] net: phy: marvell: use phydev->eee_cfg.eee_enabled Russell King (Oracle)
@ 2024-11-26 20:19 ` Heiner Kallweit
0 siblings, 0 replies; 39+ messages in thread
From: Heiner Kallweit @ 2024-11-26 20:19 UTC (permalink / raw)
To: Russell King (Oracle), Andrew Lunn
Cc: Alexandre Torgue, Andrew Lunn, Bryan Whitehead, David S. Miller,
Eric Dumazet, Florian Fainelli, Jakub Kicinski, Jose Abreu,
linux-arm-kernel, linux-stm32, Marcin Wojtas, Maxime Coquelin,
netdev, Oleksij Rempel, Paolo Abeni, UNGLinuxDriver
On 26.11.2024 13:52, Russell King (Oracle) wrote:
> Rather than calling genphy_c45_ethtool_get_eee() to retrieve whether
> EEE is enabled, use the value stored in the phy_device eee_cfg
> structure.
>
> Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
> ---
> drivers/net/phy/marvell.c | 4 +---
> 1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/drivers/net/phy/marvell.c b/drivers/net/phy/marvell.c
> index cd50cd6a7f75..1d117fa8c564 100644
> --- a/drivers/net/phy/marvell.c
> +++ b/drivers/net/phy/marvell.c
> @@ -1508,7 +1508,6 @@ static int m88e1540_get_fld(struct phy_device *phydev, u8 *msecs)
>
> static int m88e1540_set_fld(struct phy_device *phydev, const u8 *msecs)
> {
> - struct ethtool_keee eee;
> int val, ret;
>
> if (*msecs == ETHTOOL_PHY_FAST_LINK_DOWN_OFF)
> @@ -1518,8 +1517,7 @@ static int m88e1540_set_fld(struct phy_device *phydev, const u8 *msecs)
> /* According to the Marvell data sheet EEE must be disabled for
> * Fast Link Down detection to work properly
> */
> - ret = genphy_c45_ethtool_get_eee(phydev, &eee);
> - if (!ret && eee.eee_enabled) {
> + if (phydev->eee_cfg.eee_enabled) {
> phydev_warn(phydev, "Fast Link Down detection requires EEE to be disabled!\n");
> return -EBUSY;
> }
This one I had on my list too. Old and new check aren't waterproof as the user can still
enable EEE later, silently disabling FLD. But the check is better than nothing.
Reviewed-by: Heiner Kallweit <hkallweit1@gmail.com>
^ permalink raw reply [flat|nested] 39+ messages in thread
* Re: [PATCH RFC net-next 04/23] net: phy: avoid genphy_c45_ethtool_get_eee() setting eee_enabled
2024-11-26 12:52 ` [PATCH RFC net-next 04/23] net: phy: avoid genphy_c45_ethtool_get_eee() setting eee_enabled Russell King (Oracle)
@ 2024-11-26 20:20 ` Heiner Kallweit
0 siblings, 0 replies; 39+ messages in thread
From: Heiner Kallweit @ 2024-11-26 20:20 UTC (permalink / raw)
To: Russell King (Oracle), Andrew Lunn
Cc: Alexandre Torgue, Andrew Lunn, Bryan Whitehead, David S. Miller,
Eric Dumazet, Florian Fainelli, Jakub Kicinski, Jose Abreu,
linux-arm-kernel, linux-stm32, Marcin Wojtas, Maxime Coquelin,
netdev, Oleksij Rempel, Paolo Abeni, UNGLinuxDriver
On 26.11.2024 13:52, Russell King (Oracle) wrote:
> genphy_c45_ethtool_get_eee() is only called from phy_ethtool_get_eee(),
> which then calls eeecfg_to_eee(). eeecfg_to_eee() will overwrite
> keee.eee_enabled, so there's no point setting keee.eee_enabled in
> genphy_c45_ethtool_get_eee(). Remove this assignment.
>
> Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
> ---
Reviewed-by: Heiner Kallweit <hkallweit1@gmail.com>
^ permalink raw reply [flat|nested] 39+ messages in thread
* Re: [PATCH RFC net-next 05/23] net: phy: remove genphy_c45_eee_is_active()'s is_enabled arg
2024-11-26 12:52 ` [PATCH RFC net-next 05/23] net: phy: remove genphy_c45_eee_is_active()'s is_enabled arg Russell King (Oracle)
@ 2024-11-26 20:24 ` Heiner Kallweit
0 siblings, 0 replies; 39+ messages in thread
From: Heiner Kallweit @ 2024-11-26 20:24 UTC (permalink / raw)
To: Russell King (Oracle), Andrew Lunn
Cc: Alexandre Torgue, Andrew Lunn, Bryan Whitehead, David S. Miller,
Eric Dumazet, Florian Fainelli, Jakub Kicinski, Jose Abreu,
linux-arm-kernel, linux-stm32, Marcin Wojtas, Maxime Coquelin,
netdev, Oleksij Rempel, Paolo Abeni, UNGLinuxDriver
On 26.11.2024 13:52, Russell King (Oracle) wrote:
> All callers to genphy_c45_eee_is_active() now pass NULL as the
> is_enabled argument, which means we never use the value computed
> in this function. Remove the argument and clean up this function.
>
> Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
> ---
Eventually we should be able to get rid also of the adv argument
and use phydev->advertising_eee only. Prerequisite is rework of
eee_broken_modes. I have patches which I'm testing locally
currently. This can be a follow-up to your series.
Reviewed-by: Heiner Kallweit <hkallweit1@gmail.com>
^ permalink raw reply [flat|nested] 39+ messages in thread
* Re: net: rtl8169: EEE seems to be ok (was: Re: [PATCH RFC net-next 00/23] net: phylink managed EEE support)
2024-11-26 12:51 [PATCH RFC net-next 00/23] net: phylink managed EEE support Russell King (Oracle)
` (24 preceding siblings ...)
2024-11-26 16:55 ` Russell King (Oracle)
@ 2024-11-27 10:49 ` Russell King (Oracle)
2024-11-27 22:15 ` net: rtl8169: EEE seems to be ok Heiner Kallweit
2024-11-27 11:20 ` net: ti: weirdness (was Re: [PATCH RFC net-next 00/23] net: phylink managed EEE support) Russell King (Oracle)
2024-11-27 12:15 ` net: sxgbe: using lpi_timer for Twake timer Oleksij Rempel
27 siblings, 1 reply; 39+ messages in thread
From: Russell King (Oracle) @ 2024-11-27 10:49 UTC (permalink / raw)
To: Andrew Lunn, Heiner Kallweit
Cc: Alexandre Torgue, Andrew Lunn, Bryan Whitehead, David S. Miller,
Eric Dumazet, Florian Fainelli, Jakub Kicinski, Jose Abreu,
linux-arm-kernel, linux-stm32, Marcin Wojtas, Maxime Coquelin,
netdev, Oleksij Rempel, Paolo Abeni, UNGLinuxDriver
On Tue, Nov 26, 2024 at 12:51:36PM +0000, Russell King (Oracle) wrote:
> In doing this, I came across the fact that the addition of phylib
> managed EEE support has actually broken a huge number of drivers -
> phylib will now overwrite all members of struct ethtool_keee whether
> the netdev driver wants it or not. This leads to weird scenarios where
> doing a get_eee() op followed by a set_eee() op results in e.g.
> tx_lpi_timer being zeroed, because the MAC driver doesn't know it needs
> to initialise phylib's phydev->eee_cfg.tx_lpi_timer member. This mess
> really needs urgently addressing, and I believe it came about because
> Andrew's patches were only partly merged via another party - I guess
> highlighting the inherent danger of "thou shalt limit your patch series
> to no more than 15 patches" when one has a subsystem who's in-kernel
> API is changing.
Looking at the rtl8169 driver, it looks pretty similar to the Marvell
situation. The value stored in tp->tx_lpi_timer is apparently,
according to r8169_get_tx_lpi_timer_us(), a value in bytes, not in a
unit of time. So it's dependent on the negotiated speed, and thus we
can't read it to set the initial phydev->eee_cfg.tx_lpi_timer state,
because in the _probe() function, the PHY may not have negotiated a
speed.
However, this driver writes keee->tx_lpi_timer after
phy_ethtool_get_eee() which means that it overrides phylib, so hasn't
been broken.
Therefore, I think rtl8169 is fine.
--
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] 39+ messages in thread
* Re: [PATCH RFC net-next 02/23] net: phy: fix phy_ethtool_set_eee() incorrectly enabling LPI
2024-11-26 12:52 ` [PATCH RFC net-next 02/23] net: phy: fix phy_ethtool_set_eee() incorrectly enabling LPI Russell King (Oracle)
@ 2024-11-27 11:12 ` Russell King (Oracle)
2024-11-27 12:20 ` Oleksij Rempel
2024-11-28 14:11 ` Andrew Lunn
0 siblings, 2 replies; 39+ messages in thread
From: Russell King (Oracle) @ 2024-11-27 11:12 UTC (permalink / raw)
To: Andrew Lunn, Heiner Kallweit
Cc: Alexandre Torgue, Andrew Lunn, Bryan Whitehead, David S. Miller,
Eric Dumazet, Florian Fainelli, Jakub Kicinski, Jose Abreu,
linux-arm-kernel, linux-stm32, Marcin Wojtas, Maxime Coquelin,
netdev, Oleksij Rempel, Paolo Abeni, UNGLinuxDriver
On Tue, Nov 26, 2024 at 12:52:21PM +0000, Russell King (Oracle) wrote:
> @@ -1685,15 +1685,21 @@ EXPORT_SYMBOL(phy_ethtool_get_eee);
> static void phy_ethtool_set_eee_noneg(struct phy_device *phydev,
> const struct eee_config *old_cfg)
> {
> - if (phydev->eee_cfg.tx_lpi_enabled != old_cfg->tx_lpi_enabled ||
> + bool enable_tx_lpi;
> +
> + if (!phydev->link)
> + return;
> +
> + enable_tx_lpi = phydev->eee_cfg.tx_lpi_enabled && phydev->eee_active;
> +
> + if (phydev->enable_tx_lpi != enable_tx_lpi ||
> phydev->eee_cfg.tx_lpi_timer != old_cfg->tx_lpi_timer) {
I'm wondering whether this should be:
if (phydev->enable_tx_lpi != enable_tx_lpi ||
(phydev->enable_tx_lpi &&
phydev->eee_cfg.tx_lpi_timer != old_cfg->tx_lpi_timer)) {
The argument for this change would be to avoid cycling the link when the
LPI timer changes but we're not using LPI.
The argument against this change would be that then we don't program the
hardware, and if the driver reads the initial value from hardware and
is unbound/rebound, we'll lose that update whereas before the phylib
changes, it would have been preserved.
The problem, however, are drivers where the LPI timer is dependent on
the speed.
Any thoughts?
--
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] 39+ messages in thread
* Re: net: ti: weirdness (was Re: [PATCH RFC net-next 00/23] net: phylink managed EEE support)
2024-11-26 12:51 [PATCH RFC net-next 00/23] net: phylink managed EEE support Russell King (Oracle)
` (25 preceding siblings ...)
2024-11-27 10:49 ` net: rtl8169: EEE seems to be ok (was: Re: [PATCH RFC net-next 00/23] net: phylink managed EEE support) Russell King (Oracle)
@ 2024-11-27 11:20 ` Russell King (Oracle)
2024-11-28 14:21 ` Andrew Lunn
2024-11-27 12:15 ` net: sxgbe: using lpi_timer for Twake timer Oleksij Rempel
27 siblings, 1 reply; 39+ messages in thread
From: Russell King (Oracle) @ 2024-11-27 11:20 UTC (permalink / raw)
To: Andrew Lunn, Heiner Kallweit
Cc: Alexandre Torgue, Andrew Lunn, Bryan Whitehead, David S. Miller,
Eric Dumazet, Florian Fainelli, Jakub Kicinski, Jose Abreu,
linux-arm-kernel, linux-stm32, Marcin Wojtas, Maxime Coquelin,
netdev, Oleksij Rempel, Paolo Abeni, UNGLinuxDriver
On Tue, Nov 26, 2024 at 12:51:36PM +0000, Russell King (Oracle) wrote:
> In doing this, I came across the fact that the addition of phylib
> managed EEE support has actually broken a huge number of drivers -
> phylib will now overwrite all members of struct ethtool_keee whether
> the netdev driver wants it or not. This leads to weird scenarios where
> doing a get_eee() op followed by a set_eee() op results in e.g.
> tx_lpi_timer being zeroed, because the MAC driver doesn't know it needs
> to initialise phylib's phydev->eee_cfg.tx_lpi_timer member. This mess
> really needs urgently addressing, and I believe it came about because
> Andrew's patches were only partly merged via another party - I guess
> highlighting the inherent danger of "thou shalt limit your patch series
> to no more than 15 patches" when one has a subsystem who's in-kernel
> API is changing.
Looking at the two TI offerings that call phy_ethtool_get_eee(), both
of them call the phylib functions from their ethtool ops, but it looks
like the driver does diddly squat with LPI state, which makes me wonder
why they implemented the calls to phy_ethtool_get_eee() and
phy_ethtool_set_eee(), since EEE will not be functional unless the PHY
has been configured with a SmartEEE mode outside the kernel.
--
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] 39+ messages in thread
* Re: net: sxgbe: using lpi_timer for Twake timer
2024-11-26 12:51 [PATCH RFC net-next 00/23] net: phylink managed EEE support Russell King (Oracle)
` (26 preceding siblings ...)
2024-11-27 11:20 ` net: ti: weirdness (was Re: [PATCH RFC net-next 00/23] net: phylink managed EEE support) Russell King (Oracle)
@ 2024-11-27 12:15 ` Oleksij Rempel
27 siblings, 0 replies; 39+ messages in thread
From: Oleksij Rempel @ 2024-11-27 12:15 UTC (permalink / raw)
To: Russell King (Oracle)
Cc: Andrew Lunn, Heiner Kallweit, Alexandre Torgue, Andrew Lunn,
Bryan Whitehead, David S. Miller, Eric Dumazet, Florian Fainelli,
Jakub Kicinski, Jose Abreu, linux-arm-kernel, linux-stm32,
Marcin Wojtas, Maxime Coquelin, netdev, Paolo Abeni,
UNGLinuxDriver
For archive:
static void sxgbe_set_eee_timer(void __iomem *ioaddr,
const int ls, const int tw)
{
int value = ((tw & 0xffff)) | ((ls & 0x7ff) << 16);
/* Program the timers in the LPI timer control register:
* LS: minimum time (ms) for which the link
* status from PHY should be ok before transmitting
* the LPI pattern.
* TW: minimum time (us) for which the core waits
* after it has stopped transmitting the LPI pattern.
*/
writel(value, ioaddr + SXGBE_CORE_LPI_TIMER_CTRL);
}
bool sxgbe_eee_init(struct sxgbe_priv_data * const priv)
{
....
/* MAC core supports the EEE feature. */
if (priv->hw_cap.eee) {
/* Check if the PHY supports EEE */
if (phy_init_eee(ndev->phydev, true))
return false;
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);
priv->hw->mac->set_eee_timer(priv->ioaddr,
SXGBE_DEFAULT_LPI_TIMER,
priv->tx_lpi_timer);
^^^^^^^^^^^^
LPI timer is used for
Twake timer.
}
In case user configures lpi_timer value to too low, it will case frame
corruption instead of expected performance drop.
--
Pengutronix e.K. | |
Steuerwalder Str. 21 | http://www.pengutronix.de/ |
31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
^ permalink raw reply [flat|nested] 39+ messages in thread
* Re: [PATCH RFC net-next 02/23] net: phy: fix phy_ethtool_set_eee() incorrectly enabling LPI
2024-11-27 11:12 ` Russell King (Oracle)
@ 2024-11-27 12:20 ` Oleksij Rempel
2024-11-28 14:11 ` Andrew Lunn
1 sibling, 0 replies; 39+ messages in thread
From: Oleksij Rempel @ 2024-11-27 12:20 UTC (permalink / raw)
To: Russell King (Oracle)
Cc: Andrew Lunn, Heiner Kallweit, Alexandre Torgue, Andrew Lunn,
Bryan Whitehead, David S. Miller, Eric Dumazet, Florian Fainelli,
Jakub Kicinski, Jose Abreu, linux-arm-kernel, linux-stm32,
Marcin Wojtas, Maxime Coquelin, netdev, Paolo Abeni,
UNGLinuxDriver
On Wed, Nov 27, 2024 at 11:12:28AM +0000, Russell King (Oracle) wrote:
> On Tue, Nov 26, 2024 at 12:52:21PM +0000, Russell King (Oracle) wrote:
> > @@ -1685,15 +1685,21 @@ EXPORT_SYMBOL(phy_ethtool_get_eee);
> > static void phy_ethtool_set_eee_noneg(struct phy_device *phydev,
> > const struct eee_config *old_cfg)
> > {
> > - if (phydev->eee_cfg.tx_lpi_enabled != old_cfg->tx_lpi_enabled ||
> > + bool enable_tx_lpi;
> > +
> > + if (!phydev->link)
> > + return;
> > +
> > + enable_tx_lpi = phydev->eee_cfg.tx_lpi_enabled && phydev->eee_active;
> > +
> > + if (phydev->enable_tx_lpi != enable_tx_lpi ||
> > phydev->eee_cfg.tx_lpi_timer != old_cfg->tx_lpi_timer) {
>
> I'm wondering whether this should be:
>
> if (phydev->enable_tx_lpi != enable_tx_lpi ||
> (phydev->enable_tx_lpi &&
> phydev->eee_cfg.tx_lpi_timer != old_cfg->tx_lpi_timer)) {
>
> The argument for this change would be to avoid cycling the link when the
> LPI timer changes but we're not using LPI.
>
> The argument against this change would be that then we don't program the
> hardware, and if the driver reads the initial value from hardware and
> is unbound/rebound, we'll lose that update whereas before the phylib
> changes, it would have been preserved.
>
> The problem, however, are drivers where the LPI timer is dependent on
> the speed.
>
> Any thoughts?
So far, i was not able to find any. But, like I said before, to get
optimal performance and power saving balance, the lpi_timer should be
link speed specific... at least, some day with appropriate user
interface.
--
Pengutronix e.K. | |
Steuerwalder Str. 21 | http://www.pengutronix.de/ |
31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
^ permalink raw reply [flat|nested] 39+ messages in thread
* Re: net: rtl8169: EEE seems to be ok
2024-11-27 10:49 ` net: rtl8169: EEE seems to be ok (was: Re: [PATCH RFC net-next 00/23] net: phylink managed EEE support) Russell King (Oracle)
@ 2024-11-27 22:15 ` Heiner Kallweit
0 siblings, 0 replies; 39+ messages in thread
From: Heiner Kallweit @ 2024-11-27 22:15 UTC (permalink / raw)
To: Russell King (Oracle), Andrew Lunn
Cc: Alexandre Torgue, Andrew Lunn, Bryan Whitehead, David S. Miller,
Eric Dumazet, Florian Fainelli, Jakub Kicinski, Jose Abreu,
linux-arm-kernel, linux-stm32, Marcin Wojtas, Maxime Coquelin,
netdev, Oleksij Rempel, Paolo Abeni, UNGLinuxDriver
On 27.11.2024 11:49, Russell King (Oracle) wrote:
> On Tue, Nov 26, 2024 at 12:51:36PM +0000, Russell King (Oracle) wrote:
>> In doing this, I came across the fact that the addition of phylib
>> managed EEE support has actually broken a huge number of drivers -
>> phylib will now overwrite all members of struct ethtool_keee whether
>> the netdev driver wants it or not. This leads to weird scenarios where
>> doing a get_eee() op followed by a set_eee() op results in e.g.
>> tx_lpi_timer being zeroed, because the MAC driver doesn't know it needs
>> to initialise phylib's phydev->eee_cfg.tx_lpi_timer member. This mess
>> really needs urgently addressing, and I believe it came about because
>> Andrew's patches were only partly merged via another party - I guess
>> highlighting the inherent danger of "thou shalt limit your patch series
>> to no more than 15 patches" when one has a subsystem who's in-kernel
>> API is changing.
>
> Looking at the rtl8169 driver, it looks pretty similar to the Marvell
> situation. The value stored in tp->tx_lpi_timer is apparently,
> according to r8169_get_tx_lpi_timer_us(), a value in bytes, not in a
> unit of time. So it's dependent on the negotiated speed, and thus we
> can't read it to set the initial phydev->eee_cfg.tx_lpi_timer state,
> because in the _probe() function, the PHY may not have negotiated a
> speed.
>
Right, hw stores the tx_lpi_timer in bytes. Driver's default value is
one frame plus a few bytes. It doesn't use phydev->eee_cfg.tx_lpi_timer.
set_eee() op isn't implemented for tx_lpi_timer, because no one ever
asked for it and I'm not aware of any good use case.
> However, this driver writes keee->tx_lpi_timer after
> phy_ethtool_get_eee() which means that it overrides phylib, so hasn't
> been broken.
>
> Therefore, I think rtl8169 is fine.
>
^ permalink raw reply [flat|nested] 39+ messages in thread
* Re: [PATCH RFC net-next 02/23] net: phy: fix phy_ethtool_set_eee() incorrectly enabling LPI
2024-11-27 11:12 ` Russell King (Oracle)
2024-11-27 12:20 ` Oleksij Rempel
@ 2024-11-28 14:11 ` Andrew Lunn
1 sibling, 0 replies; 39+ messages in thread
From: Andrew Lunn @ 2024-11-28 14:11 UTC (permalink / raw)
To: Russell King (Oracle)
Cc: Heiner Kallweit, Alexandre Torgue, Andrew Lunn, Bryan Whitehead,
David S. Miller, Eric Dumazet, Florian Fainelli, Jakub Kicinski,
Jose Abreu, linux-arm-kernel, linux-stm32, Marcin Wojtas,
Maxime Coquelin, netdev, Oleksij Rempel, Paolo Abeni,
UNGLinuxDriver
On Wed, Nov 27, 2024 at 11:12:28AM +0000, Russell King (Oracle) wrote:
> On Tue, Nov 26, 2024 at 12:52:21PM +0000, Russell King (Oracle) wrote:
> > @@ -1685,15 +1685,21 @@ EXPORT_SYMBOL(phy_ethtool_get_eee);
> > static void phy_ethtool_set_eee_noneg(struct phy_device *phydev,
> > const struct eee_config *old_cfg)
> > {
> > - if (phydev->eee_cfg.tx_lpi_enabled != old_cfg->tx_lpi_enabled ||
> > + bool enable_tx_lpi;
> > +
> > + if (!phydev->link)
> > + return;
> > +
> > + enable_tx_lpi = phydev->eee_cfg.tx_lpi_enabled && phydev->eee_active;
> > +
> > + if (phydev->enable_tx_lpi != enable_tx_lpi ||
> > phydev->eee_cfg.tx_lpi_timer != old_cfg->tx_lpi_timer) {
>
> I'm wondering whether this should be:
>
> if (phydev->enable_tx_lpi != enable_tx_lpi ||
> (phydev->enable_tx_lpi &&
> phydev->eee_cfg.tx_lpi_timer != old_cfg->tx_lpi_timer)) {
>
> The argument for this change would be to avoid cycling the link when the
> LPI timer changes but we're not using LPI.
>
> The argument against this change would be that then we don't program the
> hardware, and if the driver reads the initial value from hardware and
> is unbound/rebound, we'll lose that update whereas before the phylib
> changes, it would have been preserved.
unbound/rebound is a pretty unusual use case. I would not consider
that a strong argument against it.
This is the case where we don't need to perform negotiation. So it is
going to be a fast operation compared to when we do need negotiation.
So i wounder if we really need to care? Donald Knuth, Premature
optimisation is the root of all evil, etc...
Andrew
^ permalink raw reply [flat|nested] 39+ messages in thread
* Re: net: ti: weirdness (was Re: [PATCH RFC net-next 00/23] net: phylink managed EEE support)
2024-11-27 11:20 ` net: ti: weirdness (was Re: [PATCH RFC net-next 00/23] net: phylink managed EEE support) Russell King (Oracle)
@ 2024-11-28 14:21 ` Andrew Lunn
0 siblings, 0 replies; 39+ messages in thread
From: Andrew Lunn @ 2024-11-28 14:21 UTC (permalink / raw)
To: Russell King (Oracle)
Cc: Heiner Kallweit, Alexandre Torgue, Andrew Lunn, Bryan Whitehead,
David S. Miller, Eric Dumazet, Florian Fainelli, Jakub Kicinski,
Jose Abreu, linux-arm-kernel, linux-stm32, Marcin Wojtas,
Maxime Coquelin, netdev, Oleksij Rempel, Paolo Abeni,
UNGLinuxDriver
On Wed, Nov 27, 2024 at 11:20:08AM +0000, Russell King (Oracle) wrote:
> On Tue, Nov 26, 2024 at 12:51:36PM +0000, Russell King (Oracle) wrote:
> > In doing this, I came across the fact that the addition of phylib
> > managed EEE support has actually broken a huge number of drivers -
> > phylib will now overwrite all members of struct ethtool_keee whether
> > the netdev driver wants it or not. This leads to weird scenarios where
> > doing a get_eee() op followed by a set_eee() op results in e.g.
> > tx_lpi_timer being zeroed, because the MAC driver doesn't know it needs
> > to initialise phylib's phydev->eee_cfg.tx_lpi_timer member. This mess
> > really needs urgently addressing, and I believe it came about because
> > Andrew's patches were only partly merged via another party - I guess
> > highlighting the inherent danger of "thou shalt limit your patch series
> > to no more than 15 patches" when one has a subsystem who's in-kernel
> > API is changing.
>
> Looking at the two TI offerings that call phy_ethtool_get_eee(), both
> of them call the phylib functions from their ethtool ops, but it looks
> like the driver does diddly squat with LPI state, which makes me wonder
> why they implemented the calls to phy_ethtool_get_eee() and
> phy_ethtool_set_eee(), since EEE will not be functional unless the PHY
> has been configured with a SmartEEE mode outside the kernel.
Probably because they did not know what they were doing, and it got
past reviewers.
Well, actually:
commit a090994980a15f8cc14fc188b5929bd61d2ae9c3
Author: Yegor Yefremov <yegorslists@googlemail.com>
Date: Mon Nov 28 09:41:33 2016 +0100
cpsw: ethtool: add support for getting/setting EEE registers
Add the ability to query and set Energy Efficient Ethernet parameters
via ethtool for applicable devices.
This patch doesn't activate full EEE support in cpsw driver, but it
enables reading and writing EEE advertising settings. This way one
can disable advertising EEE for certain speeds.
Signed-off-by: Yegor Yefremov <yegorslists@googlemail.com>
Acked-by: Rami Rosen <roszenrami@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Seems like somebody had an issue and did the minimum to work around
the issue. This also suggests the hardware is doing EEE by default,
hopefully with some sort of sensible hardware defaults.
Andrew
^ permalink raw reply [flat|nested] 39+ messages in thread
end of thread, other threads:[~2024-11-28 14:22 UTC | newest]
Thread overview: 39+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-11-26 12:51 [PATCH RFC net-next 00/23] net: phylink managed EEE support Russell King (Oracle)
2024-11-26 12:52 ` [PATCH RFC net-next 01/23] net: phy: ensure that genphy_c45_an_config_eee_aneg() sees new value of phydev->eee_cfg.eee_enabled Russell King
2024-11-26 12:52 ` [PATCH RFC net-next 02/23] net: phy: fix phy_ethtool_set_eee() incorrectly enabling LPI Russell King (Oracle)
2024-11-27 11:12 ` Russell King (Oracle)
2024-11-27 12:20 ` Oleksij Rempel
2024-11-28 14:11 ` Andrew Lunn
2024-11-26 12:52 ` [PATCH RFC net-next 03/23] net: phy: marvell: use phydev->eee_cfg.eee_enabled Russell King (Oracle)
2024-11-26 20:19 ` Heiner Kallweit
2024-11-26 12:52 ` [PATCH RFC net-next 04/23] net: phy: avoid genphy_c45_ethtool_get_eee() setting eee_enabled Russell King (Oracle)
2024-11-26 20:20 ` Heiner Kallweit
2024-11-26 12:52 ` [PATCH RFC net-next 05/23] net: phy: remove genphy_c45_eee_is_active()'s is_enabled arg Russell King (Oracle)
2024-11-26 20:24 ` Heiner Kallweit
2024-11-26 12:52 ` [PATCH RFC net-next 06/23] net: phy: update phy_ethtool_get_eee() documentation Russell King (Oracle)
2024-11-26 12:52 ` [PATCH RFC net-next 07/23] net: mdio: add definition for clock stop capable bit Russell King (Oracle)
2024-11-26 12:52 ` [PATCH RFC net-next 08/23] net: phy: add support for querying PHY clock stop capability Russell King (Oracle)
2024-11-26 12:52 ` [PATCH RFC net-next 09/23] net: phy: add configuration of rx clock stop mode Russell King (Oracle)
2024-11-26 12:53 ` [PATCH RFC net-next 10/23] net: phylink: add phylink_link_is_up() helper Russell King (Oracle)
2024-11-26 12:53 ` [PATCH RFC net-next 11/23] net: phylink: add EEE management Russell King (Oracle)
2024-11-26 12:53 ` [PATCH RFC net-next 12/23] net: mvneta: convert to phylink EEE implementation Russell King (Oracle)
2024-11-26 12:53 ` [PATCH RFC net-next 13/23] net: mvneta: only allow EEE to be used in "SGMII" modes Russell King (Oracle)
2024-11-26 12:53 ` [PATCH RFC net-next 14/23] net: mvpp2: add EEE implementation Russell King (Oracle)
2024-11-26 12:53 ` [PATCH RFC net-next 15/23] net: lan743x: use netdev in lan743x_phylink_mac_link_down() Russell King (Oracle)
2024-11-26 12:53 ` [PATCH RFC net-next 16/23] net: lan743x: convert to phylink managed EEE Russell King (Oracle)
2024-11-26 12:53 ` [PATCH RFC net-next 17/23] net: stmmac: move tx_lpi_timer tracking to phylib Russell King (Oracle)
2024-11-26 12:53 ` [PATCH RFC net-next 18/23] net: stmmac: make EEE depend on phy->enable_tx_lpi Russell King (Oracle)
2024-11-26 12:53 ` [PATCH RFC net-next 19/23] net: stmmac: remove redundant code from ethtool EEE ops Russell King (Oracle)
2024-11-26 12:53 ` [PATCH RFC net-next 20/23] net: stmmac: remove priv->tx_lpi_enabled Russell King (Oracle)
2024-11-26 12:53 ` [PATCH RFC net-next 21/23] net: stmmac: report EEE errors if EEE is supported Russell King (Oracle)
2024-11-26 12:54 ` [PATCH RFC net-next 22/23] net: stmmac: convert to use phy_eee_rx_clock_stop() Russell King (Oracle)
2024-11-26 12:54 ` [PATCH RFC net-next 23/23] net: stmmac: convert to phylink managed EEE support Russell King (Oracle)
2024-11-26 13:01 ` [PATCH RFC net-next 00/23] net: " Russell King (Oracle)
2024-11-26 14:21 ` Oleksij Rempel
2024-11-26 16:14 ` Russell King (Oracle)
2024-11-26 16:55 ` Russell King (Oracle)
2024-11-27 10:49 ` net: rtl8169: EEE seems to be ok (was: Re: [PATCH RFC net-next 00/23] net: phylink managed EEE support) Russell King (Oracle)
2024-11-27 22:15 ` net: rtl8169: EEE seems to be ok Heiner Kallweit
2024-11-27 11:20 ` net: ti: weirdness (was Re: [PATCH RFC net-next 00/23] net: phylink managed EEE support) Russell King (Oracle)
2024-11-28 14:21 ` Andrew Lunn
2024-11-27 12:15 ` net: sxgbe: using lpi_timer for Twake timer Oleksij Rempel
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).