]> git.baikalelectronics.ru Git - kernel.git/commit
net: phy: improve pause handling
authorHeiner Kallweit <hkallweit1@gmail.com>
Wed, 1 May 2019 19:34:43 +0000 (21:34 +0200)
committerDavid S. Miller <davem@davemloft.net>
Sat, 4 May 2019 04:47:55 +0000 (00:47 -0400)
commite3ea57b62bc8700637b315f7d93390e33b540b5e
tree180da5004c9e976a82513e0a5b12b3d1e97f41a1
parent1816c72d3b8cbdf6ae9badf3c3ed5ac727e32802
net: phy: improve pause handling

When probing the phy device we set sym and asym pause in the "supported"
bitmap (unless the PHY tells us otherwise). However we don't know yet
whether the MAC supports pause. Simply copying phy->supported to
phy->advertising will trigger advertising pause, and that's not
what we want. Therefore add phy_advertise_supported() that copies all
modes but doesn't touch the pause bits.

In phy_support_(a)sym_pause we shouldn't set any bits in the supported
bitmap because we may set a bit the PHY intentionally disabled.
Effective pause support should be the AND-combined PHY and MAC pause
capabilities. If the MAC supports everything, then it's only relevant
what the PHY supports. If MAC supports sym pause only, then we have to
clear the asym bit in phydev->supported.
Copy the pause flags only and don't touch the modes, because a driver
may have intentionally removed a mode from phydev->advertising.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/phy/fixed_phy.c
drivers/net/phy/phy-core.c
drivers/net/phy/phy_device.c
include/linux/phy.h