diff options
Diffstat (limited to 'net/dccp/ccids')
-rw-r--r-- | net/dccp/ccids/ccid3.c | 25 |
1 files changed, 18 insertions, 7 deletions
diff --git a/net/dccp/ccids/ccid3.c b/net/dccp/ccids/ccid3.c index dc6e41883315..8d33a09608e9 100644 --- a/net/dccp/ccids/ccid3.c +++ b/net/dccp/ccids/ccid3.c | |||
@@ -82,6 +82,21 @@ static void ccid3_hc_tx_set_state(struct sock *sk, | |||
82 | } | 82 | } |
83 | 83 | ||
84 | /* | 84 | /* |
85 | * Compute the initial sending rate X_init according to RFC 3390: | ||
86 | * w_init = min(4 * MSS, max(2 * MSS, 4380 bytes)) | ||
87 | * X_init = w_init / RTT | ||
88 | * For consistency with other parts of the code, X_init is scaled by 2^6. | ||
89 | */ | ||
90 | static inline u64 rfc3390_initial_rate(struct sock *sk) | ||
91 | { | ||
92 | const struct dccp_sock *dp = dccp_sk(sk); | ||
93 | const __u32 w_init = min(4 * dp->dccps_mss_cache, | ||
94 | max(2 * dp->dccps_mss_cache, 4380U)); | ||
95 | |||
96 | return scaled_div(w_init << 6, ccid3_hc_tx_sk(sk)->ccid3hctx_rtt); | ||
97 | } | ||
98 | |||
99 | /* | ||
85 | * Recalculate t_ipi and delta (should be called whenever X changes) | 100 | * Recalculate t_ipi and delta (should be called whenever X changes) |
86 | */ | 101 | */ |
87 | static inline void ccid3_update_send_interval(struct ccid3_hc_tx_sock *hctx) | 102 | static inline void ccid3_update_send_interval(struct ccid3_hc_tx_sock *hctx) |
@@ -469,20 +484,16 @@ static void ccid3_hc_tx_packet_recv(struct sock *sk, struct sk_buff *skb) | |||
469 | /* | 484 | /* |
470 | * Larger Initial Windows [RFC 4342, sec. 5] | 485 | * Larger Initial Windows [RFC 4342, sec. 5] |
471 | */ | 486 | */ |
472 | __u32 w_init = min(4 * dp->dccps_mss_cache, | ||
473 | max(2 * dp->dccps_mss_cache, 4380U)); | ||
474 | hctx->ccid3hctx_rtt = r_sample; | 487 | hctx->ccid3hctx_rtt = r_sample; |
475 | hctx->ccid3hctx_x = scaled_div(w_init << 6, r_sample); | 488 | hctx->ccid3hctx_x = rfc3390_initial_rate(sk); |
476 | hctx->ccid3hctx_t_ld = now; | 489 | hctx->ccid3hctx_t_ld = now; |
477 | 490 | ||
478 | ccid3_update_send_interval(hctx); | 491 | ccid3_update_send_interval(hctx); |
479 | 492 | ||
480 | ccid3_pr_debug("%s(%p), s=%u, MSS=%u, w_init=%u, " | 493 | ccid3_pr_debug("%s(%p), s=%u, MSS=%u, " |
481 | "R_sample=%dus, X=%u\n", dccp_role(sk), | 494 | "R_sample=%dus, X=%u\n", dccp_role(sk), |
482 | sk, hctx->ccid3hctx_s, | 495 | sk, hctx->ccid3hctx_s, |
483 | dp->dccps_mss_cache, | 496 | dp->dccps_mss_cache, (int)r_sample, |
484 | w_init, | ||
485 | (int)r_sample, | ||
486 | (unsigned)(hctx->ccid3hctx_x >> 6)); | 497 | (unsigned)(hctx->ccid3hctx_x >> 6)); |
487 | 498 | ||
488 | ccid3_hc_tx_set_state(sk, TFRC_SSTATE_FBACK); | 499 | ccid3_hc_tx_set_state(sk, TFRC_SSTATE_FBACK); |