Skip to content

Commit fe0d4fd

Browse files
lunnkuba-moo
authored andcommitted
net: phy: Keep track of EEE configuration
Have phylib keep track of the EEE configuration. This simplifies the MAC drivers, in that they don't need to store it. Future patches to phylib will also make use of this information to further simplify the MAC drivers. Reviewed-by: Russell King (Oracle) <[email protected]> Signed-off-by: Andrew Lunn <[email protected]> Reviewed-by: Florian Fainelli <[email protected]> Signed-off-by: Oleksij Rempel <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent e3b6876 commit fe0d4fd

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

drivers/net/phy/phy.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1640,8 +1640,8 @@ EXPORT_SYMBOL(phy_get_eee_err);
16401640
* @phydev: target phy_device struct
16411641
* @data: ethtool_keee data
16421642
*
1643-
* Description: it reportes the Supported/Advertisement/LP Advertisement
1644-
* capabilities.
1643+
* Description: reports the Supported/Advertisement/LP Advertisement
1644+
* capabilities, etc.
16451645
*/
16461646
int phy_ethtool_get_eee(struct phy_device *phydev, struct ethtool_keee *data)
16471647
{
@@ -1652,6 +1652,7 @@ int phy_ethtool_get_eee(struct phy_device *phydev, struct ethtool_keee *data)
16521652

16531653
mutex_lock(&phydev->lock);
16541654
ret = genphy_c45_ethtool_get_eee(phydev, data);
1655+
eeecfg_to_eee(data, &phydev->eee_cfg);
16551656
mutex_unlock(&phydev->lock);
16561657

16571658
return ret;
@@ -1674,6 +1675,8 @@ int phy_ethtool_set_eee(struct phy_device *phydev, struct ethtool_keee *data)
16741675

16751676
mutex_lock(&phydev->lock);
16761677
ret = genphy_c45_ethtool_set_eee(phydev, data);
1678+
if (!ret)
1679+
eee_to_eeecfg(&phydev->eee_cfg, data);
16771680
mutex_unlock(&phydev->lock);
16781681

16791682
return ret;

include/linux/phy.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
#include <linux/refcount.h>
3131

3232
#include <linux/atomic.h>
33+
#include <net/eee.h>
3334

3435
#define PHY_DEFAULT_FEATURES (SUPPORTED_Autoneg | \
3536
SUPPORTED_TP | \
@@ -595,6 +596,7 @@ struct macsec_ops;
595596
* @advertising_eee: Currently advertised EEE linkmodes
596597
* @eee_enabled: Flag indicating whether the EEE feature is enabled
597598
* @enable_tx_lpi: When True, MAC should transmit LPI to PHY
599+
* @eee_cfg: User configuration of EEE
598600
* @lp_advertising: Current link partner advertised linkmodes
599601
* @host_interfaces: PHY interface modes supported by host
600602
* @eee_broken_modes: Energy efficient ethernet modes which should be prohibited
@@ -715,6 +717,7 @@ struct phy_device {
715717
/* Energy efficient ethernet modes which should be prohibited */
716718
u32 eee_broken_modes;
717719
bool enable_tx_lpi;
720+
struct eee_config eee_cfg;
718721

719722
#ifdef CONFIG_LED_TRIGGER_PHY
720723
struct phy_led_trigger *phy_led_triggers;

0 commit comments

Comments
 (0)