* [PATCH net-next 1/2] dt-bindings: net: dsa: nxp,sja1105: Properly apply ports up to 11th port @ 2026-11-22 16:09 Krzysztof Kozlowski 2026-11-22 16:09 ` [PATCH net-next 2/2] dt-bindings: net: dsa: Flag unexpected ethernet ports Krzysztof Kozlowski 0 siblings, 1 reply; 3+ messages in thread From: Krzysztof Kozlowski @ 2026-11-22 16:09 UTC (permalink / raw) To: Hauke Mehrtens, Andrew Lunn, Vladimir Oltean, David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni, Rob Herring, Krzysztof Kozlowski, Conor Dooley, Matthias Brugger, AngeloGioacchino Del Regno, Woojung Huh, UNGLinuxDriver, Jens Emil Schulz Østergaard, Christian Marangi, Arınç ÜNAL, Landen Chao, DENG Qingfang, Sean Wang, Daniel Golle, Marek Vasut, John Crispin, netdev, devicetree, linux-kernel, linux-arm-kernel, linux-mediatek Cc: Krzysztof Kozlowski nxp,sja1110 devices have up to 11 ports in DTS (highest port@a), so the pattern was missing applying schema to the last one. Fix this by dropping the unit address from the pattern completely and adding proper constrain on the 'reg' property, so child nodes beyond port@a will be properly flagged as incorrect. Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com> --- Documentation/devicetree/bindings/net/dsa/nxp,sja1105.yaml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Documentation/devicetree/bindings/net/dsa/nxp,sja1105.yaml b/Documentation/devicetree/bindings/net/dsa/nxp,sja1105.yaml index 0486489114cd..e9b53820cc36 100644 --- a/Documentation/devicetree/bindings/net/dsa/nxp,sja1105.yaml +++ b/Documentation/devicetree/bindings/net/dsa/nxp,sja1105.yaml @@ -89,7 +89,12 @@ patternProperties: "^(ethernet-)?ports$": additionalProperties: true patternProperties: - "^(ethernet-)?port@[0-9]$": + "^(ethernet-)?port@": + type: object + properties: + reg: + maximum: 10 + allOf: - if: properties: -- 2.53.0 ^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH net-next 2/2] dt-bindings: net: dsa: Flag unexpected ethernet ports 2026-11-22 16:09 [PATCH net-next 1/2] dt-bindings: net: dsa: nxp,sja1105: Properly apply ports up to 11th port Krzysztof Kozlowski @ 2026-11-22 16:09 ` Krzysztof Kozlowski 2026-11-23 16:11 ` netdev-bot+sashiko 0 siblings, 1 reply; 3+ messages in thread From: Krzysztof Kozlowski @ 2026-11-22 16:09 UTC (permalink / raw) To: Hauke Mehrtens, Andrew Lunn, Vladimir Oltean, David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni, Rob Herring, Krzysztof Kozlowski, Conor Dooley, Matthias Brugger, AngeloGioacchino Del Regno, Woojung Huh, UNGLinuxDriver, Jens Emil Schulz Østergaard, Christian Marangi, Arınç ÜNAL, Landen Chao, DENG Qingfang, Sean Wang, Daniel Golle, Marek Vasut, John Crispin, netdev, devicetree, linux-kernel, linux-arm-kernel, linux-mediatek Cc: Krzysztof Kozlowski Bindings which reference dsa.yaml ports and restrict their own ports to specific subset (e.g. with pattern "^(ethernet-)?port@[0-6]$") actually silently allow ports with any unit address, because they use "additionalProperties: true". These additional ports are incorrect and should be flagged by the schema. Solve this by dropping the unit address from the pattern completely and adding proper constrain on the 'reg' property. Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com> --- .../devicetree/bindings/net/dsa/lantiq,gswip.yaml | 4 +++- .../devicetree/bindings/net/dsa/mediatek,mt7530.yaml | 9 +++++---- .../devicetree/bindings/net/dsa/microchip,ksz.yaml | 4 +++- .../devicetree/bindings/net/dsa/microchip,lan937x.yaml | 7 ++++++- .../bindings/net/dsa/microchip,lan96455s-switch.yaml | 6 +++++- Documentation/devicetree/bindings/net/dsa/qca8k.yaml | 4 +++- 6 files changed, 25 insertions(+), 9 deletions(-) diff --git a/Documentation/devicetree/bindings/net/dsa/lantiq,gswip.yaml b/Documentation/devicetree/bindings/net/dsa/lantiq,gswip.yaml index 89f78a1bc113..83cdd6c80d09 100644 --- a/Documentation/devicetree/bindings/net/dsa/lantiq,gswip.yaml +++ b/Documentation/devicetree/bindings/net/dsa/lantiq,gswip.yaml @@ -108,13 +108,15 @@ patternProperties: "^(ethernet-)?ports$": type: object patternProperties: - "^(ethernet-)?port@[0-6]$": + "^(ethernet-)?port@": $ref: dsa-port.yaml# allOf: - $ref: /schemas/phy/phy-common-props.yaml# unevaluatedProperties: false properties: + reg: + maximum: 6 maxlinear,slew-rate-txc: $ref: /schemas/types.yaml#/definitions/uint32 enum: [0, 1] diff --git a/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml b/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml index 90b3582b7619..80cda7ec5cb6 100644 --- a/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml +++ b/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml @@ -179,12 +179,13 @@ patternProperties: additionalProperties: true patternProperties: - "^(ethernet-)?port@[0-6]$": + "^(ethernet-)?port@": type: object additionalProperties: true properties: reg: + maximum: 6 description: Port address described must be 5 or 6 for CPU port and from 0 to 5 for user ports. @@ -208,7 +209,7 @@ $defs: patternProperties: "^(ethernet-)?ports$": patternProperties: - "^(ethernet-)?port@[0-6]$": + "^(ethernet-)?port@": if: required: [ ethernet ] then: @@ -220,7 +221,7 @@ $defs: patternProperties: "^(ethernet-)?ports$": patternProperties: - "^(ethernet-)?port@[0-6]$": + "^(ethernet-)?port@": if: required: [ ethernet ] then: @@ -246,7 +247,7 @@ $defs: patternProperties: "^(ethernet-)?ports$": patternProperties: - "^(ethernet-)?port@[0-6]$": + "^(ethernet-)?port@": if: required: [ ethernet ] then: diff --git a/Documentation/devicetree/bindings/net/dsa/microchip,ksz.yaml b/Documentation/devicetree/bindings/net/dsa/microchip,ksz.yaml index 4ed13870ed3a..9cc14aa7b4b1 100644 --- a/Documentation/devicetree/bindings/net/dsa/microchip,ksz.yaml +++ b/Documentation/devicetree/bindings/net/dsa/microchip,ksz.yaml @@ -129,10 +129,12 @@ allOf: patternProperties: "^(ethernet-)?ports$": patternProperties: - "^(ethernet-)?port@[0-2]$": + "^(ethernet-)?port@": $ref: dsa-port.yaml# unevaluatedProperties: false properties: + reg: + maximum: 2 microchip,rmii-clk-internal: $ref: /schemas/types.yaml#/definitions/flag description: diff --git a/Documentation/devicetree/bindings/net/dsa/microchip,lan937x.yaml b/Documentation/devicetree/bindings/net/dsa/microchip,lan937x.yaml index 9973d64f15a7..36a7c81df747 100644 --- a/Documentation/devicetree/bindings/net/dsa/microchip,lan937x.yaml +++ b/Documentation/devicetree/bindings/net/dsa/microchip,lan937x.yaml @@ -39,7 +39,12 @@ patternProperties: "^(ethernet-)?ports$": additionalProperties: true patternProperties: - "^(ethernet-)?port@[0-7]$": + "^(ethernet-)?port@": + type: object + properties: + reg: + maximum: 7 + allOf: - if: properties: diff --git a/Documentation/devicetree/bindings/net/dsa/microchip,lan96455s-switch.yaml b/Documentation/devicetree/bindings/net/dsa/microchip,lan96455s-switch.yaml index 517bc4c00de3..17e3c00f5a32 100644 --- a/Documentation/devicetree/bindings/net/dsa/microchip,lan96455s-switch.yaml +++ b/Documentation/devicetree/bindings/net/dsa/microchip,lan96455s-switch.yaml @@ -105,11 +105,15 @@ properties: type: object additionalProperties: true patternProperties: - "^(ethernet-)?port@[0-8]$": + "^(ethernet-)?port@": type: object description: Ethernet switch ports additionalProperties: true + properties: + reg: + maximum: 8 + allOf: - if: properties: diff --git a/Documentation/devicetree/bindings/net/dsa/qca8k.yaml b/Documentation/devicetree/bindings/net/dsa/qca8k.yaml index 167398ab253a..3840b336bdb9 100644 --- a/Documentation/devicetree/bindings/net/dsa/qca8k.yaml +++ b/Documentation/devicetree/bindings/net/dsa/qca8k.yaml @@ -75,13 +75,15 @@ patternProperties: type: object additionalProperties: true patternProperties: - "^(ethernet-)?port@[0-6]$": + "^(ethernet-)?port@": type: object description: Ethernet switch ports $ref: dsa-port.yaml# properties: + reg: + maximum: 6 qca,sgmii-rxclk-falling-edge: $ref: /schemas/types.yaml#/definitions/flag description: -- 2.53.0 ^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH net-next 2/2] dt-bindings: net: dsa: Flag unexpected ethernet ports 2026-11-22 16:09 ` [PATCH net-next 2/2] dt-bindings: net: dsa: Flag unexpected ethernet ports Krzysztof Kozlowski @ 2026-11-23 16:11 ` netdev-bot+sashiko 0 siblings, 0 replies; 3+ messages in thread From: netdev-bot+sashiko @ 2026-11-23 16:11 UTC (permalink / raw) To: krzysztof.kozlowski Cc: hauke, andrew, olteanv, davem, edumazet, kuba, pabeni, robh, krzk+dt, conor+dt, matthias.bgg, angelogioacchino.delregno, woojung.huh, UNGLinuxDriver, jensemil.schulzostergaard, ansuelsmth, arinc.unal, Landen.Chao, dqfext, sean.wang, daniel, marex, john, netdev, devicetree, linux-kernel, linux-arm-kernel, linux-mediatek Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider. Critical: 0 · High: 1 · Medium: 0 · Low: 0 If you believe none of the issues are legitimate, please reply to each issue of Medium severity or higher and explain why the AI is wrong. If any of them are legitimate and you plan to respin, please let patchwork know by including "pw-bot: cr" as a separate line at the end of your reply (one such reply per series is enough). - [High] The fix is incomplete because it skips a sibling DSA binding that has the exact defect described in the commit message. -- dt-bindings: net: dsa: Flag unexpected ethernet ports Several DSA bindings reference dsa.yaml ports, use "additionalProperties: true", and limit their port node pattern to a subset of unit addresses. Because of that, port nodes with any other unit address pass validation without a warning. The patch drops the unit address from the pattern and limits the port reg value with a maximum instead. [ ... ] > diff --git a/Documentation/devicetree/bindings/net/dsa/qca8k.yaml b/Documentation/devicetree/bindings/net/dsa/qca8k.yaml > index 167398ab253aa..3840b336bdb93 100644 > --- a/Documentation/devicetree/bindings/net/dsa/qca8k.yaml > +++ b/Documentation/devicetree/bindings/net/dsa/qca8k.yaml > @@ -75,13 +75,15 @@ patternProperties: > type: object > additionalProperties: true > patternProperties: > - "^(ethernet-)?port@[0-6]$": > + "^(ethernet-)?port@": > type: object > description: Ethernet switch ports > > $ref: dsa-port.yaml# > > properties: > + reg: > + maximum: 6 [Severity: High] Was renesas,rzn1-a5psw.yaml left out of this conversion on purpose? It looks like it has the same problem the commit message describes. It references dsa.yaml ports, its ethernet-ports node uses additionalProperties: true, and its port pattern still limits the unit address: Documentation/devicetree/bindings/net/dsa/renesas,rzn1-a5psw.yaml: allOf: - $ref: dsa.yaml#/$defs/ethernet-ports ... ethernet-ports: type: object additionalProperties: true patternProperties: "^(ethernet-)?port@[0-4]$": Under a renesas,rzn1-a5psw switch, a node such as port@5 or port@7 does not match this pattern. It does match the generic "^(ethernet-)?port@[0-9a-f]+$" pattern in dsa.yaml, so only the generic dsa-port.yaml checks apply and it passes validation. This hardware only has ports 0-4 (4 ports plus 1 CPU port). Would the same change used here for qca8k.yaml work for that file too, i.e. "^(ethernet-)?port@" plus reg: maximum: 4? nxp,netc-switch.yaml has a weaker form of the same gap: ethernet-ports: type: object patternProperties: "^ethernet-port@[0-9a-f]$": type: object $ref: dsa-port.yaml# A node named port@1 (no ethernet- prefix) or ethernet-port@10 does not match this pattern. Instead it matches the '^(ethernet-)?port@[0-9a-f]+$' pattern in ethernet-switch.yaml, which is reached through $ref: dsa.yaml# and only applies type: object. Such a node skips the NETC port schema, including dsa-port.yaml and its unevaluatedProperties: false, and passes without a warning. Should this patch cover nxp,netc-switch.yaml as well? -- Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261122160907.200727-3-krzysztof.kozlowski%40oss.qualcomm.com ^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-11-23 16:11 UTC | newest] Thread overview: 3+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2026-11-22 16:09 [PATCH net-next 1/2] dt-bindings: net: dsa: nxp,sja1105: Properly apply ports up to 11th port Krzysztof Kozlowski 2026-11-22 16:09 ` [PATCH net-next 2/2] dt-bindings: net: dsa: Flag unexpected ethernet ports Krzysztof Kozlowski 2026-11-23 16:11 ` netdev-bot+sashiko
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox