From: "Ard Biesheuvel" <ard.biesheuvel@arm.com>
To: devel@edk2.groups.io
Cc: Ard Biesheuvel <ard.biesheuvel@arm.com>,
Pete Batard <pete@akeo.ie>, Jared McNeill <jmcneill@invisible.ca>,
Andrei Warkentin <awarkentin@vmware.com>,
Samer El-Haj-Mahmoud <Samer.El-Haj-Mahmoud@arm.com>
Subject: [PATCH edk2-platforms v2 2/4] Silicon/Broadcom/BcmGenetDxe: add support for broadcast filtering
Date: Sun, 10 May 2020 12:42:57 +0200 [thread overview]
Message-ID: <20200510104259.23739-3-ard.biesheuvel@arm.com> (raw)
In-Reply-To: <20200510104259.23739-1-ard.biesheuvel@arm.com>
Add a helper to configure the first MDF filter for filtering the
broadcast Ethernet address.
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@arm.com>
---
Silicon/Broadcom/Drivers/Net/BcmGenetDxe/GenetUtil.h | 7 ++++++
Silicon/Broadcom/Drivers/Net/BcmGenetDxe/GenetUtil.c | 24 ++++++++++++++++++++
2 files changed, 31 insertions(+)
diff --git a/Silicon/Broadcom/Drivers/Net/BcmGenetDxe/GenetUtil.h b/Silicon/Broadcom/Drivers/Net/BcmGenetDxe/GenetUtil.h
index 2e7b78322bcd..1dc7a51a1ca6 100644
--- a/Silicon/Broadcom/Drivers/Net/BcmGenetDxe/GenetUtil.h
+++ b/Silicon/Broadcom/Drivers/Net/BcmGenetDxe/GenetUtil.h
@@ -107,6 +107,7 @@
#define GENET_UMAC_MDF_CTRL 0xe50
#define GENET_UMAC_MDF_ADDR0(n) (0xe54 + (n) * 0x8)
#define GENET_UMAC_MDF_ADDR1(n) (0xe58 + (n) * 0x8)
+#define GENET_MAX_MDF_FILTER 17
#define GENET_DMA_DESC_COUNT 256
#define GENET_DMA_DESC_SIZE 12
@@ -300,6 +301,12 @@ GenetSetPromisc (
IN BOOLEAN Enable
);
+VOID
+GenetEnableBroadcastFilter (
+ IN GENET_PRIVATE_DATA *Genet,
+ IN BOOLEAN Enable
+ );
+
VOID
GenetDmaInitRings (
IN GENET_PRIVATE_DATA *Genet
diff --git a/Silicon/Broadcom/Drivers/Net/BcmGenetDxe/GenetUtil.c b/Silicon/Broadcom/Drivers/Net/BcmGenetDxe/GenetUtil.c
index af7c06656433..2176bb451e7d 100644
--- a/Silicon/Broadcom/Drivers/Net/BcmGenetDxe/GenetUtil.c
+++ b/Silicon/Broadcom/Drivers/Net/BcmGenetDxe/GenetUtil.c
@@ -492,6 +492,30 @@ GenetSetPromisc (
GenetMmioWrite (Genet, GENET_UMAC_CMD, Value);
}
+/**
+ Enable the MAC filter for the Ethernet broadcast address
+
+ @param Genet[in] Pointer to GENET_PRIVATE_DATA.
+ @param Enable[in] Promiscuous mode state.
+
+**/
+VOID
+GenetEnableBroadcastFilter (
+ IN GENET_PRIVATE_DATA *Genet,
+ IN BOOLEAN Enable
+ )
+{
+ UINT32 Value;
+
+ Value = (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 &= ~BIT0;
+ }
+ GenetMmioWrite (Genet, GENET_UMAC_MDF_CTRL, Value);
+}
+
/**
Configure DMA TX and RX queues, enabling them.
--
2.17.1
next prev parent reply other threads:[~2020-05-10 10:43 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-10 10:42 [PATCH edk2-platforms v2 0/4] BCM genet fixes Ard Biesheuvel
2020-05-10 10:42 ` [PATCH edk2-platforms v2 1/4] Silicon/Broadcom/BcmGenetDxe: whitespace/cosmetic cleanup Ard Biesheuvel
2020-05-10 10:42 ` Ard Biesheuvel [this message]
2020-05-10 10:42 ` [PATCH edk2-platforms v2 3/4] Silicon/Broadcom/BcmGenetDxe: fix multicast/broadcast handling Ard Biesheuvel
2020-05-10 10:42 ` [PATCH edk2-platforms v2 4/4] Silicon/Broadcom/BcmGenetDxe: avoid uncached memory for streaming DMA Ard Biesheuvel
2020-05-10 21:36 ` [PATCH edk2-platforms v2 0/4] BCM genet fixes Ard Biesheuvel
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200510104259.23739-3-ard.biesheuvel@arm.com \
--to=devel@edk2.groups.io \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox