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>
This commit is contained in:

committed by
David S. Miller

parent
c380e377a5
commit
d897a638e9
@@ -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
|
||||
|
Reference in New Issue
Block a user