aboutsummaryrefslogtreecommitdiffstats
path: root/net/dccp/ccids/ccid2.c
diff options
context:
space:
mode:
authorGerrit Renker <gerrit@erg.abdn.ac.uk>2008-09-04 01:30:19 -0400
committerGerrit Renker <gerrit@erg.abdn.ac.uk>2008-09-04 01:45:39 -0400
commit20bbd0f75ee4b72c1dafc8e5fb6ad39ba506a75c (patch)
treec67263fcc9ed4bab01ecbdb43393b1cb2a0dfd36 /net/dccp/ccids/ccid2.c
parent1435562d7e0412e4885b661843f69859013f9d25 (diff)
dccp ccid-2: Remove wrappers around sk_{reset,stop}_timer()
This removes the wrappers around the sk timer functions as it makes the code clearer and not much is gained from using wrappers: the BUG_ON in start_rto_timer will never trigger since that function was called only when * the RTO timer expired (rto_expire, and then timer_pending() is false); * in tx_packet_sent only if !timer_pending() (BUG_ON is redundant here); * previously in new_ack, after stopping the timer (timer_pending() false). One further motive behind this patch is to replace the RTO timer with the icsk retransmission timer, as it is already part of the DCCP socket. Signed-off-by: Gerrit Renker <gerrit@erg.abdn.ac.uk>
Diffstat (limited to 'net/dccp/ccids/ccid2.c')
-rw-r--r--net/dccp/ccids/ccid2.c28
1 files changed, 4 insertions, 24 deletions
diff --git a/net/dccp/ccids/ccid2.c b/net/dccp/ccids/ccid2.c
index 22753fd98698..c539f79ab8e8 100644
--- a/net/dccp/ccids/ccid2.c
+++ b/net/dccp/ccids/ccid2.c
@@ -110,8 +110,6 @@ static void ccid2_change_l_ack_ratio(struct sock *sk, u32 val)
110 dp->dccps_l_ack_ratio = val; 110 dp->dccps_l_ack_ratio = val;
111} 111}
112 112
113static void ccid2_start_rto_timer(struct sock *sk);
114
115static void ccid2_hc_tx_rto_expire(unsigned long data) 113static void ccid2_hc_tx_rto_expire(unsigned long data)
116{ 114{
117 struct sock *sk = (struct sock *)data; 115 struct sock *sk = (struct sock *)data;
@@ -150,23 +148,13 @@ static void ccid2_hc_tx_rto_expire(unsigned long data)
150 /* if we were blocked before, we may now send cwnd=1 packet */ 148 /* if we were blocked before, we may now send cwnd=1 packet */
151 if (sender_was_blocked) 149 if (sender_was_blocked)
152 tasklet_schedule(&dccp_sk(sk)->dccps_xmitlet); 150 tasklet_schedule(&dccp_sk(sk)->dccps_xmitlet);
153 ccid2_start_rto_timer(sk); 151 /* restart backed-off timer */
152 sk_reset_timer(sk, &hctx->rtotimer, jiffies + hctx->rto);
154out: 153out:
155 bh_unlock_sock(sk); 154 bh_unlock_sock(sk);
156 sock_put(sk); 155 sock_put(sk);
157} 156}
158 157
159static void ccid2_start_rto_timer(struct sock *sk)
160{
161 struct ccid2_hc_tx_sock *hctx = ccid2_hc_tx_sk(sk);
162
163 ccid2_pr_debug("setting RTO timeout=%ld\n", hctx->rto);
164
165 BUG_ON(timer_pending(&hctx->rtotimer));
166 sk_reset_timer(sk, &hctx->rtotimer,
167 jiffies + hctx->rto);
168}
169
170static void ccid2_hc_tx_packet_sent(struct sock *sk, unsigned int len) 158static void ccid2_hc_tx_packet_sent(struct sock *sk, unsigned int len)
171{ 159{
172 struct dccp_sock *dp = dccp_sk(sk); 160 struct dccp_sock *dp = dccp_sk(sk);
@@ -245,7 +233,7 @@ static void ccid2_hc_tx_packet_sent(struct sock *sk, unsigned int len)
245 233
246 /* setup RTO timer */ 234 /* setup RTO timer */
247 if (!timer_pending(&hctx->rtotimer)) 235 if (!timer_pending(&hctx->rtotimer))
248 ccid2_start_rto_timer(sk); 236 sk_reset_timer(sk, &hctx->rtotimer, jiffies + hctx->rto);
249 237
250#ifdef CONFIG_IP_DCCP_CCID2_DEBUG 238#ifdef CONFIG_IP_DCCP_CCID2_DEBUG
251 do { 239 do {
@@ -262,14 +250,6 @@ static void ccid2_hc_tx_packet_sent(struct sock *sk, unsigned int len)
262#endif 250#endif
263} 251}
264 252
265static void ccid2_hc_tx_kill_rto_timer(struct sock *sk)
266{
267 struct ccid2_hc_tx_sock *hctx = ccid2_hc_tx_sk(sk);
268
269 sk_stop_timer(sk, &hctx->rtotimer);
270 ccid2_pr_debug("deleted RTO timer\n");
271}
272
273/** 253/**
274 * ccid2_rtt_estimator - Sample RTT and compute RTO using RFC2988 algorithm 254 * ccid2_rtt_estimator - Sample RTT and compute RTO using RFC2988 algorithm
275 * This code is almost identical with TCP's tcp_rtt_estimator(), since 255 * This code is almost identical with TCP's tcp_rtt_estimator(), since
@@ -645,7 +625,7 @@ static void ccid2_hc_tx_exit(struct sock *sk)
645 struct ccid2_hc_tx_sock *hctx = ccid2_hc_tx_sk(sk); 625 struct ccid2_hc_tx_sock *hctx = ccid2_hc_tx_sk(sk);
646 int i; 626 int i;
647 627
648 ccid2_hc_tx_kill_rto_timer(sk); 628 sk_stop_timer(sk, &hctx->rtotimer);
649 629
650 for (i = 0; i < hctx->seqbufc; i++) 630 for (i = 0; i < hctx->seqbufc; i++)
651 kfree(hctx->seqbuf[i]); 631 kfree(hctx->seqbuf[i]);