]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commitdiff
net: sched: move tc_classify function to cls_api.c
authorJiri Pirko <jiri@mellanox.com>
Wed, 17 May 2017 09:07:54 +0000 (11:07 +0200)
committerDavid S. Miller <davem@davemloft.net>
Wed, 17 May 2017 19:22:13 +0000 (15:22 -0400)
Move tc_classify function to cls_api.c where it belongs, rename it to
fit the namespace.

Signed-off-by: Jiri Pirko <jiri@mellanox.com>
Acked-by: Jamal Hadi Salim <jhs@mojatatu.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
17 files changed:
include/net/pkt_cls.h
include/net/pkt_sched.h
net/core/dev.c
net/sched/cls_api.c
net/sched/sch_api.c
net/sched/sch_atm.c
net/sched/sch_cbq.c
net/sched/sch_drr.c
net/sched/sch_dsmark.c
net/sched/sch_fq_codel.c
net/sched/sch_hfsc.c
net/sched/sch_htb.c
net/sched/sch_multiq.c
net/sched/sch_prio.c
net/sched/sch_qfq.c
net/sched/sch_sfb.c
net/sched/sch_sfq.c

index 269fd78bb0ae0a88b2affa858a75bd646322a9fc..cb745067feb3971cec135c462225b932cd8fbd72 100644 (file)
@@ -19,10 +19,19 @@ int unregister_tcf_proto_ops(struct tcf_proto_ops *ops);
 
 #ifdef CONFIG_NET_CLS
 void tcf_destroy_chain(struct tcf_proto __rcu **fl);
+int tcf_classify(struct sk_buff *skb, const struct tcf_proto *tp,
+                struct tcf_result *res, bool compat_mode);
+
 #else
 static inline void tcf_destroy_chain(struct tcf_proto __rcu **fl)
 {
 }
+
+static inline int tcf_classify(struct sk_buff *skb, const struct tcf_proto *tp,
+                              struct tcf_result *res, bool compat_mode)
+{
+       return TC_ACT_UNSPEC;
+}
 #endif
 
 static inline unsigned long
index bec46f63f10ced844f8aec2b19bebf8b3dc01167..2579c209ea51bdcab524c6f9070584d1a88e2bd2 100644 (file)
@@ -113,9 +113,6 @@ static inline void qdisc_run(struct Qdisc *q)
                __qdisc_run(q);
 }
 
-int tc_classify(struct sk_buff *skb, const struct tcf_proto *tp,
-               struct tcf_result *res, bool compat_mode);
-
 static inline __be16 tc_skb_protocol(const struct sk_buff *skb)
 {
        /* We need to take extra care in case the skb came via
index fca407b4a6ea178d9224949bc57f89a26c97c5c1..acd594c56f0ab846ed9ad895bd27abbe73411b82 100644 (file)
 #include <net/dst.h>
 #include <net/dst_metadata.h>
 #include <net/pkt_sched.h>
+#include <net/pkt_cls.h>
 #include <net/checksum.h>
 #include <net/xfrm.h>
 #include <linux/highmem.h>
@@ -3178,7 +3179,7 @@ sch_handle_egress(struct sk_buff *skb, int *ret, struct net_device *dev)
        /* qdisc_skb_cb(skb)->pkt_len was already set by the caller. */
        qdisc_bstats_cpu_update(cl->q, skb);
 
-       switch (tc_classify(skb, cl, &cl_res, false)) {
+       switch (tcf_classify(skb, cl, &cl_res, false)) {
        case TC_ACT_OK:
        case TC_ACT_RECLASSIFY:
                skb->tc_index = TC_H_MIN(cl_res.classid);
@@ -3948,7 +3949,7 @@ sch_handle_ingress(struct sk_buff *skb, struct packet_type **pt_prev, int *ret,
        skb->tc_at_ingress = 1;
        qdisc_bstats_cpu_update(cl->q, skb);
 
-       switch (tc_classify(skb, cl, &cl_res, false)) {
+       switch (tcf_classify(skb, cl, &cl_res, false)) {
        case TC_ACT_OK:
        case TC_ACT_RECLASSIFY:
                skb->tc_index = TC_H_MIN(cl_res.classid);
index 22f88b35a5463e1d896271f1e1b05675bcaa1955..af58bbef6610760f7236e60ab92b96fe4667cb1d 100644 (file)
@@ -196,6 +196,54 @@ void tcf_destroy_chain(struct tcf_proto __rcu **fl)
 }
 EXPORT_SYMBOL(tcf_destroy_chain);
 
+/* Main classifier routine: scans classifier chain attached
+ * to this qdisc, (optionally) tests for protocol and asks
+ * specific classifiers.
+ */
+int tcf_classify(struct sk_buff *skb, const struct tcf_proto *tp,
+                struct tcf_result *res, bool compat_mode)
+{
+       __be16 protocol = tc_skb_protocol(skb);
+#ifdef CONFIG_NET_CLS_ACT
+       const int max_reclassify_loop = 4;
+       const struct tcf_proto *old_tp = tp;
+       int limit = 0;
+
+reclassify:
+#endif
+       for (; tp; tp = rcu_dereference_bh(tp->next)) {
+               int err;
+
+               if (tp->protocol != protocol &&
+                   tp->protocol != htons(ETH_P_ALL))
+                       continue;
+
+               err = tp->classify(skb, tp, res);
+#ifdef CONFIG_NET_CLS_ACT
+               if (unlikely(err == TC_ACT_RECLASSIFY && !compat_mode))
+                       goto reset;
+#endif
+               if (err >= 0)
+                       return err;
+       }
+
+       return TC_ACT_UNSPEC; /* signal: continue lookup */
+#ifdef CONFIG_NET_CLS_ACT
+reset:
+       if (unlikely(limit++ >= max_reclassify_loop)) {
+               net_notice_ratelimited("%s: reclassify loop, rule prio %u, protocol %02x\n",
+                                      tp->q->ops->id, tp->prio & 0xffff,
+                                      ntohs(tp->protocol));
+               return TC_ACT_SHOT;
+       }
+
+       tp = old_tp;
+       protocol = tc_skb_protocol(skb);
+       goto reclassify;
+#endif
+}
+EXPORT_SYMBOL(tcf_classify);
+
 /* Add/change/delete/get a filter node */
 
 static int tc_ctl_tfilter(struct sk_buff *skb, struct nlmsghdr *n,
index e88342fde1bc409aed6a3c86e7a628030eaac66f..a3bcd972d940f1c7f996ec87d1595391e3e6314b 100644 (file)
@@ -1878,54 +1878,6 @@ done:
        return skb->len;
 }
 
-/* Main classifier routine: scans classifier chain attached
- * to this qdisc, (optionally) tests for protocol and asks
- * specific classifiers.
- */
-int tc_classify(struct sk_buff *skb, const struct tcf_proto *tp,
-               struct tcf_result *res, bool compat_mode)
-{
-       __be16 protocol = tc_skb_protocol(skb);
-#ifdef CONFIG_NET_CLS_ACT
-       const int max_reclassify_loop = 4;
-       const struct tcf_proto *old_tp = tp;
-       int limit = 0;
-
-reclassify:
-#endif
-       for (; tp; tp = rcu_dereference_bh(tp->next)) {
-               int err;
-
-               if (tp->protocol != protocol &&
-                   tp->protocol != htons(ETH_P_ALL))
-                       continue;
-
-               err = tp->classify(skb, tp, res);
-#ifdef CONFIG_NET_CLS_ACT
-               if (unlikely(err == TC_ACT_RECLASSIFY && !compat_mode))
-                       goto reset;
-#endif
-               if (err >= 0)
-                       return err;
-       }
-
-       return TC_ACT_UNSPEC; /* signal: continue lookup */
-#ifdef CONFIG_NET_CLS_ACT
-reset:
-       if (unlikely(limit++ >= max_reclassify_loop)) {
-               net_notice_ratelimited("%s: reclassify loop, rule prio %u, protocol %02x\n",
-                                      tp->q->ops->id, tp->prio & 0xffff,
-                                      ntohs(tp->protocol));
-               return TC_ACT_SHOT;
-       }
-
-       tp = old_tp;
-       protocol = tc_skb_protocol(skb);
-       goto reclassify;
-#endif
-}
-EXPORT_SYMBOL(tc_classify);
-
 #ifdef CONFIG_PROC_FS
 static int psched_show(struct seq_file *seq, void *v)
 {
index 40cbceed4de82aa58d70c2c67782fc65088b25c5..89d32fad9f89362360888d561030ea19d2836e23 100644 (file)
@@ -377,7 +377,7 @@ static int atm_tc_enqueue(struct sk_buff *skb, struct Qdisc *sch,
                list_for_each_entry(flow, &p->flows, list) {
                        fl = rcu_dereference_bh(flow->filter_list);
                        if (fl) {
-                               result = tc_classify(skb, fl, &res, true);
+                               result = tcf_classify(skb, fl, &res, true);
                                if (result < 0)
                                        continue;
                                flow = (struct atm_flow_data *)res.class;
index 7415859fd4c3f65e6ff801b08d683b796d1eaa03..c543ea3e30431c03002bbb473a57167a093f30c9 100644 (file)
@@ -233,7 +233,7 @@ cbq_classify(struct sk_buff *skb, struct Qdisc *sch, int *qerr)
                /*
                 * Step 2+n. Apply classifier.
                 */
-               result = tc_classify(skb, fl, &res, true);
+               result = tcf_classify(skb, fl, &res, true);
                if (!fl || result < 0)
                        goto fallback;
 
index 58a8c32eab2394f90e5935ad661b6223afee106b..446d79bb25d9a731cf9eebf017137f35a9adf993 100644 (file)
@@ -333,7 +333,7 @@ static struct drr_class *drr_classify(struct sk_buff *skb, struct Qdisc *sch,
 
        *qerr = NET_XMIT_SUCCESS | __NET_XMIT_BYPASS;
        fl = rcu_dereference_bh(q->filter_list);
-       result = tc_classify(skb, fl, &res, false);
+       result = tcf_classify(skb, fl, &res, false);
        if (result >= 0) {
 #ifdef CONFIG_NET_CLS_ACT
                switch (result) {
index 1c0f877f673a73977d3191a78a2964e6c1d41259..7bc638d2e67f354c01a24b9015f937229cbdae4a 100644 (file)
@@ -234,7 +234,7 @@ static int dsmark_enqueue(struct sk_buff *skb, struct Qdisc *sch,
        else {
                struct tcf_result res;
                struct tcf_proto *fl = rcu_dereference_bh(p->filter_list);
-               int result = tc_classify(skb, fl, &res, false);
+               int result = tcf_classify(skb, fl, &res, false);
 
                pr_debug("result %d class 0x%04x\n", result, res.classid);
 
index 9201abce928cda39f099fc94d9fc96de1468a947..42ba81ad327c7a798f657a1740e150ecd4ae8ad7 100644 (file)
@@ -96,7 +96,7 @@ static unsigned int fq_codel_classify(struct sk_buff *skb, struct Qdisc *sch,
                return fq_codel_hash(q, skb) + 1;
 
        *qerr = NET_XMIT_SUCCESS | __NET_XMIT_BYPASS;
-       result = tc_classify(skb, filter, &res, false);
+       result = tcf_classify(skb, filter, &res, false);
        if (result >= 0) {
 #ifdef CONFIG_NET_CLS_ACT
                switch (result) {
index 5cb82f6c1b0605d7a4373062dc4232e14347bc22..b0dcab1992051e5b1c4ee276469b5f4215d16c60 100644 (file)
@@ -1142,7 +1142,7 @@ hfsc_classify(struct sk_buff *skb, struct Qdisc *sch, int *qerr)
        *qerr = NET_XMIT_SUCCESS | __NET_XMIT_BYPASS;
        head = &q->root;
        tcf = rcu_dereference_bh(q->root.filter_list);
-       while (tcf && (result = tc_classify(skb, tcf, &res, false)) >= 0) {
+       while (tcf && (result = tcf_classify(skb, tcf, &res, false)) >= 0) {
 #ifdef CONFIG_NET_CLS_ACT
                switch (result) {
                case TC_ACT_QUEUED:
index 570ef3b0c09b7abe49da4787b668397d4413f0e8..640f5f3361953b9940deec9eb789395159cebfe5 100644 (file)
@@ -231,7 +231,7 @@ static struct htb_class *htb_classify(struct sk_buff *skb, struct Qdisc *sch,
        }
 
        *qerr = NET_XMIT_SUCCESS | __NET_XMIT_BYPASS;
-       while (tcf && (result = tc_classify(skb, tcf, &res, false)) >= 0) {
+       while (tcf && (result = tcf_classify(skb, tcf, &res, false)) >= 0) {
 #ifdef CONFIG_NET_CLS_ACT
                switch (result) {
                case TC_ACT_QUEUED:
index 43a3a10b3c8118fc2e0deff98be2635d2ad81330..25bb9ffc2df1cd60e47f7168c022338c2a23f73e 100644 (file)
@@ -46,7 +46,7 @@ multiq_classify(struct sk_buff *skb, struct Qdisc *sch, int *qerr)
        int err;
 
        *qerr = NET_XMIT_SUCCESS | __NET_XMIT_BYPASS;
-       err = tc_classify(skb, fl, &res, false);
+       err = tcf_classify(skb, fl, &res, false);
 #ifdef CONFIG_NET_CLS_ACT
        switch (err) {
        case TC_ACT_STOLEN:
index 92c2e6d448d7984af35d6beb2cb3aea717b76511..7997363f7e0d3a22266d30d676fb25934c6b3f1e 100644 (file)
@@ -42,7 +42,7 @@ prio_classify(struct sk_buff *skb, struct Qdisc *sch, int *qerr)
        *qerr = NET_XMIT_SUCCESS | __NET_XMIT_BYPASS;
        if (TC_H_MAJ(skb->priority) != sch->handle) {
                fl = rcu_dereference_bh(q->filter_list);
-               err = tc_classify(skb, fl, &res, false);
+               err = tcf_classify(skb, fl, &res, false);
 #ifdef CONFIG_NET_CLS_ACT
                switch (err) {
                case TC_ACT_STOLEN:
index 041eba3006ccdd84e1ea1419443f1d169550ceb5..73c7ac37b57000f18091bbf1f5054143daa7e2fa 100644 (file)
@@ -720,7 +720,7 @@ static struct qfq_class *qfq_classify(struct sk_buff *skb, struct Qdisc *sch,
 
        *qerr = NET_XMIT_SUCCESS | __NET_XMIT_BYPASS;
        fl = rcu_dereference_bh(q->filter_list);
-       result = tc_classify(skb, fl, &res, false);
+       result = tcf_classify(skb, fl, &res, false);
        if (result >= 0) {
 #ifdef CONFIG_NET_CLS_ACT
                switch (result) {
index 0f777273ba293dcf2e62ae484dd0033bce942a2b..b287880829e2f1df031cda308d9646347cb44b78 100644 (file)
@@ -259,7 +259,7 @@ static bool sfb_classify(struct sk_buff *skb, struct tcf_proto *fl,
        struct tcf_result res;
        int result;
 
-       result = tc_classify(skb, fl, &res, false);
+       result = tcf_classify(skb, fl, &res, false);
        if (result >= 0) {
 #ifdef CONFIG_NET_CLS_ACT
                switch (result) {
index 332d94be6e1cb09386307b6c16b6954244a805c9..53a641f2ccb54afd8e10bab3488e388cf8210226 100644 (file)
@@ -180,7 +180,7 @@ static unsigned int sfq_classify(struct sk_buff *skb, struct Qdisc *sch,
                return sfq_hash(q, skb) + 1;
 
        *qerr = NET_XMIT_SUCCESS | __NET_XMIT_BYPASS;
-       result = tc_classify(skb, fl, &res, false);
+       result = tcf_classify(skb, fl, &res, false);
        if (result >= 0) {
 #ifdef CONFIG_NET_CLS_ACT
                switch (result) {