Lines Matching defs:rp

208 	rio_t	*rp;
212 rp = malloc(sizeof(rio_t), M_DEVBUF, M_WAITOK|M_ZERO);
213 if (rp == NULL)
216 rp->rio_flags = flags;
219 rp->rio_pkttime = 800;
221 rp->rio_pkttime = pkttime;
224 rp->rio_weight = weight;
227 rp->rio_weight = W_WEIGHT;
230 npkts_per_sec = 1000000 / rp->rio_pkttime;
233 rp->rio_weight = W_WEIGHT_2;
236 rp->rio_weight = W_WEIGHT_1;
241 w = rp->rio_weight;
244 rp->rio_wshift = i;
245 w = 1 << rp->rio_wshift;
246 if (w != rp->rio_weight) {
248 rp->rio_weight, w);
249 rp->rio_weight = w;
253 rp->rio_wtab = wtab_alloc(rp->rio_weight);
256 struct dropprec_state *prec = &rp->rio_precstate[i];
278 prec->th_min_s = prec->th_min << (rp->rio_wshift + FP_SHIFT);
279 prec->th_max_s = prec->th_max << (rp->rio_wshift + FP_SHIFT);
291 return rp;
295 rio_destroy(rio_t *rp)
297 wtab_destroy(rp->rio_wtab);
298 free(rp, M_DEVBUF);
302 rio_getstats(rio_t *rp, struct redstats *sp)
307 memcpy(sp, &rp->q_stats[i], sizeof(struct redstats));
308 sp->q_avg = rp->rio_precstate[i].avg >> rp->rio_wshift;
330 rio_addq(rio_t *rp, class_queue_t *q, struct mbuf *m,
348 prec = &rp->rio_precstate[i];
360 n = t / rp->rio_pkttime;
364 pow_w(rp->rio_wtab, n);
369 avg += (prec->qlen << FP_SHIFT) - (avg >> rp->rio_wshift);
378 prec = &rp->rio_precstate[dpindex];
391 } else if (drop_early((avg - prec->th_min_s) >> rp->rio_wshift,
410 rp->rio_precstate[i].count = 0;
413 rp->q_stats[dpindex].drop_unforced++;
415 rp->q_stats[dpindex].drop_forced++;
416 PKTCNTR_ADD(&rp->q_stats[dpindex].drop_cnt, m_pktlen(m));
423 rp->rio_precstate[i].qlen++;
428 if (rp->rio_flags & RIOF_CLEARDSCP)
437 PKTCNTR_ADD(&rp->q_stats[dpindex].xmit_cnt, m_pktlen(m));
443 rio_getq(rio_t *rp, class_queue_t *q)
453 if (--rp->rio_precstate[i].qlen == 0) {
454 if (rp->rio_precstate[i].idle == 0) {
455 rp->rio_precstate[i].idle = 1;
456 microtime(&rp->rio_precstate[i].last);
596 rio_t *rp;
606 rp = rqp->rq_rio;
609 q_stats->weight = rp->rio_weight;
610 q_stats->flags = rp->rio_flags;
613 q_stats->q_len[i] = rp->rio_precstate[i].qlen;
614 memcpy(&q_stats->q_stats[i], &rp->q_stats[i],
617 rp->rio_precstate[i].avg >> rp->rio_wshift;
620 = rp->rio_precstate[i].inv_pmax;
622 = rp->rio_precstate[i].th_min;
624 = rp->rio_precstate[i].th_max;
676 struct redparams *rp;
679 rp = (struct redparams *)addr;
681 default_rio_params[i] = rp[i];