Subject: Re: [net-next,v3,11/13] octeontx2-pf: cn20k: Add TC rules support

From: Jakub Kicinski <[email-masked]>
Date: Sat, 10 Jan 2026 14:59:36 -0800

This is an AI-generated review of your patch. The human sending this
email has considered the AI review valid, or at least pausible.

For local reproduction steps see https://netdev-ai.bots.linux.dev/ai-local.html
---
octeontx2-pf: cn20k: Add TC rules support

This patch implements dynamic MCAM entry allocation for CN20K TC rules.
The PF driver requests entries from AF driver on the fly and shifts
entries based on rule priority, rejecting rules when X2/X4 mixing
prevents proper shifting.

> diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/cn20k.c b/drivers/net/ethernet/marvell/octeontx2/nic/cn20k.c
> index a60f8cf53feb..cd2c9a95ee22 100644
> --- a/drivers/net/ethernet/marvell/octeontx2/nic/cn20k.c
> +++ b/drivers/net/ethernet/marvell/octeontx2/nic/cn20k.c

[ ... ]

> +void cn20k_tc_update_mcam_table_del_req(struct otx2_nic *nic,
> +					struct otx2_flow_config *flow_cfg,
> +					struct otx2_tc_flow *node)
> +{
> +	struct otx2_tc_flow *first, *tmp, *n;
> +	int i = 0, index;
> +	u16 cntr_val = 0;
> +	u16 entry;
> +
> +	index = cn20k_tc_get_entry_index(flow_cfg, node);
> +	first = list_first_entry(&flow_cfg->flow_list_tc, struct otx2_tc_flow,
> +				 list);
> +	entry = first->entry;
> +
> +	/* If entries cannot be shifted then delete given entry
> +	 * and free it to AF too.
> +	 */
> +	if (!cn20k_tc_check_entry_shiftable(nic, flow_cfg, node,
> +					    index, false)) {
> +		list_del(&node->list);
> +		entry = node->entry;
> +		goto free_mcam_entry;
> +	}

[ ... ]

> +free_mcam_entry:
> +	if (cn20k_tc_free_mcam_entry(nic, entry))
> +		netdev_err(nic->netdev, "Freeing entry %d to AF failed\n",
> +			   first->entry);
                           ^^^^^^^^^^^^

Should this error message print 'entry' instead of 'first->entry'? When
the code takes the "not shiftable" path, it sets entry = node->entry and
jumps to free_mcam_entry. At that point, first->entry may be different
from the entry value that was actually passed to cn20k_tc_free_mcam_entry().

> +}