Commit 234b6860 authored by Ilpo Järvinen's avatar Ilpo Järvinen Committed by David S. Miller

[TCP]: Add tcp_for_write_queue_from_safe and use it in mtu_probe

Signed-off-by: default avatarIlpo Järvinen <ilpo.jarvinen@helsinki.fi>
Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent d67c58e9
...@@ -1229,6 +1229,11 @@ static inline struct sk_buff *tcp_write_queue_next(struct sock *sk, struct sk_bu ...@@ -1229,6 +1229,11 @@ static inline struct sk_buff *tcp_write_queue_next(struct sock *sk, struct sk_bu
for (; (skb != (struct sk_buff *)&(sk)->sk_write_queue);\ for (; (skb != (struct sk_buff *)&(sk)->sk_write_queue);\
skb = skb->next) skb = skb->next)
#define tcp_for_write_queue_from_safe(skb, tmp, sk) \
for (tmp = skb->next; \
(skb != (struct sk_buff *)&(sk)->sk_write_queue); \
skb = tmp, tmp = skb->next)
static inline struct sk_buff *tcp_send_head(struct sock *sk) static inline struct sk_buff *tcp_send_head(struct sock *sk)
{ {
return sk->sk_send_head; return sk->sk_send_head;
......
...@@ -1350,9 +1350,7 @@ static int tcp_mtu_probe(struct sock *sk) ...@@ -1350,9 +1350,7 @@ static int tcp_mtu_probe(struct sock *sk)
tcp_insert_write_queue_before(nskb, skb, sk); tcp_insert_write_queue_before(nskb, skb, sk);
len = 0; len = 0;
while (len < probe_size) { tcp_for_write_queue_from_safe(skb, next, sk) {
next = tcp_write_queue_next(sk, skb);
copy = min_t(int, skb->len, probe_size - len); copy = min_t(int, skb->len, probe_size - len);
if (nskb->ip_summed) if (nskb->ip_summed)
skb_copy_bits(skb, 0, skb_put(nskb, copy), copy); skb_copy_bits(skb, 0, skb_put(nskb, copy), copy);
...@@ -1381,7 +1379,9 @@ static int tcp_mtu_probe(struct sock *sk) ...@@ -1381,7 +1379,9 @@ static int tcp_mtu_probe(struct sock *sk)
} }
len += copy; len += copy;
skb = next;
if (len >= probe_size)
break;
} }
tcp_init_tso_segs(sk, nskb, nskb->len); tcp_init_tso_segs(sk, nskb, nskb->len);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment