[PATCH v6 20/25] net/i40e: reimplement ethertype parser

Medvedkin, Vladimir vladimir.medvedkin at intel.com
Sat Oct 10 20:44:27 CEST 2026


Hi Anatoly,

one comment inline

On 10/9/2026 11:59 AM, Anatoly Burakov wrote:
> Use the new flow graph API and the common parsing framework to implement
> flow parser for Ethertype.
>
> The ethertype filter tracking has been moved completely inside the new
> engine, and the ethertype code is refactored to enabled that use case by
> decoupling hardware writes from software tracking.
>
> Signed-off-by: Anatoly Burakov <anatoly.burakov at intel.com>
> Acked-by: Vladimir Medvedkin <vladimir.medvedkin at intel.com>
> ---
<snip>
> +static int
> +i40e_flow_ethertype_engine_init(const struct ci_flow_engine *engine __rte_unused,
> +		struct rte_eth_dev_data *dev_data, void *priv)
> +{
> +	char ethertype_hash_name[RTE_HASH_NAMESIZE];
> +	struct i40e_ethertype_priv *etype_priv = priv;
> +	struct rte_hash_parameters params = {
> +		.name = ethertype_hash_name,
> +		.entries = I40E_MAX_ETHERTYPE_FILTER_NUM,
> +		.key_len = sizeof(struct i40e_ethertype_key),
> +		.hash_func = rte_hash_crc,
> +		.hash_func_init_val = 0,
> +		.socket_id = rte_socket_id(),
> +	};
> +
> +	snprintf(ethertype_hash_name, RTE_HASH_NAMESIZE, "i40e_ethertype_hash_%s", dev_data->name);
it seems like concatenation of "i40e_ethertype_hash_" with PCI BDF is 
larger than RTE_HASH_NAMESIZE, consider either to increase namesize of 
shrink the first part with something like "i40e_etype_hash_"
> +
> +	etype_priv->hash_table = rte_hash_create(&params);
> +	if (etype_priv->hash_table == NULL) {
> +		PMD_INIT_LOG(ERR, "Failed to create ethertype hash table: %s",
> +				rte_strerror(rte_errno));
> +		return -rte_errno;
> +	}
> +
> +	return 0;
> +}
> +
> +static void
> +i40e_flow_ethertype_engine_uninit(const struct ci_flow_engine *engine __rte_unused,
> +		void *priv)
> +{
> +	struct i40e_ethertype_priv *etype_priv = priv;
> +
> +	rte_hash_free(etype_priv->hash_table);
> +}
> +
> +static const struct ci_flow_engine_ops i40e_flow_engine_ethertype_ops = {
> +	.engine_init = i40e_flow_ethertype_engine_init,
> +	.engine_uninit = i40e_flow_ethertype_engine_uninit,
> +	.ctx_init = i40e_flow_ethertype_ctx_init,
> +	.ctx_to_flow = i40e_flow_ethertype_ctx_to_flow,
> +	.flow_register = i40e_flow_ethertype_register,
> +	.flow_unregister = i40e_flow_ethertype_unregister,
> +	.flow_install = i40e_flow_ethertype_install,
> +	.flow_uninstall = i40e_flow_ethertype_uninstall,
> +};
> +
> +const struct ci_flow_engine i40e_flow_engine_ethertype = {
> +	.name = "i40e_ethertype",
> +	.ctx_size = sizeof(struct i40e_ethertype_ctx),
> +	.flow_size = sizeof(struct i40e_ethertype_flow),
> +	.priv_size = sizeof(struct i40e_ethertype_priv),
> +	.ops = &i40e_flow_engine_ethertype_ops,
> +	.graph = &i40e_ethertype_graph,
> +};
> diff --git a/drivers/net/intel/i40e/meson.build b/drivers/net/intel/i40e/meson.build
> index 3229233f501..ddc97f9b3bb 100644
> --- a/drivers/net/intel/i40e/meson.build
> +++ b/drivers/net/intel/i40e/meson.build
> @@ -33,6 +33,7 @@ sources += files(
>           'i40e_pf.c',
>           'i40e_fdir.c',
>           'i40e_flow.c',
> +        'i40e_flow_ethertype.c',
>           'i40e_tm.c',
>           'i40e_hash.c',
>           'i40e_vf_representor.c',

-- 
Regards,
Vladimir



More information about the dev mailing list