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 1CF6FAC178B for ; Wed, 15 Nov 2023 18:28:04 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=QU90zLk0X8DeLSgpKMwgy01jelR0aWMuGOduGP/Rf44=; c=relaxed/simple; d=groups.io; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject:To:Cc:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Type:Content-Transfer-Encoding; s=20140610; t=1700072883; v=1; b=Bdo7nTkyA/evg4aYwzcrqd3qkiPuI6SlKo7ByOXVTUM7zrv4uEiptUh3/zJieoXp4G1FHZYs bFZlO0tIlN8NCvUMGgPoJ9x4E8Bza/8ve+gzZfVcs+qyyfoezZ+m4GuWQ+ro4Rx2BFEjPfTthXg pIK2StETbW5Kzfia08oU2lDE= X-Received: by 127.0.0.2 with SMTP id awDYYY7687511xNO71eDR2ro; Wed, 15 Nov 2023 10:28:03 -0800 X-Received: from mail-yw1-f171.google.com (mail-yw1-f171.google.com [209.85.128.171]) by mx.groups.io with SMTP id smtpd.web11.21029.1700072883008129204 for ; Wed, 15 Nov 2023 10:28:03 -0800 X-Received: by mail-yw1-f171.google.com with SMTP id 00721157ae682-5a877e0f0d8so9635317b3.1 for ; Wed, 15 Nov 2023 10:28:02 -0800 (PST) X-Gm-Message-State: zKODm9tlLAN8EEBIF1llyyGRx7686176AA= X-Google-Smtp-Source: AGHT+IEQTM4lvWnlOLFOC2NUZLB1so0kbDnazSz17ktAkTMFhZOPKRZk3tbPYyFDI8VM2IjE7TDeweINpWhswNuIogY= X-Received: by 2002:a81:8704:0:b0:5c0:fb63:53ad with SMTP id x4-20020a818704000000b005c0fb6353admr5499691ywf.18.1700072882016; Wed, 15 Nov 2023 10:28:02 -0800 (PST) MIME-Version: 1.0 References: <20231114142815.1604-1-igork@ami.com> <3e8c08dc-a665-41f1-8c51-d4e2743bdac1@quicinc.com> <2f8fbb9f-bca8-4771-9178-6f0507ad089e@quicinc.com> In-Reply-To: From: "Mike Maslenkin" Date: Wed, 15 Nov 2023 21:27:26 +0300 Message-ID: Subject: Re: [edk2-devel] [PATCH v5 2/2] RedfishPkg: RedfishDiscoverDxe: Optimize the Redfish Discover flow To: Igor Kulchytskyy Cc: Leif Lindholm , "devel@edk2.groups.io" , Abner Chang , Nickle Wang 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,mike.maslenkin@gmail.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: Content-Type: text/plain; charset="UTF-8" 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=Bdo7nTky; dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=gmail.com (policy=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 On Wed, Nov 15, 2023 at 4:52=E2=80=AFPM Igor Kulchytskyy wr= ote: > > Hello Leif and Mike, > Let me try to explain the idea of the filtering IP. > That filtering should work only if we know exactly that IP is IPv4 or IPv= 6 in SMBIOS Type 42. Hm. I've already composed a reply below, but then a returned to this statement... Is this a difference in condition between v3 and v5? I came to the conclusion that at the place we are discussing SMBIOS table 42h can be absent because PlatformHostInterfaceInformationReady hasn't been called yet, so REDFISH_HOST_INTERFACE_HOST_IP_ADDRESS_FORMAT_UNKNOWN is expected. > And it just helping to reduce the work in case we know the exact type of = IP, which supposed to be used in BIOS BMC communication. > In that case there is no need to build network interface for the unused I= P Type. > On some systems IP address could be dynamic and we will not be able to kn= ow the version of IP from SMBIOS. > If you see I check HostIpAssignmentType in GetHiIpProtocolType function. = And return IP type UNKNOWN if it is not static. > If we get an unknown IP type, we should not return from BuildupNetworkInt= erface function, but just proceed and build the network interface for all I= Ps. > So, later Redfish Discover driver can find the right one. > Based on this logic I'm going to prepare the patch v6. > Thank you, > Igor Agree.. I was focused on edk2 implementation of RedfishPlatformHostInterfaceLib and PlatformHostInterfaceBmcUsbNicLib where HostIpAddressFormat is specified (hardcoded). I guess HostIpAddressFormat as well as SMBIOS table 42h must be available by the time RedfishServiceAcquireService()->DiscoverRedfishHostInterface() call, while it might be not available at the moment RedfishDiscoverDriverBindingStart()->BuildupNetworkInterface(). So, condition from v3 looks correct to me. My main concern was introduction of defines. Those don't look great. Those are huge (it even doesn't fit into the screen) and misleading a bit. For example: +#define MAC_COMPARE(ThisNetworkInterface, TargetNetworkInterface) (CompareMem ((VOID *)&ThisNetworkInterface->MacAddress, &TargetNetworkInterface->MacAddress, ThisNetworkInterface->HwAddressSize)) The proposed variant is equal to #define MAC_COMPARE(A, B) (CompareMem ((VOID *)&ThisNetworkInterface->MacAddress, &TargetNetworkInterface->MacAddress, ThisNetworkInterface->HwAddressSize)), i.e a bit useless. I would expect it could be declared at least as: #define MAC_COMPARE(This, Target) CompareMem ((VOID *)&(This)->MacAddress, &(Target)->MacAddress, (This)->HwAddressSize) I.e define should really replace some arguments also reducing the line len= gth. BTW: there is a place in ValidateTargetNetworkInterface() where CompareMem can be replaced with MAC_COMPARE too. Also, I found IP6_LINK_EQUAL(Mac1, Mac2) define, that is unused in edk2. But according to that one, please consider moving "=3D=3D 0" check to #define declaration. But I do not think this macro is required at all, because there are 5 MAC compares left in this module. So, it just brings some inconsistency. Agreed that static helper function would be the best. Leif, do you expect something like this? STATIC BOOLEAN FilterInterface ( IN NETWORK_INTERFACE_PROTOCOL_TYPE ProtocolType, IN UINT8 HostIpAddressFormat ) { // This is based on v5, but according to the comments above // v3 is correct as it allows REDFISH_HOST_INTERFACE_HOST_IP_ADDRESS_FORMAT_UNKNOWN if (ProtocolType =3D=3D ProtocolTypeTcp4) { return IpType !=3D REDFISH_HOST_INTERFACE_HOST_IP_ADDRESS_FORMAT_IP4; } else if (ProtocolType =3D=3D ProtocolTypeTcp6) { return IpType !=3D REDFISH_HOST_INTERFACE_HOST_IP_ADDRESS_FORMAT_IP6; } return false; } and then:: // 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 mat= ch if (FilterInterface (gRequiredProtocol[Index].ProtocolType, IpType)) { continue; } Regards, Mike. -=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 (#111286): https://edk2.groups.io/g/devel/message/111286 Mute This Topic: https://groups.io/mt/102584140/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-