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 14F77AC12D4 for ; Wed, 3 Jan 2024 12:01:13 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=725CiD8E0uG/62m66JVEMhwp2EAnrFP5+Z+osQJ2NeM=; 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=1704283272; v=1; b=gkcv1ykZXSYdbrkzwf9KV9RKBrzkkNtwitQnFaFAhFV2zAAjds9Q77RcNOvo+H+kmnp6CxCS YTf4+FffKQFSD9NI13YvqTbhGzrSH+147l0KNNA+XcQ3CUKtG8oFmvimB0JKpoVcEBpo59zs5lW fFlPvMvE7TXu2vj9eQS6O/tg= X-Received: by 127.0.0.2 with SMTP id Tmy3YY7687511xzwFXZ0E7Hm; Wed, 03 Jan 2024 04:01:12 -0800 X-Received: from NAM10-MW2-obe.outbound.protection.outlook.com (NAM10-MW2-obe.outbound.protection.outlook.com [40.107.94.59]) by mx.groups.io with SMTP id smtpd.web10.15994.1704283272207966658 for ; Wed, 03 Jan 2024 04:01:12 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=WFQbayfyF40UfAWOoW91IXIyiRuiSKlQs02qZbIvrcwEgU9Mcvcd/PO2ew5qWKv7RP042nmXvH+ttUdfj5PC7/WrYYxf5aHzRTU6CXYpOJLFSxuyglx096TPKVRHruOg9nDIODJWIOAiZxU06rbwiLRUC3j6NZfz6SKtWzi0oy3MG6akardldEEqNVuYkPVgBXbX06cMBoiftrPUNV1rxUsDoef/iPa0lq3/Ko+4cd3oq5gJho7gg0CgDTjKpZLJOCFvEXqLo0VIitVeQxCAT7TX2X7UA/MWsPJuHm+VnXFl5iIGn1CKIo0y9KVOmJlWYISJE54fNpnwPl/PzV8+7A== 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=mEW1bv6n8BhVlaxZ3Eq0vKRSMoNnxnImjvhVLU67oIo=; b=EknX4dTGZudTDBqMT4j8fwMSdhxDp2P57HP8T7k6rY3yuInE5vOhwGwYuHLcbyaGE1qEZ6OY5A9XcpPjOZItWm8d8+5AhZXzuYtVRrq/I2NfqWq/Jq1mpuXbcfjxg23jEyFYb1LCFe353UXLoLOfqfnaNUVJTIg9UD7sF2c9tPtomsStucMJ1UIk+eBTWVxEm3nPV4xwoYBXag585aRxkB7x3u/OFGop+bzwTV0Us93Zx90u9TRYSZOEYtQ9wqKDD8GhJ8lSN4sSt/WIjI0zSDw10hHF12RDdb2W2OjBdj9790IMgWxyXupDiLcmo8QksnlVbFHDdsaaR614wnstNA== 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 DM6PR11CA0038.namprd11.prod.outlook.com (2603:10b6:5:14c::15) by PH7PR12MB6834.namprd12.prod.outlook.com (2603:10b6:510:1b4::18) 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:09 +0000 X-Received: from CY4PEPF0000EDD6.namprd03.prod.outlook.com (2603:10b6:5:14c:cafe::85) by DM6PR11CA0038.outlook.office365.com (2603:10b6:5:14c::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7135.20 via Frontend Transport; Wed, 3 Jan 2024 12:01:08 +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 CY4PEPF0000EDD6.mail.protection.outlook.com (10.167.241.210) 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:08 +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:00:58 -0800 X-Received: from rnnvmail203.nvidia.com (10.129.68.9) 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:00:58 -0800 X-Received: from NV-CL38DL3.nvidia.com (10.127.8.13) by mail.nvidia.com (10.129.68.9) with Microsoft SMTP Server id 15.2.986.41 via Frontend Transport; Wed, 3 Jan 2024 04:00:57 -0800 From: "Nickle Wang via groups.io" To: CC: Abner Chang , Igor Kulchytskyy , "Nick Ramirez" Subject: [edk2-devel] [edk2-redfish-client][PATCH 07/10] RedfishClientPkg/Bios: use HTTP cache lib Date: Wed, 3 Jan 2024 20:00:56 +0800 Message-ID: <20240103120056.62184-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: CY4PEPF0000EDD6:EE_|PH7PR12MB6834:EE_ X-MS-Office365-Filtering-Correlation-Id: 1c333b39-e0ac-4613-2714-08dc0c53ac13 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Message-Info: vNhfvVIu1lglZgTwghP8e4TFO1wwjTAAyU6JwG9uTiarJLHimYg4Zk7Da1st557ajmmDasBuc+0UDVFewSRD456Glxu3WQRmNkW43yTFm5tZo4T+q8q5Ct2I4m1C3nEoy6ZSKfGF/pt4HkQ2jV3TlfOSH7lbAe85cfnkGEMrmA7aKw1bAlwvJqW8vlSAv+9ifAtBwY+Pa6uO4LpbnhEWoOYeOjsBTX5QStsiU09rNSebwSME1Aqlr0e8D7jasFReXXNYsoUVcZ74WPPbBC9eloc2YpzG1HfGBixU/+C8z9KYlDIZwlcMOY/pVXpVU5rjBTNmC96JPwHHlZ85vjWq2oywcYNkiv9fpVWH99X3qKwXgh/mqk6WnSxfirGoXyCTsTr8c7tD5+w09x7fraIfKWvZl7RxqoExP9oc4p4GkKkooBb2L+tdo4SAkYC3XdeEqGueKsVqIfpKotPKS++RUBvp/Kg476RsqYJPJigmTmV52XiMPk+SaMSBhYnsG4so/U96i4yYpYohc/hlkK8VMybyCCxW87iLtf+bFxDANnU0tcCUHyU/5Qvy7/2haIlJQdllpsr21C7pcax0tBIIr7W/yw4ThrEscYiJoAts7V+vMRzkeWFZT1CdD5XIflnciIs15sp8lDrnwUk0llYqsu+ieTnCLyG20/0PXkmiakW3t1JNfRVr1I8hyv2hVaWvIyR93djtkJxWkJ9KTGp8W54zxV0m7ShzOtka7y89iXZ+11NE3zvtLATvapeY4rDg X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Jan 2024 12:01:08.7429 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 1c333b39-e0ac-4613-2714-08dc0c53ac13 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: CY4PEPF0000EDD6.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR12MB6834 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: E6B6g16qVP4u437y4L2do5eyx7686176AA= Content-Transfer-Encoding: quoted-printable Content-Type: text/plain X-Spam-Flag: yes X-Spam-Level: ************ X-GND-Spam-Score: 190 X-GND-Status: SPAM Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20140610 header.b=gkcv1ykZ; arc=reject ("signature check failed: fail, {[1] = sig:microsoft.com:reject}"); 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 Use Redfish Http cache library to query Redfish service. Signed-off-by: Nickle Wang Cc: Abner Chang Cc: Igor Kulchytskyy Cc: Nick Ramirez --- .../Features/Bios/v1_0_9/Dxe/BiosDxe.inf | 3 +- .../Features/Bios/v1_0_9/Dxe/BiosDxe.c | 80 ++++++++----------- 2 files changed, 37 insertions(+), 46 deletions(-) diff --git a/RedfishClientPkg/Features/Bios/v1_0_9/Dxe/BiosDxe.inf b/Redfis= hClientPkg/Features/Bios/v1_0_9/Dxe/BiosDxe.inf index 37346e50..6ba4c3cf 100644 --- a/RedfishClientPkg/Features/Bios/v1_0_9/Dxe/BiosDxe.inf +++ b/RedfishClientPkg/Features/Bios/v1_0_9/Dxe/BiosDxe.inf @@ -1,7 +1,7 @@ ## @file # # (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 # @@ -39,6 +39,7 @@ UefiLib UefiDriverEntryPoint RedfishAddendumLib + RedfishHttpCacheLib =20 [Protocols] gEdkIIRedfishConfigHandlerProtocolGuid ## PRODUCED diff --git a/RedfishClientPkg/Features/Bios/v1_0_9/Dxe/BiosDxe.c b/RedfishC= lientPkg/Features/Bios/v1_0_9/Dxe/BiosDxe.c index 85dc5461..09ed8b9a 100644 --- a/RedfishClientPkg/Features/Bios/v1_0_9/Dxe/BiosDxe.c +++ b/RedfishClientPkg/Features/Bios/v1_0_9/Dxe/BiosDxe.c @@ -2,7 +2,7 @@ Redfish feature driver implementation - Bios =20 (C) Copyright 2020-2022 Hewlett Packard Enterprise Development LP
- Copyright (c) 2022-2023, NVIDIA CORPORATION. All rights reserved. + Copyright (c) 2022-2024, NVIDIA CORPORATION. All rights reserved. =20 SPDX-License-Identifier: BSD-2-Clause-Patent =20 @@ -55,7 +55,8 @@ RedfishResourceProvisioningResource ( return EFI_NOT_READY; } =20 - Status =3D GetResourceByUri (Private->RedfishService, Uri, &Response); + ZeroMem (&Response, sizeof (Response)); + Status =3D RedfishHttpGetResource (Private->RedfishService, Uri, &Respon= se, TRUE); if (EFI_ERROR (Status)) { DEBUG ((DEBUG_ERROR, "%a, get resource from: %s failed\n", __func__, U= ri)); return Status; @@ -77,6 +78,7 @@ RedfishResourceProvisioningResource ( Response.Headers, Response.Payload ); + RedfishHttpResetResource (Uri); Private->Payload =3D NULL; } =20 @@ -103,13 +105,10 @@ RedfishResourceConsumeResource ( REDFISH_RESOURCE_COMMON_PRIVATE *Private; EFI_STATUS Status; REDFISH_RESPONSE Response; + EFI_STRING PendingSettingUri; + REDFISH_RESPONSE PendingSettingResponse; REDFISH_RESPONSE *ExpectedResponse; - REDFISH_RESPONSE RedfishSettingsResponse; CHAR8 *Etag; - UINTN Index; - EDKII_JSON_VALUE JsonValue; - EFI_STRING RedfishSettingsUri; - CONST CHAR8 *RedfishSettingsUriKeys[] =3D { "@Redfi= sh.Settings", "SettingsObject", "@odata.id" }; =20 if ((This =3D=3D NULL) || IS_EMPTY_STRING (Uri)) { return EFI_INVALID_PARAMETER; @@ -121,45 +120,32 @@ RedfishResourceConsumeResource ( return EFI_NOT_READY; } =20 - Status =3D GetResourceByUri (Private->RedfishService, Uri, &Response); + ZeroMem (&Response, sizeof (Response)); + Status =3D RedfishHttpGetResource (Private->RedfishService, Uri, &Respon= se, TRUE); if (EFI_ERROR (Status)) { DEBUG ((DEBUG_ERROR, "%a, get resource from: %s failed\n", __func__, U= ri)); return Status; } =20 - ZeroMem (&RedfishSettingsResponse, sizeof (REDFISH_RESPONSE)); - - ExpectedResponse =3D &Response; - RedfishSettingsUri =3D NULL; - JsonValue =3D RedfishJsonInPayload (Response.Payload); - // - // Seeking RedfishSettings URI link. + // Check and see if "@Redfish.Settings" exist or not. // - for (Index =3D 0; Index < sizeof (RedfishSettingsUriKeys) / sizeof (*Red= fishSettingsUriKeys); Index++) { - if (JsonValue =3D=3D NULL) { - break; - } - - JsonValue =3D JsonObjectGetValue (JsonValueGetObject (JsonValue), Redf= ishSettingsUriKeys[Index]); - } - - if (JsonValue !=3D NULL) { - // - // Verify RedfishSettings URI link is valid to retrieve resource or no= t. - // - RedfishSettingsUri =3D JsonValueGetUnicodeString (JsonValue); - - Status =3D GetResourceByUri (Private->RedfishService, RedfishSettingsU= ri, &RedfishSettingsResponse); - if (EFI_ERROR (Status)) { - DEBUG ((DEBUG_ERROR, "%a, @Redfish.Settings exists, get resource fro= m: %s failed\n", __FUNCTION__, RedfishSettingsUri)); - } else { - Uri =3D RedfishSettingsUri; - ExpectedResponse =3D &RedfishSettingsResponse; - } + ZeroMem (&PendingSettingResponse, sizeof (REDFISH_RESPONSE)); + Status =3D GetPendingSettings ( + Private->RedfishService, + Response.Payload, + &PendingSettingResponse, + &PendingSettingUri + ); + if (!EFI_ERROR (Status)) { + DEBUG ((REDFISH_DEBUG_TRACE, "%a: @Redfish.Settings found: %s\n", __fu= nc__, PendingSettingUri)); + Private->Uri =3D PendingSettingUri; + ExpectedResponse =3D &PendingSettingResponse; + } else { + Private->Uri =3D Uri; + ExpectedResponse =3D &Response; } =20 - Private->Uri =3D Uri; Private->Payload =3D ExpectedResponse->Payload; ASSERT (Private->Payload !=3D NULL); =20 @@ -202,12 +188,12 @@ RedfishResourceConsumeResource ( ); } =20 - if (RedfishSettingsResponse.Payload !=3D NULL) { + if (PendingSettingResponse.Payload !=3D NULL) { RedfishFreeResponse ( - RedfishSettingsResponse.StatusCode, - RedfishSettingsResponse.HeaderCount, - RedfishSettingsResponse.Headers, - RedfishSettingsResponse.Payload + PendingSettingResponse.StatusCode, + PendingSettingResponse.HeaderCount, + PendingSettingResponse.Headers, + PendingSettingResponse.Payload ); } =20 @@ -289,7 +275,8 @@ RedfishResourceUpdate ( return EFI_NOT_READY; } =20 - Status =3D GetResourceByUri (Private->RedfishService, Uri, &Response); + ZeroMem (&Response, sizeof (Response)); + Status =3D RedfishHttpGetResource (Private->RedfishService, Uri, &Respon= se, TRUE); if (EFI_ERROR (Status)) { DEBUG ((DEBUG_ERROR, "%a, get resource from: %s failed\n", __func__, U= ri)); return Status; @@ -317,6 +304,7 @@ RedfishResourceUpdate ( Response.Headers, Response.Payload ); + RedfishHttpResetResource (Uri); Private->Payload =3D NULL; } =20 @@ -359,7 +347,8 @@ RedfishResourceCheck ( return EFI_NOT_READY; } =20 - Status =3D GetResourceByUri (Private->RedfishService, Uri, &Response); + ZeroMem (&Response, sizeof (Response)); + Status =3D RedfishHttpGetResource (Private->RedfishService, Uri, &Respon= se, TRUE); if (EFI_ERROR (Status)) { DEBUG ((DEBUG_ERROR, "%a, get resource from: %s failed\n", __func__, U= ri)); return Status; @@ -430,7 +419,8 @@ RedfishResourceIdentify ( return EFI_NOT_READY; } =20 - Status =3D GetResourceByUri (Private->RedfishService, Uri, &Response); + ZeroMem (&Response, sizeof (Response)); + Status =3D RedfishHttpGetResource (Private->RedfishService, Uri, &Respon= se, TRUE); if (EFI_ERROR (Status)) { DEBUG ((DEBUG_ERROR, "%a, get resource from: %s failed\n", __func__, U= ri)); 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 (#113076): https://edk2.groups.io/g/devel/message/113076 Mute This Topic: https://groups.io/mt/103500382/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-