From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from NAM11-DM6-obe.outbound.protection.outlook.com (NAM11-DM6-obe.outbound.protection.outlook.com [40.107.223.117]) by mx.groups.io with SMTP id smtpd.web10.55653.1681954398719538776 for ; Wed, 19 Apr 2023 18:33:18 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@os.amperecomputing.com header.s=selector2 header.b=mqEu5tx8; spf=pass (domain: os.amperecomputing.com, ip: 40.107.223.117, mailfrom: minhnguyen@os.amperecomputing.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=nvSXxNY/NegI2iiXzwn0jI3FjA+TtvFN9PfwpPPIK+eTOByG3uZ+So3XkcBVg/YzDREvpgAXlRoqCUa//vCgiG1mEotQNnGotUEWdamW2MjtOY+BU7wcnnrL881CUuP8eMPI8NKZfZLacuwVq+PCRijiSOUeqfr8uyL08rKXomZomrI3wk8v3Q+ATGMb7CaKk9vCxBRHXYiYnIeUFi2ynfdGiXZ06OrL64odR/ym/IBXYvGaXLWHB5trAP8rl6uc+VA8p/cQUlhwzehAZ0rPq+xhfvpIt1+fzglCEcOxODo8FoaS521o8p/9Wsq1u6+U00hoUr/eq/Nd6kKHVjK/fg== 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=Xhex+7T8xWwmrI5Pyb6WllN4ZPRPAjjGD1IT2cIeC/E=; b=Z7Z4POGwLWO3w31LSoBdOF4pH7yXdDn6LSuv4+ZFPSncHojMtgGXL10xqCKr2NNbCyB++KxK1vxO2GwT5UpBIMIViw41mNyDymuh6DG2fIXHkbrfdVnkz68yTYXRYsaxfqxY3bZnqZdmokqaPvOF/S7RmeDtYYz+xWDLtIkXh/KBuFsXy+nOCpwlSZAS28Kc3+qtatefJDuIO8PZIZRKupKFubYuGsUDDBxJ4TkE7hf8Cat0lm8D3AE4lU8kpMgTDydFc+DZpKEnwd/B9d0Ej0CbgBCd8Q4boUJ/NmN+bh1ccBjYUs7OFPv+a89TJL+tGKEtXbbTen2lJeehG3rVHQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=os.amperecomputing.com; dmarc=pass action=none header.from=os.amperecomputing.com; dkim=pass header.d=os.amperecomputing.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=os.amperecomputing.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Xhex+7T8xWwmrI5Pyb6WllN4ZPRPAjjGD1IT2cIeC/E=; b=mqEu5tx8fBUw9rBgNA80J/GhSG5hvDf+/E7hMEJrJjpXx2yKsp8ztQkJDPDegvtg4Hp4F9Du55CFL/rbp0qhcW4ZbBklWahJjkYXjEG27E9GuKTqEMqDk/8Lo1qTlFbEwcnUPpVFdtb5gUv6I6aEueepnyLnHDFYoxF7p/OSIC0= Received: from BYAPR01MB4038.prod.exchangelabs.com (2603:10b6:a03:5b::28) by SJ0PR01MB6304.prod.exchangelabs.com (2603:10b6:a03:297::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6319.20; Thu, 20 Apr 2023 01:33:13 +0000 Received: from BYAPR01MB4038.prod.exchangelabs.com ([fe80::ca46:c19a:9542:40a6]) by BYAPR01MB4038.prod.exchangelabs.com ([fe80::ca46:c19a:9542:40a6%7]) with mapi id 15.20.6319.020; Thu, 20 Apr 2023 01:33:13 +0000 From: Minh Nguyen OS To: "Chang, Abner" , "devel@edk2.groups.io" CC: Open Source Submission , "nicklew@nvidia.com" , "igork@ami.com" , Nhi Pham OS , Tinh Nguyen OS , Vu Nguyen OS Subject: Re: [PATCH 3/5] RedfishPkg: Create RestEx child on selected interface Thread-Topic: [PATCH 3/5] RedfishPkg: Create RestEx child on selected interface Thread-Index: AQHZbqnpCGIYNYDJWUClJ1CZBATKBK8tXJYAgAYSuGWAAAIZAIAAAJAK Date: Thu, 20 Apr 2023 01:33:13 +0000 Message-ID: References: <20230414081903.7892-1-minhnguyen@os.amperecomputing.com> <20230414081903.7892-4-minhnguyen@os.amperecomputing.com> In-Reply-To: Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: msip_labels: MSIP_Label_4342314e-0df4-4b58-84bf-38bed6170a0f_Enabled=True;MSIP_Label_4342314e-0df4-4b58-84bf-38bed6170a0f_SiteId=3dd8961f-e488-4e60-8e11-a82d994e183d;MSIP_Label_4342314e-0df4-4b58-84bf-38bed6170a0f_SetDate=2023-04-16T04:36:03.0000000Z;MSIP_Label_4342314e-0df4-4b58-84bf-38bed6170a0f_Name=General;MSIP_Label_4342314e-0df4-4b58-84bf-38bed6170a0f_ContentBits=0;MSIP_Label_4342314e-0df4-4b58-84bf-38bed6170a0f_Method=Standard;MSIP_Label_5b82cb1d-c2e0-4643-920a-bbe7b2d7cc47_Enabled=True;MSIP_Label_5b82cb1d-c2e0-4643-920a-bbe7b2d7cc47_SiteId=3bc2b170-fd94-476d-b0ce-4229bdc904a7;MSIP_Label_5b82cb1d-c2e0-4643-920a-bbe7b2d7cc47_SetDate=2023-04-20T01:33:13.260Z;MSIP_Label_5b82cb1d-c2e0-4643-920a-bbe7b2d7cc47_Name=Confidential;MSIP_Label_5b82cb1d-c2e0-4643-920a-bbe7b2d7cc47_ContentBits=0;MSIP_Label_5b82cb1d-c2e0-4643-920a-bbe7b2d7cc47_Method=Standard; authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=os.amperecomputing.com; x-ms-publictraffictype: Email x-ms-traffictypediagnostic: BYAPR01MB4038:EE_|SJ0PR01MB6304:EE_ x-ms-office365-filtering-correlation-id: cf03600f-96e2-4db3-e093-08db413f356a x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: GBHWfYRdkRgc4H9WvfhCTkr4kWzgTS0ktaxAzWHQo57mp7cJsGGMzy9YFu6pUU8pDbfJ3TE9HWKeFgl/RoimV+wSvxnC9owsVavJYQ+UPLh+OQJ1YglVHp/DjdZChuRDhRGorlYLRT49odkn0kz48lLYG3jMYKnMhSfYHCwhyKNkYTIyT7a0XAOAyOlHfUtQNxxlTmXNnzQBO7ojuVCWZOi8BTFgbjScn1gzPRVITTGIipx7tJkGTMwByNtq+r6siTNg0kriHqb4KROXnUUZABvA/XGs8vJKHWD0I/Lr3TKQXSIhe2crUOPdjvk7Nql+3huSwJmrLlUtDn61QZ7q+YphmSYWCa1wHwQPwJykwGcJOr/OA15g9ojKNlfL54ZwuZtY8/JChBivWTaNxEnXr5eefUudaGT/mT5mjMJXpnOSt1DE9Lg2NM3Rbf6DJlqw316tDKpeHnp6tQouybBZQexrkg5ziz4H0dz1kdpXHrIx8+lnXbQeLCM0mwza8wzW+OXO5jOty36TI//DSv/3MDKGVZiI1NilpkFpEeugMl9diS6c1NDHRfxUvsttGlHUFYelOkvfFtfcj3GIg21OgUttjOds585941A4XdxDB7E= x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BYAPR01MB4038.prod.exchangelabs.com;PTR:;CAT:NONE;SFS:(13230028)(4636009)(366004)(396003)(376002)(39850400004)(346002)(136003)(451199021)(19627405001)(4326008)(66556008)(6506007)(9686003)(53546011)(66476007)(55016003)(186003)(30864003)(2906002)(86362001)(8676002)(8936002)(33656002)(5660300002)(52536014)(66946007)(54906003)(41300700001)(71200400001)(45080400002)(316002)(110136005)(478600001)(76116006)(66446008)(64756008)(83380400001)(38070700005)(122000001)(7696005)(166002)(38100700002)(26005)(107886003)(91956017);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?18f1zrN0X1vaASzj1SoV68j87bR7stNbOLdmYiQq9zNmayMFaLVXwzUSRc6x?= =?us-ascii?Q?OnnpCOL9vXqzAeoW5E3ktw+mcHxxueLRtxrsIt8kfw/NkON6QnZRP7Q1J3xk?= =?us-ascii?Q?yCPKnqtulFab96T2PTrm0d6kMmLuaE63S6jkXfULZX3S0HY68ma6IYBpPpKS?= =?us-ascii?Q?yHEbEh0O+04WfLOnqXsij9slFTaesKp4KB5waySR/emMQeCYESwbUNUWCeDk?= =?us-ascii?Q?KlWC7iYTjAfgYnu12HVqhW3OUdgFfZUWnoVARY8ZRJF7YS8sPG4u8Y73OhDw?= =?us-ascii?Q?IuULdMIJj7by6+AYavDmgHbNNBPggZGS1jN8JZDZMhEfkCmTlk+MajD2PnZU?= =?us-ascii?Q?LgWq2AXbMMS/gDppwOC1huTDnPMcveFoJLMiCVPlu3AaH3LVpJPIf9pUV7iI?= =?us-ascii?Q?BZL0HW34wk7pODVOD/yquOzO0JLyENXs45pE5DVjiR2smc4VgsusELD/GH1A?= =?us-ascii?Q?AAtrZIdp6J1G6HJGYD5Ckm7ujSDYWH/khhwYeOdsi9g+MDF7YWYhyisQj31U?= =?us-ascii?Q?yYWvcrN5Nv9RdUe+8CJJQXr3F1HOkM8vxzMchnzKsKKXgEtMjkq6gcTEjZ+F?= =?us-ascii?Q?N+5tUh14ys6HXdAmIIuOByp4b1cGP7um1lkxtOGtySkFL2pxrZqz08LKcIev?= =?us-ascii?Q?/ka9X6hdzZwwTSqU8p7Ib03SfnK+B7B8AI4FuSNL5C6N3QAGpi6AlRl0Tfil?= =?us-ascii?Q?vdvVKo/04i5j2DotAnmN2zn8YsWKpZi5E5kOEs7W+U/t3JWunDmwv1vH473l?= =?us-ascii?Q?2/h9+C94dgbHtBHlzxnse8utvKfye21/FIa3XLR7VA8ZswdwKd5aYkUFNNNZ?= =?us-ascii?Q?abaJcpVu2RVhuMZ0KTWieAIyDCpbuCz1S4+xFWnZFVfE/EUUycukB+S6KLS/?= =?us-ascii?Q?PAbN9InEvA+R4wULkhsjEkskmk6cFKawL0zY0cLFbgf379uRusEkA8dcMtm9?= =?us-ascii?Q?8eu6QiytgUlVWPVFCr3vMjc2v9yVUfEiqIn6rKqty6VLvMFgDeTGBstI9KWA?= =?us-ascii?Q?qwrQmTf/ugbrc6iknABO3AXdTuJS5iByviDdgycIRqrwwpYZg94Es3pIODvv?= =?us-ascii?Q?Y631SNQLat+YGeg9Wu0Rxj2spwAlxuvSmxkPvvEDmARPpd7+2cZCGd9wKc+b?= =?us-ascii?Q?Nf86Pj8bGJ2jhLEJUrstnxmg09hkOiO5AoCgbTxwKkgKUCMVoIHpElWwi0Bn?= =?us-ascii?Q?WIP4p/vfpoF/c5eJLcuhi1kTon/GTrnToZxE3Y1sCPZ4jdzFczfN2zjtuXhC?= =?us-ascii?Q?6yFoj4G37gt6IKokjcen5MBj+itHt61Ua8ESpW8HGJ0LubD01CubvnN2Lfbv?= =?us-ascii?Q?IGR2lKZnAAFHn/tHrobRPz8qZdG7OgCE8tLcLepNdFOkEXL7JIcDgdthz7RO?= =?us-ascii?Q?6Aht8zbzppS+DmEB/mDh1oEdijuXc9OUXeAXIrDcQYhA8vd2oz7JE42fgXnz?= =?us-ascii?Q?H8+yuqQQzrcDRjXbho1R97ZhD9WtRkwxPFowxpCaxz1DOnvI9IcL/eFWvihb?= =?us-ascii?Q?DKevwWqr1gLRhVF6LbWJNXMOY60fT9BuaOh12xVE7SwwV4OTJeHZ/FUDdK2m?= =?us-ascii?Q?jMHB8P2MRaFY9wmCCS3Xf0N2zAMeoG9tx3DQcNu6xDdz2DfmMENsS7FngNCR?= =?us-ascii?Q?W9V8gpF5kJhoei4YS7lmX6c=3D?= MIME-Version: 1.0 X-OriginatorOrg: os.amperecomputing.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: BYAPR01MB4038.prod.exchangelabs.com X-MS-Exchange-CrossTenant-Network-Message-Id: cf03600f-96e2-4db3-e093-08db413f356a X-MS-Exchange-CrossTenant-originalarrivaltime: 20 Apr 2023 01:33:13.7791 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 3bc2b170-fd94-476d-b0ce-4229bdc904a7 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: leBVg0tyznQ17Tbx3A07FQVB+enSVNmZVfTvXjHTajOGanwcZRaT9ugEgh4uzg2Gy2QNMaHhyuQATbyb5LVSjK5yoLThQfwh7HCTalL/gmF3VkGx6NK7RGtFElSJl2Vr X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR01MB6304 Content-Language: en-US Content-Type: multipart/alternative; boundary="_000_BYAPR01MB40381C4077A245B689ACDD26F5639BYAPR01MB4038prod_" --_000_BYAPR01MB40381C4077A245B689ACDD26F5639BYAPR01MB4038prod_ Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Hi Chang, Yes, this is the first time and the issue comes from my internal mail and = waiting for fixing. Thanks for that information and will check with miki.de= meter@intel.com as well. Thanks, Minh Nguyen. ________________________________ From: Chang, Abner Sent: Thursday, April 20, 2023 8:28 AM To: Minh Nguyen OS ; devel@edk2.groups.i= o Cc: Open Source Submission ; nicklew@nvidia.co= m ; igork@ami.com ; Nhi Pham OS ; Tinh Nguyen OS ; V= u Nguyen OS Subject: Re: [PATCH 3/5] RedfishPkg: Create RestEx child on selected interf= ace [AMD Official Use Only - General] Hi Minh, Is this the first time you send email to groups.io, if yes please also chec= k it with Miki miki.demeter@intel.com to confirm is your mail passed through groups.io or = not. Thanks Abner Get Outlook for Android ________________________________ From: Minh Nguyen OS Sent: Thursday, April 20, 2023, 9:23 AM To: Chang, Abner ; devel@edk2.groups.io Cc: Open Source Submission ; nicklew@nvidia.co= m ; igork@ami.com ; Nhi Pham OS ; Tinh Nguyen OS ; V= u Nguyen OS Subject: Re: [PATCH 3/5] RedfishPkg: Create RestEx child on selected interf= ace Caution: This message originated from an External Source. Use proper cautio= n when opening attachments, clicking links, or responding. Hi Chang, It seems like my email has the problem, please expect the delay for my v2= patches while my email's fixing. Thanks for your patience. Thanks, Minh Nguyen ________________________________ From: Chang, Abner Sent: Sunday, April 16, 2023 11:36 AM To: Minh Nguyen OS ; devel@edk2.groups.i= o Cc: Open Source Submission ; nicklew@nvidia.co= m ; igork@ami.com ; Nhi Pham OS ; Tinh Nguyen OS ; V= u Nguyen OS Subject: RE: [PATCH 3/5] RedfishPkg: Create RestEx child on selected interf= ace [AMD Official Use Only - General] Hi Minh, That is weird I can't find this patch set on group.io, and I can't apply th= is patch from email neither. Could you please check it? Thanks Abner > -----Original Message----- > From: Minh Nguyen > Sent: Friday, April 14, 2023 4:19 PM > To: devel@edk2.groups.io > Cc: patches@amperecomputing.com; Chang, Abner > ; nicklew@nvidia.com; igork@ami.com; > nhi@os.amperecomputing.com; tinhnguyen@os.amperecomputing.com; Vu > Nguyen ; Minh Nguyen > > Subject: [PATCH 3/5] RedfishPkg: Create RestEx child on selected interfac= e > > Caution: This message originated from an External Source. Use proper > caution when opening attachments, clicking links, or responding. > > > From: Vu Nguyen > > When a MAC address matching interface is found, a RestEx child will be > created to provide the Redfish communication on that interface. > Currently, It will try to locate all RestEx binding services and choose t= he first > satisfied instance without taking care about current selected interface. = This > might raise an issue on the system with multiple network devices that the > RestEx child was installed on wrong interface. > > Signed-off-by: Minh Nguyen > --- > RedfishPkg/Include/Library/RestExLib.h | 3 + > RedfishPkg/Library/DxeRestExLib/DxeRestExLib.c | 153 ++++++++-------= --- > -- > RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c | 1 + > 3 files changed, 63 insertions(+), 94 deletions(-) > > diff --git a/RedfishPkg/Include/Library/RestExLib.h > b/RedfishPkg/Include/Library/RestExLib.h > index bc4e4ca6caa7..2c32c3684cf4 100644 > --- a/RedfishPkg/Include/Library/RestExLib.h > +++ b/RedfishPkg/Include/Library/RestExLib.h > @@ -2,6 +2,7 @@ > This library provides help functions for REST EX Protocol. > > (C) Copyright 2020 Hewlett Packard Enterprise Development LP
> + Copyright (c) 2023, Ampere Computing LLC. All rights reserved.
> > SPDX-License-Identifier: BSD-2-Clause-Patent > > @@ -20,6 +21,7 @@ > This function allows the caller to create child handle for specific > REST server. > > + @param[in] Controller The controller handle used of selecte= d > interface. > @param[in] Image The image handle used to open service= . > @param[in] AccessMode Access mode of REST server. > @param[in] ConfigType Underlying configuration to communica= te > with REST server. > @@ -32,6 +34,7 @@ > **/ > EFI_STATUS > RestExLibCreateChild ( > + IN EFI_HANDLE Controller, > IN EFI_HANDLE Image, > IN EFI_REST_EX_SERVICE_ACCESS_MODE AccessMode, > IN EFI_REST_EX_CONFIG_TYPE ConfigType, > diff --git a/RedfishPkg/Library/DxeRestExLib/DxeRestExLib.c > b/RedfishPkg/Library/DxeRestExLib/DxeRestExLib.c > index d9acad24dec1..6002be93c54e 100644 > --- a/RedfishPkg/Library/DxeRestExLib/DxeRestExLib.c > +++ b/RedfishPkg/Library/DxeRestExLib/DxeRestExLib.c > @@ -2,6 +2,7 @@ > This library provides help functions for REST EX Protocol. > > (C) Copyright 2020 Hewlett Packard Enterprise Development LP
> + Copyright (c) 2023, Ampere Computing LLC. All rights reserved.
> > SPDX-License-Identifier: BSD-2-Clause-Patent > > @@ -9,6 +10,7 @@ > > #include > #include > +#include > #include #include > #include > @@ -21,6 +23,7 @@ > This function allows the caller to create child handle for specific > REST server. > > + @param[in] Controller The controller handle used of selecte= d > interface. > @param[in] Image The image handle used to open service= . > @param[in] AccessMode Access mode of REST server. > @param[in] ConfigType Underlying configuration to communica= te > with REST server. > @@ -33,6 +36,7 @@ > **/ > EFI_STATUS > RestExLibCreateChild ( > + IN EFI_HANDLE Controller, > IN EFI_HANDLE Image, > IN EFI_REST_EX_SERVICE_ACCESS_MODE AccessMode, > IN EFI_REST_EX_CONFIG_TYPE ConfigType, > @@ -41,8 +45,6 @@ RestExLibCreateChild ( > ) > { > EFI_STATUS Status; > - UINTN NoBuffer; > - EFI_HANDLE *Handle; > EFI_HANDLE ChildHandle; > EFI_REST_EX_PROTOCOL *RestEx; > EFI_REST_EX_SERVICE_INFO *RestExServiceInfo; @@ -59,116 +61,79 @@ > RestExLibCreateChild ( > } > > *ChildInstanceHandle =3D NULL; > - // > - // Locate all REST EX binding service. > - // > - Handle =3D NULL; > - NoBuffer =3D 0; > - Status =3D gBS->LocateHandleBuffer ( > - ByProtocol, > - &gEfiRestExServiceBindingProtocolGuid, > - NULL, > - &NoBuffer, > - &Handle > - ); > - if (EFI_ERROR (Status) && (Status !=3D EFI_BUFFER_TOO_SMALL)) { > + > + ChildHandle =3D NULL; > + Status =3D NetLibCreateServiceChild ( > + Controller, > + Image, > + &gEfiRestExServiceBindingProtocolGuid, > + &ChildHandle > + ); > + if (EFI_ERROR (Status)) { > + DEBUG (( > + DEBUG_ERROR, > + "%a: Failed to create service child - %r \n", > + __FUNCTION__, > + Status > + )); > return Status; > } > - > - Handle =3D (EFI_HANDLE *)AllocateZeroPool (sizeof (EFI_HANDLE) * > NoBuffer); > - if (Handle =3D=3D NULL) { > - return EFI_OUT_OF_RESOURCES; > - } > - > - Status =3D gBS->LocateHandleBuffer ( > - ByProtocol, > - &gEfiRestExServiceBindingProtocolGuid, > + Status =3D gBS->OpenProtocol ( > + ChildHandle, > + &gEfiRestExProtocolGuid, > + (VOID **)&RestEx, > + Image, > NULL, > - &NoBuffer, > - &Handle > + EFI_OPEN_PROTOCOL_GET_PROTOCOL > ); > if (EFI_ERROR (Status)) { > - FreePool (Handle); > - return Status; > + goto ON_ERROR; > } > > // > - // Search for the proper REST EX instance. > + // Get the information of REST service provided by this EFI REST EX > + driver > // > - while (NoBuffer !=3D 0) { > - ChildHandle =3D NULL; > - Status =3D NetLibCreateServiceChild ( > - *(Handle + (NoBuffer - 1)), > - Image, > - &gEfiRestExServiceBindingProtocolGuid, > - &ChildHandle > - ); > - if (!EFI_ERROR (Status)) { > - Status =3D gBS->OpenProtocol ( > - ChildHandle, > - &gEfiRestExProtocolGuid, > - (VOID **)&RestEx, > - Image, > - NULL, > - EFI_OPEN_PROTOCOL_GET_PROTOCOL > - ); > - if (EFI_ERROR (Status)) { > - goto ON_ERROR; > - } > - > - // > - // Get the information of REST service provided by this EFI REST E= X driver > - // > - Status =3D RestEx->GetService ( > - RestEx, > - &RestExServiceInfo > - ); > - if (EFI_ERROR (Status)) { > - goto ON_ERROR; > - } > - > - // > - // Check REST EX property. > - // > - switch (ConfigType) { > - case EfiRestExConfigHttp: > - LenOfConfig =3D sizeof (EFI_REST_EX_HTTP_CONFIG_DATA); > - break; > - > - case EfiRestExConfigUnspecific: > - LenOfConfig =3D REST_EX_CONFIG_DATA_LEN_UNKNOWN; > - break; > + Status =3D RestEx->GetService ( > + RestEx, > + &RestExServiceInfo > + ); > + if (EFI_ERROR (Status)) { > + goto ON_ERROR; > + } > + // > + // Check REST EX property. > + // > + switch (ConfigType) { > + case EfiRestExConfigHttp: > + LenOfConfig =3D sizeof (EFI_REST_EX_HTTP_CONFIG_DATA); > + break; > > - default: > - goto ON_ERROR; > - } > + case EfiRestExConfigUnspecific: > + LenOfConfig =3D REST_EX_CONFIG_DATA_LEN_UNKNOWN; > + break; > > - if ((RestExServiceInfo- > >EfiRestExServiceInfoV10.RestServiceAccessMode !=3D AccessMode) || > - (RestExServiceInfo->EfiRestExServiceInfoV10.RestServiceType != =3D > ServiceType) || > - (RestExServiceInfo->EfiRestExServiceInfoV10.RestExConfigType != =3D > ConfigType) || > - ((LenOfConfig !=3D REST_EX_CONFIG_DATA_LEN_UNKNOWN) && > (RestExServiceInfo->EfiRestExServiceInfoV10.RestExConfigDataLength !=3D > LenOfConfig))) > - { > - goto ON_ERROR; > - } > - } > + default: > + goto ON_ERROR; > + } > + if (RestExServiceInfo->EfiRestExServiceInfoV10.RestServiceAccessMode != =3D > AccessMode || > + RestExServiceInfo->EfiRestExServiceInfoV10.RestServiceType !=3D > ServiceType || > + RestExServiceInfo->EfiRestExServiceInfoV10.RestExConfigType !=3D > ConfigType || > + ((LenOfConfig !=3D REST_EX_CONFIG_DATA_LEN_UNKNOWN) && > (RestExServiceInfo->EfiRestExServiceInfoV10.RestExConfigDataLength !=3D > LenOfConfig))) { > + goto ON_ERROR; > + } > > - // > - // This is proper REST EX instance. > - // > - *ChildInstanceHandle =3D ChildHandle; > - FreePool (Handle); > - return EFI_SUCCESS; > + // > + // This is proper REST EX instance. > + // > + *ChildInstanceHandle =3D ChildHandle; > + return EFI_SUCCESS; > > ON_ERROR:; > NetLibDestroyServiceChild ( > - *(Handle + (NoBuffer - 1)), > + Controller, > Image, > &gEfiRestExServiceBindingProtocolGuid, > ChildHandle > ); > - NoBuffer--; > - } > - > - FreePool (Handle); > return EFI_NOT_FOUND; > } > diff --git a/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c > b/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c > index 29e7b0624ebf..86ec88ddafc4 100644 > --- a/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c > +++ b/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c > @@ -87,6 +87,7 @@ CreateRestExInstance ( > EFI_STATUS Status; > > Status =3D RestExLibCreateChild ( > + Instance->NetworkInterface->OpenDriverControllerHandle, > Instance->Owner, > FixedPcdGetBool (PcdRedfishDiscoverAccessModeInBand) ? > EfiRestExServiceInBandAccess : EfiRestExServiceOutOfBandAccess, > EfiRestExConfigHttp, > -- > 2.39.0 --_000_BYAPR01MB40381C4077A245B689ACDD26F5639BYAPR01MB4038prod_ Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable
Hi Chang,

 Yes, this is the first time and the issue comes from my internal mail= and waiting for fixing. Thanks for tha= t information and will check with miki.demeter@intel.com as well.

Thanks,
Minh Nguyen.

From: Chang, Abner <Abne= r.Chang@amd.com>
Sent: Thursday, April 20, 2023 8:28 AM
To: Minh Nguyen OS <minhnguyen@os.amperecomputing.com>; devel@= edk2.groups.io <devel@edk2.groups.io>
Cc: Open Source Submission <patches@amperecomputing.com>; nick= lew@nvidia.com <nicklew@nvidia.com>; igork@ami.com <igork@ami.com&= gt;; Nhi Pham OS <nhi@os.amperecomputing.com>; Tinh Nguyen OS <tin= hnguyen@os.amperecomputing.com>; Vu Nguyen OS <vunguyen@os.amperecomp= uting.com>
Subject: Re: [PATCH 3/5] RedfishPkg: Create RestEx child on selected= interface
 

[AMD Official Use Only - General]


Hi Minh,
Is this the first time you send email to group= s.io, if yes please also check it with Miki 
miki.demeter@intel.com to confirm is your mail passed thr= ough groups.io or not.

Thanks
Abner


Get Outlook for Android


From:= Minh Nguyen OS <minhnguyen@os.amperecomputing.com>
Sent: Thursday, April 20, 2023, 9:23 AM
To: Chang, Abner <Abner.Chang@amd.com>; devel@edk2.g= roups.io <devel@edk2.groups.io>
Cc: Open Source Submission <patches@amperecomputing.com= >; nicklew@nvidia.com <nicklew@nvidia.com>; igork@ami.com <igor= k@ami.com>; Nhi Pham OS <nhi@os.amperecomputing.com>; Tinh Nguyen = OS <tinhnguyen@os.amperecomputing.com>; Vu Nguyen OS <vunguyen@os.= amperecomputing.com>
Subject: Re: [PATCH 3/5] RedfishPkg: Create RestEx child o= n selected interface

Caution: This message originated from an External Sour= ce. Use proper caution when opening attachments, clicking links, or respond= ing.

Hi Chang,

  It seems like my email has the problem, please expect the delay for = my v2 patches while my email's fixing. Thanks for your patience.

Thanks,
Minh Nguyen

From: Chang, Abner <Ab= ner.Chang@amd.com>
Sent: Sunday, April 16, 2023 11:36 AM
To: Minh Nguyen OS <minhnguyen@os.amperecomputing.com>; devel@= edk2.groups.io <devel@edk2.groups.io>
Cc: Open Source Submission <patches@amperecomputing.com>; nick= lew@nvidia.com <nicklew@nvidia.com>; igork@ami.com <igork@ami.com&= gt;; Nhi Pham OS <nhi@os.amperecomputing.com>; Tinh Nguyen OS <tin= hnguyen@os.amperecomputing.com>; Vu Nguyen OS <vunguyen@os.amperecomp= uting.com>
Subject: RE: [PATCH 3/5] RedfishPkg: Create RestEx child on selected= interface
 
[AMD Official Use Only - General]

Hi Minh,
That is weird I can't find this patch set on group.io, and I can't apply th= is patch from email neither. Could you please check it?

Thanks
Abner

> -----Original Message-----
> From: Minh Nguyen <minhnguyen@os.amperecomputing.com>
> Sent: Friday, April 14, 2023 4:19 PM
> To: devel@edk2.groups.io
> Cc: patches@amperecomputing.com; Chang, Abner
> <Abner.Chang@amd.com>; nicklew@nvidia.com; igork@ami.com;
> nhi@os.amperecomputing.com; tinhnguyen@os.amperecomputing.com; Vu
> Nguyen <vunguyen@os.amperecomputing.com>; Minh Nguyen
> <minhnguyen@os.amperecomputing.com>
> Subject: [PATCH 3/5] RedfishPkg: Create RestEx child on selected inter= face
>
> Caution: This message originated from an External Source. Use proper > caution when opening attachments, clicking links, or responding.
>
>
> From: Vu Nguyen <vunguyen@os.amperecomputing.com>
>
> When a MAC address matching interface is found, a RestEx child will be=
> created to provide the Redfish communication on that interface.
> Currently, It will try to locate all RestEx binding services and choos= e the first
> satisfied instance without taking care about current selected interfac= e. This
> might raise an issue on the system with multiple network devices that = the
> RestEx child was installed on wrong interface.
>
> Signed-off-by: Minh Nguyen <minhnguyen@os.amperecomputing.com> > ---
>  RedfishPkg/Include/Library/RestExLib.h    &n= bsp;        |   3 +
>  RedfishPkg/Library/DxeRestExLib/DxeRestExLib.c   =   | 153 ++++++++----------
> --
>  RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c |  = 1 +
>  3 files changed, 63 insertions(+), 94 deletions(-)
>
> diff --git a/RedfishPkg/Include/Library/RestExLib.h
> b/RedfishPkg/Include/Library/RestExLib.h
> index bc4e4ca6caa7..2c32c3684cf4 100644
> --- a/RedfishPkg/Include/Library/RestExLib.h
> +++ b/RedfishPkg/Include/Library/RestExLib.h
> @@ -2,6 +2,7 @@
>    This library provides help functions for REST EX Pro= tocol.
>
>    (C) Copyright 2020 Hewlett Packard Enterprise Develo= pment LP<BR>
> +  Copyright (c) 2023, Ampere Computing LLC. All rights reserved.= <BR>
>
>    SPDX-License-Identifier: BSD-2-Clause-Patent
>
> @@ -20,6 +21,7 @@
>    This function allows the caller to create child hand= le for specific
>    REST server.
>
> +  @param[in]  Controller      = ;     The controller handle used of selected
> interface.
>    @param[in]  Image     =            The image hand= le used to open service.
>    @param[in]  AccessMode    &= nbsp;      Access mode of REST server.
>    @param[in]  ConfigType    &= nbsp;      Underlying configuration to communicate=
> with REST server.
> @@ -32,6 +34,7 @@
>  **/
>  EFI_STATUS
>  RestExLibCreateChild (
> +  IN EFI_HANDLE        &= nbsp;           &nbs= p;  Controller,
>    IN EFI_HANDLE      &nb= sp;            =     Image,
>    IN EFI_REST_EX_SERVICE_ACCESS_MODE  AccessMode,=
>    IN EFI_REST_EX_CONFIG_TYPE    &n= bsp;     ConfigType,
> diff --git a/RedfishPkg/Library/DxeRestExLib/DxeRestExLib.c
> b/RedfishPkg/Library/DxeRestExLib/DxeRestExLib.c
> index d9acad24dec1..6002be93c54e 100644
> --- a/RedfishPkg/Library/DxeRestExLib/DxeRestExLib.c
> +++ b/RedfishPkg/Library/DxeRestExLib/DxeRestExLib.c
> @@ -2,6 +2,7 @@
>    This library provides help functions for REST EX Pro= tocol.
>
>    (C) Copyright 2020 Hewlett Packard Enterprise Develo= pment LP<BR>
> +  Copyright (c) 2023, Ampere Computing LLC. All rights reserved.= <BR>
>
>    SPDX-License-Identifier: BSD-2-Clause-Patent
>
> @@ -9,6 +10,7 @@
>
>  #include <Uefi.h>
>  #include <Library/BaseMemoryLib.h>
> +#include <Library/DebugLib.h>
>  #include <Library/MemoryAllocationLib.h>  #include &l= t;Library/NetLib.h>
> #include <Library/UefiBootServicesTableLib.h>
> @@ -21,6 +23,7 @@
>    This function allows the caller to create child hand= le for specific
>    REST server.
>
> +  @param[in]  Controller      = ;     The controller handle used of selected
> interface.
>    @param[in]  Image     =            The image hand= le used to open service.
>    @param[in]  AccessMode    &= nbsp;      Access mode of REST server.
>    @param[in]  ConfigType    &= nbsp;      Underlying configuration to communicate=
> with REST server.
> @@ -33,6 +36,7 @@
>  **/
>  EFI_STATUS
>  RestExLibCreateChild (
> +  IN EFI_HANDLE        &= nbsp;           &nbs= p;  Controller,
>    IN EFI_HANDLE      &nb= sp;            =     Image,
>    IN EFI_REST_EX_SERVICE_ACCESS_MODE  AccessMode,=
>    IN EFI_REST_EX_CONFIG_TYPE    &n= bsp;     ConfigType,
> @@ -41,8 +45,6 @@ RestExLibCreateChild (
>    )
>  {
>    EFI_STATUS       =          Status;
> -  UINTN         &nb= sp;           NoBuffer; > -  EFI_HANDLE        &nbs= p;       *Handle;
>    EFI_HANDLE       =          ChildHandle;
>    EFI_REST_EX_PROTOCOL      *= RestEx;
>    EFI_REST_EX_SERVICE_INFO  *RestExServiceInfo; @= @ -59,116 +61,79 @@
> RestExLibCreateChild (
>    }
>
>    *ChildInstanceHandle =3D NULL;
> -  //
> -  // Locate all REST EX binding service.
> -  //
> -  Handle   =3D NULL;
> -  NoBuffer =3D 0;
> -  Status   =3D gBS->LocateHandleBuffer (
> -           &nb= sp;        ByProtocol,
> -           &nb= sp;        &gEfiRestExServiceBinding= ProtocolGuid,
> -           &nb= sp;        NULL,
> -           &nb= sp;        &NoBuffer,
> -           &nb= sp;        &Handle
> -           &nb= sp;        );
> -  if (EFI_ERROR (Status) && (Status !=3D EFI_BUFFER_TOO_= SMALL)) {
> +
> +  ChildHandle =3D NULL;
> +  Status =3D NetLibCreateServiceChild (
> +           &nb= sp; Controller,
> +           &nb= sp; Image,
> +           &nb= sp; &gEfiRestExServiceBindingProtocolGuid,
> +           &nb= sp; &ChildHandle
> +           &nb= sp; );
> +  if (EFI_ERROR (Status)) {
> +    DEBUG ((
> +      DEBUG_ERROR,
> +      "%a: Failed to create service chi= ld - %r \n",
> +      __FUNCTION__,
> +      Status
> +      ));
>      return Status;
>    }
> -
> -  Handle =3D (EFI_HANDLE *)AllocateZeroPool (sizeof (EFI_HANDLE)= *
> NoBuffer);
> -  if (Handle =3D=3D NULL) {
> -    return EFI_OUT_OF_RESOURCES;
> -  }
> -
> -  Status =3D gBS->LocateHandleBuffer (
> -           &nb= sp;      ByProtocol,
> -           &nb= sp;      &gEfiRestExServiceBindingProtocolGuid= ,
> +  Status =3D gBS->OpenProtocol (
> +           &nb= sp;      ChildHandle,
> +           &nb= sp;      &gEfiRestExProtocolGuid,
> +           &nb= sp;      (VOID **)&RestEx,
> +           &nb= sp;      Image,
>            = ;        NULL,
> -           &nb= sp;      &NoBuffer,
> -           &nb= sp;      &Handle
> +           &nb= sp;      EFI_OPEN_PROTOCOL_GET_PROTOCOL
>            = ;        );
>    if (EFI_ERROR (Status)) {
> -    FreePool (Handle);
> -    return Status;
> +    goto ON_ERROR;
>    }
>
>    //
> -  // Search for the proper REST EX instance.
> +  // Get the information of REST service provided by this EFI RE= ST EX
> + driver
>    //
> -  while (NoBuffer !=3D 0) {
> -    ChildHandle =3D NULL;
> -    Status      =3D NetLibCre= ateServiceChild (
> -           &nb= sp;        *(Handle + (NoBuffer - 1)), > -           &nb= sp;        Image,
> -           &nb= sp;        &gEfiRestExServiceBinding= ProtocolGuid,
> -           &nb= sp;        &ChildHandle
> -           &nb= sp;        );
> -    if (!EFI_ERROR (Status)) {
> -      Status =3D gBS->OpenProtocol (
> -           &nb= sp;          ChildHandle,
> -           &nb= sp;          &gEfiRestExPr= otocolGuid,
> -           &nb= sp;          (VOID **)&Res= tEx,
> -           &nb= sp;          Image,
> -           &nb= sp;          NULL,
> -           &nb= sp;          EFI_OPEN_PROTOCOL= _GET_PROTOCOL
> -           &nb= sp;          );
> -      if (EFI_ERROR (Status)) {
> -        goto ON_ERROR;
> -      }
> -
> -      //
> -      // Get the information of REST service= provided by this EFI REST EX driver
> -      //
> -      Status =3D RestEx->GetService (
> -           &nb= sp;            = RestEx,
> -           &nb= sp;            = &RestExServiceInfo
> -           &nb= sp;            = );
> -      if (EFI_ERROR (Status)) {
> -        goto ON_ERROR;
> -      }
> -
> -      //
> -      // Check REST EX property.
> -      //
> -      switch (ConfigType) {
> -        case EfiRestExConfigHttp:<= br> > -          LenOfConfig = =3D sizeof (EFI_REST_EX_HTTP_CONFIG_DATA);
> -          break;
> -
> -        case EfiRestExConfigUnspec= ific:
> -          LenOfConfig = =3D REST_EX_CONFIG_DATA_LEN_UNKNOWN;
> -          break;
> +  Status =3D RestEx->GetService (
> +           &nb= sp;         RestEx,
> +           &nb= sp;         &RestExServiceInfo<= br> > +           &nb= sp;         );
> +  if (EFI_ERROR (Status)) {
> +    goto ON_ERROR;
> +  }
> +  //
> +  // Check REST EX property.
> +  //
> +  switch (ConfigType) {
> +  case EfiRestExConfigHttp:
> +    LenOfConfig =3D sizeof (EFI_REST_EX_HTTP_CONFIG_DA= TA);
> +    break;
>
> -        default:
> -          goto ON_ERROR;=
> -      }
> +  case EfiRestExConfigUnspecific:
> +    LenOfConfig =3D REST_EX_CONFIG_DATA_LEN_UNKNOWN; > +    break;
>
> -      if ((RestExServiceInfo-
> >EfiRestExServiceInfoV10.RestServiceAccessMode !=3D AccessMode) ||<= br> > -          (RestExService= Info->EfiRestExServiceInfoV10.RestServiceType !=3D
> ServiceType) ||
> -          (RestExService= Info->EfiRestExServiceInfoV10.RestExConfigType !=3D
> ConfigType) ||
> -          ((LenOfConfig = !=3D REST_EX_CONFIG_DATA_LEN_UNKNOWN) &&
> (RestExServiceInfo->EfiRestExServiceInfoV10.RestExConfigDataLength = !=3D
> LenOfConfig)))
> -      {
> -        goto ON_ERROR;
> -      }
> -    }
> +  default:
> +    goto ON_ERROR;
> +  }
> +  if (RestExServiceInfo->EfiRestExServiceInfoV10.RestServiceA= ccessMode !=3D
> AccessMode ||
> +      RestExServiceInfo->EfiRestExService= InfoV10.RestServiceType !=3D
> ServiceType ||
> +      RestExServiceInfo->EfiRestExService= InfoV10.RestExConfigType !=3D
> ConfigType ||
> +      ((LenOfConfig !=3D REST_EX_CONFIG_DATA= _LEN_UNKNOWN) &&
> (RestExServiceInfo->EfiRestExServiceInfoV10.RestExConfigDataLength = !=3D
> LenOfConfig))) {
> +    goto ON_ERROR;
> +  }
>
> -    //
> -    // This is proper REST EX instance.
> -    //
> -    *ChildInstanceHandle =3D ChildHandle;
> -    FreePool (Handle);
> -    return EFI_SUCCESS;
> +  //
> +  // This is proper REST EX instance.
> +  //
> +  *ChildInstanceHandle =3D ChildHandle;
> +  return EFI_SUCCESS;
>
>  ON_ERROR:;
>      NetLibDestroyServiceChild (
> -      *(Handle + (NoBuffer - 1)),
> +      Controller,
>        Image,
>        &gEfiRestExServiceBindin= gProtocolGuid,
>        ChildHandle
>        );
> -    NoBuffer--;
> -  }
> -
> -  FreePool (Handle);
>    return EFI_NOT_FOUND;
>  }
> diff --git a/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
> b/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
> index 29e7b0624ebf..86ec88ddafc4 100644
> --- a/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
> +++ b/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
> @@ -87,6 +87,7 @@ CreateRestExInstance (
>    EFI_STATUS  Status;
>
>    Status =3D RestExLibCreateChild (
> +           &nb= sp; Instance->NetworkInterface->OpenDriverControllerHandle,
>            = ;   Instance->Owner,
>            = ;   FixedPcdGetBool (PcdRedfishDiscoverAccessModeInBand) ?
> EfiRestExServiceInBandAccess : EfiRestExServiceOutOfBandAccess,
>            = ;   EfiRestExConfigHttp,
> --
> 2.39.0

--_000_BYAPR01MB40381C4077A245B689ACDD26F5639BYAPR01MB4038prod_--