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 15820940F00 for ; Thu, 4 Jan 2024 02:32:31 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=ecSa5bgYR7XD5p4B5Abj5eqkZtAwGIzmO/+nHIvqJhw=; 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=1704335550; v=1; b=m9Ru8a7JONdbrSWBapQhRU06SJcfOQ+j4GUpOOlLPxEPyH9n+HqetdYP4Sak7+69lH/VYGR+ mw0emdHmz84MOR/WeXVY2U8r9yWNQt9pXDJtVtiS3HKE8Ou7arLrDUQdViTyU213eJCtGPRO39e Hc5fhLsFuTR2sI7YBoLKRMi4= X-Received: by 127.0.0.2 with SMTP id X9dOYY7687511xzt8TH0Sz9X; Wed, 03 Jan 2024 18:32:30 -0800 X-Received: from NAM11-CO1-obe.outbound.protection.outlook.com (NAM11-CO1-obe.outbound.protection.outlook.com [40.107.220.42]) by mx.groups.io with SMTP id smtpd.web11.45885.1704335550141196659 for ; Wed, 03 Jan 2024 18:32:30 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=hLVe/eOeyT5KcqfySRGwK+kByTbiquex2av4If/53wTkQNLUjyS1yvrLdUrpgr8Df33+pk8qPhvcJFV27pPUcplqu+X36n4X6rrtnVa3UZh0Ttpzzb1Pag9+GOzVqKphcYVYF7P0ZT1kXmi610LpuxY1KjZENRh5XYvsBg0s7wFdx4Xu1JRDNr/NUHnAnC1DSrJi3KSCkKJA36+oIaGijiuR8hwSeIle8dNjSpHwT1a9464xS5okILSOKTycLUC9cyoD5qOWiVQnpmk0xCaECXho/x5P0oZvdwy3cVOPFREKZxI+n/K+6EcKtA2ANidyHCaGVADwTnZrHA/Gr7V0Yw== 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=XGuBSqfoDmQ2UD5P7GXgO+lyyUBhnzs42ZxatI+P4zQ=; b=WxKBB6zKOaXm7WLPrBbC69TNAGEp1+m5SKZK/NZSdavV4B7DwFxcK9DUbfskzGWYMRfzXdqhIKnFJ8bqSXjbqj2+4rJHJ9CLi4uwlObJmBkR6Rs8p0UUGLY1hVvN84kD6Qd9Wffxro10obiNsx4857AY8k4rGAFFV/eYpk2JKA703qoWKq2tDeAOgEHcPXjr5DAkpM5OxO2aTtq0P/24UXpW0XrH25pXowTSIqoP1ZHpl0iWHKhQ+/ynsQ+m8F2wVghqVpowHZhyl2hN2tYXe2ZzAbijJetGQiDgh6mcXiOaLzE5RPhgDEVZMcc1Q476oX1PKSrRxO5wEQbRG5a+bg== 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 SJ0PR05CA0020.namprd05.prod.outlook.com (2603:10b6:a03:33b::25) by SN7PR12MB8819.namprd12.prod.outlook.com (2603:10b6:806:32a::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:25 +0000 X-Received: from SJ1PEPF00001CEB.namprd03.prod.outlook.com (2603:10b6:a03:33b:cafe::79) by SJ0PR05CA0020.outlook.office365.com (2603:10b6:a03:33b::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7159.14 via Frontend Transport; Thu, 4 Jan 2024 02:32:25 +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 SJ1PEPF00001CEB.mail.protection.outlook.com (10.167.242.27) 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:25 +0000 X-Received: from drhqmail201.nvidia.com (10.126.190.180) 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:19 -0800 X-Received: from drhqmail201.nvidia.com (10.126.190.180) by drhqmail201.nvidia.com (10.126.190.180) 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:19 -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:18 -0800 From: "Nickle Wang via groups.io" To: CC: Abner Chang , Igor Kulchytskyy , "Nick Ramirez" Subject: [edk2-devel] [edk2-redfish-client][PATCH v2 07/10] RedfishClientPkg/Bios: use HTTP cache lib Date: Thu, 4 Jan 2024 10:32:18 +0800 Message-ID: <20240104023218.11226-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: SJ1PEPF00001CEB:EE_|SN7PR12MB8819:EE_ X-MS-Office365-Filtering-Correlation-Id: d26cb27e-1993-4a41-aa51-08dc0ccd6342 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Message-Info: 4NHt3ZUrDtvVWqFKB/dSuuX8zKf5cXGGCpZvvNJ2qw/9eZtHnmC6A3Dg2U/fQ803nVGtD2ibsxkPMD3LNusfMRDQu/ZFeu6iEmpAPDu7P4Vlm/nqh6NfkOkCdytc2F5kfasshBwzOqP+pz7cL8hgerJdmChIfK4myOeNf4mn+At1rJtCOAOv0SoIwl1HFbAVdg6uGFtwy2FP4+FVN0MDMVHWu5X18O2N1FL0osKMoMoxoZnDs0KIzfR1BTh7Y6dXSzX0zE4zM9CD+n+F0czXnWoBa8mYsdcZSa0NRUTCnWhZvGR5n3F5MLPrB/ByGtIL1ofCnJIrFSts31D2Br0tH8YGkoTG5lTA/qTZxlv5tUS3CjyZcEz1mO+gZtJvdxtai66bMF0bG9YekHiLXKWjQghnzl2l77gRC81WfpB9//PDr4HcIGnSUP+K9U1AAte/OCpDYsoKGO366KvsdNAlzaYIRFBfk1+cNq5KZQNC4fG+pP91TYxE2pD26pQvKxDDPGDQUtnIRWnA6Jg4ntnHC9vymA2eNmW1ITjNLnNTRQC1xalLJjExA1fDak3crzRVuCT/1OVjJgPuDiEwCYkUyT3Joh2Zb13BiaKRz3elWwmWzUmd3kfpugcpPyAce3hwH9WmXHL9O5L8OxCIbrn7TRAi9RCgZKwGcNRx6m2RyYw1Z/5uOJllYY7odiLhYuEJh9MTd7gffry+2V8uKd0IF4W9lFOW6+nxUAplYD3K8W9A/ZTWPa7oGntm22TgkSK48+rfqltG83M5G4VdTXF+iWzwuQo0Uz+lDF8ck7mR3fk= X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Jan 2024 02:32:25.2753 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: d26cb27e-1993-4a41-aa51-08dc0ccd6342 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: SJ1PEPF00001CEB.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN7PR12MB8819 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: SN6ND9hy8lNRyS1ZHlt27PFAx7686176AA= 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=m9Ru8a7J; 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 | 82 ++++++++----------- 2 files changed, 38 insertions(+), 47 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..64b9d562 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; @@ -695,7 +685,7 @@ RedfishExternalResourceResourceFeatureCallback ( Private->InformationExchange =3D InformationExchange; =20 // - // Find Redfish version on BMC + // Find Redfish version on Redfish service. // Private->RedfishVersion =3D RedfishGetVersion (RedfishService); =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 (#113120): https://edk2.groups.io/g/devel/message/113120 Mute This Topic: https://groups.io/mt/103516005/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-