I think the endianness conversions are necessary, otherwise, the hash function return value will be host endianness dependent.

For example, what should rte_hash_xor32(/*data*/ &{0x00, 0x01, 0x02, 0x03}, /*data_len*/ 4, /*init_val*/ 0x0) return? With the current implementation, it returns 0x00010203 consistently. If we remove the endianness conversions, it will return 0x00010203 on big-endian hosts and 0x03020100 on little-endian hosts. Please correct me but I don't think that's the expected behavior.

On Mon, Feb 20, 2023 at 10:19 AM Dumitrescu, Cristian <cristian.dumitrescu@intel.com> wrote:

Hi Bili,

 

Would it be possible to also remove the endianness conversion from this hash function? What would be the impact if the rte_cpu_to_be() functions are removed?

 

Thanks,

Cristian