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 B4945D8050D for ; Thu, 2 Nov 2023 02:57:03 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=I+QupHgk/cYoR9fPr+vU8W4ctI0AyUbcP2iaPw8HQ3g=; c=relaxed/simple; d=groups.io; h=ARC-Seal:ARC-Message-Signature:ARC-Authentication-Results:From:To:CC:Subject:Thread-Topic:Thread-Index:Date:Message-ID:References:In-Reply-To:Accept-Language:MIME-Version:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Language:Content-Type:Content-Transfer-Encoding; s=20140610; t=1698893822; v=1; b=ZovVpfO3mMHyjMOwF/iZda9Fl3pJifc2kfSpp8ZOc8gSWZHiUmEXvb2gkQyRk+xxawKCaKA0 7VVbiRyZsAcLYjYEZzMxyLrafhAOJZ+EDH6x8ABFdZy9VmC8ZKaw5f2ewlQ2h9OJMxSxtn3/xQl 1888/GgHHhMcwi4su1iOY5f4= X-Received: by 127.0.0.2 with SMTP id JpqGYY7687511xWxUhOwkNrm; Wed, 01 Nov 2023 19:57:02 -0700 X-Received: from NAM11-BN8-obe.outbound.protection.outlook.com (NAM11-BN8-obe.outbound.protection.outlook.com [40.107.236.41]) by mx.groups.io with SMTP id smtpd.web11.22895.1698893821388704617 for ; Wed, 01 Nov 2023 19:57:01 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ZDALcQauvzWnpEtD8RFg9ZEA7dZt6g2i+VACJk8AwQg9GQ4A2W7uU1dlSApKSMBmiRXEh+/FcGI1gKMcZzoCNCc4sfPTIFPkKpUijKAm/X3vm1qQSW2rrukntZop38XcoVr6+HMRhyADXnp6HKZUu8+zcrsK0bTeXG2pBGb0y2svbcu8ptr36PbsrxWfKLSF8vivpIGFf/906nu2tn6drTn+lYxW63Vyqx1aG/RU6IKOdo9TZI7bxcYyNQhCRjwKRwLIyVYdj+NUlFjZ1OHF/1UrMSzsM4FZFL9Hd0BFq8xTcCnaMbWJw5pjvUV64QP81vHUzcNVDUdRzHROOUH0sw== 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=Lw3ZvVa6oam/inRKUHnZ/XUGraPN+PzCLKyh+nAj9dA=; b=ABB3y5PWsigWw3Ccm+YfP002MXVxHVCd9RzkTPbY14gKG944ytQwPrjQGHDSNZjlwK3Feg2wARno0hFDqSDYFt7dy93LuO9zI5L5IyMPMEdTAMJxGb9q+1pLVH9GZAlaA+1KgLmNIAau6Zu1kL9sKiq4d/0mvDFXuFgFbdBw/sSrsLGVntNmFsV4oqzx9hiWUypfG66F6UVYuKNgsubr1QdpgjaFUogMk6FdCsQJneFJuP3UcDXogzh+GxFaEOoZjFOQutUJ+3DZnzYCdZKgIFXgtK1H4SDAM8+emhlj/x2upn4VC4dVTeofZD2fzcgyngFto+G5JYqKno35P3TP5A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nvidia.com; dmarc=pass action=none header.from=nvidia.com; dkim=pass header.d=nvidia.com; arc=none X-Received: from MW4PR12MB7031.namprd12.prod.outlook.com (2603:10b6:303:1ef::6) by IA1PR12MB6433.namprd12.prod.outlook.com (2603:10b6:208:3af::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6933.29; Thu, 2 Nov 2023 02:56:57 +0000 X-Received: from MW4PR12MB7031.namprd12.prod.outlook.com ([fe80::39a9:72e:53d1:4c6b]) by MW4PR12MB7031.namprd12.prod.outlook.com ([fe80::39a9:72e:53d1:4c6b%4]) with mapi id 15.20.6933.029; Thu, 2 Nov 2023 02:56:57 +0000 From: "Nickle Wang via groups.io" To: Igor Kulchytskyy , "devel@edk2.groups.io" CC: Abner Chang , Mike Maslenkin Subject: Re: [edk2-devel] [PATCH v2] RedfishPkg: RedfishDiscoverDxe: Fix issue if IPv4 installed after RestEx Thread-Topic: [PATCH v2] RedfishPkg: RedfishDiscoverDxe: Fix issue if IPv4 installed after RestEx Thread-Index: AQHaDQB3wfq9MU8sPUiRl4StxWQjabBmVI0A Date: Thu, 2 Nov 2023 02:56:57 +0000 Message-ID: References: <20231101201704.1504-1-igork@ami.com> In-Reply-To: <20231101201704.1504-1-igork@ami.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-publictraffictype: Email x-ms-traffictypediagnostic: MW4PR12MB7031:EE_|IA1PR12MB6433:EE_ x-ms-office365-filtering-correlation-id: fba9da0b-74fa-4c10-5354-08dbdb4f60a3 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam-message-info: Ji9iugBe2xfVFVz8ex0spqgeJQID5OCg2oE86r+RXyVXyAnB6YQyhqeJwj/+23BQUELQ8ascx/bO6T/WYvGbMRylhM1pV43Th2CLSpCwwDszaNR+bEEAFxqCwT2bAdp2SLJ1O4CJF9f0KdV4fPZm7W5rIV02hwMBQvsyu78OMUWK/KxEbuaFnsWi1BCLiesyoFYDv5Ovna06e4MkbWkAMdpv4Rm1sRfCPJfRs+0xqkYh3K75wN3KH1JUJrbYB/hgrQ9ncUw5syBBKEhphpWKCxh8u+5X17iYE0UTqYW0Rh19WXPfqDk8AL1l2xlRQ9fD+p15Mz99iD+tuE8M0U8e3g9JFqPASjYfVfGF84umMf2fUtpxSv9n7QpGK3e1N5Zvjh70KjzXL/VVsFNfUb9P8DUD2g6IqvQiYP77CbyCCLrmm9fBu9h2+vQm7pvh022kn3wTnxvvCT7og86TWVXJJGR/c5zhIhHi+Zl4kiNFBOj4sDD7Uv7IazpLXjQq8HRT2RWymJ4OURlYWIm6941PfjAxqBLyJrszcPz3eyD5udG/tLLRxPioNB0zD1cLegk3TLppw6BgwFvLuRBz22GObztsOAxYCpuKo+HUYaQ76jjEW+2rY8VFAOq9ofcsCQ0jBg/izIDKFURHA/UpLtE9soABKFr30M3w8NlY59W25SA= x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?ZRTAfuGHdWkxBIRAPGGJiRI6lneaVt+Je8rSB3SXvtJ+jOF8AF3dTad7gI54?= =?us-ascii?Q?KBAGMcSLZCQLwr8s0yxprBqpmx4d+CSbZr6x2QUp2OsLdpIHPEZVIu88i4xR?= =?us-ascii?Q?9hG9XDd5wXfINGB77uX+HM6RJl3wf8XnLbGsmiy07A8M9OSacvU6rnnMJAQI?= =?us-ascii?Q?BkOQE4rs2ijf9gBBIC/NNi7sUvVYrM0Lzatn98oixtyzhFP/M/9qsPLEUQvv?= =?us-ascii?Q?ocjsY7LxXUMSl4foIjda2dDdeSi3bx8KhmvwURS6DwqsTW5omHnY3wPxp98w?= =?us-ascii?Q?ecEkrsJ/2NQHUuw8EXf1y4zdt33q0R6VbhowTMeg49CJHRlRD1SlHu81KwSS?= =?us-ascii?Q?qnEkgKczCwaIxMmuO8xJf2J24Qlet6BZznisIPL9CtaLWhFKf3K4ttqsuPMI?= =?us-ascii?Q?UviH+PmsUCzoFAMgta1g3FKRLh5byA/IYBjRcGp9FmWGxfCCU1J/CymXT5Fa?= =?us-ascii?Q?lAOGacY9IDzgwFKvQWMFgoCW4v1yrzZjabWQNHi8HwvKuhjjP+/hzuigQLai?= =?us-ascii?Q?phOmKEELMOJkSy9Wv7nALzCHF1ypFl2lxwXnzTmS40u5qp1TTWnpxuaByG1Q?= =?us-ascii?Q?k6twxNo0sHBXSJfaAZJWaJ/94JHW01ZAOAht3nqjOonYt5OCSvIXUvI9DqE0?= =?us-ascii?Q?xfI583WNT7BoKhDQUU5RExJ7+hMIhKeZH6ZkJZUvg/I8+nMWEEa+Nf/Mjg78?= =?us-ascii?Q?U59kFBRB1lB36zdEjAJzXKW4PIMx203gs6Zx0pta5Jy9wgruL2aZSZnqSfqv?= =?us-ascii?Q?u6q6BcgxVmHRttYpX0LgoC0fGVgWSTDhnQfkJn79fNa6rugcWoYyNeTJ43Eu?= =?us-ascii?Q?AlY9XD1Lq/8XhA66WV261e7tB5DeZuGfup3EqbPSekeEHxojWJooleCyzAIJ?= =?us-ascii?Q?B+wszObPtKb6W3IHe/lGXIwg80+h0y60iviyVgvOv1mSfjyykFkQUcwhwY25?= =?us-ascii?Q?hDJCSTwwECjqqNDSBrMDPMYjIQOIMntzNYbX6ZknxgPYV5jwxEo9xJvTdUht?= =?us-ascii?Q?lhjG1qTLT/UVQ+HnYVoRkHTruek6QT4PmJR0gTEEiCvUB25l4vcT/xlUPt58?= =?us-ascii?Q?066Y3/o5XfvanwP5FxNWL0AmpJv6OOBeqkwE6f+BfR9POu3abX8Nhj9he3D+?= =?us-ascii?Q?idDQ8u9/9Xr2aE1DE7xgn2ZXBTllNgDuFIvavpXOKtG0nA/cut8f4+n1bUHA?= =?us-ascii?Q?cFYyEAPazf544pD1vcbTvOwFHw5e2OomYjQOeX67vvy3T2cbWGoVbhLOfqwp?= =?us-ascii?Q?FzLCsEb3wKjuBzfHITFSpxB2c3kBPURzIGSkFtMrKElSms8S6n8YeUIaL/Bj?= =?us-ascii?Q?fwSwp8Q7g8EjXo+wODZiee8lQVG4zPGLLRrEYvzWlZStUPm/1bF1yYlAOEya?= =?us-ascii?Q?rfcs7/TIy4NAw7zKrDiEzmLcatZ2wu4as5eNmZ+rxfXzh50DiYemWlc3fKHM?= =?us-ascii?Q?UlitsWHI3zWnuuhLDiJq6jKY2uayeIXUcGARHfOygADqSxkOfZSWfZqYNkLL?= =?us-ascii?Q?B3hmUTGwKpXodVgBA1VLeQwpGBWqAbwTWjQmdzTE+rhl4xcy9GoOY9yVaotX?= =?us-ascii?Q?JLIGapZ46tjcSeIUKxL8vwYficjhe+XXd/L57Qa1jHRXBfPHUNLyIejQd7uf?= =?us-ascii?Q?MzEX8kiU3TUfzErbdqGuh/KulVQ6Gj3B+GQchAzfIZHz?= MIME-Version: 1.0 X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: MW4PR12MB7031.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: fba9da0b-74fa-4c10-5354-08dbdb4f60a3 X-MS-Exchange-CrossTenant-originalarrivaltime: 02 Nov 2023 02:56:57.3213 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: 3alkukguPczAV2zou2+Wu2i43buI3Xf0tMuO3EfvS08ivfir13cvBzZsUYnOInMrSq23/II0BFOdklXHUusykg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA1PR12MB6433 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: 4inmIgYVX6NeGkYV596QJEd4x7686176AA= Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20140610 header.b=ZovVpfO3; spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce@groups.io; dmarc=none; arc=reject ("signature check failed: fail, {[1] = sig:microsoft.com:reject}") This change looks good to me. Just minor comments: > DEBUG ((DEBUG_INFO, "%a: all required protocols are found on this control= ler handle: %p.\n", __func__, ControllerHandle)); Could we use DEBUG_MANAGEABILITY to replace DEBUG_INFO in Redfish driver? T= his gives us the way to show manageability information only while debugging= . And it looks like we don't run uncrustify to this patch. May I know if it i= s possible to create a PR on edk2 repository and edk2 CI can test it? Edk2 = CI helps me to catch some formatting issue that I am not aware of. Thanks, Nickle > -----Original Message----- > From: Igor Kulchytskyy > Sent: Thursday, November 2, 2023 4:18 AM > To: devel@edk2.groups.io > Cc: Abner Chang ; Nickle Wang ; > Mike Maslenkin > Subject: [PATCH v2] RedfishPkg: RedfishDiscoverDxe: Fix issue if IPv4 ins= talled > after RestEx >=20 > External email: Use caution opening links or attachments >=20 >=20 > Supported function of the driver changed to wait for all newtwork > interface to be installed. > Filer out the network interfaces which are not supported by > Redfish Host Interface. >=20 > Cc: Abner Chang > Cc: Nickle Wang > Cc: Mike Maslenkin > Signed-off-by: Igor Kulchytskyy > --- > RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c | 131 ++++++++++++++-= -- > --- > 1 file changed, 95 insertions(+), 36 deletions(-) >=20 > diff --git a/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c > b/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c > index 23da3b968f..c67b8acf12 100644 > --- a/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c > +++ b/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c > @@ -322,9 +322,15 @@ GetTargetNetworkInterfaceInternal ( > { > EFI_REDFISH_DISCOVER_NETWORK_INTERFACE_INTERNAL > *ThisNetworkInterface; >=20 > + if (IsListEmpty (&mEfiRedfishDiscoverNetworkInterface)) { > + return NULL; > + } > + > ThisNetworkInterface =3D > (EFI_REDFISH_DISCOVER_NETWORK_INTERFACE_INTERNAL *)GetFirstNode > (&mEfiRedfishDiscoverNetworkInterface); > while (TRUE) { > - if (CompareMem ((VOID *)&ThisNetworkInterface->MacAddress, > &TargetNetworkInterface->MacAddress, ThisNetworkInterface->HwAddressSize) > =3D=3D 0) { > + if (CompareMem ((VOID *)&ThisNetworkInterface->MacAddress, > &TargetNetworkInterface->MacAddress, ThisNetworkInterface->HwAddressSize) > =3D=3D 0 && > + ((TargetNetworkInterface->IsIpv6 && ThisNetworkInterface- > >NetworkProtocolType =3D=3D ProtocolTypeTcp6) || > + (!TargetNetworkInterface->IsIpv6 && ThisNetworkInterface- > >NetworkProtocolType =3D=3D ProtocolTypeTcp4))) { > return ThisNetworkInterface; > } >=20 > @@ -354,6 +360,10 @@ GetTargetNetworkInterfaceInternalByController ( > { > EFI_REDFISH_DISCOVER_NETWORK_INTERFACE_INTERNAL > *ThisNetworkInterface; >=20 > + if (IsListEmpty (&mEfiRedfishDiscoverNetworkInterface)) { > + return NULL; > + } > + > ThisNetworkInterface =3D > (EFI_REDFISH_DISCOVER_NETWORK_INTERFACE_INTERNAL *)GetFirstNode > (&mEfiRedfishDiscoverNetworkInterface); > while (TRUE) { > if (ThisNetworkInterface->OpenDriverControllerHandle =3D=3D Controll= erHandle) { > @@ -476,6 +486,39 @@ CheckIsIpVersion6 ( > return FALSE; > } >=20 > +/** > + This function returns the IP type supported by the Host Interface > + > + @retval IP Type > + // Unknown=3D00h, > + // Ipv4=3D01h, > + // Ipv6=3D02h, > + > +**/ > +STATIC > +UINT8 > +GetHiIpProtocolType() > +{ > + EFI_STATUS Status; > + REDFISH_OVER_IP_PROTOCOL_DATA *Data; > + REDFISH_INTERFACE_DATA *DeviceDescriptor; > + > + Data =3D NULL; > + DeviceDescriptor =3D NULL; > + if (mSmbios =3D=3D NULL) { > + Status =3D gBS->LocateProtocol (&gEfiSmbiosProtocolGuid, NULL, (VOID > **)&mSmbios); > + if (EFI_ERROR (Status)) { > + return > REDFISH_HOST_INTERFACE_HOST_IP_ADDRESS_FORMAT_UNKNOWN; > + } > + } > + Status =3D RedfishGetHostInterfaceProtocolData (mSmbios, &DeviceDescri= ptor, > &Data); // Search for SMBIOS type 42h > + if (!EFI_ERROR (Status) && (Data !=3D NULL) && > + (Data->HostIpAssignmentType =3D=3D RedfishHostIpAssignmentStatic))= { > + return Data->HostIpAddressFormat; > + } > + return REDFISH_HOST_INTERFACE_HOST_IP_ADDRESS_FORMAT_UNKNOWN; > +} > + > /** > This function discover Redfish service through SMBIOS host interface. >=20 > @@ -512,6 +555,15 @@ DiscoverRedfishHostInterface ( >=20 > Status =3D RedfishGetHostInterfaceProtocolData (mSmbios, &DeviceDescri= ptor, > &Data); // Search for SMBIOS type 42h > if (!EFI_ERROR (Status) && (Data !=3D NULL) && (DeviceDescriptor !=3D = NULL)) { > + > + if (Instance->NetworkInterface->NetworkProtocolType =3D=3D ProtocolT= ypeTcp4 > && Data->HostIpAddressFormat !=3D > REDFISH_HOST_INTERFACE_HOST_IP_ADDRESS_FORMAT_IP4) { // IPv4 case > + DEBUG ((DEBUG_ERROR, "%a: Network Interface is IPv4, but Host Inte= rface > requires Ipv6\n", __func__)); > + return EFI_UNSUPPORTED; > + } > + else if (Instance->NetworkInterface->NetworkProtocolType =3D=3D > ProtocolTypeTcp6 && Data->HostIpAddressFormat !=3D > REDFISH_HOST_INTERFACE_HOST_IP_ADDRESS_FORMAT_IP6) { // IPv6 case > + DEBUG ((DEBUG_ERROR, "%a: Network Interface is IPv6, but Host Inte= rface > requires IPv4\n", __func__)); > + return EFI_UNSUPPORTED; > + } > // > // Check if we can reach out Redfish service using this network inte= rface. > // Check with MAC address using Device Descriptor Data Device Type 0= 4 and > Type 05. > @@ -1102,6 +1154,7 @@ RedfishServiceGetNetworkInterface ( > OUT EFI_REDFISH_DISCOVER_NETWORK_INTERFACE **NetworkIntfInstances > ) > { > + EFI_STATUS Status; > EFI_REDFISH_DISCOVER_NETWORK_INTERFACE_INTERNAL > *ThisNetworkInterfaceIntn; > EFI_REDFISH_DISCOVER_NETWORK_INTERFACE *ThisNetworkInterface= ; > EFI_REDFISH_DISCOVER_REST_EX_INSTANCE_INTERNAL *RestExInstance; > @@ -1141,6 +1194,16 @@ RedfishServiceGetNetworkInterface ( >=20 > ThisNetworkInterfaceIntn =3D > (EFI_REDFISH_DISCOVER_NETWORK_INTERFACE_INTERNAL *)GetFirstNode > (&mEfiRedfishDiscoverNetworkInterface); > while (TRUE) { > + // If Get Subnet Info failed then skip this interface > + Status =3D NetworkInterfaceGetSubnetInfo (ThisNetworkInterfaceIntn, > ImageHandle); // Get subnet info > + if (EFI_ERROR(Status)) { > + if (IsNodeAtEnd (&mEfiRedfishDiscoverNetworkInterface, > &ThisNetworkInterfaceIntn->Entry)) { > + break; > + } > + ThisNetworkInterfaceIntn =3D > (EFI_REDFISH_DISCOVER_NETWORK_INTERFACE_INTERNAL *)GetNextNode > (&mEfiRedfishDiscoverNetworkInterface, &ThisNetworkInterfaceIntn->Entry); > + continue; > + } > + > ThisNetworkInterface->IsIpv6 =3D FALSE; > if (CheckIsIpVersion6 (ThisNetworkInterfaceIntn)) { > ThisNetworkInterface->IsIpv6 =3D TRUE; > @@ -1230,6 +1293,10 @@ RedfishServiceAcquireService ( >=20 > if (TargetNetworkInterface !=3D NULL) { > TargetNetworkInterfaceInternal =3D GetTargetNetworkInterfaceInternal > (TargetNetworkInterface); > + if (TargetNetworkInterfaceInternal =3D=3D NULL) { > + DEBUG ((DEBUG_ERROR, "%a:No network interface on platform.\n", > __func__)); > + return EFI_UNSUPPORTED; > + } > NumNetworkInterfaces =3D 1; > } else { > TargetNetworkInterfaceInternal =3D > (EFI_REDFISH_DISCOVER_NETWORK_INTERFACE_INTERNAL *)GetFirstNode > (&mEfiRedfishDiscoverNetworkInterface); > @@ -1260,7 +1327,12 @@ RedfishServiceAcquireService ( > // Get subnet information in case subnet information is not set be= cause > // RedfishServiceGetNetworkInterfaces hasn't been called yet. > // > - NetworkInterfaceGetSubnetInfo (TargetNetworkInterfaceInternal, > ImageHandle); > + Status1 =3D NetworkInterfaceGetSubnetInfo (TargetNetworkInterfaceI= nternal, > ImageHandle); > + if (EFI_ERROR(Status1)) { > + DEBUG ((DEBUG_ERROR, "%a: Get subnet information fail.\n", __fun= c__)); > + FreePool(Instance); > + continue; > + } > NewInstance =3D TRUE; > } >=20 > @@ -1535,7 +1607,7 @@ TestForRequiredProtocols ( > UINT32 *Id; > UINTN Index; > EFI_STATUS Status; > - UINTN ListCount; > + UINTN ListCount, SuccessfulCount =3D 0; >=20 > ListCount =3D (sizeof (gRequiredProtocol) / sizeof > (REDFISH_DISCOVER_REQUIRED_PROTOCOL)); > for (Index =3D 0; Index < ListCount; Index++) { > @@ -1557,13 +1629,14 @@ TestForRequiredProtocols ( > EFI_OPEN_PROTOCOL_GET_PROTOCOL > ); > if (EFI_ERROR (Status)) { > - if (Index =3D=3D ListCount - 1) { > - DEBUG ((DEBUG_INFO, "%a: all required protocols are found on t= his > controller handle: %p.\n", __func__, ControllerHandle)); > - return EFI_SUCCESS; > - } > + SuccessfulCount++; > } > } > } > + if (ListCount =3D=3D SuccessfulCount) { > + DEBUG ((DEBUG_INFO, "%a: all required protocols are found on this co= ntroller > handle: %p.\n", __func__, ControllerHandle)); > + return EFI_SUCCESS; > + } >=20 > return EFI_UNSUPPORTED; > } > @@ -1600,10 +1673,23 @@ BuildupNetworkInterface ( > EFI_REDFISH_DISCOVER_REST_EX_INSTANCE_INTERNAL *RestExInstance; > EFI_TPL OldTpl; > BOOLEAN NewNetworkInterfaceIn= stalled; > + UINT8 IpType; > + UINTN ListCount; >=20 > + ListCount =3D (sizeof (gRequiredProtocol) / sizeof > (REDFISH_DISCOVER_REQUIRED_PROTOCOL)); > NewNetworkInterfaceInstalled =3D FALSE; > Index =3D 0; > - do { > + > + > + // Get IP Type to filter out unnecessary network protocol if possible > + IpType =3D GetHiIpProtocolType(); > + > + for (Index =3D 0; Index < ListCount; Index++) { > + // Check IP Type and skip an unnecessary network protocol if does no= t match > + if ((gRequiredProtocol[Index].ProtocolType =3D=3D ProtocolTypeTcp4 &= & IpType =3D=3D > REDFISH_HOST_INTERFACE_HOST_IP_ADDRESS_FORMAT_IP6) || > + (gRequiredProtocol[Index].ProtocolType =3D=3D ProtocolTypeTcp6 &= & IpType =3D=3D > REDFISH_HOST_INTERFACE_HOST_IP_ADDRESS_FORMAT_IP4)) { > + continue; > + } > Status =3D gBS->OpenProtocol ( > // Already in list? > ControllerHandle, > @@ -1614,11 +1700,6 @@ BuildupNetworkInterface ( > EFI_OPEN_PROTOCOL_GET_PROTOCOL > ); > if (!EFI_ERROR (Status)) { > - Index++; > - if (Index =3D=3D (sizeof (gRequiredProtocol) / sizeof > (REDFISH_DISCOVER_REQUIRED_PROTOCOL))) { > - break; > - } > - > continue; > } >=20 > @@ -1631,11 +1712,6 @@ BuildupNetworkInterface ( > EFI_OPEN_PROTOCOL_GET_PROTOCOL > ); > if (EFI_ERROR (Status)) { > - Index++; > - if (Index =3D=3D (sizeof (gRequiredProtocol) / sizeof > (REDFISH_DISCOVER_REQUIRED_PROTOCOL))) { > - break; > - } > - > continue; > } >=20 > @@ -1694,11 +1770,6 @@ BuildupNetworkInterface ( > ProtocolDiscoverIdPtr > ); > if (EFI_ERROR (Status)) { > - Index++; > - if (Index =3D=3D (sizeof (gRequiredProtocol) / sizeof > (REDFISH_DISCOVER_REQUIRED_PROTOCOL))) { > - break; > - } > - > continue; > } >=20 > @@ -1755,25 +1826,13 @@ BuildupNetworkInterface ( > } > } else { > DEBUG ((DEBUG_MANAGEABILITY, "%a: Not REST EX, continue with > next\n", __func__)); > - Index++; > - if (Index =3D=3D (sizeof (gRequiredProtocol) / sizeof > (REDFISH_DISCOVER_REQUIRED_PROTOCOL))) { > - break; > - } > - > continue; > } > } >=20 > return Status; > - } else { > - Index++; > - if (Index =3D=3D (sizeof (gRequiredProtocol) / sizeof > (REDFISH_DISCOVER_REQUIRED_PROTOCOL))) { > - break; > - } > - > - continue; > } > - } while (Index < (sizeof (gRequiredProtocol) / sizeof > (REDFISH_DISCOVER_REQUIRED_PROTOCOL))); > + } >=20 > return EFI_DEVICE_ERROR; > } > -- > 2.37.1.windows.1 > -The information contained in this message may be confidential and propri= etary > to American Megatrends (AMI). This communication is intended to be read o= nly by > the individual or entity to whom it is addressed or by their designee. If= the reader > of this message is not the intended recipient, you are on notice that any > distribution of this message, in any form, is strictly prohibited. Please= promptly > notify the sender by reply e-mail or by telephone at 770-246-8600, and th= en > delete or destroy all copies of the transmission. -=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 (#110498): https://edk2.groups.io/g/devel/message/110498 Mute This Topic: https://groups.io/mt/102328322/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-