Skip to content

Commit 4eaeca1

Browse files
nbd168davem330
authored andcommitted
net: mtk_eth_soc: mediatek: fix ppe flow accounting for v1 hardware
Older chips (like MT7622) use a different bit in ib2 to enable hardware counter support. Add macros for both and select the appropriate bit. Fixes: 3fbe4d8 ("net: ethernet: mtk_eth_soc: ppe: add support for flow accounting") Signed-off-by: Felix Fietkau <nbd@nbd.name> Signed-off-by: Daniel Golle <daniel@makrotopia.org> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent fbc1449 commit 4eaeca1

2 files changed

Lines changed: 10 additions & 3 deletions

File tree

drivers/net/ethernet/mediatek/mtk_ppe.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -601,6 +601,7 @@ __mtk_foe_entry_commit(struct mtk_ppe *ppe, struct mtk_foe_entry *entry,
601601
struct mtk_eth *eth = ppe->eth;
602602
u16 timestamp = mtk_eth_timestamp(eth);
603603
struct mtk_foe_entry *hwe;
604+
u32 val;
604605

605606
if (MTK_HAS_CAPS(eth->soc->caps, MTK_NETSYS_V2)) {
606607
entry->ib1 &= ~MTK_FOE_IB1_BIND_TIMESTAMP_V2;
@@ -617,8 +618,13 @@ __mtk_foe_entry_commit(struct mtk_ppe *ppe, struct mtk_foe_entry *entry,
617618
wmb();
618619
hwe->ib1 = entry->ib1;
619620

620-
if (ppe->accounting)
621-
*mtk_foe_entry_ib2(eth, hwe) |= MTK_FOE_IB2_MIB_CNT;
621+
if (ppe->accounting) {
622+
if (MTK_HAS_CAPS(eth->soc->caps, MTK_NETSYS_V2))
623+
val = MTK_FOE_IB2_MIB_CNT_V2;
624+
else
625+
val = MTK_FOE_IB2_MIB_CNT;
626+
*mtk_foe_entry_ib2(eth, hwe) |= val;
627+
}
622628

623629
dma_wmb();
624630

drivers/net/ethernet/mediatek/mtk_ppe.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,10 @@ enum {
5555
#define MTK_FOE_IB2_PSE_QOS BIT(4)
5656
#define MTK_FOE_IB2_DEST_PORT GENMASK(7, 5)
5757
#define MTK_FOE_IB2_MULTICAST BIT(8)
58+
#define MTK_FOE_IB2_MIB_CNT BIT(10)
5859

5960
#define MTK_FOE_IB2_WDMA_QID2 GENMASK(13, 12)
60-
#define MTK_FOE_IB2_MIB_CNT BIT(15)
61+
#define MTK_FOE_IB2_MIB_CNT_V2 BIT(15)
6162
#define MTK_FOE_IB2_WDMA_DEVIDX BIT(16)
6263
#define MTK_FOE_IB2_WDMA_WINFO BIT(17)
6364

0 commit comments

Comments
 (0)