From: "Russell King (Oracle)" <rmk+kernel@armlinux•org.uk>
To: Jose Abreu <Jose.Abreu@synopsys•com>
Cc: Andrew Lunn <andrew@lunn•ch>,
"David S. Miller" <davem@davemloft•net>,
Eric Dumazet <edumazet@google•com>,
Heiner Kallweit <hkallweit1@gmail•com>,
Jakub Kicinski <kuba@kernel•org>,
netdev@vger•kernel.org, Paolo Abeni <pabeni@redhat•com>
Subject: [PATCH RFC net-next 2/9] net: phylink: remove duplicated linkmode pause resolution
Date: Fri, 12 May 2023 18:27:09 +0100 [thread overview]
Message-ID: <E1pxWXt-002Qrz-Rw@rmk-PC.armlinux.org.uk> (raw)
In-Reply-To: <ZF52z7PqH2HLrWEU@shell.armlinux.org.uk>
Phylink had two chunks of code virtually the same for resolving the
negotiated pause modes. Factor this down to one function.
Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux•org.uk>
---
drivers/net/phy/phylink.c | 15 ++++-----------
1 file changed, 4 insertions(+), 11 deletions(-)
diff --git a/drivers/net/phy/phylink.c b/drivers/net/phy/phylink.c
index cc4d5b51a82f..783ab4a66111 100644
--- a/drivers/net/phy/phylink.c
+++ b/drivers/net/phy/phylink.c
@@ -1012,11 +1012,10 @@ static void phylink_apply_manual_flow(struct phylink *pl,
state->pause = pl->link_config.pause;
}
-static void phylink_resolve_flow(struct phylink_link_state *state)
+static void phylink_resolve_an_pause(struct phylink_link_state *state)
{
bool tx_pause, rx_pause;
- state->pause = MLO_PAUSE_NONE;
if (state->duplex == DUPLEX_FULL) {
linkmode_resolve_pause(state->advertising,
state->lp_advertising,
@@ -1228,7 +1227,8 @@ static void phylink_get_fixed_state(struct phylink *pl,
else if (pl->link_gpio)
state->link = !!gpiod_get_value_cansleep(pl->link_gpio);
- phylink_resolve_flow(state);
+ state->pause = MLO_PAUSE_NONE;
+ phylink_resolve_an_pause(state);
}
static void phylink_mac_initial_config(struct phylink *pl, bool force_restart)
@@ -3279,7 +3279,6 @@ static const struct sfp_upstream_ops sfp_phylink_ops = {
static void phylink_decode_c37_word(struct phylink_link_state *state,
uint16_t config_reg, int speed)
{
- bool tx_pause, rx_pause;
int fd_bit;
if (speed == SPEED_2500)
@@ -3298,13 +3297,7 @@ static void phylink_decode_c37_word(struct phylink_link_state *state,
state->link = false;
}
- linkmode_resolve_pause(state->advertising, state->lp_advertising,
- &tx_pause, &rx_pause);
-
- if (tx_pause)
- state->pause |= MLO_PAUSE_TX;
- if (rx_pause)
- state->pause |= MLO_PAUSE_RX;
+ phylink_resolve_an_pause(state);
}
static void phylink_decode_sgmii_word(struct phylink_link_state *state,
--
2.30.2
next prev parent reply other threads:[~2023-05-12 17:27 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-05-12 17:26 [PATCH RFC net-next 0/9] net: pcs: xpcs: cleanups for clause 73 support Russell King (Oracle)
2023-05-12 17:27 ` [PATCH RFC net-next 1/9] net: mdio: add clause 73 to ethtool conversion helper Russell King (Oracle)
2023-05-12 23:47 ` Andrew Lunn
2023-05-12 17:27 ` Russell King (Oracle) [this message]
2023-05-12 23:52 ` [PATCH RFC net-next 2/9] net: phylink: remove duplicated linkmode pause resolution Andrew Lunn
2023-05-12 17:27 ` [PATCH RFC net-next 3/9] net: phylink: add function to resolve clause 73 negotiation Russell King (Oracle)
2023-05-12 23:57 ` Andrew Lunn
2023-05-13 9:24 ` Russell King (Oracle)
2023-05-13 13:55 ` Andrew Lunn
2023-05-12 17:27 ` [PATCH RFC net-next 4/9] net: pcs: xpcs: clean up reading clause 73 link partner advertisement Russell King (Oracle)
2023-05-13 0:01 ` Andrew Lunn
2023-05-12 17:27 ` [PATCH RFC net-next 5/9] net: pcs: xpcs: use mii_c73_to_linkmode() helper Russell King (Oracle)
2023-05-13 0:05 ` Andrew Lunn
2023-05-12 17:27 ` [PATCH RFC net-next 6/9] net: pcs: xpcs: correct lp_advertising contents Russell King (Oracle)
2023-05-13 17:39 ` Andrew Lunn
2023-05-12 17:27 ` [PATCH RFC net-next 7/9] net: pcs: xpcs: correct pause resolution Russell King (Oracle)
2023-05-13 17:47 ` Andrew Lunn
2023-05-13 18:13 ` Russell King (Oracle)
2023-05-13 18:17 ` Andrew Lunn
2023-05-12 17:27 ` [PATCH RFC net-next 8/9] net: pcs: xpcs: use phylink_resolve_c73() helper Russell King (Oracle)
2023-05-12 19:38 ` Simon Horman
2023-05-12 17:27 ` [PATCH RFC net-next 9/9] net: pcs: xpcs: avoid reading STAT1 more than once Russell King (Oracle)
2023-05-12 19:36 ` Simon Horman
-- strict thread matches above, loose matches on Subject: below --
2023-05-17 14:11 [PATCH RFC v2 net-next 0/9] net: pcs: xpcs: cleanups for clause 73 support Russell King (Oracle)
2023-05-17 14:11 ` [PATCH RFC net-next 2/9] net: phylink: remove duplicated linkmode pause resolution Russell King (Oracle)
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=E1pxWXt-002Qrz-Rw@rmk-PC.armlinux.org.uk \
--to=rmk+kernel@armlinux$(echo .)org.uk \
--cc=Jose.Abreu@synopsys$(echo .)com \
--cc=andrew@lunn$(echo .)ch \
--cc=davem@davemloft$(echo .)net \
--cc=edumazet@google$(echo .)com \
--cc=hkallweit1@gmail$(echo .)com \
--cc=kuba@kernel$(echo .)org \
--cc=netdev@vger$(echo .)kernel.org \
--cc=pabeni@redhat$(echo .)com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox