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 A8A6374003B for ; Tue, 7 Nov 2023 12:06:23 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=yZiGDsaLsKdQxb8rqR1i6vVuoSsu8YKLUkqJqTAmwzc=; 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: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=1699358782; v=1; b=UqG9KyYQ9T3IlF84n9GSHKWzr0j4qRG4FaMGJIsgP6mKIspzF36NBDF4bAQmoRy0+f0Rutx1 5yTH7cqP7N8HPYjLm7EXmS2dgoJPBzPmy1y2JzBwgBYH2cg6oylVvbG0rfmu0w6UUVzDMYyb09V yGdWxTvSTimvK+ynZz0/N5/w= X-Received: by 127.0.0.2 with SMTP id PYU0YY7687511xAEndrzSthx; Tue, 07 Nov 2023 04:06:22 -0800 X-Received: from NAM11-BN8-obe.outbound.protection.outlook.com (NAM11-BN8-obe.outbound.protection.outlook.com [40.107.236.40]) by mx.groups.io with SMTP id smtpd.web10.8926.1699358780836586361 for ; Tue, 07 Nov 2023 04:06:21 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Np1yDiWi8PoKYct7UdM6oP9vTWJneTL3lRJINQJ4TadnZrsvB0mrtFV/CeJDM3kXNj0bSHoyBhQ1vJ8Ne/UbZAHXrfc3cfurcuyV2QWGi5nOESS4hzrmWlPcugsXrVz7MAdMq8q7LnAgHZiwsSjIulc1reaSVEc7s08xKddcXUlRpX7Mw4wqKVgBDNll7UiDhqQ7/kmtcMVmklMMeMqLOm84DuQwm/hHr3Vn6KgO/Hd47F07b0orZjDDVfg5Qaw4LubyvKab1m0VgjvRLqLatZcFukDHmkOnY9+mG44PT+nG68Yzypze9Sf1lPkLi+KDKag8N0f7HV1qn7Hi23FVzg== 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=KUa4blwvEtBmQaGDfK+T7i+k+PWGh36KLJ0Gu+XDxQo=; b=GIC1dNSQvB3f0bCG7X/to/TIlPhNj3FSTuJC/jpJcf0H/237BXZHM0Qh385V+X8ikgff70ybPUgPFLqkOu0Qaf5nJnINlOU61a/g8zv26ZWS7Yp7n4EuZhctCAnKpEqvwkwz77I7qZmDnliaJufxhzzfDrsmAPhCXB2TCXDlUXm5AOCRINKQ9MxmKnU0rIGL9c57TFgwFQRNzxgM1mXF1nOPV2cXyS3N1bqstTpETruMUCwXWQvZPxXpMvHj2qd8wqnv3xazyxUofHtLnxWALQB4ruIVMGtua4By9IX7GoEVlixV1tvIG28gsZRkoebMxILvQnH/ngvYYK+wc1/WaQ== 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 PH7PR10MB7802.namprd10.prod.outlook.com (2603:10b6:510:30c::9) 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 12:06:15 +0000 X-Received: from BLAPR10MB5185.namprd10.prod.outlook.com ([fe80::80a5:893c:880b:8754]) by BLAPR10MB5185.namprd10.prod.outlook.com ([fe80::80a5:893c:880b:8754%6]) with mapi id 15.20.6954.029; Tue, 7 Nov 2023 12:06:14 +0000 From: "Igor Kulchytskyy via groups.io" To: "devel@edk2.groups.io" CC: Abner Chang , Nickle Wang Subject: [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: AQHaEXLNd1r6tWwQW0meqWJLTeUNIw== Date: Tue, 7 Nov 2023 12:06:13 +0000 Message-ID: <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: BLAPR10MB5185:EE_|PH7PR10MB7802:EE_ x-ms-office365-filtering-correlation-id: 31c3996d-8653-41b8-cf1b-08dbdf89f004 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam-message-info: kAmTZd/bJjGt860OMG6H0ibsHez4xAHcgcBR+3su8fh0oD3XQASByR2mC+X72jeqzru4CHDyTR6p3wGnJexM8rEjQcFofixIYy+pQ/dv0z1tTwrgxSptlexLG+r8pS1XILmVp1nQxAtOqJ4S8XzavKF4Vtz+wn6jJ8VnVH9DwTmP+CYaPfO+xcjjq8w7Fa2AXJa4NjdHecHz23+64g0ScUBxWQVaKJf1d0sWxAIHpbNoKuA2p61nZzY14gr0s/pTeNif5POHXDH7czMhOUJ4+Xq2gQztNhUzMdtpqdawK+Zzj19AyuBi3M/z+w65rmJyA+B84MN2ABq/+kEX3br1qr7RY76dojpUIBd+2dHwTWxCgYex7+dr7p5LnzYISymrJkIIaa6y29dJg8s3QKvHqaA1EtExhnfDkK7nHYFzXe9np6HvBqGxaKkfHwt8ynaSsGT53t1fWBagTDkqf9YZ79AXDJUiq5CfUOZECRi/WOMJYaGprylOR7YH+qwOkbx6Rxjv4kxBFlRfZw5sW77I8TrOm4PRPyyzI+x50pRktMzb9WG0VnE3ED+Iz0v0rdvFFpjFP+cwTEHzLrycJ5yWEw30xiPYvSU08tMUoerDUTc= x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?iso-8859-1?Q?SOf9y4Psttaj2dxt7vyeU9TvvY+2uB80jyulzlA6SxM7HQvcaupoZ9xMe+?= =?iso-8859-1?Q?IXZB6EPec2tV72h6WbRbBhzL0EYWcNKsN2XpFbLSPFJKttIfYbSiz5lqI+?= =?iso-8859-1?Q?CoMw5zpFUEVc1XT0eW8Sftzq+VXCNCBtjHlkksCHUCiXuL2Tesf7FNGiid?= =?iso-8859-1?Q?JqtKJxRLn9WzoQfOog0uZjaQFOnm7N4zIW1Jize5FCzyCpH2/wxZq0YeIk?= =?iso-8859-1?Q?/kV8qwTeUVIMUrZzmaWCJ8M5GIvnrRqgc3TM9T3XCQLEVvOVWdcJOAeUxG?= =?iso-8859-1?Q?Ie4nhx+szcrQv6u0pEb1w2N3+p3BZnwE8ALWlK1RBTQ3FiY6wRzkxXnNjV?= =?iso-8859-1?Q?sb0nIwYch1qrEbeypKn5GCRBCYj8QFy7guV52gPH6a6ZIGtYhn46qy114G?= =?iso-8859-1?Q?KDSG1N8MuA9sCzIMYUG/7QN791w3ZSfWXXEPi1sE2uTzD3sTggwRFtL1nP?= =?iso-8859-1?Q?hj87AIoLjwfOZihMDrJbobjz0nNwGE55BQ1ec0gNT9PlBB4LiY8uxNbhEt?= =?iso-8859-1?Q?JdbtJXKF6hFuRTkXwqjb4c3soZPwOqeWlVs3x/T+1SJVrcbGPlEiJf7j3S?= =?iso-8859-1?Q?FeKARlLRYj96ZQSXfGuiHs1ajQeal95CWQxrJ9OYsOvzaGOap+RlP7Qfwa?= =?iso-8859-1?Q?DkxNdEimGInQrFnnj0SsAYDFy9Dx1LTpbeeb8NWTEr+aojIEkvnBOWONzZ?= =?iso-8859-1?Q?DRxfBljbhsP3x4eytNhVRREy3OdXpIswkvISnMOlq1VA8Xxo/Wa7LwxG8d?= =?iso-8859-1?Q?EseSmsHgSxC04xMcCumE7F6TMCvRRzdocgGtH1PLQI81E9EKxOIEsTEZ2q?= =?iso-8859-1?Q?VSeP9ufC1Rl+RM7t3Vr7ydY88b7U5k7UcMUemuKM/G/nMuRIM/cSfXYRJO?= =?iso-8859-1?Q?f4MPdYc3vB2Bv+80WYIbXjCGufTwx3yxpM0SDmMttucbysH7cjM+4NEzae?= =?iso-8859-1?Q?+WOSfmgtwgbjDw/iSO/+FtaSGSzfzmzV6FmZoc0bWshBAfjW5F00clIy1Y?= =?iso-8859-1?Q?3afXHexjaci95fzc7dQshMzzzwV+l0Po4CFVlL9A71SJQEGT5Xv6+2i8RR?= =?iso-8859-1?Q?GxctENLKQ20Rn/hRxtEVfuKFhcJbjRigFs8Phxz9ztZ8hGtisnNDKhizkK?= =?iso-8859-1?Q?BJb7MNuq69S1jTjBJ5I3cLBn0RgB5lueUhfQzeFrrf9hGkG6717acoOK/e?= =?iso-8859-1?Q?orYppKhCnVnyk+n44CHVBWNfDd24UdCQqyt2XSFwtYOJ746rmn1vMUZCt6?= =?iso-8859-1?Q?klnSaalWoTUncph7+m96KsjjWRt7VjIhWmAhLOU5N031eYF6VAe96WHl8H?= =?iso-8859-1?Q?WCEFak/VB2Og1AU6n9TCCgvC7UER8aIUeO6xck06srkHaZrw65BadQag0i?= =?iso-8859-1?Q?mzAEJzNgICFY3BRnBegZ8ecR5Tu2b/re4on1G5pGZKvlBTRFxgkgiJMLH+?= =?iso-8859-1?Q?m4ePCBwWxXT321fZw6D6TR9pybtH8i3uT2wJoniafOk3JQtVwfMGuK3Eym?= =?iso-8859-1?Q?gqIRjkOBp3hhGaTvbZiMQoqiOT5SxFTaA8UHPBNKecswny+qOcH3p3Mnhi?= =?iso-8859-1?Q?jXtWlL9ad/WdNB++KCTjem60UZ8qVN+a6r8adOMYXYQQ8A7+LqG7n6OhN9?= =?iso-8859-1?Q?QKZoGuWQG+dqtaMyQNmooQkU6gA5pimCkt?= 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: 31c3996d-8653-41b8-cf1b-08dbdf89f004 X-MS-Exchange-CrossTenant-originalarrivaltime: 07 Nov 2023 12:06:13.2812 (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: bkuUCd5XR9PlFPh6nJuh6wIRT3Nuv98nOS3cxmQqxS4aZkmOrUKTaM/3r0c9XJj3 X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR10MB7802 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: g6udmzhPuxjv6heujU3dfAHfx7686176AA= Content-Language: en-US Content-Type: text/plain; charset="iso-8859-1" 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=UqG9KyYQ; 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}") 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 Signed-off-by: Igor Kulchytskyy --- RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c | 165 ++++++++++++++---= --- 1 file changed, 117 insertions(+), 48 deletions(-) diff --git a/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c b/RedfishPk= g/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; + if (IsListEmpty (&mEfiRedfishDiscoverNetworkInterface)) { + return NULL; + } + ThisNetworkInterface =3D (EFI_REDFISH_DISCOVER_NETWORK_INTERFACE_INTERNA= L *)GetFirstNode (&mEfiRedfishDiscoverNetworkInterface); while (TRUE) { - if (CompareMem ((VOID *)&ThisNetworkInterface->MacAddress, &TargetNetw= orkInterface->MacAddress, ThisNetworkInterface->HwAddressSize) =3D=3D 0) { + if ((CompareMem ((VOID *)&ThisNetworkInterface->MacAddress, &TargetNet= workInterface->MacAddress, ThisNetworkInterface->HwAddressSize) =3D=3D 0) &= & + ((TargetNetworkInterface->IsIpv6 && (ThisNetworkInterface->Network= ProtocolType =3D=3D ProtocolTypeTcp6)) || + (!TargetNetworkInterface->IsIpv6 && (ThisNetworkInterface->Networ= kProtocolType =3D=3D ProtocolTypeTcp4)))) + { return ThisNetworkInterface; } @@ -354,6 +361,10 @@ GetTargetNetworkInterfaceInternalByController ( { EFI_REDFISH_DISCOVER_NETWORK_INTERFACE_INTERNAL *ThisNetworkInterface; + if (IsListEmpty (&mEfiRedfishDiscoverNetworkInterface)) { + return NULL; + } + ThisNetworkInterface =3D (EFI_REDFISH_DISCOVER_NETWORK_INTERFACE_INTERNA= L *)GetFirstNode (&mEfiRedfishDiscoverNetworkInterface); while (TRUE) { if (ThisNetworkInterface->OpenDriverControllerHandle =3D=3D Controller= Handle) { @@ -476,6 +487,42 @@ CheckIsIpVersion6 ( return FALSE; } +/** + 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, &DeviceDescript= or, &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 +559,18 @@ DiscoverRedfishHostInterface ( Status =3D RedfishGetHostInterfaceProtocolData (mSmbios, &DeviceDescript= or, &Data); // Search for SMBIOS type 42h if (!EFI_ERROR (Status) && (Data !=3D NULL) && (DeviceDescriptor !=3D NU= LL)) { + if ((Instance->NetworkInterface->NetworkProtocolType =3D=3D ProtocolTy= peTcp4) && + (Data->HostIpAddressFormat !=3D REDFISH_HOST_INTERFACE_HOST_IP_ADD= RESS_FORMAT_IP4)) // IPv4 case + { + DEBUG ((DEBUG_ERROR, "%a: Network Interface is IPv4, but Host Interf= ace requires Ipv6\n", __func__)); + return EFI_UNSUPPORTED; + } else if ((Instance->NetworkInterface->NetworkProtocolType =3D=3D Pro= tocolTypeTcp6) && + (Data->HostIpAddressFormat !=3D REDFISH_HOST_INTERFACE_HOST= _IP_ADDRESS_FORMAT_IP6)) // IPv6 case + { + DEBUG ((DEBUG_ERROR, "%a: Network Interface is IPv6, but Host Interf= ace requires IPv4\n", __func__)); + return EFI_UNSUPPORTED; + } + // // Check if we can reach out Redfish service using this network interf= ace. // Check with MAC address using Device Descriptor Data Device Type 04 = and Type 05. @@ -1102,6 +1161,7 @@ RedfishServiceGetNetworkInterface ( OUT EFI_REDFISH_DISCOVER_NETWORK_INTERFACE **NetworkIntfInstances ) { + EFI_STATUS Status; EFI_REDFISH_DISCOVER_NETWORK_INTERFACE_INTERNAL *ThisNetworkInterfaceIn= tn; EFI_REDFISH_DISCOVER_NETWORK_INTERFACE *ThisNetworkInterface; EFI_REDFISH_DISCOVER_REST_EX_INSTANCE_INTERNAL *RestExInstance; @@ -1141,13 +1201,23 @@ RedfishServiceGetNetworkInterface ( ThisNetworkInterfaceIntn =3D (EFI_REDFISH_DISCOVER_NETWORK_INTERFACE_INT= ERNAL *)GetFirstNode (&mEfiRedfishDiscoverNetworkInterface); while (TRUE) { + // If Get Subnet Info failed then skip this interface + Status =3D NetworkInterfaceGetSubnetInfo (ThisNetworkInterfaceIntn, Im= ageHandle); // Get subnet info + if (EFI_ERROR (Status)) { + if (IsNodeAtEnd (&mEfiRedfishDiscoverNetworkInterface, &ThisNetworkI= nterfaceIntn->Entry)) { + break; + } + + ThisNetworkInterfaceIntn =3D (EFI_REDFISH_DISCOVER_NETWORK_INTERFACE= _INTERNAL *)GetNextNode (&mEfiRedfishDiscoverNetworkInterface, &ThisNetwork= InterfaceIntn->Entry); + continue; + } + ThisNetworkInterface->IsIpv6 =3D FALSE; if (CheckIsIpVersion6 (ThisNetworkInterfaceIntn)) { ThisNetworkInterface->IsIpv6 =3D TRUE; } CopyMem ((VOID *)&ThisNetworkInterface->MacAddress, &ThisNetworkInterf= aceIntn->MacAddress, ThisNetworkInterfaceIntn->HwAddressSize); - NetworkInterfaceGetSubnetInfo (ThisNetworkInterfaceIntn, ImageHandle);= // Get subnet info. if (!ThisNetworkInterface->IsIpv6) { IP4_COPY_ADDRESS (&ThisNetworkInterface->SubnetId.v4, &ThisNetworkIn= terfaceIntn->SubnetAddr.v4); // IPv4 subnet information. } else { @@ -1230,7 +1300,12 @@ RedfishServiceAcquireService ( 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", __fun= c__)); + return EFI_UNSUPPORTED; + } + + NumNetworkInterfaces =3D 1; } else { TargetNetworkInterfaceInternal =3D (EFI_REDFISH_DISCOVER_NETWORK_INTER= FACE_INTERNAL *)GetFirstNode (&mEfiRedfishDiscoverNetworkInterface); NumNetworkInterfaces =3D NumberOfNetworkInterface (); @@ -1260,7 +1335,13 @@ RedfishServiceAcquireService ( // Get subnet information in case subnet information is not set beca= use // RedfishServiceGetNetworkInterfaces hasn't been called yet. // - NetworkInterfaceGetSubnetInfo (TargetNetworkInterfaceInternal, Image= Handle); + Status1 =3D NetworkInterfaceGetSubnetInfo (TargetNetworkInterfaceInt= ernal, ImageHandle); + if (EFI_ERROR (Status1)) { + DEBUG ((DEBUG_ERROR, "%a: Get subnet information fail.\n", __func_= _)); + FreePool (Instance); + continue; + } + NewInstance =3D TRUE; } @@ -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 thi= s controller handle: %p.\n", __func__, ControllerHandle)); - return EFI_SUCCESS; - } - } + // Already installed + return EFI_UNSUPPORTED; } } - return EFI_UNSUPPORTED; + DEBUG ((DEBUG_MANAGEABILITY, "%a: all required protocols are found on th= is controller handle: %p.\n", __func__, ControllerHandle)); + return EFI_SUCCESS; } /** @@ -1600,10 +1682,24 @@ BuildupNetworkInterface ( EFI_REDFISH_DISCOVER_REST_EX_INSTANCE_INTERNAL *RestExInstance; EFI_TPL OldTpl; BOOLEAN NewNetworkInterfaceInst= alled; + UINT8 IpType; + UINTN ListCount; + ListCount =3D (sizeof (gRequiredProtocol) / sizeof (R= EDFISH_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 not = 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_DISCO= VER_REQUIRED_PROTOCOL))) { - break; - } - continue; } @@ -1631,11 +1722,6 @@ BuildupNetworkInterface ( EFI_OPEN_PROTOCOL_GET_PROTOCOL ); if (EFI_ERROR (Status)) { - Index++; - if (Index =3D=3D (sizeof (gRequiredProtocol) / sizeof (REDFISH_DISCO= VER_REQUIRED_PROTOCOL))) { - break; - } - continue; } @@ -1694,11 +1780,6 @@ BuildupNetworkInterface ( ProtocolDiscoverIdPtr ); if (EFI_ERROR (Status)) { - Index++; - if (Index =3D=3D (sizeof (gRequiredProtocol) / sizeof (REDFISH_DISCO= VER_REQUIRED_PROTOCOL))) { - break; - } - continue; } @@ -1755,25 +1836,13 @@ BuildupNetworkInterface ( } } else { DEBUG ((DEBUG_MANAGEABILITY, "%a: Not REST EX, continue with nex= t\n", __func__)); - Index++; - if (Index =3D=3D (sizeof (gRequiredProtocol) / sizeof (REDFISH_D= ISCOVER_REQUIRED_PROTOCOL))) { - break; - } - continue; } } return Status; - } else { - Index++; - if (Index =3D=3D (sizeof (gRequiredProtocol) / sizeof (REDFISH_DISCO= VER_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 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 (#110847): https://edk2.groups.io/g/devel/message/110847 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-