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 62C5C7803D1 for ; Tue, 7 Nov 2023 13:03:19 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=kqOMthWCvLpw5fNjA61TSG0FzIJ42EfsRiWR2+ZrSXc=; 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=1699362198; v=1; b=RxSOpw7PEBrXmNsxKBy4YM9BOjCLqvfsMg66vt2EGRvdmIZbfMTjJ4wqbwOsRT3fD2HIdAwd R6jfYatUVEyBfjP33nXp40hUeXroFWQqgwrEic1iz4kmKYRcEZKBKZxkNpIQka37/oUHQ3kibu9 +GLLTS2m0yCcVs+SL6VpXYiU= X-Received: by 127.0.0.2 with SMTP id Wf1SYY7687511xMYe3WzejVq; Tue, 07 Nov 2023 05:03:18 -0800 X-Received: from NAM04-MW2-obe.outbound.protection.outlook.com (NAM04-MW2-obe.outbound.protection.outlook.com [40.107.101.64]) by mx.groups.io with SMTP id smtpd.web11.9764.1699362197196389819 for ; Tue, 07 Nov 2023 05:03:17 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=f/Lw7r1KJcJovI/vKuPswSPpvbK/japdo3zClnKN8UOM9/IJlK0383OhL0UOjKEsGUe376VYzxtlzurBGO7TC6NDzksQ/jlPZCvX9Gkm9hom7Uz3ZeRADWlh63GueeA2NC1u5LOqDWPPgqw9apSeOuCoeFqFsC8IRP/KVSMcKBmfIgbxKPNPe1KCt3lh8IZCue++LngHefxHo7MZHWYHVk4rSrPfQjaFqLYdMuIgpWTxlgrbRhv6HPBw6QrnPlIeMLahixblY3ZgBSZVFVhmq6DsUnFy0EFjaWmnOnbv1Jzk7H5nEyXv1424cGAZC1jOsQparDfRBhPtuPMNlxxxrQ== 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=pH8MNnshDQVH2ZXnAlYFG37mz9fEHR2rDcG3ymd83oc=; b=X/dFzsk7DG2IYqfzlfhT3Ch8Rc0vvHB+UjLDLwPd1mAQxTVLnV4mwRIccOQCFr5dts3YDZuJr5Yj5H839EhF/tX7GbIceRMjQ6l0WQu4haWZUG+hPG4TXidmBWrHr7c3CqSZzLaYNI1AEqkP5/ErWhjxRy4mi2S05wxPAHdd2NYJ0iwqNolRYXqYk27IPnXWYQmguktY/dx6Z0uK6IZijTQEwfNr1Qiko57OwcbveJM5LDQ4/uqauqNUn83fdrQfuItbblSNkr/aj5yOub4bhyAow+Eg6VTWuR+zvIfAtUJbc6TQMfQPUX/ER1WguPcjPd9QJszkNVs9F0qwpDiy1A== 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 CH2PR12MB4199.namprd12.prod.outlook.com (2603:10b6:610:a7::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6954.28; Tue, 7 Nov 2023 13:03:14 +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.6954.029; Tue, 7 Nov 2023 13:03:13 +0000 From: "Nickle Wang via groups.io" To: Igor Kulchytskyy , "devel@edk2.groups.io" CC: Abner Chang Subject: Re: [edk2-devel] [PATCH v3] RedfishPkg: RedfishDiscoverDxe: Fix issue if IPv4 installed after RestEx Thread-Topic: [PATCH v3] RedfishPkg: RedfishDiscoverDxe: Fix issue if IPv4 installed after RestEx Thread-Index: AQHaEXLNd1r6tWwQW0meqWJLTeUNI7Buw8Qg Date: Tue, 7 Nov 2023 13:03:13 +0000 Message-ID: References: <20231107120605.2035-1-igork@ami.com> In-Reply-To: <20231107120605.2035-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_|CH2PR12MB4199:EE_ x-ms-office365-filtering-correlation-id: bc9506fc-b7d3-49e3-aec0-08dbdf91e6d2 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam-message-info: BIafW679TpBJxUp/C3gxGzG87/CDNZTaYMtZDlXIs3Q6IYS4LN5sTo38XyIJn3eqxoFk3mZ0591TO5zUsQeiF93RCnFEak26MIyUUCUB9S97g+gSR2/Jnn2qQIwiJqVl/Ehy+blMoqE6aWjbwocgq/uYvZPNLGuJJbsdwGpZt3rzXSIhY1mnwgv021JV0lUsw1ogMdUruv9xkrFm1Zo9gXnLMTN93oT3+6aU1A2FwPH1/H4h97QyyR7MqHCHOpbymmHbpzv4DXXorx8vA3gIXK9/wS0s1SY+yfUVoUXiD/it8yKGok7vYCrBIX4X37J9kAcWhzJnwprIe8GLvwPZKGuyChtpO+iiuJIVcPS+XteKu/pMCWaCoBFfGjYS08CHkeYuykQdCx4KVzhEu2xwiFR/pqnhVFj4ZIygxozcsd9mNT7iK2oQiR6HXv4CVkx+TMTlJifBYwOVRK3y0gYD6rBfCXP6c3ofJ8Nq+BeYUNunEKjJBEgZDslMwg2u6uxU8I81Wqg1yqfC08j80/R+muPLGHaXO/dE6hFeM0wj0wuvh3fXPFooy7wijXNQsFgHO0c8HWDzwl/Kdr7B/UvdieyNLjMoRQdnpBenrBnmfvkjObhi/wOFMQpiDPWOozdvdwjGtameKMQQrFwewr8+voqf/36hHF/A6w29Dp16E/E= x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?rMC/fUE4Eve1/jf1PzZFeplV6Twp42YFsRA+Ab32htdTNHzl8+nsn63QW+JW?= =?us-ascii?Q?EMZ2YxDlR/j8odqTORXqkhdA3Ae57IYVZ9WW7qZcjVpBi1My/IulTahUdMXh?= =?us-ascii?Q?kr0b4jBnkVpc6BRyxA2JxZ1gV8a2e0D6Qxx8ypzL+WjCsKSKovLmJiEAuCjl?= =?us-ascii?Q?r9oIXaEQjN+tvsO87eEm6poZeZAq/gfl5yZ58+gZGA6jc7Drvy3y+aEkuMhS?= =?us-ascii?Q?d6HWxy8YU59mMkGyGJBQaBsTqYSzmhb2XcWPHOLFWBjuTq4xjoKgjwe5t6iT?= =?us-ascii?Q?8rWaY5Piwzol8v1Z2NyWzzo7EciUJDPEZhlGU+GG32iANZPSKk9AU7Ux/id3?= =?us-ascii?Q?MuKdT5ToIDaETJK428iTIufjFc70vJfj0ibcKwJMM+txkfJ2IuYBX0+5DccL?= =?us-ascii?Q?vDOMRNLtfXLglNiUMjNknnh1YdJBQOaYuSjXQzlwxgYmTJHT6tU4G24VRFlK?= =?us-ascii?Q?rztHcXPn7onZyoYEgrYM2c+umB+FKserY3H8LqNV3yMrtLiuAdoVtuFGdJFC?= =?us-ascii?Q?0uEt9wYL1rwqr5PTa46eBqQPoEOIKmkhcuJcAJx55aL4kJOhWaLfjpKo0FfL?= =?us-ascii?Q?xpG1co0hbLAuf7fcmPpW/zmUpHb9dA31uYg79MQe5i5DTjfJfzRr7Okut+B1?= =?us-ascii?Q?AGxP1Oe/zfxZkd7D8qmeIJ4EZ5Vaol+R9mgmut39hZ14Lczb6sG2N7b2quOK?= =?us-ascii?Q?IU+G2RQQBMhAMBeN3EGLNK5VKqLeJbMAiIyjKwVnAmn92+mKh6qllupEtJJC?= =?us-ascii?Q?zIBRq32Bvf3/riRLtVI7ZxSKwPUaqxg2OAFPTc2u2eRi7Rj/AgloR3shpL8i?= =?us-ascii?Q?zvHIaVwHlxpD59Y+b5YgXsfG+wf/2Af1XTBOu+FSs/OBaTym63cRYTKmQxPc?= =?us-ascii?Q?QvkUZIKantar9gu5V1yb5gfsH704Fr22XBgvEYSIXIGwJ+LhJYlPwzKnvs7Z?= =?us-ascii?Q?Df1xhVwZoHr2tgILKj4j7opxcBgUu06BwlcTUj9xYy1uvU3s3ozsjTdx9Z2D?= =?us-ascii?Q?rnIUWc3PM9CO0rPTiP6uvBJdLZSSy/Qy2J17kBkBkYioGSjzM8VkI/G2Ng21?= =?us-ascii?Q?2P8eC0/3IEn8SOqtmmhwvxtkFtvE1L+6zh1gM5a5g5lO5EM+tC3zkWPbfhxi?= =?us-ascii?Q?l8Djs+eb61otwlHds3hKZWT/1DarxuBu42Rhtk04UZAmN5mLXd2ERtjCkBlb?= =?us-ascii?Q?22QRSEE/d9GGsM73r6ArI0PqtMFgDbAMgPY/inAXCfhRdyNfGuX9IGMFd0E5?= =?us-ascii?Q?3IC/pIGtx0HB2Dl5drTSIF+NrmvS60SVQXScZPguHoh8ZkoPAivWQnkP1PrS?= =?us-ascii?Q?tQNDH7FXAqJA2W7oAQDnuoXc40UOgq5KVuZIt/DJpDe3RtyCBZXbnNF031Xs?= =?us-ascii?Q?evAaNj39do6HFXYSBj0eShbGJ0Ec9YLcDObd5vpBOd/X8Ff3qJdxeBx1Db2D?= =?us-ascii?Q?FX2qXPev+snMLK8jgZ1MStxuYR4cbVUYTqHiTBenwsJFplOVQYnU3uN0TH4B?= =?us-ascii?Q?GXP4k132yBYa1PQndwO8wMZfBJjs+4ZOl2IlmIKe2tYpMrsxP00wLg6Thd0R?= =?us-ascii?Q?9Eb6bL3pmJa/t1Yv/KpOn10B2tL4a76EnF80wka+?= 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: bc9506fc-b7d3-49e3-aec0-08dbdf91e6d2 X-MS-Exchange-CrossTenant-originalarrivaltime: 07 Nov 2023 13:03:13.8711 (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: 5cDf2vLBlG/z3ZGtVvXpDLnA8Tg0E7rm5kP1Tjvzv0xBrbPpcSaDQ8uAFSf9tzMIK7iIJYE1vXBBhzcEwjkUfg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH2PR12MB4199 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: EjJPkJW43MEEmB4XeeRwnBblx7686176AA= 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=RxSOpw7P; arc=reject ("signature check failed: fail, {[1] = sig:microsoft.com:reject}"); dmarc=none; spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce@groups.io Thanks for fixing this issue. This version looks good to me. I test it on m= y system and it works well. Reviewed-by: Nickle Wang Regards, Nickle > -----Original Message----- > From: Igor Kulchytskyy > Sent: Tuesday, November 7, 2023 8:06 PM > To: devel@edk2.groups.io > Cc: Abner Chang ; Nickle Wang > Subject: [PATCH v3] 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 interfa= ce to be > installed. > Filer out the network interfaces which are not supported by Redfish Host > Interface. >=20 > Cc: Abner Chang > Cc: Nickle Wang > Signed-off-by: Igor Kulchytskyy > --- > RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c | 165 ++++++++++++++-= -- > --- > 1 file changed, 117 insertions(+), 48 deletions(-) >=20 > diff --git a/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c > b/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c > index 23da3b968f..85e47843e4 100644 > --- a/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c > +++ b/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c > @@ -322,9 +322,16 @@ 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 +361,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 +487,42 @@ CheckIsIpVersion6 ( > return FALSE; > } >=20 > +/** > + This function returns the IP type supported by the Host Interface. > + > + @retval 00h is Unknown > + 01h is Ipv4 > + 02h is Ipv6 > + > +**/ > +UINT8 > +GetHiIpProtocolType ( > + VOID > + ) > +{ > + 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, > + &DeviceDescriptor, &Data); // Search for SMBIOS type 42h if (!EFI_ERRO= R > (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 +559,18 @@ 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 Protocol= TypeTcp4) > && > + (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 +1161,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,13 +1201,23 @@ 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; > } >=20 > CopyMem ((VOID *)&ThisNetworkInterface->MacAddress, > &ThisNetworkInterfaceIntn->MacAddress, ThisNetworkInterfaceIntn- > >HwAddressSize); > - NetworkInterfaceGetSubnetInfo (ThisNetworkInterfaceIntn, ImageHandle= ); // > Get subnet info. > if (!ThisNetworkInterface->IsIpv6) { > IP4_COPY_ADDRESS (&ThisNetworkInterface->SubnetId.v4, > &ThisNetworkInterfaceIntn->SubnetAddr.v4); // IPv4 subnet information. > } else { > @@ -1230,7 +1300,12 @@ RedfishServiceAcquireService ( >=20 > if (TargetNetworkInterface !=3D NULL) { > TargetNetworkInterfaceInternal =3D GetTargetNetworkInterfaceInternal > (TargetNetworkInterface); > - NumNetworkInterfaces =3D 1; > + 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); > NumNetworkInterfaces =3D NumberOfNetworkInterface (); > @@ -1260,7 +1335,13 @@ 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 > @@ -1547,25 +1628,26 @@ TestForRequiredProtocols ( > ControllerHandle, > EFI_OPEN_PROTOCOL_TEST_PROTOCOL > ); > + if (EFI_ERROR (Status)) { > + return EFI_UNSUPPORTED; > + } > + > + Status =3D gBS->OpenProtocol ( > + ControllerHandle, > + gRequiredProtocol[Index].DiscoveredProtocolGuid, > + (VOID **)&Id, > + This->DriverBindingHandle, > + ControllerHandle, > + EFI_OPEN_PROTOCOL_GET_PROTOCOL > + ); > if (!EFI_ERROR (Status)) { > - Status =3D gBS->OpenProtocol ( > - ControllerHandle, > - gRequiredProtocol[Index].DiscoveredProtocolGuid, > - (VOID **)&Id, > - This->DriverBindingHandle, > - ControllerHandle, > - 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; > - } > - } > + // Already installed > + return EFI_UNSUPPORTED; > } > } >=20 > - return EFI_UNSUPPORTED; > + DEBUG ((DEBUG_MANAGEABILITY, "%a: all required protocols are found on > + this controller handle: %p.\n", __func__, ControllerHandle)); return > + EFI_SUCCESS; > } >=20 > /** > @@ -1600,10 +1682,24 @@ 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 +1710,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 +1722,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 +1780,6 @@ BuildupNetworkInterface ( > ProtocolDiscoverIdPtr > ); > if (EFI_ERROR (Status)) { > - Index++; > - if (Index =3D=3D (sizeof (gRequiredProtocol) / sizeof > (REDFISH_DISCOVER_REQUIRED_PROTOCOL))) { > - break; > - } > - > continue; > } >=20 > @@ -1755,25 +1836,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 (#110849): https://edk2.groups.io/g/devel/message/110849 Mute This Topic: https://groups.io/mt/102441003/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-