From nobody Mon Feb 9 14:38:14 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+59053+1787277+3901457@groups.io; helo=web01.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+59053+1787277+3901457@groups.io ARC-Seal: i=1; a=rsa-sha256; t=1589180830; cv=none; d=zohomail.com; s=zohoarc; b=WAcdIkIAnntDURkGWuqZgeHaVqwj/DXd5OstRcsn6+qryWQTmS0u7rhuOO5USSbH8BGrL4F9YjDjXO82nQ3DAUXh9AKDOZPuHoTKa0WWBgutY8eb0nbXs3YBCQFdzywZ+rM8uXWdMpcdjR4SSo4pY6Z5U80BUqs+rntT3VpPiUg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1589180830; h=Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:Message-ID:Reply-To:References:Sender:Subject:To; bh=soECcINP35QHsZIfkVayNc0DKHLNckjhggR9AWP2MUw=; b=iBynVM7gzLGJMTekagiGmxLmxp6MHZRjQn+eKNb/4Sd/VZr+Y02F0zvgYMXFmkJMapQAaDjjitZXRauzwTp6d/PF5292m72tDZlrOIa+BhPhyH3oW3vd6zvNrQX1boIUrPiPUCDGYMZnDcXDGTWNfD6YHnzdT8+9YUJOZ01O//Q= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+59053+1787277+3901457@groups.io Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1589180830598384.28056055491743; Mon, 11 May 2020 00:07:10 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id vGx1YY1788612xuWCiGeRoNX; Mon, 11 May 2020 00:07:10 -0700 X-Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web10.7679.1589180829676458717 for ; Mon, 11 May 2020 00:07:09 -0700 X-Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 675A8D6E; Mon, 11 May 2020 00:07:09 -0700 (PDT) X-Received: from e123331-lin.nice.arm.com (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id F208B3F68F; Mon, 11 May 2020 00:07:07 -0700 (PDT) From: "Ard Biesheuvel" To: devel@edk2.groups.io Cc: Ard Biesheuvel , Pete Batard , Jared McNeill , Andrei Warkentin , Samer El-Haj-Mahmoud Subject: [edk2-devel] [PATCH edk2-platforms v3 3/5] Silicon/Broadcom/BcmGenetDxe: fix multicast/broadcast handling Date: Mon, 11 May 2020 09:06:54 +0200 Message-Id: <20200511070656.32141-4-ard.biesheuvel@arm.com> In-Reply-To: <20200511070656.32141-1-ard.biesheuvel@arm.com> References: <20200511070656.32141-1-ard.biesheuvel@arm.com> Precedence: Bulk List-Unsubscribe: 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,ard.biesheuvel@arm.com X-Gm-Message-State: gstiTLyhrnxgo7hMB04TVCX7x1787277AA= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1589180830; bh=5/fi13Pkl31t/85ikvJAOBj671iWM6nmis5NGJq1lIk=; h=Cc:Date:From:Reply-To:Subject:To; b=tEjDWQPgEJKKK5bfrxuteajxpoCmbPFu0QMz4q+Psgh1dxMNt54ViPixqCY4W2KxM4Z h7nwKZXHYdq+xAictiTl2NHHKdepDXvE0GeWPME+4dPncjp/euQR43CssjIMlbTKqIhJs ryuFNhgy/6AVh8eqVH+hsK/d+nBxYQlxaAc= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Move the handling of the promiscuous receive control to the SNP ReceiveFilters() method where it belongs. Given that we do not support multicast filtering, only minimal handling is required to test the promiscuous bit and program the MAC accordingly. Any multicast handling will be done by the MNP layer above it. For reception of broadcast frames, wire up the new helper that programs the MDF filter bank accordingly. Signed-off-by: Ard Biesheuvel --- Silicon/Broadcom/Drivers/Net/BcmGenetDxe/DriverBinding.c | 7 +++---- Silicon/Broadcom/Drivers/Net/BcmGenetDxe/GenetUtil.c | 19 ++++++++++++= ++----- Silicon/Broadcom/Drivers/Net/BcmGenetDxe/SimpleNetwork.c | 20 +++++++++---= -------- 3 files changed, 26 insertions(+), 20 deletions(-) diff --git a/Silicon/Broadcom/Drivers/Net/BcmGenetDxe/DriverBinding.c b/Sil= icon/Broadcom/Drivers/Net/BcmGenetDxe/DriverBinding.c index e3d015dd0820..a6102421cc26 100644 --- a/Silicon/Broadcom/Drivers/Net/BcmGenetDxe/DriverBinding.c +++ b/Silicon/Broadcom/Drivers/Net/BcmGenetDxe/DriverBinding.c @@ -154,11 +154,10 @@ GenetDriverBindingStart ( Genet->SnpMode.NvRamSize =3D 0; Genet->SnpMode.NvRamAccessSize =3D 0; Genet->SnpMode.ReceiveFilterMask =3D EFI_SIMPLE_NETWORK_RECEIVE_UNI= CAST | - EFI_SIMPLE_NETWORK_RECEIVE_MULTI= CAST | EFI_SIMPLE_NETWORK_RECEIVE_BROAD= CAST | - EFI_SIMPLE_NETWORK_RECEIVE_PROMI= SCUOUS | - EFI_SIMPLE_NETWORK_RECEIVE_PROMI= SCUOUS_MULTICAST; - Genet->SnpMode.ReceiveFilterSetting =3D Genet->SnpMode.ReceiveFilterMa= sk; + EFI_SIMPLE_NETWORK_RECEIVE_PROMI= SCUOUS; + Genet->SnpMode.ReceiveFilterSetting =3D EFI_SIMPLE_NETWORK_RECEIVE_UNI= CAST | + EFI_SIMPLE_NETWORK_RECEIVE_BROAD= CAST; Genet->SnpMode.MaxMCastFilterCount =3D 0; Genet->SnpMode.MCastFilterCount =3D 0; Genet->SnpMode.IfType =3D NET_IFTYPE_ETHERNET; diff --git a/Silicon/Broadcom/Drivers/Net/BcmGenetDxe/GenetUtil.c b/Silicon= /Broadcom/Drivers/Net/BcmGenetDxe/GenetUtil.c index 2176bb451e7d..746fbfe51b1d 100644 --- a/Silicon/Broadcom/Drivers/Net/BcmGenetDxe/GenetUtil.c +++ b/Silicon/Broadcom/Drivers/Net/BcmGenetDxe/GenetUtil.c @@ -505,13 +505,22 @@ GenetEnableBroadcastFilter ( IN BOOLEAN Enable ) { - UINT32 Value; + CONST EFI_MAC_ADDRESS *MacAddr =3D &Genet->SnpMode.CurrentAddress; + UINT32 Value; =20 - Value =3D (1U << GENET_MAX_MDF_FILTER) - 1; if (Enable) { - GenetMmioWrite (Genet, GENET_UMAC_MDF_ADDR0 (0), 0xffff); - GenetMmioWrite (Genet, GENET_UMAC_MDF_ADDR1 (0), 0xffffffff); - Value &=3D ~BIT0; + GenetMmioWrite (Genet, GENET_UMAC_MDF_ADDR0 (0), + MacAddr->Addr[1] | MacAddr->Addr[0] << 8); + GenetMmioWrite (Genet, GENET_UMAC_MDF_ADDR1 (0), + MacAddr->Addr[5] | MacAddr->Addr[4] << 8 | + MacAddr->Addr[3] << 16 | MacAddr->Addr[2] << 24); + + GenetMmioWrite (Genet, GENET_UMAC_MDF_ADDR0 (1), 0xffff); + GenetMmioWrite (Genet, GENET_UMAC_MDF_ADDR1 (1), 0xffffffff); + + Value =3D (1U << GENET_MAX_MDF_FILTER) & ~(BIT1 | BIT0); + } else { + Value =3D 0; } GenetMmioWrite (Genet, GENET_UMAC_MDF_CTRL, Value); } diff --git a/Silicon/Broadcom/Drivers/Net/BcmGenetDxe/SimpleNetwork.c b/Sil= icon/Broadcom/Drivers/Net/BcmGenetDxe/SimpleNetwork.c index bf28448445d1..e6de4653cde9 100644 --- a/Silicon/Broadcom/Drivers/Net/BcmGenetDxe/SimpleNetwork.c +++ b/Silicon/Broadcom/Drivers/Net/BcmGenetDxe/SimpleNetwork.c @@ -148,10 +148,6 @@ GenetSimpleNetworkInitialize ( } =20 GenetSetMacAddress (Genet, &Genet->SnpMode.CurrentAddress); - /* - * TODO: this belongs in GenetSimpleNetworkReceiveFilters, not here. - */ - GenetSetPromisc (Genet, TRUE); =20 GenetDmaInitRings (Genet); =20 @@ -306,6 +302,10 @@ GenetSimpleNetworkReceiveFilters ( } =20 Genet =3D GENET_PRIVATE_DATA_FROM_SNP_THIS (This); + if (((Enable | Disable) & ~Genet->SnpMode.ReceiveFilterMask) !=3D 0 || + (!ResetMCastFilter && MCastFilterCnt > Genet->SnpMode.MaxMCastFilter= Count)) { + return EFI_INVALID_PARAMETER; + } if (Genet->SnpMode.State =3D=3D EfiSimpleNetworkStopped) { return EFI_NOT_STARTED; } @@ -313,13 +313,11 @@ GenetSimpleNetworkReceiveFilters ( return EFI_DEVICE_ERROR; } =20 - // - // Can't actually return EFI_UNSUPPORTED, so just ignore the filters - // (we set promiscuous mode ON inside GenetSimpleNetworkInitialize). - // - // TODO: move promisc handling here. - // TODO 2: support multicast/broadcast. - // + GenetEnableBroadcastFilter (Genet, + (Enable & ~Disable & EFI_SIMPLE_NETWORK_RECEIVE_BROADCAST) !=3D 0); + + GenetSetPromisc (Genet, + (Enable & ~Disable & EFI_SIMPLE_NETWORK_RECEIVE_PROMISCUOUS) !=3D 0); =20 return EFI_SUCCESS; } --=20 2.17.1 -=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 (#59053): https://edk2.groups.io/g/devel/message/59053 Mute This Topic: https://groups.io/mt/74130976/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-