[rdkb][common][bsp][Refactor and sync wifi from openwrt]

[Description]
8719319c [MAC80211][hostapd][Fix wpa_supplicant configuration parsing error]
0ef5b371 [MAC80211][Rebase Patches][Fix WiFi6 build error]
4f47e260 [MAC80211][core][Fix kernel warning of cfg80211_bss_color_notify]
4b3f08e9 [MAC80211][Rebase Patches][Fix WiFi6 build error]
9d44e5de [MAC80211][mt76][Fix tlv length of mt7915_mcu_get_chan_mib_info]
b63d160d [MAC80211][misc][Remove duplicate group cipher setting in wpa_supplicant]
7a5de8c1 [MAC80211][mt76][Refactor txpower table dump and fix change channel not update]
a0e1acfa [MAC80211][app][Add atenl eeprom ibf cal sync command]
af3af140 [mac80211][mt76][Set station mode TXOP to 0]
9740ca99 [MAC80211][led][report tx and rx byte to tpt_led]
793674de [MAC80211][misc][Rebase hostapd patches]
25a39b5e [MAC80211][hostapd][Fix extender mode issues]
da19c3b2 [MAC80211][mt76][Add Eagle default bin for sku 404]
476c7e8d [MAC80211][mt76][Add mt7996_eeprom_dual_404.bin to mt76 makefile]
beeb6f42 [MT76][hostapd][add extension IE list for non-inherit IE]
5ef327e8 [MAC80211][Core][Enable RNR in 2.4G/5G by default]
10f3f90e [MAC80211][misc][Fix uci not set group cipher]
aa3efcbb [MAC80211][hostapd][Update MU EDCA Parameter update count]
d698fe08 [MAC80211][hnat][Add UL/DL HQoS support]
95f59a1a [MAC80211][misc][Add mediatek external reference release information]
e9c4b56d [mac80211][Rebase Patches][mt76 build fail]

[Release-log]

Change-Id: I2c9d4deafa9d865f40af64d75b9e56da74a88b11
diff --git a/recipes-wifi/hostapd/files/patches/mtk-0028-hostapd-mtk-Avoid-setting-beacon-after-wpa_supplican.patch b/recipes-wifi/hostapd/files/patches/mtk-0028-hostapd-mtk-Avoid-setting-beacon-after-wpa_supplican.patch
new file mode 100644
index 0000000..6abcc52
--- /dev/null
+++ b/recipes-wifi/hostapd/files/patches/mtk-0028-hostapd-mtk-Avoid-setting-beacon-after-wpa_supplican.patch
@@ -0,0 +1,165 @@
+From 203fe076218129d727229a0eb71b6f5fb4c6e8a9 Mon Sep 17 00:00:00 2001
+From: Michael Lee <michael-cy.lee@mediatek.com>
+Date: Fri, 28 Apr 2023 10:22:58 +0800
+Subject: [PATCH 28/35] hostapd: mtk: Avoid setting beacon after wpa_supplicant
+ stop the AP
+
+Add a new variable 'stopped_by_supplicant' to indicate the AP
+interface is currently stopped by co-locating STA interface.
+After the STA interface finishes association with some other APs, it
+will reload the co-locating AP interfaces and marks the
+'stopped_by_supplicant' as 0.
+---
+ hostapd/ctrl_iface.c   |  4 ++++
+ src/ap/beacon.c        |  5 ++++-
+ src/ap/bss_load.c      | 10 +++++++---
+ src/ap/ctrl_iface_ap.c |  4 +++-
+ src/ap/hostapd.c       |  4 +++-
+ src/ap/hostapd.h       |  1 +
+ 6 files changed, 22 insertions(+), 6 deletions(-)
+
+diff --git a/hostapd/ctrl_iface.c b/hostapd/ctrl_iface.c
+index 7f91cb6..8c48d8f 100644
+--- a/hostapd/ctrl_iface.c
++++ b/hostapd/ctrl_iface.c
+@@ -193,11 +193,15 @@ static int hostapd_ctrl_iface_update(struct hostapd_data *hapd, char *txt)
+ {
+ 	struct hostapd_config * (*config_read_cb)(const char *config_fname);
+ 	struct hostapd_iface *iface = hapd->iface;
++	size_t j;
+ 
+ 	config_read_cb = iface->interfaces->config_read_cb;
+ 	iface->interfaces->config_read_cb = hostapd_ctrl_iface_config_read;
+ 	reload_opts = txt;
+ 
++	for (j = 0; j < iface->num_bss; j++)
++		iface->bss[j]->stopped_by_supplicant = 0;
++
+ 	hostapd_reload_config(iface, 0);
+ 
+ 	iface->interfaces->config_read_cb = config_read_cb;
+diff --git a/src/ap/beacon.c b/src/ap/beacon.c
+index ad56046..c67d08b 100644
+--- a/src/ap/beacon.c
++++ b/src/ap/beacon.c
+@@ -2125,7 +2125,8 @@ int ieee802_11_set_beacon(struct hostapd_data *hapd)
+ 			continue;
+ 
+ 		for (i = 0; i < colocated->num_bss; i++) {
+-			if (colocated->bss[i] && colocated->bss[i]->started)
++			if (colocated->bss[i] && colocated->bss[i]->started &&
++			    !colocated->bss[i]->stopped_by_supplicant)
+ 				__ieee802_11_set_beacon(colocated->bss[i]);
+ 		}
+ 	}
+@@ -2141,6 +2142,7 @@ int ieee802_11_set_beacons(struct hostapd_iface *iface)
+ 
+ 	for (i = 0; i < iface->num_bss; i++) {
+ 		if (iface->bss[i]->started &&
++		    !iface->bss[i]->stopped_by_supplicant &&
+ 		    ieee802_11_set_beacon(iface->bss[i]) < 0)
+ 			ret = -1;
+ 	}
+@@ -2157,6 +2159,7 @@ int ieee802_11_update_beacons(struct hostapd_iface *iface)
+ 
+ 	for (i = 0; i < iface->num_bss; i++) {
+ 		if (iface->bss[i]->beacon_set_done && iface->bss[i]->started &&
++		    !iface->bss[i]->stopped_by_supplicant &&
+ 		    ieee802_11_set_beacon(iface->bss[i]) < 0)
+ 			ret = -1;
+ 	}
+diff --git a/src/ap/bss_load.c b/src/ap/bss_load.c
+index 725d3cd..78fd9d8 100644
+--- a/src/ap/bss_load.c
++++ b/src/ap/bss_load.c
+@@ -49,6 +49,9 @@ static void update_channel_utilization(void *eloop_data, void *user_data)
+ 	if (!(hapd->beacon_set_done && hapd->started))
+ 		return;
+ 
++	if(hapd->stopped_by_supplicant)
++		goto skip_update;
++
+ 	err = hostapd_drv_get_survey(hapd, hapd->iface->freq);
+ 	if (err) {
+ 		wpa_printf(MSG_ERROR, "BSS Load: Failed to get survey data");
+@@ -57,9 +60,6 @@ static void update_channel_utilization(void *eloop_data, void *user_data)
+ 
+ 	ieee802_11_set_beacon(hapd);
+ 
+-	if (get_bss_load_update_timeout(hapd, &sec, &usec) < 0)
+-		return;
+-
+ 	if (hapd->conf->chan_util_avg_period) {
+ 		iface->chan_util_samples_sum += iface->channel_utilization;
+ 		iface->chan_util_num_sample_periods +=
+@@ -75,6 +75,10 @@ static void update_channel_utilization(void *eloop_data, void *user_data)
+ 		}
+ 	}
+ 
++skip_update:
++	if (get_bss_load_update_timeout(hapd, &sec, &usec) < 0)
++		return;
++
+ 	eloop_register_timeout(sec, usec, update_channel_utilization, hapd,
+ 			       NULL);
+ }
+diff --git a/src/ap/ctrl_iface_ap.c b/src/ap/ctrl_iface_ap.c
+index 2fae590..1ad37c5 100644
+--- a/src/ap/ctrl_iface_ap.c
++++ b/src/ap/ctrl_iface_ap.c
+@@ -951,8 +951,10 @@ int hostapd_ctrl_iface_stop_ap(struct hostapd_data *hapd)
+ 	struct hostapd_iface *iface = hapd->iface;
+ 	int i;
+ 
+-	for (i = 0; i < iface->num_bss; i++)
++	for (i = 0; i < iface->num_bss; i++){
++		iface->bss[i]->stopped_by_supplicant = 1;
+ 		hostapd_drv_stop_ap(iface->bss[i]);
++	}
+ 
+ 	return 0;
+ }
+diff --git a/src/ap/hostapd.c b/src/ap/hostapd.c
+index ef0d6db..b372977 100644
+--- a/src/ap/hostapd.c
++++ b/src/ap/hostapd.c
+@@ -477,6 +477,7 @@ void hostapd_free_hapd_data(struct hostapd_data *hapd)
+ 	}
+ 	hapd->started = 0;
+ 	hapd->beacon_set_done = 0;
++	hapd->stopped_by_supplicant = 0;
+ 
+ 	wpa_printf(MSG_DEBUG, "%s(%s)", __func__, hapd->conf->iface);
+ 	hostapd_ubus_free_bss(hapd);
+@@ -1257,6 +1258,7 @@ static int hostapd_setup_bss(struct hostapd_data *hapd, int first,
+ 		return -1;
+ 	}
+ 	hapd->started = 1;
++	hapd->stopped_by_supplicant = 0;
+ 
+ 	if (!first || first == -1) {
+ 		u8 *addr = hapd->own_addr;
+@@ -4015,7 +4017,7 @@ void hostapd_switch_color(struct hostapd_data *hapd, u64 bitmap)
+ {
+ 	struct os_reltime now;
+ 
+-	if (hapd->cca_in_progress)
++	if (hapd->cca_in_progress || hapd->stopped_by_supplicant)
+ 		return;
+ 
+ 	if (os_get_reltime(&now))
+diff --git a/src/ap/hostapd.h b/src/ap/hostapd.h
+index 093c28a..3b51050 100644
+--- a/src/ap/hostapd.h
++++ b/src/ap/hostapd.h
+@@ -190,6 +190,7 @@ struct hostapd_data {
+ 	unsigned int started:1;
+ 	unsigned int disabled:1;
+ 	unsigned int reenable_beacon:1;
++	unsigned int stopped_by_supplicant:1;
+ 
+ 	u8 own_addr[ETH_ALEN];
+ 
+-- 
+2.18.0
+