summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrei Otcheretianski <andrei.otcheretianski@intel.com>2023-07-20 22:17:59 -0700
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>2023-09-08 20:49:49 +0000
commitb240eab03530f063ef5438497d70a731b19a201e (patch)
tree466b021754b7fe0d338edd4d226a8d3c370a07aa
parentd4ae5df71190148c902942c3462245e97ed2fcc8 (diff)
downloadedk2-b240eab03530f063ef5438497d70a731b19a201e.tar.gz
edk2-b240eab03530f063ef5438497d70a731b19a201e.tar.bz2
edk2-b240eab03530f063ef5438497d70a731b19a201e.zip
NetworkPkg: Increase HTTP buffer size and enable TCP window scaling
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4505 This gives something like ~3 fold throughput boost. Cc: Saloni Kasbekar <saloni.kasbekar@intel.com> Cc: Zachary Clark-williams <zachary.clark-williams@intel.com> Signed-off-by: Andrei Otcheretianski <andrei.otcheretianski@intel.com> Reviewed-by: Saloni Kasbekar <saloni.kasbekar@intel.com> Acked-by: Michael D Kinney <michael.d.kinney@intel.com>
-rw-r--r--NetworkPkg/HttpBootDxe/HttpBootClient.h2
-rw-r--r--NetworkPkg/HttpDxe/HttpProto.c48
-rw-r--r--NetworkPkg/HttpDxe/HttpProto.h2
3 files changed, 27 insertions, 25 deletions
diff --git a/NetworkPkg/HttpBootDxe/HttpBootClient.h b/NetworkPkg/HttpBootDxe/HttpBootClient.h
index 2fba713679..86a28bc91a 100644
--- a/NetworkPkg/HttpBootDxe/HttpBootClient.h
+++ b/NetworkPkg/HttpBootDxe/HttpBootClient.h
@@ -10,7 +10,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
#ifndef __EFI_HTTP_BOOT_HTTP_H__
#define __EFI_HTTP_BOOT_HTTP_H__
-#define HTTP_BOOT_BLOCK_SIZE 1500
+#define HTTP_BOOT_BLOCK_SIZE 32000
#define HTTP_USER_AGENT_EFI_HTTP_BOOT "UefiHttpBoot/1.0"
#define HTTP_BOOT_AUTHENTICATION_INFO_MAX_LEN 255
diff --git a/NetworkPkg/HttpDxe/HttpProto.c b/NetworkPkg/HttpDxe/HttpProto.c
index 33ae622c3f..7dfb82dd2e 100644
--- a/NetworkPkg/HttpDxe/HttpProto.c
+++ b/NetworkPkg/HttpDxe/HttpProto.c
@@ -1073,18 +1073,19 @@ HttpConfigureTcp4 (
Tcp4AP->ActiveFlag = TRUE;
IP4_COPY_ADDRESS (&Tcp4AP->RemoteAddress, &HttpInstance->RemoteAddr);
- Tcp4Option = Tcp4CfgData->ControlOption;
- Tcp4Option->ReceiveBufferSize = HTTP_BUFFER_SIZE_DEAULT;
- Tcp4Option->SendBufferSize = HTTP_BUFFER_SIZE_DEAULT;
- Tcp4Option->MaxSynBackLog = HTTP_MAX_SYN_BACK_LOG;
- Tcp4Option->ConnectionTimeout = HTTP_CONNECTION_TIMEOUT;
- Tcp4Option->DataRetries = HTTP_DATA_RETRIES;
- Tcp4Option->FinTimeout = HTTP_FIN_TIMEOUT;
- Tcp4Option->KeepAliveProbes = HTTP_KEEP_ALIVE_PROBES;
- Tcp4Option->KeepAliveTime = HTTP_KEEP_ALIVE_TIME;
- Tcp4Option->KeepAliveInterval = HTTP_KEEP_ALIVE_INTERVAL;
- Tcp4Option->EnableNagle = TRUE;
- Tcp4CfgData->ControlOption = Tcp4Option;
+ Tcp4Option = Tcp4CfgData->ControlOption;
+ Tcp4Option->ReceiveBufferSize = HTTP_BUFFER_SIZE_DEAULT;
+ Tcp4Option->SendBufferSize = HTTP_BUFFER_SIZE_DEAULT;
+ Tcp4Option->MaxSynBackLog = HTTP_MAX_SYN_BACK_LOG;
+ Tcp4Option->ConnectionTimeout = HTTP_CONNECTION_TIMEOUT;
+ Tcp4Option->DataRetries = HTTP_DATA_RETRIES;
+ Tcp4Option->FinTimeout = HTTP_FIN_TIMEOUT;
+ Tcp4Option->KeepAliveProbes = HTTP_KEEP_ALIVE_PROBES;
+ Tcp4Option->KeepAliveTime = HTTP_KEEP_ALIVE_TIME;
+ Tcp4Option->KeepAliveInterval = HTTP_KEEP_ALIVE_INTERVAL;
+ Tcp4Option->EnableNagle = TRUE;
+ Tcp4Option->EnableWindowScaling = TRUE;
+ Tcp4CfgData->ControlOption = Tcp4Option;
if ((HttpInstance->State == HTTP_STATE_TCP_CONNECTED) ||
(HttpInstance->State == HTTP_STATE_TCP_CLOSED))
@@ -1156,17 +1157,18 @@ HttpConfigureTcp6 (
IP6_COPY_ADDRESS (&Tcp6Ap->StationAddress, &HttpInstance->Ipv6Node.LocalAddress);
IP6_COPY_ADDRESS (&Tcp6Ap->RemoteAddress, &HttpInstance->RemoteIpv6Addr);
- Tcp6Option = Tcp6CfgData->ControlOption;
- Tcp6Option->ReceiveBufferSize = HTTP_BUFFER_SIZE_DEAULT;
- Tcp6Option->SendBufferSize = HTTP_BUFFER_SIZE_DEAULT;
- Tcp6Option->MaxSynBackLog = HTTP_MAX_SYN_BACK_LOG;
- Tcp6Option->ConnectionTimeout = HTTP_CONNECTION_TIMEOUT;
- Tcp6Option->DataRetries = HTTP_DATA_RETRIES;
- Tcp6Option->FinTimeout = HTTP_FIN_TIMEOUT;
- Tcp6Option->KeepAliveProbes = HTTP_KEEP_ALIVE_PROBES;
- Tcp6Option->KeepAliveTime = HTTP_KEEP_ALIVE_TIME;
- Tcp6Option->KeepAliveInterval = HTTP_KEEP_ALIVE_INTERVAL;
- Tcp6Option->EnableNagle = TRUE;
+ Tcp6Option = Tcp6CfgData->ControlOption;
+ Tcp6Option->ReceiveBufferSize = HTTP_BUFFER_SIZE_DEAULT;
+ Tcp6Option->SendBufferSize = HTTP_BUFFER_SIZE_DEAULT;
+ Tcp6Option->MaxSynBackLog = HTTP_MAX_SYN_BACK_LOG;
+ Tcp6Option->ConnectionTimeout = HTTP_CONNECTION_TIMEOUT;
+ Tcp6Option->DataRetries = HTTP_DATA_RETRIES;
+ Tcp6Option->FinTimeout = HTTP_FIN_TIMEOUT;
+ Tcp6Option->KeepAliveProbes = HTTP_KEEP_ALIVE_PROBES;
+ Tcp6Option->KeepAliveTime = HTTP_KEEP_ALIVE_TIME;
+ Tcp6Option->KeepAliveInterval = HTTP_KEEP_ALIVE_INTERVAL;
+ Tcp6Option->EnableNagle = TRUE;
+ Tcp6Option->EnableWindowScaling = TRUE;
if ((HttpInstance->State == HTTP_STATE_TCP_CONNECTED) ||
(HttpInstance->State == HTTP_STATE_TCP_CLOSED))
diff --git a/NetworkPkg/HttpDxe/HttpProto.h b/NetworkPkg/HttpDxe/HttpProto.h
index 620eb39158..012f1f4b46 100644
--- a/NetworkPkg/HttpDxe/HttpProto.h
+++ b/NetworkPkg/HttpDxe/HttpProto.h
@@ -37,7 +37,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
//
#define HTTP_TOS_DEAULT 8
#define HTTP_TTL_DEAULT 255
-#define HTTP_BUFFER_SIZE_DEAULT 65535
+#define HTTP_BUFFER_SIZE_DEAULT 0x200000
#define HTTP_MAX_SYN_BACK_LOG 5
#define HTTP_CONNECTION_TIMEOUT 60
#define HTTP_DATA_RETRIES 12