From: Bastien Curutchet <bastien.curutchet@bootlin.com>
To: Jakub Kicinski <kuba@kernel.org>
Cc: woojung.huh@microchip.com, UNGLinuxDriver@microchip.com,
andrew@lunn.ch, olteanv@gmail.com, davem@davemloft.net,
edumazet@google.com, pabeni@redhat.com, linux@armlinux.org.uk,
richardcochran@gmail.com, pascal.eberhard@se.com,
miquel.raynal@bootlin.com, thomas.petazzoni@bootlin.com,
tristram.ha@microchip.com, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH net-next 13/15] net: dsa: microchip: bypass dev_ops for port_setup()
Date: Fri, 15 May 2026 09:50:13 +0200 [thread overview]
Message-ID: <7e173325-0391-45af-a4c4-45bba216b637@bootlin.com> (raw)
In-Reply-To: <20260515011513.1270901-1-kuba@kernel.org>
Hi,
On 5/15/26 3:15 AM, Jakub Kicinski wrote:
> This is an AI-generated review of your patch. The human sending this
> email has considered the AI review valid, or at least plausible.
> ---
> net: dsa: microchip: bypass dev_ops for port_setup()
>
> This commit removes an indirection layer for KSZ switches by connecting
> the port_setup operations directly to dsa_switch_ops, bypassing the
> ksz_dev_ops callback mechanism.
>
>> diff --git a/drivers/net/dsa/microchip/ksz9477.c b/drivers/net/dsa/microchip/ksz9477.c
>> index 7385aa4e788a1..2f63a3a7d6ceb 100644
>> --- a/drivers/net/dsa/microchip/ksz9477.c
>> +++ b/drivers/net/dsa/microchip/ksz9477.c
> [ ... ]
>> @@ -1309,6 +1309,23 @@ static void ksz9477_port_setup(struct ksz_device *dev, int port, bool cpu_port)
>> ksz_pwrite8(dev, port, regs[REG_PORT_PME_CTRL], 0);
>> }
>>
>> +int ksz9477_dsa_port_setup(struct dsa_switch *ds, int port)
>> +{
>> + struct ksz_device *dev = ds->priv;
>> + int ret;
>> +
>> + if (!dsa_is_user_port(ds, port))
>> + return 0;
>> +
>> + ksz9477_port_setup(dev, port, false);
>> +
>> + ret = ksz9477_set_default_prio_queue_mapping(dev, port);
>> + if (ret)
>> + return ret;
>> +
>> + return ksz_dcb_init_port(dev, port);
>> +};
>
> This isn't a bug, but there's a stray semicolon at the end of the function definition.
>
Good catch.
> [ ... ]
>> diff --git a/drivers/net/dsa/microchip/lan937x_main.c b/drivers/net/dsa/microchip/lan937x_main.c
>> index ecb072cd99819..aff0c2735c307 100644
>> --- a/drivers/net/dsa/microchip/lan937x_main.c
>> +++ b/drivers/net/dsa/microchip/lan937x_main.c
> [ ... ]
>> @@ -823,7 +822,7 @@ const struct dsa_switch_ops lan937x_switch_ops = {
>> .phy_read = ksz_phy_read16,
>> .phy_write = ksz_phy_write16,
>> .phylink_get_caps = lan937x_phylink_get_caps,
>> - .port_setup = ksz_port_setup,
>> + .port_setup = ksz9477_dsa_port_setup,
>
> Is it intentional to use ksz9477_dsa_port_setup() for LAN937x switches here?
>
> Previously, the shared ksz_port_setup() dynamically dispatched the
> initialization via dev->dev_ops->port_setup(), which correctly resolved to
> lan937x_port_setup() for LAN937x devices.
>
> Since the new ksz9477_dsa_port_setup() function explicitly hardcodes a call
> to ksz9477_port_setup(), won't this cause LAN937x ports to skip their
> specific initialization logic and instead receive incorrect register
> configurations meant for KSZ9477 hardware?
True, I'll fix this in next iteration
Best regards,
Bastien
next prev parent reply other threads:[~2026-05-15 7:50 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-12 13:06 [PATCH net-next 00/15] net: dsa: microchip: Remove unnecessary ksz_dev_ops callbacks Bastien Curutchet (Schneider Electric)
2026-05-12 13:06 ` [PATCH net-next 01/15] net: dsa: microchip: remove unused phylink_mac_link_up() callback Bastien Curutchet (Schneider Electric)
2026-05-12 13:06 ` [PATCH net-next 02/15] net: dsa: microchip: bypass dev_ops for FDB ageing operations Bastien Curutchet
2026-05-12 13:06 ` [PATCH net-next 03/15] net: dsa: microchip: bypass dev_ops for change_mtu() operation Bastien Curutchet
2026-05-12 13:06 ` [PATCH net-next 04/15] net: dsa: microchip: bypass dev_ops for VLAN operations Bastien Curutchet
2026-05-12 13:06 ` [PATCH net-next 05/15] net: dsa: microchip: bypass dev_ops for FDB and MDB operations Bastien Curutchet
2026-05-12 13:06 ` [PATCH net-next 06/15] net: dsa: microchip: bypass dev_ops for mirror operations Bastien Curutchet
2026-05-12 13:06 ` [PATCH net-next 07/15] net: dsa: microchip: bypass dev_ops for phylink_get_caps() Bastien Curutchet
2026-05-12 13:06 ` [PATCH net-next 08/15] net: dsa: microchip: don't reset on shutdown or driver removal Bastien Curutchet
2026-05-12 13:06 ` [PATCH net-next 09/15] net: dsa: microchip: bypass dev_ops->setup() and teardown() for lan937x Bastien Curutchet
2026-05-12 13:06 ` [PATCH net-next 10/15] net: dsa: microchip: bypass dev_ops->setup() and teardown() for ksz9477 Bastien Curutchet
2026-05-12 13:06 ` [PATCH net-next 11/15] net: dsa: microchip: bypass dev_ops->setup() and teardown() for ksz8 Bastien Curutchet
2026-05-12 13:06 ` [PATCH net-next 12/15] net: dsa: microchip: remove dev_ops->setup() and teardown() Bastien Curutchet
2026-05-12 13:06 ` [PATCH net-next 13/15] net: dsa: microchip: bypass dev_ops for port_setup() Bastien Curutchet (Schneider Electric)
2026-05-15 1:15 ` Jakub Kicinski
2026-05-15 7:50 ` Bastien Curutchet [this message]
2026-05-12 13:06 ` [PATCH net-next 14/15] net: dsa: microchip: call DSA's phy_{read/write} to do mdio {read/write} Bastien Curutchet (Schneider Electric)
2026-05-12 13:06 ` [PATCH net-next 15/15] net: dsa: microchip: bypass dev_ops for phy_read()/phy_write() Bastien Curutchet (Schneider Electric)
2026-05-15 1:20 ` [PATCH net-next 00/15] net: dsa: microchip: Remove unnecessary ksz_dev_ops callbacks patchwork-bot+netdevbpf
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=7e173325-0391-45af-a4c4-45bba216b637@bootlin.com \
--to=bastien.curutchet@bootlin.com \
--cc=UNGLinuxDriver@microchip.com \
--cc=andrew@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--cc=miquel.raynal@bootlin.com \
--cc=netdev@vger.kernel.org \
--cc=olteanv@gmail.com \
--cc=pabeni@redhat.com \
--cc=pascal.eberhard@se.com \
--cc=richardcochran@gmail.com \
--cc=thomas.petazzoni@bootlin.com \
--cc=tristram.ha@microchip.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