[][openwrt-24][Mac80211][Fix WiFi7 Kernel 6.6 build fail]

[Description]
Fix WiFi7 Kernel 6.6 build fail

[Release-log]
N/A

Change-Id: Id0e4b2accb9d8b8b8e45a173b9242cfbab3f342d
Reviewed-on: https://gerrit.mediatek.inc/c/openwrt/feeds/mtk_openwrt_feeds/+/9799051
diff --git a/autobuild/unified/Readme.md b/autobuild/unified/Readme.md
index ce24279..33ddc99 100644
--- a/autobuild/unified/Readme.md
+++ b/autobuild/unified/Readme.md
@@ -93,7 +93,7 @@
 #Choose one SKU to build (1st Build)
 cd openwrt
 ## 1. Filogic 880 (MT7988+MT7996) MTK Reference Board (RFB)
-bash ../mtk-openwrt-feeds/autobuild/unified/autobuild.sh filogic-mac80211-BE19000 log_file=make
+bash ../mtk-openwrt-feeds/autobuild/unified/autobuild.sh filogic-mac80211_mtk-mt7988_rfb-mt7996 log_file=make
 ## 2. MTK Prpl Reference Board (Mozart)
 bash ../mtk-openwrt-feeds/autobuild/unified/autobuild.sh filogic-mac80211-mozart log_file=make
 ## 2. BananaPi BPI-R4
diff --git a/autobuild/unified/filogic/mac80211/master/patches-base/0001-mt76-package-makefile.patch b/autobuild/unified/filogic/mac80211/master/patches-base/0001-mt76-package-makefile.patch
index 869002a..d898263 100644
--- a/autobuild/unified/filogic/mac80211/master/patches-base/0001-mt76-package-makefile.patch
+++ b/autobuild/unified/filogic/mac80211/master/patches-base/0001-mt76-package-makefile.patch
@@ -1,5 +1,5 @@
 diff --git a/package/kernel/mt76/Makefile b/package/kernel/mt76/Makefile
-index 75a77a1..19caf16 100644
+index 73f34d8..2912d1f 100644
 --- a/package/kernel/mt76/Makefile
 +++ b/package/kernel/mt76/Makefile
 @@ -322,6 +322,7 @@ define KernelPackage/mt7996e
@@ -10,7 +10,7 @@
  endef
  
  define KernelPackage/mt7992-firmware
-@@ -664,6 +665,7 @@ define KernelPackage/mt7992-firmware/install
+@@ -665,6 +666,7 @@ define KernelPackage/mt7992-firmware/install
  		$(PKG_BUILD_DIR)/firmware/mt7996/mt7992_rom_patch.bin \
  		$(PKG_BUILD_DIR)/firmware/mt7996/mt7992_wa.bin \
  		$(PKG_BUILD_DIR)/firmware/mt7996/mt7992_wm.bin \
@@ -18,7 +18,7 @@
  		$(1)/lib/firmware/mediatek/mt7996
  endef
  
-@@ -676,6 +678,7 @@ define KernelPackage/mt7992-23-firmware/install
+@@ -677,6 +679,7 @@ define KernelPackage/mt7992-23-firmware/install
  		$(PKG_BUILD_DIR)/firmware/mt7996/mt7992_rom_patch_23.bin \
  		$(PKG_BUILD_DIR)/firmware/mt7996/mt7992_wa_23.bin \
  		$(PKG_BUILD_DIR)/firmware/mt7996/mt7992_wm_23.bin \
@@ -26,7 +26,7 @@
  		$(1)/lib/firmware/mediatek/mt7996
  endef
  
-@@ -694,6 +697,7 @@ define KernelPackage/mt7996-firmware/install
+@@ -695,6 +698,7 @@ define KernelPackage/mt7996-firmware/install
  		$(PKG_BUILD_DIR)/firmware/mt7996/mt7996_rom_patch.bin \
  		$(PKG_BUILD_DIR)/firmware/mt7996/mt7996_wa.bin \
  		$(PKG_BUILD_DIR)/firmware/mt7996/mt7996_wm.bin \
@@ -34,12 +34,11 @@
  		$(1)/lib/firmware/mediatek/mt7996
  endef
  
-@@ -705,6 +709,7 @@ define KernelPackage/mt7996-233-firmware/install
+@@ -706,6 +710,7 @@ define KernelPackage/mt7996-233-firmware/install
  		$(PKG_BUILD_DIR)/firmware/mt7996/mt7996_rom_patch_233.bin \
  		$(PKG_BUILD_DIR)/firmware/mt7996/mt7996_wa_233.bin \
  		$(PKG_BUILD_DIR)/firmware/mt7996/mt7996_wm_233.bin \
 +		$(PKG_BUILD_DIR)/firmware/mt7996/mt7996_wm_tm_233.bin \
  		$(1)/lib/firmware/mediatek/mt7996
  endef
- 
 
diff --git a/autobuild/unified/filogic/mac80211/master/patches-base/0002-wifi-scripts-package-files.patch b/autobuild/unified/filogic/mac80211/master/patches-base/0002-wifi-scripts-package-files.patch
index 0c4d37d..09ab79a 100644
--- a/autobuild/unified/filogic/mac80211/master/patches-base/0002-wifi-scripts-package-files.patch
+++ b/autobuild/unified/filogic/mac80211/master/patches-base/0002-wifi-scripts-package-files.patch
@@ -1,5 +1,5 @@
 diff --git a/package/network/config/wifi-scripts/files/lib/netifd/hostapd.sh b/package/network/config/wifi-scripts/files/lib/netifd/hostapd.sh
-index 9ffb465..35ef449 100644
+index 817ead7..e422945 100644
 --- a/package/network/config/wifi-scripts/files/lib/netifd/hostapd.sh
 +++ b/package/network/config/wifi-scripts/files/lib/netifd/hostapd.sh
 @@ -60,7 +60,14 @@ hostapd_append_wpa_key_mgmt() {
@@ -380,23 +380,23 @@
  		2g) hwmode=g;;
  		5g|6g) hwmode=a;;
 diff --git a/package/network/config/wifi-scripts/files/lib/netifd/wireless/mac80211.sh b/package/network/config/wifi-scripts/files/lib/netifd/wireless/mac80211.sh
-index 23e5571..b683dd8 100755
+index 9998e26..66479a3 100755
 --- a/package/network/config/wifi-scripts/files/lib/netifd/wireless/mac80211.sh
 +++ b/package/network/config/wifi-scripts/files/lib/netifd/wireless/mac80211.sh
-@@ -29,10 +29,12 @@ drv_mac80211_init_device_config() {
+@@ -29,10 +29,11 @@ drv_mac80211_init_device_config() {
  	config_add_string path phy 'macaddr:macaddr'
  	config_add_string tx_burst
  	config_add_string distance
 +	config_add_int mbssid mu_onoff sr_enable sr_enhanced rnr obss_interval
- 	config_add_int beacon_int chanbw frag rts
+ 	config_add_int radio beacon_int chanbw frag rts
  	config_add_int rxantenna txantenna txpower min_tx_power
  	config_add_int num_global_macaddr multiple_bssid
- 	config_add_boolean noscan ht_coex acs_exclude_dfs background_radar
+-	config_add_boolean noscan ht_coex acs_exclude_dfs background_radar
 +	config_add_boolean noscan ht_coex acs_exclude_dfs background_radar background_cert_mode
  	config_add_array ht_capab
  	config_add_array channels
  	config_add_array scan_list
-@@ -55,7 +57,10 @@ drv_mac80211_init_device_config() {
+@@ -55,7 +56,10 @@ drv_mac80211_init_device_config() {
  		he_spr_sr_control \
  		he_spr_psr_enabled \
  		he_bss_color_enabled \
@@ -408,7 +408,7 @@
  	config_add_int \
  		beamformer_antennas \
  		beamformee_antennas \
-@@ -142,13 +147,11 @@ mac80211_hostapd_setup_base() {
+@@ -142,13 +146,11 @@ mac80211_hostapd_setup_base() {
  	[ -n "$acs_exclude_dfs" ] && [ "$acs_exclude_dfs" -gt 0 ] &&
  		append base_cfg "acs_exclude_dfs=1" "$N"
  
@@ -424,7 +424,7 @@
  	[ "$min_tx_power" -gt 0 ] && append base_cfg "min_tx_power=$min_tx_power" "$N"
  
  	set_default noscan 0
-@@ -164,20 +167,41 @@ mac80211_hostapd_setup_base() {
+@@ -164,20 +166,41 @@ mac80211_hostapd_setup_base() {
  		ht_capab=
  		case "$htmode" in
  			VHT20|HT20|HE20|EHT20) ;;
@@ -470,7 +470,7 @@
  									ht_capab="[HT40+]"
  								else
  									ht_capab="[HT40-]"
-@@ -186,7 +210,6 @@ mac80211_hostapd_setup_base() {
+@@ -186,7 +209,6 @@ mac80211_hostapd_setup_base() {
  						esac
  					;;
  				esac
@@ -478,7 +478,7 @@
  			;;
  			*) ieee80211n= ;;
  		esac
-@@ -207,8 +230,13 @@ mac80211_hostapd_setup_base() {
+@@ -207,8 +229,13 @@ mac80211_hostapd_setup_base() {
  				max_amsdu:1 \
  				dsss_cck_40:1
  
@@ -493,7 +493,7 @@
  				ht_cap_mask="$(($ht_cap_mask | $cap))"
  			done
  
-@@ -284,29 +312,55 @@ mac80211_hostapd_setup_base() {
+@@ -284,29 +311,55 @@ mac80211_hostapd_setup_base() {
  		;;
  	esac
  	[ "$band" = "5g" ] && {
@@ -560,7 +560,7 @@
  			;;
  			HE*|EHT*) op_class=$((132 + $vht_oper_chwidth));;
  		esac
-@@ -315,6 +369,8 @@ mac80211_hostapd_setup_base() {
+@@ -315,6 +368,8 @@ mac80211_hostapd_setup_base() {
  	[ "$hwmode" = "a" ] || enable_ac=0
  	[ "$band" = "6g" ] && enable_ac=0
  
@@ -569,7 +569,7 @@
  	if [ "$enable_ac" != "0" ]; then
  		json_get_vars \
  			rxldpc:1 \
-@@ -337,7 +393,6 @@ mac80211_hostapd_setup_base() {
+@@ -337,7 +392,6 @@ mac80211_hostapd_setup_base() {
  			vht_link_adapt:3 \
  			vht160:2
  
@@ -577,7 +577,7 @@
  		append base_cfg "ieee80211ac=1" "$N"
  		vht_cap=0
  		for cap in $(iw phy "$phy" info | awk -F "[()]" '/VHT Capabilities/ { print $2 }'); do
-@@ -356,6 +411,12 @@ mac80211_hostapd_setup_base() {
+@@ -356,6 +410,12 @@ mac80211_hostapd_setup_base() {
  			short_gi_160=0
  		}
  
@@ -590,7 +590,7 @@
  		mac80211_add_capabilities vht_capab $vht_cap \
  			RXLDPC:0x10::$rxldpc \
  			SHORT-GI-80:0x20::$short_gi_80 \
-@@ -447,11 +508,11 @@ mac80211_hostapd_setup_base() {
+@@ -447,11 +507,11 @@ mac80211_hostapd_setup_base() {
  			he_su_beamformer:1 \
  			he_su_beamformee:1 \
  			he_mu_beamformer:1 \
@@ -604,7 +604,7 @@
  			he_bss_color_enabled:1
  
  		he_phy_cap=$(iw phy "$phy" info | sed -n '/HE Iftypes: .*AP/,$p' | awk -F "[()]" '/HE PHY Capabilities/ { print $2 }' | head -1)
-@@ -465,6 +526,11 @@ mac80211_hostapd_setup_base() {
+@@ -465,6 +525,11 @@ mac80211_hostapd_setup_base() {
  			append base_cfg "he_oper_centr_freq_seg0_idx=$vht_center_seg0" "$N"
  		}
  
@@ -616,7 +616,7 @@
  		mac80211_add_he_capabilities \
  			he_su_beamformer:${he_phy_cap:6:2}:0x80:$he_su_beamformer \
  			he_su_beamformee:${he_phy_cap:8:2}:0x1:$he_su_beamformee \
-@@ -472,7 +538,15 @@ mac80211_hostapd_setup_base() {
+@@ -472,7 +537,15 @@ mac80211_hostapd_setup_base() {
  			he_spr_psr_enabled:${he_phy_cap:14:2}:0x1:$he_spr_psr_enabled \
  			he_twt_required:${he_mac_cap:0:2}:0x6:$he_twt_required
  
@@ -632,7 +632,7 @@
  			append base_cfg "he_bss_color=$he_bss_color" "$N"
  			[ "$he_spr_non_srg_obss_pd_max_offset" -gt 0 ] && { \
  				append base_cfg "he_spr_non_srg_obss_pd_max_offset=$he_spr_non_srg_obss_pd_max_offset" "$N"
-@@ -491,33 +565,49 @@ mac80211_hostapd_setup_base() {
+@@ -491,33 +564,49 @@ mac80211_hostapd_setup_base() {
  		append base_cfg "he_mu_edca_qos_info_q_ack=0" "$N"
  		append base_cfg "he_mu_edca_qos_info_queue_request=0" "$N"
  		append base_cfg "he_mu_edca_qos_info_txop_request=0" "$N"
@@ -692,7 +692,7 @@
  		}
  	fi
  
-@@ -527,6 +617,8 @@ ${channel:+channel=$channel}
+@@ -527,6 +616,8 @@ ${channel:+channel=$channel}
  ${channel_list:+chanlist=$channel_list}
  ${hostapd_noscan:+noscan=1}
  ${tx_burst:+tx_queue_data2_burst=$tx_burst}
@@ -701,16 +701,16 @@
  ${multiple_bssid:+mbssid=$multiple_bssid}
  #num_global_macaddr=$num_global_macaddr
  $base_cfg
-@@ -554,7 +646,7 @@ mac80211_hostapd_setup_bss() {
+@@ -554,7 +645,7 @@ mac80211_hostapd_setup_bss() {
  		append hostapd_cfg "wds_sta=1" "$N"
  		[ -n "$wds_bridge" ] && append hostapd_cfg "wds_bridge=$wds_bridge" "$N"
  	}
 -	[ "$staidx" -gt 0 -o "$start_disabled" -eq 1 ] && append hostapd_cfg "start_disabled=1" "$N"
 +	[ "$start_disabled" -eq 1 ] && append hostapd_cfg "start_disabled=1" "$N"
  
- 	cat >> /var/run/hostapd-$phy.conf <<EOF
+ 	cat >> /var/run/hostapd-$phy$vif_phy_suffix.conf <<EOF
  $hostapd_cfg
-@@ -565,6 +657,31 @@ ${max_listen_int:+max_listen_interval=$max_listen_int}
+@@ -565,6 +656,31 @@ ${max_listen_int:+max_listen_interval=$max_listen_int}
  EOF
  }
  
@@ -742,7 +742,7 @@
  mac80211_get_addr() {
  	local phy="$1"
  	local idx="$(($2 + 1))"
-@@ -688,7 +805,19 @@ mac80211_prepare_vif() {
+@@ -688,7 +804,19 @@ mac80211_prepare_vif() {
  	json_add_string _ifname "$ifname"
  
  	default_macaddr=
@@ -763,11 +763,10 @@
  		macaddr="$(mac80211_generate_mac $phy)"
  		macidx="$(($macidx + 1))"
  		default_macaddr=1
-@@ -947,6 +1076,14 @@ wpa_supplicant_set_config() {
- }
+@@ -957,6 +1085,13 @@ hostapd_set_config() {
+ 	local phy="$1"
+ 	local radio="$2"
  
- hostapd_set_config() {
-+
 +	if [ "$inconsistent_country" -eq 1 ]; then
 +		echo "ERROR: Please use the same country for all the radios."
 +		wireless_setup_failed HOSTAPD_START_FAILED
@@ -776,9 +775,9 @@
 +	fi
 +
  	[ -n "$hostapd_ctrl" ] || {
- 		ubus_call hostapd config_set '{ "phy": "'"$phy"'", "config": "", "prev_config": "'"${hostapd_conf_file}.prev"'" }' > /dev/null
+ 		ubus_call hostapd config_set '{ "phy": "'"$phy"'", "radio": '"$radio"', "config": "", "prev_config": "'"${hostapd_conf_file}.prev"'" }' > /dev/null
  		return 0;
-@@ -1030,6 +1167,9 @@ mac80211_setup_vif() {
+@@ -1041,6 +1176,9 @@ mac80211_setup_vif() {
  
  	json_select ..
  	[ -n "$failed" ] || wireless_add_vif "$name" "$ifname"
@@ -788,8 +787,8 @@
  }
  
  get_freq() {
-@@ -1081,6 +1221,25 @@ mac80211_reset_config() {
- 	wdev_tool "$phy" set_config '{}'
+@@ -1097,6 +1235,25 @@ mac80211_set_suffix() {
+ 	set_default radio -1
  }
  
 +mac80211_count_ap() {
@@ -814,7 +813,7 @@
  drv_mac80211_setup() {
  	json_select config
  	json_get_vars \
-@@ -1089,7 +1248,8 @@ drv_mac80211_setup() {
+@@ -1105,7 +1262,8 @@ drv_mac80211_setup() {
  		txpower \
  		rxantenna txantenna \
  		frag rts beacon_int:100 htmode \
@@ -824,7 +823,7 @@
  	json_get_values basic_rate_list basic_rate
  	json_get_values scan_list scan_list
  	json_select ..
-@@ -1120,10 +1280,18 @@ drv_mac80211_setup() {
+@@ -1138,10 +1296,18 @@ drv_mac80211_setup() {
  		}
  	}
  
@@ -835,7 +834,7 @@
 +		sleep 6;
 +	fi
 +
- 	hostapd_conf_file="/var/run/hostapd-$phy.conf"
+ 	hostapd_conf_file="/var/run/hostapd-$phy$vif_phy_suffix.conf"
  
  	macidx=0
  	staidx=0
@@ -843,7 +842,7 @@
  
  	[ -n "$chanbw" ] && {
  		for file in /sys/kernel/debug/ieee80211/$phy/ath9k*/chanbw /sys/kernel/debug/ieee80211/$phy/ath5k/bwmode; do
-@@ -1172,14 +1340,29 @@ drv_mac80211_setup() {
+@@ -1184,14 +1350,29 @@ drv_mac80211_setup() {
  
  	wpa_supplicant_init_config
  
@@ -864,17 +863,17 @@
  
 +	country_consistent_check
 +
- 	[ -x /usr/sbin/wpa_supplicant ] && wpa_supplicant_set_config "$phy"
- 	[ -x /usr/sbin/hostapd ] && hostapd_set_config "$phy"
+ 	[ -x /usr/sbin/wpa_supplicant ] && wpa_supplicant_set_config "$phy" "$radio"
+ 	[ -x /usr/sbin/hostapd ] && hostapd_set_config "$phy" "$radio"
  
 +	[ -n "$sr_enable" ] && echo "$sr_enable" > /sys/kernel/debug/ieee80211/$phy/mt76/sr_enable
 +	[ -n "$sr_enhanced" ] && echo "$sr_enhanced" > /sys/kernel/debug/ieee80211/$phy/mt76/sr_enhanced_enable
 +
- 	[ -x /usr/sbin/wpa_supplicant ] && wpa_supplicant_start "$phy"
+ 	[ -x /usr/sbin/wpa_supplicant ] && wpa_supplicant_start "$phy" "$radio"
  
  	json_set_namespace wdev_uc prev
 diff --git a/package/network/config/wifi-scripts/files/lib/wifi/mac80211.uc b/package/network/config/wifi-scripts/files/lib/wifi/mac80211.uc
-index 9fd6c35..a759cb5 100644
+index e82525e..dc1f069 100644
 --- a/package/network/config/wifi-scripts/files/lib/wifi/mac80211.uc
 +++ b/package/network/config/wifi-scripts/files/lib/wifi/mac80211.uc
 @@ -12,6 +12,7 @@ if (!board.wlan)
@@ -884,63 +883,63 @@
 +let random_mac_bytes = getenv("MT76_ENV_RANDOM_MAC_BYTES");
  let config = uci.cursor().get_all("wireless") ?? {};
  
- function radio_exists(path, macaddr, phy) {
-@@ -47,12 +48,10 @@ for (let phy_name, phy in board.wlan) {
+ function radio_exists(path, macaddr, phy, radio) {
+@@ -52,12 +53,10 @@ for (let phy_name, phy in board.wlan) {
+ 		let band = info.bands[band_name];
+ 		let rband = radio.bands[band_name];
+ 		let channel = rband.default_channel ?? "auto";
++		if (band_name == "6G")
++			channel = 37;
  
- 	let band = info.bands[band_name];
- 	let channel = band.default_channel ?? "auto";
-+	if (band_name == "6G")
-+		channel = 37;
+ 		let width = band.max_width;
+-		if (band_name == "2G")
+-			width = 20;
+-		else if (width > 80)
+-			width = 80;
  
- 	let width = band.max_width;
--	if (band_name == "2G")
--		width = 20;
--	else if (width > 80)
--		width = 80;
+ 		let htmode = filter(htmode_order, (m) => band[lc(m)])[0];
+ 		if (htmode)
+@@ -76,8 +75,6 @@ for (let phy_name, phy in board.wlan) {
+ 		if (match(phy_name, /^phy[0-9]/))
+ 			id = `path='${phy.path}'`;
  
- 	let htmode = filter(htmode_order, (m) => band[lc(m)])[0];
- 	if (htmode)
-@@ -71,8 +70,6 @@ for (let phy_name, phy in board.wlan) {
- 	if (match(phy_name, /^phy[0-9]/))
- 		id = `path='${phy.path}'`;
- 
--	band_name = lc(band_name);
+-		band_name = lc(band_name);
 -
- 	let country, defaults, num_global_macaddr;
- 	if (board.wlan.defaults) {
- 		defaults = board.wlan.defaults.ssids?.[band_name]?.ssid ? board.wlan.defaults.ssids?.[band_name] : board.wlan.defaults.ssids?.all;
-@@ -82,25 +79,79 @@ for (let phy_name, phy in board.wlan) {
- 		num_global_macaddr = board.wlan.defaults.ssids?.[band_name]?.mac_count;
- 	}
+ 		let country, defaults, num_global_macaddr;
+ 		if (board.wlan.defaults) {
+ 			defaults = board.wlan.defaults.ssids?.[band_name]?.ssid ? board.wlan.defaults.ssids?.[band_name] : board.wlan.defaults.ssids?.all;
+@@ -90,25 +87,80 @@ for (let phy_name, phy in board.wlan) {
+ 		if (length(info.radios) > 0)
+ 			id += `\nset ${s}.radio='${radio.index}'`;
  
-+	let disabled = getenv("MT76_ENV_WM_TM") ? 1 : 0;
-+	let noscan = 0;
-+	let mbssid = 0;
-+	let rnr = 0;
-+	let background_radar = 0;
-+	let encryption = "none";
-+	let mbo = 0;
-+	let band_idx = 0;
-+	let ssid = "";
++		let disabled = getenv("MT76_ENV_WM_TM") ? 1 : 0;
++		let noscan = 0;
++		let mbssid = 0;
++		let rnr = 0;
++		let background_radar = 0;
++		let encryption = "none";
++		let mbo = 0;
++		let band_idx = 0;
++		let ssid = "";
 +
-+	if (band_name == "6G") {
-+		encryption = "sae";
-+		mbo = 1;
-+		band_idx = 2;
-+		ssid = "OpenWrt-6g";
-+	} else if (band_name == "5G") {
-+		noscan = 1;
-+		rnr = 1;
-+		background_radar = 1;
-+		band_idx = 1;
-+		ssid = "OpenWrt-5g";
-+	} else {
-+		noscan = 1;
-+		rnr = 1;
-+		ssid = "OpenWrt-2g";
-+	}
++		if (band_name == "6G") {
++			encryption = "sae";
++			mbo = 1;
++			band_idx = 2;
++			ssid = "OpenWrt-6g";
++		} else if (band_name == "5G") {
++			noscan = 1;
++			rnr = 1;
++			background_radar = 1;
++			band_idx = 1;
++			ssid = "OpenWrt-5g";
++		} else {
++			noscan = 1;
++			rnr = 1;
++			ssid = "OpenWrt-2g";
++		}
 +
- 	print(`set ${s}=wifi-device
+ 		print(`set ${s}=wifi-device
  set ${s}.type='mac80211'
  set ${s}.${id}
  set ${s}.band='${band_name}'
@@ -990,9 +989,10 @@
 +				print(`set ${si_mld}.macaddr=00:1${idx - 1}:55:66${random_mac_bytes}
 +`);
 +		}
- 	commit = true;
- }
- 
++
+ 		config[name] = {};
+ 		commit = true;
+ 	}
 diff --git a/package/network/config/wifi-scripts/files/sbin/wifi b/package/network/config/wifi-scripts/files/sbin/wifi
 index f937dba..ba2d392 100755
 --- a/package/network/config/wifi-scripts/files/sbin/wifi
@@ -1032,10 +1032,10 @@
  	ucode /lib/wifi/mac80211.uc | uci -q batch
  
 diff --git a/package/network/config/wifi-scripts/files/usr/share/hostap/wifi-detect.uc b/package/network/config/wifi-scripts/files/usr/share/hostap/wifi-detect.uc
-index ee9155b..43f560f 100644
+index db862d4..cebbc88 100644
 --- a/package/network/config/wifi-scripts/files/usr/share/hostap/wifi-detect.uc
 +++ b/package/network/config/wifi-scripts/files/usr/share/hostap/wifi-detect.uc
-@@ -129,7 +129,9 @@ function wiphy_detect() {
+@@ -157,7 +157,9 @@ function wiphy_detect() {
  				eht_phy_cap |= ift.eht_cap_phy[0];
  			}
  
diff --git a/autobuild/unified/filogic/mac80211/master/patches-base/0003-hostapd-package-makefile-ucode-files.patch b/autobuild/unified/filogic/mac80211/master/patches-base/0003-hostapd-package-makefile-ucode-files.patch
index 03218bb..00a33c7 100644
--- a/autobuild/unified/filogic/mac80211/master/patches-base/0003-hostapd-package-makefile-ucode-files.patch
+++ b/autobuild/unified/filogic/mac80211/master/patches-base/0003-hostapd-package-makefile-ucode-files.patch
@@ -1,5 +1,5 @@
 diff --git a/package/network/services/hostapd/Makefile b/package/network/services/hostapd/Makefile
-index 0e3396262d..3105b98c31 100644
+index 0e33962..3105b98 100644
 --- a/package/network/services/hostapd/Makefile
 +++ b/package/network/services/hostapd/Makefile
 @@ -85,7 +85,7 @@ ifneq ($(CONFIG_DRIVER_11BE_SUPPORT),)
@@ -22,10 +22,10 @@
  
  define Package/hostapd/install
 diff --git a/package/network/services/hostapd/files/hostapd.uc b/package/network/services/hostapd/files/hostapd.uc
-index 6774fbf3ba..f9d9df8b3c 100644
+index 2d9ce28..2bc58e4 100644
 --- a/package/network/services/hostapd/files/hostapd.uc
 +++ b/package/network/services/hostapd/files/hostapd.uc
-@@ -61,6 +61,7 @@ start_disabled=1
+@@ -86,6 +86,7 @@ start_disabled=1
  function iface_freq_info(iface, config, params)
  {
  	let freq = params.frequency;
@@ -33,7 +33,7 @@
  	if (!freq)
  		return null;
  
-@@ -69,25 +70,29 @@ function iface_freq_info(iface, config, params)
+@@ -94,25 +95,29 @@ function iface_freq_info(iface, config, params)
  		sec_offset = 0;
  
  	let width = 0;
@@ -75,7 +75,7 @@
  }
  
  function iface_add(phy, config, phy_status)
-@@ -751,6 +756,8 @@ let main_obj = {
+@@ -841,6 +846,8 @@ let main_obj = {
  			up: true,
  			frequency: 0,
  			sec_chan_offset: 0,
@@ -84,8 +84,8 @@
  			csa: true,
  			csa_count: 0,
  		},
-@@ -758,6 +765,15 @@ let main_obj = {
- 			if (req.args.up == null || !req.args.phy)
+@@ -849,6 +856,15 @@ let main_obj = {
+ 			if (req.args.up == null || !phy)
  				return libubus.STATUS_INVALID_ARGUMENT;
  
 +			hostapd.printf(`ucode: mtk: apsta state update`);
@@ -97,14 +97,14 @@
 +			hostapd.printf(`    * bw320_offset: ${req.args.bw320_offset}`);
 +			hostapd.printf(`    * csa: ${req.args.csa}`);
 +
- 			let phy = req.args.phy;
  			let config = hostapd.data.config[phy];
  			if (!config || !config.bss || !config.bss[0] || !config.bss[0].ifname)
+ 				return 0;
 diff --git a/package/network/services/hostapd/files/wpa_supplicant.uc b/package/network/services/hostapd/files/wpa_supplicant.uc
-index 31d4534625..36d0b9aaef 100644
+index fbea276..a9b7f9d 100644
 --- a/package/network/services/hostapd/files/wpa_supplicant.uc
 +++ b/package/network/services/hostapd/files/wpa_supplicant.uc
-@@ -266,6 +266,7 @@ function iface_hostapd_notify(phy, ifname, iface, state)
+@@ -316,6 +316,7 @@ function iface_hostapd_notify(phy, ifname, iface, state)
  	let status = iface.status();
  	let msg = { phy: phy };
  
@@ -112,7 +112,7 @@
  	switch (state) {
  	case "DISCONNECTED":
  	case "AUTHENTICATING":
-@@ -280,6 +281,8 @@ function iface_hostapd_notify(phy, ifname, iface, state)
+@@ -330,6 +331,8 @@ function iface_hostapd_notify(phy, ifname, iface, state)
  		msg.up = true;
  		msg.frequency = status.frequency;
  		msg.sec_chan_offset = status.sec_chan_offset;
@@ -121,7 +121,7 @@
  		break;
  	default:
  		return;
-@@ -296,6 +299,8 @@ function iface_channel_switch(phy, ifname, iface, info)
+@@ -346,6 +349,8 @@ function iface_channel_switch(phy, ifname, iface, info)
  		csa: true,
  		csa_count: info.csa_count ? info.csa_count - 1 : 0,
  		frequency: info.frequency,
diff --git a/autobuild/unified/filogic/mac80211/master/patches-base/0004-mac80211-package-makefile.patch b/autobuild/unified/filogic/mac80211/master/patches-base/0004-mac80211-package-makefile.patch
index 498f190..fd6673d 100644
--- a/autobuild/unified/filogic/mac80211/master/patches-base/0004-mac80211-package-makefile.patch
+++ b/autobuild/unified/filogic/mac80211/master/patches-base/0004-mac80211-package-makefile.patch
@@ -1,5 +1,5 @@
 diff --git a/package/kernel/mac80211/Makefile b/package/kernel/mac80211/Makefile
-index 026d3e5f82..6af7488db5 100644
+index 22cd0e9..148e5cc 100644
 --- a/package/kernel/mac80211/Makefile
 +++ b/package/kernel/mac80211/Makefile
 @@ -22,6 +22,7 @@ PKG_SOURCE:=backports-$(PKG_VERSION).tar.xz