Commit b4010af9 authored by Heiner Kallweit's avatar Heiner Kallweit Committed by David S. Miller

net: phy: fix phy_validate_pause

We have valid scenarios where ETHTOOL_LINK_MODE_Pause_BIT doesn't
need to be supported. Therefore extend the first check to check
for rx_pause being set.

See also phy_set_asym_pause:
rx=0 and tx=1: advertise asym pause only
rx=0 and tx=0: stop advertising both pause modes

The fixed commit isn't wrong, it's just the one that introduced the
linkmode bitmaps.

Fixes: 3c1bcc86 ("net: ethernet: Convert phydev advertize and supported from u32 to link mode")
Signed-off-by: default avatarHeiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 7fcd1e03
......@@ -2044,11 +2044,14 @@ bool phy_validate_pause(struct phy_device *phydev,
struct ethtool_pauseparam *pp)
{
if (!linkmode_test_bit(ETHTOOL_LINK_MODE_Pause_BIT,
phydev->supported) ||
(!linkmode_test_bit(ETHTOOL_LINK_MODE_Asym_Pause_BIT,
phydev->supported) && pp->rx_pause)
return false;
if (!linkmode_test_bit(ETHTOOL_LINK_MODE_Asym_Pause_BIT,
phydev->supported) &&
pp->rx_pause != pp->tx_pause))
pp->rx_pause != pp->tx_pause)
return false;
return true;
}
EXPORT_SYMBOL(phy_validate_pause);
......
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