diff options
author | Gerrit Renker <gerrit@erg.abdn.ac.uk> | 2010-08-29 15:23:11 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2010-08-30 16:45:26 -0400 |
commit | d26eeb07fd02de31848b59d19687daff0e93532f (patch) | |
tree | 8017b04b5e2aacb9d73334b4610d623c28a957d5 /net/dccp | |
parent | d82b6f85c1d73340ef4a26bd0b247ac14610cd83 (diff) |
dccp ccid-2: Remove wrappers around sk_{reset,stop}_timer()
This removes the wrappers around the sk timer functions, since not much is
gained from using them: the BUG_ON in start_rto_timer will never trigger
since that function is called only if:
* the RTO timer expires (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).
Removing the wrappers also clears the way for eventually replacing 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>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/dccp')
-rw-r--r-- | net/dccp/ccids/ccid2.c | 28 |
1 files changed, 3 insertions, 25 deletions
diff --git a/net/dccp/ccids/ccid2.c b/net/dccp/ccids/ccid2.c index 0cff637a4a51..8c95813bcc67 100644 --- a/net/dccp/ccids/ccid2.c +++ b/net/dccp/ccids/ccid2.c | |||
@@ -111,8 +111,6 @@ static void ccid2_change_l_ack_ratio(struct sock *sk, u32 val) | |||
111 | dp->dccps_l_ack_ratio = val; | 111 | dp->dccps_l_ack_ratio = val; |
112 | } | 112 | } |
113 | 113 | ||
114 | static void ccid2_start_rto_timer(struct sock *sk); | ||
115 | |||
116 | static void ccid2_hc_tx_rto_expire(unsigned long data) | 114 | static void ccid2_hc_tx_rto_expire(unsigned long data) |
117 | { | 115 | { |
118 | struct sock *sk = (struct sock *)data; | 116 | struct sock *sk = (struct sock *)data; |
@@ -131,7 +129,7 @@ static void ccid2_hc_tx_rto_expire(unsigned long data) | |||
131 | if (hc->tx_rto > DCCP_RTO_MAX) | 129 | if (hc->tx_rto > DCCP_RTO_MAX) |
132 | hc->tx_rto = DCCP_RTO_MAX; | 130 | hc->tx_rto = DCCP_RTO_MAX; |
133 | 131 | ||
134 | ccid2_start_rto_timer(sk); | 132 | sk_reset_timer(sk, &hc->tx_rtotimer, jiffies + hc->tx_rto); |
135 | 133 | ||
136 | /* adjust pipe, cwnd etc */ | 134 | /* adjust pipe, cwnd etc */ |
137 | hc->tx_ssthresh = hc->tx_cwnd / 2; | 135 | hc->tx_ssthresh = hc->tx_cwnd / 2; |
@@ -153,16 +151,6 @@ out: | |||
153 | sock_put(sk); | 151 | sock_put(sk); |
154 | } | 152 | } |
155 | 153 | ||
156 | static void ccid2_start_rto_timer(struct sock *sk) | ||
157 | { | ||
158 | struct ccid2_hc_tx_sock *hc = ccid2_hc_tx_sk(sk); | ||
159 | |||
160 | ccid2_pr_debug("setting RTO timeout=%u\n", hc->tx_rto); | ||
161 | |||
162 | BUG_ON(timer_pending(&hc->tx_rtotimer)); | ||
163 | sk_reset_timer(sk, &hc->tx_rtotimer, jiffies + hc->tx_rto); | ||
164 | } | ||
165 | |||
166 | static void ccid2_hc_tx_packet_sent(struct sock *sk, int more, unsigned int len) | 154 | static void ccid2_hc_tx_packet_sent(struct sock *sk, int more, unsigned int len) |
167 | { | 155 | { |
168 | struct dccp_sock *dp = dccp_sk(sk); | 156 | struct dccp_sock *dp = dccp_sk(sk); |
@@ -239,9 +227,7 @@ static void ccid2_hc_tx_packet_sent(struct sock *sk, int more, unsigned int len) | |||
239 | } | 227 | } |
240 | #endif | 228 | #endif |
241 | 229 | ||
242 | /* setup RTO timer */ | 230 | sk_reset_timer(sk, &hc->tx_rtotimer, jiffies + hc->tx_rto); |
243 | if (!timer_pending(&hc->tx_rtotimer)) | ||
244 | ccid2_start_rto_timer(sk); | ||
245 | 231 | ||
246 | #ifdef CONFIG_IP_DCCP_CCID2_DEBUG | 232 | #ifdef CONFIG_IP_DCCP_CCID2_DEBUG |
247 | do { | 233 | do { |
@@ -320,14 +306,6 @@ out_invalid_option: | |||
320 | return -1; | 306 | return -1; |
321 | } | 307 | } |
322 | 308 | ||
323 | static void ccid2_hc_tx_kill_rto_timer(struct sock *sk) | ||
324 | { | ||
325 | struct ccid2_hc_tx_sock *hc = ccid2_hc_tx_sk(sk); | ||
326 | |||
327 | sk_stop_timer(sk, &hc->tx_rtotimer); | ||
328 | ccid2_pr_debug("deleted RTO timer\n"); | ||
329 | } | ||
330 | |||
331 | /** | 309 | /** |
332 | * ccid2_rtt_estimator - Sample RTT and compute RTO using RFC2988 algorithm | 310 | * ccid2_rtt_estimator - Sample RTT and compute RTO using RFC2988 algorithm |
333 | * This code is almost identical with TCP's tcp_rtt_estimator(), since | 311 | * This code is almost identical with TCP's tcp_rtt_estimator(), since |
@@ -692,7 +670,7 @@ static void ccid2_hc_tx_exit(struct sock *sk) | |||
692 | struct ccid2_hc_tx_sock *hc = ccid2_hc_tx_sk(sk); | 670 | struct ccid2_hc_tx_sock *hc = ccid2_hc_tx_sk(sk); |
693 | int i; | 671 | int i; |
694 | 672 | ||
695 | ccid2_hc_tx_kill_rto_timer(sk); | 673 | sk_stop_timer(sk, &hc->tx_rtotimer); |
696 | 674 | ||
697 | for (i = 0; i < hc->tx_seqbufc; i++) | 675 | for (i = 0; i < hc->tx_seqbufc; i++) |
698 | kfree(hc->tx_seqbuf[i]); | 676 | kfree(hc->tx_seqbuf[i]); |