MCPcopy Create free account
hub / github.com/F-Stack/f-stack / prob_backoff

Function prob_backoff

freebsd/netinet/cc/cc_cdg.c:500–520  ·  view source on GitHub ↗

* Using a negative exponential probabilistic backoff so that sources with * varying RTTs which share the same link will, on average, have the same * probability of backoff over time. * * Prob_backoff = 1 - exp(-qtrend / V_cdg_exp_backoff_scale), where * V_cdg_exp_backoff_scale is the average qtrend for the exponential backoff. */

Source from the content-addressed store, hash-verified

498 * V_cdg_exp_backoff_scale is the average qtrend for the exponential backoff.
499 */
500static inline int
501prob_backoff(long qtrend)
502{
503 int backoff, idx, p;
504
505 backoff = (qtrend > ((MAXGRAD * V_cdg_exp_backoff_scale) << D_P_E));
506
507 if (!backoff) {
508 if (V_cdg_exp_backoff_scale > 1)
509 idx = (qtrend + V_cdg_exp_backoff_scale / 2) /
510 V_cdg_exp_backoff_scale;
511 else
512 idx = qtrend;
513
514 /* Backoff probability proportional to rate of queue growth. */
515 p = (INT_MAX / (1 << EXP_PREC)) * probexp[idx];
516 backoff = (random() < p);
517 }
518
519 return (backoff);
520}
521
522static inline void
523calc_moving_average(struct cdg *cdg_data, long qdiff_max, long qdiff_min)

Callers 1

cdg_ack_receivedFunction · 0.85

Calls 1

randomFunction · 0.50

Tested by

no test coverage detected