aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--net/dccp/ccids/ccid3.c21
1 files changed, 12 insertions, 9 deletions
diff --git a/net/dccp/ccids/ccid3.c b/net/dccp/ccids/ccid3.c
index f56aaecb56b3..5bf110b28abc 100644
--- a/net/dccp/ccids/ccid3.c
+++ b/net/dccp/ccids/ccid3.c
@@ -83,18 +83,21 @@ static void ccid3_hc_tx_set_state(struct sock *sk,
83} 83}
84 84
85/* 85/*
86 * Compute the initial sending rate X_init according to RFC 3390: 86 * Compute the initial sending rate X_init in the manner of RFC 3390:
87 * w_init = min(4 * MSS, max(2 * MSS, 4380 bytes)) 87 *
88 * X_init = w_init / RTT 88 * X_init = min(4 * s, max(2 * s, 4380 bytes)) / RTT
89 *
90 * Note that RFC 3390 uses MSS, RFC 4342 refers to RFC 3390, and rfc3448bis
91 * (rev-02) clarifies the use of RFC 3390 with regard to the above formula.
89 * For consistency with other parts of the code, X_init is scaled by 2^6. 92 * For consistency with other parts of the code, X_init is scaled by 2^6.
90 */ 93 */
91static inline u64 rfc3390_initial_rate(struct sock *sk) 94static inline u64 rfc3390_initial_rate(struct sock *sk)
92{ 95{
93 const struct dccp_sock *dp = dccp_sk(sk); 96 const struct ccid3_hc_tx_sock *hctx = ccid3_hc_tx_sk(sk);
94 const __u32 w_init = min(4 * dp->dccps_mss_cache, 97 const __u32 w_init = min_t(__u32, 4 * hctx->ccid3hctx_s,
95 max(2 * dp->dccps_mss_cache, 4380U)); 98 max_t(__u32, 2 * hctx->ccid3hctx_s, 4380));
96 99
97 return scaled_div(w_init << 6, ccid3_hc_tx_sk(sk)->ccid3hctx_rtt); 100 return scaled_div(w_init << 6, hctx->ccid3hctx_rtt);
98} 101}
99 102
100/* 103/*
@@ -336,8 +339,8 @@ static int ccid3_hc_tx_send_packet(struct sock *sk, struct sk_buff *skb)
336 hctx->ccid3hctx_x = rfc3390_initial_rate(sk); 339 hctx->ccid3hctx_x = rfc3390_initial_rate(sk);
337 hctx->ccid3hctx_t_ld = now; 340 hctx->ccid3hctx_t_ld = now;
338 } else { 341 } else {
339 /* Sender does not have RTT sample: X = MSS/second */ 342 /* Sender does not have RTT sample: X_pps = 1 pkt/sec */
340 hctx->ccid3hctx_x = dp->dccps_mss_cache; 343 hctx->ccid3hctx_x = hctx->ccid3hctx_s;
341 hctx->ccid3hctx_x <<= 6; 344 hctx->ccid3hctx_x <<= 6;
342 } 345 }
343 ccid3_update_send_interval(hctx); 346 ccid3_update_send_interval(hctx);