Lines Matching defs:tbm
523 struct tbmeter *tbm = NULL;
529 if ((tbm = cdnr_cballoc(top, TCETYPE_TBMETER,
533 tb_import_profile(&tbm->tb, profile);
535 tca_import_action(&tbm->in_action, in_action);
536 tca_import_action(&tbm->out_action, out_action);
538 return tbm;
542 tbm_destroy(struct tbmeter *tbm)
544 if (tbm->cdnrblk.cb_ref > 0)
547 tca_invalidate_action(&tbm->in_action);
548 tca_invalidate_action(&tbm->out_action);
550 cdnr_cbdestroy(tbm);
557 struct tbmeter *tbm = (struct tbmeter *)cb;
563 if (tbm->tb.token < len) {
565 interval = now - tbm->tb.last;
566 if (interval >= tbm->tb.filluptime)
567 tbm->tb.token = tbm->tb.depth;
569 tbm->tb.token += interval * tbm->tb.rate;
570 if (tbm->tb.token > tbm->tb.depth)
571 tbm->tb.token = tbm->tb.depth;
573 tbm->tb.last = now;
576 if (tbm->tb.token < len) {
577 PKTCNTR_ADD(&tbm->out_cnt, pktinfo->pkt_len);
578 return (&tbm->out_action);
581 tbm->tb.token -= len;
582 PKTCNTR_ADD(&tbm->in_cnt, pktinfo->pkt_len);
583 return (&tbm->in_action);
929 struct tbmeter *tbm;
934 tbm = tbm_create(top, &ap->profile, &ap->in_action, &ap->out_action);
935 if (tbm == NULL)
938 ap->cdnr_handle = cdnr_cb2handle(&tbm->cdnrblk);
945 struct tbmeter *tbm;
947 if ((tbm = (struct tbmeter *)cdnr_handle2cb(ap->cdnr_handle)) == NULL)
950 tb_import_profile(&tbm->tb, &ap->profile);
958 struct tbmeter *tbm;
960 if ((tbm = (struct tbmeter *)cdnr_handle2cb(ap->cdnr_handle)) == NULL)
963 ap->in_cnt = tbm->in_cnt;
964 ap->out_cnt = tbm->out_cnt;
1079 struct tbmeter *tbm;
1110 tbm = (struct tbmeter *)cb;
1111 tce.tce_cnts[0] = tbm->in_cnt;
1112 tce.tce_cnts[1] = tbm->out_cnt;