]> git.baikalelectronics.ru Git - kernel.git/commitdiff
net: sched: use tc_cls_bind_class() in filter
authorZhengchao Shao <shaozhengchao@huawei.com>
Tue, 27 Sep 2022 12:48:55 +0000 (20:48 +0800)
committerDavid S. Miller <davem@davemloft.net>
Sun, 2 Oct 2022 15:07:17 +0000 (16:07 +0100)
Use tc_cls_bind_class() in filter.

Signed-off-by: Zhengchao Shao <shaozhengchao@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/sched/cls_basic.c
net/sched/cls_bpf.c
net/sched/cls_flower.c
net/sched/cls_fw.c
net/sched/cls_matchall.c
net/sched/cls_route.c
net/sched/cls_rsvp.h
net/sched/cls_tcindex.c
net/sched/cls_u32.c

index d9fbaa0fbe8b4ae5c9214e23b757f19933d2ef13..d229ce99e55487f396501a5d56ac98e8d58c99d9 100644 (file)
@@ -261,12 +261,7 @@ static void basic_bind_class(void *fh, u32 classid, unsigned long cl, void *q,
 {
        struct basic_filter *f = fh;
 
-       if (f && f->res.classid == classid) {
-               if (cl)
-                       __tcf_bind_filter(q, &f->res, base);
-               else
-                       __tcf_unbind_filter(q, &f->res);
-       }
+       tc_cls_bind_class(classid, cl, q, &f->res, base);
 }
 
 static int basic_dump(struct net *net, struct tcf_proto *tp, void *fh,
index 938be14cfa3f104846ee52c0694c5dcfa95e2174..bc317b3eac124b2df292bdb61f7a2dc39ef11d51 100644 (file)
@@ -635,12 +635,7 @@ static void cls_bpf_bind_class(void *fh, u32 classid, unsigned long cl,
 {
        struct cls_bpf_prog *prog = fh;
 
-       if (prog && prog->res.classid == classid) {
-               if (cl)
-                       __tcf_bind_filter(q, &prog->res, base);
-               else
-                       __tcf_unbind_filter(q, &prog->res);
-       }
+       tc_cls_bind_class(classid, cl, q, &prog->res, base);
 }
 
 static void cls_bpf_walk(struct tcf_proto *tp, struct tcf_walker *arg,
index 22d32b82bc0940c569a95a05e845a0e20b2f5091..25bc57ee6ea1097c1a7a77703c389ab8294755af 100644 (file)
@@ -3405,12 +3405,7 @@ static void fl_bind_class(void *fh, u32 classid, unsigned long cl, void *q,
 {
        struct cls_fl_filter *f = fh;
 
-       if (f && f->res.classid == classid) {
-               if (cl)
-                       __tcf_bind_filter(q, &f->res, base);
-               else
-                       __tcf_unbind_filter(q, &f->res);
-       }
+       tc_cls_bind_class(classid, cl, q, &f->res, base);
 }
 
 static bool fl_delete_empty(struct tcf_proto *tp)
index fa66191574a4b724807092369ac514c21f021662..a32351da968cd7cb6fea11daf491af314093e07b 100644 (file)
@@ -416,12 +416,7 @@ static void fw_bind_class(void *fh, u32 classid, unsigned long cl, void *q,
 {
        struct fw_filter *f = fh;
 
-       if (f && f->res.classid == classid) {
-               if (cl)
-                       __tcf_bind_filter(q, &f->res, base);
-               else
-                       __tcf_unbind_filter(q, &f->res);
-       }
+       tc_cls_bind_class(classid, cl, q, &f->res, base);
 }
 
 static struct tcf_proto_ops cls_fw_ops __read_mostly = {
index 63b99ffb7dbcaf13176ea44f7eee230ad34b1687..39a5d9c170def16d7133930d30bf23125915269e 100644 (file)
@@ -394,12 +394,7 @@ static void mall_bind_class(void *fh, u32 classid, unsigned long cl, void *q,
 {
        struct cls_mall_head *head = fh;
 
-       if (head && head->res.classid == classid) {
-               if (cl)
-                       __tcf_bind_filter(q, &head->res, base);
-               else
-                       __tcf_unbind_filter(q, &head->res);
-       }
+       tc_cls_bind_class(classid, cl, q, &head->res, base);
 }
 
 static struct tcf_proto_ops cls_mall_ops __read_mostly = {
index 17bb04af2fa845dbf63e5283f30dc5a9d1276b8f..9e43b929d4ca4e42a960315f143f4023f8b454d6 100644 (file)
@@ -649,12 +649,7 @@ static void route4_bind_class(void *fh, u32 classid, unsigned long cl, void *q,
 {
        struct route4_filter *f = fh;
 
-       if (f && f->res.classid == classid) {
-               if (cl)
-                       __tcf_bind_filter(q, &f->res, base);
-               else
-                       __tcf_unbind_filter(q, &f->res);
-       }
+       tc_cls_bind_class(classid, cl, q, &f->res, base);
 }
 
 static struct tcf_proto_ops cls_route4_ops __read_mostly = {
index fb60f2c2c3252e941d4e9aa5b4123c6e4eded0d4..b00a7dbd0587403b16624aa05b6d8bafacbe4b7f 100644 (file)
@@ -733,12 +733,7 @@ static void rsvp_bind_class(void *fh, u32 classid, unsigned long cl, void *q,
 {
        struct rsvp_filter *f = fh;
 
-       if (f && f->res.classid == classid) {
-               if (cl)
-                       __tcf_bind_filter(q, &f->res, base);
-               else
-                       __tcf_unbind_filter(q, &f->res);
-       }
+       tc_cls_bind_class(classid, cl, q, &f->res, base);
 }
 
 static struct tcf_proto_ops RSVP_OPS __read_mostly = {
index a330760334621dd82a1a0a907c3c4d7dd244e4ca..1c9eeb98d826e42bc2ff2f169a36a04dac517b9d 100644 (file)
@@ -691,12 +691,7 @@ static void tcindex_bind_class(void *fh, u32 classid, unsigned long cl,
 {
        struct tcindex_filter_result *r = fh;
 
-       if (r && r->res.classid == classid) {
-               if (cl)
-                       __tcf_bind_filter(q, &r->res, base);
-               else
-                       __tcf_unbind_filter(q, &r->res);
-       }
+       tc_cls_bind_class(classid, cl, q, &r->res, base);
 }
 
 static struct tcf_proto_ops cls_tcindex_ops __read_mostly = {
index 0b3d909214b8dca022bbe92aee3668ee63891149..34d25f7a0687a7f24f49554e7187a62ae8945781 100644 (file)
@@ -1250,12 +1250,7 @@ static void u32_bind_class(void *fh, u32 classid, unsigned long cl, void *q,
 {
        struct tc_u_knode *n = fh;
 
-       if (n && n->res.classid == classid) {
-               if (cl)
-                       __tcf_bind_filter(q, &n->res, base);
-               else
-                       __tcf_unbind_filter(q, &n->res);
-       }
+       tc_cls_bind_class(classid, cl, q, &n->res, base);
 }
 
 static int u32_dump(struct net *net, struct tcf_proto *tp, void *fh,