diff options
| author | Heiner Kallweit <hkallweit1@gmail.com> | 2019-05-01 15:54:28 -0400 |
|---|---|---|
| committer | David S. Miller <davem@davemloft.net> | 2019-05-05 04:04:10 -0400 |
| commit | b4010af981ac8cdf1f7f58eb6b131c482e5dee02 (patch) | |
| tree | 7c346ca5f94d61b85fa58bf4399f639455252037 | |
| parent | 7fcd1e033dacedd520abebc943c960dcf5add3ae (diff) | |
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>
| -rw-r--r-- | drivers/net/phy/phy_device.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c index 77068c545de0..cd5966b0db57 100644 --- a/drivers/net/phy/phy_device.c +++ b/drivers/net/phy/phy_device.c | |||
| @@ -2044,11 +2044,14 @@ bool phy_validate_pause(struct phy_device *phydev, | |||
| 2044 | struct ethtool_pauseparam *pp) | 2044 | struct ethtool_pauseparam *pp) |
| 2045 | { | 2045 | { |
| 2046 | if (!linkmode_test_bit(ETHTOOL_LINK_MODE_Pause_BIT, | 2046 | if (!linkmode_test_bit(ETHTOOL_LINK_MODE_Pause_BIT, |
| 2047 | phydev->supported) || | 2047 | phydev->supported) && pp->rx_pause) |
| 2048 | (!linkmode_test_bit(ETHTOOL_LINK_MODE_Asym_Pause_BIT, | ||
| 2049 | phydev->supported) && | ||
| 2050 | pp->rx_pause != pp->tx_pause)) | ||
| 2051 | return false; | 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 | return true; | 2055 | return true; |
| 2053 | } | 2056 | } |
| 2054 | EXPORT_SYMBOL(phy_validate_pause); | 2057 | EXPORT_SYMBOL(phy_validate_pause); |
