Skip to content

Commit 2d880b8

Browse files
Russell Kingdavem330
authored andcommitted
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: tinywrkb <[email protected]> Reviewed-by: Andrew Lunn <[email protected]> Signed-off-by: Russell King <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 8d3dc3a commit 2d880b8

File tree

2 files changed

+14
-7
lines changed

2 files changed

+14
-7
lines changed

drivers/net/phy/phy-core.c

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -283,6 +283,18 @@ void of_set_phy_eee_broken(struct phy_device *phydev)
283283
phydev->eee_broken_modes = broken;
284284
}
285285

286+
void phy_resolve_aneg_pause(struct phy_device *phydev)
287+
{
288+
if (phydev->duplex == DUPLEX_FULL) {
289+
phydev->pause = linkmode_test_bit(ETHTOOL_LINK_MODE_Pause_BIT,
290+
phydev->lp_advertising);
291+
phydev->asym_pause = linkmode_test_bit(
292+
ETHTOOL_LINK_MODE_Asym_Pause_BIT,
293+
phydev->lp_advertising);
294+
}
295+
}
296+
EXPORT_SYMBOL_GPL(phy_resolve_aneg_pause);
297+
286298
/**
287299
* phy_resolve_aneg_linkmode - resolve the advertisements into phy settings
288300
* @phydev: The phy_device struct
@@ -305,13 +317,7 @@ void phy_resolve_aneg_linkmode(struct phy_device *phydev)
305317
break;
306318
}
307319

308-
if (phydev->duplex == DUPLEX_FULL) {
309-
phydev->pause = linkmode_test_bit(ETHTOOL_LINK_MODE_Pause_BIT,
310-
phydev->lp_advertising);
311-
phydev->asym_pause = linkmode_test_bit(
312-
ETHTOOL_LINK_MODE_Asym_Pause_BIT,
313-
phydev->lp_advertising);
314-
}
320+
phy_resolve_aneg_pause(phydev);
315321
}
316322
EXPORT_SYMBOL_GPL(phy_resolve_aneg_linkmode);
317323

include/linux/phy.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -678,6 +678,7 @@ static inline bool phy_is_started(struct phy_device *phydev)
678678
return phydev->state >= PHY_UP;
679679
}
680680

681+
void phy_resolve_aneg_pause(struct phy_device *phydev);
681682
void phy_resolve_aneg_linkmode(struct phy_device *phydev);
682683

683684
/**

0 commit comments

Comments
 (0)