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;
235 tc = m->tc + n_periods * m->cir_bytes_per_period;
239 te = m->te + n_periods * m->cir_bytes_per_period;
245 m->tc = tc - pkt_len;
252 m->te = te - pkt_len;
267 uint64_t time_diff, n_periods, tc, te;
270 time_diff = time - m->time;
271 n_periods = time_diff / m->cir_period;
272 m->time += n_periods * m->cir_period;
274 tc = m->tc + n_periods * m->cir_bytes_per_period;
278 te = m->te + n_periods * m->cir_bytes_per_period;
284 m->tc = tc - pkt_len;
291 m->te = te - pkt_len;
305 uint64_t time_diff_tc, time_diff_tp, n_periods_tc, n_periods_tp, tc, tp;
308 time_diff_tc = time - m->time_tc;
309 time_diff_tp = time - m->time_tp;
310 n_periods_tc = time_diff_tc / m->cir_period;
311 n_periods_tp = time_diff_tp / m->pir_period;
312 m->time_tc += n_periods_tc * m->cir_period;
313 m->time_tp += n_periods_tp * m->pir_period;
315 tc = m->tc + n_periods_tc * m->cir_bytes_per_period;
319 tp = m->tp + n_periods_tp * m->pir_bytes_per_period;
332 m->tp = tp - pkt_len;
336 m->tc = tc - pkt_len;
337 m->tp = tp - pkt_len;
347 uint64_t time_diff_tc, time_diff_tp, n_periods_tc, n_periods_tp, tc, tp;
350 time_diff_tc = time - m->time_tc;
351 time_diff_tp = time - m->time_tp;
352 n_periods_tc = time_diff_tc / m->cir_period;
353 n_periods_tp = time_diff_tp / m->pir_period;
354 m->time_tc += n_periods_tc * m->cir_period;
355 m->time_tp += n_periods_tp * m->pir_period;
357 tc = m->tc + n_periods_tc * m->cir_bytes_per_period;
361 tp = m->tp + n_periods_tp * m->pir_bytes_per_period;
374 m->tp = tp - pkt_len;
378 m->tc = tc - pkt_len;
379 m->tp = tp - pkt_len;