AI Trajectory


Trajectory: (Expand/Collapse All)
Seq Timestamp Type Name Duration
0/0 2026/10/13 02:12 flow patch-triage
6m Args:
null

Results:
{
  "EnableConfigs": null,
  "FocusSymbols": [],
  "KMSANReasoning": "",
  "NeedsKMSAN": false,
  "Reasoning": "The patch series adds support for the Motorcomm YT9224 Ethernet switch chip and its DSA tag driver (DSA_TAG_PROTO_YT922X). Motorcomm YT921x/YT922x devices are external Ethernet switch ASICs controlled via MDIO/SMI and probed via Device Tree (OF). They require physical switch hardware not emulated in standard QEMU/amd64 virtualized environments, making the modified driver and tagging code structurally unreachable.",
  "WorthFuzzing": false
}

1/1 2026/10/13 02:12 action read-patch-diff
0m Args:
null

Results:
{
  "PatchDiff": "commit f9f31f17489095fa101de117d3d0a7ad8bfa19eb\nAuthor: syz-cluster \u003ctriage@syzkaller.com\u003e\nDate:   Tue Oct 13 02:12:47 2026 +0000\n\n    syz-cluster: applied patch under review\n\ndiff --git a/MAINTAINERS b/MAINTAINERS\nindex 509b35b5a0e7a..434cd217011bb 100644\n--- a/MAINTAINERS\n+++ b/MAINTAINERS\n@@ -18434,11 +18434,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 9c1e3d538d217..22e6da0c10e1e 100644\n--- a/drivers/net/dsa/motorcomm/Makefile\n+++ b/drivers/net/dsa/motorcomm/Makefile\n@@ -4,5 +4,6 @@ yt921x-objs := chip.o\n yt921x-$(CONFIG_NET_DSA_YT921X_LEDS) += leds.o\n yt921x-objs += mdio_bus.o\n yt921x-objs += mib.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 91cc5647f2b66..f0488fac90976 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@@ -36,19 +36,19 @@\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@@ -66,16 +66,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(0),\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@@ -3606,6 +3618,11 @@ static void yt921x_dsa_teardown(struct dsa_switch *ds)\n #endif\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 {\n \tstruct device *dev = yt921x_priv_to_device(priv);\n@@ -3631,6 +3648,14 @@ 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\tdev_info(dev,\n+\t\t\t \"Motorcomm %s ethernet switch, chipid: 0x%x\\n\",\n+\t\t\t info-\u003ename, chipid);\n+\t\tpriv-\u003einfo = info;\n+\t\treturn 0;\n+\t}\n+\n \tres = yt921x_reg_read(priv, YT921X_CHIP_MODE, \u0026mode);\n \tif (res)\n \t\treturn res;\n@@ -3741,7 +3766,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@@ -4078,6 +4103,477 @@ 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 = dsa_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 = dsa_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 = dsa_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 = dsa_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 = dsa_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 = dsa_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 = dsa_to_yt921x_priv(ds);\n+\tstruct device *dev = yt921x_priv_to_device(priv);\n+\tstruct device_node *np = dev-\u003eof_node;\n+\tstruct device_node *child;\n+\tint res;\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 = dsa_to_yt921x_priv(ds);\n+\tstruct device *dev = yt921x_priv_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\treturn res;\n+\n+\tmajor = FIELD_GET(YT921X_CHIP_ID_MAJOR, chipid);\n+\tseries = yt92xx_series_lookup(major);\n+\tif (!series) {\n+\t\tdev_err(dev, \"Chip ID: 0x%x, and Unknown major.\\n\", chipid);\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@@ -4120,6 +4616,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@@ -4146,15 +4643,10 @@ static int yt921x_mdio_probe(struct mdio_device *mdiodev)\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@@ -4163,6 +4655,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@@ -4180,5 +4673,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 25ff77054de30..f14747278d1d1 100644\n--- a/drivers/net/dsa/motorcomm/chip.h\n+++ b/drivers/net/dsa/motorcomm/chip.h\n@@ -119,6 +119,7 @@ enum yt921x_speed {\n \tYT921X_SPEED_1000,\n \tYT921X_SPEED_10000,\n \tYT921X_SPEED_2500,\n+\tYT921X_SPEED_5000,\n \tYT921X_SPEED_INVALID\n };\n \n@@ -749,6 +750,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@@ -770,6 +772,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_acl_entry {\n \tu32 key[2];\n \tu32 mask[2];\n@@ -841,9 +933,28 @@ static inline u16 yt921x_info_ports_mask(const struct yt921x_info *info)\n \treturn info-\u003einternal_mask | info-\u003exmii_mask | info-\u003eserdes_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;\n@@ -888,6 +999,8 @@ static inline int ethtool_speed_to_yt921x(int speed)\n \t\treturn YT921X_SPEED_2500;\n \tcase SPEED_10000:\n \t\treturn YT921X_SPEED_10000;\n+\tcase SPEED_5000:\n+\t\treturn YT921X_SPEED_5000;\n \tdefault:\n \t\treturn YT921X_SPEED_INVALID;\n \t}\ndiff --git a/drivers/net/dsa/motorcomm/mdio_bus.c b/drivers/net/dsa/motorcomm/mdio_bus.c\nindex dd6c52f37bbf5..a4cb74d0fd90b 100644\n--- a/drivers/net/dsa/motorcomm/mdio_bus.c\n+++ b/drivers/net/dsa/motorcomm/mdio_bus.c\n@@ -113,7 +113,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@@ -131,7 +131,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@@ -145,6 +145,7 @@ int yt921x_mbus_int_init(struct yt921x_priv *priv, struct device_node *mnp)\n {\n \tstruct device *dev = yt921x_priv_to_device(priv);\n \tstruct mii_bus *mbus;\n+\tu32 max_ports;\n \tint res;\n \n \tmbus = devm_mdiobus_alloc(dev);\n@@ -157,7 +158,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@@ -297,3 +299,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..06d8d65260549 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+\ttristate \"Tag driver for Motorcomm YT922x switches\"\n+\thelp\n+\t  Say Y or M if you want to enable support for tagging frames for\n+\t  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..b6146a9af98b3\n--- /dev/null\n+++ b/net/dsa/tag_yt922x.c\n@@ -0,0 +1,122 @@\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+ * To-CPU (RX) tag format, 8 bytes:\n+ *\n+ *   tag[0]: TPID (default: 0x9988)\n+ *   tag[1]: VID lookup\n+ *   tag[2]: bit 5:2  - RX source port\n+ *\n+ * From-CPU (TX) tag format, 8 bytes:\n+ *\n+ *   tag[0]: TPID (default: 0x9988)\n+ *   tag[1]: bit 8:0 - Dst port mask\n+ *   tag[2]: bit 15  - Dst port 0\n+ *\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/13 02:12 agent patch-evaluator
6m Model:
core

Args:
null

Results:
{
  "EnableConfigs": null,
  "FocusSymbols": [],
  "Reasoning": "The patch series adds support for the Motorcomm YT9224 Ethernet switch chip and its DSA tag driver (DSA_TAG_PROTO_YT922X). Motorcomm YT921x/YT922x devices are external Ethernet switch ASICs controlled via MDIO/SMI and probed via Device Tree (OF). They require physical switch hardware not emulated in standard QEMU/amd64 virtualized environments, making the modified driver and tagging code structurally unreachable.",
  "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 f9f31f17489095fa101de117d3d0a7ad8bfa19eb
Author: syz-cluster <triage@syzkaller.com>
Date:   Tue Oct 13 02:12:47 2026 +0000

    syz-cluster: applied patch under review

diff --git a/MAINTAINERS b/MAINTAINERS
index 509b35b5a0e7a..434cd217011bb 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -18434,11 +18434,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 9c1e3d538d217..22e6da0c10e1e 100644
--- a/drivers/net/dsa/motorcomm/Makefile
+++ b/drivers/net/dsa/motorcomm/Makefile
@@ -4,5 +4,6 @@ yt921x-objs := chip.o
 yt921x-$(CONFIG_NET_DSA_YT921X_LEDS) += leds.o
 yt921x-objs += mdio_bus.o
 yt921x-objs += mib.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 91cc5647f2b66..f0488fac90976 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.
@@ -36,19 +36,19 @@
 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,
 	},
@@ -66,16 +66,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(0),
+	},
+	{
+		"YT9228", YT9224_MAJOR, 0, 0,
+		GENMASK_U16(7, 4),
+		0,
+		BIT(8) | GENMASK_U16(3, 0),
+	},
 	{}
 };
 
@@ -3606,6 +3618,11 @@ static void yt921x_dsa_teardown(struct dsa_switch *ds)
 #endif
 }
 
+static bool yt921x_needs_extmode_check(u32 major)
+{
+	return (major == YT9224_MAJOR) ? false : true;
+}
+
 static int yt921x_chip_detect(struct yt921x_priv *priv)
 {
 	struct device *dev = yt921x_priv_to_device(priv);
@@ -3631,6 +3648,14 @@ static int yt921x_chip_detect(struct yt921x_priv *priv)
 		return -ENODEV;
 	}
 
+	if (!yt921x_needs_extmode_check(major)) {
+		dev_info(dev,
+			 "Motorcomm %s ethernet switch, chipid: 0x%x\n",
+			 info->name, chipid);
+		priv->info = info;
+		return 0;
+	}
+
 	res = yt921x_reg_read(priv, YT921X_CHIP_MODE, &mode);
 	if (res)
 		return res;
@@ -3741,7 +3766,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;
@@ -4078,6 +4103,477 @@ 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 = dsa_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 = dsa_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 = dsa_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 = dsa_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 = dsa_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 = dsa_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 = dsa_to_yt921x_priv(ds);
+	struct device *dev = yt921x_priv_to_device(priv);
+	struct device_node *np = dev->of_node;
+	struct device_node *child;
+	int res;
+
+	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 = dsa_to_yt921x_priv(ds);
+	struct device *dev = yt921x_priv_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)
+		return res;
+
+	major = FIELD_GET(YT921X_CHIP_ID_MAJOR, chipid);
+	series = yt92xx_series_lookup(major);
+	if (!series) {
+		dev_err(dev, "Chip ID: 0x%x, and Unknown major.\n", chipid);
+		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);
@@ -4120,6 +4616,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)
@@ -4146,15 +4643,10 @@ static int yt921x_mdio_probe(struct mdio_device *mdiodev)
 
 	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);
 
@@ -4163,6 +4655,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);
@@ -4180,5 +4673,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 25ff77054de30..f14747278d1d1 100644
--- a/drivers/net/dsa/motorcomm/chip.h
+++ b/drivers/net/dsa/motorcomm/chip.h
@@ -119,6 +119,7 @@ enum yt921x_speed {
 	YT921X_SPEED_1000,
 	YT921X_SPEED_10000,
 	YT921X_SPEED_2500,
+	YT921X_SPEED_5000,
 	YT921X_SPEED_INVALID
 };
 
@@ -749,6 +750,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
@@ -770,6 +772,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_acl_entry {
 	u32 key[2];
 	u32 mask[2];
@@ -841,9 +933,28 @@ static inline u16 yt921x_info_ports_mask(const struct yt921x_info *info)
 	return info->internal_mask | info->xmii_mask | info->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;
@@ -888,6 +999,8 @@ static inline int ethtool_speed_to_yt921x(int speed)
 		return YT921X_SPEED_2500;
 	case SPEED_10000:
 		return YT921X_SPEED_10000;
+	case SPEED_5000:
+		return YT921X_SPEED_5000;
 	default:
 		return YT921X_SPEED_INVALID;
 	}
diff --git a/drivers/net/dsa/motorcomm/mdio_bus.c b/drivers/net/dsa/motorcomm/mdio_bus.c
index dd6c52f37bbf5..a4cb74d0fd90b 100644
--- a/drivers/net/dsa/motorcomm/mdio_bus.c
+++ b/drivers/net/dsa/motorcomm/mdio_bus.c
@@ -113,7 +113,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);
@@ -131,7 +131,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);
@@ -145,6 +145,7 @@ int yt921x_mbus_int_init(struct yt921x_priv *priv, struct device_node *mnp)
 {
 	struct device *dev = yt921x_priv_to_device(priv);
 	struct mii_bus *mbus;
+	u32 max_ports;
 	int res;
 
 	mbus = devm_mdiobus_alloc(dev);
@@ -157,7 +158,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)
@@ -297,3 +299,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..06d8d65260549 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..b6146a9af98b3
--- /dev/null
+++ b/net/dsa/tag_yt922x.c
@@ -0,0 +1,122 @@
+// 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.
+ *
+ * To-CPU (RX) tag format, 8 bytes:
+ *
+ *   tag[0]: TPID (default: 0x9988)
+ *   tag[1]: VID lookup
+ *   tag[2]: bit 5:2  - RX source port
+ *
+ * From-CPU (TX) tag format, 8 bytes:
+ *
+ *   tag[0]: TPID (default: 0x9988)
+ *   tag[1]: bit 8:0 - Dst port mask
+ *   tag[2]: bit 15  - Dst port 0
+ *
+ */
+#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/13 02:12 llm patch-evaluator
0m Model:
gemini-3.8-flash

Args:
null

Results:
null

Tokens:
							input: 20611
							output: 32
							thoughts: 225
						

Thoughts:
**My Initial Thoughts on the Motorcomm YT9224 Ethernet Switch Chip Patch**

Okay, so this patch introduces support for the Motorcomm YT9224 ethernet switch chip in the `drivers/net/dsa/motorcomm` directory, and it also adds a new DSA tagging driver, `net/dsa/tag_yt922x.c`. My immediate thought is, how testable is this? I need to figure out if this new DSA tagging driver is something that can be reached and fuzzed effectively, especially within our existing testing infrastructure.

First, I need to understand the architecture, particularly how DSA works within the Linux kernel. Can we actually reach this `net/dsa/tag_yt922x.c` driver in a syzkaller or virtualized environment? Do mock or loopback DSA devices exist that could facilitate testing, or are we strictly reliant on physical hardware for any meaningful experimentation?

I should probably research whether other DSA tag drivers have been successfully fuzzed previously. I'll also look into whether DSA tag protocols can be configured and manipulated directly on network interfaces. Specifically, can we select or test the DSA tag protocol without necessarily requiring specific hardware? I'll probably start with a keyword search in the kernel source to see if there are any existing DSA tag driver tests or documentation, and then look to see how syzkaller is integrated for DSA testing generally.



4/2 2026/10/13 02:13 tool grepper
0m Args:
{
  "Expression": "DSA_TAG_PROTO_",
  "PathPrefixes": [
    "net/dsa/"
  ]
}

Results:
{
  "Output": "\nFull output is too long, showing 200 out of 352 lines.\nUse more precise expression or PathPrefixes if possible.\n\nNumber of matching lines per file (27 files in total):\nnet/dsa/dsa.c:2\nnet/dsa/tag_ar9331.c:2\nnet/dsa/tag_brcm.c:10\nnet/dsa/tag_dsa.c:4\nnet/dsa/tag_gswip.c:2\nnet/dsa/tag_hellcreek.c:2\nnet/dsa/tag_ks8995.c:2\nnet/dsa/tag_ksz.c:10\nnet/dsa/tag_lan9303.c:2\nnet/dsa/tag_mt7628.c:2\nnet/dsa/tag_mtk.c:2\nnet/dsa/tag_mxl-gsw1xx.c:2\nnet/dsa/tag_mxl862xx.c:2\nnet/dsa/tag_netc.c:2\nnet/dsa/tag_none.c:2\nnet/dsa/tag_ocelot.c:4\nnet/dsa/tag_ocelot_8021q.c:2\nnet/dsa/tag_qca.c:2\nnet/dsa/tag_rtl4_a.c:2\nnet/dsa/tag_rtl8_4.c:4\nnet/dsa/tag_rzn1_a5psw.c:2\nnet/dsa/tag_sja1105.c:4\nnet/dsa/tag_trailer.c:2\nnet/dsa/tag_vsc73xx_8021q.c:2\nnet/dsa/tag_xrs700x.c:2\nnet/dsa/tag_yt921x.c:2\nnet/dsa/tag_yt922x.c:2\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/13 02:13 llm patch-evaluator
0m Model:
gemini-3.8-flash

Args:
null

Results:
null

Tokens:
							input: 26925
							output: 20
							thoughts: 38
						

Thoughts:
Okay, let's dive into this. Here's how I'd approach this task, as if these were my internal thoughts:

**Investigating DSA Switch Implementations in the Kernel**

Alright, I need to understand the state of DSA (Distributed Switch Architecture) within the kernel. My first question is: are there actual *DSA switches* – hardware-specific ones – or any DSA loopback or virtual switch implementations that are present? I'll need to confirm what's been integrated and what's available.

To start, the crucial entry point for registering any kind of DSA switch is `dsa_switch_register`. That's where it all begins. I should be able to identify any current DSA switch implementations and perhaps discover newer ones by seeing who's calling that function within the kernel source. So, I will need to search the kernel code base for all of the places where `dsa_switch_register` is invoked. That will give me a comprehensive overview of existing driver support and, potentially, shed light on any recent developments in this area.



6/2 2026/10/13 02:13 tool grepper
0m Args:
{
  "Expression": "dsa_register_switch"
}

Results:
{
  "Output": "Documentation/networking/dsa/dsa.rst=529=Switch registration from the perspective of a driver means passing a valid\nDocumentation/networking/dsa/dsa.rst:530:``struct dsa_switch`` pointer to ``dsa_register_switch()``, usually from the\nDocumentation/networking/dsa/dsa.rst-531-switch driver's probing function. The following members must be valid in the\n--\nDocumentation/networking/dsa/dsa.rst=572=In case of a tree with multiple switches, probing takes place asymmetrically.\nDocumentation/networking/dsa/dsa.rst:573:The first N-1 callers of ``dsa_register_switch()`` only add their ports to the\nDocumentation/networking/dsa/dsa.rst-574-port list of the tree (``dst-\u003eports``), each port having a backpointer to its\nDocumentation/networking/dsa/dsa.rst=575=associated switch (``dp-\u003eds``). Then, these switches exit their\nDocumentation/networking/dsa/dsa.rst:576:``dsa_register_switch()`` call early, because ``dsa_tree_setup_routing_table()``\nDocumentation/networking/dsa/dsa.rst-577-has determined that the tree is not yet complete (not all ports referenced by\nDocumentation/networking/dsa/dsa.rst=578=DSA links are present in the tree's port list). The tree becomes complete when\nDocumentation/networking/dsa/dsa.rst:579:the last switch calls ``dsa_register_switch()``, and this triggers the effective\nDocumentation/networking/dsa/dsa.rst-580-continuation of initialization (including the call to ``ds-\u003eops-\u003esetup()``) for\n--\ndrivers/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=1685=int gswip_probe_common(struct gswip_priv *priv, u32 version)\n--\ndrivers/net/dsa/lantiq/lantiq_gswip_common.c-1710-\ndrivers/net/dsa/lantiq/lantiq_gswip_common.c:1711:\terr = dsa_register_switch(priv-\u003eds);\ndrivers/net/dsa/lantiq/lantiq_gswip_common.c-1712-\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=4613=static int yt921x_mdio_probe(struct mdio_device *mdiodev)\n--\ndrivers/net/dsa/motorcomm/chip.c-4652-\ndrivers/net/dsa/motorcomm/chip.c:4653:\treturn dsa_register_switch(ds);\ndrivers/net/dsa/motorcomm/chip.c-4654-}\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=2071=qca8k_sw_probe(struct mdio_device *mdiodev)\n--\ndrivers/net/dsa/qca/qca8k-8xxx.c-2132-\ndrivers/net/dsa/qca/qca8k-8xxx.c:2133:\treturn dsa_register_switch(priv-\u003eds);\ndrivers/net/dsa/qca/qca8k-8xxx.c-2134-}\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--\ninclude/linux/platform_data/b53.h=25=struct b53_platform_data {\ninclude/linux/platform_data/b53.h:26:\t/* Must be first such that dsa_register_switch() can access it */\ninclude/linux/platform_data/b53.h-27-\tstruct dsa_chip_data cd;\n--\ninclude/linux/platform_data/microchip-ksz.h=51=struct ksz_platform_data {\ninclude/linux/platform_data/microchip-ksz.h:52:\t/* Must be first such that dsa_register_switch() can access it */\ninclude/linux/platform_data/microchip-ksz.h-53-\tstruct dsa_chip_data cd;\n--\ninclude/linux/platform_data/mv88e6xxx.h=7=struct dsa_mv88e6xxx_pdata {\ninclude/linux/platform_data/mv88e6xxx.h:8:\t/* Must be first, such that dsa_register_switch() can access this\ninclude/linux/platform_data/mv88e6xxx.h-9-\t * without gory pointer manipulations\n--\ninclude/net/dsa.h=1393=void dsa_unregister_switch(struct dsa_switch *ds);\ninclude/net/dsa.h:1394:int dsa_register_switch(struct dsa_switch *ds);\ninclude/net/dsa.h-1395-void dsa_switch_shutdown(struct dsa_switch *ds);\n--\nnet/dsa/dsa.c=1534=static int dsa_switch_probe(struct dsa_switch *ds)\n--\nnet/dsa/dsa.c-1575-\nnet/dsa/dsa.c:1576:int dsa_register_switch(struct dsa_switch *ds)\nnet/dsa/dsa.c-1577-{\n--\nnet/dsa/dsa.c-1586-}\nnet/dsa/dsa.c:1587:EXPORT_SYMBOL_GPL(dsa_register_switch);\nnet/dsa/dsa.c-1588-\n"
}

7/2 2026/10/13 02:13 llm patch-evaluator
0m Model:
gemini-3.8-flash

Args:
null

Results:
null

Tokens:
							input: 31434
							output: 39
							thoughts: 71
						

Thoughts:
Here's my summary, as I delve into the DSA tagging mechanisms:

**Investigating DSA Tag Driver Operation**

Alright, let's dive into the core of how these DSA tagging drivers operate. I need to understand how they're loaded, how they're used, and what's going on under the hood. My first instinct is to zero in on `net/dsa/dsa.c`. It's the logical place to start looking for the central control point for this subsystem. I'll need to figure out where the `tag_ops` structures are defined or referenced, where the drivers are found using something like `dsa_find_tagger`, and of course, I need to understand the device operations too, so I'll also grep for `dsa_device_ops`. That should give me a solid map of the driver loading and usage. Time to get my hands dirty.



8/2 2026/10/13 02:13 tool grepper
0m Args:
{
  "Expression": "dsa_tag_driver|dsa_device_ops",
  "PathPrefixes": [
    "net/dsa/"
  ]
}

Results:
{
  "Output": "\nFull output is too long, showing 200 out of 639 lines.\nUse more precise expression or PathPrefixes if possible.\n\nNumber of matching lines per file (35 files in total):\nnet/dsa/conduit.c:6\nnet/dsa/dsa.c:12\nnet/dsa/dsa.h:3\nnet/dsa/port.c:1\nnet/dsa/port.h:1\nnet/dsa/switch.c:3\nnet/dsa/switch.h:1\nnet/dsa/tag.c:42\nnet/dsa/tag.h:25\nnet/dsa/tag_ar9331.c:2\nnet/dsa/tag_brcm.c:6\nnet/dsa/tag_dsa.c:4\nnet/dsa/tag_gswip.c:2\nnet/dsa/tag_hellcreek.c:2\nnet/dsa/tag_ks8995.c:2\nnet/dsa/tag_ksz.c:7\nnet/dsa/tag_lan9303.c:2\nnet/dsa/tag_mt7628.c:2\nnet/dsa/tag_mtk.c:2\nnet/dsa/tag_mxl-gsw1xx.c:2\nnet/dsa/tag_mxl862xx.c:2\nnet/dsa/tag_netc.c:2\nnet/dsa/tag_none.c:2\nnet/dsa/tag_ocelot.c:4\nnet/dsa/tag_ocelot_8021q.c:2\nnet/dsa/tag_qca.c:2\nnet/dsa/tag_rtl4_a.c:2\nnet/dsa/tag_rtl8_4.c:4\nnet/dsa/tag_rzn1_a5psw.c:2\nnet/dsa/tag_sja1105.c:4\nnet/dsa/tag_trailer.c:2\nnet/dsa/tag_vsc73xx_8021q.c:2\nnet/dsa/tag_xrs700x.c:2\nnet/dsa/tag_yt921x.c:2\nnet/dsa/tag_yt922x.c:2\n\nnet/dsa/conduit.c=328=static void dsa_conduit_set_promiscuity(struct net_device *dev, int inc)\nnet/dsa/conduit.c-329-{\nnet/dsa/conduit.c:330:\tconst struct dsa_device_ops *ops = dev-\u003edsa_ptr-\u003etag_ops;\nnet/dsa/conduit.c-331-\n--\nnet/dsa/conduit.c=350=static ssize_t tagging_store(struct device *d, struct device_attribute *attr,\n--\nnet/dsa/conduit.c-352-{\nnet/dsa/conduit.c:353:\tconst struct dsa_device_ops *new_tag_ops, *old_tag_ops;\nnet/dsa/conduit.c-354-\tconst char *end = strchrnul(buf, '\\n'), *name;\n--\nnet/dsa/conduit.c-368-\told_tag_ops = cpu_dp-\u003etag_ops;\nnet/dsa/conduit.c:369:\tnew_tag_ops = dsa_tag_driver_get_by_name(name);\nnet/dsa/conduit.c-370-\tkfree(name);\n--\nnet/dsa/conduit.c-386-\t\t */\nnet/dsa/conduit.c:387:\t\tdsa_tag_driver_put(new_tag_ops);\nnet/dsa/conduit.c-388-\t\treturn err;\n--\nnet/dsa/conduit.c-393-out:\nnet/dsa/conduit.c:394:\tdsa_tag_driver_put(old_tag_ops);\nnet/dsa/conduit.c-395-\treturn count;\n--\nnet/dsa/conduit.c=419=int dsa_conduit_setup(struct net_device *dev, struct dsa_port *cpu_dp)\nnet/dsa/conduit.c-420-{\nnet/dsa/conduit.c:421:\tconst struct dsa_device_ops *tag_ops = cpu_dp-\u003etag_ops;\nnet/dsa/conduit.c-422-\tstruct dsa_switch *ds = cpu_dp-\u003eds;\n--\nnet/dsa/dsa.c=235=static void dsa_tree_free(struct dsa_switch_tree *dst)\n--\nnet/dsa/dsa.c-237-\tif (dst-\u003etag_ops)\nnet/dsa/dsa.c:238:\t\tdsa_tag_driver_put(dst-\u003etag_ops);\nnet/dsa/dsa.c-239-\tlist_del(\u0026dst-\u003elist);\n--\nnet/dsa/dsa.c=570=static int dsa_switch_setup_tag_protocol(struct dsa_switch *ds)\nnet/dsa/dsa.c-571-{\nnet/dsa/dsa.c:572:\tconst struct dsa_device_ops *tag_ops = ds-\u003edst-\u003etag_ops;\nnet/dsa/dsa.c-573-\tstruct dsa_switch_tree *dst = ds-\u003edst;\n--\nnet/dsa/dsa.c=614=static void dsa_switch_teardown_tag_protocol(struct dsa_switch *ds)\nnet/dsa/dsa.c-615-{\nnet/dsa/dsa.c:616:\tconst struct dsa_device_ops *tag_ops = ds-\u003edst-\u003etag_ops;\nnet/dsa/dsa.c-617-\n--\nnet/dsa/dsa.c=948=static int dsa_tree_bind_tag_proto(struct dsa_switch_tree *dst,\nnet/dsa/dsa.c:949:\t\t\t\t   const struct dsa_device_ops *tag_ops)\nnet/dsa/dsa.c-950-{\nnet/dsa/dsa.c:951:\tconst struct dsa_device_ops *old_tag_ops = dst-\u003etag_ops;\nnet/dsa/dsa.c-952-\tstruct dsa_notifier_tag_proto_info info;\n--\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,\nnet/dsa/dsa.c:985:\t\t\t      const struct dsa_device_ops *old_tag_ops)\nnet/dsa/dsa.c-986-{\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-1157-{\nnet/dsa/dsa.c:1158:\tconst struct dsa_device_ops *tag_ops = NULL;\nnet/dsa/dsa.c-1159-\tstruct dsa_switch *ds = dp-\u003eds;\n--\nnet/dsa/dsa.c-1181-\nnet/dsa/dsa.c:1182:\t\ttag_ops = dsa_tag_driver_get_by_name(user_protocol);\nnet/dsa/dsa.c-1183-\t\tif (IS_ERR(tag_ops)) {\n--\nnet/dsa/dsa.c-1191-\tif (!tag_ops)\nnet/dsa/dsa.c:1192:\t\ttag_ops = dsa_tag_driver_get_by_id(default_proto);\nnet/dsa/dsa.c-1193-\n--\nnet/dsa/dsa.c-1206-\nnet/dsa/dsa.c:1207:\t\t\tdsa_tag_driver_put(tag_ops);\nnet/dsa/dsa.c-1208-\t\t\treturn -EINVAL;\n--\nnet/dsa/dsa.c-1213-\t\t */\nnet/dsa/dsa.c:1214:\t\tdsa_tag_driver_put(tag_ops);\nnet/dsa/dsa.c-1215-\t} else {\n--\nnet/dsa/dsa.h=9=struct dsa_db;\nnet/dsa/dsa.h:10:struct dsa_device_ops;\nnet/dsa/dsa.h-11-struct dsa_lag;\n--\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,\nnet/dsa/dsa.h:27:\t\t\t      const struct dsa_device_ops *old_tag_ops);\nnet/dsa/dsa.h-28-void dsa_tree_conduit_admin_state_change(struct dsa_switch_tree *dst,\n--\nnet/dsa/port.c=1567=void dsa_port_set_tag_protocol(struct dsa_port *cpu_dp,\nnet/dsa/port.c:1568:\t\t\t       const struct dsa_device_ops *tag_ops)\nnet/dsa/port.c-1569-{\n--\nnet/dsa/port.h=19=void dsa_port_set_tag_protocol(struct dsa_port *cpu_dp,\nnet/dsa/port.h:20:\t\t\t       const struct dsa_device_ops *tag_ops);\nnet/dsa/port.h-21-int dsa_port_set_state(struct dsa_port *dp, u8 state, bool do_fast_age);\n--\nnet/dsa/switch.c=873=static int dsa_switch_change_tag_proto(struct dsa_switch *ds,\n--\nnet/dsa/switch.c-875-{\nnet/dsa/switch.c:876:\tconst struct dsa_device_ops *tag_ops = info-\u003etag_ops;\nnet/dsa/switch.c-877-\tstruct dsa_port *dp, *cpu_dp;\n--\nnet/dsa/switch.c=918=dsa_switch_connect_tag_proto(struct dsa_switch *ds,\n--\nnet/dsa/switch.c-920-{\nnet/dsa/switch.c:921:\tconst struct dsa_device_ops *tag_ops = info-\u003etag_ops;\nnet/dsa/switch.c-922-\tint err;\n--\nnet/dsa/switch.c=947=dsa_switch_disconnect_tag_proto(struct dsa_switch *ds,\n--\nnet/dsa/switch.c-949-{\nnet/dsa/switch.c:950:\tconst struct dsa_device_ops *tag_ops = info-\u003etag_ops;\nnet/dsa/switch.c-951-\n--\nnet/dsa/switch.h=98=struct dsa_notifier_tag_proto_info {\nnet/dsa/switch.h:99:\tconst struct dsa_device_ops *tag_ops;\nnet/dsa/switch.h-100-};\n--\nnet/dsa/tag.c-18-\nnet/dsa/tag.c:19:static LIST_HEAD(dsa_tag_drivers_list);\nnet/dsa/tag.c:20:static DEFINE_MUTEX(dsa_tag_drivers_lock);\nnet/dsa/tag.c-21-\n--\nnet/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)\nnet/dsa/tag.c-135-{\nnet/dsa/tag.c:136:\tdsa_tag_driver-\u003eowner = owner;\nnet/dsa/tag.c-137-\nnet/dsa/tag.c:138:\tmutex_lock(\u0026dsa_tag_drivers_lock);\nnet/dsa/tag.c:139:\tlist_add_tail(\u0026dsa_tag_driver-\u003elist, \u0026dsa_tag_drivers_list);\nnet/dsa/tag.c:140:\tmutex_unlock(\u0026dsa_tag_drivers_lock);\nnet/dsa/tag.c-141-}\nnet/dsa/tag.c-142-\nnet/dsa/tag.c:143:void dsa_tag_drivers_register(struct dsa_tag_driver *dsa_tag_driver_array[],\nnet/dsa/tag.c-144-\t\t\t      unsigned int count, struct module *owner)\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-}\nnet/dsa/tag.c-151-\nnet/dsa/tag.c:152:static void dsa_tag_driver_unregister(struct dsa_tag_driver *dsa_tag_driver)\nnet/dsa/tag.c-153-{\nnet/dsa/tag.c:154:\tmutex_lock(\u0026dsa_tag_drivers_lock);\nnet/dsa/tag.c:155:\tlist_del(\u0026dsa_tag_driver-\u003elist);\nnet/dsa/tag.c:156:\tmutex_unlock(\u0026dsa_tag_drivers_lock);\nnet/dsa/tag.c-157-}\nnet/dsa/tag.c:158:EXPORT_SYMBOL_GPL(dsa_tag_drivers_register);\nnet/dsa/tag.c-159-\nnet/dsa/tag.c:160:void dsa_tag_drivers_unregister(struct dsa_tag_driver *dsa_tag_driver_array[],\nnet/dsa/tag.c-161-\t\t\t\tunsigned int count)\n--\nnet/dsa/tag.c-165-\tfor (i = 0; i \u003c count; i++)\nnet/dsa/tag.c:166:\t\tdsa_tag_driver_unregister(dsa_tag_driver_array[i]);\nnet/dsa/tag.c-167-}\nnet/dsa/tag.c:168:EXPORT_SYMBOL_GPL(dsa_tag_drivers_unregister);\nnet/dsa/tag.c-169-\nnet/dsa/tag.c:170:const char *dsa_tag_protocol_to_str(const struct dsa_device_ops *ops)\nnet/dsa/tag.c-171-{\n--\nnet/dsa/tag.c-175-/* Function takes a reference on the module owning the tagger,\nnet/dsa/tag.c:176: * so dsa_tag_driver_put must be called afterwards.\nnet/dsa/tag.c-177- */\nnet/dsa/tag.c:178:const struct dsa_device_ops *dsa_tag_driver_get_by_name(const char *name)\nnet/dsa/tag.c-179-{\nnet/dsa/tag.c:180:\tconst struct dsa_device_ops *ops = ERR_PTR(-ENOPROTOOPT);\nnet/dsa/tag.c:181:\tstruct dsa_tag_driver *dsa_tag_driver;\nnet/dsa/tag.c-182-\n--\nnet/dsa/tag.c-184-\nnet/dsa/tag.c:185:\tmutex_lock(\u0026dsa_tag_drivers_lock);\nnet/dsa/tag.c:186:\tlist_for_each_entry(dsa_tag_driver, \u0026dsa_tag_drivers_list, list) {\nnet/dsa/tag.c:187:\t\tconst struct dsa_device_ops *tmp = dsa_tag_driver-\u003eops;\nnet/dsa/tag.c-188-\n--\nnet/dsa/tag.c-191-\nnet/dsa/tag.c:192:\t\tif (!try_module_get(dsa_tag_driver-\u003eowner))\nnet/dsa/tag.c-193-\t\t\tbreak;\n--\nnet/dsa/tag.c-197-\t}\nnet/dsa/tag.c:198:\tmutex_unlock(\u0026dsa_tag_drivers_lock);\nnet/dsa/tag.c-199-\n--\nnet/dsa/tag.c-202-\nnet/dsa/tag.c:203:const struct dsa_device_ops *dsa_tag_driver_get_by_id(int tag_protocol)\nnet/dsa/tag.c-204-{\nnet/dsa/tag.c:205:\tstruct dsa_tag_driver *dsa_tag_driver;\nnet/dsa/tag.c:206:\tconst struct dsa_device_ops *ops;\nnet/dsa/tag.c-207-\tbool found = false;\n--\nnet/dsa/tag.c-210-\nnet/dsa/tag.c:211:\tmutex_lock(\u0026dsa_tag_drivers_lock);\nnet/dsa/tag.c:212:\tlist_for_each_entry(dsa_tag_driver, \u0026dsa_tag_drivers_list, list) {\nnet/dsa/tag.c:213:\t\tops = dsa_tag_driver-\u003eops;\nnet/dsa/tag.c-214-\t\tif (ops-\u003eproto == tag_protocol) {\n--\nnet/dsa/tag.c-220-\tif (found) {\nnet/dsa/tag.c:221:\t\tif (!try_module_get(dsa_tag_driver-\u003eowner))\nnet/dsa/tag.c-222-\t\t\tops = ERR_PTR(-ENOPROTOOPT);\n--\n\n"
}

9/2 2026/10/13 02:13 llm patch-evaluator
0m Model:
gemini-3.8-flash

Args:
null

Results:
null

Tokens:
							input: 36528
							output: 37
							thoughts: 61
						

Thoughts:
Okay, let's dive into this.

**Investigating the `tagging_store` Function within `net/dsa/conduit.c`**

Alright, I need to figure out what's happening with this `tagging_store` function. The first thing that jumps to mind is, *what sysfs attribute is this tied to?* I need to understand its interface. Let's get right to the source and see what's what. My next step is to head straight to lines 340-400 of `net/dsa/conduit.c`. That should give me the context I need and hopefully reveal the purpose and mechanics of `tagging_store`. I expect this to illuminate the sysfs interface and any related data structures or interactions.



10/2 2026/10/13 02:13 tool read-file
0m Args:
{
  "File": "net/dsa/conduit.c",
  "FirstLine": 340,
  "LineCount": 60
}

Results:
{
  "Contents": " 340:\tstatic ssize_t tagging_show(struct device *d, struct device_attribute *attr,\n 341:\t\t\t\t    char *buf)\n 342:\t{\n 343:\t\tstruct net_device *dev = to_net_dev(d);\n 344:\t\tstruct dsa_port *cpu_dp = dev-\u003edsa_ptr;\n 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 395:\t\treturn count;\n 396:\t}\n 397:\tstatic DEVICE_ATTR_RW(tagging);\n 398:\t\n 399:\tstatic struct attribute *dsa_user_attrs[] = {\n"
}

11/2 2026/10/13 02:13 llm patch-evaluator
0m Model:
gemini-3.8-flash

Args:
null

Results:
null

Tokens:
							input: 37723
							output: 39
							thoughts: 120
						

Thoughts:
**Investigating the Conduit Device Tagging**

Alright, that's interesting! I see that `dsa_conduit_setup` is responsible for creating this `tagging` sysfs attribute on conduit devices. Now, a key question arises in my mind: Are there any conduit devices that *aren't* associated with a DSA switch? I need to understand this relationship better.

My immediate next step is to trace the call paths to `dsa_conduit_setup` and also refresh my memory on the probe flow for DSA switches. How are these DSA switches even brought into the system? What's the triggering mechanism?

Hold on... what actually *creates* a DSA switch in the first place? I need to understand the device instantiation process. Perhaps I should examine the code related to `dsa_loop` or other mock DSA devices for clues, because those are designed to emulate DSA functionality.

Okay, let me quickly confirm that `dsa_loop` is still around. I'll take a look at `drivers/net/dsa/dsa_loop.c` to refresh my memory and understand how the DSA switch layer is created. This will give me some context on how that conduit setup is meant to be used, and whether it's truly essential to the DSA switch concept.



12/2 2026/10/13 02:13 tool read-file
0m Args:
{
  "File": "drivers/net/dsa/dsa_loop.c",
  "FirstLine": 1,
  "LineCount": 50
}

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"
}

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

Args:
null

Results:
null

Tokens:
							input: 38851
							output: 42
							thoughts: 43
						

Thoughts:
Okay, let's dive into this `dsa_loop` instantiation. To really grasp what's happening, I need to look at the source code directly. I'll focus on lines 280 through 410 of `drivers/net/dsa/dsa_loop.c`. That should give me the core information I need about how this specific loopback driver is being brought into existence. This range likely includes the key functions and structures involved in its registration, initialization, and connection to the DSA framework. I'm hoping to see the exact details of how it's integrated, so I can analyze it effectively.



14/2 2026/10/13 02:14 tool read-file
0m Args:
{
  "File": "drivers/net/dsa/dsa_loop.c",
  "FirstLine": 280,
  "LineCount": 100
}

Results:
{
  "Contents": " 280:\t\treturn 0;\n 281:\t}\n 282:\t\n 283:\tstatic int dsa_loop_port_vlan_del(struct dsa_switch *ds, int port,\n 284:\t\t\t\t\t  const struct switchdev_obj_port_vlan *vlan)\n 285:\t{\n 286:\t\tbool untagged = vlan-\u003eflags \u0026 BRIDGE_VLAN_INFO_UNTAGGED;\n 287:\t\tstruct dsa_loop_priv *ps = ds-\u003epriv;\n 288:\t\tu16 pvid = ps-\u003eports[port].pvid;\n 289:\t\tstruct mii_bus *bus = ps-\u003ebus;\n 290:\t\tstruct dsa_loop_vlan *vl;\n 291:\t\n 292:\t\t/* Just do a sleeping operation to make lockdep checks effective */\n 293:\t\tmdiobus_read(bus, ps-\u003eport_base + port, MII_BMSR);\n 294:\t\n 295:\t\tvl = \u0026ps-\u003evlans[vlan-\u003evid];\n 296:\t\n 297:\t\tvl-\u003emembers \u0026= ~BIT(port);\n 298:\t\tif (untagged)\n 299:\t\t\tvl-\u003euntagged \u0026= ~BIT(port);\n 300:\t\n 301:\t\tif (pvid == vlan-\u003evid)\n 302:\t\t\tpvid = 1;\n 303:\t\n 304:\t\tdev_dbg(ds-\u003edev, \"%s: port: %d vlan: %d, %stagged, pvid: %d\\n\",\n 305:\t\t\t__func__, port, vlan-\u003evid, untagged ? \"un\" : \"\", pvid);\n 306:\t\tps-\u003eports[port].pvid = pvid;\n 307:\t\n 308:\t\treturn 0;\n 309:\t}\n 310:\t\n 311:\tstatic int dsa_loop_port_change_mtu(struct dsa_switch *ds, int port,\n 312:\t\t\t\t\t    int new_mtu)\n 313:\t{\n 314:\t\tstruct dsa_loop_priv *priv = ds-\u003epriv;\n 315:\t\n 316:\t\tpriv-\u003eports[port].mtu = new_mtu;\n 317:\t\n 318:\t\treturn 0;\n 319:\t}\n 320:\t\n 321:\tstatic int dsa_loop_port_max_mtu(struct dsa_switch *ds, int port)\n 322:\t{\n 323:\t\treturn ETH_MAX_MTU;\n 324:\t}\n 325:\t\n 326:\tstatic void dsa_loop_phylink_get_caps(struct dsa_switch *dsa, int port,\n 327:\t\t\t\t\t      struct phylink_config *config)\n 328:\t{\n 329:\t\tbitmap_fill(config-\u003esupported_interfaces, PHY_INTERFACE_MODE_MAX);\n 330:\t\t__clear_bit(PHY_INTERFACE_MODE_NA, config-\u003esupported_interfaces);\n 331:\t\tconfig-\u003emac_capabilities = ~0;\n 332:\t}\n 333:\t\n 334:\tstatic const struct dsa_switch_ops dsa_loop_driver = {\n 335:\t\t.get_tag_protocol\t= dsa_loop_get_protocol,\n 336:\t\t.setup\t\t\t= dsa_loop_setup,\n 337:\t\t.teardown\t\t= dsa_loop_teardown,\n 338:\t\t.get_strings\t\t= dsa_loop_get_strings,\n 339:\t\t.get_ethtool_stats\t= dsa_loop_get_ethtool_stats,\n 340:\t\t.get_sset_count\t\t= dsa_loop_get_sset_count,\n 341:\t\t.get_ethtool_phy_stats\t= dsa_loop_get_ethtool_stats,\n 342:\t\t.phy_read\t\t= dsa_loop_phy_read,\n 343:\t\t.phy_write\t\t= dsa_loop_phy_write,\n 344:\t\t.port_bridge_join\t= dsa_loop_port_bridge_join,\n 345:\t\t.port_bridge_leave\t= dsa_loop_port_bridge_leave,\n 346:\t\t.port_stp_state_set\t= dsa_loop_port_stp_state_set,\n 347:\t\t.port_vlan_filtering\t= dsa_loop_port_vlan_filtering,\n 348:\t\t.port_vlan_add\t\t= dsa_loop_port_vlan_add,\n 349:\t\t.port_vlan_del\t\t= dsa_loop_port_vlan_del,\n 350:\t\t.port_change_mtu\t= dsa_loop_port_change_mtu,\n 351:\t\t.port_max_mtu\t\t= dsa_loop_port_max_mtu,\n 352:\t\t.phylink_get_caps\t= dsa_loop_phylink_get_caps,\n 353:\t};\n 354:\t\n 355:\tstatic int dsa_loop_drv_probe(struct mdio_device *mdiodev)\n 356:\t{\n 357:\t\tstruct dsa_loop_pdata *pdata = mdiodev-\u003edev.platform_data;\n 358:\t\tstruct dsa_loop_priv *ps;\n 359:\t\tstruct dsa_switch *ds;\n 360:\t\tint ret;\n 361:\t\n 362:\t\tif (!pdata)\n 363:\t\t\treturn -ENODEV;\n 364:\t\n 365:\t\tds = devm_kzalloc(\u0026mdiodev-\u003edev, sizeof(*ds), GFP_KERNEL);\n 366:\t\tif (!ds)\n 367:\t\t\treturn -ENOMEM;\n 368:\t\n 369:\t\tds-\u003edev = \u0026mdiodev-\u003edev;\n 370:\t\tds-\u003enum_ports = DSA_LOOP_NUM_PORTS;\n 371:\t\n 372:\t\tps = devm_kzalloc(\u0026mdiodev-\u003edev, sizeof(*ps), GFP_KERNEL);\n 373:\t\tif (!ps)\n 374:\t\t\treturn -ENOMEM;\n 375:\t\n 376:\t\tps-\u003enetdev = dev_get_by_name(\u0026init_net, pdata-\u003enetdev);\n 377:\t\tif (!ps-\u003enetdev)\n 378:\t\t\treturn -EPROBE_DEFER;\n 379:\t\n"
}

15/2 2026/10/13 02:14 llm patch-evaluator
0m Model:
gemini-3.8-flash

Args:
null

Results:
null

Tokens:
							input: 40814
							output: 32
							thoughts: 55
						

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

**Debugging the DSA Loop Probe**

Okay, so I need to figure out how `dsa_loop` is being probed. The key piece of the puzzle seems to be `dsa_loop_drv_probe`. I know that function requires `pdata = mdiodev->dev.platform_data`. Now, the question is, where does this `mdiodev` come from and how is that `platform_data` actually set? I'm betting the answer lies within how the `dsa_loop` driver itself is initialized, so let's check the source, specifically `dsa_loop_bdinfo.c`. I expect to find some clues in the board information or device tree bindings there, that should lead me to the initialization sequence.



16/2 2026/10/13 02:14 tool grepper
0m Args:
{
  "Expression": "dsa_loop",
  "PathPrefixes": [
    "drivers/net/dsa/"
  ]
}

Results:
{
  "Output": "\nFull output is too long, showing 200 out of 265 lines.\nUse more precise expression or PathPrefixes if possible.\n\nNumber of matching lines per file (2 files in total):\ndrivers/net/dsa/Makefile:1\ndrivers/net/dsa/dsa_loop.c:93\n\ndrivers/net/dsa/Makefile=3=bcm-sf2-objs\t\t\t:= bcm_sf2.o bcm_sf2_cfp.o\ndrivers/net/dsa/Makefile:4:obj-$(CONFIG_NET_DSA_LOOP)\t+= dsa_loop.o\ndrivers/net/dsa/Makefile-5-obj-$(CONFIG_NET_DSA_MT7530)\t+= mt7530.o\n--\ndrivers/net/dsa/dsa_loop.c-24-\ndrivers/net/dsa/dsa_loop.c:25:struct dsa_loop_vlan {\ndrivers/net/dsa/dsa_loop.c-26-\tu16 members;\n--\ndrivers/net/dsa/dsa_loop.c-29-\ndrivers/net/dsa/dsa_loop.c:30:struct dsa_loop_mib_entry {\ndrivers/net/dsa/dsa_loop.c-31-\tchar name[ETH_GSTRING_LEN];\n--\ndrivers/net/dsa/dsa_loop.c-34-\ndrivers/net/dsa/dsa_loop.c:35:enum dsa_loop_mib_counters {\ndrivers/net/dsa/dsa_loop.c-36-\tDSA_LOOP_PHY_READ_OK,\n--\ndrivers/net/dsa/dsa_loop.c-42-\ndrivers/net/dsa/dsa_loop.c:43:struct dsa_loop_port {\ndrivers/net/dsa/dsa_loop.c:44:\tstruct dsa_loop_mib_entry mib[__DSA_LOOP_CNT_MAX];\ndrivers/net/dsa/dsa_loop.c-45-\tu16 pvid;\n--\ndrivers/net/dsa/dsa_loop.c-48-\ndrivers/net/dsa/dsa_loop.c:49:struct dsa_loop_priv {\ndrivers/net/dsa/dsa_loop.c-50-\tstruct mii_bus\t*bus;\ndrivers/net/dsa/dsa_loop.c-51-\tunsigned int\tport_base;\ndrivers/net/dsa/dsa_loop.c:52:\tstruct dsa_loop_vlan vlans[VLAN_N_VID];\ndrivers/net/dsa/dsa_loop.c-53-\tstruct net_device *netdev;\ndrivers/net/dsa/dsa_loop.c:54:\tstruct dsa_loop_port ports[DSA_MAX_PORTS];\ndrivers/net/dsa/dsa_loop.c-55-};\ndrivers/net/dsa/dsa_loop.c-56-\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\n--\ndrivers/net/dsa/dsa_loop.c-66-\ndrivers/net/dsa/dsa_loop.c:67:static struct dsa_loop_mib_entry dsa_loop_mibs[] = {\ndrivers/net/dsa/dsa_loop.c-68-\t[DSA_LOOP_PHY_READ_OK]\t= { \"phy_read_ok\", },\n--\ndrivers/net/dsa/dsa_loop.c=75=static struct mdio_device *switch_mdiodev;\ndrivers/net/dsa/dsa_loop.c-76-\ndrivers/net/dsa/dsa_loop.c:77:enum dsa_loop_devlink_resource_id {\ndrivers/net/dsa/dsa_loop.c-78-\tDSA_LOOP_DEVLINK_PARAM_ID_NONE,  /* DEVLINK_RESOURCE_ID_PARENT_TOP */\n--\ndrivers/net/dsa/dsa_loop.c-81-\ndrivers/net/dsa/dsa_loop.c:82:static u64 dsa_loop_devlink_vtu_get(void *priv)\ndrivers/net/dsa/dsa_loop.c-83-{\ndrivers/net/dsa/dsa_loop.c:84:\tstruct dsa_loop_priv *ps = priv;\ndrivers/net/dsa/dsa_loop.c-85-\tunsigned int i, count = 0;\ndrivers/net/dsa/dsa_loop.c:86:\tstruct dsa_loop_vlan *vl;\ndrivers/net/dsa/dsa_loop.c-87-\n--\ndrivers/net/dsa/dsa_loop.c-96-\ndrivers/net/dsa/dsa_loop.c:97:static int dsa_loop_setup_devlink_resources(struct dsa_switch *ds)\ndrivers/net/dsa/dsa_loop.c-98-{\ndrivers/net/dsa/dsa_loop.c-99-\tstruct devlink_resource_size_params size_params;\ndrivers/net/dsa/dsa_loop.c:100:\tstruct dsa_loop_priv *ps = ds-\u003epriv;\ndrivers/net/dsa/dsa_loop.c-101-\tint err;\n--\ndrivers/net/dsa/dsa_loop.c-115-\t\t\t\t\t      DSA_LOOP_DEVLINK_PARAM_ID_VTU,\ndrivers/net/dsa/dsa_loop.c:116:\t\t\t\t\t      dsa_loop_devlink_vtu_get, ps);\ndrivers/net/dsa/dsa_loop.c-117-\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-133-\ndrivers/net/dsa/dsa_loop.c:134:static int dsa_loop_setup(struct dsa_switch *ds)\ndrivers/net/dsa/dsa_loop.c-135-{\ndrivers/net/dsa/dsa_loop.c:136:\tstruct dsa_loop_priv *ps = ds-\u003epriv;\ndrivers/net/dsa/dsa_loop.c-137-\tunsigned int i;\n--\ndrivers/net/dsa/dsa_loop.c-139-\tfor (i = 0; i \u003c ds-\u003enum_ports; i++)\ndrivers/net/dsa/dsa_loop.c:140:\t\tmemcpy(ps-\u003eports[i].mib, dsa_loop_mibs,\ndrivers/net/dsa/dsa_loop.c:141:\t\t       sizeof(dsa_loop_mibs));\ndrivers/net/dsa/dsa_loop.c-142-\n--\ndrivers/net/dsa/dsa_loop.c-144-\ndrivers/net/dsa/dsa_loop.c:145:\treturn dsa_loop_setup_devlink_resources(ds);\ndrivers/net/dsa/dsa_loop.c-146-}\ndrivers/net/dsa/dsa_loop.c-147-\ndrivers/net/dsa/dsa_loop.c:148:static void dsa_loop_teardown(struct dsa_switch *ds)\ndrivers/net/dsa/dsa_loop.c-149-{\n--\ndrivers/net/dsa/dsa_loop.c-152-\ndrivers/net/dsa/dsa_loop.c:153:static int dsa_loop_get_sset_count(struct dsa_switch *ds, int port, int sset)\ndrivers/net/dsa/dsa_loop.c-154-{\n--\ndrivers/net/dsa/dsa_loop.c-160-\ndrivers/net/dsa/dsa_loop.c:161:static void dsa_loop_get_strings(struct dsa_switch *ds, int port,\ndrivers/net/dsa/dsa_loop.c-162-\t\t\t\t u32 stringset, uint8_t *data)\ndrivers/net/dsa/dsa_loop.c-163-{\ndrivers/net/dsa/dsa_loop.c:164:\tstruct dsa_loop_priv *ps = ds-\u003epriv;\ndrivers/net/dsa/dsa_loop.c-165-\tunsigned int i;\n--\ndrivers/net/dsa/dsa_loop.c-173-\ndrivers/net/dsa/dsa_loop.c:174:static void dsa_loop_get_ethtool_stats(struct dsa_switch *ds, int port,\ndrivers/net/dsa/dsa_loop.c-175-\t\t\t\t       uint64_t *data)\ndrivers/net/dsa/dsa_loop.c-176-{\ndrivers/net/dsa/dsa_loop.c:177:\tstruct dsa_loop_priv *ps = ds-\u003epriv;\ndrivers/net/dsa/dsa_loop.c-178-\tunsigned int i;\n--\ndrivers/net/dsa/dsa_loop.c-183-\ndrivers/net/dsa/dsa_loop.c:184:static int dsa_loop_phy_read(struct dsa_switch *ds, int port, int regnum)\ndrivers/net/dsa/dsa_loop.c-185-{\ndrivers/net/dsa/dsa_loop.c:186:\tstruct dsa_loop_priv *ps = ds-\u003epriv;\ndrivers/net/dsa/dsa_loop.c-187-\tstruct mii_bus *bus = ps-\u003ebus;\n--\ndrivers/net/dsa/dsa_loop.c-198-\ndrivers/net/dsa/dsa_loop.c:199:static int dsa_loop_phy_write(struct dsa_switch *ds, int port,\ndrivers/net/dsa/dsa_loop.c-200-\t\t\t      int regnum, u16 value)\ndrivers/net/dsa/dsa_loop.c-201-{\ndrivers/net/dsa/dsa_loop.c:202:\tstruct dsa_loop_priv *ps = ds-\u003epriv;\ndrivers/net/dsa/dsa_loop.c-203-\tstruct mii_bus *bus = ps-\u003ebus;\n--\ndrivers/net/dsa/dsa_loop.c-214-\ndrivers/net/dsa/dsa_loop.c:215:static int dsa_loop_port_bridge_join(struct dsa_switch *ds, int port,\ndrivers/net/dsa/dsa_loop.c-216-\t\t\t\t     struct dsa_bridge bridge,\n--\ndrivers/net/dsa/dsa_loop.c-225-\ndrivers/net/dsa/dsa_loop.c:226:static void dsa_loop_port_bridge_leave(struct dsa_switch *ds, int port,\ndrivers/net/dsa/dsa_loop.c-227-\t\t\t\t       struct dsa_bridge bridge)\n--\ndrivers/net/dsa/dsa_loop.c-232-\ndrivers/net/dsa/dsa_loop.c:233:static void dsa_loop_port_stp_state_set(struct dsa_switch *ds, int port,\ndrivers/net/dsa/dsa_loop.c-234-\t\t\t\t\tu8 state)\n--\ndrivers/net/dsa/dsa_loop.c-239-\ndrivers/net/dsa/dsa_loop.c:240:static int dsa_loop_port_vlan_filtering(struct dsa_switch *ds, int port,\ndrivers/net/dsa/dsa_loop.c-241-\t\t\t\t\tbool vlan_filtering,\n--\ndrivers/net/dsa/dsa_loop.c-249-\ndrivers/net/dsa/dsa_loop.c:250:static int dsa_loop_port_vlan_add(struct dsa_switch *ds, int port,\ndrivers/net/dsa/dsa_loop.c-251-\t\t\t\t  const struct switchdev_obj_port_vlan *vlan,\n--\ndrivers/net/dsa/dsa_loop.c-255-\tbool pvid = vlan-\u003eflags \u0026 BRIDGE_VLAN_INFO_PVID;\ndrivers/net/dsa/dsa_loop.c:256:\tstruct dsa_loop_priv *ps = ds-\u003epriv;\ndrivers/net/dsa/dsa_loop.c-257-\tstruct mii_bus *bus = ps-\u003ebus;\ndrivers/net/dsa/dsa_loop.c:258:\tstruct dsa_loop_vlan *vl;\ndrivers/net/dsa/dsa_loop.c-259-\n--\ndrivers/net/dsa/dsa_loop.c-282-\ndrivers/net/dsa/dsa_loop.c:283:static int dsa_loop_port_vlan_del(struct dsa_switch *ds, int port,\ndrivers/net/dsa/dsa_loop.c-284-\t\t\t\t  const struct switchdev_obj_port_vlan *vlan)\n--\ndrivers/net/dsa/dsa_loop.c-286-\tbool untagged = vlan-\u003eflags \u0026 BRIDGE_VLAN_INFO_UNTAGGED;\ndrivers/net/dsa/dsa_loop.c:287:\tstruct dsa_loop_priv *ps = ds-\u003epriv;\ndrivers/net/dsa/dsa_loop.c-288-\tu16 pvid = ps-\u003eports[port].pvid;\ndrivers/net/dsa/dsa_loop.c-289-\tstruct mii_bus *bus = ps-\u003ebus;\ndrivers/net/dsa/dsa_loop.c:290:\tstruct dsa_loop_vlan *vl;\ndrivers/net/dsa/dsa_loop.c-291-\n--\ndrivers/net/dsa/dsa_loop.c-310-\ndrivers/net/dsa/dsa_loop.c:311:static int dsa_loop_port_change_mtu(struct dsa_switch *ds, int port,\ndrivers/net/dsa/dsa_loop.c-312-\t\t\t\t    int new_mtu)\ndrivers/net/dsa/dsa_loop.c-313-{\ndrivers/net/dsa/dsa_loop.c:314:\tstruct dsa_loop_priv *priv = ds-\u003epriv;\ndrivers/net/dsa/dsa_loop.c-315-\n--\ndrivers/net/dsa/dsa_loop.c-320-\ndrivers/net/dsa/dsa_loop.c:321:static int dsa_loop_port_max_mtu(struct dsa_switch *ds, int port)\ndrivers/net/dsa/dsa_loop.c-322-{\n--\ndrivers/net/dsa/dsa_loop.c-325-\ndrivers/net/dsa/dsa_loop.c:326:static void dsa_loop_phylink_get_caps(struct dsa_switch *dsa, int port,\ndrivers/net/dsa/dsa_loop.c-327-\t\t\t\t      struct phylink_config *config)\n--\ndrivers/net/dsa/dsa_loop.c-333-\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,\ndrivers/net/dsa/dsa_loop.c:337:\t.teardown\t\t= dsa_loop_teardown,\ndrivers/net/dsa/dsa_loop.c:338:\t.get_strings\t\t= dsa_loop_get_strings,\ndrivers/net/dsa/dsa_loop.c:339:\t.get_ethtool_stats\t= dsa_loop_get_ethtool_stats,\ndrivers/net/dsa/dsa_loop.c:340:\t.get_sset_count\t\t= dsa_loop_get_sset_count,\ndrivers/net/dsa/dsa_loop.c:341:\t.get_ethtool_phy_stats\t= dsa_loop_get_ethtool_stats,\ndrivers/net/dsa/dsa_loop.c:342:\t.phy_read\t\t= dsa_loop_phy_read,\ndrivers/net/dsa/dsa_loop.c:343:\t.phy_write\t\t= dsa_loop_phy_write,\ndrivers/net/dsa/dsa_loop.c:344:\t.port_bridge_join\t= dsa_loop_port_bridge_join,\ndrivers/net/dsa/dsa_loop.c:345:\t.port_bridge_leave\t= dsa_loop_port_bridge_leave,\ndrivers/net/dsa/dsa_loop.c:346:\t.port_stp_state_set\t= dsa_loop_port_stp_state_set,\ndrivers/net/dsa/dsa_loop.c:347:\t.port_vlan_filtering\t= dsa_loop_port_vlan_filtering,\ndrivers/net/dsa/dsa_loop.c:348:\t.port_vlan_add\t\t= dsa_loop_port_vlan_add,\ndrivers/net/dsa/dsa_loop.c:349:\t.port_vlan_del\t\t= dsa_loop_port_vlan_del,\ndrivers/net/dsa/dsa_loop.c:350:\t.port_change_mtu\t= dsa_loop_port_change_mtu,\ndrivers/net/dsa/dsa_loop.c:351:\t.port_max_mtu\t\t= dsa_loop_port_max_mtu,\ndrivers/net/dsa/dsa_loop.c:352:\t.phylink_get_caps\t= dsa_loop_phylink_get_caps,\ndrivers/net/dsa/dsa_loop.c-353-};\ndrivers/net/dsa/dsa_loop.c-354-\ndrivers/net/dsa/dsa_loop.c:355:static int dsa_loop_drv_probe(struct mdio_device *mdiodev)\ndrivers/net/dsa/dsa_loop.c-356-{\ndrivers/net/dsa/dsa_loop.c:357:\tstruct dsa_loop_pdata *pdata = mdiodev-\u003edev.platform_data;\ndrivers/net/dsa/dsa_loop.c:358:\tstruct dsa_loop_priv *ps;\ndrivers/net/dsa/dsa_loop.c-359-\tstruct dsa_switch *ds;\n--\ndrivers/net/dsa/dsa_loop.c-382-\tds-\u003edev = \u0026mdiodev-\u003edev;\ndrivers/net/dsa/dsa_loop.c:383:\tds-\u003eops = \u0026dsa_loop_driver;\ndrivers/net/dsa/dsa_loop.c-384-\tds-\u003epriv = ps;\n--\ndrivers/net/dsa/dsa_loop.c-396-\ndrivers/net/dsa/dsa_loop.c:397:static void dsa_loop_drv_remove(struct mdio_device *mdiodev)\n\n"
}

17/2 2026/10/13 02:14 llm patch-evaluator
0m Model:
gemini-3.8-flash

Args:
null

Results:
null

Tokens:
							input: 46197
							output: 21
							thoughts: 43
						

Thoughts:
Okay, let's dive into this.

**Investigating `dsa_loop_bdinfo`**

Alright, I need to understand what's going on with this `dsa_loop_bdinfo` thing. My first instinct is to figure out its purpose. Specifically, does it register a new device? My experience tells me that's a likely scenario, but I need to confirm. Let's not make assumptions here. I'm going to run a `grep` command immediately. That's the quickest way to get some clues about this function and how it's used within the codebase. Hopefully, the results will point me in the right direction. Time to see what the source code has to say!



18/2 2026/10/13 02:14 tool grepper
0m Error:
no matches

Args:
{
  "Expression": "dsa_loop_bdinfo"
}

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

19/2 2026/10/13 02:14 llm patch-evaluator
0m Model:
gemini-3.8-flash

Args:
null

Results:
null

Tokens:
							input: 46427
							output: 41
							thoughts: 29
						

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

**Diving into the Kernel Module**

Okay, time to get my hands dirty. I need to refresh my memory on how this `dsa_loop.c` module initializes itself, specifically the probing mechanism. I'm going to jump straight to the relevant section around lines 400-450, focusing on the `probe` function and the `module_init` macro. This should give me a solid overview of how the module gets loaded and initialized, and where the crucial interaction with the DSA framework begins. I'll be looking for the standard driver registration, resource allocation, and device initialization routines within that section. This is where the magic happens, and I need to understand it thoroughly.



20/2 2026/10/13 02:14 tool read-file
0m Args:
{
  "File": "drivers/net/dsa/dsa_loop.c",
  "FirstLine": 400,
  "LineCount": 60
}

Results:
{
  "Contents": " 400:\t\tstruct dsa_loop_priv *ps;\n 401:\t\n 402:\t\tif (!ds)\n 403:\t\t\treturn;\n 404:\t\n 405:\t\tps = ds-\u003epriv;\n 406:\t\n 407:\t\tdsa_unregister_switch(ds);\n 408:\t\tdev_put(ps-\u003enetdev);\n 409:\t}\n 410:\t\n 411:\tstatic void dsa_loop_drv_shutdown(struct mdio_device *mdiodev)\n 412:\t{\n 413:\t\tstruct dsa_switch *ds = dev_get_drvdata(\u0026mdiodev-\u003edev);\n 414:\t\n 415:\t\tif (!ds)\n 416:\t\t\treturn;\n 417:\t\n 418:\t\tdsa_switch_shutdown(ds);\n 419:\t\n 420:\t\tdev_set_drvdata(\u0026mdiodev-\u003edev, NULL);\n 421:\t}\n 422:\t\n 423:\tstatic struct mdio_driver dsa_loop_drv = {\n 424:\t\t.mdiodrv.driver\t= {\n 425:\t\t\t.name\t= \"dsa-loop\",\n 426:\t\t},\n 427:\t\t.probe\t= dsa_loop_drv_probe,\n 428:\t\t.remove\t= dsa_loop_drv_remove,\n 429:\t\t.shutdown = dsa_loop_drv_shutdown,\n 430:\t};\n 431:\t\n 432:\tstatic int dsa_loop_bus_match(struct device *dev,\n 433:\t\t\t\t      const struct device_driver *drv)\n 434:\t{\n 435:\t\treturn drv == \u0026dsa_loop_drv.mdiodrv.driver;\n 436:\t}\n 437:\t\n 438:\tstatic void dsa_loop_phydevs_unregister(void)\n 439:\t{\n 440:\t\tfor (int i = 0; i \u003c NUM_FIXED_PHYS; i++) {\n 441:\t\t\tif (!IS_ERR(phydevs[i]))\n 442:\t\t\t\tfixed_phy_unregister(phydevs[i]);\n 443:\t\t}\n 444:\t}\n 445:\t\n 446:\tstatic int __init dsa_loop_create_switch_mdiodev(void)\n 447:\t{\n 448:\t\tstatic struct dsa_loop_pdata dsa_loop_pdata = {\n 449:\t\t\t.cd = {\n 450:\t\t\t\t.port_names[0] = \"lan1\",\n 451:\t\t\t\t.port_names[1] = \"lan2\",\n 452:\t\t\t\t.port_names[2] = \"lan3\",\n 453:\t\t\t\t.port_names[3] = \"lan4\",\n 454:\t\t\t\t.port_names[DSA_LOOP_CPU_PORT] = \"cpu\",\n 455:\t\t\t},\n 456:\t\t\t.name = \"DSA mockup driver\",\n 457:\t\t\t.enabled_ports = 0x1f,\n 458:\t\t\t.netdev = \"eth0\",\n 459:\t\t};\n"
}

21/2 2026/10/13 02:14 llm patch-evaluator
0m Model:
gemini-3.8-flash

Args:
null

Results:
null

Tokens:
							input: 47519
							output: 41
							thoughts: 59
						

Thoughts:
Okay, here's my assessment of that code snippet, delivered as if it's my own thought process:

**Diving into the DSA Loopback Mockup**

Alright, that's interesting! `dsa_loop_create_switch_mdiodev()` - it's specifically crafting a DSA-based, essentially *fake* driver and attaching it to `eth0`. I was already familiar with the DSA architecture, but seeing a dedicated mockup driver like this is a good reminder of its flexible design.

Time to delve into `drivers/net/dsa/dsa_loop.c`, specifically lines 460-520. That section is the heart of this DSA loopback driver. I'm expecting to see the initialization of the DSA structure, the registration of the MII bus, probably some handlers for PHY operations since it’s emulating hardware, and almost certainly some setup for virtual switch ports. The goal here is clearly to provide a functional DSA environment for testing and development *without* requiring actual hardware. I'll be looking to understand the methods used for emulating hardware, and ensure the mocking is clean, so that users can use it for various testing purposes.



22/2 2026/10/13 02:14 tool read-file
0m Args:
{
  "File": "drivers/net/dsa/dsa_loop.c",
  "FirstLine": 460,
  "LineCount": 60
}

Results:
{
  "Contents": " 460:\t\tstruct mii_bus *bus;\n 461:\t\tint ret = -ENODEV;\n 462:\t\n 463:\t\tbus = mdio_find_bus(\"fixed-0\");\n 464:\t\tif (WARN_ON(!bus))\n 465:\t\t\treturn ret;\n 466:\t\n 467:\t\tswitch_mdiodev = mdio_device_create(bus, 31);\n 468:\t\tif (IS_ERR(switch_mdiodev))\n 469:\t\t\tgoto out;\n 470:\t\n 471:\t\tswitch_mdiodev-\u003ebus_match = dsa_loop_bus_match;\n 472:\t\tswitch_mdiodev-\u003edev.platform_data = \u0026dsa_loop_pdata;\n 473:\t\n 474:\t\tret = mdio_device_register(switch_mdiodev);\n 475:\t\tif (ret)\n 476:\t\t\tmdio_device_free(switch_mdiodev);\n 477:\tout:\n 478:\t\tput_device(\u0026bus-\u003edev);\n 479:\t\treturn ret;\n 480:\t}\n 481:\t\n 482:\tstatic int __init dsa_loop_init(void)\n 483:\t{\n 484:\t\tunsigned int i;\n 485:\t\tint ret;\n 486:\t\n 487:\t\tret = dsa_loop_create_switch_mdiodev();\n 488:\t\tif (ret)\n 489:\t\t\treturn ret;\n 490:\t\n 491:\t\tfor (i = 0; i \u003c NUM_FIXED_PHYS; i++)\n 492:\t\t\tphydevs[i] = fixed_phy_register_100fd();\n 493:\t\n 494:\t\tret = mdio_driver_register(\u0026dsa_loop_drv);\n 495:\t\tif (ret) {\n 496:\t\t\tdsa_loop_phydevs_unregister();\n 497:\t\t\tmdio_device_remove(switch_mdiodev);\n 498:\t\t\tmdio_device_free(switch_mdiodev);\n 499:\t\t}\n 500:\t\n 501:\t\treturn ret;\n 502:\t}\n 503:\tmodule_init(dsa_loop_init);\n 504:\t\n 505:\tstatic void __exit dsa_loop_exit(void)\n 506:\t{\n 507:\t\tmdio_driver_unregister(\u0026dsa_loop_drv);\n 508:\t\tdsa_loop_phydevs_unregister();\n 509:\t\tmdio_device_remove(switch_mdiodev);\n 510:\t\tmdio_device_free(switch_mdiodev);\n 511:\t}\n 512:\tmodule_exit(dsa_loop_exit);\n 513:\t\n 514:\tMODULE_LICENSE(\"GPL\");\n 515:\tMODULE_AUTHOR(\"Florian Fainelli\");\n 516:\tMODULE_DESCRIPTION(\"DSA loopback driver\");\n"
}

23/2 2026/10/13 02:14 llm patch-evaluator
0m Model:
gemini-3.8-flash

Args:
null

Results:
null

Tokens:
							input: 48698
							output: 36
							thoughts: 188
						

Thoughts:
**Investigating a Potential Tagging Protocol Inconsistency**

Okay, so I'm looking at this `dsa_loop` driver. Specifically, I see this `dsa_loop_get_protocol` function within it. It always returns `DSA_TAG_PROTO_NONE`. That's straightforward enough. No tagging protocol supported, at least according to this function.

But then, I was reminded of something I saw in `net/dsa/conduit.c`. The `tagging_store` interface, exposed via sysfs, allows dynamic changes to the tagging protocol! I can even do something like `echo yt922x > /sys/class/net/eth0/dsa/tagging`. Huh. That's... interesting. The ability to modify tagging protocol on the fly raises a red flag. Does this apply to *any* tagger, regardless of what it "claims"?

I need to dig deeper. If that interface is allowed, I need to know under what conditions it can be used. Let's see... I should check out `dsa_tree_change_tag_proto`. That seems like the right place to start. I'll read through that in `net/dsa/dsa.c` and figure out how the system handles the tag protocol changes. This could be an important area for potential issues if there's a mismatch between what the driver claims and what is allowed.



24/2 2026/10/13 02:15 tool grepper
0m Args:
{
  "Expression": "dsa_tree_change_tag_proto",
  "PathPrefixes": [
    "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"
}

25/2 2026/10/13 02:15 llm patch-evaluator
0m Model:
gemini-3.8-flash

Args:
null

Results:
null

Tokens:
							input: 49706
							output: 37
							thoughts: 39
						

Thoughts:
Okay, let's dive into this. I need to understand how the DSA driver handles changes to the VLAN tag, specifically within the tree structure. The code I need to focus on is in `net/dsa/dsa.c`, and I'm interested in lines 950 through 1010. That should give me the core logic related to the VLAN tag manipulation. I'm assuming that this function is triggered when a VLAN tag needs to be modified within the DSA topology, perhaps during a configuration update or port state change. This is essential to understand how the driver maintains consistency across the switch fabric and propagates VLAN information correctly. I'll be looking for things like mutexes or other concurrency control, error handling, and how the changes are applied to the relevant registers of the underlying hardware, or the data structures representing that hardware. The goal is to get a handle on the interaction between software and hardware when VLAN tags are in play.



26/2 2026/10/13 02:15 tool read-file
0m Args:
{
  "File": "net/dsa/dsa.c",
  "FirstLine": 950,
  "LineCount": 60
}

Results:
{
  "Contents": " 950:\t{\n 951:\t\tconst struct dsa_device_ops *old_tag_ops = dst-\u003etag_ops;\n 952:\t\tstruct dsa_notifier_tag_proto_info info;\n 953:\t\tint err;\n 954:\t\n 955:\t\tdst-\u003etag_ops = tag_ops;\n 956:\t\n 957:\t\t/* Notify the switches from this tree about the connection\n 958:\t\t * to the new tagger\n 959:\t\t */\n 960:\t\tinfo.tag_ops = tag_ops;\n 961:\t\terr = dsa_tree_notify(dst, DSA_NOTIFIER_TAG_PROTO_CONNECT, \u0026info);\n 962:\t\tif (err \u0026\u0026 err != -EOPNOTSUPP)\n 963:\t\t\tgoto out_disconnect;\n 964:\t\n 965:\t\t/* Notify the old tagger about the disconnection from this tree */\n 966:\t\tinfo.tag_ops = old_tag_ops;\n 967:\t\tdsa_tree_notify(dst, DSA_NOTIFIER_TAG_PROTO_DISCONNECT, \u0026info);\n 968:\t\n 969:\t\treturn 0;\n 970:\t\n 971:\tout_disconnect:\n 972:\t\tinfo.tag_ops = tag_ops;\n 973:\t\tdsa_tree_notify(dst, DSA_NOTIFIER_TAG_PROTO_DISCONNECT, \u0026info);\n 974:\t\tdst-\u003etag_ops = old_tag_ops;\n 975:\t\n 976:\t\treturn err;\n 977:\t}\n 978:\t\n 979:\t/* Since the dsa/tagging sysfs device attribute is per conduit, the assumption\n 980:\t * is that all DSA switches within a tree share the same tagger, otherwise\n 981:\t * they would have formed disjoint trees (different \"dsa,member\" values).\n 982:\t */\n 983:\tint dsa_tree_change_tag_proto(struct dsa_switch_tree *dst,\n 984:\t\t\t\t      const struct dsa_device_ops *tag_ops,\n 985:\t\t\t\t      const struct dsa_device_ops *old_tag_ops)\n 986:\t{\n 987:\t\tstruct dsa_notifier_tag_proto_info info;\n 988:\t\tstruct dsa_port *dp;\n 989:\t\tint err = -EBUSY;\n 990:\t\n 991:\t\tif (!rtnl_trylock())\n 992:\t\t\treturn restart_syscall();\n 993:\t\n 994:\t\t/* At the moment we don't allow changing the tag protocol under\n 995:\t\t * traffic. The rtnl_mutex also happens to serialize concurrent\n 996:\t\t * attempts to change the tagging protocol. If we ever lift the IFF_UP\n 997:\t\t * restriction, there needs to be another mutex which serializes this.\n 998:\t\t */\n 999:\t\tdsa_tree_for_each_user_port(dp, dst) {\n1000:\t\t\tif (dsa_port_to_conduit(dp)-\u003eflags \u0026 IFF_UP)\n1001:\t\t\t\tgoto out_unlock;\n1002:\t\n1003:\t\t\tif (dp-\u003euser-\u003eflags \u0026 IFF_UP)\n1004:\t\t\t\tgoto out_unlock;\n1005:\t\t}\n1006:\t\n1007:\t\t/* Notify the tag protocol change */\n1008:\t\tinfo.tag_ops = tag_ops;\n1009:\t\terr = dsa_tree_notify(dst, DSA_NOTIFIER_TAG_PROTO, \u0026info);\n"
}

27/2 2026/10/13 02:15 llm patch-evaluator
0m Model:
gemini-3.8-flash

Args:
null

Results:
null

Tokens:
							input: 50946
							output: 38
							thoughts: 32
						

Thoughts:
Okay, here's my take on those lines of code, presented as a first-person expert analysis:

**Deep Dive into `dsa_tree_change_tag_proto` (Lines 1010-1060)**

Alright, time to dig into the guts of `dsa_tree_change_tag_proto`, specifically lines 1010-1060. My initial thought is to quickly scan the surrounding context. What's the *purpose* of this function call again? I need to remember the higher-level goals here. Is this tag modification related to a node, an edge, or something else entirely in the distributed shared array tree?

Okay, focusing on that line range...it *seems* like this block is probably dealing with the actual mechanics of how a tag change is *propagated* or *applied* within the DSA tree structure. I'm guessing there's likely some kind of consistency check in here – are the requested changes valid? Are we avoiding any race conditions or data corruption in this operation? Given the complexity of concurrent data structures, I'd expect to see some locking or atomic operations. I'm hoping I don't see anything glaringly inefficient here.

I'm mentally preparing for potential scenarios: Are we dealing with the common case of a simple tag update, or are there edge cases to handle, such as a tag being linked to some other data somewhere else? Maybe there's a need to update related data/metadata along the way. I'd watch out for how this function interacts with any caching layers. We would not want stale data creeping in here.

I anticipate seeing a few core things in this section:

*   **Error Handling:** It would be good to see proper handling of invalid tag values, out-of-bounds scenarios, or permission violations. This is crucial for stability.
*   **Data Structures Access:** I'm expecting some interactions with the underlying DSA tree's internal representations (e.g., node structures, tag tables). Are we using direct pointers, or is there a layer of abstraction? I need to ensure the abstractions are respected here.
*   **Concurrency Control:** It's almost certain there are threads interacting with this data structure, so there needs to be some form of locking. Is it fine-grained locking or coarse-grained? Is it efficient, or is it likely to be a performance bottleneck?
*   **Propagation Logic:** Here's the core. The crucial part for me is how we are doing this. What is the algorithm for updating tags across the nodes in the tree? The specifics here will largely determine the performance and scalability of the entire system. Are there any optimizations, such as lazy propagation or batched updates? I need to be careful of recursive calls.

I'm ready to dive into the code and start looking for these things. I'll need to pay close attention to the variable names and control flow within these lines to get a complete understanding. Hopefully, the code is well-commented; this is crucial for understanding distributed systems.



28/2 2026/10/13 02:15 tool read-file
0m Args:
{
  "File": "net/dsa/dsa.c",
  "FirstLine": 1010,
  "LineCount": 50
}

Results:
{
  "Contents": "1010:\t\tif (err)\n1011:\t\t\tgoto out_unwind_tagger;\n1012:\t\n1013:\t\terr = dsa_tree_bind_tag_proto(dst, tag_ops);\n1014:\t\tif (err)\n1015:\t\t\tgoto out_unwind_tagger;\n1016:\t\n1017:\t\trtnl_unlock();\n1018:\t\n1019:\t\treturn 0;\n1020:\t\n1021:\tout_unwind_tagger:\n1022:\t\tinfo.tag_ops = old_tag_ops;\n1023:\t\tdsa_tree_notify(dst, DSA_NOTIFIER_TAG_PROTO, \u0026info);\n1024:\tout_unlock:\n1025:\t\trtnl_unlock();\n1026:\t\treturn err;\n1027:\t}\n1028:\t\n1029:\tstatic void dsa_tree_conduit_state_change(struct dsa_switch_tree *dst,\n1030:\t\t\t\t\t\t  struct net_device *conduit)\n1031:\t{\n1032:\t\tstruct dsa_notifier_conduit_state_info info;\n1033:\t\tstruct dsa_port *cpu_dp = conduit-\u003edsa_ptr;\n1034:\t\n1035:\t\tinfo.conduit = conduit;\n1036:\t\tinfo.operational = dsa_port_conduit_is_operational(cpu_dp);\n1037:\t\n1038:\t\tdsa_tree_notify(dst, DSA_NOTIFIER_CONDUIT_STATE_CHANGE, \u0026info);\n1039:\t}\n1040:\t\n1041:\tvoid dsa_tree_conduit_admin_state_change(struct dsa_switch_tree *dst,\n1042:\t\t\t\t\t\t struct net_device *conduit,\n1043:\t\t\t\t\t\t bool up)\n1044:\t{\n1045:\t\tstruct dsa_port *cpu_dp = conduit-\u003edsa_ptr;\n1046:\t\tbool notify = false;\n1047:\t\n1048:\t\t/* Don't keep track of admin state on LAG DSA conduits,\n1049:\t\t * but rather just of physical DSA conduits\n1050:\t\t */\n1051:\t\tif (netif_is_lag_master(conduit))\n1052:\t\t\treturn;\n1053:\t\n1054:\t\tif ((dsa_port_conduit_is_operational(cpu_dp)) !=\n1055:\t\t    (up \u0026\u0026 cpu_dp-\u003econduit_oper_up))\n1056:\t\t\tnotify = true;\n1057:\t\n1058:\t\tcpu_dp-\u003econduit_admin_up = up;\n1059:\t\n"
}

29/2 2026/10/13 02:15 llm patch-evaluator
0m Model:
gemini-3.8-flash

Args:
null

Results:
null

Tokens:
							input: 52397
							output: 36
							thoughts: 65
						

Thoughts:
Here's my take on those thoughts:

**Analyzing `dsa_tree_notify` and Its Implications**

Okay, hold on a second. I'm focusing in on this line: `err = dsa_tree_notify(dst, DSA_NOTIFIER_TAG_PROTO, &info);`. My mind immediately jumps to `DSA_NOTIFIER_TAG_PROTO` – I need to understand what that notifier *actually* does when it's interacting with the switches. We all know how important these notifications can be for maintaining the correct state. It's time to dig into the implementation, I want to refresh myself on how this particular notifier is handled within the DSA framework. Let's see... I bet `dsa_switch_change_tag_proto` is where I'll find the relevant details; time to check that out. I need to understand the side effects.



30/2 2026/10/13 02:16 tool grepper
0m Args:
{
  "Expression": "case DSA_NOTIFIER_TAG_PROTO:",
  "PathPrefixes": [
    "net/dsa/"
  ]
}

Results:
{
  "Output": "net/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);\n"
}

31/2 2026/10/13 02:16 llm patch-evaluator
0m Model:
gemini-3.8-flash

Args:
null

Results:
null

Tokens:
							input: 52807
							output: 36
							thoughts: 27
						

Thoughts:
Here's a summary of my thought process, tailored for an expert like yourself:

**Diving into DSA Switch Tagging**

Okay, so we need to understand how the DSA driver handles switching tags. My initial move is to zero in on `dsa_switch_change_tag_proto` within `net/dsa/switch.c`. That function name screams "this is where the rubber meets the road" for changes to the tag protocol, likely handling the core logic for setting and adjusting the specifics of the tagging implementation on a per-switch basis. I expect to find the meat of the driver's interface to different DSA switch silicon. This is where the magic happens, so to speak. Now, let's get into the details...



32/2 2026/10/13 02:16 tool read-file
0m Args:
{
  "File": "net/dsa/switch.c",
  "FirstLine": 870,
  "LineCount": 45
}

Results:
{
  "Contents": " 870:\t\treturn 0;\n 871:\t}\n 872:\t\n 873:\tstatic int dsa_switch_change_tag_proto(struct dsa_switch *ds,\n 874:\t\t\t\t\t       struct dsa_notifier_tag_proto_info *info)\n 875:\t{\n 876:\t\tconst struct dsa_device_ops *tag_ops = info-\u003etag_ops;\n 877:\t\tstruct dsa_port *dp, *cpu_dp;\n 878:\t\tint err;\n 879:\t\n 880:\t\tif (!ds-\u003eops-\u003echange_tag_protocol)\n 881:\t\t\treturn -EOPNOTSUPP;\n 882:\t\n 883:\t\tASSERT_RTNL();\n 884:\t\n 885:\t\terr = ds-\u003eops-\u003echange_tag_protocol(ds, tag_ops-\u003eproto);\n 886:\t\tif (err)\n 887:\t\t\treturn err;\n 888:\t\n 889:\t\tdsa_switch_for_each_cpu_port(cpu_dp, ds)\n 890:\t\t\tdsa_port_set_tag_protocol(cpu_dp, tag_ops);\n 891:\t\n 892:\t\t/* Now that changing the tag protocol can no longer fail, let's update\n 893:\t\t * the remaining bits which are \"duplicated for faster access\", and the\n 894:\t\t * bits that depend on the tagger, such as the MTU.\n 895:\t\t */\n 896:\t\tdsa_switch_for_each_user_port(dp, ds) {\n 897:\t\t\tstruct net_device *user = dp-\u003euser;\n 898:\t\n 899:\t\t\tdsa_user_setup_tagger(user);\n 900:\t\n 901:\t\t\t/* rtnl_mutex is held in dsa_tree_change_tag_proto */\n 902:\t\t\tdsa_user_change_mtu(user, user-\u003emtu);\n 903:\t\t}\n 904:\t\n 905:\t\treturn 0;\n 906:\t}\n 907:\t\n 908:\t/* We use the same cross-chip notifiers to inform both the tagger side, as well\n 909:\t * as the switch side, of connection and disconnection events.\n 910:\t * Since ds-\u003etagger_data is owned by the tagger, it isn't a hard error if the\n 911:\t * switch side doesn't support connecting to this tagger, and therefore, the\n 912:\t * fact that we don't disconnect the tagger side doesn't constitute a memory\n 913:\t * leak: the tagger will still operate with persistent per-switch memory, just\n 914:\t * with the switch side unconnected to it. What does constitute a hard error is\n"
}

33/2 2026/10/13 02:16 llm patch-evaluator
0m Model:
gemini-3.8-flash

Args:
null

Results:
null

Tokens:
							input: 53775
							output: 20
							thoughts: 156
						

Thoughts:
**Analyzing the Tag Protocol Change**

Okay, here's what I'm seeing: that `if (!ds->ops->change_tag_protocol) return -EOPNOTSUPP;` line is key. And, yep, as I suspected, the `dsa_loop` driver, specifically `dsa_loop_driver`, doesn't implement that `change_tag_protocol` function.  So, when we get to `dsa_tree_change_tag_proto`, we're triggering that check. Consequently, `dsa_tree_notify(dst, DSA_NOTIFIER_TAG_PROTO, &info)` immediately returns `-EOPNOTSUPP`!  And because of the subsequent `if (err) goto out_unwind_tagger;`, that error propagates, causing `tagging_store` to ultimately return `-EOPNOTSUPP`. That makes sense. But this raises a bigger question: is *any* DSA driver actually implementing `change_tag_protocol`?  I need to go look and verify. I can't imagine this is a dead end.



34/2 2026/10/13 02:16 tool grepper
0m Args:
{
  "Expression": "\\.change_tag_protocol"
}

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=3416=static const struct dsa_switch_ops rtl8365mb_switch_ops = {\ndrivers/net/dsa/realtek/rtl8365mb_main.c-3417-\t.get_tag_protocol = rtl8365mb_get_tag_protocol,\ndrivers/net/dsa/realtek/rtl8365mb_main.c:3418:\t.change_tag_protocol = rtl8365mb_change_tag_protocol,\ndrivers/net/dsa/realtek/rtl8365mb_main.c-3419-\t.setup = rtl8365mb_setup,\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-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"
}

35/2 2026/10/13 02:16 llm patch-evaluator
0m Model:
gemini-3.8-flash

Args:
null

Results:
null

Tokens:
							input: 54864
							output: 20
							thoughts: 370
						

Thoughts:
**My Immediate Thoughts on DSA Switch Protocol Implementation**

Okay, so I'm looking at this `change_tag_protocol` function, and it's immediately clear that only `mv88e6xxx`, `felix`, and `rtl8365mb` even support it. And even *then*, does any of them actually handle `DSA_TAG_PROTO_YT922X`? No, of course not. That's the first glaring issue.

Now, how does a DSA switch even *get* created in the first place? Let's dive into the kernel source. Specifically, I should look at `drivers/net/dsa/motorcomm/chip.c`. Ah, there's `yt921x_mdio_driver`... what's that? Let's check the probe function and the driver declaration: `mdio_module_driver(yt921x_mdio_driver);`. Okay, it's an MDIO driver.

```c
static const struct of_device_id yt921x_of_match[] = {
	{ .compatible = "motorcomm,yt9215" },
	{ .compatible = "motorcomm,yt9224" },
	{}
};
```

This is interesting. But can an MDIO driver even be probed without actual hardware or a device tree, especially on something like amd64 QEMU? And, can `syzkaller` even probe MDIO devices? Hmm, does `syzkaller` even *have* MDIO device emulation? That's a key question.

I need to quickly check if `syzkaller` or the Linux kernel provide any support for MDIO, `phylib`, or related stuff from userspace or some form of emulation. I'm going to have to check `syzkaller`'s `syzlang` or the Linux kernel source for relevant keywords like "mdio", "dsa", etc. Could MDIO devices be instantiated from userspace or through debugfs/sysfs/netlink? That would be useful. Ultimately, I should check the `drivers/net/mdio/` directory or something similar to see what's possible and what's available.



36/2 2026/10/13 02:17 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"
}

37/2 2026/10/13 02:17 llm patch-evaluator
0m Model:
gemini-3.8-flash

Args:
null

Results:
null

Tokens:
							input: 56863
							output: 31
							thoughts: 158
						

Thoughts:
**My Assessment of MDIO Device Creation**

Okay, here's what I'm seeing with `mdio_device_create`. Looks like its usage is pretty constrained. Primarily, I'm finding it's called in a few specific scenarios. First, that `dsa_loop.c` file is calling it, which creates a "dsa-loop" device. Not terribly interesting from a general-purpose perspective, especially since it's hardcoded to use `DSA_TAG_PROTO_NONE` and doesn't support protocol changes. Secondly, it's being invoked by `of_mdiobus_register_device`, which is solely related to the Device Tree, so we're talking OpenFirmware or devicetree systems when DT nodes match. Good to know, but again, not a broadly accessible interface. Then I'm seeing it referenced in driver code, like pcs-lynx, pcs-xpcs, and air_en8811h, all specific hardware drivers.

So, the big takeaway here is that there's *no* standard sysfs or userspace interface, that I can see, to create these MDIO devices or bind MDIO drivers dynamically! That seems... limiting. I was expecting there to be some kind of more flexible method. I was really hoping for a more generic creation mechanism.

I'd better check the `mdio_bus` structure itself, to see if there's any hint of configfs support or something similar. I need to be sure before I rule out the possibility completely.



38/2 2026/10/13 02:17 tool grepper
0m Args:
{
  "Expression": "mdio_bus",
  "PathPrefixes": [
    "drivers/net/phy/"
  ]
}

Results:
{
  "Output": "\nFull output is too long, showing 200 out of 788 lines.\nUse more precise expression or PathPrefixes if possible.\n\nNumber of matching lines per file (23 files in total):\ndrivers/net/phy/Makefile:2\ndrivers/net/phy/air_en8811h.c:4\ndrivers/net/phy/bcm-phy-lib.c:16\ndrivers/net/phy/bcm54140.c:4\ndrivers/net/phy/broadcom.c:6\ndrivers/net/phy/dap8211r.c:4\ndrivers/net/phy/fixed_phy.c:4\ndrivers/net/phy/mdio_bus.c:1\ndrivers/net/phy/mdio_bus_provider.c:56\ndrivers/net/phy/mdio_device.c:2\ndrivers/net/phy/micrel.c:6\ndrivers/net/phy/motorcomm.c:10\ndrivers/net/phy/mscc/mscc_main.c:8\ndrivers/net/phy/mscc/mscc_ptp.c:6\ndrivers/net/phy/mxl-86110.c:14\ndrivers/net/phy/phy-core.c:14\ndrivers/net/phy/phy_device.c:22\ndrivers/net/phy/phylib-internal.h:2\ndrivers/net/phy/qcom/at803x.c:2\ndrivers/net/phy/qcom/qca807x.c:2\ndrivers/net/phy/realtek/realtek_main.c:4\ndrivers/net/phy/sfp.c:2\ndrivers/net/phy/xpowers/ac300.c:6\n\ndrivers/net/phy/Makefile=4=libphy-y\t\t\t:= phy.o phy-c45.o phy-core.o phy_device.o \\\ndrivers/net/phy/Makefile-5-\t\t\t\t   linkmode.o phy_link_topology.o \\\ndrivers/net/phy/Makefile:6:\t\t\t\t   phy_caps.o mdio_bus_provider.o phy_port.o \\\ndrivers/net/phy/Makefile-7-\t\t\t\t   mdio_device.o\n--\ndrivers/net/phy/Makefile=16=libphy-$(CONFIG_OPEN_ALLIANCE_HELPERS) += open_alliance_helpers.o\ndrivers/net/phy/Makefile-17-\ndrivers/net/phy/Makefile:18:obj-$(CONFIG_PHYLIB)\t\t+= mdio_bus.o\ndrivers/net/phy/Makefile-19-obj-$(CONFIG_PHYLINK)\t\t+= phylink.o\n--\ndrivers/net/phy/air_en8811h.c=432=static int an8811hb_mcu_assert(struct phy_device *phydev)\n--\ndrivers/net/phy/air_en8811h.c-436-\ndrivers/net/phy/air_en8811h.c:437:\tphy_lock_mdio_bus(phydev);\ndrivers/net/phy/air_en8811h.c-438-\n--\ndrivers/net/phy/air_en8811h.c-451-unlock:\ndrivers/net/phy/air_en8811h.c:452:\tphy_unlock_mdio_bus(phydev);\ndrivers/net/phy/air_en8811h.c-453-\treturn ret;\n--\ndrivers/net/phy/air_en8811h.c=456=static int an8811hb_mcu_deassert(struct phy_device *phydev)\n--\ndrivers/net/phy/air_en8811h.c-460-\ndrivers/net/phy/air_en8811h.c:461:\tphy_lock_mdio_bus(phydev);\ndrivers/net/phy/air_en8811h.c-462-\n--\ndrivers/net/phy/air_en8811h.c-476-unlock:\ndrivers/net/phy/air_en8811h.c:477:\tphy_unlock_mdio_bus(phydev);\ndrivers/net/phy/air_en8811h.c-478-\treturn ret;\n--\ndrivers/net/phy/bcm-phy-lib.c=33=int bcm_phy_write_exp(struct phy_device *phydev, u16 reg, u16 val)\n--\ndrivers/net/phy/bcm-phy-lib.c-36-\ndrivers/net/phy/bcm-phy-lib.c:37:\tphy_lock_mdio_bus(phydev);\ndrivers/net/phy/bcm-phy-lib.c-38-\trc = __bcm_phy_write_exp(phydev, reg, val);\ndrivers/net/phy/bcm-phy-lib.c:39:\tphy_unlock_mdio_bus(phydev);\ndrivers/net/phy/bcm-phy-lib.c-40-\n--\ndrivers/net/phy/bcm-phy-lib.c=62=int bcm_phy_read_exp(struct phy_device *phydev, u16 reg)\n--\ndrivers/net/phy/bcm-phy-lib.c-65-\ndrivers/net/phy/bcm-phy-lib.c:66:\tphy_lock_mdio_bus(phydev);\ndrivers/net/phy/bcm-phy-lib.c-67-\trc = __bcm_phy_read_exp(phydev, reg);\ndrivers/net/phy/bcm-phy-lib.c:68:\tphy_unlock_mdio_bus(phydev);\ndrivers/net/phy/bcm-phy-lib.c-69-\n--\ndrivers/net/phy/bcm-phy-lib.c=94=int bcm_phy_modify_exp(struct phy_device *phydev, u16 reg, u16 mask, u16 set)\n--\ndrivers/net/phy/bcm-phy-lib.c-97-\ndrivers/net/phy/bcm-phy-lib.c:98:\tphy_lock_mdio_bus(phydev);\ndrivers/net/phy/bcm-phy-lib.c-99-\tret = __bcm_phy_modify_exp(phydev, reg, mask, set);\ndrivers/net/phy/bcm-phy-lib.c:100:\tphy_unlock_mdio_bus(phydev);\ndrivers/net/phy/bcm-phy-lib.c-101-\n--\ndrivers/net/phy/bcm-phy-lib.c=271=int bcm_phy_read_rdb(struct phy_device *phydev, u16 rdb)\n--\ndrivers/net/phy/bcm-phy-lib.c-274-\ndrivers/net/phy/bcm-phy-lib.c:275:\tphy_lock_mdio_bus(phydev);\ndrivers/net/phy/bcm-phy-lib.c-276-\tret = __bcm_phy_read_rdb(phydev, rdb);\ndrivers/net/phy/bcm-phy-lib.c:277:\tphy_unlock_mdio_bus(phydev);\ndrivers/net/phy/bcm-phy-lib.c-278-\n--\ndrivers/net/phy/bcm-phy-lib.c=295=int bcm_phy_write_rdb(struct phy_device *phydev, u16 rdb, u16 val)\n--\ndrivers/net/phy/bcm-phy-lib.c-298-\ndrivers/net/phy/bcm-phy-lib.c:299:\tphy_lock_mdio_bus(phydev);\ndrivers/net/phy/bcm-phy-lib.c-300-\tret = __bcm_phy_write_rdb(phydev, rdb, val);\ndrivers/net/phy/bcm-phy-lib.c:301:\tphy_unlock_mdio_bus(phydev);\ndrivers/net/phy/bcm-phy-lib.c-302-\n--\ndrivers/net/phy/bcm-phy-lib.c=327=int bcm_phy_modify_rdb(struct phy_device *phydev, u16 rdb, u16 mask, u16 set)\n--\ndrivers/net/phy/bcm-phy-lib.c-330-\ndrivers/net/phy/bcm-phy-lib.c:331:\tphy_lock_mdio_bus(phydev);\ndrivers/net/phy/bcm-phy-lib.c-332-\tret = __bcm_phy_modify_rdb(phydev, rdb, mask, set);\ndrivers/net/phy/bcm-phy-lib.c:333:\tphy_unlock_mdio_bus(phydev);\ndrivers/net/phy/bcm-phy-lib.c-334-\n--\ndrivers/net/phy/bcm-phy-lib.c=660=static int _bcm_phy_cable_test_start(struct phy_device *phydev, bool is_rdb)\n--\ndrivers/net/phy/bcm-phy-lib.c-671-\ndrivers/net/phy/bcm-phy-lib.c:672:\tphy_lock_mdio_bus(phydev);\ndrivers/net/phy/bcm-phy-lib.c-673-\tif (is_rdb) {\n--\ndrivers/net/phy/bcm-phy-lib.c-690-\ndrivers/net/phy/bcm-phy-lib.c:691:\tphy_unlock_mdio_bus(phydev);\ndrivers/net/phy/bcm-phy-lib.c-692-\n--\ndrivers/net/phy/bcm-phy-lib.c=742=static int _bcm_phy_cable_test_get_status(struct phy_device *phydev,\n--\ndrivers/net/phy/bcm-phy-lib.c-748-\ndrivers/net/phy/bcm-phy-lib.c:749:\tphy_lock_mdio_bus(phydev);\ndrivers/net/phy/bcm-phy-lib.c-750-\n--\ndrivers/net/phy/bcm-phy-lib.c-799-\ndrivers/net/phy/bcm-phy-lib.c:800:\tphy_unlock_mdio_bus(phydev);\ndrivers/net/phy/bcm-phy-lib.c-801-\n--\ndrivers/net/phy/bcm54140.c=432=static int bcm54140_base_read_rdb(struct phy_device *phydev, u16 rdb)\n--\ndrivers/net/phy/bcm54140.c-435-\ndrivers/net/phy/bcm54140.c:436:\tphy_lock_mdio_bus(phydev);\ndrivers/net/phy/bcm54140.c-437-\tret = __phy_package_write(phydev, BCM54140_BASE_ADDR,\n--\ndrivers/net/phy/bcm54140.c-445-out:\ndrivers/net/phy/bcm54140.c:446:\tphy_unlock_mdio_bus(phydev);\ndrivers/net/phy/bcm54140.c-447-\treturn ret;\n--\ndrivers/net/phy/bcm54140.c=450=static int bcm54140_base_write_rdb(struct phy_device *phydev,\n--\ndrivers/net/phy/bcm54140.c-454-\ndrivers/net/phy/bcm54140.c:455:\tphy_lock_mdio_bus(phydev);\ndrivers/net/phy/bcm54140.c-456-\tret = __phy_package_write(phydev, BCM54140_BASE_ADDR,\n--\ndrivers/net/phy/bcm54140.c-464-out:\ndrivers/net/phy/bcm54140.c:465:\tphy_unlock_mdio_bus(phydev);\ndrivers/net/phy/bcm54140.c-466-\treturn ret;\n--\ndrivers/net/phy/broadcom.c=884=static int brcm_fet_config_init(struct phy_device *phydev)\n--\ndrivers/net/phy/broadcom.c-939-\ndrivers/net/phy/broadcom.c:940:\tphy_lock_mdio_bus(phydev);\ndrivers/net/phy/broadcom.c-941-\n--\ndrivers/net/phy/broadcom.c-943-\tif (err \u003c 0) {\ndrivers/net/phy/broadcom.c:944:\t\tphy_unlock_mdio_bus(phydev);\ndrivers/net/phy/broadcom.c-945-\t\treturn err;\n--\ndrivers/net/phy/broadcom.c-980-\ndrivers/net/phy/broadcom.c:981:\tphy_unlock_mdio_bus(phydev);\ndrivers/net/phy/broadcom.c-982-\n--\ndrivers/net/phy/broadcom.c=1043=static int brcm_fet_suspend(struct phy_device *phydev)\n--\ndrivers/net/phy/broadcom.c-1060-\ndrivers/net/phy/broadcom.c:1061:\tphy_lock_mdio_bus(phydev);\ndrivers/net/phy/broadcom.c-1062-\n--\ndrivers/net/phy/broadcom.c-1064-\tif (err \u003c 0) {\ndrivers/net/phy/broadcom.c:1065:\t\tphy_unlock_mdio_bus(phydev);\ndrivers/net/phy/broadcom.c-1066-\t\treturn err;\n--\ndrivers/net/phy/broadcom.c-1082-\ndrivers/net/phy/broadcom.c:1083:\tphy_unlock_mdio_bus(phydev);\ndrivers/net/phy/broadcom.c-1084-\n--\ndrivers/net/phy/dap8211r.c=76=static int dap8211r_read_ext(struct phy_device *phydev, u16 reg)\n--\ndrivers/net/phy/dap8211r.c-79-\ndrivers/net/phy/dap8211r.c:80:\tphy_lock_mdio_bus(phydev);\ndrivers/net/phy/dap8211r.c-81-\tret = __phy_write(phydev, DAP8211R_EXT_ADD, reg);\n--\ndrivers/net/phy/dap8211r.c-86-out:\ndrivers/net/phy/dap8211r.c:87:\tphy_unlock_mdio_bus(phydev);\ndrivers/net/phy/dap8211r.c-88-\treturn ret;\n--\ndrivers/net/phy/dap8211r.c=104=static int dap8211r_modify_ext(struct phy_device *phydev, u16 reg, u16 mask, u16 set)\n--\ndrivers/net/phy/dap8211r.c-107-\ndrivers/net/phy/dap8211r.c:108:\tphy_lock_mdio_bus(phydev);\ndrivers/net/phy/dap8211r.c-109-\tret = __phy_write(phydev, DAP8211R_EXT_ADD, reg);\n--\ndrivers/net/phy/dap8211r.c-114-out:\ndrivers/net/phy/dap8211r.c:115:\tphy_unlock_mdio_bus(phydev);\ndrivers/net/phy/dap8211r.c-116-\treturn ret;\n--\ndrivers/net/phy/fixed_phy.c=193=EXPORT_SYMBOL_GPL(fixed_phy_unregister);\ndrivers/net/phy/fixed_phy.c-194-\ndrivers/net/phy/fixed_phy.c:195:static int __init fixed_mdio_bus_init(void)\ndrivers/net/phy/fixed_phy.c-196-{\n--\ndrivers/net/phy/fixed_phy.c-218-}\ndrivers/net/phy/fixed_phy.c:219:module_init(fixed_mdio_bus_init);\ndrivers/net/phy/fixed_phy.c-220-\ndrivers/net/phy/fixed_phy.c:221:static void __exit fixed_mdio_bus_exit(void)\ndrivers/net/phy/fixed_phy.c-222-{\n--\ndrivers/net/phy/fixed_phy.c-225-}\ndrivers/net/phy/fixed_phy.c:226:module_exit(fixed_mdio_bus_exit);\ndrivers/net/phy/fixed_phy.c-227-\n--\ndrivers/net/phy/mdio_bus.c=59=EXPORT_SYMBOL(mdiobus_is_registered_device);\ndrivers/net/phy/mdio_bus.c-60-\ndrivers/net/phy/mdio_bus.c:61:static void mdiobus_stats_acct(struct mdio_bus_stats *stats, bool op, int ret)\ndrivers/net/phy/mdio_bus.c-62-{\n--\ndrivers/net/phy/mdio_bus_provider.c=40=static void mdiobus_release(struct device *d)\n--\ndrivers/net/phy/mdio_bus_provider.c-55-\ndrivers/net/phy/mdio_bus_provider.c:56:struct mdio_bus_stat_attr {\ndrivers/net/phy/mdio_bus_provider.c-57-\tstruct device_attribute attr;\n--\ndrivers/net/phy/mdio_bus_provider.c-61-\ndrivers/net/phy/mdio_bus_provider.c:62:static struct mdio_bus_stat_attr *to_sattr(struct device_attribute *attr)\ndrivers/net/phy/mdio_bus_provider.c-63-{\ndrivers/net/phy/mdio_bus_provider.c:64:\treturn container_of(attr, struct mdio_bus_stat_attr, attr);\ndrivers/net/phy/mdio_bus_provider.c-65-}\ndrivers/net/phy/mdio_bus_provider.c-66-\ndrivers/net/phy/mdio_bus_provider.c:67:static u64 mdio_bus_get_stat(struct mdio_bus_stats *s, unsigned int offset)\ndrivers/net/phy/mdio_bus_provider.c-68-{\n\n"
}

39/2 2026/10/13 02:17 llm patch-evaluator
0m Model:
gemini-3.8-flash

Args:
null

Results:
null

Tokens:
							input: 62211
							output: 32
							thoughts: 66
						

Thoughts:
Okay, here's my assessment of the situation:

**Concerning the Inner Workings of DSA Taggers**

Wait a minute, I'm getting ahead of myself here. Before I delve into the potential security implications, I need to fully understand the DSA tagger itself. I'm focusing on the packet flow – how these taggers are designed to receive and process data. My primary concern is, can malicious actors inject crafted packets to exploit vulnerabilities within the DSA tagger's reception mechanisms? To truly assess the risk, I need to get my hands dirty. I'm going to start by examining the source code – specifically, `net/dsa/tag.c`. This is where the core logic of receiving packets within the DSA tagger resides. I need to understand this part first, how it receives packets and all of the nuance within it.



40/2 2026/10/13 02:17 tool grepper
0m Args:
{
  "Expression": "dsa_pack_type",
  "PathPrefixes": [
    "net/dsa/"
  ]
}

Results:
{
  "Output": "net/dsa/dsa.c=1865=static int __init dsa_init_module(void)\n--\nnet/dsa/dsa.c-1877-\nnet/dsa/dsa.c:1878:\tdev_add_pack(\u0026dsa_pack_type);\nnet/dsa/dsa.c-1879-\n--\nnet/dsa/dsa.c-1889-\tdsa_user_unregister_notifier();\nnet/dsa/dsa.c:1890:\tdev_remove_pack(\u0026dsa_pack_type);\nnet/dsa/dsa.c-1891-register_notifier_fail:\n--\nnet/dsa/dsa.c=1898=static void __exit dsa_cleanup_module(void)\n--\nnet/dsa/dsa.c-1904-\tdsa_user_unregister_notifier();\nnet/dsa/dsa.c:1905:\tdev_remove_pack(\u0026dsa_pack_type);\nnet/dsa/dsa.c-1906-\tdestroy_workqueue(dsa_owq);\n--\nnet/dsa/tag.c=54=static int dsa_switch_rcv(struct sk_buff *skb, struct net_device *dev,\n--\nnet/dsa/tag.c-127-\nnet/dsa/tag.c:128:struct packet_type dsa_pack_type __read_mostly = {\nnet/dsa/tag.c-129-\t.type\t= cpu_to_be16(ETH_P_XDSA),\n--\nnet/dsa/tag.h=14=struct dsa_tag_driver {\n--\nnet/dsa/tag.h-19-\nnet/dsa/tag.h:20:extern struct packet_type dsa_pack_type;\nnet/dsa/tag.h-21-\n"
}

41/2 2026/10/13 02:17 llm patch-evaluator
0m Model:
gemini-3.8-flash

Args:
null

Results:
null

Tokens:
							input: 62984
							output: 35
							thoughts: 34
						

Thoughts:
Okay, let's dive into this. I'm going to focus on `net/dsa/tag.c`, specifically around the `dsa_switch_rcv` function, roughly lines 50 to 130. I'm keen to understand the data flow and any interesting handling within that section of the driver. I expect to find some key aspects related to packet reception on a DSA switch. I'll be looking for things like:

*   **Ingress tagging/untagging:** How incoming packets are tagged or untagged as they arrive at the switch. This is fundamental to DSA operation. Are there specific tag formats being handled and is the code generic enough to handle multiple?
*   **VLAN processing:** I expect to find VLAN handling code here, potentially including VLAN tag insertion, removal, or manipulation based on the switch configuration.
*   **Port-based operations:** The section might reveal how the switch makes decisions based on the incoming port. Perhaps specific port configurations drive particular actions.
*   **Error handling and validation:** I'll be looking for checks on the incoming packet data, potential error conditions (e.g., malformed tags, invalid VLAN IDs), and how the driver deals with them. This is critical for robustness.
*   **Packet routing/forwarding preparation:** Are we just preparing the packet for the forwarding engine here, or does this code handle aspects of where the packet is sent within the switch fabric? Does the driver apply any egress tag manipulations here?
*   **Interrupt context:** I'll be considering whether this runs in interrupt context or tasklet/workqueue context, and how it handles potential synchronization concerns.

This area is going to be important because it's the gateway for all packets. The quality of this section will be directly related to the stability and performance of the switch.



42/2 2026/10/13 02:18 tool read-file
0m Args:
{
  "File": "net/dsa/tag.c",
  "FirstLine": 50,
  "LineCount": 80
}

Results:
{
  "Contents": "  50:\t\n  51:\t\treturn ds-\u003eops-\u003eport_rxtstamp(ds, p-\u003edp-\u003eindex, skb, type);\n  52:\t}\n  53:\t\n  54:\tstatic int dsa_switch_rcv(struct sk_buff *skb, struct net_device *dev,\n  55:\t\t\t\t  struct packet_type *pt, struct net_device *unused)\n  56:\t{\n  57:\t\tstruct metadata_dst *md_dst = skb_metadata_dst(skb);\n  58:\t\tstruct dsa_port *cpu_dp = dev-\u003edsa_ptr;\n  59:\t\tstruct sk_buff *nskb = NULL;\n  60:\t\tstruct dsa_user_priv *p;\n  61:\t\n  62:\t\tif (unlikely(!cpu_dp)) {\n  63:\t\t\tkfree_skb(skb);\n  64:\t\t\treturn 0;\n  65:\t\t}\n  66:\t\n  67:\t\tskb = skb_unshare(skb, GFP_ATOMIC);\n  68:\t\tif (!skb)\n  69:\t\t\treturn 0;\n  70:\t\n  71:\t\tif (md_dst \u0026\u0026 md_dst-\u003etype == METADATA_HW_PORT_MUX) {\n  72:\t\t\tunsigned int port = md_dst-\u003eu.port_info.port_id;\n  73:\t\n  74:\t\t\tskb_dst_drop(skb);\n  75:\t\t\tif (!skb_has_extensions(skb))\n  76:\t\t\t\tskb-\u003eslow_gro = 0;\n  77:\t\n  78:\t\t\tskb-\u003edev = dsa_conduit_find_user(dev, 0, port);\n  79:\t\t\tif (likely(skb-\u003edev)) {\n  80:\t\t\t\tdsa_default_offload_fwd_mark(skb);\n  81:\t\t\t\tnskb = skb;\n  82:\t\t\t} else {\n  83:\t\t\t\t/* Just drop the skb if we can't find the user */\n  84:\t\t\t\tkfree_skb(skb);\n  85:\t\t\t}\n  86:\t\t} else {\n  87:\t\t\tnskb = cpu_dp-\u003ercv(skb, dev);\n  88:\t\t}\n  89:\t\n  90:\t\tif (!nskb)\n  91:\t\t\treturn 0;\n  92:\t\n  93:\t\tskb = nskb;\n  94:\t\tskb_push(skb, ETH_HLEN);\n  95:\t\tskb-\u003epkt_type = PACKET_HOST;\n  96:\t\tskb-\u003eprotocol = eth_type_trans(skb, skb-\u003edev);\n  97:\t\n  98:\t\tif (unlikely(!dsa_user_dev_check(skb-\u003edev))) {\n  99:\t\t\t/* Packet is to be injected directly on an upper\n 100:\t\t\t * device, e.g. a team/bond, so skip all DSA-port\n 101:\t\t\t * specific actions.\n 102:\t\t\t */\n 103:\t\t\tnetif_rx(skb);\n 104:\t\t\treturn 0;\n 105:\t\t}\n 106:\t\n 107:\t\tp = netdev_priv(skb-\u003edev);\n 108:\t\n 109:\t\tif (unlikely(cpu_dp-\u003eds-\u003euntag_bridge_pvid ||\n 110:\t\t\t     cpu_dp-\u003eds-\u003euntag_vlan_aware_bridge_pvid)) {\n 111:\t\t\t/* dsa_software_vlan_untag() drops skb on failure */\n 112:\t\t\tnskb = dsa_software_vlan_untag(skb);\n 113:\t\t\tif (!nskb)\n 114:\t\t\t\treturn 0;\n 115:\t\t\tskb = nskb;\n 116:\t\t}\n 117:\t\n 118:\t\tdev_sw_netstats_rx_add(skb-\u003edev, skb-\u003elen + ETH_HLEN);\n 119:\t\n 120:\t\tif (dsa_skb_defer_rx_timestamp(p, skb))\n 121:\t\t\treturn 0;\n 122:\t\n 123:\t\tgro_cells_receive(\u0026p-\u003egcells, skb);\n 124:\t\n 125:\t\treturn 0;\n 126:\t}\n 127:\t\n 128:\tstruct packet_type dsa_pack_type __read_mostly = {\n 129:\t\t.type\t= cpu_to_be16(ETH_P_XDSA),\n"
}

43/2 2026/10/13 02:18 llm patch-evaluator
0m Model:
gemini-3.8-flash

Args:
null

Results:
null

Tokens:
							input: 64641
							output: 33
							thoughts: 83
						

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

**Deconstructing `dsa_switch_rcv` and Tracing the `dsa_ptr` Initialization**

Okay, diving into this `dsa_switch_rcv` function, the first thing that jumps out is that it's using `dev->dsa_ptr`. Specifically, `struct dsa_port *cpu_dp = dev->dsa_ptr;` and then there's an `unlikely` check if it's NULL, immediately exiting if so. That `dsa_ptr` is clearly crucial. I need to understand how this `dev->dsa_ptr` is set in the first place, or if it has some kind of default value.

The function's logic will hinge on this pointer being valid, so I need to trace back its initialization. Let's do a quick search for where `dev->dsa_ptr =` is assigned, or even just for instances of `dsa_ptr` to get a feel for how it's handled throughout the codebase. Finding the assignment and its surrounding context will give me the key to understanding how this part of the DSA stack is set up and working.



44/2 2026/10/13 02:18 tool grepper
0m Args:
{
  "Expression": "dsa_ptr\\s*=",
  "PathPrefixes": [
    "net/dsa/"
  ]
}

Results:
{
  "Output": "net/dsa/conduit.c=419=int dsa_conduit_setup(struct net_device *dev, struct dsa_port *cpu_dp)\n--\nnet/dsa/conduit.c-452-\nnet/dsa/conduit.c:453:\tdev-\u003edsa_ptr = cpu_dp;\nnet/dsa/conduit.c-454-\n--\nnet/dsa/conduit.c=474=void dsa_conduit_teardown(struct net_device *dev)\n--\nnet/dsa/conduit.c-480-\nnet/dsa/conduit.c:481:\tdev-\u003edsa_ptr = NULL;\nnet/dsa/conduit.c-482-\n--\nnet/dsa/dsa.c=1611=void dsa_switch_shutdown(struct dsa_switch *ds)\n--\nnet/dsa/dsa.c-1653-\tdsa_switch_for_each_cpu_port(dp, ds) {\nnet/dsa/dsa.c:1654:\t\tdp-\u003econduit-\u003edsa_ptr = NULL;\nnet/dsa/dsa.c-1655-\t\tnetdev_put(dp-\u003econduit, \u0026dp-\u003econduit_tracker);\n--\nnet/dsa/user.c=3410=static void dsa_conduit_lag_leave(struct net_device *conduit,\n--\nnet/dsa/user.c-3436-\t\t */\nnet/dsa/user.c:3437:\t\tlag_dev-\u003edsa_ptr = new_cpu_dp;\nnet/dsa/user.c-3438-\t\twmb();\n"
}

45/2 2026/10/13 02:18 llm patch-evaluator
0m Model:
gemini-3.8-flash

Args:
null

Results:
null

Tokens:
							input: 65457
							output: 33
							thoughts: 39
						

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

**Analyzing the `dsa_conduit_setup` Function**

Right, so `dsa_conduit_setup` is the linchpin that establishes the `dev->dsa_ptr` pointer, got it. My immediate question is, where the heck is this crucial function actually *called*? I need to trace its usage to understand the overall device initialization and data flow. Knowing the call sites of `dsa_conduit_setup` will reveal how and when the DSA (Distributed Switch Architecture) context is being set up for a given device. Let's dig into the code and find those calls.



46/2 2026/10/13 02:18 tool grepper
0m Args:
{
  "Expression": "dsa_conduit_setup",
  "PathPrefixes": [
    "net/dsa/"
  ]
}

Results:
{
  "Output": "net/dsa/conduit.c=409=static void dsa_conduit_reset_mtu(struct net_device *dev)\n--\nnet/dsa/conduit.c-418-\nnet/dsa/conduit.c:419:int dsa_conduit_setup(struct net_device *dev, struct dsa_port *cpu_dp)\nnet/dsa/conduit.c-420-{\n--\nnet/dsa/conduit.c=490=int dsa_conduit_lag_setup(struct net_device *lag_dev, struct dsa_port *cpu_dp,\n--\nnet/dsa/conduit.c-497-\tif (!netdev_uses_dsa(lag_dev)) {\nnet/dsa/conduit.c:498:\t\terr = dsa_conduit_setup(lag_dev, cpu_dp);\nnet/dsa/conduit.c-499-\t\tif (err)\n--\nnet/dsa/conduit.h=9=struct netlink_ext_ack;\nnet/dsa/conduit.h-10-\nnet/dsa/conduit.h:11:int dsa_conduit_setup(struct net_device *dev, struct dsa_port *cpu_dp);\nnet/dsa/conduit.h-12-void dsa_conduit_teardown(struct net_device *dev);\n--\nnet/dsa/dsa.c=787=static int dsa_tree_setup_conduit(struct dsa_switch_tree *dst)\n--\nnet/dsa/dsa.c-798-\nnet/dsa/dsa.c:799:\t\terr = dsa_conduit_setup(conduit, cpu_dp);\nnet/dsa/dsa.c-800-\t\tif (err)\n"
}

47/2 2026/10/13 02:18 llm patch-evaluator
0m Model:
gemini-3.8-flash

Args:
null

Results:
null

Tokens:
							input: 66149
							output: 26
							thoughts: 2269
						

Thoughts:
**Analysis of DSA Tagging and Motorcomm YT922x Driver Reachability in QEMU/amd64**

Okay, let's break this down. My initial thought process is triggered by `dsa_conduit_setup` called during DSA tree setup, which is itself initiated by `dsa_register_switch`. The core question becomes: can the `tag_yt922x.c` driver ever be utilized by `dsa_loop` or any other DSA switch within the QEMU/amd64 environment?

I'm examining `tag_yt922x.c`. It defines `yt922x_netdev_ops`, which includes functions for transmission (`xmit`), reception (`rcv`), and the associated tagging protocol (`DSA_TAG_PROTO_YT922X`). It's clear that this driver is specifically designed for Motorcomm YT922x switches.  I see `DSA_TAG_PROTO_YT922X` is also used in `drivers/net/dsa/motorcomm/chip.c` within `yt922x_dsa_get_tag_protocol` and `yt922x_dsa_switch_ops`, linking the driver to the Motorcomm chip's operation.  The `chip.c` file itself contains an MDIO driver (`yt921x_mdio_driver`), with probe, remove, and shutdown functions.

The critical point now is reachability. I'm carefully reviewing the negative criteria for determining whether this code path is worth fuzzing, specifically in the context of our QEMU/amd64 environment.  I note that the Motorcomm YT9215 and YT9224 are dedicated Ethernet switch chips, ASICs, that communicate via MDIO/SMI.  They are physical hardware. The `yt921x_mdio_probe` function indicates that it's interacting with MDIO devices.

The key realization hits:  Can QEMU actually emulate these Motorcomm devices? The answer is no.  They are physical Ethernet switch ICs and not emulated in standard QEMU.  There's no MDIO bus emulation, and therefore no virtual Motorcomm switch in the standard QEMU setup.  This firmly puts the code into the category of "Structurally unreachable hardware." It doesn't matter how the code is linked, it's unreachable due to the lack of hardware simulation.

Now, let's revisit `dsa_loop` to be thorough. I check if `dsa_loop` can ever utilize the `tag_yt922x`.  The system calls `dsa_tree_change_tag_proto` by writing to `/sys/class/net/eth0/dsa/tagging`.  This, in turn, calls `dsa_switch_change_tag_proto`.  Crucially, for `dsa_loop`, the `ds->ops` is the `dsa_loop_driver`. However, the `dsa_loop_driver` does *not* implement the `.change_tag_protocol` function.  Therefore, even in theory, trying to change the tagging protocol on `dsa_loop` will result in a `-EOPNOTSUPP` error. And furthermore, any call of .change_tag_protocol requires physical hardware, unreachable in QEMU.



48/2 2026/10/13 02:18 tool grepper
0m Args:
{
  "Expression": "mv88e6xxx_change_tag_protocol"
}

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"
}

49/2 2026/10/13 02:18 llm patch-evaluator
0m Model:
gemini-3.8-flash

Args:
null

Results:
null

Tokens:
							input: 69522
							output: 46
							thoughts: 53
						

Thoughts:
Okay, let's dive into this. I need to understand what `mv88e6xxx_change_tag_protocol` actually *does*. Right, so, perusing the code, it seems like lines 6724 through 6745 in `drivers/net/dsa/mv88e6xxx/chip.c` should hold the key. Let's see what's going on there and piece together this function's purpose. I'll need to absorb the surrounding context, of course, but that segment should be where the core logic of the protocol change resides.



50/2 2026/10/13 02:18 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"
}

51/2 2026/10/13 02:18 llm patch-evaluator
0m Model:
gemini-3.8-flash

Args:
null

Results:
null

Tokens:
							input: 70142
							output: 22
							thoughts: 37
						

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

**Investigating Switch Tagging Protocols**

Alright, so `mv88e6xxx` is locked down. My understanding is that it's strictly EDSA and DSA, which isn't ideal for all our applications. Time to pivot. Let's dig deeper into the possibilities with the `felix` driver. I need to refresh my memory on the options it provides. Specifically, I'll focus on `felix_change_tag_protocol`. That function will tell me if we have a broader set of tagging protocols to choose from, or if we are similarly constrained. It will determine the direction of the investigation.



52/2 2026/10/13 02:18 tool grepper
0m Args:
{
  "Expression": "felix_change_tag_protocol"
}

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/13 02:18 llm patch-evaluator
0m Model:
gemini-3.8-flash

Args:
null

Results:
null

Tokens:
							input: 70790
							output: 43
							thoughts: 45
						

Thoughts:
Okay, let's dive into this. I need to understand what `felix_change_tag_protocol` actually *does*. The name implies it’s related to changing the tagging protocol, but I need the specifics. Alright, I'll go straight to the source. Let's see... the code's in `drivers/net/dsa/ocelot/felix.c`, and the relevant section is lines 754 through 770. Time to get those lines loaded and analyze them. Hopefully, this is a concise function!



54/2 2026/10/13 02:19 tool read-file
0m Args:
{
  "File": "drivers/net/dsa/ocelot/felix.c",
  "FirstLine": 754,
  "LineCount": 25
}

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 774:\t\told_proto_ops = felix-\u003etag_proto_ops;\n 775:\t\n 776:\t\tif (proto_ops == old_proto_ops)\n 777:\t\t\treturn 0;\n 778:\t\n"
}

55/2 2026/10/13 02:19 llm patch-evaluator
0m Model:
gemini-3.8-flash

Args:
null

Results:
null

Tokens:
							input: 71400
							output: 26
							thoughts: 53
						

Thoughts:
Okay, here's my interpretation of those thoughts, presented as my own mental process:

**Diving into the Driver's E-Mail**

Hmm, so `felix` is throwing that `-EPROTONOSUPPORT` error again. Okay, that's not ideal. Let's see... what about `rtl8365mb_change_tag_protocol`? That function seems like a likely candidate for the source of the problem, given the context. I'm going to quickly scan the surrounding lines of code around `rtl8365mb_change_tag_protocol`. Get a feel for its dependencies, its inputs, and how it handles different protocols. My gut tells me this is the critical area to focus on. Let's see if this rings any bells.



56/2 2026/10/13 02:19 tool grepper
0m Args:
{
  "Expression": "rtl8365mb_change_tag_protocol"
}

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

57/2 2026/10/13 02:19 llm patch-evaluator
0m Model:
gemini-3.8-flash

Args:
null

Results:
null

Tokens:
							input: 72009
							output: 49
							thoughts: 41
						

Thoughts:
Here's my take on the thought process, as requested:

**Diving into the rtl8365mb Tag Protocol**

Okay, time to get to the heart of this. My focus is on understanding how the tag protocol is handled within the `rtl8365mb` driver, specifically within `rtl8365mb_main.c`. I need to figure out how `rtl8365mb_change_tag_protocol` functions. This function likely manages the different tagging schemes supported by the Realtek RTL8365MB switch. I'll need to dissect its logic, looking at which conditions trigger a protocol change, what data structures it manipulates, and how it interacts with the underlying hardware registers. I'm expecting this is going to be a crucial piece of the puzzle for understanding packet flow, VLAN handling, and potential compatibility issues. I need to understand what's going on in this function.



58/2 2026/10/13 02:19 tool read-file
0m Args:
{
  "File": "drivers/net/dsa/realtek/rtl8365mb_main.c",
  "FirstLine": 3005,
  "LineCount": 20
}

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

59/2 2026/10/13 02:19 llm patch-evaluator
0m Model:
gemini-3.8-flash

Args:
null

Results:
null

Tokens:
							input: 72660
							output: 132
							thoughts: 3510
						

Thoughts:
**Analysis of the Motorcomm YT922X DSA Switch Driver Patch for Fuzzing Eligibility**

Okay, so the task is to determine if the changes in this patch are "WorthFuzzing".  My initial thought is that this is a case where the answer will be "no".

My reasoning is as follows: None of the current code base supports the `DSA_TAG_PROTO_YT922X` protocol. Looking at the code, it becomes clear that the only driver that *does* return `DSA_TAG_PROTO_YT922X` is the Motorcomm switch driver, specifically `yt922x_dsa_switch_ops`. This immediately raises a red flag. Let's dig deeper:

The driver in question is `yt921x_mdio_driver`. Examining its `of_match` table, it is clear this driver only supports two OF compatible strings: `"motorcomm,yt9215"` and `"motorcomm,yt9224"`. These are Device Tree (OF) compatible strings, and, significantly, are *not* something that would be used on AMD64. Even on systems that *do* use OF (like ARM or MIPS), the presence of *physical* Motorcomm YT9215 or YT9224 switch chips connected to an MDIO bus and described in the device tree would be required. The code itself, specifically `yt921x_mdio_probe`, confirms this. The `yt92xx_register_switch` function attempts to read a register (`YT921X_CHIP_ID`) over MDIO, *communicating with the actual physical switch hardware*. Without the physical chip, this probe *cannot* succeed. On amd64, of course, Device Tree is not even used. And QEMU, the standard virtual machine for testing, does *not* emulate any Motorcomm YT9215 or YT9224 switch chips.

Now, let's apply the *negative* criteria for WorthFuzzing.  According to the documentation, we should return `WorthFuzzing=false` if *all* modified code falls into one of a few categories: non-kernel/non-executable changes, structurally unreachable hardware or unreachable execution paths. This patch modifies several files: MAINTAINERS, Kconfig, Makefile, the switch driver (`chip.c`, `chip.h`, `mdio_bus.c`, `mdio_bus.h`, `pcs-922x.c`, `pcs.h`), include files (`dsa.h`), and tag driver (`tag_yt922x.c`).

A key question is whether `net/dsa/tag_yt922x.c` can be reached in *any* way without the physical Motorcomm YT9224 hardware.

The code in `tag_yt922x.c` contains functions `yt922x_tag_xmit` and `yt922x_tag_rcv`. They are registered as a DSA tag driver via `module_dsa_tag_driver`. The tag functions are invoked in cases where DSA netdevs are configured. `yt922x_tag_xmit` is called when a packet is transmitted on a DSA user netdev that uses `DSA_TAG_PROTO_YT922X`.  `yt922x_tag_rcv` is called when a packet is received on a conduit netdev, where `cpu_dp->rcv` is `yt922x_tag_rcv`.

Now, how does a netdev get associated with `DSA_TAG_PROTO_YT922X`? There are two ways:
1.  A DSA switch driver must set its `.get_tag_protocol` function to return `DSA_TAG_PROTO_YT922X`. As we established, the *only* DSA switch driver that does this is `drivers/net/dsa/motorcomm/chip.c` which, as we have already extensively shown, is an Ethernet switch *ASIC*, which must be connected to an MDIO and described via a Device Tree. This *cannot* happen in QEMU.
2.  The tagging protocol could be changed dynamically via sysfs (`/sys/class/net/<conduit>/dsa/tagging`).  For this to even *exist*, the device `<dev>` must have `dev->dsa_ptr` set, meaning it is a DSA *conduit*. This is only created when a DSA switch is probed and registered using `dsa_register_switch()`. The only virtual DSA driver in standard QEMU is `dsa_loop`. Can `dsa_loop` change its


60/2 2026/10/13 02:19 tool set-results
0m Args:
{
  "EnableConfigs": [],
  "FocusSymbols": [],
  "Reasoning": "The patch series adds support for the Motorcomm YT9224 Ethernet switch chip and its DSA tag driver (DSA_TAG_PROTO_YT922X). Motorcomm YT921x/YT922x devices are external Ethernet switch ASICs controlled via MDIO/SMI and probed via Device Tree (OF). They require physical switch hardware not emulated in standard QEMU/amd64 virtualized environments, making the modified driver and tagging code structurally unreachable.",
  "WorthFuzzing": false
}

Results:
{
  "EnableConfigs": null,
  "FocusSymbols": [],
  "Reasoning": "The patch series adds support for the Motorcomm YT9224 Ethernet switch chip and its DSA tag driver (DSA_TAG_PROTO_YT922X). Motorcomm YT921x/YT922x devices are external Ethernet switch ASICs controlled via MDIO/SMI and probed via Device Tree (OF). They require physical switch hardware not emulated in standard QEMU/amd64 virtualized environments, making the modified driver and tagging code structurally unreachable.",
  "WorthFuzzing": false
}

61/1 2026/10/13 02:19 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)