kernel: copy kernel 4.19 code to 5.4
[openwrt/staging/mkresin.git] / target / linux / generic / backport-5.4 / 739-v5.5-net-phylink-update-to-use-phy_support_asym_pause.patch
1 From 09d7d8395ec61fba4392b35baa6f71c4e36489df Mon Sep 17 00:00:00 2001
2 From: Russell King <rmk+kernel@armlinux.org.uk>
3 Date: Fri, 8 Nov 2019 15:18:02 +0000
4 Subject: [PATCH 637/660] net: phylink: update to use phy_support_asym_pause()
5
6 Use phy_support_asym_pause() rather than open-coding it.
7
8 Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
9 ---
10 drivers/net/phy/phylink.c | 17 +++++++----------
11 1 file changed, 7 insertions(+), 10 deletions(-)
12
13 --- a/drivers/net/phy/phylink.c
14 +++ b/drivers/net/phy/phylink.c
15 @@ -678,12 +678,6 @@ static int phylink_bringup_phy(struct ph
16 u32 advertising;
17 int ret;
18
19 - memset(&config, 0, sizeof(config));
20 - ethtool_convert_legacy_u32_to_link_mode(supported, phy->supported);
21 - ethtool_convert_legacy_u32_to_link_mode(config.advertising,
22 - phy->advertising);
23 - config.interface = pl->link_config.interface;
24 -
25 /*
26 * This is the new way of dealing with flow control for PHYs,
27 * as described by Timur Tabi in commit 529ed1275263 ("net: phy:
28 @@ -691,10 +685,13 @@ static int phylink_bringup_phy(struct ph
29 * using our validate call to the MAC, we rely upon the MAC
30 * clearing the bits from both supported and advertising fields.
31 */
32 - if (phylink_test(supported, Pause))
33 - phylink_set(config.advertising, Pause);
34 - if (phylink_test(supported, Asym_Pause))
35 - phylink_set(config.advertising, Asym_Pause);
36 + phy_support_asym_pause(phy);
37 +
38 + memset(&config, 0, sizeof(config));
39 + ethtool_convert_legacy_u32_to_link_mode(supported, phy->supported);
40 + ethtool_convert_legacy_u32_to_link_mode(config.advertising,
41 + phy->advertising);
42 + config.interface = pl->link_config.interface;
43
44 ret = phylink_validate(pl, supported, &config);
45 if (ret)