Lines Matching defs:tbr
252 struct tb_regulator *tbr;
257 tbr = ifq->altq_tbr;
258 if (op == ALTDQ_REMOVE && tbr->tbr_lastop == ALTDQ_POLL) {
259 /* if this is a remove after poll, bypass tbr check */
262 if (tbr->tbr_token <= 0) {
264 interval = now - tbr->tbr_last;
265 if (interval >= tbr->tbr_filluptime)
266 tbr->tbr_token = tbr->tbr_depth;
268 tbr->tbr_token += interval * tbr->tbr_rate;
269 if (tbr->tbr_token > tbr->tbr_depth)
270 tbr->tbr_token = tbr->tbr_depth;
272 tbr->tbr_last = now;
275 if (tbr->tbr_token <= 0)
289 tbr->tbr_token -= TBR_SCALE(m_pktlen(m));
290 tbr->tbr_lastop = op;
301 struct tb_regulator *tbr, *otbr;
311 /* delete this tbr */
312 if ((tbr = ifq->altq_tbr) == NULL)
315 free(tbr, M_DEVBUF);
319 tbr = malloc(sizeof(struct tb_regulator), M_DEVBUF, M_WAITOK|M_ZERO);
320 if (tbr == NULL)
323 tbr->tbr_rate = TBR_SCALE(profile->rate / 8) / machclk_freq;
324 tbr->tbr_depth = TBR_SCALE(profile->depth);
325 if (tbr->tbr_rate > 0)
326 tbr->tbr_filluptime = tbr->tbr_depth / tbr->tbr_rate;
328 tbr->tbr_filluptime = 0xffffffffffffffffLL;
329 tbr->tbr_token = tbr->tbr_depth;
330 tbr->tbr_last = read_machclk();
331 tbr->tbr_lastop = ALTDQ_REMOVE;
334 ifq->altq_tbr = tbr; /* set the new tbr */
390 struct tb_regulator *tbr;
392 if ((tbr = ifq->altq_tbr) == NULL) {
397 (u_int)TBR_UNSCALE(tbr->tbr_rate * 8 * machclk_freq);
398 profile->depth = (u_int)TBR_UNSCALE(tbr->tbr_depth);