From nobody Tue Apr 30 16:01:24 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+78186+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+78186+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1627354891; cv=none; d=zohomail.com; s=zohoarc; b=lzdemr74/7A9pQg3qqcQCFnGVc96QeP1rD77miqAWjEqYUNoyqcElMnKlbtaQPthdxqclFjOrphkTFbSQzBwXZC4roQMYlO1PjGIEnaVy1BFv1cbplARFTq8SuoIdRmeRmcD2BToIFumvKrLaEHUV99kppMH9CJrcFId5zSwYhA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1627354891; h=Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Sender:Subject:To; bh=BchwpHw0a4w/c9FnadtF/NUlE3d7tRo3EPtkx6gXk98=; b=kcH//HsXSX52EwSAkbNAFsE/vKaJcWBqNjCqgYUIJipdj2lcJaVC+Yny9d3QVRVpV3ux94DdIae9JWhFK++LyXbZfPqys2uDOV0q0g1hBLdotdsLlZinqpKrtX6r7NOOZkEEv+jwUP7If1/K5NGcc37YHqaef0E3fQtxTAMYKds= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+78186+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1627354891070917.825570102419; Mon, 26 Jul 2021 20:01:31 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id vbeEYY1788612xqAB5OYmj86; Mon, 26 Jul 2021 20:01:30 -0700 X-Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by mx.groups.io with SMTP id smtpd.web09.6442.1627354889586173525 for ; Mon, 26 Jul 2021 20:01:29 -0700 X-IronPort-AV: E=McAfee;i="6200,9189,10057"; a="276145665" X-IronPort-AV: E=Sophos;i="5.84,272,1620716400"; d="scan'208";a="276145665" X-Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Jul 2021 20:01:28 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.84,272,1620716400"; d="scan'208";a="505299960" X-Received: from hengluo-dev.ccr.corp.intel.com ([10.239.153.158]) by FMSMGA003.fm.intel.com with ESMTP; 26 Jul 2021 20:01:26 -0700 From: "Heng Luo" To: devel@edk2.groups.io Cc: Zachary Clark-Williams , Maciej Rabeda , Jiaxin Wu , Siyuan Fu Subject: [edk2-devel] [PATCH] NetworkPkg: Making the HTTP IO timeout value programmable with PCD Date: Tue, 27 Jul 2021 11:01:13 +0800 Message-Id: <20210727030113.925-1-heng.luo@intel.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,heng.luo@intel.com X-Gm-Message-State: LinWdK2zswCI8I68H2XpkeE8x1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1627354890; bh=eAnLEus/23+p2Sn3UlRuvC00yXcLLXM9vG/Abl+HDWw=; h=Cc:Date:From:Reply-To:Subject:To; b=u4aD3WuGetjPIQPF2h59GXe/UiEJHcALJuIoIXmhoCwIb/O/Jf2CQY2aQz+nnMgaIHu pTAyHuBUNpDThnrj8IWprxBqy40OE3YAuDkNNDA/i9PkeO12jAiUrXD1RKM9pAEKGcs66 PawOeklODxFCYHigP0V3scBqo2ggAZV0R54= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1627354892080100001 Content-Type: text/plain; charset="utf-8" From: Zachary Clark-Williams 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 Cc: Maciej Rabeda Cc: Jiaxin Wu Cc: Siyuan Fu --- NetworkPkg/HttpBootDxe/HttpBootClient.c | 12 +++++++++--- NetworkPkg/HttpBootDxe/HttpBootClient.h | 7 +------ NetworkPkg/HttpBootDxe/HttpBootDxe.inf | 3 ++- NetworkPkg/HttpDxe/HttpDxe.inf | 3 ++- NetworkPkg/HttpDxe/HttpImpl.c | 17 ++++++++++++++--- NetworkPkg/HttpDxe/HttpProto.h | 3 +-- NetworkPkg/NetworkPkg.dec | 8 ++++---- NetworkPkg/NetworkPkg.dsc | 3 +++ NetworkPkg/NetworkPkg.uni | 8 +++++++- 9 files changed, 43 insertions(+), 21 deletions(-) diff --git a/NetworkPkg/HttpBootDxe/HttpBootClient.c b/NetworkPkg/HttpBootD= xe/HttpBootClient.c index 8f21f7766e..aa0a153019 100644 --- a/NetworkPkg/HttpBootDxe/HttpBootClient.c +++ b/NetworkPkg/HttpBootDxe/HttpBootClient.c @@ -1,7 +1,7 @@ /** @file Implementation of the boot file download function. =20 -Copyright (c) 2015 - 2018, Intel Corporation. All rights reserved.
+Copyright (c) 2015 - 2021, Intel Corporation. All rights reserved.
(C) Copyright 2016 Hewlett Packard Enterprise Development LP
SPDX-License-Identifier: BSD-2-Clause-Patent =20 @@ -596,19 +596,25 @@ HttpBootCreateHttpIo ( HTTP_IO_CONFIG_DATA ConfigData; EFI_STATUS Status; EFI_HANDLE ImageHandle; + UINT32 TimeoutValue; =20 ASSERT (Private !=3D NULL); =20 + // + // Get HTTP timeout value + // + TimeoutValue =3D PcdGet32 (PcdHttpIoTimeout); + ZeroMem (&ConfigData, sizeof (HTTP_IO_CONFIG_DATA)); if (!Private->UsingIpv6) { ConfigData.Config4.HttpVersion =3D HttpVersion11; - ConfigData.Config4.RequestTimeOut =3D HTTP_BOOT_REQUEST_TIMEOUT; + ConfigData.Config4.RequestTimeOut =3D TimeoutValue; IP4_COPY_ADDRESS (&ConfigData.Config4.LocalIp, &Private->StationIp.v4); IP4_COPY_ADDRESS (&ConfigData.Config4.SubnetMask, &Private->SubnetMask= .v4); ImageHandle =3D Private->Ip4Nic->ImageHandle; } else { ConfigData.Config6.HttpVersion =3D HttpVersion11; - ConfigData.Config6.RequestTimeOut =3D HTTP_BOOT_REQUEST_TIMEOUT; + ConfigData.Config6.RequestTimeOut =3D TimeoutValue; IP6_COPY_ADDRESS (&ConfigData.Config6.LocalIp, &Private->StationIp.v6); ImageHandle =3D Private->Ip6Nic->ImageHandle; } diff --git a/NetworkPkg/HttpBootDxe/HttpBootClient.h b/NetworkPkg/HttpBootD= xe/HttpBootClient.h index 971b2dc800..3a98f0f557 100644 --- a/NetworkPkg/HttpBootDxe/HttpBootClient.h +++ b/NetworkPkg/HttpBootDxe/HttpBootClient.h @@ -1,7 +1,7 @@ /** @file Declaration of the boot file download function. =20 -Copyright (c) 2015 - 2018, Intel Corporation. All rights reserved.
+Copyright (c) 2015 - 2021, Intel Corporation. All rights reserved.
(C) Copyright 2016 Hewlett Packard Enterprise Development LP
SPDX-License-Identifier: BSD-2-Clause-Patent =20 @@ -10,12 +10,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent #ifndef __EFI_HTTP_BOOT_HTTP_H__ #define __EFI_HTTP_BOOT_HTTP_H__ =20 -#define HTTP_BOOT_REQUEST_TIMEOUT 5000 // 5 seconds in uin= ts of millisecond. -#define HTTP_BOOT_RESPONSE_TIMEOUT 5000 // 5 seconds in uin= ts of millisecond. #define HTTP_BOOT_BLOCK_SIZE 1500 - - - #define HTTP_USER_AGENT_EFI_HTTP_BOOT "UefiHttpBoot/1.0" =20 // diff --git a/NetworkPkg/HttpBootDxe/HttpBootDxe.inf b/NetworkPkg/HttpBootDx= e/HttpBootDxe.inf index a27a561722..f4f80caccc 100644 --- a/NetworkPkg/HttpBootDxe/HttpBootDxe.inf +++ b/NetworkPkg/HttpBootDxe/HttpBootDxe.inf @@ -1,7 +1,7 @@ ## @file # This modules produce the Load File Protocol for UEFI HTTP boot. # -# Copyright (c) 2015 - 2018, Intel Corporation. All rights reserved.
+# Copyright (c) 2015 - 2021, Intel Corporation. All rights reserved.
# (C) Copyright 2020 Hewlett-Packard Development Company, L.P.
# SPDX-License-Identifier: BSD-2-Clause-Patent # @@ -96,6 +96,7 @@ =20 [Pcd] gEfiNetworkPkgTokenSpaceGuid.PcdAllowHttpConnections ## CONSUMES + gEfiNetworkPkgTokenSpaceGuid.PcdHttpIoTimeout ## CONSUMES =20 [UserExtensions.TianoCore."ExtraFiles"] HttpBootDxeExtra.uni 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.
+# Copyright (c) 2015 - 2021, Intel Corporation. All rights reserved.
# # SPDX-License-Identifier: BSD-2-Clause-Patent # @@ -73,6 +73,7 @@ =20 [Pcd] gEfiNetworkPkgTokenSpaceGuid.PcdAllowHttpConnections ## CONSUMES + gEfiNetworkPkgTokenSpaceGuid.PcdHttpIoTimeout ## CONSUMES =20 [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. =20 - Copyright (c) 2015 - 2018, Intel Corporation. All rights reserved.
+ Copyright (c) 2015 - 2021, Intel Corporation. All rights reserved.
(C) Copyright 2015-2016 Hewlett Packard Enterprise Development LP
=20 SPDX-License-Identifier: BSD-2-Clause-Patent @@ -983,6 +983,7 @@ HttpResponseWorker ( HTTP_TOKEN_WRAP *ValueInItem; UINTN HdrLen; NET_FRAGMENT Fragment; + UINT32 TimeoutValue; =20 if (Wrap =3D=3D NULL || Wrap->HttpInstance =3D=3D NULL) { return EFI_INVALID_PARAMETER; @@ -1052,10 +1053,15 @@ HttpResponseWorker ( } } =20 + // + // Get HTTP timeout value + // + TimeoutValue =3D PcdGet32 (PcdHttpIoTimeout); + // // Start the timer, and wait Timeout seconds to receive the header pac= ket. // - Status =3D gBS->SetTimer (HttpInstance->TimeoutEvent, TimerRelative, H= TTP_RESPONSE_TIMEOUT * TICKS_PER_SECOND); + Status =3D gBS->SetTimer (HttpInstance->TimeoutEvent, TimerRelative, T= imeoutValue * TICKS_PER_MS); if (EFI_ERROR (Status)) { goto Error; } @@ -1329,10 +1335,15 @@ HttpResponseWorker ( } } =20 + // + // Get HTTP timeout value + // + TimeoutValue =3D PcdGet32 (PcdHttpIoTimeout); + // // Start the timer, and wait Timeout seconds to receive the body packe= t. // - Status =3D gBS->SetTimer (HttpInstance->TimeoutEvent, TimerRelative, H= TTP_RESPONSE_TIMEOUT * TICKS_PER_SECOND); + Status =3D gBS->SetTimer (HttpInstance->TimeoutEvent, TimerRelative, T= imeoutValue * 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. =20 -Copyright (c) 2015 - 2018, Intel Corporation. All rights reserved.
+Copyright (c) 2015 - 2021, Intel Corporation. All rights reserved.
(C) Copyright 2016 Hewlett Packard Enterprise Development LP
SPDX-License-Identifier: BSD-2-Clause-Patent =20 @@ -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 diff --git a/NetworkPkg/NetworkPkg.dec b/NetworkPkg/NetworkPkg.dec index b81f10ef6e..3e1f5c101d 100644 --- a/NetworkPkg/NetworkPkg.dec +++ b/NetworkPkg/NetworkPkg.dec @@ -97,10 +97,6 @@ # @Prompt Max size of total HTTP chunk transfer. the default value is 12= MB. gEfiNetworkPkgTokenSpaceGuid.PcdMaxHttpChunkTransfer|0x0C00000|UINT32|0x= 0000000E =20 - ## The Timeout value of HTTP IO. - # @Prompt The Timeout value of HTTP Io. Default value is 5000. - gEfiNetworkPkgTokenSpaceGuid.PcdHttpIoTimeout|5000|UINT32|0x0000000F - [PcdsFixedAtBuild, PcdsPatchableInModule] ## 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. @@ -160,5 +156,9 @@ # 0x00 =3D PXE Disabled gEfiNetworkPkgTokenSpaceGuid.PcdIPv6PXESupport|0x01|UINT8|0x1000000a =20 + ## 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"] NetworkPkgExtra.uni diff --git a/NetworkPkg/NetworkPkg.dsc b/NetworkPkg/NetworkPkg.dsc index 5e6619ad85..04685a844d 100644 --- a/NetworkPkg/NetworkPkg.dsc +++ b/NetworkPkg/NetworkPkg.dsc @@ -87,6 +87,9 @@ gEfiMdePkgTokenSpaceGuid.PcdDebugPropertyMask|0x2f gEfiMdePkgTokenSpaceGuid.PcdDebugPrintErrorLevel|0x80000000 =20 +[PcdsDynamic] + gEfiNetworkPkgTokenSpaceGuid.PcdHttpTimeout|5000 + ##########################################################################= ######################### # # Components Section - list of the modules and components that will be pro= cessed by compilation diff --git a/NetworkPkg/NetworkPkg.uni b/NetworkPkg/NetworkPkg.uni index 328d8cb54a..6d0fa67c6f 100644 --- a/NetworkPkg/NetworkPkg.uni +++ b/NetworkPkg/NetworkPkg.uni @@ -3,7 +3,7 @@ // // This package provides network modules that conform to UEFI 2.4 specific= ation. // -// Copyright (c) 2009 - 2019, Intel Corporation. All rights reserved.
+// Copyright (c) 2009 - 2021, Intel Corporation. All rights reserved.
// // 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 " = "the default from MTU information. A non-zero value will be used as= block size " = "in bytes." + +#string STR_gEfiNetworkPkgTokenSpaceGuid_PcdHttpIoTimeout_PROMPT #languag= e 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 whe= n getting " + = "the recovery image from the remote source during an HTTP recovery boo= t." + = "The default value set is 5 seconds." --=20 2.31.1.windows.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#78186): https://edk2.groups.io/g/devel/message/78186 Mute This Topic: https://groups.io/mt/84474434/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-