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 A379F74003B for ; Thu, 9 Nov 2023 13:56:51 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=wFPfJ/sBg/9xsMBgAcmdFkkplHtKrvl53EFPEyNGA20=; c=relaxed/simple; d=groups.io; h=From:To:Cc:References:In-Reply-To:Subject:Date:Message-ID:MIME-Version:Thread-Index:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Type:Content-Language; s=20140610; t=1699538210; v=1; b=izZ/UyF76q80YgmoFaVS8FAA1DU/zNQQtsyyJeUQ3AARR8J6ed6Fpd25MVZf7GGcfr0t1ixS EYZmlD4vlV+eXbc7vSO57KBndsfUkmvXpkQh5Rhs5/k4EC5DNvCB0t2LXMgmdrrefteOHGxr863 yYm8yft6CI32XNcZLKTLWLMc= X-Received: by 127.0.0.2 with SMTP id AvevYY7687511xVJzmyGuMMn; Thu, 09 Nov 2023 05:56:50 -0800 X-Received: from flee.yi-enter.com (flee.yi-enter.com [162.216.18.248]) by mx.groups.io with SMTP id smtpd.web10.121658.1699538209449421299 for ; Thu, 09 Nov 2023 05:56:49 -0800 X-Received: from look.yi-enter.com (look.yi-enter.com [159.138.153.227]) by flee.yi-enter.com (Postfix) with ESMTPS id ABBF96012A for ; Thu, 9 Nov 2023 21:56:46 +0800 (CST) X-Received: from zrleap.intel-email.com (zrleap.intel-email.com [114.80.218.36]) by look.yi-enter.com (Postfix) with ESMTPS id 8C0C322095A for ; Thu, 9 Nov 2023 21:56:44 +0800 (CST) X-Received: from zrleap.intel-email.com (localhost [127.0.0.1]) by zrleap.intel-email.com (Postfix) with ESMTP id 733B2A32E03E for ; Thu, 9 Nov 2023 21:50:12 +0800 (CST) X-Received: from localhost (localhost [127.0.0.1]) by zrleap.intel-email.com (Postfix) with ESMTP id 5E7ADA32E017 for ; Thu, 9 Nov 2023 21:50:12 +0800 (CST) X-Received: from mail.byosoft.com.cn (mail.byosoft.com.cn [58.240.74.242]) by zrleap.intel-email.com (Postfix) with SMTP id 473C3A32E05C for ; Thu, 9 Nov 2023 21:50:09 +0800 (CST) X-Received: from DESKTOPS6D0PVI ([124.133.49.51]) (envelope-sender ) by 192.168.6.13 with ESMTP(SSL) for ; Thu, 09 Nov 2023 21:49:55 +0800 X-WM-Sender: gaoliming@byosoft.com.cn X-Originating-IP: 124.133.49.51 X-WM-AuthFlag: YES X-WM-AuthUser: gaoliming@byosoft.com.cn From: "gaoliming via groups.io" To: , , "'Kinney, Michael D'" , "'Leif Lindholm'" , "'Andrew Fish'" Cc: "'Igor Kulchytskyy'" , "'Chang, Abner'" References: <20231107120605.2035-1-igork@ami.com> In-Reply-To: Subject: =?UTF-8?B?W2VkazItZGV2ZWxdIOWbnuWkjTogW2VkazItc3RhYmxlMjAyMzExXSBbUEFUQ0ggdjNdIFJlZGZpc2hQa2c6IFJlZGZpc2hEaXNjb3ZlckR4ZTogRml4IGlzc3VlIGlmIElQdjQgaW5zdGFsbGVkIGFmdGVyIFJlc3RFeA==?= Date: Thu, 9 Nov 2023 21:49:58 +0800 Message-ID: <011b01da1313$a157c080$e4074180$@byosoft.com.cn> MIME-Version: 1.0 Thread-Index: AdoTE2WtIXlpaHAMT5+kNttbXW9y+Q== 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,gaoliming@byosoft.com.cn List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: 3MQp3vzVnBOhN4RDmdRf1wOcx7686176AA= Content-Type: multipart/alternative; boundary="----=_NextPart_000_011C_01DA1356.AF7FE280" Content-Language: zh-cn X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20140610 header.b="izZ/UyF7"; 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 ------=_NextPart_000_011C_01DA1356.AF7FE280 Content-Type: text/plain; charset="gb2312" Content-Transfer-Encoding: quoted-printable Nickle: This is a bug fix. Its impact is only in RedfishDiscoverDxe. I think it ca= n be merged for this stable tag.=20 =20 Thanks Liming =B7=A2=BC=FE=C8=CB: devel@edk2.groups.io =B4=FA=B1= =ED Nickle Wang via groups.io =B7=A2=CB=CD=CA=B1=BC=E4: 2023=C4=EA11=D4=C28=C8=D5 10:44 =CA=D5=BC=FE=C8=CB: Liming Gao ; Kinney, Michael = D ; devel@edk2.groups.io =B3=AD=CB=CD: Igor Kulchytskyy ; Chang, Abner =D6=F7=CC=E2: Re: [edk2-devel] [PATCH v3] RedfishPkg: RedfishDiscoverDxe: F= ix issue if IPv4 installed after RestEx =20 Hi @Liming Gao, @Kinney, Michael D =20 > If the patch is sent before Soft Feature Freeze, and plans to catch this stable tag, the patch contributor need reply to his patch and notify edk2 community =20 We would like to include this fix to edk2-stable202311 release. Could you please help us to merge this patch? This patch review was started on November 1: https://edk2.groups.io/g/devel/message/110440. Anber and I gave reviewed-by to this patch today. We have a pull request ready for merging here: https://github.com/tianocore/edk2/pull/4994 =20 Thanks, Nickle =20 > -----Original Message----- > From: devel@edk2.groups.io > On Behalf Of Chang, Abner > via groups.io > Sent: Wednesday, November 8, 2023 8:14 AM > To: Igor Kulchytskyy >; devel@edk2.groups.io =20 > Cc: Nickle Wang > > Subject: Re: [edk2-devel] [PATCH v3] RedfishPkg: RedfishDiscoverDxe: Fix issue if > IPv4 installed after RestEx >=20 > External email: Use caution opening links or attachments >=20 >=20 > [AMD Official Use Only - General] >=20 > Reviewed-by: Abner Chang < abner.chang@amd.com> >=20 > > -----Original Message----- > > From: Igor Kulchytskyy < igork@ami.com> > > Sent: Tuesday, November 7, 2023 8:06 PM > > To: devel@edk2.groups.io > > Cc: Chang, Abner < Abner.Chang@amd.com>; Nickle Wang > > < nicklew@nvidia.com> > > Subject: [PATCH v3] RedfishPkg: RedfishDiscoverDxe: Fix issue if IPv4 > > installed after RestEx > > > > Caution: This message originated from an External Source. Use proper > > caution 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 < abner.chang@amd.com> > > Cc: Nickle Wang < nicklew@nvidia.com> > > Signed-off-by: Igor Kulchytskyy < igork@ami.com> > > --- > > 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 interface. > > // 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 > > *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 because > > // 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 this > > 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 NewNetworkInterfaceInstalled; > > + UINT8 IpType; > > + UINTN ListCount; > > > > + ListCount =3D (sizeof (gRequiredProtocol) / sizeo= f > > (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 > > + not > > match > > + if (((gRequiredProtocol[Index].ProtocolType =3D=3D ProtocolTypeTcp= 4) > > + && > > (IpType =3D=3D REDFISH_HOST_INTERFACE_HOST_IP_ADDRESS_FORMAT_IP6)) || > > + ((gRequiredProtocol[Index].ProtocolType =3D=3D ProtocolTypeTcp= 6) > > + && > > (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, 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 then > delete or destroy all copies of the transmission. >=20 >=20 >=20 >=20 =20 -=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 (#110982): https://edk2.groups.io/g/devel/message/110982 Mute This Topic: https://groups.io/mt/102485712/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- ------=_NextPart_000_011C_01DA1356.AF7FE280 Content-Type: text/html; charset="gb2312" Content-Transfer-Encoding: quoted-printable

Nickle:

 This is a b= ug fix. Its impact is only in RedfishDiscoverDxe. I think it can be merged for this stable ta= g.

 

Thanks

Liming

<= div>

= =B7=A2=BC=FE=C8=CB: devel@edk2.groups.io <devel@edk2.groups.= io> =B4=FA=B1=ED <= /b>Nickle Wang via groups= .io
=B7=A2=CB=CD=CA=B1=BC= =E4: 2023=C4=EA11=D4=C28=C8=D5 10:44
=CA=D5=BC=FE=C8=CB:<= /b> Liming Gao <gaoliming@byosoft.com.cn>; Kinney,= Michael D <michael.d.kinney@intel.com>; devel@edk2.groups.io
=B3=AD=CB=CD: Igor K= ulchytskyy <igork@ami.com>; Chang, Abner <abner.chang@amd.com><= br>=D6=F7=CC=E2:= Re: [edk2-devel] [PATCH v3] RedfishPkg: RedfishDiscoverDxe: Fix issue if I= Pv4 installed after RestEx

 

Hi @Liming Gao, @Kin= ney, Michael D

 

> If the patch is sent before Soft Feature Freeze, and plans = to catch this stable tag, the patch contributor need reply to his patch and= notify edk2 community

 

We would like to include this fix to edk2-stable202311 release. Co= uld you please help us to merge this patch? This patch review was started o= n November 1: htt= ps://edk2.groups.io/g/devel/message/110440. Anber and I gave reviewed-b= y to this patch today. We have a pull request ready for merging here: https://github.com/tiano= core/edk2/pull/4994

 

Thanks,

Nickle

 

&g= t; -----Original Message-----

= > From: devel= @edk2.groups.io <devel@edk2.= groups.io> On Behalf Of Chang, Abner

> via groups.io

=

> Sent: Wednesday, November 8= , 2023 8:14 AM

> To: Igor Kulchytskyy <igork@am= i.com>; devel@edk2.groups.io=

> C= c: Nickle Wang <nicklew@nvidia.com= >

&g= t; Subject: Re: [edk2-devel] [PATCH v3] RedfishPkg: RedfishDiscoverDxe: Fix= issue if

&= gt; IPv4 installed after RestEx

>

> External email: Use caution opening links or attachmen= ts

>

>

> [AMD Official= Use Only - General]

>

> Reviewed-by: Abner Chang <abner.chang@amd.co= m>

>

> > -----Original Message-----

> > From: Igor Kulchytskyy <igork@ami.com>

= > > Sent: Tuesday, November 7, 2023 8:06 PM

> > To: devel@edk2.groups.io

> > Cc: Chang, Abner <Abner.Chang@amd.com>; Nickle Wang

> > <nicklew@nvidia.com>

> > Subject: [PATCH v3] RedfishPkg: Redfis= hDiscoverDxe: Fix issue if IPv4

> > installed after RestEx

=

> >

<= p class=3DMsoPlainText>> > Caution: This message o= riginated from an External Source. Use proper

> > caution when opening attachmen= ts, clicking links, or responding.

> >

> >

> > Supported function of the driver changed to= wait for all newtwork

> > interface to be installed.

> > Filer out the network inter= faces which are not supported by Redfish

> > Host Interface.

> >

> > Cc: Abner Chang <<= a href=3D"mailto:abner.chang@amd.com">abner.chang@amd.com>

> > Cc: Nickle Wang <nicklew@nvidia.com>

> > Signed-off-by: Igor Kulchytsk= yy <igork@ami.com>

> > ---

> >  RedfishPkg/RedfishD= iscoverDxe/RedfishDiscoverDxe.c | 165

> > ++++++++++++++------=

> >  1 file chang= ed, 117 insertions(+), 48 deletions(-)

> >

> > diff --git a/RedfishPkg/RedfishDiscove= rDxe/RedfishDiscoverDxe.c

> > b/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe= .c

> >= ; index 23da3b968f..85e47843e4 100644

> > --- a/RedfishPkg/RedfishDiscoverDxe/Re= dfishDiscoverDxe.c

> > +++ b/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c=

> > = @@ -322,9 +322,16 @@ GetTargetNetworkInterfaceInternal (  {=

> >  =   EFI_REDFISH_DISCOVER_NETWORK_INTERFACE_INTERNAL

> > *ThisNetworkInterface= ;

> >=

> > = +  if (IsListEmpty (&mEfiRedfishDiscoverNetworkInterface)) {<= /o:p>

> > + = ;   return NULL;

> > +  }

> > +

> >    ThisNetworkInterface = =3D

> &g= t; (EFI_REDFISH_DISCOVER_NETWORK_INTERFACE_INTERNAL *)GetFirstNode

> > (&mEf= iRedfishDiscoverNetworkInterface);

> >    while (TRUE) {

> > - &n= bsp;  if (CompareMem ((VOID *)&ThisNetworkInterface->MacAddress= ,

> >= &TargetNetworkInterface->MacAddress, ThisNetworkInterface-

> > >HwAdd= ressSize) =3D=3D 0) {

> > +    if ((CompareMem ((VOID *)&This= NetworkInterface->MacAddress,

> > &TargetNetworkInterface->MacAddress,= ThisNetworkInterface-

> > >HwAddressSize) =3D=3D 0) &&

> > +  &= nbsp;     ((TargetNetworkInterface->IsIpv6 &&= ; (ThisNetworkInterface-

> > >NetworkProtocolType =3D=3D ProtocolTypeTcp6)) |= |

> >= +         (!TargetNetworkInterface= ->IsIpv6 && (ThisNetworkInterface-

> > >NetworkProtocolType =3D=3D= ProtocolTypeTcp4))))

> > +    {

> >     &nbs= p;  return ThisNetworkInterface;

> >      }

> >

> > @@ -354,= 6 +361,10 @@ GetTargetNetworkInterfaceInternalByController (

> > {

> >  &nb= sp; EFI_REDFISH_DISCOVER_NETWORK_INTERFACE_INTERNAL

> > *ThisNetworkInterface;

> >

> > +&n= bsp; if (IsListEmpty (&mEfiRedfishDiscoverNetworkInterface)) {

> > + &n= bsp;  return NULL;

> > +  }

> > +

> >    ThisNetworkInterface =3D=

> > = (EFI_REDFISH_DISCOVER_NETWORK_INTERFACE_INTERNAL *)GetFirstNode<= /span>

> > (&mEfiRe= dfishDiscoverNetworkInterface);

> >    while (TRUE) {<= /span>

> >  &= nbsp;   if (ThisNetworkInterface->OpenDriverControllerHandle = =3D=3D

>= > ControllerHandle) {

> > @@ -476,6 +487,42 @@ CheckIsIpVersion6 (

> >  = ;  return FALSE;

> >  }

<= span lang=3DEN-US>> >

> > +/**

> > +  This function returns the  IP t= ype supported by the Host Interface.

> > +

> > +  @retval 00h is Unknown

> > + &= nbsp;        01h is Ipv4

> > +  &nb= sp;       02h is Ipv6

> > +

<= p class=3DMsoPlainText>> > +**/<= /p>

> > +UINT8

> > +GetHiIpProto= colType (

&= gt; > +  VOID

> > +  )

> > +{

> > +  EFI_STATUS    &= nbsp;           &nbs= p;    Status;

<= span lang=3DEN-US>> > +  REDFISH_OVER_IP_PROTOCOL_DATA  *Da= ta;

> &g= t; +  REDFISH_INTERFACE_DATA       =   *DeviceDescriptor;

> > +

> > +  Data      &= nbsp;      =3D NULL;

> > +  DeviceDescriptor =3D N= ULL;

> &= gt; +  if (mSmbios =3D=3D NULL) {

> > +    Status =3D gBS-&g= t;LocateProtocol (&gEfiSmbiosProtocolGuid, NULL,

<= p class=3DMsoPlainText>> > + (VOID

> > **)&mSmbios)= ;

> >= +    if (EFI_ERROR (Status)) {

> > +    &nbs= p; return

&= gt; > REDFISH_HOST_INTERFACE_HOST_IP_ADDRESS_FORMAT_UNKNOWN;<= /span>

> > +  = ;  }

&= gt; > +  }

> > +

> > +  Status =3D RedfishGetHostInterfaceProtocolData = (mSmbios,

&= gt; > &DeviceDescriptor, &Data); // Search for SMBIOS type 42h

> > +&= nbsp; if (!EFI_ERROR (Status) && (Data !=3D NULL) &&

> > + =      (Data->HostIpAssignmentType =3D=3D RedfishHostI= pAssignmentStatic))

> > + {

> > +    return Data->HostIpAddressForm= at;  }

> > +

> > +  return

> > REDFISH_HOST_INTERFACE_HOST_IP_ADDRESS_FORMAT_UNK= NOWN;

> = > +}

>= ; > +

&g= t; >  /**

> >    This function discover Redfish service= through SMBIOS host interface.

> >

> > @@ -512,6 +559,18 @@ DiscoverRedfishHostInter= face (

>= >

> = >    Status =3D RedfishGetHostInterfaceProtocolData (mSmb= ios,

> &= gt; &DeviceDescriptor, &Data); // Search for SMBIOS type 42h

> > &n= bsp;  if (!EFI_ERROR (Status) && (Data !=3D NULL) && (= DeviceDescriptor !=3D

> > NULL)) {

= > > +    if ((Instance->NetworkI= nterface->NetworkProtocolType =3D=3D

> > ProtocolTypeTcp4) &&

> > + &= nbsp;      (Data->HostIpAddressFormat !=3D=

> > REDFI= SH_HOST_INTERFACE_HOST_IP_ADDRESS_FORMAT_IP4)) // IPv4 case

> > +  &nb= sp; {

> = > +      DEBUG ((DEBUG_ERROR, "%a: Network= Interface is IPv4, but Host

<= span lang=3DEN-US>> > Interface requires Ipv6\n", __func__));

> > +&n= bsp;     return EFI_UNSUPPORTED;

<= p class=3DMsoPlainText>> > +    } e= lse if ((Instance->NetworkInterface->NetworkProtocolType =3D=3D<= /o:p>

> > Protoc= olTypeTcp6) &&

> > +        &nbs= p;      (Data->HostIpAddressFormat !=3D

> > REDFISH_= HOST_INTERFACE_HOST_IP_ADDRESS_FORMAT_IP6)) // IPv6 case<= /p>

> > +   = {

> >= ; +      DEBUG ((DEBUG_ERROR, "%a: Network In= terface is IPv6, but Host

> > Interface requires IPv4\n", __func__));<= /o:p>

> > + = ;     return EFI_UNSUPPORTED;

> > +    }=

> > +

> > = ;     //

<= span lang=3DEN-US>> >      // Check if we ca= n reach out Redfish service using this network interface.=

> >   &= nbsp;  // Check with MAC address using Device Descriptor Data Device

> > Ty= pe 04 and Type 05.

> > @@ -1102,6 +1161,7 @@ RedfishServiceGetNetworkInterface = (

> >=     OUT EFI_REDFISH_DISCOVER_NETWORK_INTERFACE

> > **NetworkIntfI= nstances

&g= t; >    )

> >  {

> > +  EFI_STATUS    = ;            &n= bsp;            = ;          Status;<= /span>

> >  &= nbsp; EFI_REDFISH_DISCOVER_NETWORK_INTERFACE_INTERNAL

=

> > *ThisNetworkInterfaceI= ntn;

> &= gt;    EFI_REDFISH_DISCOVER_NETWORK_INTERFACE

> > *ThisNetworkInt= erface;

>= ; >    EFI_REDFISH_DISCOVER_REST_EX_INSTANCE_INTERNAL&nbs= p;  *RestExInstance;

> > @@ -1141,13 +1201,23 @@ RedfishServiceGetNetworkIn= terface (

&= gt; >

&g= t; >    ThisNetworkInterfaceIntn =3D

> > (EFI_REDFISH_DISCOVER= _NETWORK_INTERFACE_INTERNAL *)GetFirstNode

> > (&mEfiRedfishDiscoverNetworkI= nterface);

= > >    while (TRUE) {

> > +    // If Get Sub= net Info failed then skip this interface

> > +    Status =3D Netw= orkInterfaceGetSubnetInfo (ThisNetworkInterfaceIntn,

<= p class=3DMsoPlainText>> > ImageHandle); // Get su= bnet info

&= gt; > +    if (EFI_ERROR (Status)) {

> > +   &n= bsp;  if (IsNodeAtEnd (&mEfiRedfishDiscoverNetworkInterface,<= /o:p>

> > &T= hisNetworkInterfaceIntn->Entry)) {

> > +      &= nbsp; break;

> > +      }

> > +

> > +    &nbs= p; ThisNetworkInterfaceIntn =3D

> > (EFI_REDFISH_DISCOVER_NETWORK_INTERFACE_INTE= RNAL *)GetNextNode

> > (&mEfiRedfishDiscoverNetworkInterface,

> > &ThisNetwo= rkInterfaceIntn->Entry);

> > +      continue;

> > + =    }

> > +

> >      ThisNetworkInterface->IsIpv= 6 =3D FALSE;

> >      if (CheckIsIpVersion6 (ThisNetwor= kInterfaceIntn)) {

> >        ThisNetworkInt= erface->IsIpv6 =3D TRUE;

> >      }

> >=

> >   &= nbsp;  CopyMem ((VOID *)&ThisNetworkInterface->MacAddress,=

> > &= ThisNetworkInterfaceIntn->MacAddress, ThisNetworkInterfaceIntn-

> > >HwAdd= ressSize);

= > > -    NetworkInterfaceGetSubnetInfo (ThisNetworkInt= erfaceIntn, ImageHandle);

> > // Get subnet info.

> >      = if (!ThisNetworkInterface->IsIpv6) {

> >      &= nbsp; IP4_COPY_ADDRESS (&ThisNetworkInterface->SubnetId.v4,

> > &This= NetworkInterfaceIntn->SubnetAddr.v4); // IPv4 subnet information.

> > &n= bsp;    } else {

> > @@ -1230,7 +1300,12 @@ RedfishServiceAcquire= Service (

&= gt; >

&g= t; >    if (TargetNetworkInterface !=3D NULL) {

> >  = ;    TargetNetworkInterfaceInternal =3D

> > GetTargetNetworkInter= faceInternal (TargetNetworkInterface);

> > -    NumNetworkInterfa= ces           =3D 1;=

> > +&nbs= p;   if (TargetNetworkInterfaceInternal =3D=3D NULL) {=

> > + &nbs= p;    DEBUG ((DEBUG_ERROR, "%a:No network interface on = platform.\n",

> > __func__));

> > +      return EFI_UN= SUPPORTED;

= > > +    }

> > +

> > +    NumNetworkInterfaces = =3D 1;

>= >    } else {

> >      TargetNetwork= InterfaceInternal =3D

> > (EFI_REDFISH_DISCOVER_NETWORK_INTERFACE_INTERNAL *)Get= FirstNode

&= gt; > (&mEfiRedfishDiscoverNetworkInterface);

<= p class=3DMsoPlainText>> >    =   NumNetworkInterfaces        =    =3D NumberOfNetworkInterface ();

> > @@ -1260,7 +1335,13 @@ Redfish= ServiceAcquireService (

> >        // Get sub= net information in case subnet information is not set because

> >  &nb= sp;     // RedfishServiceGetNetworkInterfaces hasn't be= en called yet.

> >        //

> > -  &nbs= p;   NetworkInterfaceGetSubnetInfo (TargetNetworkInterfaceInterna= l,

> >= ; ImageHandle);

> > +      Status1 =3D NetworkInterface= GetSubnetInfo

> > (TargetNetworkInterfaceInternal, ImageHandle);

> > +  &nb= sp;   if (EFI_ERROR (Status1)) {

> > +     &n= bsp;  DEBUG ((DEBUG_ERROR, "%a: Get subnet information fail.\n&qu= ot;,

> &= gt; __func__));

> > +        FreePool (Instan= ce);

> &= gt; +        continue;=

> > +   = ;   }

> > +

> >        NewInstance =3D T= RUE;

> &= gt;      }

> >

> > @@ -1547,25 +1628,26 @@ TestForRequiredPr= otocols (

&= gt; >           &= nbsp;          ControllerHandl= e,

> >= ;            &n= bsp;         EFI_OPEN_PROTOCOL_TEST= _PROTOCOL

&= gt; >           &= nbsp;          );

> > +  =   if (EFI_ERROR (Status)) {

> > +      return EFI_= UNSUPPORTED;

> > +    }

> > +

> > +    Status =3D gBS->Op= enProtocol (

> > +          &n= bsp;         ControllerHandle,=

> > +&nbs= p;            &= nbsp;      gRequiredProtocol[Index].DiscoveredProt= ocolGuid,

&= gt; > +           = ;         (VOID **)&Id,

> > + &= nbsp;           &nbs= p;      This->DriverBindingHandle,

> > +  =             &nb= sp;     ControllerHandle,

> > +     = ;            &n= bsp;  EFI_OPEN_PROTOCOL_GET_PROTOCOL

> > +     &nb= sp;            =   );

&= gt; >      if (!EFI_ERROR (Status)) {

> > - &nb= sp;    Status =3D gBS->OpenProtocol (

> > -   &= nbsp;           &nbs= p;      ControllerHandle,

> > -    =             &nb= sp;     gRequiredProtocol[Index].DiscoveredProtocolGuid= ,

> >= -            &= nbsp;         (VOID **)&Id,

> > -&nb= sp;            =          This->DriverBindingHand= le,

> &g= t; -            = ;          ControllerHandle,

> > -&= nbsp;           &nbs= p;         EFI_OPEN_PROTOCOL_GET_PR= OTOCOL

>= > -           &n= bsp;          );

> > -  &= nbsp;   if (EFI_ERROR (Status)) {

> > -     = ;   if (Index =3D=3D ListCount - 1) {

> > -    &nb= sp;     DEBUG ((DEBUG_INFO, "%a: all required prot= ocols are found on this

> > controller handle: %p.\n", __func__, Controller= Handle));

&= gt; > -          return EFI= _SUCCESS;

&= gt; > -        }

> > -   &n= bsp;  }

> > +      // Already installed=

> > + &nbs= p;    return EFI_UNSUPPORTED;

> >      = }

> >=     }

> >

> > -  return EFI_UNSUPPORTED;

> > +  DEBUG ((DEBUG_MAN= AGEABILITY, "%a: all required protocols are found

> > + on

> > this controller h= andle: %p.\n", __func__, ControllerHandle));

> > +  return EFI_SUCCESS= ;

> >=   }

&g= t; >

>= ; >  /**

> > @@ -1600,10 +1682,24 @@ BuildupNetworkInterface (

> >  = ;  EFI_REDFISH_DISCOVER_REST_EX_INSTANCE_INTERNAL   *RestExI= nstance;

&g= t; >    EFI_TPL       =             &nb= sp;            =           OldTpl;

> >  &n= bsp; BOOLEAN          &nb= sp;            =             &nb= sp;      NewNetworkInterfaceInstalled;<= /span>

> > +  UINT= 8            &n= bsp;            = ;            &n= bsp;      IpType;

> > +  UINTN   &n= bsp;            = ;            &n= bsp;            = ;   ListCount;

> >

> > +  ListCount      = ;            &n= bsp; =3D (sizeof (gRequiredProtocol) / sizeof

> > (REDFISH_DISCOVER_REQUIRED_PRO= TOCOL));

&g= t; >    NewNetworkInterfaceInstalled =3D FALSE;

> >  = ;  Index          &n= bsp;            = ; =3D 0;

&g= t; > -  do {

> > +

> > +  // Get IP Type to filter out unnecessary netwo= rk protocol if

> > + possible  IpType =3D GetHiIpProtocolType ();

> > +

> > +  f= or (Index =3D 0; Index < ListCount; Index++) {

> > +    // Che= ck IP Type and skip an unnecessary network protocol if does

> > + not=

> > match<= /o:p>

> > + = ;   if (((gRequiredProtocol[Index].ProtocolType =3D=3D ProtocolTy= peTcp4)

>= ; > + &&

> > (IpType =3D=3D REDFISH_HOST_INTERFACE_HOST_IP_ADDRESS_FO= RMAT_IP6)) ||

> > +        ((gRequiredProtoco= l[Index].ProtocolType =3D=3D ProtocolTypeTcp6)

> > + &&

> > (IpType =3D=3D RE= DFISH_HOST_INTERFACE_HOST_IP_ADDRESS_FORMAT_IP4)))

> > +    {

> > +&nb= sp;     continue;

> > +    }

> > +

> >   = ;   Status =3D gBS->OpenProtocol (

> >     = ;            &n= bsp;    // Already in list?

> >     &nbs= p;            &= nbsp;   ControllerHandle, @@ -1614,11 +1710,6 @@

> > BuildupNetworkInt= erface (

&g= t; >           &n= bsp;          EFI_OPEN_PROTOCO= L_GET_PROTOCOL

> >          &n= bsp;           );

> > &nb= sp;    if (!EFI_ERROR (Status)) {

> > -    &n= bsp; Index++;

> > -      if (Index =3D=3D (sizeof (gReq= uiredProtocol) / sizeof

> > (REDFISH_DISCOVER_REQUIRED_PROTOCOL))) {<= /span>

> > -  = ;      break;

> > -      }

> > -

> >&nbs= p;       continue;

> >    &nbs= p; }

> &= gt;

> &g= t; @@ -1631,11 +1722,6 @@ BuildupNetworkInterface (

> >    &= nbsp;           &nbs= p;     EFI_OPEN_PROTOCOL_GET_PROTOCOL=

> >   &= nbsp;           &nbs= p;      );

> >      if (EFI_ER= ROR (Status)) {

> > -      Index++;

> > -   &= nbsp;  if (Index =3D=3D (sizeof (gRequiredProtocol) / sizeof

> > (REDFISH_D= ISCOVER_REQUIRED_PROTOCOL))) {

> > -        b= reak;

> = > -      }

> > -

> >      &= nbsp; continue;

> >      }

> >

> > @@ -1694,11 +1780,6 @@ Buildup= NetworkInterface (

> >         &nb= sp;            Proto= colDiscoverIdPtr

> >          =             );<= /o:p>

> > &= nbsp;    if (EFI_ERROR (Status)) {

> > -    &= nbsp; Index++;

> > -      if (Index =3D=3D (sizeof (gRe= quiredProtocol) / sizeof

> > (REDFISH_DISCOVER_REQUIRED_PROTOCOL))) {=

> > - &nbs= p;      break;

> > -      }

> > -

> >&nb= sp;       continue;

> >    &nb= sp; }

> = >

> &= gt; @@ -1755,25 +1836,13 @@ BuildupNetworkInterface (

=

> >    = ;        }

> >     &= nbsp;    } else {

> >       &n= bsp;    DEBUG ((DEBUG_MANAGEABILITY, "%a: Not REST EX, = continue

&g= t; > with next\n", __func__));

> > -      =     Index++;

> > -        = ;  if (Index =3D=3D (sizeof (gRequiredProtocol) / sizeof

> > (REDFISH_DISCO= VER_REQUIRED_PROTOCOL))) {

> > -        =     break;

> > -        &= nbsp; }

>= ; > -

&g= t; >            c= ontinue;

&g= t; >          }<= /span>

> >  &= nbsp;     }

> >

> >        ret= urn Status;

> > -    } else {

> > -      Inde= x++;

> &= gt; -      if (Index =3D=3D (sizeof (gRequiredProt= ocol) / sizeof

> > (REDFISH_DISCOVER_REQUIRED_PROTOCOL))) {

> > -   &n= bsp;    break;

= > > -      }

> > -<= /span>

> > -  = ;    continue;

= > >      }

> > -  } while= (Index < (sizeof (gRequiredProtocol) / sizeof

> > (REDFISH_DISCOVER_REQUIRED= _PROTOCOL)));

> > +  }

> >

> >    return EFI_DEVICE_ERROR;<= /span>

> >  }=

> > --

> > 2.3= 7.1.windows.1

> > -The information contained in this message may be confidential= and

> &= gt; 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 t= heir 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 str= ictly prohibited. Please promptly

> > notify the sender by reply e-mail or by te= lephone at 770-246-8600, and then

> delete or destroy all copies of the transmissio= n.

>

>

>

> =

 

=

_._,_._,_

Groups.io Links:

=20 You receive all messages sent to this group. =20 =20

View/Reply Online (#110982) | =20 | Mute= This Topic | New Topic
Your Subscriptio= n | Contact Group Owner | Unsubscribe [rebecca@openfw.io]

_._,_._,_
------=_NextPart_000_011C_01DA1356.AF7FE280--