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 CFE03C433FE for ; Tue, 22 Nov 2022 18:54:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234535AbiKVSyP (ORCPT ); Tue, 22 Nov 2022 13:54:15 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54176 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230365AbiKVSyO (ORCPT ); Tue, 22 Nov 2022 13:54:14 -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 B34F46037F; Tue, 22 Nov 2022 10:54:13 -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=b/1Ak3iyuhV5gOFgiGiOz207h7TByUFgfDFxK3JwYHA=; b=WXFFaIBfa4zWFQfoeG9X9PfCFq lMz1/cLnBHmLlCgoibrl+VHswJOcfUTqv4dh81ic5Ekyo6WFwLttkkMr42xcZ0m/rvkhlYjqTKz4k 6Nnfvbs0UfmudMUxR0KYIwsmMCrC5zFyOkAydgTPM7V45M9vUQ9cDJl8AVJ36O4Wceh9bKIkuXq33 iTQOxkCQhBbW6tzYREWJ7BSE5iJCxYS3+QaP4b3wvkMBTc+50sqDJ4bTfHlcELfW8KWdl5DEDauXj VkbuUjuSySS2mvh8J+kDScAcaaDZbk5o3fDzHIaPZ7izoQgTuwy1iVO/fg+BaWa8Pz4AAbdsS7PGc EQCNlUkw==; Received: from shell.armlinux.org.uk ([fd8f:7570:feb6:1:5054:ff:fe00:4ec]:35392) 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 1oxYPD-0001vN-At; Tue, 22 Nov 2022 18:54:03 +0000 Received: from linux by shell.armlinux.org.uk with local (Exim 4.94.2) (envelope-from ) id 1oxYPA-0003X1-8T; Tue, 22 Nov 2022 18:54:00 +0000 Date: Tue, 22 Nov 2022 18:54:00 +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 v2] net: stmmac: Set MAC's flow control register to reflect current settings Message-ID: References: <20221122063935.6741-1-wei.sheng.goh@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Sender: Russell King (Oracle) Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org On Tue, Nov 22, 2022 at 06:40:33PM +0000, Russell King (Oracle) wrote: > On Tue, Nov 22, 2022 at 02:39:35PM +0800, Goh, Wei Sheng wrote: > > 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,9 @@ 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"); > > + flow &= ~GMAC_RX_FLOW_CTRL_RFE; > > } > > writel(flow, ioaddr + GMAC_RX_FLOW_CTRL); > > This doesn't look correct to me. The function starts off: > > unsigned int flow = 0; > > flow is not written to before the context above. So, the code you've > added effectively does: > > flow = 0 & ~GMAC_RX_FLOW_CTRL_RFE; > > which is still zero. So, I don't think this hunk is meaningful apart > from adding the pr_debug(). It also should be noted that it looks like: dwxgmac2_core.c::dwxgmac2_flow_ctrl() is definitely buggy - it will only set flow control, never clearing it. dwmac100_core.c::dwmac100_flow_ctrl() looks potentially buggy - always enabling flow control irrespective of anything. The other two implmentations look sane to me. -- RMK's Patch system: https://www.armlinux.org.uk/developer/patches/ FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!