Skip to contentSkip to conversation

net: dsa: microchip: Add support for KSZ8995XA/KS8995XA

PATCH Applied Linus Walleij 5 participants 17 messages Sep 16 – Sep 19

Subsystems (5)
lore
Share & tools
lore
#0 lore raw

v15 cover net: dsa: microchip: Add support for KSZ8995XA/KS8995XA

This series breaks with the dated attempt to polish the old KS8995 driver, and instead implement support for the KS8995XA in the KSZ driver, and after that delete the old KS8995 driver.

The hardware clearly has the same ancestry, the KSZ8995XA is just a rebrand of the much older Micrel KX8995XA switch.

The old driver identified the shared 0x95/0x0 ID as KS8995MA, but this ID cannot distinguish MA from XA. No KS8995MA users are known, and KS8995E has no documented SPI management interface. Neither variant has been verified with the replacement driver.

Add new compatibles, add special code paths for the KSZ8995XA, including support for its two-level DCB priority model, and add a new tagger for the special front tag found in the KSZ8995XA.

The patches, including the per-port PHY reset polling, were tested with the Actiontec MI424WR rev D (which has the KS8995XA) and OpenWrt as userspace.

Assisted-by LLM

---
Changes in v15:
- Require a complete, linear Ethernet header before KS8995 TX tag
insertion, rejecting truncated frames and pulling fragmented headers.
Fringe case, but the AI found it so fixed it up.
- Link to v14: https://patch.msgid.link/[email protected]

Changes in v14:
- Add a KS8995 flow dissector using the four-byte in-band RX tag length, keeping the eight-byte TX headroom reservation separate.
- Link to v13: https://patch.msgid.link/[email protected]

Changes in v13:
- Limit XA apptrust to one selector at a time, since PCP and DSCP results
are ORed rather than ordered; reject both-enabled readback as well.
- Use the XA fast-age control instead of changing the 802.1p priority threshold, and wait for its 800 us cycle before restoring normal ageing.
- Link to v12: https://patch.msgid.link/[email protected]

Changes in v12:
- Program both KSZ8995XA port tag-control bits together, clearing the
opposite setting so stale bootloader configuration cannot leave both on.
- Handle KS8995 receive tags in VLAN metadata as well as in-band,
validating the source-port bits before deciding whether to untag.
- Reserve eight bytes of KS8995 transmit headroom for the switch tag
and a hardware-accelerated VLAN tag, avoiding an extra head expansion.
- Link to v11: https://patch.msgid.link/[email protected]

Changes in v11:
- Drop KSZ8995XA from the three-port binding exception so ports 3 and
4 receive generic DSA port validation.
- Reject invalid KS8995 receive port masks before ilog2() so plain
802.1Q frames are dropped safely.
- Propagate KSZ8995XA PHY reset assertion errors instead of treating
a failed write as a completed reset.
- Do not advertise legacy VLAN behavior for KSZ8995XA, preserving genuine ingress VLAN tags through the DSA receive path.
- Link to v10: https://patch.msgid.link/[email protected]

Changes in v10:
- Wait for the KSZ8995XA per-port PHY reset bits to clear before
continuing setup; verified to work on Actiontec MI424WR rev D
hardware.
- Drop the unreachable KSZ8995XA VLAN filtering check because the
restricted switch operations do not expose that callback.
- Add KSZ8995XA to the binding's Ethernet-port schema exception list.
- Convert big-endian KS8995 transmit tag fields to host byte order
before logging them.
- Align the KSZ8995XA SPI ID with its DT compatible to restore module autoloading and avoid the SPI registration warning.
- Link to v9: https://patch.msgid.link/[email protected]

Changes in v9:
- Fold the legacy Micrel compatibles into KSZ8995XA support and use an
exact tristate dependency to avoid probe races and bisect gaps.
- Always prepend a distinct KS8995 switch tag to preserve existing VLAN headers and avoid unsafe MAC-header access on direct transmit paths.
- Rate-limit KS8995 receive untagging errors to avoid log flooding.
- Link to v8: https://patch.msgid.link/[email protected]

Changes in v8:
- Add DCB support for the KSZ8995XA two-level priority model and set its internal priority map count to two.
- Initialize the KSZ8995XA per-port default tags to VID 0 so the tagger can distinguish originally untagged packets from VLAN-tagged frames.
- Push non-802.1Q hardware-accelerated VLAN tags into the packet before adding the KS8995 tag, so they cannot displace the switch tag from its required offset 12.
- Account for the discrepancy between the documented and observed
KSZ8995XA MTU behavior. Its packet-size control bits use the same
polarity as the other KSZ8 switches, while using the opposite polarity documented in the manual makes the switch hang on big packets.
- Rebased on v7.3-rc1
- Link to v7: https://patch.msgid.link/[email protected]

Changes in v7:
- Rebased on v7.2-rc1
- Rebased on top of Bastiens cleanups.
- Rebased and reworked on top of my patch changing the SKB ownership
model in the taggers.
- Drop bogus reset routine, keep per-port reset but use the right
defines.
- Properly implement the 2way queue split support (low/hi prio)
- Drop bogus surplus ops assignment.
- Link to v6: https://patch.msgid.link/[email protected]

Changes in v6:
- Provide a prompt along with the transition symbol NET_DSA_KS8995
so that oldconfig works.
- Clarify in commit message that the platform data probe path is
unused in the kernel and it is fine to delete this mechanism.
- Link to v5: https://patch.msgid.link/[email protected]

Changes in v5:
- Rebase on net-next again to be sure we apply.
- Fix the codepath where DCB was set up per-port, damaging KS8995XA
port registers.
- Fix up the transitional symbol NET_DSA_KS8995 to depend on
SPI and select both NET_DSA_MICROCHIP_KSZ_COMMON and NET_DSA_MICROCHIP_KSZ_SPI.
- Link to v4: https://patch.msgid.link/[email protected]

Changes in v4:
- Create a stub symbol for NET_DSA_KS8995 to phase over users to
the new driver.
- Link to v3: https://patch.msgid.link/[email protected]

Changes in v3:
- Rebase on net-next again, moving target!
- Fix a netdev_info() print in the tagger to be netdev_debug()
- Add net/dsa/tag_ks8995.c to MAINTAINERS
- Link to v2: https://patch.msgid.link/[email protected]

Changes in v2:
- Avoid trying to configure TOS priority settings (DCB) on the KSZ8995XA.
It does have some support for this, but let's add that later.
- Pick up Krzysztof's ACK on the new DT bindings.
- Reset the KSZ8995XA by disabling and enabling the switch like the old driver does.
- Move mutually exclusive Kconfig over to the patch introducing the
old Micrel compatibles to the Microchip ksz_spi driver.
(this complaint from Sashiko.)
- Use __be16 instead of u16 when casting into the SKB in the tagger
(this complaint from Sashiko.)
- Do not modify the hdr->h_vlan_TCI if no hardware accelerated tag
is detected, it would get nullified. Use whatever the Linux network stack assigned to TCI there.
(this complaint from Sashiko.)
- Avoid dereference of NULL in debug prints in the tagger.
(this complaint from Sashiko.)
- Ignored comment: Sashiko complains about ilog2(0) being potentially undefined but that is clearly defined as 0 in the Linux kernel.
- Link to v1: https://patch.msgid.link/[email protected]

---
Linus Walleij (4):
dt-bindings: net: dsa: microchip: Add KSZ8995XA
net: dsa: tag_ks8995: Add the KS8995 tag handling
net: dsa: microchip: Support Microchip KSZ8995XA / KS8995XA
net: dsa: ks8995: Delete surplus driver

 .../devicetree/bindings/net/dsa/microchip,ksz.yaml |   1 +
 MAINTAINERS                                        |   1 +
 drivers/net/dsa/Kconfig                            |   9 +-
 drivers/net/dsa/Makefile                           |   1 -
 drivers/net/dsa/ks8995.c                           | 857 ---------------------
 drivers/net/dsa/microchip/Kconfig                  |   1 +
 drivers/net/dsa/microchip/ksz8.c                   | 252 +++++-
 drivers/net/dsa/microchip/ksz8.h                   |   2 +
 drivers/net/dsa/microchip/ksz8_reg.h               |   2 +
 drivers/net/dsa/microchip/ksz_common.c             |  53 +-
 drivers/net/dsa/microchip/ksz_common.h             |  11 +-
 drivers/net/dsa/microchip/ksz_dcb.c                |  68 +-
 drivers/net/dsa/microchip/ksz_spi.c                |  33 +-
 include/linux/platform_data/microchip-ksz.h        |   1 +
 include/net/dsa.h                                  |   2 +
 net/dsa/Kconfig                                    |   6 +
 net/dsa/Makefile                                   |   1 +
 net/dsa/tag_ks8995.c                               | 180 +++++
 18 files changed, 549 insertions(+), 932 deletions(-)

---
base-commit: 17d3afadf539c93def8106bbb83c88274bdc7ab1
change-id: 20260509-ks8995-to-ksz8-15f3f9c8271f

Best regards,

Signature · 1 line
Linus Walleij <[email protected]>
#1 lore raw

PATCH v15 1/4 dt-bindings: net: dsa: microchip: Add KSZ8995XA

The KSZ8995XA is just like the KSZ8795 and KSZ8864 a Micrel product. It was renamed from KS8995XA to KSZ8995XA at some point, but it has the same properties as the KS8995XA.

Be careful to use the full product name in this new compatible:
there is also KSZ8995MA and KSZ8995E which are not compatible with the KS8995XA.

---
 Documentation/devicetree/bindings/net/dsa/microchip,ksz.yaml | 1 +
 1 file changed, 1 insertion(+)
Documentation/devicetree/bindings/net/dsa/microchip,ksz.yaml +1 -0
index 8d4a3a9a33fc..4ed13870ed3a 100644
@@ -23,6 +23,7 @@ properties:
       - microchip,ksz8864  # 4-port version of KSZ8895 family switch
       - microchip,ksz8873
       - microchip,ksz8895  # 5-port version of KSZ8895 family switch
+      - microchip,ksz8995xa
       - microchip,ksz9477
       - microchip,ksz9897
       - microchip,ksz9896
Signature · 1 line
2.55.0
#2 lore raw

Re: [PATCH net-next v15 1/4] dt-bindings: net: dsa: microchip: Add KSZ8995XA

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:

Critical: 0 · High: 0 · Medium: 0 · Low: 1

- [Low] Concern (validated as a FALSE POSITIVE, retained only because requires_validation=true): the new compatible microchip,ksz8995xa…

--

dt-bindings: net: dsa: microchip: Add KSZ8995XA

This adds the microchip,ksz8995xa compatible string to the enum in the Microchip KSZ series DSA switch binding. The commit notes the part was renamed from KS8995XA and shares the same properties.

No Link: tags are present in the commit header.

Documentation/devicetree/bindings/net/dsa/microchip,ksz.yaml properties: · line 29

Quoted 12 lines
Documentation/devicetree/bindings/net/dsa/microchip,ksz.yaml +1 -0
index 8d4a3a9a33fcc..4ed13870ed3ac 100644
@@ -23,6 +23,7 @@ properties:
       - microchip,ksz8864  # 4-port version of KSZ8895 family switch
       - microchip,ksz8873
       - microchip,ksz8895  # 5-port version of KSZ8895 family switch
+      - microchip,ksz8995xa
       - microchip,ksz9477
       - microchip,ksz9897
       - microchip,ksz9896

No regressions to report for this patch. The conditional blocks in microchip,ksz.yaml only gate on microchip,ksz8863 / microchip,ksz8873 and microchip,ksz8463, and the 5-port KSZ8995XA falls into the default dsa.yaml#/$defs/ethernet-ports branch, so no existing if: block needed the new string. The driver match entry for microchip,ksz8995xa is added later in the series in ksz_dt_ids[] in drivers/net/dsa/microchip/ksz_spi.c, so the compatible does not end up unmatched.

Signature · 1 line
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20260916-ks8995-to-ksz8-v15-0-8825ff5fd4be%40kernel.org
#3 lore raw

Re: [PATCH net-next v15 1/4] dt-bindings: net: dsa: microchip: Add KSZ8995XA

Quoted 4 lines · On Thu, Sep 17, 2026 at 3:22 PM <[email protected]> wrote:

Critical: 0 · High: 0 · Medium: 0 · Low: 1

- [Low] Concern (validated as a FALSE POSITIVE, retained only because requires_validation=true): the new compatible microchip,ksz8995xa…

OK so a non-issue, that's an OK then I guess.

Yours,
Linus Walleij

#4 lore raw

PATCH v15 2/4 net: dsa: tag_ks8995: Add the KS8995 tag handling

In reply to Linus Walleij

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.

---
 MAINTAINERS          |   1 +
 include/net/dsa.h    |   2 +
 net/dsa/Kconfig      |   6 ++
 net/dsa/Makefile     |   1 +
 net/dsa/tag_ks8995.c | 180 +++++++++++++++++++++++++++++++++++++++++++++++++++
 5 files changed, 190 insertions(+)
MAINTAINERS +1 -0
index 0e04d92d1b09..6e0d16e3ee4d 100644
@@ -17772,6 +17772,7 @@ F:	Documentation/devicetree/bindings/net/dsa/microchip,lan937x.yaml
 F:	drivers/net/dsa/microchip/*
 F:	include/linux/dsa/ksz_common.h
 F:	include/linux/platform_data/microchip-ksz.h
+F:	net/dsa/tag_ks8995.c
 F:	net/dsa/tag_ksz.c
 
 MICROCHIP LAN743X ETHERNET DRIVER
include/net/dsa.h +2 -0
index 7507d632e7c6..5d12191b6f6f 100644
@@ -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;
net/dsa/Kconfig +6 -0
index 23b4b74004ed..4f44bf3ede23 100644
@@ -125,6 +125,12 @@ config NET_DSA_TAG_MXL_GSW1XX
 	  Say Y or M if you want to enable support for tagging frames for
 	  MaxLinear GSW1xx switches.
 
+config NET_DSA_TAG_KS8995
+	tristate "Tag driver for Micrel KS8995 switch"
+	help
+	  Say Y if you want to enable support for tagging frames for the
+	  Micrel KS8995 switch.
+
 config NET_DSA_TAG_KSZ
 	tristate "Tag driver for Microchip 8795/937x/9477/9893 families of switches"
 	help
net/dsa/Makefile +1 -0
index d15bcf5c68f0..1f9cc30e9988 100644
@@ -25,6 +25,7 @@ obj-$(CONFIG_NET_DSA_TAG_BRCM_COMMON) += tag_brcm.o
 obj-$(CONFIG_NET_DSA_TAG_DSA_COMMON) += tag_dsa.o
 obj-$(CONFIG_NET_DSA_TAG_GSWIP) += tag_gswip.o
 obj-$(CONFIG_NET_DSA_TAG_HELLCREEK) += tag_hellcreek.o
+obj-$(CONFIG_NET_DSA_TAG_KS8995) += tag_ks8995.o
 obj-$(CONFIG_NET_DSA_TAG_KSZ) += tag_ksz.o
 obj-$(CONFIG_NET_DSA_TAG_LAN9303) += tag_lan9303.o
 obj-$(CONFIG_NET_DSA_TAG_MT7628) += tag_mt7628.o
net/dsa/tag_ks8995.c new file +180 -0

180 lines not on this page · raw message

Signature · 1 line
2.55.0
#5 lore raw

Re: [PATCH net-next v15 2/4] net: dsa: tag_ks8995: Add the KS8995 tag handling

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:

Critical: 0 · High: 0 · Medium: 0 · Low: 1

- [Low] When the KS8995 special tag has been stripped into VLAN metadata by the conduit MAC, flow dissection of the frame fails:…

--

net: dsa: tag_ks8995: Add the KS8995 tag handling

This adds a DSA tagger for the Micrel KS8995 / Microchip KSZ8995XA switch, where the switch tag is a modified 0x8100 ethertype with one bit per port set in the low nibble. The tagger always inserts a distinct outer tag on transmit and moves an in-band tag into VLAN metadata on receive.

Quoted 6 lines
net/dsa/tag_ks8995.c new file +0 -0
new file mode 100644
index 0000000000000..f011bf01845ef
@@ -0,0 +1,180 @@

[ ... ]

Quoted 6 lines
net/dsa/tag_ks8995.c new file +6 -0
+static struct sk_buff *ks8995_rcv(struct sk_buff *skb, struct net_device *dev)
+{
+	int portmask;
+	int port;
+	u16 etype;
+

net/dsa/tag_ks8995.c line 86

Quoted 10 lines
net/dsa/tag_ks8995.c new file +10 -0
+	/* The special tag may be in the packet or VLAN metadata. In either
+	 * case, its TPID must retain the source-port bits.
+	 *
+	 * Read the in-band TPID directly because skb->protocol contains
+	 * ETH_P_XDSA.
+	 */
+	if (skb_vlan_tag_present(skb))
+		etype = ntohs(skb->vlan_proto);
+	else
+		etype = ntohs(*(__be16 *)dsa_etype_header_pos_rx(skb));

[Severity: Low]

This branch accepts a special tag that the conduit MAC has already stripped into VLAN metadata, so skb->vlan_proto then holds 0x8101, 0x8102, 0x8104 or 0x8108. For those frames, can flow dissection on the conduit still work?

In __skb_flow_dissect(), the protocol used to reach the DSA tagger hook is taken from the VLAN metadata when it is present:

net/core/flow_dissector.c:__skb_flow_dissect() {
	...
		proto = skb_vlan_tag_present(skb) ?
			 skb->vlan_proto : skb->protocol;
	...
		if (unlikely(skb->dev && netdev_uses_dsa(skb->dev) &&
			     proto == htons(ETH_P_XDSA))) {
			...
			ops->flow_dissect(skb, &proto, &offset);
	...
}

With proto equal to 0x810X rather than ETH_P_XDSA, ks8995_flow_dissect() is never called, and 0x810X matches no case in the protocol switch, so dissection ends in:

net/core/flow_dissector.c:__skb_flow_dissect() {
	...
	default:
		fdret = FLOW_DISSECT_RET_OUT_BAD;
		break;
	...
}

The result is that skb_get_hash() derives a hash from zeroed keys, so RPS, RFS and tc-flower matching on the conduit see no L3/L4 keys.

Two details worth noting: this only happens with a conduit MAC that strips the non-standard 0x810X TPID into metadata while preserving the port bits, which was not demonstrated here, and the same OUT_BAD outcome already applies to other VLAN-metadata DSA taggers such as the tag_8021q family, where proto becomes ETH_P_XDSA and also has no case in the switch. Should the receive path here rely only on the in-band tag, or is degraded hashing on the conduit acceptable for this configuration?

[ ... ]

Quoted 27 lines
net/dsa/tag_ks8995.c new file +27 -0
+static void ks8995_flow_dissect(const struct sk_buff *skb, __be16 *proto,
+				int *offset)
+{
+	const __be16 *encap_proto;
+	__be16 buffer;
+
+	*proto = 0;
+	*offset = 0;
+
+	/* Extra TX headroom does not increase the in-band RX tag length. */
+	encap_proto = skb_header_pointer(skb, KS8995_TAG_LEN - sizeof(buffer),
+					 sizeof(buffer), &buffer);
+	if (!encap_proto)
+		return;
+
+	*proto = *encap_proto;
+	*offset = KS8995_TAG_LEN;
+}
+
+static const struct dsa_device_ops ks8995_netdev_ops = {
+	.name = KS8995_NAME,
+	.proto	= DSA_TAG_PROTO_KS8995,
+	.xmit = ks8995_xmit,
+	.rcv = ks8995_rcv,
+	.flow_dissect = ks8995_flow_dissect,
+	.needed_headroom = KS8995_NEEDED_HEADROOM,
+};

[ ... ]

Signature · 1 line
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20260916-ks8995-to-ksz8-v15-0-8825ff5fd4be%40kernel.org
#6 lore raw

Re: [PATCH net-next v15 2/4] net: dsa: tag_ks8995: Add the KS8995 tag handling

Quoted 7 lines · On Thu, Sep 17, 2026 at 3:22 PM <[email protected]> wrote:

Two details worth noting: this only happens with a conduit MAC that strips the non-standard 0x810X TPID into metadata while preserving the port bits, which was not demonstrated here, and the same OUT_BAD outcome already applies to other VLAN-metadata DSA taggers such as the tag_8021q family, where proto becomes ETH_P_XDSA and also has no case in the switch. Should the receive path here rely only on the in-band tag, or is degraded hashing on the conduit acceptable for this configuration?

This is just getting too fringe. What about we merge this and look into this when we have a user who actually want to do these things on this old chip?

I don't think this is a blocker.

Yours,
Linus Walleij

maintainer
#7 lore raw

Re: [PATCH net-next v15 2/4] net: dsa: tag_ks8995: Add the KS8995 tag handling

Quoted 10 lines · On Thu, 17 Sep 2026 23:18:42 +0200 Linus Walleij wrote:
Quoted 7 lines · On Thu, Sep 17, 2026 at 3:22 PM <[email protected]> wrote:

Two details worth noting: this only happens with a conduit MAC that strips the non-standard 0x810X TPID into metadata while preserving the port bits, which was not demonstrated here, and the same OUT_BAD outcome already applies to other VLAN-metadata DSA taggers such as the tag_8021q family, where proto becomes ETH_P_XDSA and also has no case in the switch. Should the receive path here rely only on the in-band tag, or is degraded hashing on the conduit acceptable for this configuration?

Quoted 5 lines

This is just getting too fringe. What about we merge this and look into this when we have a user who actually want to do these things on this old chip?

I don't think this is a blocker.

Yes, sorry, I need to modify the emails to call it out more clearly. We only really care about issues >=Medium severity, but if there are any such issues found we send out the low ones too just in case.

#8 lore raw

PATCH v15 3/4 net: dsa: microchip: Support Microchip KSZ8995XA / KS8995XA

In reply to Linus Walleij

This adds support for the Microchip KSZ8995XA also known as the Micrel KS8995XA switch to the KSZ driver.

The KSZ8995XA shares family ID 0x95 and chip-ID nibble 0x0 with the KS8995MA, so hardware detection cannot distinguish them. The legacy "micrel,ks8995" compatible is therefore treated as KSZ8995XA. No KS8995MA users are known, and KS8995E has no documented SPI management interface. Neither MA nor E has been verified with this driver.

The helper macros are named ksz_is_ksz8995xa() to make it possible to add E and MA support in the future.

Wait for the self-clearing per-port PHY reset bits before continuing with switch setup. Poll each port for up to 600 ms and allow an additional millisecond for the PHYs to settle.

The KSZ8995XA has eight global TOS priority registers with one bit per DSCP code point, providing two internal priority levels. The registers are ordered in the opposite direction from the other KSZ8 switches. Describe the two priorities in the chip data, then augment the DCB helpers for this.

Practical testing also shows that its packet-size control bits use the same semantics as the other KSZ8 switches. The polarity in the manual appears to be wrong and makes the switch hang on big packets.

The legacy KS8995 driver also matches the Micrel compatibles for KSZ8864 and KSZ8795. Add these to the KSZ SPI driver here and use an exact tristate dependency to make the drivers mutually exclusive. This transfers ownership atomically, avoiding module probe races and gaps in driver coverage between patches.

---
 drivers/net/dsa/Kconfig                     |   1 +
 drivers/net/dsa/microchip/Kconfig           |   1 +
 drivers/net/dsa/microchip/ksz8.c            | 252 +++++++++++++++++++++++-----
 drivers/net/dsa/microchip/ksz8.h            |   2 +
 drivers/net/dsa/microchip/ksz8_reg.h        |   2 +
 drivers/net/dsa/microchip/ksz_common.c      |  53 +++++-
 drivers/net/dsa/microchip/ksz_common.h      |  11 +-
 drivers/net/dsa/microchip/ksz_dcb.c         |  68 +++++---
 drivers/net/dsa/microchip/ksz_spi.c         |  33 +++-
 include/linux/platform_data/microchip-ksz.h |   1 +
 10 files changed, 353 insertions(+), 71 deletions(-)
drivers/net/dsa/Kconfig +1 -0
index 8d8edcf89f10..e3d88f41fecf 100644
@@ -112,6 +112,7 @@ config NET_DSA_RZN1_A5PSW
 config NET_DSA_KS8995
 	tristate "Micrel KS8995 family 5-ports 10/100 Ethernet switches"
 	depends on SPI
+	depends on NET_DSA_MICROCHIP_KSZ_SPI = n
 	select NET_DSA_TAG_NONE
 	help
 	  This driver supports the Micrel KS8995 family of 10/100 Mbit ethernet
drivers/net/dsa/microchip/Kconfig +1 -0
index c71d3fd5dfeb..75c9b2114afd 100644
@@ -2,6 +2,7 @@
 menuconfig NET_DSA_MICROCHIP_KSZ_COMMON
 	tristate "Microchip KSZ8XXX/KSZ9XXX/LAN937X series switch support"
 	depends on NET_DSA
+	select NET_DSA_TAG_KS8995
 	select NET_DSA_TAG_KSZ
 	select NET_DSA_TAG_NONE
 	select NET_IEEE8021Q_HELPERS
drivers/net/dsa/microchip/ksz8.c +212 -40

419 lines not on this page · raw message

drivers/net/dsa/microchip/ksz8.h +2 -0
index bc371cc26c6f..9b37c56c9617 100644
@@ -12,11 +12,13 @@
 #include <net/dsa.h>
 #include "ksz_common.h"
 
+extern const struct ksz_dev_ops ksz8995xa_dev_ops;
 extern const struct ksz_dev_ops ksz8463_dev_ops;
 extern const struct ksz_dev_ops ksz87xx_dev_ops;
 extern const struct ksz_dev_ops ksz88xx_dev_ops;
 extern const struct phylink_mac_ops ksz88x3_phylink_mac_ops;
 extern const struct phylink_mac_ops ksz8_phylink_mac_ops;
+extern const struct dsa_switch_ops ksz8995xa_switch_ops;
 extern const struct dsa_switch_ops ksz8463_switch_ops;
 extern const struct dsa_switch_ops ksz87xx_switch_ops;
 extern const struct dsa_switch_ops ksz88xx_switch_ops;
drivers/net/dsa/microchip/ksz8_reg.h +2 -0
index 6bc511da1f7d..f858bce84bfd 100644
@@ -95,6 +95,8 @@
 #define SW_LED_LINK_ACT_DUPLEX		2
 #define SW_LED_LINK_DUPLEX		3
 
+#define SW_SPECIAL_TAG			BIT(0) /* KSZ8995XA only */
+
 #define REG_SW_CTRL_10			0x0C
 
 #define SW_PASS_PAUSE			BIT(0)
drivers/net/dsa/microchip/ksz_common.c +46 -7

86 lines not on this page · raw message

drivers/net/dsa/microchip/ksz_common.h +10 -1
index 0cff33df06a4..091cfbdc486f 100644
@@ -281,6 +281,7 @@ enum ksz_model {
 	KSZ88X3,
 	KSZ8864,
 	KSZ8895,
+	KSZ8995XA,
 	KSZ9477,
 	KSZ9896,
 	KSZ9897,
@@ -790,7 +791,13 @@ static inline bool ksz_is_ksz88x3(struct ksz_device *dev)
 static inline bool ksz_is_8895_family(struct ksz_device *dev)
 {
 	return dev->chip_id == KSZ8895_CHIP_ID ||
-	       dev->chip_id == KSZ8864_CHIP_ID;
+	       dev->chip_id == KSZ8864_CHIP_ID ||
+	       dev->chip_id == KSZ8995XA_CHIP_ID;
+}
+
+static inline bool ksz_is_ksz8995xa(struct ksz_device *dev)
+{
+	return dev->chip_id == KSZ8995XA_CHIP_ID;
 }
 
 static inline bool is_ksz8(struct ksz_device *dev)
@@ -861,6 +868,7 @@ static inline bool ksz_is_sgmii_port(struct ksz_device *dev, int port)
 #define KSZ87_CHIP_ID_94		0x6
 #define KSZ87_CHIP_ID_95		0x9
 #define KSZ88_CHIP_ID_63		0x3
+#define KSZ8895_CHIP_ID_95XA		0x0
 #define KSZ8895_CHIP_ID_95		0x4
 #define KSZ8895_CHIP_ID_95R		0x6
 
@@ -928,6 +936,7 @@ static inline bool ksz_is_sgmii_port(struct ksz_device *dev, int port)
 #define KSZ8863_HUGE_PACKET_SIZE	1916
 #define KSZ8863_NORMAL_PACKET_SIZE	1536
 #define KSZ8_LEGAL_PACKET_SIZE		1518
+#define KSZ8995XA_LEGAL_PACKET_SIZE	1522
 #define KSZ9477_MAX_FRAME_SIZE		9000
 
 #define KSZ8873_REG_GLOBAL_CTRL_12	0x0e
drivers/net/dsa/microchip/ksz_dcb.c +47 -21

152 lines not on this page · raw message

drivers/net/dsa/microchip/ksz_spi.c +31 -2
index 373e9054947c..e3bb9e604186 100644
@@ -161,7 +161,8 @@ static int ksz_spi_probe(struct spi_device *spi)
 		 chip->chip_id == KSZ8794_CHIP_ID ||
 		 chip->chip_id == KSZ8765_CHIP_ID)
 		regmap_config = ksz8795_regmap_config;
-	else if (chip->chip_id == KSZ8895_CHIP_ID ||
+	else if (chip->chip_id == KSZ8995XA_CHIP_ID ||
+		 chip->chip_id == KSZ8895_CHIP_ID ||
 		 chip->chip_id == KSZ8864_CHIP_ID)
 		regmap_config = ksz8863_regmap_config;
 	else
@@ -185,7 +186,10 @@ static int ksz_spi_probe(struct spi_device *spi)
 		dev->pdata = spi->dev.platform_data;
 
 	/* setup spi */
-	spi->mode = SPI_MODE_3;
+	if (chip->chip_id == KSZ8995XA_CHIP_ID)
+		spi->mode = SPI_MODE_0;
+	else
+		spi->mode = SPI_MODE_3;
 	ret = spi_setup(spi);
 	if (ret)
 		return ret;
@@ -224,6 +228,25 @@ static void ksz_spi_shutdown(struct spi_device *spi)
 }
 
 static const struct of_device_id ksz_dt_ids[] = {
+	/*
+	 * Legacy Micrel bindings. In 2015 Microchip acquired
+	 * Micrel which is the originator of the KSZ series, and
+	 * devices branded for Micrel already existed, as well as
+	 * some device tree bindings. These two products are identical
+	 * to the same Microchip products.
+	 */
+	{
+		.compatible = "micrel,ksz8864",
+		.data = &ksz_switch_chips[KSZ8864]
+	},
+	{
+		.compatible = "micrel,ksz8795",
+		.data = &ksz_switch_chips[KSZ8795]
+	},
+	{
+		.compatible = "micrel,ks8995",
+		.data = &ksz_switch_chips[KSZ8995XA]
+	},
 	{
 		.compatible = "microchip,ksz8463",
 		.data = &ksz_switch_chips[KSZ8463]
@@ -256,6 +279,10 @@ static const struct of_device_id ksz_dt_ids[] = {
 		.compatible = "microchip,ksz8895",
 		.data = &ksz_switch_chips[KSZ8895]
 	},
+	{
+		.compatible = "microchip,ksz8995xa",
+		.data = &ksz_switch_chips[KSZ8995XA]
+	},
 	{
 		.compatible = "microchip,ksz9477",
 		.data = &ksz_switch_chips[KSZ9477]
@@ -317,6 +344,7 @@ static const struct of_device_id ksz_dt_ids[] = {
 MODULE_DEVICE_TABLE(of, ksz_dt_ids);
 
 static const struct spi_device_id ksz_spi_ids[] = {
+	{ "ks8995" },
 	{ "ksz8463" },
 	{ "ksz8765" },
 	{ "ksz8794" },
@@ -325,6 +353,7 @@ static const struct spi_device_id ksz_spi_ids[] = {
 	{ "ksz8864" },
 	{ "ksz8873" },
 	{ "ksz8895" },
+	{ "ksz8995xa" },
 	{ "ksz9477" },
 	{ "ksz9896" },
 	{ "ksz9897" },
include/linux/platform_data/microchip-ksz.h +1 -0
index fe8df1774289..411d5e164383 100644
@@ -31,6 +31,7 @@ enum ksz_chip_id {
 	KSZ88X3_CHIP_ID = 0x8830,
 	KSZ8864_CHIP_ID = 0x8864,
 	KSZ8895_CHIP_ID = 0x8895,
+	KSZ8995XA_CHIP_ID = 0x8995,
 	KSZ9477_CHIP_ID = 0x00947700,
 	KSZ9896_CHIP_ID = 0x00989600,
 	KSZ9897_CHIP_ID = 0x00989700,
Signature · 1 line
2.55.0
#9 lore raw

Re: [PATCH net-next v15 3/4] net: dsa: microchip: Support Microchip KSZ8995XA / KS8995XA

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: - [High] net: dsa: ksz8995xa: PHY soft reset writes to reserved MAC register on CPU port --

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] net: dsa: ksz8995xa: PHY soft reset writes to reserved MAC register on CPU port --

commit f841f88763071d08ce03b9faac5dca678f1c4f1f
Author: Linus Walleij <[email protected]>

net: dsa: microchip: Support Microchip KSZ8995XA / KS8995XA

This commit adds support for the Microchip KSZ8995XA switch to the KSZ driver, handling legacy compatibles and implementing specialized DCB and MTU logic. It also provides a customized DSA switch operations struct for the older hardware.

Quoted 4 lines
drivers/net/dsa/microchip/ksz8.c +0 -0
index 941ae9f66f70b..d7498132064e8 100644

[ ... ]

Quoted 4 lines
drivers/net/dsa/microchip/ksz8.c +0 -0
@@ -253,7 +255,35 @@ static int ksz8463_reset_switch(struct ksz_device *dev)
 
 static int ksz8_reset_switch(struct ksz_device *dev)
 {

drivers/net/dsa/microchip/ksz8.c static int ksz8463_reset_switch(struct ksz_device *dev) · line 266

Quoted 10 lines
drivers/net/dsa/microchip/ksz8.c +9 -1
-	if (ksz_is_ksz88x3(dev)) {
+	if (ksz_is_ksz8995xa(dev)) {
+		unsigned int port, reg, val;
+		int ret;
+
+		/* The KSZ8995XA switch itself cannot be reset by software, but
+		 * often boot loaders have fun with ports, so reset them. This
+		 * reset bit is self-clearing.
+		 */
+		for (port = 0; port < dev->info->port_cnt; port++) {

[Severity: High]
Does this loop in ksz8_reset_switch() unconditionally include the CPU port?

Since dev->info->port_cnt for KSZ8995XA is 5, it looks like this will also write PORT_PHY_SOFT_RESET to port 4 (the CPU port). However, port 4 lacks an internal PHY (dev->info->internal_phy[4] is false) and writing to its reserved MAC register address space could trigger unintended behavior.

drivers/net/dsa/microchip/ksz8.c static int ksz8463_reset_switch(struct ksz_device *dev) · line 279

Quoted 13 lines
drivers/net/dsa/microchip/ksz8.c +13 -0
+			ret = ksz_prmw8(dev, port, REG_PORT_STATUS_3,
+					PORT_PHY_SOFT_RESET,
+					PORT_PHY_SOFT_RESET);
+			if (ret)
+				return ret;
+		}
+
+		/* IEEE 802.3 allows up to 500 ms for a PHY reset. */
+		for (port = 0; port < dev->info->port_cnt; port++) {
+			reg = dev->dev_ops->get_port_addr(port, REG_PORT_STATUS_3);
+			ret = regmap_read_poll_timeout(ksz_regmap_8(dev), reg, val,
+						       !(val & PORT_PHY_SOFT_RESET),
+						       1000, 600000);

[Severity: High]
Could polling this reserved register lead to a permanent timeout?

If the hardware retains the written value on the reserved register (meaning it does not self-clear like a real PHY would), regmap_read_poll_timeout() will timeout after 600ms and return -ETIMEDOUT, causing the entire switch probe to fail.

Should this loop check dev->info->internal_phy[port] before proceeding, or alternatively iterate only up to dev->phy_port_cnt to avoid touching the CPU port?

Quoted 3 lines
drivers/net/dsa/microchip/ksz8.c +3 -0
+			if (ret)
+				return ret;
+		}
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=3
#10 lore raw

Re: [PATCH net-next v15 3/4] net: dsa: microchip: Support Microchip KSZ8995XA / KS8995XA

Quoted 2 lines · On Thu, Sep 17, 2026 at 12:21 PM <[email protected]> wrote:

[Severity: High]
Does this loop in ksz8_reset_switch() unconditionally include the CPU port?

Yes and it should.

Quoted 2 lines

[Severity: High]
Could polling this reserved register lead to a permanent timeout?

No and it has been tested.

Yours,
Linus Walleij

#11 lore raw

Re: [PATCH net-next v15 3/4] net: dsa: microchip: Support Microchip KSZ8995XA / KS8995XA

In reply to Linus Walleij
Thank you for your contribution! Sashiko AI review found 5 potential issue(s) to consider:

Thank you for your contribution! Sashiko AI review found 5 potential issue(s) to consider:

Critical: 0 · High: 0 · Medium: 1 (1) · Low: 4 (2)

- [Medium] ksz8995xa_change_mtu() (drivers/net/dsa/microchip/ksz8.c:301) programs the hardware legal-packet-size limit from frame_size = mtu +…
- [Low] After this patch (and the final patch of the series, which deletes drivers/net/dsa/ks8995.c entirely),…
- [Low] Concern (validated as FALSE POSITIVE / disclosed later in series): the Kconfig exclusivity silently re-routes the existing…
- [Low] Concern (validated as FALSE POSITIVE): the new { "ks8995" } and { "ksz8995xa" } entries in ksz_spi_ids[] advertise SPI-ID (non-…
- [Low] Concern (validated as FALSE POSITIVE): the new KSZ8995XA branch of ksz8_reset_switch() writes PORT_PHY_SOFT_RESET to REG_PORT_STATUS_3…

Pre-existing issues:
- [Medium] Concern (validated as a real but pre-existing Medium defect, below the reporting threshold): ksz_init_global_dscp_map() in…
- [Low] Concern (validated as FALSE POSITIVE): the new KSZ8995XA special- tag programming (ksz_pwrite16(REG_PORT_CTRL_VID, 0) and…
- [Low] Concern (validated as FALSE POSITIVE): in ksz8_flush_dyn_mac_table() the new KSZ8995XA sequence sets…

--

net: dsa: microchip: Support Microchip KSZ8995XA / KS8995XA

This adds KSZ8995XA (Micrel KS8995XA) support to the KSZ DSA driver, with a restricted set of dev/switch ops, per-port PHY reset polling, header special tag setup and DCB helper changes for the chip's eight one-bit TOS priority registers. It also moves the legacy "micrel,ks8995", "micrel,ksz8795" and "micrel,ksz8864" compatibles over to the KSZ SPI driver and makes NET_DSA_KS8995 and NET_DSA_MICROCHIP_KSZ_SPI mutually exclusive in Kconfig.

A few questions below.

Quoted 4 lines
drivers/net/dsa/microchip/ksz8.c +0 -0
index 941ae9f66f70b..d7498132064e8 100644

[ ... ]

Quoted 19 lines
drivers/net/dsa/microchip/ksz8.c +15 -0
@@ -269,6 +299,31 @@ static int ksz8_reset_switch(struct ksz_device *dev)
 	return 0;
 }
 
+static int ksz8995xa_change_mtu(struct dsa_switch *ds, int port, int mtu)
+{
+	struct ksz_device *dev = ds->priv;
+	int frame_size;
+	u8 ctrl2 = 0;
+
+	if (!dsa_is_cpu_port(dev->ds, port))
+		return 0;
+
+	frame_size = mtu + VLAN_ETH_HLEN + ETH_FCS_LEN;
+
+	/* The legal packet size bit polarity documented in the KSZ8995XA
+	 * manual appears to be wrong. Practical tests show that the same
+	 * semantics as the other switches are correct; using the documented
+	 * polarity makes the switch hang on big packets.

drivers/net/dsa/microchip/ksz8.c static int ksz8_reset_switch(struct ksz_device *dev) · line 326

Quoted 10 lines
drivers/net/dsa/microchip/ksz8.c +10 -0
+	 */
+	if (frame_size <= KSZ8995XA_LEGAL_PACKET_SIZE)
+		ctrl2 |= KSZ8863_LEGAL_PACKET_ENABLE;
+	else if (frame_size > KSZ8863_NORMAL_PACKET_SIZE)
+		ctrl2 |= KSZ8863_HUGE_PACKET_ENABLE;
+
+	return ksz_rmw8(dev, REG_SW_CTRL_2, KSZ8863_LEGAL_PACKET_ENABLE |
+			KSZ8863_HUGE_PACKET_ENABLE, ctrl2);
+}
+

[Severity: Medium]

Does frame_size here need to account for the 4-byte KS8995 special tag as well?

ksz8995xa_change_mtu() computes:

	frame_size = mtu + VLAN_ETH_HLEN + ETH_FCS_LEN;

which allows room for exactly one VLAN header. But ks8995_xmit() in net/dsa/tag_ks8995.c always inserts an additional outer tag:

	skb = vlan_insert_tag(skb, KS8995M_STPID(portmask), 0);

so a full-size 802.1Q frame injected by the CPU is 14 + 4 (special tag) + 4 (customer VLAN) + 1500 + 4 (FCS) = 1526 bytes on the wire at the CPU port.

At the default MTU of 1500 the computation above yields exactly 1522, which equals KSZ8995XA_LEGAL_PACKET_SIZE, so KSZ8863_LEGAL_PACKET_ENABLE is set and the switch is told to enforce 1522.

DSA does not compensate either: in dsa_user_change_mtu() the CPU port gets the bare user MTU, and only the conduit MTU gets the tag overhead added:

	cpu_mtu = largest_mtu;
	...
	err = dsa_port_mtu_change(cpu_dp, cpu_mtu);

Can this make the switch drop full-size VLAN-tagged frames coming from the CPU?

The same allowance question applies to .port_max_mtu, since ksz8995xa_switch_ops reuses ksz88xx_max_mtu(), which returns KSZ8863_HUGE_PACKET_SIZE - VLAN_ETH_HLEN - ETH_FCS_LEN and therefore also leaves no room for the special tag at the largest configurable MTU.

[ ... ]

Quoted 4 lines
drivers/net/dsa/microchip/ksz_dcb.c +0 -0
index 7131c5caac547..aa0260f07252e 100644

[ ... ]

Quoted 7 lines
drivers/net/dsa/microchip/ksz_dcb.c +1 -1
@@ -283,15 +299,12 @@ int ksz_port_get_dscp_prio(struct dsa_switch *ds, int port, u8 dscp)
  */
 static int ksz_set_global_dscp_entry(struct ksz_device *dev, u8 dscp, u8 ipm)
 {
-	int reg, per_reg, shift;
+	int reg, shift;
 	u8 mask;

drivers/net/dsa/microchip/ksz_dcb.c int ksz_port_get_dscp_prio(struct dsa_switch *ds, int port, u8 dscp) · line 308

Quoted 10 lines
drivers/net/dsa/microchip/ksz_dcb.c +2 -5
 
-	ksz_get_dscp_prio_reg(dev, &reg, &per_reg, &mask);
+	ksz_get_dscp_prio_reg(dev, dscp, &reg, &mask, &shift);
 
-	shift = (dscp % per_reg) * (8 / per_reg);
-
-	return ksz_rmw8(dev, reg + (dscp / per_reg), mask << shift,
-			ipm << shift);
+	return ksz_rmw8(dev, reg, mask << shift, ipm << shift);
 }

[Severity: Medium]

This is a pre-existing issue and not introduced by this patch, but since this helper now also drives the new KSZ8995XA one-bit-per-DSCP register layout, is the error return still being dropped by its only caller?

In ksz_init_global_dscp_map() the result is assigned and then discarded:

		ret = ksz_set_global_dscp_entry(dev, dscp, ipm);
	}

	return 0;
}

So a regmap failure while programming any of the 64 DSCP entries leaves the table partially programmed while ksz8_setup() -> ksz_dcb_init() still reports success. Would returning ret on failure be preferable?

[ ... ]

Quoted 4 lines
drivers/net/dsa/microchip/ksz_spi.c +0 -0
index 373e9054947cb..e3bb9e604186d 100644

[ ... ]

Quoted 13 lines
drivers/net/dsa/microchip/ksz_spi.c +9 -0
@@ -224,6 +228,25 @@ static void ksz_spi_shutdown(struct spi_device *spi)
 }
 
 static const struct of_device_id ksz_dt_ids[] = {
+	/*
+	 * Legacy Micrel bindings. In 2015 Microchip acquired
+	 * Micrel which is the originator of the KSZ series, and
+	 * devices branded for Micrel already existed, as well as
+	 * some device tree bindings. These two products are identical
+	 * to the same Microchip products.
+	 */
+	{
+		.compatible = "micrel,ksz8864",

drivers/net/dsa/microchip/ksz_spi.c static void ksz_spi_shutdown(struct spi_device *spi) · line 249

Quoted 10 lines
drivers/net/dsa/microchip/ksz_spi.c +10 -0
+		.data = &ksz_switch_chips[KSZ8864]
+	},
+	{
+		.compatible = "micrel,ksz8795",
+		.data = &ksz_switch_chips[KSZ8795]
+	},
+	{
+		.compatible = "micrel,ks8995",
+		.data = &ksz_switch_chips[KSZ8995XA]
+	},

[Severity: Low]

Should the bindings be updated for these three compatibles as well?

After this patch (and after the last patch of the series removes drivers/net/dsa/ks8995.c), the KSZ driver is the only implementation of "micrel,ks8995", "micrel,ksz8795" and "micrel,ksz8864", but the schema that covers them is still Documentation/devicetree/bindings/net/dsa/micrel,ks8995.yaml, which defines only compatible, reg and reset-gpios plus the dsa.yaml and spi-peripheral-props references, and ends with:

unevaluatedProperties: false

The KSZ implementation, on the other hand, reads several more properties for whatever it matches, in ksz_switch_register():

	dev->synclko_125 = of_property_read_bool(dev->dev->of_node,
						 "microchip,synclko-125");
	dev->wakeup_source = of_property_read_bool(dev->dev->of_node,
						   "wakeup-source");

plus interrupts, an mdio child node, micrel,fiber-mode, microchip,synclko-disable, microchip,pme-active-high and the three microchip,*-drive-strength-microamp properties handled by ksz8_parse_drive_strength(), which ksz8_setup() calls unconditionally.

Documentation/devicetree/bindings/net/dsa/microchip,ksz.yaml documents all of those and already lists microchip,ksz8995xa, but it does not enumerate the three micrel strings, and micrel,ks8995.yaml does not $ref it. So a device tree using compatible = "micrel,ks8995" together with, say, interrupts or microchip,synclko-125 is rejected by dt_binding_check even though the driver honours it. The two in-tree device trees (intel-ixp42x-actiontec-mi424wr.dtsi and intel-ixp42x-linksys-wrv54g.dts) only use compatible/reg/spi-max-frequency/ethernet-ports, so nothing in tree fails validation today.

Verified at the end of the series as well: micrel,ks8995.yaml is unchanged and microchip,ksz.yaml's compatible enum still lacks the micrel strings.

Signature · 1 line
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20260916-ks8995-to-ksz8-v15-0-8825ff5fd4be%40kernel.org
#12 lore raw

Re: [PATCH net-next v15 3/4] net: dsa: microchip: Support Microchip KSZ8995XA / KS8995XA

Quoted 4 lines · On Thu, Sep 17, 2026 at 3:22 PM <[email protected]> wrote:

[Severity: Medium]

Does frame_size here need to account for the 4-byte KS8995 special tag as well?

No it does not and it has been tested on the hardware. The special tag only exists inside the Switch.

Quoted 3 lines

[Severity: Medium]

This is a pre-existing issue and not introduced by this patch,

So it can be dealt with later, apart from this patch series. I'm happy to do that once this gets merged.

Quoted 3 lines

[Severity: Low]

Should the bindings be updated for these three compatibles as well?

No and it has been explained before that driver code and bindings are decoupled, and this needs to be fixed in review-prompts.

I think this patch can go in.

Yours,
Linus Walleij

#13 lore raw

PATCH v15 4/4 net: dsa: ks8995: Delete surplus driver

In reply to Linus Walleij

The Microchip KSZ driver now handles the KS(Z)8995XA. The old driver identified the shared 0x95/0x0 ID as KS8995MA, but this ID cannot distinguish MA from XA. No KS8995MA users are known, and KS8995E has no documented SPI management interface. Neither variant has been verified with the replacement driver.

The two in-tree device trees using the "micrel,ks8995" compatible:

arch/arm/boot/dts/intel/ixp/intel-ixp42x-linksys-wrv54g.dts arch/arm/boot/dts/intel/ixp/intel-ixp42x-actiontec-mi424wr.dtsi

both use KS8995XA hardware and continue to be supported by the replacement driver without regressions.

Delete the old driver, but leave a stub behind in Kconfig so new users will be automatically phased over to the new symbol when migrating their configs.

The old driver supports platform data (board file) instantiation, but nothing in the kernel tree makes use of this legacy mechanism so it is fine to delete.

---
 drivers/net/dsa/Kconfig  |  10 +-
 drivers/net/dsa/Makefile |   1 -
 drivers/net/dsa/ks8995.c | 857 -----------------------------------------------
 3 files changed, 6 insertions(+), 862 deletions(-)
drivers/net/dsa/Kconfig +6 -4
index e3d88f41fecf..fe8cd5338fda 100644
@@ -112,11 +112,13 @@ config NET_DSA_RZN1_A5PSW
 config NET_DSA_KS8995
 	tristate "Micrel KS8995 family 5-ports 10/100 Ethernet switches"
 	depends on SPI
-	depends on NET_DSA_MICROCHIP_KSZ_SPI = n
-	select NET_DSA_TAG_NONE
+	select NET_DSA_MICROCHIP_KSZ_COMMON
+	select NET_DSA_MICROCHIP_KSZ_SPI
 	help
-	  This driver supports the Micrel KS8995 family of 10/100 Mbit ethernet
-	  switches, managed over SPI.
+	  This is a transitional option for users who had NET_DSA_KS8995
+	  enabled. It automatically enables the new NET_DSA_MICROCHIP_KSZ_SPI
+	  driver which supersedes it. This option will be removed in a future
+	  kernel release.
 
 config NET_DSA_SMSC_LAN9303
 	tristate
drivers/net/dsa/Makefile +0 -1
index df849cd0e640..7e637d56b35c 100644
@@ -2,7 +2,6 @@
 obj-$(CONFIG_NET_DSA_BCM_SF2)	+= bcm-sf2.o
 bcm-sf2-objs			:= bcm_sf2.o bcm_sf2_cfp.o
 obj-$(CONFIG_NET_DSA_LOOP)	+= dsa_loop.o
-obj-$(CONFIG_NET_DSA_KS8995) 	+= ks8995.o
 obj-$(CONFIG_NET_DSA_MT7530)	+= mt7530.o
 obj-$(CONFIG_NET_DSA_MT7530_MDIO) += mt7530-mdio.o
 obj-$(CONFIG_NET_DSA_MT7530_MMIO) += mt7530-mmio.o
drivers/net/dsa/ks8995.c deleted +0 -857

857 lines not on this page · raw message

Signature · 1 line
2.55.0
#14 lore raw

Re: [PATCH net-next v15 4/4] net: dsa: ks8995: Delete surplus driver

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:

Critical: 0 · High: 0 · Medium: 1 · Low: 0

- [Medium] Commit message claims the two in-tree boards "continue to be supported by the replacement driver without regressions", but the…

--

net: dsa: ks8995: Delete surplus driver

This removes drivers/net/dsa/ks8995.c and its Makefile entry, leaving NET_DSA_KS8995 behind in Kconfig as a transitional stub that selects the Microchip KSZ SPI driver instead.

drivers/net/dsa/Kconfig config NET_DSA_RZN1_A5PSW · line 116

Quoted 12 lines
drivers/net/dsa/Kconfig +2 -2
index e3d88f41fecf7..fe8cd5338fda5 100644
@@ -112,11 +112,13 @@ config NET_DSA_RZN1_A5PSW
 config NET_DSA_KS8995
 	tristate "Micrel KS8995 family 5-ports 10/100 Ethernet switches"
 	depends on SPI
-	depends on NET_DSA_MICROCHIP_KSZ_SPI = n
-	select NET_DSA_TAG_NONE
+	select NET_DSA_MICROCHIP_KSZ_COMMON
+	select NET_DSA_MICROCHIP_KSZ_SPI

[Severity: Medium]
The commit message says the two in-tree boards "both use KS8995XA hardware and continue to be supported by the replacement driver without regressions". Is that description accurate with respect to tagging and port isolation?

The deleted driver used no switch tag and did not program the switch at all:

drivers/net/dsa/ks8995.c:

	static enum
	dsa_tag_protocol ks8995_get_tag_protocol(struct dsa_switch *ds, ...)
	{
		/* This switch actually uses the 6 byte KS8995 protocol */
		return DSA_TAG_PROTO_NONE;
	}

	static int ks8995_setup(struct dsa_switch *ds)
	{
		return 0;
	}

The replacement path for the same "micrel,ks8995" compatible reports a different protocol and enables special tagging:

drivers/net/dsa/microchip/ksz8.c:ksz8995xa_get_tag_protocol()

	return DSA_TAG_PROTO_KS8995;

drivers/net/dsa/microchip/ksz8.c:ksz8_setup()

	if (ksz_is_ksz8995xa(dev))
		ksz_cfg(dev, REG_SW_CTRL_9, SW_SPECIAL_TAG, true);

ksz8_port_setup() also programs per-port tag insert/remove and restricts standalone user ports to the upstream port via ksz8_cfg_port_member() with member = BIT(dsa_upstream_port(ds, port)).

So on intel-ixp42x-linksys-wrv54g.dts and intel-ixp42x-actiontec-mi424wr.dtsi, frames on the CPU MII link now carry the switch tag, and user ports are isolated until a bridge is created, so LAN-to-LAN hardware forwarding no longer happens by default.

Until this patch users could stay on the old behaviour because the two symbols were mutually exclusive:

depends on NET_DSA_MICROCHIP_KSZ_SPI = n

Removing that line makes the switch to the new tagging and port semantics unavoidable. Could the commit message describe this behaviour change rather than stating there are no regressions, given it also notes that the MA and E variants were never verified with the replacement driver?

Quoted 8 lines
drivers/net/dsa/Kconfig +5 -2
+	select NET_DSA_MICROCHIP_KSZ_SPI
 	help
-	  This driver supports the Micrel KS8995 family of 10/100 Mbit ethernet
-	  switches, managed over SPI.
+	  This is a transitional option for users who had NET_DSA_KS8995
+	  enabled. It automatically enables the new NET_DSA_MICROCHIP_KSZ_SPI
+	  driver which supersedes it. This option will be removed in a future
+	  kernel release.

[ ... ]

Signature · 1 line
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20260916-ks8995-to-ksz8-v15-0-8825ff5fd4be%40kernel.org
#15 lore raw

Re: [PATCH net-next v15 4/4] net: dsa: ks8995: Delete surplus driver

Quoted 6 lines · On Thu, Sep 17, 2026 at 3:22 PM <[email protected]> wrote:

[Severity: Medium]
The commit message says the two in-tree boards "both use KS8995XA hardware and continue to be supported by the replacement driver without regressions". Is that description accurate with respect to tagging and port isolation?

The deleted driver used no switch tag and did not program the switch at all:

(...)

Quoted 4 lines

Removing that line makes the switch to the new tagging and port semantics unavoidable. Could the commit message describe this behaviour change rather than stating there are no regressions, given it also notes that the MA and E variants were never verified with the replacement driver?

I don't think the exact wording of a commit message is that important.

I think this patch is good to go, I don't mind if the committer want to change the commit message slightly though.

Like to the oneliner "delete the old driver" which should give none of the above complaints from Sashiko.

Yours,
Linus Walleij

#16 lore raw
In reply to Linus Walleij
This series was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:

Hello:

This series was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:

Quoted 8 lines · On Wed, 16 Sep 2026 12:20:57 +0200 you wrote:

This series breaks with the dated attempt to polish the old KS8995 driver, and instead implement support for the KS8995XA in the KSZ driver, and after that delete the old KS8995 driver.

The hardware clearly has the same ancestry, the KSZ8995XA is just a rebrand of the much older Micrel KX8995XA switch.

[...]

Here is the summary with links:
- [net-next,v15,1/4] dt-bindings: net: dsa: microchip: Add KSZ8995XA

    https://git.kernel.org/netdev/net-next/c/7a5e75f64916
  - [net-next,v15,2/4] net: dsa: tag_ks8995: Add the KS8995 tag handling
    https://git.kernel.org/netdev/net-next/c/ca30cd47fe7f
  - [net-next,v15,3/4] net: dsa: microchip: Support Microchip KSZ8995XA / KS8995XA
    https://git.kernel.org/netdev/net-next/c/a926dc2352a9
  - [net-next,v15,4/4] net: dsa: ks8995: Delete surplus driver
    https://git.kernel.org/netdev/net-next/c/744e0256c4a1

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html