aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/include/net/flow_offload.h
diff options
context:
space:
mode:
authorJiri Pirko <jiri@resnulli.us>2020-03-10 11:11:57 +0100
committerDavid S. Miller <davem@davemloft.net>2020-03-10 15:43:25 -0700
commit62751b6808ec6bdc7622849815943cbc7377262a (patch)
treee856804720b84dc27c49eb0acab4d5abfdacc616 /include/net/flow_offload.h
parentMerge branch 'net-Add-support-for-Synopsys-DesignWare-XPCS' (diff)
downloadwireguard-linux-62751b6808ec6bdc7622849815943cbc7377262a.tar.xz
wireguard-linux-62751b6808ec6bdc7622849815943cbc7377262a.zip
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: Jiri Pirko <jiri@resnulli.us> Acked-by: Pablo Neira Ayuso <pablo@netfilter.org> Acked-by: Edward Cree <ecree@solarflare.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/net/flow_offload.h')
-rw-r--r--include/net/flow_offload.h11
1 files changed, 6 insertions, 5 deletions
diff --git a/include/net/flow_offload.h b/include/net/flow_offload.h
index 64807aa03cee..891e15055708 100644
--- a/include/net/flow_offload.h
+++ b/include/net/flow_offload.h
@@ -256,6 +256,11 @@ static inline bool flow_offload_has_one_action(const struct flow_action *action)
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
flow_action_mixed_hw_stats_types_check(const struct flow_action *action,
struct netlink_ext_ack *extack)
@@ -267,8 +272,7 @@ flow_action_mixed_hw_stats_types_check(const struct flow_action *action,
if (flow_offload_has_one_action(action))
return true;
- for (i = 0; i < action->num_entries; i++) {
- action_entry = &action->entries[i];
+ flow_action_for_each(i, action_entry, action) {
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");
return false;
@@ -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);
}
-#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_match match;
struct flow_action action;