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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 82BD2C433FE for ; Wed, 23 Nov 2022 10:53:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:List-Subscribe:List-Help: List-Post:List-Archive:List-Unsubscribe:List-Id:Message-Id:Date:Subject:Cc:To :From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=cCgr8Vz2gIEZjSdGWGD/NeJE3cZ5UWA6dHdBGyPtLYA=; b=hZSzu9uIPzSZAV 6Dnj2dtvGEMfaNeEw72pz4Z+UBZqyo2RZxtVvuUCU/Fj55JC8K74Rt83RTc7nNZt0tdNxAT3N+cv4 VC9PUp9HySdR5oAo4LZYN/MBcD/pllZ7QCUnEEtKSGDOPFB/cEv6hMIR51G3oSzONLfXacD/BOq3l 7LLC8MWn6NDmY/kmKgr0exHE6+QYyXH2/dc/Rb4zopIyd16THO7JjYbbzRGe7dkhI7HT91NJeTDRP 49E29QwtatHjx1l+vDqr7vNcnqT6Vnqnux1hWHrTuZluECT0LycF8Mil0Qawst9VXPayQ5fZCdAzF IKRYfTpA1cTeou2+oHVg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oxnMK-00GSWE-0u; Wed, 23 Nov 2022 10:52:04 +0000 Received: from mga09.intel.com ([134.134.136.24]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oxnMH-00GSUn-5u for linux-arm-kernel@lists.infradead.org; Wed, 23 Nov 2022 10:52:02 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1669200721; x=1700736721; h=from:to:cc:subject:date:message-id; bh=6iGjfHGImnQA/ryUfPU7pulSh2j0yD9AxLZ5NGkr2kQ=; b=D/IVqMQEaG7T7G7e7/ljSeSNr+0higav6w10cwNxHc7W5WlzYMc8pl9x /0lMxWEfBMhZCg9MZdJN+kPbNkRDX551J2M2h5QQOGmoyEFcW6FlzAmMg BmsfZF5fpSI1aNosYP2EPyHtkjO6dPdU2NHwYDLHFVkgpFHxutfAjwNe4 eGfreH8ypgIaGHMvB+3pur/phuorKK5/LMhO3phj2vCIQKIHYIGy5lokF /2nkZQy6pWshNuJGtPzfA6HUDR9uRyaRjWT/1wyd8PEDym069EWsjWiBP eOJMEdDEru37Kw4xJ63vFrZw8KhlvkVVSfnYTyGz4PFhB36ZWdZqqgTUw A==; X-IronPort-AV: E=McAfee;i="6500,9779,10539"; a="315191515" X-IronPort-AV: E=Sophos;i="5.96,187,1665471600"; d="scan'208";a="315191515" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Nov 2022 02:51:58 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10539"; a="672837333" X-IronPort-AV: E=Sophos;i="5.96,187,1665471600"; d="scan'208";a="672837333" Received: from p12ill01gohweish.png.intel.com ([10.88.229.16]) by orsmga008.jf.intel.com with ESMTP; 23 Nov 2022 02:51:53 -0800 From: "Goh, Wei Sheng" To: Giuseppe Cavallaro , Alexandre Torgue , Jose Abreu , "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Maxime Coquelin Cc: netdev@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Alexandre Torgue , Ong Boon Leong , Voon Wei Feng , Tan Tee Min , Ahmad Tarmizi Noor Azura , Looi Hong Aun , Goh Wei Sheng Subject: [PATCH net v4] net: stmmac: Set MAC's flow control register to reflect current settings Date: Wed, 23 Nov 2022 18:51:10 +0800 Message-Id: <20221123105110.23617-1-wei.sheng.goh@intel.com> X-Mailer: git-send-email 2.17.1 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221123_025201_315300_ABF1180E X-CRM114-Status: GOOD ( 11.81 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Currently, pause frame register GMAC_RX_FLOW_CTRL_RFE is not updated correctly when 'ethtool -A autoneg off rx off tx off' command is issued. This fix ensures the flow control change is reflected directly in the GMAC_RX_FLOW_CTRL_RFE register. Fixes: 46f69ded988d ("net: stmmac: Use resolved link config in mac_link_up()") Cc: # 5.10.x Signed-off-by: Goh, Wei Sheng Signed-off-by: Noor Azura Ahmad Tarmizi --- V3 -> V4: Fix commit message and incorrect insertions(+) value V2 -> V3: Removed value assign for 'flow' in else statement based on review comments V1 -> V2: Removed needless condition based on review comments drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c | 2 ++ drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 12 ++++++++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c b/drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c index c25bfecb4a2d..369db308b1dd 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c @@ -748,6 +748,8 @@ static void dwmac4_flow_ctrl(struct mac_device_info *hw, unsigned int duplex, if (fc & FLOW_RX) { pr_debug("\tReceive Flow-Control ON\n"); flow |= GMAC_RX_FLOW_CTRL_RFE; + } else { + pr_debug("\tReceive Flow-Control OFF\n"); } writel(flow, ioaddr + GMAC_RX_FLOW_CTRL); 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 + priv->flow_ctrl = FLOW_OFF; + + stmmac_mac_flow_ctrl(priv, duplex); if (ctrl != old_ctrl) writel(ctrl, priv->ioaddr + MAC_CTRL_REG); -- 2.17.1 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel