Lines Matching defs:queue
87 /* global value : pointer to wfq queue list */
117 wfq *queue;
138 queue = malloc(sizeof(wfq) * DEFAULT_QSIZE, M_DEVBUF, M_WAITOK|M_ZERO);
139 if (queue == NULL) {
150 new_wfqp->queue = queue;
154 for (i = 0; i < new_wfqp->nums; i++, queue++) {
155 queue->next = queue->prev = NULL;
156 queue->head = queue->tail = NULL;
157 queue->bytes = queue->quota = 0;
158 queue->weight = 100;
167 free(queue, M_DEVBUF);
209 free(wfqp->queue, M_DEVBUF);
247 return (&wfqp->queue[(*wfqp->hash_func)(&flow, wfqp->nums)]);
254 wfq *queue;
260 /* grab a queue selected by classifier */
261 if ((queue = mp->m_pkthdr.pattr_class) == NULL)
262 queue = &wfqp->queue[0];
264 if (queue->tail == NULL)
265 queue->head = mp;
267 queue->tail->m_nextpkt = mp;
268 queue->tail = mp;
270 queue->bytes += byte;
274 if (queue->next == NULL) {
275 /* this queue gets active. add the queue to the active list */
277 /* no queue in the active list */
278 queue->next = queue->prev = queue;
279 wfqp->rrp = queue;
280 WFQ_ADDQUOTA(queue);
282 /* insert the queue at the tail of the active list */
283 queue->prev = wfqp->rrp->prev;
284 wfqp->rrp->prev->next = queue;
285 wfqp->rrp->prev = queue;
286 queue->next = wfqp->rrp;
287 queue->quota = 0;
292 drop packets from the longest queue. */
307 if(drop_queue == queue)
308 /* the queue for this flow is selected to drop */
418 wfq *queue, *max_queue = NULL;
420 if((queue = wfqp->rrp) == NULL)
424 if ((byte = queue->bytes * 100 / queue->weight) > max_byte) {
425 max_queue = queue;
428 } while ((queue = queue->next) != wfqp->rrp);
438 wfq *queue;
444 if ((wfqp->bytes == 0) || ((queue = wfqp->rrp) == NULL))
449 if (queue->quota > 0) {
450 if (queue->bytes <= 0) {
451 /* this queue no longer has packet.
452 remove the queue from the active list. */
453 if (queue->next == queue){
454 /* no other active queue
457 queue->next = queue->prev = NULL;
461 queue->prev->next = queue->next;
462 queue->next->prev = queue->prev;
464 to this queue, advance the rrp */
465 wfqp->rrp = queue->next;
466 queue->next = queue->prev = NULL;
467 queue = wfqp->rrp;
468 WFQ_ADDQUOTA(queue);
473 /* dequeue a packet from this queue */
474 mp = queue->head;
476 if((queue->head = mp->m_nextpkt) == NULL)
477 queue->tail = NULL;
480 queue->quota -= byte;
481 queue->bytes -= byte;
482 PKTCNTR_ADD(&queue->xmit_cnt, byte);
489 /* if the queue gets empty by this dequeueing,
490 the queue will be removed from the active list
495 queue = wfqp->rrp = queue->next;
496 WFQ_ADDQUOTA(queue);
517 wfq *queue;
529 queue = &wfqp->queue[swp->qid];
530 old = queue->weight;
531 queue->weight = swp->weight;
541 wfq *queue;
550 queue = &wfqp->queue[gsp->qid];
553 stats->bytes = queue->bytes;
554 stats->weight = queue->weight;
555 stats->xmit_cnt = queue->xmit_cnt;
556 stats->drop_cnt = queue->drop_cnt;
566 wfq *queue;
578 free(wfqp->queue, M_DEVBUF);
580 queue = malloc(sizeof(wfq) * cf->nqueues, M_DEVBUF,
582 if (queue == NULL)
588 wfqp->queue = queue;
589 for (i = 0; i < wfqp->nums; i++, queue++) {
590 queue->next = queue->prev = NULL;
591 queue->head = queue->tail = NULL;
592 queue->bytes = queue->quota = 0;
593 queue->weight = 100;