aboutsummaryrefslogtreecommitdiffstats
path: root/net/dccp/output.c
diff options
context:
space:
mode:
authorIan McDonald <ian.mcdonald@jandi.co.nz>2006-12-09 20:56:09 -0500
committerDavid S. Miller <davem@sunset.davemloft.net>2006-12-11 17:34:37 -0500
commit5cc3741d6cc9f07d8ddd9c45cb5088460ce3364f (patch)
tree7f7f1e51e54e7f34025b60cf93e284de72740ba5 /net/dccp/output.c
parente37b8d931936f88e4b2af66304eb44e69510b86c (diff)
[DCCP]: Remove timeo from output.c
It simplifies waiting for the CCID module to signal that a packet is ready to be sent. Other simplifications flow on from this such as removing constants. As a result of this EAGAIN is not returned any more by dccp_wait_for_ccid (which would otherwise lead to unnecessarily discarding the packet in dccp_write_xmit). Signed-off-by: Ian McDonald <ian.mcdonald@jandi.co.nz> Signed-off-by: Gerrit Renker <gerrit@erg.abdn.ac.uk> Signed-off-by: Arnaldo Carvalho de Melo <acme@mandriva.com>
Diffstat (limited to 'net/dccp/output.c')
-rw-r--r--net/dccp/output.c26
1 files changed, 6 insertions, 20 deletions
diff --git a/net/dccp/output.c b/net/dccp/output.c
index 400c30b6fcae..29a8e8508462 100644
--- a/net/dccp/output.c
+++ b/net/dccp/output.c
@@ -175,14 +175,12 @@ void dccp_write_space(struct sock *sk)
175/** 175/**
176 * dccp_wait_for_ccid - Wait for ccid to tell us we can send a packet 176 * dccp_wait_for_ccid - Wait for ccid to tell us we can send a packet
177 * @sk: socket to wait for 177 * @sk: socket to wait for
178 * @timeo: for how long
179 */ 178 */
180static int dccp_wait_for_ccid(struct sock *sk, struct sk_buff *skb, 179static int dccp_wait_for_ccid(struct sock *sk, struct sk_buff *skb)
181 long *timeo)
182{ 180{
183 struct dccp_sock *dp = dccp_sk(sk); 181 struct dccp_sock *dp = dccp_sk(sk);
184 DEFINE_WAIT(wait); 182 DEFINE_WAIT(wait);
185 long delay; 183 unsigned long delay;
186 int rc; 184 int rc;
187 185
188 while (1) { 186 while (1) {
@@ -190,8 +188,6 @@ static int dccp_wait_for_ccid(struct sock *sk, struct sk_buff *skb,
190 188
191 if (sk->sk_err) 189 if (sk->sk_err)
192 goto do_error; 190 goto do_error;
193 if (!*timeo)
194 goto do_nonblock;
195 if (signal_pending(current)) 191 if (signal_pending(current))
196 goto do_interrupted; 192 goto do_interrupted;
197 193
@@ -199,12 +195,9 @@ static int dccp_wait_for_ccid(struct sock *sk, struct sk_buff *skb,
199 if (rc <= 0) 195 if (rc <= 0)
200 break; 196 break;
201 delay = msecs_to_jiffies(rc); 197 delay = msecs_to_jiffies(rc);
202 if (delay > *timeo || delay < 0)
203 goto do_nonblock;
204
205 sk->sk_write_pending++; 198 sk->sk_write_pending++;
206 release_sock(sk); 199 release_sock(sk);
207 *timeo -= schedule_timeout(delay); 200 schedule_timeout(delay);
208 lock_sock(sk); 201 lock_sock(sk);
209 sk->sk_write_pending--; 202 sk->sk_write_pending--;
210 } 203 }
@@ -215,11 +208,8 @@ out:
215do_error: 208do_error:
216 rc = -EPIPE; 209 rc = -EPIPE;
217 goto out; 210 goto out;
218do_nonblock:
219 rc = -EAGAIN;
220 goto out;
221do_interrupted: 211do_interrupted:
222 rc = sock_intr_errno(*timeo); 212 rc = -EINTR;
223 goto out; 213 goto out;
224} 214}
225 215
@@ -240,8 +230,6 @@ void dccp_write_xmit(struct sock *sk, int block)
240{ 230{
241 struct dccp_sock *dp = dccp_sk(sk); 231 struct dccp_sock *dp = dccp_sk(sk);
242 struct sk_buff *skb; 232 struct sk_buff *skb;
243 long timeo = DCCP_XMIT_TIMEO; /* If a packet is taking longer than
244 this we have other issues */
245 233
246 while ((skb = skb_peek(&sk->sk_write_queue))) { 234 while ((skb = skb_peek(&sk->sk_write_queue))) {
247 int err = ccid_hc_tx_send_packet(dp->dccps_hc_tx_ccid, sk, skb); 235 int err = ccid_hc_tx_send_packet(dp->dccps_hc_tx_ccid, sk, skb);
@@ -251,10 +239,8 @@ void dccp_write_xmit(struct sock *sk, int block)
251 sk_reset_timer(sk, &dp->dccps_xmit_timer, 239 sk_reset_timer(sk, &dp->dccps_xmit_timer,
252 msecs_to_jiffies(err)+jiffies); 240 msecs_to_jiffies(err)+jiffies);
253 break; 241 break;
254 } else { 242 } else
255 err = dccp_wait_for_ccid(sk, skb, &timeo); 243 err = dccp_wait_for_ccid(sk, skb);
256 timeo = DCCP_XMIT_TIMEO;
257 }
258 if (err) 244 if (err)
259 DCCP_BUG("err=%d after dccp_wait_for_ccid", err); 245 DCCP_BUG("err=%d after dccp_wait_for_ccid", err);
260 } 246 }