fff-network: apply upstream swap of MAC addresses for Archer C60

The ethernet MAC addresses of the Archer C60 v1/v2 were swapped
compared to the vendor assignment. This has been fixed in OpenWrt
after 19.07.2.

Apply this to our firmware already, so we cannot forget it later
and prevent having messed-up br-mesh MAC addresses.

The OpenWrt patches can be removed again when bumping to 19.07.3.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
Reviewed-by: Fabian Bläse <fabian@blaese.de>
This commit is contained in:
Adrian Schmutzler 2020-03-14 20:56:20 +01:00 committed by Fabian Bläse
parent aa42a39ce2
commit aa0d237fa9
5 changed files with 94 additions and 5 deletions

View File

@ -0,0 +1,61 @@
From: Adrian Schmutzler <freifunk@adrianschmutzler.de>
Date: Wed, 11 Mar 2020 15:46:00 +0100
Subject: ar71xx: fix swapped LAN/WAN MAC address for Archer C60 v1/v2
The MAC addresses for lan/wan are swapped compared to the vendor
firmware. This adjusts to vendor configuration, which is:
lan *:7b label
wan *:7c label+1
2.4g *:7b label
5g *:7a label-1
Only one address is stored in <&mac 0x8>, corresponding to the label.
This has been checked on revisions v1, v2 and v3.
Since ar71xx calculates the ath10k MAC address based on the ethernet
addresses, the number there is adjusted, too.
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
(cherry picked from commit 14eb54938b525d4c2d2847a6fad7670ed944650c)
diff --git a/target/linux/ar71xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata b/target/linux/ar71xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata
index 718fd7555c73c247cb662c0a8638895e2da38b84..8fb5be643c9c1372195bf10e3e45927c2f6a2a55 100644
--- a/target/linux/ar71xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata
+++ b/target/linux/ar71xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata
@@ -182,7 +182,7 @@ case "$FIRMWARE" in
ath10kcal_extract "art" 20480 12064
ln -sf /lib/firmware/ath10k/pre-cal-pci-0000\:00\:00.0.bin \
/lib/firmware/ath10k/QCA9888/hw2.0/board.bin
- ath10kcal_patch_mac $(macaddr_add $(cat /sys/class/net/eth0/address) -1)
+ ath10kcal_patch_mac $(macaddr_add $(cat /sys/class/net/eth1/address) -1)
;;
cf-e385ac)
ath10kcal_extract "art" 20480 12064
diff --git a/target/linux/ar71xx/files/arch/mips/ath79/mach-archer-c60-v1.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-archer-c60-v1.c
index 88f4f081a34db9b289d393d9c7ad4693ddb9b01d..a0839e6bcadd39b826d657141c5ba94fc5b2a729 100644
--- a/target/linux/ar71xx/files/arch/mips/ath79/mach-archer-c60-v1.c
+++ b/target/linux/ar71xx/files/arch/mips/ath79/mach-archer-c60-v1.c
@@ -157,8 +157,8 @@ static void __init archer_c60_v1_setup(void)
ath79_register_mdio(0, 0x0);
ath79_register_mdio(1, 0x0);
- ath79_init_mac(ath79_eth0_data.mac_addr, mac, 0);
- ath79_init_mac(ath79_eth1_data.mac_addr, mac, 1);
+ ath79_init_mac(ath79_eth1_data.mac_addr, mac, 0);
+ ath79_init_mac(ath79_eth0_data.mac_addr, mac, 1);
/* WAN port */
ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_MII;
@@ -199,8 +199,8 @@ static void __init archer_c60_v2_setup(void)
ath79_register_mdio(0, 0x0);
ath79_register_mdio(1, 0x0);
- ath79_init_mac(ath79_eth0_data.mac_addr, mac, 0);
- ath79_init_mac(ath79_eth1_data.mac_addr, mac, 1);
+ ath79_init_mac(ath79_eth1_data.mac_addr, mac, 0);
+ ath79_init_mac(ath79_eth0_data.mac_addr, mac, 1);
/* WAN port */
ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_MII;

View File

@ -0,0 +1,28 @@
From: Adrian Schmutzler <freifunk@adrianschmutzler.de>
Date: Wed, 11 Mar 2020 15:52:41 +0100
Subject: ar71xx: remove wrong MAC address adjustment for Archer C60 v2
The adjustment of the MAC address for Archer C60 v2 in 10_fix_wifi_mac
is broken since a "mac" partition is not set up for this device on
ar71xx. Instead, the MAC address is already patched correctly in
11-ath10k-caldata.
Remove the useless adjustment.
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
(cherry picked from commit cbdc91902466dd113b9680566abb2eb2f8022dd4)
diff --git a/target/linux/ar71xx/base-files/etc/hotplug.d/ieee80211/10_fix_wifi_mac b/target/linux/ar71xx/base-files/etc/hotplug.d/ieee80211/10_fix_wifi_mac
index b58cf9b591f47c394c4c4b4a21e114e16af2da21..d6fac80bc942bc2ddc7d08c1ab0c5ead160701c6 100644
--- a/target/linux/ar71xx/base-files/etc/hotplug.d/ieee80211/10_fix_wifi_mac
+++ b/target/linux/ar71xx/base-files/etc/hotplug.d/ieee80211/10_fix_wifi_mac
@@ -15,8 +15,7 @@ case "$board" in
archer-c58-v1|\
archer-c59-v1|\
archer-c59-v2|\
- archer-c60-v1|\
- archer-c60-v2)
+ archer-c60-v1)
echo $(macaddr_add $(mtd_get_mac_binary mac 8) $(($PHYNBR - 1)) ) > /sys${DEVPATH}/macaddress
;;
*)

View File

@ -1,7 +1,7 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=fff-network
PKG_RELEASE:=16
PKG_RELEASE:=17
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)

View File

@ -5,5 +5,5 @@ SWITCHDEV=eth1
CLIENT_PORTS="1 2 0t"
BATMAN_PORTS="3 4 0t"
ETHMESHMAC=$(cat /sys/class/net/eth1/address)
ROUTERMAC=$(cat /sys/class/net/eth0/address)
ETHMESHMAC=$(cat /sys/class/net/eth0/address)
ROUTERMAC=$(cat /sys/class/net/eth1/address)

View File

@ -5,5 +5,5 @@ SWITCHDEV=eth1
CLIENT_PORTS="1 2 0t"
BATMAN_PORTS="3 4 0t"
ETHMESHMAC=$(cat /sys/class/net/eth1/address)
ROUTERMAC=$(cat /sys/class/net/eth0/address)
ETHMESHMAC=$(cat /sys/class/net/eth0/address)
ROUTERMAC=$(cat /sys/class/net/eth1/address)