diff options
author | Jesper Dangaard Brouer <hawk@comx.dk> | 2008-06-16 19:39:32 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-06-16 19:39:32 -0400 |
commit | 47083fc0735f5145b72fc31236d07339dc52b908 (patch) | |
tree | a9113482b6edf7cfd865d8f7b9c28e7731513583 /net/sched/sch_htb.c | |
parent | f9ffcedddba5b2fc5ab16ef08bca55af8be2717e (diff) |
pkt_sched: Change HTB_HYSTERESIS to a runtime parameter htb_hysteresis.
Add a htb_hysteresis parameter to htb_sch.ko and by sysfs magic make
it runtime adjustable via
/sys/module/sch_htb/parameters/htb_hysteresis mode 640.
Signed-off-by: Jesper Dangaard Brouer <hawk@comx.dk>
Acked-by: Martin Devera <devik@cdi.cz>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/sched/sch_htb.c')
-rw-r--r-- | net/sched/sch_htb.c | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/net/sched/sch_htb.c b/net/sched/sch_htb.c index 9134f029ee0f..6807c97985a5 100644 --- a/net/sched/sch_htb.c +++ b/net/sched/sch_htb.c | |||
@@ -28,6 +28,7 @@ | |||
28 | * $Id: sch_htb.c,v 1.25 2003/12/07 11:08:25 devik Exp devik $ | 28 | * $Id: sch_htb.c,v 1.25 2003/12/07 11:08:25 devik Exp devik $ |
29 | */ | 29 | */ |
30 | #include <linux/module.h> | 30 | #include <linux/module.h> |
31 | #include <linux/moduleparam.h> | ||
31 | #include <linux/types.h> | 32 | #include <linux/types.h> |
32 | #include <linux/kernel.h> | 33 | #include <linux/kernel.h> |
33 | #include <linux/string.h> | 34 | #include <linux/string.h> |
@@ -53,13 +54,17 @@ | |||
53 | */ | 54 | */ |
54 | 55 | ||
55 | #define HTB_HSIZE 16 /* classid hash size */ | 56 | #define HTB_HSIZE 16 /* classid hash size */ |
56 | #define HTB_HYSTERESIS 0 /* whether to use mode hysteresis for speedup */ | 57 | static int htb_hysteresis __read_mostly = 0; /* whether to use mode hysteresis for speedup */ |
57 | #define HTB_VER 0x30011 /* major must be matched with number suplied by TC as version */ | 58 | #define HTB_VER 0x30011 /* major must be matched with number suplied by TC as version */ |
58 | 59 | ||
59 | #if HTB_VER >> 16 != TC_HTB_PROTOVER | 60 | #if HTB_VER >> 16 != TC_HTB_PROTOVER |
60 | #error "Mismatched sch_htb.c and pkt_sch.h" | 61 | #error "Mismatched sch_htb.c and pkt_sch.h" |
61 | #endif | 62 | #endif |
62 | 63 | ||
64 | /* Module parameter and sysfs export */ | ||
65 | module_param (htb_hysteresis, int, 0640); | ||
66 | MODULE_PARM_DESC(htb_hysteresis, "Hysteresis mode, less CPU load, less accurate"); | ||
67 | |||
63 | /* used internaly to keep status of single class */ | 68 | /* used internaly to keep status of single class */ |
64 | enum htb_cmode { | 69 | enum htb_cmode { |
65 | HTB_CANT_SEND, /* class can't send and can't borrow */ | 70 | HTB_CANT_SEND, /* class can't send and can't borrow */ |
@@ -462,19 +467,21 @@ static void htb_deactivate_prios(struct htb_sched *q, struct htb_class *cl) | |||
462 | htb_remove_class_from_row(q, cl, mask); | 467 | htb_remove_class_from_row(q, cl, mask); |
463 | } | 468 | } |
464 | 469 | ||
465 | #if HTB_HYSTERESIS | ||
466 | static inline long htb_lowater(const struct htb_class *cl) | 470 | static inline long htb_lowater(const struct htb_class *cl) |
467 | { | 471 | { |
468 | return cl->cmode != HTB_CANT_SEND ? -cl->cbuffer : 0; | 472 | if (htb_hysteresis) |
473 | return cl->cmode != HTB_CANT_SEND ? -cl->cbuffer : 0; | ||
474 | else | ||
475 | return 0; | ||
469 | } | 476 | } |
470 | static inline long htb_hiwater(const struct htb_class *cl) | 477 | static inline long htb_hiwater(const struct htb_class *cl) |
471 | { | 478 | { |
472 | return cl->cmode == HTB_CAN_SEND ? -cl->buffer : 0; | 479 | if (htb_hysteresis) |
480 | return cl->cmode == HTB_CAN_SEND ? -cl->buffer : 0; | ||
481 | else | ||
482 | return 0; | ||
473 | } | 483 | } |
474 | #else | 484 | |
475 | #define htb_lowater(cl) (0) | ||
476 | #define htb_hiwater(cl) (0) | ||
477 | #endif | ||
478 | 485 | ||
479 | /** | 486 | /** |
480 | * htb_class_mode - computes and returns current class mode | 487 | * htb_class_mode - computes and returns current class mode |