From: Andrew Lunn <andrew@lunn.ch>
To: Marek Vasut <marex@denx.de>
Cc: netdev@vger.kernel.org, Florian Fainelli <f.fainelli@gmail.com>,
Michael Grzeschik <m.grzeschik@pengutronix.de>,
Jakub Kicinski <kuba@kernel.org>
Subject: Re: [PATCH net-next] net: dsa: microchip: ksz8795: Fix KSZ8794 port map again
Date: Tue, 19 Jan 2021 22:27:22 +0100 [thread overview]
Message-ID: <YAdOuvUfa2ZdtaX6@lunn.ch> (raw)
In-Reply-To: <20210119205518.470974-1-marex@denx.de>
On Tue, Jan 19, 2021 at 09:55:18PM +0100, Marek Vasut wrote:
> The KSZ8795 switch has 4 external ports {0,1,2,3} and 1 CPU port {4}, so
> does the KSZ8765. The KSZ8794 seems to be repackaged KSZ8795 with different
> ID and port 3 not routed out, however the port 3 registers are present in
> the silicon, so the KSZ8794 switch has 3 external ports {0,1,2} and 1 CPU
> port {4}. Currently the driver always uses the last port as CPU port, on
> KSZ8795/KSZ8765 that is port 4 and that is OK, but on KSZ8794 that is port
> 3 and that is not OK, as it must also be port 4.
>
> This patch adjusts the driver such that it always registers a switch with
> 5 ports total (4 external ports, 1 CPU port), always sets the CPU port to
> switch port 4, and then configures the external port mask according to
> the switch model -- 3 ports for KSZ8794 and 4 for KSZ8795/KSZ8765.
Hi Marek
What appears to be missing is any checks for somebody trying to use
the 'somewhat non-existent' port.
Assuming all the drivers set dev->port_mask properly, i think you can
add a check to ksz_enable_port() and return -EINVAL if the requested
port is not a member of port_mask.
Andrew
prev parent reply other threads:[~2021-01-19 21:35 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-01-19 20:55 [PATCH net-next] net: dsa: microchip: ksz8795: Fix KSZ8794 port map again Marek Vasut
2021-01-19 21:27 ` Andrew Lunn [this message]
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=YAdOuvUfa2ZdtaX6@lunn.ch \
--to=andrew@lunn.ch \
--cc=f.fainelli@gmail.com \
--cc=kuba@kernel.org \
--cc=m.grzeschik@pengutronix.de \
--cc=marex@denx.de \
--cc=netdev@vger.kernel.org \
/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;
as well as URLs for NNTP newsgroup(s).