From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by spool.mail.gandi.net (Postfix) with ESMTPS id D8E5E740034 for ; Thu, 4 Jan 2024 02:32:51 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=dPBTOT/MOn/lupUmXleb46VLw3s18v0aws/gFRY0rHI=; c=relaxed/simple; d=groups.io; h=ARC-Seal:ARC-Message-Signature:ARC-Authentication-Results:Received-SPF:From:To:CC:Subject:Date:Message-ID:MIME-Version:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Transfer-Encoding:Content-Type; s=20140610; t=1704335570; v=1; b=MxAiESGyesqBEYV6+2VQswo9RBOYiWmGc+1Ccd01HoMinUXzYgUmaF4RcngbZ3qg7ZYPdqS2 jWAX/spbxC3uQtnjr6+pzWvXmrpQ2tlE5U3v6ch18KQ8jPl/I1d0PqjXWTuqD+wSUV1Dxnm2slC dbVMEKiOEmdJc7yuVb0DGxH8= X-Received: by 127.0.0.2 with SMTP id ZlNrYY7687511x1OzB1EGknh; Wed, 03 Jan 2024 18:32:50 -0800 X-Received: from NAM10-MW2-obe.outbound.protection.outlook.com (NAM10-MW2-obe.outbound.protection.outlook.com [40.107.94.53]) by mx.groups.io with SMTP id smtpd.web10.46018.1704335569879334601 for ; Wed, 03 Jan 2024 18:32:50 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=LURUcw0DpQUFmkUl2iPbWerpzV6LVqKiHvtx5UaPfe8cVu3beAZ5Qt09GgvhFEL1IGM7ZRmMNZvR4RJPi5rto/4mDPSdf8H6cSO7RUIx7u6AAzjKCNLSXBBulwhPB90TkE9We4iCUvHjl4xp4383UxZ+GE8XovV2xef4rNiQaJozjcb8cN6NMt5OuGSb0sO7eTIVt/OC/O6EoClN6fsv1IR6t39KTO3zwP9G12yNYIcMp5KJVWlSg751Q7Lsu6+cv6q0fm+JHijNoLTi6c5oU+lwBI24saORL7/Dr4roVfP1GoFscfxejeYfCxymTEotONiywO0QMbDudawz4cRDVw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=K9ykCE8ddI+cgnORAA2acJj4sJYYXAdRaUm5FYuyDj8=; b=fU58kgbcAXxvKI0DDcVYz73YSw+Fn1GmSZykm/R/rZQLCzEJ0sFhV0iAOTVT9Kav9Q5fKig1EPKLhgSf7OwRHNYyLwYeFUCh48kESrAwDQcG/JY7awvo1lPRsa+pgrHrQUNNloBXAtcNXUwLWOecfwzJNxtuG2kJ6xxzpLQd+TfD2tcU4Mxkiyrggy2exQxg+SNW5qRGOXyc6GHmFhbz8079Hf5FL01kjBuvyY5Cqgc3XikQhgQTGMC05b7aloUse9qch4MwdSCj1omSRCPQ9LtKQjM4o0F4x/0axdwMTgEepjFTKIQgdtU0jkEvLc4FbKsSCKT3fFfIdShOL2L44w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.161) smtp.rcpttodomain=edk2.groups.io smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none (0) X-Received: from CH2PR17CA0017.namprd17.prod.outlook.com (2603:10b6:610:53::27) by IA1PR12MB7662.namprd12.prod.outlook.com (2603:10b6:208:425::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7135.25; Thu, 4 Jan 2024 02:32:46 +0000 X-Received: from DS2PEPF00003441.namprd04.prod.outlook.com (2603:10b6:610:53:cafe::20) by CH2PR17CA0017.outlook.office365.com (2603:10b6:610:53::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7159.13 via Frontend Transport; Thu, 4 Jan 2024 02:32:46 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.161) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.117.161 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.161; helo=mail.nvidia.com; pr=C X-Received: from mail.nvidia.com (216.228.117.161) by DS2PEPF00003441.mail.protection.outlook.com (10.167.17.68) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7159.9 via Frontend Transport; Thu, 4 Jan 2024 02:32:46 +0000 X-Received: from rnnvmail202.nvidia.com (10.129.68.7) by mail.nvidia.com (10.129.200.67) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.41; Wed, 3 Jan 2024 18:32:37 -0800 X-Received: from rnnvmail204.nvidia.com (10.129.68.6) by rnnvmail202.nvidia.com (10.129.68.7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.41; Wed, 3 Jan 2024 18:32:36 -0800 X-Received: from NV-CL38DL3.nvidia.com (10.127.8.10) by mail.nvidia.com (10.129.68.6) with Microsoft SMTP Server id 15.2.986.41 via Frontend Transport; Wed, 3 Jan 2024 18:32:35 -0800 From: "Nickle Wang via groups.io" To: CC: Abner Chang , Igor Kulchytskyy , "Nick Ramirez" Subject: [edk2-devel] [edk2-redfish-client][PATCH v2 09/10] RedfishClientPkg/RedfishVersionLib: use HTTP cache lib Date: Thu, 4 Jan 2024 10:32:35 +0800 Message-ID: <20240104023235.11378-1-nicklew@nvidia.com> MIME-Version: 1.0 X-NVConfidentiality: public X-NV-OnPremToCloud: ExternallySecured X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS2PEPF00003441:EE_|IA1PR12MB7662:EE_ X-MS-Office365-Filtering-Correlation-Id: 6c976f70-18c2-4030-bc7c-08dc0ccd6fff X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Message-Info: dQBoe978oFzS8Tn6xy3ZqLRJ53kN136lA+9ORAHSGzbcUvCmHbPMfrhKSydfNlVuuiAjNX7DqUjTCNNqdLQ/ZjjP6GVHMS6q/0B3LGdHwRl7bHw5djF6pYxLbpFriVy2jjYodqgOUv4EhQm/x34+dV79z9Qa5RnN7gqexKLOSRraH7QP4kLMM737tJ3mbS8Zzimb7HFC5dQ6PElZTfNwqacg9o6ZErAJ1eNVTaMSE1N7nJvf2X8qiWmCnsKfaDFUZQp9/oa/HrJuA2WJ0qHzgROffLg2eAXImDBPZPVhGqSK6IuTJ4qKEiq959WzsuJLs1/0rAhVZiTcxgXY6uNbZwB877/d8D521a3yyr7xI2Bqrr3JAHUF/WnwIlTXog6S9jcvdQLsmHus5Sx2M8xpGu0BRQxY0b7sJ/J1e9tlxJSSi8yldz81VJ3rKY5SD1c4Pj9sfTU5AMu2kfTbNOiu/weNOzbIkkRgDlkQ/v4afirpFjNtj8Q3dxwE1iisrI20UXV0o84LaC6mw/Y8gi1DW6sAVTQhnfC2USga5fgxHeZSpA8TH3+0QP+ZAsR9X62zBuTlTUgHMUgDjXBuN23UceYP2HkZMi8RguoZYMHhwpxwUacx45wM4IIqsD4xw+Wqfjfbn3CnNB5l25QO1Q5HEzMXwARYTxfMinVANTJMfTeSuXs1DfuoAIccDHxQAmZTHQzezOTgaLBsLeZHfIrJtLzkF5/I/DcaPjGG2CqCf4FhSHG0y0ulywozft8ITHbH X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Jan 2024 02:32:46.5221 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 6c976f70-18c2-4030-bc7c-08dc0ccd6fff X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[216.228.117.161];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: DS2PEPF00003441.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA1PR12MB7662 Precedence: Bulk 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,nicklew@nvidia.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: Eu3TxBqCr89qEpVWfQOVuiGxx7686176AA= Content-Transfer-Encoding: quoted-printable Content-Type: text/plain X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20140610 header.b=MxAiESGy; dmarc=none; spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce@groups.io; arc=reject ("signature check failed: fail, {[1] = sig:microsoft.com:reject}") Use Redfish Http cache library to query Redfish service. Signed-off-by: Nickle Wang Cc: Abner Chang Cc: Igor Kulchytskyy Cc: Nick Ramirez --- .../RedfishVersionLib/RedfishVersionLib.inf | 3 ++ .../Include/Library/RedfishVersionLib.h | 5 +-- .../RedfishVersionLib/RedfishVersionLib.c | 32 +++++++++++++------ 3 files changed, 29 insertions(+), 11 deletions(-) diff --git a/RedfishClientPkg/Library/RedfishVersionLib/RedfishVersionLib.i= nf b/RedfishClientPkg/Library/RedfishVersionLib/RedfishVersionLib.inf index 34d13d64..10e335af 100644 --- a/RedfishClientPkg/Library/RedfishVersionLib/RedfishVersionLib.inf +++ b/RedfishClientPkg/Library/RedfishVersionLib/RedfishVersionLib.inf @@ -1,6 +1,7 @@ ## @file # # (C) Copyright 2022 Hewlett Packard Enterprise Development LP
+# Copyright (c) 2024, NVIDIA CORPORATION & AFFILIATES. All rights reserve= d. # # SPDX-License-Identifier: BSD-2-Clause-Patent # @@ -31,11 +32,13 @@ =20 [LibraryClasses] BaseLib + BaseMemoryLib DebugLib MemoryAllocationLib PcdLib RedfishLib JsonLib + RedfishHttpCacheLib =20 [Protocols] =20 diff --git a/RedfishClientPkg/Include/Library/RedfishVersionLib.h b/Redfish= ClientPkg/Include/Library/RedfishVersionLib.h index 319f22bd..baa6283b 100644 --- a/RedfishClientPkg/Include/Library/RedfishVersionLib.h +++ b/RedfishClientPkg/Include/Library/RedfishVersionLib.h @@ -2,6 +2,7 @@ This file defines the Redfish version Library interface. =20 (C) Copyright 2022 Hewlett Packard Enterprise Development LP
+ Copyright (c) 2024, NVIDIA CORPORATION & AFFILIATES. All rights reserved= . =20 SPDX-License-Identifier: BSD-2-Clause-Patent =20 @@ -11,8 +12,8 @@ #define REDFISH_VERSION_LIB_H_ =20 /** - Query HTTP request to BMC with given redfish service and return redfish - version information. If there is troulbe to get Redfish version on BMC, + Query HTTP request to redfish service and return redfish + version information. If there is trouble to get Redfish version on servi= ce, The value of PcdDefaultRedfishVersion is returned. =20 It's call responsibility to release returned buffer. diff --git a/RedfishClientPkg/Library/RedfishVersionLib/RedfishVersionLib.c= b/RedfishClientPkg/Library/RedfishVersionLib/RedfishVersionLib.c index bcaca3c7..82869376 100644 --- a/RedfishClientPkg/Library/RedfishVersionLib/RedfishVersionLib.c +++ b/RedfishClientPkg/Library/RedfishVersionLib/RedfishVersionLib.c @@ -2,6 +2,7 @@ Redfish version library implementation =20 (C) Copyright 2022 Hewlett Packard Enterprise Development LP
+ Copyright (c) 2024, NVIDIA CORPORATION & AFFILIATES. All rights reserved= . =20 SPDX-License-Identifier: BSD-2-Clause-Patent =20 @@ -10,15 +11,17 @@ #include #include #include +#include #include #include #include #include #include #include +#include =20 #define REDFISH_VERSION_DEFAULT_STRING L"v1" -#define REDFISH_ROOT_URI "/redfish" +#define REDFISH_ROOT_URI L"/redfish" =20 REDFISH_SERVICE *mCacheService; EFI_STRING mVersionCache; @@ -26,7 +29,7 @@ UINTN mVersionStringSize; =20 /** Cache the redfish service version for later use so we don't have to quer= y - HTTP request everytime. + HTTP request every time. =20 @param[in] Service Redfish service instance @param[in] Version Version string to cache @@ -65,8 +68,8 @@ CacheVersion ( } =20 /** - Query HTTP request to BMC with given redfish service and return redfish - version information. If there is troulbe to get Redfish version on BMC, + Query HTTP request to redfish service and return redfish + version information. If there is trouble to get Redfish version on servi= ce, The value of PcdDefaultRedfishVersion is returned. =20 It's call responsibility to release returned buffer. @@ -90,6 +93,7 @@ RedfishGetVersion ( EDKII_JSON_VALUE Value; =20 VersionString =3D NULL; + ZeroMem (&Response, sizeof (REDFISH_RESPONSE)); =20 if (Service =3D=3D NULL) { goto ON_ERROR; @@ -105,13 +109,14 @@ RedfishGetVersion ( // // Get resource from redfish service. // - Status =3D RedfishGetByUri ( + Status =3D RedfishHttpGetResource ( Service, REDFISH_ROOT_URI, - &Response + &Response, + TRUE ); if (EFI_ERROR (Status)) { - DEBUG ((DEBUG_ERROR, "%a, RedfishGetByService to %a failed: %r\n", __f= unc__, REDFISH_ROOT_URI, Status)); + DEBUG ((DEBUG_ERROR, "%a, RedfishGetByService to %s failed: %r\n", __f= unc__, REDFISH_ROOT_URI, Status)); if (Response.Payload !=3D NULL) { RedfishDumpPayload (Response.Payload); RedfishFreeResponse ( @@ -151,18 +156,27 @@ ON_ERROR: VersionString =3D REDFISH_VERSION_DEFAULT_STRING; } =20 + if (Response.Payload !=3D NULL) { + RedfishFreeResponse ( + Response.StatusCode, + Response.HeaderCount, + Response.Headers, + Response.Payload + ); + } + DEBUG ((DEBUG_MANAGEABILITY, "%a: Redfish version - %s\n", __func__, Ver= sionString)); return AllocateCopyPool (StrSize (VersionString), VersionString); } =20 /** =20 - Initial redfish version library instace. + Initial redfish version library instate. =20 @param[in] ImageHandle The image handle. @param[in] SystemTable The system table. =20 - @retval EFI_SUCEESS Install Boot manager menu success. + @retval EFI_SUCCESS Install Boot manager menu success. @retval Other Return error status. =20 **/ --=20 2.34.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 (#113123): https://edk2.groups.io/g/devel/message/113123 Mute This Topic: https://groups.io/mt/103516021/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-