[PATCH v3 net-next 03/10] dt-bindings: net: dsa: utilize base definitions for standard dsa switches

Colin Foster colin.foster at in-advantage.com
Tue Nov 29 01:34:52 PST 2022


Hi Rob,

On Mon, Nov 28, 2022 at 05:23:37PM -0600, Rob Herring wrote:
> On Sun, Nov 27, 2022 at 02:47:27PM -0800, Colin Foster wrote:
> > DSA switches can fall into one of two categories: switches where all ports
> > follow standard '(ethernet-)?port' properties, and switches that have
> > additional properties for the ports.
> > 
> > The scenario where DSA ports are all standardized can be handled by
> > swtiches with a reference to 'dsa.yaml#'.
> > 
> > The scenario where DSA ports require additional properties can reference
> > the new '$dsa.yaml#/$defs/base'. This will allow switches to reference
> > these base defitions of the DSA switch, but add additional properties under
> > the port nodes.
> 
> You have this backwards. '$dsa.yaml#/$defs/base' can't be extended. 
> Perhaps '$defs/ethernet-ports' would be a better name.

Oops. I'll fix this up for next set.

> 
> > 
> > Suggested-by: Rob Herring <robh at kernel.org>
> > Signed-off-by: Colin Foster <colin.foster at in-advantage.com>
> > ---
> > 
> > v3
> >   * New patch
> > 
> > ---
> >  .../bindings/net/dsa/arrow,xrs700x.yaml       |  2 +-
> >  .../devicetree/bindings/net/dsa/brcm,b53.yaml |  2 +-
> >  .../devicetree/bindings/net/dsa/dsa.yaml      | 19 ++++++++++++++++---
> >  .../net/dsa/hirschmann,hellcreek.yaml         |  2 +-
> >  .../bindings/net/dsa/mediatek,mt7530.yaml     |  2 +-
> >  .../bindings/net/dsa/microchip,ksz.yaml       |  2 +-
> >  .../bindings/net/dsa/microchip,lan937x.yaml   |  2 +-
> >  .../bindings/net/dsa/mscc,ocelot.yaml         |  2 +-
> >  .../bindings/net/dsa/nxp,sja1105.yaml         |  2 +-
> >  .../devicetree/bindings/net/dsa/realtek.yaml  |  2 +-
> >  .../bindings/net/dsa/renesas,rzn1-a5psw.yaml  |  2 +-
> >  11 files changed, 26 insertions(+), 13 deletions(-)
> > 
> > diff --git a/Documentation/devicetree/bindings/net/dsa/arrow,xrs700x.yaml b/Documentation/devicetree/bindings/net/dsa/arrow,xrs700x.yaml
> > index 259a0c6547f3..8d5abb05abdf 100644
> > --- a/Documentation/devicetree/bindings/net/dsa/arrow,xrs700x.yaml
> > +++ b/Documentation/devicetree/bindings/net/dsa/arrow,xrs700x.yaml
> > @@ -7,7 +7,7 @@ $schema: http://devicetree.org/meta-schemas/core.yaml#
> >  title: Arrow SpeedChips XRS7000 Series Switch Device Tree Bindings
> >  
> >  allOf:
> > -  - $ref: dsa.yaml#
> > +  - $ref: dsa.yaml#/$defs/base
> >  
> >  maintainers:
> >    - George McCollister <george.mccollister at gmail.com>
> > diff --git a/Documentation/devicetree/bindings/net/dsa/brcm,b53.yaml b/Documentation/devicetree/bindings/net/dsa/brcm,b53.yaml
> > index 1219b830b1a4..f323fc01b224 100644
> > --- a/Documentation/devicetree/bindings/net/dsa/brcm,b53.yaml
> > +++ b/Documentation/devicetree/bindings/net/dsa/brcm,b53.yaml
> > @@ -66,7 +66,7 @@ required:
> >    - reg
> >  
> >  allOf:
> > -  - $ref: dsa.yaml#
> > +  - $ref: dsa.yaml#/$defs/base
> >    - if:
> >        properties:
> >          compatible:
> > diff --git a/Documentation/devicetree/bindings/net/dsa/dsa.yaml b/Documentation/devicetree/bindings/net/dsa/dsa.yaml
> > index b9d48e357e77..bd1f0f7c14a8 100644
> > --- a/Documentation/devicetree/bindings/net/dsa/dsa.yaml
> > +++ b/Documentation/devicetree/bindings/net/dsa/dsa.yaml
> > @@ -19,9 +19,6 @@ description:
> >  select: false
> >  
> >  properties:
> > -  $nodename:
> > -    pattern: "^(ethernet-)?switch(@.*)?$"
> > -
> >    dsa,member:
> >      minItems: 2
> >      maxItems: 2
> > @@ -58,4 +55,20 @@ oneOf:
> >  
> >  additionalProperties: true
> >  
> > +$defs:
> > +  base:
> > +    description: A DSA switch without any extra port properties
> > +    $ref: '#/'
> > +
> > +    patternProperties:
> > +      "^(ethernet-)?ports$":
> 
> This node at the top level needs 'additionalProperties: false' assuming 
> we don't allow extra properties in 'ports' nodes. If we do, then we'll 
> need to be able to reference the 'ports' schema to extend it like is 
> done with dsa-ports.yaml.

I'll double check if there's anything that adds any properties. If there
is, would that be a separate file pair: "dsa-ports.yaml" and
"ethernet-switch-ports.yaml"? Or do you think that could be contained in
the existing dsa.yaml, ethernet-switch.yaml?

> 
> > +        type: object
> > +
> > +        patternProperties:
> > +          "^(ethernet-)?ports@[0-9]+$":
> > +            description: Ethernet switch ports
> > +            $ref: dsa-port.yaml#
> > +            unevaluatedProperties: false
> > +
> > +
> 
> One blank line.

Oops again. Thanks for spotting this and for all your help on this!

> 
> >  ...



More information about the Linux-mediatek mailing list