34 #ifndef __INCLUDE_RTE_METER_H__
35 #define __INCLUDE_RTE_METER_H__
86 struct rte_meter_srtcm;
89 struct rte_meter_trtcm;
199 struct rte_meter_srtcm {
206 uint64_t cir_bytes_per_period;
210 struct rte_meter_trtcm {
218 uint64_t cir_bytes_per_period;
220 uint64_t pir_bytes_per_period;
228 uint64_t time_diff, n_periods, tc, te;
231 time_diff = time - m->time;
232 n_periods = time_diff / m->cir_period;
233 m->time += n_periods * m->cir_period;
236 tc = m->tc + n_periods * m->cir_bytes_per_period;
247 m->tc = tc - pkt_len;
254 m->te = te - pkt_len;
269 uint64_t time_diff, n_periods, tc, te;
272 time_diff = time - m->time;
273 n_periods = time_diff / m->cir_period;
274 m->time += n_periods * m->cir_period;
277 tc = m->tc + n_periods * m->cir_bytes_per_period;
288 m->tc = tc - pkt_len;
295 m->te = te - pkt_len;
309 uint64_t time_diff_tc, time_diff_tp, n_periods_tc, n_periods_tp, tc, tp;
312 time_diff_tc = time - m->time_tc;
313 time_diff_tp = time - m->time_tp;
314 n_periods_tc = time_diff_tc / m->cir_period;
315 n_periods_tp = time_diff_tp / m->pir_period;
316 m->time_tc += n_periods_tc * m->cir_period;
317 m->time_tp += n_periods_tp * m->pir_period;
319 tc = m->tc + n_periods_tc * m->cir_bytes_per_period;
323 tp = m->tp + n_periods_tp * m->pir_bytes_per_period;
336 m->tp = tp - pkt_len;
340 m->tc = tc - pkt_len;
341 m->tp = tp - pkt_len;
351 uint64_t time_diff_tc, time_diff_tp, n_periods_tc, n_periods_tp, tc, tp;
354 time_diff_tc = time - m->time_tc;
355 time_diff_tp = time - m->time_tp;
356 n_periods_tc = time_diff_tc / m->cir_period;
357 n_periods_tp = time_diff_tp / m->pir_period;
358 m->time_tc += n_periods_tc * m->cir_period;
359 m->time_tp += n_periods_tp * m->pir_period;
361 tc = m->tc + n_periods_tc * m->cir_bytes_per_period;
365 tp = m->tp + n_periods_tp * m->pir_bytes_per_period;
378 m->tp = tp - pkt_len;
382 m->tc = tc - pkt_len;
383 m->tp = tp - pkt_len;