Skip to contentSkip to conversation

net: dsa: loop: Fix devlink resource ID

PATCH In review David Yang 2 participants 4 messages Jun 10

Subsystems (3)
lore
Share & tools
lore

David Yang

author
#0 lore raw

PATCH 1/1 net: dsa: loop: Fix devlink resource ID

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.

---
 drivers/net/dsa/dsa_loop.c | 1 +
 1 file changed, 1 insertion(+)
drivers/net/dsa/dsa_loop.c +1 -0
index 7058faf23592..9497c84fb249 100644
@@ -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,
 };
 
Signature · 1 line
2.53.0
maintainer
#1 lore raw
Quoted 2 lines · David Yang

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

author
#2 lore raw
Quoted 10 lines · Andrew Lunn
Quoted 2 lines · David Yang

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.

maintainer
#3 lore raw
Quoted 12 lines · David Yang
Quoted 10 lines · Andrew Lunn
Quoted 2 lines · David Yang

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

Quoted 8 lines

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