mlxsw: spectrum: Add infrastructure for parsing configuration
authorAmit Cohen <amcohen@nvidia.com>
Sun, 22 Aug 2021 11:37:13 +0000 (14:37 +0300)
committerDavid S. Miller <davem@davemloft.net>
Sun, 22 Aug 2021 20:39:55 +0000 (21:39 +0100)
commit2d91f0803b84e006bc46de7fb67b8e562fb65355
tree56442ca9e107ee6acbf30eb798f3015af746edf4
parent809159ee59dfd532f794b02de619186c9c75e3f3
mlxsw: spectrum: Add infrastructure for parsing configuration

Spectrum ASICs have a configurable limit on how deep into the packet
they parse. By default, the limit is 96 bytes.

There are several cases where this parsing depth is not enough and there
is a need to increase it. Currently, increasing parsing depth is
maintained as part of VxLAN module, because the MPRS register which
configures parsing depth also configures UDP destination port number
used for VxLAN encapsulation and decapsulation.

Add an API for increasing parsing depth as part of spectrum.c code, so
that it will be possible to use it from other modules. In addition, add
an API for setting UDP destination port and protect it using a dedicated
lock for saving parsing configurations. The lock is needed as not all
the callers hold RTNL lock.

Maintain a counter for increased parsing depth consumers. For first
consumer subscription, increase the parsing depth and for last consumer
unsubscription, set parsing depth to default value.

Signed-off-by: Amit Cohen <amcohen@nvidia.com>
Signed-off-by: Ido Schimmel <idosch@nvidia.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/mellanox/mlxsw/spectrum.c
drivers/net/ethernet/mellanox/mlxsw/spectrum.h