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 7BDFD941CD7 for ; Tue, 14 Nov 2023 17:26:40 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=nFwc3z5uHU1hfSf+q0qBqQBPYDWHtmzZMdiRx7SS3d4=; c=relaxed/simple; d=groups.io; h=Message-ID:Date:MIME-Version:User-Agent:Subject:To:CC:References:From:In-Reply-To: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=1699982799; v=1; b=LMs3pTxjVvTfcf39t1toql9y3//woecEJoljHEO0c+crp8qRgE8QBUpwNOE3ltYdROaeybuD NenUjohk16OfcBpqCukTMzwmL0uCcwSGO2i9RjKFna+T1MXBUSxFyyunlcmncgkVXVpCBfIvttb CiWot4a1O9/VR2INU5Io4bMc= X-Received: by 127.0.0.2 with SMTP id iUxCYY7687511xDaQGSmbr8K; Tue, 14 Nov 2023 09:26:39 -0800 X-Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) by mx.groups.io with SMTP id smtpd.web10.796.1699982798538625299 for ; Tue, 14 Nov 2023 09:26:38 -0800 X-Received: from pps.filterd (m0279862.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 3AEGib8v025697; Tue, 14 Nov 2023 17:26:34 GMT X-Received: from nasanppmta02.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3uc6nuh41u-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 14 Nov 2023 17:26:34 +0000 X-Received: from nasanex01c.na.qualcomm.com (nasanex01c.na.qualcomm.com [10.45.79.139]) by NASANPPMTA02.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 3AEHQXLp027338 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 14 Nov 2023 17:26:33 GMT X-Received: from [10.251.43.200] (10.80.80.8) by nasanex01c.na.qualcomm.com (10.45.79.139) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.39; Tue, 14 Nov 2023 09:26:32 -0800 Message-ID: <3e8c08dc-a665-41f1-8c51-d4e2743bdac1@quicinc.com> Date: Tue, 14 Nov 2023 17:26:29 +0000 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [edk2-devel] [PATCH v5 2/2] RedfishPkg: RedfishDiscoverDxe: Optimize the Redfish Discover flow To: , CC: Abner Chang , Nickle Wang References: <20231114142815.1604-1-igork@ami.com> From: "Leif Lindholm" In-Reply-To: <20231114142815.1604-1-igork@ami.com> X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: nasanex01b.na.qualcomm.com (10.46.141.250) To nasanex01c.na.qualcomm.com (10.45.79.139) X-QCInternal: smtphost X-Proofpoint-ORIG-GUID: bwAaWuKJXZabY6YX6UbtQngrNHL-EOmc X-Proofpoint-GUID: bwAaWuKJXZabY6YX6UbtQngrNHL-EOmc 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,quic_llindhol@quicinc.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: cjcNwYfAFSjk1JGjZOW8U5tqx7686176AA= Content-Language: en-GB Content-Type: text/plain; charset="UTF-8"; format=flowed 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=LMs3pTxj; dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=quicinc.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 2023-11-14 14:28, Igor Kulchytskyy via groups.io wrote: > Filter out the network interfaces which are not supported by > Redfish Host Interface. >=20 > Cc: Abner Chang > Cc: Nickle Wang > Signed-off-by: Igor Kulchytskyy > --- > RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c | 163 +++++++++= +++++------ > RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverInternal.h | 6 + > 2 files changed, 120 insertions(+), 49 deletions(-) >=20 > diff --git a/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c b/Redfish= Pkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c > index 0f622e05a9..ae83cd3c97 100644 > --- a/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c > +++ b/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c > @@ -1601,10 +1681,22 @@ BuildupNetworkInterface ( > EFI_REDFISH_DISCOVER_REST_EX_INSTANCE_INTERNAL *RestExInstance; > EFI_TPL OldTpl; > BOOLEAN NewNetworkInterfaceI= nstalled; > + UINT8 IpType; > + UINTN ListCount; >=20 > + 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 (IS_TCP4_MATCH (IpType) || IS_TCP6_MATCH (IpType)) { The logic of these macros is inverted compared to their names, though. You want this test to read if (!IS_TCP4_MATCH (IpType) && !IS_TCP6_MATCH (IpType)) { > + continue; > + } > + > Status =3D gBS->OpenProtocol ( > // Already in list? > ControllerHandle, > diff --git a/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverInternal.h b/Re= dfishPkg/RedfishDiscoverDxe/RedfishDiscoverInternal.h > index 01454acc1d..3093eea0d5 100644 > --- a/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverInternal.h > +++ b/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverInternal.h > @@ -39,6 +39,12 @@ > #define REDFISH_DISCOVER_VERSION 0x00010000 > #define EFI_REDFISH_DISCOVER_NETWORK_INTERFACE_TPL TPL_NOTIFY >=20 > +#define MAC_COMPARE(ThisNetworkInterface, TargetNetworkInterface) (Comp= areMem ((VOID *)&ThisNetworkInterface->MacAddress, &TargetNetworkInterface-= >MacAddress, ThisNetworkInterface->HwAddressSize)) > +#define VALID_TCP6(TargetNetworkInterface, ThisNetworkInterface) (Targ= etNetworkInterface->IsIpv6 && (ThisNetworkInterface->NetworkProtocolType = =3D=3D ProtocolTypeTcp6)) > +#define VALID_TCP4(TargetNetworkInterface, ThisNetworkInterface) (!Tar= getNetworkInterface->IsIpv6 && (ThisNetworkInterface->NetworkProtocolType = =3D=3D ProtocolTypeTcp4)) > +#define IS_TCP4_MATCH(IpType) ((gRe= quiredProtocol[Index].ProtocolType =3D=3D ProtocolTypeTcp4) && (IpType !=3D= REDFISH_HOST_INTERFACE_HOST_IP_ADDRESS_FORMAT_IP4)) > +#define IS_TCP6_MATCH(IpType) ((gRe= quiredProtocol[Index].ProtocolType =3D=3D ProtocolTypeTcp6) && (IpType !=3D= REDFISH_HOST_INTERFACE_HOST_IP_ADDRESS_FORMAT_IP6)) And these macros to test for =3D=3D, not !=3D Otherwise the code reads like it does the opposite of what it does. (You could also keep the logic and call the macros IS_TCP#_MISMATCH, but=20 that feels a bit convoluted.) Regards, Leif > + > // > // GUID definitions > // > -- > 2.37.1.windows.1 > -The information contained in this message may be confidential and propri= etary to American Megatrends (AMI). This communication is intended to be re= ad only by the individual or entity to whom it is addressed or by their des= ignee. 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 telepho= ne at 770-246-8600, and then delete or destroy all copies of the transmissi= on. >=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 (#111212): https://edk2.groups.io/g/devel/message/111212 Mute This Topic: https://groups.io/mt/102584140/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/leave/12367111/7686176/19134562= 12/xyzzy [rebecca@openfw.io] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-