AI Trajectory


Trajectory: (Expand/Collapse All)
Seq Timestamp Type Name Duration
0/0 2026/10/03 06:54 flow patch-triage
1m Args:
null

Results:
{
  "EnableConfigs": null,
  "FocusSymbols": [],
  "KMSANReasoning": "",
  "NeedsKMSAN": false,
  "Reasoning": "The patch series adds support for the Motorcomm YT9224/YT9228 ethernet switch chip to drivers/net/dsa/motorcomm/ and adds a corresponding DSA tag driver in net/dsa/tag_yt922x.c. The Motorcomm YT92xx devices are vendor-specific physical Ethernet switch ASICs controlled over an MDIO bus and are not emulated in standard virtualized environments (QEMU or GCE). Furthermore, the tagging driver (tag_yt922x.c) can only be engaged by this specific switch driver, as no other DSA switch supports or accepts changing to DSA_TAG_PROTO_YT922X. Consequently, the modified code is structurally unreachable for fuzzing.",
  "WorthFuzzing": false
}

1/1 2026/10/03 06:54 action read-patch-diff
0m Args:
null

Results:
{
  "PatchDiff": "commit ecb7428735fd1ff678dec15cd4f06cd75808fe49\nAuthor: syz-cluster \u003ctriage@syzkaller.com\u003e\nDate:   Sat Oct 3 06:54:09 2026 +0000\n\n    syz-cluster: applied patch under review\n\ndiff --git a/MAINTAINERS b/MAINTAINERS\nindex 3011f995437fd..1a48e4570c698 100644\n--- a/MAINTAINERS\n+++ b/MAINTAINERS\n@@ -18433,11 +18433,13 @@ F:\tdrivers/net/phy/motorcomm.c\n \n MOTORCOMM YT921X ETHERNET SWITCH DRIVER\n M:\tDavid Yang \u003cmmyangfl@gmail.com\u003e\n+M:\tKyle Switch \u003ckyle.switch@motor-comm.com\u003e\n L:\tnetdev@vger.kernel.org\n S:\tMaintained\n F:\tDocumentation/devicetree/bindings/net/dsa/motorcomm,yt921x.yaml\n F:\tdrivers/net/dsa/motorcomm/\n F:\tnet/dsa/tag_yt921x.c\n+F:\tnet/dsa/tag_yt922x.c\n \n MOXA SMARTIO/INDUSTIO/INTELLIO SERIAL CARD\n M:\tJiri Slaby \u003cjirislaby@kernel.org\u003e\ndiff --git a/drivers/net/dsa/motorcomm/Kconfig b/drivers/net/dsa/motorcomm/Kconfig\nindex 79cdd79a1fd25..648c49d6c5271 100644\n--- a/drivers/net/dsa/motorcomm/Kconfig\n+++ b/drivers/net/dsa/motorcomm/Kconfig\n@@ -1,11 +1,12 @@\n # SPDX-License-Identifier: GPL-2.0-only\n config NET_DSA_YT921X\n-\ttristate \"Motorcomm YT9215 ethernet switch chip support\"\n+\ttristate \"Motorcomm YT9215 and YT9224 ethernet switch chip support\"\n \tselect NET_DSA_TAG_YT921X\n+\tselect NET_DSA_TAG_YT922X\n \tselect NET_IEEE8021Q_HELPERS if DCB\n \thelp\n-\t  This enables support for the Motorcomm YT9215 ethernet switch\n-\t  chip.\n+\t  This enables support for the Motorcomm YT9215 and YT9224\n+\t  ethernet switch chip.\n \n config NET_DSA_YT921X_LEDS\n \tbool \"LED support for Motorcomm YT9215\"\ndiff --git a/drivers/net/dsa/motorcomm/Makefile b/drivers/net/dsa/motorcomm/Makefile\nindex 1d2c1b3064c41..d1cd7c8a3852c 100644\n--- a/drivers/net/dsa/motorcomm/Makefile\n+++ b/drivers/net/dsa/motorcomm/Makefile\n@@ -3,5 +3,6 @@ obj-$(CONFIG_NET_DSA_YT921X) += yt921x.o\n yt921x-objs := chip.o\n yt921x-$(CONFIG_NET_DSA_YT921X_LEDS) += leds.o\n yt921x-objs += mdio_bus.o\n+yt921x-objs += pcs-922x.o\n yt921x-objs += pcs-921x.o\n yt921x-objs += smi.o\ndiff --git a/drivers/net/dsa/motorcomm/chip.c b/drivers/net/dsa/motorcomm/chip.c\nindex 3ff2de383157a..175855cbc2375 100644\n--- a/drivers/net/dsa/motorcomm/chip.c\n+++ b/drivers/net/dsa/motorcomm/chip.c\n@@ -1,6 +1,6 @@\n // SPDX-License-Identifier: GPL-2.0-or-later\n /*\n- * Driver for Motorcomm YT921x Switch\n+ * Driver for Motorcomm YT921x and YT922x Switch\n  *\n  * Should work on YT9213/YT9214/YT9215/YT9218, but only tested on YT9215+SGMII,\n  * be sure to do your own checks before porting to another chip.\n@@ -101,19 +101,19 @@ static const struct yt921x_mib_desc yt921x_mib_descs[] = {\n static const struct yt921x_info yt921x_infos[] = {\n \t{\n \t\t\"YT9215SC\", YT9215_MAJOR, 1, 0,\n-\t\tGENMASK(4, 0),\n+\t\tGENMASK_U16(4, 0),\n \t\tBIT(9),\n \t\tBIT(8) | BIT(9),\n \t},\n \t{\n \t\t\"YT9215S\", YT9215_MAJOR, 2, 0,\n-\t\tGENMASK(4, 0),\n+\t\tGENMASK_U16(4, 0),\n \t\tBIT(9),\n \t\tBIT(8),\n \t},\n \t{\n \t\t\"YT9215RB\", YT9215_MAJOR, 3, 0,\n-\t\tGENMASK(4, 0),\n+\t\tGENMASK_U16(4, 0),\n \t\tBIT(8) | BIT(9),\n \t\t0,\n \t},\n@@ -131,16 +131,28 @@ static const struct yt921x_info yt921x_infos[] = {\n \t},\n \t{\n \t\t\"YT9218N\", YT9218_MAJOR, 0, 0,\n-\t\tGENMASK(7, 0),\n+\t\tGENMASK_U16(7, 0),\n \t\t0,\n \t\t0,\n \t},\n \t{\n \t\t\"YT9218MB\", YT9218_MAJOR, 1, 0,\n-\t\tGENMASK(7, 0),\n+\t\tGENMASK_U16(7, 0),\n \t\tBIT(8) | BIT(9),\n \t\tBIT(8) | BIT(9),\n \t},\n+\t{\n+\t\t\"YT9224\", YT9224_MAJOR, 0, 0,\n+\t\tGENMASK_U16(7, 4),\n+\t\t0,\n+\t\tBIT(8) | BIT(9),\n+\t},\n+\t{\n+\t\t\"YT9228\", YT9224_MAJOR, 0, 0,\n+\t\tGENMASK_U16(7, 4),\n+\t\t0,\n+\t\tBIT(8) | GENMASK_U16(3, 0),\n+\t},\n \t{}\n };\n \n@@ -3924,6 +3936,17 @@ static void yt921x_dsa_teardown(struct dsa_switch *ds)\n \n \tyt921x_leds_remove(priv);\n #endif\n+\n+\tfor (size_t i = ARRAY_SIZE(priv-\u003eports); i-- \u003e 0; ) {\n+\t\tstruct yt921x_port *pp = \u0026priv-\u003eports[i];\n+\n+\t\tdisable_delayed_work_sync(\u0026pp-\u003emib_read);\n+\t}\n+}\n+\n+static bool yt921x_needs_extmode_check(u32 major)\n+{\n+\treturn (major == YT9224_MAJOR) ? false : true;\n }\n \n static int yt921x_chip_detect(struct yt921x_priv *priv)\n@@ -3951,6 +3974,9 @@ static int yt921x_chip_detect(struct yt921x_priv *priv)\n \t\treturn -ENODEV;\n \t}\n \n+\tif (!yt921x_needs_extmode_check(major))\n+\t\tgoto skip_extmode_check;\n+\n \tres = yt921x_reg_read(priv, YT921X_CHIP_MODE, \u0026mode);\n \tif (res)\n \t\treturn res;\n@@ -3990,6 +4016,14 @@ static int yt921x_chip_detect(struct yt921x_priv *priv)\n \n \tpriv-\u003einfo = info;\n \n+\treturn 0;\n+\n+skip_extmode_check:\n+\tdev_info(dev,\n+\t\t \"Motorcomm %s ethernet switch, chipid: 0x%x\\n\",\n+\t\t info-\u003ename, chipid);\n+\tpriv-\u003einfo = info;\n+\n \treturn 0;\n }\n \n@@ -4061,7 +4095,7 @@ static int yt921x_chip_setup_dsa(struct yt921x_priv *priv)\n \tif (res)\n \t\treturn res;\n \n-\tctrl = GENMASK(10, 0);\n+\tctrl = GENMASK_U32(10, 0);\n \tres = yt921x_reg_write(priv, YT921X_FILTER_UNK_UCAST, ctrl);\n \tif (res)\n \t\treturn res;\n@@ -4251,6 +4285,14 @@ static int yt921x_dsa_setup(struct dsa_switch *ds)\n \tint port;\n \tint res;\n \n+\t/* mib polling init */\n+\tfor (size_t i = 0; i \u003c ARRAY_SIZE(priv-\u003eports); i++) {\n+\t\tstruct yt921x_port *pp = \u0026priv-\u003eports[i];\n+\n+\t\tpp-\u003eindex = i;\n+\t\tINIT_DELAYED_WORK(\u0026pp-\u003emib_read, yt921x_poll_mib);\n+\t}\n+\n \tmutex_lock(\u0026priv-\u003ereg_lock);\n \tres = yt921x_chip_reset(priv);\n \tmutex_unlock(\u0026priv-\u003ereg_lock);\n@@ -4397,6 +4439,486 @@ static const struct dsa_switch_ops yt921x_dsa_switch_ops = {\n \t.setup\t\t\t= yt921x_dsa_setup,\n };\n \n+static int yt922x_port_down(struct yt921x_priv *priv, int port)\n+{\n+\tu32 mask;\n+\tint res;\n+\n+\t/* mac force down */\n+\tmask = YT922X_PORT_LINK | YT922X_PORT_RX_MAC_EN |\n+\tYT922X_PORT_TX_MAC_EN | YT922X_PORT_LINK_AN;\n+\tres = yt921x_reg_clear_bits(priv, YT922X_PORTn_CTRL(port), mask);\n+\tif (res)\n+\t\treturn res;\n+\t/* Need force op to make soft configuration effective */\n+\tmask = YT922X_PORT_FORCE_OP;\n+\tres = yt921x_reg_set_bits(priv, YT922X_PORTn_CTRL(port), mask);\n+\tif (res)\n+\t\treturn res;\n+\n+\t/* disable en_phy */\n+\tres = yt921x_reg_clear_bits(priv, YT922X_EN_PHY_VALUE, BIT(port));\n+\tif (res)\n+\t\treturn res;\n+\tres = yt921x_reg_set_bits(priv, YT922X_EN_PHY_OVERWRITE, BIT(port));\n+\tif (res)\n+\t\treturn res;\n+\n+\treturn 0;\n+}\n+\n+static void\n+yt922x_phylink_mac_link_down(struct phylink_config *config, unsigned int mode,\n+\t\t\t     phy_interface_t interface)\n+{\n+\tstruct dsa_port *dp = dsa_phylink_to_port(config);\n+\tstruct yt921x_priv *priv = to_yt921x_priv(dp-\u003eds);\n+\tint port = dp-\u003eindex;\n+\tint res;\n+\n+\tmutex_lock(\u0026priv-\u003ereg_lock);\n+\tres = yt922x_port_down(priv, port);\n+\tmutex_unlock(\u0026priv-\u003ereg_lock);\n+\n+\tif (res)\n+\t\tdev_err(dp-\u003eds-\u003edev, \"Failed to %s port %d: %i\\n\", \"bring down\",\n+\t\t\tport, res);\n+}\n+\n+static int\n+yt922x_port_up(struct yt921x_priv *priv, int port, unsigned int mode,\n+\t       phy_interface_t interface, int speed, int duplex,\n+\t       bool tx_pause, bool rx_pause)\n+{\n+\tint ps = ethtool_speed_to_yt921x(speed);\n+\tu32 ctrl = 0;\n+\tu32 mask;\n+\tint res;\n+\n+\tif (ps == YT921X_SPEED_INVALID)\n+\t\treturn -EINVAL;\n+\tctrl |= ps;\n+\n+\tif (duplex == DUPLEX_FULL)\n+\t\tctrl |= YT922X_PORT_DUPLEX_FULL;\n+\tif (tx_pause)\n+\t\tctrl |= YT922X_PORT_TX_PAUSE;\n+\tif (rx_pause)\n+\t\tctrl |= YT922X_PORT_RX_PAUSE;\n+\tctrl |= YT922X_PORT_RX_MAC_EN | YT922X_PORT_TX_MAC_EN |\n+\t\t\tYT922X_PORT_CFG_TX_EN | YT922X_PORT_LINK |\n+\t\t\tYT922X_PORT_CFG_RX_EN;\n+\tctrl \u0026= ~(YT922X_PORT_FC_AN | YT922X_PORT_LINK_AN);\n+\tres = yt921x_reg_write(priv, YT922X_PORTn_CTRL(port), ctrl);\n+\tif (res)\n+\t\treturn res;\n+\n+\t/* force op */\n+\tmask = YT922X_PORT_FORCE_OP;\n+\tres = yt921x_reg_set_bits(priv, YT922X_PORTn_CTRL(port), mask);\n+\tif (res)\n+\t\treturn res;\n+\n+\t/* enable en_phy */\n+\tres = yt921x_reg_set_bits(priv, YT922X_EN_PHY_VALUE, BIT(port));\n+\tif (res)\n+\t\treturn res;\n+\tres = yt921x_reg_set_bits(priv, YT922X_EN_PHY_OVERWRITE, BIT(port));\n+\tif (res)\n+\t\treturn res;\n+\n+\treturn 0;\n+}\n+\n+static void\n+yt922x_phylink_mac_link_up(struct phylink_config *config,\n+\t\t\t   struct phy_device *phydev, unsigned int mode,\n+\t\t\t   phy_interface_t interface, int speed, int duplex,\n+\t\t\t   bool tx_pause, bool rx_pause)\n+{\n+\tstruct dsa_port *dp = dsa_phylink_to_port(config);\n+\tstruct yt921x_priv *priv = to_yt921x_priv(dp-\u003eds);\n+\tint port = dp-\u003eindex;\n+\tint res;\n+\n+\tmutex_lock(\u0026priv-\u003ereg_lock);\n+\tres = yt922x_port_up(priv, port, mode, interface, speed, duplex,\n+\t\t\t     tx_pause, rx_pause);\n+\tmutex_unlock(\u0026priv-\u003ereg_lock);\n+\n+\tif (res)\n+\t\tdev_err(dp-\u003eds-\u003edev, \"Failed to %s port %d: %i\\n\", \"bring up\",\n+\t\t\tport, res);\n+}\n+\n+static void\n+yt922x_phylink_mac_config(struct phylink_config *config, unsigned int mode,\n+\t\t\t  const struct phylink_link_state *state)\n+{\n+}\n+\n+static struct phylink_pcs *\n+yt922x_phylink_mac_select_pcs(struct phylink_config *config,\n+\t\t\t      phy_interface_t interface)\n+{\n+\tstruct dsa_port *dp = dsa_phylink_to_port(config);\n+\tstruct yt921x_priv *priv = to_yt921x_priv(dp-\u003eds);\n+\n+\tswitch (interface) {\n+\tcase PHY_INTERFACE_MODE_SGMII:\n+\tcase PHY_INTERFACE_MODE_1000BASEX:\n+\tcase PHY_INTERFACE_MODE_2500BASEX:\n+\tcase PHY_INTERFACE_MODE_USXGMII:\n+\t\treturn \u0026priv-\u003eports[dp-\u003eindex].pcs;\n+\n+\tdefault:\n+\t\treturn NULL;\n+\t}\n+}\n+\n+static const struct phylink_mac_ops yt922x_phylink_mac_ops = {\n+\t.mac_select_pcs = yt922x_phylink_mac_select_pcs,\n+\t.mac_link_down = yt922x_phylink_mac_link_down,\n+\t.mac_link_up = yt922x_phylink_mac_link_up,\n+\t.mac_config = yt922x_phylink_mac_config,\n+};\n+\n+static enum dsa_tag_protocol\n+yt922x_dsa_get_tag_protocol(struct dsa_switch *ds, int port,\n+\t\t\t    enum dsa_tag_protocol m)\n+{\n+\treturn DSA_TAG_PROTO_YT922X;\n+}\n+\n+static void\n+yt922x_dsa_phylink_get_caps(struct dsa_switch *ds, int port,\n+\t\t\t    struct phylink_config *config)\n+{\n+\tstruct yt921x_priv *priv = to_yt921x_priv(ds);\n+\tconst struct yt921x_info *info = priv-\u003einfo;\n+\n+\tconfig-\u003emac_capabilities = MAC_ASYM_PAUSE | MAC_SYM_PAUSE |\n+\t\t\t\t   MAC_10 | MAC_100 | MAC_1000;\n+\n+\tif (info-\u003einternal_mask \u0026 BIT(port)) {\n+\t\t/* port 4 to port 7, internal utp */\n+\t\t__set_bit(PHY_INTERFACE_MODE_INTERNAL,\n+\t\t\t  config-\u003esupported_interfaces);\n+\t\tconfig-\u003emac_capabilities |= MAC_2500FD;\n+\t}\n+\tif (info-\u003eserdes_mask \u0026 BIT(port)) {\n+\t\t/* serdes */\n+\t\t__set_bit(PHY_INTERFACE_MODE_SGMII,\n+\t\t\t  config-\u003esupported_interfaces);\n+\t\t__set_bit(PHY_INTERFACE_MODE_1000BASEX,\n+\t\t\t  config-\u003esupported_interfaces);\n+\t\t__set_bit(PHY_INTERFACE_MODE_2500BASEX,\n+\t\t\t  config-\u003esupported_interfaces);\n+\t\tconfig-\u003emac_capabilities |= MAC_2500FD;\n+\t\t__set_bit(PHY_INTERFACE_MODE_USXGMII,\n+\t\t\t  config-\u003esupported_interfaces);\n+\t\tconfig-\u003emac_capabilities |= MAC_5000FD;\n+\t\tconfig-\u003emac_capabilities |= MAC_10000FD;\n+\t}\n+}\n+\n+static int yt922x_port_setup(struct yt921x_priv *priv, int port)\n+{\n+\tstruct dsa_switch *ds = \u0026priv-\u003eds;\n+\tu32 mask;\n+\tu32 ctrl;\n+\tint res;\n+\n+\t/* enable user port isolation and disable fdb learning */\n+\tctrl = ~priv-\u003ecpu_ports_mask;\n+\tres = yt921x_reg_write(priv, YT922X_PORTn_ISOLATION(port), ctrl);\n+\tif (res)\n+\t\treturn res;\n+\n+\tmask = YT922X_PORT_LEARN_DIS;\n+\tres = yt921x_reg_set_bits(priv, YT922X_PORTn_LEARN(port), mask);\n+\tif (res)\n+\t\treturn res;\n+\n+\tif (dsa_is_cpu_port(ds, port)) {\n+\t\tctrl = ~(u32)0;\n+\t\tres = yt921x_reg_write(priv, YT922X_PORTn_ISOLATION(port),\n+\t\t\t\t       ctrl);\n+\t\tif (res)\n+\t\t\treturn res;\n+\t}\n+\n+\treturn 0;\n+}\n+\n+static int yt922x_dsa_port_setup(struct dsa_switch *ds, int port)\n+{\n+\tstruct yt921x_priv *priv = to_yt921x_priv(ds);\n+\tint res;\n+\n+\tmutex_lock(\u0026priv-\u003ereg_lock);\n+\tres = yt922x_port_setup(priv, port);\n+\tmutex_unlock(\u0026priv-\u003ereg_lock);\n+\n+\treturn res;\n+}\n+\n+static int yt922x_cpu_tag_mode_set_8b(struct yt921x_priv *priv)\n+{\n+\tu32 val;\n+\tu32 val1;\n+\tint res;\n+\n+\t/* cpu tag mode set to 8b */\n+\tres = yt921x_reg_read(priv, YT922X_CPU_TAG_RX_CTRL, \u0026val);\n+\tif (res)\n+\t\treturn res;\n+\tres = yt921x_reg_read(priv, YT922X_CPU_TAG_TX_CTRL, \u0026val1);\n+\tif (res)\n+\t\treturn res;\n+\tval \u0026= ~YT922X_CPU_TAG_RX_MODE;\n+\tval1 \u0026= ~YT922X_CPU_TAG_TX_MODE;\n+\tval1 \u0026= ~YT922X_CPU_TAG_TX_TYPE;\n+\tres = yt921x_reg_write(priv, YT922X_CPU_TAG_RX_CTRL, val);\n+\tif (res)\n+\t\treturn res;\n+\tres = yt921x_reg_write(priv, YT922X_CPU_TAG_TX_CTRL, val1);\n+\tif (res)\n+\t\treturn res;\n+\n+\treturn 0;\n+}\n+\n+static int yt922x_cpu_port_set(struct yt921x_priv *priv)\n+{\n+\tstruct dsa_switch *ds = \u0026priv-\u003eds;\n+\tu32 ctrl;\n+\tint res;\n+\n+\t/* cpu tag mode */\n+\tres = yt922x_cpu_tag_mode_set_8b(priv);\n+\tif (res)\n+\t\treturn res;\n+\n+\t/* Enable DSA */\n+\tpriv-\u003ecpu_ports_mask = dsa_cpu_ports(ds);\n+\tctrl = YT921X_EXT_CPU_PORT_TAG_EN | YT921X_EXT_CPU_PORT_PORT_EN |\n+\t       YT921X_EXT_CPU_PORT_PORT(__ffs(priv-\u003ecpu_ports_mask));\n+\tres = yt921x_reg_write(priv, YT921X_EXT_CPU_PORT, ctrl);\n+\tif (res)\n+\t\treturn res;\n+\n+\t/* Setup software switch */\n+\tctrl = YT922X_CPU_COPY_TO_EXT_CPU;\n+\tres = yt921x_reg_write(priv, YT922X_CPU_COPY, ctrl);\n+\tif (res)\n+\t\treturn res;\n+\n+\treturn res;\n+}\n+\n+static int yt922x_chip_setup_dsa(struct yt921x_priv *priv)\n+{\n+\tunsigned long cpu_ports_mask;\n+\tu32 ctrl;\n+\tint port;\n+\tint res;\n+\n+\t/* cpu port set */\n+\tres = yt922x_cpu_port_set(priv);\n+\tif (res)\n+\t\treturn res;\n+\n+\tctrl = GENMASK_U32(8, 0);\n+\tres = yt921x_reg_write(priv, YT922X_FILTER_UNK_UCAST, ctrl);\n+\tif (res)\n+\t\treturn res;\n+\n+\tctrl = 0;\n+\tfor (int i = 0; i \u003c priv-\u003eseries-\u003emax_ports; i++)\n+\t\tctrl |= YT922X_ACT_UNK_ACTn_TRAP(i);\n+\tcpu_ports_mask = priv-\u003ecpu_ports_mask;\n+\tfor_each_set_bit(port, \u0026cpu_ports_mask, priv-\u003eseries-\u003emax_ports) {\n+\t\tctrl \u0026= ~YT922X_ACT_UNK_ACTn_M(port);\n+\t\tctrl |= YT922X_ACT_UNK_ACTn_DROP(port);\n+\t}\n+\tres = yt921x_reg_write(priv, YT922X_ACT_UNK_UCAST, ctrl);\n+\tif (res)\n+\t\treturn res;\n+\tres = yt921x_reg_write(priv, YT922X_ACT_UNK_MCAST, ctrl);\n+\tif (res)\n+\t\treturn res;\n+\n+\treturn 0;\n+}\n+\n+static int yt922x_chip_setup(struct yt921x_priv *priv)\n+{\n+\tu32 ctrl;\n+\tint res;\n+\n+\tctrl = YT922X_FUNC_MIB | YT922X_FUNC_ACL;\n+\tres = yt921x_reg_set_bits(priv, YT921X_FUNC, ctrl);\n+\tif (res)\n+\t\treturn res;\n+\n+\tres = yt922x_chip_setup_dsa(priv);\n+\tif (res)\n+\t\treturn res;\n+\n+\treturn 0;\n+}\n+\n+static void yt922x_pcs_setup(struct dsa_switch *ds)\n+{\n+\tstruct yt921x_priv *priv = to_yt921x_priv(ds);\n+\tconst struct yt921x_info *info = priv-\u003einfo;\n+\tunsigned long mask;\n+\tint port;\n+\n+\tmask = info-\u003eserdes_mask;\n+\tfor_each_set_bit(port, \u0026mask, priv-\u003eseries-\u003emax_ports) {\n+\t\tstruct yt921x_port *pp = \u0026priv-\u003eports[port];\n+\n+\t\tpp-\u003epcs.ops = \u0026yt922x_phylink_pcs_ops;\n+\t\tpp-\u003epcs.poll = true;\n+\n+\t\t__set_bit(PHY_INTERFACE_MODE_SGMII,\n+\t\t\t  pp-\u003epcs.supported_interfaces);\n+\t\t__set_bit(PHY_INTERFACE_MODE_1000BASEX,\n+\t\t\t  pp-\u003epcs.supported_interfaces);\n+\t\t__set_bit(PHY_INTERFACE_MODE_2500BASEX,\n+\t\t\t  pp-\u003epcs.supported_interfaces);\n+\t\t__set_bit(PHY_INTERFACE_MODE_USXGMII,\n+\t\t\t  pp-\u003epcs.supported_interfaces);\n+\t}\n+}\n+\n+static int yt922x_dsa_setup(struct dsa_switch *ds)\n+{\n+\tstruct yt921x_priv *priv = to_yt921x_priv(ds);\n+\tstruct device *dev = to_device(priv);\n+\tstruct device_node *np = dev-\u003eof_node;\n+\tstruct device_node *child;\n+\tint res;\n+\n+\t/*  ports index init */\n+\tfor (size_t i = 0; i \u003c ARRAY_SIZE(priv-\u003eports); i++) {\n+\t\tstruct yt921x_port *pp = \u0026priv-\u003eports[i];\n+\n+\t\tpp-\u003eindex = i;\n+\t}\n+\n+\tmutex_lock(\u0026priv-\u003ereg_lock);\n+\tres = yt921x_chip_reset(priv);\n+\tmutex_unlock(\u0026priv-\u003ereg_lock);\n+\tif (res)\n+\t\treturn res;\n+\n+\t/* Register the internal mdio bus. */\n+\tchild = of_get_child_by_name(np, \"mdio\");\n+\tif (child) {\n+\t\tres = yt921x_mbus_int_init(priv, child);\n+\t\tof_node_put(child);\n+\t\tif (res)\n+\t\t\treturn res;\n+\t}\n+\n+\tmutex_lock(\u0026priv-\u003ereg_lock);\n+\tres = yt922x_chip_setup(priv);\n+\tmutex_unlock(\u0026priv-\u003ereg_lock);\n+\tif (res)\n+\t\treturn res;\n+\n+\t/* switch sds pcs setup */\n+\tyt922x_pcs_setup(ds);\n+\n+\treturn 0;\n+}\n+\n+static const struct dsa_switch_ops yt922x_dsa_switch_ops = {\n+\t/* port */\n+\t.get_tag_protocol = yt922x_dsa_get_tag_protocol,\n+\t.phylink_get_caps = yt922x_dsa_phylink_get_caps,\n+\t.port_setup  = yt922x_dsa_port_setup,\n+\t/* chip */\n+\t.setup   = yt922x_dsa_setup,\n+};\n+\n+static const struct yt92xx_series yt92xx_series_table[] = {\n+\t[YT92XX_MODE_YT921X] = {\n+\t\t.name = \"YT921x\",\n+\t\t.max_ports = YT921X_PORT_NUM,\n+\t\t.num_lag_ids = YT921X_LAG_NUM,\n+\t\t.ageing_time_min = 1 * 5000,\n+\t\t.ageing_time_max = U16_MAX * 5000,\n+\t\t.dscp_prio_mapping_is_global = true,\n+\t\t.assisted_learning_on_cpu_port = true,\n+\t\t.switch_ops = \u0026yt921x_dsa_switch_ops,\n+\t\t.mac_ops = \u0026yt921x_phylink_mac_ops\n+\t},\n+\t[YT92XX_MODE_YT922X] = {\n+\t\t.name = \"YT922x\",\n+\t\t.max_ports = YT922X_PORT_NUM,\n+\t\t.num_lag_ids = YT922X_LAG_NUM,\n+\t\t.ageing_time_min = 1 * 6000,\n+\t\t.ageing_time_max = U16_MAX * 6000,\n+\t\t.dscp_prio_mapping_is_global = true,\n+\t\t.assisted_learning_on_cpu_port = true,\n+\t\t.switch_ops = \u0026yt922x_dsa_switch_ops,\n+\t\t.mac_ops = \u0026yt922x_phylink_mac_ops,\n+\t},\n+};\n+\n+static const struct yt92xx_series *yt92xx_series_lookup(u32 major)\n+{\n+\tif (major == YT9215_MAJOR || major == YT9218_MAJOR)\n+\t\treturn \u0026yt92xx_series_table[YT92XX_MODE_YT921X];\n+\telse if (major == YT9224_MAJOR)\n+\t\treturn \u0026yt92xx_series_table[YT92XX_MODE_YT922X];\n+\telse\n+\t\treturn NULL;\n+}\n+\n+static int yt92xx_register_switch(struct dsa_switch *ds)\n+{\n+\tstruct yt921x_priv *priv = to_yt921x_priv(ds);\n+\tstruct device *dev = to_device(priv);\n+\tconst struct yt92xx_series *series;\n+\tu32 chipid;\n+\tu32 major;\n+\tint res;\n+\n+\tmutex_lock(\u0026priv-\u003ereg_lock);\n+\tres = yt921x_reg_read(priv, YT921X_CHIP_ID, \u0026chipid);\n+\tmutex_unlock(\u0026priv-\u003ereg_lock);\n+\tif (res) {\n+\t\tdev_err(dev, \"Unexpected chipid 0x%x\\n\", chipid);\n+\t\treturn res;\n+\t}\n+\n+\tmajor = FIELD_GET(YT921X_CHIP_ID_MAJOR, chipid);\n+\tseries = yt92xx_series_lookup(major);\n+\tif (!series) {\n+\t\tdev_err(dev, \"Undefined series info for the corresponding major\\n\");\n+\t\treturn -ENODEV;\n+\t}\n+\tpriv-\u003eseries = series;\n+\n+\tds-\u003eassisted_learning_on_cpu_port =\n+\t\tpriv-\u003eseries-\u003eassisted_learning_on_cpu_port;\n+\tds-\u003edscp_prio_mapping_is_global =\n+\t\tpriv-\u003eseries-\u003edscp_prio_mapping_is_global;\n+\tds-\u003eageing_time_min = priv-\u003eseries-\u003eageing_time_min;\n+\tds-\u003eageing_time_max = priv-\u003eseries-\u003eageing_time_max;\n+\tds-\u003enum_lag_ids = priv-\u003eseries-\u003enum_lag_ids;\n+\tds-\u003enum_ports = priv-\u003eseries-\u003emax_ports;\n+\tds-\u003eops = priv-\u003eseries-\u003eswitch_ops;\n+\tds-\u003ephylink_mac_ops = priv-\u003eseries-\u003emac_ops;\n+\n+\treturn 0;\n+}\n+\n static void yt921x_mdio_shutdown(struct mdio_device *mdiodev)\n {\n \tstruct yt921x_priv *priv = mdiodev_get_drvdata(mdiodev);\n@@ -4414,12 +4936,6 @@ static void yt921x_mdio_remove(struct mdio_device *mdiodev)\n \tif (!priv)\n \t\treturn;\n \n-\tfor (size_t i = ARRAY_SIZE(priv-\u003eports); i-- \u003e 0; ) {\n-\t\tstruct yt921x_port *pp = \u0026priv-\u003eports[i];\n-\n-\t\tdisable_delayed_work_sync(\u0026pp-\u003emib_read);\n-\t}\n-\n \tdsa_unregister_switch(\u0026priv-\u003eds);\n \n \tfor (unsigned int i = 0; i \u003c ARRAY_SIZE(priv-\u003eacl_blks); i++) {\n@@ -4445,6 +4961,7 @@ static int yt921x_mdio_probe(struct mdio_device *mdiodev)\n \tstruct yt921x_reg_mdio *mdio;\n \tstruct yt921x_priv *priv;\n \tstruct dsa_switch *ds;\n+\tint res;\n \n \tpriv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);\n \tif (!priv)\n@@ -4463,24 +4980,12 @@ static int yt921x_mdio_probe(struct mdio_device *mdiodev)\n \tpriv-\u003ereg_ops = \u0026yt921x_reg_ops_mdio;\n \tpriv-\u003ereg_ctx = mdio;\n \n-\tfor (size_t i = 0; i \u003c ARRAY_SIZE(priv-\u003eports); i++) {\n-\t\tstruct yt921x_port *pp = \u0026priv-\u003eports[i];\n-\n-\t\tpp-\u003eindex = i;\n-\t\tINIT_DELAYED_WORK(\u0026pp-\u003emib_read, yt921x_poll_mib);\n-\t}\n-\n \tds = \u0026priv-\u003eds;\n \tds-\u003edev = dev;\n-\tds-\u003eassisted_learning_on_cpu_port = true;\n-\tds-\u003edscp_prio_mapping_is_global = true;\n \tds-\u003epriv = priv;\n-\tds-\u003eops = \u0026yt921x_dsa_switch_ops;\n-\tds-\u003eageing_time_min = 1 * 5000;\n-\tds-\u003eageing_time_max = U16_MAX * 5000;\n-\tds-\u003ephylink_mac_ops = \u0026yt921x_phylink_mac_ops;\n-\tds-\u003enum_lag_ids = YT921X_LAG_NUM;\n-\tds-\u003enum_ports = YT921X_PORT_NUM;\n+\tres = yt92xx_register_switch(ds);\n+\tif (res)\n+\t\treturn res;\n \n \tmdiodev_set_drvdata(mdiodev, priv);\n \n@@ -4489,6 +4994,7 @@ static int yt921x_mdio_probe(struct mdio_device *mdiodev)\n \n static const struct of_device_id yt921x_of_match[] = {\n \t{ .compatible = \"motorcomm,yt9215\" },\n+\t{ .compatible = \"motorcomm,yt9224\" },\n \t{}\n };\n MODULE_DEVICE_TABLE(of, yt921x_of_match);\n@@ -4506,5 +5012,6 @@ static struct mdio_driver yt921x_mdio_driver = {\n mdio_module_driver(yt921x_mdio_driver);\n \n MODULE_AUTHOR(\"David Yang \u003cmmyangfl@gmail.com\u003e\");\n-MODULE_DESCRIPTION(\"Driver for Motorcomm YT921x Switch\");\n+MODULE_AUTHOR(\"Kyle Switch \u003ckyle.switch@motor-comm.com\u003e\");\n+MODULE_DESCRIPTION(\"Driver for Motorcomm YT921x and YT922x Switch\");\n MODULE_LICENSE(\"GPL\");\ndiff --git a/drivers/net/dsa/motorcomm/chip.h b/drivers/net/dsa/motorcomm/chip.h\nindex 28e4f26f9cc49..f11d19ba79b5b 100644\n--- a/drivers/net/dsa/motorcomm/chip.h\n+++ b/drivers/net/dsa/motorcomm/chip.h\n@@ -812,6 +812,7 @@ enum yt921x_fdb_entry_status {\n \n #define YT9215_MAJOR\t0x9002\n #define YT9218_MAJOR\t0x9001\n+#define YT9224_MAJOR\t0x9004\n \n /* required for a hard reset */\n #define YT921X_RST_DELAY_US\t10000\n@@ -833,6 +834,96 @@ enum yt921x_fdb_entry_status {\n \n #define YT921X_NAME\t\"yt921x\"\n \n+/* yt922x register lists */\n+#define YT92XX_PAGE_SELECT\t0x1e\n+#define YT92XX_PAGE\t\t0x1f\n+#define YT922X_PORTn_STATUS(port)\t(0x80200 + 4 * (port))\n+#define  YT922X_PORT_LINK_STATE\t\t\tBIT(8)\n+#define  YT922X_PORT_LINK_DUPLEX\t\tBIT(7)\n+#define  YT922X_PORT_RX_FC_EN\t\t\tBIT(6)\n+#define  YT922X_PORT_TX_FC_EN\t\t\tBIT(5)\n+#define YT922X_PORT_SPEED_10\t\t0\n+#define YT922X_PORT_SPEED_100\t\t1\n+#define YT922X_PORT_SPEED_1000\t\t2\n+#define YT922X_PORT_SPEED_10000\t\t3\n+#define YT922X_PORT_SPEED_2500\t\t4\n+#define YT922X_PORT_SPEED_5000\t\t5\n+#define YT922X_EN_PHY_OVERWRITE\t\t(0x80040)\n+#define YT922X_EN_PHY_VALUE\t\t(0x8003c)\n+/* CTRL: force op to make soft configuration effective */\n+#define YT922X_PORTn_CTRL(port)\t\t(0x80080 + 4 * (port))\n+#define  YT922X_PORT_FORCE_OP\t\t\tBIT(14)\n+#define  YT922X_PORT_CFG_TX_EN\t\t\tBIT(13)\n+#define  YT922X_PORT_CFG_RX_EN\t\t\tBIT(12)\n+#define  YT922X_PORT_FC_AN\t\t\tBIT(11)\n+#define  YT922X_PORT_LINK_AN\t\t\tBIT(10)  /* CTRL: auto negotiation */\n+#define  YT922X_PORT_LINK\t\t\tBIT(9)  /* CTRL: link status */\n+#define  YT922X_PORT_HALF_PAUSE\t\t\tBIT(8)  /* Half-duplex back pressure mode */\n+#define  YT922X_PORT_DUPLEX_FULL\t\tBIT(7)\n+#define  YT922X_PORT_RX_PAUSE\t\t\tBIT(6)\n+#define  YT922X_PORT_TX_PAUSE\t\t\tBIT(5)\n+#define  YT922X_PORT_RX_MAC_EN\t\t\tBIT(4)\n+#define  YT922X_PORT_TX_MAC_EN\t\t\tBIT(3)\n+#define  YT922X_PORT_SPEED_M\t\t\tGENMASK(2, 0)\n+#define YT922X_PORT_SDSn\t\t0x400\n+#define  YT922X_SERDES_MODE_M\t\t\tGENMASK(6, 4)\n+#define   YT922X_SERDES_MODE(x)\t\t\t\tFIELD_PREP(YT922X_SERDES_MODE_M, (x))\n+#define YT922X_SERDES_MODE_SGMII\tYT922X_SERDES_MODE(0)\n+#define YT922X_SERDES_MODE_REVSGMII\tYT922X_SERDES_MODE(1)\n+#define YT922X_SERDES_MODE_1000BASEX\tYT922X_SERDES_MODE(2)\n+#define YT922X_SERDES_MODE_100BASEX\tYT922X_SERDES_MODE(3)\n+#define YT922X_SERDES_MODE_2500BASEX\tYT922X_SERDES_MODE(4)\n+#define YT922X_SERDES_MODE_USXGMII\tYT922X_SERDES_MODE(6)\n+#define YT922X_PORT_NUM\t\t\t9\n+#define YT922X_PCS_LINK_CTRL\t\t0x11\n+#define YT922X_PCS_LINK_STATUS\t\tBIT(10)\n+#define YT922X_PCS_AN_COMPLETE\t\tBIT(11)\n+\n+/* LAG */\n+#define YT922X_LAG_NUM\t\t\t4\n+/* ISO */\n+#define YT922X_PORTn_ISOLATION(port)\t(0x4 * (port) + 0x180d80)\n+/* FDB */\n+#define YT922X_PORTn_LEARN(port)\t(0x180300 + 4 * (port))\n+#define  YT922X_PORT_LEARN_DIS\t\t\tBIT(18)\n+/* GLOBAL CTRL */\n+#define  YT922X_FUNC_ACL\t\t\tBIT(5)\n+#define  YT922X_FUNC_MIB\t\t\tBIT(4)\n+/* CTRL PKT */\n+#define YT922X_FILTER_UNK_UCAST\t\t0x180ec8\n+#define YT922X_ACT_UNK_UCAST\t\t0x180ed8\n+#define YT922X_ACT_UNK_MCAST\t\t0x180ee0\n+#define  YT922X_ACT_UNK_MCAST_BYPASS_DROP_PIM\tBIT(22)\n+#define  YT922X_ACT_UNK_MCAST_BYPASS_DROP_MLD\tBIT(21)\n+#define  YT922X_ACT_UNK_MCAST_BYPASS_DROP_IGMP\tBIT(20)\n+#define  YT922X_ACT_UNK_ACTn_M(port)\t\t\tGENMASK(2 * (port) + 1, 2 * (port))\n+#define  YT922X_ACT_UNK_ACTn(port, x)\t\t\t((x) \u003c\u003c (2 * (port)))\n+#define  YT922X_ACT_UNK_ACTn_FORWARD(port)\t\tYT922X_ACT_UNK_ACTn(port, 0)  /* flood */\n+#define  YT922X_ACT_UNK_ACTn_DROP(port)\t\t\tYT922X_ACT_UNK_ACTn(port, 1)  /* discard */\n+#define  YT922X_ACT_UNK_ACTn_TRAP(port)\t\t\tYT922X_ACT_UNK_ACTn(port, 3)  /* steer to CPU */\n+\n+/* CPU PORT */\n+#define YT922X_CPU_COPY\t\t\t0x181100\n+#define  YT922X_CPU_COPY_TO_INT_CPU\t\tBIT(1)\n+#define  YT922X_CPU_COPY_TO_EXT_CPU\t\tBIT(0)\n+#define YT922X_CPU_TAG_RX_CTRL\t\t0x80504\n+#define  YT922X_CPU_TAG_RX_MODE\t\t\tBIT(0)\n+#define YT922X_CPU_TAG_TX_CTRL\t\t0x100710\n+#define  YT922X_CPU_TAG_TX_TYPE\t\tBIT(0)\n+#define  YT922X_CPU_TAG_TX_MODE\t\tBIT(1)\n+#define  YT922X_CPU_TAG_TX_CTAG_OP\tBIT(2)\n+#define  YT922X_CPU_TAG_TX_STAG_OP\tBIT(3)\n+/* Define top ext addr for yt922x */\n+#define YT922X_COMMON_EXT_PHYADDR 9\n+\n+enum yt922x_phy_reg_type {\n+\tYT922X_PHY_REG_TYPE_COMMON_EXT,\n+\tYT922X_PHY_REG_TYPE_SDS_COMMON_EXT,\n+\tYT922X_PHY_REG_TYPE_MII,\n+\tYT922X_PHY_REG_TYPE_EXT,\n+\tYT922X_PHY_REG_TYPE_MAX\n+};\n+\n struct yt921x_mib {\n \tu64 rx_broadcast;\n \tu64 rx_pause;\n@@ -955,9 +1046,28 @@ struct yt921x_info {\n \tu16 serdes_mask;\n };\n \n+enum yt92xx_mode {\n+\tYT92XX_MODE_YT921X,\n+\tYT92XX_MODE_YT922X,\n+\tYT92XX_MODE_MAX,\n+};\n+\n+struct yt92xx_series {\n+\tconst char *name;\n+\tunsigned int max_ports;\n+\tunsigned int num_lag_ids;\n+\tunsigned int ageing_time_min;\n+\tunsigned int ageing_time_max;\n+\tu32 dscp_prio_mapping_is_global;\n+\tu32 assisted_learning_on_cpu_port;\n+\tconst struct dsa_switch_ops *switch_ops;\n+\tconst struct phylink_mac_ops *mac_ops;\n+};\n+\n struct yt921x_priv {\n \tstruct dsa_switch ds;\n \n+\tconst struct yt92xx_series *series;\n \tconst struct yt921x_info *info;\n \tunsigned int meter_slot_ns;\n \tunsigned int port_shape_slot_ns;\ndiff --git a/drivers/net/dsa/motorcomm/mdio_bus.c b/drivers/net/dsa/motorcomm/mdio_bus.c\nindex 1a3f3cc68275d..dd465ac338da8 100644\n--- a/drivers/net/dsa/motorcomm/mdio_bus.c\n+++ b/drivers/net/dsa/motorcomm/mdio_bus.c\n@@ -115,7 +115,7 @@ static int yt921x_mbus_int_read(struct mii_bus *mbus, int port, int reg)\n \tu16 val;\n \tint res;\n \n-\tif (port \u003e= YT921X_PORT_NUM)\n+\tif (port \u003e= priv-\u003eseries-\u003emax_ports)\n \t\treturn U16_MAX;\n \n \tmutex_lock(\u0026priv-\u003ereg_lock);\n@@ -133,7 +133,7 @@ yt921x_mbus_int_write(struct mii_bus *mbus, int port, int reg, u16 data)\n \tstruct yt921x_priv *priv = mbus-\u003epriv;\n \tint res;\n \n-\tif (port \u003e= YT921X_PORT_NUM)\n+\tif (port \u003e= priv-\u003eseries-\u003emax_ports)\n \t\treturn -ENODEV;\n \n \tmutex_lock(\u0026priv-\u003ereg_lock);\n@@ -147,6 +147,7 @@ int yt921x_mbus_int_init(struct yt921x_priv *priv, struct device_node *mnp)\n {\n \tstruct device *dev = to_device(priv);\n \tstruct mii_bus *mbus;\n+\tu32 max_ports;\n \tint res;\n \n \tmbus = devm_mdiobus_alloc(dev);\n@@ -159,7 +160,8 @@ int yt921x_mbus_int_init(struct yt921x_priv *priv, struct device_node *mnp)\n \tmbus-\u003eread = yt921x_mbus_int_read;\n \tmbus-\u003ewrite = yt921x_mbus_int_write;\n \tmbus-\u003eparent = dev;\n-\tmbus-\u003ephy_mask = (u32)~GENMASK(YT921X_PORT_NUM - 1, 0);\n+\tmax_ports = priv-\u003eseries-\u003emax_ports;\n+\tmbus-\u003ephy_mask = ~GENMASK_U32(max_ports - 1, 0);\n \n \tres = devm_of_mdiobus_register(dev, mbus, mnp);\n \tif (res)\n@@ -299,3 +301,42 @@ int yt921x_mbus_ext_init(struct yt921x_priv *priv, struct device_node *mnp)\n \n \treturn 0;\n }\n+\n+/* intif extend register read/write api */\n+int\n+yt921x_intif_ext_write(struct yt921x_priv *priv, int port, int reg, u16 val)\n+{\n+\tint res;\n+\n+\tif (port \u003e priv-\u003eseries-\u003emax_ports)\n+\t\treturn -ENODEV;\n+\n+\tres = yt921x_intif_write(priv, port, YT92XX_PAGE_SELECT, reg);\n+\tif (res)\n+\t\treturn res;\n+\n+\tres = yt921x_intif_write(priv, port, YT92XX_PAGE, val);\n+\tif (res)\n+\t\treturn res;\n+\n+\treturn 0;\n+}\n+\n+int\n+yt921x_intif_ext_read(struct yt921x_priv *priv, int port, int reg, u16 *valp)\n+{\n+\tint res;\n+\n+\tif (port \u003e priv-\u003eseries-\u003emax_ports)\n+\t\treturn -ENODEV;\n+\n+\tres = yt921x_intif_write(priv, port, YT92XX_PAGE_SELECT, reg);\n+\tif (res)\n+\t\treturn res;\n+\n+\tres = yt921x_intif_read(priv, port, YT92XX_PAGE, valp);\n+\tif (res)\n+\t\treturn res;\n+\n+\treturn 0;\n+}\ndiff --git a/drivers/net/dsa/motorcomm/mdio_bus.h b/drivers/net/dsa/motorcomm/mdio_bus.h\nindex e79b725d435bd..513a8d2d7618b 100644\n--- a/drivers/net/dsa/motorcomm/mdio_bus.h\n+++ b/drivers/net/dsa/motorcomm/mdio_bus.h\n@@ -50,5 +50,7 @@ yt921x_intif_modify(struct yt921x_priv *priv, int port, int reg, u16 mask,\n \n int yt921x_mbus_int_init(struct yt921x_priv *priv, struct device_node *mnp);\n int yt921x_mbus_ext_init(struct yt921x_priv *priv, struct device_node *mnp);\n+int yt921x_intif_ext_write(struct yt921x_priv *priv, int port, int reg, u16 val);\n+int yt921x_intif_ext_read(struct yt921x_priv *priv, int port, int reg, u16 *valp);\n \n #endif\ndiff --git a/drivers/net/dsa/motorcomm/pcs-922x.c b/drivers/net/dsa/motorcomm/pcs-922x.c\nnew file mode 100644\nindex 0000000000000..98d403d01ba3c\n--- /dev/null\n+++ b/drivers/net/dsa/motorcomm/pcs-922x.c\n@@ -0,0 +1,173 @@\n+// SPDX-License-Identifier: GPL-2.0-or-later\n+/*\n+ * Copyright (c) 2026 Kyle Switch\n+ */\n+\n+#include \"chip.h\"\n+#include \"mdio_bus.h\"\n+#include \"pcs.h\"\n+#include \"smi.h\"\n+\n+#define to_device(priv) ((priv)-\u003eds.dev)\n+\n+static int yt922x_sds_phyaddr_get(int port,\n+\t\t\t\t  enum yt922x_phy_reg_type reg_type)\n+{\n+\tif (reg_type == YT922X_PHY_REG_TYPE_COMMON_EXT)\n+\t\treturn YT922X_COMMON_EXT_PHYADDR;\n+\n+\treturn port;\n+}\n+\n+static void yt922x_pcs_get_state(struct phylink_pcs *pcs, unsigned int neg_mode,\n+\t\t\t\t struct phylink_link_state *state)\n+{\n+\tstruct yt921x_port *pp = pcs_to_yt921x_port(pcs);\n+\tstruct yt921x_priv *priv = yt921x_port_to_priv(pp);\n+\tint port = pp-\u003eindex;\n+\tint res = 0;\n+\tu16 data;\n+\tint addr;\n+\tu16 lp;\n+\n+\taddr = yt922x_sds_phyaddr_get(port, YT922X_PHY_REG_TYPE_MII);\n+\tif (addr \u003c 0) {\n+\t\tstate-\u003elink = false;\n+\t\treturn;\n+\t}\n+\n+\tmutex_lock(\u0026priv-\u003ereg_lock);\n+\tswitch (state-\u003einterface) {\n+\tcase PHY_INTERFACE_MODE_SGMII:\n+\tcase PHY_INTERFACE_MODE_1000BASEX:\n+\tcase PHY_INTERFACE_MODE_2500BASEX:\n+\t\tres = yt921x_intif_read(priv, addr, MII_BMSR, \u0026data);\n+\t\tif (res)\n+\t\t\tgoto err;\n+\t\tres = yt921x_intif_read(priv, addr, MII_LPA, \u0026lp);\n+\t\tif (res)\n+\t\t\tgoto err;\n+\t\tphylink_mii_c22_pcs_decode_state(state, neg_mode, data, lp);\n+\t\tbreak;\n+\tcase PHY_INTERFACE_MODE_USXGMII:\n+\t\tres = yt921x_intif_read(priv, addr, YT922X_PCS_LINK_CTRL,\n+\t\t\t\t\t\u0026data);\n+\t\tif (res)\n+\t\t\tgoto err;\n+\t\tstate-\u003elink =  FIELD_GET(YT922X_PCS_LINK_STATUS, data);\n+\t\tstate-\u003ean_complete = FIELD_GET(YT922X_PCS_AN_COMPLETE, data);\n+\t\tres = yt921x_intif_read(priv, addr, MII_LPA, \u0026lp);\n+\t\tif (res)\n+\t\t\tgoto err;\n+\t\tif (state-\u003elink)\n+\t\t\tphylink_decode_usxgmii_word(state, lp);\n+\t\tbreak;\n+\tdefault:\n+\t\tstate-\u003elink = false;\n+\t\tbreak;\n+\t}\n+\tmutex_unlock(\u0026priv-\u003ereg_lock);\n+\treturn;\n+\n+err:\n+\tmutex_unlock(\u0026priv-\u003ereg_lock);\n+\tstate-\u003elink = false;\n+}\n+\n+static void yt922x_pcs_an_restart(struct phylink_pcs *pcs)\n+{\n+\tstruct yt921x_port *pp = pcs_to_yt921x_port(pcs);\n+\tstruct yt921x_priv *priv = yt921x_port_to_priv(pp);\n+\tstruct device *dev = to_device(priv);\n+\tint port = pp-\u003eindex;\n+\tu16 data;\n+\tint addr;\n+\tint res;\n+\n+\tmutex_lock(\u0026priv-\u003ereg_lock);\n+\taddr = yt922x_sds_phyaddr_get(port, YT922X_PHY_REG_TYPE_MII);\n+\tif (addr \u003c 0) {\n+\t\tres = addr;\n+\t\tgoto err;\n+\t}\n+\tres = yt921x_intif_read(priv, addr, MII_BMCR, \u0026data);\n+\tif (res)\n+\t\tgoto err;\n+\tdata |= BMCR_ANRESTART;\n+\tres = yt921x_intif_write(priv, addr, MII_BMCR, data);\n+\tif (res)\n+\t\tgoto err;\n+\tmutex_unlock(\u0026priv-\u003ereg_lock);\n+\treturn;\n+\n+err:\n+\tmutex_unlock(\u0026priv-\u003ereg_lock);\n+\tif (res)\n+\t\tdev_err(dev, \"Failed to %s PCS port %d: %i\\n\", \"an restart\",\n+\t\t\tport, res);\n+}\n+\n+static int yt922x_pcs_config(struct phylink_pcs *pcs, unsigned int neg_mode,\n+\t\t\t     phy_interface_t interface,\n+\t\t\t     const unsigned long *advertising,\n+\t\t\t     bool permit_pause_to_mac)\n+{\n+\tstruct yt921x_port *pp = pcs_to_yt921x_port(pcs);\n+\tstruct yt921x_priv *priv = yt921x_port_to_priv(pp);\n+\tint res, port;\n+\tu16 data;\n+\tu16 ctrl;\n+\tint addr;\n+\n+\tport = pp-\u003eindex;\n+\tmutex_lock(\u0026priv-\u003ereg_lock);\n+\taddr = yt922x_sds_phyaddr_get\n+\t\t(port, YT922X_PHY_REG_TYPE_SDS_COMMON_EXT);\n+\tif (addr \u003c 0) {\n+\t\tres = addr;\n+\t\tgoto err;\n+\t}\n+\t/* write protect */\n+\tres = yt921x_intif_ext_write(priv, addr, 0x4be, 0xd);\n+\tif (res)\n+\t\tgoto err;\n+\tswitch (interface) {\n+\tcase PHY_INTERFACE_MODE_SGMII:\n+\t\tctrl = YT922X_SERDES_MODE_SGMII;\n+\t\tbreak;\n+\tcase PHY_INTERFACE_MODE_1000BASEX:\n+\t\tctrl = YT922X_SERDES_MODE_1000BASEX;\n+\t\tbreak;\n+\tcase PHY_INTERFACE_MODE_2500BASEX:\n+\t\tctrl = YT922X_SERDES_MODE_2500BASEX;\n+\t\tbreak;\n+\tcase PHY_INTERFACE_MODE_USXGMII:\n+\t\tctrl = YT922X_SERDES_MODE_USXGMII;\n+\t\tbreak;\n+\tdefault:\n+\t\tres = -EINVAL;\n+\t\tgoto err;\n+\t}\n+\tres = yt921x_intif_ext_read(priv, addr, YT922X_PORT_SDSn, \u0026data);\n+\tif (res)\n+\t\tgoto err;\n+\tdata \u0026= ~YT922X_SERDES_MODE_M;\n+\tdata |= ctrl;\n+\tres = yt921x_intif_ext_write(priv, addr, YT922X_PORT_SDSn, data);\n+\tif (res)\n+\t\tgoto err;\n+\tmutex_unlock(\u0026priv-\u003ereg_lock);\n+\n+\treturn res;\n+\n+err:\n+\tmutex_unlock(\u0026priv-\u003ereg_lock);\n+\n+\treturn res;\n+}\n+\n+const struct phylink_pcs_ops yt922x_phylink_pcs_ops = {\n+\t.pcs_get_state = yt922x_pcs_get_state,\n+\t.pcs_config = yt922x_pcs_config,\n+\t.pcs_an_restart = yt922x_pcs_an_restart,\n+};\ndiff --git a/drivers/net/dsa/motorcomm/pcs.h b/drivers/net/dsa/motorcomm/pcs.h\nindex 42426558086af..c85caa7bf2126 100644\n--- a/drivers/net/dsa/motorcomm/pcs.h\n+++ b/drivers/net/dsa/motorcomm/pcs.h\n@@ -9,5 +9,6 @@\n #include \u003clinux/phylink.h\u003e\n \n extern const struct phylink_pcs_ops yt921x_phylink_pcs_ops;\n+extern const struct phylink_pcs_ops yt922x_phylink_pcs_ops;\n \n #endif\ndiff --git a/include/net/dsa.h b/include/net/dsa.h\nindex 5d12191b6f6f5..5a173fe2bb876 100644\n--- a/include/net/dsa.h\n+++ b/include/net/dsa.h\n@@ -62,6 +62,7 @@ struct tc_action;\n #define DSA_TAG_PROTO_KSZ8463_VALUE\t\t34\n #define DSA_TAG_PROTO_MT7628_VALUE\t\t35\n #define DSA_TAG_PROTO_KS8995_VALUE\t\t36\n+#define DSA_TAG_PROTO_YT922X_VALUE\t\t37\n \n enum dsa_tag_protocol {\n \tDSA_TAG_PROTO_NONE\t\t= DSA_TAG_PROTO_NONE_VALUE,\n@@ -101,6 +102,7 @@ enum dsa_tag_protocol {\n \tDSA_TAG_PROTO_KSZ8463\t\t= DSA_TAG_PROTO_KSZ8463_VALUE,\n \tDSA_TAG_PROTO_MT7628\t\t= DSA_TAG_PROTO_MT7628_VALUE,\n \tDSA_TAG_PROTO_KS8995\t\t= DSA_TAG_PROTO_KS8995_VALUE,\n+\tDSA_TAG_PROTO_YT922X\t\t= DSA_TAG_PROTO_YT922X_VALUE,\n };\n \n struct dsa_switch;\ndiff --git a/net/dsa/Kconfig b/net/dsa/Kconfig\nindex 4f44bf3ede238..86802058678c0 100644\n--- a/net/dsa/Kconfig\n+++ b/net/dsa/Kconfig\n@@ -233,4 +233,10 @@ config NET_DSA_TAG_YT921X\n \t  Say Y or M if you want to enable support for tagging frames for\n \t  Motorcomm YT921x switches.\n \n+config NET_DSA_TAG_YT922X\n+  tristate \"Tag driver for Motorcomm YT922x switches\"\n+  help\n+    Say Y or M if you want to enable support for tagging frames for\n+    Motorcomm YT922x switches.\n+\n endif\ndiff --git a/net/dsa/Makefile b/net/dsa/Makefile\nindex 1f9cc30e99886..0ef6dfce3b924 100644\n--- a/net/dsa/Makefile\n+++ b/net/dsa/Makefile\n@@ -45,6 +45,7 @@ obj-$(CONFIG_NET_DSA_TAG_TRAILER) += tag_trailer.o\n obj-$(CONFIG_NET_DSA_TAG_VSC73XX_8021Q) += tag_vsc73xx_8021q.o\n obj-$(CONFIG_NET_DSA_TAG_XRS700X) += tag_xrs700x.o\n obj-$(CONFIG_NET_DSA_TAG_YT921X) += tag_yt921x.o\n+obj-$(CONFIG_NET_DSA_TAG_YT922X) += tag_yt922x.o\n \n # for tracing framework to find trace.h\n CFLAGS_trace.o := -I$(src)\ndiff --git a/net/dsa/tag_yt922x.c b/net/dsa/tag_yt922x.c\nnew file mode 100644\nindex 0000000000000..3c9fef651cf51\n--- /dev/null\n+++ b/net/dsa/tag_yt922x.c\n@@ -0,0 +1,109 @@\n+// SPDX-License-Identifier: GPL-2.0-or-later\n+/*\n+ * Motorcomm YT922x Switch Extended CPU Port Tagging\n+ *\n+ * Copyright (c) 2026 Kyle switch \u003ckyle.switch@motor-comm.com\u003e\n+ *\n+ */\n+\n+#include \u003clinux/etherdevice.h\u003e\n+\n+#include \"tag.h\"\n+\n+#define YT922X_TAG_LEN 8\n+\n+/*\n+ * To define the from cpu tag format 8 bytes.\n+ */\n+#define YT922X_TAG_NAME\t\t\"yt922x\"\n+#define YT922X_TAG_PORTMASK_0\tBIT(15)\n+#define YT922X_TAG_PORTMASK_M\tGENMASK(8, 0)\n+#define  YT922X_TAG_PORTS(x)\t\tFIELD_PREP(YT922X_TAG_PORTMASK_M, (x))\n+#define YT922X_TAG_FORCE_DST\tBIT(9)\n+#define YT922X_TAG_PRIO_M\tGENMASK(12, 10)\n+#define YT922X_TAG_PRIO_EN\tBIT(13)\n+#define  YT922X_TAG_PRIO(x)\t(FIELD_PREP(YT922X_TAG_PRIO_M, (x)) | YT922X_TAG_PRIO_EN)\n+#define YT922X_TAG_RX_PORT_M\tGENMASK(5, 2)\n+\n+static struct sk_buff *\n+yt922x_tag_xmit(struct sk_buff *skb, struct net_device *netdev)\n+{\n+\tunsigned long ports;\n+\t__be16 *tag;\n+\tu16 ctrl;\n+\n+\tskb_push(skb, YT922X_TAG_LEN);\n+\tdsa_alloc_etype_header(skb, YT922X_TAG_LEN);\n+\ttag = dsa_etype_header_pos_tx(skb);\n+\n+\ttag[0] = htons(ETH_P_YT921X);\n+\tports = dsa_xmit_port_mask(skb, netdev);\n+\t/*To fill in the case where the port index is not 0 */\n+\tctrl = YT922X_TAG_PRIO(skb-\u003epriority) | YT922X_TAG_FORCE_DST |\n+\t       YT922X_TAG_PORTS(ports \u003e\u003e 1);\n+\ttag[1] = htons(ctrl);\n+\tif (ports \u0026 BIT(0)) {\n+\t\t/* To fill in the case where the port index is 0 */\n+\t\tctrl = YT922X_TAG_PORTMASK_0;\n+\t\ttag[2] = htons(ctrl);\n+\t} else {\n+\t\ttag[2] = 0;\n+\t}\n+\ttag[3] = 0;\n+\n+\treturn skb;\n+}\n+\n+static struct sk_buff *\n+yt922x_tag_rcv(struct sk_buff *skb, struct net_device *netdev)\n+{\n+\tunsigned int port;\n+\t__be16 *tag;\n+\tu16 rx;\n+\n+\tif (unlikely(!pskb_may_pull(skb, YT922X_TAG_LEN))) {\n+\t\tkfree_skb(skb);\n+\t\treturn NULL;\n+\t}\n+\n+\ttag = dsa_etype_header_pos_rx(skb);\n+\n+\tif (unlikely(tag[0] != htons(ETH_P_YT921X))) {\n+\t\tdev_warn_ratelimited(\u0026netdev-\u003edev,\n+\t\t\t\t     \"Unexpected EtherType 0x%04x\\n\",\n+\t\t\t\t     ntohs(tag[0]));\n+\t\tkfree_skb(skb);\n+\t\treturn NULL;\n+\t}\n+\n+\t/* Locate which port this is coming from */\n+\trx = ntohs(tag[2]);\n+\tport = FIELD_GET(YT922X_TAG_RX_PORT_M, rx);\n+\tskb-\u003edev = dsa_conduit_find_user(netdev, 0, port);\n+\tif (unlikely(!skb-\u003edev)) {\n+\t\tdev_warn_ratelimited(\u0026netdev-\u003edev,\n+\t\t\t\t     \"Couldn't decode source port %u\\n\", port);\n+\t\tkfree_skb(skb);\n+\t\treturn NULL;\n+\t}\n+\n+\t/* Remove tag and update checksum */\n+\tskb_pull_rcsum(skb, YT922X_TAG_LEN);\n+\tdsa_strip_etype_header(skb, YT922X_TAG_LEN);\n+\n+\treturn skb;\n+}\n+\n+static const struct dsa_device_ops yt922x_netdev_ops = {\n+\t.name = YT922X_TAG_NAME,\n+\t.proto = DSA_TAG_PROTO_YT922X,\n+\t.xmit = yt922x_tag_xmit,\n+\t.rcv = yt922x_tag_rcv,\n+\t.needed_headroom = YT922X_TAG_LEN,\n+};\n+\n+MODULE_DESCRIPTION(\"DSA tag driver for Motorcomm YT922x switches\");\n+MODULE_LICENSE(\"GPL\");\n+MODULE_ALIAS_DSA_TAG_DRIVER(DSA_TAG_PROTO_YT922X, YT922X_TAG_NAME);\n+\n+module_dsa_tag_driver(yt922x_netdev_ops);\n"
}

2/1 2026/10/03 06:54 agent patch-evaluator
1m Model:
core

Args:
null

Results:
{
  "EnableConfigs": null,
  "FocusSymbols": [],
  "Reasoning": "The patch series adds support for the Motorcomm YT9224/YT9228 ethernet switch chip to drivers/net/dsa/motorcomm/ and adds a corresponding DSA tag driver in net/dsa/tag_yt922x.c. The Motorcomm YT92xx devices are vendor-specific physical Ethernet switch ASICs controlled over an MDIO bus and are not emulated in standard virtualized environments (QEMU or GCE). Furthermore, the tagging driver (tag_yt922x.c) can only be engaged by this specific switch driver, as no other DSA switch supports or accepts changing to DSA_TAG_PROTO_YT922X. Consequently, the modified code is structurally unreachable for fuzzing.",
  "WorthFuzzing": false
}

Instruction:
You are an expert Linux kernel maintainer and security engineer.
Your job is to review a provided patch series and evaluate whether it warrants fuzzing with syzkaller.

IMPORTANT: The changes have ALREADY been applied and committed as the HEAD commit in
your workspace. Do NOT rely on internal assumptions. You must actively use your code access
tools to inspect the actual source code, callers, and surrounding context.

================================================================================
1. CORE TRIAGE PHILOSOPHY
================================================================================
The goal of patch fuzzing is to discover crashes, regressions, exposed latent bugs,
and newly triggered assertions introduced by the patch series.

- REACHABILITY IS THE PRIMARY GATE:
  Fuzzing can only discover bugs in code that can actually execute in standard virtualized
  environments (GCE or QEMU, utilizing software-emulated devices like USB gadgets, netdev, tun/tap).
  If the modified code is structurally unreachable (see Section 2), it MUST NOT be fuzzed,
  regardless of whether it adds assertions or complex logic.

- DO NOT BLINDLY TRUST "NO FUNCTIONAL CHANGE" (NFCI) OR "REFACTORING" CLAIMS:
  Patch authors routinely label changes as "cleanups", "refactorings", or state
  "No functional change intended". Do NOT take these claims at face value.
  Code refactorings that rearrange logic, introduce helper functions, or alter state management
  in core subsystems frequently introduce subtle semantic shifts or uncover latent kernel bugs.
  If reachable executable code is modified or refactored, it MUST be fuzzed.

- NEW OR MODIFIED ASSERTIONS IN REACHABLE CODE MUST BE FUZZED:
  When a patch introduces or modifies runtime checks or assertions (e.g., WARN_ON*, VM_WARN_ON*,
  BUG_ON*, lockdep_assert*) in reachable code paths, it enforces new or stricter invariants.
  Even if the author believes the invariant always holds, fuzzing is essential to verify whether
  an unusual sequence of operations can violate it.

================================================================================
2. WHEN TO RETURN WorthFuzzing=false (NEGATIVE CRITERIA)
================================================================================
Return WorthFuzzing=false ONLY IF all modified code falls strictly into one or more of these categories:

- Non-kernel and non-executable changes:
  * Modifications to Documentation/, comments, or spelling fixes.
  * User-space directories, self-tests, samples, or scripts (e.g., tools/, samples/, scripts/, usr/)
    that do not affect the compiled kernel image (vmlinux) or kernel modules.
  * Purely decorative logging (e.g., message strings in pr_err, printk, dev_info) or tracepoints
    that do not alter control flow or data structures.
  * Build system or Kconfig changes that do not alter compiled C logic.
- Structurally unreachable hardware:
  * Vendor-specific PCIe switches, SmartNICs, or GPU drivers (e.g., mlxsw, pds_core, qed,
    ionic, amdgpu) requiring physical ASIC/PCIe cards not emulated in standard QEMU.
- Unreachable execution paths:
  * Driver teardown callbacks (.remove, .shutdown, pci_unregister_driver) executed only during
    physical PCI hot-unplug or manual sysfs driver unbinding.
  * Code paths exclusive to architectures other than the target architecture.

================================================================================
3. WHEN TO RETURN WorthFuzzing=true (POSITIVE CRITERIA)
================================================================================
Return WorthFuzzing=true whenever the patch touches reachable executable code, including:
- Core Subsystems:
  * Any logic modifications in memory management (mm/), synchronization/locking (kernel/locking/),
    BPF, scheduler, core networking, VFS, or syscall handling.
- Refactorings and Code Cleanups:
  * Any restructuring of reachable data structures, helper abstractions, or algorithm flows.
- Runtime Assertions and Defensive Checks:
  * Any introduction or alteration of assertions (WARN_ON*, VM_WARN_ON*, BUG_ON*, etc.) in reachable paths.
- Reachable Drivers and Protocols:
  * Drivers accessible via virtual buses (virtio, USB gadget, loopback, netlink, binder, sockets, etc.).

================================================================================
4. EXTRACTING FocusSymbols (PREVENTING DILUTION)
================================================================================
When WorthFuzzing=true, you must extract specific kernel functions into FocusSymbols to guide the fuzzer:

- AVOID UBIQUITOUS LIFECYCLE HOT-PATHS:
  Do NOT list generic, ubiquitous functions called by almost every program in the corpus
  (including, but not limited to: general memory allocators and deallocators, page fault
  and trap handlers, or core synchronization primitives; this is not an exhaustive list).
  Listing ubiquitous functions causes the fuzzer to classify thousands of unrelated tests as "focused",
  which severely dilutes fuzzing effort away from the actual changes.

- TARGET SPECIFIC FEATURE LOGIC AND ENTRYPOINTS:
  List functions that specifically implement the logic being added or altered, or direct API entrypoints
  for the subsystem feature under review.

- HANDLING STATIC INLINE FUNCTIONS IN HEADERS (.h):
  Compiler-inlined static functions (such as static inlines in mm/*.h or include/linux/*.h) lack
  distinct symbol addresses in vmlinux and cannot be targeted directly by symbol coverage filters.
  If the changes are primarily in static inline helpers, identify non-static, feature-specific caller
  functions in .c files that exercise them (avoiding ubiquitous lifecycle wrappers).

================================================================================
5. IDENTIFYING EnableConfigs
================================================================================
Identify any specific CONFIG_ options required to properly compile and reach the modified code:
- Inspect Kconfig files and #ifdef guards; do not make assumptions.
- Check "depends on" lines in Kconfig to include any non-standard parent subsystem configs needed.
- Strip any 'CONFIG_' prefix (e.g., return "NET_IPV4" instead of "CONFIG_NET_IPV4").
Prefer calling several tools at the same time to save round-trips.


Use set-results tool to provide results of the analysis.
It must be called exactly once before the final reply.
Ignore results of this tool.

Prompt:
Target architecture: amd64

For your convenience, here is the diff of the changes:
commit ecb7428735fd1ff678dec15cd4f06cd75808fe49
Author: syz-cluster <triage@syzkaller.com>
Date:   Sat Oct 3 06:54:09 2026 +0000

    syz-cluster: applied patch under review

diff --git a/MAINTAINERS b/MAINTAINERS
index 3011f995437fd..1a48e4570c698 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -18433,11 +18433,13 @@ F:	drivers/net/phy/motorcomm.c
 
 MOTORCOMM YT921X ETHERNET SWITCH DRIVER
 M:	David Yang <mmyangfl@gmail.com>
+M:	Kyle Switch <kyle.switch@motor-comm.com>
 L:	netdev@vger.kernel.org
 S:	Maintained
 F:	Documentation/devicetree/bindings/net/dsa/motorcomm,yt921x.yaml
 F:	drivers/net/dsa/motorcomm/
 F:	net/dsa/tag_yt921x.c
+F:	net/dsa/tag_yt922x.c
 
 MOXA SMARTIO/INDUSTIO/INTELLIO SERIAL CARD
 M:	Jiri Slaby <jirislaby@kernel.org>
diff --git a/drivers/net/dsa/motorcomm/Kconfig b/drivers/net/dsa/motorcomm/Kconfig
index 79cdd79a1fd25..648c49d6c5271 100644
--- a/drivers/net/dsa/motorcomm/Kconfig
+++ b/drivers/net/dsa/motorcomm/Kconfig
@@ -1,11 +1,12 @@
 # SPDX-License-Identifier: GPL-2.0-only
 config NET_DSA_YT921X
-	tristate "Motorcomm YT9215 ethernet switch chip support"
+	tristate "Motorcomm YT9215 and YT9224 ethernet switch chip support"
 	select NET_DSA_TAG_YT921X
+	select NET_DSA_TAG_YT922X
 	select NET_IEEE8021Q_HELPERS if DCB
 	help
-	  This enables support for the Motorcomm YT9215 ethernet switch
-	  chip.
+	  This enables support for the Motorcomm YT9215 and YT9224
+	  ethernet switch chip.
 
 config NET_DSA_YT921X_LEDS
 	bool "LED support for Motorcomm YT9215"
diff --git a/drivers/net/dsa/motorcomm/Makefile b/drivers/net/dsa/motorcomm/Makefile
index 1d2c1b3064c41..d1cd7c8a3852c 100644
--- a/drivers/net/dsa/motorcomm/Makefile
+++ b/drivers/net/dsa/motorcomm/Makefile
@@ -3,5 +3,6 @@ obj-$(CONFIG_NET_DSA_YT921X) += yt921x.o
 yt921x-objs := chip.o
 yt921x-$(CONFIG_NET_DSA_YT921X_LEDS) += leds.o
 yt921x-objs += mdio_bus.o
+yt921x-objs += pcs-922x.o
 yt921x-objs += pcs-921x.o
 yt921x-objs += smi.o
diff --git a/drivers/net/dsa/motorcomm/chip.c b/drivers/net/dsa/motorcomm/chip.c
index 3ff2de383157a..175855cbc2375 100644
--- a/drivers/net/dsa/motorcomm/chip.c
+++ b/drivers/net/dsa/motorcomm/chip.c
@@ -1,6 +1,6 @@
 // SPDX-License-Identifier: GPL-2.0-or-later
 /*
- * Driver for Motorcomm YT921x Switch
+ * Driver for Motorcomm YT921x and YT922x Switch
  *
  * Should work on YT9213/YT9214/YT9215/YT9218, but only tested on YT9215+SGMII,
  * be sure to do your own checks before porting to another chip.
@@ -101,19 +101,19 @@ static const struct yt921x_mib_desc yt921x_mib_descs[] = {
 static const struct yt921x_info yt921x_infos[] = {
 	{
 		"YT9215SC", YT9215_MAJOR, 1, 0,
-		GENMASK(4, 0),
+		GENMASK_U16(4, 0),
 		BIT(9),
 		BIT(8) | BIT(9),
 	},
 	{
 		"YT9215S", YT9215_MAJOR, 2, 0,
-		GENMASK(4, 0),
+		GENMASK_U16(4, 0),
 		BIT(9),
 		BIT(8),
 	},
 	{
 		"YT9215RB", YT9215_MAJOR, 3, 0,
-		GENMASK(4, 0),
+		GENMASK_U16(4, 0),
 		BIT(8) | BIT(9),
 		0,
 	},
@@ -131,16 +131,28 @@ static const struct yt921x_info yt921x_infos[] = {
 	},
 	{
 		"YT9218N", YT9218_MAJOR, 0, 0,
-		GENMASK(7, 0),
+		GENMASK_U16(7, 0),
 		0,
 		0,
 	},
 	{
 		"YT9218MB", YT9218_MAJOR, 1, 0,
-		GENMASK(7, 0),
+		GENMASK_U16(7, 0),
 		BIT(8) | BIT(9),
 		BIT(8) | BIT(9),
 	},
+	{
+		"YT9224", YT9224_MAJOR, 0, 0,
+		GENMASK_U16(7, 4),
+		0,
+		BIT(8) | BIT(9),
+	},
+	{
+		"YT9228", YT9224_MAJOR, 0, 0,
+		GENMASK_U16(7, 4),
+		0,
+		BIT(8) | GENMASK_U16(3, 0),
+	},
 	{}
 };
 
@@ -3924,6 +3936,17 @@ static void yt921x_dsa_teardown(struct dsa_switch *ds)
 
 	yt921x_leds_remove(priv);
 #endif
+
+	for (size_t i = ARRAY_SIZE(priv->ports); i-- > 0; ) {
+		struct yt921x_port *pp = &priv->ports[i];
+
+		disable_delayed_work_sync(&pp->mib_read);
+	}
+}
+
+static bool yt921x_needs_extmode_check(u32 major)
+{
+	return (major == YT9224_MAJOR) ? false : true;
 }
 
 static int yt921x_chip_detect(struct yt921x_priv *priv)
@@ -3951,6 +3974,9 @@ static int yt921x_chip_detect(struct yt921x_priv *priv)
 		return -ENODEV;
 	}
 
+	if (!yt921x_needs_extmode_check(major))
+		goto skip_extmode_check;
+
 	res = yt921x_reg_read(priv, YT921X_CHIP_MODE, &mode);
 	if (res)
 		return res;
@@ -3990,6 +4016,14 @@ static int yt921x_chip_detect(struct yt921x_priv *priv)
 
 	priv->info = info;
 
+	return 0;
+
+skip_extmode_check:
+	dev_info(dev,
+		 "Motorcomm %s ethernet switch, chipid: 0x%x\n",
+		 info->name, chipid);
+	priv->info = info;
+
 	return 0;
 }
 
@@ -4061,7 +4095,7 @@ static int yt921x_chip_setup_dsa(struct yt921x_priv *priv)
 	if (res)
 		return res;
 
-	ctrl = GENMASK(10, 0);
+	ctrl = GENMASK_U32(10, 0);
 	res = yt921x_reg_write(priv, YT921X_FILTER_UNK_UCAST, ctrl);
 	if (res)
 		return res;
@@ -4251,6 +4285,14 @@ static int yt921x_dsa_setup(struct dsa_switch *ds)
 	int port;
 	int res;
 
+	/* mib polling init */
+	for (size_t i = 0; i < ARRAY_SIZE(priv->ports); i++) {
+		struct yt921x_port *pp = &priv->ports[i];
+
+		pp->index = i;
+		INIT_DELAYED_WORK(&pp->mib_read, yt921x_poll_mib);
+	}
+
 	mutex_lock(&priv->reg_lock);
 	res = yt921x_chip_reset(priv);
 	mutex_unlock(&priv->reg_lock);
@@ -4397,6 +4439,486 @@ static const struct dsa_switch_ops yt921x_dsa_switch_ops = {
 	.setup			= yt921x_dsa_setup,
 };
 
+static int yt922x_port_down(struct yt921x_priv *priv, int port)
+{
+	u32 mask;
+	int res;
+
+	/* mac force down */
+	mask = YT922X_PORT_LINK | YT922X_PORT_RX_MAC_EN |
+	YT922X_PORT_TX_MAC_EN | YT922X_PORT_LINK_AN;
+	res = yt921x_reg_clear_bits(priv, YT922X_PORTn_CTRL(port), mask);
+	if (res)
+		return res;
+	/* Need force op to make soft configuration effective */
+	mask = YT922X_PORT_FORCE_OP;
+	res = yt921x_reg_set_bits(priv, YT922X_PORTn_CTRL(port), mask);
+	if (res)
+		return res;
+
+	/* disable en_phy */
+	res = yt921x_reg_clear_bits(priv, YT922X_EN_PHY_VALUE, BIT(port));
+	if (res)
+		return res;
+	res = yt921x_reg_set_bits(priv, YT922X_EN_PHY_OVERWRITE, BIT(port));
+	if (res)
+		return res;
+
+	return 0;
+}
+
+static void
+yt922x_phylink_mac_link_down(struct phylink_config *config, unsigned int mode,
+			     phy_interface_t interface)
+{
+	struct dsa_port *dp = dsa_phylink_to_port(config);
+	struct yt921x_priv *priv = to_yt921x_priv(dp->ds);
+	int port = dp->index;
+	int res;
+
+	mutex_lock(&priv->reg_lock);
+	res = yt922x_port_down(priv, port);
+	mutex_unlock(&priv->reg_lock);
+
+	if (res)
+		dev_err(dp->ds->dev, "Failed to %s port %d: %i\n", "bring down",
+			port, res);
+}
+
+static int
+yt922x_port_up(struct yt921x_priv *priv, int port, unsigned int mode,
+	       phy_interface_t interface, int speed, int duplex,
+	       bool tx_pause, bool rx_pause)
+{
+	int ps = ethtool_speed_to_yt921x(speed);
+	u32 ctrl = 0;
+	u32 mask;
+	int res;
+
+	if (ps == YT921X_SPEED_INVALID)
+		return -EINVAL;
+	ctrl |= ps;
+
+	if (duplex == DUPLEX_FULL)
+		ctrl |= YT922X_PORT_DUPLEX_FULL;
+	if (tx_pause)
+		ctrl |= YT922X_PORT_TX_PAUSE;
+	if (rx_pause)
+		ctrl |= YT922X_PORT_RX_PAUSE;
+	ctrl |= YT922X_PORT_RX_MAC_EN | YT922X_PORT_TX_MAC_EN |
+			YT922X_PORT_CFG_TX_EN | YT922X_PORT_LINK |
+			YT922X_PORT_CFG_RX_EN;
+	ctrl &= ~(YT922X_PORT_FC_AN | YT922X_PORT_LINK_AN);
+	res = yt921x_reg_write(priv, YT922X_PORTn_CTRL(port), ctrl);
+	if (res)
+		return res;
+
+	/* force op */
+	mask = YT922X_PORT_FORCE_OP;
+	res = yt921x_reg_set_bits(priv, YT922X_PORTn_CTRL(port), mask);
+	if (res)
+		return res;
+
+	/* enable en_phy */
+	res = yt921x_reg_set_bits(priv, YT922X_EN_PHY_VALUE, BIT(port));
+	if (res)
+		return res;
+	res = yt921x_reg_set_bits(priv, YT922X_EN_PHY_OVERWRITE, BIT(port));
+	if (res)
+		return res;
+
+	return 0;
+}
+
+static void
+yt922x_phylink_mac_link_up(struct phylink_config *config,
+			   struct phy_device *phydev, unsigned int mode,
+			   phy_interface_t interface, int speed, int duplex,
+			   bool tx_pause, bool rx_pause)
+{
+	struct dsa_port *dp = dsa_phylink_to_port(config);
+	struct yt921x_priv *priv = to_yt921x_priv(dp->ds);
+	int port = dp->index;
+	int res;
+
+	mutex_lock(&priv->reg_lock);
+	res = yt922x_port_up(priv, port, mode, interface, speed, duplex,
+			     tx_pause, rx_pause);
+	mutex_unlock(&priv->reg_lock);
+
+	if (res)
+		dev_err(dp->ds->dev, "Failed to %s port %d: %i\n", "bring up",
+			port, res);
+}
+
+static void
+yt922x_phylink_mac_config(struct phylink_config *config, unsigned int mode,
+			  const struct phylink_link_state *state)
+{
+}
+
+static struct phylink_pcs *
+yt922x_phylink_mac_select_pcs(struct phylink_config *config,
+			      phy_interface_t interface)
+{
+	struct dsa_port *dp = dsa_phylink_to_port(config);
+	struct yt921x_priv *priv = to_yt921x_priv(dp->ds);
+
+	switch (interface) {
+	case PHY_INTERFACE_MODE_SGMII:
+	case PHY_INTERFACE_MODE_1000BASEX:
+	case PHY_INTERFACE_MODE_2500BASEX:
+	case PHY_INTERFACE_MODE_USXGMII:
+		return &priv->ports[dp->index].pcs;
+
+	default:
+		return NULL;
+	}
+}
+
+static const struct phylink_mac_ops yt922x_phylink_mac_ops = {
+	.mac_select_pcs = yt922x_phylink_mac_select_pcs,
+	.mac_link_down = yt922x_phylink_mac_link_down,
+	.mac_link_up = yt922x_phylink_mac_link_up,
+	.mac_config = yt922x_phylink_mac_config,
+};
+
+static enum dsa_tag_protocol
+yt922x_dsa_get_tag_protocol(struct dsa_switch *ds, int port,
+			    enum dsa_tag_protocol m)
+{
+	return DSA_TAG_PROTO_YT922X;
+}
+
+static void
+yt922x_dsa_phylink_get_caps(struct dsa_switch *ds, int port,
+			    struct phylink_config *config)
+{
+	struct yt921x_priv *priv = to_yt921x_priv(ds);
+	const struct yt921x_info *info = priv->info;
+
+	config->mac_capabilities = MAC_ASYM_PAUSE | MAC_SYM_PAUSE |
+				   MAC_10 | MAC_100 | MAC_1000;
+
+	if (info->internal_mask & BIT(port)) {
+		/* port 4 to port 7, internal utp */
+		__set_bit(PHY_INTERFACE_MODE_INTERNAL,
+			  config->supported_interfaces);
+		config->mac_capabilities |= MAC_2500FD;
+	}
+	if (info->serdes_mask & BIT(port)) {
+		/* serdes */
+		__set_bit(PHY_INTERFACE_MODE_SGMII,
+			  config->supported_interfaces);
+		__set_bit(PHY_INTERFACE_MODE_1000BASEX,
+			  config->supported_interfaces);
+		__set_bit(PHY_INTERFACE_MODE_2500BASEX,
+			  config->supported_interfaces);
+		config->mac_capabilities |= MAC_2500FD;
+		__set_bit(PHY_INTERFACE_MODE_USXGMII,
+			  config->supported_interfaces);
+		config->mac_capabilities |= MAC_5000FD;
+		config->mac_capabilities |= MAC_10000FD;
+	}
+}
+
+static int yt922x_port_setup(struct yt921x_priv *priv, int port)
+{
+	struct dsa_switch *ds = &priv->ds;
+	u32 mask;
+	u32 ctrl;
+	int res;
+
+	/* enable user port isolation and disable fdb learning */
+	ctrl = ~priv->cpu_ports_mask;
+	res = yt921x_reg_write(priv, YT922X_PORTn_ISOLATION(port), ctrl);
+	if (res)
+		return res;
+
+	mask = YT922X_PORT_LEARN_DIS;
+	res = yt921x_reg_set_bits(priv, YT922X_PORTn_LEARN(port), mask);
+	if (res)
+		return res;
+
+	if (dsa_is_cpu_port(ds, port)) {
+		ctrl = ~(u32)0;
+		res = yt921x_reg_write(priv, YT922X_PORTn_ISOLATION(port),
+				       ctrl);
+		if (res)
+			return res;
+	}
+
+	return 0;
+}
+
+static int yt922x_dsa_port_setup(struct dsa_switch *ds, int port)
+{
+	struct yt921x_priv *priv = to_yt921x_priv(ds);
+	int res;
+
+	mutex_lock(&priv->reg_lock);
+	res = yt922x_port_setup(priv, port);
+	mutex_unlock(&priv->reg_lock);
+
+	return res;
+}
+
+static int yt922x_cpu_tag_mode_set_8b(struct yt921x_priv *priv)
+{
+	u32 val;
+	u32 val1;
+	int res;
+
+	/* cpu tag mode set to 8b */
+	res = yt921x_reg_read(priv, YT922X_CPU_TAG_RX_CTRL, &val);
+	if (res)
+		return res;
+	res = yt921x_reg_read(priv, YT922X_CPU_TAG_TX_CTRL, &val1);
+	if (res)
+		return res;
+	val &= ~YT922X_CPU_TAG_RX_MODE;
+	val1 &= ~YT922X_CPU_TAG_TX_MODE;
+	val1 &= ~YT922X_CPU_TAG_TX_TYPE;
+	res = yt921x_reg_write(priv, YT922X_CPU_TAG_RX_CTRL, val);
+	if (res)
+		return res;
+	res = yt921x_reg_write(priv, YT922X_CPU_TAG_TX_CTRL, val1);
+	if (res)
+		return res;
+
+	return 0;
+}
+
+static int yt922x_cpu_port_set(struct yt921x_priv *priv)
+{
+	struct dsa_switch *ds = &priv->ds;
+	u32 ctrl;
+	int res;
+
+	/* cpu tag mode */
+	res = yt922x_cpu_tag_mode_set_8b(priv);
+	if (res)
+		return res;
+
+	/* Enable DSA */
+	priv->cpu_ports_mask = dsa_cpu_ports(ds);
+	ctrl = YT921X_EXT_CPU_PORT_TAG_EN | YT921X_EXT_CPU_PORT_PORT_EN |
+	       YT921X_EXT_CPU_PORT_PORT(__ffs(priv->cpu_ports_mask));
+	res = yt921x_reg_write(priv, YT921X_EXT_CPU_PORT, ctrl);
+	if (res)
+		return res;
+
+	/* Setup software switch */
+	ctrl = YT922X_CPU_COPY_TO_EXT_CPU;
+	res = yt921x_reg_write(priv, YT922X_CPU_COPY, ctrl);
+	if (res)
+		return res;
+
+	return res;
+}
+
+static int yt922x_chip_setup_dsa(struct yt921x_priv *priv)
+{
+	unsigned long cpu_ports_mask;
+	u32 ctrl;
+	int port;
+	int res;
+
+	/* cpu port set */
+	res = yt922x_cpu_port_set(priv);
+	if (res)
+		return res;
+
+	ctrl = GENMASK_U32(8, 0);
+	res = yt921x_reg_write(priv, YT922X_FILTER_UNK_UCAST, ctrl);
+	if (res)
+		return res;
+
+	ctrl = 0;
+	for (int i = 0; i < priv->series->max_ports; i++)
+		ctrl |= YT922X_ACT_UNK_ACTn_TRAP(i);
+	cpu_ports_mask = priv->cpu_ports_mask;
+	for_each_set_bit(port, &cpu_ports_mask, priv->series->max_ports) {
+		ctrl &= ~YT922X_ACT_UNK_ACTn_M(port);
+		ctrl |= YT922X_ACT_UNK_ACTn_DROP(port);
+	}
+	res = yt921x_reg_write(priv, YT922X_ACT_UNK_UCAST, ctrl);
+	if (res)
+		return res;
+	res = yt921x_reg_write(priv, YT922X_ACT_UNK_MCAST, ctrl);
+	if (res)
+		return res;
+
+	return 0;
+}
+
+static int yt922x_chip_setup(struct yt921x_priv *priv)
+{
+	u32 ctrl;
+	int res;
+
+	ctrl = YT922X_FUNC_MIB | YT922X_FUNC_ACL;
+	res = yt921x_reg_set_bits(priv, YT921X_FUNC, ctrl);
+	if (res)
+		return res;
+
+	res = yt922x_chip_setup_dsa(priv);
+	if (res)
+		return res;
+
+	return 0;
+}
+
+static void yt922x_pcs_setup(struct dsa_switch *ds)
+{
+	struct yt921x_priv *priv = to_yt921x_priv(ds);
+	const struct yt921x_info *info = priv->info;
+	unsigned long mask;
+	int port;
+
+	mask = info->serdes_mask;
+	for_each_set_bit(port, &mask, priv->series->max_ports) {
+		struct yt921x_port *pp = &priv->ports[port];
+
+		pp->pcs.ops = &yt922x_phylink_pcs_ops;
+		pp->pcs.poll = true;
+
+		__set_bit(PHY_INTERFACE_MODE_SGMII,
+			  pp->pcs.supported_interfaces);
+		__set_bit(PHY_INTERFACE_MODE_1000BASEX,
+			  pp->pcs.supported_interfaces);
+		__set_bit(PHY_INTERFACE_MODE_2500BASEX,
+			  pp->pcs.supported_interfaces);
+		__set_bit(PHY_INTERFACE_MODE_USXGMII,
+			  pp->pcs.supported_interfaces);
+	}
+}
+
+static int yt922x_dsa_setup(struct dsa_switch *ds)
+{
+	struct yt921x_priv *priv = to_yt921x_priv(ds);
+	struct device *dev = to_device(priv);
+	struct device_node *np = dev->of_node;
+	struct device_node *child;
+	int res;
+
+	/*  ports index init */
+	for (size_t i = 0; i < ARRAY_SIZE(priv->ports); i++) {
+		struct yt921x_port *pp = &priv->ports[i];
+
+		pp->index = i;
+	}
+
+	mutex_lock(&priv->reg_lock);
+	res = yt921x_chip_reset(priv);
+	mutex_unlock(&priv->reg_lock);
+	if (res)
+		return res;
+
+	/* Register the internal mdio bus. */
+	child = of_get_child_by_name(np, "mdio");
+	if (child) {
+		res = yt921x_mbus_int_init(priv, child);
+		of_node_put(child);
+		if (res)
+			return res;
+	}
+
+	mutex_lock(&priv->reg_lock);
+	res = yt922x_chip_setup(priv);
+	mutex_unlock(&priv->reg_lock);
+	if (res)
+		return res;
+
+	/* switch sds pcs setup */
+	yt922x_pcs_setup(ds);
+
+	return 0;
+}
+
+static const struct dsa_switch_ops yt922x_dsa_switch_ops = {
+	/* port */
+	.get_tag_protocol = yt922x_dsa_get_tag_protocol,
+	.phylink_get_caps = yt922x_dsa_phylink_get_caps,
+	.port_setup  = yt922x_dsa_port_setup,
+	/* chip */
+	.setup   = yt922x_dsa_setup,
+};
+
+static const struct yt92xx_series yt92xx_series_table[] = {
+	[YT92XX_MODE_YT921X] = {
+		.name = "YT921x",
+		.max_ports = YT921X_PORT_NUM,
+		.num_lag_ids = YT921X_LAG_NUM,
+		.ageing_time_min = 1 * 5000,
+		.ageing_time_max = U16_MAX * 5000,
+		.dscp_prio_mapping_is_global = true,
+		.assisted_learning_on_cpu_port = true,
+		.switch_ops = &yt921x_dsa_switch_ops,
+		.mac_ops = &yt921x_phylink_mac_ops
+	},
+	[YT92XX_MODE_YT922X] = {
+		.name = "YT922x",
+		.max_ports = YT922X_PORT_NUM,
+		.num_lag_ids = YT922X_LAG_NUM,
+		.ageing_time_min = 1 * 6000,
+		.ageing_time_max = U16_MAX * 6000,
+		.dscp_prio_mapping_is_global = true,
+		.assisted_learning_on_cpu_port = true,
+		.switch_ops = &yt922x_dsa_switch_ops,
+		.mac_ops = &yt922x_phylink_mac_ops,
+	},
+};
+
+static const struct yt92xx_series *yt92xx_series_lookup(u32 major)
+{
+	if (major == YT9215_MAJOR || major == YT9218_MAJOR)
+		return &yt92xx_series_table[YT92XX_MODE_YT921X];
+	else if (major == YT9224_MAJOR)
+		return &yt92xx_series_table[YT92XX_MODE_YT922X];
+	else
+		return NULL;
+}
+
+static int yt92xx_register_switch(struct dsa_switch *ds)
+{
+	struct yt921x_priv *priv = to_yt921x_priv(ds);
+	struct device *dev = to_device(priv);
+	const struct yt92xx_series *series;
+	u32 chipid;
+	u32 major;
+	int res;
+
+	mutex_lock(&priv->reg_lock);
+	res = yt921x_reg_read(priv, YT921X_CHIP_ID, &chipid);
+	mutex_unlock(&priv->reg_lock);
+	if (res) {
+		dev_err(dev, "Unexpected chipid 0x%x\n", chipid);
+		return res;
+	}
+
+	major = FIELD_GET(YT921X_CHIP_ID_MAJOR, chipid);
+	series = yt92xx_series_lookup(major);
+	if (!series) {
+		dev_err(dev, "Undefined series info for the corresponding major\n");
+		return -ENODEV;
+	}
+	priv->series = series;
+
+	ds->assisted_learning_on_cpu_port =
+		priv->series->assisted_learning_on_cpu_port;
+	ds->dscp_prio_mapping_is_global =
+		priv->series->dscp_prio_mapping_is_global;
+	ds->ageing_time_min = priv->series->ageing_time_min;
+	ds->ageing_time_max = priv->series->ageing_time_max;
+	ds->num_lag_ids = priv->series->num_lag_ids;
+	ds->num_ports = priv->series->max_ports;
+	ds->ops = priv->series->switch_ops;
+	ds->phylink_mac_ops = priv->series->mac_ops;
+
+	return 0;
+}
+
 static void yt921x_mdio_shutdown(struct mdio_device *mdiodev)
 {
 	struct yt921x_priv *priv = mdiodev_get_drvdata(mdiodev);
@@ -4414,12 +4936,6 @@ static void yt921x_mdio_remove(struct mdio_device *mdiodev)
 	if (!priv)
 		return;
 
-	for (size_t i = ARRAY_SIZE(priv->ports); i-- > 0; ) {
-		struct yt921x_port *pp = &priv->ports[i];
-
-		disable_delayed_work_sync(&pp->mib_read);
-	}
-
 	dsa_unregister_switch(&priv->ds);
 
 	for (unsigned int i = 0; i < ARRAY_SIZE(priv->acl_blks); i++) {
@@ -4445,6 +4961,7 @@ static int yt921x_mdio_probe(struct mdio_device *mdiodev)
 	struct yt921x_reg_mdio *mdio;
 	struct yt921x_priv *priv;
 	struct dsa_switch *ds;
+	int res;
 
 	priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
 	if (!priv)
@@ -4463,24 +4980,12 @@ static int yt921x_mdio_probe(struct mdio_device *mdiodev)
 	priv->reg_ops = &yt921x_reg_ops_mdio;
 	priv->reg_ctx = mdio;
 
-	for (size_t i = 0; i < ARRAY_SIZE(priv->ports); i++) {
-		struct yt921x_port *pp = &priv->ports[i];
-
-		pp->index = i;
-		INIT_DELAYED_WORK(&pp->mib_read, yt921x_poll_mib);
-	}
-
 	ds = &priv->ds;
 	ds->dev = dev;
-	ds->assisted_learning_on_cpu_port = true;
-	ds->dscp_prio_mapping_is_global = true;
 	ds->priv = priv;
-	ds->ops = &yt921x_dsa_switch_ops;
-	ds->ageing_time_min = 1 * 5000;
-	ds->ageing_time_max = U16_MAX * 5000;
-	ds->phylink_mac_ops = &yt921x_phylink_mac_ops;
-	ds->num_lag_ids = YT921X_LAG_NUM;
-	ds->num_ports = YT921X_PORT_NUM;
+	res = yt92xx_register_switch(ds);
+	if (res)
+		return res;
 
 	mdiodev_set_drvdata(mdiodev, priv);
 
@@ -4489,6 +4994,7 @@ static int yt921x_mdio_probe(struct mdio_device *mdiodev)
 
 static const struct of_device_id yt921x_of_match[] = {
 	{ .compatible = "motorcomm,yt9215" },
+	{ .compatible = "motorcomm,yt9224" },
 	{}
 };
 MODULE_DEVICE_TABLE(of, yt921x_of_match);
@@ -4506,5 +5012,6 @@ static struct mdio_driver yt921x_mdio_driver = {
 mdio_module_driver(yt921x_mdio_driver);
 
 MODULE_AUTHOR("David Yang <mmyangfl@gmail.com>");
-MODULE_DESCRIPTION("Driver for Motorcomm YT921x Switch");
+MODULE_AUTHOR("Kyle Switch <kyle.switch@motor-comm.com>");
+MODULE_DESCRIPTION("Driver for Motorcomm YT921x and YT922x Switch");
 MODULE_LICENSE("GPL");
diff --git a/drivers/net/dsa/motorcomm/chip.h b/drivers/net/dsa/motorcomm/chip.h
index 28e4f26f9cc49..f11d19ba79b5b 100644
--- a/drivers/net/dsa/motorcomm/chip.h
+++ b/drivers/net/dsa/motorcomm/chip.h
@@ -812,6 +812,7 @@ enum yt921x_fdb_entry_status {
 
 #define YT9215_MAJOR	0x9002
 #define YT9218_MAJOR	0x9001
+#define YT9224_MAJOR	0x9004
 
 /* required for a hard reset */
 #define YT921X_RST_DELAY_US	10000
@@ -833,6 +834,96 @@ enum yt921x_fdb_entry_status {
 
 #define YT921X_NAME	"yt921x"
 
+/* yt922x register lists */
+#define YT92XX_PAGE_SELECT	0x1e
+#define YT92XX_PAGE		0x1f
+#define YT922X_PORTn_STATUS(port)	(0x80200 + 4 * (port))
+#define  YT922X_PORT_LINK_STATE			BIT(8)
+#define  YT922X_PORT_LINK_DUPLEX		BIT(7)
+#define  YT922X_PORT_RX_FC_EN			BIT(6)
+#define  YT922X_PORT_TX_FC_EN			BIT(5)
+#define YT922X_PORT_SPEED_10		0
+#define YT922X_PORT_SPEED_100		1
+#define YT922X_PORT_SPEED_1000		2
+#define YT922X_PORT_SPEED_10000		3
+#define YT922X_PORT_SPEED_2500		4
+#define YT922X_PORT_SPEED_5000		5
+#define YT922X_EN_PHY_OVERWRITE		(0x80040)
+#define YT922X_EN_PHY_VALUE		(0x8003c)
+/* CTRL: force op to make soft configuration effective */
+#define YT922X_PORTn_CTRL(port)		(0x80080 + 4 * (port))
+#define  YT922X_PORT_FORCE_OP			BIT(14)
+#define  YT922X_PORT_CFG_TX_EN			BIT(13)
+#define  YT922X_PORT_CFG_RX_EN			BIT(12)
+#define  YT922X_PORT_FC_AN			BIT(11)
+#define  YT922X_PORT_LINK_AN			BIT(10)  /* CTRL: auto negotiation */
+#define  YT922X_PORT_LINK			BIT(9)  /* CTRL: link status */
+#define  YT922X_PORT_HALF_PAUSE			BIT(8)  /* Half-duplex back pressure mode */
+#define  YT922X_PORT_DUPLEX_FULL		BIT(7)
+#define  YT922X_PORT_RX_PAUSE			BIT(6)
+#define  YT922X_PORT_TX_PAUSE			BIT(5)
+#define  YT922X_PORT_RX_MAC_EN			BIT(4)
+#define  YT922X_PORT_TX_MAC_EN			BIT(3)
+#define  YT922X_PORT_SPEED_M			GENMASK(2, 0)
+#define YT922X_PORT_SDSn		0x400
+#define  YT922X_SERDES_MODE_M			GENMASK(6, 4)
+#define   YT922X_SERDES_MODE(x)				FIELD_PREP(YT922X_SERDES_MODE_M, (x))
+#define YT922X_SERDES_MODE_SGMII	YT922X_SERDES_MODE(0)
+#define YT922X_SERDES_MODE_REVSGMII	YT922X_SERDES_MODE(1)
+#define YT922X_SERDES_MODE_1000BASEX	YT922X_SERDES_MODE(2)
+#define YT922X_SERDES_MODE_100BASEX	YT922X_SERDES_MODE(3)
+#define YT922X_SERDES_MODE_2500BASEX	YT922X_SERDES_MODE(4)
+#define YT922X_SERDES_MODE_USXGMII	YT922X_SERDES_MODE(6)
+#define YT922X_PORT_NUM			9
+#define YT922X_PCS_LINK_CTRL		0x11
+#define YT922X_PCS_LINK_STATUS		BIT(10)
+#define YT922X_PCS_AN_COMPLETE		BIT(11)
+
+/* LAG */
+#define YT922X_LAG_NUM			4
+/* ISO */
+#define YT922X_PORTn_ISOLATION(port)	(0x4 * (port) + 0x180d80)
+/* FDB */
+#define YT922X_PORTn_LEARN(port)	(0x180300 + 4 * (port))
+#define  YT922X_PORT_LEARN_DIS			BIT(18)
+/* GLOBAL CTRL */
+#define  YT922X_FUNC_ACL			BIT(5)
+#define  YT922X_FUNC_MIB			BIT(4)
+/* CTRL PKT */
+#define YT922X_FILTER_UNK_UCAST		0x180ec8
+#define YT922X_ACT_UNK_UCAST		0x180ed8
+#define YT922X_ACT_UNK_MCAST		0x180ee0
+#define  YT922X_ACT_UNK_MCAST_BYPASS_DROP_PIM	BIT(22)
+#define  YT922X_ACT_UNK_MCAST_BYPASS_DROP_MLD	BIT(21)
+#define  YT922X_ACT_UNK_MCAST_BYPASS_DROP_IGMP	BIT(20)
+#define  YT922X_ACT_UNK_ACTn_M(port)			GENMASK(2 * (port) + 1, 2 * (port))
+#define  YT922X_ACT_UNK_ACTn(port, x)			((x) << (2 * (port)))
+#define  YT922X_ACT_UNK_ACTn_FORWARD(port)		YT922X_ACT_UNK_ACTn(port, 0)  /* flood */
+#define  YT922X_ACT_UNK_ACTn_DROP(port)			YT922X_ACT_UNK_ACTn(port, 1)  /* discard */
+#define  YT922X_ACT_UNK_ACTn_TRAP(port)			YT922X_ACT_UNK_ACTn(port, 3)  /* steer to CPU */
+
+/* CPU PORT */
+#define YT922X_CPU_COPY			0x181100
+#define  YT922X_CPU_COPY_TO_INT_CPU		BIT(1)
+#define  YT922X_CPU_COPY_TO_EXT_CPU		BIT(0)
+#define YT922X_CPU_TAG_RX_CTRL		0x80504
+#define  YT922X_CPU_TAG_RX_MODE			BIT(0)
+#define YT922X_CPU_TAG_TX_CTRL		0x100710
+#define  YT922X_CPU_TAG_TX_TYPE		BIT(0)
+#define  YT922X_CPU_TAG_TX_MODE		BIT(1)
+#define  YT922X_CPU_TAG_TX_CTAG_OP	BIT(2)
+#define  YT922X_CPU_TAG_TX_STAG_OP	BIT(3)
+/* Define top ext addr for yt922x */
+#define YT922X_COMMON_EXT_PHYADDR 9
+
+enum yt922x_phy_reg_type {
+	YT922X_PHY_REG_TYPE_COMMON_EXT,
+	YT922X_PHY_REG_TYPE_SDS_COMMON_EXT,
+	YT922X_PHY_REG_TYPE_MII,
+	YT922X_PHY_REG_TYPE_EXT,
+	YT922X_PHY_REG_TYPE_MAX
+};
+
 struct yt921x_mib {
 	u64 rx_broadcast;
 	u64 rx_pause;
@@ -955,9 +1046,28 @@ struct yt921x_info {
 	u16 serdes_mask;
 };
 
+enum yt92xx_mode {
+	YT92XX_MODE_YT921X,
+	YT92XX_MODE_YT922X,
+	YT92XX_MODE_MAX,
+};
+
+struct yt92xx_series {
+	const char *name;
+	unsigned int max_ports;
+	unsigned int num_lag_ids;
+	unsigned int ageing_time_min;
+	unsigned int ageing_time_max;
+	u32 dscp_prio_mapping_is_global;
+	u32 assisted_learning_on_cpu_port;
+	const struct dsa_switch_ops *switch_ops;
+	const struct phylink_mac_ops *mac_ops;
+};
+
 struct yt921x_priv {
 	struct dsa_switch ds;
 
+	const struct yt92xx_series *series;
 	const struct yt921x_info *info;
 	unsigned int meter_slot_ns;
 	unsigned int port_shape_slot_ns;
diff --git a/drivers/net/dsa/motorcomm/mdio_bus.c b/drivers/net/dsa/motorcomm/mdio_bus.c
index 1a3f3cc68275d..dd465ac338da8 100644
--- a/drivers/net/dsa/motorcomm/mdio_bus.c
+++ b/drivers/net/dsa/motorcomm/mdio_bus.c
@@ -115,7 +115,7 @@ static int yt921x_mbus_int_read(struct mii_bus *mbus, int port, int reg)
 	u16 val;
 	int res;
 
-	if (port >= YT921X_PORT_NUM)
+	if (port >= priv->series->max_ports)
 		return U16_MAX;
 
 	mutex_lock(&priv->reg_lock);
@@ -133,7 +133,7 @@ yt921x_mbus_int_write(struct mii_bus *mbus, int port, int reg, u16 data)
 	struct yt921x_priv *priv = mbus->priv;
 	int res;
 
-	if (port >= YT921X_PORT_NUM)
+	if (port >= priv->series->max_ports)
 		return -ENODEV;
 
 	mutex_lock(&priv->reg_lock);
@@ -147,6 +147,7 @@ int yt921x_mbus_int_init(struct yt921x_priv *priv, struct device_node *mnp)
 {
 	struct device *dev = to_device(priv);
 	struct mii_bus *mbus;
+	u32 max_ports;
 	int res;
 
 	mbus = devm_mdiobus_alloc(dev);
@@ -159,7 +160,8 @@ int yt921x_mbus_int_init(struct yt921x_priv *priv, struct device_node *mnp)
 	mbus->read = yt921x_mbus_int_read;
 	mbus->write = yt921x_mbus_int_write;
 	mbus->parent = dev;
-	mbus->phy_mask = (u32)~GENMASK(YT921X_PORT_NUM - 1, 0);
+	max_ports = priv->series->max_ports;
+	mbus->phy_mask = ~GENMASK_U32(max_ports - 1, 0);
 
 	res = devm_of_mdiobus_register(dev, mbus, mnp);
 	if (res)
@@ -299,3 +301,42 @@ int yt921x_mbus_ext_init(struct yt921x_priv *priv, struct device_node *mnp)
 
 	return 0;
 }
+
+/* intif extend register read/write api */
+int
+yt921x_intif_ext_write(struct yt921x_priv *priv, int port, int reg, u16 val)
+{
+	int res;
+
+	if (port > priv->series->max_ports)
+		return -ENODEV;
+
+	res = yt921x_intif_write(priv, port, YT92XX_PAGE_SELECT, reg);
+	if (res)
+		return res;
+
+	res = yt921x_intif_write(priv, port, YT92XX_PAGE, val);
+	if (res)
+		return res;
+
+	return 0;
+}
+
+int
+yt921x_intif_ext_read(struct yt921x_priv *priv, int port, int reg, u16 *valp)
+{
+	int res;
+
+	if (port > priv->series->max_ports)
+		return -ENODEV;
+
+	res = yt921x_intif_write(priv, port, YT92XX_PAGE_SELECT, reg);
+	if (res)
+		return res;
+
+	res = yt921x_intif_read(priv, port, YT92XX_PAGE, valp);
+	if (res)
+		return res;
+
+	return 0;
+}
diff --git a/drivers/net/dsa/motorcomm/mdio_bus.h b/drivers/net/dsa/motorcomm/mdio_bus.h
index e79b725d435bd..513a8d2d7618b 100644
--- a/drivers/net/dsa/motorcomm/mdio_bus.h
+++ b/drivers/net/dsa/motorcomm/mdio_bus.h
@@ -50,5 +50,7 @@ yt921x_intif_modify(struct yt921x_priv *priv, int port, int reg, u16 mask,
 
 int yt921x_mbus_int_init(struct yt921x_priv *priv, struct device_node *mnp);
 int yt921x_mbus_ext_init(struct yt921x_priv *priv, struct device_node *mnp);
+int yt921x_intif_ext_write(struct yt921x_priv *priv, int port, int reg, u16 val);
+int yt921x_intif_ext_read(struct yt921x_priv *priv, int port, int reg, u16 *valp);
 
 #endif
diff --git a/drivers/net/dsa/motorcomm/pcs-922x.c b/drivers/net/dsa/motorcomm/pcs-922x.c
new file mode 100644
index 0000000000000..98d403d01ba3c
--- /dev/null
+++ b/drivers/net/dsa/motorcomm/pcs-922x.c
@@ -0,0 +1,173 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * Copyright (c) 2026 Kyle Switch
+ */
+
+#include "chip.h"
+#include "mdio_bus.h"
+#include "pcs.h"
+#include "smi.h"
+
+#define to_device(priv) ((priv)->ds.dev)
+
+static int yt922x_sds_phyaddr_get(int port,
+				  enum yt922x_phy_reg_type reg_type)
+{
+	if (reg_type == YT922X_PHY_REG_TYPE_COMMON_EXT)
+		return YT922X_COMMON_EXT_PHYADDR;
+
+	return port;
+}
+
+static void yt922x_pcs_get_state(struct phylink_pcs *pcs, unsigned int neg_mode,
+				 struct phylink_link_state *state)
+{
+	struct yt921x_port *pp = pcs_to_yt921x_port(pcs);
+	struct yt921x_priv *priv = yt921x_port_to_priv(pp);
+	int port = pp->index;
+	int res = 0;
+	u16 data;
+	int addr;
+	u16 lp;
+
+	addr = yt922x_sds_phyaddr_get(port, YT922X_PHY_REG_TYPE_MII);
+	if (addr < 0) {
+		state->link = false;
+		return;
+	}
+
+	mutex_lock(&priv->reg_lock);
+	switch (state->interface) {
+	case PHY_INTERFACE_MODE_SGMII:
+	case PHY_INTERFACE_MODE_1000BASEX:
+	case PHY_INTERFACE_MODE_2500BASEX:
+		res = yt921x_intif_read(priv, addr, MII_BMSR, &data);
+		if (res)
+			goto err;
+		res = yt921x_intif_read(priv, addr, MII_LPA, &lp);
+		if (res)
+			goto err;
+		phylink_mii_c22_pcs_decode_state(state, neg_mode, data, lp);
+		break;
+	case PHY_INTERFACE_MODE_USXGMII:
+		res = yt921x_intif_read(priv, addr, YT922X_PCS_LINK_CTRL,
+					&data);
+		if (res)
+			goto err;
+		state->link =  FIELD_GET(YT922X_PCS_LINK_STATUS, data);
+		state->an_complete = FIELD_GET(YT922X_PCS_AN_COMPLETE, data);
+		res = yt921x_intif_read(priv, addr, MII_LPA, &lp);
+		if (res)
+			goto err;
+		if (state->link)
+			phylink_decode_usxgmii_word(state, lp);
+		break;
+	default:
+		state->link = false;
+		break;
+	}
+	mutex_unlock(&priv->reg_lock);
+	return;
+
+err:
+	mutex_unlock(&priv->reg_lock);
+	state->link = false;
+}
+
+static void yt922x_pcs_an_restart(struct phylink_pcs *pcs)
+{
+	struct yt921x_port *pp = pcs_to_yt921x_port(pcs);
+	struct yt921x_priv *priv = yt921x_port_to_priv(pp);
+	struct device *dev = to_device(priv);
+	int port = pp->index;
+	u16 data;
+	int addr;
+	int res;
+
+	mutex_lock(&priv->reg_lock);
+	addr = yt922x_sds_phyaddr_get(port, YT922X_PHY_REG_TYPE_MII);
+	if (addr < 0) {
+		res = addr;
+		goto err;
+	}
+	res = yt921x_intif_read(priv, addr, MII_BMCR, &data);
+	if (res)
+		goto err;
+	data |= BMCR_ANRESTART;
+	res = yt921x_intif_write(priv, addr, MII_BMCR, data);
+	if (res)
+		goto err;
+	mutex_unlock(&priv->reg_lock);
+	return;
+
+err:
+	mutex_unlock(&priv->reg_lock);
+	if (res)
+		dev_err(dev, "Failed to %s PCS port %d: %i\n", "an restart",
+			port, res);
+}
+
+static int yt922x_pcs_config(struct phylink_pcs *pcs, unsigned int neg_mode,
+			     phy_interface_t interface,
+			     const unsigned long *advertising,
+			     bool permit_pause_to_mac)
+{
+	struct yt921x_port *pp = pcs_to_yt921x_port(pcs);
+	struct yt921x_priv *priv = yt921x_port_to_priv(pp);
+	int res, port;
+	u16 data;
+	u16 ctrl;
+	int addr;
+
+	port = pp->index;
+	mutex_lock(&priv->reg_lock);
+	addr = yt922x_sds_phyaddr_get
+		(port, YT922X_PHY_REG_TYPE_SDS_COMMON_EXT);
+	if (addr < 0) {
+		res = addr;
+		goto err;
+	}
+	/* write protect */
+	res = yt921x_intif_ext_write(priv, addr, 0x4be, 0xd);
+	if (res)
+		goto err;
+	switch (interface) {
+	case PHY_INTERFACE_MODE_SGMII:
+		ctrl = YT922X_SERDES_MODE_SGMII;
+		break;
+	case PHY_INTERFACE_MODE_1000BASEX:
+		ctrl = YT922X_SERDES_MODE_1000BASEX;
+		break;
+	case PHY_INTERFACE_MODE_2500BASEX:
+		ctrl = YT922X_SERDES_MODE_2500BASEX;
+		break;
+	case PHY_INTERFACE_MODE_USXGMII:
+		ctrl = YT922X_SERDES_MODE_USXGMII;
+		break;
+	default:
+		res = -EINVAL;
+		goto err;
+	}
+	res = yt921x_intif_ext_read(priv, addr, YT922X_PORT_SDSn, &data);
+	if (res)
+		goto err;
+	data &= ~YT922X_SERDES_MODE_M;
+	data |= ctrl;
+	res = yt921x_intif_ext_write(priv, addr, YT922X_PORT_SDSn, data);
+	if (res)
+		goto err;
+	mutex_unlock(&priv->reg_lock);
+
+	return res;
+
+err:
+	mutex_unlock(&priv->reg_lock);
+
+	return res;
+}
+
+const struct phylink_pcs_ops yt922x_phylink_pcs_ops = {
+	.pcs_get_state = yt922x_pcs_get_state,
+	.pcs_config = yt922x_pcs_config,
+	.pcs_an_restart = yt922x_pcs_an_restart,
+};
diff --git a/drivers/net/dsa/motorcomm/pcs.h b/drivers/net/dsa/motorcomm/pcs.h
index 42426558086af..c85caa7bf2126 100644
--- a/drivers/net/dsa/motorcomm/pcs.h
+++ b/drivers/net/dsa/motorcomm/pcs.h
@@ -9,5 +9,6 @@
 #include <linux/phylink.h>
 
 extern const struct phylink_pcs_ops yt921x_phylink_pcs_ops;
+extern const struct phylink_pcs_ops yt922x_phylink_pcs_ops;
 
 #endif
diff --git a/include/net/dsa.h b/include/net/dsa.h
index 5d12191b6f6f5..5a173fe2bb876 100644
--- a/include/net/dsa.h
+++ b/include/net/dsa.h
@@ -62,6 +62,7 @@ struct tc_action;
 #define DSA_TAG_PROTO_KSZ8463_VALUE		34
 #define DSA_TAG_PROTO_MT7628_VALUE		35
 #define DSA_TAG_PROTO_KS8995_VALUE		36
+#define DSA_TAG_PROTO_YT922X_VALUE		37
 
 enum dsa_tag_protocol {
 	DSA_TAG_PROTO_NONE		= DSA_TAG_PROTO_NONE_VALUE,
@@ -101,6 +102,7 @@ enum dsa_tag_protocol {
 	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,
+	DSA_TAG_PROTO_YT922X		= DSA_TAG_PROTO_YT922X_VALUE,
 };
 
 struct dsa_switch;
diff --git a/net/dsa/Kconfig b/net/dsa/Kconfig
index 4f44bf3ede238..86802058678c0 100644
--- a/net/dsa/Kconfig
+++ b/net/dsa/Kconfig
@@ -233,4 +233,10 @@ config NET_DSA_TAG_YT921X
 	  Say Y or M if you want to enable support for tagging frames for
 	  Motorcomm YT921x switches.
 
+config NET_DSA_TAG_YT922X
+  tristate "Tag driver for Motorcomm YT922x switches"
+  help
+    Say Y or M if you want to enable support for tagging frames for
+    Motorcomm YT922x switches.
+
 endif
diff --git a/net/dsa/Makefile b/net/dsa/Makefile
index 1f9cc30e99886..0ef6dfce3b924 100644
--- a/net/dsa/Makefile
+++ b/net/dsa/Makefile
@@ -45,6 +45,7 @@ obj-$(CONFIG_NET_DSA_TAG_TRAILER) += tag_trailer.o
 obj-$(CONFIG_NET_DSA_TAG_VSC73XX_8021Q) += tag_vsc73xx_8021q.o
 obj-$(CONFIG_NET_DSA_TAG_XRS700X) += tag_xrs700x.o
 obj-$(CONFIG_NET_DSA_TAG_YT921X) += tag_yt921x.o
+obj-$(CONFIG_NET_DSA_TAG_YT922X) += tag_yt922x.o
 
 # for tracing framework to find trace.h
 CFLAGS_trace.o := -I$(src)
diff --git a/net/dsa/tag_yt922x.c b/net/dsa/tag_yt922x.c
new file mode 100644
index 0000000000000..3c9fef651cf51
--- /dev/null
+++ b/net/dsa/tag_yt922x.c
@@ -0,0 +1,109 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * Motorcomm YT922x Switch Extended CPU Port Tagging
+ *
+ * Copyright (c) 2026 Kyle switch <kyle.switch@motor-comm.com>
+ *
+ */
+
+#include <linux/etherdevice.h>
+
+#include "tag.h"
+
+#define YT922X_TAG_LEN 8
+
+/*
+ * To define the from cpu tag format 8 bytes.
+ */
+#define YT922X_TAG_NAME		"yt922x"
+#define YT922X_TAG_PORTMASK_0	BIT(15)
+#define YT922X_TAG_PORTMASK_M	GENMASK(8, 0)
+#define  YT922X_TAG_PORTS(x)		FIELD_PREP(YT922X_TAG_PORTMASK_M, (x))
+#define YT922X_TAG_FORCE_DST	BIT(9)
+#define YT922X_TAG_PRIO_M	GENMASK(12, 10)
+#define YT922X_TAG_PRIO_EN	BIT(13)
+#define  YT922X_TAG_PRIO(x)	(FIELD_PREP(YT922X_TAG_PRIO_M, (x)) | YT922X_TAG_PRIO_EN)
+#define YT922X_TAG_RX_PORT_M	GENMASK(5, 2)
+
+static struct sk_buff *
+yt922x_tag_xmit(struct sk_buff *skb, struct net_device *netdev)
+{
+	unsigned long ports;
+	__be16 *tag;
+	u16 ctrl;
+
+	skb_push(skb, YT922X_TAG_LEN);
+	dsa_alloc_etype_header(skb, YT922X_TAG_LEN);
+	tag = dsa_etype_header_pos_tx(skb);
+
+	tag[0] = htons(ETH_P_YT921X);
+	ports = dsa_xmit_port_mask(skb, netdev);
+	/*To fill in the case where the port index is not 0 */
+	ctrl = YT922X_TAG_PRIO(skb->priority) | YT922X_TAG_FORCE_DST |
+	       YT922X_TAG_PORTS(ports >> 1);
+	tag[1] = htons(ctrl);
+	if (ports & BIT(0)) {
+		/* To fill in the case where the port index is 0 */
+		ctrl = YT922X_TAG_PORTMASK_0;
+		tag[2] = htons(ctrl);
+	} else {
+		tag[2] = 0;
+	}
+	tag[3] = 0;
+
+	return skb;
+}
+
+static struct sk_buff *
+yt922x_tag_rcv(struct sk_buff *skb, struct net_device *netdev)
+{
+	unsigned int port;
+	__be16 *tag;
+	u16 rx;
+
+	if (unlikely(!pskb_may_pull(skb, YT922X_TAG_LEN))) {
+		kfree_skb(skb);
+		return NULL;
+	}
+
+	tag = dsa_etype_header_pos_rx(skb);
+
+	if (unlikely(tag[0] != htons(ETH_P_YT921X))) {
+		dev_warn_ratelimited(&netdev->dev,
+				     "Unexpected EtherType 0x%04x\n",
+				     ntohs(tag[0]));
+		kfree_skb(skb);
+		return NULL;
+	}
+
+	/* Locate which port this is coming from */
+	rx = ntohs(tag[2]);
+	port = FIELD_GET(YT922X_TAG_RX_PORT_M, rx);
+	skb->dev = dsa_conduit_find_user(netdev, 0, port);
+	if (unlikely(!skb->dev)) {
+		dev_warn_ratelimited(&netdev->dev,
+				     "Couldn't decode source port %u\n", port);
+		kfree_skb(skb);
+		return NULL;
+	}
+
+	/* Remove tag and update checksum */
+	skb_pull_rcsum(skb, YT922X_TAG_LEN);
+	dsa_strip_etype_header(skb, YT922X_TAG_LEN);
+
+	return skb;
+}
+
+static const struct dsa_device_ops yt922x_netdev_ops = {
+	.name = YT922X_TAG_NAME,
+	.proto = DSA_TAG_PROTO_YT922X,
+	.xmit = yt922x_tag_xmit,
+	.rcv = yt922x_tag_rcv,
+	.needed_headroom = YT922X_TAG_LEN,
+};
+
+MODULE_DESCRIPTION("DSA tag driver for Motorcomm YT922x switches");
+MODULE_LICENSE("GPL");
+MODULE_ALIAS_DSA_TAG_DRIVER(DSA_TAG_PROTO_YT922X, YT922X_TAG_NAME);
+
+module_dsa_tag_driver(yt922x_netdev_ops);

3/2 2026/10/03 06:54 llm patch-evaluator
0m Model:
gemini-3.8-flash

Args:
null

Results:
null

Tokens:
							input: 20766
							output: 30
							thoughts: 278
						

Thoughts:
**Analyzing the Motorcomm YT9224 Switch Driver Patch**

Okay, so this patch is introducing support for the Motorcomm YT9224 switch chip. It looks like it's adding this support to the existing `yt921x` switch driver, which resides in `drivers/net/dsa/motorcomm/`. It's also including a new DSA tagger specifically for the YT922x, named `net/dsa/tag_yt922x.c`. My immediate thought is, let's understand the nature of this driver and the associated DSA tagger.

First, I need to remind myself how these `drivers/net/dsa/motorcomm/` drivers function at a high level. Ah, yes, it's an MDIO-attached Ethernet switch driver. That narrows things down a bit. Now, the key question for syzkaller is: does syzkaller fuzz DSA taggers and/or DSA switches directly? Are there ways to instantiate these without physical hardware? Can the DSA tagger even *be* reached independently?

Hold on... let's think about how DSA taggers are used within the Linux kernel. How are DSA tag protocols instantiated or used? Are we talking about creating `net_device` DSA conduit/user ports? Can the DSA tagging protocol itself be bound, loaded, or potentially even *simulated*? Or can syzkaller, perhaps, fuzz these taggers through packet sockets or some kind of mock conduit? This is crucial to understanding the potential attack surface.

Back to the `tag_yt922x.c` file specifically. Can a user space program create a DSA switch, or a *mock* DSA switch, to interact with the tagger?

Right, let's step back and consider what I already know and what the codebase might reveal. I need to refresh my memory on any prior discussions, patches, or test setups related to DSA reachability, especially within the context of syzkaller or virtual environments.

Time for some grep work, let's see what the syzkaller and kernel source code have to say about this!



4/2 2026/10/03 06:54 tool grepper
0m Args:
{
  "Expression": "DSA_TAG_PROTO_",
  "PathPrefix": "net/dsa"
}

Results:
{
  "Output": "\nFull output is too long, showing 200 out of 352 lines.\nUse more precise expression if possible.\n\nnet/dsa/dsa.c=1129=static enum dsa_tag_protocol dsa_get_tag_protocol(struct dsa_port *dp,\n--\nnet/dsa/dsa.c-1131-{\nnet/dsa/dsa.c:1132:\tenum dsa_tag_protocol tag_protocol = DSA_TAG_PROTO_NONE;\nnet/dsa/dsa.c-1133-\tstruct dsa_switch *mds, *ds = dp-\u003eds;\n--\nnet/dsa/dsa.c-1145-\t\ttag_protocol = mds-\u003eops-\u003eget_tag_protocol(mds, mdp_upstream,\nnet/dsa/dsa.c:1146:\t\t\t\t\t\t\t  DSA_TAG_PROTO_NONE);\nnet/dsa/dsa.c-1147-\t}\n--\nnet/dsa/tag_ar9331.c=90=static const struct dsa_device_ops ar9331_netdev_ops = {\nnet/dsa/tag_ar9331.c-91-\t.name\t= AR9331_NAME,\nnet/dsa/tag_ar9331.c:92:\t.proto\t= DSA_TAG_PROTO_AR9331,\nnet/dsa/tag_ar9331.c-93-\t.xmit\t= ar9331_tag_xmit,\n--\nnet/dsa/tag_ar9331.c=99=MODULE_LICENSE(\"GPL v2\");\nnet/dsa/tag_ar9331.c:100:MODULE_ALIAS_DSA_TAG_DRIVER(DSA_TAG_PROTO_AR9331, AR9331_NAME);\nnet/dsa/tag_ar9331.c-101-module_dsa_tag_driver(ar9331_netdev_ops);\n--\nnet/dsa/tag_brcm.c=89=static struct sk_buff *brcm_tag_xmit_ll(struct sk_buff *skb,\n--\nnet/dsa/tag_brcm.c-136- * -----------------------------------\nnet/dsa/tag_brcm.c:137: * | MAC DA | MAC SA | 4b tag | Type | DSA_TAG_PROTO_BRCM\nnet/dsa/tag_brcm.c-138- * -----------------------------------\nnet/dsa/tag_brcm.c-139- * -----------------------------------\nnet/dsa/tag_brcm.c:140: * | 4b tag | MAC DA | MAC SA | Type | DSA_TAG_PROTO_BRCM_PREPEND\nnet/dsa/tag_brcm.c-141- * -----------------------------------\n--\nnet/dsa/tag_brcm.c=217=static const struct dsa_device_ops brcm_netdev_ops = {\nnet/dsa/tag_brcm.c-218-\t.name\t= BRCM_NAME,\nnet/dsa/tag_brcm.c:219:\t.proto\t= DSA_TAG_PROTO_BRCM,\nnet/dsa/tag_brcm.c-220-\t.xmit\t= brcm_tag_xmit,\n--\nnet/dsa/tag_brcm.c=225=DSA_TAG_DRIVER(brcm_netdev_ops);\nnet/dsa/tag_brcm.c:226:MODULE_ALIAS_DSA_TAG_DRIVER(DSA_TAG_PROTO_BRCM, BRCM_NAME);\nnet/dsa/tag_brcm.c-227-#endif\n--\nnet/dsa/tag_brcm.c=311=static const struct dsa_device_ops brcm_legacy_netdev_ops = {\nnet/dsa/tag_brcm.c-312-\t.name = BRCM_LEGACY_NAME,\nnet/dsa/tag_brcm.c:313:\t.proto = DSA_TAG_PROTO_BRCM_LEGACY,\nnet/dsa/tag_brcm.c-314-\t.xmit = brcm_leg_tag_xmit,\n--\nnet/dsa/tag_brcm.c=319=DSA_TAG_DRIVER(brcm_legacy_netdev_ops);\nnet/dsa/tag_brcm.c:320:MODULE_ALIAS_DSA_TAG_DRIVER(DSA_TAG_PROTO_BRCM_LEGACY, BRCM_LEGACY_NAME);\nnet/dsa/tag_brcm.c-321-#endif /* CONFIG_NET_DSA_TAG_BRCM_LEGACY */\n--\nnet/dsa/tag_brcm.c=370=static const struct dsa_device_ops brcm_legacy_fcs_netdev_ops = {\nnet/dsa/tag_brcm.c-371-\t.name = BRCM_LEGACY_FCS_NAME,\nnet/dsa/tag_brcm.c:372:\t.proto = DSA_TAG_PROTO_BRCM_LEGACY_FCS,\nnet/dsa/tag_brcm.c-373-\t.xmit = brcm_leg_fcs_tag_xmit,\n--\nnet/dsa/tag_brcm.c=379=DSA_TAG_DRIVER(brcm_legacy_fcs_netdev_ops);\nnet/dsa/tag_brcm.c:380:MODULE_ALIAS_DSA_TAG_DRIVER(DSA_TAG_PROTO_BRCM_LEGACY_FCS, BRCM_LEGACY_FCS_NAME);\nnet/dsa/tag_brcm.c-381-#endif /* CONFIG_NET_DSA_TAG_BRCM_LEGACY_FCS */\n--\nnet/dsa/tag_brcm.c=398=static const struct dsa_device_ops brcm_prepend_netdev_ops = {\nnet/dsa/tag_brcm.c-399-\t.name\t= BRCM_PREPEND_NAME,\nnet/dsa/tag_brcm.c:400:\t.proto\t= DSA_TAG_PROTO_BRCM_PREPEND,\nnet/dsa/tag_brcm.c-401-\t.xmit\t= brcm_tag_xmit_prepend,\n--\nnet/dsa/tag_brcm.c=406=DSA_TAG_DRIVER(brcm_prepend_netdev_ops);\nnet/dsa/tag_brcm.c:407:MODULE_ALIAS_DSA_TAG_DRIVER(DSA_TAG_PROTO_BRCM_PREPEND, BRCM_PREPEND_NAME);\nnet/dsa/tag_brcm.c-408-#endif\n--\nnet/dsa/tag_dsa.c=351=static const struct dsa_device_ops dsa_netdev_ops = {\nnet/dsa/tag_dsa.c-352-\t.name\t  = DSA_NAME,\nnet/dsa/tag_dsa.c:353:\t.proto\t  = DSA_TAG_PROTO_DSA,\nnet/dsa/tag_dsa.c-354-\t.xmit\t  = dsa_xmit,\n--\nnet/dsa/tag_dsa.c=359=DSA_TAG_DRIVER(dsa_netdev_ops);\nnet/dsa/tag_dsa.c:360:MODULE_ALIAS_DSA_TAG_DRIVER(DSA_TAG_PROTO_DSA, DSA_NAME);\nnet/dsa/tag_dsa.c-361-#endif\t/* CONFIG_NET_DSA_TAG_DSA */\n--\nnet/dsa/tag_dsa.c=395=static const struct dsa_device_ops edsa_netdev_ops = {\nnet/dsa/tag_dsa.c-396-\t.name\t  = EDSA_NAME,\nnet/dsa/tag_dsa.c:397:\t.proto\t  = DSA_TAG_PROTO_EDSA,\nnet/dsa/tag_dsa.c-398-\t.xmit\t  = edsa_xmit,\n--\nnet/dsa/tag_dsa.c=403=DSA_TAG_DRIVER(edsa_netdev_ops);\nnet/dsa/tag_dsa.c:404:MODULE_ALIAS_DSA_TAG_DRIVER(DSA_TAG_PROTO_EDSA, EDSA_NAME);\nnet/dsa/tag_dsa.c-405-#endif\t/* CONFIG_NET_DSA_TAG_EDSA */\n--\nnet/dsa/tag_gswip.c=104=static const struct dsa_device_ops gswip_netdev_ops = {\nnet/dsa/tag_gswip.c-105-\t.name = GSWIP_NAME,\nnet/dsa/tag_gswip.c:106:\t.proto\t= DSA_TAG_PROTO_GSWIP,\nnet/dsa/tag_gswip.c-107-\t.xmit = gswip_tag_xmit,\n--\nnet/dsa/tag_gswip.c=113=MODULE_LICENSE(\"GPL\");\nnet/dsa/tag_gswip.c:114:MODULE_ALIAS_DSA_TAG_DRIVER(DSA_TAG_PROTO_GSWIP, GSWIP_NAME);\nnet/dsa/tag_gswip.c-115-\n--\nnet/dsa/tag_hellcreek.c=66=static const struct dsa_device_ops hellcreek_netdev_ops = {\nnet/dsa/tag_hellcreek.c-67-\t.name\t  = HELLCREEK_NAME,\nnet/dsa/tag_hellcreek.c:68:\t.proto\t  = DSA_TAG_PROTO_HELLCREEK,\nnet/dsa/tag_hellcreek.c-69-\t.xmit\t  = hellcreek_xmit,\n--\nnet/dsa/tag_hellcreek.c=75=MODULE_LICENSE(\"Dual MIT/GPL\");\nnet/dsa/tag_hellcreek.c:76:MODULE_ALIAS_DSA_TAG_DRIVER(DSA_TAG_PROTO_HELLCREEK, HELLCREEK_NAME);\nnet/dsa/tag_hellcreek.c-77-\n--\nnet/dsa/tag_ks8995.c=167=static const struct dsa_device_ops ks8995_netdev_ops = {\nnet/dsa/tag_ks8995.c-168-\t.name = KS8995_NAME,\nnet/dsa/tag_ks8995.c:169:\t.proto\t= DSA_TAG_PROTO_KS8995,\nnet/dsa/tag_ks8995.c-170-\t.xmit = ks8995_xmit,\n--\nnet/dsa/tag_ks8995.c=177=MODULE_LICENSE(\"GPL\");\nnet/dsa/tag_ks8995.c:178:MODULE_ALIAS_DSA_TAG_DRIVER(DSA_TAG_PROTO_KS8995, KS8995_NAME);\nnet/dsa/tag_ks8995.c-179-\n--\nnet/dsa/tag_ksz.c=306=static const struct dsa_device_ops ksz9477_netdev_ops = {\nnet/dsa/tag_ksz.c-307-\t.name\t= KSZ9477_NAME,\nnet/dsa/tag_ksz.c:308:\t.proto\t= DSA_TAG_PROTO_KSZ9477,\nnet/dsa/tag_ksz.c-309-\t.xmit\t= ksz9477_xmit,\n--\nnet/dsa/tag_ksz.c=316=DSA_TAG_DRIVER(ksz9477_netdev_ops);\nnet/dsa/tag_ksz.c:317:MODULE_ALIAS_DSA_TAG_DRIVER(DSA_TAG_PROTO_KSZ9477, KSZ9477_NAME);\nnet/dsa/tag_ksz.c-318-\n--\nnet/dsa/tag_ksz.c=358=static const struct dsa_device_ops ksz8795_netdev_ops = {\nnet/dsa/tag_ksz.c-359-\t.name\t= KSZ8795_NAME,\nnet/dsa/tag_ksz.c:360:\t.proto\t= DSA_TAG_PROTO_KSZ8795,\nnet/dsa/tag_ksz.c-361-\t.xmit\t= ksz8795_xmit,\n--\nnet/dsa/tag_ksz.c=366=DSA_TAG_DRIVER(ksz8795_netdev_ops);\nnet/dsa/tag_ksz.c:367:MODULE_ALIAS_DSA_TAG_DRIVER(DSA_TAG_PROTO_KSZ8795, KSZ8795_NAME);\nnet/dsa/tag_ksz.c-368-\n--\nnet/dsa/tag_ksz.c=384=static const struct dsa_device_ops ksz9893_netdev_ops = {\nnet/dsa/tag_ksz.c-385-\t.name\t= KSZ9893_NAME,\nnet/dsa/tag_ksz.c:386:\t.proto\t= DSA_TAG_PROTO_KSZ9893,\nnet/dsa/tag_ksz.c-387-\t.xmit\t= ksz9893_xmit,\n--\nnet/dsa/tag_ksz.c=394=DSA_TAG_DRIVER(ksz9893_netdev_ops);\nnet/dsa/tag_ksz.c:395:MODULE_ALIAS_DSA_TAG_DRIVER(DSA_TAG_PROTO_KSZ9893, KSZ9893_NAME);\nnet/dsa/tag_ksz.c-396-\n--\nnet/dsa/tag_ksz.c=448=static const struct dsa_device_ops ksz8463_netdev_ops = {\nnet/dsa/tag_ksz.c-449-\t.name\t= KSZ8463_NAME,\nnet/dsa/tag_ksz.c:450:\t.proto\t= DSA_TAG_PROTO_KSZ8463,\nnet/dsa/tag_ksz.c-451-\t.xmit\t= ksz8463_xmit,\n--\nnet/dsa/tag_ksz.c=458=DSA_TAG_DRIVER(ksz8463_netdev_ops);\nnet/dsa/tag_ksz.c:459:MODULE_ALIAS_DSA_TAG_DRIVER(DSA_TAG_PROTO_KSZ8463, KSZ8463_NAME);\nnet/dsa/tag_ksz.c-460-\n--\nnet/dsa/tag_ksz.c=519=static const struct dsa_device_ops lan937x_netdev_ops = {\nnet/dsa/tag_ksz.c-520-\t.name\t= LAN937X_NAME,\nnet/dsa/tag_ksz.c:521:\t.proto\t= DSA_TAG_PROTO_LAN937X,\nnet/dsa/tag_ksz.c-522-\t.xmit\t= lan937x_xmit,\n--\nnet/dsa/tag_ksz.c=529=DSA_TAG_DRIVER(lan937x_netdev_ops);\nnet/dsa/tag_ksz.c:530:MODULE_ALIAS_DSA_TAG_DRIVER(DSA_TAG_PROTO_LAN937X, LAN937X_NAME);\nnet/dsa/tag_ksz.c-531-\n--\nnet/dsa/tag_lan9303.c=116=static const struct dsa_device_ops lan9303_netdev_ops = {\nnet/dsa/tag_lan9303.c-117-\t.name = LAN9303_NAME,\nnet/dsa/tag_lan9303.c:118:\t.proto\t= DSA_TAG_PROTO_LAN9303,\nnet/dsa/tag_lan9303.c-119-\t.xmit = lan9303_xmit,\n--\nnet/dsa/tag_lan9303.c=125=MODULE_LICENSE(\"GPL\");\nnet/dsa/tag_lan9303.c:126:MODULE_ALIAS_DSA_TAG_DRIVER(DSA_TAG_PROTO_LAN9303, LAN9303_NAME);\nnet/dsa/tag_lan9303.c-127-\n--\nnet/dsa/tag_mt7628.c=81=static const struct dsa_device_ops mt7628_tag_ops = {\nnet/dsa/tag_mt7628.c-82-\t.name = MT7628_TAG_NAME,\nnet/dsa/tag_mt7628.c:83:\t.proto = DSA_TAG_PROTO_MT7628,\nnet/dsa/tag_mt7628.c-84-\t.xmit = mt7628_tag_xmit,\n--\nnet/dsa/tag_mt7628.c=89=module_dsa_tag_driver(mt7628_tag_ops);\nnet/dsa/tag_mt7628.c-90-\nnet/dsa/tag_mt7628.c:91:MODULE_ALIAS_DSA_TAG_DRIVER(DSA_TAG_PROTO_MT7628, MT7628_TAG_NAME);\nnet/dsa/tag_mt7628.c-92-MODULE_DESCRIPTION(\"DSA tag driver for MT7628 switch\");\n--\nnet/dsa/tag_mtk.c=102=static const struct dsa_device_ops mtk_netdev_ops = {\nnet/dsa/tag_mtk.c-103-\t.name\t\t= MTK_NAME,\nnet/dsa/tag_mtk.c:104:\t.proto\t\t= DSA_TAG_PROTO_MTK,\nnet/dsa/tag_mtk.c-105-\t.xmit\t\t= mtk_tag_xmit,\n--\nnet/dsa/tag_mtk.c=111=MODULE_LICENSE(\"GPL\");\nnet/dsa/tag_mtk.c:112:MODULE_ALIAS_DSA_TAG_DRIVER(DSA_TAG_PROTO_MTK, MTK_NAME);\nnet/dsa/tag_mtk.c-113-\n--\nnet/dsa/tag_mxl-gsw1xx.c=108=static const struct dsa_device_ops gsw1xx_netdev_ops = {\nnet/dsa/tag_mxl-gsw1xx.c-109-\t.name\t\t\t= GSW1XX_TAG_NAME,\nnet/dsa/tag_mxl-gsw1xx.c:110:\t.proto\t\t\t= DSA_TAG_PROTO_MXL_GSW1XX,\nnet/dsa/tag_mxl-gsw1xx.c-111-\t.xmit\t\t\t= gsw1xx_tag_xmit,\n--\nnet/dsa/tag_mxl-gsw1xx.c=117=MODULE_LICENSE(\"GPL\");\nnet/dsa/tag_mxl-gsw1xx.c:118:MODULE_ALIAS_DSA_TAG_DRIVER(DSA_TAG_PROTO_MXL_GSW1XX, GSW1XX_TAG_NAME);\nnet/dsa/tag_mxl-gsw1xx.c-119-\n--\nnet/dsa/tag_mxl862xx.c=104=static const struct dsa_device_ops mxl862_netdev_ops = {\nnet/dsa/tag_mxl862xx.c-105-\t.name = MXL862_NAME,\nnet/dsa/tag_mxl862xx.c:106:\t.proto = DSA_TAG_PROTO_MXL862,\nnet/dsa/tag_mxl862xx.c-107-\t.xmit = mxl862_tag_xmit,\n--\nnet/dsa/tag_mxl862xx.c-111-\nnet/dsa/tag_mxl862xx.c:112:MODULE_ALIAS_DSA_TAG_DRIVER(DSA_TAG_PROTO_MXL862, MXL862_NAME);\nnet/dsa/tag_mxl862xx.c-113-MODULE_DESCRIPTION(\"DSA tag driver for MaxLinear MxL862xx switches\");\n--\n\n"
}

5/2 2026/10/03 06:54 llm patch-evaluator
0m Model:
gemini-3.8-flash

Args:
null

Results:
null

Tokens:
							input: 26828
							output: 28
							thoughts: 186
						

Thoughts:
**Delving into DSA Switch and Tagger Implementation**

Okay, so I'm trying to wrap my head around the inner workings of DSA switches and how the taggers fit in. My initial thought is to trace the invocation process. How exactly *does* a DSA tagger get called? I recall the key methods are `.xmit` and `.rcv`. Right, so `.xmit` is triggered when a packet is *transmitted* from a DSA user netdev. And conversely, `.rcv` gets called when a packet is *received* on a DSA conduit netdev.

Now, a critical question arises: what defines a netdev as being a DSA user or DSA conduit? Ah, that would be through `dsa_register_switch()`. Excellent, that's the registration point.

But can I register a DSA switch *without* having actual physical switch hardware? I need to know if there's any mechanism for virtual or mock DSA switches in the kernel. Something like how `mock_phc` provides a test environment for PHC. It's time to check if DSA switches are purely bound to physical hardware through something like SPI, MDIO, I2C, MMIO, or PCIe.

The next step is to grep for callers of `dsa_register_switch` to understand how the architecture handles switch creation and registration. That should give me a good picture of the possible configurations.



6/2 2026/10/03 06:54 tool grepper
0m Args:
{
  "Expression": "dsa_register_switch",
  "PathPrefix": "drivers/"
}

Results:
{
  "Output": "drivers/net/dsa/b53/b53_common.c=3308=int b53_switch_register(struct b53_device *dev)\n--\ndrivers/net/dsa/b53/b53_common.c-3326-\ndrivers/net/dsa/b53/b53_common.c:3327:\treturn dsa_register_switch(dev-\u003eds);\ndrivers/net/dsa/b53/b53_common.c-3328-}\n--\ndrivers/net/dsa/dsa_loop.c=57=struct dsa_loop_pdata {\ndrivers/net/dsa/dsa_loop.c:58:\t/* Must be first, such that dsa_register_switch() can access this\ndrivers/net/dsa/dsa_loop.c-59-\t * without gory pointer manipulations\n--\ndrivers/net/dsa/dsa_loop.c=355=static int dsa_loop_drv_probe(struct mdio_device *mdiodev)\n--\ndrivers/net/dsa/dsa_loop.c-388-\ndrivers/net/dsa/dsa_loop.c:389:\tret = dsa_register_switch(ds);\ndrivers/net/dsa/dsa_loop.c-390-\tif (!ret)\n--\ndrivers/net/dsa/hirschmann/hellcreek.c=1933=static int hellcreek_probe(struct platform_device *pdev)\n--\ndrivers/net/dsa/hirschmann/hellcreek.c-2026-\ndrivers/net/dsa/hirschmann/hellcreek.c:2027:\tret = dsa_register_switch(hellcreek-\u003eds);\ndrivers/net/dsa/hirschmann/hellcreek.c-2028-\tif (ret) {\n--\ndrivers/net/dsa/lan9303-core.c=1404=static int lan9303_register_switch(struct lan9303 *chip)\n--\ndrivers/net/dsa/lan9303-core.c-1416-\ndrivers/net/dsa/lan9303-core.c:1417:\treturn dsa_register_switch(chip-\u003eds);\ndrivers/net/dsa/lan9303-core.c-1418-}\n--\ndrivers/net/dsa/lantiq/lantiq_gswip_common.c=1675=int gswip_probe_common(struct gswip_priv *priv, u32 version)\n--\ndrivers/net/dsa/lantiq/lantiq_gswip_common.c-1700-\ndrivers/net/dsa/lantiq/lantiq_gswip_common.c:1701:\terr = dsa_register_switch(priv-\u003eds);\ndrivers/net/dsa/lantiq/lantiq_gswip_common.c-1702-\tif (err)\n--\ndrivers/net/dsa/microchip/ksz_common.c=3988=int ksz_switch_register(struct ksz_device *dev)\n--\ndrivers/net/dsa/microchip/ksz_common.c-4145-\ndrivers/net/dsa/microchip/ksz_common.c:4146:\tret = dsa_register_switch(dev-\u003eds);\ndrivers/net/dsa/microchip/ksz_common.c-4147-\tif (ret)\n--\ndrivers/net/dsa/motorcomm/chip.c=4958=static int yt921x_mdio_probe(struct mdio_device *mdiodev)\n--\ndrivers/net/dsa/motorcomm/chip.c-4991-\ndrivers/net/dsa/motorcomm/chip.c:4992:\treturn dsa_register_switch(ds);\ndrivers/net/dsa/motorcomm/chip.c-4993-}\n--\ndrivers/net/dsa/mt7530-mdio.c=159=mt7530_probe(struct mdio_device *mdiodev)\n--\ndrivers/net/dsa/mt7530-mdio.c-223-\ndrivers/net/dsa/mt7530-mdio.c:224:\treturn dsa_register_switch(priv-\u003eds);\ndrivers/net/dsa/mt7530-mdio.c-225-}\n--\ndrivers/net/dsa/mt7530-mmio.c=30=mt7988_probe(struct platform_device *pdev)\n--\ndrivers/net/dsa/mt7530-mmio.c-63-\ndrivers/net/dsa/mt7530-mmio.c:64:\treturn dsa_register_switch(priv-\u003eds);\ndrivers/net/dsa/mt7530-mmio.c-65-}\n--\ndrivers/net/dsa/mt7628.c=565=static int mt7628_probe(struct platform_device *pdev)\n--\ndrivers/net/dsa/mt7628.c-606-\ndrivers/net/dsa/mt7628.c:607:\treturn dsa_register_switch(ds);\ndrivers/net/dsa/mt7628.c-608-}\n--\ndrivers/net/dsa/mv88e6060.c=304=static int mv88e6060_probe(struct mdio_device *mdiodev)\n--\ndrivers/net/dsa/mv88e6060.c-335-\ndrivers/net/dsa/mv88e6060.c:336:\treturn dsa_register_switch(ds);\ndrivers/net/dsa/mv88e6060.c-337-}\n--\ndrivers/net/dsa/mv88e6xxx/chip.c=3989=static int mv88e6xxx_setup(struct dsa_switch *ds)\n--\ndrivers/net/dsa/mv88e6xxx/chip.c-4004-\t * depends on the physical switch topology. We need to let DSA figure\ndrivers/net/dsa/mv88e6xxx/chip.c:4005:\t * that out and therefore we cannot set this at dsa_register_switch()\ndrivers/net/dsa/mv88e6xxx/chip.c-4006-\t * time.\n--\ndrivers/net/dsa/mv88e6xxx/chip.c=7320=static int mv88e6xxx_register_switch(struct mv88e6xxx_chip *chip)\n--\ndrivers/net/dsa/mv88e6xxx/chip.c-7345-\ndrivers/net/dsa/mv88e6xxx/chip.c:7346:\treturn dsa_register_switch(ds);\ndrivers/net/dsa/mv88e6xxx/chip.c-7347-}\n--\ndrivers/net/dsa/mxl862xx/mxl862xx.c=2102=static int mxl862xx_probe(struct mdio_device *mdiodev)\n--\ndrivers/net/dsa/mxl862xx/mxl862xx.c-2141-\ndrivers/net/dsa/mxl862xx/mxl862xx.c:2142:\terr = dsa_register_switch(ds);\ndrivers/net/dsa/mxl862xx/mxl862xx.c-2143-\tif (err) {\n--\ndrivers/net/dsa/netc/netc_main.c=2435=static int netc_switch_probe(struct pci_dev *pdev,\n--\ndrivers/net/dsa/netc/netc_main.c-2478-\ndrivers/net/dsa/netc/netc_main.c:2479:\terr = dsa_register_switch(ds);\ndrivers/net/dsa/netc/netc_main.c-2480-\tif (err)\n--\ndrivers/net/dsa/ocelot/felix.c=2390=int felix_register_switch(struct device *dev, resource_size_t switch_base,\n--\ndrivers/net/dsa/ocelot/felix.c-2428-\ndrivers/net/dsa/ocelot/felix.c:2429:\terr = dsa_register_switch(ds);\ndrivers/net/dsa/ocelot/felix.c-2430-\tif (err)\n--\ndrivers/net/dsa/qca/ar9331.c=1031=static int ar9331_sw_probe(struct mdio_device *mdiodev)\n--\ndrivers/net/dsa/qca/ar9331.c-1078-\ndrivers/net/dsa/qca/ar9331.c:1079:\tret = dsa_register_switch(ds);\ndrivers/net/dsa/qca/ar9331.c-1080-\tif (ret)\n--\ndrivers/net/dsa/qca/qca8k-8xxx.c=2059=qca8k_sw_probe(struct mdio_device *mdiodev)\n--\ndrivers/net/dsa/qca/qca8k-8xxx.c-2120-\ndrivers/net/dsa/qca/qca8k-8xxx.c:2121:\treturn dsa_register_switch(priv-\u003eds);\ndrivers/net/dsa/qca/qca8k-8xxx.c-2122-}\n--\ndrivers/net/dsa/realtek/rtl83xx.c=268=int rtl83xx_register_switch(struct realtek_priv *priv)\n--\ndrivers/net/dsa/realtek/rtl83xx.c-284-\ndrivers/net/dsa/realtek/rtl83xx.c:285:\tret = dsa_register_switch(ds);\ndrivers/net/dsa/realtek/rtl83xx.c-286-\tif (ret) {\n--\ndrivers/net/dsa/rzn1_a5psw.c=1207=static int a5psw_probe(struct platform_device *pdev)\n--\ndrivers/net/dsa/rzn1_a5psw.c-1262-\ndrivers/net/dsa/rzn1_a5psw.c:1263:\tret = dsa_register_switch(ds);\ndrivers/net/dsa/rzn1_a5psw.c-1264-\tif (ret) {\n--\ndrivers/net/dsa/sja1105/sja1105_main.c=3237=static int sja1105_probe(struct spi_device *spi)\n--\ndrivers/net/dsa/sja1105/sja1105_main.c-3340-\ndrivers/net/dsa/sja1105/sja1105_main.c:3341:\treturn dsa_register_switch(priv-\u003eds);\ndrivers/net/dsa/sja1105/sja1105_main.c-3342-}\n--\ndrivers/net/dsa/vitesse-vsc73xx-core.c=2333=int vsc73xx_probe(struct vsc73xx *vsc)\n--\ndrivers/net/dsa/vitesse-vsc73xx-core.c-2384-\tvsc-\u003eds-\u003ephylink_mac_ops = \u0026vsc73xx_phylink_mac_ops;\ndrivers/net/dsa/vitesse-vsc73xx-core.c:2385:\tret = dsa_register_switch(vsc-\u003eds);\ndrivers/net/dsa/vitesse-vsc73xx-core.c-2386-\tif (ret) {\n--\ndrivers/net/dsa/xrs700x/xrs700x.c=818=int xrs700x_switch_register(struct xrs700x *priv)\n--\ndrivers/net/dsa/xrs700x/xrs700x.c-841-\ndrivers/net/dsa/xrs700x/xrs700x.c:842:\treturn dsa_register_switch(priv-\u003eds);\ndrivers/net/dsa/xrs700x/xrs700x.c-843-}\n"
}

7/2 2026/10/03 06:54 llm patch-evaluator
0m Model:
gemini-3.8-flash

Args:
null

Results:
null

Tokens:
							input: 30592
							output: 39
							thoughts: 44
						

Thoughts:
Okay, let's dive into this. Here's my summary of the thought process, from my expert perspective:

**Diving into the `dsa_loop.c` Mystery**

Alright, the objective is to review `dsa_loop.c`. But hold on, the first question that pops into my head is: *What exactly is this `dsa_loop.c` file and its role in the system?* It's not immediately obvious from the name. I need more context.

Given its placement within `drivers/net/dsa/`, I immediately infer this is related to the Distributed Switch Architecture (DSA) networking subsystem. That narrows it down considerably. My immediate next step is to examine `drivers/net/dsa/dsa_loop.c` to understand precisely how it fits into the DSA architecture, what functionality it provides, and how it interacts with other DSA components. I'll be looking for clues about its purpose – is it for loopback testing, a specific network device, or some other specialized function related to DSA? I'm expecting to look for the file in the Linux kernel source code to get a deeper understanding. I need to understand what this module does.



8/2 2026/10/03 06:54 tool read-file
0m Args:
{
  "File": "drivers/net/dsa/dsa_loop.c",
  "FirstLine": 1,
  "LineCount": 80
}

Results:
{
  "Contents": "   1:\t// SPDX-License-Identifier: GPL-2.0-or-later\n   2:\t/*\n   3:\t * Distributed Switch Architecture loopback driver\n   4:\t *\n   5:\t * Copyright (C) 2016, Florian Fainelli \u003cf.fainelli@gmail.com\u003e\n   6:\t */\n   7:\t\n   8:\t#include \u003clinux/platform_device.h\u003e\n   9:\t#include \u003clinux/netdevice.h\u003e\n  10:\t#include \u003clinux/phy.h\u003e\n  11:\t#include \u003clinux/phy_fixed.h\u003e\n  12:\t#include \u003clinux/export.h\u003e\n  13:\t#include \u003clinux/ethtool.h\u003e\n  14:\t#include \u003clinux/workqueue.h\u003e\n  15:\t#include \u003clinux/module.h\u003e\n  16:\t#include \u003clinux/if_bridge.h\u003e\n  17:\t#include \u003clinux/if_vlan.h\u003e\n  18:\t#include \u003clinux/types.h\u003e\n  19:\t#include \u003cnet/dsa.h\u003e\n  20:\t\n  21:\t#define DSA_LOOP_NUM_PORTS\t6\n  22:\t#define DSA_LOOP_CPU_PORT\t(DSA_LOOP_NUM_PORTS - 1)\n  23:\t#define NUM_FIXED_PHYS\t\t(DSA_LOOP_NUM_PORTS - 2)\n  24:\t\n  25:\tstruct dsa_loop_vlan {\n  26:\t\tu16 members;\n  27:\t\tu16 untagged;\n  28:\t};\n  29:\t\n  30:\tstruct dsa_loop_mib_entry {\n  31:\t\tchar name[ETH_GSTRING_LEN];\n  32:\t\tunsigned long val;\n  33:\t};\n  34:\t\n  35:\tenum dsa_loop_mib_counters {\n  36:\t\tDSA_LOOP_PHY_READ_OK,\n  37:\t\tDSA_LOOP_PHY_READ_ERR,\n  38:\t\tDSA_LOOP_PHY_WRITE_OK,\n  39:\t\tDSA_LOOP_PHY_WRITE_ERR,\n  40:\t\t__DSA_LOOP_CNT_MAX,\n  41:\t};\n  42:\t\n  43:\tstruct dsa_loop_port {\n  44:\t\tstruct dsa_loop_mib_entry mib[__DSA_LOOP_CNT_MAX];\n  45:\t\tu16 pvid;\n  46:\t\tint mtu;\n  47:\t};\n  48:\t\n  49:\tstruct dsa_loop_priv {\n  50:\t\tstruct mii_bus\t*bus;\n  51:\t\tunsigned int\tport_base;\n  52:\t\tstruct dsa_loop_vlan vlans[VLAN_N_VID];\n  53:\t\tstruct net_device *netdev;\n  54:\t\tstruct dsa_loop_port ports[DSA_MAX_PORTS];\n  55:\t};\n  56:\t\n  57:\tstruct dsa_loop_pdata {\n  58:\t\t/* Must be first, such that dsa_register_switch() can access this\n  59:\t\t * without gory pointer manipulations\n  60:\t\t */\n  61:\t\tstruct dsa_chip_data cd;\n  62:\t\tconst char *name;\n  63:\t\tunsigned int enabled_ports;\n  64:\t\tconst char *netdev;\n  65:\t};\n  66:\t\n  67:\tstatic struct dsa_loop_mib_entry dsa_loop_mibs[] = {\n  68:\t\t[DSA_LOOP_PHY_READ_OK]\t= { \"phy_read_ok\", },\n  69:\t\t[DSA_LOOP_PHY_READ_ERR]\t= { \"phy_read_err\", },\n  70:\t\t[DSA_LOOP_PHY_WRITE_OK] = { \"phy_write_ok\", },\n  71:\t\t[DSA_LOOP_PHY_WRITE_ERR] = { \"phy_write_err\", },\n  72:\t};\n  73:\t\n  74:\tstatic struct phy_device *phydevs[PHY_MAX_ADDR];\n  75:\tstatic struct mdio_device *switch_mdiodev;\n  76:\t\n  77:\tenum dsa_loop_devlink_resource_id {\n  78:\t\tDSA_LOOP_DEVLINK_PARAM_ID_NONE,  /* DEVLINK_RESOURCE_ID_PARENT_TOP */\n  79:\t\tDSA_LOOP_DEVLINK_PARAM_ID_VTU,\n  80:\t};\n"
}

9/2 2026/10/03 06:54 llm patch-evaluator
0m Model:
gemini-3.8-flash

Args:
null

Results:
null

Tokens:
							input: 32102
							output: 38
							thoughts: 16
						

Thoughts:
Okay, here's my interpretation of what's going on, thinking through `dsa_loop.c` and specifically `get_tag_protocol`:

**Deconstructing `get_tag_protocol` in `dsa_loop.c`**

Alright, let's dive into `dsa_loop.c` and focus on `get_tag_protocol`. My initial thought is that this function is *crucial*. It's almost certainly the gatekeeper for interpreting and validating the data tags that are used in this module. We need to understand how the system determines *what* type of data is associated with a given tag, before we even *think* about processing it.

My hypothesis is that it likely starts by taking some sort of input, perhaps the tag itself as a numeric identifier, or maybe a structured tag object. Then, it probably uses a look-up table, a switch statement, or a more sophisticated algorithm to map that input to a specific protocol identifier. I would expect it to return an enumeration or a defined constant that represents the data protocol associated with that tag.

I'm imagining error handling is key here. What happens if the tag is invalid or unknown? Does it return an error code, log a warning, or trigger some kind of recovery procedure? I'm betting that's handled within this function, to ensure data integrity and avoid crashes down the line. We need to look closely at its return value and how it signals success or failure. I'll need to trace its error paths to understand how the system recovers when it encounters bad data or unexpected tags.

I'd also be very interested in what happens if this function *is* called multiple times and on what context this is done. I'd need to consider if it caches any information to optimize look-up times or whether the cache could lead to side effects or potential vulnerabilities. I need to be sure that the lookup it does isn't vulnerable to some kind of lookup attack.

I anticipate the code in this function sets a security boundary for the rest of the application. It looks to me like a likely place for all sorts of bugs to be hiding.



10/2 2026/10/03 06:54 tool grepper
0m Args:
{
  "Expression": "get_tag_protocol",
  "PathPrefix": "drivers/net/dsa/dsa_loop.c"
}

Results:
{
  "Output": "drivers/net/dsa/dsa_loop.c=334=static const struct dsa_switch_ops dsa_loop_driver = {\ndrivers/net/dsa/dsa_loop.c:335:\t.get_tag_protocol\t= dsa_loop_get_protocol,\ndrivers/net/dsa/dsa_loop.c-336-\t.setup\t\t\t= dsa_loop_setup,\n"
}

11/2 2026/10/03 06:54 llm patch-evaluator
0m Model:
gemini-3.8-flash

Args:
null

Results:
null

Tokens:
							input: 32720
							output: 41
							thoughts: 17
						

Thoughts:
Okay, let's dive into this. Here's my take on understanding this `dsa_loop_get_protocol` function, assuming I'm already pretty familiar with the overall system:

**Analyzing `dsa_loop_get_protocol`**

Right, let me pull up the code for `dsa_loop_get_protocol`. I'm going to assume this is related to some kind of Digital Signal Analysis (DSA) loop. The name itself suggests we're getting the communication protocol used within that loop, which could be anything from a simple handshake to a complex, proprietary format. I'll need to look at the function's definition.

My initial thoughts are that I'll be looking for things like:

*   **Input Parameters:** What does this function take as input? Is it a loop handle, some context structure, or something else entirely? The input parameters will hint at where the protocol information is stored.
*   **Return Value:** What does it return? Likely a protocol identifier or some kind of enumerated type representing the protocol. I need to understand the meaning of that return.
*   **Internal Logic:** The core of the function. Is it looking at a configuration structure, reading from a register, or calling other functions to determine the protocol? Understanding this will be key to understanding the full context.
*   **Error Handling:** It's unlikely it would be missing, let's see how it handles potential errors. What happens if the loop isn't initialized or the protocol can't be determined? Are there error codes or exceptions?

I'm anticipating that this is probably a straightforward function, maybe not too complex, but I'll need to dissect it to be sure. I'm hoping it's well-documented so I don't have to wade through a ton of code to figure out what's going on. Once I understand the implementation, I need to relate it back to the overall DSA system architecture to see how this function is used and its importance. So let's get to it.



12/2 2026/10/03 06:54 tool grepper
0m Args:
{
  "Expression": "dsa_loop_get_protocol",
  "PathPrefix": "drivers/net/dsa/dsa_loop.c"
}

Results:
{
  "Output": "drivers/net/dsa/dsa_loop.c=97=static int dsa_loop_setup_devlink_resources(struct dsa_switch *ds)\n--\ndrivers/net/dsa/dsa_loop.c-124-\ndrivers/net/dsa/dsa_loop.c:125:static enum dsa_tag_protocol dsa_loop_get_protocol(struct dsa_switch *ds,\ndrivers/net/dsa/dsa_loop.c-126-\t\t\t\t\t\t   int port,\n--\ndrivers/net/dsa/dsa_loop.c=334=static const struct dsa_switch_ops dsa_loop_driver = {\ndrivers/net/dsa/dsa_loop.c:335:\t.get_tag_protocol\t= dsa_loop_get_protocol,\ndrivers/net/dsa/dsa_loop.c-336-\t.setup\t\t\t= dsa_loop_setup,\n"
}

13/2 2026/10/03 06:54 llm patch-evaluator
0m Model:
gemini-3.8-flash

Args:
null

Results:
null

Tokens:
							input: 33456
							output: 41
							thoughts: 19
						

Thoughts:
Okay, let's dive into this. Here's my thought process on the matter:

**Analyzing dsa_loop.c around Line 125**

Alright, I'm thinking we should zero in on `dsa_loop.c` and specifically, let's take a look around line 125. *Why* line 125? Well, without context, it's hard to say precisely, but in this domain, a specific line number likely indicates we're addressing a particular function or a segment of code that's been flagged for review, perhaps in a code review, during debugging, or in addressing a bug report. It's likely we're focusing on a critical algorithm or data structure operation. I expect to find something of particular interest to the topic. Let's see what's going on there. I'm ready to find out!



14/2 2026/10/03 06:54 tool read-file
0m Args:
{
  "File": "drivers/net/dsa/dsa_loop.c",
  "FirstLine": 120,
  "LineCount": 20
}

Results:
{
  "Contents": " 120:\tout:\n 121:\t\tdsa_devlink_resources_unregister(ds);\n 122:\t\treturn err;\n 123:\t}\n 124:\t\n 125:\tstatic enum dsa_tag_protocol dsa_loop_get_protocol(struct dsa_switch *ds,\n 126:\t\t\t\t\t\t\t   int port,\n 127:\t\t\t\t\t\t\t   enum dsa_tag_protocol mp)\n 128:\t{\n 129:\t\tdev_dbg(ds-\u003edev, \"%s: port: %d\\n\", __func__, port);\n 130:\t\n 131:\t\treturn DSA_TAG_PROTO_NONE;\n 132:\t}\n 133:\t\n 134:\tstatic int dsa_loop_setup(struct dsa_switch *ds)\n 135:\t{\n 136:\t\tstruct dsa_loop_priv *ps = ds-\u003epriv;\n 137:\t\tunsigned int i;\n 138:\t\n 139:\t\tfor (i = 0; i \u003c ds-\u003enum_ports; i++)\n"
}

15/2 2026/10/03 06:54 llm patch-evaluator
0m Model:
gemini-3.8-flash

Args:
null

Results:
null

Tokens:
							input: 34002
							output: 29
							thoughts: 342
						

Thoughts:
**Analyzing the DSA Tagging Protocol Implementation**

Okay, so `dsa_loop` is using `DSA_TAG_PROTO_NONE`. That's the starting point. Now, what's happening with this switch driver modification? I need to get a clear picture. The patch is touching a substantial amount of code: the `MAINTAINERS` file, various `Kconfig` and `Makefile` entries, and multiple `.c` and `.h` files within the `drivers/net/dsa/motorcomm/` directory, including `chip.c`, `mdio_bus.c`, and `pcs-922x.c`. Plus, there are changes to `include/net/dsa.h` and the DSA core's `Kconfig`, `Makefile`, and `tag_yt922x.c`. That's a lot to digest.

The key question now is, can we actually reach `tag_yt922x.c`? Or, more broadly, how is this new `yt921x` switch driver invoked? I'm trying to see if this driver is actually operational, based on the code changes.

Wait a minute, how are DSA tag drivers actually *invoked* or modified? This is crucial. Can userspace dynamically change the tag drivers at runtime via netlink, sysfs, ethtool, iproute2, or devlink? Is there a mechanism to select or alter the tagging protocol for a DSA conduit or port? I need to see if the DSA core allows for changes to the tagging protocol by userspace applications. I'll need to search for something like "change_tag_protocol" or any indication of tag protocol alteration within the DSA core code. This is where the rubber meets the road: is this just an implementation, or is this implementable?



16/2 2026/10/03 06:54 tool grepper
0m Args:
{
  "Expression": "change_tag_protocol",
  "PathPrefix": "net/dsa"
}

Results:
{
  "Output": "net/dsa/dsa.c=570=static int dsa_switch_setup_tag_protocol(struct dsa_switch *ds)\n--\nnet/dsa/dsa.c-579-\trtnl_lock();\nnet/dsa/dsa.c:580:\terr = ds-\u003eops-\u003echange_tag_protocol(ds, tag_ops-\u003eproto);\nnet/dsa/dsa.c-581-\trtnl_unlock();\n--\nnet/dsa/dsa.c=1155=static int dsa_port_parse_cpu(struct dsa_port *dp, struct net_device *conduit,\n--\nnet/dsa/dsa.c-1176-\tif (user_protocol) {\nnet/dsa/dsa.c:1177:\t\tif (!ds-\u003eops-\u003echange_tag_protocol) {\nnet/dsa/dsa.c-1178-\t\t\tdev_err(ds-\u003edev, \"Tag protocol cannot be modified\\n\");\n--\nnet/dsa/dsa.c-1230-\t * dsa_switch_setup_tag_protocol once .setup has run and the\nnet/dsa/dsa.c:1231:\t * driver is ready to accept calls to .change_tag_protocol. If\nnet/dsa/dsa.c-1232-\t * the driver does not support the custom protocol at that\n--\nnet/dsa/switch.c=873=static int dsa_switch_change_tag_proto(struct dsa_switch *ds,\n--\nnet/dsa/switch.c-879-\nnet/dsa/switch.c:880:\tif (!ds-\u003eops-\u003echange_tag_protocol)\nnet/dsa/switch.c-881-\t\treturn -EOPNOTSUPP;\n--\nnet/dsa/switch.c-884-\nnet/dsa/switch.c:885:\terr = ds-\u003eops-\u003echange_tag_protocol(ds, tag_ops-\u003eproto);\nnet/dsa/switch.c-886-\tif (err)\n"
}

17/2 2026/10/03 06:54 llm patch-evaluator
0m Model:
gemini-3.8-flash

Args:
null

Results:
null

Tokens:
							input: 35296
							output: 34
							thoughts: 47
						

Thoughts:
Okay, here's my thought process on this, assuming I'm already pretty familiar with network device driver internals, specifically DSA (Distributed Switch Architecture) within the Linux kernel:

**Finding the Callers of `dsa_switch_change_tag_proto`**

Right, let's dive in. I need to understand how `dsa_switch_change_tag_proto` is being used. That function is pretty important, it's about changing the tagging protocol used by the switch. So, the most direct way to figure out how it's being used is to find its callers. I'm going to start by looking within `net/dsa/switch.c` itself to remind myself of its purpose, but the real work will be in tracking down where it's *called* from. I'm going to quickly reach for `grep` and search the kernel source tree for all instances of `dsa_switch_change_tag_proto`. That should give me a list of all the functions that directly invoke it. Then, I can start analyzing *those* functions to see how they fit into the larger DSA picture. I'm expecting this will probably tell me a bit about how the DSA switch tagging protocol is managed within the kernel.



18/2 2026/10/03 06:54 tool grepper
0m Args:
{
  "Expression": "dsa_switch_change_tag_proto",
  "PathPrefix": "net/dsa"
}

Results:
{
  "Output": "net/dsa/switch.c=853=static int dsa_switch_host_vlan_del(struct dsa_switch *ds,\n--\nnet/dsa/switch.c-872-\nnet/dsa/switch.c:873:static int dsa_switch_change_tag_proto(struct dsa_switch *ds,\nnet/dsa/switch.c-874-\t\t\t\t       struct dsa_notifier_tag_proto_info *info)\n--\nnet/dsa/switch.c=974=static int dsa_switch_event(struct notifier_block *nb,\n--\nnet/dsa/switch.c-1044-\tcase DSA_NOTIFIER_TAG_PROTO:\nnet/dsa/switch.c:1045:\t\terr = dsa_switch_change_tag_proto(ds, info);\nnet/dsa/switch.c-1046-\t\tbreak;\n"
}

19/2 2026/10/03 06:54 llm patch-evaluator
0m Model:
gemini-3.8-flash

Args:
null

Results:
null

Tokens:
							input: 35882
							output: 32
							thoughts: 27
						

Thoughts:
Here's my thought process, as if I were thinking it:

**Tracing the Source of a Protocol Tag**

Okay, so I need to figure out where `DSA_NOTIFIER_TAG_PROTO` is being sent from. This isn't immediately obvious, so I need to track down its origin. My first instinct, given I'm dealing with a protocol-related identifier, is to use a simple grep. Let's fire that up and see where this tag is actually *used* within the codebase. Hopefully, a quick search will give me a direct line to the relevant sender. I'm expecting this will quickly lead me to the core logic.



20/2 2026/10/03 06:54 tool grepper
0m Args:
{
  "Expression": "DSA_NOTIFIER_TAG_PROTO",
  "PathPrefix": "net/dsa"
}

Results:
{
  "Output": "net/dsa/dsa.c=948=static int dsa_tree_bind_tag_proto(struct dsa_switch_tree *dst,\n--\nnet/dsa/dsa.c-960-\tinfo.tag_ops = tag_ops;\nnet/dsa/dsa.c:961:\terr = dsa_tree_notify(dst, DSA_NOTIFIER_TAG_PROTO_CONNECT, \u0026info);\nnet/dsa/dsa.c-962-\tif (err \u0026\u0026 err != -EOPNOTSUPP)\n--\nnet/dsa/dsa.c-966-\tinfo.tag_ops = old_tag_ops;\nnet/dsa/dsa.c:967:\tdsa_tree_notify(dst, DSA_NOTIFIER_TAG_PROTO_DISCONNECT, \u0026info);\nnet/dsa/dsa.c-968-\n--\nnet/dsa/dsa.c-972-\tinfo.tag_ops = tag_ops;\nnet/dsa/dsa.c:973:\tdsa_tree_notify(dst, DSA_NOTIFIER_TAG_PROTO_DISCONNECT, \u0026info);\nnet/dsa/dsa.c-974-\tdst-\u003etag_ops = old_tag_ops;\n--\nnet/dsa/dsa.c=983=int dsa_tree_change_tag_proto(struct dsa_switch_tree *dst,\n--\nnet/dsa/dsa.c-1008-\tinfo.tag_ops = tag_ops;\nnet/dsa/dsa.c:1009:\terr = dsa_tree_notify(dst, DSA_NOTIFIER_TAG_PROTO, \u0026info);\nnet/dsa/dsa.c-1010-\tif (err)\n--\nnet/dsa/dsa.c-1022-\tinfo.tag_ops = old_tag_ops;\nnet/dsa/dsa.c:1023:\tdsa_tree_notify(dst, DSA_NOTIFIER_TAG_PROTO, \u0026info);\nnet/dsa/dsa.c-1024-out_unlock:\n--\nnet/dsa/switch.c=974=static int dsa_switch_event(struct notifier_block *nb,\n--\nnet/dsa/switch.c-1043-\t\tbreak;\nnet/dsa/switch.c:1044:\tcase DSA_NOTIFIER_TAG_PROTO:\nnet/dsa/switch.c-1045-\t\terr = dsa_switch_change_tag_proto(ds, info);\nnet/dsa/switch.c-1046-\t\tbreak;\nnet/dsa/switch.c:1047:\tcase DSA_NOTIFIER_TAG_PROTO_CONNECT:\nnet/dsa/switch.c-1048-\t\terr = dsa_switch_connect_tag_proto(ds, info);\nnet/dsa/switch.c-1049-\t\tbreak;\nnet/dsa/switch.c:1050:\tcase DSA_NOTIFIER_TAG_PROTO_DISCONNECT:\nnet/dsa/switch.c-1051-\t\terr = dsa_switch_disconnect_tag_proto(ds, info);\n--\nnet/dsa/switch.h=10=enum {\n--\nnet/dsa/switch.h-31-\tDSA_NOTIFIER_MTU,\nnet/dsa/switch.h:32:\tDSA_NOTIFIER_TAG_PROTO,\nnet/dsa/switch.h:33:\tDSA_NOTIFIER_TAG_PROTO_CONNECT,\nnet/dsa/switch.h:34:\tDSA_NOTIFIER_TAG_PROTO_DISCONNECT,\nnet/dsa/switch.h-35-\tDSA_NOTIFIER_TAG_8021Q_VLAN_ADD,\n--\nnet/dsa/switch.h=92=struct dsa_notifier_mtu_info {\n--\nnet/dsa/switch.h-96-\nnet/dsa/switch.h:97:/* DSA_NOTIFIER_TAG_PROTO_* */\nnet/dsa/switch.h-98-struct dsa_notifier_tag_proto_info {\n"
}

21/2 2026/10/03 06:54 llm patch-evaluator
0m Model:
gemini-3.8-flash

Args:
null

Results:
null

Tokens:
							input: 37134
							output: 34
							thoughts: 21
						

Thoughts:
Okay, let's dive into this code.

**Investigating the Call Sites of `dsa_tree_change_tag_proto`**

Right, so I need to understand the impact of this `dsa_tree_change_tag_proto` function. My first step, as always, is to trace its usage. I'll need to locate all the places within the codebase where this function is called. This will give me a clear picture of how it's being used, what the typical inputs are, and ultimately, what parts of the system are potentially affected by its behavior. This will likely involve a combination of static analysis and potentially some runtime debugging if the call sites aren't immediately obvious. I expect to find some interesting patterns once I identify all the callers. It will be helpful to know the context of the calling functions to better understand their intention.



22/2 2026/10/03 06:54 tool grepper
0m Args:
{
  "Expression": "dsa_tree_change_tag_proto",
  "PathPrefix": "net/dsa"
}

Results:
{
  "Output": "net/dsa/conduit.c=350=static ssize_t tagging_store(struct device *d, struct device_attribute *attr,\n--\nnet/dsa/conduit.c-380-\nnet/dsa/conduit.c:381:\terr = dsa_tree_change_tag_proto(cpu_dp-\u003eds-\u003edst, new_tag_ops,\nnet/dsa/conduit.c-382-\t\t\t\t\told_tag_ops);\n--\nnet/dsa/dsa.c=948=static int dsa_tree_bind_tag_proto(struct dsa_switch_tree *dst,\n--\nnet/dsa/dsa.c-982- */\nnet/dsa/dsa.c:983:int dsa_tree_change_tag_proto(struct dsa_switch_tree *dst,\nnet/dsa/dsa.c-984-\t\t\t      const struct dsa_device_ops *tag_ops,\n--\nnet/dsa/dsa.h=24=struct net_device *dsa_tree_find_first_conduit(struct dsa_switch_tree *dst);\nnet/dsa/dsa.h:25:int dsa_tree_change_tag_proto(struct dsa_switch_tree *dst,\nnet/dsa/dsa.h-26-\t\t\t      const struct dsa_device_ops *tag_ops,\n--\nnet/dsa/switch.c=873=static int dsa_switch_change_tag_proto(struct dsa_switch *ds,\n--\nnet/dsa/switch.c-900-\nnet/dsa/switch.c:901:\t\t/* rtnl_mutex is held in dsa_tree_change_tag_proto */\nnet/dsa/switch.c-902-\t\tdsa_user_change_mtu(user, user-\u003emtu);\n"
}

23/2 2026/10/03 06:54 llm patch-evaluator
0m Model:
gemini-3.8-flash

Args:
null

Results:
null

Tokens:
							input: 37851
							output: 37
							thoughts: 43
						

Thoughts:
Here's my analysis of the provided snippet, rendered as your assumed thought process:

**Diving into DSA Conduit Tagging**

Alright, so the clue here points us directly to `tagging_store` within `net/dsa/conduit.c`. Given my understanding of DSA (Distributed Switch Architecture) and conduits, I immediately recognize this function as a critical component. It's likely involved in how data packets are tagged or classified as they traverse the switch fabric, specifically at the conduit level. I need to understand how these tags are stored and manipulated. Let's zero in on `net/dsa/conduit.c` and take a look around line 350. That should give me a good entry point to see what's going on within that function.



24/2 2026/10/03 06:54 tool read-file
0m Args:
{
  "File": "net/dsa/conduit.c",
  "FirstLine": 345,
  "LineCount": 50
}

Results:
{
  "Contents": " 345:\t\n 346:\t\treturn sysfs_emit(buf, \"%s\\n\",\n 347:\t\t\t       dsa_tag_protocol_to_str(cpu_dp-\u003etag_ops));\n 348:\t}\n 349:\t\n 350:\tstatic ssize_t tagging_store(struct device *d, struct device_attribute *attr,\n 351:\t\t\t\t     const char *buf, size_t count)\n 352:\t{\n 353:\t\tconst struct dsa_device_ops *new_tag_ops, *old_tag_ops;\n 354:\t\tconst char *end = strchrnul(buf, '\\n'), *name;\n 355:\t\tstruct net_device *dev = to_net_dev(d);\n 356:\t\tstruct dsa_port *cpu_dp = dev-\u003edsa_ptr;\n 357:\t\tsize_t len = end - buf;\n 358:\t\tint err;\n 359:\t\n 360:\t\t/* Empty string passed */\n 361:\t\tif (!len)\n 362:\t\t\treturn -ENOPROTOOPT;\n 363:\t\n 364:\t\tname = kstrndup(buf, len, GFP_KERNEL);\n 365:\t\tif (!name)\n 366:\t\t\treturn -ENOMEM;\n 367:\t\n 368:\t\told_tag_ops = cpu_dp-\u003etag_ops;\n 369:\t\tnew_tag_ops = dsa_tag_driver_get_by_name(name);\n 370:\t\tkfree(name);\n 371:\t\t/* Bad tagger name? */\n 372:\t\tif (IS_ERR(new_tag_ops))\n 373:\t\t\treturn PTR_ERR(new_tag_ops);\n 374:\t\n 375:\t\tif (new_tag_ops == old_tag_ops)\n 376:\t\t\t/* Drop the temporarily held duplicate reference, since\n 377:\t\t\t * the DSA switch tree uses this tagger.\n 378:\t\t\t */\n 379:\t\t\tgoto out;\n 380:\t\n 381:\t\terr = dsa_tree_change_tag_proto(cpu_dp-\u003eds-\u003edst, new_tag_ops,\n 382:\t\t\t\t\t\told_tag_ops);\n 383:\t\tif (err) {\n 384:\t\t\t/* On failure the old tagger is restored, so we don't need the\n 385:\t\t\t * driver for the new one.\n 386:\t\t\t */\n 387:\t\t\tdsa_tag_driver_put(new_tag_ops);\n 388:\t\t\treturn err;\n 389:\t\t}\n 390:\t\n 391:\t\t/* On success we no longer need the module for the old tagging protocol\n 392:\t\t */\n 393:\tout:\n 394:\t\tdsa_tag_driver_put(old_tag_ops);\n"
}

25/2 2026/10/03 06:54 llm patch-evaluator
0m Model:
gemini-3.8-flash

Args:
null

Results:
null

Tokens:
							input: 38871
							output: 38
							thoughts: 266
						

Thoughts:
**Investigating Tag Protocol Changes in the DSA Subsystem**

Okay, here's what's running through my head as I dig into this code. I've got my eye on line 380 in `conduit.c`: `err = dsa_tree_change_tag_proto(cpu_dp->ds->dst, new_tag_ops, old_tag_ops);`. That function call, `dsa_tree_change_tag_proto`, is critical here. Peeking inside, I see it's setting the tag operations, using `info.tag_ops = tag_ops;` and then triggering a notification with `dsa_tree_notify(dst, DSA_NOTIFIER_TAG_PROTO, &info);`.

Following that, this notification ultimately leads to a call to `dsa_switch_change_tag_proto`. And in there, if the switch in question *doesn't* have a `change_tag_protocol` implementation, or if it doesn't support the specific tag protocol, the whole operation fails with `-EOPNOTSUPP`. That's the crux of the problem, right?

So, if a switch doesn't support the protocol, it'll fail... but does `dsa_loop` provide this functionality? I can't assume anything. I need to be sure. Time to check `dsa_loop.c`! I should probably check `drivers/net/dsa/dsa_loop.c` to be precise. Let's see if that driver specifically provides a `change_tag_protocol` function. It's the only way to be certain that this isn't the root cause of the issue!



26/2 2026/10/03 06:54 tool grepper
0m Error:
no matches

Args:
{
  "Expression": "change_tag_protocol",
  "PathPrefix": "drivers/net/dsa/dsa_loop.c"
}

Results:
{
  "error": "no matches"
}

27/2 2026/10/03 06:54 llm patch-evaluator
0m Model:
gemini-3.8-flash

Args:
null

Results:
null

Tokens:
							input: 39554
							output: 32
							thoughts: 39
						

Thoughts:
Okay, here's my take on those thoughts, tailored for an expert audience:

**Investigating `change_tag_protocol` Implementation**

Alright, so `dsa_loop.c` is *not* the place where we're going to find the `change_tag_protocol` function. That's a key piece of information.  Now, the question becomes: which components *do* implement this functionality? We need to figure out where that's handled. My immediate instinct is to fire up `grepper` and get a quick overview. Let's start by searching the codebase to determine where `change_tag_protocol` *is* actually defined. That should point us to the relevant modules or files that are responsible for this particular protocol switching mechanism. We'll be able to quickly zero in on the key players.



28/2 2026/10/03 06:54 tool grepper
0m Args:
{
  "Expression": "\\.change_tag_protocol",
  "PathPrefix": "drivers/net/dsa"
}

Results:
{
  "Output": "drivers/net/dsa/mv88e6xxx/chip.c=7256=static const struct dsa_switch_ops mv88e6xxx_switch_ops = {\ndrivers/net/dsa/mv88e6xxx/chip.c-7257-\t.get_tag_protocol\t= mv88e6xxx_get_tag_protocol,\ndrivers/net/dsa/mv88e6xxx/chip.c:7258:\t.change_tag_protocol\t= mv88e6xxx_change_tag_protocol,\ndrivers/net/dsa/mv88e6xxx/chip.c-7259-\t.setup\t\t\t= mv88e6xxx_setup,\n--\ndrivers/net/dsa/ocelot/felix.c=2306=static const struct dsa_switch_ops felix_switch_ops = {\ndrivers/net/dsa/ocelot/felix.c-2307-\t.get_tag_protocol\t\t= felix_get_tag_protocol,\ndrivers/net/dsa/ocelot/felix.c:2308:\t.change_tag_protocol\t\t= felix_change_tag_protocol,\ndrivers/net/dsa/ocelot/felix.c-2309-\t.connect_tag_protocol\t\t= felix_connect_tag_protocol,\n--\ndrivers/net/dsa/realtek/rtl8365mb_main.c=3414=static const struct dsa_switch_ops rtl8365mb_switch_ops = {\ndrivers/net/dsa/realtek/rtl8365mb_main.c-3415-\t.get_tag_protocol = rtl8365mb_get_tag_protocol,\ndrivers/net/dsa/realtek/rtl8365mb_main.c:3416:\t.change_tag_protocol = rtl8365mb_change_tag_protocol,\ndrivers/net/dsa/realtek/rtl8365mb_main.c-3417-\t.setup = rtl8365mb_setup,\n"
}

29/2 2026/10/03 06:54 llm patch-evaluator
0m Model:
gemini-3.8-flash

Args:
null

Results:
null

Tokens:
							input: 40336
							output: 32
							thoughts: 613
						

Thoughts:
**My Analysis of DSA Tag Protocol Implementation**

Okay, so I'm looking at how different switch drivers handle tagging protocols within the DSA framework. It seems only `mv88e6xxx`, `felix`, and `rtl8365mb` implement the `change_tag_protocol` function. And even then, they're pretty restrictive, only supporting their own specific tagging protocols: EDSA and DSA for the Marvell chip, Ocelot and Seville for the Broadcom chip, and RTL8 protocols for Realtek.

Now, I'm thinking about `DSA_TAG_PROTO_YT922X`. The only place that uses *that* tag protocol is `drivers/net/dsa/motorcomm/chip.c`. That's a bit odd. I'd better check that file out.

Ah, okay, `chip.c` has a function called `yt922x_dsa_get_tag_protocol` that *always* returns `DSA_TAG_PROTO_YT922X`. But, I'm trying to figure out if it implements `change_tag_protocol` – and nope! Not at all.

So, how is `motorcomm/chip.c` even instantiated, then? Let's trace it back. The driver registration looks like a standard `mdio_driver`: `yt921x_mdio_driver`. It has `probe`, `remove`, and `shutdown` functions and is of type `mdio_driver`. It's using an `of_match_table` to get its compatible devices.

Okay, let me think this through. It's an MDIO driver. That means it likely uses an `of_match_table` and is associated with a specific device with the compatible properties, which makes me think it must be associated with the device.

But the key question is: can MDIO devices *be* created from userspace? Or, put another way, is it possible to bind an MDIO device or bus without physical MDIO hardware? If this *is* possible, this could have some really interesting implications on how this driver could be used. I had better dig into the kernel code and see how MDIO devices are actually instantiated.



30/2 2026/10/03 06:54 tool grepper
0m Args:
{
  "Expression": "mdio_device_create",
  "PathPrefix": "drivers/net/mdio"
}

Results:
{
  "Output": "drivers/net/mdio/of_mdio.c=52=static int of_mdiobus_register_device(struct mii_bus *mdio,\n--\ndrivers/net/mdio/of_mdio.c-58-\ndrivers/net/mdio/of_mdio.c:59:\tmdiodev = mdio_device_create(mdio, addr);\ndrivers/net/mdio/of_mdio.c-60-\tif (IS_ERR(mdiodev))\n"
}

31/2 2026/10/03 06:54 llm patch-evaluator
0m Model:
gemini-3.8-flash

Args:
null

Results:
null

Tokens:
							input: 41594
							output: 20
							thoughts: 19
						

Thoughts:
Here's my thought process, as requested:

**Tracing the Call Path of `mdio_device_create`**

Okay, so I need to understand the usage of `mdio_device_create` within the kernel. My first instinct, given my experience, is to jump straight to the source and see where this function is actually *called*. I'll need to use a tool to perform a comprehensive search across the kernel source tree. Let's start with a tool like `grep` or `cscope`, or even use the more advanced features of my IDE. The goal is to quickly locate all instances of `mdio_device_create` being invoked. This will give me an immediate overview of its role within different subsystems or device drivers. I want to see where it's being *created* and used, to understand how the MDIO devices are integrated within the broader kernel architecture. From there, I can determine the common patterns and contexts in which this function is involved.



32/2 2026/10/03 06:54 tool grepper
0m Args:
{
  "Expression": "mdio_device_create"
}

Results:
{
  "Output": "drivers/net/dsa/dsa_loop.c=446=static int __init dsa_loop_create_switch_mdiodev(void)\n--\ndrivers/net/dsa/dsa_loop.c-466-\ndrivers/net/dsa/dsa_loop.c:467:\tswitch_mdiodev = mdio_device_create(bus, 31);\ndrivers/net/dsa/dsa_loop.c-468-\tif (IS_ERR(switch_mdiodev))\n--\ndrivers/net/mdio/of_mdio.c=52=static int of_mdiobus_register_device(struct mii_bus *mdio,\n--\ndrivers/net/mdio/of_mdio.c-58-\ndrivers/net/mdio/of_mdio.c:59:\tmdiodev = mdio_device_create(mdio, addr);\ndrivers/net/mdio/of_mdio.c-60-\tif (IS_ERR(mdiodev))\n--\ndrivers/net/pcs/pcs-lynx.c=355=struct phylink_pcs *lynx_pcs_create_mdiodev(struct mii_bus *bus, int addr)\n--\ndrivers/net/pcs/pcs-lynx.c-359-\ndrivers/net/pcs/pcs-lynx.c:360:\tmdio = mdio_device_create(bus, addr);\ndrivers/net/pcs/pcs-lynx.c-361-\tif (IS_ERR(mdio))\n--\ndrivers/net/pcs/pcs-xpcs-plat.c=337=static int xpcs_plat_init_dev(struct dw_xpcs_plat *pxpcs)\n--\ndrivers/net/pcs/pcs-xpcs-plat.c-343-\t/* There is a single memory-mapped DW XPCS device */\ndrivers/net/pcs/pcs-xpcs-plat.c:344:\tmdiodev = mdio_device_create(pxpcs-\u003ebus, 0);\ndrivers/net/pcs/pcs-xpcs-plat.c-345-\tif (IS_ERR(mdiodev))\n--\ndrivers/net/pcs/pcs-xpcs.c=1623=struct dw_xpcs *xpcs_create_mdiodev(struct mii_bus *bus, int addr)\n--\ndrivers/net/pcs/pcs-xpcs.c-1627-\ndrivers/net/pcs/pcs-xpcs.c:1628:\tmdiodev = mdio_device_create(bus, addr);\ndrivers/net/pcs/pcs-xpcs.c-1629-\tif (IS_ERR(mdiodev))\n--\ndrivers/net/phy/air_en8811h.c=1131=static int an8811hb_probe(struct phy_device *phydev)\n--\ndrivers/net/phy/air_en8811h.c-1150-\t */\ndrivers/net/phy/air_en8811h.c:1151:\tmdiodev = mdio_device_create(phydev-\u003emdio.bus,\ndrivers/net/phy/air_en8811h.c-1152-\t\t\t\t     phydev-\u003emdio.addr + EN8811H_PBUS_ADDR_OFFS);\n--\ndrivers/net/phy/mdio_device.c=113=static void mdio_device_release(struct device *dev)\n--\ndrivers/net/phy/mdio_device.c-118-\ndrivers/net/phy/mdio_device.c:119:struct mdio_device *mdio_device_create(struct mii_bus *bus, int addr)\ndrivers/net/phy/mdio_device.c-120-{\n--\ndrivers/net/phy/mdio_device.c-142-}\ndrivers/net/phy/mdio_device.c:143:EXPORT_SYMBOL(mdio_device_create);\ndrivers/net/phy/mdio_device.c-144-\n--\ninclude/linux/mdio.h=94=void mdio_device_free(struct mdio_device *mdiodev);\ninclude/linux/mdio.h:95:struct mdio_device *mdio_device_create(struct mii_bus *bus, int addr);\ninclude/linux/mdio.h-96-int mdio_device_register(struct mdio_device *mdiodev);\n"
}

33/2 2026/10/03 06:55 llm patch-evaluator
0m Model:
gemini-3.8-flash

Args:
null

Results:
null

Tokens:
							input: 42963
							output: 27
							thoughts: 919
						

Thoughts:
**Analyzing the Motorcomm Ethernet Switch Driver on amd64 VMs**

Okay, let's break this down. My initial thought was to see if I could somehow instantiate the `motorcomm/chip.c` driver, specifically the `yt9215` or `yt9224` devices, in a QEMU or GCE environment on amd64. I know that the `of_mdiobus_register_device` function is only called during device tree parsing, which is a good starting point to trace the instantiation. I see that `dsa_loop.c` creates a dummy fixed-phy MDIO bus, but the goal is to get the `motorcomm` driver instantiated, not a loopback.

Diving into `yt921x_mdio_probe`, it's clear that the driver reads registers via the MDIO bus to determine the chip ID.  Specifically, `yt92xx_register_switch` calls `yt921x_reg_read`, which is going to hit physical hardware registers! This is a dead end. Even if I could somehow force the creation of an MDIO device via DeviceTree, the `yt921x_reg_read` function would fail because there's no actual Motorcomm switch present in a standard QEMU or GCE environment on amd64.  So that's not going to work.

Next thought: What about the DSA tag driver, `net/dsa/tag_yt922x.c`?  Could *that* be reached without the switch hardware? I need to understand how the tag driver functions in the overall DSA architecture. The `module_dsa_tag_driver` call seems promising. Then, the definition of `yt922x_netdev_ops` shows the key functions: `xmit` and `rcv`.

The question becomes: Can this tag driver be used if no DSA switch using it exists? Let's check how those `xmit` and `rcv` functions are called by tracing the DSA codebase. I'm going to search for where the `proto->rcv` and `proto->xmit` are used.



34/2 2026/10/03 06:55 tool grepper
0m Args:
{
  "Expression": "-\u003exmit",
  "PathPrefix": "net/dsa"
}

Results:
{
  "Output": "net/dsa/tag_ksz.c=47=static void ksz_disconnect(struct dsa_switch *ds)\n--\nnet/dsa/tag_ksz.c-50-\nnet/dsa/tag_ksz.c:51:\tkthread_destroy_worker(priv-\u003exmit_worker);\nnet/dsa/tag_ksz.c-52-\tkfree(priv);\n--\nnet/dsa/tag_ksz.c=56=static int ksz_connect(struct dsa_switch *ds)\n--\nnet/dsa/tag_ksz.c-74-\nnet/dsa/tag_ksz.c:75:\tpriv-\u003exmit_worker = xmit_worker;\nnet/dsa/tag_ksz.c-76-\t/* Export functions for switch driver use */\n--\nnet/dsa/tag_ksz.c=183=static struct sk_buff *ksz_defer_xmit(struct dsa_port *dp, struct sk_buff *skb)\n--\nnet/dsa/tag_ksz.c-194-\nnet/dsa/tag_ksz.c:195:\txmit_work_fn = tagger_data-\u003exmit_work_fn;\nnet/dsa/tag_ksz.c:196:\txmit_worker = priv-\u003exmit_worker;\nnet/dsa/tag_ksz.c-197-\n--\nnet/dsa/tag_ocelot_8021q.c=24=static struct sk_buff *ocelot_defer_xmit(struct dsa_port *dp,\n--\nnet/dsa/tag_ocelot_8021q.c-32-\nnet/dsa/tag_ocelot_8021q.c:33:\txmit_work_fn = data-\u003exmit_work_fn;\nnet/dsa/tag_ocelot_8021q.c:34:\txmit_worker = priv-\u003exmit_worker;\nnet/dsa/tag_ocelot_8021q.c-35-\n--\nnet/dsa/tag_ocelot_8021q.c=101=static void ocelot_disconnect(struct dsa_switch *ds)\n--\nnet/dsa/tag_ocelot_8021q.c-104-\nnet/dsa/tag_ocelot_8021q.c:105:\tkthread_destroy_worker(priv-\u003exmit_worker);\nnet/dsa/tag_ocelot_8021q.c-106-\tkfree(priv);\n--\nnet/dsa/tag_ocelot_8021q.c=110=static int ocelot_connect(struct dsa_switch *ds)\n--\nnet/dsa/tag_ocelot_8021q.c-118-\nnet/dsa/tag_ocelot_8021q.c:119:\tpriv-\u003exmit_worker = kthread_run_worker(0, \"felix_xmit\");\nnet/dsa/tag_ocelot_8021q.c:120:\tif (IS_ERR(priv-\u003exmit_worker)) {\nnet/dsa/tag_ocelot_8021q.c:121:\t\terr = PTR_ERR(priv-\u003exmit_worker);\nnet/dsa/tag_ocelot_8021q.c-122-\t\tkfree(priv);\n--\nnet/dsa/tag_sja1105.c=140=static struct sk_buff *sja1105_defer_xmit(struct dsa_port *dp,\n--\nnet/dsa/tag_sja1105.c-148-\nnet/dsa/tag_sja1105.c:149:\txmit_work_fn = tagger_data-\u003exmit_work_fn;\nnet/dsa/tag_sja1105.c:150:\txmit_worker = priv-\u003exmit_worker;\nnet/dsa/tag_sja1105.c-151-\n--\nnet/dsa/tag_sja1105.c=701=static void sja1105_disconnect(struct dsa_switch *ds)\n--\nnet/dsa/tag_sja1105.c-704-\nnet/dsa/tag_sja1105.c:705:\tkthread_destroy_worker(priv-\u003exmit_worker);\nnet/dsa/tag_sja1105.c-706-\tkfree(priv);\n--\nnet/dsa/tag_sja1105.c=710=static int sja1105_connect(struct dsa_switch *ds)\n--\nnet/dsa/tag_sja1105.c-729-\nnet/dsa/tag_sja1105.c:730:\tpriv-\u003exmit_worker = xmit_worker;\nnet/dsa/tag_sja1105.c-731-\tds-\u003etagger_data = priv;\n--\nnet/dsa/user.c=914=static netdev_tx_t dsa_user_xmit(struct sk_buff *skb, struct net_device *dev)\n--\nnet/dsa/user.c-941-\t */\nnet/dsa/user.c:942:\tnskb = p-\u003exmit(skb, dev);\nnet/dsa/user.c-943-\tif (!nskb)\n--\nnet/dsa/user.c=2697=void dsa_user_setup_tagger(struct net_device *user)\n--\nnet/dsa/user.c-2713-\nnet/dsa/user.c:2714:\tp-\u003exmit = cpu_dp-\u003etag_ops-\u003exmit;\nnet/dsa/user.c-2715-\n"
}

35/2 2026/10/03 06:55 llm patch-evaluator
0m Model:
gemini-3.8-flash

Args:
null

Results:
null

Tokens:
							input: 45902
							output: 30
							thoughts: 58
						

Thoughts:
Here's my summary, as the expert:

**Investigating DSA User Netdev Transmission and Reception**

Okay, so I'm thinking about how data gets transmitted and received on this DSA user netdev. Specifically, I'm focusing on `dsa_user_xmit`, which I know is the transmit function – that's `dsa_user_netdev_ops.ndo_start_xmit`, right? Makes sense. Now, the natural next question is: How does the data get *received*? I need to track down where the `rcv` function is used. Time to trace its call sites and see how the ingress path is handled. It's all about understanding the complete lifecycle of a packet, from transmission to reception, within this DSA user context.



36/2 2026/10/03 06:55 tool grepper
0m Args:
{
  "Expression": "tag_ops-\u003ercv",
  "PathPrefix": "net/dsa"
}

Results:
{
  "Output": "net/dsa/port.c=1567=void dsa_port_set_tag_protocol(struct dsa_port *cpu_dp,\n--\nnet/dsa/port.c-1569-{\nnet/dsa/port.c:1570:\tcpu_dp-\u003ercv = tag_ops-\u003ercv;\nnet/dsa/port.c-1571-\tcpu_dp-\u003etag_ops = tag_ops;\n"
}

37/2 2026/10/03 06:55 llm patch-evaluator
0m Model:
gemini-3.8-flash

Args:
null

Results:
null

Tokens:
							input: 46280
							output: 30
							thoughts: 21
						

Thoughts:
Here's my thought process, as if I were analyzing that text:

**Investigating the Call Site of `cpu_dp->rcv`**

Okay, so I see a call to `cpu_dp->rcv` and my first instinct is to understand its context. Where is this function actually *used*? To get that information quickly and efficiently, I'm going to leverage my go-to tool for this kind of exploration: `grepper`. I'll use `grepper` to search the codebase and pinpoint every instance where that specific function, `cpu_dp->rcv`, is invoked. This will give me a clear picture of the call sites and, from there, I can begin to understand the flow and purpose of this specific function.



38/2 2026/10/03 06:55 tool grepper
0m Args:
{
  "Expression": "cpu_dp-\u003ercv",
  "PathPrefix": "net/dsa"
}

Results:
{
  "Output": "net/dsa/port.c=1567=void dsa_port_set_tag_protocol(struct dsa_port *cpu_dp,\n--\nnet/dsa/port.c-1569-{\nnet/dsa/port.c:1570:\tcpu_dp-\u003ercv = tag_ops-\u003ercv;\nnet/dsa/port.c-1571-\tcpu_dp-\u003etag_ops = tag_ops;\n--\nnet/dsa/tag.c=54=static int dsa_switch_rcv(struct sk_buff *skb, struct net_device *dev,\n--\nnet/dsa/tag.c-86-\t} else {\nnet/dsa/tag.c:87:\t\tnskb = cpu_dp-\u003ercv(skb, dev);\nnet/dsa/tag.c-88-\t}\n"
}

39/2 2026/10/03 06:55 llm patch-evaluator
0m Model:
gemini-3.8-flash

Args:
null

Results:
null

Tokens:
							input: 46718
							output: 30
							thoughts: 150
						

Thoughts:
**My DSA Switch Tree Exploration**

Okay, so I'm thinking about how these `xmit` and `rcv` functions depend on a DSA port, specifically one configured with a tagger. That makes sense. But the real question is, how does this DSA switch tree come into existence in the first place, and how does it get linked to these network devices?

My initial thought is to dive into the DSA tree creation process. Let's see... it looks like `dsa_tree_touch` is the key function. It gets called when a switch calls `dsa_register_switch(ds)`. Alright, that's the basic mechanism.

Now, a more interesting question is, can we manipulate this process? Specifically, can I trigger this switch tree creation using tools like syzkaller or even from userspace without a driver probing first? I'm wondering if there's a back door.

To figure this out, I'll need to investigate for any exposed interfaces. Let's look for a netlink or sysfs interface that would allow creating a DSA switch directly. I'll do a quick `grep` in `net/dsa/` for `rtnl_link_ops` or anything else that might provide such an interface. This is where I'll get the answer.



40/2 2026/10/03 06:55 tool grepper
0m Args:
{
  "Expression": "rtnl_link_register",
  "PathPrefix": "net/dsa"
}

Results:
{
  "Output": "net/dsa/dsa.c=1865=static int __init dsa_init_module(void)\n--\nnet/dsa/dsa.c-1879-\nnet/dsa/dsa.c:1880:\trc = rtnl_link_register(\u0026dsa_link_ops);\nnet/dsa/dsa.c-1881-\tif (rc)\n"
}

41/2 2026/10/03 06:55 llm patch-evaluator
0m Model:
gemini-3.8-flash

Args:
null

Results:
null

Tokens:
							input: 47288
							output: 30
							thoughts: 15
						

Thoughts:
Okay, let's dive into this. Here's my take on those thoughts, as if they're my own:

**Investigating `dsa_link_ops`**

Alright, time to get my hands dirty. My initial reaction is pure curiosity, a slight hum of anticipation. *`dsa_link_ops`*... that sounds like a function pointer table, or a structure containing function pointers, specifically relating to Direct System Access (DSA) and links. Given my expertise, I already have some ideas floating around in the back of my head: likely interacting with network device drivers, or potentially managing hardware resources in a specific system architecture, maybe even virtualization. The name screams "operations," so I'm expecting to find functions for creating, destroying, configuring, or otherwise managing network links within a DSA context. I need to get a better sense of where this is defined and how it is used. Let's see what's actually under the hood. Time to dig in and clarify what `dsa_link_ops` actually *is*.



42/2 2026/10/03 06:55 tool grepper
0m Args:
{
  "Expression": "dsa_link_ops",
  "PathPrefix": "net/dsa"
}

Results:
{
  "Output": "net/dsa/dsa.c=1865=static int __init dsa_init_module(void)\n--\nnet/dsa/dsa.c-1879-\nnet/dsa/dsa.c:1880:\trc = rtnl_link_register(\u0026dsa_link_ops);\nnet/dsa/dsa.c-1881-\tif (rc)\n--\nnet/dsa/dsa.c=1898=static void __exit dsa_cleanup_module(void)\n--\nnet/dsa/dsa.c-1901-\nnet/dsa/dsa.c:1902:\trtnl_link_unregister(\u0026dsa_link_ops);\nnet/dsa/dsa.c-1903-\n--\nnet/dsa/netlink.c=45=static int dsa_fill_info(struct sk_buff *skb, const struct net_device *dev)\n--\nnet/dsa/netlink.c-54-\nnet/dsa/netlink.c:55:struct rtnl_link_ops dsa_link_ops __read_mostly = {\nnet/dsa/netlink.c-56-\t.kind\t\t\t= \"dsa\",\n--\nnet/dsa/netlink.h-5-\nnet/dsa/netlink.h:6:extern struct rtnl_link_ops dsa_link_ops __read_mostly;\nnet/dsa/netlink.h-7-\n--\nnet/dsa/user.c=2758=int dsa_user_create(struct dsa_port *port)\n--\nnet/dsa/user.c-2784-\nnet/dsa/user.c:2785:\tuser_dev-\u003ertnl_link_ops = \u0026dsa_link_ops;\nnet/dsa/user.c-2786-\tuser_dev-\u003eethtool_ops = \u0026dsa_user_ethtool_ops;\n"
}

43/2 2026/10/03 06:55 llm patch-evaluator
0m Model:
gemini-3.8-flash

Args:
null

Results:
null

Tokens:
							input: 48059
							output: 36
							thoughts: 21
						

Thoughts:
Here's a summary of my mental process:

**Diving into `net/dsa/netlink.c`**

Okay, I need to get into the weeds of how DSA interacts with Netlink. My mental map immediately goes to `net/dsa/netlink.c`, specifically around line 55. This suggests that the area around that line must be a key entry point, a central point of configuration, or a place where a significant architectural choice is made within the DSA subsystem in relation to Netlink interactions. I'll need to understand the data structures and functions being called there, the error handling, and the overall control flow to truly grasp its implications. My focus will be on the details surrounding line 55; I need to see what's happening *there* and how it fits into the broader picture.



44/2 2026/10/03 06:55 tool read-file
0m Args:
{
  "File": "net/dsa/netlink.c",
  "FirstLine": 40,
  "LineCount": 40
}

Results:
{
  "Contents": "  40:\t{\n  41:\t\treturn nla_total_size(sizeof(u32)) +\t/* IFLA_DSA_CONDUIT  */\n  42:\t\t       0;\n  43:\t}\n  44:\t\n  45:\tstatic int dsa_fill_info(struct sk_buff *skb, const struct net_device *dev)\n  46:\t{\n  47:\t\tstruct net_device *conduit = dsa_user_to_conduit(dev);\n  48:\t\n  49:\t\tif (nla_put_u32(skb, IFLA_DSA_CONDUIT, conduit-\u003eifindex))\n  50:\t\t\treturn -EMSGSIZE;\n  51:\t\n  52:\t\treturn 0;\n  53:\t}\n  54:\t\n  55:\tstruct rtnl_link_ops dsa_link_ops __read_mostly = {\n  56:\t\t.kind\t\t\t= \"dsa\",\n  57:\t\t.priv_size\t\t= sizeof(struct dsa_port),\n  58:\t\t.maxtype\t\t= IFLA_DSA_MAX,\n  59:\t\t.policy\t\t\t= dsa_policy,\n  60:\t\t.changelink\t\t= dsa_changelink,\n  61:\t\t.get_size\t\t= dsa_get_size,\n  62:\t\t.fill_info\t\t= dsa_fill_info,\n  63:\t\t.netns_refund\t\t= true,\n  64:\t};\n"
}

45/2 2026/10/03 06:55 llm patch-evaluator
0m Model:
gemini-3.8-flash

Args:
null

Results:
null

Tokens:
							input: 48684
							output: 38
							thoughts: 2103
						

Thoughts:
**Analyzing DSA Tagging Protocols and Reachability**

Okay, so I'm looking at this `dsa_link_ops` structure and I see it's missing the `.newlink` and `.setup` functions, focusing solely on `.changelink`, `.get_size`, and `.fill_info`. That's a key observation. This means you can't create a DSA netdev using `ip link add type dsa`. The only way to get these DSA ports or switches is via `dsa_register_switch()`. And the switches are registered by a driver calling that function.

Now, let's look at the drivers themselves. Specifically, `drivers/net/dsa/motorcomm/chip.c`. This looks like it's for the YT921x and YT922x chips. But here's where it gets interesting. Can this driver even be probed or loaded in a standard QEMU/GCE amd64 environment? I need to check the probe function and device matching within `chip.c`.

It's an `mdio_driver` and has:
```c
static const struct of_device_id yt921x_of_match[] = {
	{ .compatible = "motorcomm,yt9215" },
	{ .compatible = "motorcomm,yt9224" },
	{}
};
MODULE_DEVICE_TABLE(of, yt921x_of_match);

static struct mdio_driver yt921x_mdio_driver = {
	.probe = yt921x_mdio_probe,
	.remove = yt921x_mdio_remove,
	.shutdown = yt921x_mdio_shutdown,
	.mdiodrv.driver = {
		.name = YT921X_NAME,
		.of_match_table = yt921x_of_match,
	},
};
mdio_module_driver(yt921x_mdio_driver);
```
So it's an MDIO driver looking for a Motorcomm YT9215 or YT9224 chip. But in the QEMU/GCE amd64 environment, there's no MDIO bus with that kind of switch chip! The Motorcomm YT9215/YT9224 are physical hardware switch ASICs. I'm running an emulated environment, so these chips aren't present.

Now, let's circle back to the negative criteria in Section 2. I need to make sure I haven't missed something. The section clearly states I should return `WorthFuzzing=false` only if all modified code falls into specific categories. One of them is: "Structurally unreachable hardware: Vendor-specific PCIe switches, SmartNICs, or GPU drivers... requiring physical ASIC/PCIe cards not emulated in standard QEMU".

So, I have: `drivers/net/dsa/motorcomm/chip.c`, `drivers/net/dsa/motorcomm/pcs-922x.c`, `drivers/net/dsa/motorcomm/mdio_bus.c`, and finally, `net/dsa/tag_yt922x.c`. Does the presence of `net/dsa/tag_yt922x.c` automatically make everything unreachable? That's what I need to figure out.

I need to understand if `net/dsa/tag_yt922x.c` can be reached even without the Motorcomm hardware. How could `yt922x_tag_xmit` or `yt922x_tag_rcv` *ever* be executed in the absence of the Motorcomm hardware?

Let's trace references to `DSA_TAG_PROTO_YT922X`:
1.  `include/net/dsa.h` defines `DSA_TAG_PROTO_YT922X = 37`.
2.  `drivers/net/dsa/motorcomm/chip.c` contains `yt922x_dsa_get_tag_protocol`, which returns `DSA_TAG_PROTO_YT922X`.
3.  `net/dsa/tag_yt922x.c` has `MODULE_ALIAS_DSA_TAG_DRIVER(DSA_TAG_PROTO_YT922X, ...)` and `yt922x_netdev_ops.proto = DSA_TAG_PROTO_YT922X`.

I need to check, could *another* driver also use the `DSA_TAG_PROTO_


46/2 2026/10/03 06:55 tool grepper
0m Args:
{
  "Expression": "mv88e6xxx_change_tag_protocol",
  "PathPrefix": "drivers/net/dsa"
}

Results:
{
  "Output": "drivers/net/dsa/mv88e6xxx/chip.c=6715=static enum dsa_tag_protocol mv88e6xxx_get_tag_protocol(struct dsa_switch *ds,\n--\ndrivers/net/dsa/mv88e6xxx/chip.c-6723-\ndrivers/net/dsa/mv88e6xxx/chip.c:6724:static int mv88e6xxx_change_tag_protocol(struct dsa_switch *ds,\ndrivers/net/dsa/mv88e6xxx/chip.c-6725-\t\t\t\t\t enum dsa_tag_protocol proto)\n--\ndrivers/net/dsa/mv88e6xxx/chip.c=7256=static const struct dsa_switch_ops mv88e6xxx_switch_ops = {\ndrivers/net/dsa/mv88e6xxx/chip.c-7257-\t.get_tag_protocol\t= mv88e6xxx_get_tag_protocol,\ndrivers/net/dsa/mv88e6xxx/chip.c:7258:\t.change_tag_protocol\t= mv88e6xxx_change_tag_protocol,\ndrivers/net/dsa/mv88e6xxx/chip.c-7259-\t.setup\t\t\t= mv88e6xxx_setup,\n"
}

47/2 2026/10/03 06:55 llm patch-evaluator
0m Model:
gemini-3.8-flash

Args:
null

Results:
null

Tokens:
							input: 52199
							output: 46
							thoughts: 38
						

Thoughts:
Okay, here's my interpretation of that thought process, assuming I'm deep in the weeds of network driver development:

**Diving into the MV88E6XXX Tag Protocol Change Function**

Alright, time to dig in. I need to understand how the Marvell 88E6XXX switch driver handles the change of its tag protocol. That function, `mv88e6xxx_change_tag_protocol`, in `drivers/net/dsa/mv88e6xxx/chip.c` is the likely place to start. This is where the core logic will reside. I need to quickly get a sense of how it's implemented. I'm probably looking for:

*   How the function handles different tag protocols (QCA, DSA, etc.)
*   If there are specific hardware registers that are altered.
*   The overall flow and any potential side effects of making this change, what dependencies are.
*   Potential error conditions or checks that are in place to ensure a valid transition.

I'll start by making sure it is the correct place to look, and scanning the function definition.



48/2 2026/10/03 06:55 tool read-file
0m Args:
{
  "File": "drivers/net/dsa/mv88e6xxx/chip.c",
  "FirstLine": 6724,
  "LineCount": 25
}

Results:
{
  "Contents": "6724:\tstatic int mv88e6xxx_change_tag_protocol(struct dsa_switch *ds,\n6725:\t\t\t\t\t\t enum dsa_tag_protocol proto)\n6726:\t{\n6727:\t\tstruct mv88e6xxx_chip *chip = ds-\u003epriv;\n6728:\t\tenum dsa_tag_protocol old_protocol;\n6729:\t\tstruct dsa_port *cpu_dp;\n6730:\t\tint err;\n6731:\t\n6732:\t\tswitch (proto) {\n6733:\t\tcase DSA_TAG_PROTO_EDSA:\n6734:\t\t\tswitch (chip-\u003einfo-\u003eedsa_support) {\n6735:\t\t\tcase MV88E6XXX_EDSA_UNSUPPORTED:\n6736:\t\t\t\treturn -EPROTONOSUPPORT;\n6737:\t\t\tcase MV88E6XXX_EDSA_UNDOCUMENTED:\n6738:\t\t\t\tdev_warn(chip-\u003edev, \"Relying on undocumented EDSA tagging behavior\\n\");\n6739:\t\t\t\tfallthrough;\n6740:\t\t\tcase MV88E6XXX_EDSA_SUPPORTED:\n6741:\t\t\t\tbreak;\n6742:\t\t\t}\n6743:\t\t\tbreak;\n6744:\t\tcase DSA_TAG_PROTO_DSA:\n6745:\t\t\tbreak;\n6746:\t\tdefault:\n6747:\t\t\treturn -EPROTONOSUPPORT;\n6748:\t\t}\n"
}

49/2 2026/10/03 06:55 llm patch-evaluator
0m Model:
gemini-3.8-flash

Args:
null

Results:
null

Tokens:
							input: 52915
							output: 44
							thoughts: 57
						

Thoughts:
Okay, here's my take on those thoughts, tailored for an expert audience:

**Analyzing the mv88e6xxx Tag Protocol Limitation**

Alright, so the `mv88e6xxx` driver is pretty specific about its acceptable tagging protocols. It's only going to play ball with `DSA_TAG_PROTO_EDSA` and `DSA_TAG_PROTO_DSA`. Anything else, and we're getting a clear `-EPROTONOSUPPORT` error. That's a pretty hard stop, no negotiation. Now, my next move is to immediately pivot and scrutinize the `felix_change_tag_protocol` function. I need to understand what's happening there, what protocols it's attempting to utilize, and where the discrepancy between its intentions and the `mv88e6xxx`'s limitations might be. Is it trying to set a protocol not in that accepted list? Is there a translation layer missing or malfunctioning? I have a feeling the answer will emerge soon after reviewing that function.



50/2 2026/10/03 06:55 tool read-file
0m Args:
{
  "File": "drivers/net/dsa/ocelot/felix.c",
  "FirstLine": 1460,
  "LineCount": 35
}

Results:
{
  "Contents": "1460:\t\terr = felix_parse_ports_node(felix, ports_node, port_phy_modes);\n1461:\t\tof_node_put(ports_node);\n1462:\t\n1463:\t\treturn err;\n1464:\t}\n1465:\t\n1466:\tstatic struct regmap *felix_request_regmap_by_name(struct felix *felix,\n1467:\t\t\t\t\t\t\t   const char *resource_name)\n1468:\t{\n1469:\t\tstruct ocelot *ocelot = \u0026felix-\u003eocelot;\n1470:\t\tstruct resource res;\n1471:\t\tint i;\n1472:\t\n1473:\t\t/* In an MFD configuration, regmaps are registered directly to the\n1474:\t\t * parent device before the child devices are probed, so there is no\n1475:\t\t * need to initialize a new one.\n1476:\t\t */\n1477:\t\tif (!felix-\u003einfo-\u003eresources)\n1478:\t\t\treturn dev_get_regmap(ocelot-\u003edev-\u003eparent, resource_name);\n1479:\t\n1480:\t\tfor (i = 0; i \u003c felix-\u003einfo-\u003enum_resources; i++) {\n1481:\t\t\tif (strcmp(resource_name, felix-\u003einfo-\u003eresources[i].name))\n1482:\t\t\t\tcontinue;\n1483:\t\n1484:\t\t\tmemcpy(\u0026res, \u0026felix-\u003einfo-\u003eresources[i], sizeof(res));\n1485:\t\t\tres.start += felix-\u003eswitch_base;\n1486:\t\t\tres.end += felix-\u003eswitch_base;\n1487:\t\n1488:\t\t\treturn ocelot_regmap_init(ocelot, \u0026res);\n1489:\t\t}\n1490:\t\n1491:\t\treturn ERR_PTR(-ENOENT);\n1492:\t}\n1493:\t\n1494:\tstatic struct regmap *felix_request_regmap(struct felix *felix,\n"
}

51/2 2026/10/03 06:55 llm patch-evaluator
0m Model:
gemini-3.8-flash

Args:
null

Results:
null

Tokens:
							input: 53781
							output: 38
							thoughts: 22
						

Thoughts:
Here's my thought process, as if I were working through this:

**Locating the `felix_change_tag_protocol` Function**

Okay, so I need to find the definition of `felix_change_tag_protocol`. It's likely a function, and given the naming convention, it's probably defined within the `felix.c` source file. That's the obvious first place to look. I'll need to use my editor's search function, or, if I'm feeling fancy and the project uses tools like `grep` or `ack`, I'll fire one of those up. The goal is pinpointing the exact location of that function's implementation within `felix.c`, so I can see what it's doing and how it operates. That's the crucial first step.



52/2 2026/10/03 06:55 tool grepper
0m Args:
{
  "Expression": "felix_change_tag_protocol",
  "PathPrefix": "drivers/net/dsa/ocelot"
}

Results:
{
  "Output": "drivers/net/dsa/ocelot/felix.c=732=felix_tag_proto_setup_shared(struct dsa_switch *ds,\n--\ndrivers/net/dsa/ocelot/felix.c-753- */\ndrivers/net/dsa/ocelot/felix.c:754:static int felix_change_tag_protocol(struct dsa_switch *ds,\ndrivers/net/dsa/ocelot/felix.c-755-\t\t\t\t     enum dsa_tag_protocol proto)\n--\ndrivers/net/dsa/ocelot/felix.c=1696=static int felix_setup(struct dsa_switch *ds)\n--\ndrivers/net/dsa/ocelot/felix.c-1751-\t */\ndrivers/net/dsa/ocelot/felix.c:1752:\tfelix_change_tag_protocol(ds, felix-\u003etag_proto);\ndrivers/net/dsa/ocelot/felix.c-1753-\n--\ndrivers/net/dsa/ocelot/felix.c=2306=static const struct dsa_switch_ops felix_switch_ops = {\ndrivers/net/dsa/ocelot/felix.c-2307-\t.get_tag_protocol\t\t= felix_get_tag_protocol,\ndrivers/net/dsa/ocelot/felix.c:2308:\t.change_tag_protocol\t\t= felix_change_tag_protocol,\ndrivers/net/dsa/ocelot/felix.c-2309-\t.connect_tag_protocol\t\t= felix_connect_tag_protocol,\n"
}

53/2 2026/10/03 06:55 llm patch-evaluator
0m Model:
gemini-3.8-flash

Args:
null

Results:
null

Tokens:
							input: 54457
							output: 43
							thoughts: 21
						

Thoughts:
Okay, here's my interpretation of that thought process, tailored for an expert audience, and written in the first person:

**Analyzing the `felix_change_tag_protocol`**

Right, let's zero in on `felix_change_tag_protocol`. Specifically, I want to re-examine line 754. My initial assessment is that this specific piece of code is likely a core element of the overall system's tag management. I will need to understand the control flow at this point to get a comprehensive understanding. Given that it is at the 754th line, I'd expect it to be a key element for the entire function. I will check for any dependencies or side effects as well. Now, let's take a look.



54/2 2026/10/03 06:55 tool read-file
0m Args:
{
  "File": "drivers/net/dsa/ocelot/felix.c",
  "FirstLine": 754,
  "LineCount": 20
}

Results:
{
  "Contents": " 754:\tstatic int felix_change_tag_protocol(struct dsa_switch *ds,\n 755:\t\t\t\t\t     enum dsa_tag_protocol proto)\n 756:\t{\n 757:\t\tconst struct felix_tag_proto_ops *old_proto_ops, *proto_ops;\n 758:\t\tstruct ocelot *ocelot = ds-\u003epriv;\n 759:\t\tstruct felix *felix = ocelot_to_felix(ocelot);\n 760:\t\tint err;\n 761:\t\n 762:\t\tswitch (proto) {\n 763:\t\tcase DSA_TAG_PROTO_SEVILLE:\n 764:\t\tcase DSA_TAG_PROTO_OCELOT:\n 765:\t\t\tproto_ops = \u0026felix_tag_npi_proto_ops;\n 766:\t\t\tbreak;\n 767:\t\tcase DSA_TAG_PROTO_OCELOT_8021Q:\n 768:\t\t\tproto_ops = \u0026felix_tag_8021q_proto_ops;\n 769:\t\t\tbreak;\n 770:\t\tdefault:\n 771:\t\t\treturn -EPROTONOSUPPORT;\n 772:\t\t}\n 773:\t\n"
}

55/2 2026/10/03 06:55 llm patch-evaluator
0m Model:
gemini-3.8-flash

Args:
null

Results:
null

Tokens:
							input: 55021
							output: 41
							thoughts: 40
						

Thoughts:
Okay, here's my take on those thoughts, framed as an expert's internal monologue:

**Focusing on Target Protocols**

Right, so I see Felix is explicitly configured to support only three tag protocols: SEVILLE, OCELOT, and OCELOT_8021Q. Makes sense, given the target hardware or software profile. Now, the next logical step is to dive into the `rtl8365mb_change_tag_protocol` function. This is where the real meat of the logic will lie – that's where the tag protocols get set, modified, or verified for the rtl8365mb. I need to understand how *that* specific function handles these three protocols, and what's handled if a different protocol is requested. This function will be the key to understanding how these protocols are applied to the targeted switch and is therefore the next point of interest.



56/2 2026/10/03 06:55 tool grepper
0m Args:
{
  "Expression": "rtl8365mb_change_tag_protocol",
  "PathPrefix": "drivers/net/dsa/realtek"
}

Results:
{
  "Output": "drivers/net/dsa/realtek/rtl8365mb_main.c=2974=static int rtl8365mb_cpu_config(struct realtek_priv *priv)\n--\ndrivers/net/dsa/realtek/rtl8365mb_main.c-3002-\ndrivers/net/dsa/realtek/rtl8365mb_main.c:3003:static int rtl8365mb_change_tag_protocol(struct dsa_switch *ds,\ndrivers/net/dsa/realtek/rtl8365mb_main.c-3004-\t\t\t\t\t enum dsa_tag_protocol proto)\n--\ndrivers/net/dsa/realtek/rtl8365mb_main.c=3414=static const struct dsa_switch_ops rtl8365mb_switch_ops = {\ndrivers/net/dsa/realtek/rtl8365mb_main.c-3415-\t.get_tag_protocol = rtl8365mb_get_tag_protocol,\ndrivers/net/dsa/realtek/rtl8365mb_main.c:3416:\t.change_tag_protocol = rtl8365mb_change_tag_protocol,\ndrivers/net/dsa/realtek/rtl8365mb_main.c-3417-\t.setup = rtl8365mb_setup,\n"
}

57/2 2026/10/03 06:55 llm patch-evaluator
0m Model:
gemini-3.8-flash

Args:
null

Results:
null

Tokens:
							input: 55654
							output: 49
							thoughts: 26
						

Thoughts:
Okay, here's my interpretation of that thought process, tailored for an expert audience, and written in the first person:

**Analyzing the `rtl8365mb_change_tag_protocol` Function**

Alright, let's dive into this. The immediate need here is to scrutinize the `rtl8365mb_change_tag_protocol` function. It's sitting at line 3003, which suggests it’s probably a fairly involved piece of the larger picture, likely related to VLAN tagging or protocol handling within the `rtl8365mb` driver, given the name. We need to understand precisely how this function influences the overall system behavior. My intuition leans toward it being the core routine for adapting or reconfiguring the Ethernet frame tagging methods on a specific network interface or port within an RTL8365MB based switch. I'll need to look at its input parameters, assess how it's called (and from where), review the internal logic and conditional branching within the function itself, and then understand its relation to other related functions to fully grasp its impact on VLAN configurations. Knowing this function is key to making changes to the VLAN tagging process.



58/2 2026/10/03 06:55 tool read-file
0m Args:
{
  "File": "drivers/net/dsa/realtek/rtl8365mb_main.c",
  "FirstLine": 3003,
  "LineCount": 20
}

Results:
{
  "Contents": "3003:\tstatic int rtl8365mb_change_tag_protocol(struct dsa_switch *ds,\n3004:\t\t\t\t\t\t enum dsa_tag_protocol proto)\n3005:\t{\n3006:\t\tstruct realtek_priv *priv = ds-\u003epriv;\n3007:\t\tstruct rtl8365mb_cpu *cpu;\n3008:\t\tstruct rtl8365mb *mb;\n3009:\t\n3010:\t\tmb = priv-\u003echip_data;\n3011:\t\tcpu = \u0026mb-\u003ecpu;\n3012:\t\n3013:\t\tswitch (proto) {\n3014:\t\tcase DSA_TAG_PROTO_RTL8_4:\n3015:\t\t\tcpu-\u003eformat = RTL8365MB_CPU_FORMAT_8BYTES;\n3016:\t\t\tcpu-\u003eposition = RTL8365MB_CPU_POS_AFTER_SA;\n3017:\t\t\tbreak;\n3018:\t\tcase DSA_TAG_PROTO_RTL8_4T:\n3019:\t\t\tcpu-\u003eformat = RTL8365MB_CPU_FORMAT_8BYTES;\n3020:\t\t\tcpu-\u003eposition = RTL8365MB_CPU_POS_BEFORE_CRC;\n3021:\t\t\tbreak;\n3022:\t\t/* The switch also supports a 4-byte format, similar to rtl4a but with\n"
}

59/2 2026/10/03 06:55 llm patch-evaluator
0m Model:
gemini-3.8-flash

Args:
null

Results:
null

Tokens:
							input: 56342
							output: 32
							thoughts: 1005
						

Thoughts:
**Analyzing the Reachability of Motorcomm YT922x Driver Code in Virtualized Environments**

Okay, so I'm looking at this patch and my initial thought is that the `rtl8365mb` driver only supports RTL8_4 and RTL8_4T. That means `DSA_TAG_PROTO_YT922X`, which is for the "yt922x" switch, is exclusively bound to Motorcomm YT9224/YT9228 switches. This, coupled with the fact the `yt921x_mdio_driver` specifically needs a "motorcomm,yt9215" or "motorcomm,yt9224" MDIO device connected to hardware that responds with a valid `YT921X_CHIP_ID`, which is looking for a major ID like `YT9215_MAJOR`, `YT9218_MAJOR`, or `YT9224_MAJOR` is a serious problem.  Neither QEMU nor GCE emulates these Motorcomm chips.

So, the burning question: is there *any* way the `yt921x` driver or `tag_yt922x.c` will run in standard virtualized environments, like QEMU or GCE on amd64?

Alright, let's go over the instructions.  Section 2, under "Structurally unreachable hardware", hits home: "Vendor-specific PCIe switches... requiring physical ASIC/PCIe cards not emulated in standard QEMU".  That *immediately* sounds like my situation. Section 1 reinforces this: "Fuzzing can only discover bugs in code that can actually execute in standard virtualized environments... If the modified code is structurally unreachable (see Section 2), it MUST NOT be fuzzed..." So, if it's not reachable in a standard environment, no fuzzing.

Now, let's systematically check every file modified by the patch:

1.  `MAINTAINERS`: Irrelevant, no execution.
2.  `drivers/net/dsa/motorcomm/Kconfig`: Kconfig changes.
3.  `drivers/net/dsa/motorcomm/Makefile`: Build system.
4.  `drivers/net/dsa/motorcomm/chip.c`: The core YT921x/YT922x switch chip driver, requiring physical hardware – that's a no.
5.  `drivers/net/dsa/motorcomm/chip.h`: Header.
6.  `drivers/net/dsa/motorcomm/mdio_bus.c`: MDIO bus access – needs hardware.
7.  `drivers/net/dsa/motorcomm/mdio_bus.h`: Header.
8.  `drivers/net/dsa/motorcomm/pcs-922x.c`: PCS routines, also needs physical hardware.
9.  `drivers/net/dsa/motorcomm/pcs.h`: Header.
10. `include/net/dsa.h`: Adds the DSA tag enum.
11. `net/dsa/Kconfig`: Config changes.
12. `net/dsa/Makefile`: Build changes.
13. `net/dsa/tag_yt922x.c`: DSA tag driver for YT922x.

Okay, wait.  Could the `tag_yt922x` module init even be executed? I see that `module_dsa_tag_driver(yt922x_netdev_ops);` registers the tagger with DSA core on module load. So, the module loading is a registration: `dsa_tag_driver_register(&yt922x_netdev_ops)`. The question is, does registering a tag driver *do* anything other than adding it to the global linked list?  I need to go into the details of the `dsa_tag_driver_register` function and verify the steps there.



60/2 2026/10/03 06:55 tool grepper
0m Args:
{
  "Expression": "dsa_tag_driver_register",
  "PathPrefix": "net/dsa"
}

Results:
{
  "Output": "net/dsa/tag.c=128=struct packet_type dsa_pack_type __read_mostly = {\n--\nnet/dsa/tag.c-132-\nnet/dsa/tag.c:133:static void dsa_tag_driver_register(struct dsa_tag_driver *dsa_tag_driver,\nnet/dsa/tag.c-134-\t\t\t\t    struct module *owner)\n--\nnet/dsa/tag.c=143=void dsa_tag_drivers_register(struct dsa_tag_driver *dsa_tag_driver_array[],\n--\nnet/dsa/tag.c-148-\tfor (i = 0; i \u003c count; i++)\nnet/dsa/tag.c:149:\t\tdsa_tag_driver_register(dsa_tag_driver_array[i], owner);\nnet/dsa/tag.c-150-}\n"
}

61/2 2026/10/03 06:55 llm patch-evaluator
0m Model:
gemini-3.8-flash

Args:
null

Results:
null

Tokens:
							input: 58497
							output: 36
							thoughts: 21
						

Thoughts:
Okay, let's dive into this. I'm going to pull up `net/dsa/tag.c` and zero in on line 133. I need to refresh my memory on what's going on in that specific part of the DSA tagging implementation. This is likely where they're handling a specific tag format, or perhaps a critical operation related to frame tagging and untagging. I'll be looking for clues about the data structures involved, the algorithms used, and potential areas for optimization or, frankly, potential pitfalls I might need to keep in mind. Let's see what the code is *actually* doing at that point. I'm expecting to find either a core function call, a switch statement, or a key data manipulation – something that directly contributes to how the tagged Ethernet frames are handled. I'm ready to dig in and understand the precise logic at play here.



62/2 2026/10/03 06:55 tool read-file
0m Args:
{
  "File": "net/dsa/tag.c",
  "FirstLine": 130,
  "LineCount": 30
}

Results:
{
  "Contents": " 130:\t\t.func\t= dsa_switch_rcv,\n 131:\t};\n 132:\t\n 133:\tstatic void dsa_tag_driver_register(struct dsa_tag_driver *dsa_tag_driver,\n 134:\t\t\t\t\t    struct module *owner)\n 135:\t{\n 136:\t\tdsa_tag_driver-\u003eowner = owner;\n 137:\t\n 138:\t\tmutex_lock(\u0026dsa_tag_drivers_lock);\n 139:\t\tlist_add_tail(\u0026dsa_tag_driver-\u003elist, \u0026dsa_tag_drivers_list);\n 140:\t\tmutex_unlock(\u0026dsa_tag_drivers_lock);\n 141:\t}\n 142:\t\n 143:\tvoid dsa_tag_drivers_register(struct dsa_tag_driver *dsa_tag_driver_array[],\n 144:\t\t\t\t      unsigned int count, struct module *owner)\n 145:\t{\n 146:\t\tunsigned int i;\n 147:\t\n 148:\t\tfor (i = 0; i \u003c count; i++)\n 149:\t\t\tdsa_tag_driver_register(dsa_tag_driver_array[i], owner);\n 150:\t}\n 151:\t\n 152:\tstatic void dsa_tag_driver_unregister(struct dsa_tag_driver *dsa_tag_driver)\n 153:\t{\n 154:\t\tmutex_lock(\u0026dsa_tag_drivers_lock);\n 155:\t\tlist_del(\u0026dsa_tag_driver-\u003elist);\n 156:\t\tmutex_unlock(\u0026dsa_tag_drivers_lock);\n 157:\t}\n 158:\tEXPORT_SYMBOL_GPL(dsa_tag_drivers_register);\n 159:\t\n"
}

63/2 2026/10/03 06:55 llm patch-evaluator
0m Model:
gemini-3.8-flash

Args:
null

Results:
null

Tokens:
							input: 59236
							output: 189
							thoughts: 714
						

Thoughts:
**Analysis of the YT922X DSA Support for Fuzzing**

Okay, so let's break this down. The `dsa_tag_driver_register` function, it's just adding the driver to a list. No magic there. Now, those callbacks in `yt922x_netdev_ops` - `yt922x_tag_xmit` and `yt922x_tag_rcv` - they *only* get called if a DSA conduit or port is bound to the `tag_ops` structure. And that binding only happens in two specific cases. First, when the switch driver claims the YT922X tagging protocol during switch registration, which is specific to that `drivers/net/dsa/motorcomm/chip.c` code and only when it detects the YT9224/YT9228 hardware. Second, it *could* happen through a sysfs interface on a conduit device, but that requires an existing DSA switch tree and a specific check `ds->ops->change_tag_protocol(ds, tag_ops->proto)` that no other switch driver allows for `DSA_TAG_PROTO_YT922X`.

Therefore, the code in both the switch driver *and* the tagging driver, `net/dsa/tag_yt922x.c`, is effectively inaccessible in a standard virtualized environment like QEMU or GCE. It *needs* that physical Motorcomm YT9224/YT9228 hardware. This is important.

Let's do a quick checklist to make sure: Is there any core subsystem change? No, just an enum in `include/net/dsa.h`, that's fine. Any kind of mock hardware in QEMU? Nope. This is vendor-specific hardware, a physical MDIO-based switch ASIC used in embedded networking hardware.

Does it fit the "structurally unreachable hardware" category? Absolutely. It's a physical switch ASIC connected via MDIO, not emulated by QEMU.

So, `WorthFuzzing` has to be `false`.

Now, for `set-results`:
*   `WorthFuzzing`: false, confirmed.
*   `Reasoning`: We need to be very clear. This patch adds support for the Motorcomm YT9224 switch chip to the Motorcomm YT921x switch driver and a corresponding DSA tagging driver (`tag_yt922x.c`). The switch is a physical hardware ASIC controlled via MDIO, and it is not emulated in standard virtualized fuzzing environments (QEMU/GCE). The tagging driver cannot be bound without the underlying switch hardware since no other switch supports or allows switching to `DSA_TAG_PROTO_YT922X`. This makes the modified code structurally unreachable.
*   `EnableConfigs`: empty, as expected. `[]`
*   `FocusSymbols`: empty, also expected. `[]`

Okay, everything checks out. This is a solid assessment. Time to call set-results.



64/2 2026/10/03 06:56 tool set-results
0m Args:
{
  "EnableConfigs": [],
  "FocusSymbols": [],
  "Reasoning": "The patch series adds support for the Motorcomm YT9224/YT9228 ethernet switch chip to drivers/net/dsa/motorcomm/ and adds a corresponding DSA tag driver in net/dsa/tag_yt922x.c. The Motorcomm YT92xx devices are vendor-specific physical Ethernet switch ASICs controlled over an MDIO bus and are not emulated in standard virtualized environments (QEMU or GCE). Furthermore, the tagging driver (tag_yt922x.c) can only be engaged by this specific switch driver, as no other DSA switch supports or accepts changing to DSA_TAG_PROTO_YT922X. Consequently, the modified code is structurally unreachable for fuzzing.",
  "WorthFuzzing": false
}

Results:
{
  "EnableConfigs": null,
  "FocusSymbols": [],
  "Reasoning": "The patch series adds support for the Motorcomm YT9224/YT9228 ethernet switch chip to drivers/net/dsa/motorcomm/ and adds a corresponding DSA tag driver in net/dsa/tag_yt922x.c. The Motorcomm YT92xx devices are vendor-specific physical Ethernet switch ASICs controlled over an MDIO bus and are not emulated in standard virtualized environments (QEMU or GCE). Furthermore, the tagging driver (tag_yt922x.c) can only be engaged by this specific switch driver, as no other DSA switch supports or accepts changing to DSA_TAG_PROTO_YT922X. Consequently, the modified code is structurally unreachable for fuzzing.",
  "WorthFuzzing": false
}

65/1 2026/10/03 06:56 action If
0m Args:
{
  "WorthFuzzing": false
}

Results:
null

LLM Calls Summary:
Total Calls Total Tokens Avg Tokens Total Duration (Seconds) Avg Duration (Seconds)
Tool Calls Summary:
Total Calls Total Duration (Seconds) Avg Duration (Seconds)