Skip to content

Commit

Permalink
[TCP] MTUprobe: Cleanup send queue check (no need to loop)
Browse files Browse the repository at this point in the history
The original code has striking complexity to perform a query
which can be reduced to a very simple compare.

FIN seqno may be included to write_seq but it should not make
any significant difference here compared to skb->len which was
used previously. One won't end up there with SYN still queued.

Use of write_seq check guarantees that there's a valid skb in
send_head so I removed the extra check.

Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@helsinki.fi>
Acked-by: John Heffner <jheffner@psc.edu>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
  • Loading branch information
Ilpo Järvinen authored and Herbert Xu committed Nov 23, 2007
1 parent 91cc17c commit 7f9c33e
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions net/ipv4/tcp_output.c
Original file line number Diff line number Diff line change
Expand Up @@ -1321,12 +1321,7 @@ static int tcp_mtu_probe(struct sock *sk)
}

/* Have enough data in the send queue to probe? */
len = 0;
if ((skb = tcp_send_head(sk)) == NULL)
return -1;
while ((len += skb->len) < size_needed && !tcp_skb_is_last(sk, skb))
skb = tcp_write_queue_next(sk, skb);
if (len < size_needed)
if (tp->write_seq - tp->snd_nxt < size_needed)
return -1;

if (tp->snd_wnd < size_needed)
Expand Down

0 comments on commit 7f9c33e

Please sign in to comment.