summaryrefslogtreecommitdiffstats
path: root/net/sched
diff options
context:
space:
mode:
authorDavide Caratti <dcaratti@redhat.com>2018-01-22 18:14:31 +0100
committerDavid S. Miller <davem@davemloft.net>2018-01-23 19:51:46 -0500
commitf6052cf2fc51772ea51e54c795b9ea234834ad9a (patch)
tree1ecf84d1a926ba6a817f75fc8b9de8d817a7ca88 /net/sched
parentb76f4189df5c54a892ae54ac23908cc54ae7134f (diff)
downloadlinux-stable-f6052cf2fc51772ea51e54c795b9ea234834ad9a.tar.gz
linux-stable-f6052cf2fc51772ea51e54c795b9ea234834ad9a.tar.bz2
linux-stable-f6052cf2fc51772ea51e54c795b9ea234834ad9a.zip
net/sched: act_csum: use per-core statistics
use per-CPU counters, like other TC actions do, instead of maintaining one set of stats across all cores. This allows updating act_csum stats without the need of protecting them using spin_{,un}lock_bh() invocations. Signed-off-by: Davide Caratti <dcaratti@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/sched')
-rw-r--r--net/sched/act_csum.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/net/sched/act_csum.c b/net/sched/act_csum.c
index af4b8ec60d9a..df22da365cd9 100644
--- a/net/sched/act_csum.c
+++ b/net/sched/act_csum.c
@@ -67,7 +67,7 @@ static int tcf_csum_init(struct net *net, struct nlattr *nla,
if (!tcf_idr_check(tn, parm->index, a, bind)) {
ret = tcf_idr_create(tn, parm->index, est, a,
- &act_csum_ops, bind, false);
+ &act_csum_ops, bind, true);
if (ret)
return ret;
ret = ACT_P_CREATED;
@@ -542,9 +542,9 @@ static int tcf_csum(struct sk_buff *skb, const struct tc_action *a,
int action;
u32 update_flags;
- spin_lock(&p->tcf_lock);
tcf_lastuse_update(&p->tcf_tm);
- bstats_update(&p->tcf_bstats, skb);
+ bstats_cpu_update(this_cpu_ptr(p->common.cpu_bstats), skb);
+ spin_lock(&p->tcf_lock);
action = p->tcf_action;
update_flags = p->update_flags;
spin_unlock(&p->tcf_lock);
@@ -566,9 +566,7 @@ static int tcf_csum(struct sk_buff *skb, const struct tc_action *a,
return action;
drop:
- spin_lock(&p->tcf_lock);
- p->tcf_qstats.drops++;
- spin_unlock(&p->tcf_lock);
+ qstats_drop_inc(this_cpu_ptr(p->common.cpu_qstats));
return TC_ACT_SHOT;
}