mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-10-06 16:49:22 +00:00
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>
This commit is contained in:
parent
cef5ecf96b
commit
cc6510a950
2 changed files with 7 additions and 4 deletions
|
@ -9,6 +9,7 @@ struct tcf_gact {
|
|||
u16 tcfg_ptype;
|
||||
u16 tcfg_pval;
|
||||
int tcfg_paction;
|
||||
atomic_t packets;
|
||||
#endif
|
||||
};
|
||||
#define to_gact(a) \
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue