mirror of
https://github.com/openwrt/openwrt.git
synced 2026-10-23 02:07:47 +04:00
Interface naming currently depends on registration order between stmmac instances, which is non-deterministic when multiple probes race at boot (e.g. two independent GMACs with no shared switch). This causes eth0/eth1 to swap randomly across reboots on some platforms. Force the netdev name to match the "ethernetN" DT alias when one is present. plat->bus_id cannot be used for this: stmmac_platform.c falls back to a driver-global counter when of_alias_get_id() finds no alias, so plat->bus_id is never negative and every stmmac netdev would be forced, including boards with no alias at all. Re-read the alias directly from the device's OF node instead, and only force the name when it actually resolves. Fall back to the original auto-numbering template if the forced name collides. unifi-ac-hd already has a correct alias mapping, so the preinit eth0/eth1 swap hack for it is no longer needed. Drop it. Signed-off-by: Mieczyslaw Nalewaj <namiltd@yahoo.com> Link: https://github.com/openwrt/openwrt/pull/25143 Signed-off-by: Robert Marko <robimarko@gmail.com>