]> git.itanic.dy.fi Git - linux-stable/commit
net/mlx5: DR, Fix crc32 calculation to work on big-endian (BE) CPUs
authorErez Shitrit <erezsh@nvidia.com>
Thu, 9 Mar 2023 14:43:15 +0000 (16:43 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 30 May 2023 12:55:33 +0000 (13:55 +0100)
commit5e0cc0d502d42fb1eed6a4d39ef26b1257ac9908
tree7c1a71a158629d8961e61ba49594516483ce8773
parent792a8233fc0124e6c7796a303e92336e2ff6b331
net/mlx5: DR, Fix crc32 calculation to work on big-endian (BE) CPUs

commit 1e5daf5565b61a96e570865091589afc9156e3d3 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: 40416d8ede65 ("net/mlx5: DR, Replace CRC32 implementation to use kernel lib")
Signed-off-by: Erez Shitrit <erezsh@nvidia.com>
Reviewed-by: Alex Vesker <valex@nvidia.com>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/net/ethernet/mellanox/mlx5/core/steering/dr_ste.c