altq_wfq.c revision 1.4 1 /* $NetBSD: altq_wfq.c,v 1.4 2001/11/12 23:14:23 lukem Exp $ */
2 /* $KAME: altq_wfq.c,v 1.7 2000/12/14 08:12:46 thorpej Exp $ */
3
4 /*
5 * Copyright (C) 1997-2000
6 * Sony Computer Science Laboratories Inc. All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
10 * are met:
11 * 1. Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the
15 * documentation and/or other materials provided with the distribution.
16 *
17 * THIS SOFTWARE IS PROVIDED BY SONY CSL AND CONTRIBUTORS ``AS IS'' AND
18 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20 * ARE DISCLAIMED. IN NO EVENT SHALL SONY CSL OR CONTRIBUTORS BE LIABLE
21 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 * SUCH DAMAGE.
28 */
29 /*
30 * March 27, 1997. Written by Hiroshi Kyusojin of Keio University
31 * (kyu (at) mt.cs.keio.ac.jp).
32 */
33
34 #include <sys/cdefs.h>
35 __KERNEL_RCSID(0, "$NetBSD: altq_wfq.c,v 1.4 2001/11/12 23:14:23 lukem Exp $");
36
37 #if defined(__FreeBSD__) || defined(__NetBSD__)
38 #include "opt_altq.h"
39 #if (__FreeBSD__ != 2)
40 #include "opt_inet.h"
41 #ifdef __FreeBSD__
42 #include "opt_inet6.h"
43 #endif
44 #endif
45 #endif /* __FreeBSD__ || __NetBSD__ */
46 #ifdef ALTQ_WFQ
47
48 #include <sys/types.h>
49 #include <sys/param.h>
50 #include <sys/malloc.h>
51 #include <sys/mbuf.h>
52 #include <sys/uio.h>
53 #include <sys/socket.h>
54 #include <sys/systm.h>
55 #include <sys/proc.h>
56 #include <sys/errno.h>
57 #include <sys/time.h>
58 #include <sys/kernel.h>
59
60 #include <net/if.h>
61 #include <net/if_types.h>
62 #include <netinet/in.h>
63
64 #include <altq/altq.h>
65 #include <altq/altq_conf.h>
66 #include <altq/altq_wfq.h>
67
68 /*
69 #define WFQ_DEBUG
70 */
71
72 static int wfq_setenable(struct wfq_interface *, int);
73 static int wfq_ifattach(struct wfq_interface *);
74 static int wfq_ifdetach(struct wfq_interface *);
75 static int wfq_ifenqueue(struct ifaltq *, struct mbuf *,
76 struct altq_pktattr *);
77 static u_long wfq_hash(struct flowinfo *, int);
78 static __inline u_long wfq_hashbydstaddr(struct flowinfo *, int);
79 static __inline u_long wfq_hashbysrcport(struct flowinfo *, int);
80 static wfq *wfq_maxqueue(wfq_state_t *);
81 static struct mbuf *wfq_ifdequeue(struct ifaltq *, int);
82 static int wfq_getqid(struct wfq_getqid *);
83 static int wfq_setweight(struct wfq_setweight *);
84 static int wfq_getstats(struct wfq_getstats *);
85 static int wfq_config(struct wfq_conf *);
86 static int wfq_request __P((struct ifaltq *, int, void *));
87 static int wfq_flush(struct ifaltq *);
88 static void *wfq_classify(void *, struct mbuf *, int);
89
90 /* global value : pointer to wfq queue list */
91 static wfq_state_t *wfq_list = NULL;
92
93 static int
94 wfq_setenable(ifacep, flag)
95 struct wfq_interface *ifacep;
96 int flag;
97 {
98 wfq_state_t *wfqp;
99 int error = 0;
100
101 if ((wfqp = altq_lookup(ifacep->wfq_ifacename, ALTQT_WFQ)) == NULL)
102 return (EBADF);
103
104 switch(flag){
105 case ENABLE:
106 error = altq_enable(wfqp->ifq);
107 break;
108 case DISABLE:
109 error = altq_disable(wfqp->ifq);
110 break;
111 }
112 return error;
113 }
114
115
116 static int
117 wfq_ifattach(ifacep)
118 struct wfq_interface *ifacep;
119 {
120 int error = 0, i;
121 struct ifnet *ifp;
122 wfq_state_t *new_wfqp;
123 wfq *queue;
124
125 if ((ifp = ifunit(ifacep->wfq_ifacename)) == NULL) {
126 #ifdef WFQ_DEBUG
127 printf("wfq_ifattach()...no ifp found\n");
128 #endif
129 return (ENXIO);
130 }
131
132 if (!ALTQ_IS_READY(&ifp->if_snd)) {
133 #ifdef WFQ_DEBUG
134 printf("wfq_ifattach()...altq is not ready\n");
135 #endif
136 return (ENXIO);
137 }
138
139 /* allocate and initialize wfq_state_t */
140 MALLOC(new_wfqp, wfq_state_t *, sizeof(wfq_state_t),
141 M_DEVBUF, M_WAITOK);
142 if (new_wfqp == NULL)
143 return (ENOMEM);
144 bzero(new_wfqp, sizeof(wfq_state_t));
145 MALLOC(queue, wfq *, sizeof(wfq) * DEFAULT_QSIZE,
146 M_DEVBUF, M_WAITOK);
147 if (queue == NULL) {
148 FREE(new_wfqp, M_DEVBUF);
149 return (ENOMEM);
150 }
151 bzero(queue, sizeof(wfq) * DEFAULT_QSIZE);
152
153 /* keep the ifq */
154 new_wfqp->ifq = &ifp->if_snd;
155 new_wfqp->nums = DEFAULT_QSIZE;
156 new_wfqp->hwm = HWM;
157 new_wfqp->bytes = 0;
158 new_wfqp->rrp = NULL;
159 new_wfqp->queue = queue;
160 new_wfqp->hash_func = wfq_hashbydstaddr;
161 new_wfqp->fbmask = FIMB4_DADDR;
162
163 for (i = 0; i < new_wfqp->nums; i++, queue++) {
164 queue->next = queue->prev = NULL;
165 queue->head = queue->tail = NULL;
166 queue->bytes = queue->quota = 0;
167 queue->weight = 100;
168 }
169
170 /*
171 * set WFQ to this ifnet structure.
172 */
173 if ((error = altq_attach(&ifp->if_snd, ALTQT_WFQ, new_wfqp,
174 wfq_ifenqueue, wfq_ifdequeue, wfq_request,
175 new_wfqp, wfq_classify)) != 0) {
176 FREE(queue, M_DEVBUF);
177 FREE(new_wfqp, M_DEVBUF);
178 return (error);
179 }
180
181 new_wfqp->next = wfq_list;
182 wfq_list = new_wfqp;
183
184 return (error);
185 }
186
187
188 static int
189 wfq_ifdetach(ifacep)
190 struct wfq_interface *ifacep;
191 {
192 int error = 0;
193 wfq_state_t *wfqp;
194
195 if ((wfqp = altq_lookup(ifacep->wfq_ifacename, ALTQT_WFQ)) == NULL)
196 return (EBADF);
197
198 /* free queued mbuf */
199 wfq_flush(wfqp->ifq);
200
201 /* remove WFQ from the ifnet structure. */
202 (void)altq_disable(wfqp->ifq);
203 (void)altq_detach(wfqp->ifq);
204
205 /* remove from the wfqstate list */
206 if (wfq_list == wfqp)
207 wfq_list = wfqp->next;
208 else {
209 wfq_state_t *wp = wfq_list;
210 do {
211 if (wp->next == wfqp) {
212 wp->next = wfqp->next;
213 break;
214 }
215 } while ((wp = wp->next) != NULL);
216 }
217
218 /* deallocate wfq_state_t */
219 FREE(wfqp->queue, M_DEVBUF);
220 FREE(wfqp, M_DEVBUF);
221 return (error);
222 }
223
224 static int
225 wfq_request(ifq, req, arg)
226 struct ifaltq *ifq;
227 int req;
228 void *arg;
229 {
230 wfq_state_t *wfqp = (wfq_state_t *)ifq->altq_disc;
231
232 switch (req) {
233 case ALTRQ_PURGE:
234 wfq_flush(wfqp->ifq);
235 break;
236 }
237 return (0);
238 }
239
240
241 static int
242 wfq_flush(ifq)
243 struct ifaltq *ifq;
244 {
245 struct mbuf *mp;
246
247 while ((mp = wfq_ifdequeue(ifq, ALTDQ_REMOVE)) != NULL)
248 m_freem(mp);
249 if (ALTQ_IS_ENABLED(ifq))
250 ifq->ifq_len = 0;
251 return 0;
252 }
253
254 static void *
255 wfq_classify(clfier, m, af)
256 void *clfier;
257 struct mbuf *m;
258 int af;
259 {
260 wfq_state_t *wfqp = (wfq_state_t *)clfier;
261 struct flowinfo flow;
262
263 altq_extractflow(m, af, &flow, wfqp->fbmask);
264 return (&wfqp->queue[(*wfqp->hash_func)(&flow, wfqp->nums)]);
265 }
266
267 static int
268 wfq_ifenqueue(ifq, mp, pktattr)
269 struct ifaltq *ifq;
270 struct mbuf *mp;
271 struct altq_pktattr *pktattr;
272 {
273 wfq_state_t *wfqp;
274 wfq *queue;
275 int byte, error = 0;
276
277 wfqp = (wfq_state_t *)ifq->altq_disc;
278 mp->m_nextpkt = NULL;
279
280 /* grab a queue selected by classifier */
281 if (pktattr == NULL || (queue = pktattr->pattr_class) == NULL)
282 queue = &wfqp->queue[0];
283
284 if (queue->tail == NULL)
285 queue->head = mp;
286 else
287 queue->tail->m_nextpkt = mp;
288 queue->tail = mp;
289 byte = mp->m_pkthdr.len;
290 queue->bytes += byte;
291 wfqp->bytes += byte;
292 ifq->ifq_len++;
293
294 if (queue->next == NULL) {
295 /* this queue gets active. add the queue to the active list */
296 if (wfqp->rrp == NULL){
297 /* no queue in the active list */
298 queue->next = queue->prev = queue;
299 wfqp->rrp = queue;
300 WFQ_ADDQUOTA(queue);
301 } else {
302 /* insert the queue at the tail of the active list */
303 queue->prev = wfqp->rrp->prev;
304 wfqp->rrp->prev->next = queue;
305 wfqp->rrp->prev = queue;
306 queue->next = wfqp->rrp;
307 queue->quota = 0;
308 }
309 }
310
311 /* check overflow. if the total size exceeds the high water mark,
312 drop packets from the longest queue. */
313 while (wfqp->bytes > wfqp->hwm) {
314 wfq *drop_queue = wfq_maxqueue(wfqp);
315
316 /* drop the packet at the head. */
317 mp = drop_queue->head;
318 if ((drop_queue->head = mp->m_nextpkt) == NULL)
319 drop_queue->tail = NULL;
320 mp->m_nextpkt = NULL;
321 byte = mp->m_pkthdr.len;
322 drop_queue->bytes -= byte;
323 PKTCNTR_ADD(&drop_queue->drop_cnt, byte);
324 wfqp->bytes -= byte;
325 m_freem(mp);
326 ifq->ifq_len--;
327 if(drop_queue == queue)
328 /* the queue for this flow is selected to drop */
329 error = ENOBUFS;
330 }
331 return error;
332 }
333
334
335 static u_long wfq_hash(flow, n)
336 struct flowinfo *flow;
337 int n;
338 {
339 u_long val = 0;
340
341 if (flow != NULL) {
342 if (flow->fi_family == AF_INET) {
343 struct flowinfo_in *fp = (struct flowinfo_in *)flow;
344 u_long val2;
345
346 val = fp->fi_dst.s_addr ^ fp->fi_src.s_addr;
347 val = val ^ (val >> 8) ^ (val >> 16) ^ (val >> 24);
348 val2 = fp->fi_dport ^ fp->fi_sport ^ fp->fi_proto;
349 val2 = val2 ^ (val2 >> 8);
350 val = val ^ val2;
351 }
352 #ifdef INET6
353 else if (flow->fi_family == AF_INET6) {
354 struct flowinfo_in6 *fp6 = (struct flowinfo_in6 *)flow;
355
356 val = ntohl(fp6->fi6_flowlabel);
357 }
358 #endif
359 }
360
361 return (val % n);
362 }
363
364
365 static __inline u_long wfq_hashbydstaddr(flow, n)
366 struct flowinfo *flow;
367 int n;
368 {
369 u_long val = 0;
370
371 if (flow != NULL) {
372 if (flow->fi_family == AF_INET) {
373 struct flowinfo_in *fp = (struct flowinfo_in *)flow;
374
375 val = fp->fi_dst.s_addr;
376 val = val ^ (val >> 8) ^ (val >> 16) ^ (val >> 24);
377 }
378 #ifdef INET6
379 else if (flow->fi_family == AF_INET6) {
380 struct flowinfo_in6 *fp6 = (struct flowinfo_in6 *)flow;
381
382 val = ntohl(fp6->fi6_flowlabel);
383 }
384 #endif
385 }
386
387 return (val % n);
388 }
389
390 static __inline u_long wfq_hashbysrcport(flow, n)
391 struct flowinfo *flow;
392 int n;
393 {
394 u_long val = 0;
395
396 if (flow != NULL) {
397 if (flow->fi_family == AF_INET) {
398 struct flowinfo_in *fp = (struct flowinfo_in *)flow;
399
400 val = fp->fi_sport;
401 }
402 #ifdef INET6
403 else if (flow->fi_family == AF_INET6) {
404 struct flowinfo_in6 *fp6 = (struct flowinfo_in6 *)flow;
405
406 val = fp6->fi6_sport;
407 }
408 #endif
409 }
410 val = val ^ (val >> 8);
411
412 return (val % n);
413 }
414
415 static wfq *wfq_maxqueue(wfqp)
416 wfq_state_t *wfqp;
417 {
418 int byte, max_byte = 0;
419 wfq *queue, *max_queue = NULL;
420
421 if((queue = wfqp->rrp) == NULL)
422 /* never happens */
423 return NULL;
424 do{
425 if ((byte = queue->bytes * 100 / queue->weight) > max_byte) {
426 max_queue = queue;
427 max_byte = byte;
428 }
429 } while ((queue = queue->next) != wfqp->rrp);
430
431 return max_queue;
432 }
433
434
435 static struct mbuf *
436 wfq_ifdequeue(ifq, op)
437 struct ifaltq *ifq;
438 int op;
439 {
440 wfq_state_t *wfqp;
441 wfq *queue;
442 struct mbuf *mp;
443 int byte;
444
445 wfqp = (wfq_state_t *)ifq->altq_disc;
446
447 if ((wfqp->bytes == 0) || ((queue = wfqp->rrp) == NULL))
448 /* no packet in the queues */
449 return NULL;
450
451 while (1) {
452 if (queue->quota > 0) {
453 if (queue->bytes <= 0) {
454 /* this queue no longer has packet.
455 remove the queue from the active list. */
456 if (queue->next == queue){
457 /* no other active queue
458 -- this case never happens in
459 this algorithm. */
460 queue->next = queue->prev = NULL;
461 wfqp->rrp = NULL;
462 return NULL;
463 } else {
464 queue->prev->next = queue->next;
465 queue->next->prev = queue->prev;
466 /* the round-robin pointer points
467 to this queue, advance the rrp */
468 wfqp->rrp = queue->next;
469 queue->next = queue->prev = NULL;
470 queue = wfqp->rrp;
471 WFQ_ADDQUOTA(queue);
472 continue;
473 }
474 }
475
476 /* dequeue a packet from this queue */
477 mp = queue->head;
478 if (op == ALTDQ_REMOVE) {
479 if((queue->head = mp->m_nextpkt) == NULL)
480 queue->tail = NULL;
481 byte = mp->m_pkthdr.len;
482 mp->m_nextpkt = NULL;
483 queue->quota -= byte;
484 queue->bytes -= byte;
485 PKTCNTR_ADD(&queue->xmit_cnt, byte);
486 wfqp->bytes -= byte;
487 if (ALTQ_IS_ENABLED(ifq))
488 ifq->ifq_len--;
489 }
490 return mp;
491
492 /* if the queue gets empty by this dequeueing,
493 the queue will be removed from the active list
494 at the next round */
495 }
496
497 /* advance the round-robin pointer */
498 queue = wfqp->rrp = queue->next;
499 WFQ_ADDQUOTA(queue);
500 }
501 }
502
503 static int
504 wfq_getqid(gqidp)
505 struct wfq_getqid *gqidp;
506 {
507 wfq_state_t *wfqp;
508
509 if ((wfqp = altq_lookup(gqidp->iface.wfq_ifacename, ALTQT_WFQ))
510 == NULL)
511 return (EBADF);
512
513 gqidp->qid = (*wfqp->hash_func)(&gqidp->flow, wfqp->nums);
514 return 0;
515 }
516
517 static int
518 wfq_setweight(swp)
519 struct wfq_setweight *swp;
520 {
521 wfq_state_t *wfqp;
522 wfq *queue;
523 int old;
524
525 if (swp->weight < 0) {
526 printf("set weight in natural number\n");
527 return (EINVAL);
528 }
529
530 if ((wfqp = altq_lookup(swp->iface.wfq_ifacename, ALTQT_WFQ)) == NULL)
531 return (EBADF);
532
533 queue = &wfqp->queue[swp->qid];
534 old = queue->weight;
535 queue->weight = swp->weight;
536 swp->weight = old;
537 return 0;
538 }
539
540
541 static int
542 wfq_getstats(gsp)
543 struct wfq_getstats *gsp;
544 {
545 wfq_state_t *wfqp;
546 wfq *queue;
547 queue_stats *stats;
548
549 if ((wfqp = altq_lookup(gsp->iface.wfq_ifacename, ALTQT_WFQ)) == NULL)
550 return (EBADF);
551
552 if (gsp->qid >= wfqp->nums)
553 return (EINVAL);
554
555 queue = &wfqp->queue[gsp->qid];
556 stats = &gsp->stats;
557
558 stats->bytes = queue->bytes;
559 stats->weight = queue->weight;
560 stats->xmit_cnt = queue->xmit_cnt;
561 stats->drop_cnt = queue->drop_cnt;
562
563 return 0;
564 }
565
566
567 static int
568 wfq_config(cf)
569 struct wfq_conf *cf;
570 {
571 wfq_state_t *wfqp;
572 wfq *queue;
573 int i, error = 0;
574
575 if ((wfqp = altq_lookup(cf->iface.wfq_ifacename, ALTQT_WFQ)) == NULL)
576 return (EBADF);
577
578 if(cf->nqueues <= 0 || MAX_QSIZE < cf->nqueues)
579 cf->nqueues = DEFAULT_QSIZE;
580
581 if (cf->nqueues != wfqp->nums) {
582 /* free queued mbuf */
583 wfq_flush(wfqp->ifq);
584 FREE(wfqp->queue, M_DEVBUF);
585
586 MALLOC(queue, wfq *, sizeof(wfq) * cf->nqueues,
587 M_DEVBUF, M_WAITOK);
588 if (queue == NULL)
589 return (ENOMEM);
590 bzero(queue, sizeof(wfq) * cf->nqueues);
591
592 wfqp->nums = cf->nqueues;
593 wfqp->bytes = 0;
594 wfqp->rrp = NULL;
595 wfqp->queue = queue;
596 for (i = 0; i < wfqp->nums; i++, queue++) {
597 queue->next = queue->prev = NULL;
598 queue->head = queue->tail = NULL;
599 queue->bytes = queue->quota = 0;
600 queue->weight = 100;
601 }
602 }
603
604 if (cf->qlimit != 0)
605 wfqp->hwm = cf->qlimit;
606
607 switch (cf->hash_policy) {
608 case WFQ_HASH_DSTADDR:
609 wfqp->hash_func = wfq_hashbydstaddr;
610 wfqp->fbmask = FIMB4_DADDR;
611 #ifdef INET6
612 wfqp->fbmask |= FIMB6_FLABEL; /* use flowlabel for ipv6 */
613 #endif
614 break;
615 case WFQ_HASH_SRCPORT:
616 wfqp->hash_func = wfq_hashbysrcport;
617 wfqp->fbmask = FIMB4_SPORT;
618 #ifdef INET6
619 wfqp->fbmask |= FIMB6_SPORT;
620 #endif
621 break;
622 case WFQ_HASH_FULL:
623 wfqp->hash_func = wfq_hash;
624 wfqp->fbmask = FIMB4_ALL;
625 #ifdef INET6
626 wfqp->fbmask |= FIMB6_FLABEL; /* use flowlabel for ipv6 */
627 #endif
628 break;
629 default:
630 error = EINVAL;
631 break;
632 }
633 return error;
634 }
635
636 /*
637 * wfq device interface
638 */
639
640 altqdev_decl(wfq);
641
642 int
643 wfqopen(dev, flag, fmt, p)
644 dev_t dev;
645 int flag, fmt;
646 struct proc *p;
647 {
648 return 0;
649 }
650
651 int
652 wfqclose(dev, flag, fmt, p)
653 dev_t dev;
654 int flag, fmt;
655 struct proc *p;
656 {
657 struct ifnet *ifp;
658 struct wfq_interface iface;
659 wfq_state_t *wfqp;
660 int s;
661
662 s = splnet();
663 while ((wfqp = wfq_list) != NULL) {
664 ifp = wfqp->ifq->altq_ifp;
665 #if defined(__NetBSD__) || defined(__OpenBSD__)
666 sprintf(iface.wfq_ifacename, "%s", ifp->if_xname);
667 #else
668 sprintf(iface.wfq_ifacename, "%s%d",
669 ifp->if_name, ifp->if_unit);
670 #endif
671 wfq_ifdetach(&iface);
672 }
673 splx(s);
674 return 0;
675 }
676
677 int
678 wfqioctl(dev, cmd, addr, flag, p)
679 dev_t dev;
680 ioctlcmd_t cmd;
681 caddr_t addr;
682 int flag;
683 struct proc *p;
684 {
685 int error = 0;
686 int s;
687
688 /* check cmd for superuser only */
689 switch (cmd) {
690 case WFQ_GET_QID:
691 case WFQ_GET_STATS:
692 break;
693 default:
694 #if (__FreeBSD_version > 400000)
695 if ((error = suser(p)) != 0)
696 #else
697 if ((error = suser(p->p_ucred, &p->p_acflag)) != 0)
698 #endif
699 return (error);
700 break;
701 }
702
703 s = splnet();
704 switch (cmd) {
705
706 case WFQ_ENABLE:
707 error = wfq_setenable((struct wfq_interface *)addr, ENABLE);
708 break;
709
710 case WFQ_DISABLE:
711 error = wfq_setenable((struct wfq_interface *)addr, DISABLE);
712 break;
713
714 case WFQ_IF_ATTACH:
715 error = wfq_ifattach((struct wfq_interface *)addr);
716 break;
717
718 case WFQ_IF_DETACH:
719 error = wfq_ifdetach((struct wfq_interface *)addr);
720 break;
721
722 case WFQ_GET_QID:
723 error = wfq_getqid((struct wfq_getqid *)addr);
724 break;
725
726 case WFQ_SET_WEIGHT:
727 error = wfq_setweight((struct wfq_setweight *)addr);
728 break;
729
730 case WFQ_GET_STATS:
731 error = wfq_getstats((struct wfq_getstats *)addr);
732 break;
733
734 case WFQ_CONFIG:
735 error = wfq_config((struct wfq_conf *)addr);
736 break;
737
738 default:
739 error = EINVAL;
740 break;
741 }
742 splx(s);
743 return error;
744 }
745
746 #ifdef KLD_MODULE
747
748 static struct altqsw wfq_sw =
749 {"wfq", wfqopen, wfqclose, wfqioctl};
750
751 ALTQ_MODULE(altq_wfq, ALTQT_WFQ, &wfq_sw);
752
753 #endif /* KLD_MODULE */
754
755 #endif /* ALTQ_WFQ */
756