From 7bc01e86d9955cc3d43c02adfe5e67a321ebe7da Mon Sep 17 00:00:00 2001 From: vanjeff Date: Thu, 18 Mar 2010 11:35:35 +0000 Subject: [PATCH] changing UDP default timeout value to 2s to improve PXE BC boot performance. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@10282 6f19259b-4bc3-4df7-8a09-765794883524 --- .../Universal/Network/UefiPxeBcDxe/PxeBcDriver.c | 14 +++++++------- .../Universal/Network/UefiPxeBcDxe/PxeBcImpl.h | 13 +++++++------ .../Universal/Network/UefiPxeBcDxe/PxeBcSupport.c | 2 +- 3 files changed, 15 insertions(+), 14 deletions(-) diff --git a/MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcDriver.c b/MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcDriver.c index f82f744b76..33e7a3769f 100644 --- a/MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcDriver.c +++ b/MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcDriver.c @@ -1,6 +1,6 @@ /** @file The driver binding for UEFI PXEBC protocol. - + Copyright (c) 2007 - 2009, 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 @@ -60,7 +60,7 @@ PxeBcDriverEntryPoint ( order to make drivers as small as possible, there are a few calling restrictions for this service. ConnectController() must follow these calling restrictions. If any other agent wishes to call - Supported() it must also follow these calling restrictions. + Supported() it must also follow these calling restrictions. PxeBc requires DHCP4 and MTFTP4 protocols. @param This Protocol instance pointer. @@ -260,7 +260,7 @@ PxeBcDriverBindingStart ( // Status = Private->Ip4->GetModeData (Private->Ip4, &Ip4ModeData, NULL, NULL); if (EFI_ERROR (Status)) { - goto ON_ERROR; + goto ON_ERROR; } Private->Ip4MaxPacketSize = Ip4ModeData.MaxPacketSize; @@ -320,7 +320,7 @@ PxeBcDriverBindingStart ( // The UDP instance for EfiPxeBcUdpWrite // Status = NetLibCreateServiceChild ( - ControllerHandle, + ControllerHandle, This->DriverBindingHandle, &gEfiUdp4ServiceBindingProtocolGuid, &Private->Udp4WriteChild @@ -348,7 +348,7 @@ PxeBcDriverBindingStart ( Private->Udp4CfgData.TypeOfService = DEFAULT_ToS; Private->Udp4CfgData.TimeToLive = DEFAULT_TTL; Private->Udp4CfgData.DoNotFragment = FALSE; - Private->Udp4CfgData.ReceiveTimeout = 50000; // 50 milliseconds + Private->Udp4CfgData.ReceiveTimeout = PXEBC_DEFAULT_LIFETIME; Private->Udp4CfgData.UseDefaultAddress = FALSE; PxeBcInitSeedPacket (&Private->SeedPacket, Private->Udp4Read); @@ -487,7 +487,7 @@ ON_ERROR: restrictions for this service. DisconnectController() must follow these calling restrictions. If any other agent wishes to call Stop() it must also follow these calling restrictions. - + @param This Protocol instance pointer. @param ControllerHandle Handle of device to stop driver on @param NumberOfChildren Number of Handles in ChildHandleBuffer. If number of @@ -545,7 +545,7 @@ PxeBcDriverBindingStop ( if (EFI_ERROR (Status)) { return Status; } - + // // Stop functionality of PXE Base Code protocol // diff --git a/MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcImpl.h b/MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcImpl.h index 807e4d128a..806a6862d5 100644 --- a/MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcImpl.h +++ b/MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcImpl.h @@ -1,6 +1,6 @@ /** @file -Copyright (c) 2007 - 2010, Intel Corporation.
+Copyright (c) 2007 - 2010, 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 @@ -51,7 +51,8 @@ typedef struct _PXEBC_PRIVATE_DATA PXEBC_PRIVATE_DATA; #define PXEBC_MTFTP_RETRIES 6 #define PXEBC_DEFAULT_UDP_OVERHEAD_SIZE 8 #define PXEBC_DEFAULT_TFTP_OVERHEAD_SIZE 4 -#define PXEBC_DEFAULT_PACKET_SIZE 1480 +#define PXEBC_DEFAULT_PACKET_SIZE 1480 +#define PXEBC_DEFAULT_LIFETIME 2000000 // 2 seconds, unit is microsecond struct _PXEBC_PRIVATE_DATA { UINT32 Signature; @@ -146,21 +147,21 @@ extern EFI_LOAD_FILE_PROTOCOL mLoadFileProtocolTemplate; @param This Protocol instance pointer. @param FilePath The device specific path of the file to load. - @param BootPolicy If TRUE, indicates that the request originates from the + @param BootPolicy If TRUE, indicates that the request originates from the boot manager is attempting to load FilePath as a boot selection. If FALSE, then FilePath must match as exact file to be loaded. @param BufferSize On input the size of Buffer in bytes. On output with a return - code of EFI_SUCCESS, the amount of data transferred to + code of EFI_SUCCESS, the amount of data transferred to Buffer. On output with a return code of EFI_BUFFER_TOO_SMALL, the size of Buffer required to retrieve the requested file. @param Buffer The memory buffer to transfer the file to. IF Buffer is NULL, - then no the size of the requested file is returned in + then no the size of the requested file is returned in BufferSize. @retval EFI_SUCCESS The file was loaded. @retval EFI_UNSUPPORTED The device does not support the provided BootPolicy - @retval EFI_INVALID_PARAMETER FilePath is not a valid device path, or + @retval EFI_INVALID_PARAMETER FilePath is not a valid device path, or BufferSize is NULL. @retval EFI_NO_MEDIA No medium was present to load the file. @retval EFI_DEVICE_ERROR The file was not loaded due to a device error. diff --git a/MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcSupport.c b/MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcSupport.c index d425b1ff8f..9e6b47aa12 100644 --- a/MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcSupport.c +++ b/MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcSupport.c @@ -194,7 +194,7 @@ PxeBcConfigureUdpWriteInstance ( ZeroMem (&Udp4CfgData, sizeof (Udp4CfgData)); - Udp4CfgData.ReceiveTimeout = 1000; + Udp4CfgData.ReceiveTimeout = PXEBC_DEFAULT_LIFETIME; Udp4CfgData.TypeOfService = DEFAULT_ToS; Udp4CfgData.TimeToLive = DEFAULT_TTL; Udp4CfgData.AllowDuplicatePort = TRUE;