Skip to content

Commit 943c14e

Browse files
dangowrtSasha Levin
authored and
Sasha Levin
committed
net: ethernet: mtk_eth_soc: fix PPE hanging issue
[ Upstream commit ea80e3e ] 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 <[email protected]> Signed-off-by: Daniel Golle <[email protected]> Signed-off-by: David S. Miller <[email protected]> Signed-off-by: Sasha Levin <[email protected]>
1 parent 1f32abb commit 943c14e

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

drivers/net/ethernet/mediatek/mtk_ppe.c

+11-7
Original file line numberDiff line numberDiff line change
@@ -992,7 +992,7 @@ void mtk_ppe_start(struct mtk_ppe *ppe)
992992
MTK_PPE_KEEPALIVE_DISABLE) |
993993
FIELD_PREP(MTK_PPE_TB_CFG_HASH_MODE, 1) |
994994
FIELD_PREP(MTK_PPE_TB_CFG_SCAN_MODE,
995-
MTK_PPE_SCAN_MODE_KEEPALIVE_AGE) |
995+
MTK_PPE_SCAN_MODE_CHECK_AGE) |
996996
FIELD_PREP(MTK_PPE_TB_CFG_ENTRY_NUM,
997997
MTK_PPE_ENTRIES_SHIFT);
998998
if (mtk_is_netsys_v2_or_greater(ppe->eth))
@@ -1088,17 +1088,21 @@ int mtk_ppe_stop(struct mtk_ppe *ppe)
10881088

10891089
mtk_ppe_cache_enable(ppe, false);
10901090

1091-
/* disable offload engine */
1092-
ppe_clear(ppe, MTK_PPE_GLO_CFG, MTK_PPE_GLO_CFG_EN);
1093-
ppe_w32(ppe, MTK_PPE_FLOW_CFG, 0);
1094-
10951091
/* disable aging */
10961092
val = MTK_PPE_TB_CFG_AGE_NON_L4 |
10971093
MTK_PPE_TB_CFG_AGE_UNBIND |
10981094
MTK_PPE_TB_CFG_AGE_TCP |
10991095
MTK_PPE_TB_CFG_AGE_UDP |
1100-
MTK_PPE_TB_CFG_AGE_TCP_FIN;
1096+
MTK_PPE_TB_CFG_AGE_TCP_FIN |
1097+
MTK_PPE_TB_CFG_SCAN_MODE;
11011098
ppe_clear(ppe, MTK_PPE_TB_CFG, val);
11021099

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

0 commit comments

Comments
 (0)