3a26b4b6006ffb514f08f5430fb305bca0b0bf0d
[openwrt/staging/neocturne.git] /
1 From 4b624a39f2ab523ca6a6ad9448fab1deb7b101e2 Mon Sep 17 00:00:00 2001
2 From: "Russell King (Oracle)" <rmk+kernel@armlinux.org.uk>
3 Date: Tue, 23 May 2023 11:15:53 +0100
4 Subject: [PATCH 17/21] net: phylink: remove duplicated linkmode pause
5 resolution
6
7 Phylink had two chunks of code virtually the same for resolving the
8 negotiated pause modes. Factor this down to one function.
9
10 Reviewed-by: Andrew Lunn <andrew@lunn.ch>
11 Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
12 Signed-off-by: Jakub Kicinski <kuba@kernel.org>
13 ---
14 drivers/net/phy/phylink.c | 15 ++++-----------
15 1 file changed, 4 insertions(+), 11 deletions(-)
16
17 --- a/drivers/net/phy/phylink.c
18 +++ b/drivers/net/phy/phylink.c
19 @@ -976,11 +976,10 @@ static void phylink_apply_manual_flow(st
20 state->pause = pl->link_config.pause;
21 }
22
23 -static void phylink_resolve_flow(struct phylink_link_state *state)
24 +static void phylink_resolve_an_pause(struct phylink_link_state *state)
25 {
26 bool tx_pause, rx_pause;
27
28 - state->pause = MLO_PAUSE_NONE;
29 if (state->duplex == DUPLEX_FULL) {
30 linkmode_resolve_pause(state->advertising,
31 state->lp_advertising,
32 @@ -1192,7 +1191,8 @@ static void phylink_get_fixed_state(stru
33 else if (pl->link_gpio)
34 state->link = !!gpiod_get_value_cansleep(pl->link_gpio);
35
36 - phylink_resolve_flow(state);
37 + state->pause = MLO_PAUSE_NONE;
38 + phylink_resolve_an_pause(state);
39 }
40
41 static void phylink_mac_initial_config(struct phylink *pl, bool force_restart)
42 @@ -3215,7 +3215,6 @@ static const struct sfp_upstream_ops sfp
43 static void phylink_decode_c37_word(struct phylink_link_state *state,
44 uint16_t config_reg, int speed)
45 {
46 - bool tx_pause, rx_pause;
47 int fd_bit;
48
49 if (speed == SPEED_2500)
50 @@ -3234,13 +3233,7 @@ static void phylink_decode_c37_word(stru
51 state->link = false;
52 }
53
54 - linkmode_resolve_pause(state->advertising, state->lp_advertising,
55 - &tx_pause, &rx_pause);
56 -
57 - if (tx_pause)
58 - state->pause |= MLO_PAUSE_TX;
59 - if (rx_pause)
60 - state->pause |= MLO_PAUSE_RX;
61 + phylink_resolve_an_pause(state);
62 }
63
64 static void phylink_decode_sgmii_word(struct phylink_link_state *state,