5 #ifndef __RTE_RED_H_INCLUDED__
6 #define __RTE_RED_H_INCLUDED__
26 #define RTE_RED_SCALING 10
27 #define RTE_RED_S (1 << 22)
28 #define RTE_RED_MAX_TH_MAX 1023
29 #define RTE_RED_WQ_LOG2_MIN 1
30 #define RTE_RED_WQ_LOG2_MAX 12
31 #define RTE_RED_MAXP_INV_MIN 1
32 #define RTE_RED_MAXP_INV_MAX 255
33 #define RTE_RED_2POW16 (1<<16)
34 #define RTE_RED_INT16_NBITS (sizeof(uint16_t) * CHAR_BIT)
35 #define RTE_RED_WQ_LOG2_NUM (RTE_RED_WQ_LOG2_MAX - RTE_RED_WQ_LOG2_MIN + 1)
42 extern uint32_t rte_red_rand_seed;
43 extern uint16_t rte_red_log2_1_minus_Wq[RTE_RED_WQ_LOG2_NUM];
44 extern uint16_t rte_red_pow2_frac_inv[16];
105 const uint16_t wq_log2,
106 const uint16_t min_th,
107 const uint16_t max_th,
108 const uint16_t maxp_inv);
120 static inline uint32_t
123 rte_red_rand_seed = (214013 * rte_red_rand_seed) + 2531011;
124 return rte_red_rand_seed >> 10;
137 static inline uint16_t
181 return (uint16_t) ((rte_red_pow2_frac_inv[f] + (1 << (n - 1))) >> n);
205 uint64_t time_diff = 0, m = 0;
207 RTE_ASSERT(red_cfg != NULL);
208 RTE_ASSERT(red != NULL);
216 time_diff = time - red->
q_time;
283 uint32_t pa_num_count = 0;
287 pa_num_count = red->
count * pa_num;
289 if (red_cfg->
pa_const <= pa_num_count)
292 pa_den = red_cfg->
pa_const - pa_num_count;
295 if (
unlikely((rte_red_rand_val % pa_den) < pa_num)) {
322 RTE_ASSERT(red_cfg != NULL);
323 RTE_ASSERT(red != NULL);
385 RTE_ASSERT(red_cfg != NULL);
386 RTE_ASSERT(red != NULL);