diff options
Diffstat (limited to 'NetworkPkg/TcpDxe/TcpOutput.c')
-rw-r--r-- | NetworkPkg/TcpDxe/TcpOutput.c | 31 |
1 files changed, 27 insertions, 4 deletions
diff --git a/NetworkPkg/TcpDxe/TcpOutput.c b/NetworkPkg/TcpDxe/TcpOutput.c index c038213484..08907a20fa 100644 --- a/NetworkPkg/TcpDxe/TcpOutput.c +++ b/NetworkPkg/TcpDxe/TcpOutput.c @@ -1,7 +1,7 @@ /** @file
TCP output process routines.
- Copyright (c) 2009 - 2010, 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)) {
+
+ //
+ // 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.
+ //
+ if ((Tcb->SndWndScale != 0) &&
+ (TCP_SEQ_GT (Seq, Tcb->RetxmitSeqMax) || TCP_SEQ_BETWEEN (Tcb->SndWl2 + Tcb->SndWnd, Seq, Tcb->SndWl2 + Tcb->SndWnd + (1 << Tcb->SndWndScale)))) {
+ 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,8 +694,7 @@ 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);
if (Nbuf == NULL) {
@@ -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
|