public inbox for linux-arm-kernel@lists.infradead.org
 help / color / mirror / Atom feed
From: Felix Fietkau <nbd@nbd.name>
To: netdev@vger.kernel.org, Sean Wang <sean.wang@mediatek.com>,
	Landen Chao <Landen.Chao@mediatek.com>,
	DENG Qingfang <dqfext@gmail.com>, Andrew Lunn <andrew@lunn.ch>,
	Vivien Didelot <vivien.didelot@gmail.com>,
	Florian Fainelli <f.fainelli@gmail.com>,
	Vladimir Oltean <olteanv@gmail.com>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	Matthias Brugger <matthias.bgg@gmail.com>
Cc: linux-arm-kernel@lists.infradead.org,
	linux-mediatek@lists.infradead.org, linux-kernel@vger.kernel.org
Subject: [PATCH 10/14] net: dsa: tag_mtk: parse hwaccel VLAN tags
Date: Mon,  7 Nov 2022 19:54:48 +0100	[thread overview]
Message-ID: <20221107185452.90711-10-nbd@nbd.name> (raw)
In-Reply-To: <20221107185452.90711-1-nbd@nbd.name>

Pull the port information from the VLAN protocol ID field

Signed-off-by: Felix Fietkau <nbd@nbd.name>
---
 net/dsa/tag_mtk.c | 26 +++++++++++++++++++++-----
 1 file changed, 21 insertions(+), 5 deletions(-)

diff --git a/net/dsa/tag_mtk.c b/net/dsa/tag_mtk.c
index 445d6113227f..0dfa2354f77d 100644
--- a/net/dsa/tag_mtk.c
+++ b/net/dsa/tag_mtk.c
@@ -73,13 +73,18 @@ static struct sk_buff *mtk_tag_rcv(struct sk_buff *skb, struct net_device *dev)
 	if (unlikely(!pskb_may_pull(skb, MTK_HDR_LEN)))
 		return NULL;
 
-	phdr = dsa_etype_header_pos_rx(skb);
-	hdr = ntohs(*phdr);
+	if (skb_vlan_tag_present(skb)) {
+		hdr = ntohs(skb->vlan_proto);
+		__vlan_hwaccel_clear_tag(skb);
+	} else {
+		phdr = dsa_etype_header_pos_rx(skb);
+		hdr = ntohs(*phdr);
 
-	/* Remove MTK tag and recalculate checksum. */
-	skb_pull_rcsum(skb, MTK_HDR_LEN);
+		/* Remove MTK tag and recalculate checksum. */
+		skb_pull_rcsum(skb, MTK_HDR_LEN);
 
-	dsa_strip_etype_header(skb, MTK_HDR_LEN);
+		dsa_strip_etype_header(skb, MTK_HDR_LEN);
+	}
 
 	/* Get source port information */
 	port = (hdr & MTK_HDR_RECV_SOURCE_PORT_MASK);
@@ -93,11 +98,22 @@ static struct sk_buff *mtk_tag_rcv(struct sk_buff *skb, struct net_device *dev)
 	return skb;
 }
 
+static void mtk_tag_flow_dissect(const struct sk_buff *skb, __be16 *proto,
+				 int *offset)
+{
+	if (!skb_vlan_tag_present(skb))
+		return dsa_tag_generic_flow_dissect(skb, proto, offset);
+
+	*offset = 0;
+	*proto = ((__be16 *)skb->data)[-1];
+}
+
 static const struct dsa_device_ops mtk_netdev_ops = {
 	.name		= "mtk",
 	.proto		= DSA_TAG_PROTO_MTK,
 	.xmit		= mtk_tag_xmit,
 	.rcv		= mtk_tag_rcv,
+	.flow_dissect	= mtk_tag_flow_dissect,
 	.needed_headroom = MTK_HDR_LEN,
 };
 
-- 
2.38.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  parent reply	other threads:[~2022-11-07 18:57 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-07 18:54 [PATCH 01/14] net: ethernet: mtk_eth_soc: account for vlan in rx header length Felix Fietkau
2022-11-07 18:54 ` [PATCH 02/14] net: ethernet: mtk_eth_soc: increase tx ring side for QDMA devices Felix Fietkau
2022-11-07 18:54 ` [PATCH 03/14] net: ethernet: mtk_eth_soc: avoid port_mg assignment on MT7622 and newer Felix Fietkau
2022-11-07 18:54 ` [PATCH 04/14] net: ethernet: mtk_eth_soc: implement multi-queue support for per-port queues Felix Fietkau
2022-11-07 18:54 ` [PATCH 05/14] net: dsa: tag_mtk: assign " Felix Fietkau
2022-11-07 20:40   ` Vladimir Oltean
2022-11-08  6:18     ` Felix Fietkau
2022-11-07 21:22   ` Vladimir Oltean
2022-11-08  6:01     ` Felix Fietkau
2022-11-08  7:58       ` Vladimir Oltean
2022-11-08  9:20         ` Felix Fietkau
2022-11-07 18:54 ` [PATCH 06/14] net: ethernet: mediatek: ppe: assign per-port queues for offloaded traffic Felix Fietkau
2022-11-07 18:54 ` [PATCH 07/14] net: ethernet: mtk_eth_soc: compile out netsys v2 code on mt7621 Felix Fietkau
2022-11-07 18:54 ` Felix Fietkau [this message]
2022-11-07 18:54 ` [PATCH 11/14] net: ethernet: mtk_eth_soc: fix VLAN rx hardware acceleration Felix Fietkau
2022-11-07 23:32   ` Vladimir Oltean
2022-11-08  6:17     ` Felix Fietkau
2022-11-07 18:54 ` [PATCH 12/14] net: ethernet: mtk_eth_soc: work around issue with sending small fragments Felix Fietkau
2022-11-07 18:54 ` [PATCH 13/14] net: ethernet: mtk_eth_soc: set NETIF_F_ALL_TSO Felix Fietkau
2022-11-07 18:54 ` [PATCH 14/14] net: ethernet: mtk_eth_soc: drop packets to WDMA if the ring is full Felix Fietkau
2022-11-07 20:55 ` [PATCH 01/14] net: ethernet: mtk_eth_soc: account for vlan in rx header length Vladimir Oltean
2022-11-08  6:18   ` Felix Fietkau

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20221107185452.90711-10-nbd@nbd.name \
    --to=nbd@nbd.name \
    --cc=Landen.Chao@mediatek.com \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=dqfext@gmail.com \
    --cc=edumazet@google.com \
    --cc=f.fainelli@gmail.com \
    --cc=kuba@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=matthias.bgg@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=olteanv@gmail.com \
    --cc=pabeni@redhat.com \
    --cc=sean.wang@mediatek.com \
    --cc=vivien.didelot@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox