net: dsa: loop: Fix devlink resource ID
Subsystems (3)
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
@@ -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
Andrew Lunn
maintainerQuoted 2 lines · David Yang
Fix collision with
DEVLINK_RESOURCE_ID_PARENT_TOP(0) by keeping the real resource IDs in enumdsa_loop_devlink_resource_idstarting 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 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 enumdsa_loop_devlink_resource_idstarting 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.
Andrew Lunn
maintainerQuoted 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 enumdsa_loop_devlink_resource_idstarting 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 ofdevl_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 withPARENT_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