netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net] net: dsa: felix: break at first CPU port during init and teardown
@ 2021-09-23 16:26 Vladimir Oltean
  2021-09-24 12:54 ` Vladimir Oltean
  0 siblings, 1 reply; 2+ messages in thread
From: Vladimir Oltean @ 2021-09-23 16:26 UTC (permalink / raw)
  To: netdev
  Cc: Andrew Lunn, Vivien Didelot, Florian Fainelli, Vladimir Oltean,
	David S. Miller, Jakub Kicinski

The NXP LS1028A switch has two Ethernet ports towards the CPU, but only
one of them is capable of acting as an NPI port at a time (inject and
extract packets using DSA tags).

However, using the alternative ocelot-8021q tagging protocol, it should
be possible to use both CPU ports symmetrically, but for that we need to
mark both ports in the device tree as DSA masters.

In the process of doing that, it can be seen that traffic to/from the
network stack gets broken, and this is because the Felix driver iterates
through all DSA CPU ports and configures them as NPI ports. But since
there can only be a single NPI port, we effectively end up in a
situation where DSA thinks the default CPU port is the first one, but
the hardware port configured to be an NPI is the last one.

I would like to treat this as a bug, because if the updated device trees
are going to start circulating, it would be really good for existing
kernels to support them, too.

Fixes: adb3dccf090b ("net: dsa: felix: convert to the new .change_tag_protocol DSA API")
Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
---
 drivers/net/dsa/ocelot/felix.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/net/dsa/ocelot/felix.c b/drivers/net/dsa/ocelot/felix.c
index 50f872454b7a..571b20fd2b4a 100644
--- a/drivers/net/dsa/ocelot/felix.c
+++ b/drivers/net/dsa/ocelot/felix.c
@@ -1126,6 +1126,7 @@ static int felix_setup(struct dsa_switch *ds)
 		 * there's no real point in checking for errors.
 		 */
 		felix_set_tag_protocol(ds, port, felix->tag_proto);
+		break;
 	}
 
 	ds->mtu_enforcement_ingress = true;
@@ -1162,6 +1163,7 @@ static void felix_teardown(struct dsa_switch *ds)
 			continue;
 
 		felix_del_tag_protocol(ds, port, felix->tag_proto);
+		break;
 	}
 
 	ocelot_devlink_sb_unregister(ocelot);
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH net] net: dsa: felix: break at first CPU port during init and teardown
  2021-09-23 16:26 [PATCH net] net: dsa: felix: break at first CPU port during init and teardown Vladimir Oltean
@ 2021-09-24 12:54 ` Vladimir Oltean
  0 siblings, 0 replies; 2+ messages in thread
From: Vladimir Oltean @ 2021-09-24 12:54 UTC (permalink / raw)
  To: netdev
  Cc: Andrew Lunn, Vivien Didelot, Florian Fainelli, Vladimir Oltean,
	David S. Miller, Jakub Kicinski

On Thu, Sep 23, 2021 at 07:26:41PM +0300, Vladimir Oltean wrote:
> The NXP LS1028A switch has two Ethernet ports towards the CPU, but only
> one of them is capable of acting as an NPI port at a time (inject and
> extract packets using DSA tags).
> 
> However, using the alternative ocelot-8021q tagging protocol, it should
> be possible to use both CPU ports symmetrically, but for that we need to
> mark both ports in the device tree as DSA masters.
> 
> In the process of doing that, it can be seen that traffic to/from the
> network stack gets broken, and this is because the Felix driver iterates
> through all DSA CPU ports and configures them as NPI ports. But since
> there can only be a single NPI port, we effectively end up in a
> situation where DSA thinks the default CPU port is the first one, but
> the hardware port configured to be an NPI is the last one.
> 
> I would like to treat this as a bug, because if the updated device trees
> are going to start circulating, it would be really good for existing
> kernels to support them, too.
> 
> Fixes: adb3dccf090b ("net: dsa: felix: convert to the new .change_tag_protocol DSA API")
> Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
> ---

I will send a v2 for this patch, please discard.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-09-24 12:57 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-23 16:26 [PATCH net] net: dsa: felix: break at first CPU port during init and teardown Vladimir Oltean
2021-09-24 12:54 ` Vladimir Oltean

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).