aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrea Bittau <a.bittau@cs.ucl.ac.uk>2006-11-16 11:28:40 -0500
committerDavid S. Miller <davem@sunset.davemloft.net>2006-12-03 00:23:52 -0500
commit32aac18dfa0963fde40cc074ba97ebbae8b755f2 (patch)
treec6851e77f1af7e7ef614e7e0a3bde630d57cf776
parent58a5a7b9555ea231b557ebef5cabeaf8e951df0b (diff)
[DCCP] CCID2: Code optimizations
These are code optimizations which are relevant when dealing with large windows. They are not coded the way I would like to, but they do the job for the short-term. This patch should be more neat. Commiter note: Changed the seqno comparisions to use {after,before}48 to handle wrapping. Signed-off-by: Andrea Bittau <a.bittau@cs.ucl.ac.uk> Signed-off-by: Arnaldo Carvalho de Melo <acme@mandriva.com>
-rw-r--r--net/dccp/ccids/ccid2.c22
-rw-r--r--net/dccp/ccids/ccid2.h1
2 files changed, 21 insertions, 2 deletions
diff --git a/net/dccp/ccids/ccid2.c b/net/dccp/ccids/ccid2.c
index 162032baeac0..6533cb2f27bb 100644
--- a/net/dccp/ccids/ccid2.c
+++ b/net/dccp/ccids/ccid2.c
@@ -619,7 +619,17 @@ static void ccid2_hc_tx_packet_recv(struct sock *sk, struct sk_buff *skb)
619 } 619 }
620 620
621 ackno = DCCP_SKB_CB(skb)->dccpd_ack_seq; 621 ackno = DCCP_SKB_CB(skb)->dccpd_ack_seq;
622 seqp = hctx->ccid2hctx_seqh->ccid2s_prev; 622 if (after48(ackno, hctx->ccid2hctx_high_ack))
623 hctx->ccid2hctx_high_ack = ackno;
624
625 seqp = hctx->ccid2hctx_seqt;
626 while (before48(seqp->ccid2s_seq, ackno)) {
627 seqp = seqp->ccid2s_next;
628 if (seqp == hctx->ccid2hctx_seqh) {
629 seqp = hctx->ccid2hctx_seqh->ccid2s_prev;
630 break;
631 }
632 }
623 633
624 /* If in slow-start, cwnd can increase at most Ack Ratio / 2 packets for 634 /* If in slow-start, cwnd can increase at most Ack Ratio / 2 packets for
625 * this single ack. I round up. 635 * this single ack. I round up.
@@ -697,7 +707,14 @@ static void ccid2_hc_tx_packet_recv(struct sock *sk, struct sk_buff *skb)
697 /* The state about what is acked should be correct now 707 /* The state about what is acked should be correct now
698 * Check for NUMDUPACK 708 * Check for NUMDUPACK
699 */ 709 */
700 seqp = hctx->ccid2hctx_seqh->ccid2s_prev; 710 seqp = hctx->ccid2hctx_seqt;
711 while (before48(seqp->ccid2s_seq, hctx->ccid2hctx_high_ack)) {
712 seqp = seqp->ccid2s_next;
713 if (seqp == hctx->ccid2hctx_seqh) {
714 seqp = hctx->ccid2hctx_seqh->ccid2s_prev;
715 break;
716 }
717 }
701 done = 0; 718 done = 0;
702 while (1) { 719 while (1) {
703 if (seqp->ccid2s_acked) { 720 if (seqp->ccid2s_acked) {
@@ -771,6 +788,7 @@ static int ccid2_hc_tx_init(struct ccid *ccid, struct sock *sk)
771 hctx->ccid2hctx_lastrtt = 0; 788 hctx->ccid2hctx_lastrtt = 0;
772 hctx->ccid2hctx_rpdupack = -1; 789 hctx->ccid2hctx_rpdupack = -1;
773 hctx->ccid2hctx_last_cong = jiffies; 790 hctx->ccid2hctx_last_cong = jiffies;
791 hctx->ccid2hctx_high_ack = 0;
774 792
775 hctx->ccid2hctx_rtotimer.function = &ccid2_hc_tx_rto_expire; 793 hctx->ccid2hctx_rtotimer.function = &ccid2_hc_tx_rto_expire;
776 hctx->ccid2hctx_rtotimer.data = (unsigned long)sk; 794 hctx->ccid2hctx_rtotimer.data = (unsigned long)sk;
diff --git a/net/dccp/ccids/ccid2.h b/net/dccp/ccids/ccid2.h
index 5b2ef4acb300..a97a89927308 100644
--- a/net/dccp/ccids/ccid2.h
+++ b/net/dccp/ccids/ccid2.h
@@ -72,6 +72,7 @@ struct ccid2_hc_tx_sock {
72 int ccid2hctx_rpdupack; 72 int ccid2hctx_rpdupack;
73 int ccid2hctx_sendwait; 73 int ccid2hctx_sendwait;
74 unsigned long ccid2hctx_last_cong; 74 unsigned long ccid2hctx_last_cong;
75 u64 ccid2hctx_high_ack;
75}; 76};
76 77
77struct ccid2_hc_rx_sock { 78struct ccid2_hc_rx_sock {