generic: 6.6: manually refresh backport patches
[openwrt/staging/wigyori.git] / target / linux / generic / backport-6.6 / 751-04-v6.4-net-ethernet-mediatek-fix-ppe-flow-accounting-for-L2.patch
index e20f94f1d4e5c81e46b16b66156caf79662719d1..e5f0c2f54d50b2848f692a48a8483a1e0992e230 100644 (file)
@@ -14,7 +14,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
 
 --- a/drivers/net/ethernet/mediatek/mtk_ppe.c
 +++ b/drivers/net/ethernet/mediatek/mtk_ppe.c
-@@ -79,9 +79,9 @@ static int mtk_ppe_mib_wait_busy(struct
+@@ -80,9 +80,9 @@ static int mtk_ppe_mib_wait_busy(struct
        int ret;
        u32 val;
  
@@ -27,7 +27,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
  
        if (ret)
                dev_err(ppe->dev, "MIB table busy");
-@@ -89,17 +89,31 @@ static int mtk_ppe_mib_wait_busy(struct
+@@ -90,17 +90,31 @@ static int mtk_ppe_mib_wait_busy(struct
        return ret;
  }
  
@@ -61,7 +61,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
  
        cnt_r0 = readl(ppe->base + MTK_PPE_MIB_SER_R0);
        cnt_r1 = readl(ppe->base + MTK_PPE_MIB_SER_R1);
-@@ -108,19 +122,19 @@ static int mtk_mib_entry_read(struct mtk
+@@ -109,19 +123,19 @@ static int mtk_mib_entry_read(struct mtk
        if (mtk_is_netsys_v3_or_greater(ppe->eth)) {
                /* 64 bit for each counter */
                u32 cnt_r3 = readl(ppe->base + MTK_PPE_MIB_SER_R3);
@@ -76,9 +76,9 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
                u32 pkt_cnt_low = FIELD_GET(MTK_PPE_MIB_SER_R1_PKT_CNT_LOW, cnt_r1);
                u32 pkt_cnt_high = FIELD_GET(MTK_PPE_MIB_SER_R2_PKT_CNT_HIGH, cnt_r2);
 -              *bytes = ((u64)byte_cnt_high << 32) | byte_cnt_low;
--              *packets = (pkt_cnt_high << 16) | pkt_cnt_low;
+-              *packets = ((u64)pkt_cnt_high << 16) | pkt_cnt_low;
 +              acct->bytes += ((u64)byte_cnt_high << 32) | byte_cnt_low;
-+              acct->packets += (pkt_cnt_high << 16) | pkt_cnt_low;
++              acct->packets += ((u64)pkt_cnt_high << 16) | pkt_cnt_low;
        }
  
 -      return 0;
@@ -86,10 +86,11 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
  }
  
  static void mtk_ppe_cache_clear(struct mtk_ppe *ppe)
-@@ -519,13 +533,6 @@ __mtk_foe_entry_clear(struct mtk_ppe *pp
+@@ -522,14 +536,6 @@ __mtk_foe_entry_clear(struct mtk_ppe *pp
                hwe->ib1 |= FIELD_PREP(MTK_FOE_IB1_STATE, MTK_FOE_STATE_INVALID);
                dma_wmb();
                mtk_ppe_cache_clear(ppe);
+-
 -              if (ppe->accounting) {
 -                      struct mtk_foe_accounting *acct;
 -
@@ -100,7 +101,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
        }
        entry->hash = 0xffff;
  
-@@ -550,11 +557,14 @@ static int __mtk_foe_entry_idle_time(str
+@@ -554,11 +560,14 @@ static int __mtk_foe_entry_idle_time(str
  }
  
  static bool
@@ -116,7 +117,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
        int len;
  
        if (hash == 0xffff)
-@@ -565,18 +575,35 @@ mtk_flow_entry_update(struct mtk_ppe *pp
+@@ -569,18 +578,35 @@ mtk_flow_entry_update(struct mtk_ppe *pp
        memcpy(&foe, hwe, len);
  
        if (!mtk_flow_entry_match(ppe->eth, entry, &foe, len) ||
@@ -155,7 +156,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
        struct mtk_flow_entry *cur;
        struct hlist_node *tmp;
        int idle;
-@@ -585,7 +612,9 @@ mtk_flow_entry_update_l2(struct mtk_ppe
+@@ -589,7 +615,9 @@ mtk_flow_entry_update_l2(struct mtk_ppe
        hlist_for_each_entry_safe(cur, tmp, &entry->l2_flows, l2_list) {
                int cur_idle;
  
@@ -166,7 +167,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
                        __mtk_foe_entry_clear(ppe, entry, false);
                        continue;
                }
-@@ -600,10 +629,29 @@ mtk_flow_entry_update_l2(struct mtk_ppe
+@@ -604,10 +632,29 @@ mtk_flow_entry_update_l2(struct mtk_ppe
        }
  }
  
@@ -196,7 +197,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
        struct mtk_eth *eth = ppe->eth;
        u16 timestamp = mtk_eth_timestamp(eth);
        struct mtk_foe_entry *hwe;
-@@ -634,6 +682,12 @@ __mtk_foe_entry_commit(struct mtk_ppe *p
+@@ -638,6 +685,12 @@ __mtk_foe_entry_commit(struct mtk_ppe *p
  
        dma_wmb();
  
@@ -209,7 +210,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
        mtk_ppe_cache_clear(ppe);
  }
  
-@@ -796,21 +850,6 @@ out:
+@@ -802,21 +855,6 @@ void __mtk_ppe_check_skb(struct mtk_ppe
        spin_unlock_bh(&ppe_lock);
  }
  
@@ -231,7 +232,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
  int mtk_ppe_prepare_reset(struct mtk_ppe *ppe)
  {
        if (!ppe)
-@@ -838,32 +877,6 @@ int mtk_ppe_prepare_reset(struct mtk_ppe
+@@ -844,32 +882,6 @@ int mtk_ppe_prepare_reset(struct mtk_ppe
        return mtk_ppe_wait_busy(ppe);
  }
  
@@ -283,7 +284,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
  
  void __mtk_ppe_check_skb(struct mtk_ppe *ppe, struct sk_buff *skb, u16 hash);
  
-@@ -396,9 +399,8 @@ int mtk_foe_entry_set_queue(struct mtk_e
+@@ -397,9 +400,8 @@ int mtk_foe_entry_set_queue(struct mtk_e
                            unsigned int queue);
  int mtk_foe_entry_commit(struct mtk_ppe *ppe, struct mtk_flow_entry *entry);
  void mtk_foe_entry_clear(struct mtk_ppe *ppe, struct mtk_flow_entry *entry);
@@ -308,7 +309,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
                seq_printf(m, "%05x %s %7s", i,
 --- a/drivers/net/ethernet/mediatek/mtk_ppe_offload.c
 +++ b/drivers/net/ethernet/mediatek/mtk_ppe_offload.c
-@@ -501,24 +501,21 @@ static int
+@@ -505,24 +505,21 @@ static int
  mtk_flow_offload_stats(struct mtk_eth *eth, struct flow_cls_offload *f)
  {
        struct mtk_flow_entry *entry;