Thread (1 message) 1 message, 1 author, 14d ago

Re: [PATCH net-next v3 4/8] net: dsa: Add tag handling for SoC-e switches

From: Vasilij Strassheim <hidden>
Date: 2026-09-25 12:46:43
Also in: linux-devicetree, lkml, sashiko-reviews

On Thu, 2026-09-24 at 10:40 +0000, sashiko-bot@kernel.org wrote:
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] net: dsa: tag_sdsa: unsupported VLAN tags left in hwaccel metadata
--

commit c9312ab6752036eeab3076e94713c79223982016
Author: Vasilij Strassheim [off-list ref]

net: dsa: Add tag handling for SoC-e switches

This commit adds a DSA tag driver for SoC-e switches, which use an 8-byte
SDSA header carrying frame direction, port, and VLAN metadata. The header
is inserted between the source MAC address and the original EtherType on
transmit and receive.
quoted
diff --git a/net/dsa/tag_sdsa.c b/net/dsa/tag_sdsa.c
new file mode 100644
index 0000000000000..8cc3fa357be42
--- /dev/null
+++ b/net/dsa/tag_sdsa.c
[ ... ]
quoted
+static struct sk_buff *sdsa_xmit(struct sk_buff *skb, struct net_device *dev)
+{
+	struct dsa_port *dp = dsa_user_to_port(dev);
+	struct sdsa_tag *tag;
+	u16 vlan_tci;
[ ... ]
quoted
+	/* SDSA carries no TPID, so only encode 802.1Q C-tags. */
+	if (skb_vlan_tag_present(skb) &&
+	    skb->vlan_proto == htons(ETH_P_8021Q)) {
+		vlan_tci = skb_vlan_tag_get(skb);
+		__vlan_hwaccel_clear_tag(skb);
+		tag->frame_type_port_hi |= SDSA_TAG_VLAN_BIT;
+		tag->vlan = cpu_to_be16(vlan_tci);
+	} else {
+		tag->vlan = 0;
+	}
[Severity: High]
Does this else branch leave unsupported VLAN tags (like 802.1ad) in the 
skb's hardware accelerated metadata?

If a user configures an unsupported VLAN protocol on a DSA user port, the 
skb will still have skb_vlan_tag_present(skb) set when reaching sdsa_xmit().
Because this branch does not clear the tag via __vlan_hwaccel_clear_tag(skb),
the conduit driver's MAC hardware might subsequently insert the remaining 
VLAN tag at the MAC boundary.

Could this insertion displace the 8-byte SDSA header just pushed, causing 
the switch hardware to receive unrecognized frames and drop them?
That's right, I missed it. I will fix it in a similar way to tag_ks8995.
quoted
+
+	return skb;
+}
  
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help