Skip to content

Commit

Permalink
net: phylink: update to use phy_support_asym_pause()
Browse files Browse the repository at this point in the history
Use phy_support_asym_pause() rather than open-coding it.

Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Russell King authored and David S. Miller committed Nov 16, 2019
1 parent 50bef71 commit 725ea4b
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions drivers/net/phy/phylink.c
Original file line number Diff line number Diff line change
Expand Up @@ -713,22 +713,19 @@ static int phylink_bringup_phy(struct phylink *pl, struct phy_device *phy)
__ETHTOOL_DECLARE_LINK_MODE_MASK(supported);
int ret;

memset(&config, 0, sizeof(config));
linkmode_copy(supported, phy->supported);
linkmode_copy(config.advertising, phy->advertising);
config.interface = pl->link_config.interface;

/*
* This is the new way of dealing with flow control for PHYs,
* as described by Timur Tabi in commit 529ed1275263 ("net: phy:
* phy drivers should not set SUPPORTED_[Asym_]Pause") except
* using our validate call to the MAC, we rely upon the MAC
* clearing the bits from both supported and advertising fields.
*/
if (phylink_test(supported, Pause))
phylink_set(config.advertising, Pause);
if (phylink_test(supported, Asym_Pause))
phylink_set(config.advertising, Asym_Pause);
phy_support_asym_pause(phy);

memset(&config, 0, sizeof(config));
linkmode_copy(supported, phy->supported);
linkmode_copy(config.advertising, phy->advertising);
config.interface = pl->link_config.interface;

ret = phylink_validate(pl, supported, &config);
if (ret)
Expand Down

0 comments on commit 725ea4b

Please sign in to comment.