Re: [PATCH v15 net-next 5/9] octeontx2-af: npc: cn20k: add subbank search order control

From: Ratheesh Kannoth

Date: Wed May 20 2026 - 23:33:47 EST


On 2026-05-20 at 07:39:35, Ratheesh Kannoth (rkannoth@xxxxxxxxxxx) wrote:
> CN20K NPC MCAM is split into 32 subbanks that are searched in a
> predefined order during allocation. Lower-numbered subbanks have
> higher priority than higher-numbered ones.

>> + for (prio = 0; prio < cnt; prio++) {
>> + sb_idx = narr[prio];
>> + sb = &npc_priv.sb[sb_idx];
>> +
>> + if (sb->flags & NPC_SUBBANK_FLAG_USED)
>> + xa = &npc_priv.xa_sb_used;
>> + else
>> + xa = &npc_priv.xa_sb_free;
>> +
>> + rc = xa_err(xa_store(xa, sb->arr_idx,
>> + xa_mk_value(sb_idx), GFP_KERNEL));
>Are we using the correct key for xa_store() here?
>It looks like the store operation uses the old priority index (sb->arr_idx)
>instead of the new priority index (prio). Because the subbank is not stored
>at the new priority slot, the cleanup loop below that erases priorities with a
>net loss of subbanks could permanently delete valid subbanks from the xarrays,
>making them unavailable for allocation.

pw-bot: changes-requested
ACK.