From: =?ISO-8859-1?q?Ilpo_J=E4rvinen?= <[EMAIL PROTECTED]>

Soon the skbs in the write_queue won't necessary be adjacent
ones because part of the queue is stored elsewhere. Verify that
there isn't hole between skbs when trying to combine two of
them.

Signed-off-by: Ilpo Järvinen <[EMAIL PROTECTED]>
---
 include/net/tcp.h     |    6 ++++++
 net/ipv4/tcp_output.c |    1 +
 2 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/include/net/tcp.h b/include/net/tcp.h
index 5bb2de6..688ccca 100644
--- a/include/net/tcp.h
+++ b/include/net/tcp.h
@@ -1245,6 +1245,12 @@ static inline struct sk_buff 
*tcp_write_queue_prev(struct sock *sk, struct sk_bu
        return skb->prev;
 }
 
+static inline int tcp_skb_adjacent(struct sock *sk, struct sk_buff *skb,
+                                  struct sk_buff *next)
+{
+       return TCP_SKB_CB(skb)->end_seq == TCP_SKB_CB(next)->seq;
+}
+
 #define tcp_for_write_queue(skb, sk, queue)                            \
                for (skb = (sk)->sk_write_queue.next;                   \
                     (skb != (struct sk_buff *)&(sk)->sk_write_queue);  \
diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c
index 202a48a..b81284a 100644
--- a/net/ipv4/tcp_output.c
+++ b/net/ipv4/tcp_output.c
@@ -1849,6 +1849,7 @@ int tcp_retransmit_skb(struct sock *sk, struct sk_buff 
*skb)
            (skb->len < (cur_mss >> 1)) &&
            (tcp_write_queue_next(sk, skb) != tcp_send_head(sk)) &&
            (!tcp_skb_is_last(sk, skb)) &&
+           (tcp_skb_adjacent(sk, skb, tcp_write_queue_next(sk, skb))) &&
            (skb_shinfo(skb)->nr_frags == 0 && 
skb_shinfo(tcp_write_queue_next(sk, skb))->nr_frags == 0) &&
            (tcp_skb_pcount(skb) == 1 && 
tcp_skb_pcount(tcp_write_queue_next(sk, skb)) == 1) &&
            (sysctl_tcp_retrans_collapse != 0))
-- 
1.5.0.6

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to