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,16 +251,9 @@ static void basic_walk(struct tcf_proto *tp, struct tcf_walker *arg,
struct basic_filter *f;
list_for_each_entry(f, &head->flist, link) {
if (arg->count < arg->skip)
goto skip;
if (arg->fn(tp, f, arg) < 0) {
arg->stop = 1;
if (!tc_cls_stats_dump(tp, arg, f))
break;
}
skip:
arg->count++;
}
}
static void basic_bind_class(void *fh, u32 classid, unsigned long cl, void *q,
......
......@@ -650,15 +650,9 @@ static void cls_bpf_walk(struct tcf_proto *tp, struct tcf_walker *arg,
struct cls_bpf_prog *prog;
list_for_each_entry(prog, &head->plist, link) {
if (arg->count < arg->skip)
goto skip;
if (arg->fn(tp, prog, arg) < 0) {
arg->stop = 1;
if (!tc_cls_stats_dump(tp, arg, prog))
break;
}
skip:
arg->count++;
}
}
static int cls_bpf_reoffload(struct tcf_proto *tp, bool add, flow_setup_cb_t *cb,
......
......@@ -683,15 +683,9 @@ static void flow_walk(struct tcf_proto *tp, struct tcf_walker *arg,
struct flow_filter *f;
list_for_each_entry(f, &head->filters, list) {
if (arg->count < arg->skip)
goto skip;
if (arg->fn(tp, f, arg) < 0) {
arg->stop = 1;
if (!tc_cls_stats_dump(tp, arg, f))
break;
}
skip:
arg->count++;
}
}
static struct tcf_proto_ops cls_flow_ops __read_mostly = {
......
......@@ -358,16 +358,9 @@ static void fw_walk(struct tcf_proto *tp, struct tcf_walker *arg,
for (f = rtnl_dereference(head->ht[h]); f;
f = rtnl_dereference(f->next)) {
if (arg->count < arg->skip) {
arg->count++;
continue;
}
if (arg->fn(tp, f, arg) < 0) {
arg->stop = 1;
if (!tc_cls_stats_dump(tp, arg, f))
return;
}
arg->count++;
}
}
}
......
......@@ -587,16 +587,9 @@ static void route4_walk(struct tcf_proto *tp, struct tcf_walker *arg,
for (f = rtnl_dereference(b->ht[h1]);
f;
f = rtnl_dereference(f->next)) {
if (arg->count < arg->skip) {
arg->count++;
continue;
}
if (arg->fn(tp, f, arg) < 0) {
arg->stop = 1;
if (!tc_cls_stats_dump(tp, arg, f))
return;
}
arg->count++;
}
}
}
}
......
......@@ -671,16 +671,9 @@ static void rsvp_walk(struct tcf_proto *tp, struct tcf_walker *arg,
for (f = rtnl_dereference(s->ht[h1]); f;
f = rtnl_dereference(f->next)) {
if (arg->count < arg->skip) {
arg->count++;
continue;
}
if (arg->fn(tp, f, arg) < 0) {
arg->stop = 1;
if (!tc_cls_stats_dump(tp, arg, f))
return;
}
arg->count++;
}
}
}
}
......
......@@ -566,29 +566,19 @@ static void tcindex_walk(struct tcf_proto *tp, struct tcf_walker *walker,
for (i = 0; i < p->hash; i++) {
if (!p->perfect[i].res.class)
continue;
if (walker->count >= walker->skip) {
if (walker->fn(tp, p->perfect + i, walker) < 0) {
walker->stop = 1;
if (!tc_cls_stats_dump(tp, walker, p->perfect + i))
return;
}
}
walker->count++;
}
}
if (!p->h)
return;
for (i = 0; i < p->hash; i++) {
for (f = rtnl_dereference(p->h[i]); f; f = next) {
next = rtnl_dereference(f->next);
if (walker->count >= walker->skip) {
if (walker->fn(tp, &f->result, walker) < 0) {
walker->stop = 1;
if (!tc_cls_stats_dump(tp, walker, &f->result))
return;
}
}
walker->count++;
}
}
}
static void tcindex_destroy(struct tcf_proto *tp, bool rtnl_held,
......
......@@ -1125,27 +1125,17 @@ static void u32_walk(struct tcf_proto *tp, struct tcf_walker *arg,
ht = rtnl_dereference(ht->next)) {
if (ht->prio != tp->prio)
continue;
if (arg->count >= arg->skip) {
if (arg->fn(tp, ht, arg) < 0) {
arg->stop = 1;
if (!tc_cls_stats_dump(tp, arg, ht))
return;
}
}
arg->count++;
for (h = 0; h <= ht->divisor; h++) {
for (n = rtnl_dereference(ht->ht[h]);
n;
n = rtnl_dereference(n->next)) {
if (arg->count < arg->skip) {
arg->count++;
continue;
}
if (arg->fn(tp, n, arg) < 0) {
arg->stop = 1;
if (!tc_cls_stats_dump(tp, arg, n))
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