diff options
Diffstat (limited to 'sys/netinet/cc/cc_cdg.c')
-rw-r--r-- | sys/netinet/cc/cc_cdg.c | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/sys/netinet/cc/cc_cdg.c b/sys/netinet/cc/cc_cdg.c index 1e9236f878d4..5b1df76e71a2 100644 --- a/sys/netinet/cc/cc_cdg.c +++ b/sys/netinet/cc/cc_cdg.c @@ -57,6 +57,7 @@ #include <sys/malloc.h> #include <sys/module.h> #include <sys/queue.h> +#include <sys/prng.h> #include <sys/socket.h> #include <sys/socketvar.h> #include <sys/sysctl.h> @@ -294,7 +295,7 @@ cdg_cb_init(struct cc_var *ccv, void *ptr) { struct cdg *cdg_data; - INP_WLOCK_ASSERT(tptoinpcb(ccv->ccvc.tcp)); + INP_WLOCK_ASSERT(tptoinpcb(ccv->tp)); if (ptr == NULL) { cdg_data = malloc(sizeof(struct cdg), M_CC_MEM, M_NOWAIT); if (cdg_data == NULL) @@ -415,27 +416,28 @@ cdg_window_increase(struct cc_var *ccv, int new_measurement) { struct cdg *cdg_data; int incr, s_w_incr; + uint32_t mss = tcp_fixed_maxseg(ccv->tp); cdg_data = ccv->cc_data; incr = s_w_incr = 0; if (CCV(ccv, snd_cwnd) <= CCV(ccv, snd_ssthresh)) { /* Slow start. */ - incr = CCV(ccv, t_maxseg); + incr = mss; s_w_incr = incr; cdg_data->window_incr = cdg_data->rtt_count = 0; } else { /* Congestion avoidance. */ if (new_measurement) { - s_w_incr = CCV(ccv, t_maxseg); + s_w_incr = mss; if (V_cdg_alpha_inc == 0) { - incr = CCV(ccv, t_maxseg); + incr = mss; } else { if (++cdg_data->rtt_count >= V_cdg_alpha_inc) { cdg_data->window_incr++; cdg_data->rtt_count = 0; } - incr = CCV(ccv, t_maxseg) * + incr = mss * cdg_data->window_incr; } } @@ -507,7 +509,8 @@ cdg_cong_signal(struct cc_var *ccv, ccsignal_t signal_type) static inline int prob_backoff(long qtrend) { - int backoff, idx, p; + int backoff, idx; + uint32_t p; backoff = (qtrend > ((MAXGRAD * V_cdg_exp_backoff_scale) << D_P_E)); @@ -519,8 +522,8 @@ prob_backoff(long qtrend) idx = qtrend; /* Backoff probability proportional to rate of queue growth. */ - p = (INT_MAX / (1 << EXP_PREC)) * probexp[idx]; - backoff = (random() < p); + p = (UINT32_MAX / (1 << EXP_PREC)) * probexp[idx]; + backoff = (prng32() < p); } return (backoff); |