From: Vladimir Oltean <olteanv@gmail.com>
To: "Russell King (Oracle)" <linux@armlinux.org.uk>
Cc: Marek Vasut <marex@denx.de>,
netdev@vger.kernel.org, "David S. Miller" <davem@davemloft.net>,
Andrew Lunn <andrew@lunn.ch>,
Arun Ramadoss <arun.ramadoss@microchip.com>,
Eric Dumazet <edumazet@google.com>,
Florian Fainelli <f.fainelli@gmail.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
UNGLinuxDriver@microchip.com,
Woojung Huh <woojung.huh@microchip.com>,
stable@vger.kernel.org
Subject: Re: [PATCH] net: dsa: microchip: Fix gigabit set and get function for KSZ87xx
Date: Wed, 22 Feb 2023 23:25:26 +0200 [thread overview]
Message-ID: <20230222212526.bfcef4dsg6crwlmh@skbuf> (raw)
In-Reply-To: <Y/YPfxg8Ackb8zmW@shell.armlinux.org.uk>
On Wed, Feb 22, 2023 at 12:50:07PM +0000, Russell King (Oracle) wrote:
> Looking at this driver, I have to say that it looks utterly vile
> from the point of view of being sure that it is correct, and I
> think this patch illustrates why.
...
> Now, what about other KSZ devices - I've analysed this for the KSZ8795,
> but what about any of the others which use this register table? It
> looks to me like those that use ksz8795_regs[] all use ksz8_dev_ops
> and the same masks and bitvals, so they should be the same.
>
> That is a hell of a lot of work to prove that setting both
> P_XMII_CTRL_0 and P_XMII_CTRL_1 to point at the same register is
> in fact safe. Given the number of registers, the masks, and bitval
> arrays, doing this to prove every combination and then analysing
> the code is utterly impractical - and thus why I label this driver
> as "vile". Is there really no better option to these register
> arrays, bitval arrays and mask arrays - something that makes it
> easier to review and prove correctness?
Only my 2 cents. What is utterly vile is the decision of hardware design
to break software compatibility in such a deliberate and gratuitous way
across switch generations. A driver can only do so much when fed with
such hardware as input.
The ksz driver could use struct reg_field from regmap to mitigate that
to a certain extent (like the ocelot driver does), but certain quirks
will still remain present in the ksz driver. For example, the "bitval"
array. The value "1" written to the P_GMII_1GBIT reg_field indicates
gigabit for ksz8795, but !gigabit on ksz9477. I am not aware of any
abstraction to mask that away in common code other than the bitvals.
Even with struct reg_field, it would still not address the fundamental
problem which is simply that the register fields responsible for a
certain function have hopped so much from generation to generation,
that getting all offsets and bits right for each generation is a
challenge in itself.
next prev parent reply other threads:[~2023-02-22 21:25 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-22 3:17 [PATCH] net: dsa: microchip: Fix gigabit set and get function for KSZ87xx Marek Vasut
2023-02-22 3:52 ` Arun.Ramadoss
2023-02-22 12:50 ` Russell King (Oracle)
2023-02-22 13:03 ` Russell King (Oracle)
2023-02-22 15:10 ` Marek Vasut
2023-02-22 15:56 ` Russell King (Oracle)
2023-02-22 16:30 ` Marek Vasut
2023-02-22 16:39 ` Russell King (Oracle)
2023-02-22 18:43 ` Marek Vasut
2023-02-22 19:12 ` Russell King (Oracle)
2023-02-22 21:25 ` Vladimir Oltean [this message]
2023-02-22 21:08 ` Vladimir Oltean
2023-02-22 22:05 ` Marek Vasut
2023-02-22 22:31 ` Vladimir Oltean
2023-02-22 22:58 ` Marek Vasut
2023-02-22 23:05 ` Florian Fainelli
2023-02-22 23:07 ` Russell King (Oracle)
2023-02-22 23:21 ` Vladimir Oltean
2023-02-22 23:55 ` Marek Vasut
2023-02-23 0:22 ` Vladimir Oltean
2023-02-23 5:17 ` Marek Vasut
2023-02-23 14:20 ` 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=20230222212526.bfcef4dsg6crwlmh@skbuf \
--to=olteanv@gmail.com \
--cc=UNGLinuxDriver@microchip.com \
--cc=andrew@lunn.ch \
--cc=arun.ramadoss@microchip.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=f.fainelli@gmail.com \
--cc=kuba@kernel.org \
--cc=linux@armlinux.org.uk \
--cc=marex@denx.de \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=stable@vger.kernel.org \
--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