5 #ifndef __INCLUDE_RTE_METER_H__
6 #define __INCLUDE_RTE_METER_H__
23 #include <rte_compat.h>
61 struct rte_meter_srtcm_profile;
67 struct rte_meter_trtcm_profile;
70 struct rte_meter_srtcm;
85 int __rte_experimental
99 int __rte_experimental
115 struct rte_meter_srtcm_profile *p);
129 struct rte_meter_trtcm_profile *p);
147 struct rte_meter_srtcm_profile *p,
169 struct rte_meter_srtcm_profile *p,
190 struct rte_meter_trtcm_profile *p,
212 struct rte_meter_trtcm_profile *p,
222 struct rte_meter_srtcm_profile {
229 uint64_t cir_bytes_per_period;
234 struct rte_meter_srtcm {
240 struct rte_meter_trtcm_profile {
247 uint64_t cir_bytes_per_period;
251 uint64_t pir_bytes_per_period;
272 struct rte_meter_srtcm_profile *p,
276 uint64_t time_diff, n_periods, tc, te;
279 time_diff = time - m->time;
280 n_periods = time_diff / p->cir_period;
281 m->time += n_periods * p->cir_period;
284 tc = m->tc + n_periods * p->cir_bytes_per_period;
295 m->tc = tc - pkt_len;
302 m->te = te - pkt_len;
313 struct rte_meter_srtcm_profile *p,
318 uint64_t time_diff, n_periods, tc, te;
321 time_diff = time - m->time;
322 n_periods = time_diff / p->cir_period;
323 m->time += n_periods * p->cir_period;
326 tc = m->tc + n_periods * p->cir_bytes_per_period;
337 m->tc = tc - pkt_len;
344 m->te = te - pkt_len;
355 struct rte_meter_trtcm_profile *p,
359 uint64_t time_diff_tc, time_diff_tp, n_periods_tc, n_periods_tp, tc, tp;
362 time_diff_tc = time - m->
time_tc;
363 time_diff_tp = time - m->
time_tp;
364 n_periods_tc = time_diff_tc / p->cir_period;
365 n_periods_tp = time_diff_tp / p->pir_period;
366 m->
time_tc += n_periods_tc * p->cir_period;
367 m->
time_tp += n_periods_tp * p->pir_period;
369 tc = m->
tc + n_periods_tc * p->cir_bytes_per_period;
373 tp = m->
tp + n_periods_tp * p->pir_bytes_per_period;
386 m->
tp = tp - pkt_len;
390 m->
tc = tc - pkt_len;
391 m->
tp = tp - pkt_len;
397 struct rte_meter_trtcm_profile *p,
402 uint64_t time_diff_tc, time_diff_tp, n_periods_tc, n_periods_tp, tc, tp;
405 time_diff_tc = time - m->
time_tc;
406 time_diff_tp = time - m->
time_tp;
407 n_periods_tc = time_diff_tc / p->cir_period;
408 n_periods_tp = time_diff_tp / p->pir_period;
409 m->
time_tc += n_periods_tc * p->cir_period;
410 m->
time_tp += n_periods_tp * p->pir_period;
412 tc = m->
tc + n_periods_tc * p->cir_bytes_per_period;
416 tp = m->
tp + n_periods_tp * p->pir_bytes_per_period;
429 m->
tp = tp - pkt_len;
433 m->
tc = tc - pkt_len;
434 m->
tp = tp - pkt_len;