Commit 2d880b87 authored by Russell King's avatar Russell King Committed by David S. Miller

net: phy: extract pause mode

Extract the update of phylib's software pause mode state from
genphy_read_status(), so that we can re-use this functionality with
PHYs that have alternative ways to read the negotiation results.
Tested-by: default avatartinywrkb <tinywrkb@gmail.com>
Reviewed-by: default avatarAndrew Lunn <andrew@lunn.ch>
Signed-off-by: default avatarRussell King <rmk+kernel@armlinux.org.uk>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 8d3dc3ac
...@@ -283,6 +283,18 @@ void of_set_phy_eee_broken(struct phy_device *phydev) ...@@ -283,6 +283,18 @@ void of_set_phy_eee_broken(struct phy_device *phydev)
phydev->eee_broken_modes = broken; phydev->eee_broken_modes = broken;
} }
void phy_resolve_aneg_pause(struct phy_device *phydev)
{
if (phydev->duplex == DUPLEX_FULL) {
phydev->pause = linkmode_test_bit(ETHTOOL_LINK_MODE_Pause_BIT,
phydev->lp_advertising);
phydev->asym_pause = linkmode_test_bit(
ETHTOOL_LINK_MODE_Asym_Pause_BIT,
phydev->lp_advertising);
}
}
EXPORT_SYMBOL_GPL(phy_resolve_aneg_pause);
/** /**
* phy_resolve_aneg_linkmode - resolve the advertisements into phy settings * phy_resolve_aneg_linkmode - resolve the advertisements into phy settings
* @phydev: The phy_device struct * @phydev: The phy_device struct
...@@ -305,13 +317,7 @@ void phy_resolve_aneg_linkmode(struct phy_device *phydev) ...@@ -305,13 +317,7 @@ void phy_resolve_aneg_linkmode(struct phy_device *phydev)
break; break;
} }
if (phydev->duplex == DUPLEX_FULL) { phy_resolve_aneg_pause(phydev);
phydev->pause = linkmode_test_bit(ETHTOOL_LINK_MODE_Pause_BIT,
phydev->lp_advertising);
phydev->asym_pause = linkmode_test_bit(
ETHTOOL_LINK_MODE_Asym_Pause_BIT,
phydev->lp_advertising);
}
} }
EXPORT_SYMBOL_GPL(phy_resolve_aneg_linkmode); EXPORT_SYMBOL_GPL(phy_resolve_aneg_linkmode);
......
...@@ -678,6 +678,7 @@ static inline bool phy_is_started(struct phy_device *phydev) ...@@ -678,6 +678,7 @@ static inline bool phy_is_started(struct phy_device *phydev)
return phydev->state >= PHY_UP; return phydev->state >= PHY_UP;
} }
void phy_resolve_aneg_pause(struct phy_device *phydev);
void phy_resolve_aneg_linkmode(struct phy_device *phydev); void phy_resolve_aneg_linkmode(struct phy_device *phydev);
/** /**
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment