[][mac80211][mt76][Enable MT76 WED support]

[Description]
Add MT76 WED support in autobuild_mac80211_release

[Release-log]
N/A

Change-Id: Ia23f637b7f158b292d375007f46ead3eed056ab6
Reviewed-on: https://gerrit.mediatek.inc/c/openwrt/feeds/mtk_openwrt_feeds/+/6209885
diff --git a/autobuild_mac80211_release/0001-master-mac80211-generate-hostapd-setting-from-ap-cap.patch b/autobuild_mac80211_release/0001-master-mac80211-generate-hostapd-setting-from-ap-cap.patch
index a789d90..392252e 100644
--- a/autobuild_mac80211_release/0001-master-mac80211-generate-hostapd-setting-from-ap-cap.patch
+++ b/autobuild_mac80211_release/0001-master-mac80211-generate-hostapd-setting-from-ap-cap.patch
@@ -1,33 +1,18 @@
 diff --git a/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh b/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh
-index 27eecf3..0124d89 100644
+index 5d6ca7c..cfe4243 100644
 --- a/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh
 +++ b/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh
-@@ -61,7 +61,8 @@ drv_mac80211_init_device_config() {
- 		rx_stbc \
- 		tx_stbc \
- 		he_bss_color \
--		he_spr_non_srg_obss_pd_max_offset
-+		he_spr_non_srg_obss_pd_max_offset \
-+		radar_background
- 	config_add_boolean \
- 		ldpc \
- 		greenfield \
-@@ -137,13 +138,10 @@ mac80211_hostapd_setup_base() {
- 	[ -n "$acs_exclude_dfs" ] && [ "$acs_exclude_dfs" -gt 0 ] &&
- 		append base_cfg "acs_exclude_dfs=1" "$N"
- 
--	json_get_vars noscan ht_coex
-+	json_get_vars noscan ht_coex radar_background:0
+@@ -141,9 +141,6 @@ mac80211_hostapd_setup_base() {
  	json_get_values ht_capab_list ht_capab tx_burst
  	json_get_values channel_list channels
  
 -	[ "$auto_channel" = 0 ] && [ -z "$channel_list" ] && \
 -		channel_list="$channel"
 -
- 	set_default noscan 0
+ 	[ "$min_tx_power" -gt 0 ] && append base_cfg "min_tx_power=$min_tx_power"
  
- 	[ "$noscan" -gt 0 ] && hostapd_noscan=1
-@@ -413,9 +411,9 @@ mac80211_hostapd_setup_base() {
+ 	set_default noscan 0
+@@ -420,9 +417,9 @@ mac80211_hostapd_setup_base() {
  			he_spr_non_srg_obss_pd_max_offset:1 \
  			he_bss_color
  
@@ -39,18 +24,11 @@
  		he_mac_cap=${he_mac_cap:2}
  
  		append base_cfg "ieee80211ax=1" "$N"
-@@ -462,6 +460,8 @@ mac80211_hostapd_setup_base() {
- 		append base_cfg "he_mu_edca_ac_vo_timer=255" "$N"
- 	fi
- 
-+	append base_cfg "enable_background_radar=$radar_background" "$N"
-+
- 	hostapd_prepare_device_config "$hostapd_conf_file" nl80211
- 	cat >> "$hostapd_conf_file" <<EOF
- ${channel:+channel=$channel}
+diff --git a/package/kernel/mac80211/files/lib/wifi/mac80211.sh b/package/kernel/mac80211/files/lib/wifi/mac80211.sh
+index 6aa46b0..5551835 100644
 --- a/package/kernel/mac80211/files/lib/wifi/mac80211.sh
 +++ b/package/kernel/mac80211/files/lib/wifi/mac80211.sh
-@@ -132,6 +132,13 @@
+@@ -132,6 +132,13 @@ get_band_defaults() {
  		mode_band="$band"
  		channel="$chan"
  		htmode="$mode"
@@ -64,7 +42,7 @@
  	done
  }
  
-@@ -157,6 +164,8 @@
+@@ -157,6 +164,8 @@ detect_mac80211() {
  		channel=""
  		htmode=""
  		ht_capab=""
@@ -73,7 +51,7 @@
  
  		get_band_defaults "$dev"
  
-@@ -181,8 +190,11 @@
+@@ -181,8 +190,11 @@ detect_mac80211() {
  			set wireless.default_radio${devidx}.network=lan
  			set wireless.default_radio${devidx}.mode=ap
  			set wireless.default_radio${devidx}.ssid=OpenWrt
@@ -87,5 +65,5 @@
  
  		devidx=$(($devidx + 1))
 -- 
-2.29.2
+2.36.1
 
diff --git a/autobuild_mac80211_release/lede-build-sanity.sh b/autobuild_mac80211_release/lede-build-sanity.sh
index 173c9c8..2c01a85 100755
--- a/autobuild_mac80211_release/lede-build-sanity.sh
+++ b/autobuild_mac80211_release/lede-build-sanity.sh
@@ -85,11 +85,12 @@
 add_proprietary_kernel_files() {
 	#cp mtk proprietary ko_module source to mtk target
 	#and also need to be done in release mtk target
-	mkdir -p ${BUILD_DIR}/target/linux/mediatek/files-5.4/drivers/net/wireless
-	cp -rf ${BUILD_DIR}/../ko_module/gateway/proprietary_driver/drivers/wifi_utility/ ${BUILD_DIR}/target/linux/mediatek/files-5.4/drivers/net/wireless
 
-	mkdir -p ${BUILD_DIR}/target/linux/mediatek/files-5.4/include/uapi/linux/
-	cp -rf ${BUILD_DIR}/../kernel/wapp_uapi_includes ${BUILD_DIR}/target/linux/mediatek/files-5.4/include/uapi/linux/wapp
+	# mean it is old process for possible build issue and should delete it gradually in the furture. 
+	if [ ! -d ${BUILD_DIR}/target/linux/mediatek/files-5.4/drivers/net/wireless/wifi_utility ]; then
+		mkdir -p ${BUILD_DIR}/target/linux/mediatek/files-5.4/drivers/net/wireless
+		cp -rf ${BUILD_DIR}/../ko_module/gateway/proprietary_driver/drivers/wifi_utility/ ${BUILD_DIR}/target/linux/mediatek/files-5.4/drivers/net/wireless
+	fi
 
 	cp -fpR ${BUILD_DIR}/autobuild/target/ ${BUILD_DIR}
 }
@@ -105,6 +106,24 @@
 	do_patch ${BUILD_DIR}/autobuild/openwrt_patches${OPENWRT_VER}/mtk_wifi || exit 1
 }
 
+prepare_flowoffload() {
+	#rm patches for flowblock
+	rm -rf ./target/linux/generic/pending-5.4/64*.patch
+	rm -rf ./target/linux/generic/hack-5.4/647-netfilter-flow-acct.patch
+	rm -rf ./target/linux/generic/hack-5.4/650-netfilter-add-xt_OFFLOAD-target.patch
+	rm -rf ./target/linux/mediatek/patches-5.4/1002-mtkhnat-add-support-for-virtual-interface-acceleration.patch
+
+	#hack mt7986 config5.4
+	echo "CONFIG_BRIDGE_NETFILTER=y" >> ./target/linux/mediatek/mt7986/config-5.4
+	echo "CONFIG_NETFILTER_FAMILY_BRIDGE=y" >> ./target/linux/mediatek/mt7986/config-5.4
+	echo "CONFIG_SKB_EXTENSIONS=y" >> ./target/linux/mediatek/mt7986/config-5.4
+
+	#hack mt7622 config5.4
+	echo "CONFIG_BRIDGE_NETFILTER=y" >> ./target/linux/mediatek/mt7622/config-5.4
+	echo "CONFIG_NETFILTER_FAMILY_BRIDGE=y" >> ./target/linux/mediatek/mt7622/config-5.4
+	echo "CONFIG_SKB_EXTENSIONS=y" >> ./target/linux/mediatek/mt7622/config-5.4
+}
+
 prepare_mac80211() {
 	rm -rf ${BUILD_DIR}/package/network/services/hostapd
 	cp -fpR ${BUILD_DIR}/./../mac80211_package/package/network/services/hostapd ${BUILD_DIR}/package/network/services
@@ -126,9 +145,20 @@
 
 	cp -fpR ${BUILD_DIR}/./../mac80211_package/package/kernel/mt76 ${BUILD_DIR}/package/kernel
 
+	#hack mt7986 hostapd config
+	echo "CONFIG_MBO=y" >> ./package/network/services/hostapd/files/hostapd-full.config
+	echo "CONFIG_WPS_UPNP=y"  >> ./package/network/services/hostapd/files/hostapd-full.config
+	echo "CONFIG_DPP=y"  >> ./package/network/services/hostapd/files/hostapd-full.config
+	echo "CONFIG_DPP2=y"  >> ./package/network/services/hostapd/files/hostapd-full.config
+	echo "CONFIG_DPP3=y"  >> ./package/network/services/hostapd/files/hostapd-full.config
+	echo "CONFIG_DPP=y"  >> ./package/network/services/hostapd/files/wpa_supplicant-full.config
+	echo "CONFIG_DPP2=y"  >> ./package/network/services/hostapd/files/wpa_supplicant-full.config
+	echo "CONFIG_DPP3=y"  >> ./package/network/services/hostapd/files/wpa_supplicant-full.config
+
 	patch -f -p1 -i ${MTK_FEED_DIR}/autobuild_mac80211_release/0001-master-mac80211-generate-hostapd-setting-from-ap-cap.patch
 	patch -f -p1 -i ${MTK_FEED_DIR}/autobuild_mac80211_release/0002-master-hostapd-makefile-for-utils.patch
 	patch -f -p1 -i ${MTK_FEED_DIR}/autobuild_mac80211_release/0003-master-mt76-makefile-for-new-chip.patch
+	patch -f -p1 -i ${MTK_FEED_DIR}/autobuild_mac80211_release/0004-master-wireless-regdb-makefile-for-6E.patch
 	cp -rfa ${MTK_FEED_DIR}/autobuild_mac80211_release/package/ ${BUILD_DIR}
 	cp -rfa ${MTK_FEED_DIR}/autobuild_mac80211_release/target/ ${BUILD_DIR}
 }
@@ -273,9 +303,27 @@
 
 	cd ${BUILD_DIR}
 
+	#make
+
+	echo "make  V=s -j $(($(nproc) + 1)) download world"
+	make  V=s -j $(($(nproc) + 1)) download world || exit 1
+
+	#tar unstripped rootfs for debug symbols
+	install_release $1
+}
+
+build_log() {
+	echo "###############################################################################"
+	echo "# $1"
+	echo "###############################################################################"
+	echo "build $1"
+
+	cd ${BUILD_DIR}
+
+	#make
+
-    	#make
-	echo make V=s $2
-	make V=s $2 || exit 1
+	echo "make  V=s -j $(($(nproc) + 1)) download world"
+	make  V=s -j $(($(nproc) + 1)) download world || make V=s -j1 || exit 1
 
 	#tar unstripped rootfs for debug symbols
 	install_release $1
diff --git a/autobuild_mac80211_release/mt7622_mt7915_mac80211/lede-branch-build-sanity.sh b/autobuild_mac80211_release/mt7622_mt7915_mac80211/lede-branch-build-sanity.sh
index ad8889b..84251d0 100755
--- a/autobuild_mac80211_release/mt7622_mt7915_mac80211/lede-branch-build-sanity.sh
+++ b/autobuild_mac80211_release/mt7622_mt7915_mac80211/lede-branch-build-sanity.sh
@@ -14,10 +14,7 @@
 echo "CONFIG_NETFILTER=y" >> ./target/linux/mediatek/mt7622/config-5.4
 echo "CONFIG_NETFILTER_ADVANCED=y" >> ./target/linux/mediatek/mt7622/config-5.4
 
-#hack hostapd config
-echo "CONFIG_MBO=y" >> ./package/network/services/hostapd/files/hostapd-full.config
-echo "CONFIG_WPS_UPNP=y"  >> ./package/network/services/hostapd/files/hostapd-full.config
-echo "CONFIG_RELAY=y" >> ./target/linux/mediatek/mt7622/config-5.4
+prepare_flowoffload
 
 prepare_mac80211
 
diff --git a/autobuild_mac80211_release/mt7986_besra_mac80211/lede-branch-build-sanity.sh b/autobuild_mac80211_release/mt7986_besra_mac80211/lede-branch-build-sanity.sh
index 1da3d5e..1f252b7 100755
--- a/autobuild_mac80211_release/mt7986_besra_mac80211/lede-branch-build-sanity.sh
+++ b/autobuild_mac80211_release/mt7986_besra_mac80211/lede-branch-build-sanity.sh
@@ -16,12 +16,11 @@
 echo "CONFIG_NETFILTER_ADVANCED=y" >> ./target/linux/mediatek/mt7986/config-5.4
 echo "CONFIG_RELAY=y" >> ./target/linux/mediatek/mt7986/config-5.4
 
-#hack mt7986 hostapd config
-echo "CONFIG_MBO=y" >> ./package/network/services/hostapd/files/hostapd-full.config
-echo "CONFIG_WPS_UPNP=y"  >> ./package/network/services/hostapd/files/hostapd-full.config
-
 prepare_mac80211
 
+rm -rf ${BUILD_DIR}/package/kernel/mac80211/patches/subsys/910-mac80211-offload.patch
+rm -rf ${BUILD_DIR}/package/kernel/mac80211/patches/subsys/911-add-fill-receive-path-ops-to-get-wed-idx-v2.patch
+find ${BUILD_DIR}/target/linux/mediatek/patches-5.4 -name "999*.patch" -delete
 find ${BUILD_DIR}/package/kernel/mt76/patches -name "*-mt76-*.patch" -delete
 
 prepare_final ${branch_name}
@@ -31,5 +30,5 @@
 
 #step2 build
 if [ -z ${1} ]; then
-	build ${branch_name} -j1 || [ "$LOCAL" != "1" ]
+	build_log ${branch_name} -j1 || [ "$LOCAL" != "1" ]
 fi
diff --git a/autobuild_mac80211_release/mt7986_mac80211/lede-branch-build-sanity.sh b/autobuild_mac80211_release/mt7986_mac80211/lede-branch-build-sanity.sh
index 3683395..24a6f12 100755
--- a/autobuild_mac80211_release/mt7986_mac80211/lede-branch-build-sanity.sh
+++ b/autobuild_mac80211_release/mt7986_mac80211/lede-branch-build-sanity.sh
@@ -16,9 +16,7 @@
 echo "CONFIG_NETFILTER_ADVANCED=y" >> ./target/linux/mediatek/mt7986/config-5.4
 echo "CONFIG_RELAY=y" >> ./target/linux/mediatek/mt7986/config-5.4
 
-#hack hostapd config
-echo "CONFIG_MBO=y" >> ./package/network/services/hostapd/files/hostapd-full.config
-echo "CONFIG_WPS_UPNP=y"  >> ./package/network/services/hostapd/files/hostapd-full.config
+prepare_flowoffload
 
 prepare_mac80211
 
@@ -26,5 +24,5 @@
 
 #step2 build
 if [ -z ${1} ]; then
-	build ${branch_name} -j1 || [ "$LOCAL" != "1" ]
+	build_log ${branch_name} -j1 || [ "$LOCAL" != "1" ]
 fi
diff --git a/autobuild_mac80211_release/package/kernel/mt76/src/firmware/mt7986_wo_0.bin b/autobuild_mac80211_release/package/kernel/mt76/src/firmware/mt7986_wo_0.bin
new file mode 100644
index 0000000..dcdca1d
--- /dev/null
+++ b/autobuild_mac80211_release/package/kernel/mt76/src/firmware/mt7986_wo_0.bin
Binary files differ
diff --git a/autobuild_mac80211_release/package/kernel/mt76/src/firmware/mt7986_wo_1.bin b/autobuild_mac80211_release/package/kernel/mt76/src/firmware/mt7986_wo_1.bin
new file mode 100644
index 0000000..3c2a458
--- /dev/null
+++ b/autobuild_mac80211_release/package/kernel/mt76/src/firmware/mt7986_wo_1.bin
Binary files differ