From nobody Tue Apr 30 04:31:27 2024 Delivered-To: importer@patchew.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Authentication-Results: mx.zoho.com; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org; Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1493797242572684.1229803294185; Wed, 3 May 2017 00:40:42 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 6CCAB21A134A3; Wed, 3 May 2017 00:40:40 -0700 (PDT) Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) (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 5B67721A13496 for ; Wed, 3 May 2017 00:40:39 -0700 (PDT) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 03 May 2017 00:40:38 -0700 Received: from sfu5-mobl3.ccr.corp.intel.com ([10.239.194.96]) by orsmga002.jf.intel.com with ESMTP; 03 May 2017 00:40:07 -0700 X-Original-To: edk2-devel@lists.01.org X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.38,283,1491289200"; d="scan'208";a="81860132" From: Fu Siyuan To: edk2-devel@lists.01.org Date: Wed, 3 May 2017 15:40:02 +0800 Message-Id: <1493797202-94576-1-git-send-email-siyuan.fu@intel.com> X-Mailer: git-send-email 2.7.4.windows.1 Subject: [edk2] [Patch] NetworkPkg: 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: , Cc: Ye Ting , Wu Jiaxin MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail: RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" The RFC1323 which defines the TCP window scale option has been obsoleted by= RFC7323. This patch is to follow the RFC3723 to address the TCP window retraction pr= oblem when a non-zero scale factor is used. Cc: Wu Jiaxin Cc: Andrey Tepin Cc: Ye Ting Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Fu Siyuan --- NetworkPkg/TcpDxe/TcpMisc.c | 3 ++- NetworkPkg/TcpDxe/TcpOutput.c | 33 ++++++++++++++++++++++++++++----- NetworkPkg/TcpDxe/TcpProto.h | 8 +++++++- 3 files changed, 37 insertions(+), 7 deletions(-) diff --git a/NetworkPkg/TcpDxe/TcpMisc.c b/NetworkPkg/TcpDxe/TcpMisc.c index a8592c9..4435036 100644 --- a/NetworkPkg/TcpDxe/TcpMisc.c +++ b/NetworkPkg/TcpDxe/TcpMisc.c @@ -2,7 +2,7 @@ Misc support routines for TCP driver. =20 (C) Copyright 2014 Hewlett-Packard Development Company, L.P.
- Copyright (c) 2009 - 2016, Intel Corporation. All rights reserved.
+ Copyright (c) 2009 - 2017, Intel Corporation. All rights reserved.
=20 This program and the accompanying materials are licensed and made available under the terms and conditions of the BS= D License @@ -86,6 +86,7 @@ TcpInitTcbLocal ( // First window size is never scaled // Tcb->RcvWndScale =3D 0; + Tcb->RetxmitSeqMax =3D 0; =20 Tcb->ProbeTimerOn =3D FALSE; } diff --git a/NetworkPkg/TcpDxe/TcpOutput.c b/NetworkPkg/TcpDxe/TcpOutput.c index a46cb60..f3dacf3 100644 --- a/NetworkPkg/TcpDxe/TcpOutput.c +++ b/NetworkPkg/TcpDxe/TcpOutput.c @@ -1,7 +1,7 @@ /** @file TCP output process routines. =20 - Copyright (c) 2009 - 2016, Intel Corporation. All rights reserved.
+ Copyright (c) 2009 - 2017, Intel Corporation. All rights reserved.
=20 This program and the accompanying materials are licensed and made available under the terms and conditions of the BS= D License @@ -664,7 +664,27 @@ 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)) { + =20 + 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", @@ -674,10 +694,9 @@ TcpRetransmit ( return 0; } =20 - Len =3D TCP_SUB_SEQ (Tcb->SndWl2 + Tcb->SndWnd, Seq); - Len =3D MIN (Len, Tcb->SndMss); + Len =3D MIN (Len, Tcb->SndMss); =20 - Nbuf =3D TcpGetSegmentSndQue (Tcb, Seq, Len); + Nbuf =3D TcpGetSegmentSndQue (Tcb, Seq, Len); if (Nbuf =3D=3D NULL) { return -1; } @@ -688,6 +707,10 @@ TcpRetransmit ( goto OnError; } =20 + if (TCP_SEQ_GT (Seq, Tcb->RetxmitSeqMax)) { + Tcb->RetxmitSeqMax =3D Seq; + } + // // The retransmitted buffer may be on the SndQue, // trim TCP head because all the buffers on SndQue diff --git a/NetworkPkg/TcpDxe/TcpProto.h b/NetworkPkg/TcpDxe/TcpProto.h index ee35134..81397d7 100644 --- a/NetworkPkg/TcpDxe/TcpProto.h +++ b/NetworkPkg/TcpDxe/TcpProto.h @@ -1,7 +1,7 @@ /** @file TCP protocol header file. =20 - Copyright (c) 2009 - 2012, Intel Corporation. All rights reserved.
+ Copyright (c) 2009 - 2017, Intel Corporation. All rights reserved.
=20 This program and the accompanying materials are licensed and made available under the terms and conditions of the BS= D License @@ -316,6 +316,12 @@ struct _TCP_CONTROL_BLOCK { TCP_SEQNO LossRecover; ///< Recover point for retxmit. =20 // + // RFC7323 + // Addressing Window Retraction for TCP Window Scale Option. + // + TCP_SEQNO RetxmitSeqMax; ///< Max Seq number in previous r= etransmission. + + // // configuration parameters, for EFI_TCP4_PROTOCOL specification // UINT32 KeepAliveIdle; ///< Idle time before sending first p= robe. --=20 1.9.5.msysgit.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel