Changeset View
Changeset View
Standalone View
Standalone View
sys/net/altq/altq_rmclass.c
Show First 20 Lines • Show All 81 Lines • ▼ Show 20 Lines | |||||
static int _rmc_addq(rm_class_t *, mbuf_t *); | static int _rmc_addq(rm_class_t *, mbuf_t *); | ||||
static void _rmc_dropq(rm_class_t *); | static void _rmc_dropq(rm_class_t *); | ||||
static mbuf_t *_rmc_getq(rm_class_t *); | static mbuf_t *_rmc_getq(rm_class_t *); | ||||
static mbuf_t *_rmc_pollq(rm_class_t *); | static mbuf_t *_rmc_pollq(rm_class_t *); | ||||
static int rmc_under_limit(struct rm_class *, struct timeval *); | static int rmc_under_limit(struct rm_class *, struct timeval *); | ||||
static void rmc_tl_satisfied(struct rm_ifdat *, struct timeval *); | static void rmc_tl_satisfied(struct rm_ifdat *, struct timeval *); | ||||
static void rmc_drop_action(struct rm_class *); | static void rmc_drop_action(struct rm_class *); | ||||
static void rmc_restart(struct rm_class *); | static void rmc_restart(void *); | ||||
static void rmc_root_overlimit(struct rm_class *, struct rm_class *); | static void rmc_root_overlimit(struct rm_class *, struct rm_class *); | ||||
#define BORROW_OFFTIME | #define BORROW_OFFTIME | ||||
/* | /* | ||||
* BORROW_OFFTIME (experimental): | * BORROW_OFFTIME (experimental): | ||||
* borrow the offtime of the class borrowing from. | * borrow the offtime of the class borrowing from. | ||||
* the reason is that when its own offtime is set, the class is unable | * the reason is that when its own offtime is set, the class is unable | ||||
* to borrow much, especially when cutoff is taking effect. | * to borrow much, especially when cutoff is taking effect. | ||||
▲ Show 20 Lines • Show All 1,426 Lines • ▼ Show 20 Lines | #endif | ||||
* NOTE: If there's no other traffic, we need the timer as | * NOTE: If there's no other traffic, we need the timer as | ||||
* a 'backstop' to restart this class. | * a 'backstop' to restart this class. | ||||
*/ | */ | ||||
if (delay > tick * 2) { | if (delay > tick * 2) { | ||||
/* FreeBSD rounds up the tick */ | /* FreeBSD rounds up the tick */ | ||||
t = hzto(&cl->undertime_); | t = hzto(&cl->undertime_); | ||||
} else | } else | ||||
t = 2; | t = 2; | ||||
CALLOUT_RESET(&cl->callout_, t, | CALLOUT_RESET(&cl->callout_, t, rmc_restart, cl); | ||||
(timeout_t *)rmc_restart, (caddr_t)cl); | |||||
} | } | ||||
} | } | ||||
/* | /* | ||||
* void | * void | ||||
* rmc_restart() - is just a helper routine for rmc_delay_action -- it is | * rmc_restart() - is just a helper routine for rmc_delay_action -- it is | ||||
* called by the system timer code & is responsible checking if the | * called by the system timer code & is responsible checking if the | ||||
* class is still sleeping (it might have been restarted as a side | * class is still sleeping (it might have been restarted as a side | ||||
* effect of the queue scan on a packet arrival) and, if so, restarting | * effect of the queue scan on a packet arrival) and, if so, restarting | ||||
* output for the class. Inspecting the class state & restarting output | * output for the class. Inspecting the class state & restarting output | ||||
* require locking the class structure. In general the driver is | * require locking the class structure. In general the driver is | ||||
* responsible for locking but this is the only routine that is not | * responsible for locking but this is the only routine that is not | ||||
* called directly or indirectly from the interface driver so it has | * called directly or indirectly from the interface driver so it has | ||||
* know about system locking conventions. Under bsd, locking is done | * know about system locking conventions. Under bsd, locking is done | ||||
* by raising IPL to splimp so that's what's implemented here. On a | * by raising IPL to splimp so that's what's implemented here. On a | ||||
* different system this would probably need to be changed. | * different system this would probably need to be changed. | ||||
* | * | ||||
* Returns: NONE | * Returns: NONE | ||||
*/ | */ | ||||
static void | static void | ||||
rmc_restart(struct rm_class *cl) | rmc_restart(void *arg) | ||||
{ | { | ||||
struct rm_class *cl = arg; | |||||
struct rm_ifdat *ifd = cl->ifdat_; | struct rm_ifdat *ifd = cl->ifdat_; | ||||
int s; | int s; | ||||
s = splnet(); | s = splnet(); | ||||
IFQ_LOCK(ifd->ifq_); | IFQ_LOCK(ifd->ifq_); | ||||
if (cl->sleeping_) { | if (cl->sleeping_) { | ||||
cl->sleeping_ = 0; | cl->sleeping_ = 0; | ||||
cl->undertime_.tv_sec = 0; | cl->undertime_.tv_sec = 0; | ||||
▲ Show 20 Lines • Show All 266 Lines • Show Last 20 Lines |