public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Michal Simek <michal.simek@amd.com>
To: u-boot@lists.denx.de, git@amd.com
Cc: Andrew Goodbody <andrew.goodbody@linaro.org>,
	Jerome Forissier <jerome.forissier@arm.com>,
	Patrice Chotard <patrice.chotard@foss.st.com>,
	Peng Fan <peng.fan@nxp.com>,
	Sai Varun Venkatapuram <saivarun.venkatapuram@amd.com>,
	Siddharth Vadapalli <s-vadapalli@ti.com>,
	Tom Rini <trini@konsulko.com>
Subject: Re: [PATCH] net: xilinx: Reject broadcast and multicast packets in AXI Ethernet MAC
Date: Tue, 7 Apr 2026 13:10:07 +0200	[thread overview]
Message-ID: <2c495b7e-7816-4880-89bd-0fa237d779c9@amd.com> (raw)
In-Reply-To: <07ad94eb8a3a9d80273a16a7ac8c7caaba607fe2.1774282153.git.michal.simek@amd.com>



On 3/23/26 17:09, Michal Simek wrote:
> Set the XAE_RAF_BCSTREJ_MASK bit in the Reset and Address Filter (RAF)
> register during hardware initialization to make the MAC drop incoming
> frames with broadcast destination address. This avoids unnecessary
> broadcast traffic processing by the CPU.
> 
> Additionally, when IPv6 is not enabled (CONFIG_IPV6), also set the
> XAE_RAF_MCSTREJ_MASK bit to reject multicast frames. Multicast
> rejection is skipped when IPv6 is configured because IPv6 Neighbor
> Discovery and DHCPv6 rely on multicast.
> 
> Expose the RAF register (offset 0x0) in struct axi_regs which was
> previously hidden in a reserved array.
> 
> Signed-off-by: Michal Simek <michal.simek@amd.com>
> ---
> 
>   drivers/net/xilinx_axi_emac.c | 20 +++++++++++++++++++-
>   1 file changed, 19 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/xilinx_axi_emac.c b/drivers/net/xilinx_axi_emac.c
> index e9cc5db52d25..1ea81fe1830a 100644
> --- a/drivers/net/xilinx_axi_emac.c
> +++ b/drivers/net/xilinx_axi_emac.c
> @@ -28,6 +28,10 @@
>   #define XAE_EMMC_LINKSPD_100	0x40000000 /* Link Speed mask for 100 Mbit */
>   #define XAE_EMMC_LINKSPD_1000	0x80000000 /* Link Speed mask for 1000 Mbit */
>   
> +/* Reset and Address Filter (RAF) Register bit definitions */
> +#define XAE_RAF_MCSTREJ_MASK	0x00000002 /* Reject rx multicast dst addr */
> +#define XAE_RAF_BCSTREJ_MASK	0x00000004 /* Reject rx broadcast dst addr */
> +
>   /* Interrupt Status/Enable/Mask Registers bit definitions */
>   #define XAE_INT_RXRJECT_MASK	0x00000008 /* Rx frame rejected */
>   #define XAE_INT_MGTRDY_MASK	0x00000080 /* MGT clock Lock */
> @@ -153,7 +157,8 @@ static struct axidma_bd tx_bd __attribute((aligned(DMAALIGN)));
>   static struct axidma_bd rx_bd __attribute((aligned(DMAALIGN)));
>   
>   struct axi_regs {
> -	u32 reserved[3];
> +	u32 raf; /* 0x0: Reset and Address Filter */
> +	u32 reserved[2];
>   	u32 is; /* 0xC: Interrupt status */
>   	u32 reserved2;
>   	u32 ie; /* 0x14: Interrupt enable */
> @@ -528,6 +533,19 @@ static int axi_ethernet_init(struct axidma_priv *priv)
>   	/* Set default MDIO divisor */
>   	writel(XAE_MDIO_DIV_DFT | XAE_MDIO_MC_MDIOEN_MASK, &regs->mdio_mc);
>   
> +	/*
> +	 * Reject broadcast and multicast frames at MAC level to reduce
> +	 * unnecessary traffic processing. Multicast rejection is only
> +	 * enabled when IPv6 is not configured because IPv6 Neighbor
> +	 * Discovery and DHCPv6 rely on multicast.
> +	 */
> +	if (!IS_ENABLED(CONFIG_IPV6))
> +		writel(readl(&regs->raf) | XAE_RAF_MCSTREJ_MASK |
> +		       XAE_RAF_BCSTREJ_MASK, &regs->raf);
> +	else
> +		writel(readl(&regs->raf) | XAE_RAF_BCSTREJ_MASK,
> +		       &regs->raf);
> +
>   	debug("axiemac: InitHw done\n");
>   	return 0;
>   }

Applied.
M

      reply	other threads:[~2026-04-07 11:10 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-23 16:09 [PATCH] net: xilinx: Reject broadcast and multicast packets in AXI Ethernet MAC Michal Simek
2026-04-07 11:10 ` Michal Simek [this message]

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-all 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=2c495b7e-7816-4880-89bd-0fa237d779c9@amd.com \
    --to=michal.simek@amd.com \
    --cc=andrew.goodbody@linaro.org \
    --cc=git@amd.com \
    --cc=jerome.forissier@arm.com \
    --cc=patrice.chotard@foss.st.com \
    --cc=peng.fan@nxp.com \
    --cc=s-vadapalli@ti.com \
    --cc=saivarun.venkatapuram@amd.com \
    --cc=trini@konsulko.com \
    --cc=u-boot@lists.denx.de \
    /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