| Seq | Timestamp | Type | Name | Duration |
|---|---|---|---|---|
| 0/0 | 2026/11/25 15:22 | flow | patch-triage |
5mArgs:null Results: {
"EnableConfigs": null,
"FocusSymbols": [],
"KMSANReasoning": "",
"NeedsKMSAN": false,
"Reasoning": "The patch series introduces support for the SoC-e SWIP FPGA Ethernet switch IP core, including devicetree bindings, an MFD core driver (soce-swip-core.c), an MDIO bus controller driver (mdio-soce.c), a DSA switch driver (soce-swip.c), and the SDSA tagging driver (tag_sdsa.c). These drivers probe via Device Tree for a memory-mapped FPGA IP core and require physical FPGA hardware that is not emulated in standard QEMU or GCE virtual machines on amd64. The SDSA tagging protocol (tag_sdsa.c) is tied specifically to this switch hardware and cannot be attached to mockup drivers like dsa_loop (which does not support runtime tag protocol changes). As such, all executable code introduced by this patch is structurally unreachable in standard fuzzing environments.",
"WorthFuzzing": false
} |
| 1/1 | 2026/11/25 15:22 | action | read-patch-diff |
0mArgs:null Results: {
"PatchDiff": "commit cfc1f499ca8f428b0e2faad735d88b4325b2b092\nAuthor: syz-cluster \u003ctriage@syzkaller.com\u003e\nDate: Wed Nov 25 15:22:14 2026 +0000\n\n syz-cluster: applied patch under review\n\ndiff --git a/Documentation/devicetree/bindings/mfd/soce,swip.yaml b/Documentation/devicetree/bindings/mfd/soce,swip.yaml\nnew file mode 100644\nindex 00000000000000..69bb9eae379f8b\n--- /dev/null\n+++ b/Documentation/devicetree/bindings/mfd/soce,swip.yaml\n@@ -0,0 +1,138 @@\n+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)\n+%YAML 1.2\n+---\n+$id: http://devicetree.org/schemas/mfd/soce,swip.yaml#\n+$schema: http://devicetree.org/meta-schemas/core.yaml#\n+\n+title: SoC-e SWIP multifunction Ethernet switch FPGA IP core\n+\n+maintainers:\n+ - Vasilij Strassheim \u003cv.strassheim@linutronix.de\u003e\n+\n+description:\n+ SoC-e Switch IP (SWIP) cores integrate Ethernet switching logic, an\n+ MDIO controller, and an MDIO bus multiplexer in one memory-mapped device.\n+ The MDIO bus multiplexer is wired to the integrated MDIO controller.\n+\n+properties:\n+ compatible:\n+ const: soce,swip\n+\n+ reg:\n+ maxItems: 1\n+\n+ '#address-cells':\n+ const: 1\n+\n+ '#size-cells':\n+ const: 1\n+\n+ ranges: true\n+\n+ ethernet-switch@0:\n+ $ref: /schemas/net/dsa/soce,swip-switch.yaml#\n+ unevaluatedProperties: false\n+\n+ mdio-mux@202:\n+ $ref: /schemas/net/mdio-mux-mmioreg.yaml#\n+ unevaluatedProperties: false\n+\n+ mdio@204:\n+ $ref: /schemas/net/soce,swip-mdio.yaml#\n+ unevaluatedProperties: false\n+\n+required:\n+ - compatible\n+ - reg\n+ - '#address-cells'\n+ - '#size-cells'\n+ - ranges\n+ - ethernet-switch@0\n+\n+dependentRequired:\n+ mdio-mux@202:\n+ - mdio@204\n+\n+additionalProperties: false\n+\n+examples:\n+ - |\n+ ip-core@80020000 {\n+ compatible = \"soce,swip\";\n+ reg = \u003c0x80020000 0x10000\u003e;\n+ ranges = \u003c0x0 0x80020000 0x10000\u003e;\n+ #address-cells = \u003c1\u003e;\n+ #size-cells = \u003c1\u003e;\n+\n+ ethernet-switch@0 {\n+ compatible = \"soce,swip-switch-00-04-0c-10\";\n+ reg = \u003c0x0 0x10000\u003e;\n+\n+ ethernet-ports {\n+ #address-cells = \u003c1\u003e;\n+ #size-cells = \u003c0\u003e;\n+\n+ ethernet-port@0 {\n+ reg = \u003c0\u003e;\n+ phy-handle = \u003c\u0026switchphy0\u003e;\n+ phy-mode = \"rgmii-id\";\n+ };\n+\n+ ethernet-port@1 {\n+ reg = \u003c1\u003e;\n+ phy-handle = \u003c\u0026switchphy1\u003e;\n+ phy-mode = \"rgmii-id\";\n+ };\n+\n+ ethernet-port@2 {\n+ reg = \u003c2\u003e;\n+ ethernet = \u003c\u0026eth0\u003e;\n+ phy-mode = \"gmii\";\n+\n+ fixed-link {\n+ speed = \u003c1000\u003e;\n+ full-duplex;\n+ };\n+ };\n+ };\n+ };\n+\n+ mdio-mux@202 {\n+ compatible = \"mdio-mux-mmioreg\", \"mdio-mux\";\n+ reg = \u003c0x202 0x2\u003e;\n+ mux-mask = \u003c0x07ff\u003e;\n+ mdio-parent-bus = \u003c\u0026mdio_parent\u003e;\n+ #address-cells = \u003c1\u003e;\n+ #size-cells = \u003c0\u003e;\n+\n+ mdio@0 {\n+ reg = \u003c0\u003e;\n+ #address-cells = \u003c1\u003e;\n+ #size-cells = \u003c0\u003e;\n+\n+ switchphy0: ethernet-phy@1 {\n+ compatible = \"ethernet-phy-ieee802.3-c22\";\n+ reg = \u003c1\u003e;\n+ };\n+ };\n+\n+ mdio@1 {\n+ reg = \u003c1\u003e;\n+ #address-cells = \u003c1\u003e;\n+ #size-cells = \u003c0\u003e;\n+\n+ switchphy1: ethernet-phy@1 {\n+ compatible = \"ethernet-phy-ieee802.3-c22\";\n+ reg = \u003c1\u003e;\n+ };\n+ };\n+ };\n+\n+ mdio_parent: mdio@204 {\n+ compatible = \"soce,swip-mdio\";\n+ reg = \u003c0x204 0xc\u003e, \u003c0x200 0x2\u003e;\n+ reg-names = \"data\", \"control\";\n+ #address-cells = \u003c1\u003e;\n+ #size-cells = \u003c0\u003e;\n+ };\n+ };\ndiff --git a/Documentation/devicetree/bindings/net/dsa/soce,swip-switch.yaml b/Documentation/devicetree/bindings/net/dsa/soce,swip-switch.yaml\nnew file mode 100644\nindex 00000000000000..55232c0f3675e5\n--- /dev/null\n+++ b/Documentation/devicetree/bindings/net/dsa/soce,swip-switch.yaml\n@@ -0,0 +1,101 @@\n+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)\n+%YAML 1.2\n+---\n+$id: http://devicetree.org/schemas/net/dsa/soce,swip-switch.yaml#\n+$schema: http://devicetree.org/meta-schemas/core.yaml#\n+\n+title: SoC-e SWIP FPGA Ethernet switch function\n+\n+maintainers:\n+ - Vasilij Strassheim \u003cv.strassheim@linutronix.de\u003e\n+\n+description:\n+ Ethernet switch function of the SoC-e Switch IP (SWIP) FPGA core. The port\n+ count and presence of VLAN and STP register blocks depend on the FPGA\n+ synthesis configuration.\n+\n+$ref: dsa.yaml#/$defs/ethernet-ports\n+\n+properties:\n+ compatible:\n+ const: soce,swip-switch-00-04-0c-10\n+ description:\n+ This compatible identifies the register layout; its suffix gives\n+ the offsets of the core version and feature identification\n+ registers (0x00, 0x04, 0x0c, and 0x10). Port counts and optional\n+ features depend on the FPGA synthesis configuration and are\n+ detected at runtime using this register layout.\n+\n+ reg:\n+ description:\n+ Register window of the IP core. Switch register blocks are located at\n+ offsets defined by the compatible. The MDIO controller and bus\n+ multiplexer occupy separate subregions described by sibling nodes.\n+ maxItems: 1\n+\n+ ethernet-ports:\n+ type: object\n+ patternProperties:\n+ '^ethernet-port@[0-9a-f]+$':\n+ type: object\n+\n+ properties:\n+ reg:\n+ maximum: 30\n+ description: Switch port index, from 0 through 30.\n+\n+ phy-mode:\n+ enum:\n+ - mii\n+ - gmii\n+ - rmii\n+ - rgmii\n+ - rgmii-id\n+ - rgmii-rxid\n+ - rgmii-txid\n+\n+ required:\n+ - reg\n+ - phy-mode\n+\n+required:\n+ - compatible\n+ - reg\n+ - ethernet-ports\n+\n+unevaluatedProperties: false\n+\n+examples:\n+ - |\n+ ethernet-switch@0 {\n+ compatible = \"soce,swip-switch-00-04-0c-10\";\n+ reg = \u003c0x0 0x10000\u003e;\n+\n+ ethernet-ports {\n+ #address-cells = \u003c1\u003e;\n+ #size-cells = \u003c0\u003e;\n+\n+ ethernet-port@0 {\n+ reg = \u003c0\u003e;\n+ phy-handle = \u003c\u0026switchphy0\u003e;\n+ phy-mode = \"rgmii-id\";\n+ };\n+\n+ ethernet-port@1 {\n+ reg = \u003c1\u003e;\n+ phy-handle = \u003c\u0026switchphy1\u003e;\n+ phy-mode = \"rgmii-id\";\n+ };\n+\n+ ethernet-port@2 {\n+ reg = \u003c2\u003e;\n+ ethernet = \u003c\u0026eth0\u003e;\n+ phy-mode = \"gmii\";\n+\n+ fixed-link {\n+ speed = \u003c1000\u003e;\n+ full-duplex;\n+ };\n+ };\n+ };\n+ };\ndiff --git a/Documentation/devicetree/bindings/net/soce,swip-mdio.yaml b/Documentation/devicetree/bindings/net/soce,swip-mdio.yaml\nnew file mode 100644\nindex 00000000000000..7a0b8bd3ab71b3\n--- /dev/null\n+++ b/Documentation/devicetree/bindings/net/soce,swip-mdio.yaml\n@@ -0,0 +1,47 @@\n+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)\n+%YAML 1.2\n+---\n+$id: http://devicetree.org/schemas/net/soce,swip-mdio.yaml#\n+$schema: http://devicetree.org/meta-schemas/core.yaml#\n+\n+title: SoC-e SWIP FPGA MDIO controller\n+\n+maintainers:\n+ - Vasilij Strassheim \u003cv.strassheim@linutronix.de\u003e\n+\n+description:\n+ MDIO controller integrated into the SoC-e Switch IP (SWIP) FPGA core.\n+ External MDIO buses are selected through a sibling MMIO MDIO mux.\n+\n+$ref: mdio.yaml#\n+\n+properties:\n+ compatible:\n+ const: soce,swip-mdio\n+\n+ reg:\n+ items:\n+ - description: MDIO parameter, write data, and read data registers\n+ - description: Lower 16-bit half of the MDIO transaction control register\n+\n+ reg-names:\n+ items:\n+ - const: data\n+ - const: control\n+\n+required:\n+ - compatible\n+ - reg\n+ - reg-names\n+\n+unevaluatedProperties: false\n+\n+examples:\n+ - |\n+ mdio@204 {\n+ compatible = \"soce,swip-mdio\";\n+ reg = \u003c0x204 0xc\u003e, \u003c0x200 0x2\u003e;\n+ reg-names = \"data\", \"control\";\n+ #address-cells = \u003c1\u003e;\n+ #size-cells = \u003c0\u003e;\n+ };\ndiff --git a/Documentation/devicetree/bindings/vendor-prefixes.yaml b/Documentation/devicetree/bindings/vendor-prefixes.yaml\nindex 5471a06f93f101..20a850a6e86ff1 100644\n--- a/Documentation/devicetree/bindings/vendor-prefixes.yaml\n+++ b/Documentation/devicetree/bindings/vendor-prefixes.yaml\n@@ -1599,6 +1599,8 @@ patternProperties:\n description: Standard Microsystems Corporation\n \"^snps,.*\":\n description: Synopsys, Inc.\n+ \"^soce,.*\":\n+ description: System-On-Chip Engineering, S.L.\n \"^sochip,.*\":\n description: Shenzhen SoChip Technology Co., Ltd.\n \"^socionext,.*\":\ndiff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig\nindex 87ed55c155f03f..ff3378e928fd8b 100644\n--- a/drivers/mfd/Kconfig\n+++ b/drivers/mfd/Kconfig\n@@ -1291,6 +1291,15 @@ config MFD_QCOM_RPM\n \t Say M here if you want to include support for the Qualcomm RPM as a\n \t module. This will build a module called \"qcom_rpm\".\n \n+config MFD_SOCE_SWIP\n+\ttristate\n+\tdepends on OF\n+\thelp\n+\t Support for memory-mapped SoC-e Ethernet switch IP cores implemented\n+\t in FPGAs. These devices integrate an Ethernet\n+\t switch, an MDIO controller, and an MDIO bus selector.\n+\t This is selected if Ethernet switch functionality is configured.\n+\n config MFD_SPACEMIT_P1\n \ttristate \"SpacemiT P1 PMIC\"\n \tdepends on ARCH_SPACEMIT || COMPILE_TEST\ndiff --git a/drivers/mfd/Makefile b/drivers/mfd/Makefile\nindex f8101d2a9ce950..9f4d2ccc3a2492 100644\n--- a/drivers/mfd/Makefile\n+++ b/drivers/mfd/Makefile\n@@ -302,6 +302,8 @@ obj-$(CONFIG_MFD_QNAP_MCU)\t+= qnap-mcu.o\n obj-$(CONFIG_MFD_RSMU_I2C)\t+= rsmu_i2c.o rsmu_core.o\n obj-$(CONFIG_MFD_RSMU_SPI)\t+= rsmu_spi.o rsmu_core.o\n \n+obj-$(CONFIG_MFD_SOCE_SWIP)\t+= soce-swip-core.o\n+\n obj-$(CONFIG_MFD_UPBOARD_FPGA)\t+= upboard-fpga.o\n \n obj-$(CONFIG_MFD_LOONGSON_SE)\t+= loongson-se.o\ndiff --git a/drivers/mfd/soce-swip-core.c b/drivers/mfd/soce-swip-core.c\nnew file mode 100644\nindex 00000000000000..2f7d966eeab275\n--- /dev/null\n+++ b/drivers/mfd/soce-swip-core.c\n@@ -0,0 +1,76 @@\n+// SPDX-License-Identifier: GPL-2.0\n+\n+#include \u003clinux/bitfield.h\u003e\n+#include \u003clinux/io.h\u003e\n+#include \u003clinux/module.h\u003e\n+#include \u003clinux/of_platform.h\u003e\n+#include \u003clinux/platform_device.h\u003e\n+\n+#define SWIP_CORE_VERSION_OFFSET\t\t0x0000\n+#define SWIP_CORE_VERSION_VERSION_MASK\t\tGENMASK(31, 24)\n+#define SWIP_CORE_VERSION_SUBVERSION_MASK\tGENMASK(23, 16)\n+#define SWIP_CORE_VERSION_REVISION_MASK\t\tGENMASK(15, 0)\n+#define SWIP_MIN_CORE_VERSION\t\t\t0x24\n+#define SWIP_MIN_CORE_SUBVERSION\t\t0x01\n+\n+static int swip_check_version(struct device *dev, void __iomem *base)\n+{\n+\tu8 subversion;\n+\tu16 revision;\n+\tu8 version;\n+\tu32 regval;\n+\n+\tregval = readl(base + SWIP_CORE_VERSION_OFFSET);\n+\tversion = FIELD_GET(SWIP_CORE_VERSION_VERSION_MASK, regval);\n+\tsubversion = FIELD_GET(SWIP_CORE_VERSION_SUBVERSION_MASK, regval);\n+\trevision = FIELD_GET(SWIP_CORE_VERSION_REVISION_MASK, regval);\n+\tif (version \u003c SWIP_MIN_CORE_VERSION ||\n+\t (version == SWIP_MIN_CORE_VERSION \u0026\u0026\n+\t subversion \u003c SWIP_MIN_CORE_SUBVERSION))\n+\t\treturn dev_err_probe(dev, -ENODEV,\n+\t\t\t\t \"unsupported core version %02x.%02x.%04x\\n\",\n+\t\t\t\t version, subversion, revision);\n+\n+\tdev_info(dev, \"SoC-e IP core version %02x.%02x.%04x detected\\n\",\n+\t\t version, subversion, revision);\n+\n+\treturn 0;\n+}\n+\n+static int swip_probe(struct platform_device *pdev)\n+{\n+\tstruct device *dev = \u0026pdev-\u003edev;\n+\tstruct resource *res;\n+\tvoid __iomem *base;\n+\tint ret;\n+\n+\tres = platform_get_resource(pdev, IORESOURCE_MEM, 0);\n+\tif (!res || resource_size(res) \u003c sizeof(u32))\n+\t\treturn -EINVAL;\n+\tbase = devm_ioremap(dev, res-\u003estart, sizeof(u32));\n+\tif (!base)\n+\t\treturn -ENOMEM;\n+\tret = swip_check_version(dev, base);\n+\tif (ret)\n+\t\treturn ret;\n+\n+\treturn devm_of_platform_populate(dev);\n+}\n+\n+static const struct of_device_id swip_of_match[] = {\n+\t{ .compatible = \"soce,swip\" },\n+\t{ }\n+};\n+MODULE_DEVICE_TABLE(of, swip_of_match);\n+\n+static struct platform_driver swip_driver = {\n+\t.probe = swip_probe,\n+\t.driver = {\n+\t\t.name = \"soce-swip\",\n+\t\t.of_match_table = swip_of_match,\n+\t},\n+};\n+module_platform_driver(swip_driver);\n+\n+MODULE_DESCRIPTION(\"SoC-e multifunction switch IP device driver\");\n+MODULE_LICENSE(\"GPL\");\ndiff --git a/drivers/net/dsa/Kconfig b/drivers/net/dsa/Kconfig\nindex d62f0cccf13d54..92415169db81c0 100644\n--- a/drivers/net/dsa/Kconfig\n+++ b/drivers/net/dsa/Kconfig\n@@ -149,6 +149,21 @@ config NET_DSA_SMSC_LAN9303_MDIO\n \t Enable access functions if the Microchip LAN9303/LAN9354 is configured\n \t for MDIO managed mode.\n \n+config NET_DSA_SOCE_SWIP\n+\ttristate \"SoC-e SWIP switches\"\n+\tdepends on NET_DSA\n+\tdepends on OF\n+\tdepends on HAS_IOMEM\n+\tselect MFD_SOCE_SWIP\n+\tselect MDIO_SOCE_SWIP\n+\tselect MDIO_BUS_MUX_MMIOREG\n+\tselect NET_DSA_TAG_SDSA\n+\thelp\n+\t This enables support for switches based on SoC-e SWIP IP cores.\n+\t Frames are exchanged with the CPU port using the SDSA DSA tag protocol.\n+\t The driver supports switch variants whose features and number of ports\n+\t are selected at synthesis time and detected at runtime.\n+\n config NET_DSA_VITESSE_VSC73XX\n \ttristate\n \tselect NET_DSA_TAG_VSC73XX_8021Q\ndiff --git a/drivers/net/dsa/Makefile b/drivers/net/dsa/Makefile\nindex 7e637d56b35c80..cb00d83ed29a95 100644\n--- a/drivers/net/dsa/Makefile\n+++ b/drivers/net/dsa/Makefile\n@@ -11,6 +11,7 @@ obj-$(CONFIG_NET_DSA_RZN1_A5PSW) += rzn1_a5psw.o\n obj-$(CONFIG_NET_DSA_SMSC_LAN9303) += lan9303-core.o\n obj-$(CONFIG_NET_DSA_SMSC_LAN9303_I2C) += lan9303_i2c.o\n obj-$(CONFIG_NET_DSA_SMSC_LAN9303_MDIO) += lan9303_mdio.o\n+obj-$(CONFIG_NET_DSA_SOCE_SWIP) += soce-swip.o\n obj-$(CONFIG_NET_DSA_VITESSE_VSC73XX) += vitesse-vsc73xx-core.o\n obj-$(CONFIG_NET_DSA_VITESSE_VSC73XX_PLATFORM) += vitesse-vsc73xx-platform.o\n obj-$(CONFIG_NET_DSA_VITESSE_VSC73XX_SPI) += vitesse-vsc73xx-spi.o\ndiff --git a/drivers/net/dsa/soce-swip.c b/drivers/net/dsa/soce-swip.c\nnew file mode 100644\nindex 00000000000000..624c7fbfd73f8a\n--- /dev/null\n+++ b/drivers/net/dsa/soce-swip.c\n@@ -0,0 +1,701 @@\n+// SPDX-License-Identifier: GPL-2.0\n+/*\n+ * Copyright (c) 2020-2026 System on Chip engineering, S.L.\n+ * Copyright (c) 2026 Linutronix GmbH\n+ * Author: Vasilij Strassheim \u003cv.strassheim@linutronix.de\u003e\n+ */\n+\n+#include \u003clinux/bitfield.h\u003e\n+#include \u003clinux/if_vlan.h\u003e\n+#include \u003clinux/io.h\u003e\n+#include \u003clinux/iopoll.h\u003e\n+#include \u003clinux/module.h\u003e\n+#include \u003clinux/netdevice.h\u003e\n+#include \u003clinux/of.h\u003e\n+#include \u003clinux/of_net.h\u003e\n+#include \u003clinux/phy.h\u003e\n+#include \u003clinux/phylink.h\u003e\n+#include \u003clinux/platform_device.h\u003e\n+#include \u003clinux/string.h\u003e\n+\n+#include \u003cnet/dsa.h\u003e\n+\n+#include \"soce-swip.h\"\n+\n+#define SWIP_IDENT_BASE_OFFSET\t\t\t0x0000\n+#define SWIP_IDENT_SIZE\t\t\t\t0x0050\n+#define SWIP_LIC_FEATURES_OFFSET\t\t0x0004\n+#define SWIP_LIC_FEATURES_NUM_PORTS_MASK\tGENMASK(31, 27)\n+#define SWIP_IMPL_FEATURES0_OFFSET\t\t0x000c\n+#define SWIP_IMPL_FEATURES0_NUM_PORTS_MASK\tGENMASK(31, 27)\n+#define SWIP_IMPL_FEATURES0_PORT_VLAN\t\tBIT(9)\n+#define SWIP_IMPL_FEATURES0_STP\t\t\tBIT(20)\n+#define SWIP_IMPL_FEATURES0_DSA\t\t\tBIT(23)\n+#define SWIP_MIN_NUM_PORTS\t\t\t3\n+\n+#define SWIP_DSA_BASE_OFFSET\t\t\t0x1200\n+#define SWIP_DSA_SIZE\t\t\t\t0x0044\n+#define SWIP_TAG_ALL_FRAMES_CTRL_OFFSET\t\t0x001c\n+#define SWIP_TAG_ALL_FRAMES_CTRL_ENABLE\t\tBIT(0)\n+#define SWIP_CUSTOM_RULES_TAGGING_OFFSET\t0x0020\n+#define SWIP_CUSTOM_RULES_TAGGING_ENABLE\tBIT(0)\n+\n+#define SWIP_PORTS_BASE_OFFSET\t\t\t0x3000\n+#define SWIP_PORTS_SIZE\t\t\t\t0x0014\n+#define SWIP_PORTS_SELECTOR_OFFSET\t\t0x0000\n+#define SWIP_PORTS_SELECTOR_PORT_MASK\t\tGENMASK(7, 0)\n+#define SWIP_PORTS_CTRL_OFFSET\t\t\t0x0004\n+#define SWIP_PORTS_CTRL_INGR_EN\t\t\tBIT(0)\n+#define SWIP_PORTS_CTRL_EGR_EN\t\t\tBIT(1)\n+\n+#define SWIP_STP_BASE_OFFSET\t\t\t0x0f00\n+#define SWIP_STP_SIZE\t\t\t\t0x0040\n+#define SWIP_STP_CTRL_OFFSET\t\t\t0x0000\n+#define SWIP_STP_CTRL_ENABLE\t\t\tBIT(0)\n+\n+#define SWIP_VLAN_BASE_OFFSET\t\t\t0x0d00\n+#define SWIP_VLAN_SIZE\t\t\t\t0x0044\n+#define SWIP_VLAN_CTRL_OFFSET\t\t\t0x0000\n+#define SWIP_VLAN_CTRL_ENABLE\t\t\tBIT(0)\n+#define SWIP_VLAN_RESET_OFFSET\t\t\t0x0004\n+#define SWIP_VLAN_RESET_CMD\t\t\tBIT(0)\n+#define SWIP_VLAN_PORT_SEL_OFFSET\t\t0x0010\n+#define SWIP_VLAN_PORT_SEL_PORT_MASK\t\tGENMASK(7, 0)\n+#define SWIP_VLAN_PORT_MODE_OFFSET\t\t0x0014\n+#define SWIP_VLAN_PORT_MODE_HYBRID\t\t0x2\n+#define SWIP_VLAN_PORT_TYPE_OFFSET\t\t0x0018\n+#define SWIP_VLAN_PORT_TYPE_UNAWARE\t\t0x0\n+#define SWIP_VLAN_PORT_VLAN_OFFSET\t\t0x001c\n+#define SWIP_VLAN_PORT_VLAN_PVID_MASK\t\tGENMASK(11, 0)\n+#define SWIP_VLAN_PORT_INGR_FILTER_OFFSET\t0x0020\n+#define SWIP_VLAN_PORT_INGR_ACCEPT_OFFSET\t0x0024\n+#define SWIP_VLAN_PORT_INGR_ACCEPT_ALL\t\t0x0\n+#define SWIP_VLAN_PORT_EGR_TAG_OFFSET\t\t0x0028\n+#define SWIP_VLAN_PORT_EGR_TAG_MASK\t\tGENMASK(1, 0)\n+#define SWIP_VLAN_PORT_EGR_TAG_UNTAG_PVID\t0x0\n+#define SWIP_VLAN_VID_SEL_OFFSET\t\t0x002c\n+#define SWIP_VLAN_VID_SEL_VID_MASK\t\tGENMASK(11, 0)\n+#define SWIP_VLAN_MEMBER_CTRL_OFFSET\t\t0x0030\n+#define SWIP_VLAN_MEMBER_CTRL_WRITE\t\tBIT(0)\n+#define SWIP_VLAN_MEMBER_PORTS_OFFSET\t\t0x0034\n+#define SWIP_VLAN_CMD_TIMEOUT_US\t\t1000\n+#define SWIP_STANDALONE_PVID\t\t\t1\n+\n+static void __iomem *swip_ioremap(struct device *dev,\n+\t\t\t\t const struct resource *window,\n+\t\t\t\t resource_size_t offset, resource_size_t size,\n+\t\t\t\t const char *name)\n+{\n+\tstruct resource res = {\n+\t\t.name = name,\n+\t\t.flags = IORESOURCE_MEM,\n+\t};\n+\n+\tif (!size || offset \u003e= resource_size(window) ||\n+\t size \u003e resource_size(window) - offset) {\n+\t\tdev_err(dev, \"%s registers exceed switch resource\\n\", name);\n+\t\treturn ERR_PTR(-EINVAL);\n+\t}\n+\n+\tres.start = window-\u003estart + offset;\n+\tres.end = res.start + size - 1;\n+\n+\treturn devm_ioremap_resource(dev, \u0026res);\n+}\n+\n+static int swip_identify(struct device *dev, void __iomem *base,\n+\t\t\t struct swip_priv *priv)\n+{\n+\tu32 implemented_ports;\n+\tu32 licensed_ports;\n+\tu32 regval;\n+\n+\tregval = readl(base + SWIP_LIC_FEATURES_OFFSET);\n+\tlicensed_ports = FIELD_GET(SWIP_LIC_FEATURES_NUM_PORTS_MASK, regval);\n+\tregval = readl(base + SWIP_IMPL_FEATURES0_OFFSET);\n+\tif (!(regval \u0026 SWIP_IMPL_FEATURES0_DSA))\n+\t\treturn dev_err_probe(dev, -ENODEV,\n+\t\t\t\t \"core does not implement DSA\\n\");\n+\n+\timplemented_ports =\n+\t\tFIELD_GET(SWIP_IMPL_FEATURES0_NUM_PORTS_MASK, regval);\n+\tif (!licensed_ports || licensed_ports \u003e SWIP_MAX_NUM_PORTS ||\n+\t implemented_ports \u003c SWIP_MIN_NUM_PORTS ||\n+\t implemented_ports \u003e licensed_ports)\n+\t\treturn dev_err_probe(dev, -EINVAL,\n+\t\t\t\t \"invalid port counts\\n\");\n+\n+\tpriv-\u003efeatures.num_ports = implemented_ports;\n+\tpriv-\u003efeatures.port_vlan = regval \u0026 SWIP_IMPL_FEATURES0_PORT_VLAN;\n+\tpriv-\u003efeatures.stp = regval \u0026 SWIP_IMPL_FEATURES0_STP;\n+\n+\treturn 0;\n+}\n+\n+static void swip_phylink_get_caps(struct dsa_switch *ds, int port,\n+\t\t\t\t struct phylink_config *config)\n+{\n+\tstruct dsa_port *dp = dsa_to_port(ds, port);\n+\tphy_interface_t mode;\n+\tint ret;\n+\n+\tret = of_get_phy_mode(dp-\u003edn, \u0026mode);\n+\tif (ret)\n+\t\treturn;\n+\n+\tif (phy_interface_mode_is_rgmii(mode))\n+\t\tphy_interface_set_rgmii(config-\u003esupported_interfaces);\n+\telse\n+\t\t__set_bit(mode, config-\u003esupported_interfaces);\n+\n+\tconfig-\u003emac_capabilities = MAC_SYM_PAUSE | MAC_ASYM_PAUSE;\n+\n+\tswitch (mode) {\n+\tcase PHY_INTERFACE_MODE_MII:\n+\t\tconfig-\u003emac_capabilities |= MAC_10 | MAC_100;\n+\t\tbreak;\n+\tcase PHY_INTERFACE_MODE_GMII:\n+\t\tconfig-\u003emac_capabilities |= MAC_10 | MAC_100 | MAC_1000;\n+\t\tbreak;\n+\tcase PHY_INTERFACE_MODE_RMII:\n+\t\tconfig-\u003emac_capabilities |= MAC_10 | MAC_100;\n+\t\tbreak;\n+\tdefault:\n+\t\tif (phy_interface_mode_is_rgmii(mode))\n+\t\t\tconfig-\u003emac_capabilities |= MAC_10 | MAC_100 | MAC_1000;\n+\t\tbreak;\n+\t}\n+}\n+\n+static void swip_enable_tagging(struct swip_dsa_local *local)\n+{\n+\tvoid __iomem *base = local-\u003edsa;\n+\tu32 regval;\n+\n+\t/* Enabling \"All Frames\" tagging isolates user ports by forwarding\n+\t * their complete ingress traffic only to the CPU port.\n+\t */\n+\tregval = readl(base + SWIP_TAG_ALL_FRAMES_CTRL_OFFSET);\n+\tregval |= SWIP_TAG_ALL_FRAMES_CTRL_ENABLE;\n+\twritel(regval, base + SWIP_TAG_ALL_FRAMES_CTRL_OFFSET);\n+\n+\t/* \"All Frames\" tagging needs the active custom tagging mechanism. */\n+\tregval = readl(base + SWIP_CUSTOM_RULES_TAGGING_OFFSET);\n+\tregval |= SWIP_CUSTOM_RULES_TAGGING_ENABLE;\n+\twritel(regval, base + SWIP_CUSTOM_RULES_TAGGING_OFFSET);\n+}\n+\n+static void swip_disable_tagging(struct swip_dsa_local *local)\n+{\n+\tvoid __iomem *base = local-\u003edsa;\n+\tu32 regval;\n+\n+\tregval = readl(base + SWIP_TAG_ALL_FRAMES_CTRL_OFFSET);\n+\tregval \u0026= ~SWIP_TAG_ALL_FRAMES_CTRL_ENABLE;\n+\twritel(regval, base + SWIP_TAG_ALL_FRAMES_CTRL_OFFSET);\n+\n+\tregval = readl(base + SWIP_CUSTOM_RULES_TAGGING_OFFSET);\n+\tregval \u0026= ~SWIP_CUSTOM_RULES_TAGGING_ENABLE;\n+\twritel(regval, base + SWIP_CUSTOM_RULES_TAGGING_OFFSET);\n+}\n+\n+static void swip_stp_disable(struct swip_dsa_local *local)\n+{\n+\tvoid __iomem *base = local-\u003estp;\n+\tu32 regval;\n+\n+\tregval = readl(base + SWIP_STP_CTRL_OFFSET);\n+\tregval \u0026= ~SWIP_STP_CTRL_ENABLE;\n+\twritel(regval, base + SWIP_STP_CTRL_OFFSET);\n+}\n+\n+static void swip_vlan_set_enabled(struct swip_dsa_local *local, bool enabled)\n+{\n+\tvoid __iomem *base = local-\u003evlan;\n+\tu32 regval;\n+\n+\tregval = readl(base + SWIP_VLAN_CTRL_OFFSET);\n+\tif (enabled)\n+\t\tregval |= SWIP_VLAN_CTRL_ENABLE;\n+\telse\n+\t\tregval \u0026= ~SWIP_VLAN_CTRL_ENABLE;\n+\twritel(regval, base + SWIP_VLAN_CTRL_OFFSET);\n+}\n+\n+static int swip_vlan_reset(struct swip_dsa_local *local)\n+{\n+\tvoid __iomem *base = local-\u003evlan;\n+\tu32 regval;\n+\n+\twritel(SWIP_VLAN_RESET_CMD, base + SWIP_VLAN_RESET_OFFSET);\n+\n+\treturn readl_poll_timeout(base + SWIP_VLAN_RESET_OFFSET,\n+\t\t\t\t regval, !(regval \u0026 SWIP_VLAN_RESET_CMD), 10,\n+\t\t\t\t SWIP_VLAN_CMD_TIMEOUT_US);\n+}\n+\n+static int swip_vlan_wait_for_write(struct swip_dsa_local *local)\n+{\n+\tvoid __iomem *base = local-\u003evlan;\n+\tu32 regval;\n+\n+\treturn readl_poll_timeout(base + SWIP_VLAN_MEMBER_CTRL_OFFSET, regval,\n+\t\t\t\t !(regval \u0026 SWIP_VLAN_MEMBER_CTRL_WRITE), 10,\n+\t\t\t\t SWIP_VLAN_CMD_TIMEOUT_US);\n+}\n+\n+static void swip_vlan_select_port(struct swip_dsa_local *local, int port)\n+{\n+\twritel(FIELD_PREP(SWIP_VLAN_PORT_SEL_PORT_MASK, port),\n+\t local-\u003evlan + SWIP_VLAN_PORT_SEL_OFFSET);\n+}\n+\n+static void swip_vlan_select_vid(struct swip_dsa_local *local, u16 vid)\n+{\n+\twritel(FIELD_PREP(SWIP_VLAN_VID_SEL_VID_MASK, vid),\n+\t local-\u003evlan + SWIP_VLAN_VID_SEL_OFFSET);\n+}\n+\n+static void swip_vlan_config_port(struct swip_priv *priv, int port)\n+{\n+\tstruct swip_dsa_local *local = \u0026priv-\u003elocal;\n+\tvoid __iomem *base = local-\u003evlan;\n+\tu32 regval;\n+\n+\t/*\n+\t * VLAN-unaware ports classify ingress traffic to PVID 1 without consuming\n+\t * existing in-band VLAN headers.\n+\t */\n+\tswip_vlan_select_port(local, port);\n+\twritel(SWIP_VLAN_PORT_MODE_HYBRID, base + SWIP_VLAN_PORT_MODE_OFFSET);\n+\twritel(SWIP_VLAN_PORT_TYPE_UNAWARE, base + SWIP_VLAN_PORT_TYPE_OFFSET);\n+\twritel(FIELD_PREP(SWIP_VLAN_PORT_VLAN_PVID_MASK,\n+\t\t\t SWIP_STANDALONE_PVID),\n+\t base + SWIP_VLAN_PORT_VLAN_OFFSET);\n+\twritel(0, base + SWIP_VLAN_PORT_INGR_FILTER_OFFSET);\n+\twritel(SWIP_VLAN_PORT_INGR_ACCEPT_ALL,\n+\t base + SWIP_VLAN_PORT_INGR_ACCEPT_OFFSET);\n+\n+\tregval = readl(base + SWIP_VLAN_PORT_EGR_TAG_OFFSET);\n+\tregval \u0026= ~SWIP_VLAN_PORT_EGR_TAG_MASK;\n+\tregval |= FIELD_PREP(SWIP_VLAN_PORT_EGR_TAG_MASK,\n+\t\t\t SWIP_VLAN_PORT_EGR_TAG_UNTAG_PVID);\n+\twritel(regval, base + SWIP_VLAN_PORT_EGR_TAG_OFFSET);\n+}\n+\n+static int swip_vlan_write_entry(struct swip_priv *priv, u16 vid)\n+{\n+\tstruct swip_dsa_local *local = \u0026priv-\u003elocal;\n+\tvoid __iomem *base = local-\u003evlan;\n+\tstruct dsa_port *dp;\n+\tu32 standalone = 0;\n+\tu32 cpu_ports;\n+\tu32 members;\n+\tint ret;\n+\n+\tcpu_ports = dsa_cpu_ports(\u0026priv-\u003eds);\n+\t/*\n+\t * DSA treats software-bridged ports as standalone. Keep their default\n+\t * PVID membership independently of VLAN RX-filter registrations.\n+\t */\n+\tif (vid == SWIP_STANDALONE_PVID) {\n+\t\tdsa_switch_for_each_user_port(dp, \u0026priv-\u003eds) {\n+\t\t\tif (!dsa_port_bridge_dev_get(dp))\n+\t\t\t\tstandalone |= BIT(dp-\u003eindex);\n+\t\t}\n+\t}\n+\tmembers = priv-\u003evlan_members[vid] | standalone;\n+\t/* CPU membership preserves VLAN delivery to the conduit. */\n+\tif (members)\n+\t\tmembers |= cpu_ports;\n+\n+\t/* A timed-out command may still be using the shared VID selector. */\n+\tret = swip_vlan_wait_for_write(local);\n+\tif (ret)\n+\t\treturn ret;\n+\n+\tswip_vlan_select_vid(local, vid);\n+\twritel(members, base + SWIP_VLAN_MEMBER_PORTS_OFFSET);\n+\twritel(SWIP_VLAN_MEMBER_CTRL_WRITE,\n+\t base + SWIP_VLAN_MEMBER_CTRL_OFFSET);\n+\n+\treturn swip_vlan_wait_for_write(local);\n+}\n+\n+static int swip_vlan_setup(struct dsa_switch *ds)\n+{\n+\tstruct swip_priv *priv = ds-\u003epriv;\n+\tstruct swip_dsa_local *local;\n+\tstruct dsa_port *dp;\n+\tint ret;\n+\n+\tlocal = \u0026priv-\u003elocal;\n+\n+\tif (!priv-\u003efeatures.port_vlan)\n+\t\treturn 0;\n+\n+\tret = swip_vlan_reset(local);\n+\tif (ret) {\n+\t\tdev_err(ds-\u003edev, \"failed to reset VLAN configuration: %d\\n\",\n+\t\t\tret);\n+\t\treturn ret;\n+\t}\n+\n+\tmemset(priv-\u003evlan_members, 0,\n+\t sizeof(*priv-\u003evlan_members) * VLAN_N_VID);\n+\n+\tret = swip_vlan_write_entry(priv, SWIP_STANDALONE_PVID);\n+\tif (ret) {\n+\t\tdev_err(ds-\u003edev, \"failed to set up standalone VLAN: %d\\n\",\n+\t\t\tret);\n+\t\treturn ret;\n+\t}\n+\n+\tdsa_switch_for_each_available_port(dp, ds)\n+\t\tswip_vlan_config_port(priv, dp-\u003eindex);\n+\n+\tswip_vlan_set_enabled(local, true);\n+\n+\treturn 0;\n+}\n+\n+static void swip_vlan_teardown(struct swip_priv *priv)\n+{\n+\tstruct swip_dsa_local *local = \u0026priv-\u003elocal;\n+\tint ret;\n+\n+\tif (!priv-\u003efeatures.port_vlan)\n+\t\treturn;\n+\n+\tscoped_guard(mutex, \u0026priv-\u003efeature_lock) {\n+\t\tret = swip_vlan_reset(local);\n+\t\tif (ret)\n+\t\t\tdev_warn(priv-\u003eds.dev,\n+\t\t\t\t \"failed to reset VLAN configuration during teardown: %d\\n\",\n+\t\t\t\t ret);\n+\t\tswip_vlan_set_enabled(local, false);\n+\t}\n+}\n+\n+static void swip_port_select(struct swip_dsa_local *local, int port)\n+{\n+\twritel(FIELD_PREP(SWIP_PORTS_SELECTOR_PORT_MASK, port),\n+\t local-\u003eports + SWIP_PORTS_SELECTOR_OFFSET);\n+}\n+\n+static void swip_port_set_enabled(struct swip_dsa_local *local, int port,\n+\t\t\t\t bool enabled)\n+{\n+\tvoid __iomem *base = local-\u003eports;\n+\tu32 regval;\n+\n+\tswip_port_select(local, port);\n+\n+\tregval = readl(base + SWIP_PORTS_CTRL_OFFSET);\n+\tif (enabled)\n+\t\tregval |= SWIP_PORTS_CTRL_INGR_EN | SWIP_PORTS_CTRL_EGR_EN;\n+\telse\n+\t\tregval \u0026= ~(SWIP_PORTS_CTRL_INGR_EN | SWIP_PORTS_CTRL_EGR_EN);\n+\twritel(regval, base + SWIP_PORTS_CTRL_OFFSET);\n+}\n+\n+static int swip_port_enable(struct dsa_switch *ds, int port,\n+\t\t\t struct phy_device *phy)\n+{\n+\tstruct swip_priv *priv = ds-\u003epriv;\n+\n+\tswip_port_set_enabled(\u0026priv-\u003elocal, port, true);\n+\n+\treturn 0;\n+}\n+\n+static void swip_port_disable(struct dsa_switch *ds, int port)\n+{\n+\tstruct swip_priv *priv = ds-\u003epriv;\n+\n+\tswip_port_set_enabled(\u0026priv-\u003elocal, port, false);\n+}\n+\n+static int swip_setup(struct dsa_switch *ds)\n+{\n+\tstruct swip_priv *priv = ds-\u003epriv;\n+\tstruct dsa_port *dp;\n+\tint ret;\n+\n+\tdsa_switch_for_each_user_port(dp, ds)\n+\t\tswip_port_set_enabled(\u0026priv-\u003elocal, dp-\u003eindex, false);\n+\n+\tret = swip_vlan_setup(ds);\n+\tif (ret)\n+\t\treturn ret;\n+\n+\t/* Unconfigured hardware STP blocks frame forwarding. */\n+\tif (priv-\u003efeatures.stp)\n+\t\tswip_stp_disable(\u0026priv-\u003elocal);\n+\n+\tswip_enable_tagging(\u0026priv-\u003elocal);\n+\n+\treturn 0;\n+}\n+\n+static void swip_teardown(struct dsa_switch *ds)\n+{\n+\tstruct swip_priv *priv = ds-\u003epriv;\n+\tstruct swip_dsa_local *local;\n+\n+\tlocal = \u0026priv-\u003elocal;\n+\n+\tswip_disable_tagging(local);\n+\tswip_vlan_teardown(priv);\n+}\n+\n+static enum dsa_tag_protocol swip_get_tag_protocol(struct dsa_switch *ds,\n+\t\t\t\t\t\t int port,\n+\t\t\t\t\t\t enum dsa_tag_protocol mprop)\n+{\n+\treturn DSA_TAG_PROTO_SDSA;\n+}\n+\n+static int swip_port_vlan_add(struct dsa_switch *ds, int port,\n+\t\t\t const struct switchdev_obj_port_vlan *vlan,\n+\t\t\t struct netlink_ext_ack *extack)\n+{\n+\tstruct swip_priv *priv = ds-\u003epriv;\n+\tu32 port_mask = BIT(port);\n+\tint rollback_ret;\n+\tu32 old_members;\n+\tu32 *members;\n+\tint ret;\n+\n+\tmembers = priv-\u003evlan_members;\n+\n+\tif (!vlan-\u003evid)\n+\t\treturn 0;\n+\n+\tif (!priv-\u003efeatures.port_vlan) {\n+\t\tNL_SET_ERR_MSG_MOD(extack,\n+\t\t\t\t \"Port VLAN support is not implemented in the switch core\");\n+\t\treturn -EINVAL;\n+\t}\n+\n+\tscoped_guard(mutex, \u0026priv-\u003efeature_lock) {\n+\t\told_members = members[vlan-\u003evid];\n+\n+\t\tmembers[vlan-\u003evid] |= port_mask;\n+\n+\t\tret = swip_vlan_write_entry(priv, vlan-\u003evid);\n+\t\tif (ret) {\n+\t\t\tNL_SET_ERR_MSG_MOD(extack,\n+\t\t\t\t\t \"failed to update VLAN hardware tables\");\n+\t\t\tdev_err(ds-\u003edev,\n+\t\t\t\t\"failed to add VLAN %u on port %d: %d\\n\",\n+\t\t\t\tvlan-\u003evid, port, ret);\n+\t\t\tmembers[vlan-\u003evid] = old_members;\n+\t\t\t/* Best-effort: restore the previous hardware entry. */\n+\t\t\trollback_ret = swip_vlan_write_entry(priv, vlan-\u003evid);\n+\t\t\tif (rollback_ret)\n+\t\t\t\tdev_err(ds-\u003edev,\n+\t\t\t\t\t\"failed to restore VLAN %u on port %d: %d\\n\",\n+\t\t\t\t\tvlan-\u003evid, port, rollback_ret);\n+\t\t\treturn ret;\n+\t\t}\n+\t}\n+\n+\treturn ret;\n+}\n+\n+static int swip_port_vlan_del(struct dsa_switch *ds, int port,\n+\t\t\t const struct switchdev_obj_port_vlan *vlan)\n+{\n+\tstruct swip_priv *priv = ds-\u003epriv;\n+\tu32 port_mask = BIT(port);\n+\tint rollback_ret;\n+\tu32 old_members;\n+\tu32 *members;\n+\tint ret;\n+\n+\tmembers = priv-\u003evlan_members;\n+\n+\tif (!vlan-\u003evid)\n+\t\treturn 0;\n+\n+\tif (!priv-\u003efeatures.port_vlan)\n+\t\treturn -EOPNOTSUPP;\n+\n+\tscoped_guard(mutex, \u0026priv-\u003efeature_lock) {\n+\t\told_members = members[vlan-\u003evid];\n+\t\tmembers[vlan-\u003evid] \u0026= ~port_mask;\n+\t\tret = swip_vlan_write_entry(priv, vlan-\u003evid);\n+\t\tif (ret) {\n+\t\t\tdev_err(ds-\u003edev,\n+\t\t\t\t\"failed to delete VLAN %u from port %d: %d\\n\",\n+\t\t\t\tvlan-\u003evid, port, ret);\n+\t\t\tmembers[vlan-\u003evid] = old_members;\n+\t\t\t/* Best-effort: restore the previous hardware entry. */\n+\t\t\trollback_ret = swip_vlan_write_entry(priv, vlan-\u003evid);\n+\t\t\tif (rollback_ret)\n+\t\t\t\tdev_err(ds-\u003edev,\n+\t\t\t\t\t\"failed to restore VLAN %u on port %d: %d\\n\",\n+\t\t\t\t\tvlan-\u003evid, port, rollback_ret);\n+\t\t\treturn ret;\n+\t\t}\n+\t}\n+\n+\treturn ret;\n+}\n+\n+static int\n+swip_port_prechangeupper(struct dsa_switch *ds, int port,\n+\t\t\t struct netdev_notifier_changeupper_info *info)\n+{\n+\tstruct swip_priv *priv = ds-\u003epriv;\n+\tstruct netlink_ext_ack *extack;\n+\n+\tif (!info-\u003elinking || !is_vlan_dev(info-\u003eupper_dev) ||\n+\t priv-\u003efeatures.port_vlan)\n+\t\treturn 0;\n+\n+\textack = netdev_notifier_info_to_extack(\u0026info-\u003einfo);\n+\tNL_SET_ERR_MSG_MOD(extack,\n+\t\t\t \"VLAN uppers require Port VLAN support in the switch core\");\n+\treturn -EOPNOTSUPP;\n+}\n+\n+static const struct dsa_switch_ops swip_switch_ops = {\n+\t.get_tag_protocol\t= swip_get_tag_protocol,\n+\t.setup\t\t\t= swip_setup,\n+\t.teardown\t\t= swip_teardown,\n+\t.phylink_get_caps\t= swip_phylink_get_caps,\n+\t.port_enable\t\t= swip_port_enable,\n+\t.port_disable\t\t= swip_port_disable,\n+\t.port_vlan_add\t\t= swip_port_vlan_add,\n+\t.port_vlan_del\t\t= swip_port_vlan_del,\n+\t.port_prechangeupper\t= swip_port_prechangeupper,\n+};\n+\n+static int swip_probe(struct platform_device *pdev)\n+{\n+\tstruct device *dev = \u0026pdev-\u003edev;\n+\tstruct swip_dsa_local *local;\n+\tstruct swip_priv *priv;\n+\tstruct dsa_switch *ds;\n+\tstruct resource *res;\n+\tvoid __iomem *base;\n+\tint ret;\n+\n+\tres = platform_get_resource(pdev, IORESOURCE_MEM, 0);\n+\tif (!res)\n+\t\treturn -EINVAL;\n+\n+\tpriv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);\n+\tif (!priv)\n+\t\treturn -ENOMEM;\n+\n+\tds = \u0026priv-\u003eds;\n+\tds-\u003edev = dev;\n+\tds-\u003epriv = priv;\n+\n+\tbase = swip_ioremap(dev, res, SWIP_IDENT_BASE_OFFSET,\n+\t\t\t SWIP_IDENT_SIZE, \"ident\");\n+\tif (IS_ERR(base))\n+\t\treturn PTR_ERR(base);\n+\tret = swip_identify(dev, base, priv);\n+\tif (ret)\n+\t\treturn ret;\n+\n+\tlocal = \u0026priv-\u003elocal;\n+\tlocal-\u003edsa = swip_ioremap(dev, res, SWIP_DSA_BASE_OFFSET,\n+\t\t\t\t SWIP_DSA_SIZE, \"dsa\");\n+\tif (IS_ERR(local-\u003edsa))\n+\t\treturn PTR_ERR(local-\u003edsa);\n+\tlocal-\u003eports = swip_ioremap(dev, res, SWIP_PORTS_BASE_OFFSET,\n+\t\t\t\t SWIP_PORTS_SIZE, \"ports\");\n+\tif (IS_ERR(local-\u003eports))\n+\t\treturn PTR_ERR(local-\u003eports);\n+\tif (priv-\u003efeatures.stp) {\n+\t\tlocal-\u003estp = swip_ioremap(dev, res, SWIP_STP_BASE_OFFSET,\n+\t\t\t\t\t SWIP_STP_SIZE, \"stp\");\n+\t\tif (IS_ERR(local-\u003estp))\n+\t\t\treturn PTR_ERR(local-\u003estp);\n+\t}\n+\tret = devm_mutex_init(dev, \u0026priv-\u003efeature_lock);\n+\tif (ret)\n+\t\treturn ret;\n+\n+\tif (priv-\u003efeatures.port_vlan) {\n+\t\tlocal-\u003evlan = swip_ioremap(dev, res, SWIP_VLAN_BASE_OFFSET,\n+\t\t\t\t\t SWIP_VLAN_SIZE, \"vlan\");\n+\t\tif (IS_ERR(local-\u003evlan))\n+\t\t\treturn PTR_ERR(local-\u003evlan);\n+\n+\t\tpriv-\u003evlan_members =\n+\t\t\tdevm_kcalloc(dev, VLAN_N_VID,\n+\t\t\t\t sizeof(*priv-\u003evlan_members), GFP_KERNEL);\n+\t\tif (!priv-\u003evlan_members)\n+\t\t\treturn -ENOMEM;\n+\n+\t} else {\n+\t\tdev_warn(dev,\n+\t\t\t \"No Port VLAN: tagged CPU ingress loses VLAN IDs. VLAN-aware bridge unsupported\\n\");\n+\t}\n+\n+\tds-\u003eops = \u0026swip_switch_ops;\n+\tds-\u003enum_ports = priv-\u003efeatures.num_ports;\n+\n+\tds-\u003eneeds_standalone_vlan_filtering = priv-\u003efeatures.port_vlan;\n+\n+\tdev_set_drvdata(dev, priv);\n+\n+\tret = dsa_register_switch(ds);\n+\tif (ret)\n+\t\treturn dev_err_probe(dev, ret,\n+\t\t\t\t \"failed to register DSA switch\\n\");\n+\n+\tdev_info(dev, \"probed SoC-e switch with %u ports\\n\",\n+\t\t priv-\u003efeatures.num_ports);\n+\n+\treturn 0;\n+}\n+\n+static void swip_remove(struct platform_device *pdev)\n+{\n+\tstruct swip_priv *priv = platform_get_drvdata(pdev);\n+\n+\tif (!priv)\n+\t\treturn;\n+\n+\tdsa_unregister_switch(\u0026priv-\u003eds);\n+\tplatform_set_drvdata(pdev, NULL);\n+}\n+\n+static void swip_shutdown(struct platform_device *pdev)\n+{\n+\tstruct swip_priv *priv = platform_get_drvdata(pdev);\n+\n+\tif (!priv)\n+\t\treturn;\n+\n+\tdsa_switch_shutdown(\u0026priv-\u003eds);\n+\tplatform_set_drvdata(pdev, NULL);\n+}\n+\n+static const struct of_device_id swip_of_match[] = {\n+\t{ .compatible = \"soce,swip-switch-00-04-0c-10\" },\n+\t{ /* sentinel */ }\n+};\n+\n+static struct platform_driver swip_driver = {\n+\t.probe = swip_probe,\n+\t.remove = swip_remove,\n+\t.shutdown = swip_shutdown,\n+\t.driver = {\n+\t\t.name = \"soce-switch\",\n+\t\t.of_match_table = swip_of_match,\n+\t},\n+};\n+\n+module_platform_driver(swip_driver);\n+MODULE_DEVICE_TABLE(of, swip_of_match);\n+MODULE_AUTHOR(\"Vasilij Strassheim \u003cv.strassheim@linutronix.de\u003e\");\n+MODULE_DESCRIPTION(\"SoC-e SWIP DSA switch driver\");\n+MODULE_LICENSE(\"GPL\");\ndiff --git a/drivers/net/dsa/soce-swip.h b/drivers/net/dsa/soce-swip.h\nnew file mode 100644\nindex 00000000000000..034a05ce8dc5c9\n--- /dev/null\n+++ b/drivers/net/dsa/soce-swip.h\n@@ -0,0 +1,39 @@\n+/* SPDX-License-Identifier: GPL-2.0 */\n+/*\n+ * Copyright (c) 2020-2026 System on Chip engineering, S.L.\n+ * Copyright (c) 2026 Linutronix GmbH\n+ * Author: Vasilij Strassheim \u003cv.strassheim@linutronix.de\u003e\n+ */\n+\n+#ifndef SOCE_SWIP_H\n+#define SOCE_SWIP_H\n+\n+#include \u003clinux/mutex.h\u003e\n+#include \u003clinux/types.h\u003e\n+\n+#include \u003cnet/dsa.h\u003e\n+\n+#define SWIP_MAX_NUM_PORTS 31\n+\n+struct swip_features {\n+\tu32 num_ports;\n+\tbool port_vlan;\n+\tbool stp;\n+};\n+\n+struct swip_dsa_local {\n+\tvoid __iomem *dsa;\n+\tvoid __iomem *ports;\n+\tvoid __iomem *vlan;\n+\tvoid __iomem *stp;\n+};\n+\n+struct swip_priv {\n+\tstruct swip_dsa_local local;\n+\tstruct swip_features features;\n+\tstruct mutex feature_lock; /* Serializes multi-register feature updates */\n+\tu32 *vlan_members;\n+\tstruct dsa_switch ds;\n+};\n+\n+#endif /* SOCE_SWIP_H */\ndiff --git a/drivers/net/mdio/Kconfig b/drivers/net/mdio/Kconfig\nindex 6f272fae4bb55b..b1ffeb439c3682 100644\n--- a/drivers/net/mdio/Kconfig\n+++ b/drivers/net/mdio/Kconfig\n@@ -182,6 +182,16 @@ config MDIO_REGMAP\n \t regmap. Users willing to use this driver must explicitly select\n \t REGMAP.\n \n+config MDIO_SOCE_SWIP\n+\ttristate\n+\tdepends on OF_MDIO \u0026\u0026 HAS_IOMEM\n+\tdepends on MFD_SOCE_SWIP\n+\thelp\n+\t This driver provides support for the MDIO controller\n+\t integrated into SoC-e SWIP Ethernet switch IP cores. This option\n+\t will be selected if the configuration for the main switch\n+\t functionality of the FPGA IP core is selected.\n+\n config MDIO_THUNDER\n \ttristate \"ThunderX SOCs MDIO buses\"\n \tdepends on 64BIT\ndiff --git a/drivers/net/mdio/Makefile b/drivers/net/mdio/Makefile\nindex e02c66a025456c..cb0a268cee596a 100644\n--- a/drivers/net/mdio/Makefile\n+++ b/drivers/net/mdio/Makefile\n@@ -22,6 +22,7 @@ obj-$(CONFIG_MDIO_OCTEON)\t\t+= mdio-octeon.o\n obj-$(CONFIG_MDIO_PIC64HPSC)\t\t+= mdio-pic64hpsc.o\n obj-$(CONFIG_MDIO_REALTEK_RTL9300)\t+= mdio-realtek-rtl9300.o\n obj-$(CONFIG_MDIO_REGMAP)\t\t+= mdio-regmap.o\n+obj-$(CONFIG_MDIO_SOCE_SWIP)\t\t+= mdio-soce.o\n obj-$(CONFIG_MDIO_SUN4I)\t\t+= mdio-sun4i.o\n obj-$(CONFIG_MDIO_THUNDER)\t\t+= mdio-thunder.o\n obj-$(CONFIG_MDIO_XGENE)\t\t+= mdio-xgene.o\ndiff --git a/drivers/net/mdio/mdio-soce.c b/drivers/net/mdio/mdio-soce.c\nnew file mode 100644\nindex 00000000000000..5350feb92d5554\n--- /dev/null\n+++ b/drivers/net/mdio/mdio-soce.c\n@@ -0,0 +1,213 @@\n+// SPDX-License-Identifier: GPL-2.0\n+/*\n+ * Copyright (c) 2020-2026 System on Chip engineering, S.L.\n+ * Copyright (c) 2026 Linutronix GmbH\n+ * Author: Vasilij Strassheim \u003cv.strassheim@linutronix.de\u003e\n+ */\n+\n+#include \u003clinux/bitfield.h\u003e\n+#include \u003clinux/io.h\u003e\n+#include \u003clinux/iopoll.h\u003e\n+#include \u003clinux/module.h\u003e\n+#include \u003clinux/of_mdio.h\u003e\n+#include \u003clinux/platform_device.h\u003e\n+\n+#define SWIP_MDIO_TIMEOUT_US\t\t1000\n+\n+#define SWIP_MDIO_PARAMS_OFFSET\t\t0x0000\n+#define SWIP_MDIO_WRITE_OFFSET\t\t0x0004\n+#define SWIP_MDIO_READ_OFFSET\t\t0x0008\n+\n+#define SWIP_MDIO_CTRL_TRANSTYPE_MASK\tGENMASK(4, 3)\n+#define SWIP_MDIO_CTRL_TRANSTYPE_WRITE\t0x1\n+#define SWIP_MDIO_CTRL_TRANSTYPE_READ\t0x3\n+#define SWIP_MDIO_CTRL_CLAUSE\t\tBIT(1)\n+#define SWIP_MDIO_CTRL_OPSTATUS\t\tBIT(0)\n+#define SWIP_MDIO_PARAMS_REGDEV_MASK\tGENMASK(12, 8)\n+#define SWIP_MDIO_PARAMS_PHYADDR_MASK\tGENMASK(4, 0)\n+#define SWIP_MDIO_READ_DATA_MASK\tGENMASK(15, 0)\n+\n+struct swip_mdio {\n+\tvoid __iomem *ctrl;\n+\tvoid __iomem *data;\n+};\n+\n+static int swip_mdio_wait_for_idle(struct swip_mdio *priv)\n+{\n+\tvoid __iomem *ctrl = priv-\u003ectrl;\n+\tu16 val;\n+\n+\treturn readw_poll_timeout(ctrl, val, !(val \u0026 SWIP_MDIO_CTRL_OPSTATUS),\n+\t\t\t\t 10, SWIP_MDIO_TIMEOUT_US);\n+}\n+\n+static int swip_mdio_read(struct mii_bus *bus, int phy_addr, int regnum)\n+{\n+\tstruct swip_mdio *priv = bus-\u003epriv;\n+\tvoid __iomem *data = priv-\u003edata;\n+\tu32 command;\n+\tint ret;\n+\n+\tret = swip_mdio_wait_for_idle(priv);\n+\tif (ret)\n+\t\treturn ret;\n+\n+\twritel(FIELD_PREP(SWIP_MDIO_PARAMS_REGDEV_MASK, regnum) |\n+\t FIELD_PREP(SWIP_MDIO_PARAMS_PHYADDR_MASK, phy_addr),\n+\t data + SWIP_MDIO_PARAMS_OFFSET);\n+\n+\tcommand = FIELD_PREP(SWIP_MDIO_CTRL_TRANSTYPE_MASK,\n+\t\t\t SWIP_MDIO_CTRL_TRANSTYPE_READ) |\n+\t\t SWIP_MDIO_CTRL_OPSTATUS;\n+\twritew(command, priv-\u003ectrl);\n+\n+\tret = swip_mdio_wait_for_idle(priv);\n+\tif (ret)\n+\t\treturn ret;\n+\n+\treturn readl(data + SWIP_MDIO_READ_OFFSET) \u0026 SWIP_MDIO_READ_DATA_MASK;\n+}\n+\n+static int swip_mdio_read_c45(struct mii_bus *bus, int phy_addr, int devad,\n+\t\t\t int regnum)\n+{\n+\tstruct swip_mdio *priv = bus-\u003epriv;\n+\tvoid __iomem *data = priv-\u003edata;\n+\tu32 command;\n+\tint ret;\n+\n+\tret = swip_mdio_wait_for_idle(priv);\n+\tif (ret)\n+\t\treturn ret;\n+\n+\twritel(FIELD_PREP(SWIP_MDIO_PARAMS_REGDEV_MASK, devad) |\n+\t FIELD_PREP(SWIP_MDIO_PARAMS_PHYADDR_MASK, phy_addr),\n+\t data + SWIP_MDIO_PARAMS_OFFSET);\n+\twritel(regnum, data + SWIP_MDIO_WRITE_OFFSET);\n+\n+\tcommand = SWIP_MDIO_CTRL_CLAUSE | SWIP_MDIO_CTRL_OPSTATUS;\n+\twritew(command, priv-\u003ectrl);\n+\n+\tret = swip_mdio_wait_for_idle(priv);\n+\tif (ret)\n+\t\treturn ret;\n+\n+\tcommand = FIELD_PREP(SWIP_MDIO_CTRL_TRANSTYPE_MASK,\n+\t\t\t SWIP_MDIO_CTRL_TRANSTYPE_READ) |\n+\t\t SWIP_MDIO_CTRL_CLAUSE | SWIP_MDIO_CTRL_OPSTATUS;\n+\twritew(command, priv-\u003ectrl);\n+\n+\tret = swip_mdio_wait_for_idle(priv);\n+\tif (ret)\n+\t\treturn ret;\n+\n+\treturn readl(data + SWIP_MDIO_READ_OFFSET) \u0026 SWIP_MDIO_READ_DATA_MASK;\n+}\n+\n+static int swip_mdio_write(struct mii_bus *bus, int phy_addr, int regnum,\n+\t\t\t u16 val)\n+{\n+\tstruct swip_mdio *priv = bus-\u003epriv;\n+\tvoid __iomem *data = priv-\u003edata;\n+\tu32 command;\n+\tint ret;\n+\n+\tret = swip_mdio_wait_for_idle(priv);\n+\tif (ret)\n+\t\treturn ret;\n+\n+\twritel(FIELD_PREP(SWIP_MDIO_PARAMS_REGDEV_MASK, regnum) |\n+\t FIELD_PREP(SWIP_MDIO_PARAMS_PHYADDR_MASK, phy_addr),\n+\t data + SWIP_MDIO_PARAMS_OFFSET);\n+\twritel(val, data + SWIP_MDIO_WRITE_OFFSET);\n+\n+\tcommand = FIELD_PREP(SWIP_MDIO_CTRL_TRANSTYPE_MASK,\n+\t\t\t SWIP_MDIO_CTRL_TRANSTYPE_WRITE) |\n+\t\t SWIP_MDIO_CTRL_OPSTATUS;\n+\twritew(command, priv-\u003ectrl);\n+\n+\treturn swip_mdio_wait_for_idle(priv);\n+}\n+\n+static int swip_mdio_write_c45(struct mii_bus *bus, int phy_addr, int devad,\n+\t\t\t int regnum, u16 val)\n+{\n+\tstruct swip_mdio *priv = bus-\u003epriv;\n+\tvoid __iomem *data = priv-\u003edata;\n+\tu32 command;\n+\tint ret;\n+\n+\tret = swip_mdio_wait_for_idle(priv);\n+\tif (ret)\n+\t\treturn ret;\n+\n+\twritel(FIELD_PREP(SWIP_MDIO_PARAMS_REGDEV_MASK, devad) |\n+\t FIELD_PREP(SWIP_MDIO_PARAMS_PHYADDR_MASK, phy_addr),\n+\t data + SWIP_MDIO_PARAMS_OFFSET);\n+\twritel(regnum, data + SWIP_MDIO_WRITE_OFFSET);\n+\n+\tcommand = SWIP_MDIO_CTRL_CLAUSE | SWIP_MDIO_CTRL_OPSTATUS;\n+\twritew(command, priv-\u003ectrl);\n+\n+\tret = swip_mdio_wait_for_idle(priv);\n+\tif (ret)\n+\t\treturn ret;\n+\n+\twritel(val, data + SWIP_MDIO_WRITE_OFFSET);\n+\n+\tcommand = FIELD_PREP(SWIP_MDIO_CTRL_TRANSTYPE_MASK,\n+\t\t\t SWIP_MDIO_CTRL_TRANSTYPE_WRITE) |\n+\t\t SWIP_MDIO_CTRL_CLAUSE | SWIP_MDIO_CTRL_OPSTATUS;\n+\twritew(command, priv-\u003ectrl);\n+\n+\treturn swip_mdio_wait_for_idle(priv);\n+}\n+\n+static int swip_mdio_probe(struct platform_device *pdev)\n+{\n+\tstruct device *dev = \u0026pdev-\u003edev;\n+\tstruct swip_mdio *priv;\n+\tstruct mii_bus *bus;\n+\n+\tbus = devm_mdiobus_alloc_size(dev, sizeof(*priv));\n+\tif (!bus)\n+\t\treturn -ENOMEM;\n+\n+\tpriv = bus-\u003epriv;\n+\tpriv-\u003edata = devm_platform_ioremap_resource_byname(pdev, \"data\");\n+\tif (IS_ERR(priv-\u003edata))\n+\t\treturn PTR_ERR(priv-\u003edata);\n+\n+\tpriv-\u003ectrl = devm_platform_ioremap_resource_byname(pdev, \"control\");\n+\tif (IS_ERR(priv-\u003ectrl))\n+\t\treturn PTR_ERR(priv-\u003ectrl);\n+\n+\tbus-\u003ename = \"soce mdio\";\n+\tsnprintf(bus-\u003eid, MII_BUS_ID_SIZE, \"%s\", dev_name(dev));\n+\tbus-\u003eparent = dev;\n+\tbus-\u003eread = swip_mdio_read;\n+\tbus-\u003ewrite = swip_mdio_write;\n+\tbus-\u003eread_c45 = swip_mdio_read_c45;\n+\tbus-\u003ewrite_c45 = swip_mdio_write_c45;\n+\n+\treturn devm_of_mdiobus_register(dev, bus, dev-\u003eof_node);\n+}\n+\n+static const struct of_device_id swip_mdio_of_match[] = {\n+\t{ .compatible = \"soce,swip-mdio\" },\n+\t{ /* sentinel */ }\n+};\n+MODULE_DEVICE_TABLE(of, swip_mdio_of_match);\n+\n+static struct platform_driver swip_mdio_driver = {\n+\t.probe = swip_mdio_probe,\n+\t.driver = {\n+\t\t.name = \"soce-mdio\",\n+\t\t.of_match_table = swip_mdio_of_match,\n+\t},\n+};\n+module_platform_driver(swip_mdio_driver);\n+\n+MODULE_AUTHOR(\"Vasilij Strassheim \u003cv.strassheim@linutronix.de\u003e\");\n+MODULE_DESCRIPTION(\"SoC-e MDIO controller driver\");\n+MODULE_LICENSE(\"GPL\");\ndiff --git a/include/net/dsa.h b/include/net/dsa.h\nindex 09f3043d57f066..799d43b3c77ff6 100644\n--- a/include/net/dsa.h\n+++ b/include/net/dsa.h\n@@ -63,6 +63,7 @@ struct tc_action;\n #define DSA_TAG_PROTO_MT7628_VALUE\t\t35\n #define DSA_TAG_PROTO_KS8995_VALUE\t\t36\n #define DSA_TAG_PROTO_LAN9645X_VALUE\t\t37\n+#define DSA_TAG_PROTO_SDSA_VALUE\t\t38\n \n enum dsa_tag_protocol {\n \tDSA_TAG_PROTO_NONE\t\t= DSA_TAG_PROTO_NONE_VALUE,\n@@ -103,6 +104,7 @@ enum dsa_tag_protocol {\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_LAN9645X\t\t= DSA_TAG_PROTO_LAN9645X_VALUE,\n+\tDSA_TAG_PROTO_SDSA\t\t= DSA_TAG_PROTO_SDSA_VALUE,\n };\n \n struct dsa_switch;\ndiff --git a/net/dsa/Kconfig b/net/dsa/Kconfig\nindex bdeb60af764b22..caf85e107fcfd5 100644\n--- a/net/dsa/Kconfig\n+++ b/net/dsa/Kconfig\n@@ -205,6 +205,12 @@ config NET_DSA_TAG_RZN1_A5PSW\n \t Renesas RZ/N1 embedded switch that uses an 8 byte tag located after\n \t destination MAC address.\n \n+config NET_DSA_TAG_SDSA\n+\ttristate \"Tag driver for SoC-e switches using EtherType SDSA headers\"\n+\thelp\n+\t Say Y or M if you want to enable support for tagging frames for the\n+\t SoC-e switches.\n+\n config NET_DSA_TAG_LAN9303\n \ttristate \"Tag driver for SMSC/Microchip LAN9303 family of switches\"\n \thelp\ndiff --git a/net/dsa/Makefile b/net/dsa/Makefile\nindex 3cd53124448d81..b3e9cd7810927e 100644\n--- a/net/dsa/Makefile\n+++ b/net/dsa/Makefile\n@@ -41,6 +41,7 @@ obj-$(CONFIG_NET_DSA_TAG_QCA) += tag_qca.o\n obj-$(CONFIG_NET_DSA_TAG_RTL4_A) += tag_rtl4_a.o\n obj-$(CONFIG_NET_DSA_TAG_RTL8_4) += tag_rtl8_4.o\n obj-$(CONFIG_NET_DSA_TAG_RZN1_A5PSW) += tag_rzn1_a5psw.o\n+obj-$(CONFIG_NET_DSA_TAG_SDSA) += tag_sdsa.o\n obj-$(CONFIG_NET_DSA_TAG_SJA1105) += tag_sja1105.o\n obj-$(CONFIG_NET_DSA_TAG_TRAILER) += tag_trailer.o\n obj-$(CONFIG_NET_DSA_TAG_VSC73XX_8021Q) += tag_vsc73xx_8021q.o\ndiff --git a/net/dsa/tag_sdsa.c b/net/dsa/tag_sdsa.c\nnew file mode 100644\nindex 00000000000000..c5a9f61edf4056\n--- /dev/null\n+++ b/net/dsa/tag_sdsa.c\n@@ -0,0 +1,170 @@\n+// SPDX-License-Identifier: GPL-2.0\n+/*\n+ * Copyright (c) 2020-2026 System on Chip engineering, S.L.\n+ * Copyright (c) 2026 Linutronix GmbH\n+ * Author: Vasilij Strassheim \u003cv.strassheim@linutronix.de\u003e\n+ */\n+\n+#include \u003clinux/bitfield.h\u003e\n+#include \u003clinux/byteorder/generic.h\u003e\n+#include \u003clinux/etherdevice.h\u003e\n+#include \u003clinux/if_vlan.h\u003e\n+#include \u003clinux/unaligned.h\u003e\n+\n+#include \"tag.h\"\n+\n+#define SDSA_HLEN\t8\n+\n+#define SDSA_NAME\t\"sdsa\"\n+#define ETH_P_SDSA\t0xDCDC\n+\n+/* SDSA tag byte layout (after the 12-byte MAC header):\n+ * Bytes 0-1: SDSA EtherType (0xDCDC)\n+ * Bytes 2-3: Reserved\n+ * Byte 4: Frame type (bits 7-6), VLAN-info bit (bit 5), port[9:5] (bits 4-0)\n+ * Byte 5: Port[4:0] (bits 7-3)\n+ * Bytes 6-7: PCP (bits 7-5) / CFI (bit 4) / VID (bits 3-0 + byte 7), only\n+ * meaningful when the VLAN-info bit is set.\n+ */\n+#define SDSA_TAG_FRAME_TYPE_MASK\tGENMASK(7, 6)\n+#define SDSA_TAG_VLAN_BIT\t\tBIT(5)\n+#define SDSA_TAG_PORT_HI_MASK\t\tGENMASK(4, 0)\n+#define SDSA_TAG_PORT_LO_MASK\t\tGENMASK(7, 3)\n+#define SDSA_TAG_PORT_HI_SHIFT\t\t5\n+#define SDSA_FRAME_TYPE_TO_CPU\t\t0\n+#define SDSA_FRAME_TYPE_FROM_CPU\t1\n+\n+struct sdsa_tag {\n+\t__be16 ethertype;\n+\t__be16 reserved;\n+\tu8 frame_type_port_hi;\n+\tu8 port_lo;\n+\t__be16 vlan;\n+};\n+\n+static struct sk_buff *sdsa_xmit(struct sk_buff *skb, struct net_device *dev)\n+{\n+\tstruct dsa_port *dp = dsa_user_to_port(dev);\n+\tstruct sdsa_tag *tag;\n+\tbool encode_vlan;\n+\tbool tag_present;\n+\tu16 vlan_tci;\n+\n+\tBUILD_BUG_ON(sizeof(*tag) != SDSA_HLEN);\n+\n+\t/* SDSA carries no TPID, so only encode 802.1Q C-tags. */\n+\ttag_present = skb_vlan_tag_present(skb);\n+\tencode_vlan = tag_present \u0026\u0026 skb-\u003evlan_proto == htons(ETH_P_8021Q);\n+\t/* Prevent the conduit from inserting a VLAN header ahead of SDSA. */\n+\tif (tag_present \u0026\u0026 !encode_vlan) {\n+\t\tskb = __vlan_hwaccel_push_inside(skb);\n+\t\tif (!skb)\n+\t\t\treturn NULL;\n+\t}\n+\n+\tskb_push(skb, SDSA_HLEN);\n+\tdsa_alloc_etype_header(skb, SDSA_HLEN);\n+\n+\ttag = dsa_etype_header_pos_tx(skb);\n+\ttag-\u003eethertype = cpu_to_be16(ETH_P_SDSA);\n+\ttag-\u003ereserved = 0;\n+\ttag-\u003eframe_type_port_hi =\n+\t\tFIELD_PREP(SDSA_TAG_FRAME_TYPE_MASK, SDSA_FRAME_TYPE_FROM_CPU) |\n+\t\tFIELD_PREP(SDSA_TAG_PORT_HI_MASK,\n+\t\t\t dp-\u003eindex \u003e\u003e SDSA_TAG_PORT_HI_SHIFT);\n+\ttag-\u003eport_lo = FIELD_PREP(SDSA_TAG_PORT_LO_MASK, dp-\u003eindex);\n+\tif (encode_vlan) {\n+\t\tvlan_tci = skb_vlan_tag_get(skb);\n+\t\t__vlan_hwaccel_clear_tag(skb);\n+\t\ttag-\u003eframe_type_port_hi |= SDSA_TAG_VLAN_BIT;\n+\t\ttag-\u003evlan = cpu_to_be16(vlan_tci);\n+\t} else {\n+\t\ttag-\u003evlan = 0;\n+\t}\n+\n+\treturn skb;\n+}\n+\n+static struct sk_buff *sdsa_rcv(struct sk_buff *skb, struct net_device *dev)\n+{\n+\tenum skb_drop_reason reason;\n+\tstruct sdsa_tag *tag;\n+\tu16 dummy_vlan_tci;\n+\tbool vlan_present;\n+\tint source_port;\n+\tu16 encap_proto;\n+\tu8 frame_type;\n+\tu16 vlan_tci;\n+\n+\treason = pskb_may_pull_reason(skb, SDSA_HLEN);\n+\tif (unlikely(reason != SKB_NOT_DROPPED_YET))\n+\t\tgoto out_drop;\n+\n+\ttag = dsa_etype_header_pos_rx(skb);\n+\tif (unlikely(be16_to_cpu(tag-\u003eethertype) != ETH_P_SDSA)) {\n+\t\treason = SKB_DROP_REASON_DEV_HDR;\n+\t\tgoto out_drop;\n+\t}\n+\n+\tframe_type = FIELD_GET(SDSA_TAG_FRAME_TYPE_MASK,\n+\t\t\t tag-\u003eframe_type_port_hi);\n+\tif (frame_type != SDSA_FRAME_TYPE_TO_CPU) {\n+\t\treason = SKB_DROP_REASON_DEV_HDR;\n+\t\tgoto out_drop;\n+\t}\n+\n+\tvlan_present = tag-\u003eframe_type_port_hi \u0026 SDSA_TAG_VLAN_BIT;\n+\tvlan_tci = be16_to_cpu(tag-\u003evlan);\n+\tencap_proto = get_unaligned_be16((u8 *)tag + SDSA_HLEN);\n+\n+\tsource_port = FIELD_GET(SDSA_TAG_PORT_HI_MASK,\n+\t\t\t\ttag-\u003eframe_type_port_hi) \u003c\u003c\n+\t\t SDSA_TAG_PORT_HI_SHIFT;\n+\tsource_port |= FIELD_GET(SDSA_TAG_PORT_LO_MASK, tag-\u003eport_lo);\n+\n+\tskb-\u003edev = dsa_conduit_find_user(dev, 0, source_port);\n+\tif (!skb-\u003edev) {\n+\t\treason = SKB_DROP_REASON_DEV_HDR;\n+\t\tgoto out_drop;\n+\t}\n+\n+\tskb_pull_rcsum(skb, SDSA_HLEN);\n+\tdsa_strip_etype_header(skb, SDSA_HLEN);\n+\tif (vlan_present) {\n+\t\t/* The in-band tag duplicates the TCI carried in SDSA. */\n+\t\tif (encap_proto == ETH_P_8021Q) {\n+\t\t\t/* __skb_vlan_pop() expects skb-\u003edata at the Ethernet header. */\n+\t\t\tskb_push_rcsum(skb, ETH_HLEN);\n+\t\t\tskb_reset_mac_header(skb);\n+\t\t\tif (__skb_vlan_pop(skb, \u0026dummy_vlan_tci)) {\n+\t\t\t\treason = SKB_DROP_REASON_NOMEM;\n+\t\t\t\tgoto out_drop;\n+\t\t\t}\n+\t\t\tskb_pull_rcsum(skb, ETH_HLEN);\n+\t\t}\n+\n+\t\t__vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q), vlan_tci);\n+\t}\n+\n+\tdsa_default_offload_fwd_mark(skb);\n+\treturn skb;\n+\n+out_drop:\n+\tkfree_skb_reason(skb, reason);\n+\treturn NULL;\n+}\n+\n+static const struct dsa_device_ops sdsa_netdev_ops = {\n+\t.name = SDSA_NAME,\n+\t.proto = DSA_TAG_PROTO_SDSA,\n+\t.xmit = sdsa_xmit,\n+\t.rcv = sdsa_rcv,\n+\t/* Include room for an accelerated non-802.1Q tag pushed in-band. */\n+\t.needed_headroom = SDSA_HLEN + VLAN_HLEN,\n+};\n+\n+MODULE_LICENSE(\"GPL\");\n+MODULE_DESCRIPTION(\"DSA tag driver for SoC-e SDSA protocol\");\n+MODULE_ALIAS_DSA_TAG_DRIVER(DSA_TAG_PROTO_SDSA, SDSA_NAME);\n+\n+module_dsa_tag_driver(sdsa_netdev_ops);\n"
} |
| 2/1 | 2026/11/25 15:22 | agent | patch-evaluator |
5mModel:core Args: null Results: {
"EnableConfigs": null,
"FocusSymbols": [],
"Reasoning": "The patch series introduces support for the SoC-e SWIP FPGA Ethernet switch IP core, including devicetree bindings, an MFD core driver (soce-swip-core.c), an MDIO bus controller driver (mdio-soce.c), a DSA switch driver (soce-swip.c), and the SDSA tagging driver (tag_sdsa.c). These drivers probe via Device Tree for a memory-mapped FPGA IP core and require physical FPGA hardware that is not emulated in standard QEMU or GCE virtual machines on amd64. The SDSA tagging protocol (tag_sdsa.c) is tied specifically to this switch hardware and cannot be attached to mockup drivers like dsa_loop (which does not support runtime tag protocol changes). As such, all executable code introduced by this patch is structurally unreachable in standard fuzzing environments.",
"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 cfc1f499ca8f428b0e2faad735d88b4325b2b092
Author: syz-cluster <triage@syzkaller.com>
Date: Wed Nov 25 15:22:14 2026 +0000
syz-cluster: applied patch under review
diff --git a/Documentation/devicetree/bindings/mfd/soce,swip.yaml b/Documentation/devicetree/bindings/mfd/soce,swip.yaml
new file mode 100644
index 00000000000000..69bb9eae379f8b
--- /dev/null
+++ b/Documentation/devicetree/bindings/mfd/soce,swip.yaml
@@ -0,0 +1,138 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/mfd/soce,swip.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: SoC-e SWIP multifunction Ethernet switch FPGA IP core
+
+maintainers:
+ - Vasilij Strassheim <v.strassheim@linutronix.de>
+
+description:
+ SoC-e Switch IP (SWIP) cores integrate Ethernet switching logic, an
+ MDIO controller, and an MDIO bus multiplexer in one memory-mapped device.
+ The MDIO bus multiplexer is wired to the integrated MDIO controller.
+
+properties:
+ compatible:
+ const: soce,swip
+
+ reg:
+ maxItems: 1
+
+ '#address-cells':
+ const: 1
+
+ '#size-cells':
+ const: 1
+
+ ranges: true
+
+ ethernet-switch@0:
+ $ref: /schemas/net/dsa/soce,swip-switch.yaml#
+ unevaluatedProperties: false
+
+ mdio-mux@202:
+ $ref: /schemas/net/mdio-mux-mmioreg.yaml#
+ unevaluatedProperties: false
+
+ mdio@204:
+ $ref: /schemas/net/soce,swip-mdio.yaml#
+ unevaluatedProperties: false
+
+required:
+ - compatible
+ - reg
+ - '#address-cells'
+ - '#size-cells'
+ - ranges
+ - ethernet-switch@0
+
+dependentRequired:
+ mdio-mux@202:
+ - mdio@204
+
+additionalProperties: false
+
+examples:
+ - |
+ ip-core@80020000 {
+ compatible = "soce,swip";
+ reg = <0x80020000 0x10000>;
+ ranges = <0x0 0x80020000 0x10000>;
+ #address-cells = <1>;
+ #size-cells = <1>;
+
+ ethernet-switch@0 {
+ compatible = "soce,swip-switch-00-04-0c-10";
+ reg = <0x0 0x10000>;
+
+ ethernet-ports {
+ #address-cells = <1>;
+ #size-cells = <0>;
+
+ ethernet-port@0 {
+ reg = <0>;
+ phy-handle = <&switchphy0>;
+ phy-mode = "rgmii-id";
+ };
+
+ ethernet-port@1 {
+ reg = <1>;
+ phy-handle = <&switchphy1>;
+ phy-mode = "rgmii-id";
+ };
+
+ ethernet-port@2 {
+ reg = <2>;
+ ethernet = <ð0>;
+ phy-mode = "gmii";
+
+ fixed-link {
+ speed = <1000>;
+ full-duplex;
+ };
+ };
+ };
+ };
+
+ mdio-mux@202 {
+ compatible = "mdio-mux-mmioreg", "mdio-mux";
+ reg = <0x202 0x2>;
+ mux-mask = <0x07ff>;
+ mdio-parent-bus = <&mdio_parent>;
+ #address-cells = <1>;
+ #size-cells = <0>;
+
+ mdio@0 {
+ reg = <0>;
+ #address-cells = <1>;
+ #size-cells = <0>;
+
+ switchphy0: ethernet-phy@1 {
+ compatible = "ethernet-phy-ieee802.3-c22";
+ reg = <1>;
+ };
+ };
+
+ mdio@1 {
+ reg = <1>;
+ #address-cells = <1>;
+ #size-cells = <0>;
+
+ switchphy1: ethernet-phy@1 {
+ compatible = "ethernet-phy-ieee802.3-c22";
+ reg = <1>;
+ };
+ };
+ };
+
+ mdio_parent: mdio@204 {
+ compatible = "soce,swip-mdio";
+ reg = <0x204 0xc>, <0x200 0x2>;
+ reg-names = "data", "control";
+ #address-cells = <1>;
+ #size-cells = <0>;
+ };
+ };
diff --git a/Documentation/devicetree/bindings/net/dsa/soce,swip-switch.yaml b/Documentation/devicetree/bindings/net/dsa/soce,swip-switch.yaml
new file mode 100644
index 00000000000000..55232c0f3675e5
--- /dev/null
+++ b/Documentation/devicetree/bindings/net/dsa/soce,swip-switch.yaml
@@ -0,0 +1,101 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/net/dsa/soce,swip-switch.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: SoC-e SWIP FPGA Ethernet switch function
+
+maintainers:
+ - Vasilij Strassheim <v.strassheim@linutronix.de>
+
+description:
+ Ethernet switch function of the SoC-e Switch IP (SWIP) FPGA core. The port
+ count and presence of VLAN and STP register blocks depend on the FPGA
+ synthesis configuration.
+
+$ref: dsa.yaml#/$defs/ethernet-ports
+
+properties:
+ compatible:
+ const: soce,swip-switch-00-04-0c-10
+ description:
+ This compatible identifies the register layout; its suffix gives
+ the offsets of the core version and feature identification
+ registers (0x00, 0x04, 0x0c, and 0x10). Port counts and optional
+ features depend on the FPGA synthesis configuration and are
+ detected at runtime using this register layout.
+
+ reg:
+ description:
+ Register window of the IP core. Switch register blocks are located at
+ offsets defined by the compatible. The MDIO controller and bus
+ multiplexer occupy separate subregions described by sibling nodes.
+ maxItems: 1
+
+ ethernet-ports:
+ type: object
+ patternProperties:
+ '^ethernet-port@[0-9a-f]+$':
+ type: object
+
+ properties:
+ reg:
+ maximum: 30
+ description: Switch port index, from 0 through 30.
+
+ phy-mode:
+ enum:
+ - mii
+ - gmii
+ - rmii
+ - rgmii
+ - rgmii-id
+ - rgmii-rxid
+ - rgmii-txid
+
+ required:
+ - reg
+ - phy-mode
+
+required:
+ - compatible
+ - reg
+ - ethernet-ports
+
+unevaluatedProperties: false
+
+examples:
+ - |
+ ethernet-switch@0 {
+ compatible = "soce,swip-switch-00-04-0c-10";
+ reg = <0x0 0x10000>;
+
+ ethernet-ports {
+ #address-cells = <1>;
+ #size-cells = <0>;
+
+ ethernet-port@0 {
+ reg = <0>;
+ phy-handle = <&switchphy0>;
+ phy-mode = "rgmii-id";
+ };
+
+ ethernet-port@1 {
+ reg = <1>;
+ phy-handle = <&switchphy1>;
+ phy-mode = "rgmii-id";
+ };
+
+ ethernet-port@2 {
+ reg = <2>;
+ ethernet = <ð0>;
+ phy-mode = "gmii";
+
+ fixed-link {
+ speed = <1000>;
+ full-duplex;
+ };
+ };
+ };
+ };
diff --git a/Documentation/devicetree/bindings/net/soce,swip-mdio.yaml b/Documentation/devicetree/bindings/net/soce,swip-mdio.yaml
new file mode 100644
index 00000000000000..7a0b8bd3ab71b3
--- /dev/null
+++ b/Documentation/devicetree/bindings/net/soce,swip-mdio.yaml
@@ -0,0 +1,47 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/net/soce,swip-mdio.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: SoC-e SWIP FPGA MDIO controller
+
+maintainers:
+ - Vasilij Strassheim <v.strassheim@linutronix.de>
+
+description:
+ MDIO controller integrated into the SoC-e Switch IP (SWIP) FPGA core.
+ External MDIO buses are selected through a sibling MMIO MDIO mux.
+
+$ref: mdio.yaml#
+
+properties:
+ compatible:
+ const: soce,swip-mdio
+
+ reg:
+ items:
+ - description: MDIO parameter, write data, and read data registers
+ - description: Lower 16-bit half of the MDIO transaction control register
+
+ reg-names:
+ items:
+ - const: data
+ - const: control
+
+required:
+ - compatible
+ - reg
+ - reg-names
+
+unevaluatedProperties: false
+
+examples:
+ - |
+ mdio@204 {
+ compatible = "soce,swip-mdio";
+ reg = <0x204 0xc>, <0x200 0x2>;
+ reg-names = "data", "control";
+ #address-cells = <1>;
+ #size-cells = <0>;
+ };
diff --git a/Documentation/devicetree/bindings/vendor-prefixes.yaml b/Documentation/devicetree/bindings/vendor-prefixes.yaml
index 5471a06f93f101..20a850a6e86ff1 100644
--- a/Documentation/devicetree/bindings/vendor-prefixes.yaml
+++ b/Documentation/devicetree/bindings/vendor-prefixes.yaml
@@ -1599,6 +1599,8 @@ patternProperties:
description: Standard Microsystems Corporation
"^snps,.*":
description: Synopsys, Inc.
+ "^soce,.*":
+ description: System-On-Chip Engineering, S.L.
"^sochip,.*":
description: Shenzhen SoChip Technology Co., Ltd.
"^socionext,.*":
diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig
index 87ed55c155f03f..ff3378e928fd8b 100644
--- a/drivers/mfd/Kconfig
+++ b/drivers/mfd/Kconfig
@@ -1291,6 +1291,15 @@ config MFD_QCOM_RPM
Say M here if you want to include support for the Qualcomm RPM as a
module. This will build a module called "qcom_rpm".
+config MFD_SOCE_SWIP
+ tristate
+ depends on OF
+ help
+ Support for memory-mapped SoC-e Ethernet switch IP cores implemented
+ in FPGAs. These devices integrate an Ethernet
+ switch, an MDIO controller, and an MDIO bus selector.
+ This is selected if Ethernet switch functionality is configured.
+
config MFD_SPACEMIT_P1
tristate "SpacemiT P1 PMIC"
depends on ARCH_SPACEMIT || COMPILE_TEST
diff --git a/drivers/mfd/Makefile b/drivers/mfd/Makefile
index f8101d2a9ce950..9f4d2ccc3a2492 100644
--- a/drivers/mfd/Makefile
+++ b/drivers/mfd/Makefile
@@ -302,6 +302,8 @@ obj-$(CONFIG_MFD_QNAP_MCU) += qnap-mcu.o
obj-$(CONFIG_MFD_RSMU_I2C) += rsmu_i2c.o rsmu_core.o
obj-$(CONFIG_MFD_RSMU_SPI) += rsmu_spi.o rsmu_core.o
+obj-$(CONFIG_MFD_SOCE_SWIP) += soce-swip-core.o
+
obj-$(CONFIG_MFD_UPBOARD_FPGA) += upboard-fpga.o
obj-$(CONFIG_MFD_LOONGSON_SE) += loongson-se.o
diff --git a/drivers/mfd/soce-swip-core.c b/drivers/mfd/soce-swip-core.c
new file mode 100644
index 00000000000000..2f7d966eeab275
--- /dev/null
+++ b/drivers/mfd/soce-swip-core.c
@@ -0,0 +1,76 @@
+// SPDX-License-Identifier: GPL-2.0
+
+#include <linux/bitfield.h>
+#include <linux/io.h>
+#include <linux/module.h>
+#include <linux/of_platform.h>
+#include <linux/platform_device.h>
+
+#define SWIP_CORE_VERSION_OFFSET 0x0000
+#define SWIP_CORE_VERSION_VERSION_MASK GENMASK(31, 24)
+#define SWIP_CORE_VERSION_SUBVERSION_MASK GENMASK(23, 16)
+#define SWIP_CORE_VERSION_REVISION_MASK GENMASK(15, 0)
+#define SWIP_MIN_CORE_VERSION 0x24
+#define SWIP_MIN_CORE_SUBVERSION 0x01
+
+static int swip_check_version(struct device *dev, void __iomem *base)
+{
+ u8 subversion;
+ u16 revision;
+ u8 version;
+ u32 regval;
+
+ regval = readl(base + SWIP_CORE_VERSION_OFFSET);
+ version = FIELD_GET(SWIP_CORE_VERSION_VERSION_MASK, regval);
+ subversion = FIELD_GET(SWIP_CORE_VERSION_SUBVERSION_MASK, regval);
+ revision = FIELD_GET(SWIP_CORE_VERSION_REVISION_MASK, regval);
+ if (version < SWIP_MIN_CORE_VERSION ||
+ (version == SWIP_MIN_CORE_VERSION &&
+ subversion < SWIP_MIN_CORE_SUBVERSION))
+ return dev_err_probe(dev, -ENODEV,
+ "unsupported core version %02x.%02x.%04x\n",
+ version, subversion, revision);
+
+ dev_info(dev, "SoC-e IP core version %02x.%02x.%04x detected\n",
+ version, subversion, revision);
+
+ return 0;
+}
+
+static int swip_probe(struct platform_device *pdev)
+{
+ struct device *dev = &pdev->dev;
+ struct resource *res;
+ void __iomem *base;
+ int ret;
+
+ res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+ if (!res || resource_size(res) < sizeof(u32))
+ return -EINVAL;
+ base = devm_ioremap(dev, res->start, sizeof(u32));
+ if (!base)
+ return -ENOMEM;
+ ret = swip_check_version(dev, base);
+ if (ret)
+ return ret;
+
+ return devm_of_platform_populate(dev);
+}
+
+static const struct of_device_id swip_of_match[] = {
+ { .compatible = "soce,swip" },
+ { }
+};
+MODULE_DEVICE_TABLE(of, swip_of_match);
+
+static struct platform_driver swip_driver = {
+ .probe = swip_probe,
+ .driver = {
+ .name = "soce-swip",
+ .of_match_table = swip_of_match,
+ },
+};
+module_platform_driver(swip_driver);
+
+MODULE_DESCRIPTION("SoC-e multifunction switch IP device driver");
+MODULE_LICENSE("GPL");
diff --git a/drivers/net/dsa/Kconfig b/drivers/net/dsa/Kconfig
index d62f0cccf13d54..92415169db81c0 100644
--- a/drivers/net/dsa/Kconfig
+++ b/drivers/net/dsa/Kconfig
@@ -149,6 +149,21 @@ config NET_DSA_SMSC_LAN9303_MDIO
Enable access functions if the Microchip LAN9303/LAN9354 is configured
for MDIO managed mode.
+config NET_DSA_SOCE_SWIP
+ tristate "SoC-e SWIP switches"
+ depends on NET_DSA
+ depends on OF
+ depends on HAS_IOMEM
+ select MFD_SOCE_SWIP
+ select MDIO_SOCE_SWIP
+ select MDIO_BUS_MUX_MMIOREG
+ select NET_DSA_TAG_SDSA
+ help
+ This enables support for switches based on SoC-e SWIP IP cores.
+ Frames are exchanged with the CPU port using the SDSA DSA tag protocol.
+ The driver supports switch variants whose features and number of ports
+ are selected at synthesis time and detected at runtime.
+
config NET_DSA_VITESSE_VSC73XX
tristate
select NET_DSA_TAG_VSC73XX_8021Q
diff --git a/drivers/net/dsa/Makefile b/drivers/net/dsa/Makefile
index 7e637d56b35c80..cb00d83ed29a95 100644
--- a/drivers/net/dsa/Makefile
+++ b/drivers/net/dsa/Makefile
@@ -11,6 +11,7 @@ obj-$(CONFIG_NET_DSA_RZN1_A5PSW) += rzn1_a5psw.o
obj-$(CONFIG_NET_DSA_SMSC_LAN9303) += lan9303-core.o
obj-$(CONFIG_NET_DSA_SMSC_LAN9303_I2C) += lan9303_i2c.o
obj-$(CONFIG_NET_DSA_SMSC_LAN9303_MDIO) += lan9303_mdio.o
+obj-$(CONFIG_NET_DSA_SOCE_SWIP) += soce-swip.o
obj-$(CONFIG_NET_DSA_VITESSE_VSC73XX) += vitesse-vsc73xx-core.o
obj-$(CONFIG_NET_DSA_VITESSE_VSC73XX_PLATFORM) += vitesse-vsc73xx-platform.o
obj-$(CONFIG_NET_DSA_VITESSE_VSC73XX_SPI) += vitesse-vsc73xx-spi.o
diff --git a/drivers/net/dsa/soce-swip.c b/drivers/net/dsa/soce-swip.c
new file mode 100644
index 00000000000000..624c7fbfd73f8a
--- /dev/null
+++ b/drivers/net/dsa/soce-swip.c
@@ -0,0 +1,701 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (c) 2020-2026 System on Chip engineering, S.L.
+ * Copyright (c) 2026 Linutronix GmbH
+ * Author: Vasilij Strassheim <v.strassheim@linutronix.de>
+ */
+
+#include <linux/bitfield.h>
+#include <linux/if_vlan.h>
+#include <linux/io.h>
+#include <linux/iopoll.h>
+#include <linux/module.h>
+#include <linux/netdevice.h>
+#include <linux/of.h>
+#include <linux/of_net.h>
+#include <linux/phy.h>
+#include <linux/phylink.h>
+#include <linux/platform_device.h>
+#include <linux/string.h>
+
+#include <net/dsa.h>
+
+#include "soce-swip.h"
+
+#define SWIP_IDENT_BASE_OFFSET 0x0000
+#define SWIP_IDENT_SIZE 0x0050
+#define SWIP_LIC_FEATURES_OFFSET 0x0004
+#define SWIP_LIC_FEATURES_NUM_PORTS_MASK GENMASK(31, 27)
+#define SWIP_IMPL_FEATURES0_OFFSET 0x000c
+#define SWIP_IMPL_FEATURES0_NUM_PORTS_MASK GENMASK(31, 27)
+#define SWIP_IMPL_FEATURES0_PORT_VLAN BIT(9)
+#define SWIP_IMPL_FEATURES0_STP BIT(20)
+#define SWIP_IMPL_FEATURES0_DSA BIT(23)
+#define SWIP_MIN_NUM_PORTS 3
+
+#define SWIP_DSA_BASE_OFFSET 0x1200
+#define SWIP_DSA_SIZE 0x0044
+#define SWIP_TAG_ALL_FRAMES_CTRL_OFFSET 0x001c
+#define SWIP_TAG_ALL_FRAMES_CTRL_ENABLE BIT(0)
+#define SWIP_CUSTOM_RULES_TAGGING_OFFSET 0x0020
+#define SWIP_CUSTOM_RULES_TAGGING_ENABLE BIT(0)
+
+#define SWIP_PORTS_BASE_OFFSET 0x3000
+#define SWIP_PORTS_SIZE 0x0014
+#define SWIP_PORTS_SELECTOR_OFFSET 0x0000
+#define SWIP_PORTS_SELECTOR_PORT_MASK GENMASK(7, 0)
+#define SWIP_PORTS_CTRL_OFFSET 0x0004
+#define SWIP_PORTS_CTRL_INGR_EN BIT(0)
+#define SWIP_PORTS_CTRL_EGR_EN BIT(1)
+
+#define SWIP_STP_BASE_OFFSET 0x0f00
+#define SWIP_STP_SIZE 0x0040
+#define SWIP_STP_CTRL_OFFSET 0x0000
+#define SWIP_STP_CTRL_ENABLE BIT(0)
+
+#define SWIP_VLAN_BASE_OFFSET 0x0d00
+#define SWIP_VLAN_SIZE 0x0044
+#define SWIP_VLAN_CTRL_OFFSET 0x0000
+#define SWIP_VLAN_CTRL_ENABLE BIT(0)
+#define SWIP_VLAN_RESET_OFFSET 0x0004
+#define SWIP_VLAN_RESET_CMD BIT(0)
+#define SWIP_VLAN_PORT_SEL_OFFSET 0x0010
+#define SWIP_VLAN_PORT_SEL_PORT_MASK GENMASK(7, 0)
+#define SWIP_VLAN_PORT_MODE_OFFSET 0x0014
+#define SWIP_VLAN_PORT_MODE_HYBRID 0x2
+#define SWIP_VLAN_PORT_TYPE_OFFSET 0x0018
+#define SWIP_VLAN_PORT_TYPE_UNAWARE 0x0
+#define SWIP_VLAN_PORT_VLAN_OFFSET 0x001c
+#define SWIP_VLAN_PORT_VLAN_PVID_MASK GENMASK(11, 0)
+#define SWIP_VLAN_PORT_INGR_FILTER_OFFSET 0x0020
+#define SWIP_VLAN_PORT_INGR_ACCEPT_OFFSET 0x0024
+#define SWIP_VLAN_PORT_INGR_ACCEPT_ALL 0x0
+#define SWIP_VLAN_PORT_EGR_TAG_OFFSET 0x0028
+#define SWIP_VLAN_PORT_EGR_TAG_MASK GENMASK(1, 0)
+#define SWIP_VLAN_PORT_EGR_TAG_UNTAG_PVID 0x0
+#define SWIP_VLAN_VID_SEL_OFFSET 0x002c
+#define SWIP_VLAN_VID_SEL_VID_MASK GENMASK(11, 0)
+#define SWIP_VLAN_MEMBER_CTRL_OFFSET 0x0030
+#define SWIP_VLAN_MEMBER_CTRL_WRITE BIT(0)
+#define SWIP_VLAN_MEMBER_PORTS_OFFSET 0x0034
+#define SWIP_VLAN_CMD_TIMEOUT_US 1000
+#define SWIP_STANDALONE_PVID 1
+
+static void __iomem *swip_ioremap(struct device *dev,
+ const struct resource *window,
+ resource_size_t offset, resource_size_t size,
+ const char *name)
+{
+ struct resource res = {
+ .name = name,
+ .flags = IORESOURCE_MEM,
+ };
+
+ if (!size || offset >= resource_size(window) ||
+ size > resource_size(window) - offset) {
+ dev_err(dev, "%s registers exceed switch resource\n", name);
+ return ERR_PTR(-EINVAL);
+ }
+
+ res.start = window->start + offset;
+ res.end = res.start + size - 1;
+
+ return devm_ioremap_resource(dev, &res);
+}
+
+static int swip_identify(struct device *dev, void __iomem *base,
+ struct swip_priv *priv)
+{
+ u32 implemented_ports;
+ u32 licensed_ports;
+ u32 regval;
+
+ regval = readl(base + SWIP_LIC_FEATURES_OFFSET);
+ licensed_ports = FIELD_GET(SWIP_LIC_FEATURES_NUM_PORTS_MASK, regval);
+ regval = readl(base + SWIP_IMPL_FEATURES0_OFFSET);
+ if (!(regval & SWIP_IMPL_FEATURES0_DSA))
+ return dev_err_probe(dev, -ENODEV,
+ "core does not implement DSA\n");
+
+ implemented_ports =
+ FIELD_GET(SWIP_IMPL_FEATURES0_NUM_PORTS_MASK, regval);
+ if (!licensed_ports || licensed_ports > SWIP_MAX_NUM_PORTS ||
+ implemented_ports < SWIP_MIN_NUM_PORTS ||
+ implemented_ports > licensed_ports)
+ return dev_err_probe(dev, -EINVAL,
+ "invalid port counts\n");
+
+ priv->features.num_ports = implemented_ports;
+ priv->features.port_vlan = regval & SWIP_IMPL_FEATURES0_PORT_VLAN;
+ priv->features.stp = regval & SWIP_IMPL_FEATURES0_STP;
+
+ return 0;
+}
+
+static void swip_phylink_get_caps(struct dsa_switch *ds, int port,
+ struct phylink_config *config)
+{
+ struct dsa_port *dp = dsa_to_port(ds, port);
+ phy_interface_t mode;
+ int ret;
+
+ ret = of_get_phy_mode(dp->dn, &mode);
+ if (ret)
+ return;
+
+ if (phy_interface_mode_is_rgmii(mode))
+ phy_interface_set_rgmii(config->supported_interfaces);
+ else
+ __set_bit(mode, config->supported_interfaces);
+
+ config->mac_capabilities = MAC_SYM_PAUSE | MAC_ASYM_PAUSE;
+
+ switch (mode) {
+ case PHY_INTERFACE_MODE_MII:
+ config->mac_capabilities |= MAC_10 | MAC_100;
+ break;
+ case PHY_INTERFACE_MODE_GMII:
+ config->mac_capabilities |= MAC_10 | MAC_100 | MAC_1000;
+ break;
+ case PHY_INTERFACE_MODE_RMII:
+ config->mac_capabilities |= MAC_10 | MAC_100;
+ break;
+ default:
+ if (phy_interface_mode_is_rgmii(mode))
+ config->mac_capabilities |= MAC_10 | MAC_100 | MAC_1000;
+ break;
+ }
+}
+
+static void swip_enable_tagging(struct swip_dsa_local *local)
+{
+ void __iomem *base = local->dsa;
+ u32 regval;
+
+ /* Enabling "All Frames" tagging isolates user ports by forwarding
+ * their complete ingress traffic only to the CPU port.
+ */
+ regval = readl(base + SWIP_TAG_ALL_FRAMES_CTRL_OFFSET);
+ regval |= SWIP_TAG_ALL_FRAMES_CTRL_ENABLE;
+ writel(regval, base + SWIP_TAG_ALL_FRAMES_CTRL_OFFSET);
+
+ /* "All Frames" tagging needs the active custom tagging mechanism. */
+ regval = readl(base + SWIP_CUSTOM_RULES_TAGGING_OFFSET);
+ regval |= SWIP_CUSTOM_RULES_TAGGING_ENABLE;
+ writel(regval, base + SWIP_CUSTOM_RULES_TAGGING_OFFSET);
+}
+
+static void swip_disable_tagging(struct swip_dsa_local *local)
+{
+ void __iomem *base = local->dsa;
+ u32 regval;
+
+ regval = readl(base + SWIP_TAG_ALL_FRAMES_CTRL_OFFSET);
+ regval &= ~SWIP_TAG_ALL_FRAMES_CTRL_ENABLE;
+ writel(regval, base + SWIP_TAG_ALL_FRAMES_CTRL_OFFSET);
+
+ regval = readl(base + SWIP_CUSTOM_RULES_TAGGING_OFFSET);
+ regval &= ~SWIP_CUSTOM_RULES_TAGGING_ENABLE;
+ writel(regval, base + SWIP_CUSTOM_RULES_TAGGING_OFFSET);
+}
+
+static void swip_stp_disable(struct swip_dsa_local *local)
+{
+ void __iomem *base = local->stp;
+ u32 regval;
+
+ regval = readl(base + SWIP_STP_CTRL_OFFSET);
+ regval &= ~SWIP_STP_CTRL_ENABLE;
+ writel(regval, base + SWIP_STP_CTRL_OFFSET);
+}
+
+static void swip_vlan_set_enabled(struct swip_dsa_local *local, bool enabled)
+{
+ void __iomem *base = local->vlan;
+ u32 regval;
+
+ regval = readl(base + SWIP_VLAN_CTRL_OFFSET);
+ if (enabled)
+ regval |= SWIP_VLAN_CTRL_ENABLE;
+ else
+ regval &= ~SWIP_VLAN_CTRL_ENABLE;
+ writel(regval, base + SWIP_VLAN_CTRL_OFFSET);
+}
+
+static int swip_vlan_reset(struct swip_dsa_local *local)
+{
+ void __iomem *base = local->vlan;
+ u32 regval;
+
+ writel(SWIP_VLAN_RESET_CMD, base + SWIP_VLAN_RESET_OFFSET);
+
+ return readl_poll_timeout(base + SWIP_VLAN_RESET_OFFSET,
+ regval, !(regval & SWIP_VLAN_RESET_CMD), 10,
+ SWIP_VLAN_CMD_TIMEOUT_US);
+}
+
+static int swip_vlan_wait_for_write(struct swip_dsa_local *local)
+{
+ void __iomem *base = local->vlan;
+ u32 regval;
+
+ return readl_poll_timeout(base + SWIP_VLAN_MEMBER_CTRL_OFFSET, regval,
+ !(regval & SWIP_VLAN_MEMBER_CTRL_WRITE), 10,
+ SWIP_VLAN_CMD_TIMEOUT_US);
+}
+
+static void swip_vlan_select_port(struct swip_dsa_local *local, int port)
+{
+ writel(FIELD_PREP(SWIP_VLAN_PORT_SEL_PORT_MASK, port),
+ local->vlan + SWIP_VLAN_PORT_SEL_OFFSET);
+}
+
+static void swip_vlan_select_vid(struct swip_dsa_local *local, u16 vid)
+{
+ writel(FIELD_PREP(SWIP_VLAN_VID_SEL_VID_MASK, vid),
+ local->vlan + SWIP_VLAN_VID_SEL_OFFSET);
+}
+
+static void swip_vlan_config_port(struct swip_priv *priv, int port)
+{
+ struct swip_dsa_local *local = &priv->local;
+ void __iomem *base = local->vlan;
+ u32 regval;
+
+ /*
+ * VLAN-unaware ports classify ingress traffic to PVID 1 without consuming
+ * existing in-band VLAN headers.
+ */
+ swip_vlan_select_port(local, port);
+ writel(SWIP_VLAN_PORT_MODE_HYBRID, base + SWIP_VLAN_PORT_MODE_OFFSET);
+ writel(SWIP_VLAN_PORT_TYPE_UNAWARE, base + SWIP_VLAN_PORT_TYPE_OFFSET);
+ writel(FIELD_PREP(SWIP_VLAN_PORT_VLAN_PVID_MASK,
+ SWIP_STANDALONE_PVID),
+ base + SWIP_VLAN_PORT_VLAN_OFFSET);
+ writel(0, base + SWIP_VLAN_PORT_INGR_FILTER_OFFSET);
+ writel(SWIP_VLAN_PORT_INGR_ACCEPT_ALL,
+ base + SWIP_VLAN_PORT_INGR_ACCEPT_OFFSET);
+
+ regval = readl(base + SWIP_VLAN_PORT_EGR_TAG_OFFSET);
+ regval &= ~SWIP_VLAN_PORT_EGR_TAG_MASK;
+ regval |= FIELD_PREP(SWIP_VLAN_PORT_EGR_TAG_MASK,
+ SWIP_VLAN_PORT_EGR_TAG_UNTAG_PVID);
+ writel(regval, base + SWIP_VLAN_PORT_EGR_TAG_OFFSET);
+}
+
+static int swip_vlan_write_entry(struct swip_priv *priv, u16 vid)
+{
+ struct swip_dsa_local *local = &priv->local;
+ void __iomem *base = local->vlan;
+ struct dsa_port *dp;
+ u32 standalone = 0;
+ u32 cpu_ports;
+ u32 members;
+ int ret;
+
+ cpu_ports = dsa_cpu_ports(&priv->ds);
+ /*
+ * DSA treats software-bridged ports as standalone. Keep their default
+ * PVID membership independently of VLAN RX-filter registrations.
+ */
+ if (vid == SWIP_STANDALONE_PVID) {
+ dsa_switch_for_each_user_port(dp, &priv->ds) {
+ if (!dsa_port_bridge_dev_get(dp))
+ standalone |= BIT(dp->index);
+ }
+ }
+ members = priv->vlan_members[vid] | standalone;
+ /* CPU membership preserves VLAN delivery to the conduit. */
+ if (members)
+ members |= cpu_ports;
+
+ /* A timed-out command may still be using the shared VID selector. */
+ ret = swip_vlan_wait_for_write(local);
+ if (ret)
+ return ret;
+
+ swip_vlan_select_vid(local, vid);
+ writel(members, base + SWIP_VLAN_MEMBER_PORTS_OFFSET);
+ writel(SWIP_VLAN_MEMBER_CTRL_WRITE,
+ base + SWIP_VLAN_MEMBER_CTRL_OFFSET);
+
+ return swip_vlan_wait_for_write(local);
+}
+
+static int swip_vlan_setup(struct dsa_switch *ds)
+{
+ struct swip_priv *priv = ds->priv;
+ struct swip_dsa_local *local;
+ struct dsa_port *dp;
+ int ret;
+
+ local = &priv->local;
+
+ if (!priv->features.port_vlan)
+ return 0;
+
+ ret = swip_vlan_reset(local);
+ if (ret) {
+ dev_err(ds->dev, "failed to reset VLAN configuration: %d\n",
+ ret);
+ return ret;
+ }
+
+ memset(priv->vlan_members, 0,
+ sizeof(*priv->vlan_members) * VLAN_N_VID);
+
+ ret = swip_vlan_write_entry(priv, SWIP_STANDALONE_PVID);
+ if (ret) {
+ dev_err(ds->dev, "failed to set up standalone VLAN: %d\n",
+ ret);
+ return ret;
+ }
+
+ dsa_switch_for_each_available_port(dp, ds)
+ swip_vlan_config_port(priv, dp->index);
+
+ swip_vlan_set_enabled(local, true);
+
+ return 0;
+}
+
+static void swip_vlan_teardown(struct swip_priv *priv)
+{
+ struct swip_dsa_local *local = &priv->local;
+ int ret;
+
+ if (!priv->features.port_vlan)
+ return;
+
+ scoped_guard(mutex, &priv->feature_lock) {
+ ret = swip_vlan_reset(local);
+ if (ret)
+ dev_warn(priv->ds.dev,
+ "failed to reset VLAN configuration during teardown: %d\n",
+ ret);
+ swip_vlan_set_enabled(local, false);
+ }
+}
+
+static void swip_port_select(struct swip_dsa_local *local, int port)
+{
+ writel(FIELD_PREP(SWIP_PORTS_SELECTOR_PORT_MASK, port),
+ local->ports + SWIP_PORTS_SELECTOR_OFFSET);
+}
+
+static void swip_port_set_enabled(struct swip_dsa_local *local, int port,
+ bool enabled)
+{
+ void __iomem *base = local->ports;
+ u32 regval;
+
+ swip_port_select(local, port);
+
+ regval = readl(base + SWIP_PORTS_CTRL_OFFSET);
+ if (enabled)
+ regval |= SWIP_PORTS_CTRL_INGR_EN | SWIP_PORTS_CTRL_EGR_EN;
+ else
+ regval &= ~(SWIP_PORTS_CTRL_INGR_EN | SWIP_PORTS_CTRL_EGR_EN);
+ writel(regval, base + SWIP_PORTS_CTRL_OFFSET);
+}
+
+static int swip_port_enable(struct dsa_switch *ds, int port,
+ struct phy_device *phy)
+{
+ struct swip_priv *priv = ds->priv;
+
+ swip_port_set_enabled(&priv->local, port, true);
+
+ return 0;
+}
+
+static void swip_port_disable(struct dsa_switch *ds, int port)
+{
+ struct swip_priv *priv = ds->priv;
+
+ swip_port_set_enabled(&priv->local, port, false);
+}
+
+static int swip_setup(struct dsa_switch *ds)
+{
+ struct swip_priv *priv = ds->priv;
+ struct dsa_port *dp;
+ int ret;
+
+ dsa_switch_for_each_user_port(dp, ds)
+ swip_port_set_enabled(&priv->local, dp->index, false);
+
+ ret = swip_vlan_setup(ds);
+ if (ret)
+ return ret;
+
+ /* Unconfigured hardware STP blocks frame forwarding. */
+ if (priv->features.stp)
+ swip_stp_disable(&priv->local);
+
+ swip_enable_tagging(&priv->local);
+
+ return 0;
+}
+
+static void swip_teardown(struct dsa_switch *ds)
+{
+ struct swip_priv *priv = ds->priv;
+ struct swip_dsa_local *local;
+
+ local = &priv->local;
+
+ swip_disable_tagging(local);
+ swip_vlan_teardown(priv);
+}
+
+static enum dsa_tag_protocol swip_get_tag_protocol(struct dsa_switch *ds,
+ int port,
+ enum dsa_tag_protocol mprop)
+{
+ return DSA_TAG_PROTO_SDSA;
+}
+
+static int swip_port_vlan_add(struct dsa_switch *ds, int port,
+ const struct switchdev_obj_port_vlan *vlan,
+ struct netlink_ext_ack *extack)
+{
+ struct swip_priv *priv = ds->priv;
+ u32 port_mask = BIT(port);
+ int rollback_ret;
+ u32 old_members;
+ u32 *members;
+ int ret;
+
+ members = priv->vlan_members;
+
+ if (!vlan->vid)
+ return 0;
+
+ if (!priv->features.port_vlan) {
+ NL_SET_ERR_MSG_MOD(extack,
+ "Port VLAN support is not implemented in the switch core");
+ return -EINVAL;
+ }
+
+ scoped_guard(mutex, &priv->feature_lock) {
+ old_members = members[vlan->vid];
+
+ members[vlan->vid] |= port_mask;
+
+ ret = swip_vlan_write_entry(priv, vlan->vid);
+ if (ret) {
+ NL_SET_ERR_MSG_MOD(extack,
+ "failed to update VLAN hardware tables");
+ dev_err(ds->dev,
+ "failed to add VLAN %u on port %d: %d\n",
+ vlan->vid, port, ret);
+ members[vlan->vid] = old_members;
+ /* Best-effort: restore the previous hardware entry. */
+ rollback_ret = swip_vlan_write_entry(priv, vlan->vid);
+ if (rollback_ret)
+ dev_err(ds->dev,
+ "failed to restore VLAN %u on port %d: %d\n",
+ vlan->vid, port, rollback_ret);
+ return ret;
+ }
+ }
+
+ return ret;
+}
+
+static int swip_port_vlan_del(struct dsa_switch *ds, int port,
+ const struct switchdev_obj_port_vlan *vlan)
+{
+ struct swip_priv *priv = ds->priv;
+ u32 port_mask = BIT(port);
+ int rollback_ret;
+ u32 old_members;
+ u32 *members;
+ int ret;
+
+ members = priv->vlan_members;
+
+ if (!vlan->vid)
+ return 0;
+
+ if (!priv->features.port_vlan)
+ return -EOPNOTSUPP;
+
+ scoped_guard(mutex, &priv->feature_lock) {
+ old_members = members[vlan->vid];
+ members[vlan->vid] &= ~port_mask;
+ ret = swip_vlan_write_entry(priv, vlan->vid);
+ if (ret) {
+ dev_err(ds->dev,
+ "failed to delete VLAN %u from port %d: %d\n",
+ vlan->vid, port, ret);
+ members[vlan->vid] = old_members;
+ /* Best-effort: restore the previous hardware entry. */
+ rollback_ret = swip_vlan_write_entry(priv, vlan->vid);
+ if (rollback_ret)
+ dev_err(ds->dev,
+ "failed to restore VLAN %u on port %d: %d\n",
+ vlan->vid, port, rollback_ret);
+ return ret;
+ }
+ }
+
+ return ret;
+}
+
+static int
+swip_port_prechangeupper(struct dsa_switch *ds, int port,
+ struct netdev_notifier_changeupper_info *info)
+{
+ struct swip_priv *priv = ds->priv;
+ struct netlink_ext_ack *extack;
+
+ if (!info->linking || !is_vlan_dev(info->upper_dev) ||
+ priv->features.port_vlan)
+ return 0;
+
+ extack = netdev_notifier_info_to_extack(&info->info);
+ NL_SET_ERR_MSG_MOD(extack,
+ "VLAN uppers require Port VLAN support in the switch core");
+ return -EOPNOTSUPP;
+}
+
+static const struct dsa_switch_ops swip_switch_ops = {
+ .get_tag_protocol = swip_get_tag_protocol,
+ .setup = swip_setup,
+ .teardown = swip_teardown,
+ .phylink_get_caps = swip_phylink_get_caps,
+ .port_enable = swip_port_enable,
+ .port_disable = swip_port_disable,
+ .port_vlan_add = swip_port_vlan_add,
+ .port_vlan_del = swip_port_vlan_del,
+ .port_prechangeupper = swip_port_prechangeupper,
+};
+
+static int swip_probe(struct platform_device *pdev)
+{
+ struct device *dev = &pdev->dev;
+ struct swip_dsa_local *local;
+ struct swip_priv *priv;
+ struct dsa_switch *ds;
+ struct resource *res;
+ void __iomem *base;
+ int ret;
+
+ res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+ if (!res)
+ return -EINVAL;
+
+ priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
+ if (!priv)
+ return -ENOMEM;
+
+ ds = &priv->ds;
+ ds->dev = dev;
+ ds->priv = priv;
+
+ base = swip_ioremap(dev, res, SWIP_IDENT_BASE_OFFSET,
+ SWIP_IDENT_SIZE, "ident");
+ if (IS_ERR(base))
+ return PTR_ERR(base);
+ ret = swip_identify(dev, base, priv);
+ if (ret)
+ return ret;
+
+ local = &priv->local;
+ local->dsa = swip_ioremap(dev, res, SWIP_DSA_BASE_OFFSET,
+ SWIP_DSA_SIZE, "dsa");
+ if (IS_ERR(local->dsa))
+ return PTR_ERR(local->dsa);
+ local->ports = swip_ioremap(dev, res, SWIP_PORTS_BASE_OFFSET,
+ SWIP_PORTS_SIZE, "ports");
+ if (IS_ERR(local->ports))
+ return PTR_ERR(local->ports);
+ if (priv->features.stp) {
+ local->stp = swip_ioremap(dev, res, SWIP_STP_BASE_OFFSET,
+ SWIP_STP_SIZE, "stp");
+ if (IS_ERR(local->stp))
+ return PTR_ERR(local->stp);
+ }
+ ret = devm_mutex_init(dev, &priv->feature_lock);
+ if (ret)
+ return ret;
+
+ if (priv->features.port_vlan) {
+ local->vlan = swip_ioremap(dev, res, SWIP_VLAN_BASE_OFFSET,
+ SWIP_VLAN_SIZE, "vlan");
+ if (IS_ERR(local->vlan))
+ return PTR_ERR(local->vlan);
+
+ priv->vlan_members =
+ devm_kcalloc(dev, VLAN_N_VID,
+ sizeof(*priv->vlan_members), GFP_KERNEL);
+ if (!priv->vlan_members)
+ return -ENOMEM;
+
+ } else {
+ dev_warn(dev,
+ "No Port VLAN: tagged CPU ingress loses VLAN IDs. VLAN-aware bridge unsupported\n");
+ }
+
+ ds->ops = &swip_switch_ops;
+ ds->num_ports = priv->features.num_ports;
+
+ ds->needs_standalone_vlan_filtering = priv->features.port_vlan;
+
+ dev_set_drvdata(dev, priv);
+
+ ret = dsa_register_switch(ds);
+ if (ret)
+ return dev_err_probe(dev, ret,
+ "failed to register DSA switch\n");
+
+ dev_info(dev, "probed SoC-e switch with %u ports\n",
+ priv->features.num_ports);
+
+ return 0;
+}
+
+static void swip_remove(struct platform_device *pdev)
+{
+ struct swip_priv *priv = platform_get_drvdata(pdev);
+
+ if (!priv)
+ return;
+
+ dsa_unregister_switch(&priv->ds);
+ platform_set_drvdata(pdev, NULL);
+}
+
+static void swip_shutdown(struct platform_device *pdev)
+{
+ struct swip_priv *priv = platform_get_drvdata(pdev);
+
+ if (!priv)
+ return;
+
+ dsa_switch_shutdown(&priv->ds);
+ platform_set_drvdata(pdev, NULL);
+}
+
+static const struct of_device_id swip_of_match[] = {
+ { .compatible = "soce,swip-switch-00-04-0c-10" },
+ { /* sentinel */ }
+};
+
+static struct platform_driver swip_driver = {
+ .probe = swip_probe,
+ .remove = swip_remove,
+ .shutdown = swip_shutdown,
+ .driver = {
+ .name = "soce-switch",
+ .of_match_table = swip_of_match,
+ },
+};
+
+module_platform_driver(swip_driver);
+MODULE_DEVICE_TABLE(of, swip_of_match);
+MODULE_AUTHOR("Vasilij Strassheim <v.strassheim@linutronix.de>");
+MODULE_DESCRIPTION("SoC-e SWIP DSA switch driver");
+MODULE_LICENSE("GPL");
diff --git a/drivers/net/dsa/soce-swip.h b/drivers/net/dsa/soce-swip.h
new file mode 100644
index 00000000000000..034a05ce8dc5c9
--- /dev/null
+++ b/drivers/net/dsa/soce-swip.h
@@ -0,0 +1,39 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Copyright (c) 2020-2026 System on Chip engineering, S.L.
+ * Copyright (c) 2026 Linutronix GmbH
+ * Author: Vasilij Strassheim <v.strassheim@linutronix.de>
+ */
+
+#ifndef SOCE_SWIP_H
+#define SOCE_SWIP_H
+
+#include <linux/mutex.h>
+#include <linux/types.h>
+
+#include <net/dsa.h>
+
+#define SWIP_MAX_NUM_PORTS 31
+
+struct swip_features {
+ u32 num_ports;
+ bool port_vlan;
+ bool stp;
+};
+
+struct swip_dsa_local {
+ void __iomem *dsa;
+ void __iomem *ports;
+ void __iomem *vlan;
+ void __iomem *stp;
+};
+
+struct swip_priv {
+ struct swip_dsa_local local;
+ struct swip_features features;
+ struct mutex feature_lock; /* Serializes multi-register feature updates */
+ u32 *vlan_members;
+ struct dsa_switch ds;
+};
+
+#endif /* SOCE_SWIP_H */
diff --git a/drivers/net/mdio/Kconfig b/drivers/net/mdio/Kconfig
index 6f272fae4bb55b..b1ffeb439c3682 100644
--- a/drivers/net/mdio/Kconfig
+++ b/drivers/net/mdio/Kconfig
@@ -182,6 +182,16 @@ config MDIO_REGMAP
regmap. Users willing to use this driver must explicitly select
REGMAP.
+config MDIO_SOCE_SWIP
+ tristate
+ depends on OF_MDIO && HAS_IOMEM
+ depends on MFD_SOCE_SWIP
+ help
+ This driver provides support for the MDIO controller
+ integrated into SoC-e SWIP Ethernet switch IP cores. This option
+ will be selected if the configuration for the main switch
+ functionality of the FPGA IP core is selected.
+
config MDIO_THUNDER
tristate "ThunderX SOCs MDIO buses"
depends on 64BIT
diff --git a/drivers/net/mdio/Makefile b/drivers/net/mdio/Makefile
index e02c66a025456c..cb0a268cee596a 100644
--- a/drivers/net/mdio/Makefile
+++ b/drivers/net/mdio/Makefile
@@ -22,6 +22,7 @@ obj-$(CONFIG_MDIO_OCTEON) += mdio-octeon.o
obj-$(CONFIG_MDIO_PIC64HPSC) += mdio-pic64hpsc.o
obj-$(CONFIG_MDIO_REALTEK_RTL9300) += mdio-realtek-rtl9300.o
obj-$(CONFIG_MDIO_REGMAP) += mdio-regmap.o
+obj-$(CONFIG_MDIO_SOCE_SWIP) += mdio-soce.o
obj-$(CONFIG_MDIO_SUN4I) += mdio-sun4i.o
obj-$(CONFIG_MDIO_THUNDER) += mdio-thunder.o
obj-$(CONFIG_MDIO_XGENE) += mdio-xgene.o
diff --git a/drivers/net/mdio/mdio-soce.c b/drivers/net/mdio/mdio-soce.c
new file mode 100644
index 00000000000000..5350feb92d5554
--- /dev/null
+++ b/drivers/net/mdio/mdio-soce.c
@@ -0,0 +1,213 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (c) 2020-2026 System on Chip engineering, S.L.
+ * Copyright (c) 2026 Linutronix GmbH
+ * Author: Vasilij Strassheim <v.strassheim@linutronix.de>
+ */
+
+#include <linux/bitfield.h>
+#include <linux/io.h>
+#include <linux/iopoll.h>
+#include <linux/module.h>
+#include <linux/of_mdio.h>
+#include <linux/platform_device.h>
+
+#define SWIP_MDIO_TIMEOUT_US 1000
+
+#define SWIP_MDIO_PARAMS_OFFSET 0x0000
+#define SWIP_MDIO_WRITE_OFFSET 0x0004
+#define SWIP_MDIO_READ_OFFSET 0x0008
+
+#define SWIP_MDIO_CTRL_TRANSTYPE_MASK GENMASK(4, 3)
+#define SWIP_MDIO_CTRL_TRANSTYPE_WRITE 0x1
+#define SWIP_MDIO_CTRL_TRANSTYPE_READ 0x3
+#define SWIP_MDIO_CTRL_CLAUSE BIT(1)
+#define SWIP_MDIO_CTRL_OPSTATUS BIT(0)
+#define SWIP_MDIO_PARAMS_REGDEV_MASK GENMASK(12, 8)
+#define SWIP_MDIO_PARAMS_PHYADDR_MASK GENMASK(4, 0)
+#define SWIP_MDIO_READ_DATA_MASK GENMASK(15, 0)
+
+struct swip_mdio {
+ void __iomem *ctrl;
+ void __iomem *data;
+};
+
+static int swip_mdio_wait_for_idle(struct swip_mdio *priv)
+{
+ void __iomem *ctrl = priv->ctrl;
+ u16 val;
+
+ return readw_poll_timeout(ctrl, val, !(val & SWIP_MDIO_CTRL_OPSTATUS),
+ 10, SWIP_MDIO_TIMEOUT_US);
+}
+
+static int swip_mdio_read(struct mii_bus *bus, int phy_addr, int regnum)
+{
+ struct swip_mdio *priv = bus->priv;
+ void __iomem *data = priv->data;
+ u32 command;
+ int ret;
+
+ ret = swip_mdio_wait_for_idle(priv);
+ if (ret)
+ return ret;
+
+ writel(FIELD_PREP(SWIP_MDIO_PARAMS_REGDEV_MASK, regnum) |
+ FIELD_PREP(SWIP_MDIO_PARAMS_PHYADDR_MASK, phy_addr),
+ data + SWIP_MDIO_PARAMS_OFFSET);
+
+ command = FIELD_PREP(SWIP_MDIO_CTRL_TRANSTYPE_MASK,
+ SWIP_MDIO_CTRL_TRANSTYPE_READ) |
+ SWIP_MDIO_CTRL_OPSTATUS;
+ writew(command, priv->ctrl);
+
+ ret = swip_mdio_wait_for_idle(priv);
+ if (ret)
+ return ret;
+
+ return readl(data + SWIP_MDIO_READ_OFFSET) & SWIP_MDIO_READ_DATA_MASK;
+}
+
+static int swip_mdio_read_c45(struct mii_bus *bus, int phy_addr, int devad,
+ int regnum)
+{
+ struct swip_mdio *priv = bus->priv;
+ void __iomem *data = priv->data;
+ u32 command;
+ int ret;
+
+ ret = swip_mdio_wait_for_idle(priv);
+ if (ret)
+ return ret;
+
+ writel(FIELD_PREP(SWIP_MDIO_PARAMS_REGDEV_MASK, devad) |
+ FIELD_PREP(SWIP_MDIO_PARAMS_PHYADDR_MASK, phy_addr),
+ data + SWIP_MDIO_PARAMS_OFFSET);
+ writel(regnum, data + SWIP_MDIO_WRITE_OFFSET);
+
+ command = SWIP_MDIO_CTRL_CLAUSE | SWIP_MDIO_CTRL_OPSTATUS;
+ writew(command, priv->ctrl);
+
+ ret = swip_mdio_wait_for_idle(priv);
+ if (ret)
+ return ret;
+
+ command = FIELD_PREP(SWIP_MDIO_CTRL_TRANSTYPE_MASK,
+ SWIP_MDIO_CTRL_TRANSTYPE_READ) |
+ SWIP_MDIO_CTRL_CLAUSE | SWIP_MDIO_CTRL_OPSTATUS;
+ writew(command, priv->ctrl);
+
+ ret = swip_mdio_wait_for_idle(priv);
+ if (ret)
+ return ret;
+
+ return readl(data + SWIP_MDIO_READ_OFFSET) & SWIP_MDIO_READ_DATA_MASK;
+}
+
+static int swip_mdio_write(struct mii_bus *bus, int phy_addr, int regnum,
+ u16 val)
+{
+ struct swip_mdio *priv = bus->priv;
+ void __iomem *data = priv->data;
+ u32 command;
+ int ret;
+
+ ret = swip_mdio_wait_for_idle(priv);
+ if (ret)
+ return ret;
+
+ writel(FIELD_PREP(SWIP_MDIO_PARAMS_REGDEV_MASK, regnum) |
+ FIELD_PREP(SWIP_MDIO_PARAMS_PHYADDR_MASK, phy_addr),
+ data + SWIP_MDIO_PARAMS_OFFSET);
+ writel(val, data + SWIP_MDIO_WRITE_OFFSET);
+
+ command = FIELD_PREP(SWIP_MDIO_CTRL_TRANSTYPE_MASK,
+ SWIP_MDIO_CTRL_TRANSTYPE_WRITE) |
+ SWIP_MDIO_CTRL_OPSTATUS;
+ writew(command, priv->ctrl);
+
+ return swip_mdio_wait_for_idle(priv);
+}
+
+static int swip_mdio_write_c45(struct mii_bus *bus, int phy_addr, int devad,
+ int regnum, u16 val)
+{
+ struct swip_mdio *priv = bus->priv;
+ void __iomem *data = priv->data;
+ u32 command;
+ int ret;
+
+ ret = swip_mdio_wait_for_idle(priv);
+ if (ret)
+ return ret;
+
+ writel(FIELD_PREP(SWIP_MDIO_PARAMS_REGDEV_MASK, devad) |
+ FIELD_PREP(SWIP_MDIO_PARAMS_PHYADDR_MASK, phy_addr),
+ data + SWIP_MDIO_PARAMS_OFFSET);
+ writel(regnum, data + SWIP_MDIO_WRITE_OFFSET);
+
+ command = SWIP_MDIO_CTRL_CLAUSE | SWIP_MDIO_CTRL_OPSTATUS;
+ writew(command, priv->ctrl);
+
+ ret = swip_mdio_wait_for_idle(priv);
+ if (ret)
+ return ret;
+
+ writel(val, data + SWIP_MDIO_WRITE_OFFSET);
+
+ command = FIELD_PREP(SWIP_MDIO_CTRL_TRANSTYPE_MASK,
+ SWIP_MDIO_CTRL_TRANSTYPE_WRITE) |
+ SWIP_MDIO_CTRL_CLAUSE | SWIP_MDIO_CTRL_OPSTATUS;
+ writew(command, priv->ctrl);
+
+ return swip_mdio_wait_for_idle(priv);
+}
+
+static int swip_mdio_probe(struct platform_device *pdev)
+{
+ struct device *dev = &pdev->dev;
+ struct swip_mdio *priv;
+ struct mii_bus *bus;
+
+ bus = devm_mdiobus_alloc_size(dev, sizeof(*priv));
+ if (!bus)
+ return -ENOMEM;
+
+ priv = bus->priv;
+ priv->data = devm_platform_ioremap_resource_byname(pdev, "data");
+ if (IS_ERR(priv->data))
+ return PTR_ERR(priv->data);
+
+ priv->ctrl = devm_platform_ioremap_resource_byname(pdev, "control");
+ if (IS_ERR(priv->ctrl))
+ return PTR_ERR(priv->ctrl);
+
+ bus->name = "soce mdio";
+ snprintf(bus->id, MII_BUS_ID_SIZE, "%s", dev_name(dev));
+ bus->parent = dev;
+ bus->read = swip_mdio_read;
+ bus->write = swip_mdio_write;
+ bus->read_c45 = swip_mdio_read_c45;
+ bus->write_c45 = swip_mdio_write_c45;
+
+ return devm_of_mdiobus_register(dev, bus, dev->of_node);
+}
+
+static const struct of_device_id swip_mdio_of_match[] = {
+ { .compatible = "soce,swip-mdio" },
+ { /* sentinel */ }
+};
+MODULE_DEVICE_TABLE(of, swip_mdio_of_match);
+
+static struct platform_driver swip_mdio_driver = {
+ .probe = swip_mdio_probe,
+ .driver = {
+ .name = "soce-mdio",
+ .of_match_table = swip_mdio_of_match,
+ },
+};
+module_platform_driver(swip_mdio_driver);
+
+MODULE_AUTHOR("Vasilij Strassheim <v.strassheim@linutronix.de>");
+MODULE_DESCRIPTION("SoC-e MDIO controller driver");
+MODULE_LICENSE("GPL");
diff --git a/include/net/dsa.h b/include/net/dsa.h
index 09f3043d57f066..799d43b3c77ff6 100644
--- a/include/net/dsa.h
+++ b/include/net/dsa.h
@@ -63,6 +63,7 @@ struct tc_action;
#define DSA_TAG_PROTO_MT7628_VALUE 35
#define DSA_TAG_PROTO_KS8995_VALUE 36
#define DSA_TAG_PROTO_LAN9645X_VALUE 37
+#define DSA_TAG_PROTO_SDSA_VALUE 38
enum dsa_tag_protocol {
DSA_TAG_PROTO_NONE = DSA_TAG_PROTO_NONE_VALUE,
@@ -103,6 +104,7 @@ enum dsa_tag_protocol {
DSA_TAG_PROTO_MT7628 = DSA_TAG_PROTO_MT7628_VALUE,
DSA_TAG_PROTO_KS8995 = DSA_TAG_PROTO_KS8995_VALUE,
DSA_TAG_PROTO_LAN9645X = DSA_TAG_PROTO_LAN9645X_VALUE,
+ DSA_TAG_PROTO_SDSA = DSA_TAG_PROTO_SDSA_VALUE,
};
struct dsa_switch;
diff --git a/net/dsa/Kconfig b/net/dsa/Kconfig
index bdeb60af764b22..caf85e107fcfd5 100644
--- a/net/dsa/Kconfig
+++ b/net/dsa/Kconfig
@@ -205,6 +205,12 @@ config NET_DSA_TAG_RZN1_A5PSW
Renesas RZ/N1 embedded switch that uses an 8 byte tag located after
destination MAC address.
+config NET_DSA_TAG_SDSA
+ tristate "Tag driver for SoC-e switches using EtherType SDSA headers"
+ help
+ Say Y or M if you want to enable support for tagging frames for the
+ SoC-e switches.
+
config NET_DSA_TAG_LAN9303
tristate "Tag driver for SMSC/Microchip LAN9303 family of switches"
help
diff --git a/net/dsa/Makefile b/net/dsa/Makefile
index 3cd53124448d81..b3e9cd7810927e 100644
--- a/net/dsa/Makefile
+++ b/net/dsa/Makefile
@@ -41,6 +41,7 @@ obj-$(CONFIG_NET_DSA_TAG_QCA) += tag_qca.o
obj-$(CONFIG_NET_DSA_TAG_RTL4_A) += tag_rtl4_a.o
obj-$(CONFIG_NET_DSA_TAG_RTL8_4) += tag_rtl8_4.o
obj-$(CONFIG_NET_DSA_TAG_RZN1_A5PSW) += tag_rzn1_a5psw.o
+obj-$(CONFIG_NET_DSA_TAG_SDSA) += tag_sdsa.o
obj-$(CONFIG_NET_DSA_TAG_SJA1105) += tag_sja1105.o
obj-$(CONFIG_NET_DSA_TAG_TRAILER) += tag_trailer.o
obj-$(CONFIG_NET_DSA_TAG_VSC73XX_8021Q) += tag_vsc73xx_8021q.o
diff --git a/net/dsa/tag_sdsa.c b/net/dsa/tag_sdsa.c
new file mode 100644
index 00000000000000..c5a9f61edf4056
--- /dev/null
+++ b/net/dsa/tag_sdsa.c
@@ -0,0 +1,170 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (c) 2020-2026 System on Chip engineering, S.L.
+ * Copyright (c) 2026 Linutronix GmbH
+ * Author: Vasilij Strassheim <v.strassheim@linutronix.de>
+ */
+
+#include <linux/bitfield.h>
+#include <linux/byteorder/generic.h>
+#include <linux/etherdevice.h>
+#include <linux/if_vlan.h>
+#include <linux/unaligned.h>
+
+#include "tag.h"
+
+#define SDSA_HLEN 8
+
+#define SDSA_NAME "sdsa"
+#define ETH_P_SDSA 0xDCDC
+
+/* SDSA tag byte layout (after the 12-byte MAC header):
+ * Bytes 0-1: SDSA EtherType (0xDCDC)
+ * Bytes 2-3: Reserved
+ * Byte 4: Frame type (bits 7-6), VLAN-info bit (bit 5), port[9:5] (bits 4-0)
+ * Byte 5: Port[4:0] (bits 7-3)
+ * Bytes 6-7: PCP (bits 7-5) / CFI (bit 4) / VID (bits 3-0 + byte 7), only
+ * meaningful when the VLAN-info bit is set.
+ */
+#define SDSA_TAG_FRAME_TYPE_MASK GENMASK(7, 6)
+#define SDSA_TAG_VLAN_BIT BIT(5)
+#define SDSA_TAG_PORT_HI_MASK GENMASK(4, 0)
+#define SDSA_TAG_PORT_LO_MASK GENMASK(7, 3)
+#define SDSA_TAG_PORT_HI_SHIFT 5
+#define SDSA_FRAME_TYPE_TO_CPU 0
+#define SDSA_FRAME_TYPE_FROM_CPU 1
+
+struct sdsa_tag {
+ __be16 ethertype;
+ __be16 reserved;
+ u8 frame_type_port_hi;
+ u8 port_lo;
+ __be16 vlan;
+};
+
+static struct sk_buff *sdsa_xmit(struct sk_buff *skb, struct net_device *dev)
+{
+ struct dsa_port *dp = dsa_user_to_port(dev);
+ struct sdsa_tag *tag;
+ bool encode_vlan;
+ bool tag_present;
+ u16 vlan_tci;
+
+ BUILD_BUG_ON(sizeof(*tag) != SDSA_HLEN);
+
+ /* SDSA carries no TPID, so only encode 802.1Q C-tags. */
+ tag_present = skb_vlan_tag_present(skb);
+ encode_vlan = tag_present && skb->vlan_proto == htons(ETH_P_8021Q);
+ /* Prevent the conduit from inserting a VLAN header ahead of SDSA. */
+ if (tag_present && !encode_vlan) {
+ skb = __vlan_hwaccel_push_inside(skb);
+ if (!skb)
+ return NULL;
+ }
+
+ skb_push(skb, SDSA_HLEN);
+ dsa_alloc_etype_header(skb, SDSA_HLEN);
+
+ tag = dsa_etype_header_pos_tx(skb);
+ tag->ethertype = cpu_to_be16(ETH_P_SDSA);
+ tag->reserved = 0;
+ tag->frame_type_port_hi =
+ FIELD_PREP(SDSA_TAG_FRAME_TYPE_MASK, SDSA_FRAME_TYPE_FROM_CPU) |
+ FIELD_PREP(SDSA_TAG_PORT_HI_MASK,
+ dp->index >> SDSA_TAG_PORT_HI_SHIFT);
+ tag->port_lo = FIELD_PREP(SDSA_TAG_PORT_LO_MASK, dp->index);
+ if (encode_vlan) {
+ vlan_tci = skb_vlan_tag_get(skb);
+ __vlan_hwaccel_clear_tag(skb);
+ tag->frame_type_port_hi |= SDSA_TAG_VLAN_BIT;
+ tag->vlan = cpu_to_be16(vlan_tci);
+ } else {
+ tag->vlan = 0;
+ }
+
+ return skb;
+}
+
+static struct sk_buff *sdsa_rcv(struct sk_buff *skb, struct net_device *dev)
+{
+ enum skb_drop_reason reason;
+ struct sdsa_tag *tag;
+ u16 dummy_vlan_tci;
+ bool vlan_present;
+ int source_port;
+ u16 encap_proto;
+ u8 frame_type;
+ u16 vlan_tci;
+
+ reason = pskb_may_pull_reason(skb, SDSA_HLEN);
+ if (unlikely(reason != SKB_NOT_DROPPED_YET))
+ goto out_drop;
+
+ tag = dsa_etype_header_pos_rx(skb);
+ if (unlikely(be16_to_cpu(tag->ethertype) != ETH_P_SDSA)) {
+ reason = SKB_DROP_REASON_DEV_HDR;
+ goto out_drop;
+ }
+
+ frame_type = FIELD_GET(SDSA_TAG_FRAME_TYPE_MASK,
+ tag->frame_type_port_hi);
+ if (frame_type != SDSA_FRAME_TYPE_TO_CPU) {
+ reason = SKB_DROP_REASON_DEV_HDR;
+ goto out_drop;
+ }
+
+ vlan_present = tag->frame_type_port_hi & SDSA_TAG_VLAN_BIT;
+ vlan_tci = be16_to_cpu(tag->vlan);
+ encap_proto = get_unaligned_be16((u8 *)tag + SDSA_HLEN);
+
+ source_port = FIELD_GET(SDSA_TAG_PORT_HI_MASK,
+ tag->frame_type_port_hi) <<
+ SDSA_TAG_PORT_HI_SHIFT;
+ source_port |= FIELD_GET(SDSA_TAG_PORT_LO_MASK, tag->port_lo);
+
+ skb->dev = dsa_conduit_find_user(dev, 0, source_port);
+ if (!skb->dev) {
+ reason = SKB_DROP_REASON_DEV_HDR;
+ goto out_drop;
+ }
+
+ skb_pull_rcsum(skb, SDSA_HLEN);
+ dsa_strip_etype_header(skb, SDSA_HLEN);
+ if (vlan_present) {
+ /* The in-band tag duplicates the TCI carried in SDSA. */
+ if (encap_proto == ETH_P_8021Q) {
+ /* __skb_vlan_pop() expects skb->data at the Ethernet header. */
+ skb_push_rcsum(skb, ETH_HLEN);
+ skb_reset_mac_header(skb);
+ if (__skb_vlan_pop(skb, &dummy_vlan_tci)) {
+ reason = SKB_DROP_REASON_NOMEM;
+ goto out_drop;
+ }
+ skb_pull_rcsum(skb, ETH_HLEN);
+ }
+
+ __vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q), vlan_tci);
+ }
+
+ dsa_default_offload_fwd_mark(skb);
+ return skb;
+
+out_drop:
+ kfree_skb_reason(skb, reason);
+ return NULL;
+}
+
+static const struct dsa_device_ops sdsa_netdev_ops = {
+ .name = SDSA_NAME,
+ .proto = DSA_TAG_PROTO_SDSA,
+ .xmit = sdsa_xmit,
+ .rcv = sdsa_rcv,
+ /* Include room for an accelerated non-802.1Q tag pushed in-band. */
+ .needed_headroom = SDSA_HLEN + VLAN_HLEN,
+};
+
+MODULE_LICENSE("GPL");
+MODULE_DESCRIPTION("DSA tag driver for SoC-e SDSA protocol");
+MODULE_ALIAS_DSA_TAG_DRIVER(DSA_TAG_PROTO_SDSA, SDSA_NAME);
+
+module_dsa_tag_driver(sdsa_netdev_ops);
|
| 3/2 | 2026/11/25 15:22 | llm | patch-evaluator |
1mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 23721 output: 22 thoughts: 383 Thoughts: **Analyzing the Patch for Reachability and Fuzzing Potential** Okay, let's break this down. My initial instinct is to methodically analyze this patch and its implications. First, a quick overview: we have additions related to the SoC-e SWIP: device tree docs, an MFD driver, a DSA driver, an MDIO driver, and a DSA tag protocol driver. My priority is reachability in a standard QEMU or GCE amd64 environment – can we get to this code without specific hardware? The DSA tag drivers are immediately raising questions. Is it possible to reach the DSA tag driver without the actual hardware? The specific driver, `net/dsa/tag_sdsa.c`, is the one to focus on. My thinking is, how can these DSA tagging protocols be fuzzed or even simply reached in a virtual environment? I'm wondering if there are any mock or virtual DSA devices, or some user-space control mechanisms over the DSA tagging protocol, or if netlink DSA conduits can be used. I need to refresh my understanding of how DSA works within the Linux kernel. I'll search to understand how DSA tag protocols are loaded and used. My immediate thought is can a user configure a DSA tagging protocol on DSA conduits or mock devices? Or, can DSA switches even be created without the physical hardware? The critical question now: can these DSA tag drivers be invoked and thus fuzzed with network packets? Time to grep the kernel sources for things like `dsa_device_ops`, `tag_sdsa`, or anything related to DSA tag protocol switching. This will give me a better handle on how we might be able to exploit these code paths. |
| 4/2 | 2026/11/25 15:23 | tool | grepper |
0mArgs:{
"Expression": "DSA_TAG_PROTO_SDSA"
}Results: {
"Output": "drivers/net/dsa/soce-swip.c=452=static enum dsa_tag_protocol swip_get_tag_protocol(struct dsa_switch *ds,\n--\ndrivers/net/dsa/soce-swip.c-455-{\ndrivers/net/dsa/soce-swip.c:456:\treturn DSA_TAG_PROTO_SDSA;\ndrivers/net/dsa/soce-swip.c-457-}\n--\ninclude/net/dsa.h=26=struct tc_action;\n--\ninclude/net/dsa.h-65-#define DSA_TAG_PROTO_LAN9645X_VALUE\t\t37\ninclude/net/dsa.h:66:#define DSA_TAG_PROTO_SDSA_VALUE\t\t38\ninclude/net/dsa.h-67-\ninclude/net/dsa.h=68=enum dsa_tag_protocol {\n--\ninclude/net/dsa.h-106-\tDSA_TAG_PROTO_LAN9645X\t\t= DSA_TAG_PROTO_LAN9645X_VALUE,\ninclude/net/dsa.h:107:\tDSA_TAG_PROTO_SDSA\t\t= DSA_TAG_PROTO_SDSA_VALUE,\ninclude/net/dsa.h-108-};\n--\nnet/dsa/tag_sdsa.c=157=static const struct dsa_device_ops sdsa_netdev_ops = {\nnet/dsa/tag_sdsa.c-158-\t.name = SDSA_NAME,\nnet/dsa/tag_sdsa.c:159:\t.proto = DSA_TAG_PROTO_SDSA,\nnet/dsa/tag_sdsa.c-160-\t.xmit = sdsa_xmit,\n--\nnet/dsa/tag_sdsa.c=167=MODULE_DESCRIPTION(\"DSA tag driver for SoC-e SDSA protocol\");\nnet/dsa/tag_sdsa.c:168:MODULE_ALIAS_DSA_TAG_DRIVER(DSA_TAG_PROTO_SDSA, SDSA_NAME);\nnet/dsa/tag_sdsa.c-169-\n"
} |
| 5/2 | 2026/11/25 15:23 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 25034 output: 18 thoughts: 89 Thoughts: Okay, here's my thought process on this, distilled into a first-person expert summary: **Investigating DSA Driver Reachability in This Setup** Alright, I need to understand how DSA tagging drivers are actually accessed in this context. My initial instinct is to see how the code paths are traversed to them. Specifically, I'm trying to figure out if we can even successfully instantiate a DSA switch here – and if not, why not. Are the `sdsa_xmit` and `sdsa_rcv` functions being reached as expected? That's the core question. Wait a second, a more fundamental question popped up: Can we even *get* a DSA switch instantiated within the test environment, be it syzkaller or QEMU? That's a huge pre-requisite. If we can't, then digging into specific function calls is somewhat moot. Hold on, I seem to remember something... `dsa_loop`... Is there even a `dsa_loop` driver available? That could be a valuable piece of the puzzle. It might act as a simple "dummy" DSA driver for testing. I'm going to quickly grep through the code to see if the string 'dsa_loop' is defined anywhere. That should give me a quick indication of its presence or absence, and whether it's worth pursuing this line of inquiry. |
| 6/2 | 2026/11/25 15:23 | tool | grepper |
0mArgs:{
"Expression": "dsa_loop"
}Results: {
"Output": "\nFull output is too long, showing 200 out of 270 lines.\nUse more precise expression or PathPrefixes if possible.\n\nNumber of matching lines per file (3 files in total):\nDocumentation/networking/dsa/dsa.rst:1\ndrivers/net/dsa/Makefile:1\ndrivers/net/dsa/dsa_loop.c:93\n\nDocumentation/networking/dsa/dsa.rst=159=all attached switch ports must be down while doing this).\nDocumentation/networking/dsa/dsa.rst-160-\nDocumentation/networking/dsa/dsa.rst:161:It is desirable that all tagging protocols are testable with the ``dsa_loop``\nDocumentation/networking/dsa/dsa.rst-162-mockup driver, which can be attached to any network interface. The goal is that\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;\n\n"
} |
| 7/2 | 2026/11/25 15:23 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 30566 output: 41 thoughts: 43 Thoughts: Okay, let's dive into this. I need to understand what `dsa_loop_get_protocol` actually *does*. I'll go straight to the source – no need for any theoretical hand-wringing here. I'm opening up `drivers/net/dsa/dsa_loop.c` and zeroing in on the vicinity of line 125. That's usually where functions like that are defined, or at least have their core implementation. Let's see what the code around that line reveals. Time to put on the detective hat and look for the clues. |
| 8/2 | 2026/11/25 15:23 | tool | read-file |
0mArgs:{
"File": "drivers/net/dsa/dsa_loop.c",
"FirstLine": 120,
"LineCount": 20
}Results: {
"Contents": " 120:\tout:\n 121:\t\tdsa_devlink_resources_unregister(ds);\n 122:\t\treturn err;\n 123:\t}\n 124:\t\n 125:\tstatic enum dsa_tag_protocol dsa_loop_get_protocol(struct dsa_switch *ds,\n 126:\t\t\t\t\t\t\t int port,\n 127:\t\t\t\t\t\t\t enum dsa_tag_protocol mp)\n 128:\t{\n 129:\t\tdev_dbg(ds-\u003edev, \"%s: port: %d\\n\", __func__, port);\n 130:\t\n 131:\t\treturn DSA_TAG_PROTO_NONE;\n 132:\t}\n 133:\t\n 134:\tstatic int dsa_loop_setup(struct dsa_switch *ds)\n 135:\t{\n 136:\t\tstruct dsa_loop_priv *ps = ds-\u003epriv;\n 137:\t\tunsigned int i;\n 138:\t\n 139:\t\tfor (i = 0; i \u003c ds-\u003enum_ports; i++)\n"
} |
| 9/2 | 2026/11/25 15:23 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 31074 output: 39 thoughts: 67 Thoughts: Here's my summary, as the expert: **Investigating a `DSA_TAG_PROTO_NONE` Return** Okay, so `dsa_loop_get_protocol` is returning `DSA_TAG_PROTO_NONE`. That's not ideal; it means we aren't detecting a valid protocol for the DSA interface, which I know indicates a problem. My initial thought is to check my understanding of the protocol negotiation process. I need to refresh my memory on what `DSA_TAG_PROTO_NONE` actually signifies in the context of the DSA framework. Where is that documented, again? Right, `Documentation/networking/dsa/dsa.rst`. I'll jump straight to lines 160-180 of that file, that section almost certainly covers the protocol enumeration and what constitutes a "none" return. Hopefully, that section will clarify whether this is a common occurrence, or if this indicates a deeper issue I need to address, such as an incorrect driver implementation or an unexpected hardware configuration. Time to investigate! |
| 10/2 | 2026/11/25 15:23 | tool | read-file |
0mArgs:{
"File": "Documentation/networking/dsa/dsa.rst",
"FirstLine": 155,
"LineCount": 35
}Results: {
"Contents": " 155:\t\n 156:\tIf the hardware and driver are capable, the tagging protocol of the DSA switch\n 157:\ttree can be changed at runtime. This is done by writing the new tagging\n 158:\tprotocol name to the same sysfs device attribute as above (the DSA conduit and\n 159:\tall attached switch ports must be down while doing this).\n 160:\t\n 161:\tIt is desirable that all tagging protocols are testable with the ``dsa_loop``\n 162:\tmockup driver, which can be attached to any network interface. The goal is that\n 163:\tany network interface should be capable of transmitting the same packet in the\n 164:\tsame way, and the tagger should decode the same received packet in the same way\n 165:\tregardless of the driver used for the switch control path, and the driver used\n 166:\tfor the DSA conduit.\n 167:\t\n 168:\tThe transmission of a packet goes through the tagger's ``xmit`` function.\n 169:\tThe passed ``struct sk_buff *skb`` has ``skb-\u003edata`` pointing at\n 170:\t``skb_mac_header(skb)``, i.e. at the destination MAC address, and the passed\n 171:\t``struct net_device *dev`` represents the virtual DSA user network interface\n 172:\twhose hardware counterpart the packet must be steered to (i.e. ``swp0``).\n 173:\tThe job of this method is to prepare the skb in a way that the switch will\n 174:\tunderstand what egress port the packet is for (and not deliver it towards other\n 175:\tports). Typically this is fulfilled by pushing a frame header. Checking for\n 176:\tinsufficient size in the skb headroom or tailroom is unnecessary provided that\n 177:\tthe ``needed_headroom`` and ``needed_tailroom`` properties were filled out\n 178:\tproperly, because DSA ensures there is enough space before calling this method.\n 179:\t\n 180:\tThe reception of a packet goes through the tagger's ``rcv`` function. The\n 181:\tpassed ``struct sk_buff *skb`` has ``skb-\u003edata`` pointing at\n 182:\t``skb_mac_header(skb) + ETH_ALEN`` octets, i.e. to where the first octet after\n 183:\tthe EtherType would have been, were this frame not tagged. The role of this\n 184:\tmethod is to consume the frame header, adjust ``skb-\u003edata`` to really point at\n 185:\tthe first octet after the EtherType, and to change ``skb-\u003edev`` to point to the\n 186:\tvirtual DSA user network interface corresponding to the physical front-facing\n 187:\tswitch port that the packet was received on.\n 188:\t\n 189:\tSince tagging protocols in category 1 and 2 break software (and most often also\n"
} |
| 11/2 | 2026/11/25 15:23 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 32160 output: 28 thoughts: 100 Thoughts: **Investigating DSA Tagging Protocol Runtime Changes** Okay, so I see something interesting here: the text mentions dynamic modification of the DSA switch tree's tagging protocol, provided the hardware and driver are capable. Interesting! Specifically, it claims this is achieved by writing a new protocol name to a specific sysfs device attribute. The key caveat, of course, is that the DSA conduit and all attached switch ports have to be down during this operation. Let's delve into this. My immediate question is, where exactly is this sysfs attribute located? I need to get my hands dirty. My instinct says to start looking in the `net/dsa/` directory in the kernel source. A quick `grep` for "tagging" should do the trick. That should help me pinpoint where this configuration actually happens and figure out the implementation details. Time to get coding! |
| 12/2 | 2026/11/25 15:23 | tool | grepper |
0mArgs:{
"Expression": "tagging",
"PathPrefixes": [
"net/dsa/"
]
}Results: {
"Output": "\nFull output is too long, showing 200 out of 330 lines.\nUse more precise expression or PathPrefixes if possible.\n\nNumber of matching lines per file (11 files in total):\nnet/dsa/Kconfig:33\nnet/dsa/Makefile:1\nnet/dsa/conduit.c:8\nnet/dsa/dsa.c:7\nnet/dsa/tag.c:2\nnet/dsa/tag.h:6\nnet/dsa/tag_8021q.c:1\nnet/dsa/tag_dsa.c:1\nnet/dsa/tag_none.c:1\nnet/dsa/tag_rzn1_a5psw.c:1\nnet/dsa/tag_sja1105.c:1\n\nnet/dsa/Kconfig=17=if NET_DSA\nnet/dsa/Kconfig-18-\nnet/dsa/Kconfig:19:# Drivers must select the appropriate tagging format(s)\nnet/dsa/Kconfig-20-\n--\nnet/dsa/Kconfig=27=config NET_DSA_TAG_AR9331\n--\nnet/dsa/Kconfig-29-\thelp\nnet/dsa/Kconfig:30:\t Say Y or M if you want to enable support for tagging frames for\nnet/dsa/Kconfig-31-\t the Atheros AR9331 SoC with built-in switch.\n--\nnet/dsa/Kconfig=37=config NET_DSA_TAG_BRCM\n--\nnet/dsa/Kconfig-40-\thelp\nnet/dsa/Kconfig:41:\t Say Y if you want to enable support for tagging frames for the\nnet/dsa/Kconfig-42-\t Broadcom switches which place the tag after the MAC source address.\n--\nnet/dsa/Kconfig=44=config NET_DSA_TAG_BRCM_LEGACY\n--\nnet/dsa/Kconfig-47-\thelp\nnet/dsa/Kconfig:48:\t Say Y if you want to enable support for tagging frames for the\nnet/dsa/Kconfig-49-\t BCM63xx legacy switches which place the tag after the MAC source\n--\nnet/dsa/Kconfig=54=config NET_DSA_TAG_BRCM_LEGACY_FCS\n--\nnet/dsa/Kconfig-57-\thelp\nnet/dsa/Kconfig:58:\t Say Y if you want to enable support for tagging frames for the\nnet/dsa/Kconfig-59-\t BCM53xx legacy switches which place the tag after the MAC source\n--\nnet/dsa/Kconfig=64=config NET_DSA_TAG_BRCM_PREPEND\n--\nnet/dsa/Kconfig-67-\thelp\nnet/dsa/Kconfig:68:\t Say Y if you want to enable support for tagging frames for the\nnet/dsa/Kconfig-69-\t Broadcom switches which places the tag before the Ethernet header\n--\nnet/dsa/Kconfig=72=config NET_DSA_TAG_HELLCREEK\n--\nnet/dsa/Kconfig-74-\thelp\nnet/dsa/Kconfig:75:\t Say Y or M if you want to enable support for tagging frames\nnet/dsa/Kconfig-76-\t for the Hirschmann Hellcreek TSN switches.\n--\nnet/dsa/Kconfig=78=config NET_DSA_TAG_GSWIP\n--\nnet/dsa/Kconfig-80-\thelp\nnet/dsa/Kconfig:81:\t Say Y or M if you want to enable support for tagging frames for the\nnet/dsa/Kconfig-82-\t Lantiq / Intel GSWIP switches.\n--\nnet/dsa/Kconfig=87=config NET_DSA_TAG_DSA\n--\nnet/dsa/Kconfig-90-\thelp\nnet/dsa/Kconfig:91:\t Say Y or M if you want to enable support for tagging frames for the\nnet/dsa/Kconfig-92-\t Marvell switches which use DSA headers.\n--\nnet/dsa/Kconfig=94=config NET_DSA_TAG_EDSA\n--\nnet/dsa/Kconfig-97-\thelp\nnet/dsa/Kconfig:98:\t Say Y or M if you want to enable support for tagging frames for the\nnet/dsa/Kconfig-99-\t Marvell switches which use EtherType DSA headers.\n--\nnet/dsa/Kconfig=101=config NET_DSA_TAG_MT7628\n--\nnet/dsa/Kconfig-103-\thelp\nnet/dsa/Kconfig:104:\t Say Y or M if you want to enable support for tagging frames for the\nnet/dsa/Kconfig-105-\t switch embedded in the MT7628 SoC.\n--\nnet/dsa/Kconfig=107=config NET_DSA_TAG_MTK\n--\nnet/dsa/Kconfig-109-\thelp\nnet/dsa/Kconfig:110:\t Say Y or M if you want to enable support for tagging frames for\nnet/dsa/Kconfig-111-\t Mediatek switches.\n--\nnet/dsa/Kconfig=113=config NET_DSA_TAG_MXL_862XX\n--\nnet/dsa/Kconfig-115-\thelp\nnet/dsa/Kconfig:116:\t Say Y or M if you want to enable support for tagging frames for the\nnet/dsa/Kconfig-117-\t MaxLinear MxL86252 and MxL86282 switches using their native 8-byte\nnet/dsa/Kconfig:118:\t tagging protocol.\nnet/dsa/Kconfig-119-\nnet/dsa/Kconfig=120=config NET_DSA_TAG_MXL_GSW1XX\n--\nnet/dsa/Kconfig-124-\t can be used on the CPU port of the switch.\nnet/dsa/Kconfig:125:\t Say Y or M if you want to enable support for tagging frames for\nnet/dsa/Kconfig-126-\t MaxLinear GSW1xx switches.\n--\nnet/dsa/Kconfig=128=config NET_DSA_TAG_KS8995\n--\nnet/dsa/Kconfig-130-\thelp\nnet/dsa/Kconfig:131:\t Say Y if you want to enable support for tagging frames for the\nnet/dsa/Kconfig-132-\t Micrel KS8995 switch.\n--\nnet/dsa/Kconfig=134=config NET_DSA_TAG_KSZ\n--\nnet/dsa/Kconfig-136-\thelp\nnet/dsa/Kconfig:137:\t Say Y if you want to enable support for tagging frames for the\nnet/dsa/Kconfig-138-\t Microchip 8795/937x/9477/9893 families of switches.\n--\nnet/dsa/Kconfig=140=config NET_DSA_TAG_LAN9645X\n--\nnet/dsa/Kconfig-142-\thelp\nnet/dsa/Kconfig:143:\t Say Y or M if you want to enable NPI tagging for the Microchip\nnet/dsa/Kconfig-144-\t LAN9645x switches. In this mode, the frames over the Ethernet CPU\n--\nnet/dsa/Kconfig=161=config NET_DSA_TAG_OCELOT\n--\nnet/dsa/Kconfig-164-\thelp\nnet/dsa/Kconfig:165:\t Say Y or M if you want to enable NPI tagging for the Ocelot switches\nnet/dsa/Kconfig-166-\t (VSC7511, VSC7512, VSC7513, VSC7514, VSC9953, VSC9959). In this mode,\n--\nnet/dsa/Kconfig=172=config NET_DSA_TAG_OCELOT_8021Q\n--\nnet/dsa/Kconfig-174-\thelp\nnet/dsa/Kconfig:175:\t Say Y or M if you want to enable support for tagging frames with a\nnet/dsa/Kconfig-176-\t custom VLAN-based header. Frames that require timestamping, such as\n--\nnet/dsa/Kconfig=182=config NET_DSA_TAG_QCA\n--\nnet/dsa/Kconfig-184-\thelp\nnet/dsa/Kconfig:185:\t Say Y or M if you want to enable support for tagging frames for\nnet/dsa/Kconfig-186-\t the Qualcomm Atheros QCA8K switches.\n--\nnet/dsa/Kconfig=188=config NET_DSA_TAG_RTL4_A\n--\nnet/dsa/Kconfig-190-\thelp\nnet/dsa/Kconfig:191:\t Say Y or M if you want to enable support for tagging frames for the\nnet/dsa/Kconfig-192-\t Realtek switches with 4 byte protocol A tags, such as found in\n--\nnet/dsa/Kconfig=195=config NET_DSA_TAG_RTL8_4\n--\nnet/dsa/Kconfig-197-\thelp\nnet/dsa/Kconfig:198:\t Say Y or M if you want to enable support for tagging frames for Realtek\nnet/dsa/Kconfig-199-\t switches with 8 byte protocol 4 tags, such as the Realtek RTL8365MB-VC.\n--\nnet/dsa/Kconfig=201=config NET_DSA_TAG_RZN1_A5PSW\n--\nnet/dsa/Kconfig-203-\thelp\nnet/dsa/Kconfig:204:\t Say Y or M if you want to enable support for tagging frames for\nnet/dsa/Kconfig-205-\t Renesas RZ/N1 embedded switch that uses an 8 byte tag located after\n--\nnet/dsa/Kconfig=208=config NET_DSA_TAG_SDSA\n--\nnet/dsa/Kconfig-210-\thelp\nnet/dsa/Kconfig:211:\t Say Y or M if you want to enable support for tagging frames for the\nnet/dsa/Kconfig-212-\t SoC-e switches.\n--\nnet/dsa/Kconfig=214=config NET_DSA_TAG_LAN9303\n--\nnet/dsa/Kconfig-216-\thelp\nnet/dsa/Kconfig:217:\t Say Y or M if you want to enable support for tagging frames for the\nnet/dsa/Kconfig-218-\t SMSC/Microchip LAN9303 family of switches.\n--\nnet/dsa/Kconfig=220=config NET_DSA_TAG_SJA1105\n--\nnet/dsa/Kconfig-223-\thelp\nnet/dsa/Kconfig:224:\t Say Y or M if you want to enable support for tagging frames with the\nnet/dsa/Kconfig:225:\t NXP SJA1105 switch family. Both the native tagging protocol (which\nnet/dsa/Kconfig:226:\t is only for link-local traffic) as well as non-native tagging (based\nnet/dsa/Kconfig-227-\t on a custom 802.1Q VLAN header) are available.\n--\nnet/dsa/Kconfig=229=config NET_DSA_TAG_TRAILER\n--\nnet/dsa/Kconfig-231-\thelp\nnet/dsa/Kconfig:232:\t Say Y or M if you want to enable support for tagging frames at\nnet/dsa/Kconfig-233-\t with a trailed. e.g. Marvell 88E6060.\n--\nnet/dsa/Kconfig=235=config NET_DSA_TAG_VSC73XX_8021Q\n--\nnet/dsa/Kconfig-237-\thelp\nnet/dsa/Kconfig:238:\t Say Y or M if you want to enable support for tagging frames with a\nnet/dsa/Kconfig-239-\t custom VLAN-based header.\n--\nnet/dsa/Kconfig=241=config NET_DSA_TAG_XRS700X\n--\nnet/dsa/Kconfig-243-\thelp\nnet/dsa/Kconfig:244:\t Say Y or M if you want to enable support for tagging frames for\nnet/dsa/Kconfig-245-\t Arrow SpeedChips XRS700x switches that use a single byte tag trailer.\n--\nnet/dsa/Kconfig=247=config NET_DSA_TAG_YT921X\n--\nnet/dsa/Kconfig-249-\thelp\nnet/dsa/Kconfig:250:\t Say Y or M if you want to enable support for tagging frames for\nnet/dsa/Kconfig-251-\t Motorcomm YT921x switches.\n--\nnet/dsa/Makefile=10=dsa_core-y += \\\n--\nnet/dsa/Makefile-21-\nnet/dsa/Makefile:22:# tagging formats\nnet/dsa/Makefile-23-obj-$(CONFIG_NET_DSA_TAG_AR9331) += tag_ar9331.o\n--\nnet/dsa/conduit.c=312=static void dsa_conduit_ethtool_teardown(struct net_device *dev)\n--\nnet/dsa/conduit.c-322-\nnet/dsa/conduit.c:323:/* Keep the conduit always promiscuous if the tagging protocol requires that\nnet/dsa/conduit.c-324- * (garbles MAC DA) or if it doesn't support unicast filtering, case in which\n--\nnet/dsa/conduit.c=328=static void dsa_conduit_set_promiscuity(struct net_device *dev, int inc)\n--\nnet/dsa/conduit.c-339-\nnet/dsa/conduit.c:340:static ssize_t tagging_show(struct device *d, struct device_attribute *attr,\nnet/dsa/conduit.c-341-\t\t\t char *buf)\n--\n\n"
} |
| 13/2 | 2026/11/25 15:23 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 36112 output: 37 thoughts: 29 Thoughts: Okay, here's my take on those thoughts, tailored for an expert audience: **Diving into `conduit.c` for `tagging_store`** Alright, let's zero in on `net/dsa/conduit.c`, specifically around line 340. I want to take a look at the `tagging_store` function. Knowing this code base, my first thought is likely to understand how it's being used within the larger context of the DSA (Distributed Switch Architecture) conduit. I'm probably mentally mapping out the data structures involved—what kind of `struct` is associated with this function? Is it handling VLAN tagging, QoS marking, or perhaps some other sort of metadata injection or manipulation on the ingress or egress side of a port? I'm probably anticipating the usual concerns: Are there any potential race conditions here? What's the lock granularity (if any) used to protect access to the data structures `tagging_store` modifies? More likely than not, my initial concern involves the potential for contention and the implications of this function's scope on latency. Ultimately, I need to see what's actually being *stored* in this "tagging store" and how it's related to the incoming and outgoing traffic. I want to check how the tagging store interacts with other key functions within the conduit framework. Are there any opportunities for optimization here, or perhaps potential bugs that require urgent attention? Let's get to the code and see what's going on. |
| 14/2 | 2026/11/25 15:23 | tool | read-file |
0mArgs:{
"File": "net/dsa/conduit.c",
"FirstLine": 335,
"LineCount": 55
}Results: {
"Contents": " 335:\t\tASSERT_RTNL();\n 336:\t\n 337:\t\tdev_set_promiscuity(dev, inc);\n 338:\t}\n 339:\t\n 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"
} |
| 15/2 | 2026/11/25 15:23 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 37353 output: 38 thoughts: 150 Thoughts: **Investigating DSA Tagging and Instantiation** Okay, so I'm looking at how the `tagging_store` interface works within sysfs, specifically when writing to `/sys/class/net/<conduit>/dsa/tagging`. The trace points me to `dsa_tag_driver_get_by_name`, which is followed by `dsa_tree_change_tag_proto`. This is where the magic happens, altering the tag protocols. But, a nagging question arises: can we actually *instantiate* a `dsa_loop` or any DSA switch in a flexible manner? I need to confirm whether DSA conduits and switches are even dynamically created or are they set up some other way. My focus shifts to the instantiation process. Is it possible for user-space applications to programmatically create a DSA switch, or, crucially, a `dsa_loop`? I need to know the mechanism. Let's dig deeper and search for the loading or instantiation paths of `dsa_loop`. The goal is to determine the limits and flexibility in our current setup. |
| 16/2 | 2026/11/25 15:23 | tool | grepper |
0mArgs:{
"Expression": "dsa_loop",
"PathPrefixes": [
"drivers/net/dsa/dsa_loop.c"
]
}Results: {
"Output": "\nFull output is too long, showing 200 out of 261 lines.\nUse more precise expression or PathPrefixes if possible.\n\nNumber of matching lines per file (1 files in total):\ndrivers/net/dsa/dsa_loop.c:93\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)\ndrivers/net/dsa/dsa_loop.c-398-{\ndrivers/net/dsa/dsa_loop.c-399-\tstruct dsa_switch *ds = dev_get_drvdata(\u0026mdiodev-\u003edev);\ndrivers/net/dsa/dsa_loop.c:400:\tstruct dsa_loop_priv *ps;\ndrivers/net/dsa/dsa_loop.c-401-\n\n"
} |
| 17/2 | 2026/11/25 15:23 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 42888 output: 41 thoughts: 37 Thoughts: Okay, let's dive into this. I need to understand how `switch_mdiodev` gets initialized within `dsa_loop.c`. Given my expertise, I suspect this initialization process is crucial to the overall functioning of the DSA (Distributed Switch Architecture) loop, likely dictating how various MDIO (Management Data Input/Output) devices are handled. To get a handle on it, I'm going to focus on lines 400 to 450 of `dsa_loop.c`. That should give me the core information I need. |
| 18/2 | 2026/11/25 15:24 | tool | read-file |
0mArgs:{
"File": "drivers/net/dsa/dsa_loop.c",
"FirstLine": 400,
"LineCount": 50
}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"
} |
| 19/2 | 2026/11/25 15:24 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 43785 output: 41 thoughts: 14 Thoughts: Okay, here's my interpretation of what's going through my mind, rendered in first person, keeping in mind the user is a subject-matter expert: **Diving into `dsa_loop.c`** Alright, time to get my hands dirty. Let's dig into `dsa_loop.c`. I expect to see the core logic for the DSA loop operation here, right? This is where the rubber meets the road, where the data structures and algorithms I know so well are actually *doing* their thing. I'm mentally parsing the code, anticipating how the iteration will be handled, any edge-case considerations, potential bottlenecks, and, of course, the ever-present opportunities for optimization. I'll be looking for any clever tricks or unexpected design choices the authors have made. Is it well commented? Is the style consistent with the rest of the project? Those kinds of things. Time to see what we've got. Let's see if this code lives up to its promise. |
| 20/2 | 2026/11/25 15:24 | tool | read-file |
0mArgs:{
"File": "drivers/net/dsa/dsa_loop.c",
"FirstLine": 450,
"LineCount": 50
}Results: {
"Contents": " 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 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"
} |
| 21/2 | 2026/11/25 15:24 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 44808 output: 18 thoughts: 695 Thoughts: **Analyzing the Patch: A Deep Dive into Device Tree Integration** Okay, so this patch introduces some changes. First, I see `dsa_loop`, a mockup driver, attaching to `eth0` and `fixed-0`. Interesting. Is that even relevant here or is `dsa_loop` or `tag_sdsa` actually something I need to be concerned about? Let's break down the files included in this patch. I see a lot of Device Tree bindings and drivers: `soce,swip.yaml`, `soce,swip-switch.yaml`, `soce,swip-mdio.yaml` bindings. Plus, a `vendor-prefixes.yaml` file. That points to Device Tree interaction. Then there are Kconfig and Makefiles for MFD, DSA, and MDIO, along with relevant C files: `soce-swip-core.c`, `soce-swip.c`, and `mdio-soce.c`. I also see `dsa.h` and `tag_sdsa.c`, which are important DSA components. Okay, my main question now is, what probes? Can `soce-swip-core.c`, `soce-swip.c`, or `mdio-soce.c` actually initialize? Let's check the device matching. `soce-swip-core.c` uses "soce,swip". It's an OF (Device Tree) platform driver. `soce-swip.c` uses "soce,swip-switch-00-04-0c-10" and is also an OF platform driver! `mdio-soce.c` uses "soce,swip-mdio" and it's also an OF platform driver. Now, a critical thought. Can OF platform devices be *dynamically* created? Is this targeting an architecture where Device Tree overlays or configfs can be used to instantiate OF devices? Hmm, can OF be enabled on amd64? I need to check `CONFIG_OF` for amd64. Let me grep for `CONFIG_OF` in `arch/x86/Kconfig` or check if `OF` is selectable on amd64. This patch might be relevant even on a standard x86/amd64 setup if Device Tree Overlays are supported. I'll need to figure that out. |
| 22/2 | 2026/11/25 15:24 | tool | grepper |
0mArgs:{
"Expression": "config OF\\b"
}Results: {
"Output": "drivers/of/Kconfig=8=config BUILTIN_DTB_ALL\n--\ndrivers/of/Kconfig-10-\ndrivers/of/Kconfig:11:menuconfig OF\ndrivers/of/Kconfig-12-\tbool \"Device Tree and Open Firmware support\"\n"
} |
| 23/2 | 2026/11/25 15:24 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 46120 output: 33 thoughts: 18 Thoughts: Here's my attempt at summarizing the thought process, tailored for an expert audience: **Diving into the Kernel Configuration Landscape** Okay, so I need to zero in on a specific Kconfig file to troubleshoot this, likely related to a driver. I'm thinking the `drivers/of/Kconfig` file is a good starting point. My hunch is that the issue, whatever it might be, is probably linked to device tree configurations. Let's start with a focused look around line 11. I'll be looking for relevant variables, dependencies, and any potential logic flows in that area that could be influencing the behavior I'm seeing. This is probably where I'll find the definitions for the relevant device tree bindings, any associated conditional compilation based on other config options, or maybe even a clue about default values. Let's get to it. |
| 24/2 | 2026/11/25 15:24 | tool | read-file |
0mArgs:{
"File": "drivers/of/Kconfig",
"FirstLine": 11,
"LineCount": 30
}Results: {
"Contents": " 11:\tmenuconfig OF\n 12:\t\tbool \"Device Tree and Open Firmware support\"\n 13:\t\thelp\n 14:\t\t This option enables the device tree infrastructure.\n 15:\t\t It is automatically selected by platforms that need it or can\n 16:\t\t be enabled manually for unittests, overlays or\n 17:\t\t compile-coverage.\n 18:\t\n 19:\tif OF\n 20:\t\n 21:\tconfig OF_UNITTEST\n 22:\t\tbool \"Device Tree runtime unit tests\"\n 23:\t\tdepends on OF_EARLY_FLATTREE\n 24:\t\tselect IRQ_DOMAIN\n 25:\t\tselect OF_RESOLVE\n 26:\t\thelp\n 27:\t\t This option builds in test cases for the device tree infrastructure\n 28:\t\t that are executed once at boot time, and the results dumped to the\n 29:\t\t console.\n 30:\t\n 31:\t\t This option should only be enabled for a development kernel. The tests\n 32:\t\t will taint the kernel with TAINT_TEST. The tests will cause ERROR and\n 33:\t\t WARNING messages to print on the console. The tests will cause stack\n 34:\t\t traces to print on the console. It is possible that the tests will\n 35:\t\t leave the devicetree in a corrupted state.\n 36:\t\n 37:\t\t The unittest output will be verbose. Copy the output to a file\n 38:\t\t via capturing the console output or via the dmesg command. Process\n 39:\t\t this file with scripts/dtc/of_unittest_expect to reduce the\n 40:\t\t verbosity, test whether expected output is present, and to\n"
} |
| 25/2 | 2026/11/25 15:24 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 46793 output: 18 thoughts: 22 Thoughts: Here's my thought process, as if I were considering those lines: **Investigating a Configuration Issue** Okay, hold on a minute. `CONFIG_OF_CONFIGFS`... that's ringing a bell, but I need to be sure. Let's not just assume; I'd better double-check the actual symbol and its context. My first instinct is to immediately search through the kernel source to understand where and how `OF_CONFIGFS` is being used. A simple `grep` should be the quickest way to track that down. Get me a quick overview of the code that uses that symbol, and then I'll move on to a deeper dive. |
| 26/2 | 2026/11/25 15:24 | tool | grepper |
0mArgs:{
"Expression": "OF_CONFIGFS"
}Results: {
"Output": "no matches"
} |
| 27/2 | 2026/11/25 15:24 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 46989 output: 18 thoughts: 21 Thoughts: Here's my thought process, as if I were considering those lines of text: **Investigating the Overlay Mechanism** Okay, so I see this mention of `OF_OVERLAY`. That's a flag, likely related to device tree overlays. The question now becomes: *What* is it doing? I need to understand its context. Let's start with the related configuration option, `CONFIG_OF_OVERLAY`. I'm guessing that enabling this config probably enables the core functionality of the overlay mechanism. I'll need to dig into the documentation or the source code where `CONFIG_OF_OVERLAY` is defined to get a clearer picture. I expect it'll give me clues about how the overlays are handled, when they're used, and potentially what hardware architectures this affects. Knowing this will give me a base to then understand where the `OF_OVERLAY` flag comes in and what it controls. It probably ties to some run-time operations, but I need the bigger picture first. |
| 28/2 | 2026/11/25 15:24 | tool | grepper |
0mArgs:{
"Expression": "OF_OVERLAY"
}Results: {
"Output": "\nFull output is too long, showing 200 out of 381 lines.\nUse more precise expression or PathPrefixes if possible.\n\nNumber of matching lines per file (24 files in total):\nDocumentation/devicetree/overlay-notes.rst:5\nDocumentation/translations/zh_CN/devicetree/overlay-notes.rst:3\narch/arm/configs/milbeaut_m10v_defconfig:1\narch/arm/configs/socfpga_defconfig:1\narch/arm64/configs/defconfig:1\narch/openrisc/configs/or1klitex_defconfig:1\ndrivers/clk/.kunitconfig:1\ndrivers/clk/clk_test.c:24\ndrivers/fpga/of-fpga-region.c:10\ndrivers/gpu/drm/bridge/imx/Kconfig:1\ndrivers/gpu/drm/tilcdc/Kconfig:1\ndrivers/misc/Kconfig:1\ndrivers/of/.kunitconfig:2\ndrivers/of/Kconfig:2\ndrivers/of/Makefile:2\ndrivers/of/dynamic.c:5\ndrivers/of/of_kunit_helpers.c:1\ndrivers/of/of_private.h:2\ndrivers/of/overlay.c:14\ndrivers/of/overlay_test.c:2\ndrivers/of/unittest-data/Makefile:2\ndrivers/of/unittest.c:15\ninclude/kunit/of.h:6\ninclude/linux/of.h:8\n\nDocumentation/devicetree/overlay-notes.rst=120=enum of_overlay_notify_action for details.\nDocumentation/devicetree/overlay-notes.rst-121-\nDocumentation/devicetree/overlay-notes.rst:122:A notifier callback for OF_OVERLAY_PRE_APPLY, OF_OVERLAY_POST_APPLY, or\nDocumentation/devicetree/overlay-notes.rst:123:OF_OVERLAY_PRE_REMOVE may store pointers to a device tree node in the overlay\nDocumentation/devicetree/overlay-notes.rst-124-or its content but these pointers must not persist past the notifier callback\nDocumentation/devicetree/overlay-notes.rst:125:for OF_OVERLAY_POST_REMOVE. The memory containing the overlay will be\nDocumentation/devicetree/overlay-notes.rst:126:kfree()ed after OF_OVERLAY_POST_REMOVE notifiers are called. Note that the\nDocumentation/devicetree/overlay-notes.rst:127:memory will be kfree()ed even if the notifier for OF_OVERLAY_POST_REMOVE\nDocumentation/devicetree/overlay-notes.rst-128-returns an error.\n--\nDocumentation/translations/zh_CN/devicetree/overlay-notes.rst=120=of_overlay_notifier_register/unregister和enum of_overlay_notify_action。\nDocumentation/translations/zh_CN/devicetree/overlay-notes.rst-121-\nDocumentation/translations/zh_CN/devicetree/overlay-notes.rst:122:OF_OVERLAY_PRE_APPLY、OF_OVERLAY_POST_APPLY或OF_OVERLAY_PRE_REMOVE\nDocumentation/translations/zh_CN/devicetree/overlay-notes.rst-123-的通知器回调可以存储指向覆盖层中的设备树节点或其内容的指针,但这些指针不能持\nDocumentation/translations/zh_CN/devicetree/overlay-notes.rst:124:续到OF_OVERLAY_POST_REMOVE的通知器回调。在OF_OVERLAY_POST_REMOVE通\nDocumentation/translations/zh_CN/devicetree/overlay-notes.rst:125:知器被调用后,包含覆盖层的内存将被kfree()ed。请注意,即使OF_OVERLAY_POST_REMOVE\nDocumentation/translations/zh_CN/devicetree/overlay-notes.rst-126-的通知器返回错误,内存也会被kfree()ed。\n--\narch/arm/configs/milbeaut_m10v_defconfig=54=CONFIG_EFI_CAPSULE_LOADER=m\narch/arm/configs/milbeaut_m10v_defconfig:55:CONFIG_OF_OVERLAY=y\narch/arm/configs/milbeaut_m10v_defconfig-56-CONFIG_BLK_DEV_LOOP=y\n--\narch/arm/configs/socfpga_defconfig=47=CONFIG_MTD_SPI_NOR=y\narch/arm/configs/socfpga_defconfig-48-# CONFIG_MTD_SPI_NOR_USE_4K_SECTORS is not set\narch/arm/configs/socfpga_defconfig:49:CONFIG_OF_OVERLAY=y\narch/arm/configs/socfpga_defconfig-50-CONFIG_BLK_DEV_LOOP=y\n--\narch/arm64/configs/defconfig=306=CONFIG_HBMC_AM654=m\narch/arm64/configs/defconfig:307:CONFIG_OF_OVERLAY=y\narch/arm64/configs/defconfig-308-CONFIG_BLK_DEV_LOOP=y\n--\narch/openrisc/configs/or1klitex_defconfig=26=CONFIG_DEVTMPFS_MOUNT=y\narch/openrisc/configs/or1klitex_defconfig:27:CONFIG_OF_OVERLAY=y\narch/openrisc/configs/or1klitex_defconfig-28-CONFIG_NETDEVICES=y\n--\ndrivers/clk/.kunitconfig=3=CONFIG_OF=y\ndrivers/clk/.kunitconfig:4:CONFIG_OF_OVERLAY=y\ndrivers/clk/.kunitconfig-5-CONFIG_COMMON_CLK=y\n--\ndrivers/clk/clk_test.c=3237=static void clk_assigned_rates_skips(struct kunit *test)\n--\ndrivers/clk/clk_test.c-3245-\ndrivers/clk/clk_test.c:3246:OF_OVERLAY_DECLARE(kunit_clk_assigned_rates_one);\ndrivers/clk/clk_test.c:3247:OF_OVERLAY_DECLARE(kunit_clk_assigned_rates_one_consumer);\ndrivers/clk/clk_test.c:3248:OF_OVERLAY_DECLARE(kunit_clk_assigned_rates_u64_one);\ndrivers/clk/clk_test.c:3249:OF_OVERLAY_DECLARE(kunit_clk_assigned_rates_u64_one_consumer);\ndrivers/clk/clk_test.c-3250-\n--\ndrivers/clk/clk_test.c=3288=KUNIT_ARRAY_PARAM_DESC(clk_assigned_rates_assigns_one,\n--\ndrivers/clk/clk_test.c-3290-\ndrivers/clk/clk_test.c:3291:OF_OVERLAY_DECLARE(kunit_clk_assigned_rates_multiple);\ndrivers/clk/clk_test.c:3292:OF_OVERLAY_DECLARE(kunit_clk_assigned_rates_multiple_consumer);\ndrivers/clk/clk_test.c:3293:OF_OVERLAY_DECLARE(kunit_clk_assigned_rates_u64_multiple);\ndrivers/clk/clk_test.c:3294:OF_OVERLAY_DECLARE(kunit_clk_assigned_rates_u64_multiple_consumer);\ndrivers/clk/clk_test.c-3295-\n--\ndrivers/clk/clk_test.c=3333=KUNIT_ARRAY_PARAM_DESC(clk_assigned_rates_assigns_multiple,\n--\ndrivers/clk/clk_test.c-3336-\ndrivers/clk/clk_test.c:3337:OF_OVERLAY_DECLARE(kunit_clk_assigned_rates_without);\ndrivers/clk/clk_test.c:3338:OF_OVERLAY_DECLARE(kunit_clk_assigned_rates_without_consumer);\ndrivers/clk/clk_test.c:3339:OF_OVERLAY_DECLARE(kunit_clk_assigned_rates_zero);\ndrivers/clk/clk_test.c:3340:OF_OVERLAY_DECLARE(kunit_clk_assigned_rates_zero_consumer);\ndrivers/clk/clk_test.c:3341:OF_OVERLAY_DECLARE(kunit_clk_assigned_rates_null);\ndrivers/clk/clk_test.c:3342:OF_OVERLAY_DECLARE(kunit_clk_assigned_rates_null_consumer);\ndrivers/clk/clk_test.c-3343-\n--\ndrivers/clk/clk_test.c=3421=static struct kunit_suite clk_assigned_rates_suite = {\n--\ndrivers/clk/clk_test.c-3426-\ndrivers/clk/clk_test.c:3427:OF_OVERLAY_DECLARE(kunit_clk_assigned_sscs_one);\ndrivers/clk/clk_test.c:3428:OF_OVERLAY_DECLARE(kunit_clk_assigned_sscs_one_consumer);\ndrivers/clk/clk_test.c:3429:OF_OVERLAY_DECLARE(kunit_clk_assigned_sscs_multiple);\ndrivers/clk/clk_test.c:3430:OF_OVERLAY_DECLARE(kunit_clk_assigned_sscs_multiple_consumer);\ndrivers/clk/clk_test.c:3431:OF_OVERLAY_DECLARE(kunit_clk_assigned_sscs_without);\ndrivers/clk/clk_test.c:3432:OF_OVERLAY_DECLARE(kunit_clk_assigned_sscs_without_consumer);\ndrivers/clk/clk_test.c:3433:OF_OVERLAY_DECLARE(kunit_clk_assigned_sscs_zero);\ndrivers/clk/clk_test.c:3434:OF_OVERLAY_DECLARE(kunit_clk_assigned_sscs_zero_consumer);\ndrivers/clk/clk_test.c:3435:OF_OVERLAY_DECLARE(kunit_clk_assigned_sscs_null);\ndrivers/clk/clk_test.c:3436:OF_OVERLAY_DECLARE(kunit_clk_assigned_sscs_null_consumer);\ndrivers/clk/clk_test.c-3437-\n--\ndrivers/fpga/of-fpga-region.c=345=static int of_fpga_region_notify(struct notifier_block *nb,\n--\ndrivers/fpga/of-fpga-region.c-352-\tswitch (action) {\ndrivers/fpga/of-fpga-region.c:353:\tcase OF_OVERLAY_PRE_APPLY:\ndrivers/fpga/of-fpga-region.c:354:\t\tpr_debug(\"%s OF_OVERLAY_PRE_APPLY\\n\", __func__);\ndrivers/fpga/of-fpga-region.c-355-\t\tbreak;\ndrivers/fpga/of-fpga-region.c:356:\tcase OF_OVERLAY_POST_APPLY:\ndrivers/fpga/of-fpga-region.c:357:\t\tpr_debug(\"%s OF_OVERLAY_POST_APPLY\\n\", __func__);\ndrivers/fpga/of-fpga-region.c-358-\t\treturn NOTIFY_OK; /* not for us */\ndrivers/fpga/of-fpga-region.c:359:\tcase OF_OVERLAY_PRE_REMOVE:\ndrivers/fpga/of-fpga-region.c:360:\t\tpr_debug(\"%s OF_OVERLAY_PRE_REMOVE\\n\", __func__);\ndrivers/fpga/of-fpga-region.c-361-\t\treturn NOTIFY_OK; /* not for us */\ndrivers/fpga/of-fpga-region.c:362:\tcase OF_OVERLAY_POST_REMOVE:\ndrivers/fpga/of-fpga-region.c:363:\t\tpr_debug(\"%s OF_OVERLAY_POST_REMOVE\\n\", __func__);\ndrivers/fpga/of-fpga-region.c-364-\t\tbreak;\n--\ndrivers/fpga/of-fpga-region.c-374-\tswitch (action) {\ndrivers/fpga/of-fpga-region.c:375:\tcase OF_OVERLAY_PRE_APPLY:\ndrivers/fpga/of-fpga-region.c-376-\t\tret = of_fpga_region_notify_pre_apply(region, nd);\n--\ndrivers/fpga/of-fpga-region.c-378-\ndrivers/fpga/of-fpga-region.c:379:\tcase OF_OVERLAY_POST_REMOVE:\ndrivers/fpga/of-fpga-region.c-380-\t\tof_fpga_region_notify_post_remove(region, nd);\n--\ndrivers/gpu/drm/bridge/imx/Kconfig=6=config DRM_IMX8MP_DW_HDMI_BRIDGE\n--\ndrivers/gpu/drm/bridge/imx/Kconfig-10-\tselect DRM_DW_HDMI\ndrivers/gpu/drm/bridge/imx/Kconfig:11:\tselect OF_OVERLAY\ndrivers/gpu/drm/bridge/imx/Kconfig-12-\tselect DRM_DISPLAY_CONNECTOR\n--\ndrivers/gpu/drm/tilcdc/Kconfig=19=config DRM_TILCDC_PANEL_LEGACY\n--\ndrivers/gpu/drm/tilcdc/Kconfig-25-\tdepends on PM\ndrivers/gpu/drm/tilcdc/Kconfig:26:\tselect OF_OVERLAY\ndrivers/gpu/drm/tilcdc/Kconfig-27-\tselect DRM_PANEL_SIMPLE\n--\ndrivers/misc/Kconfig=550=config MCHP_LAN966X_PCI\n--\ndrivers/misc/Kconfig-552-\tdepends on PCI\ndrivers/misc/Kconfig:553:\tdepends on OF_OVERLAY\ndrivers/misc/Kconfig-554-\tselect IRQ_DOMAIN\n--\ndrivers/of/.kunitconfig=3=CONFIG_OF_KUNIT_TEST=y\ndrivers/of/.kunitconfig:4:CONFIG_OF_OVERLAY=y\ndrivers/of/.kunitconfig:5:CONFIG_OF_OVERLAY_KUNIT_TEST=y\n--\ndrivers/of/Kconfig=102=config OF_RESOLVE\n--\ndrivers/of/Kconfig-104-\ndrivers/of/Kconfig:105:config OF_OVERLAY\ndrivers/of/Kconfig-106-\tbool \"Device Tree overlays\"\n--\ndrivers/of/Kconfig-115-\ndrivers/of/Kconfig:116:config OF_OVERLAY_KUNIT_TEST\ndrivers/of/Kconfig-117-\ttristate \"Device Tree overlay KUnit tests\" if !KUNIT_ALL_TESTS\n--\ndrivers/of/Makefile=12=obj-$(CONFIG_OF_RESOLVE) += resolver.o\ndrivers/of/Makefile:13:obj-$(CONFIG_OF_OVERLAY) += overlay.o\ndrivers/of/Makefile-14-obj-$(CONFIG_OF_NUMA) += of_numa.o\n--\ndrivers/of/Makefile=23=obj-$(CONFIG_OF_KUNIT_TEST) += of_test.o\ndrivers/of/Makefile:24:obj-$(CONFIG_OF_OVERLAY_KUNIT_TEST) += overlay-test.o\ndrivers/of/Makefile-25-overlay-test-y := overlay_test.o kunit_overlay_test.dtbo.o\n--\ndrivers/of/dynamic.c=212=static void __of_attach_node(struct device_node *np)\n--\ndrivers/of/dynamic.c-219-\ndrivers/of/dynamic.c:220:\tif (!of_node_check_flag(np, OF_OVERLAY)) {\ndrivers/of/dynamic.c-221-\t\tnp-\u003ename = __of_get_property(np, \"name\", NULL);\n--\ndrivers/of/dynamic.c=344=void of_node_release(struct kobject *kobj)\n--\ndrivers/of/dynamic.c-376-\ndrivers/of/dynamic.c:377:\tif (of_node_check_flag(node, OF_OVERLAY)) {\ndrivers/of/dynamic.c-378-\ndrivers/of/dynamic.c:379:\t\tif (!of_node_check_flag(node, OF_OVERLAY_FREE_CSET)) {\ndrivers/of/dynamic.c-380-\t\t\t/* premature refcount of zero, do not free memory */\n--\ndrivers/of/dynamic.c=533=static void __of_changeset_entry_destroy(struct of_changeset_entry *ce)\n--\ndrivers/of/dynamic.c-535-\tif (ce-\u003eaction == OF_RECONFIG_ATTACH_NODE \u0026\u0026\ndrivers/of/dynamic.c:536:\t of_node_check_flag(ce-\u003enp, OF_OVERLAY)) {\ndrivers/of/dynamic.c-537-\t\tif (kref_read(\u0026ce-\u003enp-\u003ekobj.kref) \u003e 1) {\n--\ndrivers/of/dynamic.c-540-\t\t} else {\ndrivers/of/dynamic.c:541:\t\t\tof_node_set_flag(ce-\u003enp, OF_OVERLAY_FREE_CSET);\ndrivers/of/dynamic.c-542-\t\t}\n--\ndrivers/of/of_kunit_helpers.c=25=EXPORT_SYMBOL_GPL(of_root_kunit_skip);\ndrivers/of/of_kunit_helpers.c-26-\ndrivers/of/of_kunit_helpers.c:27:#if defined(CONFIG_OF_OVERLAY) \u0026\u0026 defined(CONFIG_OF_EARLY_FLATTREE)\ndrivers/of/of_kunit_helpers.c-28-\n--\ndrivers/of/of_private.h=100=void __of_phandle_cache_inv_entry(phandle handle);\ndrivers/of/of_private.h-101-\ndrivers/of/of_private.h:102:#if defined(CONFIG_OF_OVERLAY)\ndrivers/of/of_private.h-103-void of_overlay_mutex_lock(void);\n--\ndrivers/of/of_private.h=107=static inline void of_overlay_mutex_unlock(void) {};\n--\ndrivers/of/of_private.h-109-\ndrivers/of/of_private.h:110:#if defined(CONFIG_OF_UNITTEST) \u0026\u0026 defined(CONFIG_OF_OVERLAY)\ndrivers/of/of_private.h-111-extern void __init unittest_unflatten_overlay_base(void);\n--\ndrivers/of/overlay.c=131=static BLOCKING_NOTIFIER_HEAD(overlay_notify_chain);\n--\ndrivers/of/overlay.c-141- * Note that a notifier callback is not supposed to store pointers to a device\ndrivers/of/overlay.c:142: * tree node or its content beyond @OF_OVERLAY_POST_REMOVE corresponding to the\ndrivers/of/overlay.c-143- * respective node it received.\n--\ndrivers/of/overlay.c=316=static int add_changeset_property(struct overlay_changeset *ovcs,\n--\ndrivers/of/overlay.c-375-\ndrivers/of/overlay.c:376:\tif (!of_node_check_flag(target-\u003enp, OF_OVERLAY))\ndrivers/of/overlay.c-377-\t\tpr_err(\"WARNING: memory leak will occur if overlay removed, property: %pOF/%s\\n\",\n--\ndrivers/of/overlay.c=418=static int add_changeset_node(struct overlay_changeset *ovcs,\n\n"
} |
| 29/2 | 2026/11/25 15:24 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 52156 output: 22 thoughts: 198 Thoughts: Okay, let me think this through. **Analyzing the SDSA Tagging Driver in Linux Networking** Hmm, first things first, I need to figure out if we even *can* reach `net/dsa/tag_sdsa.c`. Let's assume we can, and then dive deeper. Okay, `tag_sdsa.c`, let's take a closer look at that file... right, I see that the `sdsa_netdev_ops` structure is registered using `module_dsa_tag_driver(sdsa_netdev_ops)`. Ah, that's how it works! That macro, if I recall correctly, registers the driver within the DSA tag driver registry. Specifically, I see it's registering using `MODULE_ALIAS_DSA_TAG_DRIVER(DSA_TAG_PROTO_SDSA, SDSA_NAME)`. And further down, `dsa_tag_driver_register(&sdsa_netdev_ops_array, THIS_MODULE);` is called. Okay, that establishes *how* it's registered. Now, the real question is, how does this DSA tagging protocol work generally in Linux? I'm going to need to trace the usage of the registered driver. The next step is to figure out where `dsa_tag_driver_get_by_name` or `dsa_tag_driver_get_by_id` are called. That should give me the entry point and the flow to understanding how the SDSA tag is actually *used*. |
| 30/2 | 2026/11/25 15:24 | tool | grepper |
0mArgs:{
"Expression": "dsa_tag_driver_get"
}Results: {
"Output": "net/dsa/conduit.c=350=static ssize_t tagging_store(struct device *d, struct device_attribute *attr,\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/dsa.c=1155=static int dsa_port_parse_cpu(struct dsa_port *dp, struct net_device *conduit,\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/tag.c=170=const char *dsa_tag_protocol_to_str(const struct dsa_device_ops *ops)\n--\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-{\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-{\n--\nnet/dsa/tag.h=20=extern struct packet_type dsa_pack_type;\nnet/dsa/tag.h-21-\nnet/dsa/tag.h:22:const struct dsa_device_ops *dsa_tag_driver_get_by_id(int tag_protocol);\nnet/dsa/tag.h:23:const struct dsa_device_ops *dsa_tag_driver_get_by_name(const char *name);\nnet/dsa/tag.h-24-void dsa_tag_driver_put(const struct dsa_device_ops *ops);\n"
} |
| 31/2 | 2026/11/25 15:24 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 53386 output: 24 thoughts: 124 Thoughts: Okay, let's dive into this. Here's what I'm thinking, as I'm following this code path: **Inspecting DSA Tagging Protocol Changes** Right, so I'm looking at `tagging_store` in `net/dsa/conduit.c`. The first thing I see is that it's fetching a new tagging operation set by name: `new_tag_ops = dsa_tag_driver_get_by_name(name);`. Then, it calls `dsa_tree_change_tag_proto(cpu_dp->ds->dst, new_tag_ops, old_tag_ops);`. Now, hold on a second...this `dsa_tree_change_tag_proto` function...that's what's piquing my interest. Specifically, I need to know if changing the tag protocol using this function essentially lets *any* tagger be applied to a DSA switch. That's a critical point for understanding the system's flexibility and potential compatibility issues. Okay, I'm going to jump into `dsa_tree_change_tag_proto` in the `net/dsa/` directory and see what's going on. |
| 32/2 | 2026/11/25 15:24 | tool | grepper |
0mArgs:{
"Expression": "dsa_tree_change_tag_proto"
}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"
} |
| 33/2 | 2026/11/25 15:25 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 54277 output: 37 thoughts: 29 Thoughts: Okay, here's my summary, taking on the persona you requested: **Diving into the DSA Tagging Protocol Change** Alright, time to dig into this `dsa_tree_change_tag_proto` function. I'm going to pull up the source code, specifically the `net/dsa/dsa.c` file. I'm curious to see how the DSA (Distributed Switch Architecture) tag protocol is being altered. I need to understand the implications of this change, how it impacts the existing framework, and what potential performance or compatibility issues might arise. I'll need to pay close attention to the data structures involved – the tag itself, the way it's parsed, and how it interacts with the switch hardware. The goal is to fully grasp the rationale behind this modification and ensure it aligns with the overall DSA design principles, given my expertise in networking protocols and hardware interaction. |
| 34/2 | 2026/11/25 15:25 | tool | read-file |
0mArgs:{
"File": "net/dsa/dsa.c",
"FirstLine": 980,
"LineCount": 45
}Results: {
"Contents": " 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);\n1010:\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:\n"
} |
| 35/2 | 2026/11/25 15:25 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 55250 output: 36 thoughts: 43 Thoughts: Here's my attempt at summarizing the thought process, tailored for an expert audience: **Investigating the DSA Notifier Mechanism** Alright, so `DSA_NOTIFIER_TAG_PROTO` is the key. My mind immediately jumps to how this is actually implemented – what triggers it? Where does it get used? My first hunch is to check the `net/dsa/switch.c` file and zero in on the `dsa_switch_change_tag_proto` function. That seems like the logical place for a protocol tag change notification to originate, and I need to understand the relationship between the notifier and that function. Let's dig in and see exactly how they're connected. |
| 36/2 | 2026/11/25 15:25 | tool | read-file |
0mArgs:{
"File": "net/dsa/switch.c",
"FirstLine": 870,
"LineCount": 40
}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"
} |
| 37/2 | 2026/11/25 15:25 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 56097 output: 22 thoughts: 525 Thoughts: **Investigating the `change_tag_protocol` Implementation** Okay, so I'm looking at this code and it's checking for a `change_tag_protocol` operation in the `ds->ops` structure. If it's not present, it returns `-EOPNOTSUPP`. That's standard. But hold on, I need to make sure this is actually implemented by the `dsa_loop` driver. My initial thought is to make sure I understand the call graph correctly. Let's see... I'll check the `dsa_loop_driver` structure definition. I need to make sure `change_tag_protocol` is implemented. Okay, let's scan... no, it's not there! It has functions like `get_tag_protocol`, `setup`, `teardown`, and a bunch of other operations, but not that one. So, `dsa_loop` *doesn't* provide a `change_tag_protocol` implementation. This is important to understand. Now the question becomes, what other drivers *do* implement `change_tag_protocol`? I need to know where I can go to understand this call flow better. Let's move on and look for other places this might be implemented. |
| 38/2 | 2026/11/25 15:25 | tool | grepper |
0mArgs:{
"Expression": "\\.change_tag_protocol\\b"
}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=2304=static const struct dsa_switch_ops felix_switch_ops = {\ndrivers/net/dsa/ocelot/felix.c-2305-\t.get_tag_protocol\t\t= felix_get_tag_protocol,\ndrivers/net/dsa/ocelot/felix.c:2306:\t.change_tag_protocol\t\t= felix_change_tag_protocol,\ndrivers/net/dsa/ocelot/felix.c-2307-\t.connect_tag_protocol\t\t= felix_connect_tag_protocol,\n--\ndrivers/net/dsa/realtek/rtl8365mb_main.c=3469=static const struct dsa_switch_ops rtl8365mb_switch_ops = {\ndrivers/net/dsa/realtek/rtl8365mb_main.c-3470-\t.get_tag_protocol = rtl8365mb_get_tag_protocol,\ndrivers/net/dsa/realtek/rtl8365mb_main.c:3471:\t.change_tag_protocol = rtl8365mb_change_tag_protocol,\ndrivers/net/dsa/realtek/rtl8365mb_main.c-3472-\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"
} |
| 39/2 | 2026/11/25 15:25 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 57592 output: 34 thoughts: 1559 Thoughts: **SoC-e SWIP Switch Analysis: Reachability for Fuzzing** Okay, so I'm digging into this `soce-swip` driver and its interaction with the DSA framework. My initial thought was about the tag protocols supported by various switch drivers. Specifically, I wondered if any driver actually uses `DSA_TAG_PROTO_SDSA`, and it turns out, only `drivers/net/dsa/soce-swip.c` seems to declare it. However, a quick look reveals `soce-swip.c` doesn't even have a `change_tag_protocol` implementation which feels...odd. How can this even probe, let alone run? Let's break down what this driver *is*: It's a platform driver, matching a specific OpenFirmware/DeviceTree node: `soce,swip-switch-00-04-0c-10`. The description clearly states it's an FPGA IP core from SoC-e, integrating an Ethernet switch, MDIO controller, and MDIO bus multiplexer. The Kconfig options confirm this – `MFD_SOCE_SWIP`, `NET_DSA_SOCE_SWIP`, and various MDIO-related configurations are all selected. The driver reads from memory-mapped registers during probe, specifically `SWIP_CORE_VERSION_OFFSET`, then populates child devices (`soce,swip-switch-00-04-0c-10` and `soce,swip-mdio`) from the device tree. Further probing reads feature registers and registers the DSA switch. Now, the critical question: Can this all be instantiated in standard virtualized environments like QEMU on amd64, which is the target architecture? This is where reachability becomes the paramount concern for fuzzing. The key sections in the analysis document highlight structural unreachability as a primary disqualifier. Things like vendor-specific PCIe switches or drivers requiring physical hardware cards or execution paths only available on different architectures are explicitly mentioned as unreachable. Here's the rub: amd64 QEMU machines are standard x86 PCs (`pc` or `q35`), which use ACPI, *not* Device Tree. Unless someone *specifically* boots with a DTB, there won't be a device tree! So, even if the relevant Kconfig options are enabled, there's no way this driver will probe or run. Therefore, the driver is structurally unreachable for our purposes. It's a non-starter. I need to investigate if there's *any* mechanism to instantiate platform devices via sysfs, ioctl or other means. If not, this is a dead end. |
| 40/2 | 2026/11/25 15:25 | tool | grepper |
0mArgs:{
"Expression": "platform_device_register|platform_device_add",
"PathPrefixes": [
"drivers/"
]
}Results: {
"Output": "\nFull output is too long, showing 200 out of 3474 lines.\nUse more precise expression or PathPrefixes if possible.\n\nNumber of matching lines per file (391 files in total):\ndrivers/accel/rocket/rocket_drv.c:1\ndrivers/acpi/acpi_apd.c:1\ndrivers/acpi/acpi_platform.c:1\ndrivers/acpi/acpi_processor.c:1\ndrivers/acpi/acpi_watchdog.c:1\ndrivers/acpi/apei/hest.c:2\ndrivers/acpi/arm64/agdi.c:1\ndrivers/acpi/arm64/apmt.c:3\ndrivers/acpi/arm64/gtdt.c:2\ndrivers/acpi/arm64/iort.c:5\ndrivers/acpi/arm64/mpam.c:3\ndrivers/acpi/dock.c:1\ndrivers/acpi/x86/lpss.c:1\ndrivers/acpi/x86/utils.c:1\ndrivers/ata/pata_legacy.c:1\ndrivers/auxdisplay/cfag12864bfb.c:1\ndrivers/base/platform.c:25\ndrivers/base/test/platform-device-test.c:14\ndrivers/base/test/swnode-devlink-test.c:2\ndrivers/base/test/test_async_driver_probe.c:6\ndrivers/bcma/driver_chipcommon.c:1\ndrivers/bcma/main.c:3\ndrivers/block/floppy.c:1\ndrivers/bus/hisi_lpc.c:1\ndrivers/cdrom/gdrom.c:1\ndrivers/char/dsp56k.c:1\ndrivers/char/ipmi/ipmi_msghandler.c:2\ndrivers/char/ipmi/ipmi_plat_data.c:2\ndrivers/char/pc8736x_gpio.c:1\ndrivers/char/scx200_gpio.c:3\ndrivers/char/sonypi.c:1\ndrivers/char/tpm/tpm_atmel.c:1\ndrivers/char/tpm/tpm_nsc.c:1\ndrivers/char/tpm/tpm_tis.c:1\ndrivers/clk/bcm/clk-raspberrypi.c:1\ndrivers/clk/clk-gate_test.c:1\ndrivers/clk/clk-qoriq.c:1\ndrivers/clk/clk-scpi.c:1\ndrivers/clk/clk_test.c:1\ndrivers/clk/imx/clk-scu.c:2\ndrivers/clk/qcom/clk-smd-rpm.c:1\ndrivers/clk/qcom/gcc-msm8960.c:1\ndrivers/clk/rockchip/clk.c:1\ndrivers/clk/samsung/clk-exynos5-subcmu.c:1\ndrivers/clocksource/timer-gxp.c:1\ndrivers/clocksource/timer-ixp4xx.c:1\ndrivers/cpufreq/airoha-cpufreq.c:2\ndrivers/cpufreq/armada-37xx-cpufreq.c:1\ndrivers/cpufreq/armada-8k-cpufreq.c:1\ndrivers/cpufreq/cpufreq-dt-platdev.c:1\n... and 341 more files\n\ndrivers/accel/rocket/rocket_drv.c=286=static int __init rocket_register(void)\ndrivers/accel/rocket/rocket_drv.c-287-{\ndrivers/accel/rocket/rocket_drv.c:288:\tdrm_dev = platform_device_register_simple(\"rknn\", -1, NULL, 0);\ndrivers/accel/rocket/rocket_drv.c-289-\tif (IS_ERR(drm_dev))\n--\ndrivers/acpi/acpi_apd.c=65=static int fch_misc_setup(struct apd_private_data *pdata)\n--\ndrivers/acpi/acpi_apd.c-105-\ndrivers/acpi/acpi_apd.c:106:\tclkdev = platform_device_register_data(\u0026adev-\u003edev, \"clk-fch\",\ndrivers/acpi/acpi_apd.c-107-\t\t\t\t\t PLATFORM_DEVID_NONE, clk_data,\n--\ndrivers/acpi/acpi_platform.c=144=struct platform_device *acpi_create_platform_device(struct acpi_device *adev,\n--\ndrivers/acpi/acpi_platform.c-219-\ndrivers/acpi/acpi_platform.c:220:\tpdev = platform_device_register_full(\u0026pdevinfo);\ndrivers/acpi/acpi_platform.c-221-\tif (IS_ERR(pdev))\n--\ndrivers/acpi/acpi_processor.c=169=static void cpufreq_add_device(const char *name)\n--\ndrivers/acpi/acpi_processor.c-172-\ndrivers/acpi/acpi_processor.c:173:\tpdev = platform_device_register_simple(name, PLATFORM_DEVID_NONE, NULL, 0);\ndrivers/acpi/acpi_processor.c-174-\tif (IS_ERR(pdev))\n--\ndrivers/acpi/acpi_watchdog.c=102=void __init acpi_watchdog_init(void)\n--\ndrivers/acpi/acpi_watchdog.c-176-\ndrivers/acpi/acpi_watchdog.c:177:\tpdev = platform_device_register_simple(\"wdat_wdt\", PLATFORM_DEVID_NONE,\ndrivers/acpi/acpi_watchdog.c-178-\t\t\t\t\t resources, nresources);\n--\ndrivers/acpi/apei/hest.c=207=static int __init hest_parse_ghes(struct acpi_hest_header *hest_hdr, void *data)\n--\ndrivers/acpi/apei/hest.c-231-\ndrivers/acpi/apei/hest.c:232:\trc = platform_device_add_data(ghes_dev, \u0026hest_hdr, sizeof(void *));\ndrivers/acpi/apei/hest.c-233-\tif (rc)\n--\ndrivers/acpi/apei/hest.c-235-\ndrivers/acpi/apei/hest.c:236:\trc = platform_device_add(ghes_dev);\ndrivers/acpi/apei/hest.c-237-\tif (rc)\n--\ndrivers/acpi/arm64/agdi.c=176=void __init acpi_agdi_init(void)\n--\ndrivers/acpi/arm64/agdi.c-195-\ndrivers/acpi/arm64/agdi.c:196:\tpdev = platform_device_register_data(NULL, \"agdi\", 0, \u0026pdata, sizeof(pdata));\ndrivers/acpi/arm64/agdi.c-197-\tif (IS_ERR(pdev))\n--\ndrivers/acpi/arm64/apmt.c=75=static int __init apmt_add_platform_device(struct acpi_apmt_node *node,\n--\ndrivers/acpi/arm64/apmt.c-91-\ndrivers/acpi/arm64/apmt.c:92:\tret = platform_device_add_resources(pdev, res, count);\ndrivers/acpi/arm64/apmt.c-93-\tif (ret)\n--\ndrivers/acpi/arm64/apmt.c-99-\t */\ndrivers/acpi/arm64/apmt.c:100:\tret = platform_device_add_data(pdev, \u0026node, sizeof(node));\ndrivers/acpi/arm64/apmt.c-101-\tif (ret)\n--\ndrivers/acpi/arm64/apmt.c-105-\ndrivers/acpi/arm64/apmt.c:106:\tret = platform_device_add(pdev);\ndrivers/acpi/arm64/apmt.c-107-\n--\ndrivers/acpi/arm64/gtdt.c=347=static int __init gtdt_import_sbsa_gwdt(struct acpi_gtdt_watchdog *wd,\n--\ndrivers/acpi/arm64/gtdt.c-384-\t */\ndrivers/acpi/arm64/gtdt.c:385:\tpdev = platform_device_register_simple(\"sbsa-gwdt\", index, res, nr_res);\ndrivers/acpi/arm64/gtdt.c-386-\tif (IS_ERR(pdev)) {\n--\ndrivers/acpi/arm64/gtdt.c=395=static int __init gtdt_platform_timer_init(void)\n--\ndrivers/acpi/arm64/gtdt.c-435-\ndrivers/acpi/arm64/gtdt.c:436:\t\t\tpdev = platform_device_register_data(NULL, \"gtdt-arm-mmio-timer\",\ndrivers/acpi/arm64/gtdt.c-437-\t\t\t\t\t\t\t mmio_timer_count, \u0026atm,\n--\ndrivers/acpi/arm64/iort.c=1865=static int __init arm_smmu_v3_pmcg_add_platdata(struct platform_device *pdev)\n--\ndrivers/acpi/arm64/iort.c-1875-\ndrivers/acpi/arm64/iort.c:1876:\treturn platform_device_add_data(pdev, \u0026model, sizeof(model));\ndrivers/acpi/arm64/iort.c-1877-}\n--\ndrivers/acpi/arm64/iort.c=1936=static int __init iort_add_platform_device(struct acpi_iort_node *node,\n--\ndrivers/acpi/arm64/iort.c-1963-\ndrivers/acpi/arm64/iort.c:1964:\tret = platform_device_add_resources(pdev, r, count);\ndrivers/acpi/arm64/iort.c-1965-\t/*\ndrivers/acpi/arm64/iort.c:1966:\t * Resources are duplicated in platform_device_add_resources,\ndrivers/acpi/arm64/iort.c-1967-\t * free their allocated memory\n--\ndrivers/acpi/arm64/iort.c-1982-\telse\ndrivers/acpi/arm64/iort.c:1983:\t\tret = platform_device_add_data(pdev, \u0026node, sizeof(node));\ndrivers/acpi/arm64/iort.c-1984-\n--\ndrivers/acpi/arm64/iort.c-2001-\ndrivers/acpi/arm64/iort.c:2002:\tret = platform_device_add(pdev);\ndrivers/acpi/arm64/iort.c-2003-\tif (ret)\n--\ndrivers/acpi/arm64/mpam.c=218=static struct platform_device * __init acpi_mpam_parse_msc(struct acpi_mpam_msc_node *tbl_msc)\n--\ndrivers/acpi/arm64/mpam.c-265-\tWARN_ON_ONCE(next_res \u003e ARRAY_SIZE(res));\ndrivers/acpi/arm64/mpam.c:266:\terr = platform_device_add_resources(pdev, res, next_res);\ndrivers/acpi/arm64/mpam.c-267-\tif (err)\n--\ndrivers/acpi/arm64/mpam.c-289-\t */\ndrivers/acpi/arm64/mpam.c:290:\terr = platform_device_add_data(pdev, tbl_msc, tbl_msc-\u003elength);\ndrivers/acpi/arm64/mpam.c-291-\tif (err)\n--\ndrivers/acpi/arm64/mpam.c-293-\ndrivers/acpi/arm64/mpam.c:294:\terr = platform_device_add(pdev);\ndrivers/acpi/arm64/mpam.c-295-\tif (err)\n--\ndrivers/acpi/dock.c=584=void acpi_dock_add(struct acpi_device *adev)\n--\ndrivers/acpi/dock.c-597-\tpdevinfo.size_data = sizeof(ds);\ndrivers/acpi/dock.c:598:\tdd = platform_device_register_full(\u0026pdevinfo);\ndrivers/acpi/dock.c-599-\tif (IS_ERR(dd))\n--\ndrivers/acpi/x86/lpss.c=398=static inline void lpt_register_clock_device(void)\ndrivers/acpi/x86/lpss.c-399-{\ndrivers/acpi/x86/lpss.c:400:\tlpss_clk_dev = platform_device_register_simple(\"clk-lpss-atom\",\ndrivers/acpi/x86/lpss.c-401-\t\t\t\t\t\t PLATFORM_DEVID_NONE,\n--\ndrivers/acpi/x86/utils.c=568=int acpi_quirk_skip_serdev_enumeration(struct device *controller_parent, bool *skip)\n--\ndrivers/acpi/x86/utils.c-586-\t\t */\ndrivers/acpi/x86/utils.c:587:\t\tplatform_device_register_simple(\"dell-uart-backlight\", PLATFORM_DEVID_NONE,\ndrivers/acpi/x86/utils.c-588-\t\t\t\t\t\tNULL, 0);\n--\ndrivers/ata/pata_legacy.c=233=static __init int legacy_init_one(struct legacy_probe *probe)\n--\ndrivers/ata/pata_legacy.c-250-\ndrivers/ata/pata_legacy.c:251:\tpdev = platform_device_register_simple(DRV_NAME, probe-\u003eslot, NULL, 0);\ndrivers/ata/pata_legacy.c-252-\tif (IS_ERR(pdev))\n--\ndrivers/auxdisplay/cfag12864bfb.c=119=static int __init cfag12864bfb_init(void)\n--\ndrivers/auxdisplay/cfag12864bfb.c-142-\t\tif (cfag12864bfb_device)\ndrivers/auxdisplay/cfag12864bfb.c:143:\t\t\tret = platform_device_add(cfag12864bfb_device);\ndrivers/auxdisplay/cfag12864bfb.c-144-\t\telse\n--\ndrivers/base/platform.c=545=int platform_add_devices(struct platform_device **devs, int num)\n--\ndrivers/base/platform.c-549-\tfor (i = 0; i \u003c num; i++) {\ndrivers/base/platform.c:550:\t\tret = platform_device_register(devs[i]);\ndrivers/base/platform.c-551-\t\tif (ret) {\n--\ndrivers/base/platform.c=597=static void platform_device_release(struct device *dev)\n--\ndrivers/base/platform.c-625- * dev.of_node and dev.fwnode. Users wishing to do the split platform device\ndrivers/base/platform.c:626: * registration with platform_device_alloc() + platform_device_add() are\ndrivers/base/platform.c-627- * required to use dedicated helpers for adding resources, platform data or\n--\ndrivers/base/platform.c=647=EXPORT_SYMBOL_GPL(platform_device_alloc);\n--\ndrivers/base/platform.c-649-/**\ndrivers/base/platform.c:650: * platform_device_add_resources - add resources to a platform device\ndrivers/base/platform.c-651- * @pdev: platform device allocated by platform_device_alloc to add resources to\n--\ndrivers/base/platform.c-658- */\ndrivers/base/platform.c:659:int platform_device_add_resources(struct platform_device *pdev,\ndrivers/base/platform.c-660-\t\t\t\t const struct resource *res, unsigned int num)\n--\ndrivers/base/platform.c-674-}\ndrivers/base/platform.c:675:EXPORT_SYMBOL_GPL(platform_device_add_resources);\ndrivers/base/platform.c-676-\ndrivers/base/platform.c-677-/**\ndrivers/base/platform.c:678: * platform_device_add_data - add platform-specific data to a platform device\ndrivers/base/platform.c-679- * @pdev: platform device allocated by platform_device_alloc to add resources to\n--\ndrivers/base/platform.c-686- */\ndrivers/base/platform.c:687:int platform_device_add_data(struct platform_device *pdev, const void *data,\ndrivers/base/platform.c-688-\t\t\t size_t size)\n--\ndrivers/base/platform.c-701-}\ndrivers/base/platform.c:702:EXPORT_SYMBOL_GPL(platform_device_add_data);\ndrivers/base/platform.c-703-\n--\ndrivers/base/platform.c=766=EXPORT_SYMBOL_GPL(platform_device_set_of_node_from_dev);\n--\ndrivers/base/platform.c-768-/**\ndrivers/base/platform.c:769: * platform_device_add - add a platform device to device hierarchy\ndrivers/base/platform.c-770- * @pdev: platform device we're adding\ndrivers/base/platform.c-771- *\ndrivers/base/platform.c:772: * This is part 2 of platform_device_register(), though may be called\ndrivers/base/platform.c-773- * separately _iff_ pdev was allocated by platform_device_alloc().\ndrivers/base/platform.c-774- */\ndrivers/base/platform.c:775:int platform_device_add(struct platform_device *pdev)\ndrivers/base/platform.c-776-{\n--\ndrivers/base/platform.c-853-}\ndrivers/base/platform.c:854:EXPORT_SYMBOL_GPL(platform_device_add);\ndrivers/base/platform.c-855-\n--\ndrivers/base/platform.c=883=EXPORT_SYMBOL_GPL(platform_device_del);\n--\ndrivers/base/platform.c-885-/**\ndrivers/base/platform.c:886: * platform_device_register - add a platform-level device\ndrivers/base/platform.c-887- * @pdev: platform device we're adding\n--\ndrivers/base/platform.c-892- */\ndrivers/base/platform.c:893:int platform_device_register(struct platform_device *pdev)\ndrivers/base/platform.c-894-{\n--\ndrivers/base/platform.c-896-\tsetup_pdev_dma_masks(pdev);\n\n"
} |
| 41/2 | 2026/11/25 15:25 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 64702 output: 32 thoughts: 166 Thoughts: **Investigating the Reachability of `net/dsa/tag_sdsa.c`** Okay, hold on a second! I've been so focused on X, I completely missed something important. What about `net/dsa/tag_sdsa.c`? Can we actually *get* to that code? Is `sdsa_rcv` or `sdsa_xmit` reachable? I need to figure this out. Right, let's think. My initial thought is to check if syzkaller, or potentially some clever userspace program, could trigger it. But hold on, the more I think about it, the more I realize it's not that simple. To get `sdsa_rcv` running, a specific set of conditions need to be met. We're talking about a network packet needing to arrive on a DSA conduit interface that is bound to a DSA switch, and that specific interface needs to be using `DSA_TAG_PROTO_SDSA`. That's the primary path, I assume. But, are there other ways? Is there some backdoor, some other packet path to `sdsa_rcv` that I haven't considered? I need to broaden my scope. Let's see how `dsa_pack_type` handles incoming packets. That seems like a good place to start. I'll need to grep the `net/dsa/` directory for any references to `dsa_pack_type` and see where that leads. Gotta follow the data flow. |
| 42/2 | 2026/11/25 15:25 | tool | grepper |
0mArgs:{
"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"
} |
| 43/2 | 2026/11/25 15:25 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 65724 output: 35 thoughts: 33 Thoughts: Here's my analysis of the provided thought process, tailored for an expert audience: **Analyzing the `dsa_switch_rcv` Function in `net/dsa/tag.c`** Okay, so the initial thought is to dive into `net/dsa/tag.c` around line 54 and figure out what's happening within `dsa_switch_rcv`. This likely means we're looking to understand the core receive path for tagged frames within a Distributed Switch Architecture (DSA) context. Given my background, I'm expecting this function to be the entry point for handling frames that have been marked with a specific DSA tagging format. The line number suggests it's likely a relatively early step in the processing, possibly a demuxing function or initial validation point. I'll need to look closely at how the tagging information is extracted, how the frame is then routed or passed along, and what kind of checks are performed on the inbound data. I anticipate seeing things like VLAN tag extraction, port identification, and perhaps some initial classification based on the DSA tag format (e.g., how the hardware is configured to parse the data). I'm also ready to analyze the interactions with other DSA subsystems (like the DSA bridge) that would handle the frame's further processing based on the extracted information. I'm keen to see if any hardware offload capabilities are being used as well. |
| 44/2 | 2026/11/25 15:26 | tool | read-file |
0mArgs:{
"File": "net/dsa/tag.c",
"FirstLine": 54,
"LineCount": 75
}Results: {
"Contents": " 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_unclone_full(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"
} |
| 45/2 | 2026/11/25 15:26 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 67217 output: 30 thoughts: 92 Thoughts: Here's my thought process, as it stands: **Debugging the DSA Conduit Interaction** Okay, so `dev->dsa_ptr` is *the* pointer. The one set on the DSA conduit when a DSA switch is registered and bound to the conduit. Got it. And that `nskb = cpu_dp->rcv(skb, dev);` call? That only happens if `dev->dsa_ptr` is actually set. It's a key conditional. Now, the million dollar question: how does `dev->dsa_ptr` *get* set in the first place? I need to track down the assignment. Right, time to reach for the trusty grep. Let's find all the instances of `dev->dsa_ptr` in the codebase. That should quickly reveal where this critical pointer is being initialized. This is going to be the lynchpin to understanding this entire flow. |
| 46/2 | 2026/11/25 15:26 | tool | grepper |
0mArgs:{
"Expression": "dsa_ptr",
"PathPrefixes": [
"net/dsa/"
]
}Results: {
"Output": "\nFull output is too long, showing 200 out of 203 lines.\nUse more precise expression or PathPrefixes if possible.\n\nNumber of matching lines per file (10 files in total):\nnet/dsa/conduit.c:14\nnet/dsa/dsa.c:4\nnet/dsa/port.c:1\nnet/dsa/tag.c:1\nnet/dsa/tag.h:2\nnet/dsa/tag_8021q.c:1\nnet/dsa/tag_dsa.c:1\nnet/dsa/tag_qca.c:1\nnet/dsa/tag_sja1105.c:1\nnet/dsa/user.c:12\n\nnet/dsa/conduit.c=20=static int dsa_conduit_get_regs_len(struct net_device *dev)\nnet/dsa/conduit.c-21-{\nnet/dsa/conduit.c:22:\tstruct dsa_port *cpu_dp = dev-\u003edsa_ptr;\nnet/dsa/conduit.c-23-\tconst struct ethtool_ops *ops = cpu_dp-\u003eorig_ethtool_ops;\n--\nnet/dsa/conduit.c=49=static void dsa_conduit_get_regs(struct net_device *dev,\n--\nnet/dsa/conduit.c-51-{\nnet/dsa/conduit.c:52:\tstruct dsa_port *cpu_dp = dev-\u003edsa_ptr;\nnet/dsa/conduit.c-53-\tconst struct ethtool_ops *ops = cpu_dp-\u003eorig_ethtool_ops;\n--\nnet/dsa/conduit.c=102=static void dsa_conduit_get_ethtool_stats(struct net_device *dev,\n--\nnet/dsa/conduit.c-105-{\nnet/dsa/conduit.c:106:\tstruct dsa_port *dp, *cpu_dp = dev-\u003edsa_ptr;\nnet/dsa/conduit.c-107-\tconst struct ethtool_ops *ops = cpu_dp-\u003eorig_ethtool_ops;\n--\nnet/dsa/conduit.c=129=static void dsa_conduit_get_ethtool_phy_stats(struct net_device *dev,\n--\nnet/dsa/conduit.c-132-{\nnet/dsa/conduit.c:133:\tstruct dsa_port *cpu_dp = dev-\u003edsa_ptr;\nnet/dsa/conduit.c-134-\tconst struct ethtool_ops *ops = cpu_dp-\u003eorig_ethtool_ops;\n--\nnet/dsa/conduit.c=162=static int dsa_conduit_get_sset_count(struct net_device *dev, int sset)\nnet/dsa/conduit.c-163-{\nnet/dsa/conduit.c:164:\tstruct dsa_port *dp, *cpu_dp = dev-\u003edsa_ptr;\nnet/dsa/conduit.c-165-\tconst struct ethtool_ops *ops = cpu_dp-\u003eorig_ethtool_ops;\n--\nnet/dsa/conduit.c=222=static void dsa_conduit_get_strings(struct net_device *dev, u32 stringset,\n--\nnet/dsa/conduit.c-224-{\nnet/dsa/conduit.c:225:\tstruct dsa_port *dp, *cpu_dp = dev-\u003edsa_ptr;\nnet/dsa/conduit.c-226-\tconst struct ethtool_ops *ops = cpu_dp-\u003eorig_ethtool_ops;\n--\nnet/dsa/conduit.c=261=int __dsa_conduit_hwtstamp_validate(struct net_device *dev,\n--\nnet/dsa/conduit.c-264-{\nnet/dsa/conduit.c:265:\tstruct dsa_port *cpu_dp = dev-\u003edsa_ptr;\nnet/dsa/conduit.c-266-\tstruct dsa_switch *ds = cpu_dp-\u003eds;\n--\nnet/dsa/conduit.c=283=static int dsa_conduit_ethtool_setup(struct net_device *dev)\nnet/dsa/conduit.c-284-{\nnet/dsa/conduit.c:285:\tstruct dsa_port *cpu_dp = dev-\u003edsa_ptr;\nnet/dsa/conduit.c-286-\tstruct dsa_switch *ds = cpu_dp-\u003eds;\n--\nnet/dsa/conduit.c=312=static void dsa_conduit_ethtool_teardown(struct net_device *dev)\nnet/dsa/conduit.c-313-{\nnet/dsa/conduit.c:314:\tstruct dsa_port *cpu_dp = dev-\u003edsa_ptr;\nnet/dsa/conduit.c-315-\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=340=static ssize_t tagging_show(struct device *d, struct device_attribute *attr,\n--\nnet/dsa/conduit.c-343-\tstruct net_device *dev = to_net_dev(d);\nnet/dsa/conduit.c:344:\tstruct dsa_port *cpu_dp = dev-\u003edsa_ptr;\nnet/dsa/conduit.c-345-\n--\nnet/dsa/conduit.c=350=static ssize_t tagging_store(struct device *d, struct device_attribute *attr,\n--\nnet/dsa/conduit.c-355-\tstruct net_device *dev = to_net_dev(d);\nnet/dsa/conduit.c:356:\tstruct dsa_port *cpu_dp = dev-\u003edsa_ptr;\nnet/dsa/conduit.c-357-\tsize_t len = end - buf;\n--\nnet/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=1029=static void dsa_tree_conduit_state_change(struct dsa_switch_tree *dst,\n--\nnet/dsa/dsa.c-1032-\tstruct dsa_notifier_conduit_state_info info;\nnet/dsa/dsa.c:1033:\tstruct dsa_port *cpu_dp = conduit-\u003edsa_ptr;\nnet/dsa/dsa.c-1034-\n--\nnet/dsa/dsa.c=1041=void dsa_tree_conduit_admin_state_change(struct dsa_switch_tree *dst,\n--\nnet/dsa/dsa.c-1044-{\nnet/dsa/dsa.c:1045:\tstruct dsa_port *cpu_dp = conduit-\u003edsa_ptr;\nnet/dsa/dsa.c-1046-\tbool notify = false;\n--\nnet/dsa/dsa.c=1064=void dsa_tree_conduit_oper_state_change(struct dsa_switch_tree *dst,\n--\nnet/dsa/dsa.c-1067-{\nnet/dsa/dsa.c:1068:\tstruct dsa_port *cpu_dp = conduit-\u003edsa_ptr;\nnet/dsa/dsa.c-1069-\tbool notify = false;\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/port.c=1397=static int dsa_port_assign_conduit(struct dsa_port *dp,\n--\nnet/dsa/port.c-1412-\nnet/dsa/port.c:1413:\tdp-\u003ecpu_dp = conduit-\u003edsa_ptr;\nnet/dsa/port.c-1414-\tdp-\u003ecpu_port_in_lag = netif_is_lag_master(conduit);\n--\nnet/dsa/tag.c=54=static int dsa_switch_rcv(struct sk_buff *skb, struct net_device *dev,\n--\nnet/dsa/tag.c-57-\tstruct metadata_dst *md_dst = skb_metadata_dst(skb);\nnet/dsa/tag.c:58:\tstruct dsa_port *cpu_dp = dev-\u003edsa_ptr;\nnet/dsa/tag.c-59-\tstruct sk_buff *nskb = NULL;\n--\nnet/dsa/tag.h=32=static inline struct net_device *dsa_conduit_find_user(struct net_device *dev,\n--\nnet/dsa/tag.h-34-{\nnet/dsa/tag.h:35:\tstruct dsa_port *cpu_dp = dev-\u003edsa_ptr;\nnet/dsa/tag.h-36-\tstruct dsa_switch_tree *dst = cpu_dp-\u003edst;\n--\nnet/dsa/tag.h=191=dsa_find_designated_bridge_port_by_vid(struct net_device *conduit, u16 vid)\nnet/dsa/tag.h-192-{\nnet/dsa/tag.h:193:\tstruct dsa_port *cpu_dp = conduit-\u003edsa_ptr;\nnet/dsa/tag.h-194-\tstruct dsa_switch_tree *dst = cpu_dp-\u003edst;\n--\nnet/dsa/tag_8021q.c=475=dsa_tag_8021q_find_port_by_vbid(struct net_device *conduit, int vbid)\nnet/dsa/tag_8021q.c-476-{\nnet/dsa/tag_8021q.c:477:\tstruct dsa_port *cpu_dp = conduit-\u003edsa_ptr;\nnet/dsa/tag_8021q.c-478-\tstruct dsa_switch_tree *dst = cpu_dp-\u003edst;\n--\nnet/dsa/tag_dsa.c=201=static struct sk_buff *dsa_rcv_ll(struct sk_buff *skb, struct net_device *dev,\n--\nnet/dsa/tag_dsa.c-262-\tif (trunk) {\nnet/dsa/tag_dsa.c:263:\t\tstruct dsa_port *cpu_dp = dev-\u003edsa_ptr;\nnet/dsa/tag_dsa.c-264-\t\tstruct dsa_lag *lag;\n--\nnet/dsa/tag_qca.c=35=static struct sk_buff *qca_tag_rcv(struct sk_buff *skb, struct net_device *dev)\n--\nnet/dsa/tag_qca.c-37-\tstruct qca_tagger_data *tagger_data;\nnet/dsa/tag_qca.c:38:\tstruct dsa_port *dp = dev-\u003edsa_ptr;\nnet/dsa/tag_qca.c-39-\tstruct dsa_switch *ds = dp-\u003eds;\n--\nnet/dsa/tag_sja1105.c=529=static struct sk_buff *sja1110_rcv_meta(struct sk_buff *skb, u16 rx_header)\n--\nnet/dsa/tag_sja1105.c-539-\nnet/dsa/tag_sja1105.c:540:\tcpu_dp = conduit-\u003edsa_ptr;\nnet/dsa/tag_sja1105.c-541-\tds = dsa_switch_find(cpu_dp-\u003edst-\u003eindex, switch_id);\n--\nnet/dsa/user.c=3210=static int dsa_lag_conduit_validate(struct net_device *lag_dev,\n--\nnet/dsa/user.c-3227-\nnet/dsa/user.c:3228:\t\t\tif (!dsa_port_tree_same(lower1-\u003edsa_ptr,\nnet/dsa/user.c:3229:\t\t\t\t\t\tlower2-\u003edsa_ptr)) {\nnet/dsa/user.c-3230-\t\t\t\tNL_SET_ERR_MSG_MOD(extack,\n--\nnet/dsa/user.c=3274=dsa_lag_conduit_prechangelower_sanity_check(struct net_device *dev,\n--\nnet/dsa/user.c-3294-\tnetdev_for_each_lower_dev(lag_dev, lower, iter) {\nnet/dsa/user.c:3295:\t\tif (!dsa_port_tree_same(dev-\u003edsa_ptr, lower-\u003edsa_ptr)) {\nnet/dsa/user.c-3296-\t\t\tNL_SET_ERR_MSG(extack,\n--\nnet/dsa/user.c=3367=static int dsa_conduit_lag_join(struct net_device *conduit,\n--\nnet/dsa/user.c-3371-{\nnet/dsa/user.c:3372:\tstruct dsa_port *cpu_dp = conduit-\u003edsa_ptr;\nnet/dsa/user.c-3373-\tstruct dsa_switch_tree *dst = cpu_dp-\u003edst;\n--\nnet/dsa/user.c-3404-\nnet/dsa/user.c:3405:\tdsa_conduit_lag_teardown(lag_dev, conduit-\u003edsa_ptr);\nnet/dsa/user.c-3406-\n--\nnet/dsa/user.c=3410=static void dsa_conduit_lag_leave(struct net_device *conduit,\n--\nnet/dsa/user.c-3412-{\nnet/dsa/user.c:3413:\tstruct dsa_port *dp, *cpu_dp = lag_dev-\u003edsa_ptr;\nnet/dsa/user.c-3414-\tstruct dsa_switch_tree *dst = cpu_dp-\u003edst;\n--\nnet/dsa/user.c-3420-\t\tif (netdev_uses_dsa(lower)) {\nnet/dsa/user.c:3421:\t\t\tnew_cpu_dp = lower-\u003edsa_ptr;\nnet/dsa/user.c-3422-\t\t\tbreak;\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--\nnet/dsa/user.c-3448-\t */\nnet/dsa/user.c:3449:\tdsa_conduit_lag_teardown(lag_dev, conduit-\u003edsa_ptr);\nnet/dsa/user.c-3450-}\n--\nnet/dsa/user.c=3477=static int dsa_user_netdevice_event(struct notifier_block *nb,\n--\nnet/dsa/user.c-3544-\t\tif (netdev_uses_dsa(dev)) {\nnet/dsa/user.c:3545:\t\t\tdp = dev-\u003edsa_ptr;\nnet/dsa/user.c-3546-\n--\nnet/dsa/user.c-3558-\t\tif (netdev_uses_dsa(dev)) {\nnet/dsa/user.c:3559:\t\t\tstruct dsa_port *cpu_dp = dev-\u003edsa_ptr;\nnet/dsa/user.c-3560-\t\t\tstruct dsa_switch_tree *dst = cpu_dp-\u003eds-\u003edst;\n--\n\n"
} |
| 47/2 | 2026/11/25 15:26 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 71968 output: 32 thoughts: 396 Thoughts: **My Line of Reasoning** Okay, so `dev->dsa_ptr` is *only* set within `dsa_conduit_setup`, and that function is *exclusively* called when a DSA switch is registered and its CPU port is configured. Furthermore, `dsa_register_switch` is the sole caller of `dsa_conduit_setup` and is only invoked by DSA switch drivers. My main question is: can `soce-swip.c` even be instantiated in this context? It's an OF (device tree) platform driver, meaning it relies on device tree information. I see the compatible string "soce,swip-switch-00-04-0c-10" defined within the driver's OF match table. The real question is: can *any* OF platform driver even be instantiated on an amd64 (x86_64) architecture in QEMU? Wait a minute, what architecture are we targeting? Ah, it says "Target architecture: amd64," which makes me pause. Can `CONFIG_OF` even be enabled or relevant on amd64 in this setup? I've got to check some dependencies. Let's check the `drivers/net/dsa/Kconfig` file. I see `config NET_DSA_SOCE_SWIP` which depends on `NET_DSA`, `OF`, and `HAS_IOMEM`, with a few `select` statements too. But here's the crucial point: it *depends on* `OF`! This brings me back to the core question: does x86 have Device Tree support, which is what `OF` refers to? Let me quickly cross-reference `arch/x86/Kconfig` to see if there's a `select OF` or direct mention of `OF`... I need to determine if Device Tree is actually something used on x86, or if it's primarily an ARM or PowerPC thing. This will determine if the configuration options are valid or not. |
| 48/2 | 2026/11/25 15:26 | tool | grepper |
0mArgs:{
"Expression": "\\bOF\\b",
"PathPrefixes": [
"arch/x86/"
]
}Results: {
"Output": "arch/x86/Kconfig=666=config X86_INTEL_CE\n--\narch/x86/Kconfig-673-\tselect X86_REBOOTFIXUPS\narch/x86/Kconfig:674:\tselect OF\narch/x86/Kconfig-675-\tselect OF_EARLY_FLATTREE\n--\narch/x86/Kconfig=1506=config NUMA\n--\narch/x86/Kconfig-1510-\tselect USE_PERCPU_NUMA_NODE_ID\narch/x86/Kconfig:1511:\tselect OF_NUMA if OF\narch/x86/Kconfig-1512-\thelp\n--\narch/x86/Kconfig=2992=config OLPC\n--\narch/x86/Kconfig-2996-\tselect GPIOLIB_LEGACY\narch/x86/Kconfig:2997:\tselect OF\narch/x86/Kconfig-2998-\tselect OF_PROMTREE\n--\narch/x86/crypto/aes-gcm-aesni-x86_64.S-20-// distributed under the License is distributed on an \"AS IS\" BASIS,\narch/x86/crypto/aes-gcm-aesni-x86_64.S:21:// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\narch/x86/crypto/aes-gcm-aesni-x86_64.S-22-// See the License for the specific language governing permissions and\n--\narch/x86/crypto/aes-gcm-aesni-x86_64.S-38-// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\narch/x86/crypto/aes-gcm-aesni-x86_64.S:39:// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\narch/x86/crypto/aes-gcm-aesni-x86_64.S-40-// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE\narch/x86/crypto/aes-gcm-aesni-x86_64.S-41-// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\narch/x86/crypto/aes-gcm-aesni-x86_64.S:42:// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\narch/x86/crypto/aes-gcm-aesni-x86_64.S:43:// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\narch/x86/crypto/aes-gcm-aesni-x86_64.S:44:// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\narch/x86/crypto/aes-gcm-aesni-x86_64.S-45-// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\narch/x86/crypto/aes-gcm-aesni-x86_64.S:46:// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\narch/x86/crypto/aes-gcm-aesni-x86_64.S:47:// POSSIBILITY OF SUCH DAMAGE.\narch/x86/crypto/aes-gcm-aesni-x86_64.S-48-//\n--\narch/x86/crypto/aes-gcm-vaes-avx2.S-21-// distributed under the License is distributed on an \"AS IS\" BASIS,\narch/x86/crypto/aes-gcm-vaes-avx2.S:22:// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\narch/x86/crypto/aes-gcm-vaes-avx2.S-23-// See the License for the specific language governing permissions and\n--\narch/x86/crypto/aes-gcm-vaes-avx2.S-39-// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\narch/x86/crypto/aes-gcm-vaes-avx2.S:40:// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\narch/x86/crypto/aes-gcm-vaes-avx2.S-41-// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE\narch/x86/crypto/aes-gcm-vaes-avx2.S-42-// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\narch/x86/crypto/aes-gcm-vaes-avx2.S:43:// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\narch/x86/crypto/aes-gcm-vaes-avx2.S:44:// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\narch/x86/crypto/aes-gcm-vaes-avx2.S:45:// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\narch/x86/crypto/aes-gcm-vaes-avx2.S-46-// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\narch/x86/crypto/aes-gcm-vaes-avx2.S:47:// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\narch/x86/crypto/aes-gcm-vaes-avx2.S:48:// POSSIBILITY OF SUCH DAMAGE.\narch/x86/crypto/aes-gcm-vaes-avx2.S-49-//\n--\narch/x86/crypto/aes-gcm-vaes-avx512.S-21-// distributed under the License is distributed on an \"AS IS\" BASIS,\narch/x86/crypto/aes-gcm-vaes-avx512.S:22:// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\narch/x86/crypto/aes-gcm-vaes-avx512.S-23-// See the License for the specific language governing permissions and\n--\narch/x86/crypto/aes-gcm-vaes-avx512.S-39-// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\narch/x86/crypto/aes-gcm-vaes-avx512.S:40:// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\narch/x86/crypto/aes-gcm-vaes-avx512.S-41-// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE\narch/x86/crypto/aes-gcm-vaes-avx512.S-42-// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\narch/x86/crypto/aes-gcm-vaes-avx512.S:43:// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\narch/x86/crypto/aes-gcm-vaes-avx512.S:44:// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\narch/x86/crypto/aes-gcm-vaes-avx512.S:45:// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\narch/x86/crypto/aes-gcm-vaes-avx512.S-46-// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\narch/x86/crypto/aes-gcm-vaes-avx512.S:47:// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\narch/x86/crypto/aes-gcm-vaes-avx512.S:48:// POSSIBILITY OF SUCH DAMAGE.\narch/x86/crypto/aes-gcm-vaes-avx512.S-49-\n--\narch/x86/include/asm/xen/cpuid.h-15- *\narch/x86/include/asm/xen/cpuid.h:16: * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\narch/x86/include/asm/xen/cpuid.h:17: * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\narch/x86/include/asm/xen/cpuid.h-18- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\narch/x86/include/asm/xen/cpuid.h-19- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\narch/x86/include/asm/xen/cpuid.h:20: * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\narch/x86/include/asm/xen/cpuid.h:21: * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER\narch/x86/include/asm/xen/cpuid.h-22- * DEALINGS IN THE SOFTWARE.\n--\narch/x86/include/asm/xen/hypercall.h-23- *\narch/x86/include/asm/xen/hypercall.h:24: * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\narch/x86/include/asm/xen/hypercall.h:25: * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\narch/x86/include/asm/xen/hypercall.h-26- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\narch/x86/include/asm/xen/hypercall.h-27- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\narch/x86/include/asm/xen/hypercall.h:28: * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\narch/x86/include/asm/xen/hypercall.h:29: * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS\narch/x86/include/asm/xen/hypercall.h-30- * IN THE SOFTWARE.\n--\narch/x86/include/asm/xen/hypervisor.h-23- *\narch/x86/include/asm/xen/hypervisor.h:24: * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\narch/x86/include/asm/xen/hypervisor.h:25: * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\narch/x86/include/asm/xen/hypervisor.h-26- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\narch/x86/include/asm/xen/hypervisor.h-27- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\narch/x86/include/asm/xen/hypervisor.h:28: * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\narch/x86/include/asm/xen/hypervisor.h:29: * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS\narch/x86/include/asm/xen/hypervisor.h-30- * IN THE SOFTWARE.\n--\narch/x86/include/asm/xen/interface.h-15- *\narch/x86/include/asm/xen/interface.h:16: * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\narch/x86/include/asm/xen/interface.h:17: * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\narch/x86/include/asm/xen/interface.h-18- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\narch/x86/include/asm/xen/interface.h-19- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\narch/x86/include/asm/xen/interface.h:20: * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\narch/x86/include/asm/xen/interface.h:21: * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER\narch/x86/include/asm/xen/interface.h-22- * DEALINGS IN THE SOFTWARE.\n--\narch/x86/include/uapi/asm/svm.h-169-\t{ SVM_EXIT_EXCP_BASE + BP_VECTOR, \"BP excp\" }, \\\narch/x86/include/uapi/asm/svm.h:170:\t{ SVM_EXIT_EXCP_BASE + OF_VECTOR, \"OF excp\" }, \\\narch/x86/include/uapi/asm/svm.h-171-\t{ SVM_EXIT_EXCP_BASE + BR_VECTOR, \"BR excp\" }, \\\n--\narch/x86/kernel/devicetree.c-2-/*\narch/x86/kernel/devicetree.c:3: * Architecture specific OF callbacks.\narch/x86/kernel/devicetree.c-4- */\n--\narch/x86/kernel/devicetree.c=303=static void __init dtb_ioapic_setup(void)\n--\narch/x86/kernel/devicetree.c-313-\t}\narch/x86/kernel/devicetree.c:314:\tpr_err(\"Error: No information about IO-APIC in OF.\\n\");\narch/x86/kernel/devicetree.c-315-}\n--\narch/x86/kernel/relocate_kernel_64.S=522=SYM_CODE_START_NOALIGN(kexec_debug_exc_vectors)\n--\narch/x86/kernel/relocate_kernel_64.S-545-\tvec_noerr 3 // #BP\narch/x86/kernel/relocate_kernel_64.S:546:\tvec_noerr 4 // #OF\narch/x86/kernel/relocate_kernel_64.S-547-\tvec_noerr 5 // #BR\n--\narch/x86/kernel/uprobes.c=1353=static bool branch_is_call(struct arch_uprobe *auprobe)\n--\narch/x86/kernel/uprobes.c-1358-#define CASE_COND\t\t\t\t\t\\\narch/x86/kernel/uprobes.c:1359:\tCOND(70, 71, XF(OF))\t\t\t\t\\\narch/x86/kernel/uprobes.c-1360-\tCOND(72, 73, XF(CF))\t\t\t\t\\\n--\narch/x86/kernel/uprobes.c-1364-\tCOND(76, 77, XF(CF) || XF(ZF))\t\t\t\\\narch/x86/kernel/uprobes.c:1365:\tCOND(7c, 7d, XF(SF) != XF(OF))\t\t\t\\\narch/x86/kernel/uprobes.c:1366:\tCOND(7e, 7f, XF(ZF) || XF(SF) != XF(OF))\narch/x86/kernel/uprobes.c-1367-\n--\narch/x86/kvm/i8254.c-19- *\narch/x86/kvm/i8254.c:20: * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\narch/x86/kvm/i8254.c:21: * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\narch/x86/kvm/i8254.c-22- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL\narch/x86/kvm/i8254.c-23- * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\narch/x86/kvm/i8254.c:24: * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\narch/x86/kvm/i8254.c:25: * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\narch/x86/kvm/i8254.c-26- * THE SOFTWARE.\n--\narch/x86/kvm/i8259.c-17- *\narch/x86/kvm/i8259.c:18: * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\narch/x86/kvm/i8259.c:19: * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\narch/x86/kvm/i8259.c-20- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL\narch/x86/kvm/i8259.c-21- * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\narch/x86/kvm/i8259.c:22: * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\narch/x86/kvm/i8259.c:23: * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\narch/x86/kvm/i8259.c-24- * THE SOFTWARE.\n--\narch/x86/kvm/trace.h=439=TRACE_EVENT(kvm_inj_virq,\n--\narch/x86/kvm/trace.h-462-#define kvm_trace_sym_exc\t\t\t\t\t\t\\\narch/x86/kvm/trace.h:463:\tEXS(DE), EXS(DB), EXS(BP), EXS(OF), EXS(BR), EXS(UD), EXS(NM),\t\\\narch/x86/kvm/trace.h-464-\tEXS(DF), EXS(TS), EXS(NP), EXS(SS), EXS(GP), EXS(PF), EXS(MF),\t\\\n"
} |
| 49/2 | 2026/11/25 15:26 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 77309 output: 24 thoughts: 622 Thoughts: **Analyzing Reachability of FPGA-Specific Code for Fuzzing** Okay, let's break this down. I need to figure out if I can effectively fuzz code related to this "soce,swip" device. First, I'm thinking about the prerequisites. `CONFIG_OF` seems like a key piece. It's normally x86-specific for OLPC or `X86_INTEL_CE` – 32-bit stuff. But wait, digging into `drivers/of/Kconfig`, it looks like `OF` can be manually selected in menuconfig, and it doesn't *depend on* the architecture. So, theoretically, `CONFIG_OF` could be enabled on amd64. That's good to know. However, even if `CONFIG_OF` *is* enabled, the real question is how this "soce,swip" device comes into existence. It's a platform device with a specific "compatible" string, pointing to a memory-mapped FPGA IP core. Okay, that makes it clearer. It's essentially at a *physical* memory address, like 0x80020000 on a Zynq or similar SoC. The issue is virtualization. Can this be emulated in standard environments like GCE or QEMU? And that's the kicker, isn't it? Standard QEMU doesn't have a "soce,swip" device model. That takes me to the reachability guidelines. "REACHABILITY IS THE PRIMARY GATE." Right. I can only fuzz code that *actually* executes in standard virtualized environments. This "soce,swip" thing is structurally unreachable. Vendor-specific hardware or drivers that require a physical ASIC or PCIe card not emulated in QEMU are out. And that includes things like this FPGA. So the main question becomes, is *all* the code associated with this FPGA core unreachable, or can parts of it be reached without the specific hardware? What about `net/dsa/tag_sdsa.c`? Can *that* be reached independently? Can I create a DSA switch that uses `DSA_TAG_PROTO_SDSA` *without* the physical FPGA? Can I do that in QEMU or GCE? Need to check all the DSA drivers... I better list all the drivers in `drivers/net/dsa/` and look into this. |
| 50/2 | 2026/11/25 15:26 | tool | codesearch-dir-index |
0mArgs:{
"Dir": "drivers/net/dsa"
}Results: {
"Files": [
"bcm_sf2.c",
"bcm_sf2.h",
"bcm_sf2_cfp.c",
"bcm_sf2_regs.h",
"dsa_loop.c",
"lan9303-core.c",
"lan9303.h",
"lan9303_i2c.c",
"lan9303_mdio.c",
"mt7530-mdio.c",
"mt7530-mmio.c",
"mt7530.c",
"mt7530.h",
"mt7628.c",
"mv88e6060.c",
"mv88e6060.h",
"rzn1_a5psw.c",
"rzn1_a5psw.h",
"soce-swip.c",
"soce-swip.h",
"vitesse-vsc73xx-core.c",
"vitesse-vsc73xx-platform.c",
"vitesse-vsc73xx-spi.c",
"vitesse-vsc73xx.h"
],
"Subdirs": [
"b53",
"hirschmann",
"lantiq",
"microchip",
"motorcomm",
"mv88e6xxx",
"mxl862xx",
"netc",
"ocelot",
"qca",
"realtek",
"sja1105",
"xrs700x"
]
} |
| 51/2 | 2026/11/25 15:26 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 78860 output: 20 thoughts: 616 Thoughts: **Analyzing the DSA Loop Driver's Tagging Protocol Capabilities** Okay, hold on a second! I need to re-examine `dsa_loop.c`. Let's confirm that it's correctly loaded and probeable. Specifically, I'm thinking about `dsa_loop_create_switch_mdiodev()`. I see the static data structure, the port names, and the assignment to "fixed-0". That seems right. But, a critical point: how does `dsa_loop` handle tagging protocols? I recall `dsa_loop_get_protocol` returns `DSA_TAG_PROTO_NONE`. The question now is: can we *change* the tag protocol to `DSA_TAG_PROTO_SDSA` using `dsa_loop`? I need to check the `dsa_loop_driver` structure again, specifically for the `.change_tag_protocol` function pointer. Aha! It's *not* present. That makes it clear. If there's no `change_tag_protocol` function pointer in the `dsa_loop_driver`, then any attempt to write to `/sys/class/net/<conduit>/dsa/tagging` with `dsa_loop` will inevitably return `-EOPNOTSUPP`. That's because the `dsa_switch_change_tag_proto` function explicitly checks for the existence of that function pointer. It just returns "operation not supported" if this field is null. But...wait a minute. I have to go back to the documentation. I distinctly remember something in `Documentation/networking/dsa/dsa.rst` about the `dsa_loop` mockup driver. It said something about *desirability* – "It is *desirable* that all tagging protocols are testable with the `dsa_loop` mockup driver". Okay, this means it's an aspirational statement, not a fact. It's not necessarily indicating that this *is* supported; instead, that the authors *want* this driver to be capable of testing all tagging protocols. So, the next logical step is to confirm this, by checking if `dsa_loop` *ever* supported changing the tag protocol, or if that's purely a desired feature. I need to search the Git history and the code itself for any instances of `dsa_loop` and `change_tag_protocol` together to find out. |
| 52/2 | 2026/11/25 15:26 | tool | grepper |
0mArgs:{
"Expression": "dsa_loop.*tag"
}Results: {
"Output": "no matches"
} |
| 53/2 | 2026/11/25 15:26 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 80031 output: 20 thoughts: 107 Thoughts: **Investigating SDSA Tag Protocol Support** Okay, let's dive in. My immediate thought is to determine if any of the existing drivers can handle a tag protocol change to `DSA_TAG_PROTO_SDSA`. That's the core question here. My strategy, as always, is to be thorough. I'll need to locate every instance where the `.change_tag_protocol` function is implemented within the kernel source code. I need to be sure I haven't missed anything. Ah, I've got a list! It looks like we've got three functions showing up: `mv88e6xxx_change_tag_protocol`, `felix_change_tag_protocol`, and `rtl8365mb_change_tag_protocol`. Excellent. Now, the real work begins. I'll need to carefully inspect the logic within each of those functions to understand their capabilities and how well they might align with, or need to be adapted for, this specific SDSA protocol. Each implementation will need a close, critical look. Let's see what we can find. |
| 54/2 | 2026/11/25 15:26 | tool | grepper |
0mArgs:{
"Expression": "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/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=1694=static int felix_setup(struct dsa_switch *ds)\n--\ndrivers/net/dsa/ocelot/felix.c-1749-\t */\ndrivers/net/dsa/ocelot/felix.c:1750:\tfelix_change_tag_protocol(ds, felix-\u003etag_proto);\ndrivers/net/dsa/ocelot/felix.c-1751-\n--\ndrivers/net/dsa/realtek/rtl8365mb_main.c=2999=static int rtl8365mb_cpu_config(struct realtek_priv *priv)\n--\ndrivers/net/dsa/realtek/rtl8365mb_main.c-3027-\ndrivers/net/dsa/realtek/rtl8365mb_main.c:3028:static int rtl8365mb_change_tag_protocol(struct dsa_switch *ds,\ndrivers/net/dsa/realtek/rtl8365mb_main.c-3029-\t\t\t\t\t enum dsa_tag_protocol proto)\n--\nnet/dsa/dsa.c=570=static int dsa_switch_setup_tag_protocol(struct dsa_switch *ds)\n--\nnet/dsa/dsa.c-579-\trtnl_lock();\nnet/dsa/dsa.c:580:\terr = ds-\u003eops-\u003echange_tag_protocol(ds, tag_ops-\u003eproto);\nnet/dsa/dsa.c-581-\trtnl_unlock();\n--\nnet/dsa/switch.c=873=static int dsa_switch_change_tag_proto(struct dsa_switch *ds,\n--\nnet/dsa/switch.c-884-\nnet/dsa/switch.c:885:\terr = ds-\u003eops-\u003echange_tag_protocol(ds, tag_ops-\u003eproto);\nnet/dsa/switch.c-886-\tif (err)\n"
} |
| 55/2 | 2026/11/25 15:26 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 81220 output: 46 thoughts: 43 Thoughts: Okay, here's my take on those functions, as if I were thinking it through: **Analyzing Tag Protocol Changes in Switch Drivers** Right, let's dive into these functions. Specifically, I need to understand how the tag protocol is being altered within the context of these different switch driver implementations: `mv88e6xxx_change_tag_protocol`, `felix_change_tag_protocol`, and `rtl8365mb_change_tag_protocol`. This is critical. Understanding the nuances of how each driver handles this is going to be key to any cross-driver analysis or potential generalizations I want to make. I need to see if there are any core common patterns, or if each vendor is doing something wildly different. Are they adhering to some standards-based approach, or are they going completely proprietary here? Is the underlying switch hardware architecture influencing the strategy here? I need to analyze the specific data structures and registers being modified, and understand the implications of those modifications. I will compare and contrast their approaches: do they configure specific registers, manipulate descriptors, or perhaps utilize some kind of vendor-specific control commands? Ultimately, my goal is to abstract the essence of this protocol change and see how robust, or brittle, each implementation might be. |
| 56/2 | 2026/11/25 15:27 | tool | read-file |
0mArgs:{
"File": "drivers/net/dsa/mv88e6xxx/chip.c",
"FirstLine": 6724,
"LineCount": 20
}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;\n"
} |
| 57/2 | 2026/11/25 15:27 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 81906 output: 43 thoughts: 46 Thoughts: Okay, here's my take on those thoughts, framed as an expert's internal monologue: **Investigating Switch Support** Right, so the mv88e6xxx driver is *supposed* to be limited to EDSA and DSA switch architectures, which is a known fact and I understand its implications. But, wait, that doesn't feel right. I could swear there was some interaction with other types... What about the felix platform? Let me quickly cross-reference that. I need to get into the code. Time to check `drivers/net/dsa/ocelot/felix.c`, and specifically around line 754. Gotta refresh my memory and see how that integration is handled, especially the nuances of the interaction of these architectures. |
| 58/2 | 2026/11/25 15:27 | tool | read-file |
0mArgs:{
"File": "drivers/net/dsa/ocelot/felix.c",
"FirstLine": 754,
"LineCount": 20
}Results: {
"Contents": " 754:\tstatic int felix_change_tag_protocol(struct dsa_switch *ds,\n 755:\t\t\t\t\t enum dsa_tag_protocol proto)\n 756:\t{\n 757:\t\tconst struct felix_tag_proto_ops *old_proto_ops, *proto_ops;\n 758:\t\tstruct ocelot *ocelot = ds-\u003epriv;\n 759:\t\tstruct felix *felix = ocelot_to_felix(ocelot);\n 760:\t\tint err;\n 761:\t\n 762:\t\tswitch (proto) {\n 763:\t\tcase DSA_TAG_PROTO_SEVILLE:\n 764:\t\tcase DSA_TAG_PROTO_OCELOT:\n 765:\t\t\tproto_ops = \u0026felix_tag_npi_proto_ops;\n 766:\t\t\tbreak;\n 767:\t\tcase DSA_TAG_PROTO_OCELOT_8021Q:\n 768:\t\t\tproto_ops = \u0026felix_tag_8021q_proto_ops;\n 769:\t\t\tbreak;\n 770:\t\tdefault:\n 771:\t\t\treturn -EPROTONOSUPPORT;\n 772:\t\t}\n 773:\t\n"
} |
| 59/2 | 2026/11/25 15:27 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 82494 output: 49 thoughts: 34 Thoughts: Okay, here's my take on those thoughts, tailored for an expert audience: **Analyzing the rtl8365mb Driver** Alright, so we're diving into the rtl8365mb driver. Specifically, I need to check out the `rtl8365mb_change_tag_protocol` function. Line 3028 rings a bell – that's where I'd expect to find the core logic for... well, changing the VLAN tag protocol. I'm keen to see how they've handled that specific functionality. Let's see how they've implemented it, especially the aspects related to ingress/egress frame processing. I'll be looking for potential issues with protocol conversions or how it interacts with the underlying hardware registers. Let's see what's what! |
| 60/2 | 2026/11/25 15:27 | tool | read-file |
0mArgs:{
"File": "drivers/net/dsa/realtek/rtl8365mb_main.c",
"FirstLine": 3028,
"LineCount": 20
}Results: {
"Contents": "3028:\tstatic int rtl8365mb_change_tag_protocol(struct dsa_switch *ds,\n3029:\t\t\t\t\t\t enum dsa_tag_protocol proto)\n3030:\t{\n3031:\t\tstruct realtek_priv *priv = ds-\u003epriv;\n3032:\t\tstruct rtl8365mb_cpu *cpu;\n3033:\t\tstruct rtl8365mb *mb;\n3034:\t\n3035:\t\tmb = priv-\u003echip_data;\n3036:\t\tcpu = \u0026mb-\u003ecpu;\n3037:\t\n3038:\t\tswitch (proto) {\n3039:\t\tcase DSA_TAG_PROTO_RTL8_4:\n3040:\t\t\tcpu-\u003eformat = RTL8365MB_CPU_FORMAT_8BYTES;\n3041:\t\t\tcpu-\u003eposition = RTL8365MB_CPU_POS_AFTER_SA;\n3042:\t\t\tbreak;\n3043:\t\tcase DSA_TAG_PROTO_RTL8_4T:\n3044:\t\t\tcpu-\u003eformat = RTL8365MB_CPU_FORMAT_8BYTES;\n3045:\t\t\tcpu-\u003eposition = RTL8365MB_CPU_POS_BEFORE_CRC;\n3046:\t\t\tbreak;\n3047:\t\t/* The switch also supports a 4-byte format, similar to rtl4a but with\n"
} |
| 61/2 | 2026/11/25 15:27 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 83114 output: 214 thoughts: 3632 Thoughts: **Analysis of the SDSA Tagging Protocol Implementation for SoC-e SWIP FPGA IP Core** Alright, let's break this down. It seems the core question revolves around whether this new SDSA tagging protocol, specific to the SoC-e SWIP FPGA IP core, is reachable in a standard QEMU/GCE environment on amd64. My initial thought is, probably not. Let's dig in to be sure. First, it's immediately apparent that the `DSA_TAG_PROTO_SDSA` is exclusively tied to the `soce-swip.c` driver. This is our anchor. If that driver *never* runs, then all associated code paths are dead. And `soce-swip.c`? It's a platform driver, specifically looking for a `"soce,swip"` device node in the device tree. It maps an FPGA IP core into memory. Right away, this screams *hardware dependency*. Looking closer at the `soce-swip-core.c` and `mdio-soce.c` it's clear these support the SWIP FPGA IP core. Further investigation of the probe function in `soce-swip-core.c` confirms this hardware dependency by reading register values from physical memory. The `devm_of_platform_populate` function goes on to create child platform devices for the switch and MDIO interfaces. Now, can this `"soce,swip"` device node *ever* appear in a QEMU/amd64 environment? I don't see how. This isn't a PCI device, a USB device, or anything else commonly emulated. It's a memory-mapped FPGA IP core, and standard QEMU x86_64 doesn't emulate this type of hardware. No device tree node, no probe. And the ramifications? Without `soce-swip.c` probing, no switch will use `DSA_TAG_PROTO_SDSA`. That means `net/dsa/tag_sdsa.c` (the SDSA tag handler) will never be called. It appears unreachable, at least in a standard virtualized environment. Let's do a double-check. I quickly scan the kernel for any other potential entry points for `tag_sdsa.c`, even though unlikely. It is confirmed, the only potential path leads through a platform device with `DSA_TAG_PROTO_SDSA` or the switch driver's tag protocol configuration interface. The only switch driver to ever use `DSA_TAG_PROTO_SDSA` is the `soce-swip.c`. Could a device tree overlay, perhaps created by syzkaller, provide the needed device tree entry? The answer is no, because userspace does not have the ability to dynamically load overlays via configfs. Even if a node could be inserted, the probe function does an immediate memory read. If there's no FPGA hardware at the specified address, the probe *immediately* fails. The fuzzing guidelines are also very explicit: the code needs to be *reachable* in standard virtualized environments. This is not the case for any code within this patch set. All the changes are for devicetree bindings, core MFD driver, MDIO, and DSA driver for FPGA switch IP core hardware and can not be run in virtualized hardware. And SDSA tagging protocol handler for the driver. So the conclusion? This entire patch series is *structurally unreachable* in the target environment. It's all hardware-specific code that depends on the SWIP FPGA IP core and its associated device tree node. It falls under the "structurally unreachable hardware" category in the fuzzing guidelines. As a result, no fuzzing is needed. `WorthFuzzing` is `false`. Because it is unreachable, I can set `FocusSymbols` and `EnableConfigs` to empty lists as well. This makes sense and seems the correct outcome. The reasoning is clear, and the conclusion is fully supported. |
| 62/2 | 2026/11/25 15:27 | tool | set-results |
0mArgs:{
"EnableConfigs": [],
"FocusSymbols": [],
"Reasoning": "The patch series introduces support for the SoC-e SWIP FPGA Ethernet switch IP core, including devicetree bindings, an MFD core driver (soce-swip-core.c), an MDIO bus controller driver (mdio-soce.c), a DSA switch driver (soce-swip.c), and the SDSA tagging driver (tag_sdsa.c). These drivers probe via Device Tree for a memory-mapped FPGA IP core and require physical FPGA hardware that is not emulated in standard QEMU or GCE virtual machines on amd64. The SDSA tagging protocol (tag_sdsa.c) is tied specifically to this switch hardware and cannot be attached to mockup drivers like dsa_loop (which does not support runtime tag protocol changes). As such, all executable code introduced by this patch is structurally unreachable in standard fuzzing environments.",
"WorthFuzzing": false
}Results: {
"EnableConfigs": null,
"FocusSymbols": [],
"Reasoning": "The patch series introduces support for the SoC-e SWIP FPGA Ethernet switch IP core, including devicetree bindings, an MFD core driver (soce-swip-core.c), an MDIO bus controller driver (mdio-soce.c), a DSA switch driver (soce-swip.c), and the SDSA tagging driver (tag_sdsa.c). These drivers probe via Device Tree for a memory-mapped FPGA IP core and require physical FPGA hardware that is not emulated in standard QEMU or GCE virtual machines on amd64. The SDSA tagging protocol (tag_sdsa.c) is tied specifically to this switch hardware and cannot be attached to mockup drivers like dsa_loop (which does not support runtime tag protocol changes). As such, all executable code introduced by this patch is structurally unreachable in standard fuzzing environments.",
"WorthFuzzing": false
} |
| 63/1 | 2026/11/25 15:27 | action | If |
0mArgs:{
"WorthFuzzing": false
}Results: null |
| Total Calls | Total Tokens | Avg Tokens | Total Duration (Seconds) | Avg Duration (Seconds) |
|---|
| Total Calls | Total Duration (Seconds) | Avg Duration (Seconds) |
|---|