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: Fri, 29 Jul 2022 17:01:08 +0000 [thread overview]
Message-ID: <20220729170107.h4ariyl5rvhcrhq3@skbuf> (raw)
In-Reply-To: <CAL_JsqJJBDC9_RbJwUSs5Q-OjWJDSA=8GTXyfZ4LdYijB-AqqA@mail.gmail.com>
On Fri, Jul 29, 2022 at 10:22:49AM -0600, Rob Herring wrote:
> It's not the kernel's job to validate the DT. If it was, it does a
> horrible job.
I'm surprised by you saying this.
The situation is as follows: phylink parses the fwnode it's given, and
errors out if it can't find everything it needs. See phylink_parse_mode()
and phylink_parse_fixedlink(). This is a matter of fact - if you start
parsing stuff, you'll eventually need to treat the case where what
you're searching for isn't there, or isn't realistic.
DSA is a common framework used by multiple drivers, and it wasn't always
integrated with phylink. The DT nodes of some ports will lack what
phylink needs, but these ports don't really need phylink to work, it's
optional, they work without it too. However if we begin the process of
registering them with phylink and we let phylink fail, this process is
irreversible and the ports don't work anymore.
So what DSA currently does (even before this patch set) is it
pre-validates that phylink has what it needs, and skips phylink if it
doesn't. It's only that it doesn't name it this way, and it doesn't
print anything.
Being a common framework, new drivers opt into this behavior willy-nilly.
I am adding a table of compatible strings of old drivers where the
behavior is retained. For new drivers, we fail them in DSA rather than
in phylink, this is true. Maybe this is what you disagree with?
We do this as a matter of practicality - we already need to predetermine
whether phylink has a chance of working, and if we find something missing,
we know it won't. Seems illogical to let phylink go through the same
parsing again.
As for the lousy job, I can't contradict you...
> Is the schema providing this validation? If not, you need to add it.
No, it's not. I can also look into providing a patch that statically
validates this. But I'm afraid, with all due respect, that not many
people take the YAML validator too seriously? With the volume of output
it even throws, it would be even hard to detect something new, you'd
need to know to search for it. Most of the DSA drivers aren't even
converted to YAML, and it is precisely the biggest offenders that
aren't. And even if the schema says a property is required but the code
begs to differ, and a future DT blob gets to enter production based on
undocumented behavior, who's right?
next prev parent reply other threads:[~2022-07-29 17:01 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 [this message]
2022-07-29 18:39 ` Rob Herring
2022-07-30 16:23 ` Vladimir Oltean
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=20220729170107.h4ariyl5rvhcrhq3@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