[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <Y3dpikbzUJAazMTD@shell.armlinux.org.uk>
Date: Fri, 18 Nov 2022 11:16:26 +0000
From: "Russell King (Oracle)" <linux@...linux.org.uk>
To: "Goh, Wei Sheng" <wei.sheng.goh@...el.com>
Cc: Giuseppe Cavallaro <peppe.cavallaro@...com>,
Alexandre Torgue <alexandre.torgue@...com>,
Jose Abreu <joabreu@...opsys.com>,
"David S . Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>,
Paolo Abeni <pabeni@...hat.com>,
Maxime Coquelin <mcoquelin.stm32@...il.com>,
netdev@...r.kernel.org, linux-stm32@...md-mailman.stormreply.com,
linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org,
Ong Boon Leong <boon.leong.ong@...el.com>,
Voon Wei Feng <weifeng.voon@...el.com>,
Tan Tee Min <tee.min.tan@...el.com>,
Ahmad Tarmizi Noor Azura <noor.azura.ahmad.tarmizi@...el.com>,
Looi Hong Aun <hong.aun.looi@...el.com>
Subject: Re: [PATCH net] net: stmmac: Set MAC's flow control register to
reflect current settings
On Fri, Nov 18, 2022 at 03:20:51PM +0800, Goh, Wei Sheng wrote:
> diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> index 8273e6a175c8..ab7f48f32f5b 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> @@ -1061,8 +1061,16 @@ static void stmmac_mac_link_up(struct phylink_config *config,
> ctrl |= priv->hw->link.duplex;
>
> /* Flow Control operation */
> - if (tx_pause && rx_pause)
> - stmmac_mac_flow_ctrl(priv, duplex);
> + if (rx_pause && tx_pause)
> + priv->flow_ctrl = FLOW_AUTO;
> + else if (rx_pause && !tx_pause)
> + priv->flow_ctrl = FLOW_RX;
> + else if (!rx_pause && tx_pause)
> + priv->flow_ctrl = FLOW_TX;
> + else if (!rx_pause && !tx_pause)
> + priv->flow_ctrl = FLOW_OFF;
Since "if (!rx_pause && !tx_pause)" will always be true at this point,
you can eliminate this needless last condition, which will make the code
a little more readable.
Thanks.
--
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!
Powered by blists - more mailing lists