aboutsummaryrefslogtreecommitdiffstats
path: root/net/dccp/ccids/ccid3.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/dccp/ccids/ccid3.c')
-rw-r--r--net/dccp/ccids/ccid3.c18
1 files changed, 8 insertions, 10 deletions
diff --git a/net/dccp/ccids/ccid3.c b/net/dccp/ccids/ccid3.c
index d77d3e664b7e..7cd76c6c790c 100644
--- a/net/dccp/ccids/ccid3.c
+++ b/net/dccp/ccids/ccid3.c
@@ -66,15 +66,15 @@ static inline u64 rfc3390_initial_rate(struct sock *sk)
66} 66}
67 67
68/** 68/**
69 * ccid3_update_send_interval - Calculate new t_ipi = s / X_inst 69 * ccid3_update_send_interval - Calculate new t_ipi = s / X
70 * This respects the granularity of X_inst (64 * bytes/second). 70 * This respects the granularity of X (64 * bytes/second) and enforces the
71 * scaled minimum of s * 64 / t_mbi = `s' bytes/second as per RFC 3448/4342.
71 */ 72 */
72static void ccid3_update_send_interval(struct ccid3_hc_tx_sock *hctx) 73static void ccid3_update_send_interval(struct ccid3_hc_tx_sock *hctx)
73{ 74{
75 if (unlikely(hctx->x <= hctx->s))
76 hctx->x = hctx->s;
74 hctx->t_ipi = scaled_div32(((u64)hctx->s) << 6, hctx->x); 77 hctx->t_ipi = scaled_div32(((u64)hctx->s) << 6, hctx->x);
75
76 ccid3_pr_debug("t_ipi=%u, s=%u, X=%u\n", hctx->t_ipi,
77 hctx->s, (unsigned)(hctx->x >> 6));
78} 78}
79 79
80static u32 ccid3_hc_tx_idle_rtt(struct ccid3_hc_tx_sock *hctx, ktime_t now) 80static u32 ccid3_hc_tx_idle_rtt(struct ccid3_hc_tx_sock *hctx, ktime_t now)
@@ -115,7 +115,6 @@ static void ccid3_hc_tx_update_x(struct sock *sk, ktime_t *stamp)
115 if (hctx->p > 0) { 115 if (hctx->p > 0) {
116 116
117 hctx->x = min(((u64)hctx->x_calc) << 6, min_rate); 117 hctx->x = min(((u64)hctx->x_calc) << 6, min_rate);
118 hctx->x = max(hctx->x, (((u64)hctx->s) << 6) / TFRC_T_MBI);
119 118
120 } else if (ktime_us_delta(now, hctx->t_ld) - (s64)hctx->rtt >= 0) { 119 } else if (ktime_us_delta(now, hctx->t_ld) - (s64)hctx->rtt >= 0) {
121 120
@@ -197,8 +196,9 @@ static void ccid3_hc_tx_no_feedback_timer(unsigned long data)
197 if (hctx->t_rto == 0 || hctx->p == 0) { 196 if (hctx->t_rto == 0 || hctx->p == 0) {
198 197
199 /* halve send rate directly */ 198 /* halve send rate directly */
200 hctx->x = max(hctx->x / 2, (((u64)hctx->s) << 6) / TFRC_T_MBI); 199 hctx->x /= 2;
201 ccid3_update_send_interval(hctx); 200 ccid3_update_send_interval(hctx);
201
202 } else { 202 } else {
203 /* 203 /*
204 * Modify the cached value of X_recv 204 * Modify the cached value of X_recv
@@ -213,9 +213,7 @@ static void ccid3_hc_tx_no_feedback_timer(unsigned long data)
213 BUG_ON(hctx->p && !hctx->x_calc); 213 BUG_ON(hctx->p && !hctx->x_calc);
214 214
215 if (hctx->x_calc > (hctx->x_recv >> 5)) 215 if (hctx->x_calc > (hctx->x_recv >> 5))
216 hctx->x_recv = 216 hctx->x_recv /= 2;
217 max(hctx->x_recv / 2,
218 (((__u64)hctx->s) << 6) / (2 * TFRC_T_MBI));
219 else { 217 else {
220 hctx->x_recv = hctx->x_calc; 218 hctx->x_recv = hctx->x_calc;
221 hctx->x_recv <<= 4; 219 hctx->x_recv <<= 4;