diff options
Diffstat (limited to 'net/sched')
| -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 5bc1ed490180..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 1 /* 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 |
