2 * Copyright (c) 2003 Patrick McHardy, <kaber@trash.net>
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version 2
7 * of the License, or (at your option) any later version.
9 * 2003-10-17 - Ported from altq
12 * Copyright (c) 1997-1999 Carnegie Mellon University. All Rights Reserved.
14 * Permission to use, copy, modify, and distribute this software and
15 * its documentation is hereby granted (including for commercial or
16 * for-profit use), provided that both the copyright notice and this
17 * permission notice appear in all copies of the software, derivative
18 * works, or modified versions, and any portions thereof.
20 * THIS SOFTWARE IS EXPERIMENTAL AND IS KNOWN TO HAVE BUGS, SOME OF
21 * WHICH MAY HAVE SERIOUS CONSEQUENCES. CARNEGIE MELLON PROVIDES THIS
22 * SOFTWARE IN ITS ``AS IS'' CONDITION, AND ANY EXPRESS OR IMPLIED
23 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
24 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
25 * DISCLAIMED. IN NO EVENT SHALL CARNEGIE MELLON UNIVERSITY BE LIABLE
26 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
27 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
28 * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
29 * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
30 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
32 * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
35 * Carnegie Mellon encourages (but does not require) users of this
36 * software to return any improvements or extensions that they make,
37 * and to grant Carnegie Mellon the rights to redistribute these
38 * changes without encumbrance.
41 * H-FSC is described in Proceedings of SIGCOMM'97,
42 * "A Hierarchical Fair Service Curve Algorithm for Link-Sharing,
43 * Real-Time and Priority Service"
44 * by Ion Stoica, Hui Zhang, and T. S. Eugene Ng.
46 * Oleg Cherevko <olwi@aq.ml.com.ua> added the upperlimit for link-sharing.
47 * when a class has an upperlimit, the fit-time is computed from the
48 * upperlimit service curve. the link-sharing scheduler does not schedule
49 * a class whose fit-time exceeds the current time.
52 #include <linux/kernel.h>
53 #include <linux/config.h>
54 #include <linux/module.h>
55 #include <linux/types.h>
56 #include <linux/errno.h>
57 #include <linux/jiffies.h>
58 #include <linux/compiler.h>
59 #include <linux/spinlock.h>
60 #include <linux/skbuff.h>
61 #include <linux/string.h>
62 #include <linux/slab.h>
63 #include <linux/timer.h>
64 #include <linux/list.h>
65 #include <linux/init.h>
66 #include <linux/netdevice.h>
67 #include <linux/rtnetlink.h>
68 #include <linux/pkt_sched.h>
69 #include <net/pkt_sched.h>
70 #include <net/pkt_cls.h>
71 #include <asm/system.h>
72 #include <asm/div64.h>
77 * kernel internal service curve representation:
78 * coordinates are given by 64 bit unsigned integers.
79 * x-axis: unit is clock count.
80 * y-axis: unit is byte.
82 * The service curve parameters are converted to the internal
83 * representation. The slope values are scaled to avoid overflow.
84 * the inverse slope values as well as the y-projection of the 1st
85 * segment are kept in order to to avoid 64-bit divide operations
86 * that are expensive on 32-bit architectures.
91 u64 sm1; /* scaled slope of the 1st segment */
92 u64 ism1; /* scaled inverse-slope of the 1st segment */
93 u64 dx; /* the x-projection of the 1st segment */
94 u64 dy; /* the y-projection of the 1st segment */
95 u64 sm2; /* scaled slope of the 2nd segment */
96 u64 ism2; /* scaled inverse-slope of the 2nd segment */
99 /* runtime service curve */
102 u64 x; /* current starting position on x-axis */
103 u64 y; /* current starting position on y-axis */
104 u64 sm1; /* scaled slope of the 1st segment */
105 u64 ism1; /* scaled inverse-slope of the 1st segment */
106 u64 dx; /* the x-projection of the 1st segment */
107 u64 dy; /* the y-projection of the 1st segment */
108 u64 sm2; /* scaled slope of the 2nd segment */
109 u64 ism2; /* scaled inverse-slope of the 2nd segment */
112 enum hfsc_class_flags
121 u32 classid; /* class id */
122 unsigned int refcnt; /* usage count */
124 struct tc_stats stats; /* generic statistics */
125 unsigned int level; /* class level in hierarchy */
126 struct tcf_proto *filter_list; /* filter list */
127 unsigned int filter_cnt; /* filter count */
129 struct hfsc_sched *sched; /* scheduler data */
130 struct hfsc_class *cl_parent; /* parent class */
131 struct list_head siblings; /* sibling classes */
132 struct list_head children; /* child classes */
133 struct Qdisc *qdisc; /* leaf qdisc */
135 struct list_head actlist; /* active children list */
136 struct list_head alist; /* active children list member */
137 struct list_head ellist; /* eligible list member */
138 struct list_head hlist; /* hash list member */
139 struct list_head dlist; /* drop list member */
141 u64 cl_total; /* total work in bytes */
142 u64 cl_cumul; /* cumulative work in bytes done by
143 real-time criteria */
145 u64 cl_d; /* deadline*/
146 u64 cl_e; /* eligible time */
147 u64 cl_vt; /* virtual time */
148 u64 cl_f; /* time when this class will fit for
149 link-sharing, max(myf, cfmin) */
150 u64 cl_myf; /* my fit-time (calculated from this
151 class's own upperlimit curve) */
152 u64 cl_myfadj; /* my fit-time adjustment (to cancel
153 history dependence) */
154 u64 cl_cfmin; /* earliest children's fit-time (used
155 with cl_myf to obtain cl_f) */
156 u64 cl_cvtmin; /* minimal virtual time among the
157 children fit for link-sharing
158 (monotonic within a period) */
159 u64 cl_vtadj; /* intra-period cumulative vt
161 u64 cl_vtoff; /* inter-period cumulative vt offset */
162 u64 cl_cvtmax; /* max child's vt in the last period */
164 struct internal_sc cl_rsc; /* internal real-time service curve */
165 struct internal_sc cl_fsc; /* internal fair service curve */
166 struct internal_sc cl_usc; /* internal upperlimit service curve */
167 struct runtime_sc cl_deadline; /* deadline curve */
168 struct runtime_sc cl_eligible; /* eligible curve */
169 struct runtime_sc cl_virtual; /* virtual curve */
170 struct runtime_sc cl_ulimit; /* upperlimit curve */
172 unsigned long cl_flags; /* which curves are valid */
173 unsigned long cl_vtperiod; /* vt period sequence number */
174 unsigned long cl_parentperiod;/* parent's vt period sequence number*/
175 unsigned long cl_nactive; /* number of active children */
178 #define HFSC_HSIZE 16
182 u16 defcls; /* default class id */
183 struct hfsc_class root; /* root class */
184 struct list_head clhash[HFSC_HSIZE]; /* class hash */
185 struct list_head eligible; /* eligible list */
186 struct list_head droplist; /* active leaf class list (for
188 struct sk_buff_head requeue; /* requeued packet */
189 struct timer_list wd_timer; /* watchdog timer */
195 #if PSCHED_CLOCK_SOURCE == PSCHED_GETTIMEOFDAY
196 #include <linux/time.h>
197 #undef PSCHED_GET_TIME
198 #define PSCHED_GET_TIME(stamp) \
201 do_gettimeofday(&tv); \
202 (stamp) = 1000000ULL * tv.tv_sec + tv.tv_usec; \
207 #define ASSERT(cond) \
209 if (unlikely(!(cond))) \
210 printk("assertion %s failed at %s:%i (%s)\n", \
211 #cond, __FILE__, __LINE__, __FUNCTION__); \
215 #endif /* HFSC_DEBUG */
217 #define HT_INFINITY 0xffffffffffffffffULL /* infinite time value */
221 * eligible list holds backlogged classes being sorted by their eligible times.
222 * there is one eligible list per hfsc instance.
226 ellist_insert(struct hfsc_class *cl)
228 struct list_head *head = &cl->sched->eligible;
229 struct hfsc_class *p;
231 /* check the last entry first */
232 if (list_empty(head) ||
233 ((p = list_entry(head->prev, struct hfsc_class, ellist)) &&
234 p->cl_e <= cl->cl_e)) {
235 list_add_tail(&cl->ellist, head);
239 list_for_each_entry(p, head, ellist) {
240 if (cl->cl_e < p->cl_e) {
241 /* insert cl before p */
242 list_add_tail(&cl->ellist, &p->ellist);
246 ASSERT(0); /* should not reach here */
250 ellist_remove(struct hfsc_class *cl)
252 list_del(&cl->ellist);
256 ellist_update(struct hfsc_class *cl)
258 struct list_head *head = &cl->sched->eligible;
259 struct hfsc_class *p, *last;
262 * the eligible time of a class increases monotonically.
263 * if the next entry has a larger eligible time, nothing to do.
265 if (cl->ellist.next == head ||
266 ((p = list_entry(cl->ellist.next, struct hfsc_class, ellist)) &&
267 cl->cl_e <= p->cl_e))
270 /* check the last entry */
271 last = list_entry(head->prev, struct hfsc_class, ellist);
272 if (last->cl_e <= cl->cl_e) {
273 list_move_tail(&cl->ellist, head);
278 * the new position must be between the next entry
281 list_for_each_entry_continue(p, head, ellist) {
282 if (cl->cl_e < p->cl_e) {
283 list_move_tail(&cl->ellist, &p->ellist);
287 ASSERT(0); /* should not reach here */
290 /* find the class with the minimum deadline among the eligible classes */
291 static inline struct hfsc_class *
292 ellist_get_mindl(struct list_head *head, u64 cur_time)
294 struct hfsc_class *p, *cl = NULL;
296 list_for_each_entry(p, head, ellist) {
297 if (p->cl_e > cur_time)
299 if (cl == NULL || p->cl_d < cl->cl_d)
305 /* find the class with minimum eligible time among the eligible classes */
306 static inline struct hfsc_class *
307 ellist_get_minel(struct list_head *head)
309 if (list_empty(head))
311 return list_entry(head->next, struct hfsc_class, ellist);
315 * active children list holds backlogged child classes being sorted
316 * by their virtual time. each intermediate class has one active
320 actlist_insert(struct hfsc_class *cl)
322 struct list_head *head = &cl->cl_parent->actlist;
323 struct hfsc_class *p;
325 /* check the last entry first */
326 if (list_empty(head) ||
327 ((p = list_entry(head->prev, struct hfsc_class, alist)) &&
328 p->cl_vt <= cl->cl_vt)) {
329 list_add_tail(&cl->alist, head);
333 list_for_each_entry(p, head, alist) {
334 if (cl->cl_vt < p->cl_vt) {
335 /* insert cl before p */
336 list_add_tail(&cl->alist, &p->alist);
340 ASSERT(0); /* should not reach here */
344 actlist_remove(struct hfsc_class *cl)
346 list_del(&cl->alist);
350 actlist_update(struct hfsc_class *cl)
352 struct list_head *head = &cl->cl_parent->actlist;
353 struct hfsc_class *p, *last;
356 * the virtual time of a class increases monotonically.
357 * if the next entry has a larger virtual time, nothing to do.
359 if (cl->alist.next == head ||
360 ((p = list_entry(cl->alist.next, struct hfsc_class, alist)) &&
361 cl->cl_vt <= p->cl_vt))
364 /* check the last entry */
365 last = list_entry(head->prev, struct hfsc_class, alist);
366 if (last->cl_vt <= cl->cl_vt) {
367 list_move_tail(&cl->alist, head);
372 * the new position must be between the next entry
375 list_for_each_entry_continue(p, head, alist) {
376 if (cl->cl_vt < p->cl_vt) {
377 list_move_tail(&cl->alist, &p->alist);
381 ASSERT(0); /* should not reach here */
384 static inline struct hfsc_class *
385 actlist_firstfit(struct hfsc_class *cl, u64 cur_time)
387 struct hfsc_class *p;
389 list_for_each_entry(p, &cl->actlist, alist) {
390 if (p->cl_f <= cur_time) {
398 * get the leaf class with the minimum vt in the hierarchy
400 static struct hfsc_class *
401 actlist_get_minvt(struct hfsc_class *cl, u64 cur_time)
403 /* if root-class's cfmin is bigger than cur_time nothing to do */
404 if (cl->cl_cfmin > cur_time)
407 while (cl->level > 0) {
408 cl = actlist_firstfit(cl, cur_time);
412 * update parent's cl_cvtmin.
414 if (cl->cl_parent->cl_cvtmin < cl->cl_vt)
415 cl->cl_parent->cl_cvtmin = cl->cl_vt;
421 * service curve support functions
423 * external service curve parameters
426 * internal service curve parameters
427 * sm: (bytes/psched_us) << SM_SHIFT
428 * ism: (psched_us/byte) << ISM_SHIFT
431 * Time source resolution
432 * PSCHED_JIFFIES: for 48<=HZ<=1534 resolution is between 0.63us and 1.27us.
433 * PSCHED_CPU: resolution is between 0.5us and 1us.
434 * PSCHED_GETTIMEOFDAY: resolution is exactly 1us.
436 * sm and ism are scaled in order to keep effective digits.
437 * SM_SHIFT and ISM_SHIFT are selected to keep at least 4 effective
438 * digits in decimal using the following table.
440 * Note: We can afford the additional accuracy (altq hfsc keeps at most
441 * 3 effective digits) thanks to the fact that linux clock is bounded
444 * bits/sec 100Kbps 1Mbps 10Mbps 100Mbps 1Gbps
445 * ------------+-------------------------------------------------------
446 * bytes/0.5us 6.25e-3 62.5e-3 625e-3 6250e-e 62500e-3
447 * bytes/us 12.5e-3 125e-3 1250e-3 12500e-3 125000e-3
448 * bytes/1.27us 15.875e-3 158.75e-3 1587.5e-3 15875e-3 158750e-3
450 * 0.5us/byte 160 16 1.6 0.16 0.016
451 * us/byte 80 8 0.8 0.08 0.008
452 * 1.27us/byte 63 6.3 0.63 0.063 0.0063
457 #define SM_MASK ((1ULL << SM_SHIFT) - 1)
458 #define ISM_MASK ((1ULL << ISM_SHIFT) - 1)
461 seg_x2y(u64 x, u64 sm)
467 * y = x * sm >> SM_SHIFT
468 * but divide it for the upper and lower bits to avoid overflow
470 y = (x >> SM_SHIFT) * sm + (((x & SM_MASK) * sm) >> SM_SHIFT);
475 seg_y2x(u64 y, u64 ism)
481 else if (ism == HT_INFINITY)
484 x = (y >> ISM_SHIFT) * ism
485 + (((y & ISM_MASK) * ism) >> ISM_SHIFT);
490 /* Convert m (bps) into sm (bytes/psched us) */
496 sm = ((u64)m << SM_SHIFT);
497 sm += PSCHED_JIFFIE2US(HZ) - 1;
498 do_div(sm, PSCHED_JIFFIE2US(HZ));
502 /* convert m (bps) into ism (psched us/byte) */
511 ism = ((u64)PSCHED_JIFFIE2US(HZ) << ISM_SHIFT);
518 /* convert d (us) into dx (psched us) */
524 dx = ((u64)d * PSCHED_JIFFIE2US(HZ));
530 /* convert sm (bytes/psched us) into m (bps) */
536 m = (sm * PSCHED_JIFFIE2US(HZ)) >> SM_SHIFT;
540 /* convert dx (psched us) into d (us) */
547 do_div(d, PSCHED_JIFFIE2US(HZ));
552 sc2isc(struct tc_service_curve *sc, struct internal_sc *isc)
554 isc->sm1 = m2sm(sc->m1);
555 isc->ism1 = m2ism(sc->m1);
556 isc->dx = d2dx(sc->d);
557 isc->dy = seg_x2y(isc->dx, isc->sm1);
558 isc->sm2 = m2sm(sc->m2);
559 isc->ism2 = m2ism(sc->m2);
563 * initialize the runtime service curve with the given internal
564 * service curve starting at (x, y).
567 rtsc_init(struct runtime_sc *rtsc, struct internal_sc *isc, u64 x, u64 y)
571 rtsc->sm1 = isc->sm1;
572 rtsc->ism1 = isc->ism1;
575 rtsc->sm2 = isc->sm2;
576 rtsc->ism2 = isc->ism2;
580 * calculate the y-projection of the runtime service curve by the
581 * given x-projection value
584 rtsc_y2x(struct runtime_sc *rtsc, u64 y)
590 else if (y <= rtsc->y + rtsc->dy) {
591 /* x belongs to the 1st segment */
593 x = rtsc->x + rtsc->dx;
595 x = rtsc->x + seg_y2x(y - rtsc->y, rtsc->ism1);
597 /* x belongs to the 2nd segment */
598 x = rtsc->x + rtsc->dx
599 + seg_y2x(y - rtsc->y - rtsc->dy, rtsc->ism2);
605 rtsc_x2y(struct runtime_sc *rtsc, u64 x)
611 else if (x <= rtsc->x + rtsc->dx)
612 /* y belongs to the 1st segment */
613 y = rtsc->y + seg_x2y(x - rtsc->x, rtsc->sm1);
615 /* y belongs to the 2nd segment */
616 y = rtsc->y + rtsc->dy
617 + seg_x2y(x - rtsc->x - rtsc->dx, rtsc->sm2);
622 * update the runtime service curve by taking the minimum of the current
623 * runtime service curve and the service curve starting at (x, y).
626 rtsc_min(struct runtime_sc *rtsc, struct internal_sc *isc, u64 x, u64 y)
631 if (isc->sm1 <= isc->sm2) {
632 /* service curve is convex */
633 y1 = rtsc_x2y(rtsc, x);
635 /* the current rtsc is smaller */
643 * service curve is concave
644 * compute the two y values of the current rtsc
648 y1 = rtsc_x2y(rtsc, x);
650 /* rtsc is below isc, no change to rtsc */
654 y2 = rtsc_x2y(rtsc, x + isc->dx);
655 if (y2 >= y + isc->dy) {
656 /* rtsc is above isc, replace rtsc by isc */
665 * the two curves intersect
666 * compute the offsets (dx, dy) using the reverse
667 * function of seg_x2y()
668 * seg_x2y(dx, sm1) == seg_x2y(dx, sm2) + (y1 - y)
670 dx = (y1 - y) << SM_SHIFT;
671 dsm = isc->sm1 - isc->sm2;
674 * check if (x, y1) belongs to the 1st segment of rtsc.
675 * if so, add the offset.
677 if (rtsc->x + rtsc->dx > x)
678 dx += rtsc->x + rtsc->dx - x;
679 dy = seg_x2y(dx, isc->sm1);
689 init_ed(struct hfsc_class *cl, unsigned int next_len)
693 PSCHED_GET_TIME(cur_time);
695 /* update the deadline curve */
696 rtsc_min(&cl->cl_deadline, &cl->cl_rsc, cur_time, cl->cl_cumul);
699 * update the eligible curve.
700 * for concave, it is equal to the deadline curve.
701 * for convex, it is a linear curve with slope m2.
703 cl->cl_eligible = cl->cl_deadline;
704 if (cl->cl_rsc.sm1 <= cl->cl_rsc.sm2) {
705 cl->cl_eligible.dx = 0;
706 cl->cl_eligible.dy = 0;
709 /* compute e and d */
710 cl->cl_e = rtsc_y2x(&cl->cl_eligible, cl->cl_cumul);
711 cl->cl_d = rtsc_y2x(&cl->cl_deadline, cl->cl_cumul + next_len);
717 update_ed(struct hfsc_class *cl, unsigned int next_len)
719 cl->cl_e = rtsc_y2x(&cl->cl_eligible, cl->cl_cumul);
720 cl->cl_d = rtsc_y2x(&cl->cl_deadline, cl->cl_cumul + next_len);
726 update_d(struct hfsc_class *cl, unsigned int next_len)
728 cl->cl_d = rtsc_y2x(&cl->cl_deadline, cl->cl_cumul + next_len);
732 update_cfmin(struct hfsc_class *cl)
734 struct hfsc_class *p;
737 if (list_empty(&cl->actlist)) {
742 list_for_each_entry(p, &cl->actlist, alist) {
750 cl->cl_cfmin = cfmin;
754 init_vf(struct hfsc_class *cl, unsigned int len)
756 struct hfsc_class *max_cl, *p;
762 for (; cl->cl_parent != NULL; cl = cl->cl_parent) {
763 if (go_active && cl->cl_nactive++ == 0)
769 if (!list_empty(&cl->cl_parent->actlist)) {
770 max_cl = list_entry(cl->cl_parent->actlist.prev,
771 struct hfsc_class, alist);
773 * set vt to the average of the min and max
774 * classes. if the parent's period didn't
775 * change, don't decrease vt of the class.
778 if (cl->cl_parent->cl_cvtmin != 0)
779 vt = (cl->cl_parent->cl_cvtmin + vt)/2;
781 if (cl->cl_parent->cl_vtperiod !=
782 cl->cl_parentperiod || vt > cl->cl_vt)
786 * first child for a new parent backlog period.
787 * add parent's cvtmax to vtoff of children
788 * to make a new vt (vtoff + vt) larger than
789 * the vt in the last period for all children.
791 vt = cl->cl_parent->cl_cvtmax;
792 list_for_each_entry(p, &cl->cl_parent->children,
796 cl->cl_parent->cl_cvtmax = 0;
797 cl->cl_parent->cl_cvtmin = 0;
800 /* update the virtual curve */
801 vt = cl->cl_vt + cl->cl_vtoff;
802 rtsc_min(&cl->cl_virtual, &cl->cl_fsc, vt,
804 if (cl->cl_virtual.x == vt) {
805 cl->cl_virtual.x -= cl->cl_vtoff;
810 cl->cl_vtperiod++; /* increment vt period */
811 cl->cl_parentperiod = cl->cl_parent->cl_vtperiod;
812 if (cl->cl_parent->cl_nactive == 0)
813 cl->cl_parentperiod++;
818 if (cl->cl_flags & HFSC_USC) {
819 /* class has upper limit curve */
821 PSCHED_GET_TIME(cur_time);
823 /* update the ulimit curve */
824 rtsc_min(&cl->cl_ulimit, &cl->cl_usc, cur_time,
827 cl->cl_myf = rtsc_y2x(&cl->cl_ulimit,
833 f = max(cl->cl_myf, cl->cl_cfmin);
836 update_cfmin(cl->cl_parent);
842 update_vf(struct hfsc_class *cl, unsigned int len, u64 cur_time)
844 u64 f; /* , myf_bound, delta; */
847 if (cl->qdisc->q.qlen == 0 && cl->cl_flags & HFSC_FSC)
850 for (; cl->cl_parent != NULL; cl = cl->cl_parent) {
853 if (!(cl->cl_flags & HFSC_FSC) || cl->cl_nactive == 0)
856 if (go_passive && --cl->cl_nactive == 0)
862 /* no more active child, going passive */
864 /* update cvtmax of the parent class */
865 if (cl->cl_vt > cl->cl_parent->cl_cvtmax)
866 cl->cl_parent->cl_cvtmax = cl->cl_vt;
868 /* remove this class from the vt list */
871 update_cfmin(cl->cl_parent);
879 cl->cl_vt = rtsc_y2x(&cl->cl_virtual, cl->cl_total)
880 - cl->cl_vtoff + cl->cl_vtadj;
883 * if vt of the class is smaller than cvtmin,
884 * the class was skipped in the past due to non-fit.
885 * if so, we need to adjust vtadj.
887 if (cl->cl_vt < cl->cl_parent->cl_cvtmin) {
888 cl->cl_vtadj += cl->cl_parent->cl_cvtmin - cl->cl_vt;
889 cl->cl_vt = cl->cl_parent->cl_cvtmin;
892 /* update the vt list */
895 if (cl->cl_flags & HFSC_USC) {
896 cl->cl_myf = cl->cl_myfadj + rtsc_y2x(&cl->cl_ulimit,
900 * This code causes classes to stay way under their
901 * limit when multiple classes are used at gigabit
902 * speed. needs investigation. -kaber
905 * if myf lags behind by more than one clock tick
906 * from the current time, adjust myfadj to prevent
907 * a rate-limited class from going greedy.
908 * in a steady state under rate-limiting, myf
909 * fluctuates within one clock tick.
911 myf_bound = cur_time - PSCHED_JIFFIE2US(1);
912 if (cl->cl_myf < myf_bound) {
913 delta = cur_time - cl->cl_myf;
914 cl->cl_myfadj += delta;
920 f = max(cl->cl_myf, cl->cl_cfmin);
923 update_cfmin(cl->cl_parent);
929 set_active(struct hfsc_class *cl, unsigned int len)
931 if (cl->cl_flags & HFSC_RSC)
933 if (cl->cl_flags & HFSC_FSC)
936 list_add_tail(&cl->dlist, &cl->sched->droplist);
940 set_passive(struct hfsc_class *cl)
942 if (cl->cl_flags & HFSC_RSC)
945 list_del(&cl->dlist);
948 * actlist is now handled in update_vf() so that update_vf(cl, 0, 0)
949 * needs to be called explicitly to remove a class from actlist
954 * hack to get length of first packet in queue.
957 qdisc_peek_len(struct Qdisc *sch)
962 skb = sch->dequeue(sch);
965 printk("qdisc_peek_len: non work-conserving qdisc ?\n");
969 if (unlikely(sch->ops->requeue(skb, sch) != NET_XMIT_SUCCESS)) {
971 printk("qdisc_peek_len: failed to requeue\n");
978 hfsc_purge_queue(struct Qdisc *sch, struct hfsc_class *cl)
980 unsigned int len = cl->qdisc->q.qlen;
982 qdisc_reset(cl->qdisc);
991 hfsc_adjust_levels(struct hfsc_class *cl)
993 struct hfsc_class *p;
998 list_for_each_entry(p, &cl->children, siblings) {
999 if (p->level > level)
1002 cl->level = level + 1;
1003 } while ((cl = cl->cl_parent) != NULL);
1006 static inline unsigned int
1012 return h & (HFSC_HSIZE - 1);
1015 static inline struct hfsc_class *
1016 hfsc_find_class(u32 classid, struct Qdisc *sch)
1018 struct hfsc_sched *q = (struct hfsc_sched *)sch->data;
1019 struct hfsc_class *cl;
1021 list_for_each_entry(cl, &q->clhash[hfsc_hash(classid)], hlist) {
1022 if (cl->classid == classid)
1029 hfsc_change_rsc(struct hfsc_class *cl, struct tc_service_curve *rsc,
1032 sc2isc(rsc, &cl->cl_rsc);
1033 rtsc_init(&cl->cl_deadline, &cl->cl_rsc, cur_time, cl->cl_cumul);
1034 cl->cl_eligible = cl->cl_deadline;
1035 if (cl->cl_rsc.sm1 <= cl->cl_rsc.sm2) {
1036 cl->cl_eligible.dx = 0;
1037 cl->cl_eligible.dy = 0;
1039 cl->cl_flags |= HFSC_RSC;
1043 hfsc_change_fsc(struct hfsc_class *cl, struct tc_service_curve *fsc)
1045 sc2isc(fsc, &cl->cl_fsc);
1046 rtsc_init(&cl->cl_virtual, &cl->cl_fsc, cl->cl_vt, cl->cl_total);
1047 cl->cl_flags |= HFSC_FSC;
1051 hfsc_change_usc(struct hfsc_class *cl, struct tc_service_curve *usc,
1054 sc2isc(usc, &cl->cl_usc);
1055 rtsc_init(&cl->cl_ulimit, &cl->cl_usc, cur_time, cl->cl_total);
1056 cl->cl_flags |= HFSC_USC;
1060 hfsc_change_class(struct Qdisc *sch, u32 classid, u32 parentid,
1061 struct rtattr **tca, unsigned long *arg)
1063 struct hfsc_sched *q = (struct hfsc_sched *)sch->data;
1064 struct hfsc_class *cl = (struct hfsc_class *)*arg;
1065 struct hfsc_class *parent = NULL;
1066 struct rtattr *opt = tca[TCA_OPTIONS-1];
1067 struct rtattr *tb[TCA_HFSC_MAX];
1068 struct tc_service_curve *rsc = NULL, *fsc = NULL, *usc = NULL;
1072 rtattr_parse(tb, TCA_HFSC_MAX, RTA_DATA(opt), RTA_PAYLOAD(opt)))
1075 if (tb[TCA_HFSC_RSC-1]) {
1076 if (RTA_PAYLOAD(tb[TCA_HFSC_RSC-1]) < sizeof(*rsc))
1078 rsc = RTA_DATA(tb[TCA_HFSC_RSC-1]);
1079 if (rsc->m1 == 0 && rsc->m2 == 0)
1083 if (tb[TCA_HFSC_FSC-1]) {
1084 if (RTA_PAYLOAD(tb[TCA_HFSC_FSC-1]) < sizeof(*fsc))
1086 fsc = RTA_DATA(tb[TCA_HFSC_FSC-1]);
1087 if (fsc->m1 == 0 && fsc->m2 == 0)
1091 if (tb[TCA_HFSC_USC-1]) {
1092 if (RTA_PAYLOAD(tb[TCA_HFSC_USC-1]) < sizeof(*usc))
1094 usc = RTA_DATA(tb[TCA_HFSC_USC-1]);
1095 if (usc->m1 == 0 && usc->m2 == 0)
1101 if (cl->cl_parent && cl->cl_parent->classid != parentid)
1103 if (cl->cl_parent == NULL && parentid != TC_H_ROOT)
1106 PSCHED_GET_TIME(cur_time);
1110 hfsc_change_rsc(cl, rsc, cur_time);
1112 hfsc_change_fsc(cl, fsc);
1114 hfsc_change_usc(cl, usc, cur_time);
1116 if (cl->qdisc->q.qlen != 0) {
1117 if (cl->cl_flags & HFSC_RSC)
1118 update_ed(cl, qdisc_peek_len(cl->qdisc));
1119 if (cl->cl_flags & HFSC_FSC)
1120 update_vf(cl, 0, cur_time);
1122 sch_tree_unlock(sch);
1124 #ifdef CONFIG_NET_ESTIMATOR
1125 if (tca[TCA_RATE-1]) {
1126 qdisc_kill_estimator(&cl->stats);
1127 qdisc_new_estimator(&cl->stats, tca[TCA_RATE-1]);
1133 if (parentid == TC_H_ROOT)
1138 parent = hfsc_find_class(parentid, sch);
1143 if (classid == 0 || TC_H_MAJ(classid ^ sch->handle) != 0)
1145 if (hfsc_find_class(classid, sch))
1148 if (rsc == NULL && fsc == NULL)
1151 cl = kmalloc(sizeof(struct hfsc_class), GFP_KERNEL);
1154 memset(cl, 0, sizeof(struct hfsc_class));
1157 hfsc_change_rsc(cl, rsc, 0);
1159 hfsc_change_fsc(cl, fsc);
1161 hfsc_change_usc(cl, usc, 0);
1164 cl->classid = classid;
1166 cl->cl_parent = parent;
1167 cl->qdisc = qdisc_create_dflt(sch->dev, &pfifo_qdisc_ops);
1168 if (cl->qdisc == NULL)
1169 cl->qdisc = &noop_qdisc;
1170 cl->stats.lock = &sch->dev->queue_lock;
1171 INIT_LIST_HEAD(&cl->children);
1172 INIT_LIST_HEAD(&cl->actlist);
1175 list_add_tail(&cl->hlist, &q->clhash[hfsc_hash(classid)]);
1176 list_add_tail(&cl->siblings, &parent->children);
1177 if (parent->level == 0)
1178 hfsc_purge_queue(sch, parent);
1179 hfsc_adjust_levels(parent);
1180 sch_tree_unlock(sch);
1182 #ifdef CONFIG_NET_ESTIMATOR
1183 if (tca[TCA_RATE-1])
1184 qdisc_new_estimator(&cl->stats, tca[TCA_RATE-1]);
1186 *arg = (unsigned long)cl;
1191 hfsc_destroy_filters(struct tcf_proto **fl)
1193 struct tcf_proto *tp;
1195 while ((tp = *fl) != NULL) {
1202 hfsc_destroy_class(struct Qdisc *sch, struct hfsc_class *cl)
1204 struct hfsc_sched *q = (struct hfsc_sched *)sch->data;
1206 hfsc_destroy_filters(&cl->filter_list);
1207 qdisc_destroy(cl->qdisc);
1208 #ifdef CONFIG_NET_ESTIMATOR
1209 qdisc_kill_estimator(&cl->stats);
1216 hfsc_delete_class(struct Qdisc *sch, unsigned long arg)
1218 struct hfsc_sched *q = (struct hfsc_sched *)sch->data;
1219 struct hfsc_class *cl = (struct hfsc_class *)arg;
1221 if (cl->level > 0 || cl->filter_cnt > 0 || cl == &q->root)
1226 list_del(&cl->hlist);
1227 list_del(&cl->siblings);
1228 hfsc_adjust_levels(cl->cl_parent);
1229 hfsc_purge_queue(sch, cl);
1230 if (--cl->refcnt == 0)
1231 hfsc_destroy_class(sch, cl);
1233 sch_tree_unlock(sch);
1237 static struct hfsc_class *
1238 hfsc_classify(struct sk_buff *skb, struct Qdisc *sch)
1240 struct hfsc_sched *q = (struct hfsc_sched *)sch->data;
1241 struct hfsc_class *cl;
1242 struct tcf_result res;
1243 struct tcf_proto *tcf;
1246 if (TC_H_MAJ(skb->priority ^ sch->handle) == 0 &&
1247 (cl = hfsc_find_class(skb->priority, sch)) != NULL)
1251 tcf = q->root.filter_list;
1252 while (tcf && (result = tc_classify(skb, tcf, &res)) >= 0) {
1253 #ifdef CONFIG_NET_CLS_POLICE
1254 if (result == TC_POLICE_SHOT)
1257 if ((cl = (struct hfsc_class *)res.class) == NULL) {
1258 if ((cl = hfsc_find_class(res.classid, sch)) == NULL)
1259 break; /* filter selected invalid classid */
1263 return cl; /* hit leaf class */
1265 /* apply inner filter chain */
1266 tcf = cl->filter_list;
1269 /* classification failed, try default class */
1270 cl = hfsc_find_class(TC_H_MAKE(TC_H_MAJ(sch->handle), q->defcls), sch);
1271 if (cl == NULL || cl->level > 0)
1278 hfsc_graft_class(struct Qdisc *sch, unsigned long arg, struct Qdisc *new,
1281 struct hfsc_class *cl = (struct hfsc_class *)arg;
1288 new = qdisc_create_dflt(sch->dev, &pfifo_qdisc_ops);
1294 hfsc_purge_queue(sch, cl);
1295 *old = xchg(&cl->qdisc, new);
1296 sch_tree_unlock(sch);
1300 static struct Qdisc *
1301 hfsc_class_leaf(struct Qdisc *sch, unsigned long arg)
1303 struct hfsc_class *cl = (struct hfsc_class *)arg;
1305 if (cl != NULL && cl->level == 0)
1311 static unsigned long
1312 hfsc_get_class(struct Qdisc *sch, u32 classid)
1314 struct hfsc_class *cl = hfsc_find_class(classid, sch);
1319 return (unsigned long)cl;
1323 hfsc_put_class(struct Qdisc *sch, unsigned long arg)
1325 struct hfsc_class *cl = (struct hfsc_class *)arg;
1327 if (--cl->refcnt == 0)
1328 hfsc_destroy_class(sch, cl);
1331 static unsigned long
1332 hfsc_bind_tcf(struct Qdisc *sch, unsigned long parent, u32 classid)
1334 struct hfsc_class *p = (struct hfsc_class *)parent;
1335 struct hfsc_class *cl = hfsc_find_class(classid, sch);
1338 if (p != NULL && p->level <= cl->level)
1343 return (unsigned long)cl;
1347 hfsc_unbind_tcf(struct Qdisc *sch, unsigned long arg)
1349 struct hfsc_class *cl = (struct hfsc_class *)arg;
1354 static struct tcf_proto **
1355 hfsc_tcf_chain(struct Qdisc *sch, unsigned long arg)
1357 struct hfsc_sched *q = (struct hfsc_sched *)sch->data;
1358 struct hfsc_class *cl = (struct hfsc_class *)arg;
1363 return &cl->filter_list;
1367 hfsc_dump_sc(struct sk_buff *skb, int attr, struct internal_sc *sc)
1369 struct tc_service_curve tsc;
1371 tsc.m1 = sm2m(sc->sm1);
1372 tsc.d = dx2d(sc->dx);
1373 tsc.m2 = sm2m(sc->sm2);
1374 RTA_PUT(skb, attr, sizeof(tsc), &tsc);
1383 hfsc_dump_curves(struct sk_buff *skb, struct hfsc_class *cl)
1385 if ((cl->cl_flags & HFSC_RSC) &&
1386 (hfsc_dump_sc(skb, TCA_HFSC_RSC, &cl->cl_rsc) < 0))
1387 goto rtattr_failure;
1389 if ((cl->cl_flags & HFSC_FSC) &&
1390 (hfsc_dump_sc(skb, TCA_HFSC_FSC, &cl->cl_fsc) < 0))
1391 goto rtattr_failure;
1393 if ((cl->cl_flags & HFSC_USC) &&
1394 (hfsc_dump_sc(skb, TCA_HFSC_USC, &cl->cl_usc) < 0))
1395 goto rtattr_failure;
1404 hfsc_dump_stats(struct sk_buff *skb, struct hfsc_class *cl)
1406 cl->stats.qlen = cl->qdisc->q.qlen;
1407 if (qdisc_copy_stats(skb, &cl->stats) < 0)
1408 goto rtattr_failure;
1417 hfsc_dump_xstats(struct sk_buff *skb, struct hfsc_class *cl)
1419 struct tc_hfsc_stats xstats;
1421 xstats.level = cl->level;
1422 xstats.period = cl->cl_vtperiod;
1423 xstats.work = cl->cl_total;
1424 xstats.rtwork = cl->cl_cumul;
1425 RTA_PUT(skb, TCA_XSTATS, sizeof(xstats), &xstats);
1434 hfsc_dump_class(struct Qdisc *sch, unsigned long arg, struct sk_buff *skb,
1437 struct hfsc_class *cl = (struct hfsc_class *)arg;
1438 unsigned char *b = skb->tail;
1439 struct rtattr *rta = (struct rtattr *)b;
1441 tcm->tcm_parent = cl->cl_parent ? cl->cl_parent->classid : TC_H_ROOT;
1442 tcm->tcm_handle = cl->classid;
1444 tcm->tcm_info = cl->qdisc->handle;
1446 RTA_PUT(skb, TCA_OPTIONS, 0, NULL);
1447 if (hfsc_dump_curves(skb, cl) < 0)
1448 goto rtattr_failure;
1449 rta->rta_len = skb->tail - b;
1451 if ((hfsc_dump_stats(skb, cl) < 0) ||
1452 (hfsc_dump_xstats(skb, cl) < 0))
1453 goto rtattr_failure;
1458 skb_trim(skb, b - skb->data);
1463 hfsc_walk(struct Qdisc *sch, struct qdisc_walker *arg)
1465 struct hfsc_sched *q = (struct hfsc_sched *)sch->data;
1466 struct hfsc_class *cl;
1472 for (i = 0; i < HFSC_HSIZE; i++) {
1473 list_for_each_entry(cl, &q->clhash[i], hlist) {
1474 if (arg->count < arg->skip) {
1478 if (arg->fn(sch, (unsigned long)cl, arg) < 0) {
1488 hfsc_watchdog(unsigned long arg)
1490 struct Qdisc *sch = (struct Qdisc *)arg;
1492 sch->flags &= ~TCQ_F_THROTTLED;
1493 netif_schedule(sch->dev);
1497 hfsc_schedule_watchdog(struct Qdisc *sch, u64 cur_time)
1499 struct hfsc_sched *q = (struct hfsc_sched *)sch->data;
1500 struct hfsc_class *cl;
1504 if ((cl = ellist_get_minel(&q->eligible)) != NULL)
1505 next_time = cl->cl_e;
1506 if (q->root.cl_cfmin != 0) {
1507 if (next_time == 0 || next_time > q->root.cl_cfmin)
1508 next_time = q->root.cl_cfmin;
1510 ASSERT(next_time != 0);
1511 delay = next_time - cur_time;
1512 delay = PSCHED_US2JIFFIE(delay);
1514 sch->flags |= TCQ_F_THROTTLED;
1515 mod_timer(&q->wd_timer, jiffies + delay);
1519 hfsc_init_qdisc(struct Qdisc *sch, struct rtattr *opt)
1521 struct hfsc_sched *q = (struct hfsc_sched *)sch->data;
1522 struct tc_hfsc_qopt *qopt;
1525 if (opt == NULL || RTA_PAYLOAD(opt) < sizeof(*qopt))
1527 qopt = RTA_DATA(opt);
1529 memset(q, 0, sizeof(struct hfsc_sched));
1530 sch->stats.lock = &sch->dev->queue_lock;
1532 q->defcls = qopt->defcls;
1533 for (i = 0; i < HFSC_HSIZE; i++)
1534 INIT_LIST_HEAD(&q->clhash[i]);
1535 INIT_LIST_HEAD(&q->eligible);
1536 INIT_LIST_HEAD(&q->droplist);
1537 skb_queue_head_init(&q->requeue);
1540 q->root.classid = sch->handle;
1542 q->root.qdisc = qdisc_create_dflt(sch->dev, &pfifo_qdisc_ops);
1543 if (q->root.qdisc == NULL)
1544 q->root.qdisc = &noop_qdisc;
1545 q->root.stats.lock = &sch->dev->queue_lock;
1546 INIT_LIST_HEAD(&q->root.children);
1547 INIT_LIST_HEAD(&q->root.actlist);
1549 list_add(&q->root.hlist, &q->clhash[hfsc_hash(q->root.classid)]);
1551 init_timer(&q->wd_timer);
1552 q->wd_timer.function = hfsc_watchdog;
1553 q->wd_timer.data = (unsigned long)sch;
1559 hfsc_change_qdisc(struct Qdisc *sch, struct rtattr *opt)
1561 struct hfsc_sched *q = (struct hfsc_sched *)sch->data;
1562 struct tc_hfsc_qopt *qopt;
1564 if (opt == NULL || RTA_PAYLOAD(opt) < sizeof(*qopt))
1566 qopt = RTA_DATA(opt);
1569 q->defcls = qopt->defcls;
1570 sch_tree_unlock(sch);
1576 hfsc_reset_class(struct hfsc_class *cl)
1587 cl->cl_vtperiod = 0;
1588 cl->cl_parentperiod = 0;
1594 INIT_LIST_HEAD(&cl->actlist);
1595 qdisc_reset(cl->qdisc);
1597 if (cl->cl_flags & HFSC_RSC)
1598 rtsc_init(&cl->cl_deadline, &cl->cl_rsc, 0, 0);
1599 if (cl->cl_flags & HFSC_FSC)
1600 rtsc_init(&cl->cl_virtual, &cl->cl_fsc, 0, 0);
1601 if (cl->cl_flags & HFSC_USC)
1602 rtsc_init(&cl->cl_ulimit, &cl->cl_usc, 0, 0);
1606 hfsc_reset_qdisc(struct Qdisc *sch)
1608 struct hfsc_sched *q = (struct hfsc_sched *)sch->data;
1609 struct hfsc_class *cl;
1612 for (i = 0; i < HFSC_HSIZE; i++) {
1613 list_for_each_entry(cl, &q->clhash[i], hlist)
1614 hfsc_reset_class(cl);
1616 __skb_queue_purge(&q->requeue);
1617 INIT_LIST_HEAD(&q->eligible);
1618 INIT_LIST_HEAD(&q->droplist);
1619 del_timer(&q->wd_timer);
1620 sch->flags &= ~TCQ_F_THROTTLED;
1625 hfsc_destroy_qdisc(struct Qdisc *sch)
1627 struct hfsc_sched *q = (struct hfsc_sched *)sch->data;
1628 struct hfsc_class *cl, *next;
1631 for (i = 0; i < HFSC_HSIZE; i++) {
1632 list_for_each_entry_safe(cl, next, &q->clhash[i], hlist)
1633 hfsc_destroy_class(sch, cl);
1635 __skb_queue_purge(&q->requeue);
1636 del_timer(&q->wd_timer);
1640 hfsc_dump_qdisc(struct Qdisc *sch, struct sk_buff *skb)
1642 struct hfsc_sched *q = (struct hfsc_sched *)sch->data;
1643 unsigned char *b = skb->tail;
1644 struct tc_hfsc_qopt qopt;
1646 qopt.defcls = q->defcls;
1647 RTA_PUT(skb, TCA_OPTIONS, sizeof(qopt), &qopt);
1649 sch->stats.qlen = sch->q.qlen;
1650 if (qdisc_copy_stats(skb, &sch->stats) < 0)
1651 goto rtattr_failure;
1656 skb_trim(skb, b - skb->data);
1661 hfsc_enqueue(struct sk_buff *skb, struct Qdisc *sch)
1663 struct hfsc_class *cl = hfsc_classify(skb, sch);
1664 unsigned int len = skb->len;
1670 return NET_XMIT_DROP;
1673 err = cl->qdisc->enqueue(skb, cl->qdisc);
1674 if (unlikely(err != NET_XMIT_SUCCESS)) {
1680 if (cl->qdisc->q.qlen == 1)
1681 set_active(cl, len);
1683 cl->stats.packets++;
1684 cl->stats.bytes += len;
1685 sch->stats.packets++;
1686 sch->stats.bytes += len;
1689 return NET_XMIT_SUCCESS;
1692 static struct sk_buff *
1693 hfsc_dequeue(struct Qdisc *sch)
1695 struct hfsc_sched *q = (struct hfsc_sched *)sch->data;
1696 struct hfsc_class *cl;
1697 struct sk_buff *skb;
1699 unsigned int next_len;
1702 if (sch->q.qlen == 0)
1704 if ((skb = __skb_dequeue(&q->requeue)))
1707 PSCHED_GET_TIME(cur_time);
1710 * if there are eligible classes, use real-time criteria.
1711 * find the class with the minimum deadline among
1712 * the eligible classes.
1714 if ((cl = ellist_get_mindl(&q->eligible, cur_time)) != NULL) {
1718 * use link-sharing criteria
1719 * get the class with the minimum vt in the hierarchy
1721 cl = actlist_get_minvt(&q->root, cur_time);
1723 sch->stats.overlimits++;
1724 if (!netif_queue_stopped(sch->dev))
1725 hfsc_schedule_watchdog(sch, cur_time);
1730 skb = cl->qdisc->dequeue(cl->qdisc);
1732 if (net_ratelimit())
1733 printk("HFSC: Non-work-conserving qdisc ?\n");
1737 update_vf(cl, skb->len, cur_time);
1739 cl->cl_cumul += skb->len;
1741 if (cl->qdisc->q.qlen != 0) {
1742 if (cl->cl_flags & HFSC_RSC) {
1744 next_len = qdisc_peek_len(cl->qdisc);
1746 update_ed(cl, next_len);
1748 update_d(cl, next_len);
1751 /* the class becomes passive */
1756 sch->flags &= ~TCQ_F_THROTTLED;
1763 hfsc_requeue(struct sk_buff *skb, struct Qdisc *sch)
1765 struct hfsc_sched *q = (struct hfsc_sched *)sch->data;
1767 __skb_queue_head(&q->requeue, skb);
1769 return NET_XMIT_SUCCESS;
1773 hfsc_drop(struct Qdisc *sch)
1775 struct hfsc_sched *q = (struct hfsc_sched *)sch->data;
1776 struct hfsc_class *cl;
1779 list_for_each_entry(cl, &q->droplist, dlist) {
1780 if (cl->qdisc->ops->drop != NULL &&
1781 (len = cl->qdisc->ops->drop(cl->qdisc)) > 0) {
1782 if (cl->qdisc->q.qlen == 0) {
1783 update_vf(cl, 0, 0);
1786 list_move_tail(&cl->dlist, &q->droplist);
1797 static struct Qdisc_class_ops hfsc_class_ops = {
1798 .change = hfsc_change_class,
1799 .delete = hfsc_delete_class,
1800 .graft = hfsc_graft_class,
1801 .leaf = hfsc_class_leaf,
1802 .get = hfsc_get_class,
1803 .put = hfsc_put_class,
1804 .bind_tcf = hfsc_bind_tcf,
1805 .unbind_tcf = hfsc_unbind_tcf,
1806 .tcf_chain = hfsc_tcf_chain,
1807 .dump = hfsc_dump_class,
1811 static struct Qdisc_ops hfsc_qdisc_ops = {
1813 .init = hfsc_init_qdisc,
1814 .change = hfsc_change_qdisc,
1815 .reset = hfsc_reset_qdisc,
1816 .destroy = hfsc_destroy_qdisc,
1817 .dump = hfsc_dump_qdisc,
1818 .enqueue = hfsc_enqueue,
1819 .dequeue = hfsc_dequeue,
1820 .requeue = hfsc_requeue,
1822 .cl_ops = &hfsc_class_ops,
1823 .priv_size = sizeof(struct hfsc_sched),
1824 .owner = THIS_MODULE
1830 return register_qdisc(&hfsc_qdisc_ops);
1836 unregister_qdisc(&hfsc_qdisc_ops);
1839 MODULE_LICENSE("GPL");
1840 module_init(hfsc_init);
1841 module_exit(hfsc_cleanup);