net: ethernet: Add helper for MACs which support asym pause

Rather than have the MAC drivers manipulate phydev members to indicate
they support Asym Pause, add a helper function.

Signed-off-by: Andrew Lunn <andrew@lunn.ch>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
Andrew Lunn
2018-09-12 01:53:15 +02:00
committed by David S. Miller
parent 41124fa64d
commit af8d9bb2f2
17 changed files with 33 additions and 43 deletions

View File

@@ -2358,13 +2358,10 @@ static int sbmac_mii_probe(struct net_device *dev)
/* Remove any features not supported by the controller */
phy_set_max_speed(phy_dev, SPEED_1000);
phy_dev->supported |= SUPPORTED_Pause |
SUPPORTED_Asym_Pause;
phy_support_asym_pause(phy_dev);
phy_attached_info(phy_dev);
phy_dev->advertising = phy_dev->supported;
sc->phy_dev = phy_dev;
return 0;

View File

@@ -2123,15 +2123,13 @@ static int tg3_phy_init(struct tg3 *tp)
case PHY_INTERFACE_MODE_RGMII:
if (!(tp->phy_flags & TG3_PHYFLG_10_100_ONLY)) {
phy_set_max_speed(phydev, SPEED_1000);
phydev->supported |= (SUPPORTED_Pause |
SUPPORTED_Asym_Pause);
phy_support_asym_pause(phydev);
break;
}
/* fallthru */
case PHY_INTERFACE_MODE_MII:
phy_set_max_speed(phydev, SPEED_100);
phydev->supported |= (SUPPORTED_Pause |
SUPPORTED_Asym_Pause);
phy_support_asym_pause(phydev);
break;
default:
phy_disconnect(mdiobus_get_phy(tp->mdio_bus, tp->phy_addr));
@@ -2140,8 +2138,6 @@ static int tg3_phy_init(struct tg3 *tp)
tp->phy_flags |= TG3_PHYFLG_IS_CONNECTED;
phydev->advertising = phydev->supported;
phy_attached_info(phydev);
return 0;