diff options
| author | Thomas Graf <tgraf@suug.ch> | 2004-10-26 02:04:32 -0700 |
|---|---|---|
| committer | David S. Miller <davem@nuts.davemloft.net> | 2004-10-26 02:04:32 -0700 |
| commit | 99add3c05ab22a84131ca66d005d1ad3d35df438 (patch) | |
| tree | 2e64f26d891d6e83ec6343973967992d812ae0c0 /net/sched | |
| parent | 905dedcee6b3d809f01e966f6a2ef4b3602294e6 (diff) | |
[PKT_SCHED]: Move tc_classify from pkt_cls.h to sch_api.c
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>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/sched')
| -rw-r--r-- | net/sched/sch_api.c | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/net/sched/sch_api.c b/net/sched/sch_api.c index 551d8587c226..14e0b98b66c5 100644 --- a/net/sched/sch_api.c +++ b/net/sched/sch_api.c @@ -1099,6 +1099,52 @@ static int tc_dump_tclass(struct sk_buff *skb, struct netlink_callback *cb) 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_get_rtab); EXPORT_SYMBOL(qdisc_put_rtab); EXPORT_SYMBOL(register_qdisc); EXPORT_SYMBOL(unregister_qdisc); +EXPORT_SYMBOL(tc_classify); |
