net: sched: extract common action counters update code into function
Currently, all implementations of tc_action_ops->stats_update() callback have almost exactly the same implementation of counters update code (besides gact which also updates drop counter). In order to simplify support for using both percpu-allocated and regular action counters depending on run-time flag in following patches, extract action counters update code into standalone function in act API. This commit doesn't change functionality. Signed-off-by: Vlad Buslov <vladbu@mellanox.com> Acked-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
21d8bd123a
commit
c8ecebd04c
@@ -989,6 +989,20 @@ err:
|
||||
return err;
|
||||
}
|
||||
|
||||
void tcf_action_update_stats(struct tc_action *a, u64 bytes, u32 packets,
|
||||
bool drop, bool hw)
|
||||
{
|
||||
_bstats_cpu_update(this_cpu_ptr(a->cpu_bstats), bytes, packets);
|
||||
|
||||
if (drop)
|
||||
this_cpu_ptr(a->cpu_qstats)->drops += packets;
|
||||
|
||||
if (hw)
|
||||
_bstats_cpu_update(this_cpu_ptr(a->cpu_bstats_hw),
|
||||
bytes, packets);
|
||||
}
|
||||
EXPORT_SYMBOL(tcf_action_update_stats);
|
||||
|
||||
int tcf_action_copy_stats(struct sk_buff *skb, struct tc_action *p,
|
||||
int compat_mode)
|
||||
{
|
||||
|
Reference in New Issue
Block a user