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 63730940157 for ; Wed, 8 Nov 2023 00:13:39 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=hDaf95Mra77ehwOElSZ9SQTSHkv6+urtKQYjkXYDLXI=; 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=1699402418; v=1; b=EPoSPvhczmtajJxjmYymFu000rrzT4VegJdQ6gmjYf/7ezyyEsgfZB4kRDBAYzhQtNpTT+5h 6I/RfkZtXVZ7JndsM8OQklgKPIMb/sV6meut8z3OE6BSRpFL9KbcYUrX5Z7GT2dBreUtk8hQRLn KGa3skbPiVBArzMWLqTfVhT0= X-Received: by 127.0.0.2 with SMTP id WheJYY7687511xbX7hP25uXm; Tue, 07 Nov 2023 16:13:38 -0800 X-Received: from NAM12-BN8-obe.outbound.protection.outlook.com (NAM12-BN8-obe.outbound.protection.outlook.com [40.107.237.50]) by mx.groups.io with SMTP id smtpd.web10.2586.1699402417183864978 for ; Tue, 07 Nov 2023 16:13:37 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=AeRPUEp6ijrw0PsKREpfFJaxB96h5tD0sHMFYOF66jcoI43a5LDxvd3d/p/ex1bvDhHABAMyAgr7BuCXCJO6ndiAiphKRUprsraJgEIBrJT9ENWl4MAiAIcrg46wURurXgp2/IKqWTPUmn1kSaLbgKrvYZ6qzaMtCRmzAGmTBiTw8JVsnzQf/XiuNSG2I92Pu2OwhIVnnq87rya3RhN8im52WKh9+FSjEIoXE+eyOKPPJ7TBkUwlvqNEqSwG+sIli9jwSvl4a6/6khal7emfBrQaaYPRQgro4jsevBVk/p0KCCkNFLHiRGjw5rKqi9J6XyGl4O/N81rgawCnYwCAww== 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=xX8a4jerh+gTPQDPV+uB4GLyemOzX1m9j0EBhIEMK68=; b=Gh9AeDSDIjviVhnVd7gTNr3wowizj9TTBbgx3yM7aPxXJ6SVcQAa6LYQkazq/Fv5O0eRnZrfQ6hXSLCsmNJi9SYLDo1tPWuHFZogGxC9eST6TNBMml3T4kqtSO91FTR0Qaas+csjtjKEBGRtpq2tD/KZ4EbN1OAYmcaQ750h3QdOM6Onpnde2x457Wn1uKz0MXktZHbqzHl0Yynvm+XsfSyaWNVIP3ACN8NnVOSLQKPCLxL/495nj+gRjDt8zgAYabdUXO0sQrS7704l4KcoxRgCtyuy1Nuxi68NTZ3O//dJA+wuSM9gBK2pthi9x3dtmOMZbO+h2JBFCh+ntbgjAg== 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 CH2PR12MB4923.namprd12.prod.outlook.com (2603:10b6:610:6a::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6954.28; Wed, 8 Nov 2023 00:13:31 +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.027; Wed, 8 Nov 2023 00:13:31 +0000 From: "Chang, Abner via groups.io" To: Igor Kulchytskyy , "devel@edk2.groups.io" CC: Nickle Wang 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: AQHaEXLNd1r6tWwQW0meqWJLTeUNI7BvjbMQ Date: Wed, 8 Nov 2023 00:13:30 +0000 Message-ID: References: <20231107120605.2035-1-igork@ami.com> In-Reply-To: <20231107120605.2035-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=84bc7473-341f-4220-b957-0d68c7fdc6a9;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-08T00:12:45Z;MSIP_Label_4342314e-0df4-4b58-84bf-38bed6170a0f_SiteId=3dd8961f-e488-4e60-8e11-a82d994e183d; x-ms-publictraffictype: Email x-ms-traffictypediagnostic: MN2PR12MB3966:EE_|CH2PR12MB4923:EE_ x-ms-office365-filtering-correlation-id: d05bcb4f-4a82-4b7f-de49-08dbdfef8a14 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam-message-info: k810mG6TgfOHHB+dAHMBUmbSWfQAULrigL6SOnucow0OHwqRE4wgOFGLtBIwDQmwwo16j6v9RwcCia2FUt5bxPTQ875/Tjdj5hqrvYBYJarqoIItAQdQufZSBGfldDQb+CLG6k8ZcNIKyJQVOJTnwSI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8XVtUeUDKFe+mzi5B6erIHO7MfqPgKBqbgURQ7UVs3/eu8gJkINEnH/kaT?= =?us-ascii?Q?S24/gJtVorAE+/5tL3R5kBrQiAxteGkHyY+F9GWLzWWByEqXb1NmP20v1hPh?= =?us-ascii?Q?BkJWY03FeTQYiRGAioJOHfom1MbtKO3De8zcO0Bv8+zypDtpKcnuw0PsDfMr?= =?us-ascii?Q?Nll/mUg8vMgGZYedLWINCIfi3zfzBQyBNugEF7g1Ewx/inlfccZf4HBEpD+z?= =?us-ascii?Q?X0WTOC9jfiIjzKM/d/OPoYrEgyALkSzdah7n5PRe/o+1B70wN4jrAbAqmAej?= =?us-ascii?Q?sIsaTPBEiGG5DMJQbtw=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: d05bcb4f-4a82-4b7f-de49-08dbdfef8a14 X-MS-Exchange-CrossTenant-originalarrivaltime: 08 Nov 2023 00:13:30.9439 (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: 9GqTlJHJnPfduIoL9bTaBR8xfRdYhn4xH0xlQ5CRul9rcOCu4RPLKh2sNh4xzvoYtWc6eThSfCpwc1B5ZlRDnA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH2PR12MB4923 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: TuBUK30PXGsv5rOPLMvzYjNux7686176AA= 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=EPoSPvhc; 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] Reviewed-by: Abner Chang > -----Original Message----- > From: Igor Kulchytskyy > Sent: Tuesday, November 7, 2023 8:06 PM > To: devel@edk2.groups.io > Cc: Chang, Abner ; Nickle Wang > > Subject: [PATCH v3] 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 > 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/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; > > + 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 +361,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 +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, > &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 +559,18 @@ 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 +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 ( > > 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; > } > > 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 ( > > 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 > (TargetNetworkInterfaceInternal, 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 t= his > 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 > this 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 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 +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; > } > > @@ -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; > } > > @@ -1694,11 +1780,6 @@ BuildupNetworkInterface ( > ProtocolDiscoverIdPtr > ); > if (EFI_ERROR (Status)) { > - Index++; > - if (Index =3D=3D (sizeof (gRequiredProtocol) / sizeof > (REDFISH_DISCOVER_REQUIRED_PROTOCOL))) { > - break; > - } > - > continue; > } > > @@ -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; > } > } > > 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 (#110878): https://edk2.groups.io/g/devel/message/110878 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-