flow_offload: check for basic action hw stats type

Introduce flow_action_basic_hw_stats_types_check() helper and use it
in drivers. That sanitizes the drivers which do not have support
for action HW stats types.

Signed-off-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
Jiri Pirko 2020-03-07 12:40:13 +01:00 committed by David S. Miller
parent 1ee473306a
commit 319a1d1947
12 changed files with 119 additions and 11 deletions

View file

@ -865,6 +865,10 @@ static int dsa_slave_add_cls_matchall(struct net_device *dev,
if (!flow_offload_has_one_action(&cls->rule->action))
return err;
if (!flow_action_basic_hw_stats_types_check(&cls->rule->action,
cls->common.extack))
return err;
act = &cls->rule->action.entries[0];
if (act->id == FLOW_ACTION_MIRRED && protocol == htons(ETH_P_ALL)) {