From ca30cd47fe7fd1a7eabf6ec120b8d142cfd7eeef Mon Sep 17 00:00:00 2001 From: Linus Walleij Date: Wed, 16 Sep 2026 12:20:59 +0200 Subject: net: dsa: tag_ks8995: Add the KS8995 tag handling The KS8995 100Mbit switch can do proper DSA per-port tagging with the proper set-up. This adds the code to handle ingress and egress KS8995 tags. The tagger is used by the KSZ8995XA support added later in this series. The tag is a modified 0x8100 ethertype tag where a bit in the last nibble is set for each target port. Always insert a distinct outer switch tag. User ports remove this field on egress, so reusing an existing 802.1Q header would consume the sender VLAN tag instead of preserving it. Push any hardware-accelerated VLAN tag into the packet first. This keeps the switch tag at offset 12 while retaining 802.1Q, 802.1ad and stacked VLAN headers as inner payload, and avoids relying on a valid SKB MAC header in direct transmit paths. Rate-limit receive untagging errors so repeated failures cannot flood the kernel log. Reviewed-by: Nicolai Buchwitz Signed-off-by: Linus Walleij Link: https://patch.msgid.link/20260916-ks8995-to-ksz8-v15-2-8825ff5fd4be@kernel.org Signed-off-by: Jakub Kicinski --- include/net/dsa.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'include') diff --git a/include/net/dsa.h b/include/net/dsa.h index 7507d632e7c6..5d12191b6f6f 100644 --- a/include/net/dsa.h +++ b/include/net/dsa.h @@ -61,6 +61,7 @@ struct tc_action; #define DSA_TAG_PROTO_NETC_VALUE 33 #define DSA_TAG_PROTO_KSZ8463_VALUE 34 #define DSA_TAG_PROTO_MT7628_VALUE 35 +#define DSA_TAG_PROTO_KS8995_VALUE 36 enum dsa_tag_protocol { DSA_TAG_PROTO_NONE = DSA_TAG_PROTO_NONE_VALUE, @@ -99,6 +100,7 @@ enum dsa_tag_protocol { DSA_TAG_PROTO_NETC = DSA_TAG_PROTO_NETC_VALUE, DSA_TAG_PROTO_KSZ8463 = DSA_TAG_PROTO_KSZ8463_VALUE, DSA_TAG_PROTO_MT7628 = DSA_TAG_PROTO_MT7628_VALUE, + DSA_TAG_PROTO_KS8995 = DSA_TAG_PROTO_KS8995_VALUE, }; struct dsa_switch; -- cgit v1.2.3