Skip to content

Commit

Permalink
net/sched: act_csum: use per-core statistics
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Davide Caratti authored and David S. Miller committed Jan 24, 2018
1 parent b76f418 commit f6052cf
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions net/sched/act_csum.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand All @@ -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;
}

Expand Down

0 comments on commit f6052cf

Please sign in to comment.