0e272ea891a4c429f6e874e68b65a9aec81fab9a
[openwrt/staging/stintel.git] /
1 From 6f3ea4e5b1f0867ec217f6101fcb89783ed905d7 Mon Sep 17 00:00:00 2001
2 From: Russell King <rmk+kernel@armlinux.org.uk>
3 Date: Sat, 9 Feb 2019 18:23:26 +0000
4 Subject: [PATCH] net: phylink: only call mac_config() during resolve
5 when link is up
6
7 There's little point calling mac_config() when the link is down.
8
9 Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
10 ---
11 drivers/net/phy/phylink.c | 11 +++++++++--
12 1 file changed, 9 insertions(+), 2 deletions(-)
13
14 --- a/drivers/net/phy/phylink.c
15 +++ b/drivers/net/phy/phylink.c
16 @@ -339,6 +339,13 @@ static void phylink_mac_config(struct ph
17 pl->ops->mac_config(pl->netdev, pl->link_an_mode, state);
18 }
19
20 +static void phylink_mac_config_up(struct phylink *pl,
21 + const struct phylink_link_state *state)
22 +{
23 + if (state->link)
24 + phylink_mac_config(pl, state);
25 +}
26 +
27 static void phylink_mac_an_restart(struct phylink *pl)
28 {
29 if (pl->link_config.an_enabled &&
30 @@ -442,12 +449,12 @@ static void phylink_resolve(struct work_
31 case MLO_AN_PHY:
32 link_state = pl->phy_state;
33 phylink_resolve_flow(pl, &link_state);
34 - phylink_mac_config(pl, &link_state);
35 + phylink_mac_config_up(pl, &link_state);
36 break;
37
38 case MLO_AN_FIXED:
39 phylink_get_fixed_state(pl, &link_state);
40 - phylink_mac_config(pl, &link_state);
41 + phylink_mac_config_up(pl, &link_state);
42 break;
43
44 case MLO_AN_INBAND: