mirror of
https://github.com/torvalds/linux.git
synced 2024-11-22 20:22:09 +00:00
net/sched: act_gate: use percpu stats
The tc action act_gate was using shared stats, move it to percpu stats. tdc results: 1..12 ok 1 5153 - Add gate action with priority and sched-entry ok 2 7189 - Add gate action with base-time ok 3 a721 - Add gate action with cycle-time ok 4 c029 - Add gate action with cycle-time-ext ok 5 3719 - Replace gate base-time action ok 6 d821 - Delete gate action with valid index ok 7 3128 - Delete gate action with invalid index ok 8 7837 - List gate actions ok 9 9273 - Flush gate actions ok 10 c829 - Add gate action with duplicate index ok 11 3043 - Add gate action with invalid index ok 12 2930 - Add gate action with cookie Reviewed-by: Jamal Hadi Salim <jhs@mojatatu.com> Signed-off-by: Pedro Tammela <pctammela@mojatatu.com> Signed-off-by: Paolo Abeni <pabeni@redhat.com>
This commit is contained in:
parent
288864effe
commit
7afd073e55
@ -119,35 +119,37 @@ TC_INDIRECT_SCOPE int tcf_gate_act(struct sk_buff *skb,
|
|||||||
struct tcf_result *res)
|
struct tcf_result *res)
|
||||||
{
|
{
|
||||||
struct tcf_gate *gact = to_gate(a);
|
struct tcf_gate *gact = to_gate(a);
|
||||||
|
int action = READ_ONCE(gact->tcf_action);
|
||||||
spin_lock(&gact->tcf_lock);
|
|
||||||
|
|
||||||
tcf_lastuse_update(&gact->tcf_tm);
|
tcf_lastuse_update(&gact->tcf_tm);
|
||||||
bstats_update(&gact->tcf_bstats, skb);
|
tcf_action_update_bstats(&gact->common, skb);
|
||||||
|
|
||||||
|
spin_lock(&gact->tcf_lock);
|
||||||
if (unlikely(gact->current_gate_status & GATE_ACT_PENDING)) {
|
if (unlikely(gact->current_gate_status & GATE_ACT_PENDING)) {
|
||||||
spin_unlock(&gact->tcf_lock);
|
spin_unlock(&gact->tcf_lock);
|
||||||
return gact->tcf_action;
|
return action;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(gact->current_gate_status & GATE_ACT_GATE_OPEN))
|
if (!(gact->current_gate_status & GATE_ACT_GATE_OPEN)) {
|
||||||
|
spin_unlock(&gact->tcf_lock);
|
||||||
goto drop;
|
goto drop;
|
||||||
|
}
|
||||||
|
|
||||||
if (gact->current_max_octets >= 0) {
|
if (gact->current_max_octets >= 0) {
|
||||||
gact->current_entry_octets += qdisc_pkt_len(skb);
|
gact->current_entry_octets += qdisc_pkt_len(skb);
|
||||||
if (gact->current_entry_octets > gact->current_max_octets) {
|
if (gact->current_entry_octets > gact->current_max_octets) {
|
||||||
gact->tcf_qstats.overlimits++;
|
spin_unlock(&gact->tcf_lock);
|
||||||
goto drop;
|
goto overlimit;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
spin_unlock(&gact->tcf_lock);
|
spin_unlock(&gact->tcf_lock);
|
||||||
|
|
||||||
return gact->tcf_action;
|
return action;
|
||||||
|
|
||||||
|
overlimit:
|
||||||
|
tcf_action_inc_overlimit_qstats(&gact->common);
|
||||||
drop:
|
drop:
|
||||||
gact->tcf_qstats.drops++;
|
tcf_action_inc_drop_qstats(&gact->common);
|
||||||
spin_unlock(&gact->tcf_lock);
|
|
||||||
|
|
||||||
return TC_ACT_SHOT;
|
return TC_ACT_SHOT;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -357,8 +359,8 @@ static int tcf_gate_init(struct net *net, struct nlattr *nla,
|
|||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (!err) {
|
if (!err) {
|
||||||
ret = tcf_idr_create(tn, index, est, a,
|
ret = tcf_idr_create_from_flags(tn, index, est, a,
|
||||||
&act_gate_ops, bind, false, flags);
|
&act_gate_ops, bind, flags);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
tcf_idr_cleanup(tn, index);
|
tcf_idr_cleanup(tn, index);
|
||||||
return ret;
|
return ret;
|
||||||
|
Loading…
Reference in New Issue
Block a user