ucentral: development update

* fix mac assign on ath11k

Signed-off-by: John Crispin <john@phrozen.org>
This commit is contained in:
John Crispin
2021-07-27 10:10:32 +02:00
parent e964a23554
commit 1396c25a78
4 changed files with 95 additions and 50 deletions

View File

@@ -1,7 +1,7 @@
From db2eba02d81092e0e46b9abd79e6564a8f778da6 Mon Sep 17 00:00:00 2001
From 7e9c8738c1030b154cb0c0b104dbb403e5270120 Mon Sep 17 00:00:00 2001
From: John Crispin <john@phrozen.org>
Date: Thu, 27 May 2021 13:25:03 +0200
Subject: [PATCH 01/43] mac80211: update to latest HEAD
Subject: [PATCH 01/42] mac80211: update to latest HEAD
Signed-off-by: John Crispin <john@phrozen.org>
---
@@ -9,7 +9,7 @@ Signed-off-by: John Crispin <john@phrozen.org>
package/kernel/mac80211/ath.mk | 13 +-
package/kernel/mac80211/broadcom.mk | 4 +-
.../mac80211/files/lib/netifd/mac80211.sh | 36 -
.../files/lib/netifd/wireless/mac80211.sh | 179 ++-
.../files/lib/netifd/wireless/mac80211.sh | 192 ++-
.../mac80211/files/lib/wifi/mac80211.sh | 110 +-
package/kernel/mac80211/mac80211.sh.diff | 58 +
.../patches/ath/402-ath_regd_optional.patch | 2 +-
@@ -97,7 +97,7 @@ Signed-off-by: John Crispin <john@phrozen.org>
...on-API-to-configure-SAR-power-limita.patch | 398 +++++
...mac80211-add-ieee80211_set_sar_specs.patch | 51 +
.../500-mac80211_configure_antenna_gain.patch | 24 +-
92 files changed, 3725 insertions(+), 1341 deletions(-)
92 files changed, 3735 insertions(+), 1344 deletions(-)
delete mode 100644 package/kernel/mac80211/files/lib/netifd/mac80211.sh
create mode 100644 package/kernel/mac80211/mac80211.sh.diff
delete mode 100644 package/kernel/mac80211/patches/ath/560-ath9k-fix-transmitting-to-stations-in-dynamic-SMPS-m.patch
@@ -370,7 +370,7 @@ index 92e5c0e395..0000000000
- done
-}
diff --git a/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh b/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh
index 92c56afd24..0b7a84d7c9 100644
index 92c56afd24..30d6b9311a 100644
--- a/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh
+++ b/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh
@@ -1,7 +1,6 @@
@@ -381,7 +381,7 @@ index 92c56afd24..0b7a84d7c9 100644
init_wireless_driver "$@"
@@ -26,7 +25,6 @@ drv_mac80211_init_device_config() {
@@ -26,11 +25,11 @@ drv_mac80211_init_device_config() {
hostapd_common_add_device_config
config_add_string path phy 'macaddr:macaddr'
@@ -389,7 +389,12 @@ index 92c56afd24..0b7a84d7c9 100644
config_add_string tx_burst
config_add_string distance
config_add_int beacon_int chanbw frag rts
@@ -44,11 +42,24 @@ drv_mac80211_init_device_config() {
config_add_int rxantenna txantenna antenna_gain txpower
+ config_add_int num_global_macaddr
config_add_boolean noscan ht_coex acs_exclude_dfs
config_add_array ht_capab
config_add_array channels
@@ -44,11 +43,24 @@ drv_mac80211_init_device_config() {
su_beamformee \
mu_beamformer \
mu_beamformee \
@@ -416,7 +421,7 @@ index 92c56afd24..0b7a84d7c9 100644
config_add_boolean \
ldpc \
greenfield \
@@ -96,6 +107,23 @@ mac80211_add_capabilities() {
@@ -96,6 +108,23 @@ mac80211_add_capabilities() {
export -n -- "$__var=$__out"
}
@@ -440,7 +445,7 @@ index 92c56afd24..0b7a84d7c9 100644
mac80211_hostapd_setup_base() {
local phy="$1"
@@ -195,12 +223,14 @@ mac80211_hostapd_setup_base() {
@@ -195,12 +224,14 @@ mac80211_hostapd_setup_base() {
enable_ac=0
vht_oper_chwidth=0
vht_center_seg0=
@@ -456,7 +461,7 @@ index 92c56afd24..0b7a84d7c9 100644
1) idx=$(($channel + 2));;
0) idx=$(($channel - 2));;
esac
@@ -208,7 +238,7 @@ mac80211_hostapd_setup_base() {
@@ -208,7 +239,7 @@ mac80211_hostapd_setup_base() {
vht_center_seg0=$idx
;;
VHT80|HE80)
@@ -465,7 +470,7 @@ index 92c56afd24..0b7a84d7c9 100644
1) idx=$(($channel + 6));;
2) idx=$(($channel + 2));;
3) idx=$(($channel - 2));;
@@ -219,15 +249,35 @@ mac80211_hostapd_setup_base() {
@@ -219,15 +250,35 @@ mac80211_hostapd_setup_base() {
vht_center_seg0=$idx
;;
VHT160|HE160)
@@ -505,7 +510,7 @@ index 92c56afd24..0b7a84d7c9 100644
[ "$hwmode" = "a" ] || enable_ac=0
if [ "$enable_ac" != "0" ]; then
@@ -337,16 +387,62 @@ mac80211_hostapd_setup_base() {
@@ -337,16 +388,62 @@ mac80211_hostapd_setup_base() {
esac
if [ "$enable_ax" != "0" ]; then
@@ -571,7 +576,29 @@ index 92c56afd24..0b7a84d7c9 100644
fi
hostapd_prepare_device_config "$hostapd_conf_file" nl80211
@@ -449,7 +545,7 @@ mac80211_generate_mac() {
@@ -426,7 +523,11 @@ mac80211_generate_mac() {
local oIFS="$IFS"; IFS=":"; set -- $ref; IFS="$oIFS"
macidx=$(($id + 1))
- [ "$((0x$mask1))" -gt 0 ] && {
+
+ local use_global=0
+ [ "$id" -gt 0 -a "$macidx" -le "$num_global_macaddr" ] && use_global=1
+
+ [ "$((0x$mask1))" -gt 0 -a "$use_global" -lt 1 ] && {
b1="0x$1"
[ "$id" -gt 0 ] && \
b1=$(($b1 ^ ((($id - !($b1 & 2)) << 2)) | 0x2))
@@ -434,7 +535,7 @@ mac80211_generate_mac() {
return
}
- [ "$((0x$mask6))" -lt 255 ] && {
+ [ "$((0x$mask6))" -lt 255 -a "$use_global" -gt 0 ] && {
printf "%s:%s:%s:%s:%s:%02x" $1 $2 $3 $4 $5 $(( 0x$6 ^ $id ))
return
}
@@ -449,7 +550,7 @@ mac80211_generate_mac() {
find_phy() {
[ -n "$phy" -a -d /sys/class/ieee80211/$phy ] && return 0
[ -n "$path" ] && {
@@ -580,7 +607,7 @@ index 92c56afd24..0b7a84d7c9 100644
[ -n "$phy" ] && return 0
}
[ -n "$macaddr" ] && {
@@ -689,14 +785,8 @@ mac80211_prepare_iw_htmode() {
@@ -689,14 +790,8 @@ mac80211_prepare_iw_htmode() {
case "$htmode" in
VHT20|HT20) iw_htmode=HT20;;
HT40*|VHT40|VHT160)
@@ -597,7 +624,7 @@ index 92c56afd24..0b7a84d7c9 100644
case "$htmode" in
HT40+) iw_htmode="HT40+";;
HT40-) iw_htmode="HT40-";;
@@ -709,6 +799,12 @@ mac80211_prepare_iw_htmode() {
@@ -709,6 +804,12 @@ mac80211_prepare_iw_htmode() {
;;
esac
;;
@@ -610,7 +637,7 @@ index 92c56afd24..0b7a84d7c9 100644
esac
[ "$auto_channel" -gt 0 ] && iw_htmode="HT40+"
;;
@@ -818,7 +914,6 @@ mac80211_setup_vif() {
@@ -818,7 +919,6 @@ mac80211_setup_vif() {
mesh)
wireless_vif_parse_encryption
[ -z "$htmode" ] && htmode="NOHT";
@@ -618,7 +645,7 @@ index 92c56afd24..0b7a84d7c9 100644
if [ "$wpa" -gt 0 -o "$auto_channel" -gt 0 ] || chan_is_dfs "$phy" "$channel"; then
mac80211_setup_supplicant $vif_enable || failed=1
else
@@ -832,7 +927,6 @@ mac80211_setup_vif() {
@@ -832,7 +932,6 @@ mac80211_setup_vif() {
adhoc)
wireless_vif_parse_encryption
if [ "$wpa" -gt 0 -o "$auto_channel" -gt 0 ]; then
@@ -626,7 +653,7 @@ index 92c56afd24..0b7a84d7c9 100644
mac80211_setup_supplicant_noctl $vif_enable || failed=1
else
mac80211_setup_adhoc $vif_enable
@@ -849,10 +943,30 @@ mac80211_setup_vif() {
@@ -849,10 +948,30 @@ mac80211_setup_vif() {
get_freq() {
local phy="$1"
@@ -646,20 +673,30 @@ index 92c56afd24..0b7a84d7c9 100644
+
+$1 ~ /Band/ {
+ band_match = band == $2
}
+}
+
+band_match && $3 == "MHz" && $4 == channel {
+ print $2
+ exit
+}
+'
+}
+
}
+
chan_is_dfs() {
local phy="$1"
local chan="$2"
@@ -907,10 +1021,8 @@ drv_mac80211_setup() {
@@ -896,7 +1015,8 @@ drv_mac80211_setup() {
country chanbw distance \
txpower antenna_gain \
rxantenna txantenna \
- frag rts beacon_int:100 htmode
+ frag rts beacon_int:100 htmode \
+ num_global_macaddr
json_get_values basic_rate_list basic_rate
json_get_values scan_list scan_list
json_select ..
@@ -907,10 +1027,8 @@ drv_mac80211_setup() {
return 1
}
@@ -672,7 +709,7 @@ index 92c56afd24..0b7a84d7c9 100644
OLDAPLIST=$(uci -q -P /var/state get wireless._${phy}.aplist)
OLDSPLIST=$(uci -q -P /var/state get wireless._${phy}.splist)
@@ -935,7 +1047,7 @@ drv_mac80211_setup() {
@@ -935,7 +1053,7 @@ drv_mac80211_setup() {
done
# convert channel to frequency
@@ -681,7 +718,15 @@ index 92c56afd24..0b7a84d7c9 100644
[ -n "$country" ] && {
iw reg get | grep -q "^country $country:" || {
@@ -1003,6 +1115,7 @@ drv_mac80211_setup() {
@@ -960,6 +1078,7 @@ drv_mac80211_setup() {
set_default txantenna 0xffffffff
set_default distance 0
set_default antenna_gain 0
+ set_default num_global_macaddr 1
[ "$txantenna" = "all" ] && txantenna=0xffffffff
[ "$rxantenna" = "all" ] && rxantenna=0xffffffff
@@ -1003,6 +1122,7 @@ drv_mac80211_setup() {
[ -n "$hostapd_ctrl" ] && {
local no_reload=1
if [ -n "$(ubus list | grep hostapd.$primary_ap)" ]; then
@@ -689,7 +734,7 @@ index 92c56afd24..0b7a84d7c9 100644
[ "${NEW_MD5}" = "${OLD_MD5}" ] || {
ubus call hostapd.$primary_ap reload
no_reload=$?
@@ -1077,6 +1190,10 @@ drv_mac80211_teardown() {
@@ -1077,6 +1197,10 @@ drv_mac80211_teardown() {
json_select data
json_get_vars phy
json_select ..

View File

@@ -29,6 +29,7 @@ drv_mac80211_init_device_config() {
config_add_string distance
config_add_int beacon_int chanbw frag rts
config_add_int rxantenna txantenna antenna_gain txpower
config_add_int num_global_macaddr
config_add_boolean noscan ht_coex acs_exclude_dfs
config_add_array ht_capab
config_add_array channels
@@ -522,7 +523,11 @@ mac80211_generate_mac() {
local oIFS="$IFS"; IFS=":"; set -- $ref; IFS="$oIFS"
macidx=$(($id + 1))
[ "$((0x$mask1))" -gt 0 ] && {
local use_global=0
[ "$id" -gt 0 -a "$macidx" -le "$num_global_macaddr" ] && use_global=1
[ "$((0x$mask1))" -gt 0 -a "$use_global" -lt 1 ] && {
b1="0x$1"
[ "$id" -gt 0 ] && \
b1=$(($b1 ^ ((($id - !($b1 & 2)) << 2)) | 0x2))
@@ -530,7 +535,7 @@ mac80211_generate_mac() {
return
}
[ "$((0x$mask6))" -lt 255 ] && {
[ "$((0x$mask6))" -lt 255 -a "$use_global" -gt 0 ] && {
printf "%s:%s:%s:%s:%s:%02x" $1 $2 $3 $4 $5 $(( 0x$6 ^ $id ))
return
}
@@ -1010,7 +1015,8 @@ drv_mac80211_setup() {
country chanbw distance \
txpower antenna_gain \
rxantenna txantenna \
frag rts beacon_int:100 htmode
frag rts beacon_int:100 htmode \
num_global_macaddr
json_get_values basic_rate_list basic_rate
json_get_values scan_list scan_list
json_select ..
@@ -1072,6 +1078,7 @@ drv_mac80211_setup() {
set_default txantenna 0xffffffff
set_default distance 0
set_default antenna_gain 0
set_default num_global_macaddr 1
[ "$txantenna" = "all" ] && txantenna=0xffffffff
[ "$rxantenna" = "all" ] && rxantenna=0xffffffff

View File

@@ -174,6 +174,7 @@ detect_mac80211() {
set wireless.radio${devidx}.channel=${channel}
set wireless.radio${devidx}.band=${mode_band}
set wireless.radio${devidx}.htmode=$htmode
set wireless.radio${devidx}.num_global_macaddr=8
set wireless.radio${devidx}.disabled=1
set wireless.default_radio${devidx}=wifi-iface

View File

@@ -1,7 +1,7 @@
From d3da4b4a61bba6ac57f999cffb2341b52d969c49 Mon Sep 17 00:00:00 2001
From 5a812a3cefe635673c88413322c9ad0b93caa3e2 Mon Sep 17 00:00:00 2001
From: John Crispin <john@phrozen.org>
Date: Sat, 18 Jul 2020 08:53:44 +0200
Subject: [PATCH 01/23] ipq807x: add the Qualcomm AX target support
Subject: [PATCH 21/42] ipq807x: add the Qualcomm AX target support
Signed-off-by: John Crispin <john@phrozen.org>
---
@@ -13,7 +13,7 @@ Signed-off-by: John Crispin <john@phrozen.org>
target/linux/ipq807x/Makefile | 22 +
.../ipq807x/base-files/etc/board.d/01_leds | 36 +
.../ipq807x/base-files/etc/board.d/02_network | 77 +
.../etc/hotplug.d/firmware/10-ath11k-caldata | 97 ++
.../etc/hotplug.d/firmware/10-ath11k-caldata | 89 +
.../ipq807x/base-files/etc/init.d/aq_phy | 15 +
.../ipq807x/base-files/etc/init.d/bootcount | 12 +
.../linux/ipq807x/base-files/etc/init.d/wdt | 14 +
@@ -52,7 +52,7 @@ Signed-off-by: John Crispin <john@phrozen.org>
.../linux/ipq807x/patches/108-log-spam.patch | 37 +
target/linux/ipq807x/patches/109-tplink.patch | 1518 +++++++++++++++++
.../ipq807x/patches/110-add-esmt-nand.patch | 37 +
47 files changed, 9337 insertions(+), 1 deletion(-)
47 files changed, 9329 insertions(+), 1 deletion(-)
create mode 100644 package/boot/uboot-envtools/files/ipq807x
create mode 100644 target/linux/ipq807x/109-logspam.patch
create mode 100644 target/linux/ipq807x/Makefile
@@ -261,7 +261,7 @@ index 0000000000..66031ace35
+$(eval $(call BuildTarget))
diff --git a/target/linux/ipq807x/base-files/etc/board.d/01_leds b/target/linux/ipq807x/base-files/etc/board.d/01_leds
new file mode 100755
index 0000000000..35b4d9b529
index 0000000000..0bfa04d614
--- /dev/null
+++ b/target/linux/ipq807x/base-files/etc/board.d/01_leds
@@ -0,0 +1,36 @@
@@ -386,10 +386,10 @@ index 0000000000..eaa440943b
+exit 0
diff --git a/target/linux/ipq807x/base-files/etc/hotplug.d/firmware/10-ath11k-caldata b/target/linux/ipq807x/base-files/etc/hotplug.d/firmware/10-ath11k-caldata
new file mode 100755
index 0000000000..ea23dc7a58
index 0000000000..93f429ec51
--- /dev/null
+++ b/target/linux/ipq807x/base-files/etc/hotplug.d/firmware/10-ath11k-caldata
@@ -0,0 +1,97 @@
@@ -0,0 +1,89 @@
+#!/bin/sh
+
+[ -e /lib/firmware/$FIRMWARE ] && exit 0
@@ -397,23 +397,15 @@ index 0000000000..ea23dc7a58
+. /lib/functions.sh
+. /lib/functions/system.sh
+
+macaddr_setup() {
+ local mac=$1
+ local val=$2
+ local oui=${mac%:*:*}
+ local nic=$(echo $mac | cut -d: -f 5)
+
+ nic=$(printf "%02x" $((0x${nic//:/} + $val & 0xff)) | sed 's/^\(.\{2\}\)\(.\{2\}\)\(.\{2\}\)/\1:\2:\3/')
+ echo $oui:$nic:01
+}
+
+ath11k_generate_macs() {
+ touch /lib/firmware/ath11k-macs
+ eth=$(cat /sys/class/net/eth0/address)
+ for a in `seq 1 3`; do
+ m=$(macaddr_setup ${eth} $a)
+ echo -ne \\x${m//:/\\x} >> /lib/firmware/ath11k-macs
+ done
+ mac1=$(macaddr_add $eth 2)
+ mac2=$(macaddr_add $eth 10)
+ mac3=$(macaddr_add $eth 18)
+ echo -ne \\x${mac1//:/\\x} >> /lib/firmware/ath11k-macs
+ echo -ne \\x${mac2//:/\\x} >> /lib/firmware/ath11k-macs
+ echo -ne \\x${mac3//:/\\x} >> /lib/firmware/ath11k-macs
+}
+
+caldata_die() {