[PATCH v3 2/4] hash: add dynamic polynomial calculation

Stephen Hemminger stephen at networkplumber.org
Wed Oct 16 00:29:45 CEST 2024


On Fri, 11 Oct 2024 18:17:00 +0000
Vladimir Medvedkin <vladimir.medvedkin at intel.com> wrote:

> +
> +uint32_t
> +rte_thash_get_rand_poly(uint32_t poly_degree)
> +{
> +	uint32_t ret_poly;
> +
> +	if (poly_degree > 32)
> +		return 0;
> +
> +	do
> +		ret_poly = __thash_get_rand_poly(poly_degree);
> +	while (thash_test_poly_order(ret_poly, poly_degree));

Unbounded loop adds some risk, should there be an upper limit on retries.

> +
> +	return ret_poly;
> +}
> diff --git a/lib/hash/version.map b/lib/hash/version.map
> index 4f13f1d5aa..7ce6ab1121 100644
> --- a/lib/hash/version.map
> +++ b/lib/hash/version.map
> @@ -61,4 +61,5 @@ INTERNAL {
>  
>  	rte_thash_gfni_stub;
>  	rte_thash_gfni_bulk_stub;
> +	rte_thash_get_rand_poly;

Why does this function need to be moved to its own file?
Only used in one place in rte_thash.c.


More information about the dev mailing list