[PATCH] net: xilinx: Reject broadcast and multicast packets in AXI Ethernet MAC
Michal Simek
michal.simek at amd.com
Tue Apr 7 13:10:07 CEST 2026
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 at 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, ®s->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(®s->raf) | XAE_RAF_MCSTREJ_MASK |
> + XAE_RAF_BCSTREJ_MASK, ®s->raf);
> + else
> + writel(readl(®s->raf) | XAE_RAF_BCSTREJ_MASK,
> + ®s->raf);
> +
> debug("axiemac: InitHw done\n");
> return 0;
> }
Applied.
M
More information about the U-Boot
mailing list