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:

committed by
David S. Miller

parent
1ee473306a
commit
319a1d1947
@@ -1746,7 +1746,8 @@ unlock:
|
||||
}
|
||||
|
||||
static int qede_parse_actions(struct qede_dev *edev,
|
||||
struct flow_action *flow_action)
|
||||
struct flow_action *flow_action,
|
||||
struct netlink_ext_ack *extack)
|
||||
{
|
||||
const struct flow_action_entry *act;
|
||||
int i;
|
||||
@@ -1756,6 +1757,9 @@ static int qede_parse_actions(struct qede_dev *edev,
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
if (!flow_action_basic_hw_stats_types_check(flow_action, extack))
|
||||
return -EOPNOTSUPP;
|
||||
|
||||
flow_action_for_each(i, act, flow_action) {
|
||||
switch (act->id) {
|
||||
case FLOW_ACTION_DROP:
|
||||
@@ -1970,7 +1974,7 @@ int qede_add_tc_flower_fltr(struct qede_dev *edev, __be16 proto,
|
||||
}
|
||||
|
||||
/* parse tc actions and get the vf_id */
|
||||
if (qede_parse_actions(edev, &f->rule->action))
|
||||
if (qede_parse_actions(edev, &f->rule->action, f->common.extack))
|
||||
goto unlock;
|
||||
|
||||
if (qede_flow_find_fltr(edev, &t)) {
|
||||
@@ -2038,7 +2042,7 @@ static int qede_flow_spec_validate(struct qede_dev *edev,
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
if (qede_parse_actions(edev, flow_action))
|
||||
if (qede_parse_actions(edev, flow_action, NULL))
|
||||
return -EINVAL;
|
||||
|
||||
return 0;
|
||||
|
Reference in New Issue
Block a user