* 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. */
| 498 | * V_cdg_exp_backoff_scale is the average qtrend for the exponential backoff. |
| 499 | */ |
| 500 | static inline int |
| 501 | prob_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 | |
| 522 | static inline void |
| 523 | calc_moving_average(struct cdg *cdg_data, long qdiff_max, long qdiff_min) |
no test coverage detected