net: sched: implement qstat helper routines
This adds helpers to manipulate qstats logic and replaces locations that touch the counters directly. This simplifies future patches to push qstats onto per cpu counters. Signed-off-by: John Fastabend <john.r.fastabend@intel.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:

committed by
David S. Miller

parent
22e0f8b932
commit
25331d6ce4
@@ -175,7 +175,7 @@ static int tbf_segment(struct sk_buff *skb, struct Qdisc *sch)
|
||||
ret = qdisc_enqueue(segs, q->qdisc);
|
||||
if (ret != NET_XMIT_SUCCESS) {
|
||||
if (net_xmit_drop_count(ret))
|
||||
sch->qstats.drops++;
|
||||
qdisc_qstats_drop(sch);
|
||||
} else {
|
||||
nb++;
|
||||
}
|
||||
@@ -201,7 +201,7 @@ static int tbf_enqueue(struct sk_buff *skb, struct Qdisc *sch)
|
||||
ret = qdisc_enqueue(skb, q->qdisc);
|
||||
if (ret != NET_XMIT_SUCCESS) {
|
||||
if (net_xmit_drop_count(ret))
|
||||
sch->qstats.drops++;
|
||||
qdisc_qstats_drop(sch);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -216,7 +216,7 @@ static unsigned int tbf_drop(struct Qdisc *sch)
|
||||
|
||||
if (q->qdisc->ops->drop && (len = q->qdisc->ops->drop(q->qdisc)) != 0) {
|
||||
sch->q.qlen--;
|
||||
sch->qstats.drops++;
|
||||
qdisc_qstats_drop(sch);
|
||||
}
|
||||
return len;
|
||||
}
|
||||
@@ -281,7 +281,7 @@ static struct sk_buff *tbf_dequeue(struct Qdisc *sch)
|
||||
(cf. CSZ, HPFQ, HFSC)
|
||||
*/
|
||||
|
||||
sch->qstats.overlimits++;
|
||||
qdisc_qstats_overlimit(sch);
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
Reference in New Issue
Block a user