diff options
author | Ilpo Järvinen <ilpo.jarvinen@helsinki.fi> | 2007-12-01 17:48:02 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-01-28 17:55:43 -0500 |
commit | 234b68607006f3721679e900809ccb99e8bfb10c (patch) | |
tree | 5f40cdf7db79afbfbbb864ee3a07192136162006 | |
parent | d67c58e9ae80ea577785111534e49d3ca757ec50 (diff) |
[TCP]: Add tcp_for_write_queue_from_safe and use it in mtu_probe
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@helsinki.fi>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | include/net/tcp.h | 5 | ||||
-rw-r--r-- | net/ipv4/tcp_output.c | 8 |
2 files changed, 9 insertions, 4 deletions
diff --git a/include/net/tcp.h b/include/net/tcp.h index cdd0050b97a4..6e392babda4a 100644 --- a/include/net/tcp.h +++ b/include/net/tcp.h | |||
@@ -1229,6 +1229,11 @@ static inline struct sk_buff *tcp_write_queue_next(struct sock *sk, struct sk_bu | |||
1229 | for (; (skb != (struct sk_buff *)&(sk)->sk_write_queue);\ | 1229 | for (; (skb != (struct sk_buff *)&(sk)->sk_write_queue);\ |
1230 | skb = skb->next) | 1230 | skb = skb->next) |
1231 | 1231 | ||
1232 | #define tcp_for_write_queue_from_safe(skb, tmp, sk) \ | ||
1233 | for (tmp = skb->next; \ | ||
1234 | (skb != (struct sk_buff *)&(sk)->sk_write_queue); \ | ||
1235 | skb = tmp, tmp = skb->next) | ||
1236 | |||
1232 | static inline struct sk_buff *tcp_send_head(struct sock *sk) | 1237 | static inline struct sk_buff *tcp_send_head(struct sock *sk) |
1233 | { | 1238 | { |
1234 | return sk->sk_send_head; | 1239 | return sk->sk_send_head; |
diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c index b41176f380d7..7d8583a15d02 100644 --- a/net/ipv4/tcp_output.c +++ b/net/ipv4/tcp_output.c | |||
@@ -1350,9 +1350,7 @@ static int tcp_mtu_probe(struct sock *sk) | |||
1350 | tcp_insert_write_queue_before(nskb, skb, sk); | 1350 | tcp_insert_write_queue_before(nskb, skb, sk); |
1351 | 1351 | ||
1352 | len = 0; | 1352 | len = 0; |
1353 | while (len < probe_size) { | 1353 | tcp_for_write_queue_from_safe(skb, next, sk) { |
1354 | next = tcp_write_queue_next(sk, skb); | ||
1355 | |||
1356 | copy = min_t(int, skb->len, probe_size - len); | 1354 | copy = min_t(int, skb->len, probe_size - len); |
1357 | if (nskb->ip_summed) | 1355 | if (nskb->ip_summed) |
1358 | skb_copy_bits(skb, 0, skb_put(nskb, copy), copy); | 1356 | skb_copy_bits(skb, 0, skb_put(nskb, copy), copy); |
@@ -1381,7 +1379,9 @@ static int tcp_mtu_probe(struct sock *sk) | |||
1381 | } | 1379 | } |
1382 | 1380 | ||
1383 | len += copy; | 1381 | len += copy; |
1384 | skb = next; | 1382 | |
1383 | if (len >= probe_size) | ||
1384 | break; | ||
1385 | } | 1385 | } |
1386 | tcp_init_tso_segs(sk, nskb, nskb->len); | 1386 | tcp_init_tso_segs(sk, nskb, nskb->len); |
1387 | 1387 | ||