[RFC 2/3] hash: reduce architecture special cases

Morten Brørup mb at smartsharesystems.com
Fri Aug 22 11:20:43 CEST 2025


> From: Stephen Hemminger [mailto:stephen at networkplumber.org]
> Sent: Thursday, 21 August 2025 22.35
> 
> Make comparison of power of 2 sizes compatible across platforms.
> Keep the special case code for 16 bytes for x86 and arm64 but
> also add simple xor for others.
> 
> Need to make rte_hash_k32_cmp_eq() exposed because ip_frag
> code poaches it.

One more argument why these architecture optimized compare functions should be exposed as generic EAL functions, like rte_mov16() etc. for rte_memcpy(), instead of hiding them away in the hash library.

It could be rte_memeq16(const void *, const void *) etc. in /lib/eal/include, with architecture optimized variants, and a generic variant.

And a wrapper calling them in the hash library, such as:

static inline int
rte_hash_k16_cmp_eq(const void *key1, const void *key2, size_t key_len __rte_unused)
{
	return !rte_memeq16(key1, key2);
}

> 
> Signed-off-by: Stephen Hemminger <stephen at networkplumber.org>
> ---

With our without suggested feature creep...

Acked-by: Morten Brørup <mb at smartsharesystems.com>



More information about the dev mailing list