mlxsw: spectrum: Split handling of pedit mangle by chip type
authorPetr Machata <petrm@mellanox.com>
Sun, 21 Jun 2020 08:34:33 +0000 (11:34 +0300)
committerDavid S. Miller <davem@davemloft.net>
Mon, 22 Jun 2020 23:32:11 +0000 (16:32 -0700)
commit3cc9a15a0bb1bde93d5430facda3f3e07c2d3d87
tree36ee620feb9ca0fa3dc89140efa499ea6fa6c455
parent73f782d523ecf4a4ba1531266a02c53ab359c85b
mlxsw: spectrum: Split handling of pedit mangle by chip type

Certain ACL actions are only available on some Spectrum revisions. In
particular, L4_PORT_ACTION is not available on Spectrum-1. Introduce a
new ops struct intended to hold these differences, mlxsw_sp_rulei_ops.
Prime it with a sole member, act_mangle_field, meant for handling of
pedit mangles.

Create two ops structures, one for Spectrum-1, the other for Spectrum-2
and above. Add callbacks for act_mangle_field and dispatch to the common
handler.

Invoke mlxsw_sp_rulei_ops.act_mangle_field from the field mangler
instead of calling the common handler directly.

Signed-off-by: Petr Machata <petrm@mellanox.com>
Reviewed-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: Ido Schimmel <idosch@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/mellanox/mlxsw/spectrum.c
drivers/net/ethernet/mellanox/mlxsw/spectrum.h
drivers/net/ethernet/mellanox/mlxsw/spectrum_acl.c