5 #ifndef __INCLUDE_RTE_METER_H__
6 #define __INCLUDE_RTE_METER_H__
60 struct rte_meter_srtcm_profile;
66 struct rte_meter_trtcm_profile;
69 struct rte_meter_srtcm;
114 struct rte_meter_srtcm_profile *p);
128 struct rte_meter_trtcm_profile *p);
146 struct rte_meter_srtcm_profile *p,
168 struct rte_meter_srtcm_profile *p,
189 struct rte_meter_trtcm_profile *p,
211 struct rte_meter_trtcm_profile *p,
221 struct rte_meter_srtcm_profile {
228 uint64_t cir_bytes_per_period;
233 struct rte_meter_srtcm {
239 struct rte_meter_trtcm_profile {
246 uint64_t cir_bytes_per_period;
250 uint64_t pir_bytes_per_period;
271 struct rte_meter_srtcm_profile *p,
275 uint64_t time_diff, n_periods, tc, te;
278 time_diff = time - m->time;
279 n_periods = time_diff / p->cir_period;
280 m->time += n_periods * p->cir_period;
283 tc = m->tc + n_periods * p->cir_bytes_per_period;
294 m->tc = tc - pkt_len;
301 m->te = te - pkt_len;
312 struct rte_meter_srtcm_profile *p,
317 uint64_t time_diff, n_periods, tc, te;
320 time_diff = time - m->time;
321 n_periods = time_diff / p->cir_period;
322 m->time += n_periods * p->cir_period;
325 tc = m->tc + n_periods * p->cir_bytes_per_period;
336 m->tc = tc - pkt_len;
343 m->te = te - pkt_len;
354 struct rte_meter_trtcm_profile *p,
358 uint64_t time_diff_tc, time_diff_tp, n_periods_tc, n_periods_tp, tc, tp;
361 time_diff_tc = time - m->
time_tc;
362 time_diff_tp = time - m->
time_tp;
363 n_periods_tc = time_diff_tc / p->cir_period;
364 n_periods_tp = time_diff_tp / p->pir_period;
365 m->
time_tc += n_periods_tc * p->cir_period;
366 m->
time_tp += n_periods_tp * p->pir_period;
368 tc = m->
tc + n_periods_tc * p->cir_bytes_per_period;
372 tp = m->
tp + n_periods_tp * p->pir_bytes_per_period;
385 m->
tp = tp - pkt_len;
389 m->
tc = tc - pkt_len;
390 m->
tp = tp - pkt_len;
396 struct rte_meter_trtcm_profile *p,
401 uint64_t time_diff_tc, time_diff_tp, n_periods_tc, n_periods_tp, tc, tp;
404 time_diff_tc = time - m->
time_tc;
405 time_diff_tp = time - m->
time_tp;
406 n_periods_tc = time_diff_tc / p->cir_period;
407 n_periods_tp = time_diff_tp / p->pir_period;
408 m->
time_tc += n_periods_tc * p->cir_period;
409 m->
time_tp += n_periods_tp * p->pir_period;
411 tc = m->
tc + n_periods_tc * p->cir_bytes_per_period;
415 tp = m->
tp + n_periods_tp * p->pir_bytes_per_period;
428 m->
tp = tp - pkt_len;
432 m->
tc = tc - pkt_len;
433 m->
tp = tp - pkt_len;
static enum rte_meter_color rte_meter_srtcm_color_aware_check(struct rte_meter_srtcm *m, struct rte_meter_srtcm_profile *p, uint64_t time, uint32_t pkt_len, enum rte_meter_color pkt_color)
int rte_meter_trtcm_profile_config(struct rte_meter_trtcm_profile *p, struct rte_meter_trtcm_params *params)
int rte_meter_srtcm_config(struct rte_meter_srtcm *m, struct rte_meter_srtcm_profile *p)
int rte_meter_trtcm_config(struct rte_meter_trtcm *m, struct rte_meter_trtcm_profile *p)
static enum rte_meter_color rte_meter_trtcm_color_aware_check(struct rte_meter_trtcm *m, struct rte_meter_trtcm_profile *p, uint64_t time, uint32_t pkt_len, enum rte_meter_color pkt_color)
static enum rte_meter_color rte_meter_trtcm_color_blind_check(struct rte_meter_trtcm *m, struct rte_meter_trtcm_profile *p, uint64_t time, uint32_t pkt_len)
static enum rte_meter_color rte_meter_srtcm_color_blind_check(struct rte_meter_srtcm *m, struct rte_meter_srtcm_profile *p, uint64_t time, uint32_t pkt_len)
int rte_meter_srtcm_profile_config(struct rte_meter_srtcm_profile *p, struct rte_meter_srtcm_params *params)