aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/ipq806x
diff options
context:
space:
mode:
authorMark Mentovai <mark@moxienet.com>2021-04-12 11:59:20 -0400
committerPetr Štetiar <ynezz@true.cz>2021-05-07 07:05:16 +0200
commit565814a5eeb9252d0586c9c7a576f7d1cc9d4bc3 (patch)
tree327f6621f54eac24e5658616ac0e95ac1485215f /target/linux/ipq806x
parent4f74966852433651164c9a2a3544f727a45f30b4 (diff)
downloadupstream-565814a5eeb9252d0586c9c7a576f7d1cc9d4bc3.tar.gz
upstream-565814a5eeb9252d0586c9c7a576f7d1cc9d4bc3.tar.bz2
upstream-565814a5eeb9252d0586c9c7a576f7d1cc9d4bc3.zip
ipq806x: ubnt,unifi-ac-hd: reorder eth0 and eth1
The Ubiquiti UniFi AC HD (UAP-AC-HD, UAP301) has two Ethernet ports, labeled MAIN and SECONDARY, connected to gmac2 and gmac1, respectively. The standard probe order results in gmac1/SECONDARY being eth0 and gmac2/MAIN being eth1. This does not match the stock firmware, is contrary to user expectation, causes the wrong (high) MAC address to be used in a bridged configuration (the default for this device), and makes the gmac2/MAIN port unusable in the preinit environment (such as for failsafe). Until a recent patch, gmac1/SECONDARY (eth0) was not even usable. This reorders the ports so that gmac2/MAIN is eth0, and the now-working gmac1/SECONDARY is eth1. eth0 has the low MAC address and eth1 has the high; when bridged, the bridge takes on the correct low MAC address. This matches the stock firmware. The MAIN port is usable for failsafe during preinit. This device does not have a switch on board, so there's no possibility to remap ports via switch configuration. "ip link set $interface name" is used instead, during preinit before networking is configured. Signed-off-by: Mark Mentovai <mark@moxienet.com> Build-tested: ipq806x/ubnt,unifi-ac-hd Run-tested: ipq806x/ubnt,unifi-ac-hd
Diffstat (limited to 'target/linux/ipq806x')
-rw-r--r--target/linux/ipq806x/base-files/lib/preinit/04_reorder_eth13
-rw-r--r--target/linux/ipq806x/files/arch/arm/boot/dts/qcom-ipq8064-unifi-ac-hd.dts4
2 files changed, 15 insertions, 2 deletions
diff --git a/target/linux/ipq806x/base-files/lib/preinit/04_reorder_eth b/target/linux/ipq806x/base-files/lib/preinit/04_reorder_eth
new file mode 100644
index 0000000000..9f58473617
--- /dev/null
+++ b/target/linux/ipq806x/base-files/lib/preinit/04_reorder_eth
@@ -0,0 +1,13 @@
+. /lib/functions.sh
+
+preinit_reorder_eth() {
+ case $(board_name) in
+ ubnt,unifi-ac-hd)
+ ip link set eth0 name ethtmp
+ ip link set eth1 name eth0
+ ip link set ethtmp name eth1
+ ;;
+ esac
+}
+
+boot_hook_add preinit_main preinit_reorder_eth
diff --git a/target/linux/ipq806x/files/arch/arm/boot/dts/qcom-ipq8064-unifi-ac-hd.dts b/target/linux/ipq806x/files/arch/arm/boot/dts/qcom-ipq8064-unifi-ac-hd.dts
index 70c51b90f3..672be3ca2c 100644
--- a/target/linux/ipq806x/files/arch/arm/boot/dts/qcom-ipq8064-unifi-ac-hd.dts
+++ b/target/linux/ipq806x/files/arch/arm/boot/dts/qcom-ipq8064-unifi-ac-hd.dts
@@ -16,8 +16,8 @@
led-running = &led_dome_blue;
led-upgrade = &led_dome_blue;
mdio-gpio0 = &mdio0;
- ethernet0 = &gmac1;
- ethernet1 = &gmac2;
+ ethernet0 = &gmac2;
+ ethernet1 = &gmac1;
};
leds {