1 diff -urN linux-2.6.21.1.old/include/linux/pkt_sched.h linux-2.6.21.1.dev/include/linux/pkt_sched.h
2 --- linux-2.6.21.1.old/include/linux/pkt_sched.h 2007-04-27 23:49:26.000000000 +0200
3 +++ linux-2.6.21.1.dev/include/linux/pkt_sched.h 2007-05-26 20:43:12.530587320 +0200
6 * The only reason for this is efficiency, it is possible
7 * to change these parameters in compile time.
9 + * If you need to play with these values use esfq instead.
17 + TCA_SFQ_HASH_CLASSIC,
20 + TCA_SFQ_HASH_FWMARK,
22 + TCA_SFQ_HASH_DSTDIR,
23 + TCA_SFQ_HASH_SRCDIR,
24 + TCA_SFQ_HASH_FWMARKDIR,
26 + TCA_SFQ_HASH_CTORIGDST,
27 + TCA_SFQ_HASH_CTORIGSRC,
28 + TCA_SFQ_HASH_CTREPLDST,
29 + TCA_SFQ_HASH_CTREPLSRC,
34 + unsigned quantum; /* Bytes per round allocated to flow */
35 + int perturb_period; /* Period of hash perturbation */
36 + __u32 limit; /* Maximal packets in queue */
37 + unsigned divisor; /* Hash divisor */
38 + unsigned flows; /* Maximal number of flows */
39 + unsigned hash_kind; /* Hash function to use for flow identification */
45 diff -urN linux-2.6.21.1.old/net/sched/Kconfig linux-2.6.21.1.dev/net/sched/Kconfig
46 --- linux-2.6.21.1.old/net/sched/Kconfig 2007-04-27 23:49:26.000000000 +0200
47 +++ linux-2.6.21.1.dev/net/sched/Kconfig 2007-05-26 20:43:12.572580936 +0200
49 To compile this code as a module, choose M here: the
50 module will be called sch_sfq.
53 + tristate "Enhanced Stochastic Fairness Queueing (ESFQ)"
55 + Say Y here if you want to use the Enhanced Stochastic Fairness
56 + Queueing (ESFQ) packet scheduling algorithm for some of your network
57 + devices or as a leaf discipline for a classful qdisc such as HTB or
58 + CBQ (see the top of <file:net/sched/sch_esfq.c> for details and
59 + references to the SFQ algorithm).
61 + This is an enchanced SFQ version which allows you to control some
62 + hardcoded values in the SFQ scheduler.
64 + ESFQ also adds control of the hash function used to identify packet
65 + flows. The original SFQ discipline hashes by connection; ESFQ add
66 + several other hashing methods, such as by src IP or by dst IP, which
67 + can be more fair to users in some networking situations.
69 + To compile this code as a module, choose M here: the
70 + module will be called sch_esfq.
73 tristate "True Link Equalizer (TEQL)"
75 diff -urN linux-2.6.21.1.old/net/sched/Makefile linux-2.6.21.1.dev/net/sched/Makefile
76 --- linux-2.6.21.1.old/net/sched/Makefile 2007-04-27 23:49:26.000000000 +0200
77 +++ linux-2.6.21.1.dev/net/sched/Makefile 2007-05-26 20:43:12.577580176 +0200
79 obj-$(CONFIG_NET_SCH_INGRESS) += sch_ingress.o
80 obj-$(CONFIG_NET_SCH_DSMARK) += sch_dsmark.o
81 obj-$(CONFIG_NET_SCH_SFQ) += sch_sfq.o
82 +obj-$(CONFIG_NET_SCH_ESFQ) += sch_esfq.o
83 obj-$(CONFIG_NET_SCH_TBF) += sch_tbf.o
84 obj-$(CONFIG_NET_SCH_TEQL) += sch_teql.o
85 obj-$(CONFIG_NET_SCH_PRIO) += sch_prio.o
86 diff -urN linux-2.6.21.1.old/net/sched/sch_esfq.c linux-2.6.21.1.dev/net/sched/sch_esfq.c
87 --- linux-2.6.21.1.old/net/sched/sch_esfq.c 1970-01-01 01:00:00.000000000 +0100
88 +++ linux-2.6.21.1.dev/net/sched/sch_esfq.c 2007-05-26 20:43:12.578580024 +0200
91 + * net/sched/sch_esfq.c Extended Stochastic Fairness Queueing discipline.
93 + * This program is free software; you can redistribute it and/or
94 + * modify it under the terms of the GNU General Public License
95 + * as published by the Free Software Foundation; either version
96 + * 2 of the License, or (at your option) any later version.
98 + * Authors: Alexey Kuznetsov, <kuznet@ms2.inr.ac.ru>
100 + * Changes: Alexander Atanasov, <alex@ssi.bg>
101 + * Added dynamic depth,limit,divisor,hash_kind options.
102 + * Added dst and src hashes.
104 + * Alexander Clouter, <alex@digriz.org.uk>
105 + * Ported ESFQ to Linux 2.6.
107 + * Corey Hickey, <bugfood-c@fatooh.org>
108 + * Maintenance of the Linux 2.6 port.
109 + * Added fwmark hash (thanks to Robert Kurjata).
110 + * Added direct hashing for src, dst, and fwmark.
111 + * Added usage of jhash.
115 +#include <linux/module.h>
116 +#include <asm/uaccess.h>
117 +#include <asm/system.h>
118 +#include <linux/bitops.h>
119 +#include <linux/types.h>
120 +#include <linux/kernel.h>
121 +#include <linux/jiffies.h>
122 +#include <linux/string.h>
123 +#include <linux/mm.h>
124 +#include <linux/socket.h>
125 +#include <linux/sockios.h>
126 +#include <linux/in.h>
127 +#include <linux/errno.h>
128 +#include <linux/interrupt.h>
129 +#include <linux/if_ether.h>
130 +#include <linux/inet.h>
131 +#include <linux/netdevice.h>
132 +#include <linux/etherdevice.h>
133 +#include <linux/notifier.h>
134 +#include <linux/init.h>
136 +#include <linux/ipv6.h>
137 +#include <net/route.h>
138 +#include <linux/skbuff.h>
139 +#include <net/sock.h>
140 +#include <net/pkt_sched.h>
141 +#include <linux/jhash.h>
143 +#ifdef CONFIG_NF_CONNTRACK_ENABLED
144 +#include <net/netfilter/nf_conntrack.h>
147 +/* Stochastic Fairness Queuing algorithm.
148 + For more comments look at sch_sfq.c.
149 + The difference is that you can change limit, depth,
150 + hash table size and choose alternate hash types.
152 + classic: same as in sch_sfq.c
153 + dst: destination IP address
154 + src: source IP address
155 + fwmark: netfilter mark value
158 + fwmark_direct: direct hashing of the above sources
159 + ctorigdst: original destination IP address
160 + ctorigsrc: original source IP address
161 + ctrepldst: reply destination IP address
162 + ctreplsrc: reply source IP
167 +/* This type should contain at least SFQ_DEPTH*2 values */
168 +typedef unsigned int esfq_index;
176 +struct esfq_sched_data
179 + int perturb_period;
180 + unsigned quantum; /* Allotment per round: MUST BE >= MTU */
183 + unsigned hash_divisor;
184 + unsigned hash_kind;
186 + struct timer_list perturb_timer;
188 + esfq_index tail; /* Index of current slot in round */
189 + esfq_index max_depth; /* Maximal depth */
191 + esfq_index *ht; /* Hash table */
192 + esfq_index *next; /* Active slots link */
193 + short *allot; /* Current allotment per slot */
194 + unsigned short *hash; /* Hash value indexed by slots */
195 + struct sk_buff_head *qs; /* Slot queue */
196 + struct esfq_head *dep; /* Linked list of slots, indexed by depth */
197 + unsigned dyn_min; /* For dynamic divisor adjustment; minimum value seen */
198 + unsigned dyn_max; /* maximum value seen */
199 + unsigned dyn_range; /* saved range */
202 +/* This contains the info we will hash. */
203 +struct esfq_packet_info
205 + u32 proto; /* protocol or port */
206 + u32 src; /* source from packet header */
207 + u32 dst; /* destination from packet header */
208 + u32 ctorigsrc; /* original source from conntrack */
209 + u32 ctorigdst; /* original destination from conntrack */
210 + u32 ctreplsrc; /* reply source from conntrack */
211 + u32 ctrepldst; /* reply destination from conntrack */
212 + u32 mark; /* netfilter mark (fwmark) */
215 +/* Hash input values directly into the "nearest" slot, taking into account the
216 + * range of input values seen. This is most useful when the hash table is at
217 + * least as large as the range of possible values.
218 + * Note: this functionality was added before the change to using jhash, and may
219 + * no longer be useful. */
220 +static __inline__ unsigned esfq_hash_direct(struct esfq_sched_data *q, u32 h)
222 + /* adjust minimum and maximum */
223 + if (h < q->dyn_min || h > q->dyn_max) {
224 + q->dyn_min = h < q->dyn_min ? h : q->dyn_min;
225 + q->dyn_max = h > q->dyn_max ? h : q->dyn_max;
227 + /* find new range */
228 + if ((q->dyn_range = q->dyn_max - q->dyn_min) >= q->hash_divisor)
229 + printk(KERN_WARNING "ESFQ: (direct hash) Input range %u is larger than hash "
230 + "table. See ESFQ README for details.\n", q->dyn_range);
233 + /* hash input values into slot numbers */
234 + if (q->dyn_min == q->dyn_max)
235 + return 0; /* only one value seen; avoid division by 0 */
237 + return (h - q->dyn_min) * (q->hash_divisor - 1) / q->dyn_range;
240 +static __inline__ unsigned esfq_jhash_1word(struct esfq_sched_data *q,u32 a)
242 + return jhash_1word(a, q->perturbation) & (q->hash_divisor-1);
245 +static __inline__ unsigned esfq_jhash_2words(struct esfq_sched_data *q, u32 a, u32 b)
247 + return jhash_2words(a, b, q->perturbation) & (q->hash_divisor-1);
250 +static __inline__ unsigned esfq_jhash_3words(struct esfq_sched_data *q, u32 a, u32 b, u32 c)
252 + return jhash_3words(a, b, c, q->perturbation) & (q->hash_divisor-1);
256 +static unsigned esfq_hash(struct esfq_sched_data *q, struct sk_buff *skb)
258 + struct esfq_packet_info info;
259 +#ifdef CONFIG_NF_CONNTRACK_ENABLED
260 + enum ip_conntrack_info ctinfo;
261 + struct nf_conn *ct = nf_ct_get(skb, &ctinfo);
264 + switch (skb->protocol) {
265 + case __constant_htons(ETH_P_IP):
267 + struct iphdr *iph = skb->nh.iph;
268 + info.dst = iph->daddr;
269 + info.src = iph->saddr;
270 + if (!(iph->frag_off&htons(IP_MF|IP_OFFSET)) &&
271 + (iph->protocol == IPPROTO_TCP ||
272 + iph->protocol == IPPROTO_UDP ||
273 + iph->protocol == IPPROTO_SCTP ||
274 + iph->protocol == IPPROTO_DCCP ||
275 + iph->protocol == IPPROTO_ESP))
276 + info.proto = *(((u32*)iph) + iph->ihl);
278 + info.proto = iph->protocol;
281 + case __constant_htons(ETH_P_IPV6):
283 + struct ipv6hdr *iph = skb->nh.ipv6h;
284 + /* Hash ipv6 addresses into a u32. This isn't ideal,
285 + * but the code is simple. */
286 + info.dst = jhash2(iph->daddr.s6_addr32, 4, q->perturbation);
287 + info.src = jhash2(iph->saddr.s6_addr32, 4, q->perturbation);
288 + if (iph->nexthdr == IPPROTO_TCP ||
289 + iph->nexthdr == IPPROTO_UDP ||
290 + iph->nexthdr == IPPROTO_SCTP ||
291 + iph->nexthdr == IPPROTO_DCCP ||
292 + iph->nexthdr == IPPROTO_ESP)
293 + info.proto = *(u32*)&iph[1];
295 + info.proto = iph->nexthdr;
299 + info.dst = (u32)(unsigned long)skb->dst;
300 + info.src = (u32)(unsigned long)skb->sk;
301 + info.proto = skb->protocol;
304 + info.mark = skb->mark;
306 +#ifdef CONFIG_NF_CONNTRACK_ENABLED
307 + /* defaults if there is no conntrack info */
308 + info.ctorigsrc = info.src;
309 + info.ctorigdst = info.dst;
310 + info.ctreplsrc = info.dst;
311 + info.ctrepldst = info.src;
312 + /* collect conntrack info */
313 + if (ct && ct != &nf_conntrack_untracked) {
314 + if (skb->protocol == __constant_htons(ETH_P_IP)) {
315 + info.ctorigsrc = ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple.src.u3.ip;
316 + info.ctorigdst = ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple.dst.u3.ip;
317 + info.ctreplsrc = ct->tuplehash[IP_CT_DIR_REPLY].tuple.src.u3.ip;
318 + info.ctrepldst = ct->tuplehash[IP_CT_DIR_REPLY].tuple.dst.u3.ip;
320 + else if (skb->protocol == __constant_htons(ETH_P_IPV6)) {
321 + /* Again, hash ipv6 addresses into a single u32. */
322 + info.ctorigsrc = jhash2(ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple.src.u3.ip6, 4, q->perturbation);
323 + info.ctorigdst = jhash2(ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple.dst.u3.ip6, 4, q->perturbation);
324 + info.ctreplsrc = jhash2(ct->tuplehash[IP_CT_DIR_REPLY].tuple.src.u3.ip6, 4, q->perturbation);
325 + info.ctrepldst = jhash2(ct->tuplehash[IP_CT_DIR_REPLY].tuple.dst.u3.ip6, 4, q->perturbation);
331 + switch(q->hash_kind)
333 + case TCA_SFQ_HASH_CLASSIC:
334 + return esfq_jhash_3words(q, info.dst, info.src, info.proto);
335 + case TCA_SFQ_HASH_DST:
336 + return esfq_jhash_1word(q, info.dst);
337 + case TCA_SFQ_HASH_DSTDIR:
338 + return esfq_hash_direct(q, ntohl(info.dst));
339 + case TCA_SFQ_HASH_SRC:
340 + return esfq_jhash_1word(q, info.src);
341 + case TCA_SFQ_HASH_SRCDIR:
342 + return esfq_hash_direct(q, ntohl(info.src));
343 + case TCA_SFQ_HASH_FWMARK:
344 + return esfq_jhash_1word(q, info.mark);
345 + case TCA_SFQ_HASH_FWMARKDIR:
346 + return esfq_hash_direct(q, info.mark);
347 +#ifdef CONFIG_NF_CONNTRACK_ENABLED
348 + case TCA_SFQ_HASH_CTORIGDST:
349 + return esfq_jhash_1word(q, info.ctorigdst);
350 + case TCA_SFQ_HASH_CTORIGSRC:
351 + return esfq_jhash_1word(q, info.ctorigsrc);
352 + case TCA_SFQ_HASH_CTREPLDST:
353 + return esfq_jhash_1word(q, info.ctrepldst);
354 + case TCA_SFQ_HASH_CTREPLSRC:
355 + return esfq_jhash_1word(q, info.ctreplsrc);
358 + if (net_ratelimit())
359 + printk(KERN_WARNING "ESFQ: Unknown hash method. Falling back to classic.\n");
361 + return esfq_jhash_3words(q, info.dst, info.src, info.proto);
364 +static inline void esfq_link(struct esfq_sched_data *q, esfq_index x)
367 + int d = q->qs[x].qlen + q->depth;
370 + n = q->dep[d].next;
371 + q->dep[x].next = n;
372 + q->dep[x].prev = p;
373 + q->dep[p].next = q->dep[n].prev = x;
376 +static inline void esfq_dec(struct esfq_sched_data *q, esfq_index x)
380 + n = q->dep[x].next;
381 + p = q->dep[x].prev;
382 + q->dep[p].next = n;
383 + q->dep[n].prev = p;
385 + if (n == p && q->max_depth == q->qs[x].qlen + 1)
391 +static inline void esfq_inc(struct esfq_sched_data *q, esfq_index x)
396 + n = q->dep[x].next;
397 + p = q->dep[x].prev;
398 + q->dep[p].next = n;
399 + q->dep[n].prev = p;
401 + if (q->max_depth < d)
407 +static unsigned int esfq_drop(struct Qdisc *sch)
409 + struct esfq_sched_data *q = qdisc_priv(sch);
410 + esfq_index d = q->max_depth;
411 + struct sk_buff *skb;
414 + /* Queue is full! Find the longest slot and
415 + drop a packet from it */
418 + esfq_index x = q->dep[d+q->depth].next;
419 + skb = q->qs[x].prev;
421 + __skb_unlink(skb, &q->qs[x]);
425 + sch->qstats.drops++;
426 + sch->qstats.backlog -= len;
431 + /* It is difficult to believe, but ALL THE SLOTS HAVE LENGTH 1. */
432 + d = q->next[q->tail];
433 + q->next[q->tail] = q->next[d];
434 + q->allot[q->next[d]] += q->quantum;
435 + skb = q->qs[d].prev;
437 + __skb_unlink(skb, &q->qs[d]);
441 + q->ht[q->hash[d]] = q->depth;
442 + sch->qstats.drops++;
443 + sch->qstats.backlog -= len;
451 +esfq_enqueue(struct sk_buff *skb, struct Qdisc* sch)
453 + struct esfq_sched_data *q = qdisc_priv(sch);
454 + unsigned hash = esfq_hash(q, skb);
455 + unsigned depth = q->depth;
460 + q->ht[hash] = x = q->dep[depth].next;
463 + sch->qstats.backlog += skb->len;
464 + __skb_queue_tail(&q->qs[x], skb);
466 + if (q->qs[x].qlen == 1) { /* The flow is new */
467 + if (q->tail == depth) { /* It is the first flow */
470 + q->allot[x] = q->quantum;
472 + q->next[x] = q->next[q->tail];
473 + q->next[q->tail] = x;
477 + if (++sch->q.qlen < q->limit-1) {
478 + sch->bstats.bytes += skb->len;
479 + sch->bstats.packets++;
484 + return NET_XMIT_CN;
488 +esfq_requeue(struct sk_buff *skb, struct Qdisc* sch)
490 + struct esfq_sched_data *q = qdisc_priv(sch);
491 + unsigned hash = esfq_hash(q, skb);
492 + unsigned depth = q->depth;
497 + q->ht[hash] = x = q->dep[depth].next;
500 + sch->qstats.backlog += skb->len;
501 + __skb_queue_head(&q->qs[x], skb);
503 + if (q->qs[x].qlen == 1) { /* The flow is new */
504 + if (q->tail == depth) { /* It is the first flow */
507 + q->allot[x] = q->quantum;
509 + q->next[x] = q->next[q->tail];
510 + q->next[q->tail] = x;
514 + if (++sch->q.qlen < q->limit - 1) {
515 + sch->qstats.requeues++;
519 + sch->qstats.drops++;
521 + return NET_XMIT_CN;
527 +static struct sk_buff *
528 +esfq_dequeue(struct Qdisc* sch)
530 + struct esfq_sched_data *q = qdisc_priv(sch);
531 + struct sk_buff *skb;
532 + unsigned depth = q->depth;
533 + esfq_index a, old_a;
535 + /* No active slots */
536 + if (q->tail == depth)
539 + a = old_a = q->next[q->tail];
542 + skb = __skb_dequeue(&q->qs[a]);
545 + sch->qstats.backlog -= skb->len;
547 + /* Is the slot empty? */
548 + if (q->qs[a].qlen == 0) {
549 + q->ht[q->hash[a]] = depth;
555 + q->next[q->tail] = a;
556 + q->allot[a] += q->quantum;
557 + } else if ((q->allot[a] -= skb->len) <= 0) {
560 + q->allot[a] += q->quantum;
567 +esfq_reset(struct Qdisc* sch)
569 + struct sk_buff *skb;
571 + while ((skb = esfq_dequeue(sch)) != NULL)
575 +static void esfq_perturbation(unsigned long arg)
577 + struct Qdisc *sch = (struct Qdisc*)arg;
578 + struct esfq_sched_data *q = qdisc_priv(sch);
580 + q->perturbation = net_random()&0x1F;
582 + if (q->perturb_period) {
583 + q->perturb_timer.expires = jiffies + q->perturb_period;
584 + add_timer(&q->perturb_timer);
588 +static int esfq_change(struct Qdisc *sch, struct rtattr *opt)
590 + struct esfq_sched_data *q = qdisc_priv(sch);
591 + struct tc_esfq_qopt *ctl = RTA_DATA(opt);
592 + int old_perturb = q->perturb_period;
594 + if (opt->rta_len < RTA_LENGTH(sizeof(*ctl)))
597 + sch_tree_lock(sch);
598 + q->quantum = ctl->quantum ? : psched_mtu(sch->dev);
599 + q->perturb_period = ctl->perturb_period*HZ;
600 +// q->hash_divisor = ctl->divisor;
601 +// q->tail = q->limit = q->depth = ctl->flows;
604 + q->limit = min_t(u32, ctl->limit, q->depth);
606 + if (ctl->hash_kind) {
607 + q->hash_kind = ctl->hash_kind;
608 + if (q->hash_kind != TCA_SFQ_HASH_CLASSIC)
609 + q->perturb_period = 0;
612 + // is sch_tree_lock enough to do this ?
613 + while (sch->q.qlen >= q->limit-1)
617 + del_timer(&q->perturb_timer);
618 + if (q->perturb_period) {
619 + q->perturb_timer.expires = jiffies + q->perturb_period;
620 + add_timer(&q->perturb_timer);
622 + q->perturbation = 0;
624 + sch_tree_unlock(sch);
628 +static int esfq_init(struct Qdisc *sch, struct rtattr *opt)
630 + struct esfq_sched_data *q = qdisc_priv(sch);
631 + struct tc_esfq_qopt *ctl;
632 + esfq_index p = ~0U/2;
635 + if (opt && opt->rta_len < RTA_LENGTH(sizeof(*ctl)))
638 + init_timer(&q->perturb_timer);
639 + q->perturb_timer.data = (unsigned long)sch;
640 + q->perturb_timer.function = esfq_perturbation;
641 + q->perturbation = 0;
642 + q->hash_kind = TCA_SFQ_HASH_CLASSIC;
644 + q->dyn_min = ~0U; /* maximum value for this type */
645 + q->dyn_max = 0; /* dyn_min/dyn_max will be set properly upon first packet */
647 + q->quantum = psched_mtu(sch->dev);
648 + q->perturb_period = 0;
649 + q->hash_divisor = 1024;
650 + q->tail = q->limit = q->depth = 128;
653 + ctl = RTA_DATA(opt);
654 + q->quantum = ctl->quantum ? : psched_mtu(sch->dev);
655 + q->perturb_period = ctl->perturb_period*HZ;
656 + q->hash_divisor = ctl->divisor ? : 1024;
657 + q->tail = q->limit = q->depth = ctl->flows ? : 128;
659 + if ( q->depth > p - 1 )
663 + q->limit = min_t(u32, ctl->limit, q->depth);
665 + if (ctl->hash_kind) {
666 + q->hash_kind = ctl->hash_kind;
669 + if (q->perturb_period) {
670 + q->perturb_timer.expires = jiffies + q->perturb_period;
671 + add_timer(&q->perturb_timer);
675 + q->ht = kmalloc(q->hash_divisor*sizeof(esfq_index), GFP_KERNEL);
679 + q->dep = kmalloc((1+q->depth*2)*sizeof(struct esfq_head), GFP_KERNEL);
682 + q->next = kmalloc(q->depth*sizeof(esfq_index), GFP_KERNEL);
686 + q->allot = kmalloc(q->depth*sizeof(short), GFP_KERNEL);
689 + q->hash = kmalloc(q->depth*sizeof(unsigned short), GFP_KERNEL);
692 + q->qs = kmalloc(q->depth*sizeof(struct sk_buff_head), GFP_KERNEL);
696 + for (i=0; i< q->hash_divisor; i++)
697 + q->ht[i] = q->depth;
698 + for (i=0; i<q->depth; i++) {
699 + skb_queue_head_init(&q->qs[i]);
700 + q->dep[i+q->depth].next = i+q->depth;
701 + q->dep[i+q->depth].prev = i+q->depth;
704 + for (i=0; i<q->depth; i++)
708 + del_timer(&q->perturb_timer);
724 +static void esfq_destroy(struct Qdisc *sch)
726 + struct esfq_sched_data *q = qdisc_priv(sch);
727 + del_timer(&q->perturb_timer);
742 +static int esfq_dump(struct Qdisc *sch, struct sk_buff *skb)
744 + struct esfq_sched_data *q = qdisc_priv(sch);
745 + unsigned char *b = skb->tail;
746 + struct tc_esfq_qopt opt;
748 + opt.quantum = q->quantum;
749 + opt.perturb_period = q->perturb_period/HZ;
751 + opt.limit = q->limit;
752 + opt.divisor = q->hash_divisor;
753 + opt.flows = q->depth;
754 + opt.hash_kind = q->hash_kind;
756 + RTA_PUT(skb, TCA_OPTIONS, sizeof(opt), &opt);
761 + skb_trim(skb, b - skb->data);
765 +static struct Qdisc_ops esfq_qdisc_ops =
770 + .priv_size = sizeof(struct esfq_sched_data),
771 + .enqueue = esfq_enqueue,
772 + .dequeue = esfq_dequeue,
773 + .requeue = esfq_requeue,
776 + .reset = esfq_reset,
777 + .destroy = esfq_destroy,
778 + .change = NULL, /* esfq_change - needs more work */
780 + .owner = THIS_MODULE,
783 +static int __init esfq_module_init(void)
785 + return register_qdisc(&esfq_qdisc_ops);
787 +static void __exit esfq_module_exit(void)
789 + unregister_qdisc(&esfq_qdisc_ops);
791 +module_init(esfq_module_init)
792 +module_exit(esfq_module_exit)
793 +MODULE_LICENSE("GPL");