[PATCH v3 10/34] net/sfc: attach to HW table API

Andrew Rybchenko andrew.rybchenko at oktetlabs.ru
Wed Jun 7 14:08:49 CEST 2023


On 6/5/23 02:24, Ivan Malov wrote:
> From: Denis Pryazhennikov <denis.pryazhennikov at arknetworks.am>
> 
> The patch adds APIs to initialise, manipulate and finalise
> HW tables API-specific context in NIC control structure.
> The context itself will be used to store HW tables-related info,
> like table descriptors and field descriptors.
> 
> Signed-off-by: Denis Pryazhennikov <denis.pryazhennikov at arknetworks.am>
> Reviewed-by: Ivan Malov <ivan.malov at arknetworks.am>
> Reviewed-by: Andy Moreton <amoreton at xilinx.com>

[snip]

> +int
> +sfc_tbl_meta_cache_ctor(struct rte_hash **ref_cache)
> +{
> +	size_t cache_size = RTE_MAX((unsigned int)SFC_TBL_META_CACHE_SIZE_MIN,
> +				    efx_table_supported_num_get());
> +	struct rte_hash *cache = NULL;
> +	const struct rte_hash_parameters hash_params = {
> +		.name       = "meta_hash_table",
> +		.hash_func  = rte_jhash,
> +		.entries    = cache_size,
> +		.socket_id  = rte_socket_id(),
> +		.key_len    = sizeof(efx_table_id_t),
> +	};
> +
> +	cache = rte_hash_create(&hash_params);
> +	if (!cache)

Compare vs NULL as DPDK coding style says

> +		return -ENOMEM;
> +
> +	*ref_cache = cache;
> +
> +	return 0;
> +}



More information about the dev mailing list