X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=blobdiff_plain;f=MdeModulePkg%2FLibrary%2FDxeTcpIoLib%2FDxeTcpIoLib.c;h=341295d0b7afd49874c5ee3a2aa01579820fca90;hp=730ccb2cafe8b36fda3d7a89898588dee12a90be;hb=c0fd7f734e2d33e22215899b40a47b843129541d;hpb=8322eb77ce4ccdf803a769e8799e13f0834b6bb4 diff --git a/MdeModulePkg/Library/DxeTcpIoLib/DxeTcpIoLib.c b/MdeModulePkg/Library/DxeTcpIoLib/DxeTcpIoLib.c index 730ccb2caf..341295d0b7 100644 --- a/MdeModulePkg/Library/DxeTcpIoLib/DxeTcpIoLib.c +++ b/MdeModulePkg/Library/DxeTcpIoLib/DxeTcpIoLib.c @@ -2,14 +2,8 @@ This library is used to share code between UEFI network stack modules. It provides the helper routines to access TCP service. -Copyright (c) 2010 - 2011, Intel Corporation. All rights reserved.
-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
-http://opensource.org/licenses/bsd-license.php - -THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.
+SPDX-License-Identifier: BSD-2-Clause-Patent **/ @@ -22,106 +16,106 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. #include #include -/** - The common notify function associated with various TcpIo events. - - @param[in] Event The event signaled. - @param[in] Context The context. - -**/ -VOID -EFIAPI +/** + The common notify function associated with various TcpIo events. + + @param[in] Event The event signaled. + @param[in] Context The context. + +**/ +VOID +EFIAPI TcpIoCommonNotify ( - IN EFI_EVENT Event, - IN VOID *Context - ) + IN EFI_EVENT Event, + IN VOID *Context + ) { if ((Event == NULL) || (Context == NULL)) { return ; } - *((BOOLEAN *) Context) = TRUE; + *((BOOLEAN *) Context) = TRUE; } -/** +/** The internal function for delay configuring TCP6 when IP6 driver is still in DAD. - - @param[in] Tcp6 The EFI_TCP6_PROTOCOL protocol instance. - @param[in] Tcp6ConfigData The Tcp6 configuration data. - - @retval EFI_SUCCESS The operational settings successfully - completed. + + @param[in] Tcp6 The EFI_TCP6_PROTOCOL protocol instance. + @param[in] Tcp6ConfigData The Tcp6 configuration data. + + @retval EFI_SUCCESS The operational settings successfully + completed. @retval EFI_INVALID_PARAMETER One or more parameters are invalid. @retval Others Failed to finish the operation. -**/ -EFI_STATUS +**/ +EFI_STATUS TcpIoGetMapping ( - IN EFI_TCP6_PROTOCOL *Tcp6, - IN EFI_TCP6_CONFIG_DATA *Tcp6ConfigData - ) -{ - EFI_STATUS Status; - EFI_EVENT Event; + IN EFI_TCP6_PROTOCOL *Tcp6, + IN EFI_TCP6_CONFIG_DATA *Tcp6ConfigData + ) +{ + EFI_STATUS Status; + EFI_EVENT Event; if ((Tcp6 == NULL) || (Tcp6ConfigData == NULL)) { return EFI_INVALID_PARAMETER; } - Event = NULL; - Status = gBS->CreateEvent ( - EVT_TIMER, - TPL_CALLBACK, - NULL, - NULL, - &Event - ); - if (EFI_ERROR (Status)) { - goto ON_EXIT; - } - - Status = gBS->SetTimer ( - Event, - TimerRelative, + Event = NULL; + Status = gBS->CreateEvent ( + EVT_TIMER, + TPL_CALLBACK, + NULL, + NULL, + &Event + ); + if (EFI_ERROR (Status)) { + goto ON_EXIT; + } + + Status = gBS->SetTimer ( + Event, + TimerRelative, TCP_GET_MAPPING_TIMEOUT - ); - - if (EFI_ERROR (Status)) { - goto ON_EXIT; - } - - while (EFI_ERROR (gBS->CheckEvent (Event))) { - - Tcp6->Poll (Tcp6); - - Status = Tcp6->Configure (Tcp6, Tcp6ConfigData); - - if (!EFI_ERROR (Status)) { - break; - } - } - -ON_EXIT: - - if (Event != NULL) { - gBS->CloseEvent (Event); - } - - return Status; + ); + + if (EFI_ERROR (Status)) { + goto ON_EXIT; + } + + while (EFI_ERROR (gBS->CheckEvent (Event))) { + + Tcp6->Poll (Tcp6); + + Status = Tcp6->Configure (Tcp6, Tcp6ConfigData); + + if (!EFI_ERROR (Status)) { + break; + } + } + +ON_EXIT: + + if (Event != NULL) { + gBS->CloseEvent (Event); + } + + return Status; } /** - Create a TCP socket with the specified configuration data. + Create a TCP socket with the specified configuration data. @param[in] Image The handle of the driver image. @param[in] Controller The handle of the controller. @param[in] TcpVersion The version of Tcp, TCP_VERSION_4 or TCP_VERSION_6. @param[in] ConfigData The Tcp configuration data. @param[out] TcpIo The TcpIo. - + @retval EFI_SUCCESS The TCP socket is created and configured. @retval EFI_INVALID_PARAMETER One or more parameters are invalid. - @retval EFI_UNSUPPORTED One or more of the control options are not + @retval EFI_UNSUPPORTED One or more of the control options are not supported in the implementation. @retval EFI_OUT_OF_RESOURCES Failed to allocate memory. @retval Others Failed to create the TCP socket or configure it. @@ -176,27 +170,27 @@ TcpIoCreateSocket ( // // Create the TCP child instance and get the TCP protocol. - // - Status = NetLibCreateServiceChild ( - Controller, - Image, + // + Status = NetLibCreateServiceChild ( + Controller, + Image, ServiceBindingGuid, &TcpIo->Handle - ); - if (EFI_ERROR (Status)) { - return Status; - } - - Status = gBS->OpenProtocol ( + ); + if (EFI_ERROR (Status)) { + return Status; + } + + Status = gBS->OpenProtocol ( TcpIo->Handle, ProtocolGuid, Interface, - Image, - Controller, - EFI_OPEN_PROTOCOL_BY_DRIVER - ); + Image, + Controller, + EFI_OPEN_PROTOCOL_BY_DRIVER + ); if (EFI_ERROR (Status) || (*Interface == NULL)) { - goto ON_ERROR; + goto ON_ERROR; } if (TcpVersion == TCP_VERSION_4) { @@ -204,28 +198,28 @@ TcpIoCreateSocket ( } else { Tcp6 = TcpIo->Tcp.Tcp6; } - + TcpIo->Image = Image; TcpIo->Controller = Controller; - - // - // Set the configuration parameters. - // - ControlOption.ReceiveBufferSize = 0x200000; - ControlOption.SendBufferSize = 0x200000; - ControlOption.MaxSynBackLog = 0; - ControlOption.ConnectionTimeout = 0; - ControlOption.DataRetries = 6; - ControlOption.FinTimeout = 0; - ControlOption.TimeWaitTimeout = 0; - ControlOption.KeepAliveProbes = 4; - ControlOption.KeepAliveTime = 0; - ControlOption.KeepAliveInterval = 0; - ControlOption.EnableNagle = FALSE; - ControlOption.EnableTimeStamp = FALSE; - ControlOption.EnableWindowScaling = TRUE; - ControlOption.EnableSelectiveAck = FALSE; - ControlOption.EnablePathMtuDiscovery = FALSE; + + // + // Set the configuration parameters. + // + ControlOption.ReceiveBufferSize = 0x200000; + ControlOption.SendBufferSize = 0x200000; + ControlOption.MaxSynBackLog = 0; + ControlOption.ConnectionTimeout = 0; + ControlOption.DataRetries = 6; + ControlOption.FinTimeout = 0; + ControlOption.TimeWaitTimeout = 0; + ControlOption.KeepAliveProbes = 4; + ControlOption.KeepAliveTime = 0; + ControlOption.KeepAliveInterval = 0; + ControlOption.EnableNagle = FALSE; + ControlOption.EnableTimeStamp = FALSE; + ControlOption.EnableWindowScaling = TRUE; + ControlOption.EnableSelectiveAck = FALSE; + ControlOption.EnablePathMtuDiscovery = FALSE; if (TcpVersion == TCP_VERSION_4) { Tcp4ConfigData.TypeOfService = 8; @@ -309,59 +303,59 @@ TcpIoCreateSocket ( } } - // - // Create events for variuos asynchronous operations. + // + // Create events for variuos asynchronous operations. // Status = gBS->CreateEvent ( - EVT_NOTIFY_SIGNAL, - TPL_NOTIFY, + EVT_NOTIFY_SIGNAL, + TPL_NOTIFY, TcpIoCommonNotify, &TcpIo->IsConnDone, &Event - ); - if (EFI_ERROR (Status)) { - goto ON_ERROR; + ); + if (EFI_ERROR (Status)) { + goto ON_ERROR; } TcpIo->ConnToken.Tcp4Token.CompletionToken.Event = Event; - Status = gBS->CreateEvent ( - EVT_NOTIFY_SIGNAL, - TPL_NOTIFY, + Status = gBS->CreateEvent ( + EVT_NOTIFY_SIGNAL, + TPL_NOTIFY, TcpIoCommonNotify, &TcpIo->IsListenDone, &Event - ); - if (EFI_ERROR (Status)) { - goto ON_ERROR; + ); + if (EFI_ERROR (Status)) { + goto ON_ERROR; } TcpIo->ListenToken.Tcp4Token.CompletionToken.Event = Event; - Status = gBS->CreateEvent ( - EVT_NOTIFY_SIGNAL, - TPL_NOTIFY, + Status = gBS->CreateEvent ( + EVT_NOTIFY_SIGNAL, + TPL_NOTIFY, TcpIoCommonNotify, &TcpIo->IsTxDone, &Event - ); - if (EFI_ERROR (Status)) { - goto ON_ERROR; - } + ); + if (EFI_ERROR (Status)) { + goto ON_ERROR; + } TcpIo->TxToken.Tcp4Token.CompletionToken.Event = Event; - Status = gBS->CreateEvent ( - EVT_NOTIFY_SIGNAL, - TPL_NOTIFY, + Status = gBS->CreateEvent ( + EVT_NOTIFY_SIGNAL, + TPL_NOTIFY, TcpIoCommonNotify, &TcpIo->IsRxDone, &Event - ); - if (EFI_ERROR (Status)) { - goto ON_ERROR; - } + ); + if (EFI_ERROR (Status)) { + goto ON_ERROR; + } TcpIo->RxToken.Tcp4Token.CompletionToken.Event = Event; @@ -373,31 +367,31 @@ TcpIoCreateSocket ( TcpIo->RxToken.Tcp4Token.Packet.RxData = RxData; - Status = gBS->CreateEvent ( - EVT_NOTIFY_SIGNAL, - TPL_NOTIFY, + Status = gBS->CreateEvent ( + EVT_NOTIFY_SIGNAL, + TPL_NOTIFY, TcpIoCommonNotify, &TcpIo->IsCloseDone, &Event - ); - if (EFI_ERROR (Status)) { - goto ON_ERROR; - } + ); + if (EFI_ERROR (Status)) { + goto ON_ERROR; + } TcpIo->CloseToken.Tcp4Token.CompletionToken.Event = Event; return EFI_SUCCESS; - -ON_ERROR: + +ON_ERROR: TcpIoDestroySocket (TcpIo); - + return Status; } - + /** - Destroy the socket. + Destroy the socket. @param[in] TcpIo The TcpIo which wraps the socket to be destroyed. @@ -482,7 +476,7 @@ TcpIoDestroySocket ( if ((Tcp4 != NULL) || (Tcp6 != NULL)) { - gBS->CloseProtocol ( + gBS->CloseProtocol ( TcpIo->Handle, ProtocolGuid, TcpIo->Image, @@ -518,7 +512,7 @@ TcpIoDestroySocket ( } } - NetLibDestroyServiceChild ( + NetLibDestroyServiceChild ( TcpIo->Controller, TcpIo->Image, ServiceBindingGuid, @@ -530,8 +524,8 @@ TcpIoDestroySocket ( Connect to the other endpoint of the TCP socket. @param[in, out] TcpIo The TcpIo wrapping the TCP socket. - @param[in] Timeout The time to wait for connection done. - + @param[in] Timeout The time to wait for connection done. Set to NULL for infinite wait. + @retval EFI_SUCCESS Connect to the other endpoint of the TCP socket successfully. @retval EFI_TIMEOUT Failed to connect to the other endpoint of the @@ -546,7 +540,7 @@ EFI_STATUS EFIAPI TcpIoConnect ( IN OUT TCP_IO *TcpIo, - IN EFI_EVENT Timeout + IN EFI_EVENT Timeout OPTIONAL ) { EFI_TCP4_PROTOCOL *Tcp4; @@ -572,24 +566,29 @@ TcpIoConnect ( return EFI_UNSUPPORTED; } - if (EFI_ERROR (Status)) { - return Status; - } - - while (!TcpIo->IsConnDone && EFI_ERROR (gBS->CheckEvent (Timeout))) { + if (EFI_ERROR (Status)) { + return Status; + } + + while (!TcpIo->IsConnDone && ((Timeout == NULL) || EFI_ERROR (gBS->CheckEvent (Timeout)))) { if (TcpIo->TcpVersion == TCP_VERSION_4) { Tcp4->Poll (Tcp4); } else { Tcp6->Poll (Tcp6); } - } - + } + if (!TcpIo->IsConnDone) { - Status = EFI_TIMEOUT; + if (TcpIo->TcpVersion == TCP_VERSION_4) { + Tcp4->Cancel (Tcp4, &TcpIo->ConnToken.Tcp4Token.CompletionToken); + } else { + Tcp6->Cancel (Tcp6, &TcpIo->ConnToken.Tcp6Token.CompletionToken); + } + Status = EFI_TIMEOUT; } else { Status = TcpIo->ConnToken.Tcp4Token.CompletionToken.Status; } - + return Status; } @@ -597,9 +596,9 @@ TcpIoConnect ( Accept the incomding request from the other endpoint of the TCP socket. @param[in, out] TcpIo The TcpIo wrapping the TCP socket. - @param[in] Timeout The time to wait for connection done. + @param[in] Timeout The time to wait for connection done. Set to NULL for infinite wait. + - @retval EFI_SUCCESS Connect to the other endpoint of the TCP socket successfully. @retval EFI_INVALID_PARAMETER One or more parameters are invalid. @@ -607,7 +606,7 @@ TcpIoConnect ( supported in the implementation. @retval EFI_TIMEOUT Failed to connect to the other endpoint of the - TCP socket in the specified time period. + TCP socket in the specified time period. @retval Others Other errors as indicated. **/ @@ -615,7 +614,7 @@ EFI_STATUS EFIAPI TcpIoAccept ( IN OUT TCP_IO *TcpIo, - IN EFI_EVENT Timeout + IN EFI_EVENT Timeout OPTIONAL ) { EFI_STATUS Status; @@ -642,45 +641,50 @@ TcpIoAccept ( return EFI_UNSUPPORTED; } - if (EFI_ERROR (Status)) { - return Status; + if (EFI_ERROR (Status)) { + return Status; } - while (!TcpIo->IsListenDone && EFI_ERROR (gBS->CheckEvent (Timeout))) { + while (!TcpIo->IsListenDone && ((Timeout == NULL) || EFI_ERROR (gBS->CheckEvent (Timeout)))) { if (TcpIo->TcpVersion == TCP_VERSION_4) { Tcp4->Poll (Tcp4); } else { Tcp6->Poll (Tcp6); } - } + } if (!TcpIo->IsListenDone) { - Status = EFI_TIMEOUT; + if (TcpIo->TcpVersion == TCP_VERSION_4) { + Tcp4->Cancel (Tcp4, &TcpIo->ListenToken.Tcp4Token.CompletionToken); + } else { + Tcp6->Cancel (Tcp6, &TcpIo->ListenToken.Tcp6Token.CompletionToken); + } + Status = EFI_TIMEOUT; } else { Status = TcpIo->ListenToken.Tcp4Token.CompletionToken.Status; } - // - // The new TCP instance handle created for the established connection is - // in ListenToken. - // + // + // The new TCP instance handle created for the established connection is + // in ListenToken. + // if (!EFI_ERROR (Status)) { if (TcpIo->TcpVersion == TCP_VERSION_4) { ProtocolGuid = &gEfiTcp4ProtocolGuid; } else { ProtocolGuid = &gEfiTcp6ProtocolGuid; } - - Status = gBS->OpenProtocol ( + + Status = gBS->OpenProtocol ( TcpIo->ListenToken.Tcp4Token.NewChildHandle, ProtocolGuid, (VOID **) (&TcpIo->NewTcp.Tcp4), TcpIo->Image, TcpIo->Controller, - EFI_OPEN_PROTOCOL_BY_DRIVER - ); - - } + EFI_OPEN_PROTOCOL_BY_DRIVER + ); + + } return Status; } @@ -709,7 +713,7 @@ TcpIoReset ( Tcp4 = NULL; Tcp6 = NULL; - if (TcpIo->TcpVersion == TCP_VERSION_4) { + if (TcpIo->TcpVersion == TCP_VERSION_4) { TcpIo->CloseToken.Tcp4Token.AbortOnClose = TRUE; Tcp4 = TcpIo->Tcp.Tcp4; Status = Tcp4->Close (Tcp4, &TcpIo->CloseToken.Tcp4Token); @@ -721,10 +725,10 @@ TcpIoReset ( return ; } - if (EFI_ERROR (Status)) { - return ; - } - + if (EFI_ERROR (Status)) { + return ; + } + while (!TcpIo->IsCloseDone) { if (TcpIo->TcpVersion == TCP_VERSION_4) { Tcp4->Poll (Tcp4); @@ -734,13 +738,13 @@ TcpIoReset ( } } - + /** Transmit the Packet to the other endpoint of the socket. @param[in] TcpIo The TcpIo wrapping the TCP socket. @param[in] Packet The packet to transmit. - + @retval EFI_SUCCESS The packet is trasmitted. @retval EFI_INVALID_PARAMETER One or more parameters are invalid. @retval EFI_UNSUPPORTED One or more of the control options are not @@ -769,7 +773,7 @@ TcpIoTransmit ( if (TcpIo->TcpVersion == TCP_VERSION_4) { - Size = sizeof (EFI_TCP4_TRANSMIT_DATA) + + Size = sizeof (EFI_TCP4_TRANSMIT_DATA) + (Packet->BlockOpNum - 1) * sizeof (EFI_TCP4_FRAGMENT_DATA); } else if (TcpIo->TcpVersion == TCP_VERSION_6) { Size = sizeof (EFI_TCP6_TRANSMIT_DATA) + @@ -780,16 +784,16 @@ TcpIoTransmit ( Data = AllocatePool (Size); if (Data == NULL) { - return EFI_OUT_OF_RESOURCES; + return EFI_OUT_OF_RESOURCES; } ((EFI_TCP4_TRANSMIT_DATA *) Data)->Push = TRUE; ((EFI_TCP4_TRANSMIT_DATA *) Data)->Urgent = FALSE; ((EFI_TCP4_TRANSMIT_DATA *) Data)->DataLength = Packet->TotalSize; - // - // Build the fragment table. - // + // + // Build the fragment table. + // ((EFI_TCP4_TRANSMIT_DATA *) Data)->FragmentCount = Packet->BlockOpNum; NetbufBuildExt ( @@ -802,8 +806,8 @@ TcpIoTransmit ( Tcp6 = NULL; Status = EFI_DEVICE_ERROR; - // - // Trasnmit the packet. + // + // Trasnmit the packet. // if (TcpIo->TcpVersion == TCP_VERSION_4) { TcpIo->TxToken.Tcp4Token.Packet.TxData = (EFI_TCP4_TRANSMIT_DATA *) Data; @@ -815,7 +819,7 @@ TcpIoTransmit ( if (Tcp4 == NULL) { goto ON_EXIT; } - + Status = Tcp4->Transmit (Tcp4, &TcpIo->TxToken.Tcp4Token); } else { TcpIo->TxToken.Tcp6Token.Packet.TxData = (EFI_TCP6_TRANSMIT_DATA *) Data; @@ -831,25 +835,25 @@ TcpIoTransmit ( Status = Tcp6->Transmit (Tcp6, &TcpIo->TxToken.Tcp6Token); } - if (EFI_ERROR (Status)) { - goto ON_EXIT; - } - + if (EFI_ERROR (Status)) { + goto ON_EXIT; + } + while (!TcpIo->IsTxDone) { if (TcpIo->TcpVersion == TCP_VERSION_4) { Tcp4->Poll (Tcp4); } else { Tcp6->Poll (Tcp6); } - } - + } + TcpIo->IsTxDone = FALSE; Status = TcpIo->TxToken.Tcp4Token.CompletionToken.Status; -ON_EXIT: - +ON_EXIT: + FreePool (Data); - + return Status; } @@ -860,7 +864,7 @@ ON_EXIT: @param[in] Packet The buffer to hold the data copy from the socket rx buffer. @param[in] AsyncMode Is this receive asyncronous or not. @param[in] Timeout The time to wait for receiving the amount of data the Packet - can hold. + can hold. Set to NULL for infinite wait. @retval EFI_SUCCESS The required amount of data is received from the socket. @retval EFI_INVALID_PARAMETER One or more parameters are invalid. @@ -877,7 +881,7 @@ TcpIoReceive ( IN OUT TCP_IO *TcpIo, IN NET_BUF *Packet, IN BOOLEAN AsyncMode, - IN EFI_EVENT Timeout + IN EFI_EVENT Timeout OPTIONAL ) { EFI_TCP4_PROTOCOL *Tcp4; @@ -919,29 +923,29 @@ TcpIoReceive ( } if (Tcp6 == NULL) { - return EFI_DEVICE_ERROR; + return EFI_DEVICE_ERROR; } } else { return EFI_UNSUPPORTED; } - FragmentCount = Packet->BlockOpNum; - Fragment = AllocatePool (FragmentCount * sizeof (NET_FRAGMENT)); + FragmentCount = Packet->BlockOpNum; + Fragment = AllocatePool (FragmentCount * sizeof (NET_FRAGMENT)); if (Fragment == NULL) { Status = EFI_OUT_OF_RESOURCES; goto ON_EXIT; - } - // - // Build the fragment table. - // - NetbufBuildExt (Packet, Fragment, &FragmentCount); + } + // + // Build the fragment table. + // + NetbufBuildExt (Packet, Fragment, &FragmentCount); RxData->FragmentCount = 1; CurrentFragment = 0; - Status = EFI_SUCCESS; - - while (CurrentFragment < FragmentCount) { + Status = EFI_SUCCESS; + + while (CurrentFragment < FragmentCount) { RxData->DataLength = Fragment[CurrentFragment].Len; RxData->FragmentTable[0].FragmentLength = Fragment[CurrentFragment].Len; RxData->FragmentTable[0].FragmentBuffer = Fragment[CurrentFragment].Bulk; @@ -951,11 +955,11 @@ TcpIoReceive ( } else { Status = Tcp6->Receive (Tcp6, &TcpIo->RxToken.Tcp6Token); } - - if (EFI_ERROR (Status)) { - goto ON_EXIT; - } - + + if (EFI_ERROR (Status)) { + goto ON_EXIT; + } + while (!TcpIo->IsRxDone && ((Timeout == NULL) || EFI_ERROR (gBS->CheckEvent (Timeout)))) { // // Poll until some data is received or an error occurs. @@ -966,42 +970,42 @@ TcpIoReceive ( Tcp6->Poll (Tcp6); } } - + if (!TcpIo->IsRxDone) { - // - // Timeout occurs, cancel the receive request. - // + // + // Timeout occurs, cancel the receive request. + // if (TcpIo->TcpVersion == TCP_VERSION_4) { Tcp4->Cancel (Tcp4, &TcpIo->RxToken.Tcp4Token.CompletionToken); } else { Tcp6->Cancel (Tcp6, &TcpIo->RxToken.Tcp6Token.CompletionToken); } - - Status = EFI_TIMEOUT; - goto ON_EXIT; - } else { + + Status = EFI_TIMEOUT; + goto ON_EXIT; + } else { TcpIo->IsRxDone = FALSE; } Status = TcpIo->RxToken.Tcp4Token.CompletionToken.Status; if (EFI_ERROR (Status)) { - goto ON_EXIT; - } - + goto ON_EXIT; + } + Fragment[CurrentFragment].Len -= RxData->FragmentTable[0].FragmentLength; - if (Fragment[CurrentFragment].Len == 0) { - CurrentFragment++; - } else { + if (Fragment[CurrentFragment].Len == 0) { + CurrentFragment++; + } else { Fragment[CurrentFragment].Bulk += RxData->FragmentTable[0].FragmentLength; - } - } - -ON_EXIT: + } + } + +ON_EXIT: if (Fragment != NULL) { FreePool (Fragment); } - + return Status; }