public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: Vladimir Oltean <vladimir.oltean@nxp.com>
To: Rob Herring <robh+dt@kernel.org>
Cc: netdev <netdev@vger.kernel.org>,
	"David S. Miller" <davem@davemloft.net>,
	"Eric Dumazet" <edumazet@google.com>,
	"Jakub Kicinski" <kuba@kernel.org>,
	"Paolo Abeni" <pabeni@redhat.com>, "Andrew Lunn" <andrew@lunn.ch>,
	"Vivien Didelot" <vivien.didelot@gmail.com>,
	"Florian Fainelli" <f.fainelli@gmail.com>,
	"Oleksij Rempel" <linux@rempel-privat.de>,
	"Christian Marangi" <ansuelsmth@gmail.com>,
	"John Crispin" <john@phrozen.org>,
	"Kurt Kanzenbach" <kurt@linutronix.de>,
	"Mans Rullgard" <mans@mansr.com>,
	"Arun Ramadoss" <arun.ramadoss@microchip.com>,
	"Woojung Huh" <woojung.huh@microchip.com>,
	"UNGLinuxDriver@microchip.com" <UNGLinuxDriver@microchip.com>,
	"Claudiu Manoil" <claudiu.manoil@nxp.com>,
	"Alexandre Belloni" <alexandre.belloni@bootlin.com>,
	"George McCollister" <george.mccollister@gmail.com>,
	"DENG Qingfang" <dqfext@gmail.com>,
	"Sean Wang" <sean.wang@mediatek.com>,
	"Landen Chao" <Landen.Chao@mediatek.com>,
	"Matthias Brugger" <matthias.bgg@gmail.com>,
	"Hauke Mehrtens" <hauke@hauke-m.de>,
	"Martin Blumenstingl" <martin.blumenstingl@googlemail.com>,
	"Aleksander Jan Bajkowski" <olek2@wp.pl>,
	"Alvin Šipraga" <alsi@bang-olufsen.dk>,
	"Luiz Angelo Daros de Luca" <luizluca@gmail.com>,
	"Linus Walleij" <linus.walleij@linaro.org>,
	"Pawel Dembicki" <paweldembicki@gmail.com>,
	"Clément Léger" <clement.leger@bootlin.com>,
	"Geert Uytterhoeven" <geert+renesas@glider.be>,
	"Russell King" <rmk+kernel@armlinux.org.uk>,
	"Marek Behún" <kabel@kernel.org>,
	"Marcin Wojtas" <mw@semihalf.com>,
	"Frank Rowand" <frowand.list@gmail.com>
Subject: Re: [PATCH v2 net-next 4/4] net: dsa: validate that DT nodes of shared ports have the properties they need
Date: Sat, 30 Jul 2022 16:23:52 +0000	[thread overview]
Message-ID: <20220730162351.rwfzpma5uvsg3kax@skbuf> (raw)
In-Reply-To: <CAL_JsqL7AcAbtqwjYmhbtwZBXyRNsquuM8LqEFGYgha-xpuE+Q@mail.gmail.com>

Hi Rob,

On Fri, Jul 29, 2022 at 12:39:06PM -0600, Rob Herring wrote:
> All valid points. At least for the sea of warnings, you can limit
> checking to only a subset of schemas you care about. Setting
> 'DT_SCHEMA_FILES=net/' will only check networking schemas for example.
> Just need folks to care about those subsets.
> 
> I'm not saying don't put warnings in the kernel for this. Just don't
> make it the only source of warnings. Given you are tightening the
> requirements, it makes sense to have a warning. If it was something
> entirely new, then I'd be more inclined to say only the schema should
> check.

How does this look like? It says that if the 'ethernet' property exists
and is a phandle (i.e. this is a CPU port), or if the 'link' property
exists and is a phandle-array (i.e. this is a DSA port), then the
phylink-related properties are mandatory, in the combinations that they
may appear in.

diff --git a/Documentation/devicetree/bindings/net/dsa/dsa-port.yaml b/Documentation/devicetree/bindings/net/dsa/dsa-port.yaml
index 09317e16cb5d..ed828cec90fd 100644
--- a/Documentation/devicetree/bindings/net/dsa/dsa-port.yaml
+++ b/Documentation/devicetree/bindings/net/dsa/dsa-port.yaml
@@ -76,6 +76,31 @@ properties:
 required:
   - reg
 
+if:
+  oneOf:
+    - properties:
+        ethernet:
+          items:
+            $ref: /schemas/types.yaml#/definitions/phandle
+    - properties:
+        link:
+          items:
+            $ref: /schemas/types.yaml#/definitions/phandle-array
+then:
+  allOf:
+  - required:
+    - phy-mode
+  - oneOf:
+    - required:
+      - fixed-link
+    - required:
+      - phy-handle
+    - required:
+      - managed
+    - required:
+      - phy-handle
+      - managed
+
 additionalProperties: true
 

I have deliberately made this part of dsa-port.yaml and not depend on
any compatible string. The reason is the code - we'll warn about missing
properties regardless of whether we have fallback logic for some older
switches. Essentially the fact that some switches have the fallback to
not use phylink will remain an undocumented easter egg as far as the
dt-schema is concerned.

What do you think?

Can I also get an ACK for this patch and patch 1 please?

  reply	other threads:[~2022-07-30 16:24 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-29 13:21 [PATCH v2 net-next 0/4] Validate OF nodes for DSA shared ports Vladimir Oltean
2022-07-29 13:21 ` [PATCH v2 net-next 1/4] of: base: export of_device_compatible_match() for use in modules Vladimir Oltean
2022-07-29 13:21 ` [PATCH v2 net-next 2/4] net: dsa: avoid dsa_port_link_{,un}register_of() calls with platform data Vladimir Oltean
2022-07-29 13:21 ` [PATCH v2 net-next 3/4] net: dsa: rename dsa_port_link_{,un}register_of Vladimir Oltean
2022-07-29 13:21 ` [PATCH v2 net-next 4/4] net: dsa: validate that DT nodes of shared ports have the properties they need Vladimir Oltean
2022-07-29 16:22   ` Rob Herring
2022-07-29 17:01     ` Vladimir Oltean
2022-07-29 18:39       ` Rob Herring
2022-07-30 16:23         ` Vladimir Oltean [this message]
2022-08-01 14:02           ` Rob Herring
2022-08-01 14:11             ` Vladimir Oltean
2022-08-01 14:26               ` Rob Herring
2022-07-29 17:57   ` Marcin Wojtas
2022-07-29 18:34     ` Vladimir Oltean
2022-07-29 20:36       ` Marcin Wojtas
2022-07-29 21:17         ` Andrew Lunn
2022-07-29 21:24           ` Florian Fainelli
2022-07-29 21:33             ` Marcin Wojtas
2022-07-29 21:44               ` Florian Fainelli
2022-07-30  0:49               ` Vladimir Oltean

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220730162351.rwfzpma5uvsg3kax@skbuf \
    --to=vladimir.oltean@nxp.com \
    --cc=Landen.Chao@mediatek.com \
    --cc=UNGLinuxDriver@microchip.com \
    --cc=alexandre.belloni@bootlin.com \
    --cc=alsi@bang-olufsen.dk \
    --cc=andrew@lunn.ch \
    --cc=ansuelsmth@gmail.com \
    --cc=arun.ramadoss@microchip.com \
    --cc=claudiu.manoil@nxp.com \
    --cc=clement.leger@bootlin.com \
    --cc=davem@davemloft.net \
    --cc=dqfext@gmail.com \
    --cc=edumazet@google.com \
    --cc=f.fainelli@gmail.com \
    --cc=frowand.list@gmail.com \
    --cc=geert+renesas@glider.be \
    --cc=george.mccollister@gmail.com \
    --cc=hauke@hauke-m.de \
    --cc=john@phrozen.org \
    --cc=kabel@kernel.org \
    --cc=kuba@kernel.org \
    --cc=kurt@linutronix.de \
    --cc=linus.walleij@linaro.org \
    --cc=linux@rempel-privat.de \
    --cc=luizluca@gmail.com \
    --cc=mans@mansr.com \
    --cc=martin.blumenstingl@googlemail.com \
    --cc=matthias.bgg@gmail.com \
    --cc=mw@semihalf.com \
    --cc=netdev@vger.kernel.org \
    --cc=olek2@wp.pl \
    --cc=pabeni@redhat.com \
    --cc=paweldembicki@gmail.com \
    --cc=rmk+kernel@armlinux.org.uk \
    --cc=robh+dt@kernel.org \
    --cc=sean.wang@mediatek.com \
    --cc=vivien.didelot@gmail.com \
    --cc=woojung.huh@microchip.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox