Commit 62751b68 authored by Jiri Pirko's avatar Jiri Pirko Committed by David S. Miller

flow_offload: use flow_action_for_each in flow_action_mixed_hw_stats_types_check()

Instead of manually iterating over entries, use flow_action_for_each
helper. Move the helper and wrap it to fit to 80 cols on the way.
Signed-off-by: default avatarJiri Pirko <jiri@resnulli.us>
Acked-by: default avatarPablo Neira Ayuso <pablo@netfilter.org>
Acked-by: default avatarEdward Cree <ecree@solarflare.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent e442cfc7
...@@ -256,6 +256,11 @@ static inline bool flow_offload_has_one_action(const struct flow_action *action) ...@@ -256,6 +256,11 @@ static inline bool flow_offload_has_one_action(const struct flow_action *action)
return action->num_entries == 1; return action->num_entries == 1;
} }
#define flow_action_for_each(__i, __act, __actions) \
for (__i = 0, __act = &(__actions)->entries[0]; \
__i < (__actions)->num_entries; \
__act = &(__actions)->entries[++__i])
static inline bool static inline bool
flow_action_mixed_hw_stats_types_check(const struct flow_action *action, flow_action_mixed_hw_stats_types_check(const struct flow_action *action,
struct netlink_ext_ack *extack) struct netlink_ext_ack *extack)
...@@ -267,8 +272,7 @@ flow_action_mixed_hw_stats_types_check(const struct flow_action *action, ...@@ -267,8 +272,7 @@ flow_action_mixed_hw_stats_types_check(const struct flow_action *action,
if (flow_offload_has_one_action(action)) if (flow_offload_has_one_action(action))
return true; return true;
for (i = 0; i < action->num_entries; i++) { flow_action_for_each(i, action_entry, action) {
action_entry = &action->entries[i];
if (i && action_entry->hw_stats_type != last_hw_stats_type) { if (i && action_entry->hw_stats_type != last_hw_stats_type) {
NL_SET_ERR_MSG_MOD(extack, "Mixing HW stats types for actions is not supported"); NL_SET_ERR_MSG_MOD(extack, "Mixing HW stats types for actions is not supported");
return false; return false;
...@@ -316,9 +320,6 @@ flow_action_basic_hw_stats_types_check(const struct flow_action *action, ...@@ -316,9 +320,6 @@ flow_action_basic_hw_stats_types_check(const struct flow_action *action,
return flow_action_hw_stats_types_check(action, extack, 0); return flow_action_hw_stats_types_check(action, extack, 0);
} }
#define flow_action_for_each(__i, __act, __actions) \
for (__i = 0, __act = &(__actions)->entries[0]; __i < (__actions)->num_entries; __act = &(__actions)->entries[++__i])
struct flow_rule { struct flow_rule {
struct flow_match match; struct flow_match match;
struct flow_action action; struct flow_action action;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment