forked from Minki/linux
net/sched: use tc_qdisc_stats_dump() in qdisc
use tc_qdisc_stats_dump() in qdisc. Signed-off-by: Zhengchao Shao <shaozhengchao@huawei.com> Reviewed-by: Victor Nogueira <victor@mojatatu.com> Tested-by: Victor Nogueira <victor@mojatatu.com> Acked-by: Toke Høiland-Jørgensen <toke@redhat.com> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
parent
d7a68e564e
commit
e046fa895c
@ -354,12 +354,8 @@ static void atm_tc_walk(struct Qdisc *sch, struct qdisc_walker *walker)
|
|||||||
if (walker->stop)
|
if (walker->stop)
|
||||||
return;
|
return;
|
||||||
list_for_each_entry(flow, &p->flows, list) {
|
list_for_each_entry(flow, &p->flows, list) {
|
||||||
if (walker->count >= walker->skip &&
|
if (!tc_qdisc_stats_dump(sch, (unsigned long)flow, walker))
|
||||||
walker->fn(sch, (unsigned long)flow, walker) < 0) {
|
|
||||||
walker->stop = 1;
|
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
walker->count++;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3061,16 +3061,13 @@ static void cake_walk(struct Qdisc *sch, struct qdisc_walker *arg)
|
|||||||
struct cake_tin_data *b = &q->tins[q->tin_order[i]];
|
struct cake_tin_data *b = &q->tins[q->tin_order[i]];
|
||||||
|
|
||||||
for (j = 0; j < CAKE_QUEUES; j++) {
|
for (j = 0; j < CAKE_QUEUES; j++) {
|
||||||
if (list_empty(&b->flows[j].flowchain) ||
|
if (list_empty(&b->flows[j].flowchain)) {
|
||||||
arg->count < arg->skip) {
|
|
||||||
arg->count++;
|
arg->count++;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (arg->fn(sch, i * CAKE_QUEUES + j + 1, arg) < 0) {
|
if (!tc_qdisc_stats_dump(sch, i * CAKE_QUEUES + j + 1,
|
||||||
arg->stop = 1;
|
arg))
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
arg->count++;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1676,15 +1676,8 @@ static void cbq_walk(struct Qdisc *sch, struct qdisc_walker *arg)
|
|||||||
|
|
||||||
for (h = 0; h < q->clhash.hashsize; h++) {
|
for (h = 0; h < q->clhash.hashsize; h++) {
|
||||||
hlist_for_each_entry(cl, &q->clhash.hash[h], common.hnode) {
|
hlist_for_each_entry(cl, &q->clhash.hash[h], common.hnode) {
|
||||||
if (arg->count < arg->skip) {
|
if (!tc_qdisc_stats_dump(sch, (unsigned long)cl, arg))
|
||||||
arg->count++;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (arg->fn(sch, (unsigned long)cl, arg) < 0) {
|
|
||||||
arg->stop = 1;
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
arg->count++;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -520,13 +520,7 @@ static unsigned long cbs_find(struct Qdisc *sch, u32 classid)
|
|||||||
static void cbs_walk(struct Qdisc *sch, struct qdisc_walker *walker)
|
static void cbs_walk(struct Qdisc *sch, struct qdisc_walker *walker)
|
||||||
{
|
{
|
||||||
if (!walker->stop) {
|
if (!walker->stop) {
|
||||||
if (walker->count >= walker->skip) {
|
tc_qdisc_stats_dump(sch, 1, walker);
|
||||||
if (walker->fn(sch, 1, walker) < 0) {
|
|
||||||
walker->stop = 1;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
walker->count++;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -284,15 +284,8 @@ static void drr_walk(struct Qdisc *sch, struct qdisc_walker *arg)
|
|||||||
|
|
||||||
for (i = 0; i < q->clhash.hashsize; i++) {
|
for (i = 0; i < q->clhash.hashsize; i++) {
|
||||||
hlist_for_each_entry(cl, &q->clhash.hash[i], common.hnode) {
|
hlist_for_each_entry(cl, &q->clhash.hash[i], common.hnode) {
|
||||||
if (arg->count < arg->skip) {
|
if (!tc_qdisc_stats_dump(sch, (unsigned long)cl, arg))
|
||||||
arg->count++;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (arg->fn(sch, (unsigned long)cl, arg) < 0) {
|
|
||||||
arg->stop = 1;
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
arg->count++;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -176,16 +176,12 @@ static void dsmark_walk(struct Qdisc *sch, struct qdisc_walker *walker)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
for (i = 0; i < p->indices; i++) {
|
for (i = 0; i < p->indices; i++) {
|
||||||
if (p->mv[i].mask == 0xff && !p->mv[i].value)
|
if (p->mv[i].mask == 0xff && !p->mv[i].value) {
|
||||||
goto ignore;
|
walker->count++;
|
||||||
if (walker->count >= walker->skip) {
|
continue;
|
||||||
if (walker->fn(sch, i + 1, walker) < 0) {
|
|
||||||
walker->stop = 1;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
ignore:
|
if (!tc_qdisc_stats_dump(sch, i + 1, walker))
|
||||||
walker->count++;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -341,15 +341,8 @@ static void ets_qdisc_walk(struct Qdisc *sch, struct qdisc_walker *arg)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
for (i = 0; i < q->nbands; i++) {
|
for (i = 0; i < q->nbands; i++) {
|
||||||
if (arg->count < arg->skip) {
|
if (!tc_qdisc_stats_dump(sch, i + 1, arg))
|
||||||
arg->count++;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (arg->fn(sch, i + 1, arg) < 0) {
|
|
||||||
arg->stop = 1;
|
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
arg->count++;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -673,16 +673,12 @@ static void fq_codel_walk(struct Qdisc *sch, struct qdisc_walker *arg)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
for (i = 0; i < q->flows_cnt; i++) {
|
for (i = 0; i < q->flows_cnt; i++) {
|
||||||
if (list_empty(&q->flows[i].flowchain) ||
|
if (list_empty(&q->flows[i].flowchain)) {
|
||||||
arg->count < arg->skip) {
|
|
||||||
arg->count++;
|
arg->count++;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (arg->fn(sch, i + 1, arg) < 0) {
|
if (!tc_qdisc_stats_dump(sch, i + 1, arg))
|
||||||
arg->stop = 1;
|
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
arg->count++;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1349,15 +1349,8 @@ hfsc_walk(struct Qdisc *sch, struct qdisc_walker *arg)
|
|||||||
for (i = 0; i < q->clhash.hashsize; i++) {
|
for (i = 0; i < q->clhash.hashsize; i++) {
|
||||||
hlist_for_each_entry(cl, &q->clhash.hash[i],
|
hlist_for_each_entry(cl, &q->clhash.hash[i],
|
||||||
cl_common.hnode) {
|
cl_common.hnode) {
|
||||||
if (arg->count < arg->skip) {
|
if (!tc_qdisc_stats_dump(sch, (unsigned long)cl, arg))
|
||||||
arg->count++;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (arg->fn(sch, (unsigned long)cl, arg) < 0) {
|
|
||||||
arg->stop = 1;
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
arg->count++;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2119,15 +2119,8 @@ static void htb_walk(struct Qdisc *sch, struct qdisc_walker *arg)
|
|||||||
|
|
||||||
for (i = 0; i < q->clhash.hashsize; i++) {
|
for (i = 0; i < q->clhash.hashsize; i++) {
|
||||||
hlist_for_each_entry(cl, &q->clhash.hash[i], common.hnode) {
|
hlist_for_each_entry(cl, &q->clhash.hash[i], common.hnode) {
|
||||||
if (arg->count < arg->skip) {
|
if (!tc_qdisc_stats_dump(sch, (unsigned long)cl, arg))
|
||||||
arg->count++;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (arg->fn(sch, (unsigned long)cl, arg) < 0) {
|
|
||||||
arg->stop = 1;
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
arg->count++;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -247,11 +247,8 @@ static void mq_walk(struct Qdisc *sch, struct qdisc_walker *arg)
|
|||||||
|
|
||||||
arg->count = arg->skip;
|
arg->count = arg->skip;
|
||||||
for (ntx = arg->skip; ntx < dev->num_tx_queues; ntx++) {
|
for (ntx = arg->skip; ntx < dev->num_tx_queues; ntx++) {
|
||||||
if (arg->fn(sch, ntx + 1, arg) < 0) {
|
if (!tc_qdisc_stats_dump(sch, ntx + 1, arg))
|
||||||
arg->stop = 1;
|
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
arg->count++;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -558,11 +558,8 @@ static void mqprio_walk(struct Qdisc *sch, struct qdisc_walker *arg)
|
|||||||
/* Walk hierarchy with a virtual class per tc */
|
/* Walk hierarchy with a virtual class per tc */
|
||||||
arg->count = arg->skip;
|
arg->count = arg->skip;
|
||||||
for (ntx = arg->skip; ntx < netdev_get_num_tc(dev); ntx++) {
|
for (ntx = arg->skip; ntx < netdev_get_num_tc(dev); ntx++) {
|
||||||
if (arg->fn(sch, ntx + TC_H_MIN_PRIORITY, arg) < 0) {
|
if (!tc_qdisc_stats_dump(sch, ntx + TC_H_MIN_PRIORITY, arg))
|
||||||
arg->stop = 1;
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
arg->count++;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Pad the values and skip over unused traffic classes */
|
/* Pad the values and skip over unused traffic classes */
|
||||||
|
@ -353,15 +353,8 @@ static void multiq_walk(struct Qdisc *sch, struct qdisc_walker *arg)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
for (band = 0; band < q->bands; band++) {
|
for (band = 0; band < q->bands; band++) {
|
||||||
if (arg->count < arg->skip) {
|
if (!tc_qdisc_stats_dump(sch, band + 1, arg))
|
||||||
arg->count++;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (arg->fn(sch, band + 1, arg) < 0) {
|
|
||||||
arg->stop = 1;
|
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
arg->count++;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1251,12 +1251,8 @@ static unsigned long netem_find(struct Qdisc *sch, u32 classid)
|
|||||||
static void netem_walk(struct Qdisc *sch, struct qdisc_walker *walker)
|
static void netem_walk(struct Qdisc *sch, struct qdisc_walker *walker)
|
||||||
{
|
{
|
||||||
if (!walker->stop) {
|
if (!walker->stop) {
|
||||||
if (walker->count >= walker->skip)
|
if (!tc_qdisc_stats_dump(sch, 1, walker))
|
||||||
if (walker->fn(sch, 1, walker) < 0) {
|
return;
|
||||||
walker->stop = 1;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
walker->count++;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -376,15 +376,8 @@ static void prio_walk(struct Qdisc *sch, struct qdisc_walker *arg)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
for (prio = 0; prio < q->bands; prio++) {
|
for (prio = 0; prio < q->bands; prio++) {
|
||||||
if (arg->count < arg->skip) {
|
if (!tc_qdisc_stats_dump(sch, prio + 1, arg))
|
||||||
arg->count++;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (arg->fn(sch, prio + 1, arg) < 0) {
|
|
||||||
arg->stop = 1;
|
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
arg->count++;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -659,15 +659,8 @@ static void qfq_walk(struct Qdisc *sch, struct qdisc_walker *arg)
|
|||||||
|
|
||||||
for (i = 0; i < q->clhash.hashsize; i++) {
|
for (i = 0; i < q->clhash.hashsize; i++) {
|
||||||
hlist_for_each_entry(cl, &q->clhash.hash[i], common.hnode) {
|
hlist_for_each_entry(cl, &q->clhash.hash[i], common.hnode) {
|
||||||
if (arg->count < arg->skip) {
|
if (!tc_qdisc_stats_dump(sch, (unsigned long)cl, arg))
|
||||||
arg->count++;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (arg->fn(sch, (unsigned long)cl, arg) < 0) {
|
|
||||||
arg->stop = 1;
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
arg->count++;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -516,12 +516,7 @@ static unsigned long red_find(struct Qdisc *sch, u32 classid)
|
|||||||
static void red_walk(struct Qdisc *sch, struct qdisc_walker *walker)
|
static void red_walk(struct Qdisc *sch, struct qdisc_walker *walker)
|
||||||
{
|
{
|
||||||
if (!walker->stop) {
|
if (!walker->stop) {
|
||||||
if (walker->count >= walker->skip)
|
tc_qdisc_stats_dump(sch, 1, walker);
|
||||||
if (walker->fn(sch, 1, walker) < 0) {
|
|
||||||
walker->stop = 1;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
walker->count++;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -659,12 +659,7 @@ static int sfb_delete(struct Qdisc *sch, unsigned long cl,
|
|||||||
static void sfb_walk(struct Qdisc *sch, struct qdisc_walker *walker)
|
static void sfb_walk(struct Qdisc *sch, struct qdisc_walker *walker)
|
||||||
{
|
{
|
||||||
if (!walker->stop) {
|
if (!walker->stop) {
|
||||||
if (walker->count >= walker->skip)
|
tc_qdisc_stats_dump(sch, 1, walker);
|
||||||
if (walker->fn(sch, 1, walker) < 0) {
|
|
||||||
walker->stop = 1;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
walker->count++;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -888,16 +888,12 @@ static void sfq_walk(struct Qdisc *sch, struct qdisc_walker *arg)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
for (i = 0; i < q->divisor; i++) {
|
for (i = 0; i < q->divisor; i++) {
|
||||||
if (q->ht[i] == SFQ_EMPTY_SLOT ||
|
if (q->ht[i] == SFQ_EMPTY_SLOT) {
|
||||||
arg->count < arg->skip) {
|
|
||||||
arg->count++;
|
arg->count++;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (arg->fn(sch, i + 1, arg) < 0) {
|
if (!tc_qdisc_stats_dump(sch, i + 1, arg))
|
||||||
arg->stop = 1;
|
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
arg->count++;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -265,15 +265,8 @@ static void skbprio_walk(struct Qdisc *sch, struct qdisc_walker *arg)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
for (i = 0; i < SKBPRIO_MAX_PRIORITY; i++) {
|
for (i = 0; i < SKBPRIO_MAX_PRIORITY; i++) {
|
||||||
if (arg->count < arg->skip) {
|
if (!tc_qdisc_stats_dump(sch, i + 1, arg))
|
||||||
arg->count++;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (arg->fn(sch, i + 1, arg) < 0) {
|
|
||||||
arg->stop = 1;
|
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
arg->count++;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1953,11 +1953,8 @@ static void taprio_walk(struct Qdisc *sch, struct qdisc_walker *arg)
|
|||||||
|
|
||||||
arg->count = arg->skip;
|
arg->count = arg->skip;
|
||||||
for (ntx = arg->skip; ntx < dev->num_tx_queues; ntx++) {
|
for (ntx = arg->skip; ntx < dev->num_tx_queues; ntx++) {
|
||||||
if (arg->fn(sch, ntx + 1, arg) < 0) {
|
if (!tc_qdisc_stats_dump(sch, ntx + 1, arg))
|
||||||
arg->stop = 1;
|
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
arg->count++;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -580,12 +580,7 @@ static unsigned long tbf_find(struct Qdisc *sch, u32 classid)
|
|||||||
static void tbf_walk(struct Qdisc *sch, struct qdisc_walker *walker)
|
static void tbf_walk(struct Qdisc *sch, struct qdisc_walker *walker)
|
||||||
{
|
{
|
||||||
if (!walker->stop) {
|
if (!walker->stop) {
|
||||||
if (walker->count >= walker->skip)
|
tc_qdisc_stats_dump(sch, 1, walker);
|
||||||
if (walker->fn(sch, 1, walker) < 0) {
|
|
||||||
walker->stop = 1;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
walker->count++;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user