Commit 5f36ca1b authored by Felix Fietkau's avatar Felix Fietkau Committed by Jakub Kicinski
Browse files

net: ethernet: mtk_eth_soc: fix L2 offloading with DSA untag offload



Check for skb metadata in order to detect the case where the DSA header
is not present.

Fixes: 2d7605a7 ("net: ethernet: mtk_eth_soc: enable hardware DSA untagging")
Reviewed-by: default avatarSimon Horman <simon.horman@corigine.com>
Signed-off-by: default avatarFelix Fietkau <nbd@nbd.name>
Reviewed-by: default avatarLeon Romanovsky <leonro@nvidia.com>
Link: https://lore.kernel.org/r/20230330120840.52079-2-nbd@nbd.name


Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent 8c1cb87c
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -2057,9 +2057,6 @@ static int mtk_poll_rx(struct napi_struct *napi, int budget,
			skb_checksum_none_assert(skb);
		skb->protocol = eth_type_trans(skb, netdev);

		if (reason == MTK_PPE_CPU_REASON_HIT_UNBIND_RATE_REACHED)
			mtk_ppe_check_skb(eth->ppe[0], skb, hash);

		if (netdev->features & NETIF_F_HW_VLAN_CTAG_RX) {
			if (MTK_HAS_CAPS(eth->soc->caps, MTK_NETSYS_V2)) {
				if (trxd.rxd3 & RX_DMA_VTAG_V2) {
@@ -2087,6 +2084,9 @@ static int mtk_poll_rx(struct napi_struct *napi, int budget,
			__vlan_hwaccel_put_tag(skb, htons(vlan_proto), vlan_tci);
		}

		if (reason == MTK_PPE_CPU_REASON_HIT_UNBIND_RATE_REACHED)
			mtk_ppe_check_skb(eth->ppe[0], skb, hash);

		skb_record_rx_queue(skb, 0);
		napi_gro_receive(napi, skb);

+4 −1
Original line number Diff line number Diff line
@@ -8,6 +8,7 @@
#include <linux/platform_device.h>
#include <linux/if_ether.h>
#include <linux/if_vlan.h>
#include <net/dst_metadata.h>
#include <net/dsa.h>
#include "mtk_eth_soc.h"
#include "mtk_ppe.h"
@@ -699,7 +700,9 @@ void __mtk_ppe_check_skb(struct mtk_ppe *ppe, struct sk_buff *skb, u16 hash)
		    skb->dev->dsa_ptr->tag_ops->proto != DSA_TAG_PROTO_MTK)
			goto out;

		if (!skb_metadata_dst(skb))
			tag += 4;

		if (get_unaligned_be16(tag) != ETH_P_8021Q)
			break;