aboutsummaryrefslogtreecommitdiffstats
path: root/net/sched/sch_htb.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/sched/sch_htb.c')
-rw-r--r--net/sched/sch_htb.c23
1 files changed, 15 insertions, 8 deletions
diff --git a/net/sched/sch_htb.c b/net/sched/sch_htb.c
index 213071859030..2cef8f34b2cb 100644
--- a/net/sched/sch_htb.c
+++ b/net/sched/sch_htb.c
@@ -26,6 +26,7 @@
26 * and many others. thanks. 26 * and many others. thanks.
27 */ 27 */
28#include <linux/module.h> 28#include <linux/module.h>
29#include <linux/moduleparam.h>
29#include <linux/types.h> 30#include <linux/types.h>
30#include <linux/kernel.h> 31#include <linux/kernel.h>
31#include <linux/string.h> 32#include <linux/string.h>
@@ -51,13 +52,17 @@
51*/ 52*/
52 53
53#define HTB_HSIZE 16 /* classid hash size */ 54#define HTB_HSIZE 16 /* classid hash size */
54#define HTB_HYSTERESIS 1 /* whether to use mode hysteresis for speedup */ 55static int htb_hysteresis __read_mostly = 0; /* whether to use mode hysteresis for speedup */
55#define HTB_VER 0x30011 /* major must be matched with number suplied by TC as version */ 56#define HTB_VER 0x30011 /* major must be matched with number suplied by TC as version */
56 57
57#if HTB_VER >> 16 != TC_HTB_PROTOVER 58#if HTB_VER >> 16 != TC_HTB_PROTOVER
58#error "Mismatched sch_htb.c and pkt_sch.h" 59#error "Mismatched sch_htb.c and pkt_sch.h"
59#endif 60#endif
60 61
62/* Module parameter and sysfs export */
63module_param (htb_hysteresis, int, 0640);
64MODULE_PARM_DESC(htb_hysteresis, "Hysteresis mode, less CPU load, less accurate");
65
61/* used internaly to keep status of single class */ 66/* used internaly to keep status of single class */
62enum htb_cmode { 67enum htb_cmode {
63 HTB_CANT_SEND, /* class can't send and can't borrow */ 68 HTB_CANT_SEND, /* class can't send and can't borrow */
@@ -460,19 +465,21 @@ static void htb_deactivate_prios(struct htb_sched *q, struct htb_class *cl)
460 htb_remove_class_from_row(q, cl, mask); 465 htb_remove_class_from_row(q, cl, mask);
461} 466}
462 467
463#if HTB_HYSTERESIS
464static inline long htb_lowater(const struct htb_class *cl) 468static inline long htb_lowater(const struct htb_class *cl)
465{ 469{
466 return cl->cmode != HTB_CANT_SEND ? -cl->cbuffer : 0; 470 if (htb_hysteresis)
471 return cl->cmode != HTB_CANT_SEND ? -cl->cbuffer : 0;
472 else
473 return 0;
467} 474}
468static inline long htb_hiwater(const struct htb_class *cl) 475static inline long htb_hiwater(const struct htb_class *cl)
469{ 476{
470 return cl->cmode == HTB_CAN_SEND ? -cl->buffer : 0; 477 if (htb_hysteresis)
478 return cl->cmode == HTB_CAN_SEND ? -cl->buffer : 0;
479 else
480 return 0;
471} 481}
472#else 482
473#define htb_lowater(cl) (0)
474#define htb_hiwater(cl) (0)
475#endif
476 483
477/** 484/**
478 * htb_class_mode - computes and returns current class mode 485 * htb_class_mode - computes and returns current class mode