Commit 4aa988ec authored by Erez Shitrit's avatar Erez Shitrit Committed by openeuler-sync-bot
Browse files

net/mlx5: DR, Fix crc32 calculation to work on big-endian (BE) CPUs

stable inclusion
from stable-v5.10.181
commit c21862232f6cd1437e2c7531eec196a593c1d9ae
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I8GJZJ

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=c21862232f6cd1437e2c7531eec196a593c1d9ae



--------------------------------

commit 1e5daf55 upstream.

When calculating crc for hash index we use the function crc32 that
calculates for little-endian (LE) arch.
Then we convert it to network endianness using htonl(), but it's wrong
to do the conversion in BE archs since the crc32 value is already LE.

The solution is to switch the bytes from the crc result for all types
of arc.

Fixes: 40416d8e ("net/mlx5: DR, Replace CRC32 implementation to use kernel lib")
Signed-off-by: default avatarErez Shitrit <erezsh@nvidia.com>
Reviewed-by: default avatarAlex Vesker <valex@nvidia.com>
Signed-off-by: default avatarSaeed Mahameed <saeedm@nvidia.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: default avatarsanglipeng <sanglipeng1@jd.com>
(cherry picked from commit 8c9073a3)
parent fa4e2922
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment