kernel: bump 4.19 to 4.19.55
[openwrt/openwrt.git] / target / linux / mvebu / patches-4.19 / 403-net-phylink-ensure-inband-AN-works-correctly.patch
1 From 72f973f292b3eaaf451ebcd3253900d41f4ef24a Mon Sep 17 00:00:00 2001
2 From: Russell King <rmk+kernel@armlinux.org.uk>
3 Date: Fri, 25 Jan 2019 17:42:51 +0000
4 Subject: [PATCH] net: phylink: ensure inband AN works correctly
5
6 Do not update the link interface mode while the link is down to avoid
7 spurious link interface changes.
8
9 Always call mac_config if we have a PHY to propagate the pause mode
10 settings to the MAC.
11
12 Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
13 ---
14 drivers/net/phy/phylink.c | 37 +++++++++++++++----------------------
15 1 file changed, 15 insertions(+), 22 deletions(-)
16
17 --- a/drivers/net/phy/phylink.c
18 +++ b/drivers/net/phy/phylink.c
19 @@ -457,28 +457,21 @@ static void phylink_resolve(struct work_
20
21 case MLO_AN_INBAND:
22 phylink_get_mac_state(pl, &link_state);
23 - if (pl->phydev) {
24 - bool changed = false;
25
26 - link_state.link = link_state.link &&
27 - pl->phy_state.link;
28 + /* If we have a phy, the "up" state is the union of
29 + * both the PHY and the MAC */
30 + if (pl->phydev)
31 + link_state.link &= pl->phy_state.link;
32
33 - if (pl->phy_state.interface !=
34 - link_state.interface) {
35 - link_state.interface = pl->phy_state.interface;
36 - changed = true;
37 - }
38 + /* Only update if the PHY link is up */
39 + if (pl->phydev && pl->phy_state.link) {
40 + link_state.interface = pl->phy_state.interface;
41
42 - /* Propagate the flow control from the PHY
43 - * to the MAC. Also propagate the interface
44 - * if changed.
45 - */
46 - if (pl->phy_state.link || changed) {
47 - link_state.pause |= pl->phy_state.pause;
48 - phylink_resolve_flow(pl, &link_state);
49 -
50 - phylink_mac_config(pl, &link_state);
51 - }
52 + /* If we have a PHY, we need to update with
53 + * the pause mode bits. */
54 + link_state.pause |= pl->phy_state.pause;
55 + phylink_resolve_flow(pl, &link_state);
56 + phylink_mac_config(pl, &link_state);
57 }
58 break;
59 }