From patchwork Tue Mar 10 09:16:25 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fan Du X-Patchwork-Id: 448444 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id A84FD140083 for ; Tue, 10 Mar 2015 20:21:42 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752669AbbCJJVa (ORCPT ); Tue, 10 Mar 2015 05:21:30 -0400 Received: from mga09.intel.com ([134.134.136.24]:38648 "EHLO mga09.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752647AbbCJJV2 (ORCPT ); Tue, 10 Mar 2015 05:21:28 -0400 Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga102.jf.intel.com with ESMTP; 10 Mar 2015 02:19:45 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.11,373,1422950400"; d="scan'208";a="677763763" Received: from dufan-optiplex-9010.bj.intel.com ([10.238.155.116]) by fmsmga001.fm.intel.com with ESMTP; 10 Mar 2015 02:21:28 -0700 From: Fan Du To: johnwheffner@gmail.com Cc: davem@davemloft.net, netdev@vger.kernel.org, fengyuleidian0615@gmail.com Subject: [PATCH net-next 3/4] ipv4: Use probe_size to check write queue data length Date: Tue, 10 Mar 2015 17:16:25 +0800 Message-Id: <1425978986-8512-4-git-send-email-fan.du@intel.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1425978986-8512-1-git-send-email-fan.du@intel.com> References: <1425978986-8512-1-git-send-email-fan.du@intel.com> Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org When building a probe segment, only 'probe_size' of bytes is needed, so check write queue data length with probe_size instead of size_needed. Signed-off-by: Fan Du --- net/ipv4/tcp_output.c | 8 +++----- 1 files changed, 3 insertions(+), 5 deletions(-) diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c index 79977d1..89d3f84 100644 --- a/net/ipv4/tcp_output.c +++ b/net/ipv4/tcp_output.c @@ -1872,7 +1872,6 @@ static int tcp_mtu_probe(struct sock *sk) struct net *net = sock_net(sk); int len; int probe_size; - int size_needed; int copy; int mss_now; int interval; @@ -1895,7 +1894,6 @@ static int tcp_mtu_probe(struct sock *sk) mss_now = tcp_current_mss(sk); probe_size = tcp_mtu_to_mss(sk, (icsk->icsk_mtup.search_high + icsk->icsk_mtup.search_low) >> 1); - size_needed = probe_size + (tp->reordering + 1) * tp->mss_cache; interval = icsk->icsk_mtup.search_high - icsk->icsk_mtup.search_low; /* When misfortune happens, we are reprobing actively, * and then reprobe timer has expired. We stick with current @@ -1911,12 +1909,12 @@ static int tcp_mtu_probe(struct sock *sk) } /* Have enough data in the send queue to probe? */ - if (tp->write_seq - tp->snd_nxt < size_needed) + if (tp->write_seq - tp->snd_nxt < probe_size) return -1; - if (tp->snd_wnd < size_needed) + if (tp->snd_wnd < probe_size) return -1; - if (after(tp->snd_nxt + size_needed, tcp_wnd_end(tp))) + if (after(tp->snd_nxt + probe_size, tcp_wnd_end(tp))) return 0; /* Do we need to wait to drain cwnd? With none in flight, don't stall */