]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
net: ethernet: mtk_eth_soc: avoid port_mg assignment on MT7622 and newer
authorFelix Fietkau <nbd@nbd.name>
Wed, 16 Nov 2022 08:07:31 +0000 (09:07 +0100)
committerJakub Kicinski <kuba@kernel.org>
Sat, 19 Nov 2022 03:46:06 +0000 (19:46 -0800)
On newer chips, this field is unused and contains some bits related to queue
assignment. Initialize it to 0 in those cases.
Fix offload_version on MT7621 and MT7623, which still need the previous value.

Signed-off-by: Felix Fietkau <nbd@nbd.name>
Link: https://lore.kernel.org/r/20221116080734.44013-4-nbd@nbd.name
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/mediatek/mtk_eth_soc.c
drivers/net/ethernet/mediatek/mtk_ppe.c

index db017ebdb9679f249d28ce6bcafac6d41be6ea76..0595d27441176fc1a3cce05a5f7c48a8ae9cc066 100644 (file)
@@ -4324,7 +4324,7 @@ static const struct mtk_soc_data mt7621_data = {
        .hw_features = MTK_HW_FEATURES,
        .required_clks = MT7621_CLKS_BITMAP,
        .required_pctl = false,
-       .offload_version = 2,
+       .offload_version = 1,
        .hash_offset = 2,
        .foe_entry_size = sizeof(struct mtk_foe_entry) - 16,
        .txrx = {
@@ -4363,7 +4363,7 @@ static const struct mtk_soc_data mt7623_data = {
        .hw_features = MTK_HW_FEATURES,
        .required_clks = MT7623_CLKS_BITMAP,
        .required_pctl = true,
-       .offload_version = 2,
+       .offload_version = 1,
        .hash_offset = 2,
        .foe_entry_size = sizeof(struct mtk_foe_entry) - 16,
        .txrx = {
index 2d8ca99f2467ff9f859b3e2294a024d19d840820..3ee2bf53f9e58f3d8e0549ce339effb322ce576e 100644 (file)
@@ -175,6 +175,8 @@ int mtk_foe_entry_prepare(struct mtk_eth *eth, struct mtk_foe_entry *entry,
                val = FIELD_PREP(MTK_FOE_IB2_DEST_PORT_V2, pse_port) |
                      FIELD_PREP(MTK_FOE_IB2_PORT_AG_V2, 0xf);
        } else {
+               int port_mg = eth->soc->offload_version > 1 ? 0 : 0x3f;
+
                val = FIELD_PREP(MTK_FOE_IB1_STATE, MTK_FOE_STATE_BIND) |
                      FIELD_PREP(MTK_FOE_IB1_PACKET_TYPE, type) |
                      FIELD_PREP(MTK_FOE_IB1_UDP, l4proto == IPPROTO_UDP) |
@@ -182,7 +184,7 @@ int mtk_foe_entry_prepare(struct mtk_eth *eth, struct mtk_foe_entry *entry,
                entry->ib1 = val;
 
                val = FIELD_PREP(MTK_FOE_IB2_DEST_PORT, pse_port) |
-                     FIELD_PREP(MTK_FOE_IB2_PORT_MG, 0x3f) |
+                     FIELD_PREP(MTK_FOE_IB2_PORT_MG, port_mg) |
                      FIELD_PREP(MTK_FOE_IB2_PORT_AG, 0x1f);
        }