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 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 BAA88C4332F for ; Tue, 22 Nov 2022 18:55:15 +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:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=I3nx8Ry+P+brVAFQZ5sSTc2T4VxDyo9v1Zrr6ZM+I9I=; b=obK/0LC6zRJJyA 6zI91o+RxJAQHCAhYmujRQfVGQy+3wxbsDieM54tdB5SJ1cWNC7Sz1DeUmWsQrFdN9eQmeuYFaO+l mW57p3gbGeZVYyiQZdHjtOhOGKalH/8pDSlVd8Xc0uh9prl7GEkgi5lQhvms3PdfV+MG6WkI7bvyc XYLSarj035LqiRd9BwZrhyBbFVjlc21A5D8aEwJCO9ABKMKqwOD1QQ6DtlkORZf2ct1sPVc5zxtsC pXKKrtzMPt5hGtV+g+9wVFpVI0/3w0MgFXpAfzJX4mfaVyKe++Ih8C0SZCuYag5/j2T39NADqYay5 QFi08VWfCLQHtWxi72ug==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oxYPV-00BQ6Y-QK; Tue, 22 Nov 2022 18:54:22 +0000 Received: from pandora.armlinux.org.uk ([2001:4d48:ad52:32c8:5054:ff:fe00:142]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oxYPQ-00BQ3r-8U for linux-arm-kernel@lists.infradead.org; Tue, 22 Nov 2022 18:54:17 +0000 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-Disposition: inline In-Reply-To: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221122_105416_336062_BF6542F3 X-CRM114-Status: GOOD ( 16.17 ) 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: , 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 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! _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel 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 245D6C43219 for ; Tue, 22 Nov 2022 18:54:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234551AbiKVSyR (ORCPT ); Tue, 22 Nov 2022 13:54:17 -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: linux-kernel@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!