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 7F35778043D for ; Thu, 2 Nov 2023 08:03:44 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=CXZd9aPGd6eMncdvlgHYe99hOnHsSRDRwvTY0+RuYfQ=; 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:msip_labels: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=1698912222; v=1; b=hU3vNITx+IpLRzci/iCQ0YjSARDDVYNt9Xw8lXtYl7f0X2oC9YrePfXCOxfoxkWZ5lL7wrKE +JNnxgqHQxnbWFNsXfOgS+tNJB4HE6/BYv23YdkXpuuek2Pe0OP3tFwp4Fau4f/aS0XGfFCEqps OVMq8D5izFo3jhkkOgOPMGlc= X-Received: by 127.0.0.2 with SMTP id ZNZHYY7687511xQ8PbYBcPtT; Thu, 02 Nov 2023 01:03:42 -0700 X-Received: from NAM02-DM3-obe.outbound.protection.outlook.com (NAM02-DM3-obe.outbound.protection.outlook.com [40.107.95.48]) by mx.groups.io with SMTP id smtpd.web11.25824.1698912221861951843 for ; Thu, 02 Nov 2023 01:03:42 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=eKvv45M0yjr5Eco1+0GIMlfSvHXv4Np3dSEoakOTV46rbqlAfZ8oLzPXAzHQycZ/xpAcWZglwFxEfq8c0hRajnCoECO8lO2sRDbDM4bQ5AiRXtME7fUm4ig20yEzrOq/IBM5bbjUM8nc42rOryxVMGcYr7gIAFzlXAxHtgIbRSRjDLxyBuCa0Mn2CBU1L1yXxjXwgXiV+0aPgLSlRGqEn4SRqJMQR08K8Ni0lkaybhU8qius5F8Y6AxN+Gi53o0QsEg8N+DkBOgH+fSinN0nnax3pWEzjRUyNbAOwbevpzxqKsYeFTi0RjkepRCLAlDq4aj63cuqA8lwsSUz+wYK9A== 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=yxCllDRBeFBTdIr2H87shQ1/GtQVvLn4EiJsPbgMcpU=; b=VJXW7HOltQzzwpRtJ1vAOcJiSWo8iSXMHWOpBBLYhhnbLzIKz5u6Qf7IqPXhaOAl1OSadHTaXkG4UQuxUd9Q/+1gzbvCdnqtsWf7IrpwpO578pm21Emv0Lw42e4XHLDI1jBv+YCvGl01X5fa3WMFgEKp5GU0Fa+WKCPmYGrbIzxGISsO7QoLopLvrTgfIVvkZlX2stPL5X/vZpbD70E/+i7yC0ADj0/aHy97axGy/23P51nhh4e91g79YibaX0lSW4a5tlz3Au98Q8/ByKKoZKkNGCJGL7a3z0KNGfFWDk3Zve0+uhgR8Sv+qf8XJvRXFJkT8T490uc8Tr0qJqsG7A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass header.d=amd.com; arc=none X-Received: from MN2PR12MB3966.namprd12.prod.outlook.com (2603:10b6:208:165::18) by PH7PR12MB7843.namprd12.prod.outlook.com (2603:10b6:510:27e::11) 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 08:03:36 +0000 X-Received: from MN2PR12MB3966.namprd12.prod.outlook.com ([fe80::e670:e45f:fa32:2420]) by MN2PR12MB3966.namprd12.prod.outlook.com ([fe80::e670:e45f:fa32:2420%7]) with mapi id 15.20.6954.019; Thu, 2 Nov 2023 08:03:36 +0000 From: "Chang, Abner via groups.io" To: Igor Kulchytskyy , "devel@edk2.groups.io" CC: Nickle Wang , 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: AQHaDQB3wfq9MU8sPUiRl4StxWQjabBmqS8Q Date: Thu, 2 Nov 2023 08:03:35 +0000 Message-ID: References: <20231101201704.1504-1-igork@ami.com> In-Reply-To: <20231101201704.1504-1-igork@ami.com> Accept-Language: en-US, zh-CN X-MS-Has-Attach: X-MS-TNEF-Correlator: msip_labels: MSIP_Label_4342314e-0df4-4b58-84bf-38bed6170a0f_ActionId=51e4f52a-d8f3-4569-be38-6f03eedef24f;MSIP_Label_4342314e-0df4-4b58-84bf-38bed6170a0f_ContentBits=0;MSIP_Label_4342314e-0df4-4b58-84bf-38bed6170a0f_Enabled=true;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_SetDate=2023-11-02T07:52:58Z;MSIP_Label_4342314e-0df4-4b58-84bf-38bed6170a0f_SiteId=3dd8961f-e488-4e60-8e11-a82d994e183d; x-ms-publictraffictype: Email x-ms-traffictypediagnostic: MN2PR12MB3966:EE_|PH7PR12MB7843:EE_ x-ms-office365-filtering-correlation-id: f0c91b4e-6081-4a81-1ba4-08dbdb7a368e x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam-message-info: 09Zn52c6Lmr5IQ1tnP0v71XcaevAN21sRnsUgoyCOpO20QNmvO77Yw9moez5oESoyz0llHBtI2A8K2djo2fauoYU79+NoXgupvvX/FkUcovdmntHeC4KCvIIuTKBsuiizg5mwU/UesAcRhhbM8BMCt4MfY7bJ3VjN4idOO39zeEHVz+Qvb9j62nw2HA0fp+Lv+AAfZ8R9RwEbNrxlqvEoLeRWuNG/tcZbtCX/kUXqTIYqP6xX4JdHF9caajMxwnwECBNsQ4IDUzdnoX0K7v7qnlFTS5hl0Q2+1KtolEsPLDUBZI9yq+c87HyU5wMHXp/ilaT0n7yRr9jpyRpqmJo/w/nFRR92xx2I0AQDRaO66dIP5CJ39EaiaoqwalcIUvVSnucJcOQSTUHA5+6PbobEsOe+mYYtfpXwqb+f8rM/RT9bwzgFDNDoEwKOf7hUFh2htohv4aViY7QhI0pk3QQ3gJXIlaJoojrQ6wUnxqO58WrLptyrTEeQ8wtV3v0BBZmBQLD1KuI3n8Tj0X+xOWc8ZWD3rVDKbPS7H/k9S923HSbA9Ojlkcc9VSsyLUIVCK1hqTtMsz7RX4ttHg9F6MxftejmWgdHsWjilErxeU6SHNKjekcE8M/skjm629AAnuXykPVJjj5ufsoTsqbrpY97JCCkj/Gtkf13SHvUAChrJU= x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?z0VqQSGy/fCHFfG/siadYV0Pjy4lIFUnlBe/YzgL+dnAoxswxsagaA9O2J/U?= =?us-ascii?Q?7P+2Th02LW3sBFKkUxXTJc0K01+GS+nIariYHnu/5OchsJ6c4OtinVNW3m4E?= =?us-ascii?Q?csCSPdDPlEFqKdnnnwFLcRUpIeV5wjULfermLOTDka5h0CDYNSLeZfSN+ufc?= =?us-ascii?Q?5VYyacwbv0emUmvWAjoaH5BBahhwsHFalxLBXWeNXX5tVgrO3JyPACbL22Dq?= =?us-ascii?Q?t2jdI8Uni/4fM4KYelE6M5rX8/+jFP8t9BAQTpfWNnayx6quzjVNzcficKnH?= =?us-ascii?Q?gGsXRmW1nrnfTeBv4oTSG6QekX8b3wNTGtYCjWYgRnZNKphglTNGmnGnCBEv?= =?us-ascii?Q?7u90WOVAicOJ+ZRRlQgM21EjTl8RIGKWiazX2RQvassyfmE/ob2yZ7xJKK1f?= =?us-ascii?Q?CAgPrBZHywdt9JRpVpTb7zFd1LMv2xm42r7iQLOC+XgIdR+UMkf04gfr9Zqs?= =?us-ascii?Q?lid5Dhj4aU9K0TjjIIvu0SBZkf1UGiSJoqAAE/BAbW4oJXnxU8XpjZe+wOxw?= =?us-ascii?Q?SfXBho85x+kmscXNaNPIr4HbILOua12ZlFjn5HfxLI5EfkKbivEyG8T3c/mM?= =?us-ascii?Q?oi0mcJQZGUlhwm8eO8BJcV/1+H1/SPF3ch8kcDLxcDC9mVEXqfDAudSbGlAB?= =?us-ascii?Q?YkYFQtKav6IVMHR1rplDZu24SjkReJNMwbY/aJkfnZM/BRshE2OhAMrNT4b4?= =?us-ascii?Q?WlT1e2PTMomTEVHqGJ8M5/dsXiAT+zogd0GhhfvcU4KVM9mzvM3TMy5xddPE?= =?us-ascii?Q?PzTdJ5OiaoV2ZeU6w8rVD0rvP4u+QpLZnVRzZXX8vyBtgdyzJIj2oZCIRltv?= =?us-ascii?Q?b1yRsLtJ0qOOCDqV63CGeD4bYxeIuWOWMeUjy7lAnKtI5/UBwFyMz0GiqPfF?= =?us-ascii?Q?SP9SVXvuO/uGUhYdkgZaIT6p0fnXRoLOsJYdF2NjnYIGnpsPZh4XDl1ynejI?= =?us-ascii?Q?V9t2wUS3hjcxU86uYF5kuldT2AOdazjOWZRLqlBJa9VMHISIv7CGq9LEiOK1?= =?us-ascii?Q?2jmWuERMpE4kUuTypNiutfQlFuYg2TllwFLjJO/ehvTd0RmsS+bBDISmuVQL?= =?us-ascii?Q?LdwmUokVEWIHf/1UUFkDoGZdEBnD68rVCXqvH738KL1HFSyFU+3qU1mywOoM?= =?us-ascii?Q?49lY9CfMfvIFGB0d/tnnqTk1t9jkUiRTlXd3iaBUiJa5dydQU9rch8LbEulq?= =?us-ascii?Q?m7ZQ/zOHT1NJFPM0K09MlWEF8gSE2LlkAkzpvy7u8NtTX2lLN0c8iDZOG9dr?= =?us-ascii?Q?7JpZ5RBCkrML+1jw5rHYXW2YTvebUA05jwdH2mxm0deWGD+/NWYJEV07Q/jN?= =?us-ascii?Q?hNoRv//o8i5tiVvtGZOdOcLPU9HrFqMkDrMjKFVoN/+i5eEa/HsrAXZElcCj?= =?us-ascii?Q?1VyfVRuHzcJEL9ELmMrVbacxHhx+PJSf1ubEDFYEpQUZBUtXusb2dfX6W7Jw?= =?us-ascii?Q?eOGkqbblG6XtzyLo08wSpknYjAimq4jNPmyIulyLCXz2rGRxGPzKhQnfjDXo?= =?us-ascii?Q?Z+ju7+s4zoNMRjBiT5eBKbJFNWfiRlYmD2SRLJ366g+d9J9LC3qx1UXLrWks?= =?us-ascii?Q?dvSKAbcw9T7GVeamjdM=3D?= MIME-Version: 1.0 X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: MN2PR12MB3966.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: f0c91b4e-6081-4a81-1ba4-08dbdb7a368e X-MS-Exchange-CrossTenant-originalarrivaltime: 02 Nov 2023 08:03:35.0665 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: J8c321gTPSz2onceiOZ8XMfDgakRlhHCp3baNx+kpF6+oQA9DY7s+MiKka9xHO90vuG28r5EAEISURD6m9wcoA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR12MB7843 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,abner.chang@amd.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: T3kyQNxQgu3sCuaxvwqKtBZ8x7686176AA= 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=hU3vNITx; 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 [AMD Official Use Only - General] Only one comment in line. > -----Original Message----- > From: Igor Kulchytskyy > Sent: Thursday, November 2, 2023 4:18 AM > To: devel@edk2.groups.io > Cc: Chang, Abner ; Nickle Wang > ; Mike Maslenkin > Subject: [PATCH v2] RedfishPkg: RedfishDiscoverDxe: Fix issue if IPv4 ins= talled > after RestEx > > Caution: This message originated from an External Source. Use proper caut= ion > when opening attachments, clicking links, or responding. > > > 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 > ControllerHandle) { > @@ -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() STATIC UINT8 GetHiIpProtocolType(VOID) Abner > +{ > + 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_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, > &DeviceDescriptor, &Data); // Search for SMBIOS type 42h > if (!EFI_ERROR (Status) && (Data !=3D NULL) && (DeviceDescriptor !=3D = NULL)) { > + > + if (Instance->NetworkInterface->NetworkProtocolType =3D=3D > ProtocolTypeTcp4 && Data->HostIpAddressFormat !=3D > REDFISH_HOST_INTERFACE_HOST_IP_ADDRESS_FORMAT_IP4) { // IPv4 case > + DEBUG ((DEBUG_ERROR, "%a: Network Interface is IPv4, but Host > Interface 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 > Interface 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 > (TargetNetworkInterfaceInternal, ImageHandle); > + if (EFI_ERROR(Status1)) { > + DEBUG ((DEBUG_ERROR, "%a: Get subnet information fail.\n", > __func__)); > + 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 > controller 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 > proprietary 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 > designee. If the reader of this message is not the intended recipient, yo= u 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 telep= hone > at 770-246-8600, and then delete or destroy all copies of the transmissio= n. -=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 (#110503): https://edk2.groups.io/g/devel/message/110503 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-