From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754765AbcEaPDB (ORCPT ); Tue, 31 May 2016 11:03:01 -0400 Received: from mail-pf0-f195.google.com ([209.85.192.195]:33679 "EHLO mail-pf0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753914AbcEaPCz (ORCPT ); Tue, 31 May 2016 11:02:55 -0400 From: Andrey Vagin To: netdev@vger.kernel.org Cc: linux-kernel@vger.kernel.org, criu@openvz.org, Andrey Vagin , Pavel Emelyanov , "David S. Miller" , Alexey Kuznetsov , James Morris , Hideaki YOSHIFUJI , Patrick McHardy Subject: [PATCH] tcp: extend window to fit all restored unacked data in a send queue Date: Tue, 31 May 2016 08:02:36 -0700 Message-Id: <1464706956-29291-1-git-send-email-avagin@openvz.org> X-Mailer: git-send-email 2.5.5 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Data from a send queue is sent only if there is enough space in a window, so when we restore unacked data, we need to expand a window to fit this data. Currently we don't do this and tcp_acceptable_seq() returns tcp_wnd_end(tp) instead of tp->snd_nxt. The other side drops packets with this seq, becuse tcp_sequence() returns false (seq < tp->rcv_nxt). Cc: Pavel Emelyanov Cc: "David S. Miller" Cc: Alexey Kuznetsov Cc: James Morris Cc: Hideaki YOSHIFUJI Cc: Patrick McHardy Signed-off-by: Andrey Vagin --- net/ipv4/tcp_output.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c index 79a03b8..b36f968 100644 --- a/net/ipv4/tcp_output.c +++ b/net/ipv4/tcp_output.c @@ -75,6 +75,10 @@ static void tcp_event_new_data_sent(struct sock *sk, const struct sk_buff *skb) tcp_advance_send_head(sk, skb); tp->snd_nxt = TCP_SKB_CB(skb)->end_seq; + /* All sent data have to fit into the window */ + if (unlikely(tp->repair) && before(tcp_wnd_end(tp), tp->snd_nxt)) + tp->snd_wnd = tp->snd_nxt - tp->snd_una; + tp->packets_out += tcp_skb_pcount(skb); if (!prior_packets || icsk->icsk_pending == ICSK_TIME_EARLY_RETRANS || icsk->icsk_pending == ICSK_TIME_LOSS_PROBE) { -- 2.5.5