Message ID | 9a788bb6984c836e63a7ecbdadff11a723769c37.1677699407.git.daniel@makrotopia.org |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp3837432wrd; Wed, 1 Mar 2023 11:59:32 -0800 (PST) X-Google-Smtp-Source: AK7set8l4OZBGirwjCxInNY3aYDkDDQrXlyuUz2Xuw3a1zEc9f8tckrFaLgylk15y48VYMBk7AFY X-Received: by 2002:a17:906:5601:b0:888:b764:54e5 with SMTP id f1-20020a170906560100b00888b76454e5mr7024908ejq.71.1677700772017; Wed, 01 Mar 2023 11:59:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1677700772; cv=none; d=google.com; s=arc-20160816; b=sLOC5ZX0B7Kb1MaFmkqj7iwRCIXgJo3qzNHZ/a7OiAzrQiYFrYOtHfZcAmub7oLMW4 qgc+Tgb9U5fHTywt56vNoLt1JYb/B/NQArjLGDrlIZIlPhHm4W8gWu/e9FUNYKFQcdHH 0FFKJBeIchsmzl/kFPgQqeMlLoJdyt7L85kwBpSpRlJ7bQWSXq9XNp4DHThOimdcPhsK q5dxCgpnlMGc2bWpzu/mRubt/IttzuVjp/PHJlsSP/aZDMVB+pUNRULDW4sFnzRKUbyQ f/X/D60yYrvtbSHFQhj8uQQ/hMjmMXvN1jK/y6/1aemX2NfKmfLjIjYgjeCNaEKhmemb BhFw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=xWlhkkROj8vERphsF7a+jhL2mecP1JhwwrKz2E+NPBo=; b=tJZWlISACP12doPXhz3/bbdPvv3b0P7KEh3P1H3GZsvzzVlT+fYWSpPNru4cInHNiP LywXVtp548y6fbnoKSw8BkJneWXDNAmC7WMr/Jn8YrAYa10TBTsZkGEWQ08q3rciOBOx W+GsfBOI/pxjDFzjSgvchCz3wA4532EN22DtpeV9X1XlPwvPbg9uYUS2utiV+rVtOXQi Z0iQ2lr5klNqxp2BCCD1G683pXq3sinVzPd8nJX+tok76MdAlLPlCQvf09hXNzNv0HG1 QJIbJoxDhXqp1psCW5lzGF8eGqLbETkRgDvAuj5G510fM/vyGWHJMqJkVzSTKIV5HhNk p+sw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id o22-20020a1709061b1600b008b2a99b17fbsi2693826ejg.205.2023.03.01.11.59.08; Wed, 01 Mar 2023 11:59:31 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229463AbjCATzo (ORCPT <rfc822;david.simonyants@gmail.com> + 99 others); Wed, 1 Mar 2023 14:55:44 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59040 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229851AbjCATzd (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Wed, 1 Mar 2023 14:55:33 -0500 Received: from fudo.makrotopia.org (fudo.makrotopia.org [IPv6:2a07:2ec0:3002::71]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9575E4DE31; Wed, 1 Mar 2023 11:55:11 -0800 (PST) Received: from local by fudo.makrotopia.org with esmtpsa (TLS1.3:TLS_AES_256_GCM_SHA384:256) (Exim 4.96) (envelope-from <daniel@makrotopia.org>) id 1pXSXd-0007Kk-34; Wed, 01 Mar 2023 20:55:10 +0100 Date: Wed, 1 Mar 2023 19:55:05 +0000 From: Daniel Golle <daniel@makrotopia.org> To: devicetree@vger.kernel.org, Rob Herring <robh+dt@kernel.org>, Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>, netdev@vger.kernel.org, linux-mediatek@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Russell King <linux@armlinux.org.uk>, Heiner Kallweit <hkallweit1@gmail.com>, Lorenzo Bianconi <lorenzo@kernel.org>, Mark Lee <Mark-MC.Lee@mediatek.com>, John Crispin <john@phrozen.org>, Felix Fietkau <nbd@nbd.name>, AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>, Matthias Brugger <matthias.bgg@gmail.com>, DENG Qingfang <dqfext@gmail.com>, Landen Chao <Landen.Chao@mediatek.com>, Sean Wang <sean.wang@mediatek.com>, Paolo Abeni <pabeni@redhat.com>, Jakub Kicinski <kuba@kernel.org>, Eric Dumazet <edumazet@google.com>, "David S. Miller" <davem@davemloft.net>, Vladimir Oltean <olteanv@gmail.com>, Florian Fainelli <f.fainelli@gmail.com>, Andrew Lunn <andrew@lunn.ch> Cc: Jianhui Zhao <zhaojh329@gmail.com>, =?iso-8859-1?q?Bj=F8rn?= Mork <bjorn@mork.no> Subject: [RFC PATCH v11 08/12] net: ethernet: mtk_eth_soc: fix RX data corruption issue Message-ID: <9a788bb6984c836e63a7ecbdadff11a723769c37.1677699407.git.daniel@makrotopia.org> References: <cover.1677699407.git.daniel@makrotopia.org> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <cover.1677699407.git.daniel@makrotopia.org> X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1759196764605712965?= X-GMAIL-MSGID: =?utf-8?q?1759196764605712965?= |
Series |
net: ethernet: mtk_eth_soc: various enhancements
|
|
Commit Message
Daniel Golle
March 1, 2023, 7:55 p.m. UTC
Also set bit 12 which disabled the RX FIDO clear function when setting up MAC MCR, as MediaTek SDK did the same change stating: "If without this patch, kernel might receive invalid packets that are corrupted by GMAC."[1] This fixes issues with <= 1G speed where we could previously observe about 30% packet loss while the bad packet counter was increasing. [1]: https://git01.mediatek.com/plugins/gitiles/openwrt/feeds/mtk-openwrt-feeds/+/d8a2975939a12686c4a95c40db21efdc3f821f63 Tested-by: Bjørn Mork <bjorn@mork.no> Signed-off-by: Daniel Golle <daniel@makrotopia.org> --- drivers/net/ethernet/mediatek/mtk_eth_soc.c | 3 ++- drivers/net/ethernet/mediatek/mtk_eth_soc.h | 1 + 2 files changed, 3 insertions(+), 1 deletion(-)
Comments
On Wed, Mar 01, 2023 at 07:55:05PM +0000, Daniel Golle wrote: > Also set bit 12 which disabled the RX FIDO clear function when setting up > MAC MCR, as MediaTek SDK did the same change stating: > "If without this patch, kernel might receive invalid packets that are > corrupted by GMAC."[1] > This fixes issues with <= 1G speed where we could previously observe > about 30% packet loss while the bad packet counter was increasing. > > [1]: https://git01.mediatek.com/plugins/gitiles/openwrt/feeds/mtk-openwrt-feeds/+/d8a2975939a12686c4a95c40db21efdc3f821f63 > Tested-by: Bjørn Mork <bjorn@mork.no> > Signed-off-by: Daniel Golle <daniel@makrotopia.org> > --- Should this patch be submitted separately from the series, to the net.git tree, to be backported to stable kernels?
On Thu, Mar 02, 2023 at 01:31:21AM +0200, Vladimir Oltean wrote: > On Wed, Mar 01, 2023 at 07:55:05PM +0000, Daniel Golle wrote: > > Also set bit 12 which disabled the RX FIDO clear function when setting up > > MAC MCR, as MediaTek SDK did the same change stating: > > "If without this patch, kernel might receive invalid packets that are > > corrupted by GMAC."[1] > > This fixes issues with <= 1G speed where we could previously observe > > about 30% packet loss while the bad packet counter was increasing. > > > > [1]: https://git01.mediatek.com/plugins/gitiles/openwrt/feeds/mtk-openwrt-feeds/+/d8a2975939a12686c4a95c40db21efdc3f821f63 > > Tested-by: Bjørn Mork <bjorn@mork.no> > > Signed-off-by: Daniel Golle <daniel@makrotopia.org> > > --- > > Should this patch be submitted separately from the series, to the > net.git tree, to be backported to stable kernels? Maybe yes, as this issue may affect e.g. the BPi-R3 board when used with 1G SFP modules. Previously this has just never been a problem as all practically all boards with MediaTek SoCs using SGMII also use the MediaTek MT7531 switch connecting in 2500Base-X mode. Should the Fixes:-tag hence reference the commit adding support for the BPi-R3?
On Thu, Mar 02, 2023 at 12:03:45AM +0000, Daniel Golle wrote: > On Thu, Mar 02, 2023 at 01:31:21AM +0200, Vladimir Oltean wrote: > > On Wed, Mar 01, 2023 at 07:55:05PM +0000, Daniel Golle wrote: > > > Also set bit 12 which disabled the RX FIDO clear function when setting up > > > MAC MCR, as MediaTek SDK did the same change stating: > > > "If without this patch, kernel might receive invalid packets that are > > > corrupted by GMAC."[1] > > > This fixes issues with <= 1G speed where we could previously observe > > > about 30% packet loss while the bad packet counter was increasing. > > > > > > [1]: https://git01.mediatek.com/plugins/gitiles/openwrt/feeds/mtk-openwrt-feeds/+/d8a2975939a12686c4a95c40db21efdc3f821f63 > > > Tested-by: Bjørn Mork <bjorn@mork.no> > > > Signed-off-by: Daniel Golle <daniel@makrotopia.org> > > > --- > > > > Should this patch be submitted separately from the series, to the > > net.git tree, to be backported to stable kernels? > > Maybe yes, as this issue may affect e.g. the BPi-R3 board when used > with 1G SFP modules. Previously this has just never been a problem as > all practically all boards with MediaTek SoCs using SGMII also use the > MediaTek MT7531 switch connecting in 2500Base-X mode. > > Should the Fixes:-tag hence reference the commit adding support for the > BPi-R3? If it's not an issue that affects existing setups, there is no need to backport the patch. But it needs to be clearly described as such in the commit message. You mention <= 1G speeds, but then only talk about 1G SFP modules. I see that the mtk_eth_soc driver also sets "gmii" and "rgmii" in phylink's supported_interfaces. Those are also <= 1G speeds. There could also be SGMII on-board PHYs. Does the RX FIFO clearing issue not affect those?
On Thu, Mar 02, 2023 at 12:00:22PM +0200, Vladimir Oltean wrote: > On Thu, Mar 02, 2023 at 12:03:45AM +0000, Daniel Golle wrote: > > On Thu, Mar 02, 2023 at 01:31:21AM +0200, Vladimir Oltean wrote: > > > On Wed, Mar 01, 2023 at 07:55:05PM +0000, Daniel Golle wrote: > > > > Also set bit 12 which disabled the RX FIDO clear function when setting up > > > > MAC MCR, as MediaTek SDK did the same change stating: > > > > "If without this patch, kernel might receive invalid packets that are > > > > corrupted by GMAC."[1] > > > > This fixes issues with <= 1G speed where we could previously observe > > > > about 30% packet loss while the bad packet counter was increasing. > > > > > > > > [1]: https://git01.mediatek.com/plugins/gitiles/openwrt/feeds/mtk-openwrt-feeds/+/d8a2975939a12686c4a95c40db21efdc3f821f63 > > > > Tested-by: Bjørn Mork <bjorn@mork.no> > > > > Signed-off-by: Daniel Golle <daniel@makrotopia.org> > > > > --- > > > > > > Should this patch be submitted separately from the series, to the > > > net.git tree, to be backported to stable kernels? > > > > Maybe yes, as this issue may affect e.g. the BPi-R3 board when used > > with 1G SFP modules. Previously this has just never been a problem as > > all practically all boards with MediaTek SoCs using SGMII also use the > > MediaTek MT7531 switch connecting in 2500Base-X mode. > > > > Should the Fixes:-tag hence reference the commit adding support for the > > BPi-R3? > > If it's not an issue that affects existing setups, there is no need to > backport the patch. But it needs to be clearly described as such in the > commit message. > > You mention <= 1G speeds, but then only talk about 1G SFP modules. > I see that the mtk_eth_soc driver also sets "gmii" and "rgmii" in > phylink's supported_interfaces. Those are also <= 1G speeds. There could > also be SGMII on-board PHYs. Does the RX FIFO clearing issue not affect > those? The issues affects PHYs (and potentially switch PHY ICs) connected via SGMII operating at 1.25Mbaud. The only officially supported board affected by this is the BPi-R3 where it affects the SFP cages -- the on-board MT7531 switch which is also used on all other boards using these SoCs is connected with 2500Base-X. The issue does **not** affect RGMII or GMII on the MT7623 SoC, but I don't have any way to try RGMII or GMII on more recent SoCs as I lack hardware making use of that to connect a PHY.
On Thu, Mar 02, 2023 at 11:56:56AM +0000, Daniel Golle wrote: > The issues affects PHYs (and potentially switch PHY ICs) connected via > SGMII operating at 1.25Mbaud. > > The only officially supported board affected by this is the BPi-R3 where > it affects the SFP cages -- the on-board MT7531 switch which is also > used on all other boards using these SoCs is connected with 2500Base-X. > > The issue does **not** affect RGMII or GMII on the MT7623 SoC, but I > don't have any way to try RGMII or GMII on more recent SoCs as I lack > hardware making use of that to connect a PHY. I don't believe that board vendors need to have their device tree "officially supported" in Linux in order to claim that a bug affecting them should be fixed on stable kernels. As long as the PHY interface type is generally supported by the driver and is expected to work, it should work with any board (the exception being if there are other configuration steps specific to that board required). In any case, a good commit message for a bug fix explains what is the user impact of the bug being fixed, the configurations which are affected, how it was noticed, an adequate Fixes: tag, and if necessary, why it is being fixed the way it is. In other words, it must be able to respond to normal questions that a reader might have when he/she stumbles upon it, for various reasons (it introduces a regression, they are debugging an issue and want to assess whether backporting this patch would help them, etc). The reader might be in the not so close future, when you might not be able to provide clarifications personally, so the commit message should contain all that you know which is relevant to the topic. Most of these clarifications were provided by you as replies to the patch, but they should be present in the commit message instead.
diff --git a/drivers/net/ethernet/mediatek/mtk_eth_soc.c b/drivers/net/ethernet/mediatek/mtk_eth_soc.c index 030d87c42bd42..ed32a511adc30 100644 --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c @@ -616,7 +616,8 @@ static int mtk_mac_finish(struct phylink_config *config, unsigned int mode, mcr_cur = mtk_r32(mac->hw, MTK_MAC_MCR(mac->id)); mcr_new = mcr_cur; mcr_new |= MAC_MCR_IPG_CFG | MAC_MCR_FORCE_MODE | - MAC_MCR_BACKOFF_EN | MAC_MCR_BACKPR_EN | MAC_MCR_FORCE_LINK; + MAC_MCR_BACKOFF_EN | MAC_MCR_BACKPR_EN | MAC_MCR_FORCE_LINK | + MAC_MCR_RX_FIFO_CLR_DIS; /* Only update control register when needed! */ if (mcr_new != mcr_cur) diff --git a/drivers/net/ethernet/mediatek/mtk_eth_soc.h b/drivers/net/ethernet/mediatek/mtk_eth_soc.h index 142def8629c82..529c95c481b73 100644 --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.h +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.h @@ -404,6 +404,7 @@ #define MAC_MCR_FORCE_MODE BIT(15) #define MAC_MCR_TX_EN BIT(14) #define MAC_MCR_RX_EN BIT(13) +#define MAC_MCR_RX_FIFO_CLR_DIS BIT(12) #define MAC_MCR_BACKOFF_EN BIT(9) #define MAC_MCR_BACKPR_EN BIT(8) #define MAC_MCR_FORCE_RX_FC BIT(5)