public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [Patch V2] MdeModulePkg: Addressing TCP Window Retraction when window scale factor is used.
@ 2017-05-05  1:56 Fu Siyuan
  2017-05-05  1:56 ` [Patch V2] NetworkPkg: " Fu Siyuan
  0 siblings, 1 reply; 4+ messages in thread
From: Fu Siyuan @ 2017-05-05  1:56 UTC (permalink / raw)
  To: edk2-devel; +Cc: Wu Jiaxin, Andrey Tepin, Ye Ting

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 problem
when a non-zero scale factor is used.

Cc: Wu Jiaxin <jiaxin.wu@intel.com>
Cc: Andrey Tepin <atepin@kraftway.ru>
Cc: Ye Ting <ting.ye@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Fu Siyuan <siyuan.fu@intel.com>
---
 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/MdeModulePkg/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.
 
-Copyright (c) 2005 - 2016, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2005 - 2017, Intel Corporation. All rights reserved.<BR>
 This program and the accompanying materials
 are licensed and made available under the terms and conditions of the BSD License
 which accompanies this distribution.  The full text of the license may be found at
@@ -78,7 +78,8 @@ TcpInitTcbLocal (
   // First window size is never scaled
   //
   Tcb->RcvWndScale  = 0;
-
+  Tcb->RetxmitSeqMax = 0;
+  
   Tcb->ProbeTimerOn = FALSE;
 }
 
diff --git a/MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Output.c b/MdeModulePkg/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.
     
-Copyright (c) 2005 - 2016, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2005 - 2017, Intel Corporation. All rights reserved.<BR>
 This program and the accompanying materials
 are licensed and made available under the terms and conditions of the BSD License
 which accompanies this distribution.  The full text of the license may be found at
@@ -671,17 +671,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 != 0) &&
+      (TCP_SEQ_GT (Seq, Tcb->RetxmitSeqMax) || TCP_SEQ_GT (Tcb->SndWl2 + Tcb->SndWnd + (1 << Tcb->SndWndScale), Seq))) {
+    //
+    // Handle the Window Retraction if TCP window scale is enabled according 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 = TCP_SUB_SEQ (Tcb->SndNxt, Seq);
+    DEBUG (
+      (EFI_D_WARN,
+      "TcpRetransmit: retransmission without regard to the receiver window for TCB %p\n",
+      Tcb)
+      );
+    
+  } else if (TCP_SEQ_GEQ (Tcb->SndWl2 + Tcb->SndWnd, Seq)) {
+    Len = TCP_SUB_SEQ (Tcb->SndWl2 + Tcb->SndWnd, Seq);
+    
+  } else {
+    DEBUG (
+      (EFI_D_WARN,
+      "TcpRetransmit: retransmission cancelled because send window too small for TCB %p\n",
+      Tcb)
+      );
 
     return 0;
   }
+  
+  Len = MIN (Len, Tcb->SndMss);
 
-  Len   = TCP_SUB_SEQ (Tcb->SndWl2 + Tcb->SndWnd, Seq);
-  Len   = MIN (Len, Tcb->SndMss);
-
-  Nbuf  = TcpGetSegmentSndQue (Tcb, Seq, Len);
+  Nbuf = TcpGetSegmentSndQue (Tcb, Seq, Len);
   if (Nbuf == NULL) {
     return -1;
   }
@@ -691,6 +712,10 @@ TcpRetransmit (
   if (TcpTransmitSegment (Tcb, Nbuf) != 0) {
     goto OnError;
   }
+  
+  if (TCP_SEQ_GT (Seq, Tcb->RetxmitSeqMax)) {
+    Tcb->RetxmitSeqMax = Seq;
+  }
 
   //
   // The retransmitted buffer may be on the SndQue,
diff --git a/MdeModulePkg/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.
 
-Copyright (c) 2005 - 2010, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2005 - 2017, Intel Corporation. All rights reserved.<BR>
 This program and the accompanying materials
 are licensed and made available under the terms and conditions of the BSD License
 which accompanies this distribution.  The full text of the license may be found at
@@ -251,6 +251,12 @@ struct _TCP_CB {
   UINT32            ConnectTimeout;  ///< The connect establishment time out
 
   //
+  // RFC7323
+  // Addressing Window Retraction for TCP Window Scale Option.
+  //
+  TCP_SEQNO         RetxmitSeqMax;       ///< Max Seq number in previous retransmission.
+
+  //
   // configuration for tcp provided by user
   //
   BOOLEAN           UseDefaultAddr;
-- 
1.9.5.msysgit.1



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [Patch V2] NetworkPkg: Addressing TCP Window Retraction when window scale factor is used.
  2017-05-05  1:56 [Patch V2] MdeModulePkg: Addressing TCP Window Retraction when window scale factor is used Fu Siyuan
@ 2017-05-05  1:56 ` Fu Siyuan
  2017-05-05  5:03   ` Ye, Ting
  2017-05-05  5:12   ` Wu, Jiaxin
  0 siblings, 2 replies; 4+ messages in thread
From: Fu Siyuan @ 2017-05-05  1:56 UTC (permalink / raw)
  To: edk2-devel; +Cc: Wu Jiaxin, Andrey Tepin, Ye Ting

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 problem
when a non-zero scale factor is used.
The changes has been test in high packet loss rate network by using HTTP boot and 
iSCSI file read/write.

Cc: Wu Jiaxin <jiaxin.wu@intel.com>
Cc: Andrey Tepin <atepin@kraftway.ru>
Cc: Ye Ting <ting.ye@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Fu Siyuan <siyuan.fu@intel.com>
---
 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.
 
   (C) Copyright 2014 Hewlett-Packard Development Company, L.P.<BR>
-  Copyright (c) 2009 - 2016, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2009 - 2017, Intel Corporation. All rights reserved.<BR>
 
   This program and the accompanying materials
   are licensed and made available under the terms and conditions of the BSD License
@@ -86,6 +86,7 @@ TcpInitTcbLocal (
   // First window size is never scaled
   //
   Tcb->RcvWndScale  = 0;
+  Tcb->RetxmitSeqMax = 0;
 
   Tcb->ProbeTimerOn = 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.
 
-  Copyright (c) 2009 - 2016, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2009 - 2017, Intel Corporation. All rights reserved.<BR>
 
   This program and the accompanying materials
   are licensed and made available under the terms and conditions of the BSD 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)) {
+  
+  if ((Tcb->SndWndScale != 0) &&
+      (TCP_SEQ_GT (Seq, Tcb->RetxmitSeqMax) || TCP_SEQ_GT (Tcb->SndWl2 + Tcb->SndWnd + (1 << Tcb->SndWndScale), Seq))) {
+    //
+    // Handle the Window Retraction if TCP window scale is enabled according 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 = TCP_SUB_SEQ (Tcb->SndNxt, Seq);
+    DEBUG (
+      (EFI_D_WARN,
+      "TcpRetransmit: retransmission without regard to the receiver window for TCB %p\n",
+      Tcb)
+      );
+    
+  } else if (TCP_SEQ_GEQ (Tcb->SndWl2 + Tcb->SndWnd, Seq)) {
+    Len = TCP_SUB_SEQ (Tcb->SndWl2 + Tcb->SndWnd, Seq);
+    
+  } else {
     DEBUG (
       (EFI_D_WARN,
       "TcpRetransmit: retransmission cancelled because send window too small for TCB %p\n",
@@ -674,10 +694,9 @@ TcpRetransmit (
     return 0;
   }
 
-  Len   = TCP_SUB_SEQ (Tcb->SndWl2 + Tcb->SndWnd, Seq);
-  Len   = MIN (Len, Tcb->SndMss);
+  Len = MIN (Len, Tcb->SndMss);
 
-  Nbuf  = TcpGetSegmentSndQue (Tcb, Seq, Len);
+  Nbuf = TcpGetSegmentSndQue (Tcb, Seq, Len);
   if (Nbuf == NULL) {
     return -1;
   }
@@ -688,6 +707,10 @@ TcpRetransmit (
     goto OnError;
   }
 
+  if (TCP_SEQ_GT (Seq, Tcb->RetxmitSeqMax)) {
+    Tcb->RetxmitSeqMax = 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.
 
-  Copyright (c) 2009 - 2012, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2009 - 2017, Intel Corporation. All rights reserved.<BR>
 
   This program and the accompanying materials
   are licensed and made available under the terms and conditions of the BSD License
@@ -316,6 +316,12 @@ struct _TCP_CONTROL_BLOCK {
   TCP_SEQNO         LossRecover;  ///< Recover point for retxmit.
 
   //
+  // RFC7323
+  // Addressing Window Retraction for TCP Window Scale Option.
+  //
+  TCP_SEQNO         RetxmitSeqMax;       ///< Max Seq number in previous retransmission.
+
+  //
   // configuration parameters, for EFI_TCP4_PROTOCOL specification
   //
   UINT32            KeepAliveIdle;   ///< Idle time before sending first probe.
-- 
1.9.5.msysgit.1



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [Patch V2] NetworkPkg: Addressing TCP Window Retraction when window scale factor is used.
  2017-05-05  1:56 ` [Patch V2] NetworkPkg: " Fu Siyuan
@ 2017-05-05  5:03   ` Ye, Ting
  2017-05-05  5:12   ` Wu, Jiaxin
  1 sibling, 0 replies; 4+ messages in thread
From: Ye, Ting @ 2017-05-05  5:03 UTC (permalink / raw)
  To: Fu, Siyuan, edk2-devel@lists.01.org; +Cc: Wu, Jiaxin, Andrey Tepin

Reviewed-by: Ye Ting <ting.ye@intel.com>


-----Original Message-----
From: Fu, Siyuan 
Sent: Friday, May 05, 2017 9:56 AM
To: edk2-devel@lists.01.org
Cc: Wu, Jiaxin <jiaxin.wu@intel.com>; Andrey Tepin <atepin@kraftway.ru>; Ye, Ting <ting.ye@intel.com>
Subject: [Patch V2] NetworkPkg: Addressing TCP Window Retraction when window 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 problem when a non-zero scale factor is used.
The changes has been test in high packet loss rate network by using HTTP boot and iSCSI file read/write.

Cc: Wu Jiaxin <jiaxin.wu@intel.com>
Cc: Andrey Tepin <atepin@kraftway.ru>
Cc: Ye Ting <ting.ye@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Fu Siyuan <siyuan.fu@intel.com>
---
 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.
 
   (C) Copyright 2014 Hewlett-Packard Development Company, L.P.<BR>
-  Copyright (c) 2009 - 2016, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2009 - 2017, Intel Corporation. All rights 
+ reserved.<BR>
 
   This program and the accompanying materials
   are licensed and made available under the terms and conditions of the BSD License @@ -86,6 +86,7 @@ TcpInitTcbLocal (
   // First window size is never scaled
   //
   Tcb->RcvWndScale  = 0;
+  Tcb->RetxmitSeqMax = 0;
 
   Tcb->ProbeTimerOn = 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.
 
-  Copyright (c) 2009 - 2016, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2009 - 2017, Intel Corporation. All rights 
+ reserved.<BR>
 
   This program and the accompanying materials
   are licensed and made available under the terms and conditions of the BSD 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)) {
+  
+  if ((Tcb->SndWndScale != 0) &&
+      (TCP_SEQ_GT (Seq, Tcb->RetxmitSeqMax) || TCP_SEQ_GT (Tcb->SndWl2 + Tcb->SndWnd + (1 << Tcb->SndWndScale), Seq))) {
+    //
+    // Handle the Window Retraction if TCP window scale is enabled according 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 = TCP_SUB_SEQ (Tcb->SndNxt, Seq);
+    DEBUG (
+      (EFI_D_WARN,
+      "TcpRetransmit: retransmission without regard to the receiver window for TCB %p\n",
+      Tcb)
+      );
+    
+  } else if (TCP_SEQ_GEQ (Tcb->SndWl2 + Tcb->SndWnd, Seq)) {
+    Len = TCP_SUB_SEQ (Tcb->SndWl2 + Tcb->SndWnd, Seq);
+    
+  } else {
     DEBUG (
       (EFI_D_WARN,
       "TcpRetransmit: retransmission cancelled because send window too small for TCB %p\n", @@ -674,10 +694,9 @@ TcpRetransmit (
     return 0;
   }
 
-  Len   = TCP_SUB_SEQ (Tcb->SndWl2 + Tcb->SndWnd, Seq);
-  Len   = MIN (Len, Tcb->SndMss);
+  Len = MIN (Len, Tcb->SndMss);
 
-  Nbuf  = TcpGetSegmentSndQue (Tcb, Seq, Len);
+  Nbuf = TcpGetSegmentSndQue (Tcb, Seq, Len);
   if (Nbuf == NULL) {
     return -1;
   }
@@ -688,6 +707,10 @@ TcpRetransmit (
     goto OnError;
   }
 
+  if (TCP_SEQ_GT (Seq, Tcb->RetxmitSeqMax)) {
+    Tcb->RetxmitSeqMax = 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.
 
-  Copyright (c) 2009 - 2012, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2009 - 2017, Intel Corporation. All rights 
+ reserved.<BR>
 
   This program and the accompanying materials
   are licensed and made available under the terms and conditions of the BSD License @@ -316,6 +316,12 @@ struct _TCP_CONTROL_BLOCK {
   TCP_SEQNO         LossRecover;  ///< Recover point for retxmit.
 
   //
+  // RFC7323
+  // Addressing Window Retraction for TCP Window Scale Option.
+  //
+  TCP_SEQNO         RetxmitSeqMax;       ///< Max Seq number in previous retransmission.
+
+  //
   // configuration parameters, for EFI_TCP4_PROTOCOL specification
   //
   UINT32            KeepAliveIdle;   ///< Idle time before sending first probe.
--
1.9.5.msysgit.1



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Patch V2] NetworkPkg: Addressing TCP Window Retraction when window scale factor is used.
  2017-05-05  1:56 ` [Patch V2] NetworkPkg: " Fu Siyuan
  2017-05-05  5:03   ` Ye, Ting
@ 2017-05-05  5:12   ` Wu, Jiaxin
  1 sibling, 0 replies; 4+ messages in thread
From: Wu, Jiaxin @ 2017-05-05  5:12 UTC (permalink / raw)
  To: Fu, Siyuan, edk2-devel@lists.01.org; +Cc: Andrey Tepin, Ye, Ting

Reviewed-by: Wu Jiaxin <jiaxin.wu@intel.com>



> -----Original Message-----
> From: Fu, Siyuan
> Sent: Friday, May 5, 2017 9:56 AM
> To: edk2-devel@lists.01.org
> Cc: Wu, Jiaxin <jiaxin.wu@intel.com>; Andrey Tepin <atepin@kraftway.ru>; Ye,
> Ting <ting.ye@intel.com>
> Subject: [Patch V2] NetworkPkg: Addressing TCP Window Retraction when
> window 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
> problem
> when a non-zero scale factor is used.
> The changes has been test in high packet loss rate network by using HTTP boot
> and
> iSCSI file read/write.
> 
> Cc: Wu Jiaxin <jiaxin.wu@intel.com>
> Cc: Andrey Tepin <atepin@kraftway.ru>
> Cc: Ye Ting <ting.ye@intel.com>
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Fu Siyuan <siyuan.fu@intel.com>
> ---
>  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.
> 
>    (C) Copyright 2014 Hewlett-Packard Development Company, L.P.<BR>
> -  Copyright (c) 2009 - 2016, Intel Corporation. All rights reserved.<BR>
> +  Copyright (c) 2009 - 2017, Intel Corporation. All rights reserved.<BR>
> 
>    This program and the accompanying materials
>    are licensed and made available under the terms and conditions of the BSD
> License
> @@ -86,6 +86,7 @@ TcpInitTcbLocal (
>    // First window size is never scaled
>    //
>    Tcb->RcvWndScale  = 0;
> +  Tcb->RetxmitSeqMax = 0;
> 
>    Tcb->ProbeTimerOn = 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.
> 
> -  Copyright (c) 2009 - 2016, Intel Corporation. All rights reserved.<BR>
> +  Copyright (c) 2009 - 2017, Intel Corporation. All rights reserved.<BR>
> 
>    This program and the accompanying materials
>    are licensed and made available under the terms and conditions of the BSD
> 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)) {
> +
> +  if ((Tcb->SndWndScale != 0) &&
> +      (TCP_SEQ_GT (Seq, Tcb->RetxmitSeqMax) || TCP_SEQ_GT (Tcb->SndWl2 +
> Tcb->SndWnd + (1 << Tcb->SndWndScale), Seq))) {
> +    //
> +    // Handle the Window Retraction if TCP window scale is enabled according
> 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 = TCP_SUB_SEQ (Tcb->SndNxt, Seq);
> +    DEBUG (
> +      (EFI_D_WARN,
> +      "TcpRetransmit: retransmission without regard to the receiver window for
> TCB %p\n",
> +      Tcb)
> +      );
> +
> +  } else if (TCP_SEQ_GEQ (Tcb->SndWl2 + Tcb->SndWnd, Seq)) {
> +    Len = TCP_SUB_SEQ (Tcb->SndWl2 + Tcb->SndWnd, Seq);
> +
> +  } else {
>      DEBUG (
>        (EFI_D_WARN,
>        "TcpRetransmit: retransmission cancelled because send window too small
> for TCB %p\n",
> @@ -674,10 +694,9 @@ TcpRetransmit (
>      return 0;
>    }
> 
> -  Len   = TCP_SUB_SEQ (Tcb->SndWl2 + Tcb->SndWnd, Seq);
> -  Len   = MIN (Len, Tcb->SndMss);
> +  Len = MIN (Len, Tcb->SndMss);
> 
> -  Nbuf  = TcpGetSegmentSndQue (Tcb, Seq, Len);
> +  Nbuf = TcpGetSegmentSndQue (Tcb, Seq, Len);
>    if (Nbuf == NULL) {
>      return -1;
>    }
> @@ -688,6 +707,10 @@ TcpRetransmit (
>      goto OnError;
>    }
> 
> +  if (TCP_SEQ_GT (Seq, Tcb->RetxmitSeqMax)) {
> +    Tcb->RetxmitSeqMax = 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.
> 
> -  Copyright (c) 2009 - 2012, Intel Corporation. All rights reserved.<BR>
> +  Copyright (c) 2009 - 2017, Intel Corporation. All rights reserved.<BR>
> 
>    This program and the accompanying materials
>    are licensed and made available under the terms and conditions of the BSD
> License
> @@ -316,6 +316,12 @@ struct _TCP_CONTROL_BLOCK {
>    TCP_SEQNO         LossRecover;  ///< Recover point for retxmit.
> 
>    //
> +  // RFC7323
> +  // Addressing Window Retraction for TCP Window Scale Option.
> +  //
> +  TCP_SEQNO         RetxmitSeqMax;       ///< Max Seq number in previous
> retransmission.
> +
> +  //
>    // configuration parameters, for EFI_TCP4_PROTOCOL specification
>    //
>    UINT32            KeepAliveIdle;   ///< Idle time before sending first probe.
> --
> 1.9.5.msysgit.1



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-05-05  5:12 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-05-05  1:56 [Patch V2] MdeModulePkg: Addressing TCP Window Retraction when window scale factor is used Fu Siyuan
2017-05-05  1:56 ` [Patch V2] NetworkPkg: " Fu Siyuan
2017-05-05  5:03   ` Ye, Ting
2017-05-05  5:12   ` Wu, Jiaxin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox