diff options
Diffstat (limited to 'net/dccp/ccids/ccid2.c')
-rw-r--r-- | net/dccp/ccids/ccid2.c | 45 |
1 files changed, 29 insertions, 16 deletions
diff --git a/net/dccp/ccids/ccid2.c b/net/dccp/ccids/ccid2.c index 162032baeac0..2555be8f4790 100644 --- a/net/dccp/ccids/ccid2.c +++ b/net/dccp/ccids/ccid2.c | |||
@@ -33,18 +33,11 @@ | |||
33 | #include "../dccp.h" | 33 | #include "../dccp.h" |
34 | #include "ccid2.h" | 34 | #include "ccid2.h" |
35 | 35 | ||
36 | static int ccid2_debug; | ||
37 | 36 | ||
38 | #ifdef CONFIG_IP_DCCP_CCID2_DEBUG | 37 | #ifdef CONFIG_IP_DCCP_CCID2_DEBUG |
39 | #define ccid2_pr_debug(format, a...) \ | 38 | static int ccid2_debug; |
40 | do { if (ccid2_debug) \ | 39 | #define ccid2_pr_debug(format, a...) DCCP_PR_DEBUG(ccid2_debug, format, ##a) |
41 | printk(KERN_DEBUG "%s: " format, __FUNCTION__, ##a); \ | ||
42 | } while (0) | ||
43 | #else | ||
44 | #define ccid2_pr_debug(format, a...) | ||
45 | #endif | ||
46 | 40 | ||
47 | #ifdef CONFIG_IP_DCCP_CCID2_DEBUG | ||
48 | static void ccid2_hc_tx_check_sanity(const struct ccid2_hc_tx_sock *hctx) | 41 | static void ccid2_hc_tx_check_sanity(const struct ccid2_hc_tx_sock *hctx) |
49 | { | 42 | { |
50 | int len = 0; | 43 | int len = 0; |
@@ -86,7 +79,8 @@ static void ccid2_hc_tx_check_sanity(const struct ccid2_hc_tx_sock *hctx) | |||
86 | BUG_ON(len != hctx->ccid2hctx_seqbufc * CCID2_SEQBUF_LEN); | 79 | BUG_ON(len != hctx->ccid2hctx_seqbufc * CCID2_SEQBUF_LEN); |
87 | } | 80 | } |
88 | #else | 81 | #else |
89 | #define ccid2_hc_tx_check_sanity(hctx) do {} while (0) | 82 | #define ccid2_pr_debug(format, a...) |
83 | #define ccid2_hc_tx_check_sanity(hctx) | ||
90 | #endif | 84 | #endif |
91 | 85 | ||
92 | static int ccid2_hc_tx_alloc_seq(struct ccid2_hc_tx_sock *hctx, int num, | 86 | static int ccid2_hc_tx_alloc_seq(struct ccid2_hc_tx_sock *hctx, int num, |
@@ -131,8 +125,7 @@ static int ccid2_hc_tx_alloc_seq(struct ccid2_hc_tx_sock *hctx, int num, | |||
131 | return 0; | 125 | return 0; |
132 | } | 126 | } |
133 | 127 | ||
134 | static int ccid2_hc_tx_send_packet(struct sock *sk, | 128 | static int ccid2_hc_tx_send_packet(struct sock *sk, struct sk_buff *skb) |
135 | struct sk_buff *skb, int len) | ||
136 | { | 129 | { |
137 | struct ccid2_hc_tx_sock *hctx; | 130 | struct ccid2_hc_tx_sock *hctx; |
138 | 131 | ||
@@ -274,7 +267,7 @@ static void ccid2_start_rto_timer(struct sock *sk) | |||
274 | jiffies + hctx->ccid2hctx_rto); | 267 | jiffies + hctx->ccid2hctx_rto); |
275 | } | 268 | } |
276 | 269 | ||
277 | static void ccid2_hc_tx_packet_sent(struct sock *sk, int more, int len) | 270 | static void ccid2_hc_tx_packet_sent(struct sock *sk, int more, unsigned int len) |
278 | { | 271 | { |
279 | struct dccp_sock *dp = dccp_sk(sk); | 272 | struct dccp_sock *dp = dccp_sk(sk); |
280 | struct ccid2_hc_tx_sock *hctx = ccid2_hc_tx_sk(sk); | 273 | struct ccid2_hc_tx_sock *hctx = ccid2_hc_tx_sk(sk); |
@@ -426,7 +419,7 @@ static int ccid2_ackvector(struct sock *sk, struct sk_buff *skb, int offset, | |||
426 | return -1; | 419 | return -1; |
427 | 420 | ||
428 | out_invalid_option: | 421 | out_invalid_option: |
429 | BUG_ON(1); /* should never happen... options were previously parsed ! */ | 422 | DCCP_BUG("Invalid option - this should not happen (previous parsing)!"); |
430 | return -1; | 423 | return -1; |
431 | } | 424 | } |
432 | 425 | ||
@@ -619,7 +612,17 @@ static void ccid2_hc_tx_packet_recv(struct sock *sk, struct sk_buff *skb) | |||
619 | } | 612 | } |
620 | 613 | ||
621 | ackno = DCCP_SKB_CB(skb)->dccpd_ack_seq; | 614 | ackno = DCCP_SKB_CB(skb)->dccpd_ack_seq; |
622 | seqp = hctx->ccid2hctx_seqh->ccid2s_prev; | 615 | if (after48(ackno, hctx->ccid2hctx_high_ack)) |
616 | hctx->ccid2hctx_high_ack = ackno; | ||
617 | |||
618 | seqp = hctx->ccid2hctx_seqt; | ||
619 | while (before48(seqp->ccid2s_seq, ackno)) { | ||
620 | seqp = seqp->ccid2s_next; | ||
621 | if (seqp == hctx->ccid2hctx_seqh) { | ||
622 | seqp = hctx->ccid2hctx_seqh->ccid2s_prev; | ||
623 | break; | ||
624 | } | ||
625 | } | ||
623 | 626 | ||
624 | /* If in slow-start, cwnd can increase at most Ack Ratio / 2 packets for | 627 | /* If in slow-start, cwnd can increase at most Ack Ratio / 2 packets for |
625 | * this single ack. I round up. | 628 | * this single ack. I round up. |
@@ -697,7 +700,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 | 700 | /* The state about what is acked should be correct now |
698 | * Check for NUMDUPACK | 701 | * Check for NUMDUPACK |
699 | */ | 702 | */ |
700 | seqp = hctx->ccid2hctx_seqh->ccid2s_prev; | 703 | seqp = hctx->ccid2hctx_seqt; |
704 | while (before48(seqp->ccid2s_seq, hctx->ccid2hctx_high_ack)) { | ||
705 | seqp = seqp->ccid2s_next; | ||
706 | if (seqp == hctx->ccid2hctx_seqh) { | ||
707 | seqp = hctx->ccid2hctx_seqh->ccid2s_prev; | ||
708 | break; | ||
709 | } | ||
710 | } | ||
701 | done = 0; | 711 | done = 0; |
702 | while (1) { | 712 | while (1) { |
703 | if (seqp->ccid2s_acked) { | 713 | if (seqp->ccid2s_acked) { |
@@ -771,6 +781,7 @@ static int ccid2_hc_tx_init(struct ccid *ccid, struct sock *sk) | |||
771 | hctx->ccid2hctx_lastrtt = 0; | 781 | hctx->ccid2hctx_lastrtt = 0; |
772 | hctx->ccid2hctx_rpdupack = -1; | 782 | hctx->ccid2hctx_rpdupack = -1; |
773 | hctx->ccid2hctx_last_cong = jiffies; | 783 | hctx->ccid2hctx_last_cong = jiffies; |
784 | hctx->ccid2hctx_high_ack = 0; | ||
774 | 785 | ||
775 | hctx->ccid2hctx_rtotimer.function = &ccid2_hc_tx_rto_expire; | 786 | hctx->ccid2hctx_rtotimer.function = &ccid2_hc_tx_rto_expire; |
776 | hctx->ccid2hctx_rtotimer.data = (unsigned long)sk; | 787 | hctx->ccid2hctx_rtotimer.data = (unsigned long)sk; |
@@ -823,8 +834,10 @@ static struct ccid_operations ccid2 = { | |||
823 | .ccid_hc_rx_packet_recv = ccid2_hc_rx_packet_recv, | 834 | .ccid_hc_rx_packet_recv = ccid2_hc_rx_packet_recv, |
824 | }; | 835 | }; |
825 | 836 | ||
837 | #ifdef CONFIG_IP_DCCP_CCID2_DEBUG | ||
826 | module_param(ccid2_debug, int, 0444); | 838 | module_param(ccid2_debug, int, 0444); |
827 | MODULE_PARM_DESC(ccid2_debug, "Enable debug messages"); | 839 | MODULE_PARM_DESC(ccid2_debug, "Enable debug messages"); |
840 | #endif | ||
828 | 841 | ||
829 | static __init int ccid2_module_init(void) | 842 | static __init int ccid2_module_init(void) |
830 | { | 843 | { |