From: Jens Emil Schulz Ostergaard <jensemil.schulzostergaard@microchip.com>
To: Andrew Lunn <andrew@lunn.ch>
Cc: <UNGLinuxDriver@microchip.com>,
Vladimir Oltean <olteanv@gmail.com>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
"Simon Horman" <horms@kernel.org>, Rob Herring <robh@kernel.org>,
Krzysztof Kozlowski <krzk+dt@kernel.org>,
Conor Dooley <conor+dt@kernel.org>,
Woojung Huh <woojung.huh@microchip.com>,
Russell King <linux@armlinux.org.uk>,
"Steen Hegelund" <Steen.Hegelund@microchip.com>,
Daniel Machon <daniel.machon@microchip.com>,
<linux-kernel@vger.kernel.org>, <netdev@vger.kernel.org>,
<devicetree@vger.kernel.org>
Subject: Re: [PATCH net-next v7 4/9] net: dsa: lan9645x: add basic dsa driver for LAN9645X
Date: Tue, 9 Jun 2026 09:08:13 +0200 [thread overview]
Message-ID: <a9ab4d129f2e3158c1a7b01d0a975fac00a05893.camel@microchip.com> (raw)
In-Reply-To: <9ee993d0-9a71-48ff-b368-fcebe1ee9e48@lunn.ch>
On Mon, 2026-06-08 at 20:00 +0200, Andrew Lunn wrote:
> EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
>
> > + dsa_switch_for_each_user_port(dp, ds) {
> > + if (dp->cpu_dp->ds != ds) {
> > + dev_err(ds->dev,
> > + "NPI port on a remote switch is not supported\n");
> > + return -EINVAL;
> > + }
> > +
> > + if (first_cpu_dp && dp->cpu_dp != first_cpu_dp) {
> > + dev_err(ds->dev, "Multiple NPI ports not supported\n");
> > + return -EINVAL;
> > + }
> > +
> > + first_cpu_dp = dp->cpu_dp;
>
> The reason i asked about NPI ports is because this is looping over
> user ports. Yet you say one of these user ports is a CPU port. That
> cannot be correct.
>
> The first port returned by dsa_tree_for_each_cpu_port() would be
> first_cpu_dp.
>
> Andrew
I tried to mimic the approach in drivers/net/dsa/ocelot/felix.c:
static int felix_tag_npi_setup(struct dsa_switch *ds)
{
struct dsa_port *dp, *first_cpu_dp = NULL;
struct ocelot *ocelot = ds->priv;
dsa_switch_for_each_user_port(dp, ds) {
if (first_cpu_dp && dp->cpu_dp != first_cpu_dp) {
dev_err(ds->dev, "Multiple NPI ports not supported\n");
return -EINVAL;
}
first_cpu_dp = dp->cpu_dp;
}
if (!first_cpu_dp)
return -EINVAL;
felix_npi_port_init(ocelot, first_cpu_dp->index);
return 0;
}
Perhaps I misunderstand you, but there could be confusion about
terminology. The chip designers have a concept of CPU port, which is
used liberally in the datasheet, and in this driver code.
However, the concept is different from the DSA concept of a CPU port.
Let us call the first switch CPU port, and the second DSA CPU port.
The port we want to use as a DSA CPU port, i.e. the port with the
'ethernet = <&host_port>;' property in the device tree, will be
configured to be an NPI port for injection/extraction for the switch CPU
port (which is not a physical port on the device).
Therefore, this NPI port is not iterated by
dsa_switch_for_each_user_port. The switch CPU port (index 9) is also not
iterated by it. It is a chip internal construct with no representation
in the device tree, and no struct dsa_port.
Thanks,
Emil
next prev parent reply other threads:[~2026-06-09 7:08 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-03 7:25 [PATCH net-next v7 0/9] net: dsa: add DSA support for the LAN9645x switch chip family Jens Emil Schulz Østergaard
2026-06-03 7:25 ` [PATCH net-next v7 1/9] net: dsa: add tag driver for LAN9645X Jens Emil Schulz Østergaard
2026-06-03 7:25 ` [PATCH net-next v7 2/9] dt-bindings: net: lan9645x: add LAN9645X switch bindings Jens Emil Schulz Østergaard
2026-06-03 7:25 ` [PATCH net-next v7 3/9] net: dsa: lan9645x: add autogenerated register macros Jens Emil Schulz Østergaard
2026-06-03 7:25 ` [PATCH net-next v7 4/9] net: dsa: lan9645x: add basic dsa driver for LAN9645X Jens Emil Schulz Østergaard
2026-06-03 12:37 ` Andrew Lunn
2026-06-08 8:20 ` Jens Emil Schulz Ostergaard
2026-06-08 18:00 ` Andrew Lunn
2026-06-09 7:08 ` Jens Emil Schulz Ostergaard [this message]
2026-06-09 8:48 ` Andrew Lunn
2026-06-03 7:25 ` [PATCH net-next v7 5/9] net: dsa: lan9645x: add bridge support Jens Emil Schulz Østergaard
2026-06-03 7:25 ` [PATCH net-next v7 6/9] net: dsa: lan9645x: add vlan support Jens Emil Schulz Østergaard
2026-06-03 7:25 ` [PATCH net-next v7 7/9] net: dsa: lan9645x: add mac table integration Jens Emil Schulz Østergaard
2026-06-03 7:25 ` [PATCH net-next v7 8/9] net: dsa: lan9645x: add mdb management Jens Emil Schulz Østergaard
2026-06-03 7:25 ` [PATCH net-next v7 9/9] net: dsa: lan9645x: add port statistics Jens Emil Schulz Østergaard
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=a9ab4d129f2e3158c1a7b01d0a975fac00a05893.camel@microchip.com \
--to=jensemil.schulzostergaard@microchip.com \
--cc=Steen.Hegelund@microchip.com \
--cc=UNGLinuxDriver@microchip.com \
--cc=andrew@lunn.ch \
--cc=conor+dt@kernel.org \
--cc=daniel.machon@microchip.com \
--cc=davem@davemloft.net \
--cc=devicetree@vger.kernel.org \
--cc=edumazet@google.com \
--cc=horms@kernel.org \
--cc=krzk+dt@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--cc=netdev@vger.kernel.org \
--cc=olteanv@gmail.com \
--cc=pabeni@redhat.com \
--cc=robh@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