netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Thomas Graf <tgraf@suug.ch>
To: "David S. Miller" <davem@davemloft.net>
Cc: netdev@oss.sgi.com, hadi@cyberus.ca
Subject: [PATCH 7/11] PKT_SCHED: Move tc_classify from pkt_cls.h to sch_api.c
Date: Wed, 27 Oct 2004 00:27:01 +0200	[thread overview]
Message-ID: <20041026222701.GH12289@postel.suug.ch> (raw)
In-Reply-To: <20041026222148.GA12289@postel.suug.ch>

tc_classiy has grown too big to be inlined, move it to sch_api.c
and export it.

Signed-off-by: Thomas Graf <tgraf@suug.ch>

--- linux-2.6.10-rc1-bk1.orig/include/net/pkt_cls.h	2004-10-26 23:19:23.000000000 +0200
+++ linux-2.6.10-rc1-bk1/include/net/pkt_cls.h	2004-10-26 23:27:03.000000000 +0200
@@ -14,51 +14,6 @@
 	int	(*fn)(struct tcf_proto *, unsigned long node, struct tcf_walker *);
 };
 
-/* Main classifier routine: scans classifier chain attached
-   to this qdisc, (optionally) tests for protocol and asks
-   specific classifiers.
- */
-
-static inline int tc_classify(struct sk_buff *skb, struct tcf_proto *tp, struct tcf_result *res)
-{
-	int err = 0;
-	u32 protocol = skb->protocol;
-#ifdef CONFIG_NET_CLS_ACT
-	struct tcf_proto *otp = tp;
-reclassify:
-#endif
-	protocol = skb->protocol;
-
-	for ( ; tp; tp = tp->next) {
-		if ((tp->protocol == protocol ||
-			tp->protocol == __constant_htons(ETH_P_ALL)) &&
-			(err = tp->classify(skb, tp, res)) >= 0) {
-#ifdef CONFIG_NET_CLS_ACT
-			if ( TC_ACT_RECLASSIFY == err) {
-				__u32 verd = (__u32) G_TC_VERD(skb->tc_verd);
-				tp = otp;
-
-				if (MAX_REC_LOOP < verd++) {
-					printk("rule prio %d protocol %02x reclassify is buggy packet dropped\n",tp->prio&0xffff, ntohs(tp->protocol));
-					return TC_ACT_SHOT;
-				}
-				skb->tc_verd = SET_TC_VERD(skb->tc_verd,verd);
-				goto reclassify;
-			} else {
-				if (skb->tc_verd) 
-					skb->tc_verd = SET_TC_VERD(skb->tc_verd,0);
-				return err;
-			}
-#else
-
-			return err;
-#endif
-            }
-
-	}
-	return -1;
-}
-
 extern int register_tcf_proto_ops(struct tcf_proto_ops *ops);
 extern int unregister_tcf_proto_ops(struct tcf_proto_ops *ops);
 extern int ing_filter(struct sk_buff *skb);
--- linux-2.6.10-rc1-bk1.orig/include/net/pkt_sched.h	2004-10-26 23:31:17.000000000 +0200
+++ linux-2.6.10-rc1-bk1/include/net/pkt_sched.h	2004-10-26 23:31:50.000000000 +0200
@@ -232,6 +232,9 @@
 
 extern int qdisc_restart(struct net_device *dev);
 
+extern int tc_classify(struct sk_buff *skb, struct tcf_proto *tp,
+	struct tcf_result *res);
+
 /* Calculate maximal size of packet seen by hard_start_xmit
    routine of this device.
  */
--- linux-2.6.10-rc1-bk1.orig/net/sched/sch_api.c	2004-10-26 22:57:06.000000000 +0200
+++ linux-2.6.10-rc1-bk1/net/sched/sch_api.c	2004-10-26 23:34:40.000000000 +0200
@@ -1099,6 +1099,52 @@
 	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, struct tcf_proto *tp,
+	struct tcf_result *res)
+{
+	int err = 0;
+	u32 protocol = skb->protocol;
+#ifdef CONFIG_NET_CLS_ACT
+	struct tcf_proto *otp = tp;
+reclassify:
+#endif
+	protocol = skb->protocol;
+
+	for ( ; tp; tp = tp->next) {
+		if ((tp->protocol == protocol ||
+			tp->protocol == __constant_htons(ETH_P_ALL)) &&
+			(err = tp->classify(skb, tp, res)) >= 0) {
+#ifdef CONFIG_NET_CLS_ACT
+			if ( TC_ACT_RECLASSIFY == err) {
+				__u32 verd = (__u32) G_TC_VERD(skb->tc_verd);
+				tp = otp;
+
+				if (MAX_REC_LOOP < verd++) {
+					printk("rule prio %d protocol %02x reclassify is buggy packet dropped\n",
+						tp->prio&0xffff, ntohs(tp->protocol));
+					return TC_ACT_SHOT;
+				}
+				skb->tc_verd = SET_TC_VERD(skb->tc_verd,verd);
+				goto reclassify;
+			} else {
+				if (skb->tc_verd) 
+					skb->tc_verd = SET_TC_VERD(skb->tc_verd,0);
+				return err;
+			}
+#else
+
+			return err;
+#endif
+		}
+
+	}
+	return -1;
+}
+
 int psched_us_per_tick = 1;
 int psched_tick_per_us = 1;
 
@@ -1246,3 +1292,4 @@
 EXPORT_SYMBOL(qdisc_put_rtab);
 EXPORT_SYMBOL(register_qdisc);
 EXPORT_SYMBOL(unregister_qdisc);
+EXPORT_SYMBOL(tc_classify);

  parent reply	other threads:[~2004-10-26 22:27 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-10-26 22:21 [PATCHSET 0/11] PKT_SCHED: overall net/pkt_cls.h and net/pkt_sched.h cleanup Thomas Graf
2004-10-26 22:22 ` [PATCH 1/11] PKT_SCHED: linux/pkt_cls.h depends on linux/pkt_sched.h Thomas Graf
2004-10-26 22:23 ` [PATCH 2/11] PKT_SCHED: Add net/sch_generic.h with generic sched definitions Thomas Graf
2004-10-26 22:24 ` [PATCH 3/11] PKT_SCHED: Remove obsolete definitions in pkt_cls.h Thomas Graf
2004-10-26 22:25 ` [PATCH 4/11] PKT_SCHED: Add net/act_api.h with public action/policer bits Thomas Graf
2004-10-26 22:25 ` [PATCH 5/11] PKT_SCHED: Remove obsolete definitions in pkt_sched.h Thomas Graf
2004-10-26 22:26 ` [PATCH 6/11] PKT_SCHED: Transform prototypes to be extern Thomas Graf
2004-10-26 22:27 ` Thomas Graf [this message]
2004-10-26 22:27 ` [PATCH 8/11] PKT_SCHED: psched_*_per_* can be static Thomas Graf
2004-10-26 22:28 ` [PATCH 9/11] PKT_SCHED: Cleanup cls_set_class Thomas Graf
2004-10-27  8:57   ` Tommy Christensen
2004-10-27  9:42     ` Thomas Graf
2004-10-27 10:58       ` Thomas Graf
2004-10-27 21:38       ` David S. Miller
2004-10-26 22:28 ` [PATCH 10/11] PKT_SCHED: Inline psched_tod_diff Thomas Graf
2004-10-26 22:29 ` [PATCH 11/11]: PKT_SCHED: Use new header architecture Thomas Graf
2004-10-26 23:22 ` [PATCHSET 0/11] PKT_SCHED: overall net/pkt_cls.h and net/pkt_sched.h cleanup David S. Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20041026222701.GH12289@postel.suug.ch \
    --to=tgraf@suug.ch \
    --cc=davem@davemloft.net \
    --cc=hadi@cyberus.ca \
    --cc=netdev@oss.sgi.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).