aboutsummaryrefslogtreecommitdiffstats
path: root/net/dccp/ccids/ccid2.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/dccp/ccids/ccid2.c')
-rw-r--r--net/dccp/ccids/ccid2.c46
1 files changed, 15 insertions, 31 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,