1 From: Felix Fietkau <nbd@nbd.name>
2 Date: Fri, 4 Nov 2022 19:49:08 +0100
3 Subject: [PATCH] net: ethernet: mtk_eth_soc: avoid port_mg assignment on
6 On newer chips, this field is unused and contains some bits related to queue
7 assignment. Initialize it to 0 in those cases.
8 Fix offload_version on MT7621 and MT7623, which still need the previous value.
10 Signed-off-by: Felix Fietkau <nbd@nbd.name>
13 --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c
14 +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
15 @@ -4484,7 +4484,7 @@ static const struct mtk_soc_data mt7621_
16 .hw_features = MTK_HW_FEATURES,
17 .required_clks = MT7621_CLKS_BITMAP,
18 .required_pctl = false,
19 - .offload_version = 2,
20 + .offload_version = 1,
22 .foe_entry_size = sizeof(struct mtk_foe_entry) - 16,
24 @@ -4523,7 +4523,7 @@ static const struct mtk_soc_data mt7623_
25 .hw_features = MTK_HW_FEATURES,
26 .required_clks = MT7623_CLKS_BITMAP,
27 .required_pctl = true,
28 - .offload_version = 2,
29 + .offload_version = 1,
31 .foe_entry_size = sizeof(struct mtk_foe_entry) - 16,
33 --- a/drivers/net/ethernet/mediatek/mtk_ppe.c
34 +++ b/drivers/net/ethernet/mediatek/mtk_ppe.c
35 @@ -175,6 +175,8 @@ int mtk_foe_entry_prepare(struct mtk_eth
36 val = FIELD_PREP(MTK_FOE_IB2_DEST_PORT_V2, pse_port) |
37 FIELD_PREP(MTK_FOE_IB2_PORT_AG_V2, 0xf);
39 + int port_mg = eth->soc->offload_version > 1 ? 0 : 0x3f;
41 val = FIELD_PREP(MTK_FOE_IB1_STATE, MTK_FOE_STATE_BIND) |
42 FIELD_PREP(MTK_FOE_IB1_PACKET_TYPE, type) |
43 FIELD_PREP(MTK_FOE_IB1_UDP, l4proto == IPPROTO_UDP) |
44 @@ -182,7 +184,7 @@ int mtk_foe_entry_prepare(struct mtk_eth
47 val = FIELD_PREP(MTK_FOE_IB2_DEST_PORT, pse_port) |
48 - FIELD_PREP(MTK_FOE_IB2_PORT_MG, 0x3f) |
49 + FIELD_PREP(MTK_FOE_IB2_PORT_MG, port_mg) |
50 FIELD_PREP(MTK_FOE_IB2_PORT_AG, 0x1f);