mlxsw: spectrum: Add packet sample offloading support
authorYotam Gigi <yotamg@mellanox.com>
Mon, 23 Jan 2017 10:07:11 +0000 (11:07 +0100)
committerDavid S. Miller <davem@davemloft.net>
Tue, 24 Jan 2017 18:44:28 +0000 (13:44 -0500)
commit98d0f7b9acda0cf15259f83ca1758ad6017c0942
treee6a1795a19f0932aaec4e74d4d06731a8ba3f6ee
parent0677d6828b039bdccc6161a4ea6ae715489dca7e
mlxsw: spectrum: Add packet sample offloading support

Using the MPSC register, add the functions that configure port-based
packet sampling in hardware and the necessary datatypes in the
mlxsw_sp_port struct. In addition, add the necessary trap for sampled
packets and integrate with matchall offloading to allow offloading of the
sample tc action.

The current offload support is for the tc command:

tc filter add dev <DEV> parent ffff: \
  matchall skip_sw \
  action sample rate <RATE> group <GROUP> [trunc <SIZE>]

Where only ingress qdiscs are supported, and only a combination of
matchall classifier and sample action will lead to activating hardware
packet sampling.

Signed-off-by: Yotam Gigi <yotamg@mellanox.com>
Signed-off-by: Jiri Pirko <jiri@mellanox.com>
Reviewed-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/trap.h