mlxsw: spectrum_acl_bloom_filter: Add support for Spectrum-4 calculation
authorAmit Cohen <amcohen@nvidia.com>
Thu, 6 Jan 2022 16:06:51 +0000 (18:06 +0200)
committerJakub Kicinski <kuba@kernel.org>
Fri, 7 Jan 2022 04:00:45 +0000 (20:00 -0800)
commit852ee4191dd2046203c2fece6a9402ce28118f80
treeeeba7236b9f92906e15fd3a7e509f7f433aae582
parent58723d2f77717373d44721a2c65f8af5917102b7
mlxsw: spectrum_acl_bloom_filter: Add support for Spectrum-4 calculation

Spectrum-4 will calculate hash function for bloom filter differently
from the existing ASICs.

First, two hash functions will be used to calculate 16 bits result.
The final result will be combination of the two results - 6 bits which
are result of CRC-6 will be used as MSB and 10 bits which are result of
CRC-10 will be used as LSB.

Second, while in Spectrum{2,3}, there is a padding in each chunk, so the
chunks use a sequence of whole bytes, in Spectrum-4 there is no padding,
so each chunk use 20 bytes minus 2 bits, so it is necessary to align the
chunks to be without holes.

Add dedicated 'mlxsw_sp_acl_bf_ops' for Spectrum-4 and add the required
tables for CRC calculations.

All the details are documented as part of the code for future use.

Signed-off-by: Amit Cohen <amcohen@nvidia.com>
Reviewed-by: Petr Machata <petrm@nvidia.com>
Signed-off-by: Ido Schimmel <idosch@nvidia.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/mellanox/mlxsw/spectrum.h
drivers/net/ethernet/mellanox/mlxsw/spectrum_acl_bloom_filter.c