5 #ifndef __INCLUDE_RTE_METER_H__
6 #define __INCLUDE_RTE_METER_H__
57 struct rte_meter_srtcm;
60 struct rte_meter_trtcm;
170 struct rte_meter_srtcm {
177 uint64_t cir_bytes_per_period;
181 struct rte_meter_trtcm {
189 uint64_t cir_bytes_per_period;
191 uint64_t pir_bytes_per_period;
199 uint64_t time_diff, n_periods, tc, te;
202 time_diff = time - m->time;
203 n_periods = time_diff / m->cir_period;
204 m->time += n_periods * m->cir_period;
207 tc = m->tc + n_periods * m->cir_bytes_per_period;
218 m->tc = tc - pkt_len;
225 m->te = te - pkt_len;
240 uint64_t time_diff, n_periods, tc, te;
243 time_diff = time - m->time;
244 n_periods = time_diff / m->cir_period;
245 m->time += n_periods * m->cir_period;
248 tc = m->tc + n_periods * m->cir_bytes_per_period;
259 m->tc = tc - pkt_len;
266 m->te = te - pkt_len;
280 uint64_t time_diff_tc, time_diff_tp, n_periods_tc, n_periods_tp, tc, tp;
283 time_diff_tc = time - m->time_tc;
284 time_diff_tp = time - m->time_tp;
285 n_periods_tc = time_diff_tc / m->cir_period;
286 n_periods_tp = time_diff_tp / m->pir_period;
287 m->time_tc += n_periods_tc * m->cir_period;
288 m->time_tp += n_periods_tp * m->pir_period;
290 tc = m->tc + n_periods_tc * m->cir_bytes_per_period;
294 tp = m->tp + n_periods_tp * m->pir_bytes_per_period;
307 m->tp = tp - pkt_len;
311 m->tc = tc - pkt_len;
312 m->tp = tp - pkt_len;
322 uint64_t time_diff_tc, time_diff_tp, n_periods_tc, n_periods_tp, tc, tp;
325 time_diff_tc = time - m->time_tc;
326 time_diff_tp = time - m->time_tp;
327 n_periods_tc = time_diff_tc / m->cir_period;
328 n_periods_tp = time_diff_tp / m->pir_period;
329 m->time_tc += n_periods_tc * m->cir_period;
330 m->time_tp += n_periods_tp * m->pir_period;
332 tc = m->tc + n_periods_tc * m->cir_bytes_per_period;
336 tp = m->tp + n_periods_tp * m->pir_bytes_per_period;
349 m->tp = tp - pkt_len;
353 m->tc = tc - pkt_len;
354 m->tp = tp - pkt_len;