Mox: detection of switch module on TOS 6.0 always returns first module
TOS 6.0
Detection of mox switch module number fails to tell modules apart, because phys_switch_id
always has value 00000000
for all switch ports.
Which in turn means that we can't easily tell which eth port belongs to which mox module.
TOS 5.3.x
On TOS 5.3.x different switch ports returned different phys_switch_id
based on the physical mox module, e.g.:
00000000 -> switch 0
01000000 -> switch 1
02000000 -> switch 2
- ...
Proposed solution
Determine the Mox module number by looking into /sys/class/net/<iface>/device/of_node
real path.
For example single topaz module:
/sys/class/net/lan4/device/of_node -> [..]/firmware/devicetree/base/soc/internal-regs@d0000000/mdio@32004/switch0@2
Will identify switch as switch0@2
-> switch 0
.
These switchX@Y
identifiers should be stable, because they are defined in kernel DTS.