diff options
| author | David S. Miller <davem@davemloft.net> | 2023-03-31 09:23:41 +0100 |
|---|---|---|
| committer | David S. Miller <davem@davemloft.net> | 2023-03-31 09:23:41 +0100 |
| commit | 279d8ff5ec00b06a5dc9b90f3d00a5a5253aa95d (patch) | |
| tree | 7e35d1b3b7ed09e85953fb360187a5001df190a7 /drivers/net/phy | |
| parent | 44d807320000db0d0013372ad39b53e12d52f758 (diff) | |
| parent | 6fc21a6ed5953b1dd3a41ce7be1ea57f5ef8c081 (diff) | |
| download | lwn-279d8ff5ec00b06a5dc9b90f3d00a5a5253aa95d.tar.gz lwn-279d8ff5ec00b06a5dc9b90f3d00a5a5253aa95d.zip | |
Merge branch 'phy-handle-fixes'
Michael Sit Wei Hong says:
====================
Fix PHY handle no longer parsing
After the fixed link support was introduced, it is observed that PHY
no longer attach to the MAC properly. So we introduce a helper
function to determine if the MAC should expect to connect to a PHY
and proceed accordingly.
====================
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/phy')
| -rw-r--r-- | drivers/net/phy/phylink.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/drivers/net/phy/phylink.c b/drivers/net/phy/phylink.c index 1a2f074685fa..30c166b33468 100644 --- a/drivers/net/phy/phylink.c +++ b/drivers/net/phy/phylink.c @@ -1586,6 +1586,25 @@ void phylink_destroy(struct phylink *pl) } EXPORT_SYMBOL_GPL(phylink_destroy); +/** + * phylink_expects_phy() - Determine if phylink expects a phy to be attached + * @pl: a pointer to a &struct phylink returned from phylink_create() + * + * When using fixed-link mode, or in-band mode with 1000base-X or 2500base-X, + * no PHY is needed. + * + * Returns true if phylink will be expecting a PHY. + */ +bool phylink_expects_phy(struct phylink *pl) +{ + if (pl->cfg_link_an_mode == MLO_AN_FIXED || + (pl->cfg_link_an_mode == MLO_AN_INBAND && + phy_interface_mode_is_8023z(pl->link_config.interface))) + return false; + return true; +} +EXPORT_SYMBOL_GPL(phylink_expects_phy); + static void phylink_phy_change(struct phy_device *phydev, bool up) { struct phylink *pl = phydev->phylink; |
