From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 04DDCC433FE for ; Fri, 18 Nov 2022 11:16:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241644AbiKRLQv (ORCPT ); Fri, 18 Nov 2022 06:16:51 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52294 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235188AbiKRLQt (ORCPT ); Fri, 18 Nov 2022 06:16:49 -0500 Received: from pandora.armlinux.org.uk (pandora.armlinux.org.uk [IPv6:2001:4d48:ad52:32c8:5054:ff:fe00:142]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3EBD064555; Fri, 18 Nov 2022 03:16:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=armlinux.org.uk; s=pandora-2019; h=Sender:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=jCwiJcjbg7ZTiA+/f8xyS0h637tVnp9E3xI0ct+Ox54=; b=rdf+XtnYZnsMspk9kS+ZyEh0AS RGUkEV072p31F9GFMBGTOEe6ALTWGCIK0JuPu8PhAeIZYMrFcpz3qqdzROztEjXfNAYJRkb8eRWYT e22+XnXqBxBLbZoRze7we+h03xg21hlr+/NqlLOxV+Pa9c7DvOfTekCmZGtv7bWPCyrjT29aJmVg0 QDnmZIG0yUbnvkZiHay1w8+4kEQWnpircZoR9Z6WUXU6VMSmBMRWGOAF9ySxbZo/6YdSYAAQxY1P1 HCMUwICYV899eA97K58YX8q/NqeWF63YQcgk19VPhMWWxqjeGV+6tGOlZwwYTHahBOG/W+0sWxnvO OxOBw7Sg==; Received: from shell.armlinux.org.uk ([fd8f:7570:feb6:1:5054:ff:fe00:4ec]:35326) by pandora.armlinux.org.uk with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1ovzMG-0005cX-UB; Fri, 18 Nov 2022 11:16:32 +0000 Received: from linux by shell.armlinux.org.uk with local (Exim 4.94.2) (envelope-from ) id 1ovzMA-0007iy-Ra; Fri, 18 Nov 2022 11:16:26 +0000 Date: Fri, 18 Nov 2022 11:16:26 +0000 From: "Russell King (Oracle)" To: "Goh, Wei Sheng" Cc: Giuseppe Cavallaro , Alexandre Torgue , Jose Abreu , "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Maxime Coquelin , netdev@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Ong Boon Leong , Voon Wei Feng , Tan Tee Min , Ahmad Tarmizi Noor Azura , Looi Hong Aun Subject: Re: [PATCH net] net: stmmac: Set MAC's flow control register to reflect current settings Message-ID: References: <20221118072051.31313-1-wei.sheng.goh@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20221118072051.31313-1-wei.sheng.goh@intel.com> Sender: Russell King (Oracle) Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org 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!