Skip to content

Commit 365c1e6

Browse files
Russell Kingdavem330
authored andcommitted
phy: add phy_interface_mode_is_8023z() helper
Add and use phy_interface_mode_is_8023z() helper to identify the interface modes that use 802.3z negotiation. Use it in phylink's phylink_mac_an_restart(). Signed-off-by: Russell King <[email protected]> Reviewed-by: Florian Fainelli <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent b0e9fe1 commit 365c1e6

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed

drivers/net/phy/phylink.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -320,8 +320,7 @@ static void phylink_mac_config(struct phylink *pl,
320320
static void phylink_mac_an_restart(struct phylink *pl)
321321
{
322322
if (pl->link_config.an_enabled &&
323-
(pl->link_config.interface == PHY_INTERFACE_MODE_1000BASEX ||
324-
pl->link_config.interface == PHY_INTERFACE_MODE_2500BASEX))
323+
phy_interface_mode_is_8023z(pl->link_config.interface))
325324
pl->ops->mac_an_restart(pl->netdev);
326325
}
327326

include/linux/phy.h

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -761,6 +761,20 @@ static inline bool phy_interface_mode_is_rgmii(phy_interface_t mode)
761761
mode <= PHY_INTERFACE_MODE_RGMII_TXID;
762762
};
763763

764+
/**
765+
* phy_interface_mode_is_8023z() - does the phy interface mode use 802.3z
766+
* negotiation
767+
* @mode: one of &enum phy_interface_t
768+
*
769+
* Returns true if the phy interface mode uses the 16-bit negotiation
770+
* word as defined in 802.3z. (See 802.3-2015 37.2.1 Config_Reg encoding)
771+
*/
772+
static inline bool phy_interface_mode_is_8023z(phy_interface_t mode)
773+
{
774+
return mode == PHY_INTERFACE_MODE_1000BASEX ||
775+
mode == PHY_INTERFACE_MODE_2500BASEX;
776+
}
777+
764778
/**
765779
* phy_interface_is_rgmii - Convenience function for testing if a PHY interface
766780
* is RGMII (all variants)

0 commit comments

Comments
 (0)