dt-bindings: net: dsa: nxp,sja1105: Properly apply ports up to 11th port
Subsystems (8)
PATCH 1/2 dt-bindings: net: dsa: nxp,sja1105: Properly apply ports up to 11th port
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.
--- Documentation/devicetree/bindings/net/dsa/nxp,sja1105.yaml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
Documentation/devicetree/bindings/net/dsa/nxp,sja1105.yaml +6 -1
@@ -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:
Signature · 1 line
2.53.0
PATCH 2/2 dt-bindings: net: dsa: Flag unexpected ethernet ports
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.
--- .../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(-)
Documentation/devicetree/bindings/net/dsa/lantiq,gswip.yaml +3 -1
@@ -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]
Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml +5 -4
@@ -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:
Documentation/devicetree/bindings/net/dsa/microchip,ksz.yaml +3 -1
@@ -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:
Documentation/devicetree/bindings/net/dsa/microchip,lan937x.yaml +6 -1
@@ -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:
Documentation/devicetree/bindings/net/dsa/microchip,lan96455s-switch.yaml +5 -1
@@ -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:
Documentation/devicetree/bindings/net/dsa/qca8k.yaml +3 -1
@@ -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:
Signature · 1 line
2.53.0
[email protected]
AI reviewRe: [PATCH net-next 2/2] dt-bindings: net: dsa: Flag unexpected ethernet ports
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider.
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider.
Critical: 0 · High: 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.
[ ... ]
Quoted 8 lines
Documentation/devicetree/bindings/net/dsa/qca8k.yaml +0
-0@@ -75,13 +75,15 @@ patternProperties: type: object additionalProperties: true patternProperties:
Documentation/devicetree/bindings/net/dsa/qca8k.yaml patternProperties: · line 86
Quoted 10 lines
Documentation/devicetree/bindings/net/dsa/qca8k.yaml +3
-1- "^(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?
Signature · 1 line
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261122160907.200727-3-krzysztof.kozlowski%40oss.qualcomm.com
Re: [PATCH net-next 2/2] dt-bindings: net: dsa: Flag unexpected ethernet ports
Quoted 87 lines · netdev-bot+sashiko@ wrote:
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.yamlports, 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.[ ... ]
Review
Quoted 1 line
(quoted diff) +0
-0
b/Documentation/devicetree/bindings/net/dsa/qca8k.yamlQuoted 7 lines
index
167398ab253aa..3840b336bdb93100644Documentation/devicetree/bindings/net/dsa/qca8k.yaml +0
-0@@ -75,13 +75,15 @@ patternProperties: type: object additionalProperties: true patternProperties:Documentation/devicetree/bindings/net/dsa/qca8k.yaml patternProperties: · line 86
Quoted 10 lines
Documentation/devicetree/bindings/net/dsa/qca8k.yaml +3
-1- "^(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 referencesdsa.yamlports, 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 genericdsa-port.yamlchecks 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.yamlwork 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.
Quoted 4 lines
Such a node skips the NETC port schema, including
dsa-port.yamland its
unevaluatedProperties: false, and passes without a warning.Should this patch cover nxp,netc-switch.yaml as well?
Could you answer this sashiko question?
Rob Herring
maintainerRe: [PATCH net-next 2/2] dt-bindings: net: dsa: Flag unexpected ethernet ports
In reply to [email protected]Quoted 63 lines · On Mon, Nov 23, 2026 at 04:11:53PM +0000, [email protected] wrote:
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.yamlports, 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.[ ... ]
Quoted 8 lines
Documentation/devicetree/bindings/net/dsa/qca8k.yaml +0
-0@@ -75,13 +75,15 @@ patternProperties: type: object additionalProperties: true patternProperties:Documentation/devicetree/bindings/net/dsa/qca8k.yaml patternProperties: · line 86
Quoted 10 lines
Documentation/devicetree/bindings/net/dsa/qca8k.yaml +3
-1- "^(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 referencesdsa.yamlports, 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]$":
Quoted 5 lines
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 genericdsa-port.yamlchecks apply and it passes validation. This hardware only has ports 0-4 (4 ports plus 1 CPU port).
Yes.
Quoted 18 lines
Would the same change used here for
qca8k.yamlwork 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.
Quoted 4 lines
Such a node skips the NETC port schema, including
dsa-port.yamland its
unevaluatedProperties: false, and passes without a warning.Should this patch cover nxp,netc-switch.yaml as well?
Yes.
There's a whole other class of schemas here that don't put any restriction on the port numbers. Maybe they should, but doing so requires knowing how many ports there are. But that would be a separate improvement rather than fixing what looks like a constraint on number of ports but in reality isn't doing anything. And that could get messy when you have several variants with different numbers of ports covered by 1 schema.
Rob
Re: [PATCH net-next 2/2] dt-bindings: net: dsa: Flag unexpected ethernet ports
In reply to [email protected]Quoted 7 lines · On 23/11/2026 17:11, [email protected] wrote:
Review
Quoted 6 lines
$ref: dsa-port.yaml#
properties:
(quoted diff) +2
-0+ reg: + maximum: 6
Quoted 8 lines
[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 referencesdsa.yamlports, 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:
This is fixed by Lad's patch:
https://lore.kernel.org/all/[email protected]/
Quoted 33 lines
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 genericdsa-port.yamlchecks 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.yamlwork 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.
Quoted 4 lines
Such a node skips the NETC port schema, including
dsa-port.yamland its
unevaluatedProperties: false, and passes without a warning.Should this patch cover nxp,netc-switch.yaml as well?
As Rob explained, that requires a bit more effort than this simple cleanup.
Best regards,
Krzysztof
Quoted 11 lines · 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 <[email protected]>--- Documentation/devicetree/bindings/net/dsa/nxp,sja1105.yaml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
This series was applied to netdev/net-next.git (main) by Paolo Abeni <[email protected]>:
Hello:
This series was applied to netdev/net-next.git (main) by Paolo Abeni <[email protected]>:
Quoted 9 lines · On Sun, 22 Nov 2026 17:09:08 +0100 you wrote:
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 <[email protected]>[...]
Here is the summary with links:
- [net-next,1/2] dt-bindings: net: dsa: nxp,sja1105: Properly apply ports up to 11th port
https://git.kernel.org/netdev/net-next/c/82ad65aa0a66 - [net-next,2/2] dt-bindings: net: dsa: Flag unexpected ethernet ports https://git.kernel.org/netdev/net-next/c/2164c096a98e
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html