aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/ramips/files-4.14/drivers/net/ethernet/mediatek/mtk_eth_soc.c
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@nbd.name>2019-03-23 14:29:00 +0100
committerFelix Fietkau <nbd@nbd.name>2019-04-03 10:40:09 +0200
commitc9262a96d1fc0a7fb1ba0806acb3b7aae00b1ecf (patch)
tree4aa71736956430fc63331ec1fed9c0ff5860caf4 /target/linux/ramips/files-4.14/drivers/net/ethernet/mediatek/mtk_eth_soc.c
parent701b8d0050b4d12907ee751fcd4ed6496b9f10fc (diff)
downloadupstream-c9262a96d1fc0a7fb1ba0806acb3b7aae00b1ecf.tar.gz
upstream-c9262a96d1fc0a7fb1ba0806acb3b7aae00b1ecf.tar.bz2
upstream-c9262a96d1fc0a7fb1ba0806acb3b7aae00b1ecf.zip
ramips: implement vlan rx offload on MT7621
Avoids the overhead of software VLAN untagging in the network stack Signed-off-by: Felix Fietkau <nbd@nbd.name>
Diffstat (limited to 'target/linux/ramips/files-4.14/drivers/net/ethernet/mediatek/mtk_eth_soc.c')
-rw-r--r--target/linux/ramips/files-4.14/drivers/net/ethernet/mediatek/mtk_eth_soc.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/target/linux/ramips/files-4.14/drivers/net/ethernet/mediatek/mtk_eth_soc.c b/target/linux/ramips/files-4.14/drivers/net/ethernet/mediatek/mtk_eth_soc.c
index e0bc0ab818..10d9fd7a3e 100644
--- a/target/linux/ramips/files-4.14/drivers/net/ethernet/mediatek/mtk_eth_soc.c
+++ b/target/linux/ramips/files-4.14/drivers/net/ethernet/mediatek/mtk_eth_soc.c
@@ -933,6 +933,11 @@ static int fe_poll_rx(struct napi_struct *napi, int budget,
skb_checksum_none_assert(skb);
skb->protocol = eth_type_trans(skb, netdev);
+ if (netdev->features & NETIF_F_HW_VLAN_CTAG_RX &&
+ RX_DMA_VID(trxd.rxd3))
+ __vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q),
+ RX_DMA_VID(trxd.rxd3));
+
#ifdef CONFIG_NET_MEDIATEK_OFFLOAD
if (mtk_offload_check_rx(priv, skb, trxd.rxd4) == 0) {
#endif
@@ -1585,7 +1590,9 @@ static int fe_probe(struct platform_device *pdev)
if (soc->init_data)
soc->init_data(soc, netdev);
- netdev->vlan_features = netdev->hw_features & ~NETIF_F_HW_VLAN_CTAG_TX;
+ netdev->vlan_features = netdev->hw_features &
+ ~(NETIF_F_HW_VLAN_CTAG_TX |
+ NETIF_F_HW_VLAN_CTAG_RX);
netdev->features |= netdev->hw_features;
if (IS_ENABLED(CONFIG_SOC_MT7621))