summaryrefslogtreecommitdiffstats
path: root/net/sched/act_gact.c
diff options
context:
space:
mode:
authorEric Dumazet <edumazet@google.com>2015-07-06 05:18:06 -0700
committerDavid S. Miller <davem@davemloft.net>2015-07-08 13:50:42 -0700
commitcc6510a9504fd3c03d76bd68d99653148342eecc (patch)
tree0faf9f73bdb9cdf72787bc138792135c017ffa37 /net/sched/act_gact.c
parentcef5ecf96b28dc91c4e9f398a336c578fb9e1a0c (diff)
downloadtalos-obmc-linux-cc6510a9504fd3c03d76bd68d99653148342eecc.tar.gz
talos-obmc-linux-cc6510a9504fd3c03d76bd68d99653148342eecc.zip
net_sched: act_gact: use a separate packet counters for gact_determ()
Second step for gact RCU operation : We want to get rid of the spinlock protecting gact operations. Stats (packets/bytes) will soon be per cpu. gact_determ() would not work without a central packet counter, so lets add it for this mode. Signed-off-by: Eric Dumazet <edumazet@google.com> Cc: Alexei Starovoitov <ast@plumgrid.com> Acked-by: Jamal Hadi Salim <jhs@mojatatu.com> Acked-by: John Fastabend <john.fastabend@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/sched/act_gact.c')
-rw-r--r--net/sched/act_gact.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/net/sched/act_gact.c b/net/sched/act_gact.c
index 22a3a61aa090..2f9bec584b3f 100644
--- a/net/sched/act_gact.c
+++ b/net/sched/act_gact.c
@@ -36,8 +36,10 @@ static int gact_net_rand(struct tcf_gact *gact)
static int gact_determ(struct tcf_gact *gact)
{
+ u32 pack = atomic_inc_return(&gact->packets);
+
smp_rmb(); /* coupled with smp_wmb() in tcf_gact_init() */
- if (gact->tcf_bstats.packets % gact->tcfg_pval)
+ if (pack % gact->tcfg_pval)
return gact->tcf_action;
return gact->tcfg_paction;
}
OpenPOWER on IntegriCloud