Commit 5508ff7c authored by Zhengchao Shao's avatar Zhengchao Shao Committed by Jakub Kicinski

net/sched: use tc_cls_stats_dump() in filter

use tc_cls_stats_dump() in filter.
Signed-off-by: default avatarZhengchao Shao <shaozhengchao@huawei.com>
Reviewed-by: default avatarJamal Hadi Salim <jhs@mojatatu.com>
Reviewed-by: default avatarVictor Nogueira <victor@mojatatu.com>
Tested-by: default avatarVictor Nogueira <victor@mojatatu.com>
Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent fe0df81d
...@@ -251,15 +251,8 @@ static void basic_walk(struct tcf_proto *tp, struct tcf_walker *arg, ...@@ -251,15 +251,8 @@ static void basic_walk(struct tcf_proto *tp, struct tcf_walker *arg,
struct basic_filter *f; struct basic_filter *f;
list_for_each_entry(f, &head->flist, link) { list_for_each_entry(f, &head->flist, link) {
if (arg->count < arg->skip) if (!tc_cls_stats_dump(tp, arg, f))
goto skip;
if (arg->fn(tp, f, arg) < 0) {
arg->stop = 1;
break; break;
}
skip:
arg->count++;
} }
} }
......
...@@ -650,14 +650,8 @@ static void cls_bpf_walk(struct tcf_proto *tp, struct tcf_walker *arg, ...@@ -650,14 +650,8 @@ static void cls_bpf_walk(struct tcf_proto *tp, struct tcf_walker *arg,
struct cls_bpf_prog *prog; struct cls_bpf_prog *prog;
list_for_each_entry(prog, &head->plist, link) { list_for_each_entry(prog, &head->plist, link) {
if (arg->count < arg->skip) if (!tc_cls_stats_dump(tp, arg, prog))
goto skip;
if (arg->fn(tp, prog, arg) < 0) {
arg->stop = 1;
break; break;
}
skip:
arg->count++;
} }
} }
......
...@@ -683,14 +683,8 @@ static void flow_walk(struct tcf_proto *tp, struct tcf_walker *arg, ...@@ -683,14 +683,8 @@ static void flow_walk(struct tcf_proto *tp, struct tcf_walker *arg,
struct flow_filter *f; struct flow_filter *f;
list_for_each_entry(f, &head->filters, list) { list_for_each_entry(f, &head->filters, list) {
if (arg->count < arg->skip) if (!tc_cls_stats_dump(tp, arg, f))
goto skip;
if (arg->fn(tp, f, arg) < 0) {
arg->stop = 1;
break; break;
}
skip:
arg->count++;
} }
} }
......
...@@ -358,15 +358,8 @@ static void fw_walk(struct tcf_proto *tp, struct tcf_walker *arg, ...@@ -358,15 +358,8 @@ static void fw_walk(struct tcf_proto *tp, struct tcf_walker *arg,
for (f = rtnl_dereference(head->ht[h]); f; for (f = rtnl_dereference(head->ht[h]); f;
f = rtnl_dereference(f->next)) { f = rtnl_dereference(f->next)) {
if (arg->count < arg->skip) { if (!tc_cls_stats_dump(tp, arg, f))
arg->count++;
continue;
}
if (arg->fn(tp, f, arg) < 0) {
arg->stop = 1;
return; return;
}
arg->count++;
} }
} }
} }
......
...@@ -587,15 +587,8 @@ static void route4_walk(struct tcf_proto *tp, struct tcf_walker *arg, ...@@ -587,15 +587,8 @@ static void route4_walk(struct tcf_proto *tp, struct tcf_walker *arg,
for (f = rtnl_dereference(b->ht[h1]); for (f = rtnl_dereference(b->ht[h1]);
f; f;
f = rtnl_dereference(f->next)) { f = rtnl_dereference(f->next)) {
if (arg->count < arg->skip) { if (!tc_cls_stats_dump(tp, arg, f))
arg->count++;
continue;
}
if (arg->fn(tp, f, arg) < 0) {
arg->stop = 1;
return; return;
}
arg->count++;
} }
} }
} }
......
...@@ -671,15 +671,8 @@ static void rsvp_walk(struct tcf_proto *tp, struct tcf_walker *arg, ...@@ -671,15 +671,8 @@ static void rsvp_walk(struct tcf_proto *tp, struct tcf_walker *arg,
for (f = rtnl_dereference(s->ht[h1]); f; for (f = rtnl_dereference(s->ht[h1]); f;
f = rtnl_dereference(f->next)) { f = rtnl_dereference(f->next)) {
if (arg->count < arg->skip) { if (!tc_cls_stats_dump(tp, arg, f))
arg->count++;
continue;
}
if (arg->fn(tp, f, arg) < 0) {
arg->stop = 1;
return; return;
}
arg->count++;
} }
} }
} }
......
...@@ -566,13 +566,8 @@ static void tcindex_walk(struct tcf_proto *tp, struct tcf_walker *walker, ...@@ -566,13 +566,8 @@ static void tcindex_walk(struct tcf_proto *tp, struct tcf_walker *walker,
for (i = 0; i < p->hash; i++) { for (i = 0; i < p->hash; i++) {
if (!p->perfect[i].res.class) if (!p->perfect[i].res.class)
continue; continue;
if (walker->count >= walker->skip) { if (!tc_cls_stats_dump(tp, walker, p->perfect + i))
if (walker->fn(tp, p->perfect + i, walker) < 0) { return;
walker->stop = 1;
return;
}
}
walker->count++;
} }
} }
if (!p->h) if (!p->h)
...@@ -580,13 +575,8 @@ static void tcindex_walk(struct tcf_proto *tp, struct tcf_walker *walker, ...@@ -580,13 +575,8 @@ static void tcindex_walk(struct tcf_proto *tp, struct tcf_walker *walker,
for (i = 0; i < p->hash; i++) { for (i = 0; i < p->hash; i++) {
for (f = rtnl_dereference(p->h[i]); f; f = next) { for (f = rtnl_dereference(p->h[i]); f; f = next) {
next = rtnl_dereference(f->next); next = rtnl_dereference(f->next);
if (walker->count >= walker->skip) { if (!tc_cls_stats_dump(tp, walker, &f->result))
if (walker->fn(tp, &f->result, walker) < 0) { return;
walker->stop = 1;
return;
}
}
walker->count++;
} }
} }
} }
......
...@@ -1125,26 +1125,16 @@ static void u32_walk(struct tcf_proto *tp, struct tcf_walker *arg, ...@@ -1125,26 +1125,16 @@ static void u32_walk(struct tcf_proto *tp, struct tcf_walker *arg,
ht = rtnl_dereference(ht->next)) { ht = rtnl_dereference(ht->next)) {
if (ht->prio != tp->prio) if (ht->prio != tp->prio)
continue; continue;
if (arg->count >= arg->skip) {
if (arg->fn(tp, ht, arg) < 0) { if (!tc_cls_stats_dump(tp, arg, ht))
arg->stop = 1; return;
return;
}
}
arg->count++;
for (h = 0; h <= ht->divisor; h++) { for (h = 0; h <= ht->divisor; h++) {
for (n = rtnl_dereference(ht->ht[h]); for (n = rtnl_dereference(ht->ht[h]);
n; n;
n = rtnl_dereference(n->next)) { n = rtnl_dereference(n->next)) {
if (arg->count < arg->skip) { if (!tc_cls_stats_dump(tp, arg, n))
arg->count++;
continue;
}
if (arg->fn(tp, n, arg) < 0) {
arg->stop = 1;
return; return;
}
arg->count++;
} }
} }
} }
......
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