net: ethernet: mtk_eth_soc: fix RX VLAN offload
authorFelix Fietkau <nbd@nbd.name>
Fri, 23 Apr 2021 05:20:54 +0000 (22:20 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 22 May 2021 08:40:30 +0000 (10:40 +0200)
[ Upstream commit 3f57d8c40fea9b20543cab4da12f4680d2ef182c ]

The VLAN ID in the rx descriptor is only valid if the RX_DMA_VTAG bit is
set. Fixes frames wrongly marked with VLAN tags.

Signed-off-by: Felix Fietkau <nbd@nbd.name>
[Ilya: fix commit message]
Signed-off-by: Ilya Lipnitskiy <ilya.lipnitskiy@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/ethernet/mediatek/mtk_eth_soc.c
drivers/net/ethernet/mediatek/mtk_eth_soc.h

index d10c8a8156bc2f897961742cba21558bdfc378d2..5b072bf80783a1bd4986aab2d4c9df1c69845358 100644 (file)
@@ -964,7 +964,7 @@ static int mtk_poll_rx(struct napi_struct *napi, int budget,
                skb->protocol = eth_type_trans(skb, netdev);
 
                if (netdev->features & NETIF_F_HW_VLAN_CTAG_RX &&
-                   RX_DMA_VID(trxd.rxd3))
+                   (trxd.rxd2 & RX_DMA_VTAG))
                        __vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q),
                                               RX_DMA_VID(trxd.rxd3));
                napi_gro_receive(napi, skb);
index 99b1c8e9f16f981a0603f906280dcd98f7fa1b54..2e7ccd8261c3390055b5ef7538223a37aaf56967 100644 (file)
 #define RX_DMA_DONE            BIT(31)
 #define RX_DMA_PLEN0(_x)       (((_x) & 0x3fff) << 16)
 #define RX_DMA_GET_PLEN0(_x)   (((_x) >> 16) & 0x3fff)
+#define RX_DMA_VTAG            BIT(15)
 
 /* QDMA descriptor rxd3 */
 #define RX_DMA_VID(_x)         ((_x) & 0xfff)