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 1CB8F74003B for ; Thu, 2 Nov 2023 20:58:54 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=9+Q0lA0Z1uhYLtqsC2TznJYn/ASnkwfk7suhtBhwllY=; 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=1698958733; v=1; b=BiI6Nmswt5KxDWJUMENcoMXhXHkTP9vFyvq0bBMu6NsRgn0YyBvoJdd1B+Pjvg5GaF9seloF 2Z0vo+WYwCXL0izNbtaiGFrUF/elRUsWun7yysT6x2OyntH1x2kqFEIwYglKdlwUna2Wy1ppaD6 RxMRgLJ0Ng/O5FvGrSQ6LeeE= X-Received: by 127.0.0.2 with SMTP id v5jvYY7687511xuyrSgugv3s; Thu, 02 Nov 2023 13:58:53 -0700 X-Received: from NAM11-CO1-obe.outbound.protection.outlook.com (NAM11-CO1-obe.outbound.protection.outlook.com [40.107.220.47]) by mx.groups.io with SMTP id smtpd.web10.44387.1698958726443999902 for ; Thu, 02 Nov 2023 13:58:52 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=kIosxkWalqs1rg9otVVmBBR9VIGnvvdhmCu5f1ZolpMvQyjwYUtG0ugcJG6lwe1Pi+EY4W9HGBid8W1D5FByl/jPi6MbGClXvzM4HnY86ZFo9gsyCBKNBxUJNGOqM53FzCEKcFgeO0d979RCXkhVRZocl9pjACYnM1AxGH/RpdLRd/Pflo4RA6dXC75xWUESqOGw645Dmx3HZUatVf2yt+GrluFEPxcXVsjkMg13o9epSzFZqXQziCOl1Xl7cy2p/f08/K8d16lUrLlcWPUzeVMzjLtTmT0CJwa9lOPTxvyOUm5ANyUOpalVT6xr/9pzDP9I4v9QVrXzdN/s/1ItQA== 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=3h9fRxv96JCXmpRaTVAJAp62AlS4ZRosvyTgsyh1DAk=; b=j5HPT21fKwpjwy51hNr0hVg3vTxB20viswgbXxQt69XstvBiV3Yl5Ce30UPVt//kda+QgaleVZ2e180FRox9jenRi0n0oIMSJVo6nwJl8w1XW4zGyQObzxc70KP2BWC15H8ylzFHx/TgoSwAQEj7JOFcxVd1/5EeYPS+LpsMZuqwAwRVybMambzCwbenXLheGChFUh6WnWQY5cKNXCShXFKXo8uuK2zeKiH2FMCzR+WrMGVTXfCn+EymEWasH8UGf3ZfTKMn08qBd5N7jYzXOogD10NmIO10CjCoKFtfQXXg1BSg3Vr7ahQ+adpXQLpOmXBafvIRyDOVlLthrrEnRA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=ami.com; dmarc=pass action=none header.from=ami.com; dkim=pass header.d=ami.com; arc=none X-Received: from BLAPR10MB5185.namprd10.prod.outlook.com (2603:10b6:208:328::16) by DS7PR10MB5325.namprd10.prod.outlook.com (2603:10b6:5:3a1::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6954.19; Thu, 2 Nov 2023 20:58:41 +0000 X-Received: from BLAPR10MB5185.namprd10.prod.outlook.com ([fe80::4996:8531:b16e:22d1]) by BLAPR10MB5185.namprd10.prod.outlook.com ([fe80::4996:8531:b16e:22d1%4]) with mapi id 15.20.6954.021; Thu, 2 Nov 2023 20:58:40 +0000 From: "Igor Kulchytskyy via groups.io" To: Nickle Wang , "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: [EXTERNAL] RE: [PATCH v2] RedfishPkg: RedfishDiscoverDxe: Fix issue if IPv4 installed after RestEx Thread-Index: AQHaDQB3wfq9MU8sPUiRl4StxWQjabBmVI0AgAEtPUA= Date: Thu, 2 Nov 2023 20:58:40 +0000 Message-ID: References: <20231101201704.1504-1-igork@ami.com> In-Reply-To: Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-publictraffictype: Email x-ms-traffictypediagnostic: BLAPR10MB5185:EE_|DS7PR10MB5325:EE_ x-ms-office365-filtering-correlation-id: 1813ac14-529f-4e29-732f-08dbdbe67e07 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam-message-info: QqgrX51fFAxW0cvz1J/QtP6q3Dg7fAJWwEqHaaOU4RSvF/CSV/JVmWjcBQdWAT9ecIAZOTZFSFVb/UnlPlCbHwIeUuG39RI/5SPU8ZgiS5AdDrxx5Koq8GW5a793MQkdqBtjIiZcTcqyiJEMUYFpHZZd7miJmpBdIWBVKOR75TQYzJABwwsYSx9M6hOHU9I6NQTsNYUJOoxEVPCzwVl54dKyWh/aB/d2JamK20qCfrM2dxgEsleduRUpUET6CkwKmzF3cLAoZIyRzTXmkSoZWVr3LQJ/XbEHMKjZeCx8n1cVrIoOL5WkOCCAq4A64jn5quKxFDZGzs114gJim72OIcR509f3JbSVpLFy2p/fsaU0o9lU3J0gXEx05PCVUQDIBIwii3boV0rM0FKWhKGgWdNP3HL94y0v4bQdyJ5ELixh1MIUlBg1pL4R9mrS4mSA0bUg0SRmat45oaL7U6W1SNlxOq8esnLwfWwoMu0SV80jFWe0kTz2BszR7vayR9m13LiyYbe5QK22ZGwQuvvZ5Rmw1u/XWHKztLRrfcRvMx/8GqZbRUp+b+HXTaE/z3Vo3FLgtzlCiAs9dnA+wjpvI+a/PZhLBWfZARkyF4VAmrU8NGr1lS/YqLpYbtak+lCsRHoMXo4s6TA2yIxT1u7euA== x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?PQ7KSnkSX7xP84wOwlbQL/UlIfFtXgSAYHw1kDVAugLWkyDLAu8o7SQf+md+?= =?us-ascii?Q?WLURTot/qg/H3pAcZzglceLeRYKtob5KqM566xadXJwAJE1vZ1waOOnBZAvJ?= =?us-ascii?Q?Xfpsg00Bt4++oMHU6H1kDG03+qOL7RXuFcjPiwp2QWn8C3BG7WO52Y2BmVEe?= =?us-ascii?Q?uh3RXV2mrsrKKgGd/5kPGlKcT4Q87Z7OajSIhSIE8DjRMKsgsr+lO4rKcw20?= =?us-ascii?Q?yHSBQH8hj0FKruIlEJSrsvk+h8N6qFvgPIBoHNQ7q0CPEgQQ8clmvIv48Mce?= =?us-ascii?Q?EJtsSIcDRVwAcck2Bx9ZhLwUK1/f/+k0XH8AZgz4fdQUssitKOVNuCHMKWkg?= =?us-ascii?Q?qt1l4N2OD15t/KmkyALi2LcXptx4GZtmUqMRMkMpQWs/vXTF+5okxMGzZ4Fr?= =?us-ascii?Q?ShwXyi82ZvnxvEgrUA/N3LcKSzJ1yyGnPOj7un9p+Fmo+/GuOz8QW4J7NqTS?= =?us-ascii?Q?8gBuQK/CCDiY5ft04iu4caiC8PumXupWWYVQ3tdwt3WQBr+9B7pR1AMvso9R?= =?us-ascii?Q?CLlHDZh2SGshn7tgT2wD4A67nU7BTTrrdeaQsfDD1jYKGN89vgVlqTGvfyy3?= =?us-ascii?Q?pB6uCZ8/D8MXIh1BPv1alIYH+fcE+DHrdMW7hD1aySQXZpnziIDq6KJKJof+?= =?us-ascii?Q?ct7p/kciT4bcZIIIbVAsVrZIYLxJ9nlQyHxxUDPv9ara/zL6ACGT/6YcySlU?= =?us-ascii?Q?kj25UZ3VLkfOUcUIN73lxkimYUxLQAoTSsQguoIIabpIgwJnjTzzMAALW7Gf?= =?us-ascii?Q?/+PmRigyPSbkd3wl+g9UHr1uA+VqysqHGwdJOLO532qKs4TQ9KQb+o17KKcz?= =?us-ascii?Q?cZjHC1Yf+U4hx6FaISA0+5AAW4zGZIWbAz13CPzgahTZZBrAotgE7HO/eNXe?= =?us-ascii?Q?fI/yQjaP/fQLS1YoQ9nOD5MQvEozzRDgVILxK3Kbtf2IoLJEcOjmKbb6My1R?= =?us-ascii?Q?VciRspHXDW3ozIaG3CbuOzz4dZAUpdFeAIBto3gT5MkSuRyxTjDYcuVA8I4M?= =?us-ascii?Q?LZtJPGhws9F14Kda3QRJCTwQWRyn3LlEvc3p08ZD6OU+/uLwIww3gMRJL1b9?= =?us-ascii?Q?klIA7sDSHFcLUxkwpyPS6jBBF80f90LjwJ3zsAW2OUOQy90CV2N96yvtXklO?= =?us-ascii?Q?Se9IzZneEs9UH3LOftpTM9qA1QKz3OEv/CFkamszw82ET5VkoAOWi5whCVqc?= =?us-ascii?Q?fvaHMDqJiCIGCumVUe3Tlp40EUeGeBE4xdOh8zM5wUNBJmu0KXLZetwTRpmb?= =?us-ascii?Q?2vckqkajvTck17YDiPpFp81ZZTFCTqqhCoS6DpHobHtvtAYp7LKYZppeEZJW?= =?us-ascii?Q?pX2aCNcUs9nlqSFnIDhNaCA4Eion0o1nwqBIhk8uNr3MoG5j4L7iZSWqHBeS?= =?us-ascii?Q?mcUbNhU6Ll0etSQpy66ty/TAvY8BKQErqhlLx7n3sKbpMAf+F08FVJCY470V?= =?us-ascii?Q?hbOixTHx3z5Rp0zeEA6c2q+ryIlRQaojEaQyGHDTyuifKOu0FKzhrk75RmJo?= =?us-ascii?Q?/2yckxV/jdv46TL+gmKRBqWJRxNRdeIeJGxhPH+5v2P8jJv4KLXqIAIuoVEf?= =?us-ascii?Q?EBEAjNlkNy/Yb8S8kRA=3D?= MIME-Version: 1.0 X-OriginatorOrg: ami.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: BLAPR10MB5185.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1813ac14-529f-4e29-732f-08dbdbe67e07 X-MS-Exchange-CrossTenant-originalarrivaltime: 02 Nov 2023 20:58:40.5998 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 27e97857-e15f-486c-b58e-86c2b3040f93 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: jKaq9rDSgN6tQq4QD/DktAN4qRVihpUUWVF5hKY+1+rrxJB7dpB6VKI7MeCeSdHX X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS7PR10MB5325 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,igork@ami.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: BmqoO5FCBtKajqmTMjx1Upmcx7686176AA= 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=BiI6Nmsw; 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; arc=reject ("signature check failed: fail, {[1] = sig:microsoft.com:reject}") Hi Nickle, I fixed all your comments, Abner and Mike comments. I also created PR https://github.com/tianocore/edk2/pull/4994/ I fixed all Uncrustify errors and CI passed except PatchCheck which shows t= he error * Missing Signed-off-by! (Note: this must be added by the code contributor!= ) Which I'm not sure how to fix. I added Signed-off-by during commit. Thank you, Igor -----Original Message----- From: Nickle Wang Sent: Wednesday, November 1, 2023 10:57 PM To: Igor Kulchytskyy ; devel@edk2.groups.io Cc: Abner Chang ; Mike Maslenkin Subject: [EXTERNAL] RE: [PATCH v2] RedfishPkg: RedfishDiscoverDxe: Fix issu= e if IPv4 installed after RestEx **CAUTION: The e-mail below is from an external source. Please exercise cau= tion before opening attachments, clicking links, or following guidance.** 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 > > External email: Use caution opening links or attachments > > > 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. > > 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(-) > > 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; > > + 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; > } > > @@ -354,6 +360,10 @@ GetTargetNetworkInterfaceInternalByController ( > { > EFI_REDFISH_DISCOVER_NETWORK_INTERFACE_INTERNAL > *ThisNetworkInterface; > > + 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; > } > > +/** > + 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. > > @@ -512,6 +555,15 @@ DiscoverRedfishHostInterface ( > > 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 ( > > 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 ( > > 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; > } > > @@ -1535,7 +1607,7 @@ TestForRequiredProtocols ( > UINT32 *Id; > UINTN Index; > EFI_STATUS Status; > - UINTN ListCount; > + UINTN ListCount, SuccessfulCount =3D 0; > > 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; > + } > > 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; > > + 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; > } > > @@ -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; > } > > @@ -1694,11 +1770,6 @@ BuildupNetworkInterface ( > ProtocolDiscoverIdPtr > ); > if (EFI_ERROR (Status)) { > - Index++; > - if (Index =3D=3D (sizeof (gRequiredProtocol) / sizeof > (REDFISH_DISCOVER_REQUIRED_PROTOCOL))) { > - break; > - } > - > continue; > } > > @@ -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; > } > } > > 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))); > + } > > 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. -The information contained in this message may be confidential and propriet= ary to American Megatrends (AMI). This communication is intended to be read= only by the individual or entity to whom it is addressed or by their desig= nee. If the reader of this message is not the intended recipient, you are o= n notice that any distribution of this message, in any form, is strictly pr= ohibited. Please promptly notify the sender by reply e-mail or by telephone= at 770-246-8600, and then 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 (#110574): https://edk2.groups.io/g/devel/message/110574 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-