Skip to content

Commit ea80e3e

Browse files
dangowrtdavem330
authored andcommitted
net: ethernet: mtk_eth_soc: fix PPE hanging issue
A patch to resolve an issue was found in MediaTek's GPL-licensed SDK: In the mtk_ppe_stop() function, the PPE scan mode is not disabled before disabling the PPE. This can potentially lead to a hang during the process of disabling the PPE. Without this patch, the PPE may experience a hang during the reboot test. Link: https://git01.mediatek.com/plugins/gitiles/openwrt/feeds/mtk-openwrt-feeds/+/b40da332dfe763932a82f9f62a4709457a15dd6c Fixes: ba37b7c ("net: ethernet: mtk_eth_soc: add support for initializing the PPE") Suggested-by: Bc-bocun Chen <bc-bocun.chen@mediatek.com> Signed-off-by: Daniel Golle <daniel@makrotopia.org> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent f1b85ef commit ea80e3e

1 file changed

Lines changed: 11 additions & 7 deletions

File tree

drivers/net/ethernet/mediatek/mtk_ppe.c

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -994,7 +994,7 @@ void mtk_ppe_start(struct mtk_ppe *ppe)
994994
MTK_PPE_KEEPALIVE_DISABLE) |
995995
FIELD_PREP(MTK_PPE_TB_CFG_HASH_MODE, 1) |
996996
FIELD_PREP(MTK_PPE_TB_CFG_SCAN_MODE,
997-
MTK_PPE_SCAN_MODE_KEEPALIVE_AGE) |
997+
MTK_PPE_SCAN_MODE_CHECK_AGE) |
998998
FIELD_PREP(MTK_PPE_TB_CFG_ENTRY_NUM,
999999
MTK_PPE_ENTRIES_SHIFT);
10001000
if (mtk_is_netsys_v2_or_greater(ppe->eth))
@@ -1090,17 +1090,21 @@ int mtk_ppe_stop(struct mtk_ppe *ppe)
10901090

10911091
mtk_ppe_cache_enable(ppe, false);
10921092

1093-
/* disable offload engine */
1094-
ppe_clear(ppe, MTK_PPE_GLO_CFG, MTK_PPE_GLO_CFG_EN);
1095-
ppe_w32(ppe, MTK_PPE_FLOW_CFG, 0);
1096-
10971093
/* disable aging */
10981094
val = MTK_PPE_TB_CFG_AGE_NON_L4 |
10991095
MTK_PPE_TB_CFG_AGE_UNBIND |
11001096
MTK_PPE_TB_CFG_AGE_TCP |
11011097
MTK_PPE_TB_CFG_AGE_UDP |
1102-
MTK_PPE_TB_CFG_AGE_TCP_FIN;
1098+
MTK_PPE_TB_CFG_AGE_TCP_FIN |
1099+
MTK_PPE_TB_CFG_SCAN_MODE;
11031100
ppe_clear(ppe, MTK_PPE_TB_CFG, val);
11041101

1105-
return mtk_ppe_wait_busy(ppe);
1102+
if (mtk_ppe_wait_busy(ppe))
1103+
return -ETIMEDOUT;
1104+
1105+
/* disable offload engine */
1106+
ppe_clear(ppe, MTK_PPE_GLO_CFG, MTK_PPE_GLO_CFG_EN);
1107+
ppe_w32(ppe, MTK_PPE_FLOW_CFG, 0);
1108+
1109+
return 0;
11061110
}

0 commit comments

Comments
 (0)