Commit 8f2ae965 authored by Eric Dumazet's avatar Eric Dumazet Committed by David S. Miller

net_sched: act_gact: read tcfg_ptype once

Third step for gact RCU operation :

Following patch will get rid of spinlock protection,
so we need to read tcfg_ptype once.
Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
Cc: Alexei Starovoitov <ast@plumgrid.com>
Acked-by: default avatarJamal Hadi Salim <jhs@mojatatu.com>
Acked-by: default avatarJohn Fastabend <john.fastabend@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent cc6510a9
...@@ -127,16 +127,16 @@ static int tcf_gact(struct sk_buff *skb, const struct tc_action *a, ...@@ -127,16 +127,16 @@ static int tcf_gact(struct sk_buff *skb, const struct tc_action *a,
struct tcf_result *res) struct tcf_result *res)
{ {
struct tcf_gact *gact = a->priv; struct tcf_gact *gact = a->priv;
int action = TC_ACT_SHOT; int action = gact->tcf_action;
spin_lock(&gact->tcf_lock); spin_lock(&gact->tcf_lock);
#ifdef CONFIG_GACT_PROB #ifdef CONFIG_GACT_PROB
if (gact->tcfg_ptype) {
action = gact_rand[gact->tcfg_ptype](gact); u32 ptype = READ_ONCE(gact->tcfg_ptype);
else
action = gact->tcf_action; if (ptype)
#else action = gact_rand[ptype](gact);
action = gact->tcf_action; }
#endif #endif
gact->tcf_bstats.bytes += qdisc_pkt_len(skb); gact->tcf_bstats.bytes += qdisc_pkt_len(skb);
gact->tcf_bstats.packets++; gact->tcf_bstats.packets++;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment