Skip to content

Commit 193250a

Browse files
dangowrtkuba-moo
authored andcommitted
net: ethernet: mtk_eth_soc: fix RX data corruption issue
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: 42c0384 ("net-next: mediatek: add support for MediaTek MT7622 SoC") Tested-by: Bjørn Mork <[email protected]> Signed-off-by: Daniel Golle <[email protected]> Reviewed-by: Vladimir Oltean <[email protected]> Reviewed-by: Florian Fainelli <[email protected]> Link: https://lore.kernel.org/r/138da2735f92c8b6f8578ec2e5a794ee515b665f.1677937317.git.daniel@makrotopia.org Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 58aac3a commit 193250a

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

drivers/net/ethernet/mediatek/mtk_eth_soc.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -616,7 +616,8 @@ static int mtk_mac_finish(struct phylink_config *config, unsigned int mode,
616616
mcr_cur = mtk_r32(mac->hw, MTK_MAC_MCR(mac->id));
617617
mcr_new = mcr_cur;
618618
mcr_new |= MAC_MCR_IPG_CFG | MAC_MCR_FORCE_MODE |
619-
MAC_MCR_BACKOFF_EN | MAC_MCR_BACKPR_EN | MAC_MCR_FORCE_LINK;
619+
MAC_MCR_BACKOFF_EN | MAC_MCR_BACKPR_EN | MAC_MCR_FORCE_LINK |
620+
MAC_MCR_RX_FIFO_CLR_DIS;
620621

621622
/* Only update control register when needed! */
622623
if (mcr_new != mcr_cur)

drivers/net/ethernet/mediatek/mtk_eth_soc.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -397,6 +397,7 @@
397397
#define MAC_MCR_FORCE_MODE BIT(15)
398398
#define MAC_MCR_TX_EN BIT(14)
399399
#define MAC_MCR_RX_EN BIT(13)
400+
#define MAC_MCR_RX_FIFO_CLR_DIS BIT(12)
400401
#define MAC_MCR_BACKOFF_EN BIT(9)
401402
#define MAC_MCR_BACKPR_EN BIT(8)
402403
#define MAC_MCR_FORCE_RX_FC BIT(5)

0 commit comments

Comments
 (0)