[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1657189155-38222-1-git-send-email-liyonglong@chinatelecom.cn>
Date: Thu, 7 Jul 2022 18:19:15 +0800
From: Yonglong Li <liyonglong@...natelecom.cn>
To: netdev@...r.kernel.org
Cc: davem@...emloft.net, dsahern@...nel.org, edumazet@...gle.com,
kuba@...nel.org, pabeni@...hat.com, liyonglong@...natelecom.cn
Subject: [PATCH] tcp: make retransmitted SKB fit into the send window
From: liyonglong <liyonglong@...natelecom.cn>
current code of __tcp_retransmit_skb only check TCP_SKB_CB(skb)->seq
in send window, it will cause retransmit more than send window data.
Signed-off-by: liyonglong <liyonglong@...natelecom.cn>
---
net/ipv4/tcp_output.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c
index 18c913a..3530d1f 100644
--- a/net/ipv4/tcp_output.c
+++ b/net/ipv4/tcp_output.c
@@ -3176,7 +3176,7 @@ int __tcp_retransmit_skb(struct sock *sk, struct sk_buff *skb, int segs)
TCP_SKB_CB(skb)->seq != tp->snd_una)
return -EAGAIN;
- len = cur_mss * segs;
+ len = min_t(int, tcp_wnd_end(tp) - TCP_SKB_CB(skb)->seq, cur_mss * segs);
if (skb->len > len) {
if (tcp_fragment(sk, TCP_FRAG_IN_RTX_QUEUE, skb, len,
cur_mss, GFP_ATOMIC))
@@ -3190,7 +3190,7 @@ int __tcp_retransmit_skb(struct sock *sk, struct sk_buff *skb, int segs)
diff -= tcp_skb_pcount(skb);
if (diff)
tcp_adjust_pcount(sk, skb, diff);
- if (skb->len < cur_mss)
+ if (skb->len < cur_mss && len >= cur_mss)
tcp_retrans_try_collapse(sk, skb, cur_mss);
}
--
1.8.3.1
Powered by blists - more mailing lists