linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net] net: ethernet: mtk_eth_soc: fix RX data corruption issue
@ 2023-03-04 13:43 Daniel Golle
  2023-03-06 12:15 ` Vladimir Oltean
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Daniel Golle @ 2023-03-04 13:43 UTC (permalink / raw)
  To: netdev, linux-mediatek, linux-arm-kernel, linux-kernel,
	Russell King, Heiner Kallweit, Lorenzo Bianconi, Mark Lee,
	John Crispin, Felix Fietkau, AngeloGioacchino Del Regno,
	Matthias Brugger, DENG Qingfang, Landen Chao, Sean Wang,
	Paolo Abeni, Jakub Kicinski, Eric Dumazet, David S. Miller,
	Vladimir Oltean, Florian Fainelli, Andrew Lunn, Vladimir Oltean
  Cc: Bjørn Mork

Fix data corruption issue with SerDes connected PHYs operating at 1.25
Gbps speed where we could previously observe about 30% packet loss while
the bad packet counter was increasing.

As almost all boards with MediaTek MT7622 or MT7986 use either the MT7531
switch IC operating at 3.125Gbps SerDes rate or single-port PHYs using
rate-adaptation to 2500Base-X mode, this issue only got exposed now when
we started trying to use SFP modules operating with 1.25 Gbps with the
BananaPi R3 board.

The fix is to set bit 12 which disables the RX FIFO clear function when
setting up MAC MCR, MediaTek SDK did the same change stating:
"If without this patch, kernel might receive invalid packets that are
corrupted by GMAC."[1]

[1]: https://git01.mediatek.com/plugins/gitiles/openwrt/feeds/mtk-openwrt-feeds/+/d8a2975939a12686c4a95c40db21efdc3f821f63

Fixes: 42c03844e93d ("net-next: mediatek: add support for MediaTek MT7622 SoC")
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(-)

diff --git a/drivers/net/ethernet/mediatek/mtk_eth_soc.c b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
index 14be6ea51b88..3cb43623d3db 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 afc9d52e79bf..b65de174c3d9 100644
--- a/drivers/net/ethernet/mediatek/mtk_eth_soc.h
+++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.h
@@ -397,6 +397,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)

base-commit: 528125268588a18a2f257002af051b62b14bb282
-- 
2.39.2


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH net] net: ethernet: mtk_eth_soc: fix RX data corruption issue
  2023-03-04 13:43 [PATCH net] net: ethernet: mtk_eth_soc: fix RX data corruption issue Daniel Golle
@ 2023-03-06 12:15 ` Vladimir Oltean
  2023-03-06 17:31 ` Florian Fainelli
  2023-03-06 22:00 ` patchwork-bot+netdevbpf
  2 siblings, 0 replies; 4+ messages in thread
From: Vladimir Oltean @ 2023-03-06 12:15 UTC (permalink / raw)
  To: Daniel Golle
  Cc: netdev, linux-mediatek, linux-arm-kernel, linux-kernel,
	Russell King, Heiner Kallweit, Lorenzo Bianconi, Mark Lee,
	John Crispin, Felix Fietkau, AngeloGioacchino Del Regno,
	Matthias Brugger, DENG Qingfang, Landen Chao, Sean Wang,
	Paolo Abeni, Jakub Kicinski, Eric Dumazet, David S. Miller,
	Florian Fainelli, Andrew Lunn, Vladimir Oltean, Bjørn Mork,
	arinc9.unal, frank-w

On Sat, Mar 04, 2023 at 01:43:20PM +0000, Daniel Golle wrote:
> Fix data corruption issue with SerDes connected PHYs operating at 1.25
> Gbps speed where we could previously observe about 30% packet loss while
> the bad packet counter was increasing.
> 
> As almost all boards with MediaTek MT7622 or MT7986 use either the MT7531
> switch IC operating at 3.125Gbps SerDes rate or single-port PHYs using
> rate-adaptation to 2500Base-X mode, this issue only got exposed now when
> we started trying to use SFP modules operating with 1.25 Gbps with the
> BananaPi R3 board.
> 
> The fix is to set bit 12 which disables the RX FIFO clear function when
> setting up MAC MCR, MediaTek SDK did the same change stating:
> "If without this patch, kernel might receive invalid packets that are
> corrupted by GMAC."[1]
> 
> [1]: https://git01.mediatek.com/plugins/gitiles/openwrt/feeds/mtk-openwrt-feeds/+/d8a2975939a12686c4a95c40db21efdc3f821f63
> 
> Fixes: 42c03844e93d ("net-next: mediatek: add support for MediaTek MT7622 SoC")
> Tested-by: Bjørn Mork <bjorn@mork.no>
> Signed-off-by: Daniel Golle <daniel@makrotopia.org>
> ---

I don't see something particularly controversial with this change.

Reviewed-by: Vladimir Oltean <olteanv@gmail.com>

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH net] net: ethernet: mtk_eth_soc: fix RX data corruption issue
  2023-03-04 13:43 [PATCH net] net: ethernet: mtk_eth_soc: fix RX data corruption issue Daniel Golle
  2023-03-06 12:15 ` Vladimir Oltean
@ 2023-03-06 17:31 ` Florian Fainelli
  2023-03-06 22:00 ` patchwork-bot+netdevbpf
  2 siblings, 0 replies; 4+ messages in thread
From: Florian Fainelli @ 2023-03-06 17:31 UTC (permalink / raw)
  To: Daniel Golle, netdev, linux-mediatek, linux-arm-kernel,
	linux-kernel, Russell King, Heiner Kallweit, Lorenzo Bianconi,
	Mark Lee, John Crispin, Felix Fietkau, AngeloGioacchino Del Regno,
	Matthias Brugger, DENG Qingfang, Landen Chao, Sean Wang,
	Paolo Abeni, Jakub Kicinski, Eric Dumazet, David S. Miller,
	Vladimir Oltean, Andrew Lunn, Vladimir Oltean
  Cc: Bjørn Mork

On 3/4/23 05:43, Daniel Golle wrote:
> Fix data corruption issue with SerDes connected PHYs operating at 1.25
> Gbps speed where we could previously observe about 30% packet loss while
> the bad packet counter was increasing.
> 
> As almost all boards with MediaTek MT7622 or MT7986 use either the MT7531
> switch IC operating at 3.125Gbps SerDes rate or single-port PHYs using
> rate-adaptation to 2500Base-X mode, this issue only got exposed now when
> we started trying to use SFP modules operating with 1.25 Gbps with the
> BananaPi R3 board.
> 
> The fix is to set bit 12 which disables the RX FIFO clear function when
> setting up MAC MCR, MediaTek SDK did the same change stating:
> "If without this patch, kernel might receive invalid packets that are
> corrupted by GMAC."[1]
> 
> [1]: https://git01.mediatek.com/plugins/gitiles/openwrt/feeds/mtk-openwrt-feeds/+/d8a2975939a12686c4a95c40db21efdc3f821f63
> 
> Fixes: 42c03844e93d ("net-next: mediatek: add support for MediaTek MT7622 SoC")
> Tested-by: Bjørn Mork <bjorn@mork.no>
> Signed-off-by: Daniel Golle <daniel@makrotopia.org>

Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
-- 
Florian


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH net] net: ethernet: mtk_eth_soc: fix RX data corruption issue
  2023-03-04 13:43 [PATCH net] net: ethernet: mtk_eth_soc: fix RX data corruption issue Daniel Golle
  2023-03-06 12:15 ` Vladimir Oltean
  2023-03-06 17:31 ` Florian Fainelli
@ 2023-03-06 22:00 ` patchwork-bot+netdevbpf
  2 siblings, 0 replies; 4+ messages in thread
From: patchwork-bot+netdevbpf @ 2023-03-06 22:00 UTC (permalink / raw)
  To: Daniel Golle
  Cc: netdev, linux-mediatek, linux-arm-kernel, linux-kernel, linux,
	hkallweit1, lorenzo, Mark-MC.Lee, john, nbd,
	angelogioacchino.delregno, matthias.bgg, dqfext, Landen.Chao,
	sean.wang, pabeni, kuba, edumazet, davem, olteanv, f.fainelli,
	andrew, vladimir.oltean, bjorn

Hello:

This patch was applied to netdev/net.git (main)
by Jakub Kicinski <kuba@kernel.org>:

On Sat, 4 Mar 2023 13:43:20 +0000 you wrote:
> Fix data corruption issue with SerDes connected PHYs operating at 1.25
> Gbps speed where we could previously observe about 30% packet loss while
> the bad packet counter was increasing.
> 
> As almost all boards with MediaTek MT7622 or MT7986 use either the MT7531
> switch IC operating at 3.125Gbps SerDes rate or single-port PHYs using
> rate-adaptation to 2500Base-X mode, this issue only got exposed now when
> we started trying to use SFP modules operating with 1.25 Gbps with the
> BananaPi R3 board.
> 
> [...]

Here is the summary with links:
  - [net] net: ethernet: mtk_eth_soc: fix RX data corruption issue
    https://git.kernel.org/netdev/net/c/193250ace270

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-03-06 22:01 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-03-04 13:43 [PATCH net] net: ethernet: mtk_eth_soc: fix RX data corruption issue Daniel Golle
2023-03-06 12:15 ` Vladimir Oltean
2023-03-06 17:31 ` Florian Fainelli
2023-03-06 22:00 ` patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).