From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id B713A21A134AE for ; Thu, 4 May 2017 22:03:37 -0700 (PDT) Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 04 May 2017 22:03:37 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.38,291,1491289200"; d="scan'208";a="964681065" Received: from fmsmsx107.amr.corp.intel.com ([10.18.124.205]) by orsmga003.jf.intel.com with ESMTP; 04 May 2017 22:03:36 -0700 Received: from fmsmsx113.amr.corp.intel.com (10.18.116.7) by fmsmsx107.amr.corp.intel.com (10.18.124.205) with Microsoft SMTP Server (TLS) id 14.3.319.2; Thu, 4 May 2017 22:03:36 -0700 Received: from shsmsx152.ccr.corp.intel.com (10.239.6.52) by FMSMSX113.amr.corp.intel.com (10.18.116.7) with Microsoft SMTP Server (TLS) id 14.3.319.2; Thu, 4 May 2017 22:03:36 -0700 Received: from shsmsx103.ccr.corp.intel.com ([169.254.4.117]) by SHSMSX152.ccr.corp.intel.com ([169.254.6.217]) with mapi id 14.03.0319.002; Fri, 5 May 2017 13:03:34 +0800 From: "Ye, Ting" To: "Fu, Siyuan" , "edk2-devel@lists.01.org" CC: "Wu, Jiaxin" , Andrey Tepin Thread-Topic: [Patch V2] MdeModulePkg: Addressing TCP Window Retraction when window scale factor is used. Thread-Index: AQHSxUxIesTH6eV6HEGPvN4Tmr2tnaHlLzCQ Date: Fri, 5 May 2017 05:03:34 +0000 Message-ID: References: <1493953230-113520-1-git-send-email-siyuan.fu@intel.com> In-Reply-To: <1493953230-113520-1-git-send-email-siyuan.fu@intel.com> Accept-Language: zh-CN, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Subject: Re: [Patch V2] MdeModulePkg: Addressing TCP Window Retraction when window scale factor is used. X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 05 May 2017 05:03:37 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Ye Ting =20 -----Original Message----- From: Fu, Siyuan=20 Sent: Friday, May 05, 2017 11:01 AM To: edk2-devel@lists.01.org Cc: Wu, Jiaxin ; Andrey Tepin ; Ye= , Ting Subject: [Patch V2] MdeModulePkg: Addressing TCP Window Retraction when win= dow scale factor is used. The RFC1323 which defines the TCP window scale option has been obsoleted by= RFC7323. This patch is to follow the RFC7323 to address the TCP window retraction pr= oblem when a non-zero scale factor is used. The changes has been test in high packet loss rate network by using HTTP bo= ot and iSCSI file read/write. Cc: Wu Jiaxin Cc: Andrey Tepin Cc: Ye Ting Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Fu Siyuan --- MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Misc.c | 5 +-- .../Universal/Network/Tcp4Dxe/Tcp4Output.c | 41 +++++++++++++++++-= ---- MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Proto.h | 8 ++++- 3 files changed, 43 insertions(+), 11 deletions(-) diff --git a/MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Misc.c b/MdeModuleP= kg/Universal/Network/Tcp4Dxe/Tcp4Misc.c index 1a7c41a..892d19b 100644 --- a/MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Misc.c +++ b/MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Misc.c @@ -1,7 +1,7 @@ /** @file Misc support routines for tcp. =20 -Copyright (c) 2005 - 2016, Intel Corporation. All rights reserved.
+Copyright (c) 2005 - 2017, Intel Corporation. All rights reserved.
This program and the accompanying materials are licensed and made availab= le under the terms and conditions of the BSD License which accompanies thi= s distribution. The full text of the license may be found at @@ -78,7 +78,= 8 @@ TcpInitTcbLocal ( // First window size is never scaled // Tcb->RcvWndScale =3D 0; - + Tcb->RetxmitSeqMax =3D 0; + =20 Tcb->ProbeTimerOn =3D FALSE; } =20 diff --git a/MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Output.c b/MdeModul= ePkg/Universal/Network/Tcp4Dxe/Tcp4Output.c index 0eec8f0..ed71f97 100644 --- a/MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Output.c +++ b/MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Output.c @@ -1,7 +1,7 @@ /** @file TCP output process routines. =20 -Copyright (c) 2005 - 2016, Intel Corporation. All rights reserved.
+Copyright (c) 2005 - 2017, Intel Corporation. All rights reserved.
This program and the accompanying materials are licensed and made availab= le under the terms and conditions of the BSD License which accompanies thi= s distribution. The full text of the license may be found at @@ -671,17 +6= 71,38 @@ TcpRetransmit ( // 2. must in the current send window // 3. will not change the boundaries of queued segments. // - if (TCP_SEQ_LT (Tcb->SndWl2 + Tcb->SndWnd, Seq)) { - DEBUG ((EFI_D_WARN, "TcpRetransmit: retransmission cancelled " - "because send window too small for TCB %p\n", Tcb)); + if ((Tcb->SndWndScale !=3D 0) && + (TCP_SEQ_GT (Seq, Tcb->RetxmitSeqMax) || TCP_SEQ_GT (Tcb->SndWl2 + T= cb->SndWnd + (1 << Tcb->SndWndScale), Seq))) { + // + // Handle the Window Retraction if TCP window scale is enabled accordi= ng to RFC7323: + // On first retransmission, or if the sequence number is out of + // window by less than 2^Rcv.Wind.Shift, then do normal + // retransmission(s) without regard to the receiver window as long + // as the original segment was in window when it was sent. + // + Len =3D TCP_SUB_SEQ (Tcb->SndNxt, Seq); + DEBUG ( + (EFI_D_WARN, + "TcpRetransmit: retransmission without regard to the receiver window= for TCB %p\n", + Tcb) + ); + =20 + } else if (TCP_SEQ_GEQ (Tcb->SndWl2 + Tcb->SndWnd, Seq)) { + Len =3D TCP_SUB_SEQ (Tcb->SndWl2 + Tcb->SndWnd, Seq); + =20 + } else { + DEBUG ( + (EFI_D_WARN, + "TcpRetransmit: retransmission cancelled because send window too sma= ll for TCB %p\n", + Tcb) + ); =20 return 0; } + =20 + Len =3D MIN (Len, Tcb->SndMss); =20 - Len =3D TCP_SUB_SEQ (Tcb->SndWl2 + Tcb->SndWnd, Seq); - Len =3D MIN (Len, Tcb->SndMss); - - Nbuf =3D TcpGetSegmentSndQue (Tcb, Seq, Len); + Nbuf =3D TcpGetSegmentSndQue (Tcb, Seq, Len); if (Nbuf =3D=3D NULL) { return -1; } @@ -691,6 +712,10 @@ TcpRetransmit ( if (TcpTransmitSegment (Tcb, Nbuf) !=3D 0) { goto OnError; } + =20 + if (TCP_SEQ_GT (Seq, Tcb->RetxmitSeqMax)) { + Tcb->RetxmitSeqMax =3D Seq; + } =20 // // The retransmitted buffer may be on the SndQue, diff --git a/MdeModule= Pkg/Universal/Network/Tcp4Dxe/Tcp4Proto.h b/MdeModulePkg/Universal/Network/= Tcp4Dxe/Tcp4Proto.h index 01d6034..49d8a1d 100644 --- a/MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Proto.h +++ b/MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Proto.h @@ -1,7 +1,7 @@ /** @file Tcp Protocol header file. =20 -Copyright (c) 2005 - 2010, Intel Corporation. All rights reserved.
+Copyright (c) 2005 - 2017, Intel Corporation. All rights reserved.
This program and the accompanying materials are licensed and made availab= le under the terms and conditions of the BSD License which accompanies thi= s distribution. The full text of the license may be found at @@ -251,6 +25= 1,12 @@ struct _TCP_CB { UINT32 ConnectTimeout; ///< The connect establishment time o= ut =20 // + // RFC7323 + // Addressing Window Retraction for TCP Window Scale Option. + // + TCP_SEQNO RetxmitSeqMax; ///< Max Seq number in previous r= etransmission. + + // // configuration for tcp provided by user // BOOLEAN UseDefaultAddr; -- 1.9.5.msysgit.1