mox: Adjust detection of which eth port belongs to which module
Detection of mox switch module number fails to tell modules apart,
because phys_switch_id
always has value 00000000 for all switch ports.
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
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.
Closes: #16 (closed)