]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
net: ethernet: mtk_eth_soc: fix tx vlan tag for llc packets
authorFelix Fietkau <nbd@nbd.name>
Sun, 31 Aug 2025 18:20:07 +0000 (20:20 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 9 Sep 2025 16:58:10 +0000 (18:58 +0200)
[ Upstream commit d4736737110ffa83d29f1c5d17b26113864205f6 ]

When sending llc packets with vlan tx offload, the hardware fails to
actually add the tag. Deal with this by fixing it up in software.

Fixes: 656e705243fd ("net-next: mediatek: add support for MT7623 ethernet")
Reported-by: Thibaut VARENE <hacks@slashdirt.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Reviewed-by: Simon Horman <horms@kernel.org>
Link: https://patch.msgid.link/20250831182007.51619-1-nbd@nbd.name
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/ethernet/mediatek/mtk_eth_soc.c

index 272f178906d61f82f326c4d938a47429480e78df..64d86068b51eb48fdbe3e602014218fde935e2a3 100644 (file)
@@ -1606,6 +1606,13 @@ static netdev_tx_t mtk_start_xmit(struct sk_buff *skb, struct net_device *dev)
        bool gso = false;
        int tx_num;
 
+       if (skb_vlan_tag_present(skb) &&
+           !eth_proto_is_802_3(eth_hdr(skb)->h_proto)) {
+               skb = __vlan_hwaccel_push_inside(skb);
+               if (!skb)
+                       goto dropped;
+       }
+
        /* normally we can rely on the stack not calling this more than once,
         * however we have 2 queues running on the same ring so we need to lock
         * the ring access
@@ -1651,8 +1658,9 @@ static netdev_tx_t mtk_start_xmit(struct sk_buff *skb, struct net_device *dev)
 
 drop:
        spin_unlock(&eth->page_lock);
-       stats->tx_dropped++;
        dev_kfree_skb_any(skb);
+dropped:
+       stats->tx_dropped++;
        return NETDEV_TX_OK;
 }