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 2C0DCD80127 for ; Thu, 4 Jan 2024 02:32:56 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=spTNP6gPY7iac2NlUItAkrAjcj/7CaWqnwOP2zpxEX4=; 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=1704335574; v=1; b=cGSTydMDGO8xU/lXVhVACj2Mt+2xBbedYufR6u5o+NSWGPsX4HL4ssLzP8aqe5rP6s8Hlmo+ B5LR6veJoGIRpIeCjxGUFJuNEax85puhCgmG1eunbxGiWYPKbEvBG0V+sCmcu5THj6/sW4WUOTY ieyrRsAI8/ba63M8yiLhNU6I= X-Received: by 127.0.0.2 with SMTP id HkRpYY7687511xUxnfEyBSxd; Wed, 03 Jan 2024 18:32:54 -0800 X-Received: from NAM12-BN8-obe.outbound.protection.outlook.com (NAM12-BN8-obe.outbound.protection.outlook.com [40.107.237.84]) by mx.groups.io with SMTP id smtpd.web11.45889.1704335574042545194 for ; Wed, 03 Jan 2024 18:32:54 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=L2An7bS9JXNXxbd8uQilCyVTiOrSLOVqB3DCP+6ITAOorcMO03rm2NMLHWhaQ/zjGdzMj1MTuV3y44sc/KW/XJ2g6Q28LA4XahBf/2IYIsF5FVqvaj8Z5tNzSoeBKeyLszbeVDOwMgakNmaswT1O9DsmPYYcyWomdbJWvo9+uKaz3Z5J3Pn4q3md99rWTr/Xchz1IlNstDwHPVCPk1gV9NT911j/2oDskZjnq53RGeDDlVl6XTygZjEandZHmv/9o91usYKdeVRrFADc8rbgVeMArPa6zr/avQ2bE5n4+plFxE8zVl2itUspuIm2nUKAVXoWHWZXo9a+17K4/kiVRQ== 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=AYf99gQIm7CHlDELborF5LuR7DX/s8sEhbHe0TDvuaU=; b=BOjkgkDYPaYsje4aFAh+wXIeXDzDkB8X+04w0LA21OiVQDoXmU9MFODAZ8N1sa+TH4Tyd25UKEJL8+B2cSmqu8a5EFHCrSz+wgRWBIwb3sgbNdsXkiG3e/6WXU9yZbvHFocW4JrIso3ztTL3CNReBuywogRDcDtBv5WsQx+ebm/AzKkKj69uwBUW2hbLuYYS/jNggx9jRp1c6pPgDkywl1gJBOhss/NFX0J2YYZTD2+vWqWnu4OIOvhMHD+f2ql1v6G6TY0bM7/GdhTi6EVvcbK7pDLsXU2ckcb8BHyJwk6TW/nNva5K2yiY774KhklR4VOYGdqVYtnAheZY7Yhe8Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.118.233) 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 DM6PR02CA0140.namprd02.prod.outlook.com (2603:10b6:5:332::7) by SJ0PR12MB6943.namprd12.prod.outlook.com (2603:10b6:a03:44b::11) 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:50 +0000 X-Received: from CY4PEPF0000EE32.namprd05.prod.outlook.com (2603:10b6:5:332:cafe::46) by DM6PR02CA0140.outlook.office365.com (2603:10b6:5:332::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7135.25 via Frontend Transport; Thu, 4 Jan 2024 02:32:50 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.118.233) 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.118.233 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.118.233; helo=mail.nvidia.com; pr=C X-Received: from mail.nvidia.com (216.228.118.233) by CY4PEPF0000EE32.mail.protection.outlook.com (10.167.242.38) 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:50 +0000 X-Received: from drhqmail202.nvidia.com (10.126.190.181) by mail.nvidia.com (10.127.129.6) 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:48 -0800 X-Received: from drhqmail201.nvidia.com (10.126.190.180) by drhqmail202.nvidia.com (10.126.190.181) 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:48 -0800 X-Received: from NV-CL38DL3.nvidia.com (10.127.8.10) by mail.nvidia.com (10.126.190.180) with Microsoft SMTP Server id 15.2.986.41 via Frontend Transport; Wed, 3 Jan 2024 18:32:47 -0800 From: "Nickle Wang via groups.io" To: CC: Abner Chang , Igor Kulchytskyy , "Nick Ramirez" Subject: [edk2-devel] [edk2-redfish-client][PATCH v2 10/10] RedfishClientPkg/RedfishFeatureUtilityLib: use HTTP cache lib Date: Thu, 4 Jan 2024 10:32:46 +0800 Message-ID: <20240104023246.11466-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: CY4PEPF0000EE32:EE_|SJ0PR12MB6943:EE_ X-MS-Office365-Filtering-Correlation-Id: 874cff16-1334-41a5-45fc-08dc0ccd7251 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Message-Info: VdEeWt7XxGJgdYi357ch3pP2+Ki4fO+ZemcWmVImuTd4wL31IiXWLnMMScLGwCQqfX7RaIHKJ8HJpqa0FXFkIMBhu3n6w1y7SCY9OE+ga04mPWjThj09UkIiCk0kfNb2merKtR0sYwp/bggPbhzWRpHNYNCDdNwsHp8QyejpZ/mPzlcFWq5KtSoKThJ5GVn/Qqz36TMTX6LElPXiLNKfGXYOQUHKjQv1/Tzf/TLGA7z1Hxb4jyZl6qLkurGve5FL7kw1vJ1iU1QuXvwGMbykziCaYxsOB3iLByhPxcwVvXmwuZJmcW8ycc/7ybQlyQpebdjOvIcaV+ODaigCvrl3nesovYE01bmwqEHJFylqNgJXxFOYhxlfckUwGWnTAGrt3oIWGcsMEbt1+WULNlVCltRSCa2U5yCJPdkb+a0kJUFi+ZRgS8NCIkgRJY/R8DQ18H/cz/FMh/CacgHzuWZ2LFT4SpfxjkZYKo0NQ8Qlqqo5CUP6j/8nXRXg+4Sbe/ikALkj/a0zemz7kkj6gFyLO/x8yA82ldyfeswK0d1vTzNeaG1vR/YF5w9Al1xhJAwSH9ff9zqf6xsZHRlK41d5JEZYD0056FoaVc9ebHEXN8OgljM20j+ADxRjBvh+6VcYxhJLCMBpgy3iw2/Qo6F1t742DF8mYVA4rNpJ2u3eM5zeJdDTtvyBhwGqROwZKwXTM7hM0bXdJuv8IMeuwtSiiQ6noEmR8Rib6cu1+hdflZpltpaFU6JGCCRqrQYz34S3 X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Jan 2024 02:32:50.4588 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 874cff16-1334-41a5-45fc-08dc0ccd7251 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[216.228.118.233];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: CY4PEPF0000EE32.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR12MB6943 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: GehivIt0uAuhiZa84To0YUGzx7686176AA= 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=cGSTydMD; spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce@groups.io; dmarc=none; 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 | 73 ++----------------- 4 files changed, 12 insertions(+), 88 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..cad91a41 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; @@ -887,8 +888,8 @@ ApplyFeatureSettingsStringArrayType ( } =20 // - // Validate input string array from BMC to see: - // 1) String array from BMC is valid or not. + // Validate input string array from Redfish service to see: + // 1) String array from Redfish service is valid or not. // 2) If there is no change in array, do nothing. // Status =3D ValidateRedfishStringArrayValues (ArrayHead, RedfishValue.Val= ue.StringArray, RedfishValue.ArrayCount, &ValueChanged); @@ -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; @@ -3889,7 +3830,7 @@ ValidateRedfishStringArrayValues ( // CharArrayBuffer is not the same as the StringArray at Index. So= the // value is changed. But we still have to go through StringArray t= o see // if CharArrayBuffer can be found in StringArray or not. If not, = Head - // is invalid input from BMC. + // is invalid input from Redfish service. // for (ArrayIndex =3D FirstMismatch; ArrayIndex < ArraySize; ArrayIn= dex++) { if (AsciiStrCmp (StringArray[ArrayIndex], CharArrayBuffer->Array= Value) =3D=3D 0) { --=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 (#113124): https://edk2.groups.io/g/devel/message/113124 Mute This Topic: https://groups.io/mt/103516022/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-