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 01A7B74004A for ; Wed, 3 Jan 2024 12:01:38 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=byDboVOrpI7SWOJyIOBhpuBFvHeQshsF3NJ5obNId6M=; 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=1704283297; v=1; b=M+Mv74D5BV85++KBr6zdp5xmxIAMDo91PZADxjMamUFgWi2TcuN3A8+be9/ibp5I0gi6ACQT teLm15u+VplrcA8+vv3+Qwp0Fqj7unuNywxDNqHk0N7doNMWyeBnFafXs/Y2zdpbTi5ajNOmJi8 T0QrLk5RC2dEpOeKjsb7tCwE= X-Received: by 127.0.0.2 with SMTP id DHByYY7687511xS9zJnzKT70; Wed, 03 Jan 2024 04:01:37 -0800 X-Received: from NAM04-MW2-obe.outbound.protection.outlook.com (NAM04-MW2-obe.outbound.protection.outlook.com [40.107.101.51]) by mx.groups.io with SMTP id smtpd.web11.15931.1704283297055645262 for ; Wed, 03 Jan 2024 04:01:37 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=nzt66PmvpPt1NHfFKaq2SCgS7XVM2/RWiiEsSk7ass9z5miCxHsHHW4qZ8ucouskl5nkuEzcMjFluMoezvDxFZRGOlOVx1HuTMfrlIgW97OGPi8kXnPvLfKvlWAN6si11b8j6OQOt1qtL0Qr7lhKjd4XyLP6x5ZCU35pBoQADRbjq5JCaaTC4dD8Tq043a5HhxxIAMJzWlLXda6fwWSH7aJbs2Wi7wdRBH8jgZaqTjuIiMI041VxO+Wt42Feu+4GVrt5Y8XRdI1HgaleSdrs27O8nEPR/RpJ7iUXgpJ+xteNALqQyBddKKiyCuukkJ20/ZfPhnLjd6tJCgCtZf1xlQ== 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=dVhDUQQUctZJT9dl9Av1yODAXXKLE/sLk7iY8Ivx21M=; b=HWiwnirGKZDy3IWcoZmU2YpVAOEI+BUhdY9RSIPQkadj5fmXSeOCKiG4CWMW2nExrZt+mCrS+NZrS82cCVUU5uraTrBjmQUw49yk/DJ3iQJquG/HQ8K9Apt5VAqK3BiXq9+XRA9Kw6qUd8ZlBXUoG3vcp98zCKJAKiuF38lF1jH0vFNHWKF5ydAEzQ8LxwWtaAbZJ2sWqjXplAyt3MZHIOL7tvkJpooRnqLTDPHH2bjj7tHwJjIB2GZAgbYyZ0EAHnzMSWhEt3w6qCKK2ckmablFpfqOfK+nIC0O05I+rXUQLEbKOz1nS0JVZt2rfzyXtAoigPwACmXnh87Iq3WNeQ== 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 CY5PR15CA0136.namprd15.prod.outlook.com (2603:10b6:930:68::24) by BL1PR12MB5994.namprd12.prod.outlook.com (2603:10b6:208:39a::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7135.25; Wed, 3 Jan 2024 12:01:33 +0000 X-Received: from CY4PEPF0000EDD1.namprd03.prod.outlook.com (2603:10b6:930:68:cafe::a2) by CY5PR15CA0136.outlook.office365.com (2603:10b6:930:68::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7159.13 via Frontend Transport; Wed, 3 Jan 2024 12:01:32 +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 CY4PEPF0000EDD1.mail.protection.outlook.com (10.167.241.205) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7159.9 via Frontend Transport; Wed, 3 Jan 2024 12:01:32 +0000 X-Received: from rnnvmail205.nvidia.com (10.129.68.10) 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 04:01:21 -0800 X-Received: from rnnvmail205.nvidia.com (10.129.68.10) by rnnvmail205.nvidia.com (10.129.68.10) 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 04:01:20 -0800 X-Received: from NV-CL38DL3.nvidia.com (10.127.8.13) by mail.nvidia.com (10.129.68.10) with Microsoft SMTP Server id 15.2.986.41 via Frontend Transport; Wed, 3 Jan 2024 04:01:19 -0800 From: "Nickle Wang via groups.io" To: CC: Abner Chang , Igor Kulchytskyy , "Nick Ramirez" Subject: [edk2-devel] [edk2-redfish-client][PATCH 10/10] RedfishClientPkg/RedfishFeatureUtilityLib: use HTTP cache lib Date: Wed, 3 Jan 2024 20:01:19 +0800 Message-ID: <20240103120119.62406-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: CY4PEPF0000EDD1:EE_|BL1PR12MB5994:EE_ X-MS-Office365-Filtering-Correlation-Id: e921961c-04ad-4ada-5747-08dc0c53ba6b X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Message-Info: 37nK6GyIgVCTJ+XFQqVVpiuR4tXiyymw2M33cI8WvlhrIF9YCenMa/URUxUPucUXU1R1WpCJfW7ce88RvvguZOgmycV5O24Z4qgEzFbIenijsC5/pAnww8ekRsiW8un66P4XxdKejUyKbRjkIgwQYel+LpJNSIlpSTngPcSrFwzS8toydSr6Fbt4J+oR3IXngS20/b7Rnn/WFkqWpU7Y0u471pVWvf1vAwgDI7sZ7/oSD30o9T5DvXXbDrAb5mB8QixRxgrId9AUSAstA5/tZN3tF+PahkQNKzAG6AI3syopWRJbCx/Wvn1INOkwsod0bn8qJzuwJ2x6z4cmmj0/4PUViMZ/wgsh93oCWRs+iz6Ub9lAcUuZ2SFdpAo5jyPjKHhhTJmO0XM7oO2so1+7fNegpKqpa8oC7wG4X2lsDbNkfwZ2VI3pJ7Z77ud9v6UyhZcgOOHph7feN9gYIsji58qsnqorIwjERX1GTSzNKewaes98ricw1TxOvFTRvnKPTQ0ZP15zre4gwtUOP3iwUuRISEiGU8OEVMEAVEaTCClAiFLUlXur5CcWmMvYsHRF2LbwI/ezSQU7iZNWSTfdwAdsuLX+rRkPvLxwknATUiqep1B+aQxEDN85IN3w0lU5BLNZTJZhx3Qi49tWMqGLAZ2blkb5tSv4NPBYsVpaVyaXVb3L/m2SRC+tkoeZMSHsqH2g1JQMA9n3X0KUXpDGZT2oYvaYEKNj2AqsG+DcIHjhRhhS4Uk0ubxk9Co3wltc X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Jan 2024 12:01:32.8089 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: e921961c-04ad-4ada-5747-08dc0c53ba6b 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: CY4PEPF0000EDD1.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL1PR12MB5994 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: nSPjq1EqgWchsWFQ7rywO9htx7686176AA= 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=M+Mv74D5; 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 --- .../RedfishFeatureUtilityLib.inf | 3 +- .../Library/RedfishFeatureUtilityLib.h | 21 +----- .../RedfishFeatureUtilityInternal.h | 3 +- .../RedfishFeatureUtilityLib.c | 67 ++----------------- 4 files changed, 9 insertions(+), 85 deletions(-) diff --git a/RedfishClientPkg/Library/RedfishFeatureUtilityLib/RedfishFeatu= reUtilityLib.inf b/RedfishClientPkg/Library/RedfishFeatureUtilityLib/Redfis= hFeatureUtilityLib.inf index fd66b8ac..718273b2 100644 --- a/RedfishClientPkg/Library/RedfishFeatureUtilityLib/RedfishFeatureUtili= tyLib.inf +++ b/RedfishClientPkg/Library/RedfishFeatureUtilityLib/RedfishFeatureUtili= tyLib.inf @@ -2,7 +2,7 @@ # INF for Redfish feature utility library. # # (C) Copyright 2020-2022 Hewlett Packard Enterprise Development LP
-# Copyright (c) 2023, NVIDIA CORPORATION & AFFILIATES. All rights reserve= d. +# Copyright (c) 2023-2024, NVIDIA CORPORATION & AFFILIATES. All rights re= served. # # SPDX-License-Identifier: BSD-2-Clause-Patent # @@ -46,6 +46,7 @@ PrintLib HttpLib RedfishDebugLib + RedfishHttpCacheLib =20 [Protocols] gEdkIIRedfishETagProtocolGuid ## CONSUMED ## diff --git a/RedfishClientPkg/Include/Library/RedfishFeatureUtilityLib.h b/= RedfishClientPkg/Include/Library/RedfishFeatureUtilityLib.h index 24f0ad24..9513a656 100644 --- a/RedfishClientPkg/Include/Library/RedfishFeatureUtilityLib.h +++ b/RedfishClientPkg/Include/Library/RedfishFeatureUtilityLib.h @@ -2,7 +2,7 @@ This file defines the Redfish Feature Utility Library interface. =20 (C) Copyright 2021-2022 Hewlett Packard Enterprise Development LP
- Copyright (c) 2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved= . + Copyright (c) 2023-2024, NVIDIA CORPORATION & AFFILIATES. All rights res= erved. =20 SPDX-License-Identifier: BSD-2-Clause-Patent =20 @@ -18,25 +18,6 @@ =20 #define REDFISH_ENABLE_SYSTEM_REBOOT() PcdSetBoolS(PcdRedfishSystemReboot= Required, TRUE) =20 -/** - - Read redfish resource by given resource URI. - - @param[in] Service Redfish service instance to make query. - @param[in] ResourceUri Target resource URI. - @param[out] Response HTTP response from redfish service. - - @retval EFI_SUCCESS Resrouce is returned successfully. - @retval Others Errors occur. - -**/ -EFI_STATUS -GetResourceByUri ( - IN REDFISH_SERVICE *Service, - IN EFI_STRING ResourceUri, - OUT REDFISH_RESPONSE *Response - ); - /** =20 Check if this is the Redpath array. Usually the Redpath array represents diff --git a/RedfishClientPkg/Library/RedfishFeatureUtilityLib/RedfishFeatu= reUtilityInternal.h b/RedfishClientPkg/Library/RedfishFeatureUtilityLib/Red= fishFeatureUtilityInternal.h index 5d39984c..b4cfca03 100644 --- a/RedfishClientPkg/Library/RedfishFeatureUtilityLib/RedfishFeatureUtili= tyInternal.h +++ b/RedfishClientPkg/Library/RedfishFeatureUtilityLib/RedfishFeatureUtili= tyInternal.h @@ -2,7 +2,7 @@ Common header file for RedfishFeatureUtilityLib driver. =20 (C) Copyright 2020-2022 Hewlett Packard Enterprise Development LP
- Copyright (c) 2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved= . + Copyright (c) 2023-2024, NVIDIA CORPORATION & AFFILIATES. All rights res= erved. =20 SPDX-License-Identifier: BSD-2-Clause-Patent =20 @@ -30,6 +30,7 @@ #include #include #include +#include =20 #include =20 diff --git a/RedfishClientPkg/Library/RedfishFeatureUtilityLib/RedfishFeatu= reUtilityLib.c b/RedfishClientPkg/Library/RedfishFeatureUtilityLib/RedfishF= eatureUtilityLib.c index 01c054ae..34868a13 100644 --- a/RedfishClientPkg/Library/RedfishFeatureUtilityLib/RedfishFeatureUtili= tyLib.c +++ b/RedfishClientPkg/Library/RedfishFeatureUtilityLib/RedfishFeatureUtili= tyLib.c @@ -2,7 +2,7 @@ Redfish feature utility library implementation =20 (C) Copyright 2020-2022 Hewlett Packard Enterprise Development LP
- Copyright (c) 2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved= . + Copyright (c) 2023-2024, NVIDIA CORPORATION & AFFILIATES. All rights res= erved. =20 SPDX-License-Identifier: BSD-2-Clause-Patent =20 @@ -147,7 +147,8 @@ SetEtagFromUri ( return Status; } =20 - Status =3D GetResourceByUri (RedfishService, Uri, &Response); + ZeroMem (&Response, sizeof (Response)); + Status =3D RedfishHttpGetResource (RedfishService, Uri, &Response, TRUE)= ; if (EFI_ERROR (Status)) { DEBUG ((DEBUG_ERROR, "%a: get resource from: %s failed\n", __func__, U= ri)); return Status; @@ -1163,66 +1164,6 @@ ApplyFeatureSettingsBooleanArrayType ( return Status; } =20 -/** - - Read redfish resource by given resource URI. - - @param[in] Service Redfish service instance to make query. - @param[in] ResourceUri Target resource URI. - @param[out] Response HTTP response from redfish service. - - @retval EFI_SUCCESS Resrouce is returned successfully. - @retval Others Errors occur. - -**/ -EFI_STATUS -GetResourceByUri ( - IN REDFISH_SERVICE *Service, - IN EFI_STRING ResourceUri, - OUT REDFISH_RESPONSE *Response - ) -{ - EFI_STATUS Status; - CHAR8 *AsciiResourceUri; - - if ((Service =3D=3D NULL) || (Response =3D=3D NULL) || IS_EMPTY_STRING (= ResourceUri)) { - return EFI_INVALID_PARAMETER; - } - - AsciiResourceUri =3D StrUnicodeToAscii (ResourceUri); - if (AsciiResourceUri =3D=3D NULL) { - return EFI_OUT_OF_RESOURCES; - } - - // - // Get resource from redfish service. - // - Status =3D RedfishGetByUri ( - Service, - AsciiResourceUri, - Response - ); - if (EFI_ERROR (Status)) { - DEBUG ((DEBUG_ERROR, "%a: RedfishGetByUri to %a failed: %r\n", __func_= _, AsciiResourceUri, Status)); - if (Response->Payload !=3D NULL) { - RedfishDumpPayload (Response->Payload); - RedfishFreeResponse ( - NULL, - 0, - NULL, - Response->Payload - ); - Response->Payload =3D NULL; - } - } - - if (AsciiResourceUri !=3D NULL) { - FreePool (AsciiResourceUri); - } - - return Status; -} - /** =20 Check if this is the Redpath array. Usually the Redpath array represents @@ -3704,7 +3645,7 @@ GetPendingSettings ( return EFI_NOT_FOUND; } =20 - Status =3D GetResourceByUri (RedfishService, *SettingUri, SettingRespo= nse); + Status =3D RedfishHttpGetResource (RedfishService, *SettingUri, Settin= gResponse, TRUE); if (EFI_ERROR (Status)) { DEBUG ((DEBUG_ERROR, "%a: @Redfish.Settings exists, get resource fro= m: %s failed: %r\n", __func__, *SettingUri, Status)); return Status; --=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 (#113080): https://edk2.groups.io/g/devel/message/113080 Mute This Topic: https://groups.io/mt/103500392/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-