[][MAC80211][wifi6][mt76][Add the mac80211 hw bmc ps buffer function.]

[Description]
Add the mac80211 hw bmc ps buffer function.

[Release-log]
N/A

Change-Id: I873a4ded193efd52ccc1e4f4b9b7ceacb4a2e68f
Reviewed-on: https://gerrit.mediatek.inc/c/openwrt/feeds/mtk_openwrt_feeds/+/7920607
diff --git a/autobuild_mac80211_release/0001-wifi6-mac80211-generate-hostapd-setting-from-ap-cap.patch b/autobuild_mac80211_release/0001-wifi6-mac80211-generate-hostapd-setting-from-ap-cap.patch
index ee11653..540dff6 100644
--- a/autobuild_mac80211_release/0001-wifi6-mac80211-generate-hostapd-setting-from-ap-cap.patch
+++ b/autobuild_mac80211_release/0001-wifi6-mac80211-generate-hostapd-setting-from-ap-cap.patch
@@ -1,8 +1,8 @@
 diff --git a/package/kernel/mac80211/Makefile b/package/kernel/mac80211/Makefile
-index a7472ee779..f06c889b0a 100644
+index 8ecbe30..44af0c7 100644
 --- a/package/kernel/mac80211/Makefile
 +++ b/package/kernel/mac80211/Makefile
-@@ -20,6 +20,7 @@ PKG_SOURCE:=backports-$(PKG_VERSION).tar.xz
+@@ -19,6 +19,7 @@ PKG_SOURCE:=backports-$(PKG_VERSION).tar.xz
  PKG_BUILD_DIR:=$(KERNEL_BUILD_DIR)/backports-$(PKG_VERSION)
  PKG_BUILD_PARALLEL:=1
  
@@ -10,7 +10,7 @@
  PKG_MAINTAINER:=Felix Fietkau <nbd@nbd.name>
  
  PKG_DRIVERS = \
-@@ -72,6 +73,10 @@ config-y:= \
+@@ -71,6 +72,11 @@ config-y:= \
  	WLAN_VENDOR_ST \
  	WLAN_VENDOR_TI \
  	WLAN_VENDOR_ZYDAS \
@@ -18,10 +18,11 @@
 +	MAC80211_MLME_DEBUG \
 +	MAC80211_STA_DEBUG \
 +	MAC80211_HT_DEBUG \
++	MAC80211_PS_DEBUG \
  
  config-$(call config_package,cfg80211) += CFG80211
  config-$(CONFIG_PACKAGE_CFG80211_TESTMODE) += NL80211_TESTMODE
-@@ -297,6 +302,8 @@ define Build/Prepare
+@@ -296,6 +302,8 @@ define Build/Prepare
  	mkdir -p $(PKG_BUILD_DIR)
  	$(PKG_UNPACK)
  	$(Build/Patch)
@@ -31,7 +32,7 @@
  		$(PKG_BUILD_DIR)/include/linux/ssb \
  		$(PKG_BUILD_DIR)/include/linux/bcma \
 diff --git a/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh b/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh
-index 5aaba9af26..e6e9e540e4 100644
+index ed28052..13c385f 100644
 --- a/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh
 +++ b/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh
 @@ -27,6 +27,7 @@ drv_mac80211_init_device_config() {
@@ -462,7 +463,7 @@
  	NEWUMLIST=
  
 diff --git a/package/kernel/mac80211/files/lib/wifi/mac80211.sh b/package/kernel/mac80211/files/lib/wifi/mac80211.sh
-index e24a2a634e..20e60688ea 100644
+index 3ecd932..69ecbbf 100644
 --- a/package/kernel/mac80211/files/lib/wifi/mac80211.sh
 +++ b/package/kernel/mac80211/files/lib/wifi/mac80211.sh
 @@ -60,6 +60,9 @@ BEGIN {
@@ -547,7 +548,7 @@
  
  		get_band_defaults "$dev"
  
-@@ -196,6 +236,14 @@ detect_mac80211() {
+@@ -192,6 +232,14 @@ detect_mac80211() {
  				;;
  		esac
  
@@ -562,7 +563,7 @@
  		uci -q batch <<-EOF
  			set wireless.${name}=wifi-device
  			set wireless.${name}.type=mac80211
-@@ -203,15 +251,40 @@ detect_mac80211() {
+@@ -199,15 +247,40 @@ detect_mac80211() {
  			set wireless.${name}.channel=${channel}
  			set wireless.${name}.band=${mode_band}
  			set wireless.${name}.htmode=$htmode
@@ -607,7 +608,7 @@
  	done
  }
 diff --git a/package/network/services/hostapd/files/hostapd.sh b/package/network/services/hostapd/files/hostapd.sh
-index bf3625c92d..d98ff0e9c0 100644
+index 28bd210..dc315da 100644
 --- a/package/network/services/hostapd/files/hostapd.sh
 +++ b/package/network/services/hostapd/files/hostapd.sh
 @@ -60,7 +60,14 @@ hostapd_append_wpa_key_mgmt() {
@@ -634,7 +635,7 @@
  	config_add_int maxassoc
  
  	config_add_string acs_chan_bias
-@@ -227,8 +235,10 @@ hostapd_prepare_device_config() {
+@@ -225,8 +233,10 @@ hostapd_prepare_device_config() {
  		hostapd_add_rate brlist "$br"
  	done
  
@@ -645,7 +646,7 @@
  	[ -n "$beacon_rate" ] && append base_cfg "beacon_rate=$beacon_rate" "$N"
  	[ -n "$rlist" ] && append base_cfg "supported_rates=$rlist" "$N"
  	[ -n "$brlist" ] && append base_cfg "basic_rates=$brlist" "$N"
-@@ -379,6 +389,24 @@ hostapd_common_add_bss_config() {
+@@ -376,6 +386,24 @@ hostapd_common_add_bss_config() {
  	config_add_string fils_dhcp
  
  	config_add_int ocv
@@ -670,7 +671,7 @@
  }
  
  hostapd_set_vlan_file() {
-@@ -443,11 +471,11 @@ append_iw_nai_realm() {
+@@ -440,11 +468,11 @@ append_iw_nai_realm() {
  }
  
  append_iw_venue_name() {
@@ -684,7 +685,7 @@
  }
  
  append_hs20_oper_friendly_name() {
-@@ -565,7 +593,8 @@ hostapd_set_bss_options() {
+@@ -562,7 +590,8 @@ hostapd_set_bss_options() {
  		ppsk airtime_bss_weight airtime_bss_limit airtime_sta_weight \
  		multicast_to_unicast_all proxy_arp per_sta_vif \
  		eap_server eap_user_file ca_cert server_cert private_key private_key_passwd server_id \
@@ -694,7 +695,7 @@
  
  	set_default fils 0
  	set_default isolate 0
-@@ -793,6 +822,35 @@ hostapd_set_bss_options() {
+@@ -790,6 +819,35 @@ hostapd_set_bss_options() {
  	local auth_algs="$((($auth_mode_shared << 1) | $auth_mode_open))"
  	append bss_conf "auth_algs=${auth_algs:-1}" "$N"
  	append bss_conf "wpa=$wpa" "$N"
@@ -730,7 +731,7 @@
  	[ -n "$wpa_pairwise" ] && append bss_conf "wpa_pairwise=$wpa_pairwise" "$N"
  
  	set_default wps_pushbutton 0
-@@ -844,7 +902,7 @@ hostapd_set_bss_options() {
+@@ -841,7 +899,7 @@ hostapd_set_bss_options() {
  	}
  
  	append bss_conf "ssid=$ssid" "$N"
@@ -739,7 +740,7 @@
  	[ -n "$network_ifname" ] && append bss_conf "snoop_iface=$network_ifname" "$N"
  	[ -n "$iapp_interface" ] && {
  		local ifname
-@@ -957,6 +1015,8 @@ hostapd_set_bss_options() {
+@@ -954,6 +1012,8 @@ hostapd_set_bss_options() {
  	fi
  
  	if [ "$wpa" -ge "2" ]; then
@@ -748,7 +749,7 @@
  		if [ -n "$network_bridge" -a "$rsn_preauth" = 1 ]; then
  			set_default auth_cache 1
  			append bss_conf "rsn_preauth=1" "$N"
-@@ -975,17 +1035,42 @@ hostapd_set_bss_options() {
+@@ -972,17 +1032,42 @@ hostapd_set_bss_options() {
  		append bss_conf "okc=$auth_cache" "$N"
  		[ "$auth_cache" = 0 -a "$fils" = 0 ] && append bss_conf "disable_pmksa_caching=1" "$N"
  
@@ -792,7 +793,7 @@
  					[ -n "$ieee80211w_max_timeout" ] && \
  						append bss_conf "assoc_sa_query_max_timeout=$ieee80211w_max_timeout" "$N"
  					[ -n "$ieee80211w_retry_timeout" ] && \
-@@ -1050,9 +1135,10 @@ hostapd_set_bss_options() {
+@@ -1047,9 +1132,10 @@ hostapd_set_bss_options() {
  	json_get_vars iw_roaming_consortium iw_domain_name iw_anqp_3gpp_cell_net iw_nai_realm
  	json_get_vars iw_anqp_elem iw_qos_map_set iw_ipaddr_type_availability iw_gas_address3
  	json_get_vars iw_venue_name iw_venue_url
@@ -804,7 +805,7 @@
  		append bss_conf "interworking=1" "$N"
  		set_default iw_internet 1
  		set_default iw_asra 0
-@@ -1159,6 +1245,22 @@ hostapd_set_bss_options() {
+@@ -1156,6 +1242,22 @@ hostapd_set_bss_options() {
  		append bss_conf "$val" "$N"
  	done
  
@@ -827,7 +828,7 @@
  	bss_md5sum="$(echo $bss_conf | md5sum | cut -d" " -f1)"
  	append bss_conf "config_id=$bss_md5sum" "$N"
  
-@@ -1249,6 +1351,7 @@ wpa_supplicant_prepare_interface() {
+@@ -1246,6 +1348,7 @@ wpa_supplicant_prepare_interface() {
  		country_str="country=$country"
  	}
  
@@ -835,7 +836,7 @@
  	multiap_flag_file="${_config}.is_multiap"
  	if [ "$multi_ap" = "1" ]; then
  		touch "$multiap_flag_file"
-@@ -1260,6 +1363,7 @@ wpa_supplicant_prepare_interface() {
+@@ -1257,6 +1360,7 @@ wpa_supplicant_prepare_interface() {
  ${scan_list:+freq_list=$scan_list}
  $ap_scan
  $country_str
@@ -843,7 +844,7 @@
  EOF
  	return 0
  }
-@@ -1531,12 +1635,38 @@ wpa_supplicant_add_network() {
+@@ -1528,12 +1632,38 @@ wpa_supplicant_add_network() {
  		;;
  	esac
  
@@ -886,7 +887,7 @@
  		case "$wpa" in
  			1)
  				append network_data "proto=WPA" "$N$T"
-@@ -1546,12 +1676,48 @@ wpa_supplicant_add_network() {
+@@ -1543,12 +1673,48 @@ wpa_supplicant_add_network() {
  			;;
  		esac
  
@@ -936,7 +937,7 @@
  	[ -n "$bssid" ] && append network_data "bssid=$bssid" "$N$T"
  	[ -n "$beacon_int" ] && append network_data "beacon_int=$beacon_int" "$N$T"
  
-@@ -1562,6 +1728,20 @@ wpa_supplicant_add_network() {
+@@ -1559,6 +1725,20 @@ wpa_supplicant_add_network() {
  	[ -n "$bssid_blacklist" ] && append network_data "bssid_blacklist=$bssid_blacklist" "$N$T"
  	[ -n "$bssid_whitelist" ] && append network_data "bssid_whitelist=$bssid_whitelist" "$N$T"
  
@@ -957,7 +958,7 @@
  	[ -n "$basic_rate" ] && {
  		local br rate_list=
  		for br in $basic_rate; do
-@@ -1576,6 +1756,11 @@ wpa_supplicant_add_network() {
+@@ -1573,6 +1753,11 @@ wpa_supplicant_add_network() {
  		append network_data "mcast_rate=$mc_rate" "$N$T"
  	}