提交 47083fc0 编写于 作者: J Jesper Dangaard Brouer 提交者: David S. Miller

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: NJesper Dangaard Brouer <hawk@comx.dk>
Acked-by: NMartin Devera <devik@cdi.cz>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 f9ffcedd
...@@ -28,6 +28,7 @@ ...@@ -28,6 +28,7 @@
* $Id: sch_htb.c,v 1.25 2003/12/07 11:08:25 devik Exp devik $ * $Id: sch_htb.c,v 1.25 2003/12/07 11:08:25 devik Exp devik $
*/ */
#include <linux/module.h> #include <linux/module.h>
#include <linux/moduleparam.h>
#include <linux/types.h> #include <linux/types.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/string.h> #include <linux/string.h>
...@@ -53,13 +54,17 @@ ...@@ -53,13 +54,17 @@
*/ */
#define HTB_HSIZE 16 /* classid hash size */ #define HTB_HSIZE 16 /* classid hash size */
#define HTB_HYSTERESIS 0 /* whether to use mode hysteresis for speedup */ static int htb_hysteresis __read_mostly = 0; /* whether to use mode hysteresis for speedup */
#define HTB_VER 0x30011 /* major must be matched with number suplied by TC as version */ #define HTB_VER 0x30011 /* major must be matched with number suplied by TC as version */
#if HTB_VER >> 16 != TC_HTB_PROTOVER #if HTB_VER >> 16 != TC_HTB_PROTOVER
#error "Mismatched sch_htb.c and pkt_sch.h" #error "Mismatched sch_htb.c and pkt_sch.h"
#endif #endif
/* Module parameter and sysfs export */
module_param (htb_hysteresis, int, 0640);
MODULE_PARM_DESC(htb_hysteresis, "Hysteresis mode, less CPU load, less accurate");
/* used internaly to keep status of single class */ /* used internaly to keep status of single class */
enum htb_cmode { enum htb_cmode {
HTB_CANT_SEND, /* class can't send and can't borrow */ 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,19 +467,21 @@ static void htb_deactivate_prios(struct htb_sched *q, struct htb_class *cl)
htb_remove_class_from_row(q, cl, mask); htb_remove_class_from_row(q, cl, mask);
} }
#if HTB_HYSTERESIS
static inline long htb_lowater(const struct htb_class *cl) static inline long htb_lowater(const struct htb_class *cl)
{ {
return cl->cmode != HTB_CANT_SEND ? -cl->cbuffer : 0; if (htb_hysteresis)
return cl->cmode != HTB_CANT_SEND ? -cl->cbuffer : 0;
else
return 0;
} }
static inline long htb_hiwater(const struct htb_class *cl) static inline long htb_hiwater(const struct htb_class *cl)
{ {
return cl->cmode == HTB_CAN_SEND ? -cl->buffer : 0; if (htb_hysteresis)
return cl->cmode == HTB_CAN_SEND ? -cl->buffer : 0;
else
return 0;
} }
#else
#define htb_lowater(cl) (0)
#define htb_hiwater(cl) (0)
#endif
/** /**
* htb_class_mode - computes and returns current class mode * htb_class_mode - computes and returns current class mode
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册