aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--net/dccp/ccids/ccid2.c46
-rw-r--r--net/dccp/ccids/ccid2.h6
2 files changed, 17 insertions, 35 deletions
diff --git a/net/dccp/ccids/ccid2.c b/net/dccp/ccids/ccid2.c
index 4f6c35261b6e..02d126d9a711 100644
--- a/net/dccp/ccids/ccid2.c
+++ b/net/dccp/ccids/ccid2.c
@@ -199,9 +199,8 @@ static void ccid2_hc_tx_rto_expire(unsigned long data)
199 hctx->ccid2hctx_pipe = 0; 199 hctx->ccid2hctx_pipe = 0;
200 200
201 /* clear state about stuff we sent */ 201 /* clear state about stuff we sent */
202 hctx->ccid2hctx_seqt = hctx->ccid2hctx_seqh; 202 hctx->ccid2hctx_seqt = hctx->ccid2hctx_seqh;
203 hctx->ccid2hctx_ssacks = 0; 203 hctx->ccid2hctx_packets_acked = 0;
204 hctx->ccid2hctx_acks = 0;
205 204
206 /* clear ack ratio state. */ 205 /* clear ack ratio state. */
207 hctx->ccid2hctx_rpseq = 0; 206 hctx->ccid2hctx_rpseq = 0;
@@ -406,31 +405,15 @@ static inline void ccid2_new_ack(struct sock *sk,
406{ 405{
407 struct ccid2_hc_tx_sock *hctx = ccid2_hc_tx_sk(sk); 406 struct ccid2_hc_tx_sock *hctx = ccid2_hc_tx_sk(sk);
408 407
409 /* slow start */
410 if (hctx->ccid2hctx_cwnd < hctx->ccid2hctx_ssthresh) { 408 if (hctx->ccid2hctx_cwnd < hctx->ccid2hctx_ssthresh) {
411 hctx->ccid2hctx_acks = 0; 409 if (*maxincr > 0 && ++hctx->ccid2hctx_packets_acked == 2) {
412 410 hctx->ccid2hctx_cwnd += 1;
413 /* We can increase cwnd at most maxincr [ack_ratio/2] */ 411 *maxincr -= 1;
414 if (*maxincr) { 412 hctx->ccid2hctx_packets_acked = 0;
415 /* increase every 2 acks */
416 hctx->ccid2hctx_ssacks++;
417 if (hctx->ccid2hctx_ssacks == 2) {
418 hctx->ccid2hctx_cwnd++;
419 hctx->ccid2hctx_ssacks = 0;
420 *maxincr = *maxincr - 1;
421 }
422 } else {
423 /* increased cwnd enough for this single ack */
424 hctx->ccid2hctx_ssacks = 0;
425 }
426 } else {
427 hctx->ccid2hctx_ssacks = 0;
428 hctx->ccid2hctx_acks++;
429
430 if (hctx->ccid2hctx_acks >= hctx->ccid2hctx_cwnd) {
431 hctx->ccid2hctx_cwnd++;
432 hctx->ccid2hctx_acks = 0;
433 } 413 }
414 } else if (++hctx->ccid2hctx_packets_acked >= hctx->ccid2hctx_cwnd) {
415 hctx->ccid2hctx_cwnd += 1;
416 hctx->ccid2hctx_packets_acked = 0;
434 } 417 }
435 418
436 /* update RTO */ 419 /* update RTO */
@@ -596,12 +579,13 @@ static void ccid2_hc_tx_packet_recv(struct sock *sk, struct sk_buff *skb)
596 } 579 }
597 } 580 }
598 581
599 /* If in slow-start, cwnd can increase at most Ack Ratio / 2 packets for 582 /*
600 * this single ack. I round up. 583 * In slow-start, cwnd can increase up to a maximum of Ack Ratio/2
601 * -sorbo. 584 * packets per acknowledgement. Rounding up avoids that cwnd is not
585 * advanced when Ack Ratio is 1 and gives a slight edge otherwise.
602 */ 586 */
603 maxincr = dp->dccps_l_ack_ratio >> 1; 587 if (hctx->ccid2hctx_cwnd < hctx->ccid2hctx_ssthresh)
604 maxincr++; 588 maxincr = DIV_ROUND_UP(dp->dccps_l_ack_ratio, 2);
605 589
606 /* go through all ack vectors */ 590 /* go through all ack vectors */
607 while ((offset = ccid2_ackvector(sk, skb, offset, 591 while ((offset = ccid2_ackvector(sk, skb, offset,
diff --git a/net/dccp/ccids/ccid2.h b/net/dccp/ccids/ccid2.h
index 2671f8ebe294..2c94ca029010 100644
--- a/net/dccp/ccids/ccid2.h
+++ b/net/dccp/ccids/ccid2.h
@@ -43,8 +43,7 @@ struct ccid2_seq {
43/** struct ccid2_hc_tx_sock - CCID2 TX half connection 43/** struct ccid2_hc_tx_sock - CCID2 TX half connection
44 * 44 *
45 * @ccid2hctx_{cwnd,ssthresh,pipe}: as per RFC 4341, section 5 45 * @ccid2hctx_{cwnd,ssthresh,pipe}: as per RFC 4341, section 5
46 * @ccid2hctx_ssacks - ACKs recv in slow start 46 * @ccid2hctx_packets_acked - Ack counter for deriving cwnd growth (RFC 3465)
47 * @ccid2hctx_acks - ACKS recv in AI phase
48 * @ccid2hctx_lastrtt -time RTT was last measured 47 * @ccid2hctx_lastrtt -time RTT was last measured
49 * @ccid2hctx_rpseq - last consecutive seqno 48 * @ccid2hctx_rpseq - last consecutive seqno
50 * @ccid2hctx_rpdupack - dupacks since rpseq 49 * @ccid2hctx_rpdupack - dupacks since rpseq
@@ -53,8 +52,7 @@ struct ccid2_hc_tx_sock {
53 u32 ccid2hctx_cwnd; 52 u32 ccid2hctx_cwnd;
54 u32 ccid2hctx_ssthresh; 53 u32 ccid2hctx_ssthresh;
55 u32 ccid2hctx_pipe; 54 u32 ccid2hctx_pipe;
56 int ccid2hctx_ssacks; 55 u32 ccid2hctx_packets_acked;
57 int ccid2hctx_acks;
58 struct ccid2_seq *ccid2hctx_seqbuf[CCID2_SEQBUF_MAX]; 56 struct ccid2_seq *ccid2hctx_seqbuf[CCID2_SEQBUF_MAX];
59 int ccid2hctx_seqbufc; 57 int ccid2hctx_seqbufc;
60 struct ccid2_seq *ccid2hctx_seqh; 58 struct ccid2_seq *ccid2hctx_seqh;