Re: [PATCH net-next v4 2/2] net: stmmac: dwxgmac2: Add support for HW-accelerated VLAN stripping

From: Simon Horman
Date: Thu Apr 24 2025 - 08:17:39 EST


On Tue, Apr 22, 2025 at 12:29:30AM +0800, Boon Khai Ng wrote:
> This patch adds support for MAC level VLAN tag stripping for the
> dwxgmac2 IP. This feature can be configured through ethtool.
> If the rx-vlan-offload is off, then the VLAN tag will be stripped
> by the driver. If the rx-vlan-offload is on then the VLAN tag
> will be stripped by the MAC.
>
> Signed-off-by: Boon Khai Ng <boon.khai.ng@xxxxxxxxxx>
> Reviewed-by: Matthew Gerlach <matthew.gerlach@xxxxxxxxxx>

...

> diff --git a/drivers/net/ethernet/stmicro/stmmac/dwxgmac2_descs.c b/drivers/net/ethernet/stmicro/stmmac/dwxgmac2_descs.c

...

> @@ -69,6 +70,21 @@ static int dwxgmac2_get_tx_ls(struct dma_desc *p)
> return (le32_to_cpu(p->des3) & XGMAC_RDES3_LD) > 0;
> }
>
> +static u16 dwxgmac2_wrback_get_rx_vlan_tci(struct dma_desc *p)
> +{
> + return (le32_to_cpu(p->des0) & XGMAC_RDES0_VLAN_TAG_MASK);

nit: The outer parentheses are not needed on the line above.

return le32_to_cpu(p->des0) & XGMAC_RDES0_VLAN_TAG_MASK;


> +}

...