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.c27
1 files changed, 17 insertions, 10 deletions
diff --git a/net/sched/sch_htb.c b/net/sched/sch_htb.c
index c0b80b75cdff..d8c1a6b0def1 100644
--- a/net/sched/sch_htb.c
+++ b/net/sched/sch_htb.c
@@ -483,6 +483,20 @@ static void htb_deactivate_prios(struct htb_sched *q, struct htb_class *cl)
483 htb_remove_class_from_row(q,cl,mask); 483 htb_remove_class_from_row(q,cl,mask);
484} 484}
485 485
486#if HTB_HYSTERESIS
487static inline long htb_lowater(const struct htb_class *cl)
488{
489 return cl->cmode != HTB_CANT_SEND ? -cl->cbuffer : 0;
490}
491static inline long htb_hiwater(const struct htb_class *cl)
492{
493 return cl->cmode == HTB_CAN_SEND ? -cl->buffer : 0;
494}
495#else
496#define htb_lowater(cl) (0)
497#define htb_hiwater(cl) (0)
498#endif
499
486/** 500/**
487 * htb_class_mode - computes and returns current class mode 501 * htb_class_mode - computes and returns current class mode
488 * 502 *
@@ -499,19 +513,12 @@ htb_class_mode(struct htb_class *cl,long *diff)
499{ 513{
500 long toks; 514 long toks;
501 515
502 if ((toks = (cl->ctokens + *diff)) < ( 516 if ((toks = (cl->ctokens + *diff)) < htb_lowater(cl)) {
503#if HTB_HYSTERESIS
504 cl->cmode != HTB_CANT_SEND ? -cl->cbuffer :
505#endif
506 0)) {
507 *diff = -toks; 517 *diff = -toks;
508 return HTB_CANT_SEND; 518 return HTB_CANT_SEND;
509 } 519 }
510 if ((toks = (cl->tokens + *diff)) >= ( 520
511#if HTB_HYSTERESIS 521 if ((toks = (cl->tokens + *diff)) >= htb_hiwater(cl))
512 cl->cmode == HTB_CAN_SEND ? -cl->buffer :
513#endif
514 0))
515 return HTB_CAN_SEND; 522 return HTB_CAN_SEND;
516 523
517 *diff = -toks; 524 *diff = -toks;