aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--net/dccp/ccids/ccid2.c20
1 files changed, 15 insertions, 5 deletions
diff --git a/net/dccp/ccids/ccid2.c b/net/dccp/ccids/ccid2.c
index ef19fb834299..9c5b6c73f7c9 100644
--- a/net/dccp/ccids/ccid2.c
+++ b/net/dccp/ccids/ccid2.c
@@ -741,15 +741,25 @@ static void ccid2_hc_tx_packet_recv(struct sock *sk, struct sk_buff *skb)
741static int ccid2_hc_tx_init(struct ccid *ccid, struct sock *sk) 741static int ccid2_hc_tx_init(struct ccid *ccid, struct sock *sk)
742{ 742{
743 struct ccid2_hc_tx_sock *hctx = ccid_priv(ccid); 743 struct ccid2_hc_tx_sock *hctx = ccid_priv(ccid);
744 struct dccp_sock *dp = dccp_sk(sk);
745 u32 max_ratio;
744 746
745 ccid2_change_cwnd(hctx, 1); 747 /* RFC 4341, 5: initialise ssthresh to arbitrarily high (max) value */
746 /* Initialize ssthresh to infinity. This means that we will exit the
747 * initial slow-start after the first packet loss. This is what we
748 * want.
749 */
750 hctx->ccid2hctx_ssthresh = ~0; 748 hctx->ccid2hctx_ssthresh = ~0;
751 hctx->ccid2hctx_numdupack = 3; 749 hctx->ccid2hctx_numdupack = 3;
752 750
751 /*
752 * RFC 4341, 5: "The cwnd parameter is initialized to at most four
753 * packets for new connections, following the rules from [RFC3390]".
754 * We need to convert the bytes of RFC3390 into the packets of RFC 4341.
755 */
756 hctx->ccid2hctx_cwnd = min(4U, max(2U, 4380U / dp->dccps_mss_cache));
757
758 /* Make sure that Ack Ratio is enabled and within bounds. */
759 max_ratio = DIV_ROUND_UP(hctx->ccid2hctx_cwnd, 2);
760 if (dp->dccps_l_ack_ratio == 0 || dp->dccps_l_ack_ratio > max_ratio)
761 dp->dccps_l_ack_ratio = max_ratio;
762
753 /* XXX init ~ to window size... */ 763 /* XXX init ~ to window size... */
754 if (ccid2_hc_tx_alloc_seq(hctx)) 764 if (ccid2_hc_tx_alloc_seq(hctx))
755 return -ENOMEM; 765 return -ENOMEM;