mirror of https://github.com/acidanthera/audk.git
NetworkPkg: Making the HTTP IO timeout value programmable with PCD
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3507 HTTP boot has a default set forced timeout value of 5 seconds for getting the recovery image from a remote source. This change allows the HTTP boot flow to get the IO timeout value from the PcdHttpIoTimeout. PcdHttpIoTimeout value is set in platform code. Signed-off-by: Zachary Clark-Williams <zachary.clark-williams@intel.com> Cc: Maciej Rabeda <maciej.rabeda@linux.intel.com> Cc: Jiaxin Wu <jiaxin.wu@intel.com> Cc: Siyuan Fu <siyuan.fu@intel.com> Reviewed-by: Maciej Rabeda <maciej.rabeda@linux.intel.com> Reviewed-by: Jiaxin Wu <jiaxin.wu@intel.com>
This commit is contained in:
parent
147f34b56c
commit
ac70e71b1f
|
@ -1,7 +1,7 @@
|
||||||
/** @file
|
/** @file
|
||||||
Implementation of the boot file download function.
|
Implementation of the boot file download function.
|
||||||
|
|
||||||
Copyright (c) 2015 - 2018, Intel Corporation. All rights reserved.<BR>
|
Copyright (c) 2015 - 2021, Intel Corporation. All rights reserved.<BR>
|
||||||
(C) Copyright 2016 Hewlett Packard Enterprise Development LP<BR>
|
(C) Copyright 2016 Hewlett Packard Enterprise Development LP<BR>
|
||||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||||
|
|
||||||
|
@ -596,19 +596,25 @@ HttpBootCreateHttpIo (
|
||||||
HTTP_IO_CONFIG_DATA ConfigData;
|
HTTP_IO_CONFIG_DATA ConfigData;
|
||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
EFI_HANDLE ImageHandle;
|
EFI_HANDLE ImageHandle;
|
||||||
|
UINT32 TimeoutValue;
|
||||||
|
|
||||||
ASSERT (Private != NULL);
|
ASSERT (Private != NULL);
|
||||||
|
|
||||||
|
//
|
||||||
|
// Get HTTP timeout value
|
||||||
|
//
|
||||||
|
TimeoutValue = PcdGet32 (PcdHttpIoTimeout);
|
||||||
|
|
||||||
ZeroMem (&ConfigData, sizeof (HTTP_IO_CONFIG_DATA));
|
ZeroMem (&ConfigData, sizeof (HTTP_IO_CONFIG_DATA));
|
||||||
if (!Private->UsingIpv6) {
|
if (!Private->UsingIpv6) {
|
||||||
ConfigData.Config4.HttpVersion = HttpVersion11;
|
ConfigData.Config4.HttpVersion = HttpVersion11;
|
||||||
ConfigData.Config4.RequestTimeOut = HTTP_BOOT_REQUEST_TIMEOUT;
|
ConfigData.Config4.RequestTimeOut = TimeoutValue;
|
||||||
IP4_COPY_ADDRESS (&ConfigData.Config4.LocalIp, &Private->StationIp.v4);
|
IP4_COPY_ADDRESS (&ConfigData.Config4.LocalIp, &Private->StationIp.v4);
|
||||||
IP4_COPY_ADDRESS (&ConfigData.Config4.SubnetMask, &Private->SubnetMask.v4);
|
IP4_COPY_ADDRESS (&ConfigData.Config4.SubnetMask, &Private->SubnetMask.v4);
|
||||||
ImageHandle = Private->Ip4Nic->ImageHandle;
|
ImageHandle = Private->Ip4Nic->ImageHandle;
|
||||||
} else {
|
} else {
|
||||||
ConfigData.Config6.HttpVersion = HttpVersion11;
|
ConfigData.Config6.HttpVersion = HttpVersion11;
|
||||||
ConfigData.Config6.RequestTimeOut = HTTP_BOOT_REQUEST_TIMEOUT;
|
ConfigData.Config6.RequestTimeOut = TimeoutValue;
|
||||||
IP6_COPY_ADDRESS (&ConfigData.Config6.LocalIp, &Private->StationIp.v6);
|
IP6_COPY_ADDRESS (&ConfigData.Config6.LocalIp, &Private->StationIp.v6);
|
||||||
ImageHandle = Private->Ip6Nic->ImageHandle;
|
ImageHandle = Private->Ip6Nic->ImageHandle;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/** @file
|
/** @file
|
||||||
Declaration of the boot file download function.
|
Declaration of the boot file download function.
|
||||||
|
|
||||||
Copyright (c) 2015 - 2018, Intel Corporation. All rights reserved.<BR>
|
Copyright (c) 2015 - 2021, Intel Corporation. All rights reserved.<BR>
|
||||||
(C) Copyright 2016 Hewlett Packard Enterprise Development LP<BR>
|
(C) Copyright 2016 Hewlett Packard Enterprise Development LP<BR>
|
||||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||||
|
|
||||||
|
@ -10,12 +10,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||||
#ifndef __EFI_HTTP_BOOT_HTTP_H__
|
#ifndef __EFI_HTTP_BOOT_HTTP_H__
|
||||||
#define __EFI_HTTP_BOOT_HTTP_H__
|
#define __EFI_HTTP_BOOT_HTTP_H__
|
||||||
|
|
||||||
#define HTTP_BOOT_REQUEST_TIMEOUT 5000 // 5 seconds in uints of millisecond.
|
|
||||||
#define HTTP_BOOT_RESPONSE_TIMEOUT 5000 // 5 seconds in uints of millisecond.
|
|
||||||
#define HTTP_BOOT_BLOCK_SIZE 1500
|
#define HTTP_BOOT_BLOCK_SIZE 1500
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#define HTTP_USER_AGENT_EFI_HTTP_BOOT "UefiHttpBoot/1.0"
|
#define HTTP_USER_AGENT_EFI_HTTP_BOOT "UefiHttpBoot/1.0"
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
## @file
|
## @file
|
||||||
# This modules produce the Load File Protocol for UEFI HTTP boot.
|
# This modules produce the Load File Protocol for UEFI HTTP boot.
|
||||||
#
|
#
|
||||||
# Copyright (c) 2015 - 2018, Intel Corporation. All rights reserved.<BR>
|
# Copyright (c) 2015 - 2021, Intel Corporation. All rights reserved.<BR>
|
||||||
# (C) Copyright 2020 Hewlett-Packard Development Company, L.P.<BR>
|
# (C) Copyright 2020 Hewlett-Packard Development Company, L.P.<BR>
|
||||||
# SPDX-License-Identifier: BSD-2-Clause-Patent
|
# SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||||
#
|
#
|
||||||
|
@ -96,6 +96,7 @@
|
||||||
|
|
||||||
[Pcd]
|
[Pcd]
|
||||||
gEfiNetworkPkgTokenSpaceGuid.PcdAllowHttpConnections ## CONSUMES
|
gEfiNetworkPkgTokenSpaceGuid.PcdAllowHttpConnections ## CONSUMES
|
||||||
|
gEfiNetworkPkgTokenSpaceGuid.PcdHttpIoTimeout ## CONSUMES
|
||||||
|
|
||||||
[UserExtensions.TianoCore."ExtraFiles"]
|
[UserExtensions.TianoCore."ExtraFiles"]
|
||||||
HttpBootDxeExtra.uni
|
HttpBootDxeExtra.uni
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
## @file
|
## @file
|
||||||
# Implementation of EFI HTTP protocol interfaces.
|
# Implementation of EFI HTTP protocol interfaces.
|
||||||
#
|
#
|
||||||
# Copyright (c) 2015 - 2018, Intel Corporation. All rights reserved.<BR>
|
# Copyright (c) 2015 - 2021, Intel Corporation. All rights reserved.<BR>
|
||||||
#
|
#
|
||||||
# SPDX-License-Identifier: BSD-2-Clause-Patent
|
# SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||||
#
|
#
|
||||||
|
@ -73,6 +73,7 @@
|
||||||
|
|
||||||
[Pcd]
|
[Pcd]
|
||||||
gEfiNetworkPkgTokenSpaceGuid.PcdAllowHttpConnections ## CONSUMES
|
gEfiNetworkPkgTokenSpaceGuid.PcdAllowHttpConnections ## CONSUMES
|
||||||
|
gEfiNetworkPkgTokenSpaceGuid.PcdHttpIoTimeout ## CONSUMES
|
||||||
|
|
||||||
[UserExtensions.TianoCore."ExtraFiles"]
|
[UserExtensions.TianoCore."ExtraFiles"]
|
||||||
HttpDxeExtra.uni
|
HttpDxeExtra.uni
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/** @file
|
/** @file
|
||||||
Implementation of EFI_HTTP_PROTOCOL protocol interfaces.
|
Implementation of EFI_HTTP_PROTOCOL protocol interfaces.
|
||||||
|
|
||||||
Copyright (c) 2015 - 2018, Intel Corporation. All rights reserved.<BR>
|
Copyright (c) 2015 - 2021, Intel Corporation. All rights reserved.<BR>
|
||||||
(C) Copyright 2015-2016 Hewlett Packard Enterprise Development LP<BR>
|
(C) Copyright 2015-2016 Hewlett Packard Enterprise Development LP<BR>
|
||||||
|
|
||||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||||
|
@ -983,6 +983,7 @@ HttpResponseWorker (
|
||||||
HTTP_TOKEN_WRAP *ValueInItem;
|
HTTP_TOKEN_WRAP *ValueInItem;
|
||||||
UINTN HdrLen;
|
UINTN HdrLen;
|
||||||
NET_FRAGMENT Fragment;
|
NET_FRAGMENT Fragment;
|
||||||
|
UINT32 TimeoutValue;
|
||||||
|
|
||||||
if (Wrap == NULL || Wrap->HttpInstance == NULL) {
|
if (Wrap == NULL || Wrap->HttpInstance == NULL) {
|
||||||
return EFI_INVALID_PARAMETER;
|
return EFI_INVALID_PARAMETER;
|
||||||
|
@ -1052,10 +1053,15 @@ HttpResponseWorker (
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Get HTTP timeout value
|
||||||
|
//
|
||||||
|
TimeoutValue = PcdGet32 (PcdHttpIoTimeout);
|
||||||
|
|
||||||
//
|
//
|
||||||
// Start the timer, and wait Timeout seconds to receive the header packet.
|
// Start the timer, and wait Timeout seconds to receive the header packet.
|
||||||
//
|
//
|
||||||
Status = gBS->SetTimer (HttpInstance->TimeoutEvent, TimerRelative, HTTP_RESPONSE_TIMEOUT * TICKS_PER_SECOND);
|
Status = gBS->SetTimer (HttpInstance->TimeoutEvent, TimerRelative, TimeoutValue * TICKS_PER_MS);
|
||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
goto Error;
|
goto Error;
|
||||||
}
|
}
|
||||||
|
@ -1329,10 +1335,15 @@ HttpResponseWorker (
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Get HTTP timeout value
|
||||||
|
//
|
||||||
|
TimeoutValue = PcdGet32 (PcdHttpIoTimeout);
|
||||||
|
|
||||||
//
|
//
|
||||||
// Start the timer, and wait Timeout seconds to receive the body packet.
|
// Start the timer, and wait Timeout seconds to receive the body packet.
|
||||||
//
|
//
|
||||||
Status = gBS->SetTimer (HttpInstance->TimeoutEvent, TimerRelative, HTTP_RESPONSE_TIMEOUT * TICKS_PER_SECOND);
|
Status = gBS->SetTimer (HttpInstance->TimeoutEvent, TimerRelative, TimeoutValue * TICKS_PER_MS);
|
||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
goto Error2;
|
goto Error2;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/** @file
|
/** @file
|
||||||
The header files of miscellaneous routines for HttpDxe driver.
|
The header files of miscellaneous routines for HttpDxe driver.
|
||||||
|
|
||||||
Copyright (c) 2015 - 2018, Intel Corporation. All rights reserved.<BR>
|
Copyright (c) 2015 - 2021, Intel Corporation. All rights reserved.<BR>
|
||||||
(C) Copyright 2016 Hewlett Packard Enterprise Development LP<BR>
|
(C) Copyright 2016 Hewlett Packard Enterprise Development LP<BR>
|
||||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||||
|
|
||||||
|
@ -41,7 +41,6 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||||
#define HTTP_BUFFER_SIZE_DEAULT 65535
|
#define HTTP_BUFFER_SIZE_DEAULT 65535
|
||||||
#define HTTP_MAX_SYN_BACK_LOG 5
|
#define HTTP_MAX_SYN_BACK_LOG 5
|
||||||
#define HTTP_CONNECTION_TIMEOUT 60
|
#define HTTP_CONNECTION_TIMEOUT 60
|
||||||
#define HTTP_RESPONSE_TIMEOUT 5
|
|
||||||
#define HTTP_DATA_RETRIES 12
|
#define HTTP_DATA_RETRIES 12
|
||||||
#define HTTP_FIN_TIMEOUT 2
|
#define HTTP_FIN_TIMEOUT 2
|
||||||
#define HTTP_KEEP_ALIVE_PROBES 6
|
#define HTTP_KEEP_ALIVE_PROBES 6
|
||||||
|
|
|
@ -97,10 +97,6 @@
|
||||||
# @Prompt Max size of total HTTP chunk transfer. the default value is 12MB.
|
# @Prompt Max size of total HTTP chunk transfer. the default value is 12MB.
|
||||||
gEfiNetworkPkgTokenSpaceGuid.PcdMaxHttpChunkTransfer|0x0C00000|UINT32|0x0000000E
|
gEfiNetworkPkgTokenSpaceGuid.PcdMaxHttpChunkTransfer|0x0C00000|UINT32|0x0000000E
|
||||||
|
|
||||||
## The Timeout value of HTTP IO.
|
|
||||||
# @Prompt The Timeout value of HTTP Io. Default value is 5000.
|
|
||||||
gEfiNetworkPkgTokenSpaceGuid.PcdHttpIoTimeout|5000|UINT32|0x0000000F
|
|
||||||
|
|
||||||
[PcdsFixedAtBuild, PcdsPatchableInModule]
|
[PcdsFixedAtBuild, PcdsPatchableInModule]
|
||||||
## Indicates whether HTTP connections (i.e., unsecured) are permitted or not.
|
## Indicates whether HTTP connections (i.e., unsecured) are permitted or not.
|
||||||
# TRUE - HTTP connections are allowed. Both the "https://" and "http://" URI schemes are permitted.
|
# TRUE - HTTP connections are allowed. Both the "https://" and "http://" URI schemes are permitted.
|
||||||
|
@ -160,5 +156,9 @@
|
||||||
# 0x00 = PXE Disabled
|
# 0x00 = PXE Disabled
|
||||||
gEfiNetworkPkgTokenSpaceGuid.PcdIPv6PXESupport|0x01|UINT8|0x1000000a
|
gEfiNetworkPkgTokenSpaceGuid.PcdIPv6PXESupport|0x01|UINT8|0x1000000a
|
||||||
|
|
||||||
|
## The Timeout value of HTTP IO.
|
||||||
|
# @Prompt The Timeout value of HTTP Io. Default value is 5000.
|
||||||
|
gEfiNetworkPkgTokenSpaceGuid.PcdHttpIoTimeout|5000|UINT32|0x0000000F
|
||||||
|
|
||||||
[UserExtensions.TianoCore."ExtraFiles"]
|
[UserExtensions.TianoCore."ExtraFiles"]
|
||||||
NetworkPkgExtra.uni
|
NetworkPkgExtra.uni
|
||||||
|
|
|
@ -87,6 +87,9 @@
|
||||||
gEfiMdePkgTokenSpaceGuid.PcdDebugPropertyMask|0x2f
|
gEfiMdePkgTokenSpaceGuid.PcdDebugPropertyMask|0x2f
|
||||||
gEfiMdePkgTokenSpaceGuid.PcdDebugPrintErrorLevel|0x80000000
|
gEfiMdePkgTokenSpaceGuid.PcdDebugPrintErrorLevel|0x80000000
|
||||||
|
|
||||||
|
[PcdsDynamicDefault]
|
||||||
|
gEfiNetworkPkgTokenSpaceGuid.PcdHttpIoTimeout|5000
|
||||||
|
|
||||||
###################################################################################################
|
###################################################################################################
|
||||||
#
|
#
|
||||||
# Components Section - list of the modules and components that will be processed by compilation
|
# Components Section - list of the modules and components that will be processed by compilation
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
//
|
//
|
||||||
// This package provides network modules that conform to UEFI 2.4 specification.
|
// This package provides network modules that conform to UEFI 2.4 specification.
|
||||||
//
|
//
|
||||||
// Copyright (c) 2009 - 2019, Intel Corporation. All rights reserved.<BR>
|
// Copyright (c) 2009 - 2021, Intel Corporation. All rights reserved.<BR>
|
||||||
//
|
//
|
||||||
// SPDX-License-Identifier: BSD-2-Clause-Patent
|
// SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||||
//
|
//
|
||||||
|
@ -105,3 +105,9 @@
|
||||||
#string STR_gEfiNetworkPkgTokenSpaceGuid_PcdTftpBlockSize_HELP #language en-US "This setting can override the default TFTP block size. A value of 0 computes "
|
#string STR_gEfiNetworkPkgTokenSpaceGuid_PcdTftpBlockSize_HELP #language en-US "This setting can override the default TFTP block size. A value of 0 computes "
|
||||||
"the default from MTU information. A non-zero value will be used as block size "
|
"the default from MTU information. A non-zero value will be used as block size "
|
||||||
"in bytes."
|
"in bytes."
|
||||||
|
|
||||||
|
#string STR_gEfiNetworkPkgTokenSpaceGuid_PcdHttpIoTimeout_PROMPT #language en-US "HTTP Boot Image Request and Response Timeout"
|
||||||
|
|
||||||
|
#string STR_gEfiNetworkPkgTokenSpaceGuid_PcdHttpIoTimeout_HELP #language en-US "This value is used to configure the request and response timeout when getting "
|
||||||
|
"the recovery image from the remote source during an HTTP recovery boot."
|
||||||
|
"The default value set is 5 seconds."
|
||||||
|
|
Loading…
Reference in New Issue