__qdisc_run(q);
 }
 
-int tc_classify_compat(struct sk_buff *skb, const struct tcf_proto *tp,
-                      struct tcf_result *res);
 int tc_classify(struct sk_buff *skb, const struct tcf_proto *tp,
-               struct tcf_result *res);
+               struct tcf_result *res, bool compat_mode);
 
 static inline __be16 tc_skb_protocol(const struct sk_buff *skb)
 {
 
        skb->tc_verd = SET_TC_AT(skb->tc_verd, AT_INGRESS);
        qdisc_bstats_cpu_update(cl->q, skb);
 
-       switch (tc_classify(skb, cl, &cl_res)) {
+       switch (tc_classify(skb, cl, &cl_res, false)) {
        case TC_ACT_OK:
        case TC_ACT_RECLASSIFY:
                skb->tc_index = TC_H_MIN(cl_res.classid);
 
  * to this qdisc, (optionally) tests for protocol and asks
  * specific classifiers.
  */
-int tc_classify_compat(struct sk_buff *skb, const struct tcf_proto *tp,
-                      struct tcf_result *res)
+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);
-       int err;
+#ifdef CONFIG_NET_CLS_ACT
+       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);
 
+               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 -1;
-}
-EXPORT_SYMBOL(tc_classify_compat);
 
-int tc_classify(struct sk_buff *skb, const struct tcf_proto *tp,
-               struct tcf_result *res)
-{
-       int err = 0;
-#ifdef CONFIG_NET_CLS_ACT
-       const struct tcf_proto *otp = tp;
-       int limit = 0;
-reclassify:
-#endif
-
-       err = tc_classify_compat(skb, tp, res);
+       return -1;
 #ifdef CONFIG_NET_CLS_ACT
-       if (err == TC_ACT_RECLASSIFY) {
-               tp = otp;
-
-               if (unlikely(limit++ >= MAX_REC_LOOP)) {
-                       net_notice_ratelimited("%s: packet reclassify loop rule prio %u protocol %02x\n",
-                                              tp->q->ops->id,
-                                              tp->prio & 0xffff,
-                                              ntohs(tp->protocol));
-                       return TC_ACT_SHOT;
-               }
-               goto reclassify;
+reset:
+       if (unlikely(limit++ >= MAX_REC_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;
+       goto reclassify;
 #endif
-       return err;
 }
 EXPORT_SYMBOL(tc_classify);
 
 
                list_for_each_entry(flow, &p->flows, list) {
                        fl = rcu_dereference_bh(flow->filter_list);
                        if (fl) {
-                               result = tc_classify_compat(skb, fl, &res);
+                               result = tc_classify(skb, fl, &res, true);
                                if (result < 0)
                                        continue;
                                flow = (struct atm_flow_data *)res.class;
 
                /*
                 * Step 2+n. Apply classifier.
                 */
-               result = tc_classify_compat(skb, fl, &res);
+               result = tc_classify(skb, fl, &res, true);
                if (!fl || result < 0)
                        goto fallback;
 
 
        int result;
 
        fl = rcu_dereference_bh(q->filter_list);
-       result = tc_classify(skb, fl, &res);
+       result = tc_classify(skb, fl, &res, false);
        if (result >= 0) {
 #ifdef CONFIG_NET_CLS_ACT
                switch (result) {
 
 
        *qerr = NET_XMIT_SUCCESS | __NET_XMIT_BYPASS;
        fl = rcu_dereference_bh(q->filter_list);
-       result = tc_classify(skb, fl, &res);
+       result = tc_classify(skb, fl, &res, false);
        if (result >= 0) {
 #ifdef CONFIG_NET_CLS_ACT
                switch (result) {
 
        else {
                struct tcf_result res;
                struct tcf_proto *fl = rcu_dereference_bh(p->filter_list);
-               int result = tc_classify(skb, fl, &res);
+               int result = tc_classify(skb, fl, &res, false);
 
                pr_debug("result %d class 0x%04x\n", result, res.classid);
 
 
                return fq_codel_hash(q, skb) + 1;
 
        *qerr = NET_XMIT_SUCCESS | __NET_XMIT_BYPASS;
-       result = tc_classify(skb, filter, &res);
+       result = tc_classify(skb, filter, &res, false);
        if (result >= 0) {
 #ifdef CONFIG_NET_CLS_ACT
                switch (result) {
 
        *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)) >= 0) {
+       while (tcf && (result = tc_classify(skb, tcf, &res, false)) >= 0) {
 #ifdef CONFIG_NET_CLS_ACT
                switch (result) {
                case TC_ACT_QUEUED:
 
        }
 
        *qerr = NET_XMIT_SUCCESS | __NET_XMIT_BYPASS;
-       while (tcf && (result = tc_classify(skb, tcf, &res)) >= 0) {
+       while (tcf && (result = tc_classify(skb, tcf, &res, false)) >= 0) {
 #ifdef CONFIG_NET_CLS_ACT
                switch (result) {
                case TC_ACT_QUEUED:
 
        int err;
 
        *qerr = NET_XMIT_SUCCESS | __NET_XMIT_BYPASS;
-       err = tc_classify(skb, fl, &res);
+       err = tc_classify(skb, fl, &res, false);
 #ifdef CONFIG_NET_CLS_ACT
        switch (err) {
        case TC_ACT_STOLEN:
 
        *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);
+               err = tc_classify(skb, fl, &res, false);
 #ifdef CONFIG_NET_CLS_ACT
                switch (err) {
                case TC_ACT_STOLEN:
 
 
        *qerr = NET_XMIT_SUCCESS | __NET_XMIT_BYPASS;
        fl = rcu_dereference_bh(q->filter_list);
-       result = tc_classify(skb, fl, &res);
+       result = tc_classify(skb, fl, &res, false);
        if (result >= 0) {
 #ifdef CONFIG_NET_CLS_ACT
                switch (result) {
 
        struct tcf_result res;
        int result;
 
-       result = tc_classify(skb, fl, &res);
+       result = tc_classify(skb, fl, &res, false);
        if (result >= 0) {
 #ifdef CONFIG_NET_CLS_ACT
                switch (result) {
 
                return sfq_hash(q, skb) + 1;
 
        *qerr = NET_XMIT_SUCCESS | __NET_XMIT_BYPASS;
-       result = tc_classify(skb, fl, &res);
+       result = tc_classify(skb, fl, &res, false);
        if (result >= 0) {
 #ifdef CONFIG_NET_CLS_ACT
                switch (result) {