[PATCH v2 02/24] net/nfp: add the structures and functions for flow offload

Ferruh Yigit ferruh.yigit at amd.com
Mon Oct 10 16:49:45 CEST 2022


On 10/10/2022 7:08 AM, Chaoyong He wrote:
> Add the structures and functions to process mask table, flow
> table, and flow stats id, which are used in the rte_flow
> offload logics.
> 
> Signed-off-by: Chaoyong He <chaoyong.he at corigine.com>
> Reviewed-by: Niklas Söderlund <niklas.soderlund at corigine.com>

<...>

> +__rte_unused static int
> +nfp_flow_table_delete(struct nfp_flow_priv *priv,
> +		struct rte_flow *nfp_flow)
> +{
> +	int ret;
> +	char *hash_data;
> +	uint32_t hash_key;
> +
> +	hash_data = (char *)(nfp_flow->payload.unmasked_data);
> +	hash_key = rte_jhash(hash_data, nfp_flow->length, priv->hash_seed);

It can be an option to store hash information in 'struct rte_flow', 
instead of keep calculating it.

<...>

> +	/* flow stats */
> +	rte_spinlock_init(&priv->stats_lock);
> +	stats_size = (ctx_count & NFP_FL_STAT_ID_STAT) |
> +			((ctx_split - 1) & NFP_FL_STAT_ID_MU_NUM);
> +	PMD_INIT_LOG(INFO, "ctx_count:%0lx, ctx_split:%0lx, stats_size:%0lx ",
> +			ctx_count, ctx_split, stats_size);
> +	priv->stats = rte_zmalloc("nfp_flow_stats",
> +			stats_size * sizeof(struct nfp_fl_stats), 0);

Is this allocates 'stats' for max possible flow rule count? Isn't this a 
too big number to allocate in advance?


More information about the dev mailing list