| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: altq_subr.c,v 1.27 2008/11/25 23:10:43 tsutsui Exp $ */ | | 1 | /* $NetBSD: altq_subr.c,v 1.28 2009/01/04 18:41:36 pooka Exp $ */ |
2 | /* $KAME: altq_subr.c,v 1.24 2005/04/13 03:44:25 suz Exp $ */ | | 2 | /* $KAME: altq_subr.c,v 1.24 2005/04/13 03:44:25 suz Exp $ */ |
3 | | | 3 | |
4 | /* | | 4 | /* |
5 | * Copyright (C) 1997-2003 | | 5 | * Copyright (C) 1997-2003 |
6 | * Sony Computer Science Laboratories Inc. All rights reserved. | | 6 | * Sony Computer Science Laboratories Inc. All rights reserved. |
7 | * | | 7 | * |
8 | * Redistribution and use in source and binary forms, with or without | | 8 | * Redistribution and use in source and binary forms, with or without |
9 | * modification, are permitted provided that the following conditions | | 9 | * modification, are permitted provided that the following conditions |
10 | * are met: | | 10 | * are met: |
11 | * 1. Redistributions of source code must retain the above copyright | | 11 | * 1. Redistributions of source code must retain the above copyright |
12 | * notice, this list of conditions and the following disclaimer. | | 12 | * notice, this list of conditions and the following disclaimer. |
13 | * 2. Redistributions in binary form must reproduce the above copyright | | 13 | * 2. Redistributions in binary form must reproduce the above copyright |
14 | * notice, this list of conditions and the following disclaimer in the | | 14 | * notice, this list of conditions and the following disclaimer in the |
| @@ -18,27 +18,27 @@ | | | @@ -18,27 +18,27 @@ |
18 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | | 18 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
19 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | | 19 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
20 | * ARE DISCLAIMED. IN NO EVENT SHALL SONY CSL OR CONTRIBUTORS BE LIABLE | | 20 | * ARE DISCLAIMED. IN NO EVENT SHALL SONY CSL OR CONTRIBUTORS BE LIABLE |
21 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | | 21 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
22 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | | 22 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
23 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | | 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 | | 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 | | 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 | | 26 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
27 | * SUCH DAMAGE. | | 27 | * SUCH DAMAGE. |
28 | */ | | 28 | */ |
29 | | | 29 | |
30 | #include <sys/cdefs.h> | | 30 | #include <sys/cdefs.h> |
31 | __KERNEL_RCSID(0, "$NetBSD: altq_subr.c,v 1.27 2008/11/25 23:10:43 tsutsui Exp $"); | | 31 | __KERNEL_RCSID(0, "$NetBSD: altq_subr.c,v 1.28 2009/01/04 18:41:36 pooka Exp $"); |
32 | | | 32 | |
33 | #ifdef _KERNEL_OPT | | 33 | #ifdef _KERNEL_OPT |
34 | #include "opt_altq.h" | | 34 | #include "opt_altq.h" |
35 | #include "opt_inet.h" | | 35 | #include "opt_inet.h" |
36 | #include "pf.h" | | 36 | #include "pf.h" |
37 | #endif | | 37 | #endif |
38 | | | 38 | |
39 | #include <sys/param.h> | | 39 | #include <sys/param.h> |
40 | #include <sys/malloc.h> | | 40 | #include <sys/malloc.h> |
41 | #include <sys/mbuf.h> | | 41 | #include <sys/mbuf.h> |
42 | #include <sys/systm.h> | | 42 | #include <sys/systm.h> |
43 | #include <sys/proc.h> | | 43 | #include <sys/proc.h> |
44 | #include <sys/socket.h> | | 44 | #include <sys/socket.h> |
| @@ -323,29 +323,29 @@ tbr_set(struct ifaltq *ifq, struct tb_pr | | | @@ -323,29 +323,29 @@ tbr_set(struct ifaltq *ifq, struct tb_pr |
323 | tbr->tbr_rate = TBR_SCALE(profile->rate / 8) / machclk_freq; | | 323 | tbr->tbr_rate = TBR_SCALE(profile->rate / 8) / machclk_freq; |
324 | tbr->tbr_depth = TBR_SCALE(profile->depth); | | 324 | tbr->tbr_depth = TBR_SCALE(profile->depth); |
325 | if (tbr->tbr_rate > 0) | | 325 | if (tbr->tbr_rate > 0) |
326 | tbr->tbr_filluptime = tbr->tbr_depth / tbr->tbr_rate; | | 326 | tbr->tbr_filluptime = tbr->tbr_depth / tbr->tbr_rate; |
327 | else | | 327 | else |
328 | tbr->tbr_filluptime = 0xffffffffffffffffLL; | | 328 | tbr->tbr_filluptime = 0xffffffffffffffffLL; |
329 | tbr->tbr_token = tbr->tbr_depth; | | 329 | tbr->tbr_token = tbr->tbr_depth; |
330 | tbr->tbr_last = read_machclk(); | | 330 | tbr->tbr_last = read_machclk(); |
331 | tbr->tbr_lastop = ALTDQ_REMOVE; | | 331 | tbr->tbr_lastop = ALTDQ_REMOVE; |
332 | | | 332 | |
333 | otbr = ifq->altq_tbr; | | 333 | otbr = ifq->altq_tbr; |
334 | ifq->altq_tbr = tbr; /* set the new tbr */ | | 334 | ifq->altq_tbr = tbr; /* set the new tbr */ |
335 | | | 335 | |
336 | if (otbr != NULL) | | 336 | if (otbr != NULL) { |
337 | free(otbr, M_DEVBUF); | | 337 | free(otbr, M_DEVBUF); |
338 | else { | | 338 | } else { |
339 | if (tbr_timer == 0) { | | 339 | if (tbr_timer == 0) { |
340 | CALLOUT_RESET(&tbr_callout, 1, tbr_timeout, (void *)0); | | 340 | CALLOUT_RESET(&tbr_callout, 1, tbr_timeout, (void *)0); |
341 | tbr_timer = 1; | | 341 | tbr_timer = 1; |
342 | } | | 342 | } |
343 | } | | 343 | } |
344 | return (0); | | 344 | return (0); |
345 | } | | 345 | } |
346 | | | 346 | |
347 | /* | | 347 | /* |
348 | * tbr_timeout goes through the interface list, and kicks the drivers | | 348 | * tbr_timeout goes through the interface list, and kicks the drivers |
349 | * if necessary. | | 349 | * if necessary. |
350 | */ | | 350 | */ |
351 | static void | | 351 | static void |