Re: [PATCH v4 net 05/10] octeontx2-af: npc: cn20k: Clear MCAM entries by index and key width

Ratheesh Kannoth
2026-04-27T10:02:08Z

On 2026-04-27 at 12:02:08, Ratheesh Kannoth (rkannoth@marvell.com) wrote:
> Replace the old four-argument CN20K MCAM clear with a per-bank static
> helper and npc_cn20k_clear_mcam_entry() that takes a logical MCAM index,
> resolves the key width via npc_mcam_idx_2_key_type(), and clears either
> one bank (X2) or every bank (X4).
> Call it from npc_clear_mcam_entry() on cn20k and log when key-type lookup
> fails. Use the per-bank helper from npc_cn20k_config_mcam_entry() for
> pre-program clears.
> For loopback VFs, use the promisc MCAM index as ucast_idx when copying
> RSS action for promisc, matching cn20k default-rule layout.
>
> Cc: Suman Ghosh <sumang@marvell.com>
> Fixes: 6d1e70282f76 ("octeontx2-af: npc: cn20k: Use common APIs")
> Signed-off-by: Ratheesh Kannoth <rkannoth@marvell.com>

>> @@ -755,9 +762,15 @@ void rvu_npc_install_promisc_entry(struct rvu *rvu, u16 pcifunc,
>>
>> /* If the corresponding PF's ucast action is RSS,
>> * use the same action for promisc also
>> + * Please note that for lbk(s) "index" and "ucast_idx"
>> + * will be same.
>> */
>> - ucast_idx = npc_get_nixlf_mcam_index(mcam, pcifunc,
>> - nixlf, NIXLF_UCAST_ENTRY);
>> + if (is_lbk_vf(rvu, pcifunc))
>> + ucast_idx = index;
>> + else
>> + ucast_idx = npc_get_nixlf_mcam_index(mcam, pcifunc,
>> + nixlf, NIXLF_UCAST_ENTRY);
>> +
>The commit subject and the Fixes: tag reference a cn20k-only change,
>and the comment added above says the new layout matches cn20k
>default-rules, but is_lbk_vf() is silicon-agnostic:
> static inline bool is_lbk_vf(struct rvu *rvu, u16 pcifunc)
> {
> return (!(pcifunc & ~RVU_PFVF_FUNC_MASK) &&
> (rvu->vf_devid == RVU_LBK_VF_DEVID));
> }
>Is it intentional that this branch fires on cn10k and otx2 LBK VFs as
>well?
>Previously, for any LBK VF, ucast_idx was obtained from
>npc_get_nixlf_mcam_index(..., NIXLF_UCAST_ENTRY), which on non-cn20k
>falls through to npc_get_ucast_mcam_index() and returns the ucast
>slot. After this patch ucast_idx becomes the promisc slot for all
>LBK VFs.
>The subsequent is_mcam_entry_enabled(ucast_idx) and
>npc_get_mcam_action(ucast_idx) now read a different MCAM entry on
>non-cn20k silicon, which can change whether an RSS action is
>inherited for the LBK VF promisc rule.
>Should this hunk be gated by is_cn20k(rvu->pdev), or is the
>behavioural change on cn10k/otx2 LBK VFs intended and worth calling
>out in the commit message?
This is intentional change.