From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (NAM10-MW2-obe.outbound.protection.outlook.com [40.107.94.116]) by mx.groups.io with SMTP id smtpd.web10.55490.1681953813737142452 for ; Wed, 19 Apr 2023 18:23:34 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@os.amperecomputing.com header.s=selector2 header.b=hEd+vYrC; spf=pass (domain: os.amperecomputing.com, ip: 40.107.94.116, mailfrom: minhnguyen@os.amperecomputing.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=QmbbRP4qqwUlwqn1Z9MitmcXsDdeC5F7Hb/3OjoR6yYe5joc0aDsmfXln5CXDpWs0P+7zE81KoQ6NwIa3+TXci+LZYsznWSHPb5c4lUF5XUzUsVxEHGyxPOxE//suIT0C8qn9o2FWsrE1zJaRc+jMKkPABsIXaAfQCt0AdOGnS7pmf/bKnuIC17F1ssXLMbXqdMGDCoYzCakGmAs30NCb64NSU+OQpbRE91fzVbvoGosBaStr4GcnNiDaWPbzcKGZiygCUxjAfUAQiAb/0olcNDVdiD90AcNo+ptVIT0KFccNlQgAsN8wJPJ2oQ66NSncK5Qm2A02TWg4WSEHx45tg== 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=J4kqqV85HThxAAHQZ/QXnsPVmRAOj0MiNvJ9r7oQ02M=; b=gEevMQkR1bEGTvVlVvKYCVuODLndl9gpVhL/yfUOXp1YX+bAFIkOJAs5wWgIGmkq0rvWw8ygHvgBV7nFLEPhKdmulc8heRyxs7Vfs+1VNlLOjYxJER3HKIorbfkTggGSXYVOqpAd2KqO9yB9I+EVnHh37L4BAg2lliRdVIbJd8hPZdiOtqN5Fjhuf77G3nEgOcDUGkDdsm/B4kkoE9rW1ehEtCW4L7wqEnhXqAPwngjYIqbTYhisUONlPtbxYZwVrbKEZ/sE9HED00sizRkBc1ndnvzduMv2Blv6ZJzyfEc2SbM/78XGwAWnxhSUl00J06QmWOGdOx7oNFidiSA+hA== 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=J4kqqV85HThxAAHQZ/QXnsPVmRAOj0MiNvJ9r7oQ02M=; b=hEd+vYrC4uQ0VxT+MwG/tM8mE+tP1ZkB4alVg2xuf5L57wwNxdPUH5+wA9lIOnMjO1IJdF3tOHJw1ZJdgx2BiJCovTFHQGjFfjGNFwllZ/Z1j0St8U26MmOI+K/qdEENTdxmBr9enavharaHcFSPmB8Sb+Cov1A7smVWRapSBTQ= Received: from BYAPR01MB4038.prod.exchangelabs.com (2603:10b6:a03:5b::28) by BL0PR01MB5089.prod.exchangelabs.com (2603:10b6:208:6e::28) 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:23:09 +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:23:08 +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: AQHZbqnpCGIYNYDJWUClJ1CZBATKBK8tXJYAgAYSuGU= Date: Thu, 20 Apr 2023 01:23:07 +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_SetDate=2023-04-16T04:36:03Z; MSIP_Label_4342314e-0df4-4b58-84bf-38bed6170a0f_Method=Standard; MSIP_Label_4342314e-0df4-4b58-84bf-38bed6170a0f_Name=General; MSIP_Label_4342314e-0df4-4b58-84bf-38bed6170a0f_SiteId=3dd8961f-e488-4e60-8e11-a82d994e183d; MSIP_Label_4342314e-0df4-4b58-84bf-38bed6170a0f_ActionId=07942507-d5f7-4cbb-85db-8c4c664b62de; MSIP_Label_4342314e-0df4-4b58-84bf-38bed6170a0f_ContentBits=1;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:23:07.070Z;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_|BL0PR01MB5089:EE_ x-ms-office365-filtering-correlation-id: 513f666a-9e4f-4727-9ddf-08db413dcc52 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: 7wE4JDvsoAHYspZ1OMvEELEATS+8f+QS5V+uEz8BgAX+i/BnIwBZoay10l/4cjYxqzhJDqhzeEVZUINoDNW5BNK90qH+Aar4Nq1uJzu7NCjtj+Xonq8ULkWWcHe0pcIM9P4SPCrMHX1jDYJVlbynEvIq5EvE+UG9RsjyY0Uyq0O7qeNKFbS7TW7ZTUF/HTadd79+R+65SUQDrhGFNzkm80OW+zQK5nUMU9kzPVgNVPPoMAd7RKpRu9E+sf37VXleFoJm/cZ5arGU2j9luAEMrYOKRCLa07ZDoCIiPJpfJAX/82AOWCyp2MG554g7paMFZMDOfPMXTF+Fonp7T/IqMHHYa9FgMwg9ghbxy9ziqtLJeIZ1lfiXHLtH7zXmyj85BCxCK0Ek9CiR5Vo/V6JdE31aIQ+E/mA7CX4xHWJfkt0ncHuIggtIb7kuKlypDVNj1465Q82creOnXdUAfp876LqEM2fyPYvVDMCP6E2iKPp9ySq/jOl01Whkz4G9u0a4UR3Ex8QTp/VlWMP/s93I+yNtw3T7GCwrodHl+p7Sdpa72T7tJYa/Isgw8PtB2WMdti6mIyo8JoVlYKKFikHF85nlrv/8mH9akMWtFVqpRBTr7lkLYiYYpWTOlBrWQUqN 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)(396003)(376002)(39850400004)(346002)(366004)(136003)(451199021)(55016003)(2906002)(107886003)(53546011)(478600001)(66476007)(91956017)(83380400001)(66446008)(316002)(76116006)(66556008)(66946007)(54906003)(64756008)(4326008)(110136005)(7696005)(8936002)(8676002)(186003)(26005)(52536014)(6506007)(5660300002)(9686003)(41300700001)(71200400001)(38070700005)(122000001)(38100700002)(33656002)(86362001)(19627405001);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?wrGEV3t5dQBF+iBnBssQfPUhNwGNdwvwgDdIvrG6IIWfucKSUQI8/JPNfCSY?= =?us-ascii?Q?SYHXKH30iH4h6hMs5c5dOI9wwDKcH6q0UworPtaFtpI88iPVFA2H14Xp9nN5?= =?us-ascii?Q?TAtSuZ6zYOSKNzuxe+ySrQth+e9QvGEf8dnYs32x8rqtQgfCH1fAvBrQn+SA?= =?us-ascii?Q?hpO3ynebaz3fUzpBk8eR9eE9foLp6lAq8zSGwW/Z1H5mCT5EfVQgl0JBbPbI?= =?us-ascii?Q?nNF3K81NGwgRKaR9akmK+Cawv8zf2ErbPq76ur+uqSH96tnBDuCXrJmLWdhm?= =?us-ascii?Q?daBc30lVFFE5t/Iv5Bl1bUU6zsESxkDuDnUA1aMT9VhZvJAUO3cQhmqBzmBq?= =?us-ascii?Q?YG/6uyEB8FRStr8+daSCP6v3LRtB5p6UT63qfmblGjwd2nTgSR1oEZ/diKSi?= =?us-ascii?Q?fFl8YxtPABwqYPSGnAjy8D0rlYer+MfuNF8hOrrJeNPS9z+rfjbNiRpWhsbW?= =?us-ascii?Q?jezPxDAXw1Yi6uK491JyHe5fnb9027W7fubhfH+70Ilgzh8Szi9iAe0QEYFm?= =?us-ascii?Q?qxR5Fo4ZeEGr5/GdAj7nmuVJJdHM2Dmm3jdu9cB+i6DVLVe2RnhVZl6nMPLO?= =?us-ascii?Q?iEmH8D/YlIn/BkcVcvjGgaf1h2E2G2kHmlR2C2o7sTaldZ/QcA9u/1nC9fnq?= =?us-ascii?Q?jAgTMJL68kuzuA0GBMumkrCBN4o7PRIrnTRV+SwrqLlBVsGB8B7VbVYFSS4Y?= =?us-ascii?Q?e48RS61Vv5c+rkQsML4iGlXtqYhJTyX1fvQjDF3bRoK3YdNOROwKiDnv0kgn?= =?us-ascii?Q?ZLWsjQFZK4nRF7yw2Ccue11F3Jldnnzsuc+Bbkt/5j6JrJcdTznS43FO4tVP?= =?us-ascii?Q?kwLR7XvVhMpycX8Q89418iGzgz9ETxyxJ9H4kg6ouhkycyXsryrgf8bhKUUF?= =?us-ascii?Q?bx+L1fqt8qqkUSNdEd+MiRzQ61VMfrcsjgr/Bgegi8ZmdaPnxO1lASE9B0Q2?= =?us-ascii?Q?BNZEjuv/X/FAQwbM7V9jJXi2SEYyesgW2VtBddEQuWdWTBmN2FBvuJwsN+5+?= =?us-ascii?Q?HX5Spx5ur6npJUHANXoNcaELhBfstdmrNjllHfYnxd897IiObeuwZvJr6aqe?= =?us-ascii?Q?4Wm8+GGRSa7/Pbck3ItF6ztuyKO37BgUYJQAh0nFo4l9EyVwdjBVNPjLjgsv?= =?us-ascii?Q?2t8ecJ6QPt06Gr4O2hnLmIXORdeIu6dIVkgOMeGxtdJiqqb/zRr9/jlXHedG?= =?us-ascii?Q?OSdioR2oFpuWy2nkIIjEN0iry84JgPqXRY+5u4TjN9uuyIiBz8OGNya0cOva?= =?us-ascii?Q?JIqwZU3IzHxqm+dK6Wfk1Jqm9RInB0pBWY9Fn4bFN74zQnn3O1akiRHyC4y8?= =?us-ascii?Q?IAs1/mI/25bjCZ6tf24uN3sZbgRaxqTuoqATSTK5w8ex/R+FA0EvpQHnOgrG?= =?us-ascii?Q?1RPR05Eao7ai3zAA2y8+VZ1UTddL87ZdNCzK2uuZyscaIVZHggxAAX12g7Ba?= =?us-ascii?Q?rUkSfa92s/bWu3ntCP70Hnj7JH6On9yKkM4UU0YPZWutwUHee+4eb6kEpzvK?= =?us-ascii?Q?3Dfwzu8GKnSyEevw1ihl3pVpBbBkluMALGbDOKrNmLHZG414qEy2SkGhDgFA?= =?us-ascii?Q?RZawg8WqC1OZOUt6dcrwPacQCLGOeNAJDtoSQD1geHJE8LELY/jPyRcZ+/xU?= =?us-ascii?Q?q3h6QsEJxGnIKfiG116dk6w=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: 513f666a-9e4f-4727-9ddf-08db413dcc52 X-MS-Exchange-CrossTenant-originalarrivaltime: 20 Apr 2023 01:23:07.9299 (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: 68B6HD7OoQPjmFHX/iNA/yIIMgQmE3bvbn7FL8XKzMJ8tgVEA1Q4o+wpf3ErPIuUQrazKfwS0OlRMyIEorsU9DOsi648MTKI/D0jCcNy8Jjxqr2ktqUne1nakXQxzIk2 X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL0PR01MB5089 Content-Language: en-US Content-Type: multipart/alternative; boundary="_000_BYAPR01MB4038D967585D329234DF0FE7F5639BYAPR01MB4038prod_" --_000_BYAPR01MB4038D967585D329234DF0FE7F5639BYAPR01MB4038prod_ Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable 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_BYAPR01MB4038D967585D329234DF0FE7F5639BYAPR01MB4038prod_ Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable
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 <Abne= r.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_BYAPR01MB4038D967585D329234DF0FE7F5639BYAPR01MB4038prod_--