c9823daa1d2eb4e34e7ee5a013309d6eedb39779
[openwrt/staging/pepe2k.git] /
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
4 MT7622 and newer
5
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.
9
10 Signed-off-by: Felix Fietkau <nbd@nbd.name>
11 ---
12
13 --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c
14 +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
15 @@ -4478,7 +4478,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,
21 .hash_offset = 2,
22 .foe_entry_size = sizeof(struct mtk_foe_entry) - 16,
23 .txrx = {
24 @@ -4517,7 +4517,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,
30 .hash_offset = 2,
31 .foe_entry_size = sizeof(struct mtk_foe_entry) - 16,
32 .txrx = {
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);
38 } else {
39 + int port_mg = eth->soc->offload_version > 1 ? 0 : 0x3f;
40 +
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
45 entry->ib1 = val;
46
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);
51 }
52