diff options
author | Zachary Clark-Williams <zachary.clark-williams@intel.com> | 2021-07-28 20:16:13 +0800 |
---|---|---|
committer | mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> | 2021-07-28 16:19:19 +0000 |
commit | ac70e71b1ffc823e5eec80b0cba04750860728b7 (patch) | |
tree | 85977eeb3eb6b3ed26ff240659bebb3411d78b34 /NetworkPkg/HttpDxe | |
parent | 147f34b56ce0e2e18285ef7d0695753ac0aa5085 (diff) | |
download | edk2-ac70e71b1ffc823e5eec80b0cba04750860728b7.tar.gz edk2-ac70e71b1ffc823e5eec80b0cba04750860728b7.tar.bz2 edk2-ac70e71b1ffc823e5eec80b0cba04750860728b7.zip |
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>
Diffstat (limited to 'NetworkPkg/HttpDxe')
-rw-r--r-- | NetworkPkg/HttpDxe/HttpDxe.inf | 3 | ||||
-rw-r--r-- | NetworkPkg/HttpDxe/HttpImpl.c | 17 | ||||
-rw-r--r-- | NetworkPkg/HttpDxe/HttpProto.h | 3 |
3 files changed, 17 insertions, 6 deletions
diff --git a/NetworkPkg/HttpDxe/HttpDxe.inf b/NetworkPkg/HttpDxe/HttpDxe.inf index 35fe31af18..8dd3838793 100644 --- a/NetworkPkg/HttpDxe/HttpDxe.inf +++ b/NetworkPkg/HttpDxe/HttpDxe.inf @@ -1,7 +1,7 @@ ## @file
# 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
#
@@ -73,6 +73,7 @@ [Pcd]
gEfiNetworkPkgTokenSpaceGuid.PcdAllowHttpConnections ## CONSUMES
+ gEfiNetworkPkgTokenSpaceGuid.PcdHttpIoTimeout ## CONSUMES
[UserExtensions.TianoCore."ExtraFiles"]
HttpDxeExtra.uni
diff --git a/NetworkPkg/HttpDxe/HttpImpl.c b/NetworkPkg/HttpDxe/HttpImpl.c index 5a6ecbc9d9..8790e9b4e0 100644 --- a/NetworkPkg/HttpDxe/HttpImpl.c +++ b/NetworkPkg/HttpDxe/HttpImpl.c @@ -1,7 +1,7 @@ /** @file
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>
SPDX-License-Identifier: BSD-2-Clause-Patent
@@ -983,6 +983,7 @@ HttpResponseWorker ( HTTP_TOKEN_WRAP *ValueInItem;
UINTN HdrLen;
NET_FRAGMENT Fragment;
+ UINT32 TimeoutValue;
if (Wrap == NULL || Wrap->HttpInstance == NULL) {
return EFI_INVALID_PARAMETER;
@@ -1053,9 +1054,14 @@ HttpResponseWorker ( }
//
+ // Get HTTP timeout value
+ //
+ TimeoutValue = PcdGet32 (PcdHttpIoTimeout);
+
+ //
// 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)) {
goto Error;
}
@@ -1330,9 +1336,14 @@ HttpResponseWorker ( }
//
+ // Get HTTP timeout value
+ //
+ TimeoutValue = PcdGet32 (PcdHttpIoTimeout);
+
+ //
// 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)) {
goto Error2;
}
diff --git a/NetworkPkg/HttpDxe/HttpProto.h b/NetworkPkg/HttpDxe/HttpProto.h index 00ba26aca4..6b3e49090e 100644 --- a/NetworkPkg/HttpDxe/HttpProto.h +++ b/NetworkPkg/HttpDxe/HttpProto.h @@ -1,7 +1,7 @@ /** @file
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>
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_MAX_SYN_BACK_LOG 5
#define HTTP_CONNECTION_TIMEOUT 60
-#define HTTP_RESPONSE_TIMEOUT 5
#define HTTP_DATA_RETRIES 12
#define HTTP_FIN_TIMEOUT 2
#define HTTP_KEEP_ALIVE_PROBES 6
|