Lines Matching full:rp

181 	rio_t	*rp;  in rio_alloc()  local
185 rp = malloc(sizeof(rio_t), M_DEVBUF, M_NOWAIT | M_ZERO); in rio_alloc()
186 if (rp == NULL) in rio_alloc()
189 rp->rio_flags = flags; in rio_alloc()
192 rp->rio_pkttime = 800; in rio_alloc()
194 rp->rio_pkttime = pkttime; in rio_alloc()
197 rp->rio_weight = weight; in rio_alloc()
200 rp->rio_weight = W_WEIGHT; in rio_alloc()
203 npkts_per_sec = 1000000 / rp->rio_pkttime; in rio_alloc()
206 rp->rio_weight = W_WEIGHT_2; in rio_alloc()
209 rp->rio_weight = W_WEIGHT_1; in rio_alloc()
214 w = rp->rio_weight; in rio_alloc()
217 rp->rio_wshift = i; in rio_alloc()
218 w = 1 << rp->rio_wshift; in rio_alloc()
219 if (w != rp->rio_weight) { in rio_alloc()
221 rp->rio_weight, w); in rio_alloc()
222 rp->rio_weight = w; in rio_alloc()
226 rp->rio_wtab = wtab_alloc(rp->rio_weight); in rio_alloc()
229 struct dropprec_state *prec = &rp->rio_precstate[i]; in rio_alloc()
251 prec->th_min_s = prec->th_min << (rp->rio_wshift + FP_SHIFT); in rio_alloc()
252 prec->th_max_s = prec->th_max << (rp->rio_wshift + FP_SHIFT); in rio_alloc()
264 return (rp); in rio_alloc()
268 rio_destroy(rio_t *rp) in rio_destroy() argument
270 wtab_destroy(rp->rio_wtab); in rio_destroy()
271 free(rp, M_DEVBUF); in rio_destroy()
275 rio_getstats(rio_t *rp, struct redstats *sp) in rio_getstats() argument
280 bcopy(&rp->q_stats[i], sp, sizeof(struct redstats)); in rio_getstats()
281 sp->q_avg = rp->rio_precstate[i].avg >> rp->rio_wshift; in rio_getstats()
316 rio_addq(rio_t *rp, class_queue_t *q, struct mbuf *m, in rio_addq() argument
334 prec = &rp->rio_precstate[i]; in rio_addq()
346 n = t / rp->rio_pkttime; in rio_addq()
350 pow_w(rp->rio_wtab, n); in rio_addq()
355 avg += (prec->qlen << FP_SHIFT) - (avg >> rp->rio_wshift); in rio_addq()
364 prec = &rp->rio_precstate[dpindex]; in rio_addq()
377 } else if (drop_early((avg - prec->th_min_s) >> rp->rio_wshift, in rio_addq()
396 rp->rio_precstate[i].count = 0; in rio_addq()
399 rp->q_stats[dpindex].drop_unforced++; in rio_addq()
401 rp->q_stats[dpindex].drop_forced++; in rio_addq()
402 PKTCNTR_ADD(&rp->q_stats[dpindex].drop_cnt, m_pktlen(m)); in rio_addq()
409 rp->rio_precstate[i].qlen++; in rio_addq()
414 if (rp->rio_flags & RIOF_CLEARDSCP) in rio_addq()
423 PKTCNTR_ADD(&rp->q_stats[dpindex].xmit_cnt, m_pktlen(m)); in rio_addq()
429 rio_getq(rio_t *rp, class_queue_t *q) in rio_getq() argument
439 if (--rp->rio_precstate[i].qlen == 0) { in rio_getq()
440 if (rp->rio_precstate[i].idle == 0) { in rio_getq()
441 rp->rio_precstate[i].idle = 1; in rio_getq()
442 microtime(&rp->rio_precstate[i].last); in rio_getq()