Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 34466
b: refs/heads/master
c: 18a63e8
h: refs/heads/master
v: v3
  • Loading branch information
Stephen Hemminger authored and David S. Miller committed Sep 22, 2006
1 parent ebfb32d commit 576293e
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 11 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 9ac961ee05bfc837e5271be34ad7158e90dce7d9
refs/heads/master: 18a63e868b04cf949643cc9d2c8a51d8cb5da9c4
27 changes: 17 additions & 10 deletions trunk/net/sched/sch_htb.c
Original file line number Diff line number Diff line change
Expand Up @@ -483,6 +483,20 @@ static void htb_deactivate_prios(struct htb_sched *q, struct htb_class *cl)
htb_remove_class_from_row(q,cl,mask);
}

#if HTB_HYSTERESIS
static inline long htb_lowater(const struct htb_class *cl)
{
return cl->cmode != HTB_CANT_SEND ? -cl->cbuffer : 0;
}
static inline long htb_hiwater(const struct htb_class *cl)
{
return cl->cmode == HTB_CAN_SEND ? -cl->buffer : 0;
}
#else
#define htb_lowater(cl) (0)
#define htb_hiwater(cl) (0)
#endif

/**
* htb_class_mode - computes and returns current class mode
*
Expand All @@ -499,19 +513,12 @@ htb_class_mode(struct htb_class *cl,long *diff)
{
long toks;

if ((toks = (cl->ctokens + *diff)) < (
#if HTB_HYSTERESIS
cl->cmode != HTB_CANT_SEND ? -cl->cbuffer :
#endif
0)) {
if ((toks = (cl->ctokens + *diff)) < htb_lowater(cl)) {
*diff = -toks;
return HTB_CANT_SEND;
}
if ((toks = (cl->tokens + *diff)) >= (
#if HTB_HYSTERESIS
cl->cmode == HTB_CAN_SEND ? -cl->buffer :
#endif
0))

if ((toks = (cl->tokens + *diff)) >= htb_hiwater(cl))
return HTB_CAN_SEND;

*diff = -toks;
Expand Down

0 comments on commit 576293e

Please sign in to comment.