[PATCH net v2] octeontx2-af: skip NPC_AF_MATCH_STATX access on cn20k

From: Vadluri Mukunda

Date: Tue Nov 03 2026 - 04:24:10 EST


From: Subbaraya Sundeep <sbhatta@xxxxxxxxxxx>

NPC_AF_MATCH_STATX is not present on cn20k silicon, and cn20k does
not set up an RX miss action counter. Two paths still access it:
the npc_delete_flow mailbox, which reads the counter of the deleted
rule, and the rx_miss_act_stats debugfs file, which would read
counter 0. Avoid the access on cn20k. Counter support for cn20k is
left for later.

Found by code inspection. The issue was not triggered on hardware.
Compile tested only; not tested on real hardware.

Fixes: 4e527f1e5c15 ("octeontx2-af: npc: cn20k: Add new mailboxes for CN20K silicon")
Signed-off-by: Subbaraya Sundeep <sbhatta@xxxxxxxxxxx>
Signed-off-by: Vadluri Mukunda <vmukunda@xxxxxxxxxxx>
---
v2:
- Fixes tag now points to the upstream commit
- Also skip creating the rx_miss_act_stats debugfs file on cn20k
- Use full name in Signed-off-by
- Add how the issue was found and what testing was done
v1: https://lore.kernel.org/netdev/20261026035140.666684-1-vmukunda@xxxxxxxxxxx/

drivers/net/ethernet/marvell/octeontx2/af/rvu_debugfs.c | 6 ++++--
drivers/net/ethernet/marvell/octeontx2/af/rvu_npc_fs.c | 2 +-
2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/net/ethernet/marvell/octeontx2/af/rvu_debugfs.c b/drivers/net/ethernet/marvell/octeontx2/af/rvu_debugfs.c
index 2927633465d9..119426beb946 100644
--- a/drivers/net/ethernet/marvell/octeontx2/af/rvu_debugfs.c
+++ b/drivers/net/ethernet/marvell/octeontx2/af/rvu_debugfs.c
@@ -3740,8 +3740,10 @@ static void rvu_dbg_npc_init(struct rvu *rvu)
debugfs_create_file("mcam_rules", 0444, rvu->rvu_dbg.npc, rvu,
&rvu_dbg_npc_mcam_rules_fops);

- debugfs_create_file("rx_miss_act_stats", 0444, rvu->rvu_dbg.npc, rvu,
- &rvu_dbg_npc_rx_miss_act_fops);
+ /* RX miss action counter is not available on cn20k */
+ if (!is_cn20k(rvu->pdev))
+ debugfs_create_file("rx_miss_act_stats", 0444, rvu->rvu_dbg.npc,
+ rvu, &rvu_dbg_npc_rx_miss_act_fops);

if (is_cn20k(rvu->pdev))
npc_cn20k_debugfs_init(rvu);
diff --git a/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc_fs.c b/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc_fs.c
index ea5d462a66ee..f3b0b082443b 100644
--- a/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc_fs.c
+++ b/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc_fs.c
@@ -1960,7 +1960,7 @@ int rvu_mbox_handler_npc_delete_flow(struct rvu *rvu,
/* single rule */
} else if (req->entry == iter->entry) {
blkaddr = rvu_get_blkaddr(rvu, BLKTYPE_NPC, 0);
- if (blkaddr)
+ if (blkaddr && !is_cn20k(rvu->pdev))
rsp->cntr_val = rvu_read64(rvu, blkaddr,
NPC_AF_MATCH_STATX(iter->cntr));
list_move_tail(&iter->list, &del_list);
--
2.25.1