Skip to content

Commit

Permalink
Merge branch 'net-phy-add-and-use-helper-phy_advertise_eee_all'
Browse files Browse the repository at this point in the history
Heiner Kallweit says:

====================
net: phy: add and use helper phy_advertise_eee_all

Per default phylib preserves the EEE advertising at the time of
phy probing. The EEE advertising can be changed from user space,
in addition this helper allows to set the EEE advertising to all
supported modes from drivers in kernel space.
====================

Link: https://lore.kernel.org/r/0d886510-b2b7-43f2-b8a6-fb770d97266d@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
  • Loading branch information
Jakub Kicinski committed Feb 7, 2024
2 parents 2813ca8 + 7cc0187 commit 5f98922
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 2 deletions.
3 changes: 1 addition & 2 deletions drivers/net/ethernet/realtek/r8169_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -5091,8 +5091,7 @@ static int r8169_mdio_register(struct rtl8169_private *tp)

tp->phydev->mac_managed_pm = true;
if (rtl_supports_eee(tp))
linkmode_copy(tp->phydev->advertising_eee,
tp->phydev->supported_eee);
phy_advertise_eee_all(tp->phydev);
phy_support_asym_pause(tp->phydev);

/* PHY will be woken up in rtl_open() */
Expand Down
16 changes: 16 additions & 0 deletions drivers/net/phy/phy_device.c
Original file line number Diff line number Diff line change
Expand Up @@ -2777,6 +2777,22 @@ void phy_advertise_supported(struct phy_device *phydev)
}
EXPORT_SYMBOL(phy_advertise_supported);

/**
* phy_advertise_eee_all - Advertise all supported EEE modes
* @phydev: target phy_device struct
*
* Description: Per default phylib preserves the EEE advertising at the time of
* phy probing, which might be a subset of the supported EEE modes. Use this
* function when all supported EEE modes should be advertised. This does not
* trigger auto-negotiation, so must be called before phy_start()/
* phylink_start() which will start auto-negotiation.
*/
void phy_advertise_eee_all(struct phy_device *phydev)
{
linkmode_copy(phydev->advertising_eee, phydev->supported_eee);
}
EXPORT_SYMBOL_GPL(phy_advertise_eee_all);

/**
* phy_support_sym_pause - Enable support of symmetrical pause
* @phydev: target phy_device struct
Expand Down
1 change: 1 addition & 0 deletions include/linux/phy.h
Original file line number Diff line number Diff line change
Expand Up @@ -1960,6 +1960,7 @@ int phy_get_rate_matching(struct phy_device *phydev,
void phy_set_max_speed(struct phy_device *phydev, u32 max_speed);
void phy_remove_link_mode(struct phy_device *phydev, u32 link_mode);
void phy_advertise_supported(struct phy_device *phydev);
void phy_advertise_eee_all(struct phy_device *phydev);
void phy_support_sym_pause(struct phy_device *phydev);
void phy_support_asym_pause(struct phy_device *phydev);
void phy_set_sym_pause(struct phy_device *phydev, bool rx, bool tx,
Expand Down

0 comments on commit 5f98922

Please sign in to comment.