diff options
author | Jakub Kicinski <jakub.kicinski@netronome.com> | 2017-05-31 08:06:43 -0700 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2017-05-31 17:58:13 -0400 |
commit | d897a638e98c476c56118d0dcc1bc55450504866 (patch) | |
tree | e902b10f4f6f2f9335d3e1ec039f97b42f4ecde0 /include | |
parent | c380e377a50e944a2b9a892133b5a37b3ec90fe3 (diff) | |
download | linux-d897a638e98c476c56118d0dcc1bc55450504866.tar.bz2 |
sched: add helper for updating statistics on all actions
Forgetting to disable preemption around tcf_action_stats_update()
seems to be a common mistake. Add a helper function for updating
stats on all actions of a filter.
Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include')
-rw-r--r-- | include/net/pkt_cls.h | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/include/net/pkt_cls.h b/include/net/pkt_cls.h index f7762295b7b8..537d0a0ad4c4 100644 --- a/include/net/pkt_cls.h +++ b/include/net/pkt_cls.h @@ -157,6 +157,25 @@ static inline void tcf_exts_to_list(const struct tcf_exts *exts, #endif } +static inline void +tcf_exts_stats_update(const struct tcf_exts *exts, + u64 bytes, u64 packets, u64 lastuse) +{ +#ifdef CONFIG_NET_CLS_ACT + int i; + + preempt_disable(); + + for (i = 0; i < exts->nr_actions; i++) { + struct tc_action *a = exts->actions[i]; + + tcf_action_stats_update(a, bytes, packets, lastuse); + } + + preempt_enable(); +#endif +} + /** * tcf_exts_exec - execute tc filter extensions * @skb: socket buffer |