]> git.baikalelectronics.ru Git - kernel.git/commit
mlxsw: spectrum_acl: Offload FLOW_ACTION_SAMPLE
authorIdo Schimmel <idosch@nvidia.com>
Tue, 16 Mar 2021 15:03:01 +0000 (17:03 +0200)
committerDavid S. Miller <davem@davemloft.net>
Tue, 16 Mar 2021 22:32:22 +0000 (15:32 -0700)
commit9a5567c779bb633c49d089bf691e023b91b13bc6
treec0e2b13d8f8d13f1d735eb19155e1eb9a0a92d05
parentdfdc6117c9a53db7ebfbc57d06b2b9256594140f
mlxsw: spectrum_acl: Offload FLOW_ACTION_SAMPLE

Implement support for action sample when used with a flower classifier
by implementing the required sampler_add() / sampler_del() callbacks and
registering an Rx listener for the sampled packets.

The sampler_add() callback returns an error for Spectrum-1 as the
functionality is not supported. In Spectrum-{2,3} the callback creates a
mirroring agent towards the CPU. The agent's identifier is used by the
policy engine code to mirror towards the CPU with probability.

The Rx listener for the sampled packet is registered with the 'policy
engine' mirroring reason and passes trapped packets to the psample
module after looking up their parameters (e.g., sampling group).

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