Re: [PATCH v16 net-next 1/9] octeontx2-af: npc: cn20k: debugfs enhancements

From: Ratheesh Kannoth

Date: Sun May 31 2026 - 22:25:46 EST


On 2026-05-26 at 02:29:44, Jakub Kicinski (kuba@xxxxxxxxxx) wrote:
> On Thu, 21 May 2026 15:22:55 +0530 Ratheesh Kannoth wrote:
> > Improve MCAM visibility and field debugging for CN20K NPC.
> >
> > - Extend "mcam_layout" to show enabled (+) or disabled state per entry
> > so status can be verified without parsing the full "mcam_entry" dump.
> > - Add "dstats" debugfs entry: reports recently hit MCAM indices with
> > packet counts; stats are cleared on read so each read shows deltas.
> > - Add "mismatch" debugfs entry: lists MCAM entries that are enabled
> > but not explicitly allocated, helping diagnose allocation/field issues.
>
> debugfs file which clears state seems quite odd.
> Does any user need this?
The clear-on-read behavior in dstats is implemented to provide incremental (delta)
hit-counts for live field debugging.

On each read operation, the driver compares current hardware hit counters against
a cached baseline array (in software). It reports only the entries that experienced an increment,
and then updates the baseline cache to the current hardware values. This allows developers
to easily isolate active traffic matching rules without looking at all monotonically increasing hw counters.

I will update the commit message to reflect the same.

> This looks like a crutch for badly written tests TBH.