mirror of
				https://github.com/Telecominfraproject/wlan-ap.git
				synced 2025-10-31 10:28:06 +00:00 
			
		
		
		
	WIFI-3023: fix mac assign on ath11k
Port over mac assign fix from v2. Signed-off-by: Arif Alam <arif.alam@netexperience.com>
This commit is contained in:
		
							
								
								
									
										114
									
								
								patches/0058-Fix-mac-assign-on-ath11k.patch
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										114
									
								
								patches/0058-Fix-mac-assign-on-ath11k.patch
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,114 @@ | ||||
| From c685d1eb284547aaefb6d7ccb03677905d652b17 Mon Sep 17 00:00:00 2001 | ||||
| From: Arif Alam <arif.alam@netexperience.com> | ||||
| Date: Thu, 29 Jul 2021 15:25:57 -0400 | ||||
| Subject: [PATCH] Fix mac assign on ath11k | ||||
|  | ||||
| Signed-off-by: John Crispin <john@phrozen.org> | ||||
| Signed-off-by: Arif Alam <arif.alam@netexperience.com> | ||||
| --- | ||||
|  .../files/lib/netifd/wireless/mac80211.sh     | 13 +++++++++--- | ||||
|  .../mac80211/files/lib/wifi/mac80211.sh       |  1 + | ||||
|  .../etc/hotplug.d/firmware/10-ath11k-caldata  | 20 ++++++------------- | ||||
|  3 files changed, 17 insertions(+), 17 deletions(-) | ||||
|  | ||||
| diff --git a/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh b/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh | ||||
| index 36aebbb2cc..cf3e7ffbb8 100644 | ||||
| --- a/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh | ||||
| +++ b/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh | ||||
| @@ -26,6 +26,7 @@ drv_mac80211_init_device_config() { | ||||
|  	config_add_string tx_burst | ||||
|  	config_add_int beacon_int chanbw frag rts | ||||
|  	config_add_int rxantenna txantenna antenna_gain txpower distance | ||||
| +	config_add_int num_global_macaddr | ||||
|  	config_add_boolean noscan ht_coex | ||||
|  	config_add_array ht_capab | ||||
|  	config_add_array channels | ||||
| @@ -382,7 +383,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 - 1) << 2) | 0x2))) | ||||
| @@ -390,7 +395,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 | ||||
|  	} | ||||
| @@ -724,7 +729,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_select .. | ||||
|   | ||||
| @@ -763,6 +769,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 | ||||
| diff --git a/package/kernel/mac80211/files/lib/wifi/mac80211.sh b/package/kernel/mac80211/files/lib/wifi/mac80211.sh | ||||
| index 511a9188db..09452ab365 100644 | ||||
| --- a/package/kernel/mac80211/files/lib/wifi/mac80211.sh | ||||
| +++ b/package/kernel/mac80211/files/lib/wifi/mac80211.sh | ||||
| @@ -113,6 +113,7 @@ detect_mac80211() { | ||||
|  			set wireless.radio${devidx}.hwmode=11${mode_band} | ||||
|  			${dev_id} | ||||
|  			${ht_capab} | ||||
| +			set wireless.radio${devidx}.num_global_macaddr=8 | ||||
|  			set wireless.radio${devidx}.disabled=1 | ||||
|   | ||||
|  			set wireless.default_radio${devidx}=wifi-iface | ||||
| 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 | ||||
| index e6eb7e2dfd..02ea5056f4 100755 | ||||
| --- 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 | ||||
| @@ -5,23 +5,15 @@ | ||||
|  . /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 | ||||
|  } | ||||
|   | ||||
|  # The tplink device has 17 MAC addresses. The base MAC address is reserved for eth0(WAN),  | ||||
| --  | ||||
| 2.25.1 | ||||
|  | ||||
		Reference in New Issue
	
	Block a user
	 Arif Alam
					Arif Alam