Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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: 3c1bcc8614db ("net: ethernet: Convert phydev advertize and supported from u32 to link mode")
Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Heiner Kallweit and committed by
David S. Miller
b4010af9 7fcd1e03

+7 -4
+7 -4
drivers/net/phy/phy_device.c
··· 2044 2044 struct ethtool_pauseparam *pp) 2045 2045 { 2046 2046 if (!linkmode_test_bit(ETHTOOL_LINK_MODE_Pause_BIT, 2047 - phydev->supported) || 2048 - (!linkmode_test_bit(ETHTOOL_LINK_MODE_Asym_Pause_BIT, 2049 - phydev->supported) && 2050 - pp->rx_pause != pp->tx_pause)) 2047 + phydev->supported) && pp->rx_pause) 2051 2048 return false; 2049 + 2050 + if (!linkmode_test_bit(ETHTOOL_LINK_MODE_Asym_Pause_BIT, 2051 + phydev->supported) && 2052 + pp->rx_pause != pp->tx_pause) 2053 + return false; 2054 + 2052 2055 return true; 2053 2056 } 2054 2057 EXPORT_SYMBOL(phy_validate_pause);