From 450fb8dbdaacad0529ae33fc8bdb8e4e4a5671ec Mon Sep 17 00:00:00 2001 From: Gerrit Renker Date: Sat, 24 Nov 2007 21:44:30 -0200 Subject: [PATCH] --- yaml --- r: 78199 b: refs/heads/master c: b00d2bbc45a287c9a72374582ce42205f3412419 h: refs/heads/master i: 78197: cafc31d81142127656d75d87c3e80276794b5ee0 78195: 40b3b72e304d40f6318f4da8bc04fec68aca06d4 78191: c144635cc7fa2025830e48139e6de788d5ef7bd7 v: v3 --- [refs] | 2 +- trunk/net/dccp/ccids/ccid2.c | 20 +++++++++++++++----- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/[refs] b/[refs] index f60b214d06d5..060c304b5352 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: e18d7a9857cb620a8f70622c4e400be477c264cf +refs/heads/master: b00d2bbc45a287c9a72374582ce42205f3412419 diff --git a/trunk/net/dccp/ccids/ccid2.c b/trunk/net/dccp/ccids/ccid2.c index ef19fb834299..9c5b6c73f7c9 100644 --- a/trunk/net/dccp/ccids/ccid2.c +++ b/trunk/net/dccp/ccids/ccid2.c @@ -741,15 +741,25 @@ static void ccid2_hc_tx_packet_recv(struct sock *sk, struct sk_buff *skb) static int ccid2_hc_tx_init(struct ccid *ccid, struct sock *sk) { struct ccid2_hc_tx_sock *hctx = ccid_priv(ccid); + struct dccp_sock *dp = dccp_sk(sk); + u32 max_ratio; - ccid2_change_cwnd(hctx, 1); - /* Initialize ssthresh to infinity. This means that we will exit the - * initial slow-start after the first packet loss. This is what we - * want. - */ + /* RFC 4341, 5: initialise ssthresh to arbitrarily high (max) value */ hctx->ccid2hctx_ssthresh = ~0; hctx->ccid2hctx_numdupack = 3; + /* + * RFC 4341, 5: "The cwnd parameter is initialized to at most four + * packets for new connections, following the rules from [RFC3390]". + * We need to convert the bytes of RFC3390 into the packets of RFC 4341. + */ + hctx->ccid2hctx_cwnd = min(4U, max(2U, 4380U / dp->dccps_mss_cache)); + + /* Make sure that Ack Ratio is enabled and within bounds. */ + max_ratio = DIV_ROUND_UP(hctx->ccid2hctx_cwnd, 2); + if (dp->dccps_l_ack_ratio == 0 || dp->dccps_l_ack_ratio > max_ratio) + dp->dccps_l_ack_ratio = max_ratio; + /* XXX init ~ to window size... */ if (ccid2_hc_tx_alloc_seq(hctx)) return -ENOMEM;