RE: [PATCH v6 net-next 02/15] dt-bindings: net: dsa: add NETC switch
Wei Fang <[email protected]> Mon, 11 May 2026 03:33:18 +0000
| Newsgroups | dev.linux.lists.sashiko,dev.linux.lists.imx,org.kernel.vger.linux-devicetree,org.kernel.vger.netdev |
|---|---|
| Message-ID | <DBBPR04MB7500661393F2BEFE98A0363B88382@DBBPR04MB7500.eurprd04.prod.outlook.com> |
> Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to > consider: > - [Low] The `dsa,member` property lacks validation constraints for the switch > index. > - [Low] The `patternProperties` regex for ethernet ports is overly restrictive and > diverges from standard DSA bindings. > -- > > commit 8c698895982ff77d4bd027af7fa3d21f57f09eba > Author: Wei Fang <[email protected]> > > dt-bindings: net: dsa: add NETC switch > > This commit adds the device tree bindings for the NETC switch. It is a PCIe > function of the NETC IP that supports advanced QoS and TSN capabilities. The > switch connects to an internal ENETC port via a light-weight pseudo MAC. > > > diff --git a/Documentation/devicetree/bindings/net/dsa/nxp,netc-switch.yaml > b/Documentation/devicetree/bindings/net/dsa/nxp,netc-switch.yaml > > new file mode 100644 > > index 0000000000000..988688bf4467d > > --- /dev/null > > +++ b/Documentation/devicetree/bindings/net/dsa/nxp,netc-switch.yaml > > [ ... ] > > > + reg: > > + maxItems: 1 > > + > > + dsa,member: > > + description: > > > + The property indicates DSA cluster and switch index. For NETC switch, > > + the valid range of the switch index is 1 ~ 7, the index is reflected > > + in the switch tag as an indication of the switch ID where the frame > > + originated. The value 0 is reserved for ENETC VEPA switch, whose ID > > + is hardwired to zero. > > The description mentions that the valid range of the switch index is 1 to 7 > and that 0 is reserved, but there do not appear to be any constraints > enforcing this restriction in the schema definition. > > Should an items array constraint be added here with a minimum of 1 and > maximum of 7 for the second element to ensure invalid configurations like > <0 0> are caught during schema validation? I have added the check in the driver, I can add the following the check in next version if no more comments. dsa,member: description: > The property indicates DSA cluster and switch index. For NETC switch, the valid range of the switch index is 1 ~ 7, the index is reflected in the switch tag as an indication of the switch ID where the frame originated. The value 0 is reserved for ENETC VEPA switch, whose ID is hardwired to zero. items: - true - minimum: 1 maximum: 7 > > > + > > + ethernet-ports: > > + type: object > > + patternProperties: > > + "^ethernet-port@[0-9a-f]$": > > Is this regex intentionally more restrictive than the standard DSA bindings? > 'ethernet-ports' for new bindings. See https://lore.kernel.org/imx/[email protected]/ > The standard DSA schema in dsa.yaml allows ^(ethernet-)?port@[0-9a-f]+$. > Because this binding sets unevaluatedProperties to false for the > ethernet-ports node, if a device tree author uses the standard port@1 > naming convention, the binding will reject it. > > Additionally, the single hex digit restriction would prevent port numbers > from exceeding 15. Could this be aligned with the standard pattern? Currently, the i.MX94 NETC switch only has 4 ports, a single hex digit is enough, and this is consistent with the definition in dsa.yaml. please ignore this warning.