Lines Matching refs:p

229 static inline void red_set_parms(struct red_parms *p,  in red_set_parms()  argument
236 p->qth_min = qth_min << Wlog; in red_set_parms()
237 p->qth_max = qth_max << Wlog; in red_set_parms()
238 p->Wlog = Wlog; in red_set_parms()
239 p->Plog = Plog; in red_set_parms()
242 p->qth_delta = delta; in red_set_parms()
247 p->max_P = max_P; in red_set_parms()
250 p->max_P_reciprocal = reciprocal_value(max_p_delta); in red_set_parms()
257 p->target_min = qth_min + 2*delta; in red_set_parms()
258 p->target_max = qth_min + 3*delta; in red_set_parms()
260 p->Scell_log = Scell_log; in red_set_parms()
261 p->Scell_max = (255 << Scell_log); in red_set_parms()
264 memcpy(p->Stab, stab, sizeof(p->Stab)); in red_set_parms()
289 static inline unsigned long red_calc_qavg_from_idle_time(const struct red_parms *p, in red_calc_qavg_from_idle_time() argument
293 long us_idle = min_t(s64, delta, p->Scell_max); in red_calc_qavg_from_idle_time()
316 shift = p->Stab[(us_idle >> p->Scell_log) & RED_STAB_MASK]; in red_calc_qavg_from_idle_time()
328 us_idle = (v->qavg * (u64)us_idle) >> p->Scell_log; in red_calc_qavg_from_idle_time()
337 static inline unsigned long red_calc_qavg_no_idle_time(const struct red_parms *p, in red_calc_qavg_no_idle_time() argument
350 return v->qavg + (backlog - (v->qavg >> p->Wlog)); in red_calc_qavg_no_idle_time()
353 static inline unsigned long red_calc_qavg(const struct red_parms *p, in red_calc_qavg() argument
358 return red_calc_qavg_no_idle_time(p, v, backlog); in red_calc_qavg()
360 return red_calc_qavg_from_idle_time(p, v); in red_calc_qavg()
364 static inline u32 red_random(const struct red_parms *p) in red_random() argument
366 return reciprocal_divide(get_random_u32(), p->max_P_reciprocal); in red_random()
369 static inline int red_mark_probability(const struct red_parms *p, in red_mark_probability() argument
389 return !(((qavg - p->qth_min) >> p->Wlog) * v->qcount < v->qR); in red_mark_probability()
398 static inline int red_cmp_thresh(const struct red_parms *p, unsigned long qavg) in red_cmp_thresh() argument
400 if (qavg < p->qth_min) in red_cmp_thresh()
402 else if (qavg >= p->qth_max) in red_cmp_thresh()
414 static inline int red_action(const struct red_parms *p, in red_action() argument
418 switch (red_cmp_thresh(p, qavg)) { in red_action()
425 if (red_mark_probability(p, v, qavg)) { in red_action()
427 v->qR = red_random(p); in red_action()
431 v->qR = red_random(p); in red_action()
444 static inline void red_adaptative_algo(struct red_parms *p, struct red_vars *v) in red_adaptative_algo() argument
451 qavg = red_calc_qavg_from_idle_time(p, v); in red_adaptative_algo()
454 qavg >>= p->Wlog; in red_adaptative_algo()
456 if (qavg > p->target_max && p->max_P <= MAX_P_MAX) in red_adaptative_algo()
457 p->max_P += MAX_P_ALPHA(p->max_P); /* maxp = maxp + alpha */ in red_adaptative_algo()
458 else if (qavg < p->target_min && p->max_P >= MAX_P_MIN) in red_adaptative_algo()
459 p->max_P = (p->max_P/10)*9; /* maxp = maxp * Beta */ in red_adaptative_algo()
461 max_p_delta = DIV_ROUND_CLOSEST(p->max_P, p->qth_delta); in red_adaptative_algo()
463 p->max_P_reciprocal = reciprocal_value(max_p_delta); in red_adaptative_algo()