mirror of
				https://github.com/Telecominfraproject/wlan-ap.git
				synced 2025-10-31 18:38:10 +00:00 
			
		
		
		
	mac80211: fix default 6E channel selection
Signed-off-by: John Crispin <john@phrozen.org>
This commit is contained in:
		| @@ -1,7 +1,7 @@ | ||||
| From 7e9c8738c1030b154cb0c0b104dbb403e5270120 Mon Sep 17 00:00:00 2001 | ||||
| From 2636d06404c24ec6c2ad8395ad1dc8d26875be7a 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/42] mac80211: update to latest HEAD | ||||
| Subject: [PATCH 01/44] 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     |  192 ++- | ||||
|  .../files/lib/netifd/wireless/mac80211.sh     |  195 ++- | ||||
|  .../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, 3735 insertions(+), 1344 deletions(-) | ||||
|  92 files changed, 3737 insertions(+), 1345 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..30d6b9311a 100644 | ||||
| index 92c56afd24..a58af1fef0 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 @@ | ||||
| @@ -445,14 +445,26 @@ index 92c56afd24..30d6b9311a 100644 | ||||
|  mac80211_hostapd_setup_base() { | ||||
|  	local phy="$1" | ||||
|   | ||||
| @@ -195,12 +224,14 @@ mac80211_hostapd_setup_base() { | ||||
|  	enable_ac=0 | ||||
|  	vht_oper_chwidth=0 | ||||
|  	vht_center_seg0= | ||||
| @@ -119,6 +148,9 @@ mac80211_hostapd_setup_base() { | ||||
|  	[ "$noscan" -gt 0 ] && hostapd_noscan=1 | ||||
|  	[ "$tx_burst" = 0 ] && tx_burst= | ||||
|   | ||||
| +	chan_ofs=0 | ||||
| +	[ "$band" = "6g" ] && chan_ofs=1 | ||||
|   | ||||
|  	idx="$channel" | ||||
| + | ||||
|  	ieee80211n=1 | ||||
|  	ht_capab= | ||||
|  	case "$htmode" in | ||||
| @@ -126,7 +158,7 @@ mac80211_hostapd_setup_base() { | ||||
|  		HT40*|VHT40|VHT80|VHT160|HE40|HE80|HE160) | ||||
|  			case "$hwmode" in | ||||
|  				a) | ||||
| -					case "$(( ($channel / 4) % 2 ))" in | ||||
| +					case "$(( (($channel / 4) + $chan_ofs) % 2 ))" in | ||||
|  						1) ht_capab="[HT40+]";; | ||||
|  						0) ht_capab="[HT40-]";; | ||||
|  					esac | ||||
| @@ -200,7 +232,7 @@ mac80211_hostapd_setup_base() { | ||||
|  	case "$htmode" in | ||||
|  		VHT20|HE20) enable_ac=1;; | ||||
|  		VHT40|HE40) | ||||
| @@ -461,7 +473,7 @@ index 92c56afd24..30d6b9311a 100644 | ||||
|  				1) idx=$(($channel + 2));; | ||||
|  				0) idx=$(($channel - 2));; | ||||
|  			esac | ||||
| @@ -208,7 +239,7 @@ mac80211_hostapd_setup_base() { | ||||
| @@ -208,7 +240,7 @@ mac80211_hostapd_setup_base() { | ||||
|  			vht_center_seg0=$idx | ||||
|  		;; | ||||
|  		VHT80|HE80) | ||||
| @@ -470,7 +482,7 @@ index 92c56afd24..30d6b9311a 100644 | ||||
|  				1) idx=$(($channel + 6));; | ||||
|  				2) idx=$(($channel + 2));; | ||||
|  				3) idx=$(($channel - 2));; | ||||
| @@ -219,15 +250,35 @@ mac80211_hostapd_setup_base() { | ||||
| @@ -219,15 +251,35 @@ mac80211_hostapd_setup_base() { | ||||
|  			vht_center_seg0=$idx | ||||
|  		;; | ||||
|  		VHT160|HE160) | ||||
| @@ -510,7 +522,7 @@ index 92c56afd24..30d6b9311a 100644 | ||||
|  	[ "$hwmode" = "a" ] || enable_ac=0 | ||||
|   | ||||
|  	if [ "$enable_ac" != "0" ]; then | ||||
| @@ -337,16 +388,62 @@ mac80211_hostapd_setup_base() { | ||||
| @@ -337,16 +389,62 @@ mac80211_hostapd_setup_base() { | ||||
|  	esac | ||||
|   | ||||
|  	if [ "$enable_ax" != "0" ]; then | ||||
| @@ -576,7 +588,7 @@ index 92c56afd24..30d6b9311a 100644 | ||||
|  	fi | ||||
|   | ||||
|  	hostapd_prepare_device_config "$hostapd_conf_file" nl80211 | ||||
| @@ -426,7 +523,11 @@ mac80211_generate_mac() { | ||||
| @@ -426,7 +524,11 @@ mac80211_generate_mac() { | ||||
|  	local oIFS="$IFS"; IFS=":"; set -- $ref; IFS="$oIFS" | ||||
|   | ||||
|  	macidx=$(($id + 1)) | ||||
| @@ -589,7 +601,7 @@ index 92c56afd24..30d6b9311a 100644 | ||||
|  		b1="0x$1" | ||||
|  		[ "$id" -gt 0 ] && \ | ||||
|  			b1=$(($b1 ^ ((($id - !($b1 & 2)) << 2)) | 0x2)) | ||||
| @@ -434,7 +535,7 @@ mac80211_generate_mac() { | ||||
| @@ -434,7 +536,7 @@ mac80211_generate_mac() { | ||||
|  		return | ||||
|  	} | ||||
|   | ||||
| @@ -598,7 +610,7 @@ index 92c56afd24..30d6b9311a 100644 | ||||
|  		printf "%s:%s:%s:%s:%s:%02x" $1 $2 $3 $4 $5 $(( 0x$6 ^ $id )) | ||||
|  		return | ||||
|  	} | ||||
| @@ -449,7 +550,7 @@ mac80211_generate_mac() { | ||||
| @@ -449,7 +551,7 @@ mac80211_generate_mac() { | ||||
|  find_phy() { | ||||
|  	[ -n "$phy" -a -d /sys/class/ieee80211/$phy ] && return 0 | ||||
|  	[ -n "$path" ] && { | ||||
| @@ -607,7 +619,7 @@ index 92c56afd24..30d6b9311a 100644 | ||||
|  		[ -n "$phy" ] && return 0 | ||||
|  	} | ||||
|  	[ -n "$macaddr" ] && { | ||||
| @@ -689,14 +790,8 @@ mac80211_prepare_iw_htmode() { | ||||
| @@ -689,14 +791,8 @@ mac80211_prepare_iw_htmode() { | ||||
|  	case "$htmode" in | ||||
|  		VHT20|HT20) iw_htmode=HT20;; | ||||
|  		HT40*|VHT40|VHT160) | ||||
| @@ -624,7 +636,7 @@ index 92c56afd24..30d6b9311a 100644 | ||||
|  					case "$htmode" in | ||||
|  						HT40+) iw_htmode="HT40+";; | ||||
|  						HT40-) iw_htmode="HT40-";; | ||||
| @@ -709,6 +804,12 @@ mac80211_prepare_iw_htmode() { | ||||
| @@ -709,6 +805,12 @@ mac80211_prepare_iw_htmode() { | ||||
|  						;; | ||||
|  					esac | ||||
|  				;; | ||||
| @@ -637,7 +649,7 @@ index 92c56afd24..30d6b9311a 100644 | ||||
|  			esac | ||||
|  			[ "$auto_channel" -gt 0 ] && iw_htmode="HT40+" | ||||
|  		;; | ||||
| @@ -818,7 +919,6 @@ mac80211_setup_vif() { | ||||
| @@ -818,7 +920,6 @@ mac80211_setup_vif() { | ||||
|  		mesh) | ||||
|  			wireless_vif_parse_encryption | ||||
|  			[ -z "$htmode" ] && htmode="NOHT"; | ||||
| @@ -645,7 +657,7 @@ index 92c56afd24..30d6b9311a 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 +932,6 @@ mac80211_setup_vif() { | ||||
| @@ -832,7 +933,6 @@ mac80211_setup_vif() { | ||||
|  		adhoc) | ||||
|  			wireless_vif_parse_encryption | ||||
|  			if [ "$wpa" -gt 0 -o "$auto_channel" -gt 0 ]; then | ||||
| @@ -653,7 +665,7 @@ index 92c56afd24..30d6b9311a 100644 | ||||
|  				mac80211_setup_supplicant_noctl $vif_enable || failed=1 | ||||
|  			else | ||||
|  				mac80211_setup_adhoc $vif_enable | ||||
| @@ -849,10 +948,30 @@ mac80211_setup_vif() { | ||||
| @@ -849,10 +949,30 @@ mac80211_setup_vif() { | ||||
|   | ||||
|  get_freq() { | ||||
|  	local phy="$1" | ||||
| @@ -686,7 +698,7 @@ index 92c56afd24..30d6b9311a 100644 | ||||
|  chan_is_dfs() { | ||||
|  	local phy="$1" | ||||
|  	local chan="$2" | ||||
| @@ -896,7 +1015,8 @@ drv_mac80211_setup() { | ||||
| @@ -896,7 +1016,8 @@ drv_mac80211_setup() { | ||||
|  		country chanbw distance \ | ||||
|  		txpower antenna_gain \ | ||||
|  		rxantenna txantenna \ | ||||
| @@ -696,7 +708,7 @@ index 92c56afd24..30d6b9311a 100644 | ||||
|  	json_get_values basic_rate_list basic_rate | ||||
|  	json_get_values scan_list scan_list | ||||
|  	json_select .. | ||||
| @@ -907,10 +1027,8 @@ drv_mac80211_setup() { | ||||
| @@ -907,10 +1028,8 @@ drv_mac80211_setup() { | ||||
|  		return 1 | ||||
|  	} | ||||
|   | ||||
| @@ -709,7 +721,7 @@ index 92c56afd24..30d6b9311a 100644 | ||||
|   | ||||
|  	OLDAPLIST=$(uci -q -P /var/state get wireless._${phy}.aplist) | ||||
|  	OLDSPLIST=$(uci -q -P /var/state get wireless._${phy}.splist) | ||||
| @@ -935,7 +1053,7 @@ drv_mac80211_setup() { | ||||
| @@ -935,7 +1054,7 @@ drv_mac80211_setup() { | ||||
|  	done | ||||
|   | ||||
|  	# convert channel to frequency | ||||
| @@ -718,7 +730,7 @@ index 92c56afd24..30d6b9311a 100644 | ||||
|   | ||||
|  	[ -n "$country" ] && { | ||||
|  		iw reg get | grep -q "^country $country:" || { | ||||
| @@ -960,6 +1078,7 @@ drv_mac80211_setup() { | ||||
| @@ -960,6 +1079,7 @@ drv_mac80211_setup() { | ||||
|  	set_default txantenna 0xffffffff | ||||
|  	set_default distance 0 | ||||
|  	set_default antenna_gain 0 | ||||
| @@ -726,7 +738,7 @@ index 92c56afd24..30d6b9311a 100644 | ||||
|   | ||||
|  	[ "$txantenna" = "all" ] && txantenna=0xffffffff | ||||
|  	[ "$rxantenna" = "all" ] && rxantenna=0xffffffff | ||||
| @@ -1003,6 +1122,7 @@ drv_mac80211_setup() { | ||||
| @@ -1003,6 +1123,7 @@ drv_mac80211_setup() { | ||||
|  	[ -n "$hostapd_ctrl" ] && { | ||||
|  		local no_reload=1 | ||||
|  		if [ -n "$(ubus list | grep hostapd.$primary_ap)" ]; then | ||||
| @@ -734,7 +746,7 @@ index 92c56afd24..30d6b9311a 100644 | ||||
|  			[ "${NEW_MD5}" = "${OLD_MD5}" ] || { | ||||
|  				ubus call hostapd.$primary_ap reload | ||||
|  				no_reload=$? | ||||
| @@ -1077,6 +1197,10 @@ drv_mac80211_teardown() { | ||||
| @@ -1077,6 +1198,10 @@ drv_mac80211_teardown() { | ||||
|  	json_select data | ||||
|  	json_get_vars phy | ||||
|  	json_select .. | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 John Crispin
					John Crispin