mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH net-next] net: dsa: loop: Fix devlink resource ID
@ 2026-06-10  6:25 David Yang
  2026-06-10  7:23 ` Andrew Lunn
  0 siblings, 1 reply; 4+ messages in thread
From: David Yang @ 2026-06-10  6:25 UTC (permalink / raw)
  To: netdev
  Cc: David Yang, Andrew Lunn, Vladimir Oltean, David S. Miller,
	Eric Dumazet, Jakub Kicinski, Paolo Abeni, linux-kernel

Fix collision with DEVLINK_RESOURCE_ID_PARENT_TOP (0) by keeping the
real resource IDs in enum dsa_loop_devlink_resource_id starting at 1.

Signed-off-by: David Yang <mmyangfl@gmail.com>
---
 drivers/net/dsa/dsa_loop.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/dsa/dsa_loop.c b/drivers/net/dsa/dsa_loop.c
index 7058faf23592..9497c84fb249 100644
--- a/drivers/net/dsa/dsa_loop.c
+++ b/drivers/net/dsa/dsa_loop.c
@@ -75,6 +75,7 @@ static struct phy_device *phydevs[PHY_MAX_ADDR];
 static struct mdio_device *switch_mdiodev;
 
 enum dsa_loop_devlink_resource_id {
+	DSA_LOOP_DEVLINK_PARAM_NONE,  /* DEVLINK_RESOURCE_ID_PARENT_TOP */
 	DSA_LOOP_DEVLINK_PARAM_ID_VTU,
 };
 
-- 
2.53.0


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

* Re: [PATCH net-next] net: dsa: loop: Fix devlink resource ID
  2026-06-10  6:25 [PATCH net-next] net: dsa: loop: Fix devlink resource ID David Yang
@ 2026-06-10  7:23 ` Andrew Lunn
  2026-06-10 13:36   ` David Yang
  0 siblings, 1 reply; 4+ messages in thread
From: Andrew Lunn @ 2026-06-10  7:23 UTC (permalink / raw)
  To: David Yang
  Cc: netdev, Vladimir Oltean, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, linux-kernel

On Wed, Jun 10, 2026 at 02:25:45PM +0800, David Yang wrote:
> Fix collision with DEVLINK_RESOURCE_ID_PARENT_TOP (0) by keeping the
> real resource IDs in enum dsa_loop_devlink_resource_id starting at 1.

Please could you expand on this. What is actually wrong here?

When i look at mv88e6xxx, hellcreak and b53 it does the same.

     Andrew

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

* Re: [PATCH net-next] net: dsa: loop: Fix devlink resource ID
  2026-06-10  7:23 ` Andrew Lunn
@ 2026-06-10 13:36   ` David Yang
  2026-06-10 20:28     ` Andrew Lunn
  0 siblings, 1 reply; 4+ messages in thread
From: David Yang @ 2026-06-10 13:36 UTC (permalink / raw)
  To: Andrew Lunn
  Cc: netdev, Vladimir Oltean, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, linux-kernel

On Wed, Jun 10, 2026 at 3:23 PM Andrew Lunn <andrew@lunn.ch> wrote:
>
> On Wed, Jun 10, 2026 at 02:25:45PM +0800, David Yang wrote:
> > Fix collision with DEVLINK_RESOURCE_ID_PARENT_TOP (0) by keeping the
> > real resource IDs in enum dsa_loop_devlink_resource_id starting at 1.
>
> Please could you expand on this. What is actually wrong here?
>
> When i look at mv88e6xxx, hellcreak and b53 it does the same.
>
>      Andrew

dsa_devlink_resource_register() is, but other users of
devl_resource_register() (mlxsw and netdevsim) avoid 0 explicitly.

In this case for dsa_loop, the usage is semantically questionable (0
being its own parent) but might just work as well. But it is a real
problem on mv88e6xxx, where ATU_bin_* are in fact registered as
top-level siblings, not as children of ATU, due to ATU ID colliding
with PARENT_TOP.

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

* Re: [PATCH net-next] net: dsa: loop: Fix devlink resource ID
  2026-06-10 13:36   ` David Yang
@ 2026-06-10 20:28     ` Andrew Lunn
  0 siblings, 0 replies; 4+ messages in thread
From: Andrew Lunn @ 2026-06-10 20:28 UTC (permalink / raw)
  To: David Yang
  Cc: netdev, Vladimir Oltean, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, linux-kernel

On Wed, Jun 10, 2026 at 09:36:59PM +0800, David Yang wrote:
> On Wed, Jun 10, 2026 at 3:23 PM Andrew Lunn <andrew@lunn.ch> wrote:
> >
> > On Wed, Jun 10, 2026 at 02:25:45PM +0800, David Yang wrote:
> > > Fix collision with DEVLINK_RESOURCE_ID_PARENT_TOP (0) by keeping the
> > > real resource IDs in enum dsa_loop_devlink_resource_id starting at 1.
> >
> > Please could you expand on this. What is actually wrong here?
> >
> > When i look at mv88e6xxx, hellcreak and b53 it does the same.
> >
> >      Andrew
> 
> dsa_devlink_resource_register() is, but other users of
> devl_resource_register() (mlxsw and netdevsim) avoid 0 explicitly.
> 
> In this case for dsa_loop, the usage is semantically questionable (0
> being its own parent) but might just work as well. But it is a real
> problem on mv88e6xxx, where ATU_bin_* are in fact registered as
> top-level siblings, not as children of ATU, due to ATU ID colliding
> with PARENT_TOP.

So please produce a patchset fixing all users of
devl_resource_register() which pass 0. And then maybe add WARN_ON()?

    Andrew

---
pw-bot: cr

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

end of thread, other threads:[~2026-06-10 20:28 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-06-10  6:25 [PATCH net-next] net: dsa: loop: Fix devlink resource ID David Yang
2026-06-10  7:23 ` Andrew Lunn
2026-06-10 13:36   ` David Yang
2026-06-10 20:28     ` Andrew Lunn

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®