net/mlx5e: Add tc action infrastructure
authorRoi Dayan <roid@nvidia.com>
Mon, 12 Jul 2021 11:13:10 +0000 (14:13 +0300)
committerSaeed Mahameed <saeedm@nvidia.com>
Wed, 15 Dec 2021 05:29:41 +0000 (21:29 -0800)
commitfad54790698023190f01a1b4d6406395e84464db
tree38fa800c6b4170b924705fe61ac34cd079a989c7
parent6cf7a1ac0fedad8a70c050ade8a27a2071638500
net/mlx5e: Add tc action infrastructure

Add an infrastructure to help parsing tc actions in a generic way.

Supporting an action parser means implementing struct mlx5e_tc_act
for that action.

The infrastructure will give the possibility to be generic when parsing tc
actions, i.e. parse_tc_nic_actions() and parse_tc_fdb_actions().
To parse tc actions a user needs to allocate a parse_state instance
and pass it when iterating over the tc actions parsers.
If a parser doesn't exists then a user can treat it as unsupported.

To add an action parser a user needs to implement two callbacks.
The can_offload() callback to quickly check if an action can be offloaded.
The parse_action() callback to do actual parsing and prepare for offload.

Add implementation for drop, trap, mark and accept action parsers with this
commit to act as examples and implement usage of the new infrastructure for
those actions.

Signed-off-by: Roi Dayan <roid@nvidia.com>
Reviewed-by: Oz Shlomo <ozsh@nvidia.com>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
drivers/net/ethernet/mellanox/mlx5/core/Makefile
drivers/net/ethernet/mellanox/mlx5/core/en/tc/act/accept.c [new file with mode: 0644]
drivers/net/ethernet/mellanox/mlx5/core/en/tc/act/act.c [new file with mode: 0644]
drivers/net/ethernet/mellanox/mlx5/core/en/tc/act/act.h [new file with mode: 0644]
drivers/net/ethernet/mellanox/mlx5/core/en/tc/act/drop.c [new file with mode: 0644]
drivers/net/ethernet/mellanox/mlx5/core/en/tc/act/mark.c [new file with mode: 0644]
drivers/net/ethernet/mellanox/mlx5/core/en/tc/act/trap.c [new file with mode: 0644]
drivers/net/ethernet/mellanox/mlx5/core/en/tc_priv.h
drivers/net/ethernet/mellanox/mlx5/core/en_tc.c