733-v6.4-25-net-ethernet-mediatek-fix-ppe-flow-accounting-for-v1.patch 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. From: Felix Fietkau <[email protected]>
  2. Date: Thu, 23 Mar 2023 21:45:43 +0100
  3. Subject: [PATCH] net: ethernet: mediatek: fix ppe flow accounting for v1
  4. hardware
  5. Older chips (like MT7622) use a different bit in ib2 to enable hardware
  6. counter support.
  7. Signed-off-by: Felix Fietkau <[email protected]>
  8. ---
  9. --- a/drivers/net/ethernet/mediatek/mtk_ppe.c
  10. +++ b/drivers/net/ethernet/mediatek/mtk_ppe.c
  11. @@ -605,6 +605,7 @@ __mtk_foe_entry_commit(struct mtk_ppe *p
  12. struct mtk_eth *eth = ppe->eth;
  13. u16 timestamp = mtk_eth_timestamp(eth);
  14. struct mtk_foe_entry *hwe;
  15. + u32 val;
  16. if (MTK_HAS_CAPS(eth->soc->caps, MTK_NETSYS_V2)) {
  17. entry->ib1 &= ~MTK_FOE_IB1_BIND_TIMESTAMP_V2;
  18. @@ -621,8 +622,13 @@ __mtk_foe_entry_commit(struct mtk_ppe *p
  19. wmb();
  20. hwe->ib1 = entry->ib1;
  21. - if (ppe->accounting)
  22. - *mtk_foe_entry_ib2(eth, hwe) |= MTK_FOE_IB2_MIB_CNT;
  23. + if (ppe->accounting) {
  24. + if (MTK_HAS_CAPS(eth->soc->caps, MTK_NETSYS_V2))
  25. + val = MTK_FOE_IB2_MIB_CNT_V2;
  26. + else
  27. + val = MTK_FOE_IB2_MIB_CNT;
  28. + *mtk_foe_entry_ib2(eth, hwe) |= val;
  29. + }
  30. dma_wmb();
  31. --- a/drivers/net/ethernet/mediatek/mtk_ppe.h
  32. +++ b/drivers/net/ethernet/mediatek/mtk_ppe.h
  33. @@ -55,9 +55,10 @@ enum {
  34. #define MTK_FOE_IB2_PSE_QOS BIT(4)
  35. #define MTK_FOE_IB2_DEST_PORT GENMASK(7, 5)
  36. #define MTK_FOE_IB2_MULTICAST BIT(8)
  37. +#define MTK_FOE_IB2_MIB_CNT BIT(10)
  38. #define MTK_FOE_IB2_WDMA_QID2 GENMASK(13, 12)
  39. -#define MTK_FOE_IB2_MIB_CNT BIT(15)
  40. +#define MTK_FOE_IB2_MIB_CNT_V2 BIT(15)
  41. #define MTK_FOE_IB2_WDMA_DEVIDX BIT(16)
  42. #define MTK_FOE_IB2_WDMA_WINFO BIT(17)