34 #ifndef __RTE_RED_H_INCLUDED__
35 #define __RTE_RED_H_INCLUDED__
55 #define RTE_RED_SCALING 10
56 #define RTE_RED_S (1 << 22)
57 #define RTE_RED_MAX_TH_MAX 1023
58 #define RTE_RED_WQ_LOG2_MIN 1
59 #define RTE_RED_WQ_LOG2_MAX 12
60 #define RTE_RED_MAXP_INV_MIN 1
61 #define RTE_RED_MAXP_INV_MAX 255
62 #define RTE_RED_2POW16 (1<<16)
63 #define RTE_RED_INT16_NBITS (sizeof(uint16_t) * CHAR_BIT)
64 #define RTE_RED_WQ_LOG2_NUM (RTE_RED_WQ_LOG2_MAX - RTE_RED_WQ_LOG2_MIN + 1)
71 extern uint32_t rte_red_rand_seed;
72 extern uint16_t rte_red_log2_1_minus_Wq[RTE_RED_WQ_LOG2_NUM];
73 extern uint16_t rte_red_pow2_frac_inv[16];
134 const uint16_t wq_log2,
135 const uint16_t min_th,
136 const uint16_t max_th,
137 const uint16_t maxp_inv);
149 static inline uint32_t
152 rte_red_rand_seed = (214013 * rte_red_rand_seed) + 2531011;
153 return rte_red_rand_seed >> 10;
166 static inline uint16_t
210 return (uint16_t) ((rte_red_pow2_frac_inv[f] + (1 << (n - 1))) >> n);
234 uint64_t time_diff = 0, m = 0;
236 RTE_ASSERT(red_cfg != NULL);
237 RTE_ASSERT(red != NULL);
245 time_diff = time - red->
q_time;
312 uint32_t pa_num_count = 0;
316 pa_num_count = red->
count * pa_num;
318 if (red_cfg->
pa_const <= pa_num_count)
321 pa_den = red_cfg->
pa_const - pa_num_count;
324 if (
unlikely((rte_red_rand_val % pa_den) < pa_num)) {
351 RTE_ASSERT(red_cfg != NULL);
352 RTE_ASSERT(red != NULL);
414 RTE_ASSERT(red_cfg != NULL);
415 RTE_ASSERT(red != NULL);