[rdkb][common][bsp][Refactor and sync wifi from openwrt]
[Description]
28f61ae6 [MAC80211][wed][init all msdu_pg cnt to support kite]
78a4b72a [mac80211][wifi6][mt76][Disable HW amsdu when using fixed rate]
807a22eb [MAC80211][WiFi6][mt76][Add obss_interval config add with ht_coex]
593fe440 [[MAC80211][WiFi6][mt76][fix build fail of netifd and mt76]
b98e772b [MAC80211][wifi7][core][remove antenna_gain patch]
2972a3e1 [MAC80211][wifi7][hostapd][Bandwidth Synchronization in AP/STA Mode]
9b6e8826 [MAC80211][wifi7][hostapd][rebase internal hostapd patches based on AP/STA ucode reimplmentation]
d744b79d [MAC80211][WiFi6][mt76][Rebase patch to fix patch error]
c515ae02 [MAC80211][WiFi6][mt76][Add enable/disable Spatial Reuse through debugfs]
2f85da88 [MAC80211][wifi6][mt76][revert sta BMC entry changes]
b951ede7 [MAC80211][WiFi7][netifd][Add default on background radar and background cert mode for SQC]
19d775bb [mac80211][wifi6/7][netifd][fix disabling radio via config if reconf is being used]
1a93ff79 [mac80211][rebase patches][fix build fail]
5d344b22 [mac80211][wifi6][mt76][Update debugfs knob for token]
712d7c3c [MAC80211][hostapd][Avoid color switch when beacon is not set]
fdf67b0f [MAC80211][WiFi7][hostapd][Add the support for enable/disable AMSDU via mwctl]
e45abb8e [MAC80211][wifi6][mt76][Rebase][for upstream]
c7c60af7 [MAC80211][wifi6][mt76][sync some fixes]
34dd91c1 [MAC80211][WiFi7][core][Set MUEDCA AIFSn as 0 by default]
2d484b5b [MAC80211][hostapd][update op_class when AP channel switch]
92a260ee [MAC80211][wifi6][mt76][Check vif type before report cca and csa done]
dff81b67 [MAC80211][misc][Remove ipsec for mac80211 build]
0b2c5250 [MAC80211][wifi6][mt76][Add the mac80211 hw bmc ps buffer function.]
6f9e6b6a [MAC80211][misc][Rebase Patches][Fix patch fail issue]
b63830c1 [mac80211][wifi6][mt76][Remove per-bss counter in mt76]
b164bbc8 [mac80211][wifi6][mt76][fix debugfs for pleinfo and token_txd]
[Release-log]
Change-Id: I8e33ab1f14d32ae3395e40bbba263455fcbe9707
diff --git a/recipes-wifi/hostapd/files/patches-2.10.3/100-daemonize_fix.patch b/recipes-wifi/hostapd/files/patches-2.10.3/100-daemonize_fix.patch
deleted file mode 100644
index 687bd40..0000000
--- a/recipes-wifi/hostapd/files/patches-2.10.3/100-daemonize_fix.patch
+++ /dev/null
@@ -1,97 +0,0 @@
---- a/src/utils/os_unix.c
-+++ b/src/utils/os_unix.c
-@@ -10,6 +10,7 @@
-
- #include <time.h>
- #include <sys/wait.h>
-+#include <fcntl.h>
-
- #ifdef ANDROID
- #include <sys/capability.h>
-@@ -188,59 +189,46 @@ int os_gmtime(os_time_t t, struct os_tm
- return 0;
- }
-
--
--#ifdef __APPLE__
--#include <fcntl.h>
--static int os_daemon(int nochdir, int noclose)
-+int os_daemonize(const char *pid_file)
- {
-- int devnull;
-+ int pid = 0, i, devnull;
-
-- if (chdir("/") < 0)
-- return -1;
-+#if defined(__uClinux__) || defined(__sun__)
-+ return -1;
-+#else /* defined(__uClinux__) || defined(__sun__) */
-
-- devnull = open("/dev/null", O_RDWR);
-- if (devnull < 0)
-+#ifndef __APPLE__
-+ pid = fork();
-+ if (pid < 0)
- return -1;
-+#endif
-
-- if (dup2(devnull, STDIN_FILENO) < 0) {
-- close(devnull);
-- return -1;
-+ if (pid > 0) {
-+ if (pid_file) {
-+ FILE *f = fopen(pid_file, "w");
-+ if (f) {
-+ fprintf(f, "%u\n", pid);
-+ fclose(f);
-+ }
-+ }
-+ _exit(0);
- }
-
-- if (dup2(devnull, STDOUT_FILENO) < 0) {
-- close(devnull);
-+ if (setsid() < 0)
- return -1;
-- }
-
-- if (dup2(devnull, STDERR_FILENO) < 0) {
-- close(devnull);
-+ if (chdir("/") < 0)
- return -1;
-- }
--
-- return 0;
--}
--#else /* __APPLE__ */
--#define os_daemon daemon
--#endif /* __APPLE__ */
-
--
--int os_daemonize(const char *pid_file)
--{
--#if defined(__uClinux__) || defined(__sun__)
-- return -1;
--#else /* defined(__uClinux__) || defined(__sun__) */
-- if (os_daemon(0, 0)) {
-- perror("daemon");
-+ devnull = open("/dev/null", O_RDWR);
-+ if (devnull < 0)
- return -1;
-- }
-
-- if (pid_file) {
-- FILE *f = fopen(pid_file, "w");
-- if (f) {
-- fprintf(f, "%u\n", getpid());
-- fclose(f);
-- }
-- }
-+ for (i = 0; i <= STDERR_FILENO; i++)
-+ dup2(devnull, i);
-+
-+ if (devnull > 2)
-+ close(devnull);
-
- return -0;
- #endif /* defined(__uClinux__) || defined(__sun__) */
diff --git a/recipes-wifi/hostapd/files/patches-2.10.3/340-reload_freq_change.patch b/recipes-wifi/hostapd/files/patches-2.10.3/340-reload_freq_change.patch
deleted file mode 100644
index ae6cd81..0000000
--- a/recipes-wifi/hostapd/files/patches-2.10.3/340-reload_freq_change.patch
+++ /dev/null
@@ -1,80 +0,0 @@
---- a/src/ap/hostapd.c
-+++ b/src/ap/hostapd.c
-@@ -143,6 +143,29 @@ static void hostapd_reload_bss(struct ho
- #endif /* CONFIG_NO_RADIUS */
-
- ssid = &hapd->conf->ssid;
-+
-+ hostapd_set_freq(hapd, hapd->iconf->hw_mode, hapd->iface->freq,
-+ hapd->iconf->channel,
-+ hapd->iconf->enable_edmg,
-+ hapd->iconf->edmg_channel,
-+ hapd->iconf->ieee80211n,
-+ hapd->iconf->ieee80211ac,
-+ hapd->iconf->ieee80211ax,
-+ hapd->iconf->ieee80211be,
-+ hapd->iconf->secondary_channel,
-+ hostapd_get_oper_chwidth(hapd->iconf),
-+ hostapd_get_oper_centr_freq_seg0_idx(hapd->iconf),
-+ hostapd_get_oper_centr_freq_seg1_idx(hapd->iconf));
-+
-+ if (hapd->iface->current_mode) {
-+ if (hostapd_prepare_rates(hapd->iface, hapd->iface->current_mode)) {
-+ wpa_printf(MSG_ERROR, "Failed to prepare rates table.");
-+ hostapd_logger(hapd, NULL, HOSTAPD_MODULE_IEEE80211,
-+ HOSTAPD_LEVEL_WARNING,
-+ "Failed to prepare rates table.");
-+ }
-+ }
-+
- if (!ssid->wpa_psk_set && ssid->wpa_psk && !ssid->wpa_psk->next &&
- ssid->wpa_passphrase_set && ssid->wpa_passphrase) {
- /*
-@@ -251,6 +274,7 @@ int hostapd_reload_config(struct hostapd
- struct hostapd_data *hapd = iface->bss[0];
- struct hostapd_config *newconf, *oldconf;
- size_t j;
-+ int i;
-
- if (iface->config_fname == NULL) {
- /* Only in-memory config in use - assume it has been updated */
-@@ -301,6 +325,17 @@ int hostapd_reload_config(struct hostapd
- }
- iface->conf = newconf;
-
-+ for (i = 0; i < iface->num_hw_features; i++) {
-+ struct hostapd_hw_modes *mode = &iface->hw_features[i];
-+ if (mode->mode == iface->conf->hw_mode) {
-+ iface->current_mode = mode;
-+ break;
-+ }
-+ }
-+
-+ if (iface->conf->channel)
-+ iface->freq = hostapd_hw_get_freq(hapd, iface->conf->channel);
-+
- for (j = 0; j < iface->num_bss; j++) {
- hapd = iface->bss[j];
- if (!hapd->conf->config_id || !newconf->bss[j]->config_id ||
-@@ -308,21 +343,6 @@ int hostapd_reload_config(struct hostapd
- newconf->bss[j]->config_id) != 0)
- hostapd_clear_old_bss(hapd);
- hapd->iconf = newconf;
-- hapd->iconf->channel = oldconf->channel;
-- hapd->iconf->acs = oldconf->acs;
-- hapd->iconf->secondary_channel = oldconf->secondary_channel;
-- hapd->iconf->ieee80211n = oldconf->ieee80211n;
-- hapd->iconf->ieee80211ac = oldconf->ieee80211ac;
-- hapd->iconf->ht_capab = oldconf->ht_capab;
-- hapd->iconf->vht_capab = oldconf->vht_capab;
-- hostapd_set_oper_chwidth(hapd->iconf,
-- hostapd_get_oper_chwidth(oldconf));
-- hostapd_set_oper_centr_freq_seg0_idx(
-- hapd->iconf,
-- hostapd_get_oper_centr_freq_seg0_idx(oldconf));
-- hostapd_set_oper_centr_freq_seg1_idx(
-- hapd->iconf,
-- hostapd_get_oper_centr_freq_seg1_idx(oldconf));
- hapd->conf = newconf->bss[j];
- hostapd_reload_bss(hapd);
- }
diff --git a/recipes-wifi/hostapd/files/patches-2.10.3/360-ctrl_iface_reload.patch b/recipes-wifi/hostapd/files/patches-2.10.3/360-ctrl_iface_reload.patch
deleted file mode 100644
index 4d85ea1..0000000
--- a/recipes-wifi/hostapd/files/patches-2.10.3/360-ctrl_iface_reload.patch
+++ /dev/null
@@ -1,106 +0,0 @@
---- a/hostapd/ctrl_iface.c
-+++ b/hostapd/ctrl_iface.c
-@@ -68,6 +68,7 @@
- #include "fst/fst_ctrl_iface.h"
- #include "config_file.h"
- #include "ctrl_iface.h"
-+#include "config_file.h"
-
-
- #define HOSTAPD_CLI_DUP_VALUE_MAX_LEN 256
-@@ -83,6 +84,7 @@ static void hostapd_ctrl_iface_send(stru
- enum wpa_msg_type type,
- const char *buf, size_t len);
-
-+static char *reload_opts = NULL;
-
- static int hostapd_ctrl_iface_attach(struct hostapd_data *hapd,
- struct sockaddr_storage *from,
-@@ -134,6 +136,61 @@ static int hostapd_ctrl_iface_new_sta(st
- return 0;
- }
-
-+static char *get_option(char *opt, char *str)
-+{
-+ int len = strlen(str);
-+
-+ if (!strncmp(opt, str, len))
-+ return opt + len;
-+ else
-+ return NULL;
-+}
-+
-+static struct hostapd_config *hostapd_ctrl_iface_config_read(const char *fname)
-+{
-+ struct hostapd_config *conf;
-+ char *opt, *val;
-+
-+ conf = hostapd_config_read(fname);
-+ if (!conf)
-+ return NULL;
-+
-+ for (opt = strtok(reload_opts, " ");
-+ opt;
-+ opt = strtok(NULL, " ")) {
-+
-+ if ((val = get_option(opt, "channel=")))
-+ conf->channel = atoi(val);
-+ else if ((val = get_option(opt, "ht_capab=")))
-+ conf->ht_capab = atoi(val);
-+ else if ((val = get_option(opt, "ht_capab_mask=")))
-+ conf->ht_capab &= atoi(val);
-+ else if ((val = get_option(opt, "sec_chan=")))
-+ conf->secondary_channel = atoi(val);
-+ else if ((val = get_option(opt, "hw_mode=")))
-+ conf->hw_mode = atoi(val);
-+ else if ((val = get_option(opt, "ieee80211n=")))
-+ conf->ieee80211n = atoi(val);
-+ else
-+ break;
-+ }
-+
-+ return conf;
-+}
-+
-+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;
-+
-+ config_read_cb = iface->interfaces->config_read_cb;
-+ iface->interfaces->config_read_cb = hostapd_ctrl_iface_config_read;
-+ reload_opts = txt;
-+
-+ hostapd_reload_config(iface);
-+
-+ iface->interfaces->config_read_cb = config_read_cb;
-+}
-
- #ifdef NEED_AP_MLME
- static int hostapd_ctrl_iface_sa_query(struct hostapd_data *hapd,
-@@ -3564,6 +3621,8 @@ static int hostapd_ctrl_iface_receive_pr
- } else if (os_strncmp(buf, "VENDOR ", 7) == 0) {
- reply_len = hostapd_ctrl_iface_vendor(hapd, buf + 7, reply,
- reply_size);
-+ } else if (os_strncmp(buf, "UPDATE ", 7) == 0) {
-+ hostapd_ctrl_iface_update(hapd, buf + 7);
- } else if (os_strcmp(buf, "ERP_FLUSH") == 0) {
- ieee802_1x_erp_flush(hapd);
- #ifdef RADIUS_SERVER
---- a/src/ap/ctrl_iface_ap.c
-+++ b/src/ap/ctrl_iface_ap.c
-@@ -1023,7 +1023,13 @@ int hostapd_parse_csa_settings(const cha
-
- int hostapd_ctrl_iface_stop_ap(struct hostapd_data *hapd)
- {
-- return hostapd_drv_stop_ap(hapd);
-+ struct hostapd_iface *iface = hapd->iface;
-+ int i;
-+
-+ for (i = 0; i < iface->num_bss; i++)
-+ hostapd_drv_stop_ap(iface->bss[i]);
-+
-+ return 0;
- }
-
-
diff --git a/recipes-wifi/hostapd/files/patches-2.10.3/370-ap_sta_support.patch b/recipes-wifi/hostapd/files/patches-2.10.3/370-ap_sta_support.patch
deleted file mode 100644
index 3baad2a..0000000
--- a/recipes-wifi/hostapd/files/patches-2.10.3/370-ap_sta_support.patch
+++ /dev/null
@@ -1,392 +0,0 @@
---- a/wpa_supplicant/Makefile
-+++ b/wpa_supplicant/Makefile
-@@ -126,6 +126,8 @@ OBJS_c += ../src/utils/common.o
- OBJS_c += ../src/common/cli.o
- OBJS += wmm_ac.o
-
-+OBJS += ../src/common/wpa_ctrl.o
-+
- ifndef CONFIG_OS
- ifdef CONFIG_NATIVE_WINDOWS
- CONFIG_OS=win32
---- a/wpa_supplicant/bss.c
-+++ b/wpa_supplicant/bss.c
-@@ -11,6 +11,7 @@
- #include "utils/common.h"
- #include "utils/eloop.h"
- #include "common/ieee802_11_defs.h"
-+#include "common/ieee802_11_common.h"
- #include "drivers/driver.h"
- #include "eap_peer/eap.h"
- #include "wpa_supplicant_i.h"
-@@ -283,6 +284,10 @@ void calculate_update_time(const struct
- static void wpa_bss_copy_res(struct wpa_bss *dst, struct wpa_scan_res *src,
- struct os_reltime *fetch_time)
- {
-+ struct ieee80211_ht_capabilities *capab;
-+ struct ieee80211_ht_operation *oper;
-+ struct ieee802_11_elems elems;
-+
- dst->flags = src->flags;
- os_memcpy(dst->bssid, src->bssid, ETH_ALEN);
- dst->freq = src->freq;
-@@ -296,6 +301,15 @@ static void wpa_bss_copy_res(struct wpa_
- dst->est_throughput = src->est_throughput;
- dst->snr = src->snr;
-
-+ memset(&elems, 0, sizeof(elems));
-+ ieee802_11_parse_elems((u8 *) (src + 1), src->ie_len, &elems, 0);
-+ capab = (struct ieee80211_ht_capabilities *) elems.ht_capabilities;
-+ oper = (struct ieee80211_ht_operation *) elems.ht_operation;
-+ if (capab)
-+ dst->ht_capab = le_to_host16(capab->ht_capabilities_info);
-+ if (oper)
-+ dst->ht_param = oper->ht_param;
-+
- calculate_update_time(fetch_time, src->age, &dst->last_update);
- }
-
---- a/wpa_supplicant/bss.h
-+++ b/wpa_supplicant/bss.h
-@@ -94,6 +94,10 @@ struct wpa_bss {
- u8 ssid[SSID_MAX_LEN];
- /** Length of SSID */
- size_t ssid_len;
-+ /** HT capabilities */
-+ u16 ht_capab;
-+ /* Five octets of HT Operation Information */
-+ u8 ht_param;
- /** Frequency of the channel in MHz (e.g., 2412 = channel 1) */
- int freq;
- /** Beacon interval in TUs (host byte order) */
---- a/wpa_supplicant/main.c
-+++ b/wpa_supplicant/main.c
-@@ -35,7 +35,7 @@ static void usage(void)
- "vW] [-P<pid file>] "
- "[-g<global ctrl>] \\\n"
- " [-G<group>] \\\n"
-- " -i<ifname> -c<config file> [-C<ctrl>] [-D<driver>] "
-+ " -i<ifname> -c<config file> [-C<ctrl>] [-D<driver>] [-H<hostapd path>] "
- "[-p<driver_param>] \\\n"
- " [-b<br_ifname>] [-e<entropy file>]"
- #ifdef CONFIG_DEBUG_FILE
-@@ -75,6 +75,7 @@ static void usage(void)
- " -g = global ctrl_interface\n"
- " -G = global ctrl_interface group\n"
- " -h = show this help text\n"
-+ " -H = connect to a hostapd instance to manage state changes\n"
- " -i = interface name\n"
- " -I = additional configuration file\n"
- " -K = include keys (passwords, etc.) in debug output\n"
-@@ -202,7 +203,7 @@ int main(int argc, char *argv[])
-
- for (;;) {
- c = getopt(argc, argv,
-- "b:Bc:C:D:de:f:g:G:hi:I:KLMm:No:O:p:P:qsTtuvW");
-+ "b:Bc:C:D:de:f:g:G:hH:i:I:KLMm:No:O:p:P:qsTtuvW");
- if (c < 0)
- break;
- switch (c) {
-@@ -249,6 +250,9 @@ int main(int argc, char *argv[])
- usage();
- exitcode = 0;
- goto out;
-+ case 'H':
-+ iface->hostapd_ctrl = optarg;
-+ break;
- case 'i':
- iface->ifname = optarg;
- break;
---- a/wpa_supplicant/wpa_supplicant.c
-+++ b/wpa_supplicant/wpa_supplicant.c
-@@ -131,6 +131,54 @@ static void wpas_update_fils_connect_par
- static void wpas_update_owe_connect_params(struct wpa_supplicant *wpa_s);
- #endif /* CONFIG_OWE */
-
-+static int hostapd_stop(struct wpa_supplicant *wpa_s)
-+{
-+ const char *cmd = "STOP_AP";
-+ char buf[256];
-+ size_t len = sizeof(buf);
-+
-+ if (wpa_ctrl_request(wpa_s->hostapd, cmd, os_strlen(cmd), buf, &len, NULL) < 0) {
-+ wpa_printf(MSG_ERROR, "\nFailed to stop hostapd AP interfaces\n");
-+ return -1;
-+ }
-+ return 0;
-+}
-+
-+static int hostapd_reload(struct wpa_supplicant *wpa_s, struct wpa_bss *bss)
-+{
-+ char *cmd = NULL;
-+ char buf[256];
-+ size_t len = sizeof(buf);
-+ enum hostapd_hw_mode hw_mode;
-+ u8 channel;
-+ int sec_chan = 0;
-+ int ret;
-+
-+ if (!bss)
-+ return -1;
-+
-+ if (bss->ht_param & HT_INFO_HT_PARAM_STA_CHNL_WIDTH) {
-+ int sec = bss->ht_param & HT_INFO_HT_PARAM_SECONDARY_CHNL_OFF_MASK;
-+ if (sec == HT_INFO_HT_PARAM_SECONDARY_CHNL_ABOVE)
-+ sec_chan = 1;
-+ else if (sec == HT_INFO_HT_PARAM_SECONDARY_CHNL_BELOW)
-+ sec_chan = -1;
-+ }
-+
-+ hw_mode = ieee80211_freq_to_chan(bss->freq, &channel);
-+ if (asprintf(&cmd, "UPDATE channel=%d sec_chan=%d hw_mode=%d",
-+ channel, sec_chan, hw_mode) < 0)
-+ return -1;
-+
-+ ret = wpa_ctrl_request(wpa_s->hostapd, cmd, os_strlen(cmd), buf, &len, NULL);
-+ free(cmd);
-+
-+ if (ret < 0) {
-+ wpa_printf(MSG_ERROR, "\nFailed to reload hostapd AP interfaces\n");
-+ return -1;
-+ }
-+ return 0;
-+}
-
- #ifdef CONFIG_WEP
- /* Configure default/group WEP keys for static WEP */
-@@ -1026,6 +1074,8 @@ void wpa_supplicant_set_state(struct wpa
-
- sme_sched_obss_scan(wpa_s, 1);
-
-+ if (wpa_s->hostapd)
-+ hostapd_reload(wpa_s, wpa_s->current_bss);
- #if defined(CONFIG_FILS) && defined(IEEE8021X_EAPOL)
- if (!fils_hlp_sent && ssid && ssid->eap.erp)
- update_fils_connect_params = true;
-@@ -1036,6 +1086,8 @@ void wpa_supplicant_set_state(struct wpa
- #endif /* CONFIG_OWE */
- } else if (state == WPA_DISCONNECTED || state == WPA_ASSOCIATING ||
- state == WPA_ASSOCIATED) {
-+ if (wpa_s->hostapd)
-+ hostapd_stop(wpa_s);
- wpa_s->new_connection = 1;
- wpa_drv_set_operstate(wpa_s, 0);
- #ifndef IEEE8021X_EAPOL
-@@ -2537,6 +2589,8 @@ void wpa_supplicant_associate(struct wpa
- return;
- }
- wpa_s->current_bss = bss;
-+ if (wpa_s->hostapd)
-+ hostapd_reload(wpa_s, wpa_s->current_bss);
- #else /* CONFIG_MESH */
- wpa_msg(wpa_s, MSG_ERROR,
- "mesh mode support not included in the build");
-@@ -7037,6 +7091,16 @@ static int wpa_supplicant_init_iface(str
- sizeof(wpa_s->bridge_ifname));
- }
-
-+ if (iface->hostapd_ctrl) {
-+ wpa_s->hostapd = wpa_ctrl_open(iface->hostapd_ctrl);
-+ if (!wpa_s->hostapd) {
-+ wpa_printf(MSG_ERROR, "\nFailed to connect to hostapd\n");
-+ return -1;
-+ }
-+ if (hostapd_stop(wpa_s) < 0)
-+ return -1;
-+ }
-+
- /* RSNA Supplicant Key Management - INITIALIZE */
- eapol_sm_notify_portEnabled(wpa_s->eapol, false);
- eapol_sm_notify_portValid(wpa_s->eapol, false);
-@@ -7379,6 +7443,11 @@ static void wpa_supplicant_deinit_iface(
- if (terminate)
- wpa_msg(wpa_s, MSG_INFO, WPA_EVENT_TERMINATING);
-
-+ if (wpa_s->hostapd) {
-+ wpa_ctrl_close(wpa_s->hostapd);
-+ wpa_s->hostapd = NULL;
-+ }
-+
- wpa_supplicant_ctrl_iface_deinit(wpa_s, wpa_s->ctrl_iface);
- wpa_s->ctrl_iface = NULL;
-
---- a/wpa_supplicant/wpa_supplicant_i.h
-+++ b/wpa_supplicant/wpa_supplicant_i.h
-@@ -106,6 +106,11 @@ struct wpa_interface {
- const char *ifname;
-
- /**
-+ * hostapd_ctrl - path to hostapd control socket for notification
-+ */
-+ const char *hostapd_ctrl;
-+
-+ /**
- * bridge_ifname - Optional bridge interface name
- *
- * If the driver interface (ifname) is included in a Linux bridge
-@@ -665,6 +670,8 @@ struct wpa_supplicant {
- #endif /* CONFIG_CTRL_IFACE_BINDER */
- char bridge_ifname[16];
-
-+ struct wpa_ctrl *hostapd;
-+
- char *confname;
- char *confanother;
-
---- a/hostapd/ctrl_iface.c
-+++ b/hostapd/ctrl_iface.c
-@@ -2751,6 +2751,12 @@ static int hostapd_ctrl_iface_chan_switc
- return 0;
- }
-
-+ if (os_strstr(pos, " auto-ht")) {
-+ settings.freq_params.ht_enabled = iface->conf->ieee80211n;
-+ settings.freq_params.vht_enabled = iface->conf->ieee80211ac;
-+ settings.freq_params.he_enabled = iface->conf->ieee80211ax;
-+ }
-+
- for (i = 0; i < iface->num_bss; i++) {
-
- /* Save CHAN_SWITCH VHT, HE, and EHT config */
---- a/src/ap/beacon.c
-+++ b/src/ap/beacon.c
-@@ -2108,11 +2108,6 @@ static int __ieee802_11_set_beacon(struc
- return -1;
- }
-
-- if (hapd->csa_in_progress) {
-- wpa_printf(MSG_ERROR, "Cannot set beacons during CSA period");
-- return -1;
-- }
--
- hapd->beacon_set_done = 1;
-
- if (ieee802_11_build_ap_params(hapd, ¶ms) < 0)
---- a/wpa_supplicant/events.c
-+++ b/wpa_supplicant/events.c
-@@ -5345,6 +5345,60 @@ static void wpas_link_reconfig(struct wp
- }
-
-
-+static void
-+supplicant_ch_switch_started(struct wpa_supplicant *wpa_s,
-+ union wpa_event_data *data)
-+{
-+ char buf[256];
-+ size_t len = sizeof(buf);
-+ char *cmd = NULL;
-+ int width = 20;
-+ int ret;
-+
-+ if (!wpa_s->hostapd)
-+ return;
-+
-+ wpa_msg(wpa_s, MSG_INFO, WPA_EVENT_CHANNEL_SWITCH
-+ "count=%d freq=%d ht_enabled=%d ch_offset=%d ch_width=%s cf1=%d cf2=%d",
-+ data->ch_switch.count,
-+ data->ch_switch.freq,
-+ data->ch_switch.ht_enabled,
-+ data->ch_switch.ch_offset,
-+ channel_width_to_string(data->ch_switch.ch_width),
-+ data->ch_switch.cf1,
-+ data->ch_switch.cf2);
-+
-+ switch (data->ch_switch.ch_width) {
-+ case CHAN_WIDTH_20_NOHT:
-+ case CHAN_WIDTH_20:
-+ width = 20;
-+ break;
-+ case CHAN_WIDTH_40:
-+ width = 40;
-+ break;
-+ case CHAN_WIDTH_80:
-+ width = 80;
-+ break;
-+ case CHAN_WIDTH_160:
-+ case CHAN_WIDTH_80P80:
-+ width = 160;
-+ break;
-+ }
-+
-+ asprintf(&cmd, "CHAN_SWITCH %d %d sec_channel_offset=%d center_freq1=%d center_freq2=%d, bandwidth=%d auto-ht\n",
-+ data->ch_switch.count - 1,
-+ data->ch_switch.freq,
-+ data->ch_switch.ch_offset,
-+ data->ch_switch.cf1,
-+ data->ch_switch.cf2,
-+ width);
-+ ret = wpa_ctrl_request(wpa_s->hostapd, cmd, os_strlen(cmd), buf, &len, NULL);
-+ free(cmd);
-+
-+ if (ret < 0)
-+ wpa_printf(MSG_ERROR, "\nFailed to reload hostapd AP interfaces\n");
-+}
-+
- void supplicant_event(void *ctx, enum wpa_event_type event,
- union wpa_event_data *data)
- {
-@@ -5697,8 +5751,10 @@ void supplicant_event(void *ctx, enum wp
- channel_width_to_string(data->ch_switch.ch_width),
- data->ch_switch.cf1,
- data->ch_switch.cf2);
-- if (event == EVENT_CH_SWITCH_STARTED)
-+ if (event == EVENT_CH_SWITCH_STARTED) {
-+ supplicant_ch_switch_started(wpa_s, data);
- break;
-+ }
-
- wpa_s->assoc_freq = data->ch_switch.freq;
- wpa_s->current_ssid->frequency = data->ch_switch.freq;
---- a/src/drivers/driver.h
-+++ b/src/drivers/driver.h
-@@ -6421,6 +6421,7 @@ union wpa_event_data {
-
- /**
- * struct ch_switch
-+ * @count: Count until channel switch activates
- * @freq: Frequency of new channel in MHz
- * @ht_enabled: Whether this is an HT channel
- * @ch_offset: Secondary channel offset
-@@ -6431,6 +6432,7 @@ union wpa_event_data {
- * @punct_bitmap: Puncturing bitmap
- */
- struct ch_switch {
-+ int count;
- int freq;
- int ht_enabled;
- int ch_offset;
---- a/src/drivers/driver_nl80211_event.c
-+++ b/src/drivers/driver_nl80211_event.c
-@@ -1202,6 +1202,7 @@ static void mlme_event_ch_switch(struct
- struct nlattr *bw, struct nlattr *cf1,
- struct nlattr *cf2,
- struct nlattr *punct_bitmap,
-+ struct nlattr *count,
- int finished)
- {
- struct i802_bss *bss;
-@@ -1265,6 +1266,8 @@ static void mlme_event_ch_switch(struct
- data.ch_switch.cf1 = nla_get_u32(cf1);
- if (cf2)
- data.ch_switch.cf2 = nla_get_u32(cf2);
-+ if (count)
-+ data.ch_switch.count = nla_get_u32(count);
-
- if (finished)
- bss->flink->freq = data.ch_switch.freq;
-@@ -3848,6 +3851,7 @@ static void do_process_drv_event(struct
- tb[NL80211_ATTR_CENTER_FREQ1],
- tb[NL80211_ATTR_CENTER_FREQ2],
- tb[NL80211_ATTR_PUNCT_BITMAP],
-+ tb[NL80211_ATTR_CH_SWITCH_COUNT],
- 0);
- break;
- case NL80211_CMD_CH_SWITCH_NOTIFY:
-@@ -3860,6 +3864,7 @@ static void do_process_drv_event(struct
- tb[NL80211_ATTR_CENTER_FREQ1],
- tb[NL80211_ATTR_CENTER_FREQ2],
- tb[NL80211_ATTR_PUNCT_BITMAP],
-+ NULL,
- 1);
- break;
- case NL80211_CMD_DISCONNECT:
diff --git a/recipes-wifi/hostapd/files/patches-2.10.3/380-disable_ctrl_iface_mib.patch b/recipes-wifi/hostapd/files/patches-2.10.3/380-disable_ctrl_iface_mib.patch
index 456599d..54a736f 100644
--- a/recipes-wifi/hostapd/files/patches-2.10.3/380-disable_ctrl_iface_mib.patch
+++ b/recipes-wifi/hostapd/files/patches-2.10.3/380-disable_ctrl_iface_mib.patch
@@ -12,7 +12,7 @@
else
--- a/hostapd/ctrl_iface.c
+++ b/hostapd/ctrl_iface.c
-@@ -3377,6 +3377,7 @@ static int hostapd_ctrl_iface_receive_pr
+@@ -3314,6 +3314,7 @@ static int hostapd_ctrl_iface_receive_pr
reply_size);
} else if (os_strcmp(buf, "STATUS-DRIVER") == 0) {
reply_len = hostapd_drv_status(hapd, reply, reply_size);
@@ -20,7 +20,7 @@
} else if (os_strcmp(buf, "MIB") == 0) {
reply_len = ieee802_11_get_mib(hapd, reply, reply_size);
if (reply_len >= 0) {
-@@ -3418,6 +3419,7 @@ static int hostapd_ctrl_iface_receive_pr
+@@ -3355,6 +3356,7 @@ static int hostapd_ctrl_iface_receive_pr
} else if (os_strncmp(buf, "STA-NEXT ", 9) == 0) {
reply_len = hostapd_ctrl_iface_sta_next(hapd, buf + 9, reply,
reply_size);
@@ -30,7 +30,7 @@
reply_len = -1;
--- a/wpa_supplicant/Makefile
+++ b/wpa_supplicant/Makefile
-@@ -985,6 +985,9 @@ ifdef CONFIG_FILS
+@@ -983,6 +983,9 @@ ifdef CONFIG_FILS
OBJS += ../src/ap/fils_hlp.o
endif
ifdef CONFIG_CTRL_IFACE
diff --git a/recipes-wifi/hostapd/files/patches-2.10.3/420-indicate-features.patch b/recipes-wifi/hostapd/files/patches-2.10.3/420-indicate-features.patch
index 786b83d..3b28b6e 100644
--- a/recipes-wifi/hostapd/files/patches-2.10.3/420-indicate-features.patch
+++ b/recipes-wifi/hostapd/files/patches-2.10.3/420-indicate-features.patch
@@ -37,16 +37,16 @@
#include "crypto/crypto.h"
#include "fst/fst.h"
#include "wpa_supplicant_i.h"
-@@ -203,7 +204,7 @@ int main(int argc, char *argv[])
+@@ -202,7 +203,7 @@ int main(int argc, char *argv[])
for (;;) {
c = getopt(argc, argv,
-- "b:Bc:C:D:de:f:g:G:hH:i:I:KLMm:No:O:p:P:qsTtuvW");
-+ "b:Bc:C:D:de:f:g:G:hH:i:I:KLMm:No:O:p:P:qsTtuv::W");
+- "b:Bc:C:D:de:f:g:G:hi:I:KLMm:No:O:p:P:qsTtuvW");
++ "b:Bc:C:D:de:f:g:G:hi:I:KLMm:No:O:p:P:qsTtuv::W");
if (c < 0)
break;
switch (c) {
-@@ -306,8 +307,12 @@ int main(int argc, char *argv[])
+@@ -302,8 +303,12 @@ int main(int argc, char *argv[])
break;
#endif /* CONFIG_CTRL_IFACE_DBUS_NEW */
case 'v':
diff --git a/recipes-wifi/hostapd/files/patches-2.10.3/450-scan_wait.patch b/recipes-wifi/hostapd/files/patches-2.10.3/450-scan_wait.patch
deleted file mode 100644
index 4588689..0000000
--- a/recipes-wifi/hostapd/files/patches-2.10.3/450-scan_wait.patch
+++ /dev/null
@@ -1,73 +0,0 @@
---- a/hostapd/main.c
-+++ b/hostapd/main.c
-@@ -39,6 +39,8 @@ struct hapd_global {
- };
-
- static struct hapd_global global;
-+static int daemonize = 0;
-+static char *pid_file = NULL;
-
-
- #ifndef CONFIG_NO_HOSTAPD_LOGGER
-@@ -146,6 +148,14 @@ static void hostapd_logger_cb(void *ctx,
- }
- #endif /* CONFIG_NO_HOSTAPD_LOGGER */
-
-+static void hostapd_setup_complete_cb(void *ctx)
-+{
-+ if (daemonize && os_daemonize(pid_file)) {
-+ perror("daemon");
-+ return;
-+ }
-+ daemonize = 0;
-+}
-
- /**
- * hostapd_driver_init - Preparate driver interface
-@@ -217,6 +227,8 @@ static int hostapd_driver_init(struct ho
- }
- #endif /* CONFIG_IEEE80211BE */
-
-+ hapd->setup_complete_cb = hostapd_setup_complete_cb;
-+
- /* Initialize the driver interface */
- if (!(b[0] | b[1] | b[2] | b[3] | b[4] | b[5]))
- b = NULL;
-@@ -497,8 +509,6 @@ static void hostapd_global_deinit(const
- #endif /* CONFIG_NATIVE_WINDOWS */
-
- eap_server_unregister_methods();
--
-- os_daemonize_terminate(pid_file);
- }
-
-
-@@ -524,18 +534,6 @@ static int hostapd_global_run(struct hap
- }
- #endif /* EAP_SERVER_TNC */
-
-- if (daemonize) {
-- if (os_daemonize(pid_file)) {
-- wpa_printf(MSG_ERROR, "daemon: %s", strerror(errno));
-- return -1;
-- }
-- if (eloop_sock_requeue()) {
-- wpa_printf(MSG_ERROR, "eloop_sock_requeue: %s",
-- strerror(errno));
-- return -1;
-- }
-- }
--
- eloop_run();
-
- return 0;
-@@ -739,8 +737,7 @@ int main(int argc, char *argv[])
- struct hapd_interfaces interfaces;
- int ret = 1;
- size_t i, j;
-- int c, debug = 0, daemonize = 0;
-- char *pid_file = NULL;
-+ int c, debug = 0;
- const char *log_file = NULL;
- const char *entropy_file = NULL;
- char **bss_config = NULL, **tmp_bss;
diff --git a/recipes-wifi/hostapd/files/patches-2.10.3/460-wpa_supplicant-add-new-config-params-to-be-used-with.patch b/recipes-wifi/hostapd/files/patches-2.10.3/460-wpa_supplicant-add-new-config-params-to-be-used-with.patch
index 4c72868..e50c609 100644
--- a/recipes-wifi/hostapd/files/patches-2.10.3/460-wpa_supplicant-add-new-config-params-to-be-used-with.patch
+++ b/recipes-wifi/hostapd/files/patches-2.10.3/460-wpa_supplicant-add-new-config-params-to-be-used-with.patch
@@ -174,7 +174,7 @@
* macsec_policy - Determines the policy for MACsec secure session
--- a/wpa_supplicant/wpa_supplicant.c
+++ b/wpa_supplicant/wpa_supplicant.c
-@@ -4203,6 +4203,12 @@ static void wpas_start_assoc_cb(struct w
+@@ -4149,6 +4149,12 @@ static void wpas_start_assoc_cb(struct w
params.beacon_int = ssid->beacon_int;
else
params.beacon_int = wpa_s->conf->beacon_int;
diff --git a/recipes-wifi/hostapd/files/patches-2.10.3/464-fix-mesh-obss-check.patch b/recipes-wifi/hostapd/files/patches-2.10.3/464-fix-mesh-obss-check.patch
index c7e8cf2..4d7d85f 100644
--- a/recipes-wifi/hostapd/files/patches-2.10.3/464-fix-mesh-obss-check.patch
+++ b/recipes-wifi/hostapd/files/patches-2.10.3/464-fix-mesh-obss-check.patch
@@ -1,6 +1,6 @@
--- a/wpa_supplicant/wpa_supplicant.c
+++ b/wpa_supplicant/wpa_supplicant.c
-@@ -3094,6 +3094,10 @@ void ibss_mesh_setup_freq(struct wpa_sup
+@@ -3040,6 +3040,10 @@ void ibss_mesh_setup_freq(struct wpa_sup
freq->freq = ssid->frequency;
diff --git a/recipes-wifi/hostapd/files/patches-2.10.3/500-lto-jobserver-support.patch b/recipes-wifi/hostapd/files/patches-2.10.3/500-lto-jobserver-support.patch
index 046da42..67312c5 100644
--- a/recipes-wifi/hostapd/files/patches-2.10.3/500-lto-jobserver-support.patch
+++ b/recipes-wifi/hostapd/files/patches-2.10.3/500-lto-jobserver-support.patch
@@ -20,7 +20,7 @@
NOBJS = nt_password_hash.o ../src/crypto/ms_funcs.o $(SHA1OBJS)
--- a/wpa_supplicant/Makefile
+++ b/wpa_supplicant/Makefile
-@@ -2039,31 +2039,31 @@ wpa_supplicant_multi.a: .config $(BCHECK
+@@ -2037,31 +2037,31 @@ wpa_supplicant_multi.a: .config $(BCHECK
@$(AR) cr $@ wpa_supplicant_multi.o $(OBJS)
wpa_supplicant: $(BCHECK) $(OBJS) $(EXTRA_progs)
diff --git a/recipes-wifi/hostapd/files/patches-2.10.3/600-ubus_support.patch b/recipes-wifi/hostapd/files/patches-2.10.3/600-ubus_support.patch
index f420c18..5b2745a 100644
--- a/recipes-wifi/hostapd/files/patches-2.10.3/600-ubus_support.patch
+++ b/recipes-wifi/hostapd/files/patches-2.10.3/600-ubus_support.patch
@@ -41,7 +41,7 @@
struct hostapd_iface * hostapd_alloc_iface(void);
--- a/src/ap/hostapd.c
+++ b/src/ap/hostapd.c
-@@ -455,6 +455,7 @@ void hostapd_free_hapd_data(struct hosta
+@@ -435,6 +435,7 @@ void hostapd_free_hapd_data(struct hosta
hapd->beacon_set_done = 0;
wpa_printf(MSG_DEBUG, "%s(%s)", __func__, hapd->conf->iface);
@@ -49,7 +49,7 @@
accounting_deinit(hapd);
hostapd_deinit_wpa(hapd);
vlan_deinit(hapd);
-@@ -1207,6 +1208,8 @@ static int hostapd_start_beacon(struct h
+@@ -1187,6 +1188,8 @@ static int hostapd_start_beacon(struct h
if (hapd->driver && hapd->driver->set_operstate)
hapd->driver->set_operstate(hapd->drv_priv, 1);
@@ -58,7 +58,7 @@
return 0;
}
-@@ -2295,6 +2298,7 @@ static int hostapd_setup_interface_compl
+@@ -2275,6 +2278,7 @@ static int hostapd_setup_interface_compl
if (err)
goto fail;
@@ -66,7 +66,7 @@
wpa_printf(MSG_DEBUG, "Completing interface initialization");
if (iface->freq) {
#ifdef NEED_AP_MLME
-@@ -2514,6 +2518,7 @@ dfs_offload:
+@@ -2494,6 +2498,7 @@ dfs_offload:
fail:
wpa_printf(MSG_ERROR, "Interface initialization failed");
@@ -74,7 +74,7 @@
if (iface->is_no_ir) {
hostapd_set_state(iface, HAPD_IFACE_NO_IR);
-@@ -3004,6 +3009,7 @@ void hostapd_interface_deinit_free(struc
+@@ -2984,6 +2989,7 @@ void hostapd_interface_deinit_free(struc
(unsigned int) iface->conf->num_bss);
driver = iface->bss[0]->driver;
drv_priv = iface->bss[0]->drv_priv;
@@ -322,7 +322,7 @@
--- a/wpa_supplicant/Makefile
+++ b/wpa_supplicant/Makefile
-@@ -194,6 +194,13 @@ ifdef CONFIG_EAPOL_TEST
+@@ -192,6 +192,13 @@ ifdef CONFIG_EAPOL_TEST
CFLAGS += -Werror -DEAPOL_TEST
endif
@@ -336,7 +336,7 @@
ifdef CONFIG_CODE_COVERAGE
CFLAGS += -O0 -fprofile-arcs -ftest-coverage
LIBS += -lgcov
-@@ -989,6 +996,9 @@ ifdef CONFIG_CTRL_IFACE_MIB
+@@ -987,6 +994,9 @@ ifdef CONFIG_CTRL_IFACE_MIB
CFLAGS += -DCONFIG_CTRL_IFACE_MIB
endif
OBJS += ../src/ap/ctrl_iface_ap.o
@@ -348,7 +348,7 @@
CFLAGS += -DEAP_SERVER -DEAP_SERVER_IDENTITY
--- a/wpa_supplicant/wpa_supplicant.c
+++ b/wpa_supplicant/wpa_supplicant.c
-@@ -7635,6 +7635,8 @@ struct wpa_supplicant * wpa_supplicant_a
+@@ -7566,6 +7566,8 @@ struct wpa_supplicant * wpa_supplicant_a
}
#endif /* CONFIG_P2P */
@@ -357,7 +357,7 @@
return wpa_s;
}
-@@ -7661,6 +7663,8 @@ int wpa_supplicant_remove_iface(struct w
+@@ -7592,6 +7594,8 @@ int wpa_supplicant_remove_iface(struct w
struct wpa_supplicant *parent = wpa_s->parent;
#endif /* CONFIG_MESH */
@@ -366,7 +366,7 @@
/* Remove interface from the global list of interfaces */
prev = global->ifaces;
if (prev == wpa_s) {
-@@ -8007,8 +8011,12 @@ int wpa_supplicant_run(struct wpa_global
+@@ -7938,8 +7942,12 @@ int wpa_supplicant_run(struct wpa_global
eloop_register_signal_terminate(wpa_supplicant_terminate, global);
eloop_register_signal_reconfig(wpa_supplicant_reconfig, global);
@@ -389,7 +389,7 @@
extern const char *const wpa_supplicant_version;
extern const char *const wpa_supplicant_license;
-@@ -324,6 +325,8 @@ struct wpa_global {
+@@ -319,6 +320,8 @@ struct wpa_global {
#endif /* CONFIG_WIFI_DISPLAY */
struct psk_list_entry *add_psk; /* From group formation */
@@ -398,7 +398,7 @@
};
-@@ -655,6 +658,7 @@ struct wpa_supplicant {
+@@ -650,6 +653,7 @@ struct wpa_supplicant {
unsigned char own_addr[ETH_ALEN];
unsigned char perm_addr[ETH_ALEN];
char ifname[100];
@@ -427,16 +427,16 @@
--- a/wpa_supplicant/main.c
+++ b/wpa_supplicant/main.c
-@@ -204,7 +204,7 @@ int main(int argc, char *argv[])
+@@ -203,7 +203,7 @@ int main(int argc, char *argv[])
for (;;) {
c = getopt(argc, argv,
-- "b:Bc:C:D:de:f:g:G:hH:i:I:KLMm:No:O:p:P:qsTtuv::W");
-+ "b:Bc:C:D:de:f:g:G:hH:i:I:KLMm:nNo:O:p:P:qsTtuv::W");
+- "b:Bc:C:D:de:f:g:G:hi:I:KLMm:No:O:p:P:qsTtuv::W");
++ "b:Bc:C:D:de:f:g:G:hi:I:KLMm:nNo:O:p:P:qsTtuv::W");
if (c < 0)
break;
switch (c) {
-@@ -272,6 +272,9 @@ int main(int argc, char *argv[])
+@@ -268,6 +268,9 @@ int main(int argc, char *argv[])
params.conf_p2p_dev = optarg;
break;
#endif /* CONFIG_P2P */
diff --git a/recipes-wifi/hostapd/files/patches-2.10.3/601-ucode_support.patch b/recipes-wifi/hostapd/files/patches-2.10.3/601-ucode_support.patch
index ff1a9dd..e0bbf13 100644
--- a/recipes-wifi/hostapd/files/patches-2.10.3/601-ucode_support.patch
+++ b/recipes-wifi/hostapd/files/patches-2.10.3/601-ucode_support.patch
@@ -26,7 +26,7 @@
ifdef CONFIG_CODE_COVERAGE
--- a/hostapd/main.c
+++ b/hostapd/main.c
-@@ -991,6 +991,7 @@ int main(int argc, char *argv[])
+@@ -994,6 +994,7 @@ int main(int argc, char *argv[])
}
hostapd_global_ctrl_iface_init(&interfaces);
@@ -34,7 +34,7 @@
if (hostapd_global_run(&interfaces, daemonize, pid_file)) {
wpa_printf(MSG_ERROR, "Failed to start eloop");
-@@ -1000,6 +1001,7 @@ int main(int argc, char *argv[])
+@@ -1003,6 +1004,7 @@ int main(int argc, char *argv[])
ret = 0;
out:
@@ -79,18 +79,27 @@
void *owner;
char *config_fname;
struct hostapd_config *conf;
+@@ -706,6 +713,8 @@ struct hostapd_iface * hostapd_init(stru
+ struct hostapd_iface *
+ hostapd_interface_init_bss(struct hapd_interfaces *interfaces, const char *phy,
+ const char *config_fname, int debug);
++int hostapd_setup_bss(struct hostapd_data *hapd, int first, bool start_beacon);
++void hostapd_bss_deinit(struct hostapd_data *hapd);
+ void hostapd_new_assoc_sta(struct hostapd_data *hapd, struct sta_info *sta,
+ int reassoc);
+ void hostapd_interface_deinit_free(struct hostapd_iface *iface);
--- a/src/ap/hostapd.c
+++ b/src/ap/hostapd.c
-@@ -276,6 +276,8 @@ int hostapd_reload_config(struct hostapd
+@@ -252,6 +252,8 @@ int hostapd_reload_config(struct hostapd
+ struct hostapd_config *newconf, *oldconf;
size_t j;
- int i;
-+ hostapd_ucode_reload_bss(hapd, reconf);
++ hostapd_ucode_reload_bss(hapd);
+
if (iface->config_fname == NULL) {
/* Only in-memory config in use - assume it has been updated */
hostapd_clear_old(iface);
-@@ -455,6 +457,7 @@ void hostapd_free_hapd_data(struct hosta
+@@ -435,6 +437,7 @@ void hostapd_free_hapd_data(struct hosta
hapd->beacon_set_done = 0;
wpa_printf(MSG_DEBUG, "%s(%s)", __func__, hapd->conf->iface);
@@ -98,7 +107,7 @@
hostapd_ubus_free_bss(hapd);
accounting_deinit(hapd);
hostapd_deinit_wpa(hapd);
-@@ -619,6 +622,7 @@ void hostapd_cleanup_iface_partial(struc
+@@ -599,6 +602,7 @@ void hostapd_cleanup_iface_partial(struc
static void hostapd_cleanup_iface(struct hostapd_iface *iface)
{
wpa_printf(MSG_DEBUG, "%s(%p)", __func__, iface);
@@ -106,7 +115,7 @@
eloop_cancel_timeout(channel_list_update_timeout, iface, NULL);
eloop_cancel_timeout(hostapd_interface_setup_failure_handler, iface,
NULL);
-@@ -1209,6 +1213,7 @@ static int hostapd_start_beacon(struct h
+@@ -1189,6 +1193,7 @@ static int hostapd_start_beacon(struct h
hapd->driver->set_operstate(hapd->drv_priv, 1);
hostapd_ubus_add_bss(hapd);
@@ -114,9 +123,28 @@
return 0;
}
+@@ -1211,8 +1216,7 @@ static int hostapd_start_beacon(struct h
+ * initialized. Most of the modules that are initialized here will be
+ * deinitialized in hostapd_cleanup().
+ */
+-static int hostapd_setup_bss(struct hostapd_data *hapd, int first,
+- bool start_beacon)
++int hostapd_setup_bss(struct hostapd_data *hapd, int first, bool start_beacon)
+ {
+ struct hostapd_bss_config *conf = hapd->conf;
+ u8 ssid[SSID_MAX_LEN + 1];
+@@ -2698,7 +2702,7 @@ hostapd_alloc_bss_data(struct hostapd_if
+ }
+
+
+-static void hostapd_bss_deinit(struct hostapd_data *hapd)
++void hostapd_bss_deinit(struct hostapd_data *hapd)
+ {
+ if (!hapd)
+ return;
--- a/wpa_supplicant/Makefile
+++ b/wpa_supplicant/Makefile
-@@ -197,8 +197,20 @@ endif
+@@ -195,8 +195,20 @@ endif
ifdef CONFIG_UBUS
CFLAGS += -DUBUS_SUPPORT
OBJS += ubus.o
@@ -138,7 +166,7 @@
endif
ifdef CONFIG_CODE_COVERAGE
-@@ -999,6 +1011,9 @@ OBJS += ../src/ap/ctrl_iface_ap.o
+@@ -997,6 +1009,9 @@ OBJS += ../src/ap/ctrl_iface_ap.o
ifdef CONFIG_UBUS
OBJS += ../src/ap/ubus.o
endif
@@ -150,7 +178,15 @@
CFLAGS += -DEAP_SERVER -DEAP_SERVER_IDENTITY
--- a/wpa_supplicant/wpa_supplicant.c
+++ b/wpa_supplicant/wpa_supplicant.c
-@@ -7636,6 +7636,7 @@ struct wpa_supplicant * wpa_supplicant_a
+@@ -1044,6 +1044,7 @@ void wpa_supplicant_set_state(struct wpa
+ sme_sched_obss_scan(wpa_s, 0);
+ }
+ wpa_s->wpa_state = state;
++ wpas_ucode_update_state(wpa_s);
+
+ #ifdef CONFIG_BGSCAN
+ if (state == WPA_COMPLETED && wpa_s->current_ssid != wpa_s->bgscan_ssid)
+@@ -7567,6 +7568,7 @@ struct wpa_supplicant * wpa_supplicant_a
#endif /* CONFIG_P2P */
wpas_ubus_add_bss(wpa_s);
@@ -158,7 +194,7 @@
return wpa_s;
}
-@@ -7663,6 +7664,7 @@ int wpa_supplicant_remove_iface(struct w
+@@ -7594,6 +7596,7 @@ int wpa_supplicant_remove_iface(struct w
struct wpa_supplicant *parent = wpa_s->parent;
#endif /* CONFIG_MESH */
@@ -166,7 +202,7 @@
wpas_ubus_free_bss(wpa_s);
/* Remove interface from the global list of interfaces */
-@@ -7973,6 +7975,7 @@ struct wpa_global * wpa_supplicant_init(
+@@ -7904,6 +7907,7 @@ struct wpa_global * wpa_supplicant_init(
eloop_register_timeout(WPA_SUPPLICANT_CLEANUP_INTERVAL, 0,
wpas_periodic, global, NULL);
@@ -174,7 +210,7 @@
return global;
}
-@@ -8011,12 +8014,8 @@ int wpa_supplicant_run(struct wpa_global
+@@ -7942,12 +7946,8 @@ int wpa_supplicant_run(struct wpa_global
eloop_register_signal_terminate(wpa_supplicant_terminate, global);
eloop_register_signal_reconfig(wpa_supplicant_reconfig, global);
@@ -187,7 +223,7 @@
return 0;
}
-@@ -8049,6 +8048,8 @@ void wpa_supplicant_deinit(struct wpa_gl
+@@ -7980,6 +7980,8 @@ void wpa_supplicant_deinit(struct wpa_gl
wpas_notify_supplicant_deinitialized(global);
@@ -206,7 +242,7 @@
extern const char *const wpa_supplicant_version;
extern const char *const wpa_supplicant_license;
-@@ -659,6 +660,7 @@ struct wpa_supplicant {
+@@ -654,6 +655,7 @@ struct wpa_supplicant {
unsigned char perm_addr[ETH_ALEN];
char ifname[100];
struct wpas_ubus_bss ubus;
@@ -216,7 +252,7 @@
#endif /* CONFIG_MATCH_IFACE */
--- a/hostapd/ctrl_iface.c
+++ b/hostapd/ctrl_iface.c
-@@ -4921,6 +4921,7 @@ try_again:
+@@ -4856,6 +4856,7 @@ try_again:
return -1;
}
@@ -224,7 +260,7 @@
wpa_msg_register_cb(hostapd_ctrl_iface_msg_cb);
return 0;
-@@ -5022,6 +5023,7 @@ fail:
+@@ -4957,6 +4958,7 @@ fail:
os_free(fname);
interface->global_ctrl_sock = s;
@@ -232,3 +268,66 @@
eloop_register_read_sock(s, hostapd_global_ctrl_iface_receive,
interface, NULL);
+--- a/src/drivers/driver.h
++++ b/src/drivers/driver.h
+@@ -6426,6 +6426,7 @@ union wpa_event_data {
+
+ /**
+ * struct ch_switch
++ * @count: Count until channel switch activates
+ * @freq: Frequency of new channel in MHz
+ * @ht_enabled: Whether this is an HT channel
+ * @ch_offset: Secondary channel offset
+@@ -6436,6 +6437,7 @@ union wpa_event_data {
+ * @punct_bitmap: Puncturing bitmap
+ */
+ struct ch_switch {
++ int count;
+ int freq;
+ int ht_enabled;
+ int ch_offset;
+--- a/src/drivers/driver_nl80211_event.c
++++ b/src/drivers/driver_nl80211_event.c
+@@ -1202,6 +1202,7 @@ static void mlme_event_ch_switch(struct
+ struct nlattr *bw, struct nlattr *cf1,
+ struct nlattr *cf2,
+ struct nlattr *punct_bitmap,
++ struct nlattr *count,
+ int finished)
+ {
+ struct i802_bss *bss;
+@@ -1265,6 +1266,8 @@ static void mlme_event_ch_switch(struct
+ data.ch_switch.cf1 = nla_get_u32(cf1);
+ if (cf2)
+ data.ch_switch.cf2 = nla_get_u32(cf2);
++ if (count)
++ data.ch_switch.count = nla_get_u32(count);
+
+ if (finished)
+ bss->flink->freq = data.ch_switch.freq;
+@@ -3848,6 +3851,7 @@ static void do_process_drv_event(struct
+ tb[NL80211_ATTR_CENTER_FREQ1],
+ tb[NL80211_ATTR_CENTER_FREQ2],
+ tb[NL80211_ATTR_PUNCT_BITMAP],
++ tb[NL80211_ATTR_CH_SWITCH_COUNT],
+ 0);
+ break;
+ case NL80211_CMD_CH_SWITCH_NOTIFY:
+@@ -3860,6 +3864,7 @@ static void do_process_drv_event(struct
+ tb[NL80211_ATTR_CENTER_FREQ1],
+ tb[NL80211_ATTR_CENTER_FREQ2],
+ tb[NL80211_ATTR_PUNCT_BITMAP],
++ NULL,
+ 1);
+ break;
+ case NL80211_CMD_DISCONNECT:
+--- a/wpa_supplicant/events.c
++++ b/wpa_supplicant/events.c
+@@ -5381,6 +5381,7 @@ void supplicant_event(void *ctx, enum wp
+ event_to_string(event), event);
+ #endif /* CONFIG_NO_STDOUT_DEBUG */
+
++ wpas_ucode_event(wpa_s, event, data);
+ switch (event) {
+ case EVENT_AUTH:
+ #ifdef CONFIG_FST
diff --git a/recipes-wifi/hostapd/files/patches-2.10.3/700-wifi-reload.patch b/recipes-wifi/hostapd/files/patches-2.10.3/700-wifi-reload.patch
deleted file mode 100644
index c0e7e4d..0000000
--- a/recipes-wifi/hostapd/files/patches-2.10.3/700-wifi-reload.patch
+++ /dev/null
@@ -1,232 +0,0 @@
---- a/hostapd/config_file.c
-+++ b/hostapd/config_file.c
-@@ -2420,6 +2420,8 @@ static int hostapd_config_fill(struct ho
- bss->isolate = atoi(pos);
- } else if (os_strcmp(buf, "ap_max_inactivity") == 0) {
- bss->ap_max_inactivity = atoi(pos);
-+ } else if (os_strcmp(buf, "config_id") == 0) {
-+ bss->config_id = os_strdup(pos);
- } else if (os_strcmp(buf, "skip_inactivity_poll") == 0) {
- bss->skip_inactivity_poll = atoi(pos);
- } else if (os_strcmp(buf, "config_id") == 0) {
-@@ -3130,6 +3132,8 @@ static int hostapd_config_fill(struct ho
- }
- } else if (os_strcmp(buf, "acs_exclude_dfs") == 0) {
- conf->acs_exclude_dfs = atoi(pos);
-+ } else if (os_strcmp(buf, "radio_config_id") == 0) {
-+ conf->config_id = os_strdup(pos);
- } else if (os_strcmp(buf, "op_class") == 0) {
- conf->op_class = atoi(pos);
- } else if (os_strcmp(buf, "channel") == 0) {
---- a/src/ap/ap_config.c
-+++ b/src/ap/ap_config.c
-@@ -998,6 +998,7 @@ void hostapd_config_free(struct hostapd_
-
- for (i = 0; i < conf->num_bss; i++)
- hostapd_config_free_bss(conf->bss[i]);
-+ os_free(conf->config_id);
- os_free(conf->bss);
- os_free(conf->supported_rates);
- os_free(conf->basic_rates);
---- a/src/ap/ap_config.h
-+++ b/src/ap/ap_config.h
-@@ -998,6 +998,7 @@ struct eht_phy_capabilities_info {
- struct hostapd_config {
- struct hostapd_bss_config **bss, *last_bss;
- size_t num_bss;
-+ char *config_id;
-
- u16 beacon_int;
- int rts_threshold;
---- a/src/ap/hostapd.c
-+++ b/src/ap/hostapd.c
-@@ -127,7 +127,7 @@ void hostapd_reconfig_encryption(struct
- }
-
-
--static void hostapd_reload_bss(struct hostapd_data *hapd)
-+void hostapd_reload_bss(struct hostapd_data *hapd)
- {
- struct hostapd_ssid *ssid;
-
-@@ -255,6 +255,10 @@ static int hostapd_iface_conf_changed(st
- {
- size_t i;
-
-+ if (newconf->config_id != oldconf->config_id)
-+ if (strcmp(newconf->config_id, oldconf->config_id))
-+ return 1;
-+
- if (newconf->num_bss != oldconf->num_bss)
- return 1;
-
-@@ -268,7 +272,7 @@ static int hostapd_iface_conf_changed(st
- }
-
-
--int hostapd_reload_config(struct hostapd_iface *iface)
-+int hostapd_reload_config(struct hostapd_iface *iface, int reconf)
- {
- struct hapd_interfaces *interfaces = iface->interfaces;
- struct hostapd_data *hapd = iface->bss[0];
-@@ -298,6 +302,9 @@ int hostapd_reload_config(struct hostapd
- char *fname;
- int res;
-
-+ if (reconf)
-+ return -1;
-+
- hostapd_clear_old(iface);
-
- wpa_printf(MSG_DEBUG,
-@@ -324,6 +331,24 @@ int hostapd_reload_config(struct hostapd
- wpa_printf(MSG_ERROR,
- "Failed to enable interface on config reload");
- return res;
-+ } else {
-+ for (j = 0; j < iface->num_bss; j++) {
-+ hapd = iface->bss[j];
-+ if (!hapd->config_id || strcmp(hapd->config_id, newconf->bss[j]->config_id)) {
-+ hostapd_flush_old_stations(iface->bss[j],
-+ WLAN_REASON_PREV_AUTH_NOT_VALID);
-+#ifdef CONFIG_WEP
-+ hostapd_broadcast_wep_clear(iface->bss[j]);
-+#endif
-+
-+#ifndef CONFIG_NO_RADIUS
-+ /* TODO: update dynamic data based on changed configuration
-+ * items (e.g., open/close sockets, etc.) */
-+ radius_client_flush(iface->bss[j]->radius, 0);
-+#endif /* CONFIG_NO_RADIUS */
-+ wpa_printf(MSG_INFO, "bss %zu changed", j);
-+ }
-+ }
- }
- iface->conf = newconf;
-
-@@ -340,6 +365,12 @@ int hostapd_reload_config(struct hostapd
-
- for (j = 0; j < iface->num_bss; j++) {
- hapd = iface->bss[j];
-+ if (hapd->config_id) {
-+ os_free(hapd->config_id);
-+ hapd->config_id = NULL;
-+ }
-+ if (newconf->bss[j]->config_id)
-+ hapd->config_id = strdup(newconf->bss[j]->config_id);
- if (!hapd->conf->config_id || !newconf->bss[j]->config_id ||
- os_strcmp(hapd->conf->config_id,
- newconf->bss[j]->config_id) != 0)
-@@ -1236,8 +1267,7 @@ static int hostapd_start_beacon(struct h
- * initialized. Most of the modules that are initialized here will be
- * deinitialized in hostapd_cleanup().
- */
--static int hostapd_setup_bss(struct hostapd_data *hapd, int first,
-- bool start_beacon)
-+int hostapd_setup_bss(struct hostapd_data *hapd, int first, bool start_beacon)
- {
- struct hostapd_bss_config *conf = hapd->conf;
- u8 ssid[SSID_MAX_LEN + 1];
-@@ -2705,6 +2735,10 @@ hostapd_alloc_bss_data(struct hostapd_if
- hapd->iconf = conf;
- hapd->conf = bss;
- hapd->iface = hapd_iface;
-+ if (bss && bss->config_id)
-+ hapd->config_id = strdup(bss->config_id);
-+ else
-+ hapd->config_id = NULL;
- if (conf)
- hapd->driver = conf->driver;
- hapd->ctrl_sock = -1;
-@@ -2723,7 +2757,7 @@ hostapd_alloc_bss_data(struct hostapd_if
- }
-
-
--static void hostapd_bss_deinit(struct hostapd_data *hapd)
-+void hostapd_bss_deinit(struct hostapd_data *hapd)
- {
- if (!hapd)
- return;
---- a/src/ap/hostapd.h
-+++ b/src/ap/hostapd.h
-@@ -48,7 +48,7 @@ struct mesh_conf;
- struct hostapd_iface;
-
- struct hapd_interfaces {
-- int (*reload_config)(struct hostapd_iface *iface);
-+ int (*reload_config)(struct hostapd_iface *iface, int reconf);
- struct hostapd_config * (*config_read_cb)(const char *config_fname);
- int (*ctrl_iface_init)(struct hostapd_data *hapd);
- void (*ctrl_iface_deinit)(struct hostapd_data *hapd);
-@@ -192,6 +192,7 @@ struct hostapd_data {
- struct hostapd_bss_config *conf;
- struct hostapd_ubus_bss ubus;
- struct hostapd_ucode_bss ucode;
-+ char *config_id;
- int interface_added; /* virtual interface added for this BSS */
- unsigned int started:1;
- unsigned int disabled:1;
-@@ -696,7 +697,9 @@ struct hostapd_iface {
- int hostapd_for_each_interface(struct hapd_interfaces *interfaces,
- int (*cb)(struct hostapd_iface *iface,
- void *ctx), void *ctx);
--int hostapd_reload_config(struct hostapd_iface *iface);
-+int hostapd_reload_config(struct hostapd_iface *iface, int reconf);
-+void hostapd_reload_bss(struct hostapd_data *hapd);
-+void hostapd_bss_deinit(struct hostapd_data *hapd);
- void hostapd_reconfig_encryption(struct hostapd_data *hapd);
- struct hostapd_data *
- hostapd_alloc_bss_data(struct hostapd_iface *hapd_iface,
-@@ -713,6 +716,7 @@ struct hostapd_iface * hostapd_init(stru
- struct hostapd_iface *
- hostapd_interface_init_bss(struct hapd_interfaces *interfaces, const char *phy,
- const char *config_fname, int debug);
-+int hostapd_setup_bss(struct hostapd_data *hapd, int first, bool start_beacon);
- void hostapd_new_assoc_sta(struct hostapd_data *hapd, struct sta_info *sta,
- int reassoc);
- void hostapd_interface_deinit_free(struct hostapd_iface *iface);
---- a/src/drivers/driver_nl80211.c
-+++ b/src/drivers/driver_nl80211.c
-@@ -5322,6 +5322,9 @@ static int wpa_driver_nl80211_set_ap(voi
- if (ret) {
- wpa_printf(MSG_DEBUG, "nl80211: Beacon set failed: %d (%s)",
- ret, strerror(-ret));
-+ if (!bss->flink->beacon_set)
-+ ret = 0;
-+ bss->flink->beacon_set = 0;
- } else {
- link->beacon_set = 1;
- nl80211_set_bss(bss, params->cts_protect, params->preamble,
---- a/hostapd/ctrl_iface.c
-+++ b/hostapd/ctrl_iface.c
-@@ -187,7 +187,7 @@ static int hostapd_ctrl_iface_update(str
- iface->interfaces->config_read_cb = hostapd_ctrl_iface_config_read;
- reload_opts = txt;
-
-- hostapd_reload_config(iface);
-+ hostapd_reload_config(iface, 0);
-
- iface->interfaces->config_read_cb = config_read_cb;
- }
---- a/hostapd/main.c
-+++ b/hostapd/main.c
-@@ -410,7 +410,7 @@ static void handle_term(int sig, void *s
-
- static int handle_reload_iface(struct hostapd_iface *iface, void *ctx)
- {
-- if (hostapd_reload_config(iface) < 0) {
-+ if (hostapd_reload_config(iface, 0) < 0) {
- wpa_printf(MSG_WARNING, "Failed to read new configuration "
- "file - continuing with old.");
- }
---- a/src/ap/wps_hostapd.c
-+++ b/src/ap/wps_hostapd.c
-@@ -315,7 +315,7 @@ static void wps_reload_config(void *eloo
-
- wpa_printf(MSG_DEBUG, "WPS: Reload configuration data");
- if (iface->interfaces == NULL ||
-- iface->interfaces->reload_config(iface) < 0) {
-+ iface->interfaces->reload_config(iface, 1) < 0) {
- wpa_printf(MSG_WARNING, "WPS: Failed to reload the updated "
- "configuration");
- }
diff --git a/recipes-wifi/hostapd/files/patches-2.10.3/701-reload_config_inline.patch b/recipes-wifi/hostapd/files/patches-2.10.3/701-reload_config_inline.patch
index 071281e..44c8892 100644
--- a/recipes-wifi/hostapd/files/patches-2.10.3/701-reload_config_inline.patch
+++ b/recipes-wifi/hostapd/files/patches-2.10.3/701-reload_config_inline.patch
@@ -1,6 +1,6 @@
--- a/hostapd/config_file.c
+++ b/hostapd/config_file.c
-@@ -4814,7 +4814,12 @@ struct hostapd_config * hostapd_config_r
+@@ -4810,7 +4810,12 @@ struct hostapd_config * hostapd_config_r
int errors = 0;
size_t i;
diff --git a/recipes-wifi/hostapd/files/patches-2.10.3/710-vlan_no_bridge.patch b/recipes-wifi/hostapd/files/patches-2.10.3/710-vlan_no_bridge.patch
index 61f33ac..63d1b8a 100644
--- a/recipes-wifi/hostapd/files/patches-2.10.3/710-vlan_no_bridge.patch
+++ b/recipes-wifi/hostapd/files/patches-2.10.3/710-vlan_no_bridge.patch
@@ -30,7 +30,7 @@
--- a/hostapd/config_file.c
+++ b/hostapd/config_file.c
-@@ -3355,6 +3355,8 @@ static int hostapd_config_fill(struct ho
+@@ -3351,6 +3351,8 @@ static int hostapd_config_fill(struct ho
#ifndef CONFIG_NO_VLAN
} else if (os_strcmp(buf, "dynamic_vlan") == 0) {
bss->ssid.dynamic_vlan = atoi(pos);
diff --git a/recipes-wifi/hostapd/files/patches-2.10.3/720-iface_max_num_sta.patch b/recipes-wifi/hostapd/files/patches-2.10.3/720-iface_max_num_sta.patch
index 5f40aab..1aa4456 100644
--- a/recipes-wifi/hostapd/files/patches-2.10.3/720-iface_max_num_sta.patch
+++ b/recipes-wifi/hostapd/files/patches-2.10.3/720-iface_max_num_sta.patch
@@ -1,6 +1,6 @@
--- a/hostapd/config_file.c
+++ b/hostapd/config_file.c
-@@ -2850,6 +2850,14 @@ static int hostapd_config_fill(struct ho
+@@ -2848,6 +2848,14 @@ static int hostapd_config_fill(struct ho
line, bss->max_num_sta, MAX_STA_COUNT);
return 1;
}
@@ -17,7 +17,7 @@
} else if (os_strcmp(buf, "extended_key_id") == 0) {
--- a/src/ap/hostapd.h
+++ b/src/ap/hostapd.h
-@@ -744,6 +744,7 @@ void hostapd_cleanup_cs_params(struct ho
+@@ -742,6 +742,7 @@ void hostapd_cleanup_cs_params(struct ho
void hostapd_periodic_iface(struct hostapd_iface *iface);
int hostapd_owe_trans_get_info(struct hostapd_data *hapd);
void hostapd_ocv_check_csa_sa_query(void *eloop_ctx, void *timeout_ctx);
@@ -27,10 +27,10 @@
void hostapd_cleanup_cca_params(struct hostapd_data *hapd);
--- a/src/ap/hostapd.c
+++ b/src/ap/hostapd.c
-@@ -272,6 +272,30 @@ static int hostapd_iface_conf_changed(st
+@@ -244,6 +244,29 @@ static int hostapd_iface_conf_changed(st
+ return 0;
}
-
+static inline int hostapd_iface_num_sta(struct hostapd_iface *iface)
+{
+ int num_sta = 0;
@@ -54,10 +54,9 @@
+
+ return 0;
+}
-+
- int hostapd_reload_config(struct hostapd_iface *iface, int reconf)
+
+ int hostapd_reload_config(struct hostapd_iface *iface)
{
- struct hapd_interfaces *interfaces = iface->interfaces;
--- a/src/ap/beacon.c
+++ b/src/ap/beacon.c
@@ -1252,7 +1252,7 @@ void handle_probe_req(struct hostapd_dat
@@ -71,7 +70,7 @@
" since no room for additional STA",
--- a/src/ap/ap_config.h
+++ b/src/ap/ap_config.h
-@@ -1037,6 +1037,8 @@ struct hostapd_config {
+@@ -1036,6 +1036,8 @@ struct hostapd_config {
unsigned int track_sta_max_num;
unsigned int track_sta_max_age;
diff --git a/recipes-wifi/hostapd/files/patches-2.10.3/730-ft_iface.patch b/recipes-wifi/hostapd/files/patches-2.10.3/730-ft_iface.patch
index 563fe5b..0795ed1 100644
--- a/recipes-wifi/hostapd/files/patches-2.10.3/730-ft_iface.patch
+++ b/recipes-wifi/hostapd/files/patches-2.10.3/730-ft_iface.patch
@@ -1,6 +1,6 @@
--- a/hostapd/config_file.c
+++ b/hostapd/config_file.c
-@@ -3009,6 +3009,8 @@ static int hostapd_config_fill(struct ho
+@@ -3007,6 +3007,8 @@ static int hostapd_config_fill(struct ho
wpa_printf(MSG_INFO,
"Line %d: Obsolete peerkey parameter ignored", line);
#ifdef CONFIG_IEEE80211R_AP
diff --git a/recipes-wifi/hostapd/files/patches-2.10.3/750-qos_map_set_without_interworking.patch b/recipes-wifi/hostapd/files/patches-2.10.3/750-qos_map_set_without_interworking.patch
index 3e282b4..97c32df 100644
--- a/recipes-wifi/hostapd/files/patches-2.10.3/750-qos_map_set_without_interworking.patch
+++ b/recipes-wifi/hostapd/files/patches-2.10.3/750-qos_map_set_without_interworking.patch
@@ -18,7 +18,7 @@
#ifdef CONFIG_HS20
static int hs20_parse_conn_capab(struct hostapd_bss_config *bss, char *buf,
-@@ -4066,10 +4066,10 @@ static int hostapd_config_fill(struct ho
+@@ -4062,10 +4062,10 @@ static int hostapd_config_fill(struct ho
bss->gas_frag_limit = val;
} else if (os_strcmp(buf, "gas_comeback_delay") == 0) {
bss->gas_comeback_delay = atoi(pos);
@@ -32,7 +32,7 @@
os_free(bss->dump_msk_file);
--- a/src/ap/hostapd.c
+++ b/src/ap/hostapd.c
-@@ -1538,6 +1538,7 @@ int hostapd_setup_bss(struct hostapd_dat
+@@ -1486,6 +1486,7 @@ int hostapd_setup_bss(struct hostapd_dat
wpa_printf(MSG_ERROR, "GAS server initialization failed");
return -1;
}
@@ -40,7 +40,7 @@
if (conf->qos_map_set_len &&
hostapd_drv_set_qos_map(hapd, conf->qos_map_set,
-@@ -1545,7 +1546,6 @@ int hostapd_setup_bss(struct hostapd_dat
+@@ -1493,7 +1494,6 @@ int hostapd_setup_bss(struct hostapd_dat
wpa_printf(MSG_ERROR, "Failed to initialize QoS Map");
return -1;
}
diff --git a/recipes-wifi/hostapd/files/patches-2.10.3/760-dynamic_own_ip.patch b/recipes-wifi/hostapd/files/patches-2.10.3/760-dynamic_own_ip.patch
index 946b453..2c705a6 100644
--- a/recipes-wifi/hostapd/files/patches-2.10.3/760-dynamic_own_ip.patch
+++ b/recipes-wifi/hostapd/files/patches-2.10.3/760-dynamic_own_ip.patch
@@ -98,7 +98,7 @@
hapd->conf->own_ip_addr.af == AF_INET &&
--- a/hostapd/config_file.c
+++ b/hostapd/config_file.c
-@@ -2690,6 +2690,8 @@ static int hostapd_config_fill(struct ho
+@@ -2688,6 +2688,8 @@ static int hostapd_config_fill(struct ho
} else if (os_strcmp(buf, "iapp_interface") == 0) {
wpa_printf(MSG_INFO, "DEPRECATED: iapp_interface not used");
#endif /* CONFIG_IAPP */
diff --git a/recipes-wifi/hostapd/files/patches-2.10.3/761-shared_das_port.patch b/recipes-wifi/hostapd/files/patches-2.10.3/761-shared_das_port.patch
index d60764a..cbb2a1b 100644
--- a/recipes-wifi/hostapd/files/patches-2.10.3/761-shared_das_port.patch
+++ b/recipes-wifi/hostapd/files/patches-2.10.3/761-shared_das_port.patch
@@ -10,7 +10,7 @@
unsigned int time_window;
--- a/src/ap/hostapd.c
+++ b/src/ap/hostapd.c
-@@ -1475,6 +1475,7 @@ int hostapd_setup_bss(struct hostapd_dat
+@@ -1423,6 +1423,7 @@ int hostapd_setup_bss(struct hostapd_dat
os_memset(&das_conf, 0, sizeof(das_conf));
das_conf.port = conf->radius_das_port;
diff --git a/recipes-wifi/hostapd/files/patches-2.10.3/770-radius_server.patch b/recipes-wifi/hostapd/files/patches-2.10.3/770-radius_server.patch
index 6fca86d..e4690c7 100644
--- a/recipes-wifi/hostapd/files/patches-2.10.3/770-radius_server.patch
+++ b/recipes-wifi/hostapd/files/patches-2.10.3/770-radius_server.patch
@@ -13,15 +13,15 @@
OBJS += ../src/ap/drv_callbacks.o
--- a/hostapd/main.c
+++ b/hostapd/main.c
-@@ -42,6 +42,7 @@ static struct hapd_global global;
- static int daemonize = 0;
- static char *pid_file = NULL;
+@@ -40,6 +40,7 @@ struct hapd_global {
+
+ static struct hapd_global global;
+extern int radius_main(int argc, char **argv);
#ifndef CONFIG_NO_HOSTAPD_LOGGER
static void hostapd_logger_cb(void *ctx, const u8 *addr, unsigned int module,
-@@ -755,6 +756,11 @@ int main(int argc, char *argv[])
+@@ -758,6 +759,11 @@ int main(int argc, char *argv[])
if (os_program_init())
return -1;
diff --git a/recipes-wifi/hostapd/files/patches-2.10.3/991-Fix-OpenWrt-13156.patch b/recipes-wifi/hostapd/files/patches-2.10.3/991-Fix-OpenWrt-13156.patch
new file mode 100644
index 0000000..3f10fb1
--- /dev/null
+++ b/recipes-wifi/hostapd/files/patches-2.10.3/991-Fix-OpenWrt-13156.patch
@@ -0,0 +1,63 @@
+From 26cd9bafc1d25e602952ee86cd2a5b8c3a995490 Mon Sep 17 00:00:00 2001
+From: Stijn Tintel <stijn@linux-ipv6.be>
+Date: Fri, 28 Jul 2023 16:27:47 +0300
+Subject: [PATCH] Revert "Do prune_association only after the STA is
+ authorized"
+
+Commit e978072baaca ("Do prune_association only after the STA is
+authorized") causes issues when an STA roams from one interface to
+another interface on the same PHY. The mt7915 driver is not able to
+handle this properly. While the commits fixes a DoS, there are other
+devices and drivers with the same limitation, so revert to the orginal
+behavior for now, until we have a better solution in place.
+
+Ref: https://github.com/openwrt/openwrt/issues/13156
+Signed-off-by: Stijn Tintel <stijn@linux-ipv6.be>
+---
+ src/ap/hostapd.c | 14 +++++++++++---
+ src/ap/sta_info.c | 3 ---
+ 2 files changed, 11 insertions(+), 6 deletions(-)
+
+--- a/src/ap/hostapd.c
++++ b/src/ap/hostapd.c
+@@ -3563,6 +3563,8 @@ int hostapd_remove_iface(struct hapd_int
+ void hostapd_new_assoc_sta(struct hostapd_data *hapd, struct sta_info *sta,
+ int reassoc)
+ {
++ int mld_assoc_link_id = -1;
++
+ if (hapd->tkip_countermeasures) {
+ hostapd_drv_sta_deauth(hapd, sta->addr,
+ WLAN_REASON_MICHAEL_MIC_FAILURE);
+@@ -3570,10 +3572,16 @@ void hostapd_new_assoc_sta(struct hostap
+ }
+
+ #ifdef CONFIG_IEEE80211BE
+- if (hapd->conf->mld_ap && sta->mld_info.mld_sta &&
+- sta->mld_assoc_link_id != hapd->mld_link_id)
+- return;
++ if (hapd->conf->mld_ap && sta->mld_info.mld_sta) {
++ if (sta->mld_assoc_link_id == hapd->mld_link_id) {
++ mld_assoc_link_id = sta->mld_assoc_link_id;
++ } else {
++ return;
++ }
++ }
+ #endif /* CONFIG_IEEE80211BE */
++ if (mld_assoc_link_id != -2)
++ hostapd_prune_associations(hapd, sta->addr, mld_assoc_link_id);
+
+ ap_sta_clear_disconnect_timeouts(hapd, sta);
+ sta->post_csa_sa_query = 0;
+--- a/src/ap/sta_info.c
++++ b/src/ap/sta_info.c
+@@ -1318,9 +1318,6 @@ void ap_sta_set_authorized(struct hostap
+ mld_assoc_link_id = -2;
+ }
+ #endif /* CONFIG_IEEE80211BE */
+- if (mld_assoc_link_id != -2)
+- hostapd_prune_associations(hapd, sta->addr,
+- mld_assoc_link_id);
+ sta->flags |= WLAN_STA_AUTHORIZED;
+ } else {
+ sta->flags &= ~WLAN_STA_AUTHORIZED;
diff --git a/recipes-wifi/hostapd/files/patches-2.10.3/mtk-0001-hostapd-mtk-Add-neighbor-report-and-BSS-Termination-.patch b/recipes-wifi/hostapd/files/patches-2.10.3/mtk-0001-hostapd-mtk-Add-neighbor-report-and-BSS-Termination-.patch
index 4fa2dfb..ebd951f 100644
--- a/recipes-wifi/hostapd/files/patches-2.10.3/mtk-0001-hostapd-mtk-Add-neighbor-report-and-BSS-Termination-.patch
+++ b/recipes-wifi/hostapd/files/patches-2.10.3/mtk-0001-hostapd-mtk-Add-neighbor-report-and-BSS-Termination-.patch
@@ -1,8 +1,8 @@
-From bfca3c43597bf827e4d5faec91ac8f420d33c921 Mon Sep 17 00:00:00 2001
+From 66102db35a595a1b2754e13a95123e55d378332e Mon Sep 17 00:00:00 2001
From: "howard.hsu" <howard-yh.hsu@mediatek.com>
Date: Wed, 19 Jan 2022 19:18:07 +0800
-Subject: [PATCH] hostapd: mtk: Add neighbor report and BSS Termination for MBO
- certification
+Subject: [PATCH 01/40] hostapd: mtk: Add neighbor report and BSS Termination
+ for MBO certification
1. Add hostapd_neighbor_count() and hostapd_neighbor_insert_buffer ()
The first function can count the number of neighbor report in neighbore report
@@ -31,10 +31,10 @@
9 files changed, 223 insertions(+), 4 deletions(-)
diff --git a/hostapd/ctrl_iface.c b/hostapd/ctrl_iface.c
-index 55711ab..fab1287 100644
+index 0a892c9..98d598e 100644
--- a/hostapd/ctrl_iface.c
+++ b/hostapd/ctrl_iface.c
-@@ -1347,6 +1347,11 @@ static int hostapd_ctrl_iface_set(struct hostapd_data *hapd, char *cmd)
+@@ -1290,6 +1290,11 @@ static int hostapd_ctrl_iface_set(struct hostapd_data *hapd, char *cmd)
#endif /* CONFIG_DPP */
} else if (os_strcasecmp(cmd, "setband") == 0) {
ret = hostapd_ctrl_iface_set_band(hapd, value);
@@ -47,7 +47,7 @@
ret = hostapd_set_iface(hapd->iconf, hapd->conf, cmd, value);
if (ret)
diff --git a/src/ap/ap_config.c b/src/ap/ap_config.c
-index 41c7070..7d0de12 100644
+index 298216a..73b33b4 100644
--- a/src/ap/ap_config.c
+++ b/src/ap/ap_config.c
@@ -171,6 +171,7 @@ void hostapd_config_defaults_bss(struct hostapd_bss_config *bss)
@@ -59,7 +59,7 @@
diff --git a/src/ap/ap_config.h b/src/ap/ap_config.h
-index 02fd494..dc60252 100644
+index 44b62f8..774f64e 100644
--- a/src/ap/ap_config.h
+++ b/src/ap/ap_config.h
@@ -558,6 +558,7 @@ struct hostapd_bss_config {
@@ -71,10 +71,10 @@
/* IEEE 802.11u - Interworking */
int interworking;
diff --git a/src/ap/ctrl_iface_ap.c b/src/ap/ctrl_iface_ap.c
-index 50a4dc4..cf1cff4 100644
+index 42c9593..0e173f1 100644
--- a/src/ap/ctrl_iface_ap.c
+++ b/src/ap/ctrl_iface_ap.c
-@@ -1280,6 +1280,10 @@ int hostapd_ctrl_iface_bss_tm_req(struct hostapd_data *hapd,
+@@ -1274,6 +1274,10 @@ int hostapd_ctrl_iface_bss_tm_req(struct hostapd_data *hapd,
wpa_printf(MSG_DEBUG, "Invalid bss_term data");
return -1;
}
@@ -85,7 +85,7 @@
end++;
WPA_PUT_LE16(&bss_term_dur[10], atoi(end));
}
-@@ -1306,14 +1310,25 @@ int hostapd_ctrl_iface_bss_tm_req(struct hostapd_data *hapd,
+@@ -1300,14 +1304,25 @@ int hostapd_ctrl_iface_bss_tm_req(struct hostapd_data *hapd,
req_mode |= WNM_BSS_TM_REQ_ESS_DISASSOC_IMMINENT;
}
diff --git a/recipes-wifi/hostapd/files/patches-2.10.3/mtk-0002-hostapd-mtk-print-sae-groups-by-hostapd-ctrl.patch b/recipes-wifi/hostapd/files/patches-2.10.3/mtk-0002-hostapd-mtk-print-sae-groups-by-hostapd-ctrl.patch
index 9a4638d..70486da 100644
--- a/recipes-wifi/hostapd/files/patches-2.10.3/mtk-0002-hostapd-mtk-print-sae-groups-by-hostapd-ctrl.patch
+++ b/recipes-wifi/hostapd/files/patches-2.10.3/mtk-0002-hostapd-mtk-print-sae-groups-by-hostapd-ctrl.patch
@@ -1,17 +1,17 @@
-From a1c40b639dfdb7ebfbc4ee75f5d0ea35ff7d17fc Mon Sep 17 00:00:00 2001
+From a915b2e10f342705ab26158efebaa7a7024042ae Mon Sep 17 00:00:00 2001
From: Shayne Chen <shayne.chen@mediatek.com>
Date: Tue, 20 Sep 2022 19:33:45 +0800
-Subject: [PATCH 02/32] hostapd: mtk: print sae groups by hostapd ctrl
+Subject: [PATCH 02/40] hostapd: mtk: print sae groups by hostapd ctrl
---
hostapd/ctrl_iface.c | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/hostapd/ctrl_iface.c b/hostapd/ctrl_iface.c
-index fab1287cd..4624d9afd 100644
+index 98d598e..c03e6f6 100644
--- a/hostapd/ctrl_iface.c
+++ b/hostapd/ctrl_iface.c
-@@ -1421,6 +1421,19 @@ static int hostapd_ctrl_iface_get(struct hostapd_data *hapd, char *cmd,
+@@ -1364,6 +1364,19 @@ static int hostapd_ctrl_iface_get(struct hostapd_data *hapd, char *cmd,
if (os_snprintf_error(buflen, res))
return -1;
return res;
@@ -32,5 +32,5 @@
return -1;
--
-2.39.2
+2.18.0
diff --git a/recipes-wifi/hostapd/files/patches-2.10.3/mtk-0003-hostapd-mtk-add-support-for-runtime-set-in-band-disc.patch b/recipes-wifi/hostapd/files/patches-2.10.3/mtk-0003-hostapd-mtk-add-support-for-runtime-set-in-band-disc.patch
index dae1d21..377b04a 100644
--- a/recipes-wifi/hostapd/files/patches-2.10.3/mtk-0003-hostapd-mtk-add-support-for-runtime-set-in-band-disc.patch
+++ b/recipes-wifi/hostapd/files/patches-2.10.3/mtk-0003-hostapd-mtk-add-support-for-runtime-set-in-band-disc.patch
@@ -1,7 +1,7 @@
-From 713b2663c91c55f00c6b9bfbf44922306aab6ad3 Mon Sep 17 00:00:00 2001
+From e2ecc047a72c3069c9f05975e612a37864da5885 Mon Sep 17 00:00:00 2001
From: MeiChia Chiu <meichia.chiu@mediatek.com>
Date: Tue, 31 May 2022 21:15:54 +0800
-Subject: [PATCH 03/32] hostapd: mtk: add support for runtime set in-band
+Subject: [PATCH 03/40] hostapd: mtk: add support for runtime set in-band
discovery
Usage:
@@ -21,10 +21,10 @@
5 files changed, 98 insertions(+), 4 deletions(-)
diff --git a/hostapd/ctrl_iface.c b/hostapd/ctrl_iface.c
-index 4624d9afd..d4737958a 100644
+index c03e6f6..ee6d492 100644
--- a/hostapd/ctrl_iface.c
+++ b/hostapd/ctrl_iface.c
-@@ -827,6 +827,69 @@ static int hostapd_ctrl_iface_send_qos_map_conf(struct hostapd_data *hapd,
+@@ -770,6 +770,69 @@ static int hostapd_ctrl_iface_send_qos_map_conf(struct hostapd_data *hapd,
#endif /* CONFIG_INTERWORKING */
@@ -94,7 +94,7 @@
#ifdef CONFIG_WNM_AP
-@@ -3546,6 +3609,9 @@ static int hostapd_ctrl_iface_receive_process(struct hostapd_data *hapd,
+@@ -3483,6 +3546,9 @@ static int hostapd_ctrl_iface_receive_process(struct hostapd_data *hapd,
if (hostapd_ctrl_iface_coloc_intf_req(hapd, buf + 15))
reply_len = -1;
#endif /* CONFIG_WNM_AP */
@@ -105,7 +105,7 @@
reply_len = hostapd_ctrl_iface_get_config(hapd, reply,
reply_size);
diff --git a/hostapd/hostapd_cli.c b/hostapd/hostapd_cli.c
-index 61f8cba12..dfc996d49 100644
+index 61f8cba..dfc996d 100644
--- a/hostapd/hostapd_cli.c
+++ b/hostapd/hostapd_cli.c
@@ -655,6 +655,24 @@ static int hostapd_cli_cmd_wps_config(struct wpa_ctrl *ctrl, int argc,
@@ -143,7 +143,7 @@
};
diff --git a/src/ap/beacon.c b/src/ap/beacon.c
-index 78b347618..f26e5254c 100644
+index 9454cdf..3dc217f 100644
--- a/src/ap/beacon.c
+++ b/src/ap/beacon.c
@@ -1648,6 +1648,8 @@ static u8 * hostapd_fils_discovery(struct hostapd_data *hapd,
@@ -166,7 +166,7 @@
¶ms->fd_frame_tmpl_len);
diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c
-index 70d98e7d4..37e156fc8 100644
+index 99870a6..7867e69 100644
--- a/src/drivers/driver_nl80211.c
+++ b/src/drivers/driver_nl80211.c
@@ -4686,9 +4686,10 @@ static int nl80211_fils_discovery(struct i802_bss *bss, struct nl_msg *msg,
@@ -195,7 +195,7 @@
#endif /* CONFIG_FILS */
diff --git a/src/drivers/nl80211_copy.h b/src/drivers/nl80211_copy.h
-index c59fec406..82860ae32 100644
+index c59fec4..82860ae 100644
--- a/src/drivers/nl80211_copy.h
+++ b/src/drivers/nl80211_copy.h
@@ -7591,6 +7591,7 @@ enum nl80211_fils_discovery_attributes {
@@ -207,5 +207,5 @@
/* keep last */
__NL80211_FILS_DISCOVERY_ATTR_LAST,
--
-2.39.2
+2.18.0
diff --git a/recipes-wifi/hostapd/files/patches-2.10.3/mtk-0004-hostapd-mtk-Add-mtk_vendor.h.patch b/recipes-wifi/hostapd/files/patches-2.10.3/mtk-0004-hostapd-mtk-Add-mtk_vendor.h.patch
index e3e5973..11971cd 100644
--- a/recipes-wifi/hostapd/files/patches-2.10.3/mtk-0004-hostapd-mtk-Add-mtk_vendor.h.patch
+++ b/recipes-wifi/hostapd/files/patches-2.10.3/mtk-0004-hostapd-mtk-Add-mtk_vendor.h.patch
@@ -1,7 +1,7 @@
-From 4fd45869d5a3ca0e99ce7d14c925828f1b027881 Mon Sep 17 00:00:00 2001
+From bb0f79fb5a04b7ba10bf3ff03634110dd25aa31f Mon Sep 17 00:00:00 2001
From: Howard Hsu <howard-yh.hsu@mediatek.com>
Date: Mon, 30 May 2022 15:04:57 +0800
-Subject: [PATCH 04/32] hostapd: mtk: Add mtk_vendor.h
+Subject: [PATCH 04/40] hostapd: mtk: Add mtk_vendor.h
---
src/common/mtk_vendor.h | 197 ++++++++++++++++++++++++++++++++++++++++
@@ -10,7 +10,7 @@
diff --git a/src/common/mtk_vendor.h b/src/common/mtk_vendor.h
new file mode 100644
-index 000000000..4a19d2fc9
+index 0000000..4a19d2f
--- /dev/null
+++ b/src/common/mtk_vendor.h
@@ -0,0 +1,197 @@
@@ -212,5 +212,5 @@
+};
+#endif /* MTK_VENDOR_H */
--
-2.39.2
+2.18.0
diff --git a/recipes-wifi/hostapd/files/patches-2.10.3/mtk-0005-hostapd-mtk-Support-EDCCA-hostapd-configuration.patch b/recipes-wifi/hostapd/files/patches-2.10.3/mtk-0005-hostapd-mtk-Support-EDCCA-hostapd-configuration.patch
index 4f85cf2..272ebf8 100644
--- a/recipes-wifi/hostapd/files/patches-2.10.3/mtk-0005-hostapd-mtk-Support-EDCCA-hostapd-configuration.patch
+++ b/recipes-wifi/hostapd/files/patches-2.10.3/mtk-0005-hostapd-mtk-Support-EDCCA-hostapd-configuration.patch
@@ -1,7 +1,7 @@
-From 68bb1314767dfb84656385e38a1c05862312d76e Mon Sep 17 00:00:00 2001
+From 6b321709940a2feaa79a5e6d63f19a83bde83bb7 Mon Sep 17 00:00:00 2001
From: Howard Hsu <howard-yh.hsu@mediatek.com>
Date: Mon, 30 May 2022 16:31:34 +0800
-Subject: [PATCH 05/32] hostapd: mtk: Support EDCCA hostapd configuration
+Subject: [PATCH 05/40] hostapd: mtk: Support EDCCA hostapd configuration
edcca_enable and edcca_compensation and implement edcca related handlers.
---
@@ -20,10 +20,10 @@
12 files changed, 428 insertions(+), 6 deletions(-)
diff --git a/hostapd/config_file.c b/hostapd/config_file.c
-index 45b4d457b..339d6915e 100644
+index 3557bef..1fc6456 100644
--- a/hostapd/config_file.c
+++ b/hostapd/config_file.c
-@@ -4805,6 +4805,40 @@ static int hostapd_config_fill(struct hostapd_config *conf,
+@@ -4803,6 +4803,40 @@ static int hostapd_config_fill(struct hostapd_config *conf,
} else if (os_strcmp(buf, "mld_id") == 0) {
bss->mld_id = atoi(pos);
#endif /* CONFIG_IEEE80211BE */
@@ -65,10 +65,10 @@
wpa_printf(MSG_ERROR,
"Line %d: unknown configuration item '%s'",
diff --git a/hostapd/ctrl_iface.c b/hostapd/ctrl_iface.c
-index d4737958a..d8afba992 100644
+index ee6d492..cad3f86 100644
--- a/hostapd/ctrl_iface.c
+++ b/hostapd/ctrl_iface.c
-@@ -599,6 +599,19 @@ static const char * pbc_status_str(enum pbc_status status)
+@@ -542,6 +542,19 @@ static const char * pbc_status_str(enum pbc_status status)
}
@@ -88,7 +88,7 @@
static int hostapd_ctrl_iface_wps_get_status(struct hostapd_data *hapd,
char *buf, size_t buflen)
{
-@@ -3432,6 +3445,112 @@ static int hostapd_ctrl_iface_driver_cmd(struct hostapd_data *hapd, char *cmd,
+@@ -3369,6 +3382,112 @@ static int hostapd_ctrl_iface_driver_cmd(struct hostapd_data *hapd, char *cmd,
#endif /* ANDROID */
@@ -201,7 +201,7 @@
static int hostapd_ctrl_iface_receive_process(struct hostapd_data *hapd,
char *buf, char *reply,
int reply_size,
-@@ -3987,6 +4106,12 @@ static int hostapd_ctrl_iface_receive_process(struct hostapd_data *hapd,
+@@ -3922,6 +4041,12 @@ static int hostapd_ctrl_iface_receive_process(struct hostapd_data *hapd,
reply_len = hostapd_ctrl_iface_driver_cmd(hapd, buf + 7, reply,
reply_size);
#endif /* ANDROID */
@@ -215,7 +215,7 @@
os_memcpy(reply, "UNKNOWN COMMAND\n", 16);
reply_len = 16;
diff --git a/src/ap/ap_config.c b/src/ap/ap_config.c
-index 7d0de122d..35ea6b7f3 100644
+index 73b33b4..8e56d10 100644
--- a/src/ap/ap_config.c
+++ b/src/ap/ap_config.c
@@ -295,6 +295,9 @@ struct hostapd_config * hostapd_config_defaults(void)
@@ -228,7 +228,7 @@
return conf;
}
-@@ -1009,6 +1012,7 @@ void hostapd_config_free(struct hostapd_config *conf)
+@@ -1008,6 +1011,7 @@ void hostapd_config_free(struct hostapd_config *conf)
#ifdef CONFIG_ACS
os_free(conf->acs_chan_bias);
#endif /* CONFIG_ACS */
@@ -237,10 +237,10 @@
wpabuf_free(conf->civic);
diff --git a/src/ap/ap_config.h b/src/ap/ap_config.h
-index dc6025279..9186fbda8 100644
+index 774f64e..0e829c0 100644
--- a/src/ap/ap_config.h
+++ b/src/ap/ap_config.h
-@@ -1191,8 +1191,38 @@ struct hostapd_config {
+@@ -1190,8 +1190,38 @@ struct hostapd_config {
MBSSID_ENABLED = 1,
ENHANCED_MBSSID_ENABLED = 2,
} mbssid;
@@ -280,7 +280,7 @@
static inline enum oper_chan_width
hostapd_get_oper_chwidth(struct hostapd_config *conf)
diff --git a/src/ap/ap_drv_ops.c b/src/ap/ap_drv_ops.c
-index 75ddfa15c..99ba973aa 100644
+index 75ddfa1..99ba973 100644
--- a/src/ap/ap_drv_ops.c
+++ b/src/ap/ap_drv_ops.c
@@ -1137,3 +1137,27 @@ int hostapd_drv_set_secure_ranging_ctx(struct hostapd_data *hapd,
@@ -312,7 +312,7 @@
+ return hapd->driver->get_edcca(hapd->drv_priv, mode, value);
+}
diff --git a/src/ap/ap_drv_ops.h b/src/ap/ap_drv_ops.h
-index 331b0eaf4..8806217bb 100644
+index 331b0ea..8806217 100644
--- a/src/ap/ap_drv_ops.h
+++ b/src/ap/ap_drv_ops.h
@@ -144,6 +144,10 @@ int hostapd_drv_set_secure_ranging_ctx(struct hostapd_data *hapd,
@@ -327,10 +327,10 @@
#include "drivers/driver.h"
diff --git a/src/ap/hostapd.c b/src/ap/hostapd.c
-index 0b7d2c1f4..b67698a72 100644
+index 96ab02b..b34c9d2 100644
--- a/src/ap/hostapd.c
+++ b/src/ap/hostapd.c
-@@ -2559,6 +2559,13 @@ dfs_offload:
+@@ -2511,6 +2511,13 @@ dfs_offload:
}
#endif /* CONFIG_MESH */
@@ -345,7 +345,7 @@
iface->bss[0]->conf->iface);
if (iface->interfaces && iface->interfaces->terminate_on_error > 0)
diff --git a/src/common/mtk_vendor.h b/src/common/mtk_vendor.h
-index 4a19d2fc9..6121857dd 100644
+index 4a19d2f..6121857 100644
--- a/src/common/mtk_vendor.h
+++ b/src/common/mtk_vendor.h
@@ -30,14 +30,22 @@ enum mtk_vendor_attr_edcca_ctrl {
@@ -378,7 +378,7 @@
[MTK_VENDOR_ATTR_EDCCA_CTRL_MODE] = { .type = NLA_U8 },
[MTK_VENDOR_ATTR_EDCCA_CTRL_PRI20_VAL] = { .type = NLA_U8 },
diff --git a/src/drivers/driver.h b/src/drivers/driver.h
-index 969cbda6b..443c4a79d 100644
+index 969cbda..443c4a7 100644
--- a/src/drivers/driver.h
+++ b/src/drivers/driver.h
@@ -5080,6 +5080,10 @@ struct wpa_driver_ops {
@@ -393,7 +393,7 @@
/**
diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c
-index 37e156fc8..c4e0bc9fe 100644
+index 7867e69..5a3e208 100644
--- a/src/drivers/driver_nl80211.c
+++ b/src/drivers/driver_nl80211.c
@@ -37,6 +37,8 @@
@@ -405,7 +405,7 @@
#ifndef NETLINK_CAP_ACK
-@@ -13635,6 +13637,174 @@ static int testing_nl80211_radio_disable(void *priv, int disabled)
+@@ -13632,6 +13634,174 @@ static int testing_nl80211_radio_disable(void *priv, int disabled)
#endif /* CONFIG_TESTING_OPTIONS */
@@ -580,7 +580,7 @@
const struct wpa_driver_ops wpa_driver_nl80211_ops = {
.name = "nl80211",
-@@ -13789,4 +13959,8 @@ const struct wpa_driver_ops wpa_driver_nl80211_ops = {
+@@ -13786,4 +13956,8 @@ const struct wpa_driver_ops wpa_driver_nl80211_ops = {
.register_frame = testing_nl80211_register_frame,
.radio_disable = testing_nl80211_radio_disable,
#endif /* CONFIG_TESTING_OPTIONS */
@@ -590,7 +590,7 @@
+ .get_edcca = nl80211_get_edcca,
};
diff --git a/src/drivers/driver_nl80211.h b/src/drivers/driver_nl80211.h
-index aee8c4512..51b3fbec8 100644
+index aee8c45..51b3fbe 100644
--- a/src/drivers/driver_nl80211.h
+++ b/src/drivers/driver_nl80211.h
@@ -202,6 +202,7 @@ struct wpa_driver_nl80211_data {
@@ -602,7 +602,7 @@
u64 vendor_scan_cookie;
u64 remain_on_chan_cookie;
diff --git a/src/drivers/driver_nl80211_capa.c b/src/drivers/driver_nl80211_capa.c
-index 5e6406885..5dadf2450 100644
+index 5e64068..5dadf24 100644
--- a/src/drivers/driver_nl80211_capa.c
+++ b/src/drivers/driver_nl80211_capa.c
@@ -18,6 +18,7 @@
@@ -627,5 +627,5 @@
wpa_printf(MSG_DEBUG, "nl80211: Supported vendor command: vendor_id=0x%x subcmd=%u",
--
-2.39.2
+2.18.0
diff --git a/recipes-wifi/hostapd/files/patches-2.10.3/mtk-0006-hostapd-mtk-Add-hostapd-MU-SET-GET-control.patch b/recipes-wifi/hostapd/files/patches-2.10.3/mtk-0006-hostapd-mtk-Add-hostapd-MU-SET-GET-control.patch
index 747cafe..7ae38e3 100644
--- a/recipes-wifi/hostapd/files/patches-2.10.3/mtk-0006-hostapd-mtk-Add-hostapd-MU-SET-GET-control.patch
+++ b/recipes-wifi/hostapd/files/patches-2.10.3/mtk-0006-hostapd-mtk-Add-hostapd-MU-SET-GET-control.patch
@@ -1,7 +1,7 @@
-From 8bfd442787c9b455d73a157f5879421b0b1ca9d4 Mon Sep 17 00:00:00 2001
+From 2ae0d6fb6b676f76081a9edd3416d93b26091400 Mon Sep 17 00:00:00 2001
From: TomLiu <tomml.liu@mediatek.com>
Date: Tue, 9 Aug 2022 10:23:44 -0700
-Subject: [PATCH 06/32] hostapd: mtk: Add hostapd MU SET/GET control
+Subject: [PATCH 06/40] hostapd: mtk: Add hostapd MU SET/GET control
---
hostapd/config_file.c | 9 +++
@@ -20,10 +20,10 @@
13 files changed, 251 insertions(+)
diff --git a/hostapd/config_file.c b/hostapd/config_file.c
-index 339d6915e..1918d0340 100644
+index 1fc6456..0e67796 100644
--- a/hostapd/config_file.c
+++ b/hostapd/config_file.c
-@@ -3679,6 +3679,15 @@ static int hostapd_config_fill(struct hostapd_config *conf,
+@@ -3677,6 +3677,15 @@ static int hostapd_config_fill(struct hostapd_config *conf,
return 1;
}
conf->mbssid = mbssid;
@@ -40,10 +40,10 @@
} else if (os_strcmp(buf, "max_listen_interval") == 0) {
bss->max_listen_interval = atoi(pos);
diff --git a/hostapd/ctrl_iface.c b/hostapd/ctrl_iface.c
-index d8afba992..342cec820 100644
+index cad3f86..c5d92b0 100644
--- a/hostapd/ctrl_iface.c
+++ b/hostapd/ctrl_iface.c
-@@ -3551,6 +3551,63 @@ hostapd_ctrl_iface_get_edcca(struct hostapd_data *hapd, char *cmd, char *buf,
+@@ -3488,6 +3488,63 @@ hostapd_ctrl_iface_get_edcca(struct hostapd_data *hapd, char *cmd, char *buf,
}
@@ -107,7 +107,7 @@
static int hostapd_ctrl_iface_receive_process(struct hostapd_data *hapd,
char *buf, char *reply,
int reply_size,
-@@ -4112,6 +4169,11 @@ static int hostapd_ctrl_iface_receive_process(struct hostapd_data *hapd,
+@@ -4047,6 +4104,11 @@ static int hostapd_ctrl_iface_receive_process(struct hostapd_data *hapd,
} else if (os_strncmp(buf, "GET_EDCCA ", 10) == 0) {
reply_len = hostapd_ctrl_iface_get_edcca(hapd, buf+10, reply,
reply_size);
@@ -120,7 +120,7 @@
os_memcpy(reply, "UNKNOWN COMMAND\n", 16);
reply_len = 16;
diff --git a/hostapd/hostapd_cli.c b/hostapd/hostapd_cli.c
-index dfc996d49..98892ee9d 100644
+index dfc996d..98892ee 100644
--- a/hostapd/hostapd_cli.c
+++ b/hostapd/hostapd_cli.c
@@ -1400,6 +1400,20 @@ static int hostapd_cli_cmd_driver_flags(struct wpa_ctrl *ctrl, int argc,
@@ -156,7 +156,7 @@
{ "dpp_qr_code", hostapd_cli_cmd_dpp_qr_code, NULL,
"report a scanned DPP URI from a QR Code" },
diff --git a/src/ap/ap_config.c b/src/ap/ap_config.c
-index 35ea6b7f3..5d04e60c1 100644
+index 8e56d10..cf7f563 100644
--- a/src/ap/ap_config.c
+++ b/src/ap/ap_config.c
@@ -281,6 +281,7 @@ struct hostapd_config * hostapd_config_defaults(void)
@@ -168,10 +168,10 @@
/* The third octet of the country string uses an ASCII space character
diff --git a/src/ap/ap_config.h b/src/ap/ap_config.h
-index 9186fbda8..3df378ed2 100644
+index 0e829c0..0bd6254 100644
--- a/src/ap/ap_config.h
+++ b/src/ap/ap_config.h
-@@ -1144,6 +1144,7 @@ struct hostapd_config {
+@@ -1143,6 +1143,7 @@ struct hostapd_config {
u8 he_6ghz_tx_ant_pat;
u8 he_6ghz_reg_pwr_type;
bool require_he;
@@ -180,7 +180,7 @@
/* VHT enable/disable config from CHAN_SWITCH */
diff --git a/src/ap/ap_drv_ops.c b/src/ap/ap_drv_ops.c
-index 99ba973aa..44f494ed9 100644
+index 99ba973..44f494e 100644
--- a/src/ap/ap_drv_ops.c
+++ b/src/ap/ap_drv_ops.c
@@ -1161,3 +1161,17 @@ int hostapd_drv_get_edcca(struct hostapd_data *hapd, const u8 mode, u8 *value)
@@ -202,7 +202,7 @@
+ return hapd->driver->mu_dump(hapd->drv_priv, mu_onoff);
+}
diff --git a/src/ap/ap_drv_ops.h b/src/ap/ap_drv_ops.h
-index 8806217bb..6e0cf814c 100644
+index 8806217..6e0cf81 100644
--- a/src/ap/ap_drv_ops.h
+++ b/src/ap/ap_drv_ops.h
@@ -148,6 +148,8 @@ int hostapd_drv_configure_edcca_enable(struct hostapd_data *hapd);
@@ -215,10 +215,10 @@
#include "drivers/driver.h"
diff --git a/src/ap/hostapd.c b/src/ap/hostapd.c
-index b67698a72..aa0568175 100644
+index b34c9d2..4251699 100644
--- a/src/ap/hostapd.c
+++ b/src/ap/hostapd.c
-@@ -2565,6 +2565,8 @@ dfs_offload:
+@@ -2517,6 +2517,8 @@ dfs_offload:
if (hostapd_drv_configure_edcca_threshold(hapd,
hapd->iconf->edcca_threshold) < 0)
goto fail;
@@ -228,7 +228,7 @@
wpa_printf(MSG_DEBUG, "%s: Setup of interface done.",
iface->bss[0]->conf->iface);
diff --git a/src/common/mtk_vendor.h b/src/common/mtk_vendor.h
-index 6121857dd..60bc4cd4c 100644
+index 6121857..60bc4cd 100644
--- a/src/common/mtk_vendor.h
+++ b/src/common/mtk_vendor.h
@@ -10,6 +10,8 @@ enum mtk_nl80211_vendor_subcmds {
@@ -261,7 +261,7 @@
#define ETH_ALEN 6
diff --git a/src/drivers/driver.h b/src/drivers/driver.h
-index 443c4a79d..1471ba2ef 100644
+index 443c4a7..1471ba2 100644
--- a/src/drivers/driver.h
+++ b/src/drivers/driver.h
@@ -176,6 +176,11 @@ struct hostapd_channel_data {
@@ -292,10 +292,10 @@
/**
diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c
-index c4e0bc9fe..e7bfc35fa 100644
+index 5a3e208..8e8a4fd 100644
--- a/src/drivers/driver_nl80211.c
+++ b/src/drivers/driver_nl80211.c
-@@ -13500,6 +13500,114 @@ fail:
+@@ -13497,6 +13497,114 @@ fail:
}
@@ -410,7 +410,7 @@
#ifdef CONFIG_DPP
static int nl80211_dpp_listen(void *priv, bool enable)
{
-@@ -13950,6 +14058,8 @@ const struct wpa_driver_ops wpa_driver_nl80211_ops = {
+@@ -13947,6 +14055,8 @@ const struct wpa_driver_ops wpa_driver_nl80211_ops = {
.update_connect_params = nl80211_update_connection_params,
.send_external_auth_status = nl80211_send_external_auth_status,
.set_4addr_mode = nl80211_set_4addr_mode,
@@ -420,7 +420,7 @@
.dpp_listen = nl80211_dpp_listen,
#endif /* CONFIG_DPP */
diff --git a/src/drivers/driver_nl80211.h b/src/drivers/driver_nl80211.h
-index 51b3fbec8..bd5d28404 100644
+index 51b3fbe..bd5d284 100644
--- a/src/drivers/driver_nl80211.h
+++ b/src/drivers/driver_nl80211.h
@@ -203,6 +203,7 @@ struct wpa_driver_nl80211_data {
@@ -432,7 +432,7 @@
u64 vendor_scan_cookie;
u64 remain_on_chan_cookie;
diff --git a/src/drivers/driver_nl80211_capa.c b/src/drivers/driver_nl80211_capa.c
-index 5dadf2450..ac66a916b 100644
+index 5dadf24..ac66a91 100644
--- a/src/drivers/driver_nl80211_capa.c
+++ b/src/drivers/driver_nl80211_capa.c
@@ -1113,6 +1113,9 @@ static int wiphy_info_handler(struct nl_msg *msg, void *arg)
@@ -446,5 +446,5 @@
}
--
-2.39.2
+2.18.0
diff --git a/recipes-wifi/hostapd/files/patches-2.10.3/mtk-0007-hostapd-mtk-Add-three-wire-PTA-ctrl-hostapd-vendor-c.patch b/recipes-wifi/hostapd/files/patches-2.10.3/mtk-0007-hostapd-mtk-Add-three-wire-PTA-ctrl-hostapd-vendor-c.patch
index 6f55c61..0488ba3 100644
--- a/recipes-wifi/hostapd/files/patches-2.10.3/mtk-0007-hostapd-mtk-Add-three-wire-PTA-ctrl-hostapd-vendor-c.patch
+++ b/recipes-wifi/hostapd/files/patches-2.10.3/mtk-0007-hostapd-mtk-Add-three-wire-PTA-ctrl-hostapd-vendor-c.patch
@@ -1,7 +1,7 @@
-From 9b68a2d7cbffa1c1ee28c6a785649d90b621b95b Mon Sep 17 00:00:00 2001
+From 74fde855e7d167f93908a70b50b029c42b796be8 Mon Sep 17 00:00:00 2001
From: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
Date: Fri, 2 Sep 2022 01:03:23 +0800
-Subject: [PATCH 07/32] hostapd: mtk: Add three wire PTA ctrl hostapd vendor
+Subject: [PATCH 07/40] hostapd: mtk: Add three wire PTA ctrl hostapd vendor
command
Signed-off-by: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
@@ -20,10 +20,10 @@
11 files changed, 93 insertions(+)
diff --git a/hostapd/config_file.c b/hostapd/config_file.c
-index 1918d0340..01880249d 100644
+index 0e67796..c716630 100644
--- a/hostapd/config_file.c
+++ b/hostapd/config_file.c
-@@ -4848,6 +4848,10 @@ static int hostapd_config_fill(struct hostapd_config *conf,
+@@ -4846,6 +4846,10 @@ static int hostapd_config_fill(struct hostapd_config *conf,
return 1;
}
conf->edcca_compensation = (s8) val;
@@ -35,7 +35,7 @@
wpa_printf(MSG_ERROR,
"Line %d: unknown configuration item '%s'",
diff --git a/src/ap/ap_config.c b/src/ap/ap_config.c
-index 5d04e60c1..8a1d51382 100644
+index cf7f563..8b11545 100644
--- a/src/ap/ap_config.c
+++ b/src/ap/ap_config.c
@@ -298,6 +298,7 @@ struct hostapd_config * hostapd_config_defaults(void)
@@ -47,10 +47,10 @@
return conf;
}
diff --git a/src/ap/ap_config.h b/src/ap/ap_config.h
-index 3df378ed2..e42656f82 100644
+index 0bd6254..8f4f79e 100644
--- a/src/ap/ap_config.h
+++ b/src/ap/ap_config.h
-@@ -1196,6 +1196,19 @@ struct hostapd_config {
+@@ -1195,6 +1195,19 @@ struct hostapd_config {
u8 edcca_enable;
s8 edcca_compensation;
int *edcca_threshold;
@@ -71,7 +71,7 @@
enum edcca_mode {
diff --git a/src/ap/ap_drv_ops.c b/src/ap/ap_drv_ops.c
-index 44f494ed9..2f15f99f4 100644
+index 44f494e..2f15f99 100644
--- a/src/ap/ap_drv_ops.c
+++ b/src/ap/ap_drv_ops.c
@@ -1175,3 +1175,14 @@ int hostapd_drv_mu_dump(struct hostapd_data *hapd, u8 *mu_onoff)
@@ -90,7 +90,7 @@
+ return hapd->driver->three_wire_ctrl(hapd->drv_priv, hapd->iconf->three_wire_enable);
+}
diff --git a/src/ap/ap_drv_ops.h b/src/ap/ap_drv_ops.h
-index 6e0cf814c..960a110b7 100644
+index 6e0cf81..960a110 100644
--- a/src/ap/ap_drv_ops.h
+++ b/src/ap/ap_drv_ops.h
@@ -150,6 +150,7 @@ int hostapd_drv_configure_edcca_threshold(struct hostapd_data *hapd,
@@ -102,10 +102,10 @@
#include "drivers/driver.h"
diff --git a/src/ap/hostapd.c b/src/ap/hostapd.c
-index aa0568175..eb39b9ae3 100644
+index 4251699..798852e 100644
--- a/src/ap/hostapd.c
+++ b/src/ap/hostapd.c
-@@ -2567,6 +2567,8 @@ dfs_offload:
+@@ -2519,6 +2519,8 @@ dfs_offload:
goto fail;
if (hostapd_drv_mu_ctrl(hapd) < 0)
goto fail;
@@ -115,7 +115,7 @@
wpa_printf(MSG_DEBUG, "%s: Setup of interface done.",
iface->bss[0]->conf->iface);
diff --git a/src/common/mtk_vendor.h b/src/common/mtk_vendor.h
-index 60bc4cd4c..99ecbaf71 100644
+index 60bc4cd..99ecbaf 100644
--- a/src/common/mtk_vendor.h
+++ b/src/common/mtk_vendor.h
@@ -13,6 +13,7 @@ enum mtk_nl80211_vendor_subcmds {
@@ -149,7 +149,7 @@
MTK_VENDOR_ATTR_CSI_CTRL_UNSPEC,
diff --git a/src/drivers/driver.h b/src/drivers/driver.h
-index 1471ba2ef..cd7afef33 100644
+index 1471ba2..cd7afef 100644
--- a/src/drivers/driver.h
+++ b/src/drivers/driver.h
@@ -5097,6 +5097,14 @@ struct wpa_driver_ops {
@@ -168,10 +168,10 @@
/**
diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c
-index e7bfc35fa..86d08a721 100644
+index 8e8a4fd..621515d 100644
--- a/src/drivers/driver_nl80211.c
+++ b/src/drivers/driver_nl80211.c
-@@ -13913,6 +13913,38 @@ static int nl80211_get_edcca(void *priv, const u8 mode, u8 *value)
+@@ -13910,6 +13910,38 @@ static int nl80211_get_edcca(void *priv, const u8 mode, u8 *value)
return ret;
}
@@ -210,14 +210,14 @@
const struct wpa_driver_ops wpa_driver_nl80211_ops = {
.name = "nl80211",
-@@ -14073,4 +14105,5 @@ const struct wpa_driver_ops wpa_driver_nl80211_ops = {
+@@ -14070,4 +14102,5 @@ const struct wpa_driver_ops wpa_driver_nl80211_ops = {
.configure_edcca_enable = nl80211_configure_edcca_enable,
.configure_edcca_threshold = nl80211_configure_edcca_threshold,
.get_edcca = nl80211_get_edcca,
+ .three_wire_ctrl = nl80211_enable_three_wire,
};
diff --git a/src/drivers/driver_nl80211.h b/src/drivers/driver_nl80211.h
-index bd5d28404..99af8b075 100644
+index bd5d284..99af8b0 100644
--- a/src/drivers/driver_nl80211.h
+++ b/src/drivers/driver_nl80211.h
@@ -204,6 +204,7 @@ struct wpa_driver_nl80211_data {
@@ -229,7 +229,7 @@
u64 vendor_scan_cookie;
u64 remain_on_chan_cookie;
diff --git a/src/drivers/driver_nl80211_capa.c b/src/drivers/driver_nl80211_capa.c
-index ac66a916b..3ff47f3e8 100644
+index ac66a91..3ff47f3 100644
--- a/src/drivers/driver_nl80211_capa.c
+++ b/src/drivers/driver_nl80211_capa.c
@@ -1116,6 +1116,9 @@ static int wiphy_info_handler(struct nl_msg *msg, void *arg)
@@ -243,5 +243,5 @@
}
--
-2.39.2
+2.18.0
diff --git a/recipes-wifi/hostapd/files/patches-2.10.3/mtk-0008-hostapd-mtk-Add-hostapd-iBF-control.patch b/recipes-wifi/hostapd/files/patches-2.10.3/mtk-0008-hostapd-mtk-Add-hostapd-iBF-control.patch
index 8c1d923..6d807ee 100644
--- a/recipes-wifi/hostapd/files/patches-2.10.3/mtk-0008-hostapd-mtk-Add-hostapd-iBF-control.patch
+++ b/recipes-wifi/hostapd/files/patches-2.10.3/mtk-0008-hostapd-mtk-Add-hostapd-iBF-control.patch
@@ -1,7 +1,7 @@
-From 0ec269fc9ad3ceb566093ee1b67ea73da7efa8e4 Mon Sep 17 00:00:00 2001
+From a527e4f9a557f751fa0b3ef8b3d40e5edef56d38 Mon Sep 17 00:00:00 2001
From: mtk27835 <shurong.wen@mediatek.com>
Date: Wed, 7 Sep 2022 14:41:51 -0700
-Subject: [PATCH 08/32] hostapd: mtk: Add hostapd iBF control
+Subject: [PATCH 08/40] hostapd: mtk: Add hostapd iBF control
Signed-off-by: mtk27835 <shurong.wen@mediatek.com>
---
@@ -21,10 +21,10 @@
13 files changed, 224 insertions(+), 1 deletion(-)
diff --git a/hostapd/config_file.c b/hostapd/config_file.c
-index 01880249d..81bfe81d5 100644
+index c716630..dea124a 100644
--- a/hostapd/config_file.c
+++ b/hostapd/config_file.c
-@@ -4852,6 +4852,9 @@ static int hostapd_config_fill(struct hostapd_config *conf,
+@@ -4850,6 +4850,9 @@ static int hostapd_config_fill(struct hostapd_config *conf,
u8 en = atoi(pos);
conf->three_wire_enable = en;
@@ -35,10 +35,10 @@
wpa_printf(MSG_ERROR,
"Line %d: unknown configuration item '%s'",
diff --git a/hostapd/ctrl_iface.c b/hostapd/ctrl_iface.c
-index 342cec820..f2cb7af1e 100644
+index c5d92b0..7d7ebe3 100644
--- a/hostapd/ctrl_iface.c
+++ b/hostapd/ctrl_iface.c
-@@ -3608,6 +3608,30 @@ hostapd_ctrl_iface_get_mu(struct hostapd_data *hapd, char *buf,
+@@ -3545,6 +3545,30 @@ hostapd_ctrl_iface_get_mu(struct hostapd_data *hapd, char *buf,
}
@@ -69,7 +69,7 @@
static int hostapd_ctrl_iface_receive_process(struct hostapd_data *hapd,
char *buf, char *reply,
int reply_size,
-@@ -4174,6 +4198,8 @@ static int hostapd_ctrl_iface_receive_process(struct hostapd_data *hapd,
+@@ -4109,6 +4133,8 @@ static int hostapd_ctrl_iface_receive_process(struct hostapd_data *hapd,
reply_size);
} else if (os_strncmp(buf, "GET_MU", 6) == 0) {
reply_len = hostapd_ctrl_iface_get_mu(hapd, reply, reply_size);
@@ -79,7 +79,7 @@
os_memcpy(reply, "UNKNOWN COMMAND\n", 16);
reply_len = 16;
diff --git a/hostapd/hostapd_cli.c b/hostapd/hostapd_cli.c
-index 98892ee9d..4fa2d323d 100644
+index 98892ee..4fa2d32 100644
--- a/hostapd/hostapd_cli.c
+++ b/hostapd/hostapd_cli.c
@@ -1606,6 +1606,13 @@ static int hostapd_cli_cmd_driver(struct wpa_ctrl *ctrl, int argc, char *argv[])
@@ -106,7 +106,7 @@
};
diff --git a/src/ap/ap_config.c b/src/ap/ap_config.c
-index 8a1d51382..7fd9dce48 100644
+index 8b11545..c9b9683 100644
--- a/src/ap/ap_config.c
+++ b/src/ap/ap_config.c
@@ -299,6 +299,7 @@ struct hostapd_config * hostapd_config_defaults(void)
@@ -118,10 +118,10 @@
return conf;
}
diff --git a/src/ap/ap_config.h b/src/ap/ap_config.h
-index e42656f82..3a3d2b542 100644
+index 8f4f79e..9758439 100644
--- a/src/ap/ap_config.h
+++ b/src/ap/ap_config.h
-@@ -1197,6 +1197,7 @@ struct hostapd_config {
+@@ -1196,6 +1196,7 @@ struct hostapd_config {
s8 edcca_compensation;
int *edcca_threshold;
u8 three_wire_enable;
@@ -129,7 +129,7 @@
};
enum three_wire_mode {
-@@ -1322,6 +1323,7 @@ hostapd_set_oper_centr_freq_seg1_idx(struct hostapd_config *conf,
+@@ -1321,6 +1322,7 @@ hostapd_set_oper_centr_freq_seg1_idx(struct hostapd_config *conf,
conf->vht_oper_centr_freq_seg1_idx = oper_centr_freq_seg1_idx;
}
@@ -138,7 +138,7 @@
int hostapd_mac_comp(const void *a, const void *b);
struct hostapd_config * hostapd_config_defaults(void);
diff --git a/src/ap/ap_drv_ops.c b/src/ap/ap_drv_ops.c
-index 2f15f99f4..41e76aa54 100644
+index 2f15f99..41e76aa 100644
--- a/src/ap/ap_drv_ops.c
+++ b/src/ap/ap_drv_ops.c
@@ -1186,3 +1186,17 @@ int hostapd_drv_three_wire_ctrl(struct hostapd_data *hapd)
@@ -161,7 +161,7 @@
+}
\ No newline at end of file
diff --git a/src/ap/ap_drv_ops.h b/src/ap/ap_drv_ops.h
-index 960a110b7..3f1df5d2c 100644
+index 960a110..3f1df5d 100644
--- a/src/ap/ap_drv_ops.h
+++ b/src/ap/ap_drv_ops.h
@@ -151,6 +151,8 @@ int hostapd_drv_get_edcca(struct hostapd_data *hapd, const u8 mode, u8 *value);
@@ -174,10 +174,10 @@
#include "drivers/driver.h"
diff --git a/src/ap/hostapd.c b/src/ap/hostapd.c
-index eb39b9ae3..4212f3fcd 100644
+index 798852e..a513236 100644
--- a/src/ap/hostapd.c
+++ b/src/ap/hostapd.c
-@@ -2569,6 +2569,8 @@ dfs_offload:
+@@ -2521,6 +2521,8 @@ dfs_offload:
goto fail;
if (hostapd_drv_three_wire_ctrl(hapd) < 0)
goto fail;
@@ -187,7 +187,7 @@
wpa_printf(MSG_DEBUG, "%s: Setup of interface done.",
iface->bss[0]->conf->iface);
diff --git a/src/common/mtk_vendor.h b/src/common/mtk_vendor.h
-index 99ecbaf71..9811f266e 100644
+index 99ecbaf..9811f26 100644
--- a/src/common/mtk_vendor.h
+++ b/src/common/mtk_vendor.h
@@ -13,7 +13,8 @@ enum mtk_nl80211_vendor_subcmds {
@@ -240,7 +240,7 @@
#define CSI_MAX_COUNT 256
#define ETH_ALEN 6
diff --git a/src/drivers/driver.h b/src/drivers/driver.h
-index cd7afef33..7ac02845b 100644
+index cd7afef..7ac0284 100644
--- a/src/drivers/driver.h
+++ b/src/drivers/driver.h
@@ -181,6 +181,11 @@ struct hostapd_channel_data {
@@ -277,10 +277,10 @@
/**
diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c
-index 86d08a721..ec85621ab 100644
+index 621515d..936a4f8 100644
--- a/src/drivers/driver_nl80211.c
+++ b/src/drivers/driver_nl80211.c
-@@ -13946,6 +13946,112 @@ static int nl80211_enable_three_wire(void *priv, const u8 three_wire_enable)
+@@ -13943,6 +13943,112 @@ static int nl80211_enable_three_wire(void *priv, const u8 three_wire_enable)
return ret;
}
@@ -393,7 +393,7 @@
const struct wpa_driver_ops wpa_driver_nl80211_ops = {
.name = "nl80211",
.desc = "Linux nl80211/cfg80211",
-@@ -14106,4 +14212,6 @@ const struct wpa_driver_ops wpa_driver_nl80211_ops = {
+@@ -14103,4 +14209,6 @@ const struct wpa_driver_ops wpa_driver_nl80211_ops = {
.configure_edcca_threshold = nl80211_configure_edcca_threshold,
.get_edcca = nl80211_get_edcca,
.three_wire_ctrl = nl80211_enable_three_wire,
@@ -401,7 +401,7 @@
+ .ibf_dump = nl80211_ibf_dump,
};
diff --git a/src/drivers/driver_nl80211.h b/src/drivers/driver_nl80211.h
-index 99af8b075..4e64e7d31 100644
+index 99af8b0..4e64e7d 100644
--- a/src/drivers/driver_nl80211.h
+++ b/src/drivers/driver_nl80211.h
@@ -205,6 +205,7 @@ struct wpa_driver_nl80211_data {
@@ -413,7 +413,7 @@
u64 vendor_scan_cookie;
u64 remain_on_chan_cookie;
diff --git a/src/drivers/driver_nl80211_capa.c b/src/drivers/driver_nl80211_capa.c
-index 3ff47f3e8..7ad15bafd 100644
+index 3ff47f3..7ad15ba 100644
--- a/src/drivers/driver_nl80211_capa.c
+++ b/src/drivers/driver_nl80211_capa.c
@@ -1119,6 +1119,9 @@ static int wiphy_info_handler(struct nl_msg *msg, void *arg)
@@ -427,5 +427,5 @@
}
--
-2.39.2
+2.18.0
diff --git a/recipes-wifi/hostapd/files/patches-2.10.3/mtk-0009-hostapd-mtk-Do-not-include-HE-capab-IE-if-associated.patch b/recipes-wifi/hostapd/files/patches-2.10.3/mtk-0009-hostapd-mtk-Do-not-include-HE-capab-IE-if-associated.patch
index c22efa9..40fccf5 100644
--- a/recipes-wifi/hostapd/files/patches-2.10.3/mtk-0009-hostapd-mtk-Do-not-include-HE-capab-IE-if-associated.patch
+++ b/recipes-wifi/hostapd/files/patches-2.10.3/mtk-0009-hostapd-mtk-Do-not-include-HE-capab-IE-if-associated.patch
@@ -1,7 +1,7 @@
-From 63e4c07d235e07d0616ecb1328067f7157271c30 Mon Sep 17 00:00:00 2001
+From 46e29c26ddaa503b6af4dc33784a2998c453d6c9 Mon Sep 17 00:00:00 2001
From: Howard Hsu <howard-yh.hsu@mediatek.com>
Date: Thu, 22 Sep 2022 16:08:09 +0800
-Subject: [PATCH 09/32] hostapd: mtk: Do not include HE capab IE if associated
+Subject: [PATCH 09/40] hostapd: mtk: Do not include HE capab IE if associated
sta's HE capab IE is invalid
---
@@ -9,7 +9,7 @@
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/ap/ieee802_11.c b/src/ap/ieee802_11.c
-index db48b7cb7..1bf5bea9d 100644
+index db48b7c..1bf5bea 100644
--- a/src/ap/ieee802_11.c
+++ b/src/ap/ieee802_11.c
@@ -4843,7 +4843,8 @@ static u16 send_assoc_resp(struct hostapd_data *hapd, struct sta_info *sta,
@@ -23,5 +23,5 @@
p = hostapd_eid_he_operation(hapd, p);
p = hostapd_eid_cca(hapd, p);
--
-2.39.2
+2.18.0
diff --git a/recipes-wifi/hostapd/files/patches-2.10.3/mtk-0010-hostapd-mtk-Add-DFS-detection-mode.patch b/recipes-wifi/hostapd/files/patches-2.10.3/mtk-0010-hostapd-mtk-Add-DFS-detection-mode.patch
index 6bb78ff..1b4dadf 100644
--- a/recipes-wifi/hostapd/files/patches-2.10.3/mtk-0010-hostapd-mtk-Add-DFS-detection-mode.patch
+++ b/recipes-wifi/hostapd/files/patches-2.10.3/mtk-0010-hostapd-mtk-Add-DFS-detection-mode.patch
@@ -1,7 +1,7 @@
-From 28af790c74e862e0c23ced4e458e4149e69a1427 Mon Sep 17 00:00:00 2001
+From a257091386c0bf12de2934730b874d240f34d1bb Mon Sep 17 00:00:00 2001
From: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
Date: Mon, 20 Feb 2023 14:55:49 +0800
-Subject: [PATCH 10/32] hostapd: mtk: Add DFS detection mode
+Subject: [PATCH 10/40] hostapd: mtk: Add DFS detection mode
Add DFS detection mode for testing radar detection rate.
If DFS detection mode is on, AP will not switch channels when receiving
@@ -17,10 +17,10 @@
4 files changed, 50 insertions(+)
diff --git a/hostapd/config_file.c b/hostapd/config_file.c
-index 81bfe81d5..d4eed008c 100644
+index dea124a..a4a8e71 100644
--- a/hostapd/config_file.c
+++ b/hostapd/config_file.c
-@@ -4855,6 +4855,10 @@ static int hostapd_config_fill(struct hostapd_config *conf,
+@@ -4853,6 +4853,10 @@ static int hostapd_config_fill(struct hostapd_config *conf,
} else if (os_strcmp(buf, "ibf_enable") == 0) { /*ibf setting is per device*/
int val = atoi(pos);
conf->ibf_enable = !!val;
@@ -32,10 +32,10 @@
wpa_printf(MSG_ERROR,
"Line %d: unknown configuration item '%s'",
diff --git a/hostapd/ctrl_iface.c b/hostapd/ctrl_iface.c
-index f2cb7af1e..0d978be7e 100644
+index 7d7ebe3..d8f6663 100644
--- a/hostapd/ctrl_iface.c
+++ b/hostapd/ctrl_iface.c
-@@ -3632,6 +3632,26 @@ hostapd_ctrl_iface_get_ibf(struct hostapd_data *hapd, char *buf,
+@@ -3569,6 +3569,26 @@ hostapd_ctrl_iface_get_ibf(struct hostapd_data *hapd, char *buf,
}
@@ -62,7 +62,7 @@
static int hostapd_ctrl_iface_receive_process(struct hostapd_data *hapd,
char *buf, char *reply,
int reply_size,
-@@ -4200,6 +4220,9 @@ static int hostapd_ctrl_iface_receive_process(struct hostapd_data *hapd,
+@@ -4135,6 +4155,9 @@ static int hostapd_ctrl_iface_receive_process(struct hostapd_data *hapd,
reply_len = hostapd_ctrl_iface_get_mu(hapd, reply, reply_size);
} else if (os_strncmp(buf, "GET_IBF", 7) == 0) {
reply_len = hostapd_ctrl_iface_get_ibf(hapd, reply, reply_size);
@@ -73,10 +73,10 @@
os_memcpy(reply, "UNKNOWN COMMAND\n", 16);
reply_len = 16;
diff --git a/src/ap/ap_config.h b/src/ap/ap_config.h
-index 3a3d2b542..7b3e21f7b 100644
+index 9758439..c50c2e2 100644
--- a/src/ap/ap_config.h
+++ b/src/ap/ap_config.h
-@@ -1198,6 +1198,7 @@ struct hostapd_config {
+@@ -1197,6 +1197,7 @@ struct hostapd_config {
int *edcca_threshold;
u8 three_wire_enable;
u8 ibf_enable;
@@ -84,7 +84,7 @@
};
enum three_wire_mode {
-@@ -1212,6 +1213,18 @@ enum three_wire_mode {
+@@ -1211,6 +1212,18 @@ enum three_wire_mode {
NUM_THREE_WIRE_MODE - 1
};
@@ -104,7 +104,7 @@
EDCCA_MODE_FORCE_DISABLE = 0,
EDCCA_MODE_AUTO = 1,
diff --git a/src/ap/dfs.c b/src/ap/dfs.c
-index a19afb03f..644a7eae7 100644
+index a19afb0..644a7ea 100644
--- a/src/ap/dfs.c
+++ b/src/ap/dfs.c
@@ -1322,6 +1322,11 @@ hostapd_dfs_background_start_channel_switch(struct hostapd_iface *iface,
@@ -132,5 +132,5 @@
if (hostapd_csa_in_progress(iface))
return 0;
--
-2.39.2
+2.18.0
diff --git a/recipes-wifi/hostapd/files/patches-2.10.3/mtk-0011-hostapd-mtk-Add-DFS-offchan-channel-switch.patch b/recipes-wifi/hostapd/files/patches-2.10.3/mtk-0011-hostapd-mtk-Add-DFS-offchan-channel-switch.patch
index 058e0d5..11b11fc 100644
--- a/recipes-wifi/hostapd/files/patches-2.10.3/mtk-0011-hostapd-mtk-Add-DFS-offchan-channel-switch.patch
+++ b/recipes-wifi/hostapd/files/patches-2.10.3/mtk-0011-hostapd-mtk-Add-DFS-offchan-channel-switch.patch
@@ -1,7 +1,7 @@
-From 575a8605a68d47f7ecf45ab81f704cc49a8aef65 Mon Sep 17 00:00:00 2001
+From 4802aabaad0a2e7a02d32a365f6d8fec344d264c Mon Sep 17 00:00:00 2001
From: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
Date: Mon, 20 Feb 2023 14:56:55 +0800
-Subject: [PATCH 11/32] hostapd: mtk: Add DFS offchan channel switch
+Subject: [PATCH 11/40] hostapd: mtk: Add DFS offchan channel switch
Add DFS background chain channel switch command for testing purpose.
This feature is implemented via hostapd_cli command.
@@ -16,10 +16,10 @@
3 files changed, 96 insertions(+), 16 deletions(-)
diff --git a/hostapd/ctrl_iface.c b/hostapd/ctrl_iface.c
-index 0d978be7e..78eb80bf0 100644
+index d8f6663..2399979 100644
--- a/hostapd/ctrl_iface.c
+++ b/hostapd/ctrl_iface.c
-@@ -3652,6 +3652,76 @@ hostapd_ctrl_iface_set_dfs_detect_mode(struct hostapd_data *hapd, char *value,
+@@ -3589,6 +3589,76 @@ hostapd_ctrl_iface_set_dfs_detect_mode(struct hostapd_data *hapd, char *value,
}
@@ -96,7 +96,7 @@
static int hostapd_ctrl_iface_receive_process(struct hostapd_data *hapd,
char *buf, char *reply,
int reply_size,
-@@ -4223,6 +4293,8 @@ static int hostapd_ctrl_iface_receive_process(struct hostapd_data *hapd,
+@@ -4158,6 +4228,8 @@ static int hostapd_ctrl_iface_receive_process(struct hostapd_data *hapd,
} else if (os_strncmp(buf, "DFS_DETECT_MODE ", 16) == 0) {
reply_len = hostapd_ctrl_iface_set_dfs_detect_mode(hapd, buf + 16,
reply, reply_size);
@@ -106,7 +106,7 @@
os_memcpy(reply, "UNKNOWN COMMAND\n", 16);
reply_len = 16;
diff --git a/src/ap/dfs.c b/src/ap/dfs.c
-index 644a7eae7..48c5fc917 100644
+index 644a7ea..48c5fc9 100644
--- a/src/ap/dfs.c
+++ b/src/ap/dfs.c
@@ -19,13 +19,6 @@
@@ -156,7 +156,7 @@
if (!iface->conf->ieee80211ac && !iface->conf->ieee80211ax)
return;
diff --git a/src/ap/dfs.h b/src/ap/dfs.h
-index 606c1b393..c2556d2d9 100644
+index 606c1b3..c2556d2 100644
--- a/src/ap/dfs.h
+++ b/src/ap/dfs.h
@@ -9,6 +9,12 @@
@@ -188,5 +188,5 @@
#endif /* DFS_H */
--
-2.39.2
+2.18.0
diff --git a/recipes-wifi/hostapd/files/patches-2.10.3/mtk-0012-hostapd-mtk-Add-amsdu-set-get-ctrl.patch b/recipes-wifi/hostapd/files/patches-2.10.3/mtk-0012-hostapd-mtk-Add-amsdu-set-get-ctrl.patch
index b59fffc..aa32d0f 100644
--- a/recipes-wifi/hostapd/files/patches-2.10.3/mtk-0012-hostapd-mtk-Add-amsdu-set-get-ctrl.patch
+++ b/recipes-wifi/hostapd/files/patches-2.10.3/mtk-0012-hostapd-mtk-Add-amsdu-set-get-ctrl.patch
@@ -1,7 +1,7 @@
-From ae49d6fffebb8314cc36eb3ba2241f0e70ae8ce6 Mon Sep 17 00:00:00 2001
+From 4f54451e436ca42946b3f0f294b6e784d2f61862 Mon Sep 17 00:00:00 2001
From: Evelyn Tsai <evelyn.tsai@mediatek.com>
Date: Fri, 16 Dec 2022 03:57:11 +0800
-Subject: [PATCH 12/32] hostapd: mtk: Add amsdu set get ctrl
+Subject: [PATCH 12/40] hostapd: mtk: Add amsdu set get ctrl
---
hostapd/config_file.c | 9 +++
@@ -20,10 +20,10 @@
13 files changed, 207 insertions(+), 1 deletion(-)
diff --git a/hostapd/config_file.c b/hostapd/config_file.c
-index d4eed008c..ecd290717 100644
+index a4a8e71..d17e50e 100644
--- a/hostapd/config_file.c
+++ b/hostapd/config_file.c
-@@ -4859,6 +4859,15 @@ static int hostapd_config_fill(struct hostapd_config *conf,
+@@ -4857,6 +4857,15 @@ static int hostapd_config_fill(struct hostapd_config *conf,
u8 en = strtol(pos, NULL, 10);
conf->dfs_detect_mode = en;
@@ -40,10 +40,10 @@
wpa_printf(MSG_ERROR,
"Line %d: unknown configuration item '%s'",
diff --git a/hostapd/ctrl_iface.c b/hostapd/ctrl_iface.c
-index 78eb80bf0..ed17211e0 100644
+index 2399979..c54cbb9 100644
--- a/hostapd/ctrl_iface.c
+++ b/hostapd/ctrl_iface.c
-@@ -3722,6 +3722,30 @@ hostapd_ctrl_iface_set_offchan_ctrl(struct hostapd_data *hapd, char *cmd,
+@@ -3659,6 +3659,30 @@ hostapd_ctrl_iface_set_offchan_ctrl(struct hostapd_data *hapd, char *cmd,
}
@@ -74,7 +74,7 @@
static int hostapd_ctrl_iface_receive_process(struct hostapd_data *hapd,
char *buf, char *reply,
int reply_size,
-@@ -4295,6 +4319,8 @@ static int hostapd_ctrl_iface_receive_process(struct hostapd_data *hapd,
+@@ -4230,6 +4254,8 @@ static int hostapd_ctrl_iface_receive_process(struct hostapd_data *hapd,
reply, reply_size);
} else if (os_strncmp(buf, "SET_OFFCHAN_CTRL", 16) == 0) {
reply_len = hostapd_ctrl_iface_set_offchan_ctrl(hapd, buf + 16, reply, reply_size);
@@ -84,7 +84,7 @@
os_memcpy(reply, "UNKNOWN COMMAND\n", 16);
reply_len = 16;
diff --git a/hostapd/hostapd_cli.c b/hostapd/hostapd_cli.c
-index 4fa2d323d..d59373062 100644
+index 4fa2d32..d593730 100644
--- a/hostapd/hostapd_cli.c
+++ b/hostapd/hostapd_cli.c
@@ -1613,6 +1613,13 @@ static int hostapd_cli_cmd_get_ibf(struct wpa_ctrl *ctrl, int argc,
@@ -111,7 +111,7 @@
};
diff --git a/src/ap/ap_config.c b/src/ap/ap_config.c
-index 7fd9dce48..83e2ea121 100644
+index c9b9683..f519a76 100644
--- a/src/ap/ap_config.c
+++ b/src/ap/ap_config.c
@@ -300,6 +300,7 @@ struct hostapd_config * hostapd_config_defaults(void)
@@ -123,10 +123,10 @@
return conf;
}
diff --git a/src/ap/ap_config.h b/src/ap/ap_config.h
-index 7b3e21f7b..94056157b 100644
+index c50c2e2..b8f6680 100644
--- a/src/ap/ap_config.h
+++ b/src/ap/ap_config.h
-@@ -1199,6 +1199,7 @@ struct hostapd_config {
+@@ -1198,6 +1198,7 @@ struct hostapd_config {
u8 three_wire_enable;
u8 ibf_enable;
u8 dfs_detect_mode;
@@ -135,7 +135,7 @@
enum three_wire_mode {
diff --git a/src/ap/ap_drv_ops.c b/src/ap/ap_drv_ops.c
-index 41e76aa54..a7226cfa9 100644
+index 41e76aa..a7226cf 100644
--- a/src/ap/ap_drv_ops.c
+++ b/src/ap/ap_drv_ops.c
@@ -1199,4 +1199,18 @@ int hostapd_drv_ibf_dump(struct hostapd_data *hapd, u8 *ibf_enable)
@@ -159,7 +159,7 @@
}
\ No newline at end of file
diff --git a/src/ap/ap_drv_ops.h b/src/ap/ap_drv_ops.h
-index 3f1df5d2c..422cb5222 100644
+index 3f1df5d..422cb52 100644
--- a/src/ap/ap_drv_ops.h
+++ b/src/ap/ap_drv_ops.h
@@ -153,6 +153,8 @@ int hostapd_drv_mu_dump(struct hostapd_data *hapd, u8 *mu_onoff);
@@ -172,10 +172,10 @@
#include "drivers/driver.h"
diff --git a/src/ap/hostapd.c b/src/ap/hostapd.c
-index 4212f3fcd..abadd1ad0 100644
+index a513236..24e5df8 100644
--- a/src/ap/hostapd.c
+++ b/src/ap/hostapd.c
-@@ -2571,6 +2571,8 @@ dfs_offload:
+@@ -2523,6 +2523,8 @@ dfs_offload:
goto fail;
if (hostapd_drv_ibf_ctrl(hapd) < 0)
goto fail;
@@ -185,7 +185,7 @@
wpa_printf(MSG_DEBUG, "%s: Setup of interface done.",
iface->bss[0]->conf->iface);
diff --git a/src/common/mtk_vendor.h b/src/common/mtk_vendor.h
-index 9811f266e..7b4d7c11a 100644
+index 9811f26..7b4d7c1 100644
--- a/src/common/mtk_vendor.h
+++ b/src/common/mtk_vendor.h
@@ -170,7 +170,6 @@ enum mtk_vendor_attr_wireless_ctrl {
@@ -220,7 +220,7 @@
MTK_VENDOR_ATTR_RFEATURE_CTRL_UNSPEC,
diff --git a/src/drivers/driver.h b/src/drivers/driver.h
-index 7ac02845b..87a5a9b64 100644
+index 7ac0284..87a5a9b 100644
--- a/src/drivers/driver.h
+++ b/src/drivers/driver.h
@@ -5124,6 +5124,15 @@ struct wpa_driver_ops {
@@ -240,10 +240,10 @@
/**
diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c
-index ec85621ab..4ac8b6e0b 100644
+index 936a4f8..ce09d9f 100644
--- a/src/drivers/driver_nl80211.c
+++ b/src/drivers/driver_nl80211.c
-@@ -14052,6 +14052,118 @@ fail:
+@@ -14049,6 +14049,118 @@ fail:
return -ENOBUFS;
}
@@ -362,7 +362,7 @@
const struct wpa_driver_ops wpa_driver_nl80211_ops = {
.name = "nl80211",
.desc = "Linux nl80211/cfg80211",
-@@ -14214,4 +14326,6 @@ const struct wpa_driver_ops wpa_driver_nl80211_ops = {
+@@ -14211,4 +14323,6 @@ const struct wpa_driver_ops wpa_driver_nl80211_ops = {
.three_wire_ctrl = nl80211_enable_three_wire,
.ibf_ctrl = nl80211_ibf_enable,
.ibf_dump = nl80211_ibf_dump,
@@ -370,7 +370,7 @@
+ .amsdu_dump = nl80211_dump_amsdu,
};
diff --git a/src/drivers/driver_nl80211.h b/src/drivers/driver_nl80211.h
-index 4e64e7d31..0100314ba 100644
+index 4e64e7d..0100314 100644
--- a/src/drivers/driver_nl80211.h
+++ b/src/drivers/driver_nl80211.h
@@ -206,6 +206,7 @@ struct wpa_driver_nl80211_data {
@@ -382,7 +382,7 @@
u64 vendor_scan_cookie;
u64 remain_on_chan_cookie;
diff --git a/src/drivers/driver_nl80211_capa.c b/src/drivers/driver_nl80211_capa.c
-index 7ad15bafd..f14706d77 100644
+index 7ad15ba..f14706d 100644
--- a/src/drivers/driver_nl80211_capa.c
+++ b/src/drivers/driver_nl80211_capa.c
@@ -1122,6 +1122,9 @@ static int wiphy_info_handler(struct nl_msg *msg, void *arg)
@@ -396,5 +396,5 @@
}
--
-2.39.2
+2.18.0
diff --git a/recipes-wifi/hostapd/files/patches-2.10.3/mtk-0013-hostapd-mtk-Add-he_ldpc-configuration.patch b/recipes-wifi/hostapd/files/patches-2.10.3/mtk-0013-hostapd-mtk-Add-he_ldpc-configuration.patch
index 8a9696f..dd96623 100644
--- a/recipes-wifi/hostapd/files/patches-2.10.3/mtk-0013-hostapd-mtk-Add-he_ldpc-configuration.patch
+++ b/recipes-wifi/hostapd/files/patches-2.10.3/mtk-0013-hostapd-mtk-Add-he_ldpc-configuration.patch
@@ -1,7 +1,7 @@
-From 65f862e0db364352657f0f19245339208dc0a966 Mon Sep 17 00:00:00 2001
+From ea7da2297d396febe75de0d7cf77cba9d2eab778 Mon Sep 17 00:00:00 2001
From: MeiChia Chiu <meichia.chiu@mediatek.com>
Date: Thu, 12 Jan 2023 15:18:19 +0800
-Subject: [PATCH 13/32] hostapd: mtk: Add he_ldpc configuration
+Subject: [PATCH 13/40] hostapd: mtk: Add he_ldpc configuration
---
hostapd/config_file.c | 2 ++
@@ -13,10 +13,10 @@
6 files changed, 19 insertions(+)
diff --git a/hostapd/config_file.c b/hostapd/config_file.c
-index ecd290717..8c5831dbb 100644
+index d17e50e..04ca433 100644
--- a/hostapd/config_file.c
+++ b/hostapd/config_file.c
-@@ -3517,6 +3517,8 @@ static int hostapd_config_fill(struct hostapd_config *conf,
+@@ -3515,6 +3515,8 @@ static int hostapd_config_fill(struct hostapd_config *conf,
conf->he_phy_capab.he_su_beamformee = atoi(pos);
} else if (os_strcmp(buf, "he_mu_beamformer") == 0) {
conf->he_phy_capab.he_mu_beamformer = atoi(pos);
@@ -26,7 +26,7 @@
conf->he_op.he_bss_color = atoi(pos) & 0x3f;
conf->he_op.he_bss_color_disabled = 0;
diff --git a/hostapd/hostapd.conf b/hostapd/hostapd.conf
-index 30fb06d1c..fd42c5038 100644
+index 30fb06d..fd42c50 100644
--- a/hostapd/hostapd.conf
+++ b/hostapd/hostapd.conf
@@ -833,6 +833,11 @@ wmm_ac_vo_acm=0
@@ -42,7 +42,7 @@
#he_bss_color=1
diff --git a/src/ap/ap_config.c b/src/ap/ap_config.c
-index 83e2ea121..1f27543bf 100644
+index f519a76..223db56 100644
--- a/src/ap/ap_config.c
+++ b/src/ap/ap_config.c
@@ -269,6 +269,7 @@ struct hostapd_config * hostapd_config_defaults(void)
@@ -54,7 +54,7 @@
HE_OPERATION_RTS_THRESHOLD_OFFSET;
/* Set default basic MCS/NSS set to single stream MCS 0-7 */
diff --git a/src/ap/ap_config.h b/src/ap/ap_config.h
-index 94056157b..195816c28 100644
+index b8f6680..5b2dbff 100644
--- a/src/ap/ap_config.h
+++ b/src/ap/ap_config.h
@@ -956,6 +956,7 @@ struct hostapd_bss_config {
@@ -66,7 +66,7 @@
bool he_su_beamformee;
bool he_mu_beamformer;
diff --git a/src/ap/ieee802_11_he.c b/src/ap/ieee802_11_he.c
-index 548a44821..9407dd6e5 100644
+index 548a448..9407dd6 100644
--- a/src/ap/ieee802_11_he.c
+++ b/src/ap/ieee802_11_he.c
@@ -138,6 +138,13 @@ u8 * hostapd_eid_he_capab(struct hostapd_data *hapd, u8 *eid,
@@ -84,10 +84,10 @@
cap->he_phy_capab_info[HE_PHYCAP_SU_BEAMFORMER_CAPAB_IDX] |=
HE_PHYCAP_SU_BEAMFORMER_CAPAB;
diff --git a/src/common/ieee802_11_defs.h b/src/common/ieee802_11_defs.h
-index 571ace2f5..74301178f 100644
+index 0b7b776..cf3ef98 100644
--- a/src/common/ieee802_11_defs.h
+++ b/src/common/ieee802_11_defs.h
-@@ -2355,6 +2355,9 @@ struct ieee80211_spatial_reuse {
+@@ -2357,6 +2357,9 @@ struct ieee80211_spatial_reuse {
#define HE_PHYCAP_CHANNEL_WIDTH_SET_160MHZ_IN_5G ((u8) BIT(3))
#define HE_PHYCAP_CHANNEL_WIDTH_SET_80PLUS80MHZ_IN_5G ((u8) BIT(4))
@@ -98,5 +98,5 @@
#define HE_PHYCAP_SU_BEAMFORMER_CAPAB ((u8) BIT(7))
#define HE_PHYCAP_SU_BEAMFORMEE_CAPAB_IDX 4
--
-2.39.2
+2.18.0
diff --git a/recipes-wifi/hostapd/files/patches-2.10.3/mtk-0014-hostapd-mtk-Add-vendor-command-attribute-for-RTS-BW-.patch b/recipes-wifi/hostapd/files/patches-2.10.3/mtk-0014-hostapd-mtk-Add-vendor-command-attribute-for-RTS-BW-.patch
index 0751337..6003cfb 100644
--- a/recipes-wifi/hostapd/files/patches-2.10.3/mtk-0014-hostapd-mtk-Add-vendor-command-attribute-for-RTS-BW-.patch
+++ b/recipes-wifi/hostapd/files/patches-2.10.3/mtk-0014-hostapd-mtk-Add-vendor-command-attribute-for-RTS-BW-.patch
@@ -1,7 +1,7 @@
-From 2694ff1a1eb124938848bf46361990f13cf4d277 Mon Sep 17 00:00:00 2001
+From 41ccc468e3ce6727b237390bcedf1ab734d749e4 Mon Sep 17 00:00:00 2001
From: "himanshu.goyal" <himanshu.goyal@mediatek.com>
Date: Tue, 24 Jan 2023 19:06:44 +0800
-Subject: [PATCH 14/32] hostapd: mtk: Add vendor command attribute for RTS BW
+Subject: [PATCH 14/40] hostapd: mtk: Add vendor command attribute for RTS BW
signaling.
Signed-off-by: himanshu.goyal <himanshu.goyal@mediatek.com>
@@ -10,7 +10,7 @@
1 file changed, 1 insertion(+)
diff --git a/src/common/mtk_vendor.h b/src/common/mtk_vendor.h
-index 7b4d7c11a..ace993bc8 100644
+index 7b4d7c1..ace993b 100644
--- a/src/common/mtk_vendor.h
+++ b/src/common/mtk_vendor.h
@@ -172,6 +172,7 @@ enum mtk_vendor_attr_wireless_ctrl {
@@ -22,5 +22,5 @@
/* keep last */
NUM_MTK_VENDOR_ATTRS_WIRELESS_CTRL,
--
-2.39.2
+2.18.0
diff --git a/recipes-wifi/hostapd/files/patches-2.10.3/mtk-0015-hostapd-mtk-6G-band-does-not-require-DFS.patch b/recipes-wifi/hostapd/files/patches-2.10.3/mtk-0015-hostapd-mtk-6G-band-does-not-require-DFS.patch
index a850c6d..3b19e78 100644
--- a/recipes-wifi/hostapd/files/patches-2.10.3/mtk-0015-hostapd-mtk-6G-band-does-not-require-DFS.patch
+++ b/recipes-wifi/hostapd/files/patches-2.10.3/mtk-0015-hostapd-mtk-6G-band-does-not-require-DFS.patch
@@ -1,14 +1,14 @@
-From cd2d0f7ee500cbdf302b2042e9e4804107e06148 Mon Sep 17 00:00:00 2001
+From 0381565e342ecf407ffb6a32212c6d7123417c73 Mon Sep 17 00:00:00 2001
From: Peter Chiu <chui-hao.chiu@mediatek.com>
Date: Mon, 13 Feb 2023 11:03:53 +0800
-Subject: [PATCH 15/32] hostapd: mtk: 6G band does not require DFS
+Subject: [PATCH 15/40] hostapd: mtk: 6G band does not require DFS
---
src/ap/dfs.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/ap/dfs.c b/src/ap/dfs.c
-index 48c5fc917..dcf89ce62 100644
+index 48c5fc9..dcf89ce 100644
--- a/src/ap/dfs.c
+++ b/src/ap/dfs.c
@@ -1511,6 +1511,7 @@ int hostapd_is_dfs_required(struct hostapd_iface *iface)
@@ -20,5 +20,5 @@
return 0;
--
-2.39.2
+2.18.0
diff --git a/recipes-wifi/hostapd/files/patches-2.10.3/mtk-0016-hostapd-mtk-Fix-sending-wrong-VHT-operation-IE-in-CS.patch b/recipes-wifi/hostapd/files/patches-2.10.3/mtk-0016-hostapd-mtk-Fix-sending-wrong-VHT-operation-IE-in-CS.patch
index f9c3cb7..206a8d3 100644
--- a/recipes-wifi/hostapd/files/patches-2.10.3/mtk-0016-hostapd-mtk-Fix-sending-wrong-VHT-operation-IE-in-CS.patch
+++ b/recipes-wifi/hostapd/files/patches-2.10.3/mtk-0016-hostapd-mtk-Fix-sending-wrong-VHT-operation-IE-in-CS.patch
@@ -1,7 +1,7 @@
-From e8e838a2dffaa6ba5ea66f6638d4ba7f01302bf6 Mon Sep 17 00:00:00 2001
+From b810754f20e0bad1b1be74bd71fc96f6b74b8c4d Mon Sep 17 00:00:00 2001
From: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
Date: Mon, 20 Feb 2023 11:01:18 +0800
-Subject: [PATCH 16/32] hostapd: mtk: Fix sending wrong VHT operation IE in CSA
+Subject: [PATCH 16/40] hostapd: mtk: Fix sending wrong VHT operation IE in CSA
while using ZWDFS
Signed-off-by: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
@@ -10,7 +10,7 @@
1 file changed, 9 insertions(+), 5 deletions(-)
diff --git a/src/ap/dfs.c b/src/ap/dfs.c
-index dcf89ce62..e5ed645d6 100644
+index dcf89ce..e5ed645 100644
--- a/src/ap/dfs.c
+++ b/src/ap/dfs.c
@@ -1115,6 +1115,14 @@ static int
@@ -42,5 +42,5 @@
--
-2.39.2
+2.18.0
diff --git a/recipes-wifi/hostapd/files/patches-2.10.3/mtk-0017-hostapd-mtk-Add-sta-assisted-DFS-state-update-mechan.patch b/recipes-wifi/hostapd/files/patches-2.10.3/mtk-0017-hostapd-mtk-Add-sta-assisted-DFS-state-update-mechan.patch
index 8c35888..f2e966a 100644
--- a/recipes-wifi/hostapd/files/patches-2.10.3/mtk-0017-hostapd-mtk-Add-sta-assisted-DFS-state-update-mechan.patch
+++ b/recipes-wifi/hostapd/files/patches-2.10.3/mtk-0017-hostapd-mtk-Add-sta-assisted-DFS-state-update-mechan.patch
@@ -1,7 +1,7 @@
-From c5b6477df27a7da54a56ee0cc94b147072b25749 Mon Sep 17 00:00:00 2001
+From 20f21e3ff3c5d5db5daea650e22c6fa8ca6071a4 Mon Sep 17 00:00:00 2001
From: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
Date: Mon, 20 Feb 2023 10:51:47 +0800
-Subject: [PATCH 17/32] hostapd: mtk: Add sta-assisted DFS state update
+Subject: [PATCH 17/40] hostapd: mtk: Add sta-assisted DFS state update
mechanism
Signed-off-by: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
@@ -16,7 +16,7 @@
7 files changed, 78 insertions(+)
diff --git a/src/ap/dfs.c b/src/ap/dfs.c
-index e5ed645d6..d52a60e0d 100644
+index e5ed645..d52a60e 100644
--- a/src/ap/dfs.c
+++ b/src/ap/dfs.c
@@ -1508,6 +1508,26 @@ int hostapd_dfs_nop_finished(struct hostapd_iface *iface, int freq,
@@ -47,7 +47,7 @@
{
int n_chans, n_chans1, start_chan_idx, start_chan_idx1, res;
diff --git a/src/ap/dfs.h b/src/ap/dfs.h
-index c2556d2d9..25ba29ca1 100644
+index c2556d2..25ba29c 100644
--- a/src/ap/dfs.h
+++ b/src/ap/dfs.h
@@ -30,6 +30,9 @@ int hostapd_dfs_radar_detected(struct hostapd_iface *iface, int freq,
@@ -61,7 +61,7 @@
int hostapd_is_dfs_chan_available(struct hostapd_iface *iface);
int hostapd_dfs_start_cac(struct hostapd_iface *iface, int freq,
diff --git a/src/ap/drv_callbacks.c b/src/ap/drv_callbacks.c
-index b0bba9906..694056b42 100644
+index 903eab3..c3fc419 100644
--- a/src/ap/drv_callbacks.c
+++ b/src/ap/drv_callbacks.c
@@ -1912,6 +1912,24 @@ static void hostapd_event_dfs_cac_started(struct hostapd_data *hapd,
@@ -107,7 +107,7 @@
/* channel list changed (regulatory?), update channel list */
/* TODO: check this. hostapd_get_hw_features() initializes
diff --git a/src/common/wpa_ctrl.h b/src/common/wpa_ctrl.h
-index ccff0ee09..e209ac6d7 100644
+index ccff0ee..e209ac6 100644
--- a/src/common/wpa_ctrl.h
+++ b/src/common/wpa_ctrl.h
@@ -374,6 +374,7 @@ extern "C" {
@@ -119,7 +119,7 @@
#define AP_CSA_FINISHED "AP-CSA-FINISHED "
diff --git a/src/drivers/driver.h b/src/drivers/driver.h
-index 87a5a9b64..592f506ec 100644
+index 87a5a9b..592f506 100644
--- a/src/drivers/driver.h
+++ b/src/drivers/driver.h
@@ -5760,6 +5760,20 @@ enum wpa_event_type {
@@ -144,7 +144,7 @@
diff --git a/src/drivers/driver_nl80211_event.c b/src/drivers/driver_nl80211_event.c
-index 3e8ace052..3d0d9b7bb 100644
+index 8566b2a..ab988fa 100644
--- a/src/drivers/driver_nl80211_event.c
+++ b/src/drivers/driver_nl80211_event.c
@@ -2447,6 +2447,12 @@ static void nl80211_radar_event(struct wpa_driver_nl80211_data *drv,
@@ -161,7 +161,7 @@
wpa_printf(MSG_DEBUG, "nl80211: Unknown radar event %d "
"received", event_type);
diff --git a/src/drivers/nl80211_copy.h b/src/drivers/nl80211_copy.h
-index 82860ae32..225864b94 100644
+index 82860ae..225864b 100644
--- a/src/drivers/nl80211_copy.h
+++ b/src/drivers/nl80211_copy.h
@@ -6643,6 +6643,10 @@ enum nl80211_smps_mode {
@@ -185,5 +185,5 @@
/**
--
-2.39.2
+2.18.0
diff --git a/recipes-wifi/hostapd/files/patches-2.10.3/mtk-0018-hostapd-mtk-Fix-auto-ht-issue-when-switching-to-DFS-.patch b/recipes-wifi/hostapd/files/patches-2.10.3/mtk-0018-hostapd-mtk-Fix-auto-ht-issue-when-switching-to-DFS-.patch
deleted file mode 100644
index ea43585..0000000
--- a/recipes-wifi/hostapd/files/patches-2.10.3/mtk-0018-hostapd-mtk-Fix-auto-ht-issue-when-switching-to-DFS-.patch
+++ /dev/null
@@ -1,45 +0,0 @@
-From cf17d8510dd96dc092b73236b6e74d8ea1c5990c Mon Sep 17 00:00:00 2001
-From: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
-Date: Mon, 20 Feb 2023 16:58:20 +0800
-Subject: [PATCH 18/32] hostapd: mtk: Fix auto ht issue when switching to DFS
- channel
-
-Signed-off-by: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
----
- hostapd/ctrl_iface.c | 13 +++++++------
- 1 file changed, 7 insertions(+), 6 deletions(-)
-
-diff --git a/hostapd/ctrl_iface.c b/hostapd/ctrl_iface.c
-index ed17211e0..f89bb58f1 100644
---- a/hostapd/ctrl_iface.c
-+++ b/hostapd/ctrl_iface.c
-@@ -2808,6 +2808,13 @@ static int hostapd_ctrl_iface_chan_switch(struct hostapd_iface *iface,
- break;
- }
-
-+ if (os_strstr(pos, " auto-ht")) {
-+ settings.freq_params.ht_enabled = iface->conf->ieee80211n;
-+ settings.freq_params.vht_enabled = iface->conf->ieee80211ac;
-+ settings.freq_params.he_enabled = iface->conf->ieee80211ax;
-+ settings.freq_params.eht_enabled = iface->conf->ieee80211be;
-+ }
-+
- if (settings.freq_params.center_freq1)
- dfs_range += hostapd_is_dfs_overlap(
- iface, bandwidth, settings.freq_params.center_freq1);
-@@ -2845,12 +2852,6 @@ static int hostapd_ctrl_iface_chan_switch(struct hostapd_iface *iface,
- return 0;
- }
-
-- if (os_strstr(pos, " auto-ht")) {
-- settings.freq_params.ht_enabled = iface->conf->ieee80211n;
-- settings.freq_params.vht_enabled = iface->conf->ieee80211ac;
-- settings.freq_params.he_enabled = iface->conf->ieee80211ax;
-- }
--
- for (i = 0; i < iface->num_bss; i++) {
-
- /* Save CHAN_SWITCH VHT, HE, and EHT config */
---
-2.39.2
-
diff --git a/recipes-wifi/hostapd/files/patches-2.10.3/mtk-0019-hostapd-mtk-Mark-DFS-channel-as-available-for-CSA.patch b/recipes-wifi/hostapd/files/patches-2.10.3/mtk-0018-hostapd-mtk-Mark-DFS-channel-as-available-for-CSA.patch
similarity index 85%
rename from recipes-wifi/hostapd/files/patches-2.10.3/mtk-0019-hostapd-mtk-Mark-DFS-channel-as-available-for-CSA.patch
rename to recipes-wifi/hostapd/files/patches-2.10.3/mtk-0018-hostapd-mtk-Mark-DFS-channel-as-available-for-CSA.patch
index 9e93011..a9c1842 100644
--- a/recipes-wifi/hostapd/files/patches-2.10.3/mtk-0019-hostapd-mtk-Mark-DFS-channel-as-available-for-CSA.patch
+++ b/recipes-wifi/hostapd/files/patches-2.10.3/mtk-0018-hostapd-mtk-Mark-DFS-channel-as-available-for-CSA.patch
@@ -1,7 +1,7 @@
-From ece45354ac0191c2474b3f57cdfc26060db9efec Mon Sep 17 00:00:00 2001
+From 2471c86d25da6898dd8840b7267211a5dba036b1 Mon Sep 17 00:00:00 2001
From: "himanshu.goyal" <himanshu.goyal@mediatek.com>
Date: Fri, 3 Mar 2023 12:45:42 +0800
-Subject: [PATCH 19/32] hostapd: mtk: Mark DFS channel as available for CSA.
+Subject: [PATCH 18/40] hostapd: mtk: Mark DFS channel as available for CSA.
---
hostapd/ctrl_iface.c | 10 ++++++++++
@@ -10,11 +10,11 @@
3 files changed, 12 insertions(+), 1 deletion(-)
diff --git a/hostapd/ctrl_iface.c b/hostapd/ctrl_iface.c
-index f89bb58f1..bad9790ca 100644
+index c54cbb9..aab5c0a 100644
--- a/hostapd/ctrl_iface.c
+++ b/hostapd/ctrl_iface.c
-@@ -2815,6 +2815,16 @@ static int hostapd_ctrl_iface_chan_switch(struct hostapd_iface *iface,
- settings.freq_params.eht_enabled = iface->conf->ieee80211be;
+@@ -2751,6 +2751,16 @@ static int hostapd_ctrl_iface_chan_switch(struct hostapd_iface *iface,
+ break;
}
+ if (settings.freq_params.radar_background) {
@@ -31,7 +31,7 @@
dfs_range += hostapd_is_dfs_overlap(
iface, bandwidth, settings.freq_params.center_freq1);
diff --git a/hostapd/hostapd_cli.c b/hostapd/hostapd_cli.c
-index d59373062..0a374be8e 100644
+index d593730..0a374be 100644
--- a/hostapd/hostapd_cli.c
+++ b/hostapd/hostapd_cli.c
@@ -1715,7 +1715,7 @@ static const struct hostapd_cli_cmd hostapd_cli_commands[] = {
@@ -44,7 +44,7 @@
{ "hs20_wnm_notif", hostapd_cli_cmd_hs20_wnm_notif, NULL,
"<addr> <url>\n"
diff --git a/src/ap/ctrl_iface_ap.c b/src/ap/ctrl_iface_ap.c
-index cf1cff447..aab8a4665 100644
+index 0e173f1..7bdefb4 100644
--- a/src/ap/ctrl_iface_ap.c
+++ b/src/ap/ctrl_iface_ap.c
@@ -1014,6 +1014,7 @@ int hostapd_parse_csa_settings(const char *pos,
@@ -56,5 +56,5 @@
#undef SET_CSA_SETTING
#undef SET_CSA_SETTING_EXT
--
-2.39.2
+2.18.0
diff --git a/recipes-wifi/hostapd/files/patches-2.10.3/mtk-0020-hostapd-mtk-Add-available-color-bitmap.patch b/recipes-wifi/hostapd/files/patches-2.10.3/mtk-0019-hostapd-mtk-Add-available-color-bitmap.patch
similarity index 94%
rename from recipes-wifi/hostapd/files/patches-2.10.3/mtk-0020-hostapd-mtk-Add-available-color-bitmap.patch
rename to recipes-wifi/hostapd/files/patches-2.10.3/mtk-0019-hostapd-mtk-Add-available-color-bitmap.patch
index de6ffe6..01aa4d5 100644
--- a/recipes-wifi/hostapd/files/patches-2.10.3/mtk-0020-hostapd-mtk-Add-available-color-bitmap.patch
+++ b/recipes-wifi/hostapd/files/patches-2.10.3/mtk-0019-hostapd-mtk-Add-available-color-bitmap.patch
@@ -1,7 +1,7 @@
-From 71b229a9e0a12ebc6d5f298f40042cc67fb285e1 Mon Sep 17 00:00:00 2001
+From 236e82d01cd015135468166e6d00b05b16e4c5f8 Mon Sep 17 00:00:00 2001
From: Yi-Chia Hsieh <yi-chia.hsieh@mediatek.com>
Date: Thu, 26 Jan 2023 09:16:00 +0800
-Subject: [PATCH 20/32] hostapd: mtk: Add available color bitmap
+Subject: [PATCH 19/40] hostapd: mtk: Add available color bitmap
Signed-off-by: Yi-Chia Hsieh <yi-chia.hsieh@mediatek.com>
---
@@ -17,10 +17,10 @@
9 files changed, 324 insertions(+), 2 deletions(-)
diff --git a/hostapd/ctrl_iface.c b/hostapd/ctrl_iface.c
-index bad9790ca..997b50aad 100644
+index aab5c0a..a6be199 100644
--- a/hostapd/ctrl_iface.c
+++ b/hostapd/ctrl_iface.c
-@@ -3756,6 +3756,76 @@ hostapd_ctrl_iface_get_amsdu(struct hostapd_data *hapd, char *buf,
+@@ -3692,6 +3692,76 @@ hostapd_ctrl_iface_get_amsdu(struct hostapd_data *hapd, char *buf,
return ret;
}
@@ -97,7 +97,7 @@
static int hostapd_ctrl_iface_receive_process(struct hostapd_data *hapd,
char *buf, char *reply,
-@@ -4332,6 +4402,10 @@ static int hostapd_ctrl_iface_receive_process(struct hostapd_data *hapd,
+@@ -4266,6 +4336,10 @@ static int hostapd_ctrl_iface_receive_process(struct hostapd_data *hapd,
reply_len = hostapd_ctrl_iface_set_offchan_ctrl(hapd, buf + 16, reply, reply_size);
} else if (os_strncmp(buf, "GET_AMSDU", 9) == 0) {
reply_len = hostapd_ctrl_iface_get_amsdu(hapd, reply, reply_size);
@@ -109,7 +109,7 @@
os_memcpy(reply, "UNKNOWN COMMAND\n", 16);
reply_len = 16;
diff --git a/hostapd/hostapd_cli.c b/hostapd/hostapd_cli.c
-index 0a374be8e..e9e156d28 100644
+index 0a374be..e9e156d 100644
--- a/hostapd/hostapd_cli.c
+++ b/hostapd/hostapd_cli.c
@@ -1598,6 +1598,20 @@ static int hostapd_cli_cmd_reload_wpa_psk(struct wpa_ctrl *ctrl, int argc,
@@ -145,7 +145,7 @@
{ "driver", hostapd_cli_cmd_driver, NULL,
"<driver sub command> [<hex formatted data>] = send driver command data" },
diff --git a/src/ap/ap_drv_ops.c b/src/ap/ap_drv_ops.c
-index a7226cfa9..9615ca8ce 100644
+index a7226cf..9615ca8 100644
--- a/src/ap/ap_drv_ops.c
+++ b/src/ap/ap_drv_ops.c
@@ -1213,4 +1213,12 @@ int hostapd_drv_amsdu_dump(struct hostapd_data *hapd, u8 *amsdu)
@@ -164,7 +164,7 @@
+ return hapd->driver->get_aval_color_bmp(hapd->drv_priv, aval_color_bmp);
+}
diff --git a/src/ap/ap_drv_ops.h b/src/ap/ap_drv_ops.h
-index 422cb5222..136ea2349 100644
+index 422cb52..136ea23 100644
--- a/src/ap/ap_drv_ops.h
+++ b/src/ap/ap_drv_ops.h
@@ -155,6 +155,8 @@ int hostapd_drv_ibf_ctrl(struct hostapd_data *hapd);
@@ -177,7 +177,7 @@
#include "drivers/driver.h"
diff --git a/src/common/mtk_vendor.h b/src/common/mtk_vendor.h
-index ace993bc8..e27fe69b3 100644
+index ace993b..e27fe69 100644
--- a/src/common/mtk_vendor.h
+++ b/src/common/mtk_vendor.h
@@ -15,6 +15,7 @@ enum mtk_nl80211_vendor_subcmds {
@@ -206,7 +206,7 @@
#define CSI_MAX_COUNT 256
#define ETH_ALEN 6
diff --git a/src/drivers/driver.h b/src/drivers/driver.h
-index 592f506ec..91cb475ac 100644
+index 592f506..91cb475 100644
--- a/src/drivers/driver.h
+++ b/src/drivers/driver.h
@@ -5133,6 +5133,14 @@ struct wpa_driver_ops {
@@ -225,10 +225,10 @@
/**
diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c
-index 4ac8b6e0b..b8730472d 100644
+index ce09d9f..8b8ddfa 100644
--- a/src/drivers/driver_nl80211.c
+++ b/src/drivers/driver_nl80211.c
-@@ -12736,7 +12736,6 @@ static void nl80211_parse_btm_candidate_info(struct candidate_list *candidate,
+@@ -12733,7 +12733,6 @@ static void nl80211_parse_btm_candidate_info(struct candidate_list *candidate,
num, MAC2STR(candidate->bssid), buf);
}
@@ -236,7 +236,7 @@
static int
nl80211_get_bss_transition_status_handler(struct nl_msg *msg, void *arg)
{
-@@ -14164,6 +14163,203 @@ fail:
+@@ -14161,6 +14160,203 @@ fail:
return -ENOBUFS;
}
@@ -440,14 +440,14 @@
const struct wpa_driver_ops wpa_driver_nl80211_ops = {
.name = "nl80211",
.desc = "Linux nl80211/cfg80211",
-@@ -14328,4 +14524,5 @@ const struct wpa_driver_ops wpa_driver_nl80211_ops = {
+@@ -14325,4 +14521,5 @@ const struct wpa_driver_ops wpa_driver_nl80211_ops = {
.ibf_dump = nl80211_ibf_dump,
.amsdu_ctrl = nl80211_enable_amsdu,
.amsdu_dump = nl80211_dump_amsdu,
+ .get_aval_color_bmp = nl80211_get_aval_color_bmp,
};
diff --git a/src/drivers/driver_nl80211.h b/src/drivers/driver_nl80211.h
-index 0100314ba..fd1e57cc2 100644
+index 0100314..fd1e57c 100644
--- a/src/drivers/driver_nl80211.h
+++ b/src/drivers/driver_nl80211.h
@@ -207,6 +207,7 @@ struct wpa_driver_nl80211_data {
@@ -459,7 +459,7 @@
u64 vendor_scan_cookie;
u64 remain_on_chan_cookie;
diff --git a/src/drivers/driver_nl80211_capa.c b/src/drivers/driver_nl80211_capa.c
-index f14706d77..4f8e92024 100644
+index f14706d..4f8e920 100644
--- a/src/drivers/driver_nl80211_capa.c
+++ b/src/drivers/driver_nl80211_capa.c
@@ -1125,6 +1125,9 @@ static int wiphy_info_handler(struct nl_msg *msg, void *arg)
@@ -473,5 +473,5 @@
}
--
-2.39.2
+2.18.0
diff --git a/recipes-wifi/hostapd/files/patches-2.10.3/mtk-0022-hostapd-mtk-Fix-ZWDFS-issue-in-BW-160.patch b/recipes-wifi/hostapd/files/patches-2.10.3/mtk-0020-hostapd-mtk-Fix-ZWDFS-issue-in-BW-160.patch
similarity index 97%
rename from recipes-wifi/hostapd/files/patches-2.10.3/mtk-0022-hostapd-mtk-Fix-ZWDFS-issue-in-BW-160.patch
rename to recipes-wifi/hostapd/files/patches-2.10.3/mtk-0020-hostapd-mtk-Fix-ZWDFS-issue-in-BW-160.patch
index 88dc605..67950bf 100644
--- a/recipes-wifi/hostapd/files/patches-2.10.3/mtk-0022-hostapd-mtk-Fix-ZWDFS-issue-in-BW-160.patch
+++ b/recipes-wifi/hostapd/files/patches-2.10.3/mtk-0020-hostapd-mtk-Fix-ZWDFS-issue-in-BW-160.patch
@@ -1,7 +1,7 @@
-From 2b0d1e11b72e96c4af1c428b9e3d4de494e40c52 Mon Sep 17 00:00:00 2001
+From 4518e45497260d319663621eca8cea4c0f79b668 Mon Sep 17 00:00:00 2001
From: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
Date: Mon, 20 Mar 2023 16:08:30 +0800
-Subject: [PATCH 22/32] hostapd: mtk: Fix ZWDFS issue in BW 160
+Subject: [PATCH 20/40] hostapd: mtk: Fix ZWDFS issue in BW 160
When background radar is enabled and bandwidth is set to 160, AP will
fail to startup due to the lack of non-DFS channel.
@@ -14,7 +14,7 @@
1 file changed, 79 insertions(+), 19 deletions(-)
diff --git a/src/ap/dfs.c b/src/ap/dfs.c
-index d52a60e0d..2f5c86eb6 100644
+index d52a60e..2f5c86e 100644
--- a/src/ap/dfs.c
+++ b/src/ap/dfs.c
@@ -69,15 +69,22 @@ static int dfs_get_used_n_chans(struct hostapd_iface *iface, int *seg1)
@@ -206,5 +206,5 @@
} else if (hostapd_dfs_is_background_event(iface, freq)) {
iface->radar_background.cac_started = 0;
--
-2.39.2
+2.18.0
diff --git a/recipes-wifi/hostapd/files/patches-2.10.3/mtk-0021-hostapd-mtk-Add-channel-information-for-hostapd-relo.patch b/recipes-wifi/hostapd/files/patches-2.10.3/mtk-0021-hostapd-mtk-Add-channel-information-for-hostapd-relo.patch
deleted file mode 100644
index df803ef..0000000
--- a/recipes-wifi/hostapd/files/patches-2.10.3/mtk-0021-hostapd-mtk-Add-channel-information-for-hostapd-relo.patch
+++ /dev/null
@@ -1,79 +0,0 @@
-From 84337cd7cc25c227b19f8dde3138c40fdbf863b4 Mon Sep 17 00:00:00 2001
-From: Michael Lee <michael-cy.lee@mediatek.com>
-Date: Wed, 22 Mar 2023 13:59:29 +0800
-Subject: [PATCH 21/32] hostapd: mtk: Add channel information for hostapd
- reload
-
-Add center channel, operating class, and bandwidth into the UPDATE
-command when wpa_supplciant reloads hostapd.
-Hostapd can correctly update its channel information.
-
-Signed-off-by: Michael Lee <michael-cy.lee@mediatek.com>
----
- hostapd/ctrl_iface.c | 11 +++++++++++
- wpa_supplicant/wpa_supplicant.c | 17 ++++++++++++++---
- 2 files changed, 25 insertions(+), 3 deletions(-)
-
-diff --git a/hostapd/ctrl_iface.c b/hostapd/ctrl_iface.c
-index 997b50aad..3abf06a09 100644
---- a/hostapd/ctrl_iface.c
-+++ b/hostapd/ctrl_iface.c
-@@ -171,6 +171,17 @@ static struct hostapd_config *hostapd_ctrl_iface_config_read(const char *fname)
- conf->hw_mode = atoi(val);
- else if ((val = get_option(opt, "ieee80211n=")))
- conf->ieee80211n = atoi(val);
-+ else if ((val = get_option(opt, "center_segment0=")))
-+ hostapd_set_oper_centr_freq_seg0_idx(conf, atoi(val));
-+ else if ((val = get_option(opt, "center_segment1=")))
-+ hostapd_set_oper_centr_freq_seg1_idx(conf, atoi(val));
-+ else if ((val = get_option(opt, "op_class="))) {
-+ enum oper_chan_width ch_width;
-+
-+ conf->op_class = atoi(val);
-+ ch_width = op_class_to_ch_width(conf->op_class);
-+ hostapd_set_oper_chwidth(conf, ch_width);
-+ }
- else
- break;
- }
-diff --git a/wpa_supplicant/wpa_supplicant.c b/wpa_supplicant/wpa_supplicant.c
-index deb14632c..2ca2bd263 100644
---- a/wpa_supplicant/wpa_supplicant.c
-+++ b/wpa_supplicant/wpa_supplicant.c
-@@ -150,9 +150,10 @@ static int hostapd_reload(struct wpa_supplicant *wpa_s, struct wpa_bss *bss)
- char buf[256];
- size_t len = sizeof(buf);
- enum hostapd_hw_mode hw_mode;
-- u8 channel;
-+ u8 channel, center_segment0, center_segment1 = 0, op_class;
- int sec_chan = 0;
- int ret;
-+ struct wpa_channel_info ci;
-
- if (!bss)
- return -1;
-@@ -165,9 +166,19 @@ static int hostapd_reload(struct wpa_supplicant *wpa_s, struct wpa_bss *bss)
- sec_chan = -1;
- }
-
-+ ret = wpa_drv_channel_info(wpa_s, &ci);
-+ if (ret)
-+ return -1;
-+
-+ ieee80211_freq_to_chan(ci.center_frq1, ¢er_segment0);
-+ ieee80211_freq_to_chan(ci.center_frq2, ¢er_segment1);
-+ ieee80211_chaninfo_to_channel(ci.frequency, ci.chanwidth, sec_chan,
-+ &op_class, &channel);
- hw_mode = ieee80211_freq_to_chan(bss->freq, &channel);
-- if (asprintf(&cmd, "UPDATE channel=%d sec_chan=%d hw_mode=%d",
-- channel, sec_chan, hw_mode) < 0)
-+ if (asprintf(&cmd, "UPDATE channel=%d center_segment0=%d "
-+ "center_segment1=%d sec_chan=%d hw_mode=%d op_class=%d",
-+ channel, center_segment0, center_segment1, sec_chan,
-+ hw_mode, op_class) < 0)
- return -1;
-
- ret = wpa_ctrl_request(wpa_s->hostapd, cmd, os_strlen(cmd), buf, &len, NULL);
---
-2.39.2
-
diff --git a/recipes-wifi/hostapd/files/patches-2.10.3/mtk-0023-hostapd-mtk-Add-vendor-for-CAPI-certification-comman.patch b/recipes-wifi/hostapd/files/patches-2.10.3/mtk-0021-hostapd-mtk-Add-vendor-for-CAPI-certification-comman.patch
similarity index 94%
rename from recipes-wifi/hostapd/files/patches-2.10.3/mtk-0023-hostapd-mtk-Add-vendor-for-CAPI-certification-comman.patch
rename to recipes-wifi/hostapd/files/patches-2.10.3/mtk-0021-hostapd-mtk-Add-vendor-for-CAPI-certification-comman.patch
index 9ff8a4f..43905c6 100644
--- a/recipes-wifi/hostapd/files/patches-2.10.3/mtk-0023-hostapd-mtk-Add-vendor-for-CAPI-certification-comman.patch
+++ b/recipes-wifi/hostapd/files/patches-2.10.3/mtk-0021-hostapd-mtk-Add-vendor-for-CAPI-certification-comman.patch
@@ -1,11 +1,11 @@
-From 69b54dc64a95701f5e949e55399dacb598d23142 Mon Sep 17 00:00:00 2001
+From 014cf359542aeefc995d936ab4843491c4a3b8b6 Mon Sep 17 00:00:00 2001
From: Evelyn Tsai <evelyn.tsai@mediatek.com>
Date: Fri, 17 Mar 2023 16:17:14 +0800
-Subject: [PATCH 23/32] hostapd: mtk: Add vendor for CAPI certification
+Subject: [PATCH 21/40] hostapd: mtk: Add vendor for CAPI certification
commands
---
- hostapd/ctrl_iface.c | 95 +++++++++++++++++++++++++++++++
+ hostapd/ctrl_iface.c | 97 +++++++++++++++++++++++++++++++
src/ap/ap_drv_ops.c | 21 +++++++
src/ap/ap_drv_ops.h | 3 +
src/common/mtk_vendor.h | 33 +----------
@@ -13,21 +13,21 @@
src/drivers/driver_nl80211.c | 55 ++++++++++++++++++
src/drivers/driver_nl80211.h | 1 +
src/drivers/driver_nl80211_capa.c | 3 +
- 8 files changed, 202 insertions(+), 31 deletions(-)
+ 8 files changed, 204 insertions(+), 31 deletions(-)
diff --git a/hostapd/ctrl_iface.c b/hostapd/ctrl_iface.c
-index 3abf06a09..e0ed700db 100644
+index a6be199..92c94c0 100644
--- a/hostapd/ctrl_iface.c
+++ b/hostapd/ctrl_iface.c
-@@ -70,6 +70,7 @@
- #include "ctrl_iface.h"
+@@ -69,6 +69,7 @@
#include "config_file.h"
+ #include "ctrl_iface.h"
+#include "common/mtk_vendor.h"
#define HOSTAPD_CLI_DUP_VALUE_MAX_LEN 256
-@@ -3837,6 +3838,96 @@ hostapd_ctrl_iface_get_aval_color_bmp(struct hostapd_data *hapd, char *buf,
+@@ -3762,6 +3763,98 @@ hostapd_ctrl_iface_get_aval_color_bmp(struct hostapd_data *hapd, char *buf,
return pos - buf;
}
@@ -61,6 +61,8 @@
+ sub_cmd = MTK_VENDOR_ATTR_WIRELESS_CTRL_MIMO;
+ else if (os_strncmp(config, "cert", 4) == 0)
+ sub_cmd = MTK_VENDOR_ATTR_WIRELESS_CTRL_CERT ;
++ else if (os_strncmp(config, "amsdu", 5) == 0)
++ sub_cmd = MTK_VENDOR_ATTR_WIRELESS_CTRL_AMSDU;
+ else {
+ wpa_printf(MSG_ERROR,
+ "Unsupported parameter %s for ap_wireless", config);
@@ -124,7 +126,7 @@
static int hostapd_ctrl_iface_receive_process(struct hostapd_data *hapd,
char *buf, char *reply,
-@@ -4417,6 +4508,10 @@ static int hostapd_ctrl_iface_receive_process(struct hostapd_data *hapd,
+@@ -4340,6 +4433,10 @@ static int hostapd_ctrl_iface_receive_process(struct hostapd_data *hapd,
reply_len = hostapd_ctrl_iface_get_bss_color(hapd, reply, reply_size);
} else if (os_strncmp(buf, "AVAL_COLOR_BMP", 14) == 0) {
reply_len = hostapd_ctrl_iface_get_aval_color_bmp(hapd, reply, reply_size);
@@ -136,7 +138,7 @@
os_memcpy(reply, "UNKNOWN COMMAND\n", 16);
reply_len = 16;
diff --git a/src/ap/ap_drv_ops.c b/src/ap/ap_drv_ops.c
-index 9615ca8ce..11444c7eb 100644
+index 9615ca8..11444c7 100644
--- a/src/ap/ap_drv_ops.c
+++ b/src/ap/ap_drv_ops.c
@@ -1222,3 +1222,24 @@ int hostapd_drv_get_aval_bss_color_bmp(struct hostapd_data *hapd, u64 *aval_colo
@@ -165,7 +167,7 @@
+ return hapd->driver->ap_trigtype(hapd->drv_priv, enable, type);
+}
diff --git a/src/ap/ap_drv_ops.h b/src/ap/ap_drv_ops.h
-index 136ea2349..946ee2d68 100644
+index 136ea23..946ee2d 100644
--- a/src/ap/ap_drv_ops.h
+++ b/src/ap/ap_drv_ops.h
@@ -157,6 +157,9 @@ int hostapd_drv_amsdu_ctrl(struct hostapd_data *hapd);
@@ -179,7 +181,7 @@
#include "drivers/driver.h"
diff --git a/src/common/mtk_vendor.h b/src/common/mtk_vendor.h
-index e27fe69b3..0b23c76ad 100644
+index e27fe69..0b23c76 100644
--- a/src/common/mtk_vendor.h
+++ b/src/common/mtk_vendor.h
@@ -50,17 +50,6 @@ enum mtk_vendor_attr_edcca_dump {
@@ -258,7 +260,7 @@
MTK_VENDOR_ATTR_BSS_COLOR_CTRL_UNSPEC,
diff --git a/src/drivers/driver.h b/src/drivers/driver.h
-index 91cb475ac..3efea9f68 100644
+index 91cb475..3efea9f 100644
--- a/src/drivers/driver.h
+++ b/src/drivers/driver.h
@@ -5141,6 +5141,28 @@ struct wpa_driver_ops {
@@ -291,7 +293,7 @@
/**
diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c
-index b8730472d..642d75bd1 100644
+index 8b8ddfa..6a42633 100644
--- a/src/drivers/driver_nl80211.c
+++ b/src/drivers/driver_nl80211.c
@@ -76,6 +76,58 @@ enum nlmsgerr_attrs {
@@ -353,7 +355,7 @@
static struct nl_sock * nl_create_handle(struct nl_cb *cb, const char *dbg)
{
struct nl_sock *handle;
-@@ -14525,4 +14577,7 @@ const struct wpa_driver_ops wpa_driver_nl80211_ops = {
+@@ -14522,4 +14574,7 @@ const struct wpa_driver_ops wpa_driver_nl80211_ops = {
.amsdu_ctrl = nl80211_enable_amsdu,
.amsdu_dump = nl80211_dump_amsdu,
.get_aval_color_bmp = nl80211_get_aval_color_bmp,
@@ -362,7 +364,7 @@
+ .ap_trigtype = nl80211_ap_trigtype,
};
diff --git a/src/drivers/driver_nl80211.h b/src/drivers/driver_nl80211.h
-index fd1e57cc2..fc5217d61 100644
+index fd1e57c..fc5217d 100644
--- a/src/drivers/driver_nl80211.h
+++ b/src/drivers/driver_nl80211.h
@@ -208,6 +208,7 @@ struct wpa_driver_nl80211_data {
@@ -374,7 +376,7 @@
u64 vendor_scan_cookie;
u64 remain_on_chan_cookie;
diff --git a/src/drivers/driver_nl80211_capa.c b/src/drivers/driver_nl80211_capa.c
-index 4f8e92024..c1cf5b533 100644
+index 4f8e920..c1cf5b5 100644
--- a/src/drivers/driver_nl80211_capa.c
+++ b/src/drivers/driver_nl80211_capa.c
@@ -1128,6 +1128,9 @@ static int wiphy_info_handler(struct nl_msg *msg, void *arg)
@@ -388,5 +390,5 @@
}
--
-2.39.2
+2.18.0
diff --git a/recipes-wifi/hostapd/files/patches-2.10.3/mtk-0024-hostapd-mtk-Air-Monitor-support-in-hostapd-by-vendor.patch b/recipes-wifi/hostapd/files/patches-2.10.3/mtk-0022-hostapd-mtk-Air-Monitor-support-in-hostapd-by-vendor.patch
similarity index 95%
rename from recipes-wifi/hostapd/files/patches-2.10.3/mtk-0024-hostapd-mtk-Air-Monitor-support-in-hostapd-by-vendor.patch
rename to recipes-wifi/hostapd/files/patches-2.10.3/mtk-0022-hostapd-mtk-Air-Monitor-support-in-hostapd-by-vendor.patch
index 28a7167..90f9965 100644
--- a/recipes-wifi/hostapd/files/patches-2.10.3/mtk-0024-hostapd-mtk-Air-Monitor-support-in-hostapd-by-vendor.patch
+++ b/recipes-wifi/hostapd/files/patches-2.10.3/mtk-0022-hostapd-mtk-Air-Monitor-support-in-hostapd-by-vendor.patch
@@ -1,7 +1,7 @@
-From 06f750bee3e0a9798aa583b27257ef26dd4a1a8c Mon Sep 17 00:00:00 2001
+From 7e2055111b854c61eaa7ad485ebd3bf171b93df5 Mon Sep 17 00:00:00 2001
From: Evelyn Tsai <evelyn.tsai@mediatek.com>
Date: Fri, 12 May 2023 05:18:48 +0800
-Subject: [PATCH 24/32] hostapd: mtk: Air Monitor support in hostapd by vendor
+Subject: [PATCH 22/40] hostapd: mtk: Air Monitor support in hostapd by vendor
Signed-off-by: mtk23888 <dipanshu.mittal@mediatek.com>
---
@@ -17,10 +17,10 @@
9 files changed, 352 insertions(+)
diff --git a/hostapd/ctrl_iface.c b/hostapd/ctrl_iface.c
-index e0ed700db..9989a04ce 100644
+index 92c94c0..1bb64ea 100644
--- a/hostapd/ctrl_iface.c
+++ b/hostapd/ctrl_iface.c
-@@ -3876,6 +3876,44 @@ hostapd_ctrl_iface_ap_wireless(struct hostapd_data *hapd, char *cmd,
+@@ -3803,6 +3803,44 @@ hostapd_ctrl_iface_ap_wireless(struct hostapd_data *hapd, char *cmd,
if (hostapd_drv_ap_wireless(hapd, (u8) sub_cmd, atoi(value)) != 0)
return -1;
@@ -65,7 +65,7 @@
return os_snprintf(buf, buflen, "OK\n");
}
-@@ -3929,6 +3967,75 @@ exit:
+@@ -3856,6 +3894,75 @@ exit:
return os_snprintf(buf, buflen, "OK\n");
}
@@ -141,7 +141,7 @@
static int hostapd_ctrl_iface_receive_process(struct hostapd_data *hapd,
char *buf, char *reply,
int reply_size,
-@@ -4512,6 +4619,12 @@ static int hostapd_ctrl_iface_receive_process(struct hostapd_data *hapd,
+@@ -4437,6 +4544,12 @@ static int hostapd_ctrl_iface_receive_process(struct hostapd_data *hapd,
reply_len = hostapd_ctrl_iface_ap_wireless(hapd, buf + 12, reply, reply_size);
} else if (os_strncmp(buf, "ap_rfeatures ", 13) == 0) {
reply_len = hostapd_ctrl_iface_ap_rfeatures(hapd, buf + 13, reply, reply_size);
@@ -155,7 +155,7 @@
os_memcpy(reply, "UNKNOWN COMMAND\n", 16);
reply_len = 16;
diff --git a/hostapd/hostapd_cli.c b/hostapd/hostapd_cli.c
-index e9e156d28..6d763f327 100644
+index e9e156d..6d763f3 100644
--- a/hostapd/hostapd_cli.c
+++ b/hostapd/hostapd_cli.c
@@ -1633,6 +1633,17 @@ static int hostapd_cli_cmd_get_amsdu(struct wpa_ctrl *ctrl, int argc,
@@ -188,7 +188,7 @@
};
diff --git a/src/ap/ap_drv_ops.c b/src/ap/ap_drv_ops.c
-index 11444c7eb..b90dd5722 100644
+index 11444c7..b90dd57 100644
--- a/src/ap/ap_drv_ops.c
+++ b/src/ap/ap_drv_ops.c
@@ -1243,3 +1243,17 @@ int hostapd_drv_ap_trig_type(struct hostapd_data *hapd, u8 enable, u8 type)
@@ -210,7 +210,7 @@
+ return hapd->driver->amnt_dump(hapd->drv_priv, amnt_idx, amnt_dump_buf);
+}
diff --git a/src/ap/ap_drv_ops.h b/src/ap/ap_drv_ops.h
-index 946ee2d68..1e2a92acb 100644
+index 946ee2d..1e2a92a 100644
--- a/src/ap/ap_drv_ops.h
+++ b/src/ap/ap_drv_ops.h
@@ -161,6 +161,9 @@ int hostapd_drv_ap_wireless(struct hostapd_data *hapd, u8 sub_vendor_id, int val
@@ -224,7 +224,7 @@
int hostapd_drv_wnm_oper(struct hostapd_data *hapd,
diff --git a/src/common/mtk_vendor.h b/src/common/mtk_vendor.h
-index 0b23c76ad..dd1ca2164 100644
+index 0b23c76..dd1ca21 100644
--- a/src/common/mtk_vendor.h
+++ b/src/common/mtk_vendor.h
@@ -258,10 +258,18 @@ struct csi_data {
@@ -247,7 +247,7 @@
+
#endif /* MTK_VENDOR_H */
diff --git a/src/drivers/driver.h b/src/drivers/driver.h
-index 3efea9f68..5c70ec78f 100644
+index 3efea9f..5c70ec7 100644
--- a/src/drivers/driver.h
+++ b/src/drivers/driver.h
@@ -5163,6 +5163,22 @@ struct wpa_driver_ops {
@@ -274,7 +274,7 @@
/**
diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c
-index 642d75bd1..b923e5c7e 100644
+index 6a42633..3d8cb95 100644
--- a/src/drivers/driver_nl80211.c
+++ b/src/drivers/driver_nl80211.c
@@ -128,6 +128,19 @@ wireless_ctrl_policy[NUM_MTK_VENDOR_ATTRS_WIRELESS_CTRL] = {
@@ -297,7 +297,7 @@
static struct nl_sock * nl_create_handle(struct nl_cb *cb, const char *dbg)
{
struct nl_sock *handle;
-@@ -14412,6 +14425,171 @@ fail:
+@@ -14409,6 +14422,171 @@ fail:
return -ENOBUFS;
}
@@ -469,7 +469,7 @@
const struct wpa_driver_ops wpa_driver_nl80211_ops = {
.name = "nl80211",
.desc = "Linux nl80211/cfg80211",
-@@ -14580,4 +14758,6 @@ const struct wpa_driver_ops wpa_driver_nl80211_ops = {
+@@ -14577,4 +14755,6 @@ const struct wpa_driver_ops wpa_driver_nl80211_ops = {
.ap_wireless = nl80211_ap_wireless,
.ap_rfeatures = nl80211_ap_rfeatures,
.ap_trigtype = nl80211_ap_trigtype,
@@ -477,7 +477,7 @@
+ .amnt_dump = nl80211_amnt_dump,
};
diff --git a/src/drivers/driver_nl80211.h b/src/drivers/driver_nl80211.h
-index fc5217d61..0d85adfee 100644
+index fc5217d..0d85adf 100644
--- a/src/drivers/driver_nl80211.h
+++ b/src/drivers/driver_nl80211.h
@@ -209,6 +209,7 @@ struct wpa_driver_nl80211_data {
@@ -489,7 +489,7 @@
u64 vendor_scan_cookie;
u64 remain_on_chan_cookie;
diff --git a/src/drivers/driver_nl80211_capa.c b/src/drivers/driver_nl80211_capa.c
-index c1cf5b533..8c8b84ed3 100644
+index c1cf5b5..8c8b84e 100644
--- a/src/drivers/driver_nl80211_capa.c
+++ b/src/drivers/driver_nl80211_capa.c
@@ -1127,6 +1127,8 @@ static int wiphy_info_handler(struct nl_msg *msg, void *arg)
@@ -502,5 +502,5 @@
case MTK_NL80211_VENDOR_SUBCMD_RFEATURE_CTRL:
drv->mtk_rfeatures_vendor_cmd_avail = 1;
--
-2.39.2
+2.18.0
diff --git a/recipes-wifi/hostapd/files/patches-2.10.3/mtk-0027-hostapd-mtk-Fix-setting-wrong-seg0-index-for-5G-cent.patch b/recipes-wifi/hostapd/files/patches-2.10.3/mtk-0023-hostapd-mtk-Fix-setting-wrong-seg0-index-for-5G-cent.patch
similarity index 77%
rename from recipes-wifi/hostapd/files/patches-2.10.3/mtk-0027-hostapd-mtk-Fix-setting-wrong-seg0-index-for-5G-cent.patch
rename to recipes-wifi/hostapd/files/patches-2.10.3/mtk-0023-hostapd-mtk-Fix-setting-wrong-seg0-index-for-5G-cent.patch
index 85c4ad4..cd30f92 100644
--- a/recipes-wifi/hostapd/files/patches-2.10.3/mtk-0027-hostapd-mtk-Fix-setting-wrong-seg0-index-for-5G-cent.patch
+++ b/recipes-wifi/hostapd/files/patches-2.10.3/mtk-0023-hostapd-mtk-Fix-setting-wrong-seg0-index-for-5G-cent.patch
@@ -1,7 +1,7 @@
-From 6583d6a35c98648fc5726b16c5c528def0dd4a38 Mon Sep 17 00:00:00 2001
+From a397fa2ee7a72fafbfa5480adfacad75352d7d2a Mon Sep 17 00:00:00 2001
From: Evelyn Tsai <evelyn.tsai@mediatek.com>
Date: Fri, 12 May 2023 05:23:00 +0800
-Subject: [PATCH 27/32] hostapd: mtk: Fix setting wrong seg0 index for 5G
+Subject: [PATCH 23/40] hostapd: mtk: Fix setting wrong seg0 index for 5G
center chan 159 BW40
Signed-off-by: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
@@ -10,10 +10,10 @@
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/ap/ap_config.h b/src/ap/ap_config.h
-index 195816c28..1eb871f10 100644
+index 5b2dbff..b329e81 100644
--- a/src/ap/ap_config.h
+++ b/src/ap/ap_config.h
-@@ -1306,7 +1306,8 @@ hostapd_set_oper_centr_freq_seg0_idx(struct hostapd_config *conf,
+@@ -1305,7 +1305,8 @@ hostapd_set_oper_centr_freq_seg0_idx(struct hostapd_config *conf,
#ifdef CONFIG_IEEE80211BE
if (conf->ieee80211be)
conf->eht_oper_centr_freq_seg0_idx = oper_centr_freq_seg0_idx;
@@ -24,5 +24,5 @@
conf->channel > oper_centr_freq_seg0_idx ? 16 : -16;
#endif /* CONFIG_IEEE80211BE */
--
-2.39.2
+2.18.0
diff --git a/recipes-wifi/hostapd/files/patches-2.10.3/mtk-0028-hostapd-mtk-Add-muru-user-number-debug-command.patch b/recipes-wifi/hostapd/files/patches-2.10.3/mtk-0024-hostapd-mtk-Add-muru-user-number-debug-command.patch
similarity index 89%
rename from recipes-wifi/hostapd/files/patches-2.10.3/mtk-0028-hostapd-mtk-Add-muru-user-number-debug-command.patch
rename to recipes-wifi/hostapd/files/patches-2.10.3/mtk-0024-hostapd-mtk-Add-muru-user-number-debug-command.patch
index 85cd75c..95dae39 100644
--- a/recipes-wifi/hostapd/files/patches-2.10.3/mtk-0028-hostapd-mtk-Add-muru-user-number-debug-command.patch
+++ b/recipes-wifi/hostapd/files/patches-2.10.3/mtk-0024-hostapd-mtk-Add-muru-user-number-debug-command.patch
@@ -1,7 +1,7 @@
-From b232336ca798430ca9d920d1fa58b1418999eeb0 Mon Sep 17 00:00:00 2001
+From de53629544ee0f9508554049bc5927ce2f04fcf9 Mon Sep 17 00:00:00 2001
From: Evelyn Tsai <evelyn.tsai@mediatek.com>
Date: Fri, 12 May 2023 05:24:19 +0800
-Subject: [PATCH 28/32] hostapd: mtk: Add muru user number debug command
+Subject: [PATCH 24/40] hostapd: mtk: Add muru user number debug command
---
hostapd/ctrl_iface.c | 13 ++++++++++++-
@@ -14,10 +14,10 @@
7 files changed, 55 insertions(+), 15 deletions(-)
diff --git a/hostapd/ctrl_iface.c b/hostapd/ctrl_iface.c
-index 4952bef89..972393e77 100644
+index 1bb64ea..f36c138 100644
--- a/hostapd/ctrl_iface.c
+++ b/hostapd/ctrl_iface.c
-@@ -3477,6 +3477,8 @@ hostapd_ctrl_iface_set_edcca(struct hostapd_data *hapd, char *cmd,
+@@ -3398,6 +3398,8 @@ hostapd_ctrl_iface_set_edcca(struct hostapd_data *hapd, char *cmd,
char *buf, size_t buflen)
{
char *pos, *config, *value;
@@ -26,7 +26,7 @@
config = cmd;
pos = os_strchr(config, ' ');
if (pos == NULL)
-@@ -3583,6 +3585,8 @@ hostapd_ctrl_iface_set_mu(struct hostapd_data *hapd, char *cmd,
+@@ -3504,6 +3506,8 @@ hostapd_ctrl_iface_set_mu(struct hostapd_data *hapd, char *cmd,
char *buf, size_t buflen)
{
char *pos, *config, *value;
@@ -35,7 +35,7 @@
config = cmd;
pos = os_strchr(config, ' ');
if (pos == NULL)
-@@ -3600,13 +3604,20 @@ hostapd_ctrl_iface_set_mu(struct hostapd_data *hapd, char *cmd,
+@@ -3521,13 +3525,20 @@ hostapd_ctrl_iface_set_mu(struct hostapd_data *hapd, char *cmd,
return -1;
}
hapd->iconf->mu_onoff = (u8) mu;
@@ -58,7 +58,7 @@
} else {
return -1;
diff --git a/src/ap/ap_drv_ops.c b/src/ap/ap_drv_ops.c
-index b90dd5722..0aec9e925 100644
+index b90dd57..0aec9e9 100644
--- a/src/ap/ap_drv_ops.c
+++ b/src/ap/ap_drv_ops.c
@@ -1162,11 +1162,11 @@ int hostapd_drv_get_edcca(struct hostapd_data *hapd, const u8 mode, u8 *value)
@@ -76,7 +76,7 @@
int hostapd_drv_mu_dump(struct hostapd_data *hapd, u8 *mu_onoff)
diff --git a/src/ap/ap_drv_ops.h b/src/ap/ap_drv_ops.h
-index 1e2a92acb..5dd701e10 100644
+index 1e2a92a..5dd701e 100644
--- a/src/ap/ap_drv_ops.h
+++ b/src/ap/ap_drv_ops.h
@@ -148,7 +148,7 @@ int hostapd_drv_configure_edcca_enable(struct hostapd_data *hapd);
@@ -89,7 +89,7 @@
int hostapd_drv_three_wire_ctrl(struct hostapd_data *hapd);
int hostapd_drv_ibf_ctrl(struct hostapd_data *hapd);
diff --git a/src/ap/hostapd.c b/src/ap/hostapd.c
-index 6e6ae77d7..c684d7e39 100644
+index 24e5df8..25ae08f 100644
--- a/src/ap/hostapd.c
+++ b/src/ap/hostapd.c
@@ -57,6 +57,7 @@
@@ -100,7 +100,7 @@
static int hostapd_flush_old_stations(struct hostapd_data *hapd, u16 reason);
#ifdef CONFIG_WEP
-@@ -2567,7 +2568,7 @@ dfs_offload:
+@@ -2517,7 +2518,7 @@ dfs_offload:
if (hostapd_drv_configure_edcca_threshold(hapd,
hapd->iconf->edcca_threshold) < 0)
goto fail;
@@ -110,7 +110,7 @@
if (hostapd_drv_three_wire_ctrl(hapd) < 0)
goto fail;
diff --git a/src/common/mtk_vendor.h b/src/common/mtk_vendor.h
-index dd1ca2164..99371bf73 100644
+index dd1ca21..99371bf 100644
--- a/src/common/mtk_vendor.h
+++ b/src/common/mtk_vendor.h
@@ -199,6 +199,8 @@ enum mtk_vendor_attr_mu_ctrl {
@@ -133,7 +133,7 @@
+};
#endif /* MTK_VENDOR_H */
diff --git a/src/drivers/driver.h b/src/drivers/driver.h
-index 5c70ec78f..84387a6d7 100644
+index 5c70ec7..84387a6 100644
--- a/src/drivers/driver.h
+++ b/src/drivers/driver.h
@@ -5096,11 +5096,11 @@ struct wpa_driver_ops {
@@ -151,10 +151,10 @@
/**
diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c
-index b923e5c7e..0e7ee4306 100644
+index 3d8cb95..b682620 100644
--- a/src/drivers/driver_nl80211.c
+++ b/src/drivers/driver_nl80211.c
-@@ -13565,13 +13565,13 @@ fail:
+@@ -13562,13 +13562,13 @@ fail:
#ifdef CONFIG_IEEE80211AX
@@ -170,7 +170,7 @@
if (!drv->mtk_mu_vendor_cmd_avail) {
wpa_printf(MSG_INFO,
-@@ -13582,17 +13582,38 @@ static int nl80211_mu_onoff(void *priv, u8 mu_onoff)
+@@ -13579,17 +13579,38 @@ static int nl80211_mu_onoff(void *priv, u8 mu_onoff)
if (!(msg = nl80211_drv_msg(drv, 0, NL80211_CMD_VENDOR)) ||
nla_put_u32(msg, NL80211_ATTR_VENDOR_ID, OUI_MTK) ||
nla_put_u32(msg, NL80211_ATTR_VENDOR_SUBCMD, MTK_NL80211_VENDOR_SUBCMD_MU_CTRL) ||
@@ -214,7 +214,7 @@
}
-@@ -14734,7 +14755,7 @@ const struct wpa_driver_ops wpa_driver_nl80211_ops = {
+@@ -14731,7 +14752,7 @@ const struct wpa_driver_ops wpa_driver_nl80211_ops = {
.update_connect_params = nl80211_update_connection_params,
.send_external_auth_status = nl80211_send_external_auth_status,
.set_4addr_mode = nl80211_set_4addr_mode,
@@ -224,5 +224,5 @@
#ifdef CONFIG_DPP
.dpp_listen = nl80211_dpp_listen,
--
-2.39.2
+2.18.0
diff --git a/recipes-wifi/hostapd/files/patches-2.10.3/mtk-0025-hostapd-mtk-Fix-scan-result-updating-issue.patch b/recipes-wifi/hostapd/files/patches-2.10.3/mtk-0025-hostapd-mtk-Fix-scan-result-updating-issue.patch
deleted file mode 100644
index cbd0111..0000000
--- a/recipes-wifi/hostapd/files/patches-2.10.3/mtk-0025-hostapd-mtk-Fix-scan-result-updating-issue.patch
+++ /dev/null
@@ -1,33 +0,0 @@
-From eb14389eb6c2e30a702ee7ebc98330fbc62edb44 Mon Sep 17 00:00:00 2001
-From: Michael Lee <michael-cy.lee@mediatek.com>
-Date: Wed, 19 Apr 2023 17:18:33 +0800
-Subject: [PATCH 25/32] hostapd: mtk: Fix scan result updating issue
-
-There are no HT capability and operation in beacon of AP operating in
-NOHT.
-Therefore, when updating scan results, HT capability and operation
-should be assigned the default value for this kind of AP.
----
- wpa_supplicant/bss.c | 4 ++++
- 1 file changed, 4 insertions(+)
-
-diff --git a/wpa_supplicant/bss.c b/wpa_supplicant/bss.c
-index 3bfcf7ef4..004d4a639 100644
---- a/wpa_supplicant/bss.c
-+++ b/wpa_supplicant/bss.c
-@@ -307,8 +307,12 @@ static void wpa_bss_copy_res(struct wpa_bss *dst, struct wpa_scan_res *src,
- oper = (struct ieee80211_ht_operation *) elems.ht_operation;
- if (capab)
- dst->ht_capab = le_to_host16(capab->ht_capabilities_info);
-+ else
-+ dst->ht_capab = 0;
- if (oper)
- dst->ht_param = oper->ht_param;
-+ else
-+ dst->ht_param = 0;
-
- calculate_update_time(fetch_time, src->age, &dst->last_update);
- }
---
-2.39.2
-
diff --git a/recipes-wifi/hostapd/files/patches-2.10.3/mtk-0031-hostapd-mtk-add-connac3-PHY-MURU-manual-mode-config-.patch b/recipes-wifi/hostapd/files/patches-2.10.3/mtk-0025-hostapd-mtk-add-connac3-PHY-MURU-manual-mode-config-.patch
similarity index 95%
rename from recipes-wifi/hostapd/files/patches-2.10.3/mtk-0031-hostapd-mtk-add-connac3-PHY-MURU-manual-mode-config-.patch
rename to recipes-wifi/hostapd/files/patches-2.10.3/mtk-0025-hostapd-mtk-add-connac3-PHY-MURU-manual-mode-config-.patch
index 6354d3c..19a3c79 100644
--- a/recipes-wifi/hostapd/files/patches-2.10.3/mtk-0031-hostapd-mtk-add-connac3-PHY-MURU-manual-mode-config-.patch
+++ b/recipes-wifi/hostapd/files/patches-2.10.3/mtk-0025-hostapd-mtk-add-connac3-PHY-MURU-manual-mode-config-.patch
@@ -1,7 +1,8 @@
-From 78107269ba6f1ef6449e385e0182970ad85d7f43 Mon Sep 17 00:00:00 2001
+From 7f1a652729514a0f9a885be30185810c18110c4d Mon Sep 17 00:00:00 2001
From: Howard Hsu <howard-yh.hsu@mediatek.com>
Date: Sat, 3 Jun 2023 17:12:15 +0800
-Subject: [PATCH] hostapd: mtk: add connac3 PHY MURU manual mode config support
+Subject: [PATCH 25/40] hostapd: mtk: add connac3 PHY MURU manual mode config
+ support
This commit supports read the following two formats to set MU/RU manual
mode:
@@ -46,10 +47,10 @@
8 files changed, 390 insertions(+), 43 deletions(-)
diff --git a/hostapd/ctrl_iface.c b/hostapd/ctrl_iface.c
-index 972393e..b280a04 100644
+index f36c138..c288352 100644
--- a/hostapd/ctrl_iface.c
+++ b/hostapd/ctrl_iface.c
-@@ -3579,22 +3579,61 @@ hostapd_ctrl_iface_get_edcca(struct hostapd_data *hapd, char *cmd, char *buf,
+@@ -3500,22 +3500,61 @@ hostapd_ctrl_iface_get_edcca(struct hostapd_data *hapd, char *cmd, char *buf,
}
}
@@ -118,7 +119,7 @@
value = pos;
if (os_strcmp(config, "onoff") == 0) {
-@@ -3604,24 +3643,167 @@ hostapd_ctrl_iface_set_mu(struct hostapd_data *hapd, char *cmd,
+@@ -3525,24 +3564,167 @@ hostapd_ctrl_iface_set_mu(struct hostapd_data *hapd, char *cmd,
return -1;
}
hapd->iconf->mu_onoff = (u8) mu;
@@ -300,7 +301,7 @@
}
-@@ -4613,8 +4795,7 @@ static int hostapd_ctrl_iface_receive_process(struct hostapd_data *hapd,
+@@ -4534,8 +4716,7 @@ static int hostapd_ctrl_iface_receive_process(struct hostapd_data *hapd,
reply_len = hostapd_ctrl_iface_get_edcca(hapd, buf+10, reply,
reply_size);
} else if (os_strncmp(buf, "SET_MU ", 7) == 0) {
@@ -310,7 +311,7 @@
} else if (os_strncmp(buf, "GET_MU", 6) == 0) {
reply_len = hostapd_ctrl_iface_get_mu(hapd, reply, reply_size);
} else if (os_strncmp(buf, "GET_IBF", 7) == 0) {
-@@ -4640,6 +4821,14 @@ static int hostapd_ctrl_iface_receive_process(struct hostapd_data *hapd,
+@@ -4561,6 +4742,14 @@ static int hostapd_ctrl_iface_receive_process(struct hostapd_data *hapd,
} else if (os_strncmp(buf, "DUMP_AMNT", 9) == 0) {
reply_len = hostapd_ctrl_iface_dump_amnt(hapd, buf+10,
reply, reply_size);
@@ -326,10 +327,10 @@
os_memcpy(reply, "UNKNOWN COMMAND\n", 16);
reply_len = 16;
diff --git a/src/ap/ap_config.h b/src/ap/ap_config.h
-index 1eb871f..4e38e67 100644
+index b329e81..d43f1a6 100644
--- a/src/ap/ap_config.h
+++ b/src/ap/ap_config.h
-@@ -1201,6 +1201,7 @@ struct hostapd_config {
+@@ -1200,6 +1200,7 @@ struct hostapd_config {
u8 ibf_enable;
u8 dfs_detect_mode;
u8 amsdu;
@@ -369,10 +370,10 @@
int hostapd_drv_three_wire_ctrl(struct hostapd_data *hapd);
int hostapd_drv_ibf_ctrl(struct hostapd_data *hapd);
diff --git a/src/ap/hostapd.c b/src/ap/hostapd.c
-index c684d7e..52d04d6 100644
+index 25ae08f..0dc86bf 100644
--- a/src/ap/hostapd.c
+++ b/src/ap/hostapd.c
-@@ -2568,7 +2568,7 @@ dfs_offload:
+@@ -2518,7 +2518,7 @@ dfs_offload:
if (hostapd_drv_configure_edcca_threshold(hapd,
hapd->iconf->edcca_threshold) < 0)
goto fail;
@@ -579,10 +580,10 @@
/**
diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c
-index ab121ca..fdd8505 100644
+index b682620..22c56f9 100644
--- a/src/drivers/driver_nl80211.c
+++ b/src/drivers/driver_nl80211.c
-@@ -13566,12 +13566,13 @@ fail:
+@@ -13562,12 +13562,13 @@ fail:
#ifdef CONFIG_IEEE80211AX
@@ -597,7 +598,7 @@
int ret = -ENOBUFS;
if (!drv->mtk_mu_vendor_cmd_avail) {
-@@ -13588,17 +13589,16 @@ static int nl80211_mu_ctrl(void *priv, u8 mode, u8 val)
+@@ -13584,17 +13585,16 @@ static int nl80211_mu_ctrl(void *priv, u8 mode, u8 val)
switch (mode) {
case MU_CTRL_ONOFF:
@@ -622,7 +623,7 @@
ret = -EINVAL;
goto fail;
}
-@@ -13606,9 +13606,8 @@ static int nl80211_mu_ctrl(void *priv, u8 mode, u8 val)
+@@ -13602,9 +13602,8 @@ static int nl80211_mu_ctrl(void *priv, u8 mode, u8 val)
nla_nest_end(msg, data);
ret = send_and_recv_msgs(drv, msg, NULL, NULL, NULL, NULL);
diff --git a/recipes-wifi/hostapd/files/patches-2.10.3/mtk-0032-hostapd-mtk-Add-HE-capabilities-check.patch b/recipes-wifi/hostapd/files/patches-2.10.3/mtk-0026-hostapd-mtk-Add-HE-capabilities-check.patch
similarity index 91%
rename from recipes-wifi/hostapd/files/patches-2.10.3/mtk-0032-hostapd-mtk-Add-HE-capabilities-check.patch
rename to recipes-wifi/hostapd/files/patches-2.10.3/mtk-0026-hostapd-mtk-Add-HE-capabilities-check.patch
index 4b7c8b4..a93ae69 100644
--- a/recipes-wifi/hostapd/files/patches-2.10.3/mtk-0032-hostapd-mtk-Add-HE-capabilities-check.patch
+++ b/recipes-wifi/hostapd/files/patches-2.10.3/mtk-0026-hostapd-mtk-Add-HE-capabilities-check.patch
@@ -1,7 +1,7 @@
-From bb2459cc960ea017702c11e19cf3dbef4df599b8 Mon Sep 17 00:00:00 2001
+From 963b6800d4416d5a88053097128a33d8bdc8f56b Mon Sep 17 00:00:00 2001
From: MeiChia Chiu <meichia.chiu@mediatek.com>
Date: Fri, 9 Jun 2023 09:03:05 +0800
-Subject: [PATCH 32/32] hostapd: mtk: Add HE capabilities check
+Subject: [PATCH 26/40] hostapd: mtk: Add HE capabilities check
Add HE capabilities check.
Since "HE capabilities" check has been removed by driver,
@@ -11,7 +11,7 @@
1 file changed, 26 insertions(+)
diff --git a/src/ap/hw_features.c b/src/ap/hw_features.c
-index 828b9261b..991af2c45 100644
+index 828b926..991af2c 100644
--- a/src/ap/hw_features.c
+++ b/src/ap/hw_features.c
@@ -680,6 +680,32 @@ static int ieee80211ac_supported_vht_capab(struct hostapd_iface *iface)
@@ -48,5 +48,5 @@
}
#endif /* CONFIG_IEEE80211AX */
--
-2.39.2
+2.18.0
diff --git a/recipes-wifi/hostapd/files/patches-2.10.3/mtk-0026-hostapd-mtk-Avoid-setting-beacon-after-wpa_supplican.patch b/recipes-wifi/hostapd/files/patches-2.10.3/mtk-0026-hostapd-mtk-Avoid-setting-beacon-after-wpa_supplican.patch
deleted file mode 100644
index dbd7163..0000000
--- a/recipes-wifi/hostapd/files/patches-2.10.3/mtk-0026-hostapd-mtk-Avoid-setting-beacon-after-wpa_supplican.patch
+++ /dev/null
@@ -1,165 +0,0 @@
-From 67e2363c4875dd918418dd84b43f86041db690c7 Mon Sep 17 00:00:00 2001
-From: Evelyn Tsai <evelyn.tsai@mediatek.com>
-Date: Fri, 12 May 2023 05:21:28 +0800
-Subject: [PATCH] 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 e575c37d1..0e352c5c7 100644
---- a/hostapd/ctrl_iface.c
-+++ b/hostapd/ctrl_iface.c
-@@ -194,11 +194,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 f26e5254c..1aaeaa8e4 100644
---- a/src/ap/beacon.c
-+++ b/src/ap/beacon.c
-@@ -2246,7 +2246,8 @@ int ieee802_11_set_beacon(struct hostapd_data *hapd)
- continue;
-
- for (i = 0; i < other->num_bss; i++) {
-- if (other->bss[i] && other->bss[i]->started)
-+ if (other->bss[i] && other->bss[i]->started &&
-+ !other->bss[i]->stopped_by_supplicant)
- __ieee802_11_set_beacon(other->bss[i]);
- }
- }
-@@ -2262,6 +2263,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;
- }
-@@ -2278,6 +2280,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 725d3cd34..78fd9d8ec 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 aab8a4665..d52188bb7 100644
---- a/src/ap/ctrl_iface_ap.c
-+++ b/src/ap/ctrl_iface_ap.c
-@@ -1028,8 +1028,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 28e549b61..be75613c8 100644
---- a/src/ap/hostapd.c
-+++ b/src/ap/hostapd.c
-@@ -510,6 +510,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_ucode_free_bss(hapd);
-@@ -1320,6 +1321,7 @@ int hostapd_setup_bss(struct hostapd_data *hapd, int first, bool start_beacon)
- return -1;
- }
- hapd->started = 1;
-+ hapd->stopped_by_supplicant = 0;
-
- if (!first || first == -1) {
- u8 *addr = hapd->own_addr;
-@@ -4289,7 +4291,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 5bd1537fe..435dbd027 100644
---- a/src/ap/hostapd.h
-+++ b/src/ap/hostapd.h
-@@ -197,6 +197,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];
- u8 mld_addr[ETH_ALEN];
---
-2.39.2
-
diff --git a/recipes-wifi/hostapd/files/patches-2.10.3/mtk-0033-hostapd-mtk-Fix-background-channel-overlapping-opera.patch b/recipes-wifi/hostapd/files/patches-2.10.3/mtk-0027-hostapd-mtk-Fix-background-channel-overlapping-opera.patch
similarity index 92%
rename from recipes-wifi/hostapd/files/patches-2.10.3/mtk-0033-hostapd-mtk-Fix-background-channel-overlapping-opera.patch
rename to recipes-wifi/hostapd/files/patches-2.10.3/mtk-0027-hostapd-mtk-Fix-background-channel-overlapping-opera.patch
index dd121ca..1134253 100644
--- a/recipes-wifi/hostapd/files/patches-2.10.3/mtk-0033-hostapd-mtk-Fix-background-channel-overlapping-opera.patch
+++ b/recipes-wifi/hostapd/files/patches-2.10.3/mtk-0027-hostapd-mtk-Fix-background-channel-overlapping-opera.patch
@@ -1,8 +1,8 @@
-From 76e54b095fdd8ab65a562c28fba330afcfb519ec Mon Sep 17 00:00:00 2001
+From b79b625e3790f0d9152f736629fbc0dcd826bf62 Mon Sep 17 00:00:00 2001
From: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
Date: Wed, 5 Jul 2023 10:44:15 +0800
-Subject: [PATCH] hostapd: mtk: Fix background channel overlapping operating
- channel issue
+Subject: [PATCH 27/40] hostapd: mtk: Fix background channel overlapping
+ operating channel issue
Signed-off-by: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
---
diff --git a/recipes-wifi/hostapd/files/patches-2.10.3/mtk-0034-hostapd-mtk-Fix-hostapd_dfs_start_cac-log.patch b/recipes-wifi/hostapd/files/patches-2.10.3/mtk-0028-hostapd-mtk-Fix-hostapd_dfs_start_cac-log.patch
similarity index 81%
rename from recipes-wifi/hostapd/files/patches-2.10.3/mtk-0034-hostapd-mtk-Fix-hostapd_dfs_start_cac-log.patch
rename to recipes-wifi/hostapd/files/patches-2.10.3/mtk-0028-hostapd-mtk-Fix-hostapd_dfs_start_cac-log.patch
index 96522dd..b85fdca 100644
--- a/recipes-wifi/hostapd/files/patches-2.10.3/mtk-0034-hostapd-mtk-Fix-hostapd_dfs_start_cac-log.patch
+++ b/recipes-wifi/hostapd/files/patches-2.10.3/mtk-0028-hostapd-mtk-Fix-hostapd_dfs_start_cac-log.patch
@@ -1,7 +1,7 @@
-From fba1094daa7efaea9e2e3e9342b6eb6bd00ca174 Mon Sep 17 00:00:00 2001
+From aeabc47685135ee69cdeca5f5753c4057ca0f608 Mon Sep 17 00:00:00 2001
From: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
Date: Wed, 5 Jul 2023 10:47:20 +0800
-Subject: [PATCH 34/34] hostapd: mtk: Fix hostapd_dfs_start_cac log
+Subject: [PATCH 28/40] hostapd: mtk: Fix hostapd_dfs_start_cac log
Signed-off-by: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
---
@@ -9,10 +9,10 @@
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/src/ap/dfs.c b/src/ap/dfs.c
-index 6506d7a..c255978 100644
+index c9a9c6c..593a468 100644
--- a/src/ap/dfs.c
+++ b/src/ap/dfs.c
-@@ -1655,9 +1655,11 @@ int hostapd_dfs_start_cac(struct hostapd_iface *iface, int freq,
+@@ -1650,9 +1650,11 @@ int hostapd_dfs_start_cac(struct hostapd_iface *iface, int freq,
/* TODO: How to check CAC time for ETSI weather channels? */
iface->dfs_cac_ms = 60000;
wpa_msg(iface->bss[0]->msg_ctx, MSG_INFO, DFS_EVENT_CAC_START
diff --git a/recipes-wifi/hostapd/files/patches-2.10.3/mtk-0035-hostapd-mtk-Check-the-bridge-after-ioctl-SIOCBRADDIF.patch b/recipes-wifi/hostapd/files/patches-2.10.3/mtk-0029-hostapd-mtk-Check-the-bridge-after-ioctl-SIOCBRADDIF.patch
similarity index 90%
rename from recipes-wifi/hostapd/files/patches-2.10.3/mtk-0035-hostapd-mtk-Check-the-bridge-after-ioctl-SIOCBRADDIF.patch
rename to recipes-wifi/hostapd/files/patches-2.10.3/mtk-0029-hostapd-mtk-Check-the-bridge-after-ioctl-SIOCBRADDIF.patch
index 1937640..3d6f958 100644
--- a/recipes-wifi/hostapd/files/patches-2.10.3/mtk-0035-hostapd-mtk-Check-the-bridge-after-ioctl-SIOCBRADDIF.patch
+++ b/recipes-wifi/hostapd/files/patches-2.10.3/mtk-0029-hostapd-mtk-Check-the-bridge-after-ioctl-SIOCBRADDIF.patch
@@ -1,7 +1,8 @@
-From 99159b174eb245a7162fe38900971cdff017cf75 Mon Sep 17 00:00:00 2001
+From 1bc32b7308d9460116954f048eca89f02204825c Mon Sep 17 00:00:00 2001
From: Michael Lee <michael-cy.lee@mediatek.com>
Date: Thu, 13 Jul 2023 13:14:26 +0800
-Subject: [PATCH] hostapd: mtk: Check the bridge after ioctl SIOCBRADDIF failed
+Subject: [PATCH 29/40] hostapd: mtk: Check the bridge after ioctl SIOCBRADDIF
+ failed
If ioctl returns EBUSY on command SIOCBRADDIF, the interface might
already be bridged by others, and linux_br_add_if should not indicate an
@@ -51,5 +52,5 @@
return 0;
--
-2.25.1
+2.18.0
diff --git a/recipes-wifi/hostapd/files/patches-2.10.3/mtk-0030-hostapd-mtk-Fix-unexpected-AP-beacon-state-transitio.patch b/recipes-wifi/hostapd/files/patches-2.10.3/mtk-0030-hostapd-mtk-Fix-unexpected-AP-beacon-state-transitio.patch
deleted file mode 100644
index 69d1a31..0000000
--- a/recipes-wifi/hostapd/files/patches-2.10.3/mtk-0030-hostapd-mtk-Fix-unexpected-AP-beacon-state-transitio.patch
+++ /dev/null
@@ -1,36 +0,0 @@
-From 62c4fa824adefc85ec7820b431f5d617aaf07bc7 Mon Sep 17 00:00:00 2001
-From: Michael Lee <michael-cy.lee@mediatek.com>
-Date: Wed, 3 May 2023 16:10:57 +0800
-Subject: [PATCH 30/32] hostapd: mtk: Fix unexpected AP beacon state transition
-
-When AP fails to set the beacon, it assigns bss->beacon_set to 0 no
-matter what the error number is.
-However, in the case that the error number is -EBUSY, the driver might
-not free the beacon and expect a later beacon re-setting. If hostapd set
-a new beacon under this case, the driver will return -EALREADY.
-This patch checks the error number after hostapd fails to set the
-beacon. If the error number is -EBUSY, bss->beacon_set will not be
-assigned to 0.
-
-Signed-off-by: Michael Lee <michael-cy.lee@mediatek.com>
----
- src/drivers/driver_nl80211.c | 3 ++-
- 1 file changed, 2 insertions(+), 1 deletion(-)
-
-diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c
-index 0e7ee4306..ab121ca16 100644
---- a/src/drivers/driver_nl80211.c
-+++ b/src/drivers/driver_nl80211.c
-@@ -5395,7 +5395,8 @@ static int wpa_driver_nl80211_set_ap(void *priv,
- ret, strerror(-ret));
- if (!bss->flink->beacon_set)
- ret = 0;
-- bss->flink->beacon_set = 0;
-+ if (ret != -EBUSY)
-+ bss->flink->beacon_set = 0;
- } else {
- link->beacon_set = 1;
- nl80211_set_bss(bss, params->cts_protect, params->preamble,
---
-2.39.2
-
diff --git a/recipes-wifi/hostapd/files/patches-2.10.3/mtk-0036-hostapd-mtk-Update-parameter_set_count-in-MU-EDCA-IE.patch b/recipes-wifi/hostapd/files/patches-2.10.3/mtk-0030-hostapd-mtk-Update-parameter_set_count-in-MU-EDCA-IE.patch
similarity index 84%
rename from recipes-wifi/hostapd/files/patches-2.10.3/mtk-0036-hostapd-mtk-Update-parameter_set_count-in-MU-EDCA-IE.patch
rename to recipes-wifi/hostapd/files/patches-2.10.3/mtk-0030-hostapd-mtk-Update-parameter_set_count-in-MU-EDCA-IE.patch
index 295ce2b..8073974 100644
--- a/recipes-wifi/hostapd/files/patches-2.10.3/mtk-0036-hostapd-mtk-Update-parameter_set_count-in-MU-EDCA-IE.patch
+++ b/recipes-wifi/hostapd/files/patches-2.10.3/mtk-0030-hostapd-mtk-Update-parameter_set_count-in-MU-EDCA-IE.patch
@@ -1,7 +1,7 @@
-From 11c7b9e7b7d4dfef23b2f8f2d72591c1c3590fd5 Mon Sep 17 00:00:00 2001
+From c6557f76857bc80128d2d02e615ce32de8a0c998 Mon Sep 17 00:00:00 2001
From: MeiChia Chiu <meichia.chiu@mediatek.com>
Date: Fri, 14 Jul 2023 17:19:13 +0800
-Subject: [PATCH] hostapd: mtk: Update parameter_set_count in MU EDCA IE
+Subject: [PATCH 30/40] hostapd: mtk: Update parameter_set_count in MU EDCA IE
without this patch, MU EDCA Parameter update count not equal to
WMM Parameter set count.
@@ -24,5 +24,5 @@
pos, sizeof(*edca));
--
-2.39.0
+2.18.0
diff --git a/recipes-wifi/hostapd/files/patches-2.10.3/mtk-0037-hostapd-mtk-Add-extension-IE-list-for-non-inherit-IE.patch b/recipes-wifi/hostapd/files/patches-2.10.3/mtk-0031-hostapd-mtk-add-extension-IE-list-for-non-inherit-IE.patch
similarity index 89%
rename from recipes-wifi/hostapd/files/patches-2.10.3/mtk-0037-hostapd-mtk-Add-extension-IE-list-for-non-inherit-IE.patch
rename to recipes-wifi/hostapd/files/patches-2.10.3/mtk-0031-hostapd-mtk-add-extension-IE-list-for-non-inherit-IE.patch
index 45a340d..52deb06 100644
--- a/recipes-wifi/hostapd/files/patches-2.10.3/mtk-0037-hostapd-mtk-Add-extension-IE-list-for-non-inherit-IE.patch
+++ b/recipes-wifi/hostapd/files/patches-2.10.3/mtk-0031-hostapd-mtk-add-extension-IE-list-for-non-inherit-IE.patch
@@ -1,8 +1,8 @@
-From d65c803ab5583dddc6574b09fee47ccfb39cb99b Mon Sep 17 00:00:00 2001
+From de15bbc394a478d141e416114297213d4e4b027d Mon Sep 17 00:00:00 2001
From: mtk20656 <chank.chen@mediatek.com>
Date: Mon, 24 Jul 2023 11:30:27 +0800
-Subject: [PATCH] hostapd: mtk: add extension IE list for non-inherit IE in
- mbssid
+Subject: [PATCH 31/40] hostapd: mtk: add extension IE list for non-inherit IE
+ in mbssid
Certain clients do not scan all non tx profiles due to absence of
element ID extension list which is mandatory field in non inheritance
@@ -14,6 +14,7 @@
---
src/ap/ieee802_11.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
+ mode change 100644 => 100755 src/ap/ieee802_11.c
diff --git a/src/ap/ieee802_11.c b/src/ap/ieee802_11.c
old mode 100644
diff --git a/recipes-wifi/hostapd/files/patches-2.10.3/mtk-0038-hostapd-mtk-Fix-11vmbss-aid-using-wrong-pool.patch b/recipes-wifi/hostapd/files/patches-2.10.3/mtk-0032-hostapd-mtk-Fix-11vmbss-aid-using-wrong-pool.patch
similarity index 85%
rename from recipes-wifi/hostapd/files/patches-2.10.3/mtk-0038-hostapd-mtk-Fix-11vmbss-aid-using-wrong-pool.patch
rename to recipes-wifi/hostapd/files/patches-2.10.3/mtk-0032-hostapd-mtk-Fix-11vmbss-aid-using-wrong-pool.patch
index 7cd34cd..7eb42ad 100644
--- a/recipes-wifi/hostapd/files/patches-2.10.3/mtk-0038-hostapd-mtk-Fix-11vmbss-aid-using-wrong-pool.patch
+++ b/recipes-wifi/hostapd/files/patches-2.10.3/mtk-0032-hostapd-mtk-Fix-11vmbss-aid-using-wrong-pool.patch
@@ -1,7 +1,7 @@
-From 1671a37b5990929bd11823158d496e7877d83d92 Mon Sep 17 00:00:00 2001
+From b99fd7f0b86a87fc82d63ec809fd9a73f308dd08 Mon Sep 17 00:00:00 2001
From: "Allen.Ye" <allen.ye@mediatek.com>
Date: Wed, 2 Aug 2023 18:33:31 +0800
-Subject: [PATCH 38/38] hostapd: mtk: Fix 11vmbss aid using wrong pool
+Subject: [PATCH 32/40] hostapd: mtk: Fix 11vmbss aid using wrong pool
Fix 11vmbss aid using wrong pool.
All STAs use the aid pool in transmitted bss.
diff --git a/recipes-wifi/hostapd/files/patches-2.10.3/mtk-0039-hostapd-mtk-Fix-rnr-ie-length-when-no-need-to-report.patch b/recipes-wifi/hostapd/files/patches-2.10.3/mtk-0033-hostapd-mtk-Fix-rnr-ie-length-when-no-need-to-report.patch
similarity index 87%
rename from recipes-wifi/hostapd/files/patches-2.10.3/mtk-0039-hostapd-mtk-Fix-rnr-ie-length-when-no-need-to-report.patch
rename to recipes-wifi/hostapd/files/patches-2.10.3/mtk-0033-hostapd-mtk-Fix-rnr-ie-length-when-no-need-to-report.patch
index 9218f9b..c9df793 100644
--- a/recipes-wifi/hostapd/files/patches-2.10.3/mtk-0039-hostapd-mtk-Fix-rnr-ie-length-when-no-need-to-report.patch
+++ b/recipes-wifi/hostapd/files/patches-2.10.3/mtk-0033-hostapd-mtk-Fix-rnr-ie-length-when-no-need-to-report.patch
@@ -1,7 +1,7 @@
-From ea3e20d6cc8d11750e509a701131297da81ef35d Mon Sep 17 00:00:00 2001
+From ee4aa23d0c87c8fe69f8ba28fe5faf95bf0103d8 Mon Sep 17 00:00:00 2001
From: "Allen.Ye" <allen.ye@mediatek.com>
Date: Mon, 7 Aug 2023 15:27:27 +0800
-Subject: [PATCH 39/39] hostapd: mtk: Fix rnr ie length when no need to report
+Subject: [PATCH 33/40] hostapd: mtk: Fix rnr ie length when no need to report
bss
Fix rnr ie length when no need to report bss. If we don't have content in
diff --git a/recipes-wifi/hostapd/files/patches-2.10.3/mtk-0040-hostapd-mtk-add-back-ht-vht-cap-missing-field-before.patch b/recipes-wifi/hostapd/files/patches-2.10.3/mtk-0034-hostapd-mtk-add-back-ht-vht-cap-missing-field-before.patch
similarity index 85%
rename from recipes-wifi/hostapd/files/patches-2.10.3/mtk-0040-hostapd-mtk-add-back-ht-vht-cap-missing-field-before.patch
rename to recipes-wifi/hostapd/files/patches-2.10.3/mtk-0034-hostapd-mtk-add-back-ht-vht-cap-missing-field-before.patch
index 0a27496..80b7589 100644
--- a/recipes-wifi/hostapd/files/patches-2.10.3/mtk-0040-hostapd-mtk-add-back-ht-vht-cap-missing-field-before.patch
+++ b/recipes-wifi/hostapd/files/patches-2.10.3/mtk-0034-hostapd-mtk-add-back-ht-vht-cap-missing-field-before.patch
@@ -1,8 +1,8 @@
-From 2ea36366ea036e3063ff553a2939c9cac17c6ac8 Mon Sep 17 00:00:00 2001
+From 26e0cd2739dc56e02cc7e1b5582220d0fcde795b Mon Sep 17 00:00:00 2001
From: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
Date: Tue, 8 Aug 2023 19:21:41 +0800
-Subject: [PATCH] hostapd: mtk: add back ht vht cap missing field before dfs
- channel fallback
+Subject: [PATCH 34/40] hostapd: mtk: add back ht vht cap missing field before
+ dfs channel fallback
hostapd_event_ch_switch would set / clear ht_capab and vht_capab, based
on the bandwidth of switched channel.
@@ -22,10 +22,10 @@
1 file changed, 7 insertions(+)
diff --git a/src/ap/hostapd.c b/src/ap/hostapd.c
-index c2e0b13..4b7ebc5 100644
+index 0dc86bf..2283b19 100644
--- a/src/ap/hostapd.c
+++ b/src/ap/hostapd.c
-@@ -4161,6 +4161,13 @@ hostapd_switch_channel_fallback(struct hostapd_iface *iface,
+@@ -4111,6 +4111,13 @@ hostapd_switch_channel_fallback(struct hostapd_iface *iface,
break;
}
diff --git a/recipes-wifi/hostapd/files/patches-2.10.3/mtk-0035-hostapd-mtk-update-op_class-when-AP-channel-switchin.patch b/recipes-wifi/hostapd/files/patches-2.10.3/mtk-0035-hostapd-mtk-update-op_class-when-AP-channel-switchin.patch
new file mode 100644
index 0000000..05b2121
--- /dev/null
+++ b/recipes-wifi/hostapd/files/patches-2.10.3/mtk-0035-hostapd-mtk-update-op_class-when-AP-channel-switchin.patch
@@ -0,0 +1,36 @@
+From ef5f744c72f2e6ec6b7d4ec1ce4f233470ff7689 Mon Sep 17 00:00:00 2001
+From: Michael-CY Lee <michael-cy.lee@mediatek.com>
+Date: Wed, 23 Aug 2023 17:44:50 +0800
+Subject: [PATCH 35/40] hostapd: mtk: update op_class when AP channel switching
+
+Signed-off-by: Michael Lee <michael-cy.lee@mediatek.com>
+---
+ src/ap/drv_callbacks.c | 5 ++++-
+ 1 file changed, 4 insertions(+), 1 deletion(-)
+
+diff --git a/src/ap/drv_callbacks.c b/src/ap/drv_callbacks.c
+index c3fc419..1911f85 100644
+--- a/src/ap/drv_callbacks.c
++++ b/src/ap/drv_callbacks.c
+@@ -873,7 +873,7 @@ void hostapd_event_ch_switch(struct hostapd_data *hapd, int freq, int ht,
+ {
+ #ifdef NEED_AP_MLME
+ int channel, chwidth, is_dfs0, is_dfs;
+- u8 seg0_idx = 0, seg1_idx = 0;
++ u8 seg0_idx = 0, seg1_idx = 0, op_class, chan_no;
+ size_t i;
+
+ hostapd_logger(hapd, NULL, HOSTAPD_MODULE_IEEE80211,
+@@ -995,6 +995,9 @@ void hostapd_event_ch_switch(struct hostapd_data *hapd, int freq, int ht,
+ hapd->iconf->ht_capab &= ~HT_CAP_INFO_SUPP_CHANNEL_WIDTH_SET;
+
+ hapd->iconf->secondary_channel = offset;
++ ieee80211_freq_to_channel_ext(freq, offset, chwidth,
++ &op_class, &chan_no);
++ hapd->iconf->op_class = op_class;
+ hostapd_set_oper_chwidth(hapd->iconf, chwidth);
+ hostapd_set_oper_centr_freq_seg0_idx(hapd->iconf, seg0_idx);
+ hostapd_set_oper_centr_freq_seg1_idx(hapd->iconf, seg1_idx);
+--
+2.18.0
+
diff --git a/recipes-wifi/hostapd/files/patches-2.10.3/mtk-1001-hostapd-mtk-Add-support-for-gtk-rekeying-in-hostapd-.patch b/recipes-wifi/hostapd/files/patches-2.10.3/mtk-0036-hostapd-mtk-Add-support-for-gtk-rekeying-in-hostapd-.patch
similarity index 86%
rename from recipes-wifi/hostapd/files/patches-2.10.3/mtk-1001-hostapd-mtk-Add-support-for-gtk-rekeying-in-hostapd-.patch
rename to recipes-wifi/hostapd/files/patches-2.10.3/mtk-0036-hostapd-mtk-Add-support-for-gtk-rekeying-in-hostapd-.patch
index 25a401d..3dd5457 100644
--- a/recipes-wifi/hostapd/files/patches-2.10.3/mtk-1001-hostapd-mtk-Add-support-for-gtk-rekeying-in-hostapd-.patch
+++ b/recipes-wifi/hostapd/files/patches-2.10.3/mtk-0036-hostapd-mtk-Add-support-for-gtk-rekeying-in-hostapd-.patch
@@ -1,8 +1,8 @@
-From d9ddfb581c40edd45b7c1a30bfc2889ddb2102a4 Mon Sep 17 00:00:00 2001
+From eaff9afb87f172b09eac63237b099f7c4e5def3c Mon Sep 17 00:00:00 2001
From: mtk23510 <rudra.shahi@mediatek.com>
Date: Fri, 26 May 2023 14:52:35 +0800
-Subject: [PATCH 1001/1001] hostapd: mtk: Add support for gtk rekeying in
- hostapd cli
+Subject: [PATCH 36/40] hostapd: mtk: Add support for gtk rekeying in hostapd
+ cli
Signed-off-by: mtk23510 <rudra.shahi@mediatek.com>
---
@@ -10,7 +10,7 @@
1 file changed, 13 insertions(+)
diff --git a/hostapd/hostapd_cli.c b/hostapd/hostapd_cli.c
-index 6d763f327..363a6bb93 100644
+index 6d763f3..363a6bb 100644
--- a/hostapd/hostapd_cli.c
+++ b/hostapd/hostapd_cli.c
@@ -1256,6 +1256,15 @@ static int hostapd_cli_cmd_update_beacon(struct wpa_ctrl *ctrl, int argc,
@@ -41,5 +41,5 @@
"= drop all ERP keys"},
{ "log_level", hostapd_cli_cmd_log_level, NULL,
--
-2.39.2
+2.18.0
diff --git a/recipes-wifi/hostapd/files/patches-2.10.3/mtk-0037-hostapd-mtk-Fix-wpa_supplicant-configuration-parsing.patch b/recipes-wifi/hostapd/files/patches-2.10.3/mtk-0037-hostapd-mtk-Fix-wpa_supplicant-configuration-parsing.patch
new file mode 100644
index 0000000..f7f22d8
--- /dev/null
+++ b/recipes-wifi/hostapd/files/patches-2.10.3/mtk-0037-hostapd-mtk-Fix-wpa_supplicant-configuration-parsing.patch
@@ -0,0 +1,33 @@
+From a1fd2056b0e3820920778fd9252cec645cbb6389 Mon Sep 17 00:00:00 2001
+From: Michael Lee <michael-cy.lee@mediatek.com>
+Date: Fri, 7 Jul 2023 17:14:40 +0800
+Subject: [PATCH 37/40] hostapd: mtk: Fix wpa_supplicant configuration parsing
+ error
+
+In the original flow, after hostapd_config_tx_queue successfully
+parses a tx_queue variable, it would not return immediately. Then it
+would print out "unknow global field" later and set return val to -1.
+
+This patch returns immediately after hostapd_config_tx_queue
+successfully parses a tx_queue variable.
+
+Signed-off-by: Michael Lee <michael-cy.lee@mediatek.com>
+---
+ wpa_supplicant/config.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/wpa_supplicant/config.c b/wpa_supplicant/config.c
+index 325ab8d..2652c8a 100644
+--- a/wpa_supplicant/config.c
++++ b/wpa_supplicant/config.c
+@@ -5715,6 +5715,7 @@ int wpa_config_process_global(struct wpa_config *config, char *pos, int line)
+ line);
+ return -1;
+ }
++ return ret;
+ }
+
+ if (os_strncmp(pos, "wmm_ac_", 7) == 0) {
+--
+2.18.0
+
diff --git a/recipes-wifi/hostapd/files/patches-2.10.3/mtk-0038-hostapd-mtk-Set-WMM-and-TX-queue-parameters-for-wpa_.patch b/recipes-wifi/hostapd/files/patches-2.10.3/mtk-0038-hostapd-mtk-Set-WMM-and-TX-queue-parameters-for-wpa_.patch
new file mode 100644
index 0000000..27beaf7
--- /dev/null
+++ b/recipes-wifi/hostapd/files/patches-2.10.3/mtk-0038-hostapd-mtk-Set-WMM-and-TX-queue-parameters-for-wpa_.patch
@@ -0,0 +1,48 @@
+From b52a1f04b4a897e88b5a14f61befd71f65cdc062 Mon Sep 17 00:00:00 2001
+From: Michael Lee <michael-cy.lee@mediatek.com>
+Date: Tue, 11 Jul 2023 14:17:43 +0800
+Subject: [PATCH 38/40] hostapd: mtk: Set WMM and TX queue parameters for
+ wpa_supplicant
+
+Since most of the time, wpa_supplicant will be used to setup an STA
+interface, it's default WMM and TX queue parameters should be set for
+STA.
+
+Signed-off-by: Michael Lee <michael-cy.lee@mediatek.com>
+---
+ wpa_supplicant/config.c | 12 ++++++------
+ 1 file changed, 6 insertions(+), 6 deletions(-)
+
+diff --git a/wpa_supplicant/config.c b/wpa_supplicant/config.c
+index 2652c8a..cd40258 100644
+--- a/wpa_supplicant/config.c
++++ b/wpa_supplicant/config.c
+@@ -4673,19 +4673,19 @@ struct wpa_config * wpa_config_alloc_empty(const char *ctrl_interface,
+ const struct hostapd_wmm_ac_params ac_bk =
+ { aCWmin, aCWmax, 7, 0, 0 }; /* background traffic */
+ const struct hostapd_wmm_ac_params ac_be =
+- { aCWmin, aCWmax, 3, 0, 0 }; /* best effort traffic */
++ { aCWmin, aCWmin + 2, 3, 0, 0 }; /* best effort traffic */
+ const struct hostapd_wmm_ac_params ac_vi = /* video traffic */
+- { aCWmin - 1, aCWmin, 2, 3008 / 32, 0 };
++ { aCWmin - 1, aCWmin, 1, 3008 / 32, 0 };
+ const struct hostapd_wmm_ac_params ac_vo = /* voice traffic */
+- { aCWmin - 2, aCWmin - 1, 2, 1504 / 32, 0 };
++ { aCWmin - 2, aCWmin - 1, 1, 1504 / 32, 0 };
+ const struct hostapd_tx_queue_params txq_bk =
+ { 7, ecw2cw(aCWmin), ecw2cw(aCWmax), 0 };
+ const struct hostapd_tx_queue_params txq_be =
+- { 3, ecw2cw(aCWmin), 4 * (ecw2cw(aCWmin) + 1) - 1, 0 };
++ { 3, ecw2cw(aCWmin), ecw2cw(aCWmax), 0 };
+ const struct hostapd_tx_queue_params txq_vi =
+- { 1, (ecw2cw(aCWmin) + 1) / 2 - 1, ecw2cw(aCWmin), 30 };
++ { 2, (ecw2cw(aCWmin) + 1) / 2 - 1, ecw2cw(aCWmin), 30 };
+ const struct hostapd_tx_queue_params txq_vo =
+- { 1, (ecw2cw(aCWmin) + 1) / 4 - 1,
++ { 2, (ecw2cw(aCWmin) + 1) / 4 - 1,
+ (ecw2cw(aCWmin) + 1) / 2 - 1, 15 };
+
+ #undef ecw2cw
+--
+2.18.0
+
diff --git a/recipes-wifi/hostapd/files/patches-2.10.3/mtk-0039-hostapd-mtk-Set-STA-TX-queue-parameters-configuratio.patch b/recipes-wifi/hostapd/files/patches-2.10.3/mtk-0039-hostapd-mtk-Set-STA-TX-queue-parameters-configuratio.patch
new file mode 100644
index 0000000..9c8c63b
--- /dev/null
+++ b/recipes-wifi/hostapd/files/patches-2.10.3/mtk-0039-hostapd-mtk-Set-STA-TX-queue-parameters-configuratio.patch
@@ -0,0 +1,78 @@
+From 55837ad406c9af8a398d6073809151f7a3779b74 Mon Sep 17 00:00:00 2001
+From: Michael Lee <michael-cy.lee@mediatek.com>
+Date: Fri, 7 Jul 2023 17:16:11 +0800
+Subject: [PATCH 39/40] hostapd: mtk: Set STA TX queue parameters configuration
+ after association
+
+This patch adds the way for wpa_supplicant to set driver's TX queue
+parameters.
+Since STA parses and apply TX queue parameters from AP beacon's WMM IE
+during association, wpa_supplicant set driver's TX queue parameters
+after the association.
+
+Signed-off-by: Michael Lee <michael-cy.lee@mediatek.com>
+---
+ wpa_supplicant/driver_i.h | 12 ++++++++++++
+ wpa_supplicant/events.c | 16 ++++++++++++++++
+ 2 files changed, 28 insertions(+)
+
+diff --git a/wpa_supplicant/driver_i.h b/wpa_supplicant/driver_i.h
+index 48953c1..0699689 100644
+--- a/wpa_supplicant/driver_i.h
++++ b/wpa_supplicant/driver_i.h
+@@ -321,6 +321,18 @@ static inline int wpa_drv_set_country(struct wpa_supplicant *wpa_s,
+ return 0;
+ }
+
++static inline int wpa_drv_set_tx_queue_params(struct wpa_supplicant *wpa_s,
++ int q, int aifs, int cw_min,
++ int cw_max, int burst_time)
++{
++ int link_id = -1;
++ if (wpa_s->driver->set_tx_queue_params)
++ return wpa_s->driver->set_tx_queue_params(wpa_s->drv_priv, q,
++ aifs, cw_min, cw_max,
++ burst_time, link_id);
++ return 0;
++}
++
+ static inline int wpa_drv_send_mlme(struct wpa_supplicant *wpa_s,
+ const u8 *data, size_t data_len, int noack,
+ unsigned int freq, unsigned int wait)
+diff --git a/wpa_supplicant/events.c b/wpa_supplicant/events.c
+index 03442f5..5eb5248 100644
+--- a/wpa_supplicant/events.c
++++ b/wpa_supplicant/events.c
+@@ -3557,6 +3557,20 @@ out:
+ return wpa_sm_set_mlo_params(wpa_s->wpa, &wpa_mlo);
+ }
+
++static void wpa_supplicant_tx_queue_params(struct wpa_supplicant *wpa_s){
++ struct hostapd_tx_queue_params *p;
++
++ for (int i = 0; i < NUM_TX_QUEUES; i++){
++ p = &wpa_s->conf->tx_queue[i];
++ if(wpa_drv_set_tx_queue_params(wpa_s, i, p->aifs,
++ p->cwmin, p->cwmax,
++ p->burst)) {
++ wpa_printf(MSG_DEBUG, "Failed to set TX queue "
++ "parameters for queue %d.", i);
++ /* Continue anyway */
++ }
++ }
++}
+
+ static void wpa_supplicant_event_assoc(struct wpa_supplicant *wpa_s,
+ union wpa_event_data *data)
+@@ -3884,6 +3898,8 @@ static void wpa_supplicant_event_assoc(struct wpa_supplicant *wpa_s,
+
+ if (wpa_s->current_ssid && wpa_s->current_ssid->enable_4addr_mode)
+ wpa_supplicant_set_4addr_mode(wpa_s);
++
++ wpa_supplicant_tx_queue_params(wpa_s);
+ }
+
+
+--
+2.18.0
+
diff --git a/recipes-wifi/hostapd/files/patches-2.10.3/mtk-0040-hostapd-mtk-avoid-color-switch-when-beacon-is-not-se.patch b/recipes-wifi/hostapd/files/patches-2.10.3/mtk-0040-hostapd-mtk-avoid-color-switch-when-beacon-is-not-se.patch
new file mode 100644
index 0000000..d31b6c2
--- /dev/null
+++ b/recipes-wifi/hostapd/files/patches-2.10.3/mtk-0040-hostapd-mtk-avoid-color-switch-when-beacon-is-not-se.patch
@@ -0,0 +1,26 @@
+From 100dae9224afa0c9dbd1117ab97b60e427657afc Mon Sep 17 00:00:00 2001
+From: Michael-CY Lee <michael-cy.lee@mediatek.com>
+Date: Fri, 1 Sep 2023 15:31:24 +0800
+Subject: [PATCH 40/40] hostapd: mtk: avoid color switch when beacon is not set
+
+Signed-off-by: Michael-CY Lee <michael-cy.lee@mediatek.com>
+---
+ src/ap/hostapd.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/ap/hostapd.c b/src/ap/hostapd.c
+index 2283b19..6d86993 100644
+--- a/src/ap/hostapd.c
++++ b/src/ap/hostapd.c
+@@ -4249,7 +4249,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->beacon_set_done)
+ return;
+
+ if (os_get_reltime(&now))
+--
+2.18.0
+
diff --git a/recipes-wifi/hostapd/files/patches-2.10.3/mtk-1000-hostapd-mtk-update-eht-operation-element.patch b/recipes-wifi/hostapd/files/patches-2.10.3/mtk-1001-hostapd-mtk-update-eht-operation-element.patch
similarity index 83%
rename from recipes-wifi/hostapd/files/patches-2.10.3/mtk-1000-hostapd-mtk-update-eht-operation-element.patch
rename to recipes-wifi/hostapd/files/patches-2.10.3/mtk-1001-hostapd-mtk-update-eht-operation-element.patch
index f25ae08..e2c6d87 100644
--- a/recipes-wifi/hostapd/files/patches-2.10.3/mtk-1000-hostapd-mtk-update-eht-operation-element.patch
+++ b/recipes-wifi/hostapd/files/patches-2.10.3/mtk-1001-hostapd-mtk-update-eht-operation-element.patch
@@ -1,14 +1,14 @@
-From 04a5e0bf7a0f13759a4df7ca7d6789c67c837017 Mon Sep 17 00:00:00 2001
+From 3b4b9812c97b0b75579829c96a19e8a8cc0bfa7b Mon Sep 17 00:00:00 2001
From: Evelyn Tsai <evelyn.tsai@mediatek.com>
Date: Wed, 10 May 2023 13:11:34 +0800
-Subject: [PATCH 1000/1001] hostapd: mtk: update eht operation element
+Subject: [PATCH 1001/1004] hostapd: mtk: update eht operation element
---
src/ap/ieee802_11_eht.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/ap/ieee802_11_eht.c b/src/ap/ieee802_11_eht.c
-index 9a07f7501..f132e1d9c 100644
+index 9a07f75..f132e1d 100644
--- a/src/ap/ieee802_11_eht.c
+++ b/src/ap/ieee802_11_eht.c
@@ -215,9 +215,9 @@ u8 * hostapd_eid_eht_operation(struct hostapd_data *hapd, u8 *eid)
@@ -25,5 +25,5 @@
if (is_6ghz_op_class(conf->op_class))
chwidth = op_class_to_ch_width(conf->op_class);
--
-2.39.2
+2.18.0
diff --git a/recipes-wifi/hostapd/files/patches-2.10.3/mtk-1002-hostapd-mtk-ucode-add-support-for-ucode-to-parse-BW3.patch b/recipes-wifi/hostapd/files/patches-2.10.3/mtk-1002-hostapd-mtk-ucode-add-support-for-ucode-to-parse-BW3.patch
new file mode 100644
index 0000000..1b51a28
--- /dev/null
+++ b/recipes-wifi/hostapd/files/patches-2.10.3/mtk-1002-hostapd-mtk-ucode-add-support-for-ucode-to-parse-BW3.patch
@@ -0,0 +1,28 @@
+From 5ed678c7562b1acf04f1b6c63ab25a5f3043325f Mon Sep 17 00:00:00 2001
+From: Evelyn Tsai <evelyn.tsai@mediatek.com>
+Date: Wed, 30 Aug 2023 04:23:37 +0800
+Subject: [PATCH 1002/1004] hostapd: mtk: ucode: add support for ucode to parse
+ BW320MHz info
+
+---
+ src/utils/ucode.c | 4 ++++
+ 1 file changed, 4 insertions(+)
+
+diff --git a/src/utils/ucode.c b/src/utils/ucode.c
+index 896ef46..4448738 100644
+--- a/src/utils/ucode.c
++++ b/src/utils/ucode.c
+@@ -85,6 +85,10 @@ uc_value_t *uc_wpa_freq_info(uc_vm_t *vm, size_t nargs)
+ case 2:
+ chanwidth = CONF_OPER_CHWIDTH_160MHZ;
+ break;
++ case 9:
++ width = 3;
++ chanwidth = CONF_OPER_CHWIDTH_320MHZ;
++ break;
+ default:
+ return NULL;
+ }
+--
+2.18.0
+
diff --git a/recipes-wifi/hostapd/files/patches-2.10.3/mtk-1003-hostapd-mtk-synchronize-bandwidth-in-AP-STA-support.patch b/recipes-wifi/hostapd/files/patches-2.10.3/mtk-1003-hostapd-mtk-synchronize-bandwidth-in-AP-STA-support.patch
new file mode 100644
index 0000000..74c685b
--- /dev/null
+++ b/recipes-wifi/hostapd/files/patches-2.10.3/mtk-1003-hostapd-mtk-synchronize-bandwidth-in-AP-STA-support.patch
@@ -0,0 +1,61 @@
+From 25b1c0f5e4f674ea2b72949bce83c05204d19653 Mon Sep 17 00:00:00 2001
+From: Michael-CY Lee <michael-cy.lee@mediatek.com>
+Date: Thu, 24 Aug 2023 16:44:30 +0800
+Subject: [PATCH] hostapd: mtk: synchronize bandwidth in AP/STA support
+
+Signed-off-by: Michael Lee <michael-cy.lee@mediatek.com>
+---
+ src/utils/ucode.c | 1 +
+ wpa_supplicant/ucode.c | 10 ++++++++++
+ 2 files changed, 11 insertions(+)
+
+diff --git a/src/utils/ucode.c b/src/utils/ucode.c
+index 44169f0..41c19fb 100644
+--- a/src/utils/ucode.c
++++ b/src/utils/ucode.c
+@@ -115,6 +115,7 @@ uc_value_t *uc_wpa_freq_info(uc_vm_t *vm, size_t nargs)
+ ucv_object_add(ret, "hw_mode_str", ucv_get(ucv_string_new(modestr)));
+ ucv_object_add(ret, "sec_channel", ucv_int64_new(sec_channel));
+ ucv_object_add(ret, "frequency", ucv_int64_new(freq_val));
++ ucv_object_add(ret, "oper_chwidth", ucv_int64_new(chanwidth));
+
+ if (!sec_channel)
+ return ret;
+diff --git a/wpa_supplicant/ucode.c b/wpa_supplicant/ucode.c
+index d0a78d1..dbf57fa 100644
+--- a/wpa_supplicant/ucode.c
++++ b/wpa_supplicant/ucode.c
+@@ -6,6 +6,7 @@
+ #include "wps_supplicant.h"
+ #include "bss.h"
+ #include "ucode.h"
++#include "driver_i.h"
+
+ static struct wpa_global *wpa_global;
+ static uc_resource_type_t *global_type, *iface_type;
+@@ -194,6 +195,9 @@ uc_wpas_iface_status(uc_vm_t *vm, size_t nargs)
+ struct wpa_supplicant *wpa_s = uc_fn_thisval("wpas.iface");
+ struct wpa_bss *bss;
+ uc_value_t *ret, *val;
++ struct wpa_channel_info ci;
++ u8 op_class, channel;
++ enum oper_chan_width ch_width;
+
+ if (!wpa_s)
+ return NULL;
+@@ -222,6 +226,12 @@ uc_wpas_iface_status(uc_vm_t *vm, size_t nargs)
+
+ ucv_object_add(ret, "sec_chan_offset", ucv_int64_new(sec_chan));
+ ucv_object_add(ret, "frequency", ucv_int64_new(bss->freq));
++
++ wpa_drv_channel_info(wpa_s, &ci);
++ ieee80211_chaninfo_to_channel(ci.frequency, ci.chanwidth,
++ sec_chan, &op_class, &channel);
++ ch_width = op_class_to_ch_width(op_class);
++ ucv_object_add(ret, "ch_width", ucv_int64_new(ch_width));
+ }
+
+ return ret;
+--
+2.25.1
+
diff --git a/recipes-wifi/hostapd/files/patches-2.10.3/patches.inc b/recipes-wifi/hostapd/files/patches-2.10.3/patches.inc
index 89585bc..02810bf 100644
--- a/recipes-wifi/hostapd/files/patches-2.10.3/patches.inc
+++ b/recipes-wifi/hostapd/files/patches-2.10.3/patches.inc
@@ -9,7 +9,6 @@
file://030-driver_nl80211-rewrite-neigh-code-to-not-depend-on-l.patch \
file://040-mesh-allow-processing-authentication-frames-in-block.patch \
file://050-build_fix.patch \
- file://100-daemonize_fix.patch \
file://110-mbedtls-TLS-crypto-option-initial-port.patch \
file://120-mbedtls-fips186_2_prf.patch \
file://130-mbedtls-annotate-with-TEST_FAIL-for-hwsim-tests.patch \
@@ -24,11 +23,8 @@
file://310-rescan_immediately.patch \
file://320-optional_rfkill.patch \
file://330-nl80211_fix_set_freq.patch \
- file://340-reload_freq_change.patch \
file://341-mesh-ctrl-iface-channel-switch.patch \
file://350-nl80211_del_beacon_bss.patch \
- file://360-ctrl_iface_reload.patch \
- file://370-ap_sta_support.patch \
file://380-disable_ctrl_iface_mib.patch \
file://381-hostapd_cli_UNKNOWN-COMMAND.patch \
file://390-wpa_ie_cap_workaround.patch \
@@ -37,7 +33,6 @@
file://420-indicate-features.patch \
file://430-hostapd_cli_ifdef.patch \
file://431-wpa_cli_ifdef.patch \
- file://450-scan_wait.patch;apply=no \
file://460-wpa_supplicant-add-new-config-params-to-be-used-with.patch \
file://463-add-mcast_rate-to-11s.patch \
file://464-fix-mesh-obss-check.patch \
@@ -49,7 +44,6 @@
file://600-ubus_support.patch \
file://601-ucode_support.patch \
file://610-hostapd_cli_ujail_permission.patch \
- file://700-wifi-reload.patch \
file://701-reload_config_inline.patch \
file://710-vlan_no_bridge.patch \
file://711-wds_bridge_force.patch \
@@ -62,6 +56,7 @@
file://761-shared_das_port.patch \
file://770-radius_server.patch \
file://990-ctrl-make-WNM_AP-functions-dependant-on-CONFIG_AP.patch \
+ file://991-Fix-OpenWrt-13156.patch \
file://mtk-0001-hostapd-mtk-Add-neighbor-report-and-BSS-Termination-.patch \
file://mtk-0002-hostapd-mtk-print-sae-groups-by-hostapd-ctrl.patch \
file://mtk-0003-hostapd-mtk-add-support-for-runtime-set-in-band-disc.patch \
@@ -79,28 +74,30 @@
file://mtk-0015-hostapd-mtk-6G-band-does-not-require-DFS.patch \
file://mtk-0016-hostapd-mtk-Fix-sending-wrong-VHT-operation-IE-in-CS.patch \
file://mtk-0017-hostapd-mtk-Add-sta-assisted-DFS-state-update-mechan.patch \
- file://mtk-0018-hostapd-mtk-Fix-auto-ht-issue-when-switching-to-DFS-.patch \
- file://mtk-0019-hostapd-mtk-Mark-DFS-channel-as-available-for-CSA.patch \
- file://mtk-0020-hostapd-mtk-Add-available-color-bitmap.patch \
- file://mtk-0021-hostapd-mtk-Add-channel-information-for-hostapd-relo.patch \
- file://mtk-0022-hostapd-mtk-Fix-ZWDFS-issue-in-BW-160.patch \
- file://mtk-0023-hostapd-mtk-Add-vendor-for-CAPI-certification-comman.patch \
- file://mtk-0024-hostapd-mtk-Air-Monitor-support-in-hostapd-by-vendor.patch \
- file://mtk-0025-hostapd-mtk-Fix-scan-result-updating-issue.patch \
- file://mtk-0026-hostapd-mtk-Avoid-setting-beacon-after-wpa_supplican.patch \
- file://mtk-0027-hostapd-mtk-Fix-setting-wrong-seg0-index-for-5G-cent.patch \
- file://mtk-0028-hostapd-mtk-Add-muru-user-number-debug-command.patch \
- file://mtk-0030-hostapd-mtk-Fix-unexpected-AP-beacon-state-transitio.patch \
- file://mtk-0031-hostapd-mtk-add-connac3-PHY-MURU-manual-mode-config-.patch \
- file://mtk-0032-hostapd-mtk-Add-HE-capabilities-check.patch \
- file://mtk-0033-hostapd-mtk-Fix-background-channel-overlapping-opera.patch \
- file://mtk-0034-hostapd-mtk-Fix-hostapd_dfs_start_cac-log.patch \
- file://mtk-0035-hostapd-mtk-Check-the-bridge-after-ioctl-SIOCBRADDIF.patch \
- file://mtk-0036-hostapd-mtk-Update-parameter_set_count-in-MU-EDCA-IE.patch \
- file://mtk-0037-hostapd-mtk-Add-extension-IE-list-for-non-inherit-IE.patch \
- file://mtk-0038-hostapd-mtk-Fix-11vmbss-aid-using-wrong-pool.patch \
- file://mtk-0039-hostapd-mtk-Fix-rnr-ie-length-when-no-need-to-report.patch \
- file://mtk-0040-hostapd-mtk-add-back-ht-vht-cap-missing-field-before.patch \
- file://mtk-1000-hostapd-mtk-update-eht-operation-element.patch \
- file://mtk-1001-hostapd-mtk-Add-support-for-gtk-rekeying-in-hostapd-.patch \
+ file://mtk-0018-hostapd-mtk-Mark-DFS-channel-as-available-for-CSA.patch \
+ file://mtk-0019-hostapd-mtk-Add-available-color-bitmap.patch \
+ file://mtk-0020-hostapd-mtk-Fix-ZWDFS-issue-in-BW-160.patch \
+ file://mtk-0021-hostapd-mtk-Add-vendor-for-CAPI-certification-comman.patch \
+ file://mtk-0022-hostapd-mtk-Air-Monitor-support-in-hostapd-by-vendor.patch \
+ file://mtk-0023-hostapd-mtk-Fix-setting-wrong-seg0-index-for-5G-cent.patch \
+ file://mtk-0024-hostapd-mtk-Add-muru-user-number-debug-command.patch \
+ file://mtk-0025-hostapd-mtk-add-connac3-PHY-MURU-manual-mode-config-.patch \
+ file://mtk-0026-hostapd-mtk-Add-HE-capabilities-check.patch \
+ file://mtk-0027-hostapd-mtk-Fix-background-channel-overlapping-opera.patch \
+ file://mtk-0028-hostapd-mtk-Fix-hostapd_dfs_start_cac-log.patch \
+ file://mtk-0029-hostapd-mtk-Check-the-bridge-after-ioctl-SIOCBRADDIF.patch \
+ file://mtk-0030-hostapd-mtk-Update-parameter_set_count-in-MU-EDCA-IE.patch \
+ file://mtk-0031-hostapd-mtk-add-extension-IE-list-for-non-inherit-IE.patch \
+ file://mtk-0032-hostapd-mtk-Fix-11vmbss-aid-using-wrong-pool.patch \
+ file://mtk-0033-hostapd-mtk-Fix-rnr-ie-length-when-no-need-to-report.patch \
+ file://mtk-0034-hostapd-mtk-add-back-ht-vht-cap-missing-field-before.patch \
+ file://mtk-0035-hostapd-mtk-update-op_class-when-AP-channel-switchin.patch \
+ file://mtk-0036-hostapd-mtk-Add-support-for-gtk-rekeying-in-hostapd-.patch \
+ file://mtk-0037-hostapd-mtk-Fix-wpa_supplicant-configuration-parsing.patch \
+ file://mtk-0038-hostapd-mtk-Set-WMM-and-TX-queue-parameters-for-wpa_.patch \
+ file://mtk-0039-hostapd-mtk-Set-STA-TX-queue-parameters-configuratio.patch \
+ file://mtk-0040-hostapd-mtk-avoid-color-switch-when-beacon-is-not-se.patch \
+ file://mtk-1001-hostapd-mtk-update-eht-operation-element.patch \
+ file://mtk-1002-hostapd-mtk-ucode-add-support-for-ucode-to-parse-BW3.patch \
+ file://mtk-1003-hostapd-mtk-synchronize-bandwidth-in-AP-STA-support.patch \
"
diff --git a/recipes-wifi/hostapd/files/patches/mtk-0039-hostapd-mtk-avoid-color-switch-when-beacon-is-not-se.patch b/recipes-wifi/hostapd/files/patches/mtk-0039-hostapd-mtk-avoid-color-switch-when-beacon-is-not-se.patch
new file mode 100755
index 0000000..2883c1f
--- /dev/null
+++ b/recipes-wifi/hostapd/files/patches/mtk-0039-hostapd-mtk-avoid-color-switch-when-beacon-is-not-se.patch
@@ -0,0 +1,28 @@
+From 33117ec15f94315f7671cfdaf47e8d5eeddee4ae Mon Sep 17 00:00:00 2001
+From: MeiChia Chiu <meichia.chiu@mediatek.com>
+Date: Fri, 1 Sep 2023 15:20:19 +0800
+Subject: [PATCH] hostapd: mtk: avoid color switch when beacon is not set
+
+Signed-off-by: MeiChia Chiu <meichia.chiu@mediatek.com>
+Signed-off-by: Michael-CY Lee <michael-cy.lee@mediatek.com>
+---
+ src/ap/hostapd.c | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/src/ap/hostapd.c b/src/ap/hostapd.c
+index abc6156..f2eb638 100644
+--- a/src/ap/hostapd.c
++++ b/src/ap/hostapd.c
+@@ -4024,7 +4024,8 @@ void hostapd_switch_color(struct hostapd_data *hapd, u64 bitmap)
+ {
+ struct os_reltime now;
+
+- if (hapd->cca_in_progress || hapd->stopped_by_supplicant)
++ if (hapd->cca_in_progress || hapd->stopped_by_supplicant ||
++ !hapd->beacon_set_done)
+ return;
+
+ if (os_get_reltime(&now))
+--
+2.39.0
+
diff --git a/recipes-wifi/hostapd/files/patches/patches.inc b/recipes-wifi/hostapd/files/patches/patches.inc
index f783c48..34e183e 100644
--- a/recipes-wifi/hostapd/files/patches/patches.inc
+++ b/recipes-wifi/hostapd/files/patches/patches.inc
@@ -102,4 +102,5 @@
file://mtk-0037-hostapd-mtk-Fix-11vmbss-aid-using-wrong-pool.patch \
file://mtk-0037-hostapd-mtk-add-back-ht-vht-cap-missing-field-before.patch \
file://mtk-0038-hostapd-mtk-Fix-rnr-ie-length-when-no-need-to-report.patch \
+ file://mtk-0039-hostapd-mtk-avoid-color-switch-when-beacon-is-not-se.patch \
"
diff --git a/recipes-wifi/hostapd/files/src-2.10.3/src/ap/ubus.c b/recipes-wifi/hostapd/files/src-2.10.3/src/ap/ubus.c
index a609eb1..6ff2257 100644
--- a/recipes-wifi/hostapd/files/src-2.10.3/src/ap/ubus.c
+++ b/recipes-wifi/hostapd/files/src-2.10.3/src/ap/ubus.c
@@ -163,7 +163,7 @@
{
struct hostapd_data *hapd = container_of(obj, struct hostapd_data, ubus.obj);
- return hostapd_reload_config(hapd->iface, 1);
+ return hostapd_reload_config(hapd->iface);
}
diff --git a/recipes-wifi/hostapd/files/src-2.10.3/src/ap/ucode.c b/recipes-wifi/hostapd/files/src-2.10.3/src/ap/ucode.c
index 137cb81..0326f6f 100644
--- a/recipes-wifi/hostapd/files/src-2.10.3/src/ap/ucode.c
+++ b/recipes-wifi/hostapd/files/src-2.10.3/src/ap/ucode.c
@@ -4,7 +4,10 @@
#include "utils/common.h"
#include "utils/ucode.h"
#include "hostapd.h"
+#include "beacon.h"
+#include "hw_features.h"
#include "ap_drv_ops.h"
+#include "dfs.h"
#include <libubox/uloop.h>
static uc_resource_type_t *global_type, *bss_type, *iface_type;
@@ -21,7 +24,7 @@
return wpa_ucode_registry_get(bss_registry, hapd->ucode.idx);
val = uc_resource_new(bss_type, hapd);
- wpa_ucode_registry_add(bss_registry, val, &hapd->ucode.idx);
+ hapd->ucode.idx = wpa_ucode_registry_add(bss_registry, val);
return val;
}
@@ -35,46 +38,46 @@
return wpa_ucode_registry_get(iface_registry, hapd->ucode.idx);
val = uc_resource_new(iface_type, hapd);
- wpa_ucode_registry_add(iface_registry, val, &hapd->ucode.idx);
+ hapd->ucode.idx = wpa_ucode_registry_add(iface_registry, val);
return val;
}
static void
-hostapd_ucode_update_bss_list(struct hostapd_iface *iface)
+hostapd_ucode_update_bss_list(struct hostapd_iface *iface, uc_value_t *if_bss, uc_value_t *bss)
{
- uc_value_t *ifval, *list;
+ uc_value_t *list;
int i;
list = ucv_array_new(vm);
for (i = 0; i < iface->num_bss; i++) {
struct hostapd_data *hapd = iface->bss[i];
uc_value_t *val = hostapd_ucode_bss_get_uval(hapd);
- uc_value_t *proto = ucv_prototype_get(val);
- ucv_object_add(proto, "name", ucv_get(ucv_string_new(hapd->conf->iface)));
- ucv_object_add(proto, "index", ucv_int64_new(i));
- ucv_array_set(list, i, ucv_get(val));
+ ucv_array_set(list, i, ucv_get(ucv_string_new(hapd->conf->iface)));
+ ucv_object_add(bss, hapd->conf->iface, ucv_get(val));
}
-
- ifval = hostapd_ucode_iface_get_uval(iface);
- ucv_object_add(ucv_prototype_get(ifval), "bss", ucv_get(list));
+ ucv_object_add(if_bss, iface->phy, ucv_get(list));
}
static void
hostapd_ucode_update_interfaces(void)
{
uc_value_t *ifs = ucv_object_new(vm);
+ uc_value_t *if_bss = ucv_array_new(vm);
+ uc_value_t *bss = ucv_object_new(vm);
int i;
for (i = 0; i < interfaces->count; i++) {
struct hostapd_iface *iface = interfaces->iface[i];
ucv_object_add(ifs, iface->phy, ucv_get(hostapd_ucode_iface_get_uval(iface)));
- hostapd_ucode_update_bss_list(iface);
+ hostapd_ucode_update_bss_list(iface, if_bss, bss);
}
ucv_object_add(ucv_prototype_get(global), "interfaces", ucv_get(ifs));
+ ucv_object_add(ucv_prototype_get(global), "interface_bss", ucv_get(if_bss));
+ ucv_object_add(ucv_prototype_get(global), "bss", ucv_get(bss));
ucv_gc(vm);
}
@@ -197,7 +200,7 @@
hostapd_config_free_bss(hapd->conf);
os_free(hapd);
- hostapd_ucode_update_bss_list(iface);
+ hostapd_ucode_update_interfaces();
ucv_gc(vm);
return NULL;
@@ -250,7 +253,7 @@
iface->conf->bss[iface->conf->num_bss] = bss;
conf->bss[idx] = NULL;
ret = hostapd_ucode_bss_get_uval(hapd);
- hostapd_ucode_update_bss_list(iface);
+ hostapd_ucode_update_interfaces();
goto out;
deinit_ctrl:
@@ -289,12 +292,149 @@
return ucv_string_new_length(reply, reply_len);
}
+static uc_value_t *
+uc_hostapd_iface_stop(uc_vm_t *vm, size_t nargs)
+{
+ struct hostapd_iface *iface = uc_fn_thisval("hostapd.iface");
+ int i;
+
+ for (i = 0; i < iface->num_bss; i++) {
+ struct hostapd_data *hapd = iface->bss[i];
+
+ hostapd_drv_stop_ap(hapd);
+ hapd->started = 0;
+ }
+}
+
+static uc_value_t *
+uc_hostapd_iface_start(uc_vm_t *vm, size_t nargs)
+{
+ struct hostapd_iface *iface = uc_fn_thisval("hostapd.iface");
+ uc_value_t *info = uc_fn_arg(0);
+ struct hostapd_config *conf;
+ uint64_t intval;
+ int i;
+
+ if (!iface)
+ return NULL;
+
+ if (!info)
+ goto out;
+
+ if (ucv_type(info) != UC_OBJECT)
+ return NULL;
+
+ conf = iface->conf;
+ if ((intval = ucv_int64_get(ucv_object_get(info, "op_class", NULL))) && !errno)
+ conf->op_class = intval;
+ if ((intval = ucv_int64_get(ucv_object_get(info, "hw_mode", NULL))) && !errno)
+ conf->hw_mode = intval;
+ if ((intval = ucv_int64_get(ucv_object_get(info, "channel", NULL))) && !errno)
+ conf->channel = intval;
+ if ((intval = ucv_int64_get(ucv_object_get(info, "sec_channel", NULL))) && !errno)
+ conf->secondary_channel = intval;
+
+ intval = ucv_int64_get(ucv_object_get(info, "center_seg0_idx", NULL));
+ if (!errno)
+ hostapd_set_oper_centr_freq_seg0_idx(conf, intval);
+
+ intval = ucv_int64_get(ucv_object_get(info, "center_seg1_idx", NULL));
+ if (!errno)
+ hostapd_set_oper_centr_freq_seg1_idx(conf, intval);
+
+ intval = ucv_int64_get(ucv_object_get(info, "oper_chwidth", NULL));
+ if (!errno)
+ hostapd_set_oper_chwidth(conf, intval);
+
+out:
+ if (conf->channel)
+ iface->freq = hostapd_hw_get_freq(iface->bss[0], conf->channel);
+
+ if (hostapd_is_dfs_required(iface) && !hostapd_is_dfs_chan_available(iface)) {
+ wpa_printf(MSG_INFO, "DFS CAC required on new channel, restart interface");
+ hostapd_disable_iface(iface);
+ hostapd_enable_iface(iface);
+ return ucv_boolean_new(true);
+ }
+
+ for (i = 0; i < iface->num_bss; i++) {
+ struct hostapd_data *hapd = iface->bss[i];
+ int ret;
+
+ hapd->started = 1;
+ hapd->conf->start_disabled = 0;
+ hostapd_set_freq(hapd, conf->hw_mode, iface->freq,
+ conf->channel,
+ conf->enable_edmg,
+ conf->edmg_channel,
+ conf->ieee80211n,
+ conf->ieee80211ac,
+ conf->ieee80211ax,
+ conf->ieee80211be,
+ conf->secondary_channel,
+ hostapd_get_oper_chwidth(conf),
+ hostapd_get_oper_centr_freq_seg0_idx(conf),
+ hostapd_get_oper_centr_freq_seg1_idx(conf));
+
+ ieee802_11_set_beacon(hapd);
+ }
+
+ return ucv_boolean_new(true);
+}
+
+static uc_value_t *
+uc_hostapd_iface_switch_channel(uc_vm_t *vm, size_t nargs)
+{
+ struct hostapd_iface *iface = uc_fn_thisval("hostapd.iface");
+ uc_value_t *info = uc_fn_arg(0);
+ struct hostapd_config *conf;
+ struct csa_settings csa = {};
+ uint64_t intval;
+ int i, ret = 0;
+
+ if (!iface || ucv_type(info) != UC_OBJECT)
+ return NULL;
+
+ conf = iface->conf;
+ if ((intval = ucv_int64_get(ucv_object_get(info, "csa_count", NULL))) && !errno)
+ csa.cs_count = intval;
+ if ((intval = ucv_int64_get(ucv_object_get(info, "sec_channel", NULL))) && !errno)
+ csa.freq_params.sec_channel_offset = intval;
+
+ csa.freq_params.ht_enabled = conf->ieee80211n;
+ csa.freq_params.vht_enabled = conf->ieee80211ac;
+ csa.freq_params.he_enabled = conf->ieee80211ax;
+#ifdef CONFIG_IEEE80211BE
+ csa.freq_params.eht_enabled = conf->ieee80211be;
+#endif
+ intval = ucv_int64_get(ucv_object_get(info, "oper_chwidth", NULL));
+ if (errno)
+ intval = hostapd_get_oper_chwidth(conf);
+ if (intval)
+ csa.freq_params.bandwidth = 40 << intval;
+ else
+ csa.freq_params.bandwidth = csa.freq_params.sec_channel_offset ? 40 : 20;
+
+ if ((intval = ucv_int64_get(ucv_object_get(info, "frequency", NULL))) && !errno)
+ csa.freq_params.freq = intval;
+ if ((intval = ucv_int64_get(ucv_object_get(info, "center_freq1", NULL))) && !errno)
+ csa.freq_params.center_freq1 = intval;
+ if ((intval = ucv_int64_get(ucv_object_get(info, "center_freq2", NULL))) && !errno)
+ csa.freq_params.center_freq2 = intval;
+
+ for (i = 0; i < iface->num_bss; i++)
+ ret = hostapd_switch_channel(iface->bss[i], &csa);
+
+ return ucv_boolean_new(!ret);
+}
+
int hostapd_ucode_init(struct hapd_interfaces *ifaces)
{
static const uc_function_list_t global_fns[] = {
{ "printf", uc_wpa_printf },
{ "getpid", uc_wpa_getpid },
{ "sha1", uc_wpa_sha1 },
+ { "freq_info", uc_wpa_freq_info },
{ "add_iface", uc_hostapd_add_iface },
{ "remove_iface", uc_hostapd_remove_iface },
};
@@ -304,7 +444,10 @@
{ "delete", uc_hostapd_bss_delete },
};
static const uc_function_list_t iface_fns[] = {
- { "add_bss", uc_hostapd_iface_add_bss }
+ { "add_bss", uc_hostapd_iface_add_bss },
+ { "stop", uc_hostapd_iface_stop },
+ { "start", uc_hostapd_iface_start },
+ { "switch_channel", uc_hostapd_iface_switch_channel },
};
uc_value_t *data, *proto;
@@ -360,7 +503,7 @@
ucv_gc(vm);
}
-void hostapd_ucode_reload_bss(struct hostapd_data *hapd, int reconf)
+void hostapd_ucode_reload_bss(struct hostapd_data *hapd)
{
uc_value_t *val;
@@ -370,8 +513,7 @@
val = hostapd_ucode_bss_get_uval(hapd);
uc_value_push(ucv_get(ucv_string_new(hapd->conf->iface)));
uc_value_push(ucv_get(val));
- uc_value_push(ucv_int64_new(reconf));
- ucv_put(wpa_ucode_call(3));
+ ucv_put(wpa_ucode_call(2));
ucv_gc(vm);
}
diff --git a/recipes-wifi/hostapd/files/src-2.10.3/src/ap/ucode.h b/recipes-wifi/hostapd/files/src-2.10.3/src/ap/ucode.h
index dbc49e6..d00b787 100644
--- a/recipes-wifi/hostapd/files/src-2.10.3/src/ap/ucode.h
+++ b/recipes-wifi/hostapd/files/src-2.10.3/src/ap/ucode.h
@@ -25,7 +25,7 @@
void hostapd_ucode_free_iface(struct hostapd_iface *iface);
void hostapd_ucode_add_bss(struct hostapd_data *hapd);
void hostapd_ucode_free_bss(struct hostapd_data *hapd);
-void hostapd_ucode_reload_bss(struct hostapd_data *hapd, int reconf);
+void hostapd_ucode_reload_bss(struct hostapd_data *hapd);
#else
@@ -39,7 +39,7 @@
static inline void hostapd_ucode_free_iface(struct hostapd_iface *iface)
{
}
-static inline void hostapd_ucode_reload_bss(struct hostapd_data *hapd, int reconf)
+static inline void hostapd_ucode_reload_bss(struct hostapd_data *hapd)
{
}
static inline void hostapd_ucode_add_bss(struct hostapd_data *hapd)
diff --git a/recipes-wifi/hostapd/files/src-2.10.3/src/utils/ucode.c b/recipes-wifi/hostapd/files/src-2.10.3/src/utils/ucode.c
index a92913a..896ef46 100644
--- a/recipes-wifi/hostapd/files/src-2.10.3/src/utils/ucode.c
+++ b/recipes-wifi/hostapd/files/src-2.10.3/src/utils/ucode.c
@@ -3,6 +3,7 @@
#include "utils/eloop.h"
#include "crypto/crypto.h"
#include "crypto/sha1.h"
+#include "common/ieee802_11_common.h"
#include <libubox/uloop.h>
#include <ucode/compiler.h>
@@ -45,6 +46,100 @@
return NULL;
}
+uc_value_t *uc_wpa_freq_info(uc_vm_t *vm, size_t nargs)
+{
+ uc_value_t *freq = uc_fn_arg(0);
+ uc_value_t *sec = uc_fn_arg(1);
+ int width = ucv_uint64_get(uc_fn_arg(2));
+ int freq_val, center_idx, center_ofs;
+ enum oper_chan_width chanwidth;
+ enum hostapd_hw_mode hw_mode;
+ u8 op_class, channel, tmp_channel;
+ const char *modestr;
+ int sec_channel = 0;
+ uc_value_t *ret;
+
+ if (ucv_type(freq) != UC_INTEGER)
+ return NULL;
+
+ freq_val = ucv_int64_get(freq);
+ if (ucv_type(sec) == UC_INTEGER)
+ sec_channel = ucv_int64_get(sec);
+ else if (sec)
+ return NULL;
+ else if (freq_val > 4000)
+ sec_channel = (freq_val / 20) & 1 ? 1 : -1;
+ else
+ sec_channel = freq_val < 2442 ? 1 : -1;
+
+ if (sec_channel != -1 && sec_channel != 1 && sec_channel != 0)
+ return NULL;
+
+ switch (width) {
+ case 0:
+ chanwidth = CONF_OPER_CHWIDTH_USE_HT;
+ break;
+ case 1:
+ chanwidth = CONF_OPER_CHWIDTH_80MHZ;
+ break;
+ case 2:
+ chanwidth = CONF_OPER_CHWIDTH_160MHZ;
+ break;
+ default:
+ return NULL;
+ }
+
+ hw_mode = ieee80211_freq_to_channel_ext(freq_val, sec_channel,
+ chanwidth, &op_class, &channel);
+ switch (hw_mode) {
+ case HOSTAPD_MODE_IEEE80211B:
+ modestr = "b";
+ break;
+ case HOSTAPD_MODE_IEEE80211G:
+ modestr = "g";
+ break;
+ case HOSTAPD_MODE_IEEE80211A:
+ modestr = "a";
+ break;
+ case HOSTAPD_MODE_IEEE80211AD:
+ modestr = "ad";
+ break;
+ default:
+ return NULL;
+ }
+
+ ret = ucv_object_new(vm);
+ ucv_object_add(ret, "op_class", ucv_int64_new(op_class));
+ ucv_object_add(ret, "channel", ucv_int64_new(channel));
+ ucv_object_add(ret, "hw_mode", ucv_int64_new(hw_mode));
+ ucv_object_add(ret, "hw_mode_str", ucv_get(ucv_string_new(modestr)));
+ ucv_object_add(ret, "sec_channel", ucv_int64_new(sec_channel));
+ ucv_object_add(ret, "frequency", ucv_int64_new(freq_val));
+
+ if (!sec_channel)
+ return ret;
+
+ if (freq_val >= 5900)
+ center_ofs = 0;
+ else if (freq_val >= 5745)
+ center_ofs = 20;
+ else
+ center_ofs = 35;
+ tmp_channel = channel - center_ofs;
+ tmp_channel &= ~((8 << width) - 1);
+ center_idx = tmp_channel + center_ofs + (4 << width) - 1;
+
+ if (freq_val < 3000)
+ ucv_object_add(ret, "center_seg0_idx", ucv_int64_new(0));
+ else
+ ucv_object_add(ret, "center_seg0_idx", ucv_int64_new(center_idx));
+ center_idx = (center_idx - channel) * 5 + freq_val;
+ ucv_object_add(ret, "center_freq1", ucv_int64_new(center_idx));
+
+out:
+ return ret;
+}
+
uc_value_t *uc_wpa_getpid(uc_vm_t *vm, size_t nargs)
{
return ucv_int64_new(getpid());
@@ -179,21 +274,7 @@
return global;
}
-static uc_value_t *wpa_ucode_prototype_clone(uc_value_t *uval)
-{
- uc_value_t *proto, *proto_new;
-
- proto = ucv_prototype_get(uval);
- proto_new = ucv_object_new(&vm);
-
- ucv_object_foreach(proto, key, val)
- ucv_object_add(proto_new, key, ucv_get(val));
- ucv_prototype_set(uval, ucv_get(proto));
-
- return proto;
-}
-
-void wpa_ucode_registry_add(uc_value_t *reg, uc_value_t *val, int *idx)
+int wpa_ucode_registry_add(uc_value_t *reg, uc_value_t *val)
{
uc_value_t *data;
int i = 0;
@@ -203,10 +284,7 @@
ucv_array_set(reg, i, ucv_get(val));
- data = ucv_object_new(&vm);
- ucv_object_add(wpa_ucode_prototype_clone(val), "data", ucv_get(data));
-
- *idx = i + 1;
+ return i + 1;
}
uc_value_t *wpa_ucode_registry_get(uc_value_t *reg, int idx)
diff --git a/recipes-wifi/hostapd/files/src-2.10.3/src/utils/ucode.h b/recipes-wifi/hostapd/files/src-2.10.3/src/utils/ucode.h
index 4caf8ad..2c18869 100644
--- a/recipes-wifi/hostapd/files/src-2.10.3/src/utils/ucode.h
+++ b/recipes-wifi/hostapd/files/src-2.10.3/src/utils/ucode.h
@@ -17,12 +17,13 @@
uc_value_t *wpa_ucode_global_init(const char *name, uc_resource_type_t *global_type);
-void wpa_ucode_registry_add(uc_value_t *reg, uc_value_t *val, int *idx);
+int wpa_ucode_registry_add(uc_value_t *reg, uc_value_t *val);
uc_value_t *wpa_ucode_registry_get(uc_value_t *reg, int idx);
uc_value_t *wpa_ucode_registry_remove(uc_value_t *reg, int idx);
uc_value_t *uc_wpa_printf(uc_vm_t *vm, size_t nargs);
uc_value_t *uc_wpa_getpid(uc_vm_t *vm, size_t nargs);
uc_value_t *uc_wpa_sha1(uc_vm_t *vm, size_t nargs);
+uc_value_t *uc_wpa_freq_info(uc_vm_t *vm, size_t nargs);
#endif
diff --git a/recipes-wifi/hostapd/files/src-2.10.3/wpa_supplicant/ucode.c b/recipes-wifi/hostapd/files/src-2.10.3/wpa_supplicant/ucode.c
index eec3980..d120ed6 100644
--- a/recipes-wifi/hostapd/files/src-2.10.3/wpa_supplicant/ucode.c
+++ b/recipes-wifi/hostapd/files/src-2.10.3/wpa_supplicant/ucode.c
@@ -1,8 +1,10 @@
#include "utils/includes.h"
#include "utils/common.h"
#include "utils/ucode.h"
+#include "drivers/driver.h"
#include "wpa_supplicant_i.h"
#include "wps_supplicant.h"
+#include "bss.h"
#include "ucode.h"
static struct wpa_global *wpa_global;
@@ -19,7 +21,7 @@
return wpa_ucode_registry_get(iface_registry, wpa_s->ucode.idx);
val = uc_resource_new(iface_type, wpa_s);
- wpa_ucode_registry_add(iface_registry, val, &wpa_s->ucode.idx);
+ wpa_s->ucode.idx = wpa_ucode_registry_add(iface_registry, val);
return val;
}
@@ -69,6 +71,59 @@
ucv_gc(vm);
}
+void wpas_ucode_update_state(struct wpa_supplicant *wpa_s)
+{
+ const char *state;
+ uc_value_t *val;
+
+ val = wpa_ucode_registry_get(iface_registry, wpa_s->ucode.idx);
+ if (!val)
+ return;
+
+ if (wpa_ucode_call_prepare("state"))
+ return;
+
+ state = wpa_supplicant_state_txt(wpa_s->wpa_state);
+ uc_value_push(ucv_get(ucv_string_new(wpa_s->ifname)));
+ uc_value_push(ucv_get(val));
+ uc_value_push(ucv_get(ucv_string_new(state)));
+ ucv_put(wpa_ucode_call(3));
+ ucv_gc(vm);
+}
+
+void wpas_ucode_event(struct wpa_supplicant *wpa_s, int event, union wpa_event_data *data)
+{
+ const char *state;
+ uc_value_t *val;
+
+ if (event != EVENT_CH_SWITCH_STARTED)
+ return;
+
+ val = wpa_ucode_registry_get(iface_registry, wpa_s->ucode.idx);
+ if (!val)
+ return;
+
+ if (wpa_ucode_call_prepare("event"))
+ return;
+
+ uc_value_push(ucv_get(ucv_string_new(wpa_s->ifname)));
+ uc_value_push(ucv_get(val));
+ uc_value_push(ucv_get(ucv_string_new(event_to_string(event))));
+ val = ucv_object_new(vm);
+ uc_value_push(ucv_get(val));
+
+ if (event == EVENT_CH_SWITCH_STARTED) {
+ ucv_object_add(val, "csa_count", ucv_int64_new(data->ch_switch.count));
+ ucv_object_add(val, "frequency", ucv_int64_new(data->ch_switch.freq));
+ ucv_object_add(val, "sec_chan_offset", ucv_int64_new(data->ch_switch.ch_offset));
+ ucv_object_add(val, "center_freq1", ucv_int64_new(data->ch_switch.cf1));
+ ucv_object_add(val, "center_freq2", ucv_int64_new(data->ch_switch.cf2));
+ }
+
+ ucv_put(wpa_ucode_call(4));
+ ucv_gc(vm);
+}
+
static const char *obj_stringval(uc_value_t *obj, const char *name)
{
uc_value_t *val = ucv_object_get(obj, name, NULL);
@@ -84,7 +139,6 @@
uc_value_t *bridge = ucv_object_get(info, "bridge", NULL);
uc_value_t *config = ucv_object_get(info, "config", NULL);
uc_value_t *ctrl = ucv_object_get(info, "ctrl", NULL);
- uc_value_t *hapd_ctrl = ucv_object_get(info, "hostapd_ctrl", NULL);
struct wpa_interface iface;
int ret = -1;
@@ -97,7 +151,6 @@
.bridge_ifname = ucv_string_get(bridge),
.confname = ucv_string_get(config),
.ctrl_interface = ucv_string_get(ctrl),
- .hostapd_ctrl = ucv_string_get(hapd_ctrl),
};
if (!iface.ifname || !iface.confname)
@@ -135,6 +188,46 @@
return ucv_int64_new(ret);
}
+static uc_value_t *
+uc_wpas_iface_status(uc_vm_t *vm, size_t nargs)
+{
+ struct wpa_supplicant *wpa_s = uc_fn_thisval("wpas.iface");
+ struct wpa_bss *bss;
+ uc_value_t *ret, *val;
+
+ if (!wpa_s)
+ return NULL;
+
+ ret = ucv_object_new(vm);
+
+ val = ucv_string_new(wpa_supplicant_state_txt(wpa_s->wpa_state));
+ ucv_object_add(ret, "state", ucv_get(val));
+
+ bss = wpa_s->current_bss;
+ if (bss) {
+ int sec_chan = 0;
+ const u8 *ie;
+
+ ie = wpa_bss_get_ie(bss, WLAN_EID_HT_OPERATION);
+ if (ie && ie[1] >= 2) {
+ const struct ieee80211_ht_operation *ht_oper;
+ int sec;
+
+ ht_oper = (const void *) (ie + 2);
+ sec = ht_oper->ht_param & HT_INFO_HT_PARAM_SECONDARY_CHNL_OFF_MASK;
+ if (sec == HT_INFO_HT_PARAM_SECONDARY_CHNL_ABOVE)
+ sec_chan = 1;
+ else if (sec == HT_INFO_HT_PARAM_SECONDARY_CHNL_BELOW)
+ sec_chan = -1;
+ }
+
+ ucv_object_add(ret, "sec_chan_offset", ucv_int64_new(sec_chan));
+ ucv_object_add(ret, "frequency", ucv_int64_new(bss->freq));
+ }
+
+ return ret;
+}
+
int wpas_ucode_init(struct wpa_global *gl)
{
static const uc_function_list_t global_fns[] = {
@@ -144,6 +237,7 @@
{ "remove_iface", uc_wpas_remove_iface },
};
static const uc_function_list_t iface_fns[] = {
+ { "status", uc_wpas_iface_status },
};
uc_value_t *data, *proto;
@@ -151,10 +245,10 @@
vm = wpa_ucode_create_vm();
global_type = uc_type_declare(vm, "wpas.global", global_fns, NULL);
- iface_type = uc_type_declare(vm, "hostapd.iface", iface_fns, NULL);
+ iface_type = uc_type_declare(vm, "wpas.iface", iface_fns, NULL);
iface_registry = ucv_array_new(vm);
- uc_vm_registry_set(vm, "hostap.iface_registry", iface_registry);
+ uc_vm_registry_set(vm, "wpas.iface_registry", iface_registry);
global = wpa_ucode_global_init("wpas", global_type);
diff --git a/recipes-wifi/hostapd/files/src-2.10.3/wpa_supplicant/ucode.h b/recipes-wifi/hostapd/files/src-2.10.3/wpa_supplicant/ucode.h
index fcd2313..a429a0e 100644
--- a/recipes-wifi/hostapd/files/src-2.10.3/wpa_supplicant/ucode.h
+++ b/recipes-wifi/hostapd/files/src-2.10.3/wpa_supplicant/ucode.h
@@ -4,6 +4,7 @@
#include "utils/ucode.h"
struct wpa_global;
+union wpa_event_data;
struct wpa_supplicant;
struct wpas_ucode_bss {
@@ -17,6 +18,8 @@
void wpas_ucode_free(void);
void wpas_ucode_add_bss(struct wpa_supplicant *wpa_s);
void wpas_ucode_free_bss(struct wpa_supplicant *wpa_s);
+void wpas_ucode_update_state(struct wpa_supplicant *wpa_s);
+void wpas_ucode_event(struct wpa_supplicant *wpa_s, int event, union wpa_event_data *data);
#else
static inline int wpas_ucode_init(struct wpa_global *gl)
{
@@ -33,6 +36,14 @@
{
}
+static inline void wpas_ucode_update_state(struct wpa_supplicant *wpa_s)
+{
+}
+
+static inline void wpas_ucode_event(struct wpa_supplicant *wpa_s, int event, union wpa_event_data *data)
+{
+}
+
#endif
#endif
diff --git a/recipes-wifi/iw/patches/001-nl80211_h_sync.patch b/recipes-wifi/iw/patches/001-nl80211_h_sync.patch
deleted file mode 100644
index afe27d6..0000000
--- a/recipes-wifi/iw/patches/001-nl80211_h_sync.patch
+++ /dev/null
@@ -1,259 +0,0 @@
---- a/nl80211.h
-+++ b/nl80211.h
-@@ -324,6 +324,17 @@
- */
-
- /**
-+ * DOC: Multi-Link Operation
-+ *
-+ * In Multi-Link Operation, a connection between to MLDs utilizes multiple
-+ * links. To use this in nl80211, various commands and responses now need
-+ * to or will include the new %NL80211_ATTR_MLO_LINKS attribute.
-+ * Additionally, various commands that need to operate on a specific link
-+ * now need to be given the %NL80211_ATTR_MLO_LINK_ID attribute, e.g. to
-+ * use %NL80211_CMD_START_AP or similar functions.
-+ */
-+
-+/**
- * enum nl80211_commands - supported nl80211 commands
- *
- * @NL80211_CMD_UNSPEC: unspecified command to catch errors
-@@ -366,14 +377,22 @@
- * the non-transmitting interfaces are deleted as well.
- *
- * @NL80211_CMD_GET_KEY: Get sequence counter information for a key specified
-- * by %NL80211_ATTR_KEY_IDX and/or %NL80211_ATTR_MAC.
-+ * by %NL80211_ATTR_KEY_IDX and/or %NL80211_ATTR_MAC. %NL80211_ATTR_MAC
-+ * represents peer's MLD address for MLO pairwise key. For MLO group key,
-+ * the link is identified by %NL80211_ATTR_MLO_LINK_ID.
- * @NL80211_CMD_SET_KEY: Set key attributes %NL80211_ATTR_KEY_DEFAULT,
- * %NL80211_ATTR_KEY_DEFAULT_MGMT, or %NL80211_ATTR_KEY_THRESHOLD.
-+ * For MLO connection, the link to set default key is identified by
-+ * %NL80211_ATTR_MLO_LINK_ID.
- * @NL80211_CMD_NEW_KEY: add a key with given %NL80211_ATTR_KEY_DATA,
- * %NL80211_ATTR_KEY_IDX, %NL80211_ATTR_MAC, %NL80211_ATTR_KEY_CIPHER,
-- * and %NL80211_ATTR_KEY_SEQ attributes.
-+ * and %NL80211_ATTR_KEY_SEQ attributes. %NL80211_ATTR_MAC represents
-+ * peer's MLD address for MLO pairwise key. The link to add MLO
-+ * group key is identified by %NL80211_ATTR_MLO_LINK_ID.
- * @NL80211_CMD_DEL_KEY: delete a key identified by %NL80211_ATTR_KEY_IDX
-- * or %NL80211_ATTR_MAC.
-+ * or %NL80211_ATTR_MAC. %NL80211_ATTR_MAC represents peer's MLD address
-+ * for MLO pairwise key. The link to delete group key is identified by
-+ * %NL80211_ATTR_MLO_LINK_ID.
- *
- * @NL80211_CMD_GET_BEACON: (not used)
- * @NL80211_CMD_SET_BEACON: change the beacon on an access point interface
-@@ -753,6 +772,13 @@
- * %NL80211_ATTR_CSA_C_OFFSETS_TX is an array of offsets to CSA
- * counters which will be updated to the current value. This attribute
- * is used during CSA period.
-+ * For TX on an MLD, the frequency can be omitted and the link ID be
-+ * specified, or if transmitting to a known peer MLD (with MLD addresses
-+ * in the frame) both can be omitted and the link will be selected by
-+ * lower layers.
-+ * For RX notification, %NL80211_ATTR_RX_HW_TIMESTAMP may be included to
-+ * indicate the frame RX timestamp and %NL80211_ATTR_TX_HW_TIMESTAMP may
-+ * be included to indicate the ack TX timestamp.
- * @NL80211_CMD_FRAME_WAIT_CANCEL: When an off-channel TX was requested, this
- * command may be used with the corresponding cookie to cancel the wait
- * time if it is known that it is no longer necessary. This command is
-@@ -763,7 +789,9 @@
- * transmitted with %NL80211_CMD_FRAME. %NL80211_ATTR_COOKIE identifies
- * the TX command and %NL80211_ATTR_FRAME includes the contents of the
- * frame. %NL80211_ATTR_ACK flag is included if the recipient acknowledged
-- * the frame.
-+ * the frame. %NL80211_ATTR_TX_HW_TIMESTAMP may be included to indicate the
-+ * tx timestamp and %NL80211_ATTR_RX_HW_TIMESTAMP may be included to
-+ * indicate the ack RX timestamp.
- * @NL80211_CMD_ACTION_TX_STATUS: Alias for @NL80211_CMD_FRAME_TX_STATUS for
- * backward compatibility.
- *
-@@ -1108,6 +1136,12 @@
- * has been received. %NL80211_ATTR_FRAME is used to specify the
- * frame contents. The frame is the raw EAPoL data, without ethernet or
- * 802.11 headers.
-+ * For an MLD transmitter, the %NL80211_ATTR_MLO_LINK_ID may be given and
-+ * its effect will depend on the destination: If the destination is known
-+ * to be an MLD, this will be used as a hint to select the link to transmit
-+ * the frame on. If the destination is not an MLD, this will select both
-+ * the link to transmit on and the source address will be set to the link
-+ * address of that link.
- * When used as an event indication %NL80211_ATTR_CONTROL_PORT_ETHERTYPE,
- * %NL80211_ATTR_CONTROL_PORT_NO_ENCRYPT and %NL80211_ATTR_MAC are added
- * indicating the protocol type of the received frame; whether the frame
-@@ -1237,6 +1271,16 @@
- * to describe the BSSID address of the AP and %NL80211_ATTR_TIMEOUT to
- * specify the timeout value.
- *
-+ * @NL80211_CMD_ADD_LINK: Add a new link to an interface. The
-+ * %NL80211_ATTR_MLO_LINK_ID attribute is used for the new link.
-+ * @NL80211_CMD_REMOVE_LINK: Remove a link from an interface. This may come
-+ * without %NL80211_ATTR_MLO_LINK_ID as an easy way to remove all links
-+ * in preparation for e.g. roaming to a regular (non-MLO) AP.
-+ *
-+ * @NL80211_CMD_ADD_LINK_STA: Add a link to an MLD station
-+ * @NL80211_CMD_MODIFY_LINK_STA: Modify a link of an MLD station
-+ * @NL80211_CMD_REMOVE_LINK_STA: Remove a link of an MLD station
-+ *
- * @NL80211_CMD_MAX: highest used command number
- * @__NL80211_CMD_AFTER_LAST: internal use
- */
-@@ -1481,6 +1525,13 @@ enum nl80211_commands {
-
- NL80211_CMD_ASSOC_COMEBACK,
-
-+ NL80211_CMD_ADD_LINK,
-+ NL80211_CMD_REMOVE_LINK,
-+
-+ NL80211_CMD_ADD_LINK_STA,
-+ NL80211_CMD_MODIFY_LINK_STA,
-+ NL80211_CMD_REMOVE_LINK_STA,
-+
- /* add new commands above here */
-
- /* used to define NL80211_CMD_MAX below */
-@@ -2340,8 +2391,10 @@ enum nl80211_commands {
- *
- * @NL80211_ATTR_IFTYPE_EXT_CAPA: Nested attribute of the following attributes:
- * %NL80211_ATTR_IFTYPE, %NL80211_ATTR_EXT_CAPA,
-- * %NL80211_ATTR_EXT_CAPA_MASK, to specify the extended capabilities per
-- * interface type.
-+ * %NL80211_ATTR_EXT_CAPA_MASK, to specify the extended capabilities and
-+ * other interface-type specific capabilities per interface type. For MLO,
-+ * %NL80211_ATTR_EML_CAPABILITY and %NL80211_ATTR_MLD_CAPA_AND_OPS are
-+ * present.
- *
- * @NL80211_ATTR_MU_MIMO_GROUP_DATA: array of 24 bytes that defines a MU-MIMO
- * groupID for monitor mode.
-@@ -2663,6 +2716,44 @@ enum nl80211_commands {
- * association request when used with NL80211_CMD_NEW_STATION). Can be set
- * only if %NL80211_STA_FLAG_WME is set.
- *
-+ * @NL80211_ATTR_MLO_LINK_ID: A (u8) link ID for use with MLO, to be used with
-+ * various commands that need a link ID to operate.
-+ * @NL80211_ATTR_MLO_LINKS: A nested array of links, each containing some
-+ * per-link information and a link ID.
-+ * @NL80211_ATTR_MLD_ADDR: An MLD address, used with various commands such as
-+ * authenticate/associate.
-+ *
-+ * @NL80211_ATTR_MLO_SUPPORT: Flag attribute to indicate user space supports MLO
-+ * connection. Used with %NL80211_CMD_CONNECT. If this attribute is not
-+ * included in NL80211_CMD_CONNECT drivers must not perform MLO connection.
-+ *
-+ * @NL80211_ATTR_MAX_NUM_AKM_SUITES: U16 attribute. Indicates maximum number of
-+ * AKM suites allowed for %NL80211_CMD_CONNECT, %NL80211_CMD_ASSOCIATE and
-+ * %NL80211_CMD_START_AP in %NL80211_CMD_GET_WIPHY response. If this
-+ * attribute is not present userspace shall consider maximum number of AKM
-+ * suites allowed as %NL80211_MAX_NR_AKM_SUITES which is the legacy maximum
-+ * number prior to the introduction of this attribute.
-+ *
-+ * @NL80211_ATTR_EML_CAPABILITY: EML Capability information (u16)
-+ * @NL80211_ATTR_MLD_CAPA_AND_OPS: MLD Capabilities and Operations (u16)
-+ *
-+ * @NL80211_ATTR_TX_HW_TIMESTAMP: Hardware timestamp for TX operation in
-+ * nanoseconds (u64). This is the device clock timestamp so it will
-+ * probably reset when the device is stopped or the firmware is reset.
-+ * When used with %NL80211_CMD_FRAME_TX_STATUS, indicates the frame TX
-+ * timestamp. When used with %NL80211_CMD_FRAME RX notification, indicates
-+ * the ack TX timestamp.
-+ * @NL80211_ATTR_RX_HW_TIMESTAMP: Hardware timestamp for RX operation in
-+ * nanoseconds (u64). This is the device clock timestamp so it will
-+ * probably reset when the device is stopped or the firmware is reset.
-+ * When used with %NL80211_CMD_FRAME_TX_STATUS, indicates the ack RX
-+ * timestamp. When used with %NL80211_CMD_FRAME RX notification, indicates
-+ * the incoming frame RX timestamp.
-+ * @NL80211_ATTR_TD_BITMAP: Transition Disable bitmap, for subsequent
-+ * (re)associations.
-+ * @NL80211_ATTR_WIPHY_ANTENNA_GAIN: Configured antenna gain. Used to reduce
-+ * transmit power to stay within regulatory limits. u32, dBi.
-+ *
- * @NUM_NL80211_ATTR: total number of nl80211_attrs available
- * @NL80211_ATTR_MAX: highest attribute number currently defined
- * @__NL80211_ATTR_AFTER_LAST: internal use
-@@ -3177,6 +3268,23 @@ enum nl80211_attrs {
-
- NL80211_ATTR_DISABLE_EHT,
-
-+ NL80211_ATTR_MLO_LINKS,
-+ NL80211_ATTR_MLO_LINK_ID,
-+ NL80211_ATTR_MLD_ADDR,
-+
-+ NL80211_ATTR_MLO_SUPPORT,
-+
-+ NL80211_ATTR_MAX_NUM_AKM_SUITES,
-+
-+ NL80211_ATTR_EML_CAPABILITY,
-+ NL80211_ATTR_MLD_CAPA_AND_OPS,
-+
-+ NL80211_ATTR_TX_HW_TIMESTAMP,
-+ NL80211_ATTR_RX_HW_TIMESTAMP,
-+ NL80211_ATTR_TD_BITMAP,
-+
-+ NL80211_ATTR_WIPHY_ANTENNA_GAIN,
-+
- /* add attributes here, update the policy in nl80211.c */
-
- __NL80211_ATTR_AFTER_LAST,
-@@ -3231,6 +3339,11 @@ enum nl80211_attrs {
- #define NL80211_HE_MIN_CAPABILITY_LEN 16
- #define NL80211_HE_MAX_CAPABILITY_LEN 54
- #define NL80211_MAX_NR_CIPHER_SUITES 5
-+
-+/*
-+ * NL80211_MAX_NR_AKM_SUITES is obsolete when %NL80211_ATTR_MAX_NUM_AKM_SUITES
-+ * present in %NL80211_CMD_GET_WIPHY response.
-+ */
- #define NL80211_MAX_NR_AKM_SUITES 2
- #define NL80211_EHT_MIN_CAPABILITY_LEN 13
- #define NL80211_EHT_MAX_CAPABILITY_LEN 51
-@@ -4853,6 +4966,8 @@ enum nl80211_bss_scan_width {
- * Contains a nested array of signal strength attributes (u8, dBm),
- * using the nesting index as the antenna number.
- * @NL80211_BSS_FREQUENCY_OFFSET: frequency offset in KHz
-+ * @NL80211_BSS_MLO_LINK_ID: MLO link ID of the BSS (u8).
-+ * @NL80211_BSS_MLD_ADDR: MLD address of this BSS if connected to it.
- * @__NL80211_BSS_AFTER_LAST: internal
- * @NL80211_BSS_MAX: highest BSS attribute
- */
-@@ -4878,6 +4993,8 @@ enum nl80211_bss {
- NL80211_BSS_PARENT_BSSID,
- NL80211_BSS_CHAIN_SIGNAL,
- NL80211_BSS_FREQUENCY_OFFSET,
-+ NL80211_BSS_MLO_LINK_ID,
-+ NL80211_BSS_MLD_ADDR,
-
- /* keep last */
- __NL80211_BSS_AFTER_LAST,
-@@ -5874,7 +5991,7 @@ enum nl80211_ap_sme_features {
- * @NL80211_FEATURE_INACTIVITY_TIMER: This driver takes care of freeing up
- * the connected inactive stations in AP mode.
- * @NL80211_FEATURE_CELL_BASE_REG_HINTS: This driver has been tested
-- * to work properly to suppport receiving regulatory hints from
-+ * to work properly to support receiving regulatory hints from
- * cellular base stations.
- * @NL80211_FEATURE_P2P_DEVICE_NEEDS_CHANNEL: (no longer available, only
- * here to reserve the value for API/ABI compatibility)
-@@ -6174,6 +6291,14 @@ enum nl80211_feature_flags {
- * @NL80211_EXT_FEATURE_RADAR_BACKGROUND: Device supports background radar/CAC
- * detection.
- *
-+ * @NL80211_EXT_FEATURE_POWERED_ADDR_CHANGE: Device can perform a MAC address
-+ * change without having to bring the underlying network device down
-+ * first. For example, in station mode this can be used to vary the
-+ * origin MAC address prior to a connection to a new AP for privacy
-+ * or other reasons. Note that certain driver specific restrictions
-+ * might apply, e.g. no scans in progress, no offchannel operations
-+ * in progress, and no active connections.
-+ *
- * @NUM_NL80211_EXT_FEATURES: number of extended features.
- * @MAX_NL80211_EXT_FEATURES: highest extended feature index.
- */
-@@ -6241,6 +6366,7 @@ enum nl80211_ext_feature_index {
- NL80211_EXT_FEATURE_BSS_COLOR,
- NL80211_EXT_FEATURE_FILS_CRYPTO_OFFLOAD,
- NL80211_EXT_FEATURE_RADAR_BACKGROUND,
-+ NL80211_EXT_FEATURE_POWERED_ADDR_CHANGE,
-
- /* add new features before the definition below */
- NUM_NL80211_EXT_FEATURES,
diff --git a/recipes-wifi/iw/patches/120-antenna_gain.patch b/recipes-wifi/iw/patches/120-antenna_gain.patch
deleted file mode 100644
index f8d537f..0000000
--- a/recipes-wifi/iw/patches/120-antenna_gain.patch
+++ /dev/null
@@ -1,33 +0,0 @@
---- a/phy.c
-+++ b/phy.c
-@@ -855,3 +855,30 @@ static int handle_get_txq(struct nl80211
- COMMAND(get, txq, "",
- NL80211_CMD_GET_WIPHY, 0, CIB_PHY, handle_get_txq,
- "Get TXQ parameters.");
-+
-+static int handle_antenna_gain(struct nl80211_state *state,
-+ struct nl_msg *msg,
-+ int argc, char **argv,
-+ enum id_input id)
-+{
-+ char *endptr;
-+ int dbm;
-+
-+ /* get the required args */
-+ if (argc != 1)
-+ return 1;
-+
-+ dbm = strtol(argv[0], &endptr, 10);
-+ if (*endptr)
-+ return 2;
-+
-+ NLA_PUT_U32(msg, NL80211_ATTR_WIPHY_ANTENNA_GAIN, dbm);
-+
-+ return 0;
-+
-+ nla_put_failure:
-+ return -ENOBUFS;
-+}
-+COMMAND(set, antenna_gain, "<antenna gain in dBm>",
-+ NL80211_CMD_SET_WIPHY, 0, CIB_PHY, handle_antenna_gain,
-+ "Specify antenna gain.");
diff --git a/recipes-wifi/iw/patches/patches.inc b/recipes-wifi/iw/patches/patches.inc
index 455311f..5dc69de 100644
--- a/recipes-wifi/iw/patches/patches.inc
+++ b/recipes-wifi/iw/patches/patches.inc
@@ -1,8 +1,6 @@
#patch patches (come from openwrt/lede/target/linux/mediatek)
SRC_URI_append = " \
- file://001-nl80211_h_sync.patch \
file://010-Revert-iw-allow-specifying-CFLAGS-LIBS-externally.patch \
file://1000-Add-support-to-set-control-and-center-freq-for-6G-BW.patch \
- file://120-antenna_gain.patch \
file://130-survey-bss-rx-time.patch \
"
diff --git a/recipes-wifi/linux-mac80211/files/patches-6.x/subsys/500-mac80211_configure_antenna_gain.patch b/recipes-wifi/linux-mac80211/files/patches-6.x/subsys/500-mac80211_configure_antenna_gain.patch
deleted file mode 100644
index 58a5906..0000000
--- a/recipes-wifi/linux-mac80211/files/patches-6.x/subsys/500-mac80211_configure_antenna_gain.patch
+++ /dev/null
@@ -1,162 +0,0 @@
---- a/include/net/cfg80211.h
-+++ b/include/net/cfg80211.h
-@@ -4084,6 +4084,7 @@ struct mgmt_frame_regs {
- * (as advertised by the nl80211 feature flag.)
- * @get_tx_power: store the current TX power into the dbm variable;
- * return 0 if successful
-+ * @set_antenna_gain: set antenna gain to reduce maximum tx power if necessary
- *
- * @rfkill_poll: polls the hw rfkill line, use cfg80211 reporting
- * functions to adjust rfkill hw state
-@@ -4434,6 +4435,7 @@ struct cfg80211_ops {
- enum nl80211_tx_power_setting type, int mbm);
- int (*get_tx_power)(struct wiphy *wiphy, struct wireless_dev *wdev,
- int *dbm);
-+ int (*set_antenna_gain)(struct wiphy *wiphy, int dbi);
-
- void (*rfkill_poll)(struct wiphy *wiphy);
-
---- a/include/net/mac80211.h
-+++ b/include/net/mac80211.h
-@@ -1677,6 +1677,7 @@ enum ieee80211_smps_mode {
- *
- * @power_level: requested transmit power (in dBm), backward compatibility
- * value only that is set to the minimum of all interfaces
-+ * @max_antenna_gain: maximum antenna gain adjusted by user config (in dBi)
- *
- * @chandef: the channel definition to tune to
- * @radar_enabled: whether radar detection is enabled
-@@ -1697,6 +1698,7 @@ enum ieee80211_smps_mode {
- struct ieee80211_conf {
- u32 flags;
- int power_level, dynamic_ps_timeout;
-+ int max_antenna_gain;
-
- u16 listen_interval;
- u8 ps_dtim_period;
---- a/include/uapi/linux/nl80211.h
-+++ b/include/uapi/linux/nl80211.h
-@@ -2749,6 +2749,9 @@ enum nl80211_commands {
- * When used with %NL80211_CMD_FRAME_TX_STATUS, indicates the ack RX
- * timestamp. When used with %NL80211_CMD_FRAME RX notification, indicates
- * the incoming frame RX timestamp.
-+ * @NL80211_ATTR_WIPHY_ANTENNA_GAIN: Configured antenna gain. Used to reduce
-+ * transmit power to stay within regulatory limits. u32, dBi.
-+ *
- * @NUM_NL80211_ATTR: total number of nl80211_attrs available
- * @NL80211_ATTR_MAX: highest attribute number currently defined
- * @__NL80211_ATTR_AFTER_LAST: internal use
-@@ -3277,6 +3280,8 @@ enum nl80211_attrs {
- NL80211_ATTR_TX_HW_TIMESTAMP,
- NL80211_ATTR_RX_HW_TIMESTAMP,
-
-+ NL80211_ATTR_WIPHY_ANTENNA_GAIN,
-+
- /* add attributes here, update the policy in nl80211.c */
-
- __NL80211_ATTR_AFTER_LAST,
---- a/net/mac80211/cfg.c
-+++ b/net/mac80211/cfg.c
-@@ -3046,6 +3046,19 @@ static int ieee80211_get_tx_power(struct
- return 0;
- }
-
-+static int ieee80211_set_antenna_gain(struct wiphy *wiphy, int dbi)
-+{
-+ struct ieee80211_local *local = wiphy_priv(wiphy);
-+
-+ if (dbi < 0)
-+ return -EINVAL;
-+
-+ local->user_antenna_gain = dbi;
-+ ieee80211_hw_config(local, 0);
-+
-+ return 0;
-+}
-+
- static void ieee80211_rfkill_poll(struct wiphy *wiphy)
- {
- struct ieee80211_local *local = wiphy_priv(wiphy);
-@@ -4956,6 +4969,7 @@ const struct cfg80211_ops mac80211_confi
- .set_wiphy_params = ieee80211_set_wiphy_params,
- .set_tx_power = ieee80211_set_tx_power,
- .get_tx_power = ieee80211_get_tx_power,
-+ .set_antenna_gain = ieee80211_set_antenna_gain,
- .rfkill_poll = ieee80211_rfkill_poll,
- CFG80211_TESTMODE_CMD(ieee80211_testmode_cmd)
- CFG80211_TESTMODE_DUMP(ieee80211_testmode_dump)
---- a/net/mac80211/ieee80211_i.h
-+++ b/net/mac80211/ieee80211_i.h
-@@ -1542,6 +1542,7 @@ struct ieee80211_local {
- int dynamic_ps_forced_timeout;
-
- int user_power_level; /* in dBm, for all interfaces */
-+ int user_antenna_gain; /* in dBi */
-
- enum ieee80211_smps_mode smps_mode;
-
---- a/net/mac80211/main.c
-+++ b/net/mac80211/main.c
-@@ -96,7 +96,7 @@ static u32 ieee80211_hw_conf_chan(struct
- struct ieee80211_sub_if_data *sdata;
- struct cfg80211_chan_def chandef = {};
- u32 changed = 0;
-- int power;
-+ int power, max_power;
- u32 offchannel_flag;
-
- offchannel_flag = local->hw.conf.flags & IEEE80211_CONF_OFFCHANNEL;
-@@ -157,6 +157,12 @@ static u32 ieee80211_hw_conf_chan(struct
- }
- rcu_read_unlock();
-
-+ max_power = chandef.chan->max_reg_power;
-+ if (local->user_antenna_gain > 0) {
-+ max_power -= local->user_antenna_gain;
-+ power = min(power, max_power);
-+ }
-+
- if (local->hw.conf.power_level != power) {
- changed |= IEEE80211_CONF_CHANGE_POWER;
- local->hw.conf.power_level = power;
-@@ -762,6 +768,7 @@ struct ieee80211_hw *ieee80211_alloc_hw_
- IEEE80211_RADIOTAP_MCS_HAVE_BW;
- local->hw.radiotap_vht_details = IEEE80211_RADIOTAP_VHT_KNOWN_GI |
- IEEE80211_RADIOTAP_VHT_KNOWN_BANDWIDTH;
-+ local->user_antenna_gain = 0;
- local->hw.uapsd_queues = IEEE80211_DEFAULT_UAPSD_QUEUES;
- local->hw.uapsd_max_sp_len = IEEE80211_DEFAULT_MAX_SP_LEN;
- local->hw.max_mtu = IEEE80211_MAX_DATA_LEN;
---- a/net/wireless/nl80211.c
-+++ b/net/wireless/nl80211.c
-@@ -799,6 +799,7 @@ static const struct nla_policy nl80211_p
- [NL80211_ATTR_MLD_ADDR] = NLA_POLICY_EXACT_LEN(ETH_ALEN),
- [NL80211_ATTR_MLO_SUPPORT] = { .type = NLA_FLAG },
- [NL80211_ATTR_MAX_NUM_AKM_SUITES] = { .type = NLA_REJECT },
-+ [NL80211_ATTR_WIPHY_ANTENNA_GAIN] = { .type = NLA_U32 },
- };
-
- /* policy for the key attributes */
-@@ -3511,6 +3512,22 @@ static int nl80211_set_wiphy(struct sk_b
- if (result)
- goto out;
- }
-+
-+ if (info->attrs[NL80211_ATTR_WIPHY_ANTENNA_GAIN]) {
-+ int idx, dbi = 0;
-+
-+ if (!rdev->ops->set_antenna_gain) {
-+ result = -EOPNOTSUPP;
-+ goto out;
-+ }
-+
-+ idx = NL80211_ATTR_WIPHY_ANTENNA_GAIN;
-+ dbi = nla_get_u32(info->attrs[idx]);
-+
-+ result = rdev->ops->set_antenna_gain(&rdev->wiphy, dbi);
-+ if (result)
-+ goto out;
-+ }
-
- if (info->attrs[NL80211_ATTR_WIPHY_TX_POWER_SETTING]) {
- struct wireless_dev *txp_wdev = wdev;
diff --git a/recipes-wifi/linux-mac80211/files/patches-6.x/subsys/bp-0001-Revert-mac80211_configure_antenna_gain.patch b/recipes-wifi/linux-mac80211/files/patches-6.x/subsys/bp-0001-Revert-mac80211_configure_antenna_gain.patch
deleted file mode 100644
index 7c29367..0000000
--- a/recipes-wifi/linux-mac80211/files/patches-6.x/subsys/bp-0001-Revert-mac80211_configure_antenna_gain.patch
+++ /dev/null
@@ -1,194 +0,0 @@
-From cefd58077419436745c1ca07daf75419c96e36b5 Mon Sep 17 00:00:00 2001
-From: Shayne Chen <shayne.chen@mediatek.com>
-Date: Tue, 18 Apr 2023 15:37:08 +0800
-Subject: [PATCH 1/9] Revert mac80211_configure_antenna_gain
-
----
- include/net/cfg80211.h | 2 --
- include/net/mac80211.h | 2 --
- include/uapi/linux/nl80211.h | 5 -----
- net/mac80211/cfg.c | 14 --------------
- net/mac80211/ieee80211_i.h | 1 -
- net/mac80211/main.c | 9 +--------
- net/wireless/nl80211.c | 17 -----------------
- 7 files changed, 1 insertion(+), 49 deletions(-)
-
-diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
-index 357a78f..803949b 100644
---- a/include/net/cfg80211.h
-+++ b/include/net/cfg80211.h
-@@ -4081,7 +4081,6 @@ struct mgmt_frame_regs {
- * (as advertised by the nl80211 feature flag.)
- * @get_tx_power: store the current TX power into the dbm variable;
- * return 0 if successful
-- * @set_antenna_gain: set antenna gain to reduce maximum tx power if necessary
- *
- * @rfkill_poll: polls the hw rfkill line, use cfg80211 reporting
- * functions to adjust rfkill hw state
-@@ -4432,7 +4431,6 @@ struct cfg80211_ops {
- enum nl80211_tx_power_setting type, int mbm);
- int (*get_tx_power)(struct wiphy *wiphy, struct wireless_dev *wdev,
- int *dbm);
-- int (*set_antenna_gain)(struct wiphy *wiphy, int dbi);
-
- void (*rfkill_poll)(struct wiphy *wiphy);
-
-diff --git a/include/net/mac80211.h b/include/net/mac80211.h
-index da3c3b3..9c59eb8 100644
---- a/include/net/mac80211.h
-+++ b/include/net/mac80211.h
-@@ -1677,7 +1677,6 @@ enum ieee80211_smps_mode {
- *
- * @power_level: requested transmit power (in dBm), backward compatibility
- * value only that is set to the minimum of all interfaces
-- * @max_antenna_gain: maximum antenna gain adjusted by user config (in dBi)
- *
- * @chandef: the channel definition to tune to
- * @radar_enabled: whether radar detection is enabled
-@@ -1698,7 +1697,6 @@ enum ieee80211_smps_mode {
- struct ieee80211_conf {
- u32 flags;
- int power_level, dynamic_ps_timeout;
-- int max_antenna_gain;
-
- u16 listen_interval;
- u8 ps_dtim_period;
-diff --git a/include/uapi/linux/nl80211.h b/include/uapi/linux/nl80211.h
-index ba4aa09..c32e761 100644
---- a/include/uapi/linux/nl80211.h
-+++ b/include/uapi/linux/nl80211.h
-@@ -2749,9 +2749,6 @@ enum nl80211_commands {
- * When used with %NL80211_CMD_FRAME_TX_STATUS, indicates the ack RX
- * timestamp. When used with %NL80211_CMD_FRAME RX notification, indicates
- * the incoming frame RX timestamp.
-- * @NL80211_ATTR_WIPHY_ANTENNA_GAIN: Configured antenna gain. Used to reduce
-- * transmit power to stay within regulatory limits. u32, dBi.
-- *
- * @NUM_NL80211_ATTR: total number of nl80211_attrs available
- * @NL80211_ATTR_MAX: highest attribute number currently defined
- * @__NL80211_ATTR_AFTER_LAST: internal use
-@@ -3280,8 +3277,6 @@ enum nl80211_attrs {
- NL80211_ATTR_TX_HW_TIMESTAMP,
- NL80211_ATTR_RX_HW_TIMESTAMP,
-
-- NL80211_ATTR_WIPHY_ANTENNA_GAIN,
--
- /* add attributes here, update the policy in nl80211.c */
-
- __NL80211_ATTR_AFTER_LAST,
-diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
-index 5397fe9..7a5e459 100644
---- a/net/mac80211/cfg.c
-+++ b/net/mac80211/cfg.c
-@@ -3046,19 +3046,6 @@ static int ieee80211_get_tx_power(struct wiphy *wiphy,
- return 0;
- }
-
--static int ieee80211_set_antenna_gain(struct wiphy *wiphy, int dbi)
--{
-- struct ieee80211_local *local = wiphy_priv(wiphy);
--
-- if (dbi < 0)
-- return -EINVAL;
--
-- local->user_antenna_gain = dbi;
-- ieee80211_hw_config(local, 0);
--
-- return 0;
--}
--
- static void ieee80211_rfkill_poll(struct wiphy *wiphy)
- {
- struct ieee80211_local *local = wiphy_priv(wiphy);
-@@ -4966,7 +4953,6 @@ const struct cfg80211_ops mac80211_config_ops = {
- .set_wiphy_params = ieee80211_set_wiphy_params,
- .set_tx_power = ieee80211_set_tx_power,
- .get_tx_power = ieee80211_get_tx_power,
-- .set_antenna_gain = ieee80211_set_antenna_gain,
- .rfkill_poll = ieee80211_rfkill_poll,
- CFG80211_TESTMODE_CMD(ieee80211_testmode_cmd)
- CFG80211_TESTMODE_DUMP(ieee80211_testmode_dump)
-diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h
-index e7bcdea..a4fab9a 100644
---- a/net/mac80211/ieee80211_i.h
-+++ b/net/mac80211/ieee80211_i.h
-@@ -1538,7 +1538,6 @@ struct ieee80211_local {
- int dynamic_ps_forced_timeout;
-
- int user_power_level; /* in dBm, for all interfaces */
-- int user_antenna_gain; /* in dBi */
-
- enum ieee80211_smps_mode smps_mode;
-
-diff --git a/net/mac80211/main.c b/net/mac80211/main.c
-index 83a1482..dfb9f4b 100644
---- a/net/mac80211/main.c
-+++ b/net/mac80211/main.c
-@@ -96,7 +96,7 @@ static u32 ieee80211_hw_conf_chan(struct ieee80211_local *local)
- struct ieee80211_sub_if_data *sdata;
- struct cfg80211_chan_def chandef = {};
- u32 changed = 0;
-- int power, max_power;
-+ int power;
- u32 offchannel_flag;
-
- offchannel_flag = local->hw.conf.flags & IEEE80211_CONF_OFFCHANNEL;
-@@ -157,12 +157,6 @@ static u32 ieee80211_hw_conf_chan(struct ieee80211_local *local)
- }
- rcu_read_unlock();
-
-- max_power = chandef.chan->max_reg_power;
-- if (local->user_antenna_gain > 0) {
-- max_power -= local->user_antenna_gain;
-- power = min(power, max_power);
-- }
--
- if (local->hw.conf.power_level != power) {
- changed |= IEEE80211_CONF_CHANGE_POWER;
- local->hw.conf.power_level = power;
-@@ -768,7 +762,6 @@ struct ieee80211_hw *ieee80211_alloc_hw_nm(size_t priv_data_len,
- IEEE80211_RADIOTAP_MCS_HAVE_BW;
- local->hw.radiotap_vht_details = IEEE80211_RADIOTAP_VHT_KNOWN_GI |
- IEEE80211_RADIOTAP_VHT_KNOWN_BANDWIDTH;
-- local->user_antenna_gain = 0;
- local->hw.uapsd_queues = IEEE80211_DEFAULT_UAPSD_QUEUES;
- local->hw.uapsd_max_sp_len = IEEE80211_DEFAULT_MAX_SP_LEN;
- local->hw.max_mtu = IEEE80211_MAX_DATA_LEN;
-diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
-index 507c868..777c141 100644
---- a/net/wireless/nl80211.c
-+++ b/net/wireless/nl80211.c
-@@ -799,7 +799,6 @@ static const struct nla_policy nl80211_policy[NUM_NL80211_ATTR] = {
- [NL80211_ATTR_MLD_ADDR] = NLA_POLICY_EXACT_LEN(ETH_ALEN),
- [NL80211_ATTR_MLO_SUPPORT] = { .type = NLA_FLAG },
- [NL80211_ATTR_MAX_NUM_AKM_SUITES] = { .type = NLA_REJECT },
-- [NL80211_ATTR_WIPHY_ANTENNA_GAIN] = { .type = NLA_U32 },
- };
-
- /* policy for the key attributes */
-@@ -3513,22 +3512,6 @@ static int nl80211_set_wiphy(struct sk_buff *skb, struct genl_info *info)
- goto out;
- }
-
-- if (info->attrs[NL80211_ATTR_WIPHY_ANTENNA_GAIN]) {
-- int idx, dbi = 0;
--
-- if (!rdev->ops->set_antenna_gain) {
-- result = -EOPNOTSUPP;
-- goto out;
-- }
--
-- idx = NL80211_ATTR_WIPHY_ANTENNA_GAIN;
-- dbi = nla_get_u32(info->attrs[idx]);
--
-- result = rdev->ops->set_antenna_gain(&rdev->wiphy, dbi);
-- if (result)
-- goto out;
-- }
--
- if (info->attrs[NL80211_ATTR_WIPHY_TX_POWER_SETTING]) {
- struct wireless_dev *txp_wdev = wdev;
- enum nl80211_tx_power_setting type;
---
-2.39.2
-
diff --git a/recipes-wifi/linux-mac80211/files/patches-6.x/subsys/subsys.inc b/recipes-wifi/linux-mac80211/files/patches-6.x/subsys/subsys.inc
index d392140..758523e 100644
--- a/recipes-wifi/linux-mac80211/files/patches-6.x/subsys/subsys.inc
+++ b/recipes-wifi/linux-mac80211/files/patches-6.x/subsys/subsys.inc
@@ -41,9 +41,7 @@
file://338-mac80211-split-mesh-fast-tx-cache-into-local-proxied.patch \
file://339-wifi-cfg80211-fix-receving-mesh-packets-without-RFC1.patch \
file://400-allow-ibss-mixed.patch \
- file://500-mac80211_configure_antenna_gain.patch \
file://782-net-next-1-of-net-pass-the-dst-buffer-to-of_get_mac_address.patch \
- file://bp-0001-Revert-mac80211_configure_antenna_gain.patch \
file://bp-0002-mac80211-support-minimal-EHT-rate-reporting-on-RX.patch \
file://bp-0003-cfg80211-Update-Transition-Disable-policy-during-por.patch \
file://bp-0004-wifi-mac80211-mlme-handle-EHT-channel-puncturing.patch \
diff --git a/recipes-wifi/linux-mt76/files/patches/0000-sync-to-master-codebase.patch b/recipes-wifi/linux-mt76/files/patches/0000-sync-to-master-codebase.patch
deleted file mode 100644
index fb3e74b..0000000
--- a/recipes-wifi/linux-mt76/files/patches/0000-sync-to-master-codebase.patch
+++ /dev/null
@@ -1,9784 +0,0 @@
-From e3eb835c5f9c1f40a1aaf4fae2a2de83f2cd1a9c Mon Sep 17 00:00:00 2001
-From: Shayne Chen <shayne.chen@mediatek.com>
-Date: Thu, 3 Aug 2023 14:49:59 +0800
-Subject: [PATCH] sync to master codebase
-
----
- Makefile | 8 +
- mt76_connac3_mac.h | 14 +
- mt76x02_mac.c | 3 +-
- mt7915/main.c | 3 +-
- mt7915/mcu.c | 2 +-
- mt7921/Kconfig | 4 +-
- mt7921/Makefile | 9 +-
- mt7921/acpi_sar.h | 105 ---
- mt7921/debugfs.c | 228 +------
- mt7921/init.c | 304 +--------
- mt7921/mac.c | 442 ++-----------
- mt7921/main.c | 796 +++++-----------------
- mt7921/mcu.c | 217 ++----
- mt7921/mt7921.h | 320 ++-------
- mt7921/pci.c | 223 ++++---
- mt7921/pci_mac.c | 18 +-
- mt7921/pci_mcu.c | 71 +-
- mt7921/regs.h | 464 +------------
- mt7921/sdio.c | 32 +-
- mt7921/sdio_mac.c | 6 +-
- mt7921/sdio_mcu.c | 14 +-
- mt7921/testmode.c | 10 +-
- mt7921/trace.c | 12 -
- mt7921/usb.c | 205 +++---
- mt7921/usb_mac.c | 255 -------
- mt792x.h | 367 +++++++++++
- mt7921/acpi_sar.c => mt792x_acpi_sar.c | 128 ++--
- mt792x_acpi_sar.h | 105 +++
- mt792x_core.c | 844 ++++++++++++++++++++++++
- mt792x_debugfs.c | 168 +++++
- mt7921/dma.c => mt792x_dma.c | 336 +++++-----
- mt792x_mac.c | 385 +++++++++++
- mt792x_regs.h | 479 ++++++++++++++
- mt792x_trace.c | 14 +
- mt7921/mt7921_trace.h => mt792x_trace.h | 16 +-
- mt792x_usb.c | 309 +++++++++
- mt7996/mt7996.h | 14 -
- testmode.c | 1 +
- 38 files changed, 3586 insertions(+), 3345 deletions(-)
- delete mode 100644 mt7921/acpi_sar.h
- delete mode 100644 mt7921/trace.c
- delete mode 100644 mt7921/usb_mac.c
- create mode 100644 mt792x.h
- rename mt7921/acpi_sar.c => mt792x_acpi_sar.c (64%)
- create mode 100644 mt792x_acpi_sar.h
- create mode 100644 mt792x_core.c
- create mode 100644 mt792x_debugfs.c
- rename mt7921/dma.c => mt792x_dma.c (55%)
- create mode 100644 mt792x_mac.c
- create mode 100644 mt792x_regs.h
- create mode 100644 mt792x_trace.c
- rename mt7921/mt7921_trace.h => mt792x_trace.h (68%)
- create mode 100644 mt792x_usb.c
-
-diff --git a/Makefile b/Makefile
-index f9b94280..c8aedf6d 100644
---- a/Makefile
-+++ b/Makefile
-@@ -6,6 +6,8 @@ obj-$(CONFIG_MT76_SDIO) += mt76-sdio.o
- obj-$(CONFIG_MT76x02_LIB) += mt76x02-lib.o
- obj-$(CONFIG_MT76x02_USB) += mt76x02-usb.o
- obj-$(CONFIG_MT76_CONNAC_LIB) += mt76-connac-lib.o
-+obj-$(CONFIG_MT792x_LIB) += mt792x-lib.o
-+obj-$(CONFIG_MT792x_USB) += mt792x-usb.o
-
- mt76-y := \
- mmio.o util.o trace.o dma.o mac80211.o debugfs.o eeprom.o \
-@@ -20,6 +22,7 @@ mt76-sdio-y := sdio.o sdio_txrx.o
- CFLAGS_trace.o := -I$(src)
- CFLAGS_usb_trace.o := -I$(src)
- CFLAGS_mt76x02_trace.o := -I$(src)
-+CFLAGS_mt792x_trace.o := -I$(src)
-
- mt76x02-lib-y := mt76x02_util.o mt76x02_mac.o mt76x02_mcu.o \
- mt76x02_eeprom.o mt76x02_phy.o mt76x02_mmio.o \
-@@ -30,6 +33,11 @@ mt76x02-usb-y := mt76x02_usb_mcu.o mt76x02_usb_core.o
-
- mt76-connac-lib-y := mt76_connac_mcu.o mt76_connac_mac.o mt76_connac3_mac.o
-
-+mt792x-lib-y := mt792x_core.o mt792x_mac.o mt792x_trace.o \
-+ mt792x_debugfs.o mt792x_dma.o
-+mt792x-lib-$(CONFIG_ACPI) += mt792x_acpi_sar.o
-+mt792x-usb-y := mt792x_usb.o
-+
- obj-$(CONFIG_MT76x0_COMMON) += mt76x0/
- obj-$(CONFIG_MT76x2_COMMON) += mt76x2/
- obj-$(CONFIG_MT7603E) += mt7603/
-diff --git a/mt76_connac3_mac.h b/mt76_connac3_mac.h
-index 6663a0b4..68ca0844 100644
---- a/mt76_connac3_mac.h
-+++ b/mt76_connac3_mac.h
-@@ -4,6 +4,20 @@
- #ifndef __MT76_CONNAC3_MAC_H
- #define __MT76_CONNAC3_MAC_H
-
-+enum {
-+ MT_CTX0,
-+ MT_HIF0 = 0x0,
-+
-+ MT_LMAC_AC00 = 0x0,
-+ MT_LMAC_AC01,
-+ MT_LMAC_AC02,
-+ MT_LMAC_AC03,
-+ MT_LMAC_ALTX0 = 0x10,
-+ MT_LMAC_BMC0,
-+ MT_LMAC_BCN0,
-+ MT_LMAC_PSMP0,
-+};
-+
- #define MT_CT_PARSE_LEN 72
- #define MT_CT_DMA_BUF_NUM 2
-
-diff --git a/mt76x02_mac.c b/mt76x02_mac.c
-index 3e41d809..d5db6ffd 100644
---- a/mt76x02_mac.c
-+++ b/mt76x02_mac.c
-@@ -853,7 +853,8 @@ int mt76x02_mac_process_rx(struct mt76x02_dev *dev, struct sk_buff *skb,
- if (WARN_ON_ONCE(len > skb->len))
- return -EINVAL;
-
-- pskb_trim(skb, len);
-+ if (pskb_trim(skb, len))
-+ return -EINVAL;
-
- status->chains = BIT(0);
- signal = mt76x02_mac_get_rssi(dev, rxwi->rssi[0], 0);
-diff --git a/mt7915/main.c b/mt7915/main.c
-index 33bfa4a6..9b79e915 100644
---- a/mt7915/main.c
-+++ b/mt7915/main.c
-@@ -471,7 +471,8 @@ static int mt7915_config(struct ieee80211_hw *hw, u32 changed)
- ieee80211_wake_queues(hw);
- }
-
-- if (changed & IEEE80211_CONF_CHANGE_POWER) {
-+ if (changed & (IEEE80211_CONF_CHANGE_POWER |
-+ IEEE80211_CONF_CHANGE_CHANNEL)) {
- ret = mt7915_mcu_set_txpower_sku(phy);
- if (ret)
- return ret;
-diff --git a/mt7915/mcu.c b/mt7915/mcu.c
-index b0328d4f..8224f8be 100644
---- a/mt7915/mcu.c
-+++ b/mt7915/mcu.c
-@@ -3038,7 +3038,7 @@ int mt7915_mcu_get_chan_mib_info(struct mt7915_phy *phy, bool chan_switch)
- }
-
- ret = mt76_mcu_send_and_get_msg(&dev->mt76, MCU_EXT_CMD(GET_MIB_INFO),
-- req, sizeof(req), true, &skb);
-+ req, len * sizeof(req[0]), true, &skb);
- if (ret)
- return ret;
-
-diff --git a/mt7921/Kconfig b/mt7921/Kconfig
-index adff2d73..7ed51e05 100644
---- a/mt7921/Kconfig
-+++ b/mt7921/Kconfig
-@@ -1,7 +1,7 @@
- # SPDX-License-Identifier: ISC
- config MT7921_COMMON
- tristate
-- select MT76_CONNAC_LIB
-+ select MT792x_LIB
- select WANT_DEV_COREDUMP
-
- config MT7921E
-@@ -27,7 +27,7 @@ config MT7921S
-
- config MT7921U
- tristate "MediaTek MT7921U (USB) support"
-- select MT76_USB
-+ select MT792x_USB
- select MT7921_COMMON
- depends on MAC80211
- depends on USB
-diff --git a/mt7921/Makefile b/mt7921/Makefile
-index e5d2d2e1..849be9e8 100644
---- a/mt7921/Makefile
-+++ b/mt7921/Makefile
-@@ -5,11 +5,8 @@ obj-$(CONFIG_MT7921E) += mt7921e.o
- obj-$(CONFIG_MT7921S) += mt7921s.o
- obj-$(CONFIG_MT7921U) += mt7921u.o
-
--CFLAGS_trace.o := -I$(src)
--
--mt7921-common-y := mac.o mcu.o main.o init.o debugfs.o trace.o
-+mt7921-common-y := mac.o mcu.o main.o init.o debugfs.o
- mt7921-common-$(CONFIG_NL80211_TESTMODE) += testmode.o
--mt7921-common-$(CONFIG_ACPI) += acpi_sar.o
--mt7921e-y := pci.o pci_mac.o pci_mcu.o dma.o
-+mt7921e-y := pci.o pci_mac.o pci_mcu.o
- mt7921s-y := sdio.o sdio_mac.o sdio_mcu.o
--mt7921u-y := usb.o usb_mac.o
-+mt7921u-y := usb.o
-diff --git a/mt7921/acpi_sar.h b/mt7921/acpi_sar.h
-deleted file mode 100644
-index 35268b08..00000000
---- a/mt7921/acpi_sar.h
-+++ /dev/null
-@@ -1,105 +0,0 @@
--/* SPDX-License-Identifier: ISC */
--/* Copyright (C) 2022 MediaTek Inc. */
--
--#ifndef __MT7921_ACPI_SAR_H
--#define __MT7921_ACPI_SAR_H
--
--#define MT7921_ASAR_MIN_DYN 1
--#define MT7921_ASAR_MAX_DYN 8
--#define MT7921_ASAR_MIN_GEO 3
--#define MT7921_ASAR_MAX_GEO 8
--#define MT7921_ASAR_MIN_FG 8
--
--#define MT7921_ACPI_MTCL "MTCL"
--#define MT7921_ACPI_MTDS "MTDS"
--#define MT7921_ACPI_MTGS "MTGS"
--#define MT7921_ACPI_MTFG "MTFG"
--
--struct mt7921_asar_dyn_limit {
-- u8 idx;
-- u8 frp[5];
--} __packed;
--
--struct mt7921_asar_dyn {
-- u8 names[4];
-- u8 enable;
-- u8 nr_tbl;
-- struct mt7921_asar_dyn_limit tbl[0];
--} __packed;
--
--struct mt7921_asar_dyn_limit_v2 {
-- u8 idx;
-- u8 frp[11];
--} __packed;
--
--struct mt7921_asar_dyn_v2 {
-- u8 names[4];
-- u8 enable;
-- u8 rsvd;
-- u8 nr_tbl;
-- struct mt7921_asar_dyn_limit_v2 tbl[0];
--} __packed;
--
--struct mt7921_asar_geo_band {
-- u8 pwr;
-- u8 offset;
--} __packed;
--
--struct mt7921_asar_geo_limit {
-- u8 idx;
-- /* 0:2G, 1:5G */
-- struct mt7921_asar_geo_band band[2];
--} __packed;
--
--struct mt7921_asar_geo {
-- u8 names[4];
-- u8 version;
-- u8 nr_tbl;
-- struct mt7921_asar_geo_limit tbl[0];
--} __packed;
--
--struct mt7921_asar_geo_limit_v2 {
-- u8 idx;
-- /* 0:2G, 1:5G, 2:6G */
-- struct mt7921_asar_geo_band band[3];
--} __packed;
--
--struct mt7921_asar_geo_v2 {
-- u8 names[4];
-- u8 version;
-- u8 rsvd;
-- u8 nr_tbl;
-- struct mt7921_asar_geo_limit_v2 tbl[0];
--} __packed;
--
--struct mt7921_asar_cl {
-- u8 names[4];
-- u8 version;
-- u8 mode_6g;
-- u8 cl6g[6];
--} __packed;
--
--struct mt7921_asar_fg {
-- u8 names[4];
-- u8 version;
-- u8 rsvd;
-- u8 nr_flag;
-- u8 rsvd1;
-- u8 flag[0];
--} __packed;
--
--struct mt7921_acpi_sar {
-- u8 ver;
-- union {
-- struct mt7921_asar_dyn *dyn;
-- struct mt7921_asar_dyn_v2 *dyn_v2;
-- };
-- union {
-- struct mt7921_asar_geo *geo;
-- struct mt7921_asar_geo_v2 *geo_v2;
-- };
-- struct mt7921_asar_cl *countrylist;
-- struct mt7921_asar_fg *fg;
--};
--
--#endif
-diff --git a/mt7921/debugfs.c b/mt7921/debugfs.c
-index d6c66e77..616b66a3 100644
---- a/mt7921/debugfs.c
-+++ b/mt7921/debugfs.c
-@@ -6,11 +6,11 @@
- static int
- mt7921_reg_set(void *data, u64 val)
- {
-- struct mt7921_dev *dev = data;
-+ struct mt792x_dev *dev = data;
-
-- mt7921_mutex_acquire(dev);
-+ mt792x_mutex_acquire(dev);
- mt76_wr(dev, dev->mt76.debugfs_reg, val);
-- mt7921_mutex_release(dev);
-+ mt792x_mutex_release(dev);
-
- return 0;
- }
-@@ -18,11 +18,11 @@ mt7921_reg_set(void *data, u64 val)
- static int
- mt7921_reg_get(void *data, u64 *val)
- {
-- struct mt7921_dev *dev = data;
-+ struct mt792x_dev *dev = data;
-
-- mt7921_mutex_acquire(dev);
-+ mt792x_mutex_acquire(dev);
- *val = mt76_rr(dev, dev->mt76.debugfs_reg);
-- mt7921_mutex_release(dev);
-+ mt792x_mutex_release(dev);
-
- return 0;
- }
-@@ -32,14 +32,14 @@ DEFINE_DEBUGFS_ATTRIBUTE(fops_regval, mt7921_reg_get, mt7921_reg_set,
- static int
- mt7921_fw_debug_set(void *data, u64 val)
- {
-- struct mt7921_dev *dev = data;
-+ struct mt792x_dev *dev = data;
-
-- mt7921_mutex_acquire(dev);
-+ mt792x_mutex_acquire(dev);
-
- dev->fw_debug = (u8)val;
- mt7921_mcu_fw_log_2_host(dev, dev->fw_debug);
-
-- mt7921_mutex_release(dev);
-+ mt792x_mutex_release(dev);
-
- return 0;
- }
-@@ -47,7 +47,7 @@ mt7921_fw_debug_set(void *data, u64 val)
- static int
- mt7921_fw_debug_get(void *data, u64 *val)
- {
-- struct mt7921_dev *dev = data;
-+ struct mt792x_dev *dev = data;
-
- *val = dev->fw_debug;
-
-@@ -57,128 +57,7 @@ mt7921_fw_debug_get(void *data, u64 *val)
- DEFINE_DEBUGFS_ATTRIBUTE(fops_fw_debug, mt7921_fw_debug_get,
- mt7921_fw_debug_set, "%lld\n");
-
--static void
--mt7921_ampdu_stat_read_phy(struct mt7921_phy *phy,
-- struct seq_file *file)
--{
-- struct mt7921_dev *dev = file->private;
-- int bound[15], range[4], i;
--
-- if (!phy)
-- return;
--
-- mt7921_mac_update_mib_stats(phy);
--
-- /* Tx ampdu stat */
-- for (i = 0; i < ARRAY_SIZE(range); i++)
-- range[i] = mt76_rr(dev, MT_MIB_ARNG(0, i));
--
-- for (i = 0; i < ARRAY_SIZE(bound); i++)
-- bound[i] = MT_MIB_ARNCR_RANGE(range[i / 4], i % 4) + 1;
--
-- seq_printf(file, "\nPhy0\n");
--
-- seq_printf(file, "Length: %8d | ", bound[0]);
-- for (i = 0; i < ARRAY_SIZE(bound) - 1; i++)
-- seq_printf(file, "%3d %3d | ", bound[i] + 1, bound[i + 1]);
--
-- seq_puts(file, "\nCount: ");
-- for (i = 0; i < ARRAY_SIZE(bound); i++)
-- seq_printf(file, "%8d | ", phy->mt76->aggr_stats[i]);
-- seq_puts(file, "\n");
--
-- seq_printf(file, "BA miss count: %d\n", phy->mib.ba_miss_cnt);
--}
--
--static int
--mt7921_tx_stats_show(struct seq_file *file, void *data)
--{
-- struct mt7921_dev *dev = file->private;
-- struct mt7921_phy *phy = &dev->phy;
-- struct mt76_mib_stats *mib = &phy->mib;
-- int i;
--
-- mt7921_mutex_acquire(dev);
--
-- mt7921_ampdu_stat_read_phy(phy, file);
--
-- seq_puts(file, "Tx MSDU stat:\n");
-- for (i = 0; i < ARRAY_SIZE(mib->tx_amsdu); i++) {
-- seq_printf(file, "AMSDU pack count of %d MSDU in TXD: %8d ",
-- i + 1, mib->tx_amsdu[i]);
-- if (mib->tx_amsdu_cnt)
-- seq_printf(file, "(%3d%%)\n",
-- mib->tx_amsdu[i] * 100 / mib->tx_amsdu_cnt);
-- else
-- seq_puts(file, "\n");
-- }
--
-- mt7921_mutex_release(dev);
--
-- return 0;
--}
--
--DEFINE_SHOW_ATTRIBUTE(mt7921_tx_stats);
--
--static int
--mt7921_queues_acq(struct seq_file *s, void *data)
--{
-- struct mt7921_dev *dev = dev_get_drvdata(s->private);
-- int i;
--
-- mt7921_mutex_acquire(dev);
--
-- for (i = 0; i < 4; i++) {
-- u32 ctrl, val, qlen = 0;
-- int j;
--
-- val = mt76_rr(dev, MT_PLE_AC_QEMPTY(i));
-- ctrl = BIT(31) | BIT(11) | (i << 24);
--
-- for (j = 0; j < 32; j++) {
-- if (val & BIT(j))
-- continue;
--
-- mt76_wr(dev, MT_PLE_FL_Q0_CTRL, ctrl | j);
-- qlen += mt76_get_field(dev, MT_PLE_FL_Q3_CTRL,
-- GENMASK(11, 0));
-- }
-- seq_printf(s, "AC%d: queued=%d\n", i, qlen);
-- }
--
-- mt7921_mutex_release(dev);
--
-- return 0;
--}
--
--static int
--mt7921_queues_read(struct seq_file *s, void *data)
--{
-- struct mt7921_dev *dev = dev_get_drvdata(s->private);
-- struct {
-- struct mt76_queue *q;
-- char *queue;
-- } queue_map[] = {
-- { dev->mphy.q_tx[MT_TXQ_BE], "WFDMA0" },
-- { dev->mt76.q_mcu[MT_MCUQ_WM], "MCUWM" },
-- { dev->mt76.q_mcu[MT_MCUQ_FWDL], "MCUFWQ" },
-- };
-- int i;
--
-- for (i = 0; i < ARRAY_SIZE(queue_map); i++) {
-- struct mt76_queue *q = queue_map[i].q;
--
-- if (!q)
-- continue;
--
-- seq_printf(s,
-- "%s: queued=%d head=%d tail=%d\n",
-- queue_map[i].queue, q->queued, q->head,
-- q->tail);
-- }
--
-- return 0;
--}
-+DEFINE_SHOW_ATTRIBUTE(mt792x_tx_stats);
-
- static void
- mt7921_seq_puts_array(struct seq_file *file, const char *str,
-@@ -211,13 +90,13 @@ mt7921_seq_puts_array(struct seq_file *file, const char *str,
- static int
- mt7921_txpwr(struct seq_file *s, void *data)
- {
-- struct mt7921_dev *dev = dev_get_drvdata(s->private);
-+ struct mt792x_dev *dev = dev_get_drvdata(s->private);
- struct mt7921_txpwr txpwr;
- int ret;
-
-- mt7921_mutex_acquire(dev);
-+ mt792x_mutex_acquire(dev);
- ret = mt7921_get_txpwr_info(dev, &txpwr);
-- mt7921_mutex_release(dev);
-+ mt792x_mutex_release(dev);
-
- if (ret)
- return ret;
-@@ -263,7 +142,7 @@ mt7921_txpwr(struct seq_file *s, void *data)
- static int
- mt7921_pm_set(void *data, u64 val)
- {
-- struct mt7921_dev *dev = data;
-+ struct mt792x_dev *dev = data;
- struct mt76_connac_pm *pm = &dev->pm;
-
- if (mt76_is_usb(&dev->mt76))
-@@ -296,7 +175,7 @@ out:
- static int
- mt7921_pm_get(void *data, u64 *val)
- {
-- struct mt7921_dev *dev = data;
-+ struct mt792x_dev *dev = data;
-
- *val = dev->pm.enable_user;
-
-@@ -308,7 +187,7 @@ DEFINE_DEBUGFS_ATTRIBUTE(fops_pm, mt7921_pm_get, mt7921_pm_set, "%lld\n");
- static int
- mt7921_deep_sleep_set(void *data, u64 val)
- {
-- struct mt7921_dev *dev = data;
-+ struct mt792x_dev *dev = data;
- struct mt76_connac_pm *pm = &dev->pm;
- bool monitor = !!(dev->mphy.hw->conf.flags & IEEE80211_CONF_MONITOR);
- bool enable = !!val;
-@@ -316,7 +195,7 @@ mt7921_deep_sleep_set(void *data, u64 val)
- if (mt76_is_usb(&dev->mt76))
- return -EOPNOTSUPP;
-
-- mt7921_mutex_acquire(dev);
-+ mt792x_mutex_acquire(dev);
- if (pm->ds_enable_user == enable)
- goto out;
-
-@@ -324,7 +203,7 @@ mt7921_deep_sleep_set(void *data, u64 val)
- pm->ds_enable = enable && !monitor;
- mt76_connac_mcu_set_deep_sleep(&dev->mt76, pm->ds_enable);
- out:
-- mt7921_mutex_release(dev);
-+ mt792x_mutex_release(dev);
-
- return 0;
- }
-@@ -332,7 +211,7 @@ out:
- static int
- mt7921_deep_sleep_get(void *data, u64 *val)
- {
-- struct mt7921_dev *dev = data;
-+ struct mt792x_dev *dev = data;
-
- *val = dev->pm.ds_enable_user;
-
-@@ -342,67 +221,24 @@ mt7921_deep_sleep_get(void *data, u64 *val)
- DEFINE_DEBUGFS_ATTRIBUTE(fops_ds, mt7921_deep_sleep_get,
- mt7921_deep_sleep_set, "%lld\n");
-
--static int
--mt7921_pm_stats(struct seq_file *s, void *data)
--{
-- struct mt7921_dev *dev = dev_get_drvdata(s->private);
-- struct mt76_connac_pm *pm = &dev->pm;
--
-- unsigned long awake_time = pm->stats.awake_time;
-- unsigned long doze_time = pm->stats.doze_time;
--
-- if (!test_bit(MT76_STATE_PM, &dev->mphy.state))
-- awake_time += jiffies - pm->stats.last_wake_event;
-- else
-- doze_time += jiffies - pm->stats.last_doze_event;
--
-- seq_printf(s, "awake time: %14u\ndoze time: %15u\n",
-- jiffies_to_msecs(awake_time),
-- jiffies_to_msecs(doze_time));
--
-- seq_printf(s, "low power wakes: %9d\n", pm->stats.lp_wake);
--
-- return 0;
--}
--
--static int
--mt7921_pm_idle_timeout_set(void *data, u64 val)
--{
-- struct mt7921_dev *dev = data;
--
-- dev->pm.idle_timeout = msecs_to_jiffies(val);
--
-- return 0;
--}
--
--static int
--mt7921_pm_idle_timeout_get(void *data, u64 *val)
--{
-- struct mt7921_dev *dev = data;
--
-- *val = jiffies_to_msecs(dev->pm.idle_timeout);
--
-- return 0;
--}
--
--DEFINE_DEBUGFS_ATTRIBUTE(fops_pm_idle_timeout, mt7921_pm_idle_timeout_get,
-- mt7921_pm_idle_timeout_set, "%lld\n");
-+DEFINE_DEBUGFS_ATTRIBUTE(fops_pm_idle_timeout, mt792x_pm_idle_timeout_get,
-+ mt792x_pm_idle_timeout_set, "%lld\n");
-
- static int mt7921_chip_reset(void *data, u64 val)
- {
-- struct mt7921_dev *dev = data;
-+ struct mt792x_dev *dev = data;
- int ret = 0;
-
- switch (val) {
- case 1:
- /* Reset wifisys directly. */
-- mt7921_reset(&dev->mt76);
-+ mt792x_reset(&dev->mt76);
- break;
- default:
- /* Collect the core dump before reset wifisys. */
-- mt7921_mutex_acquire(dev);
-+ mt792x_mutex_acquire(dev);
- ret = mt76_connac_mcu_chip_config(&dev->mt76);
-- mt7921_mutex_release(dev);
-+ mt792x_mutex_release(dev);
- break;
- }
-
-@@ -414,7 +250,7 @@ DEFINE_DEBUGFS_ATTRIBUTE(fops_reset, NULL, mt7921_chip_reset, "%lld\n");
- static int
- mt7921s_sched_quota_read(struct seq_file *s, void *data)
- {
-- struct mt7921_dev *dev = dev_get_drvdata(s->private);
-+ struct mt792x_dev *dev = dev_get_drvdata(s->private);
- struct mt76_sdio *sdio = &dev->mt76.sdio;
-
- seq_printf(s, "pse_data_quota\t%d\n", sdio->sched.pse_data_quota);
-@@ -425,7 +261,7 @@ mt7921s_sched_quota_read(struct seq_file *s, void *data)
- return 0;
- }
-
--int mt7921_init_debugfs(struct mt7921_dev *dev)
-+int mt7921_init_debugfs(struct mt792x_dev *dev)
- {
- struct dentry *dir;
-
-@@ -435,23 +271,23 @@ int mt7921_init_debugfs(struct mt7921_dev *dev)
-
- if (mt76_is_mmio(&dev->mt76))
- debugfs_create_devm_seqfile(dev->mt76.dev, "xmit-queues",
-- dir, mt7921_queues_read);
-+ dir, mt792x_queues_read);
- else
- debugfs_create_devm_seqfile(dev->mt76.dev, "xmit-queues",
- dir, mt76_queues_read);
-
- debugfs_create_devm_seqfile(dev->mt76.dev, "acq", dir,
-- mt7921_queues_acq);
-+ mt792x_queues_acq);
- debugfs_create_devm_seqfile(dev->mt76.dev, "txpower_sku", dir,
- mt7921_txpwr);
-- debugfs_create_file("tx_stats", 0400, dir, dev, &mt7921_tx_stats_fops);
-+ debugfs_create_file("tx_stats", 0400, dir, dev, &mt792x_tx_stats_fops);
- debugfs_create_file("fw_debug", 0600, dir, dev, &fops_fw_debug);
- debugfs_create_file("runtime-pm", 0600, dir, dev, &fops_pm);
- debugfs_create_file("idle-timeout", 0600, dir, dev,
- &fops_pm_idle_timeout);
- debugfs_create_file("chip_reset", 0600, dir, dev, &fops_reset);
- debugfs_create_devm_seqfile(dev->mt76.dev, "runtime_pm_stats", dir,
-- mt7921_pm_stats);
-+ mt792x_pm_stats);
- debugfs_create_file("deep-sleep", 0600, dir, dev, &fops_ds);
- if (mt76_is_sdio(&dev->mt76))
- debugfs_create_devm_seqfile(dev->mt76.dev, "sched-quota", dir,
-diff --git a/mt7921/init.c b/mt7921/init.c
-index 94b7cdfd..ff63f37f 100644
---- a/mt7921/init.c
-+++ b/mt7921/init.c
-@@ -10,63 +10,19 @@
- #include "../mt76_connac2_mac.h"
- #include "mcu.h"
-
--static const struct ieee80211_iface_limit if_limits[] = {
-- {
-- .max = MT7921_MAX_INTERFACES,
-- .types = BIT(NL80211_IFTYPE_STATION)
-- },
-- {
-- .max = 1,
-- .types = BIT(NL80211_IFTYPE_AP)
-- }
--};
--
--static const struct ieee80211_iface_combination if_comb[] = {
-- {
-- .limits = if_limits,
-- .n_limits = ARRAY_SIZE(if_limits),
-- .max_interfaces = MT7921_MAX_INTERFACES,
-- .num_different_channels = 1,
-- .beacon_int_infra_match = true,
-- },
--};
--
--static const struct ieee80211_iface_limit if_limits_chanctx[] = {
-- {
-- .max = 2,
-- .types = BIT(NL80211_IFTYPE_STATION) |
-- BIT(NL80211_IFTYPE_P2P_CLIENT)
-- },
-- {
-- .max = 1,
-- .types = BIT(NL80211_IFTYPE_AP) |
-- BIT(NL80211_IFTYPE_P2P_GO)
-- }
--};
--
--static const struct ieee80211_iface_combination if_comb_chanctx[] = {
-- {
-- .limits = if_limits_chanctx,
-- .n_limits = ARRAY_SIZE(if_limits_chanctx),
-- .max_interfaces = 2,
-- .num_different_channels = 2,
-- .beacon_int_infra_match = false,
-- }
--};
--
- static ssize_t mt7921_thermal_temp_show(struct device *dev,
- struct device_attribute *attr,
- char *buf)
- {
- switch (to_sensor_dev_attr(attr)->index) {
- case 0: {
-- struct mt7921_phy *phy = dev_get_drvdata(dev);
-- struct mt7921_dev *mdev = phy->dev;
-+ struct mt792x_phy *phy = dev_get_drvdata(dev);
-+ struct mt792x_dev *mdev = phy->dev;
- int temperature;
-
-- mt7921_mutex_acquire(mdev);
-+ mt792x_mutex_acquire(mdev);
- temperature = mt7921_mcu_get_temperature(phy);
-- mt7921_mutex_release(mdev);
-+ mt792x_mutex_release(mdev);
-
- if (temperature < 0)
- return temperature;
-@@ -85,7 +41,7 @@ static struct attribute *mt7921_hwmon_attrs[] = {
- };
- ATTRIBUTE_GROUPS(mt7921_hwmon);
-
--static int mt7921_thermal_init(struct mt7921_phy *phy)
-+static int mt7921_thermal_init(struct mt792x_phy *phy)
- {
- struct wiphy *wiphy = phy->mt76->hw->wiphy;
- struct device *hwmon;
-@@ -110,206 +66,20 @@ mt7921_regd_notifier(struct wiphy *wiphy,
- struct regulatory_request *request)
- {
- struct ieee80211_hw *hw = wiphy_to_ieee80211_hw(wiphy);
-- struct mt7921_dev *dev = mt7921_hw_dev(hw);
-+ struct mt792x_dev *dev = mt792x_hw_dev(hw);
-
- memcpy(dev->mt76.alpha2, request->alpha2, sizeof(dev->mt76.alpha2));
- dev->mt76.region = request->dfs_region;
- dev->country_ie_env = request->country_ie_env;
-
-- mt7921_mutex_acquire(dev);
-+ mt792x_mutex_acquire(dev);
- mt7921_mcu_set_clc(dev, request->alpha2, request->country_ie_env);
- mt76_connac_mcu_set_channel_domain(hw->priv);
- mt7921_set_tx_sar_pwr(hw, NULL);
-- mt7921_mutex_release(dev);
--}
--
--static int
--mt7921_init_wiphy(struct ieee80211_hw *hw)
--{
-- struct mt7921_phy *phy = mt7921_hw_phy(hw);
-- struct mt7921_dev *dev = phy->dev;
-- struct wiphy *wiphy = hw->wiphy;
--
-- hw->queues = 4;
-- hw->max_rx_aggregation_subframes = IEEE80211_MAX_AMPDU_BUF_HE;
-- hw->max_tx_aggregation_subframes = IEEE80211_MAX_AMPDU_BUF_HE;
-- hw->netdev_features = NETIF_F_RXCSUM;
--
-- hw->radiotap_timestamp.units_pos =
-- IEEE80211_RADIOTAP_TIMESTAMP_UNIT_US;
--
-- phy->slottime = 9;
--
-- hw->sta_data_size = sizeof(struct mt7921_sta);
-- hw->vif_data_size = sizeof(struct mt7921_vif);
--
-- if (dev->fw_features & MT7921_FW_CAP_CNM) {
-- wiphy->flags |= WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL;
-- wiphy->iface_combinations = if_comb_chanctx;
-- wiphy->n_iface_combinations = ARRAY_SIZE(if_comb_chanctx);
-- } else {
-- wiphy->flags &= ~WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL;
-- wiphy->iface_combinations = if_comb;
-- wiphy->n_iface_combinations = ARRAY_SIZE(if_comb);
-- }
-- wiphy->flags &= ~(WIPHY_FLAG_IBSS_RSN | WIPHY_FLAG_4ADDR_AP |
-- WIPHY_FLAG_4ADDR_STATION);
-- wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION) |
-- BIT(NL80211_IFTYPE_AP) |
-- BIT(NL80211_IFTYPE_P2P_CLIENT) |
-- BIT(NL80211_IFTYPE_P2P_GO);
-- wiphy->max_remain_on_channel_duration = 5000;
-- wiphy->max_scan_ie_len = MT76_CONNAC_SCAN_IE_LEN;
-- wiphy->max_scan_ssids = 4;
-- wiphy->max_sched_scan_plan_interval =
-- MT76_CONNAC_MAX_TIME_SCHED_SCAN_INTERVAL;
-- wiphy->max_sched_scan_ie_len = IEEE80211_MAX_DATA_LEN;
-- wiphy->max_sched_scan_ssids = MT76_CONNAC_MAX_SCHED_SCAN_SSID;
-- wiphy->max_match_sets = MT76_CONNAC_MAX_SCAN_MATCH;
-- wiphy->max_sched_scan_reqs = 1;
-- wiphy->flags |= WIPHY_FLAG_HAS_CHANNEL_SWITCH |
-- WIPHY_FLAG_SPLIT_SCAN_6GHZ;
-- wiphy->reg_notifier = mt7921_regd_notifier;
--
-- wiphy->features |= NL80211_FEATURE_SCHED_SCAN_RANDOM_MAC_ADDR |
-- NL80211_FEATURE_SCAN_RANDOM_MAC_ADDR;
-- wiphy_ext_feature_set(wiphy, NL80211_EXT_FEATURE_SET_SCAN_DWELL);
-- wiphy_ext_feature_set(wiphy, NL80211_EXT_FEATURE_BEACON_RATE_LEGACY);
-- wiphy_ext_feature_set(wiphy, NL80211_EXT_FEATURE_BEACON_RATE_HT);
-- wiphy_ext_feature_set(wiphy, NL80211_EXT_FEATURE_BEACON_RATE_VHT);
-- wiphy_ext_feature_set(wiphy, NL80211_EXT_FEATURE_BEACON_RATE_HE);
-- wiphy_ext_feature_set(wiphy, NL80211_EXT_FEATURE_ACK_SIGNAL_SUPPORT);
-- wiphy_ext_feature_set(wiphy, NL80211_EXT_FEATURE_CAN_REPLACE_PTK0);
--
-- ieee80211_hw_set(hw, SINGLE_SCAN_ON_ALL_BANDS);
-- ieee80211_hw_set(hw, HAS_RATE_CONTROL);
-- ieee80211_hw_set(hw, SUPPORTS_TX_ENCAP_OFFLOAD);
-- ieee80211_hw_set(hw, SUPPORTS_RX_DECAP_OFFLOAD);
-- ieee80211_hw_set(hw, WANT_MONITOR_VIF);
-- ieee80211_hw_set(hw, SUPPORTS_PS);
-- ieee80211_hw_set(hw, SUPPORTS_DYNAMIC_PS);
-- ieee80211_hw_set(hw, SUPPORTS_VHT_EXT_NSS_BW);
-- ieee80211_hw_set(hw, CONNECTION_MONITOR);
--
-- if (dev->pm.enable)
-- ieee80211_hw_set(hw, CONNECTION_MONITOR);
--
-- hw->max_tx_fragments = 4;
--
-- return 0;
--}
--
--static void
--mt7921_mac_init_band(struct mt7921_dev *dev, u8 band)
--{
-- u32 mask, set;
--
-- mt76_rmw_field(dev, MT_TMAC_CTCR0(band),
-- MT_TMAC_CTCR0_INS_DDLMT_REFTIME, 0x3f);
-- mt76_set(dev, MT_TMAC_CTCR0(band),
-- MT_TMAC_CTCR0_INS_DDLMT_VHT_SMPDU_EN |
-- MT_TMAC_CTCR0_INS_DDLMT_EN);
--
-- mt76_set(dev, MT_WF_RMAC_MIB_TIME0(band), MT_WF_RMAC_MIB_RXTIME_EN);
-- mt76_set(dev, MT_WF_RMAC_MIB_AIRTIME0(band), MT_WF_RMAC_MIB_RXTIME_EN);
--
-- /* enable MIB tx-rx time reporting */
-- mt76_set(dev, MT_MIB_SCR1(band), MT_MIB_TXDUR_EN);
-- mt76_set(dev, MT_MIB_SCR1(band), MT_MIB_RXDUR_EN);
--
-- mt76_rmw_field(dev, MT_DMA_DCR0(band), MT_DMA_DCR0_MAX_RX_LEN, 1536);
-- /* disable rx rate report by default due to hw issues */
-- mt76_clear(dev, MT_DMA_DCR0(band), MT_DMA_DCR0_RXD_G5_EN);
--
-- /* filter out non-resp frames and get instantaneous signal reporting */
-- mask = MT_WTBLOFF_TOP_RSCR_RCPI_MODE | MT_WTBLOFF_TOP_RSCR_RCPI_PARAM;
-- set = FIELD_PREP(MT_WTBLOFF_TOP_RSCR_RCPI_MODE, 0) |
-- FIELD_PREP(MT_WTBLOFF_TOP_RSCR_RCPI_PARAM, 0x3);
-- mt76_rmw(dev, MT_WTBLOFF_TOP_RSCR(band), mask, set);
--}
--
--static u8
--mt7921_get_offload_capability(struct device *dev, const char *fw_wm)
--{
-- const struct mt76_connac2_fw_trailer *hdr;
-- struct mt7921_realease_info *rel_info;
-- const struct firmware *fw;
-- int ret, i, offset = 0;
-- const u8 *data, *end;
-- u8 offload_caps = 0;
--
-- ret = request_firmware(&fw, fw_wm, dev);
-- if (ret)
-- return ret;
--
-- if (!fw || !fw->data || fw->size < sizeof(*hdr)) {
-- dev_err(dev, "Invalid firmware\n");
-- goto out;
-- }
--
-- data = fw->data;
-- hdr = (const void *)(fw->data + fw->size - sizeof(*hdr));
--
-- for (i = 0; i < hdr->n_region; i++) {
-- const struct mt76_connac2_fw_region *region;
--
-- region = (const void *)((const u8 *)hdr -
-- (hdr->n_region - i) * sizeof(*region));
-- offset += le32_to_cpu(region->len);
-- }
--
-- data += offset + 16;
-- rel_info = (struct mt7921_realease_info *)data;
-- data += sizeof(*rel_info);
-- end = data + le16_to_cpu(rel_info->len);
--
-- while (data < end) {
-- rel_info = (struct mt7921_realease_info *)data;
-- data += sizeof(*rel_info);
--
-- if (rel_info->tag == MT7921_FW_TAG_FEATURE) {
-- struct mt7921_fw_features *features;
--
-- features = (struct mt7921_fw_features *)data;
-- offload_caps = features->data;
-- break;
-- }
--
-- data += le16_to_cpu(rel_info->len) + rel_info->pad_len;
-- }
--
--out:
-- release_firmware(fw);
--
-- return offload_caps;
-+ mt792x_mutex_release(dev);
- }
-
--struct ieee80211_ops *
--mt7921_get_mac80211_ops(struct device *dev, void *drv_data, u8 *fw_features)
--{
-- struct ieee80211_ops *ops;
--
-- ops = devm_kmemdup(dev, &mt7921_ops, sizeof(mt7921_ops), GFP_KERNEL);
-- if (!ops)
-- return NULL;
--
-- *fw_features = mt7921_get_offload_capability(dev, drv_data);
-- if (!(*fw_features & MT7921_FW_CAP_CNM)) {
-- ops->remain_on_channel = NULL;
-- ops->cancel_remain_on_channel = NULL;
-- ops->add_chanctx = NULL;
-- ops->remove_chanctx = NULL;
-- ops->change_chanctx = NULL;
-- ops->assign_vif_chanctx = NULL;
-- ops->unassign_vif_chanctx = NULL;
-- ops->mgd_prepare_tx = NULL;
-- ops->mgd_complete_tx = NULL;
-- }
-- return ops;
--}
--EXPORT_SYMBOL_GPL(mt7921_get_mac80211_ops);
--
--int mt7921_mac_init(struct mt7921_dev *dev)
-+int mt7921_mac_init(struct mt792x_dev *dev)
- {
- int i;
-
-@@ -319,17 +89,17 @@ int mt7921_mac_init(struct mt7921_dev *dev)
- /* enable hardware rx header translation */
- mt76_set(dev, MT_MDP_DCR0, MT_MDP_DCR0_RX_HDR_TRANS_EN);
-
-- for (i = 0; i < MT7921_WTBL_SIZE; i++)
-+ for (i = 0; i < MT792x_WTBL_SIZE; i++)
- mt7921_mac_wtbl_update(dev, i,
- MT_WTBL_UPDATE_ADM_COUNT_CLEAR);
- for (i = 0; i < 2; i++)
-- mt7921_mac_init_band(dev, i);
-+ mt792x_mac_init_band(dev, i);
-
- return mt76_connac_mcu_set_rts_thresh(&dev->mt76, 0x92b, 0);
- }
- EXPORT_SYMBOL_GPL(mt7921_mac_init);
-
--static int __mt7921_init_hardware(struct mt7921_dev *dev)
-+static int __mt7921_init_hardware(struct mt792x_dev *dev)
- {
- int ret;
-
-@@ -337,7 +107,7 @@ static int __mt7921_init_hardware(struct mt7921_dev *dev)
- * which should be set before firmware download stage.
- */
- mt76_wr(dev, MT_SWDEF_MODE, MT_SWDEF_NORMAL_MODE);
-- ret = mt7921_mcu_init(dev);
-+ ret = mt792x_mcu_init(dev);
- if (ret)
- goto out;
-
-@@ -352,21 +122,21 @@ out:
- return ret;
- }
-
--static int mt7921_init_hardware(struct mt7921_dev *dev)
-+static int mt7921_init_hardware(struct mt792x_dev *dev)
- {
- int ret, i;
-
- set_bit(MT76_STATE_INITIALIZED, &dev->mphy.state);
-
-- for (i = 0; i < MT7921_MCU_INIT_RETRY_COUNT; i++) {
-+ for (i = 0; i < MT792x_MCU_INIT_RETRY_COUNT; i++) {
- ret = __mt7921_init_hardware(dev);
- if (!ret)
- break;
-
-- mt7921_init_reset(dev);
-+ mt792x_init_reset(dev);
- }
-
-- if (i == MT7921_MCU_INIT_RETRY_COUNT) {
-+ if (i == MT792x_MCU_INIT_RETRY_COUNT) {
- dev_err(dev->mt76.dev, "hardware init failed\n");
- return ret;
- }
-@@ -374,26 +144,9 @@ static int mt7921_init_hardware(struct mt7921_dev *dev)
- return 0;
- }
-
--static int mt7921_init_wcid(struct mt7921_dev *dev)
--{
-- int idx;
--
-- /* Beacon and mgmt frames should occupy wcid 0 */
-- idx = mt76_wcid_alloc(dev->mt76.wcid_mask, MT7921_WTBL_STA - 1);
-- if (idx)
-- return -ENOSPC;
--
-- dev->mt76.global_wcid.idx = idx;
-- dev->mt76.global_wcid.hw_key_idx = -1;
-- dev->mt76.global_wcid.tx_info |= MT_WCID_TX_INFO_SET;
-- rcu_assign_pointer(dev->mt76.wcid[idx], &dev->mt76.global_wcid);
--
-- return 0;
--}
--
- static void mt7921_init_work(struct work_struct *work)
- {
-- struct mt7921_dev *dev = container_of(work, struct mt7921_dev,
-+ struct mt792x_dev *dev = container_of(work, struct mt792x_dev,
- init_work);
- int ret;
-
-@@ -429,7 +182,7 @@ static void mt7921_init_work(struct work_struct *work)
- mt76_connac_mcu_set_deep_sleep(&dev->mt76, dev->pm.ds_enable);
- }
-
--int mt7921_register_device(struct mt7921_dev *dev)
-+int mt7921_register_device(struct mt792x_dev *dev)
- {
- struct ieee80211_hw *hw = mt76_hw(dev);
- int ret;
-@@ -437,17 +190,17 @@ int mt7921_register_device(struct mt7921_dev *dev)
- dev->phy.dev = dev;
- dev->phy.mt76 = &dev->mt76.phy;
- dev->mt76.phy.priv = &dev->phy;
-- dev->mt76.tx_worker.fn = mt7921_tx_worker;
-+ dev->mt76.tx_worker.fn = mt792x_tx_worker;
-
-- INIT_DELAYED_WORK(&dev->pm.ps_work, mt7921_pm_power_save_work);
-- INIT_WORK(&dev->pm.wake_work, mt7921_pm_wake_work);
-+ INIT_DELAYED_WORK(&dev->pm.ps_work, mt792x_pm_power_save_work);
-+ INIT_WORK(&dev->pm.wake_work, mt792x_pm_wake_work);
- spin_lock_init(&dev->pm.wake.lock);
- mutex_init(&dev->pm.mutex);
- init_waitqueue_head(&dev->pm.wait);
- if (mt76_is_sdio(&dev->mt76))
- init_waitqueue_head(&dev->mt76.sdio.wait);
- spin_lock_init(&dev->pm.txq_lock);
-- INIT_DELAYED_WORK(&dev->mphy.mac_work, mt7921_mac_work);
-+ INIT_DELAYED_WORK(&dev->mphy.mac_work, mt792x_mac_work);
- INIT_DELAYED_WORK(&dev->phy.scan_work, mt7921_scan_work);
- INIT_DELAYED_WORK(&dev->coredump.work, mt7921_coredump_work);
- #if IS_ENABLED(CONFIG_IPV6)
-@@ -461,10 +214,10 @@ int mt7921_register_device(struct mt7921_dev *dev)
- INIT_WORK(&dev->init_work, mt7921_init_work);
-
- INIT_WORK(&dev->phy.roc_work, mt7921_roc_work);
-- timer_setup(&dev->phy.roc_timer, mt7921_roc_timer, 0);
-+ timer_setup(&dev->phy.roc_timer, mt792x_roc_timer, 0);
- init_waitqueue_head(&dev->phy.roc_wait);
-
-- dev->pm.idle_timeout = MT7921_PM_TIMEOUT;
-+ dev->pm.idle_timeout = MT792x_PM_TIMEOUT;
- dev->pm.stats.last_wake_event = jiffies;
- dev->pm.stats.last_doze_event = jiffies;
- if (!mt76_is_usb(&dev->mt76)) {
-@@ -477,16 +230,17 @@ int mt7921_register_device(struct mt7921_dev *dev)
- if (!mt76_is_mmio(&dev->mt76))
- hw->extra_tx_headroom += MT_SDIO_TXD_SIZE + MT_SDIO_HDR_SIZE;
-
-- mt7921_init_acpi_sar(dev);
-+ mt792x_init_acpi_sar(dev);
-
-- ret = mt7921_init_wcid(dev);
-+ ret = mt792x_init_wcid(dev);
- if (ret)
- return ret;
-
-- ret = mt7921_init_wiphy(hw);
-+ ret = mt792x_init_wiphy(hw);
- if (ret)
- return ret;
-
-+ hw->wiphy->reg_notifier = mt7921_regd_notifier;
- dev->mphy.sband_2g.sband.ht_cap.cap |=
- IEEE80211_HT_CAP_LDPC_CODING |
- IEEE80211_HT_CAP_MAX_AMSDU;
-diff --git a/mt7921/mac.c b/mt7921/mac.c
-index 368f9271..21f93745 100644
---- a/mt7921/mac.c
-+++ b/mt7921/mac.c
-@@ -15,35 +15,7 @@
-
- #define MT_WTBL_AC0_CTT_OFFSET 20
-
--static u32 mt7921_mac_wtbl_lmac_addr(int idx, u8 offset)
--{
-- return MT_WTBL_LMAC_OFFS(idx, 0) + offset * 4;
--}
--
--static struct mt76_wcid *mt7921_rx_get_wcid(struct mt7921_dev *dev,
-- u16 idx, bool unicast)
--{
-- struct mt7921_sta *sta;
-- struct mt76_wcid *wcid;
--
-- if (idx >= ARRAY_SIZE(dev->mt76.wcid))
-- return NULL;
--
-- wcid = rcu_dereference(dev->mt76.wcid[idx]);
-- if (unicast || !wcid)
-- return wcid;
--
-- if (!wcid->sta)
-- return NULL;
--
-- sta = container_of(wcid, struct mt7921_sta, wcid);
-- if (!sta->vif)
-- return NULL;
--
-- return &sta->vif->sta.wcid;
--}
--
--bool mt7921_mac_wtbl_update(struct mt7921_dev *dev, int idx, u32 mask)
-+bool mt7921_mac_wtbl_update(struct mt792x_dev *dev, int idx, u32 mask)
- {
- mt76_rmw(dev, MT_WTBL_UPDATE, MT_WTBL_UPDATE_WLAN_IDX,
- FIELD_PREP(MT_WTBL_UPDATE_WLAN_IDX, idx) | mask);
-@@ -52,7 +24,12 @@ bool mt7921_mac_wtbl_update(struct mt7921_dev *dev, int idx, u32 mask)
- 0, 5000);
- }
-
--static void mt7921_mac_sta_poll(struct mt7921_dev *dev)
-+static u32 mt7921_mac_wtbl_lmac_addr(int idx, u8 offset)
-+{
-+ return MT_WTBL_LMAC_OFFS(idx, 0) + offset * 4;
-+}
-+
-+static void mt7921_mac_sta_poll(struct mt792x_dev *dev)
- {
- static const u8 ac_to_tid[] = {
- [IEEE80211_AC_BE] = 0,
-@@ -61,7 +38,7 @@ static void mt7921_mac_sta_poll(struct mt7921_dev *dev)
- [IEEE80211_AC_VO] = 6
- };
- struct ieee80211_sta *sta;
-- struct mt7921_sta *msta;
-+ struct mt792x_sta *msta;
- u32 tx_time[IEEE80211_NUM_ACS], rx_time[IEEE80211_NUM_ACS];
- LIST_HEAD(sta_poll_list);
- struct rate_info *rate;
-@@ -84,7 +61,7 @@ static void mt7921_mac_sta_poll(struct mt7921_dev *dev)
- break;
- }
- msta = list_first_entry(&sta_poll_list,
-- struct mt7921_sta, wcid.poll_list);
-+ struct mt792x_sta, wcid.poll_list);
- list_del_init(&msta->wcid.poll_list);
- spin_unlock_bh(&dev->mt76.sta_poll_lock);
-
-@@ -184,54 +161,8 @@ static void mt7921_mac_sta_poll(struct mt7921_dev *dev)
- }
- }
-
--static void
--mt7921_get_status_freq_info(struct mt7921_dev *dev, struct mt76_phy *mphy,
-- struct mt76_rx_status *status, u8 chfreq)
--{
-- if (chfreq > 180) {
-- status->band = NL80211_BAND_6GHZ;
-- chfreq = (chfreq - 181) * 4 + 1;
-- } else if (chfreq > 14) {
-- status->band = NL80211_BAND_5GHZ;
-- } else {
-- status->band = NL80211_BAND_2GHZ;
-- }
-- status->freq = ieee80211_channel_to_frequency(chfreq, status->band);
--}
--
--static void
--mt7921_mac_rssi_iter(void *priv, u8 *mac, struct ieee80211_vif *vif)
--{
-- struct sk_buff *skb = priv;
-- struct mt76_rx_status *status = (struct mt76_rx_status *)skb->cb;
-- struct mt7921_vif *mvif = (struct mt7921_vif *)vif->drv_priv;
-- struct ieee80211_hdr *hdr = mt76_skb_get_hdr(skb);
--
-- if (status->signal > 0)
-- return;
--
-- if (!ether_addr_equal(vif->addr, hdr->addr1))
-- return;
--
-- ewma_rssi_add(&mvif->rssi, -status->signal);
--}
--
--static void
--mt7921_mac_assoc_rssi(struct mt7921_dev *dev, struct sk_buff *skb)
--{
-- struct ieee80211_hdr *hdr = mt76_skb_get_hdr(skb);
--
-- if (!ieee80211_is_assoc_resp(hdr->frame_control) &&
-- !ieee80211_is_auth(hdr->frame_control))
-- return;
--
-- ieee80211_iterate_active_interfaces_atomic(mt76_hw(dev),
-- IEEE80211_IFACE_ITER_RESUME_ALL,
-- mt7921_mac_rssi_iter, skb);
--}
--
- static int
--mt7921_mac_fill_rx(struct mt7921_dev *dev, struct sk_buff *skb)
-+mt7921_mac_fill_rx(struct mt792x_dev *dev, struct sk_buff *skb)
- {
- u32 csum_mask = MT_RXD0_NORMAL_IP_SUM | MT_RXD0_NORMAL_UDP_TCP_SUM;
- struct mt76_rx_status *status = (struct mt76_rx_status *)skb->cb;
-@@ -240,7 +171,7 @@ mt7921_mac_fill_rx(struct mt7921_dev *dev, struct sk_buff *skb)
- u16 hdr_gap;
- __le32 *rxv = NULL, *rxd = (__le32 *)skb->data;
- struct mt76_phy *mphy = &dev->mt76.phy;
-- struct mt7921_phy *phy = &dev->phy;
-+ struct mt792x_phy *phy = &dev->phy;
- struct ieee80211_supported_band *sband;
- u32 csum_status = *(u32 *)skb->cb;
- u32 rxd0 = le32_to_cpu(rxd[0]);
-@@ -248,7 +179,7 @@ mt7921_mac_fill_rx(struct mt7921_dev *dev, struct sk_buff *skb)
- u32 rxd2 = le32_to_cpu(rxd[2]);
- u32 rxd3 = le32_to_cpu(rxd[3]);
- u32 rxd4 = le32_to_cpu(rxd[4]);
-- struct mt7921_sta *msta = NULL;
-+ struct mt792x_sta *msta = NULL;
- u16 seq_ctrl = 0;
- __le16 fc = 0;
- u8 mode = 0;
-@@ -276,10 +207,10 @@ mt7921_mac_fill_rx(struct mt7921_dev *dev, struct sk_buff *skb)
- chfreq = FIELD_GET(MT_RXD3_NORMAL_CH_FREQ, rxd3);
- unicast = FIELD_GET(MT_RXD3_NORMAL_ADDR_TYPE, rxd3) == MT_RXD3_NORMAL_U2M;
- idx = FIELD_GET(MT_RXD1_NORMAL_WLAN_IDX, rxd1);
-- status->wcid = mt7921_rx_get_wcid(dev, idx, unicast);
-+ status->wcid = mt792x_rx_get_wcid(dev, idx, unicast);
-
- if (status->wcid) {
-- msta = container_of(status->wcid, struct mt7921_sta, wcid);
-+ msta = container_of(status->wcid, struct mt792x_sta, wcid);
- spin_lock_bh(&dev->mt76.sta_poll_lock);
- if (list_empty(&msta->wcid.poll_list))
- list_add_tail(&msta->wcid.poll_list,
-@@ -287,7 +218,7 @@ mt7921_mac_fill_rx(struct mt7921_dev *dev, struct sk_buff *skb)
- spin_unlock_bh(&dev->mt76.sta_poll_lock);
- }
-
-- mt7921_get_status_freq_info(dev, mphy, status, chfreq);
-+ mt792x_get_status_freq_info(status, chfreq);
-
- switch (status->band) {
- case NL80211_BAND_5GHZ:
-@@ -496,7 +427,7 @@ mt7921_mac_fill_rx(struct mt7921_dev *dev, struct sk_buff *skb)
- status->flag |= RX_FLAG_8023;
- }
-
-- mt7921_mac_assoc_rssi(dev, skb);
-+ mt792x_mac_assoc_rssi(dev, skb);
-
- if (rxv && mode >= MT_PHY_TYPE_HE_SU && !(status->flag & RX_FLAG_8023))
- mt76_connac2_mac_decode_he_radiotap(&dev->mt76, skb, rxv, mode);
-@@ -511,9 +442,9 @@ mt7921_mac_fill_rx(struct mt7921_dev *dev, struct sk_buff *skb)
- return 0;
- }
-
--void mt7921_mac_add_txs(struct mt7921_dev *dev, void *data)
-+void mt7921_mac_add_txs(struct mt792x_dev *dev, void *data)
- {
-- struct mt7921_sta *msta = NULL;
-+ struct mt792x_sta *msta = NULL;
- struct mt76_wcid *wcid;
- __le32 *txs_data = data;
- u16 wcidx;
-@@ -528,7 +459,7 @@ void mt7921_mac_add_txs(struct mt7921_dev *dev, void *data)
- if (pid < MT_PACKET_ID_FIRST)
- return;
-
-- if (wcidx >= MT7921_WTBL_SIZE)
-+ if (wcidx >= MT792x_WTBL_SIZE)
- return;
-
- rcu_read_lock();
-@@ -537,7 +468,7 @@ void mt7921_mac_add_txs(struct mt7921_dev *dev, void *data)
- if (!wcid)
- goto out;
-
-- msta = container_of(wcid, struct mt7921_sta, wcid);
-+ msta = container_of(wcid, struct mt792x_sta, wcid);
-
- mt76_connac2_mac_add_txs_skb(&dev->mt76, wcid, pid, txs_data);
- if (!wcid->sta)
-@@ -552,7 +483,7 @@ out:
- rcu_read_unlock();
- }
-
--static void mt7921_mac_tx_free(struct mt7921_dev *dev, void *data, int len)
-+static void mt7921_mac_tx_free(struct mt792x_dev *dev, void *data, int len)
- {
- struct mt76_connac_tx_free *free = data;
- __le32 *tx_info = (__le32 *)(data + sizeof(*free));
-@@ -582,7 +513,7 @@ static void mt7921_mac_tx_free(struct mt7921_dev *dev, void *data, int len)
- * 1'b0: msdu_id with the same 'wcid pair' as above.
- */
- if (info & MT_TX_FREE_PAIR) {
-- struct mt7921_sta *msta;
-+ struct mt792x_sta *msta;
- u16 idx;
-
- count++;
-@@ -592,7 +523,7 @@ static void mt7921_mac_tx_free(struct mt7921_dev *dev, void *data, int len)
- if (!sta)
- continue;
-
-- msta = container_of(wcid, struct mt7921_sta, wcid);
-+ msta = container_of(wcid, struct mt792x_sta, wcid);
- spin_lock_bh(&mdev->sta_poll_lock);
- if (list_empty(&msta->wcid.poll_list))
- list_add_tail(&msta->wcid.poll_list,
-@@ -634,7 +565,7 @@ static void mt7921_mac_tx_free(struct mt7921_dev *dev, void *data, int len)
-
- bool mt7921_rx_check(struct mt76_dev *mdev, void *data, int len)
- {
-- struct mt7921_dev *dev = container_of(mdev, struct mt7921_dev, mt76);
-+ struct mt792x_dev *dev = container_of(mdev, struct mt792x_dev, mt76);
- __le32 *rxd = (__le32 *)data;
- __le32 *end = (__le32 *)&rxd[len / 4];
- enum rx_pkt_type type;
-@@ -659,7 +590,7 @@ EXPORT_SYMBOL_GPL(mt7921_rx_check);
- void mt7921_queue_rx_skb(struct mt76_dev *mdev, enum mt76_rxq_id q,
- struct sk_buff *skb, u32 *info)
- {
-- struct mt7921_dev *dev = container_of(mdev, struct mt7921_dev, mt76);
-+ struct mt792x_dev *dev = container_of(mdev, struct mt792x_dev, mt76);
- __le32 *rxd = (__le32 *)skb->data;
- __le32 *end = (__le32 *)&skb->data[skb->len];
- enum rx_pkt_type type;
-@@ -699,128 +630,12 @@ void mt7921_queue_rx_skb(struct mt76_dev *mdev, enum mt76_rxq_id q,
- }
- EXPORT_SYMBOL_GPL(mt7921_queue_rx_skb);
-
--void mt7921_mac_reset_counters(struct mt7921_phy *phy)
--{
-- struct mt7921_dev *dev = phy->dev;
-- int i;
--
-- for (i = 0; i < 4; i++) {
-- mt76_rr(dev, MT_TX_AGG_CNT(0, i));
-- mt76_rr(dev, MT_TX_AGG_CNT2(0, i));
-- }
--
-- dev->mt76.phy.survey_time = ktime_get_boottime();
-- memset(phy->mt76->aggr_stats, 0, sizeof(phy->mt76->aggr_stats));
--
-- /* reset airtime counters */
-- mt76_rr(dev, MT_MIB_SDR9(0));
-- mt76_rr(dev, MT_MIB_SDR36(0));
-- mt76_rr(dev, MT_MIB_SDR37(0));
--
-- mt76_set(dev, MT_WF_RMAC_MIB_TIME0(0), MT_WF_RMAC_MIB_RXTIME_CLR);
-- mt76_set(dev, MT_WF_RMAC_MIB_AIRTIME0(0), MT_WF_RMAC_MIB_RXTIME_CLR);
--}
--
--void mt7921_mac_set_timing(struct mt7921_phy *phy)
--{
-- s16 coverage_class = phy->coverage_class;
-- struct mt7921_dev *dev = phy->dev;
-- u32 val, reg_offset;
-- u32 cck = FIELD_PREP(MT_TIMEOUT_VAL_PLCP, 231) |
-- FIELD_PREP(MT_TIMEOUT_VAL_CCA, 48);
-- u32 ofdm = FIELD_PREP(MT_TIMEOUT_VAL_PLCP, 60) |
-- FIELD_PREP(MT_TIMEOUT_VAL_CCA, 28);
-- bool is_2ghz = phy->mt76->chandef.chan->band == NL80211_BAND_2GHZ;
-- int sifs = is_2ghz ? 10 : 16, offset;
--
-- if (!test_bit(MT76_STATE_RUNNING, &phy->mt76->state))
-- return;
--
-- mt76_set(dev, MT_ARB_SCR(0),
-- MT_ARB_SCR_TX_DISABLE | MT_ARB_SCR_RX_DISABLE);
-- udelay(1);
--
-- offset = 3 * coverage_class;
-- reg_offset = FIELD_PREP(MT_TIMEOUT_VAL_PLCP, offset) |
-- FIELD_PREP(MT_TIMEOUT_VAL_CCA, offset);
--
-- mt76_wr(dev, MT_TMAC_CDTR(0), cck + reg_offset);
-- mt76_wr(dev, MT_TMAC_ODTR(0), ofdm + reg_offset);
-- mt76_wr(dev, MT_TMAC_ICR0(0),
-- FIELD_PREP(MT_IFS_EIFS, 360) |
-- FIELD_PREP(MT_IFS_RIFS, 2) |
-- FIELD_PREP(MT_IFS_SIFS, sifs) |
-- FIELD_PREP(MT_IFS_SLOT, phy->slottime));
--
-- if (phy->slottime < 20 || !is_2ghz)
-- val = MT7921_CFEND_RATE_DEFAULT;
-- else
-- val = MT7921_CFEND_RATE_11B;
--
-- mt76_rmw_field(dev, MT_AGG_ACR0(0), MT_AGG_ACR_CFEND_RATE, val);
-- mt76_clear(dev, MT_ARB_SCR(0),
-- MT_ARB_SCR_TX_DISABLE | MT_ARB_SCR_RX_DISABLE);
--}
--
--static u8
--mt7921_phy_get_nf(struct mt7921_phy *phy, int idx)
--{
-- return 0;
--}
--
--static void
--mt7921_phy_update_channel(struct mt76_phy *mphy, int idx)
--{
-- struct mt7921_dev *dev = container_of(mphy->dev, struct mt7921_dev, mt76);
-- struct mt7921_phy *phy = (struct mt7921_phy *)mphy->priv;
-- struct mt76_channel_state *state;
-- u64 busy_time, tx_time, rx_time, obss_time;
-- int nf;
--
-- busy_time = mt76_get_field(dev, MT_MIB_SDR9(idx),
-- MT_MIB_SDR9_BUSY_MASK);
-- tx_time = mt76_get_field(dev, MT_MIB_SDR36(idx),
-- MT_MIB_SDR36_TXTIME_MASK);
-- rx_time = mt76_get_field(dev, MT_MIB_SDR37(idx),
-- MT_MIB_SDR37_RXTIME_MASK);
-- obss_time = mt76_get_field(dev, MT_WF_RMAC_MIB_AIRTIME14(idx),
-- MT_MIB_OBSSTIME_MASK);
--
-- nf = mt7921_phy_get_nf(phy, idx);
-- if (!phy->noise)
-- phy->noise = nf << 4;
-- else if (nf)
-- phy->noise += nf - (phy->noise >> 4);
--
-- state = mphy->chan_state;
-- state->cc_busy += busy_time;
-- state->cc_tx += tx_time;
-- state->cc_rx += rx_time + obss_time;
-- state->cc_bss_rx += rx_time;
-- state->noise = -(phy->noise >> 4);
--}
--
--void mt7921_update_channel(struct mt76_phy *mphy)
--{
-- struct mt7921_dev *dev = container_of(mphy->dev, struct mt7921_dev, mt76);
--
-- if (mt76_connac_pm_wake(mphy, &dev->pm))
-- return;
--
-- mt7921_phy_update_channel(mphy, 0);
-- /* reset obss airtime */
-- mt76_set(dev, MT_WF_RMAC_MIB_TIME0(0), MT_WF_RMAC_MIB_RXTIME_CLR);
--
-- mt76_connac_power_save_sched(mphy, &dev->pm);
--}
--EXPORT_SYMBOL_GPL(mt7921_update_channel);
--
- static void
- mt7921_vif_connect_iter(void *priv, u8 *mac,
- struct ieee80211_vif *vif)
- {
-- struct mt7921_vif *mvif = (struct mt7921_vif *)vif->drv_priv;
-- struct mt7921_dev *dev = mvif->phy->dev;
-+ struct mt792x_vif *mvif = (struct mt792x_vif *)vif->drv_priv;
-+ struct mt792x_dev *dev = mvif->phy->dev;
- struct ieee80211_hw *hw = mt76_hw(dev);
-
- if (vif->type == NL80211_IFTYPE_STATION)
-@@ -841,7 +656,7 @@ mt7921_vif_connect_iter(void *priv, u8 *mac,
- /* system error recovery */
- void mt7921_mac_reset_work(struct work_struct *work)
- {
-- struct mt7921_dev *dev = container_of(work, struct mt7921_dev,
-+ struct mt792x_dev *dev = container_of(work, struct mt792x_dev,
- reset_work);
- struct ieee80211_hw *hw = mt76_hw(dev);
- struct mt76_connac_pm *pm = &dev->pm;
-@@ -857,7 +672,7 @@ void mt7921_mac_reset_work(struct work_struct *work)
-
- for (i = 0; i < 10; i++) {
- mutex_lock(&dev->mt76.mutex);
-- ret = mt7921_dev_reset(dev);
-+ ret = mt792x_dev_reset(dev);
- mutex_unlock(&dev->mt76.mutex);
-
- if (!ret)
-@@ -884,185 +699,12 @@ void mt7921_mac_reset_work(struct work_struct *work)
- mt76_connac_power_save_sched(&dev->mt76.phy, pm);
- }
-
--void mt7921_reset(struct mt76_dev *mdev)
--{
-- struct mt7921_dev *dev = container_of(mdev, struct mt7921_dev, mt76);
-- struct mt76_connac_pm *pm = &dev->pm;
--
-- if (!dev->hw_init_done)
-- return;
--
-- if (dev->hw_full_reset)
-- return;
--
-- if (pm->suspended)
-- return;
--
-- queue_work(dev->mt76.wq, &dev->reset_work);
--}
--EXPORT_SYMBOL_GPL(mt7921_reset);
--
--void mt7921_mac_update_mib_stats(struct mt7921_phy *phy)
--{
-- struct mt76_mib_stats *mib = &phy->mib;
-- struct mt7921_dev *dev = phy->dev;
-- int i, aggr0 = 0, aggr1;
-- u32 val;
--
-- mib->fcs_err_cnt += mt76_get_field(dev, MT_MIB_SDR3(0),
-- MT_MIB_SDR3_FCS_ERR_MASK);
-- mib->ack_fail_cnt += mt76_get_field(dev, MT_MIB_MB_BSDR3(0),
-- MT_MIB_ACK_FAIL_COUNT_MASK);
-- mib->ba_miss_cnt += mt76_get_field(dev, MT_MIB_MB_BSDR2(0),
-- MT_MIB_BA_FAIL_COUNT_MASK);
-- mib->rts_cnt += mt76_get_field(dev, MT_MIB_MB_BSDR0(0),
-- MT_MIB_RTS_COUNT_MASK);
-- mib->rts_retries_cnt += mt76_get_field(dev, MT_MIB_MB_BSDR1(0),
-- MT_MIB_RTS_FAIL_COUNT_MASK);
--
-- mib->tx_ampdu_cnt += mt76_rr(dev, MT_MIB_SDR12(0));
-- mib->tx_mpdu_attempts_cnt += mt76_rr(dev, MT_MIB_SDR14(0));
-- mib->tx_mpdu_success_cnt += mt76_rr(dev, MT_MIB_SDR15(0));
--
-- val = mt76_rr(dev, MT_MIB_SDR32(0));
-- mib->tx_pkt_ebf_cnt += FIELD_GET(MT_MIB_SDR9_EBF_CNT_MASK, val);
-- mib->tx_pkt_ibf_cnt += FIELD_GET(MT_MIB_SDR9_IBF_CNT_MASK, val);
--
-- val = mt76_rr(dev, MT_ETBF_TX_APP_CNT(0));
-- mib->tx_bf_ibf_ppdu_cnt += FIELD_GET(MT_ETBF_TX_IBF_CNT, val);
-- mib->tx_bf_ebf_ppdu_cnt += FIELD_GET(MT_ETBF_TX_EBF_CNT, val);
--
-- val = mt76_rr(dev, MT_ETBF_RX_FB_CNT(0));
-- mib->tx_bf_rx_fb_all_cnt += FIELD_GET(MT_ETBF_RX_FB_ALL, val);
-- mib->tx_bf_rx_fb_he_cnt += FIELD_GET(MT_ETBF_RX_FB_HE, val);
-- mib->tx_bf_rx_fb_vht_cnt += FIELD_GET(MT_ETBF_RX_FB_VHT, val);
-- mib->tx_bf_rx_fb_ht_cnt += FIELD_GET(MT_ETBF_RX_FB_HT, val);
--
-- mib->rx_mpdu_cnt += mt76_rr(dev, MT_MIB_SDR5(0));
-- mib->rx_ampdu_cnt += mt76_rr(dev, MT_MIB_SDR22(0));
-- mib->rx_ampdu_bytes_cnt += mt76_rr(dev, MT_MIB_SDR23(0));
-- mib->rx_ba_cnt += mt76_rr(dev, MT_MIB_SDR31(0));
--
-- for (i = 0; i < ARRAY_SIZE(mib->tx_amsdu); i++) {
-- val = mt76_rr(dev, MT_PLE_AMSDU_PACK_MSDU_CNT(i));
-- mib->tx_amsdu[i] += val;
-- mib->tx_amsdu_cnt += val;
-- }
--
-- for (i = 0, aggr1 = aggr0 + 8; i < 4; i++) {
-- u32 val2;
--
-- val = mt76_rr(dev, MT_TX_AGG_CNT(0, i));
-- val2 = mt76_rr(dev, MT_TX_AGG_CNT2(0, i));
--
-- phy->mt76->aggr_stats[aggr0++] += val & 0xffff;
-- phy->mt76->aggr_stats[aggr0++] += val >> 16;
-- phy->mt76->aggr_stats[aggr1++] += val2 & 0xffff;
-- phy->mt76->aggr_stats[aggr1++] += val2 >> 16;
-- }
--}
--
--void mt7921_mac_work(struct work_struct *work)
--{
-- struct mt7921_phy *phy;
-- struct mt76_phy *mphy;
--
-- mphy = (struct mt76_phy *)container_of(work, struct mt76_phy,
-- mac_work.work);
-- phy = mphy->priv;
--
-- mt7921_mutex_acquire(phy->dev);
--
-- mt76_update_survey(mphy);
-- if (++mphy->mac_work_count == 2) {
-- mphy->mac_work_count = 0;
--
-- mt7921_mac_update_mib_stats(phy);
-- }
--
-- mt7921_mutex_release(phy->dev);
--
-- mt76_tx_status_check(mphy->dev, false);
-- ieee80211_queue_delayed_work(phy->mt76->hw, &mphy->mac_work,
-- MT7921_WATCHDOG_TIME);
--}
--
--void mt7921_pm_wake_work(struct work_struct *work)
--{
-- struct mt7921_dev *dev;
-- struct mt76_phy *mphy;
--
-- dev = (struct mt7921_dev *)container_of(work, struct mt7921_dev,
-- pm.wake_work);
-- mphy = dev->phy.mt76;
--
-- if (!mt7921_mcu_drv_pmctrl(dev)) {
-- struct mt76_dev *mdev = &dev->mt76;
-- int i;
--
-- if (mt76_is_sdio(mdev)) {
-- mt76_connac_pm_dequeue_skbs(mphy, &dev->pm);
-- mt76_worker_schedule(&mdev->sdio.txrx_worker);
-- } else {
-- local_bh_disable();
-- mt76_for_each_q_rx(mdev, i)
-- napi_schedule(&mdev->napi[i]);
-- local_bh_enable();
-- mt76_connac_pm_dequeue_skbs(mphy, &dev->pm);
-- mt76_connac_tx_cleanup(mdev);
-- }
-- if (test_bit(MT76_STATE_RUNNING, &mphy->state))
-- ieee80211_queue_delayed_work(mphy->hw, &mphy->mac_work,
-- MT7921_WATCHDOG_TIME);
-- }
--
-- ieee80211_wake_queues(mphy->hw);
-- wake_up(&dev->pm.wait);
--}
--
--void mt7921_pm_power_save_work(struct work_struct *work)
--{
-- struct mt7921_dev *dev;
-- unsigned long delta;
-- struct mt76_phy *mphy;
--
-- dev = (struct mt7921_dev *)container_of(work, struct mt7921_dev,
-- pm.ps_work.work);
-- mphy = dev->phy.mt76;
--
-- delta = dev->pm.idle_timeout;
-- if (test_bit(MT76_HW_SCANNING, &mphy->state) ||
-- test_bit(MT76_HW_SCHED_SCANNING, &mphy->state) ||
-- dev->fw_assert)
-- goto out;
--
-- if (mutex_is_locked(&dev->mt76.mutex))
-- /* if mt76 mutex is held we should not put the device
-- * to sleep since we are currently accessing device
-- * register map. We need to wait for the next power_save
-- * trigger.
-- */
-- goto out;
--
-- if (time_is_after_jiffies(dev->pm.last_activity + delta)) {
-- delta = dev->pm.last_activity + delta - jiffies;
-- goto out;
-- }
--
-- if (!mt7921_mcu_fw_pmctrl(dev)) {
-- cancel_delayed_work_sync(&mphy->mac_work);
-- return;
-- }
--out:
-- queue_delayed_work(dev->mt76.wq, &dev->pm.ps_work, delta);
--}
--
- void mt7921_coredump_work(struct work_struct *work)
- {
-- struct mt7921_dev *dev;
-+ struct mt792x_dev *dev;
- char *dump, *data;
-
-- dev = (struct mt7921_dev *)container_of(work, struct mt7921_dev,
-+ dev = (struct mt792x_dev *)container_of(work, struct mt792x_dev,
- coredump.work.work);
-
- if (time_is_after_jiffies(dev->coredump.last_activity +
-@@ -1101,12 +743,12 @@ void mt7921_coredump_work(struct work_struct *work)
- dev_coredumpv(dev->mt76.dev, dump, MT76_CONNAC_COREDUMP_SZ,
- GFP_KERNEL);
-
-- mt7921_reset(&dev->mt76);
-+ mt792x_reset(&dev->mt76);
- }
-
- /* usb_sdio */
- static void
--mt7921_usb_sdio_write_txwi(struct mt7921_dev *dev, struct mt76_wcid *wcid,
-+mt7921_usb_sdio_write_txwi(struct mt792x_dev *dev, struct mt76_wcid *wcid,
- enum mt76_txq_id qid, struct ieee80211_sta *sta,
- struct ieee80211_key_conf *key, int pid,
- struct sk_buff *skb)
-@@ -1123,7 +765,7 @@ int mt7921_usb_sdio_tx_prepare_skb(struct mt76_dev *mdev, void *txwi_ptr,
- struct ieee80211_sta *sta,
- struct mt76_tx_info *tx_info)
- {
-- struct mt7921_dev *dev = container_of(mdev, struct mt7921_dev, mt76);
-+ struct mt792x_dev *dev = container_of(mdev, struct mt792x_dev, mt76);
- struct ieee80211_tx_info *info = IEEE80211_SKB_CB(tx_info->skb);
- struct ieee80211_key_conf *key = info->control.hw_key;
- struct sk_buff *skb = tx_info->skb;
-@@ -1140,7 +782,7 @@ int mt7921_usb_sdio_tx_prepare_skb(struct mt76_dev *mdev, void *txwi_ptr,
- wcid = &dev->mt76.global_wcid;
-
- if (sta) {
-- struct mt7921_sta *msta = (struct mt7921_sta *)sta->drv_priv;
-+ struct mt792x_sta *msta = (struct mt792x_sta *)sta->drv_priv;
-
- if (time_after(jiffies, msta->last_txs + HZ / 4)) {
- info->flags |= IEEE80211_TX_CTL_REQ_TX_STATUS;
-@@ -1189,11 +831,11 @@ EXPORT_SYMBOL_GPL(mt7921_usb_sdio_tx_complete_skb);
-
- bool mt7921_usb_sdio_tx_status_data(struct mt76_dev *mdev, u8 *update)
- {
-- struct mt7921_dev *dev = container_of(mdev, struct mt7921_dev, mt76);
-+ struct mt792x_dev *dev = container_of(mdev, struct mt792x_dev, mt76);
-
-- mt7921_mutex_acquire(dev);
-+ mt792x_mutex_acquire(dev);
- mt7921_mac_sta_poll(dev);
-- mt7921_mutex_release(dev);
-+ mt792x_mutex_release(dev);
-
- return false;
- }
-@@ -1202,8 +844,8 @@ EXPORT_SYMBOL_GPL(mt7921_usb_sdio_tx_status_data);
- #if IS_ENABLED(CONFIG_IPV6)
- void mt7921_set_ipv6_ns_work(struct work_struct *work)
- {
-- struct mt7921_dev *dev = container_of(work, struct mt7921_dev,
-- ipv6_ns_work);
-+ struct mt792x_dev *dev = container_of(work, struct mt792x_dev,
-+ ipv6_ns_work);
- struct sk_buff *skb;
- int ret = 0;
-
-@@ -1213,10 +855,10 @@ void mt7921_set_ipv6_ns_work(struct work_struct *work)
- if (!skb)
- break;
-
-- mt7921_mutex_acquire(dev);
-+ mt792x_mutex_acquire(dev);
- ret = mt76_mcu_skb_send_msg(&dev->mt76, skb,
- MCU_UNI_CMD(OFFLOAD), true);
-- mt7921_mutex_release(dev);
-+ mt792x_mutex_release(dev);
-
- } while (!ret);
-
-diff --git a/mt7921/main.c b/mt7921/main.c
-index 87067ac3..0844d28b 100644
---- a/mt7921/main.c
-+++ b/mt7921/main.c
-@@ -10,7 +10,7 @@
- #include "mcu.h"
-
- static int
--mt7921_init_he_caps(struct mt7921_phy *phy, enum nl80211_band band,
-+mt7921_init_he_caps(struct mt792x_phy *phy, enum nl80211_band band,
- struct ieee80211_sband_iftype_data *data)
- {
- int i, idx = 0;
-@@ -185,7 +185,7 @@ mt7921_init_he_caps(struct mt7921_phy *phy, enum nl80211_band band,
- return idx;
- }
-
--void mt7921_set_stream_he_caps(struct mt7921_phy *phy)
-+void mt7921_set_stream_he_caps(struct mt792x_phy *phy)
- {
- struct ieee80211_sband_iftype_data *data;
- struct ieee80211_supported_band *band;
-@@ -219,7 +219,7 @@ void mt7921_set_stream_he_caps(struct mt7921_phy *phy)
- }
- }
-
--int __mt7921_start(struct mt7921_phy *phy)
-+int __mt7921_start(struct mt792x_phy *phy)
- {
- struct mt76_phy *mphy = phy->mt76;
- int err;
-@@ -240,11 +240,11 @@ int __mt7921_start(struct mt7921_phy *phy)
- if (err)
- return err;
-
-- mt7921_mac_reset_counters(phy);
-+ mt792x_mac_reset_counters(phy);
- set_bit(MT76_STATE_RUNNING, &mphy->state);
-
- ieee80211_queue_delayed_work(mphy->hw, &mphy->mac_work,
-- MT7921_WATCHDOG_TIME);
-+ MT792x_WATCHDOG_TIME);
-
- return 0;
- }
-@@ -252,20 +252,20 @@ EXPORT_SYMBOL_GPL(__mt7921_start);
-
- static int mt7921_start(struct ieee80211_hw *hw)
- {
-- struct mt7921_phy *phy = mt7921_hw_phy(hw);
-+ struct mt792x_phy *phy = mt792x_hw_phy(hw);
- int err;
-
-- mt7921_mutex_acquire(phy->dev);
-+ mt792x_mutex_acquire(phy->dev);
- err = __mt7921_start(phy);
-- mt7921_mutex_release(phy->dev);
-+ mt792x_mutex_release(phy->dev);
-
- return err;
- }
-
- void mt7921_stop(struct ieee80211_hw *hw)
- {
-- struct mt7921_dev *dev = mt7921_hw_dev(hw);
-- struct mt7921_phy *phy = mt7921_hw_phy(hw);
-+ struct mt792x_dev *dev = mt792x_hw_dev(hw);
-+ struct mt792x_phy *phy = mt792x_hw_phy(hw);
-
- cancel_delayed_work_sync(&phy->mt76->mac_work);
-
-@@ -274,26 +274,26 @@ void mt7921_stop(struct ieee80211_hw *hw)
- cancel_work_sync(&dev->reset_work);
- mt76_connac_free_pending_tx_skbs(&dev->pm, NULL);
-
-- mt7921_mutex_acquire(dev);
-+ mt792x_mutex_acquire(dev);
- clear_bit(MT76_STATE_RUNNING, &phy->mt76->state);
- mt76_connac_mcu_set_mac_enable(&dev->mt76, 0, false, false);
-- mt7921_mutex_release(dev);
-+ mt792x_mutex_release(dev);
- }
- EXPORT_SYMBOL_GPL(mt7921_stop);
-
--static int mt7921_add_interface(struct ieee80211_hw *hw,
-- struct ieee80211_vif *vif)
-+static int
-+mt7921_add_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif)
- {
-- struct mt7921_vif *mvif = (struct mt7921_vif *)vif->drv_priv;
-- struct mt7921_dev *dev = mt7921_hw_dev(hw);
-- struct mt7921_phy *phy = mt7921_hw_phy(hw);
-+ struct mt792x_vif *mvif = (struct mt792x_vif *)vif->drv_priv;
-+ struct mt792x_dev *dev = mt792x_hw_dev(hw);
-+ struct mt792x_phy *phy = mt792x_hw_phy(hw);
- struct mt76_txq *mtxq;
- int idx, ret = 0;
-
-- mt7921_mutex_acquire(dev);
-+ mt792x_mutex_acquire(dev);
-
- mvif->mt76.idx = __ffs64(~dev->mt76.vif_mask);
-- if (mvif->mt76.idx >= MT7921_MAX_INTERFACES) {
-+ if (mvif->mt76.idx >= MT792x_MAX_INTERFACES) {
- ret = -ENOSPC;
- goto out;
- }
-@@ -311,7 +311,7 @@ static int mt7921_add_interface(struct ieee80211_hw *hw,
- dev->mt76.vif_mask |= BIT_ULL(mvif->mt76.idx);
- phy->omac_mask |= BIT_ULL(mvif->mt76.omac_idx);
-
-- idx = MT7921_WTBL_RESERVED - mvif->mt76.idx;
-+ idx = MT792x_WTBL_RESERVED - mvif->mt76.idx;
-
- INIT_LIST_HEAD(&mvif->sta.wcid.poll_list);
- mvif->sta.wcid.idx = idx;
-@@ -333,89 +333,55 @@ static int mt7921_add_interface(struct ieee80211_hw *hw,
-
- vif->driver_flags |= IEEE80211_VIF_BEACON_FILTER;
- out:
-- mt7921_mutex_release(dev);
-+ mt792x_mutex_release(dev);
-
- return ret;
- }
-
--static void mt7921_remove_interface(struct ieee80211_hw *hw,
-- struct ieee80211_vif *vif)
--{
-- struct mt7921_vif *mvif = (struct mt7921_vif *)vif->drv_priv;
-- struct mt7921_sta *msta = &mvif->sta;
-- struct mt7921_dev *dev = mt7921_hw_dev(hw);
-- struct mt7921_phy *phy = mt7921_hw_phy(hw);
-- int idx = msta->wcid.idx;
--
-- mt7921_mutex_acquire(dev);
-- mt76_connac_free_pending_tx_skbs(&dev->pm, &msta->wcid);
-- mt76_connac_mcu_uni_add_dev(&dev->mphy, vif, &mvif->sta.wcid, false);
--
-- rcu_assign_pointer(dev->mt76.wcid[idx], NULL);
--
-- dev->mt76.vif_mask &= ~BIT_ULL(mvif->mt76.idx);
-- phy->omac_mask &= ~BIT_ULL(mvif->mt76.omac_idx);
-- mt7921_mutex_release(dev);
--
-- spin_lock_bh(&dev->mt76.sta_poll_lock);
-- if (!list_empty(&msta->wcid.poll_list))
-- list_del_init(&msta->wcid.poll_list);
-- spin_unlock_bh(&dev->mt76.sta_poll_lock);
--
-- mt76_packet_id_flush(&dev->mt76, &msta->wcid);
--}
--
- static void mt7921_roc_iter(void *priv, u8 *mac,
- struct ieee80211_vif *vif)
- {
-- struct mt7921_vif *mvif = (struct mt7921_vif *)vif->drv_priv;
-- struct mt7921_phy *phy = priv;
-+ struct mt792x_vif *mvif = (struct mt792x_vif *)vif->drv_priv;
-+ struct mt792x_phy *phy = priv;
-
- mt7921_mcu_abort_roc(phy, mvif, phy->roc_token_id);
- }
-
- void mt7921_roc_work(struct work_struct *work)
- {
-- struct mt7921_phy *phy;
-+ struct mt792x_phy *phy;
-
-- phy = (struct mt7921_phy *)container_of(work, struct mt7921_phy,
-+ phy = (struct mt792x_phy *)container_of(work, struct mt792x_phy,
- roc_work);
-
- if (!test_and_clear_bit(MT76_STATE_ROC, &phy->mt76->state))
- return;
-
-- mt7921_mutex_acquire(phy->dev);
-+ mt792x_mutex_acquire(phy->dev);
- ieee80211_iterate_active_interfaces(phy->mt76->hw,
- IEEE80211_IFACE_ITER_RESUME_ALL,
- mt7921_roc_iter, phy);
-- mt7921_mutex_release(phy->dev);
-+ mt792x_mutex_release(phy->dev);
- ieee80211_remain_on_channel_expired(phy->mt76->hw);
- }
-
--void mt7921_roc_timer(struct timer_list *timer)
--{
-- struct mt7921_phy *phy = from_timer(phy, timer, roc_timer);
--
-- ieee80211_queue_work(phy->mt76->hw, &phy->roc_work);
--}
--
--static int mt7921_abort_roc(struct mt7921_phy *phy, struct mt7921_vif *vif)
-+static int mt7921_abort_roc(struct mt792x_phy *phy, struct mt792x_vif *vif)
- {
- int err = 0;
-
- del_timer_sync(&phy->roc_timer);
- cancel_work_sync(&phy->roc_work);
-
-- mt7921_mutex_acquire(phy->dev);
-+ mt792x_mutex_acquire(phy->dev);
- if (test_and_clear_bit(MT76_STATE_ROC, &phy->mt76->state))
- err = mt7921_mcu_abort_roc(phy, vif, phy->roc_token_id);
-- mt7921_mutex_release(phy->dev);
-+ mt792x_mutex_release(phy->dev);
-
- return err;
- }
-
--static int mt7921_set_roc(struct mt7921_phy *phy,
-- struct mt7921_vif *vif,
-+static int mt7921_set_roc(struct mt792x_phy *phy,
-+ struct mt792x_vif *vif,
- struct ieee80211_channel *chan,
- int duration,
- enum mt7921_roc_req type)
-@@ -450,13 +416,13 @@ static int mt7921_remain_on_channel(struct ieee80211_hw *hw,
- int duration,
- enum ieee80211_roc_type type)
- {
-- struct mt7921_vif *mvif = (struct mt7921_vif *)vif->drv_priv;
-- struct mt7921_phy *phy = mt7921_hw_phy(hw);
-+ struct mt792x_vif *mvif = (struct mt792x_vif *)vif->drv_priv;
-+ struct mt792x_phy *phy = mt792x_hw_phy(hw);
- int err;
-
-- mt7921_mutex_acquire(phy->dev);
-+ mt792x_mutex_acquire(phy->dev);
- err = mt7921_set_roc(phy, mvif, chan, duration, MT7921_ROC_REQ_ROC);
-- mt7921_mutex_release(phy->dev);
-+ mt792x_mutex_release(phy->dev);
-
- return err;
- }
-@@ -464,20 +430,20 @@ static int mt7921_remain_on_channel(struct ieee80211_hw *hw,
- static int mt7921_cancel_remain_on_channel(struct ieee80211_hw *hw,
- struct ieee80211_vif *vif)
- {
-- struct mt7921_vif *mvif = (struct mt7921_vif *)vif->drv_priv;
-- struct mt7921_phy *phy = mt7921_hw_phy(hw);
-+ struct mt792x_vif *mvif = (struct mt792x_vif *)vif->drv_priv;
-+ struct mt792x_phy *phy = mt792x_hw_phy(hw);
-
- return mt7921_abort_roc(phy, mvif);
- }
-
--static int mt7921_set_channel(struct mt7921_phy *phy)
-+static int mt7921_set_channel(struct mt792x_phy *phy)
- {
-- struct mt7921_dev *dev = phy->dev;
-+ struct mt792x_dev *dev = phy->dev;
- int ret;
-
- cancel_delayed_work_sync(&phy->mt76->mac_work);
-
-- mt7921_mutex_acquire(dev);
-+ mt792x_mutex_acquire(dev);
- set_bit(MT76_RESET, &phy->mt76->state);
-
- mt76_set_channel(phy->mt76);
-@@ -486,18 +452,18 @@ static int mt7921_set_channel(struct mt7921_phy *phy)
- if (ret)
- goto out;
-
-- mt7921_mac_set_timing(phy);
-+ mt792x_mac_set_timeing(phy);
-
-- mt7921_mac_reset_counters(phy);
-+ mt792x_mac_reset_counters(phy);
- phy->noise = 0;
-
- out:
- clear_bit(MT76_RESET, &phy->mt76->state);
-- mt7921_mutex_release(dev);
-+ mt792x_mutex_release(dev);
-
- mt76_worker_schedule(&dev->mt76.tx_worker);
- ieee80211_queue_delayed_work(phy->mt76->hw, &phy->mt76->mac_work,
-- MT7921_WATCHDOG_TIME);
-+ MT792x_WATCHDOG_TIME);
-
- return ret;
- }
-@@ -506,9 +472,9 @@ static int mt7921_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
- struct ieee80211_vif *vif, struct ieee80211_sta *sta,
- struct ieee80211_key_conf *key)
- {
-- struct mt7921_dev *dev = mt7921_hw_dev(hw);
-- struct mt7921_vif *mvif = (struct mt7921_vif *)vif->drv_priv;
-- struct mt7921_sta *msta = sta ? (struct mt7921_sta *)sta->drv_priv :
-+ struct mt792x_dev *dev = mt792x_hw_dev(hw);
-+ struct mt792x_vif *mvif = (struct mt792x_vif *)vif->drv_priv;
-+ struct mt792x_sta *msta = sta ? (struct mt792x_sta *)sta->drv_priv :
- &mvif->sta;
- struct mt76_wcid *wcid = &msta->wcid;
- u8 *wcid_keyidx = &wcid->hw_key_idx;
-@@ -546,7 +512,7 @@ static int mt7921_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
- return -EOPNOTSUPP;
- }
-
-- mt7921_mutex_acquire(dev);
-+ mt792x_mutex_acquire(dev);
-
- if (cmd == SET_KEY) {
- *wcid_keyidx = idx;
-@@ -570,7 +536,7 @@ static int mt7921_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
- key, MCU_UNI_CMD(STA_REC_UPDATE),
- &mvif->wep_sta->wcid, cmd);
- out:
-- mt7921_mutex_release(dev);
-+ mt792x_mutex_release(dev);
-
- return err;
- }
-@@ -578,7 +544,7 @@ out:
- static void
- mt7921_pm_interface_iter(void *priv, u8 *mac, struct ieee80211_vif *vif)
- {
-- struct mt7921_dev *dev = priv;
-+ struct mt792x_dev *dev = priv;
- struct ieee80211_hw *hw = mt76_hw(dev);
- bool pm_enable = dev->pm.enable;
- int err;
-@@ -599,7 +565,7 @@ mt7921_pm_interface_iter(void *priv, u8 *mac, struct ieee80211_vif *vif)
- static void
- mt7921_sniffer_interface_iter(void *priv, u8 *mac, struct ieee80211_vif *vif)
- {
-- struct mt7921_dev *dev = priv;
-+ struct mt792x_dev *dev = priv;
- struct ieee80211_hw *hw = mt76_hw(dev);
- struct mt76_connac_pm *pm = &dev->pm;
- bool monitor = !!(hw->conf.flags & IEEE80211_CONF_MONITOR);
-@@ -614,7 +580,7 @@ mt7921_sniffer_interface_iter(void *priv, u8 *mac, struct ieee80211_vif *vif)
- mt7921_mcu_set_beacon_filter(dev, vif, false);
- }
-
--void mt7921_set_runtime_pm(struct mt7921_dev *dev)
-+void mt7921_set_runtime_pm(struct mt792x_dev *dev)
- {
- struct ieee80211_hw *hw = mt76_hw(dev);
- struct mt76_connac_pm *pm = &dev->pm;
-@@ -630,8 +596,8 @@ void mt7921_set_runtime_pm(struct mt7921_dev *dev)
-
- static int mt7921_config(struct ieee80211_hw *hw, u32 changed)
- {
-- struct mt7921_dev *dev = mt7921_hw_dev(hw);
-- struct mt7921_phy *phy = mt7921_hw_phy(hw);
-+ struct mt792x_dev *dev = mt792x_hw_dev(hw);
-+ struct mt792x_phy *phy = mt792x_hw_phy(hw);
- int ret = 0;
-
- if (changed & IEEE80211_CONF_CHANGE_CHANNEL) {
-@@ -642,7 +608,7 @@ static int mt7921_config(struct ieee80211_hw *hw, u32 changed)
- ieee80211_wake_queues(hw);
- }
-
-- mt7921_mutex_acquire(dev);
-+ mt792x_mutex_acquire(dev);
-
- if (changed & IEEE80211_CONF_CHANGE_POWER) {
- ret = mt7921_set_tx_sar_pwr(hw, NULL);
-@@ -657,25 +623,11 @@ static int mt7921_config(struct ieee80211_hw *hw, u32 changed)
- }
-
- out:
-- mt7921_mutex_release(dev);
-+ mt792x_mutex_release(dev);
-
- return ret;
- }
-
--static int
--mt7921_conf_tx(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
-- unsigned int link_id, u16 queue,
-- const struct ieee80211_tx_queue_params *params)
--{
-- struct mt7921_vif *mvif = (struct mt7921_vif *)vif->drv_priv;
--
-- /* no need to update right away, we'll get BSS_CHANGED_QOS */
-- queue = mt76_connac_lmac_mapping(queue);
-- mvif->queue_params[queue] = *params;
--
-- return 0;
--}
--
- static void mt7921_configure_filter(struct ieee80211_hw *hw,
- unsigned int changed_flags,
- unsigned int *total_flags,
-@@ -686,7 +638,7 @@ static void mt7921_configure_filter(struct ieee80211_hw *hw,
- #define MT7921_FILTER_OTHER_BSS BIT(6)
- #define MT7921_FILTER_ENABLE BIT(31)
-
-- struct mt7921_dev *dev = mt7921_hw_dev(hw);
-+ struct mt792x_dev *dev = mt792x_hw_dev(hw);
- u32 flags = MT7921_FILTER_ENABLE;
-
- #define MT7921_FILTER(_fif, _type) do { \
-@@ -698,9 +650,9 @@ static void mt7921_configure_filter(struct ieee80211_hw *hw,
- MT7921_FILTER(FIF_CONTROL, CONTROL);
- MT7921_FILTER(FIF_OTHER_BSS, OTHER_BSS);
-
-- mt7921_mutex_acquire(dev);
-+ mt792x_mutex_acquire(dev);
- mt7921_mcu_set_rxfilter(dev, flags, 0, 0);
-- mt7921_mutex_release(dev);
-+ mt792x_mutex_release(dev);
-
- *total_flags &= (FIF_OTHER_BSS | FIF_FCSFAIL | FIF_CONTROL);
- }
-@@ -710,17 +662,17 @@ static void mt7921_bss_info_changed(struct ieee80211_hw *hw,
- struct ieee80211_bss_conf *info,
- u64 changed)
- {
-- struct mt7921_phy *phy = mt7921_hw_phy(hw);
-- struct mt7921_dev *dev = mt7921_hw_dev(hw);
-+ struct mt792x_phy *phy = mt792x_hw_phy(hw);
-+ struct mt792x_dev *dev = mt792x_hw_dev(hw);
-
-- mt7921_mutex_acquire(dev);
-+ mt792x_mutex_acquire(dev);
-
- if (changed & BSS_CHANGED_ERP_SLOT) {
- int slottime = info->use_short_slot ? 9 : 20;
-
- if (slottime != phy->slottime) {
- phy->slottime = slottime;
-- mt7921_mac_set_timing(phy);
-+ mt792x_mac_set_timeing(phy);
- }
- }
-
-@@ -743,24 +695,24 @@ static void mt7921_bss_info_changed(struct ieee80211_hw *hw,
- }
-
- if (changed & BSS_CHANGED_ARP_FILTER) {
-- struct mt7921_vif *mvif = (struct mt7921_vif *)vif->drv_priv;
-+ struct mt792x_vif *mvif = (struct mt792x_vif *)vif->drv_priv;
-
- mt76_connac_mcu_update_arp_filter(&dev->mt76, &mvif->mt76,
- info);
- }
-
-- mt7921_mutex_release(dev);
-+ mt792x_mutex_release(dev);
- }
-
- int mt7921_mac_sta_add(struct mt76_dev *mdev, struct ieee80211_vif *vif,
- struct ieee80211_sta *sta)
- {
-- struct mt7921_dev *dev = container_of(mdev, struct mt7921_dev, mt76);
-- struct mt7921_sta *msta = (struct mt7921_sta *)sta->drv_priv;
-- struct mt7921_vif *mvif = (struct mt7921_vif *)vif->drv_priv;
-+ struct mt792x_dev *dev = container_of(mdev, struct mt792x_dev, mt76);
-+ struct mt792x_sta *msta = (struct mt792x_sta *)sta->drv_priv;
-+ struct mt792x_vif *mvif = (struct mt792x_vif *)vif->drv_priv;
- int ret, idx;
-
-- idx = mt76_wcid_alloc(dev->mt76.wcid_mask, MT7921_WTBL_STA - 1);
-+ idx = mt76_wcid_alloc(dev->mt76.wcid_mask, MT792x_WTBL_STA - 1);
- if (idx < 0)
- return -ENOSPC;
-
-@@ -796,11 +748,11 @@ EXPORT_SYMBOL_GPL(mt7921_mac_sta_add);
- void mt7921_mac_sta_assoc(struct mt76_dev *mdev, struct ieee80211_vif *vif,
- struct ieee80211_sta *sta)
- {
-- struct mt7921_dev *dev = container_of(mdev, struct mt7921_dev, mt76);
-- struct mt7921_sta *msta = (struct mt7921_sta *)sta->drv_priv;
-- struct mt7921_vif *mvif = (struct mt7921_vif *)vif->drv_priv;
-+ struct mt792x_dev *dev = container_of(mdev, struct mt792x_dev, mt76);
-+ struct mt792x_sta *msta = (struct mt792x_sta *)sta->drv_priv;
-+ struct mt792x_vif *mvif = (struct mt792x_vif *)vif->drv_priv;
-
-- mt7921_mutex_acquire(dev);
-+ mt792x_mutex_acquire(dev);
-
- if (vif->type == NL80211_IFTYPE_STATION && !sta->tdls)
- mt76_connac_mcu_uni_add_bss(&dev->mphy, vif, &mvif->sta.wcid,
-@@ -814,15 +766,15 @@ void mt7921_mac_sta_assoc(struct mt76_dev *mdev, struct ieee80211_vif *vif,
-
- mt7921_mcu_sta_update(dev, sta, vif, true, MT76_STA_INFO_STATE_ASSOC);
-
-- mt7921_mutex_release(dev);
-+ mt792x_mutex_release(dev);
- }
- EXPORT_SYMBOL_GPL(mt7921_mac_sta_assoc);
-
- void mt7921_mac_sta_remove(struct mt76_dev *mdev, struct ieee80211_vif *vif,
- struct ieee80211_sta *sta)
- {
-- struct mt7921_dev *dev = container_of(mdev, struct mt7921_dev, mt76);
-- struct mt7921_sta *msta = (struct mt7921_sta *)sta->drv_priv;
-+ struct mt792x_dev *dev = container_of(mdev, struct mt792x_dev, mt76);
-+ struct mt792x_sta *msta = (struct mt792x_sta *)sta->drv_priv;
-
- mt76_connac_free_pending_tx_skbs(&dev->pm, &msta->wcid);
- mt76_connac_pm_wake(&dev->mphy, &dev->pm);
-@@ -832,7 +784,7 @@ void mt7921_mac_sta_remove(struct mt76_dev *mdev, struct ieee80211_vif *vif,
- MT_WTBL_UPDATE_ADM_COUNT_CLEAR);
-
- if (vif->type == NL80211_IFTYPE_STATION) {
-- struct mt7921_vif *mvif = (struct mt7921_vif *)vif->drv_priv;
-+ struct mt792x_vif *mvif = (struct mt792x_vif *)vif->drv_priv;
-
- mvif->wep_sta = NULL;
- ewma_rssi_init(&mvif->rssi);
-@@ -851,67 +803,13 @@ void mt7921_mac_sta_remove(struct mt76_dev *mdev, struct ieee80211_vif *vif,
- }
- EXPORT_SYMBOL_GPL(mt7921_mac_sta_remove);
-
--void mt7921_tx_worker(struct mt76_worker *w)
--{
-- struct mt7921_dev *dev = container_of(w, struct mt7921_dev,
-- mt76.tx_worker);
--
-- if (!mt76_connac_pm_ref(&dev->mphy, &dev->pm)) {
-- queue_work(dev->mt76.wq, &dev->pm.wake_work);
-- return;
-- }
--
-- mt76_txq_schedule_all(&dev->mphy);
-- mt76_connac_pm_unref(&dev->mphy, &dev->pm);
--}
--
--static void mt7921_tx(struct ieee80211_hw *hw,
-- struct ieee80211_tx_control *control,
-- struct sk_buff *skb)
--{
-- struct mt7921_dev *dev = mt7921_hw_dev(hw);
-- struct mt76_phy *mphy = hw->priv;
-- struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
-- struct ieee80211_vif *vif = info->control.vif;
-- struct mt76_wcid *wcid = &dev->mt76.global_wcid;
-- int qid;
--
-- if (control->sta) {
-- struct mt7921_sta *sta;
--
-- sta = (struct mt7921_sta *)control->sta->drv_priv;
-- wcid = &sta->wcid;
-- }
--
-- if (vif && !control->sta) {
-- struct mt7921_vif *mvif;
--
-- mvif = (struct mt7921_vif *)vif->drv_priv;
-- wcid = &mvif->sta.wcid;
-- }
--
-- if (mt76_connac_pm_ref(mphy, &dev->pm)) {
-- mt76_tx(mphy, control->sta, wcid, skb);
-- mt76_connac_pm_unref(mphy, &dev->pm);
-- return;
-- }
--
-- qid = skb_get_queue_mapping(skb);
-- if (qid >= MT_TXQ_PSD) {
-- qid = IEEE80211_AC_BE;
-- skb_set_queue_mapping(skb, qid);
-- }
--
-- mt76_connac_pm_queue_skb(hw, &dev->pm, wcid, skb);
--}
--
- static int mt7921_set_rts_threshold(struct ieee80211_hw *hw, u32 val)
- {
-- struct mt7921_dev *dev = mt7921_hw_dev(hw);
-+ struct mt792x_dev *dev = mt792x_hw_dev(hw);
-
-- mt7921_mutex_acquire(dev);
-+ mt792x_mutex_acquire(dev);
- mt76_connac_mcu_set_rts_thresh(&dev->mt76, val, 0);
-- mt7921_mutex_release(dev);
-+ mt792x_mutex_release(dev);
-
- return 0;
- }
-@@ -921,10 +819,10 @@ mt7921_ampdu_action(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
- struct ieee80211_ampdu_params *params)
- {
- enum ieee80211_ampdu_mlme_action action = params->action;
-- struct mt7921_dev *dev = mt7921_hw_dev(hw);
-+ struct mt792x_dev *dev = mt792x_hw_dev(hw);
- struct ieee80211_sta *sta = params->sta;
- struct ieee80211_txq *txq = sta->txq[params->tid];
-- struct mt7921_sta *msta = (struct mt7921_sta *)sta->drv_priv;
-+ struct mt792x_sta *msta = (struct mt792x_sta *)sta->drv_priv;
- u16 tid = params->tid;
- u16 ssn = params->ssn;
- struct mt76_txq *mtxq;
-@@ -935,7 +833,7 @@ mt7921_ampdu_action(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
-
- mtxq = (struct mt76_txq *)txq->drv_priv;
-
-- mt7921_mutex_acquire(dev);
-+ mt792x_mutex_acquire(dev);
- switch (action) {
- case IEEE80211_AMPDU_RX_START:
- mt76_rx_aggr_start(&dev->mt76, &msta->wcid, tid, ssn,
-@@ -968,7 +866,7 @@ mt7921_ampdu_action(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
- ieee80211_stop_tx_ba_cb_irqsafe(vif, sta->addr, tid);
- break;
- }
-- mt7921_mutex_release(dev);
-+ mt792x_mutex_release(dev);
-
- return ret;
- }
-@@ -979,293 +877,22 @@ static int mt7921_sta_state(struct ieee80211_hw *hw,
- enum ieee80211_sta_state old_state,
- enum ieee80211_sta_state new_state)
- {
-- struct mt7921_dev *dev = mt7921_hw_dev(hw);
-+ struct mt792x_dev *dev = mt792x_hw_dev(hw);
-
- if (dev->pm.ds_enable) {
-- mt7921_mutex_acquire(dev);
-+ mt792x_mutex_acquire(dev);
- mt76_connac_sta_state_dp(&dev->mt76, old_state, new_state);
-- mt7921_mutex_release(dev);
-+ mt792x_mutex_release(dev);
- }
-
- return mt76_sta_state(hw, vif, sta, old_state, new_state);
- }
-
--static int
--mt7921_get_stats(struct ieee80211_hw *hw,
-- struct ieee80211_low_level_stats *stats)
--{
-- struct mt7921_phy *phy = mt7921_hw_phy(hw);
-- struct mt76_mib_stats *mib = &phy->mib;
--
-- mt7921_mutex_acquire(phy->dev);
--
-- stats->dot11RTSSuccessCount = mib->rts_cnt;
-- stats->dot11RTSFailureCount = mib->rts_retries_cnt;
-- stats->dot11FCSErrorCount = mib->fcs_err_cnt;
-- stats->dot11ACKFailureCount = mib->ack_fail_cnt;
--
-- mt7921_mutex_release(phy->dev);
--
-- return 0;
--}
--
--static const char mt7921_gstrings_stats[][ETH_GSTRING_LEN] = {
-- /* tx counters */
-- "tx_ampdu_cnt",
-- "tx_mpdu_attempts",
-- "tx_mpdu_success",
-- "tx_pkt_ebf_cnt",
-- "tx_pkt_ibf_cnt",
-- "tx_ampdu_len:0-1",
-- "tx_ampdu_len:2-10",
-- "tx_ampdu_len:11-19",
-- "tx_ampdu_len:20-28",
-- "tx_ampdu_len:29-37",
-- "tx_ampdu_len:38-46",
-- "tx_ampdu_len:47-55",
-- "tx_ampdu_len:56-79",
-- "tx_ampdu_len:80-103",
-- "tx_ampdu_len:104-127",
-- "tx_ampdu_len:128-151",
-- "tx_ampdu_len:152-175",
-- "tx_ampdu_len:176-199",
-- "tx_ampdu_len:200-223",
-- "tx_ampdu_len:224-247",
-- "ba_miss_count",
-- "tx_beamformer_ppdu_iBF",
-- "tx_beamformer_ppdu_eBF",
-- "tx_beamformer_rx_feedback_all",
-- "tx_beamformer_rx_feedback_he",
-- "tx_beamformer_rx_feedback_vht",
-- "tx_beamformer_rx_feedback_ht",
-- "tx_msdu_pack_1",
-- "tx_msdu_pack_2",
-- "tx_msdu_pack_3",
-- "tx_msdu_pack_4",
-- "tx_msdu_pack_5",
-- "tx_msdu_pack_6",
-- "tx_msdu_pack_7",
-- "tx_msdu_pack_8",
-- /* rx counters */
-- "rx_mpdu_cnt",
-- "rx_ampdu_cnt",
-- "rx_ampdu_bytes_cnt",
-- "rx_ba_cnt",
-- /* per vif counters */
-- "v_tx_mode_cck",
-- "v_tx_mode_ofdm",
-- "v_tx_mode_ht",
-- "v_tx_mode_ht_gf",
-- "v_tx_mode_vht",
-- "v_tx_mode_he_su",
-- "v_tx_mode_he_ext_su",
-- "v_tx_mode_he_tb",
-- "v_tx_mode_he_mu",
-- "v_tx_bw_20",
-- "v_tx_bw_40",
-- "v_tx_bw_80",
-- "v_tx_bw_160",
-- "v_tx_mcs_0",
-- "v_tx_mcs_1",
-- "v_tx_mcs_2",
-- "v_tx_mcs_3",
-- "v_tx_mcs_4",
-- "v_tx_mcs_5",
-- "v_tx_mcs_6",
-- "v_tx_mcs_7",
-- "v_tx_mcs_8",
-- "v_tx_mcs_9",
-- "v_tx_mcs_10",
-- "v_tx_mcs_11",
-- "v_tx_nss_1",
-- "v_tx_nss_2",
-- "v_tx_nss_3",
-- "v_tx_nss_4",
--};
--
--static void
--mt7921_get_et_strings(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
-- u32 sset, u8 *data)
--{
-- struct mt7921_dev *dev = mt7921_hw_dev(hw);
--
-- if (sset != ETH_SS_STATS)
-- return;
--
-- memcpy(data, *mt7921_gstrings_stats, sizeof(mt7921_gstrings_stats));
--
-- if (mt76_is_sdio(&dev->mt76))
-- return;
--
-- data += sizeof(mt7921_gstrings_stats);
-- page_pool_ethtool_stats_get_strings(data);
--}
--
--static int
--mt7921_get_et_sset_count(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
-- int sset)
--{
-- struct mt7921_dev *dev = mt7921_hw_dev(hw);
--
-- if (sset != ETH_SS_STATS)
-- return 0;
--
-- if (mt76_is_sdio(&dev->mt76))
-- return ARRAY_SIZE(mt7921_gstrings_stats);
--
-- return ARRAY_SIZE(mt7921_gstrings_stats) +
-- page_pool_ethtool_stats_get_count();
--}
--
--static void
--mt7921_ethtool_worker(void *wi_data, struct ieee80211_sta *sta)
--{
-- struct mt7921_sta *msta = (struct mt7921_sta *)sta->drv_priv;
-- struct mt76_ethtool_worker_info *wi = wi_data;
--
-- if (msta->vif->mt76.idx != wi->idx)
-- return;
--
-- mt76_ethtool_worker(wi, &msta->wcid.stats, false);
--}
--
--static
--void mt7921_get_et_stats(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
-- struct ethtool_stats *stats, u64 *data)
--{
-- struct mt7921_vif *mvif = (struct mt7921_vif *)vif->drv_priv;
-- int stats_size = ARRAY_SIZE(mt7921_gstrings_stats);
-- struct mt7921_phy *phy = mt7921_hw_phy(hw);
-- struct mt7921_dev *dev = phy->dev;
-- struct mt76_mib_stats *mib = &phy->mib;
-- struct mt76_ethtool_worker_info wi = {
-- .data = data,
-- .idx = mvif->mt76.idx,
-- };
-- int i, ei = 0;
--
-- mt7921_mutex_acquire(dev);
--
-- mt7921_mac_update_mib_stats(phy);
--
-- data[ei++] = mib->tx_ampdu_cnt;
-- data[ei++] = mib->tx_mpdu_attempts_cnt;
-- data[ei++] = mib->tx_mpdu_success_cnt;
-- data[ei++] = mib->tx_pkt_ebf_cnt;
-- data[ei++] = mib->tx_pkt_ibf_cnt;
--
-- /* Tx ampdu stat */
-- for (i = 0; i < 15; i++)
-- data[ei++] = phy->mt76->aggr_stats[i];
--
-- data[ei++] = phy->mib.ba_miss_cnt;
--
-- /* Tx Beamformer monitor */
-- data[ei++] = mib->tx_bf_ibf_ppdu_cnt;
-- data[ei++] = mib->tx_bf_ebf_ppdu_cnt;
--
-- /* Tx Beamformer Rx feedback monitor */
-- data[ei++] = mib->tx_bf_rx_fb_all_cnt;
-- data[ei++] = mib->tx_bf_rx_fb_he_cnt;
-- data[ei++] = mib->tx_bf_rx_fb_vht_cnt;
-- data[ei++] = mib->tx_bf_rx_fb_ht_cnt;
--
-- /* Tx amsdu info (pack-count histogram) */
-- for (i = 0; i < ARRAY_SIZE(mib->tx_amsdu); i++)
-- data[ei++] = mib->tx_amsdu[i];
--
-- /* rx counters */
-- data[ei++] = mib->rx_mpdu_cnt;
-- data[ei++] = mib->rx_ampdu_cnt;
-- data[ei++] = mib->rx_ampdu_bytes_cnt;
-- data[ei++] = mib->rx_ba_cnt;
--
-- /* Add values for all stations owned by this vif */
-- wi.initial_stat_idx = ei;
-- ieee80211_iterate_stations_atomic(hw, mt7921_ethtool_worker, &wi);
--
-- mt7921_mutex_release(dev);
--
-- if (!wi.sta_count)
-- return;
--
-- ei += wi.worker_stat_count;
--
-- if (!mt76_is_sdio(&dev->mt76)) {
-- mt76_ethtool_page_pool_stats(&dev->mt76, &data[ei], &ei);
-- stats_size += page_pool_ethtool_stats_get_count();
-- }
--
-- if (ei != stats_size)
-- dev_err(dev->mt76.dev, "ei: %d SSTATS_LEN: %d", ei, stats_size);
--}
--
--static u64
--mt7921_get_tsf(struct ieee80211_hw *hw, struct ieee80211_vif *vif)
--{
-- struct mt7921_vif *mvif = (struct mt7921_vif *)vif->drv_priv;
-- struct mt7921_dev *dev = mt7921_hw_dev(hw);
-- u8 omac_idx = mvif->mt76.omac_idx;
-- union {
-- u64 t64;
-- u32 t32[2];
-- } tsf;
-- u16 n;
--
-- mt7921_mutex_acquire(dev);
--
-- n = omac_idx > HW_BSSID_MAX ? HW_BSSID_0 : omac_idx;
-- /* TSF software read */
-- mt76_set(dev, MT_LPON_TCR(0, n), MT_LPON_TCR_SW_MODE);
-- tsf.t32[0] = mt76_rr(dev, MT_LPON_UTTR0(0));
-- tsf.t32[1] = mt76_rr(dev, MT_LPON_UTTR1(0));
--
-- mt7921_mutex_release(dev);
--
-- return tsf.t64;
--}
--
--static void
--mt7921_set_tsf(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
-- u64 timestamp)
--{
-- struct mt7921_vif *mvif = (struct mt7921_vif *)vif->drv_priv;
-- struct mt7921_dev *dev = mt7921_hw_dev(hw);
-- u8 omac_idx = mvif->mt76.omac_idx;
-- union {
-- u64 t64;
-- u32 t32[2];
-- } tsf = { .t64 = timestamp, };
-- u16 n;
--
-- mt7921_mutex_acquire(dev);
--
-- n = omac_idx > HW_BSSID_MAX ? HW_BSSID_0 : omac_idx;
-- mt76_wr(dev, MT_LPON_UTTR0(0), tsf.t32[0]);
-- mt76_wr(dev, MT_LPON_UTTR1(0), tsf.t32[1]);
-- /* TSF software overwrite */
-- mt76_set(dev, MT_LPON_TCR(0, n), MT_LPON_TCR_SW_WRITE);
--
-- mt7921_mutex_release(dev);
--}
--
--static void
--mt7921_set_coverage_class(struct ieee80211_hw *hw, s16 coverage_class)
--{
-- struct mt7921_phy *phy = mt7921_hw_phy(hw);
-- struct mt7921_dev *dev = phy->dev;
--
-- mt7921_mutex_acquire(dev);
-- phy->coverage_class = max_t(s16, coverage_class, 0);
-- mt7921_mac_set_timing(phy);
-- mt7921_mutex_release(dev);
--}
--
- void mt7921_scan_work(struct work_struct *work)
- {
-- struct mt7921_phy *phy;
-+ struct mt792x_phy *phy;
-
-- phy = (struct mt7921_phy *)container_of(work, struct mt7921_phy,
-+ phy = (struct mt792x_phy *)container_of(work, struct mt792x_phy,
- scan_work.work);
-
- while (true) {
-@@ -1298,13 +925,13 @@ static int
- mt7921_hw_scan(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
- struct ieee80211_scan_request *req)
- {
-- struct mt7921_dev *dev = mt7921_hw_dev(hw);
-+ struct mt792x_dev *dev = mt792x_hw_dev(hw);
- struct mt76_phy *mphy = hw->priv;
- int err;
-
-- mt7921_mutex_acquire(dev);
-+ mt792x_mutex_acquire(dev);
- err = mt76_connac_mcu_hw_scan(mphy, vif, req);
-- mt7921_mutex_release(dev);
-+ mt792x_mutex_release(dev);
-
- return err;
- }
-@@ -1312,12 +939,12 @@ mt7921_hw_scan(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
- static void
- mt7921_cancel_hw_scan(struct ieee80211_hw *hw, struct ieee80211_vif *vif)
- {
-- struct mt7921_dev *dev = mt7921_hw_dev(hw);
-+ struct mt792x_dev *dev = mt792x_hw_dev(hw);
- struct mt76_phy *mphy = hw->priv;
-
-- mt7921_mutex_acquire(dev);
-+ mt792x_mutex_acquire(dev);
- mt76_connac_mcu_cancel_hw_scan(mphy, vif);
-- mt7921_mutex_release(dev);
-+ mt792x_mutex_release(dev);
- }
-
- static int
-@@ -1325,11 +952,11 @@ mt7921_start_sched_scan(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
- struct cfg80211_sched_scan_request *req,
- struct ieee80211_scan_ies *ies)
- {
-- struct mt7921_dev *dev = mt7921_hw_dev(hw);
-+ struct mt792x_dev *dev = mt792x_hw_dev(hw);
- struct mt76_phy *mphy = hw->priv;
- int err;
-
-- mt7921_mutex_acquire(dev);
-+ mt792x_mutex_acquire(dev);
-
- err = mt76_connac_mcu_sched_scan_req(mphy, vif, req);
- if (err < 0)
-@@ -1337,7 +964,7 @@ mt7921_start_sched_scan(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
-
- err = mt76_connac_mcu_sched_scan_enable(mphy, vif, true);
- out:
-- mt7921_mutex_release(dev);
-+ mt792x_mutex_release(dev);
-
- return err;
- }
-@@ -1345,13 +972,13 @@ out:
- static int
- mt7921_stop_sched_scan(struct ieee80211_hw *hw, struct ieee80211_vif *vif)
- {
-- struct mt7921_dev *dev = mt7921_hw_dev(hw);
-+ struct mt792x_dev *dev = mt792x_hw_dev(hw);
- struct mt76_phy *mphy = hw->priv;
- int err;
-
-- mt7921_mutex_acquire(dev);
-+ mt792x_mutex_acquire(dev);
- err = mt76_connac_mcu_sched_scan_enable(mphy, vif, false);
-- mt7921_mutex_release(dev);
-+ mt792x_mutex_release(dev);
-
- return err;
- }
-@@ -1359,8 +986,8 @@ mt7921_stop_sched_scan(struct ieee80211_hw *hw, struct ieee80211_vif *vif)
- static int
- mt7921_set_antenna(struct ieee80211_hw *hw, u32 tx_ant, u32 rx_ant)
- {
-- struct mt7921_dev *dev = mt7921_hw_dev(hw);
-- struct mt7921_phy *phy = mt7921_hw_phy(hw);
-+ struct mt792x_dev *dev = mt792x_hw_dev(hw);
-+ struct mt792x_phy *phy = mt792x_hw_phy(hw);
- int max_nss = hweight8(hw->wiphy->available_antennas_tx);
-
- if (!tx_ant || tx_ant != rx_ant || ffs(tx_ant) > max_nss)
-@@ -1369,7 +996,7 @@ mt7921_set_antenna(struct ieee80211_hw *hw, u32 tx_ant, u32 rx_ant)
- if ((BIT(hweight8(tx_ant)) - 1) != tx_ant)
- return -EINVAL;
-
-- mt7921_mutex_acquire(dev);
-+ mt792x_mutex_acquire(dev);
-
- phy->mt76->antenna_mask = tx_ant;
- phy->mt76->chainmask = tx_ant;
-@@ -1377,54 +1004,17 @@ mt7921_set_antenna(struct ieee80211_hw *hw, u32 tx_ant, u32 rx_ant)
- mt76_set_stream_caps(phy->mt76, true);
- mt7921_set_stream_he_caps(phy);
-
-- mt7921_mutex_release(dev);
-+ mt792x_mutex_release(dev);
-
- return 0;
- }
-
--static void mt7921_sta_statistics(struct ieee80211_hw *hw,
-- struct ieee80211_vif *vif,
-- struct ieee80211_sta *sta,
-- struct station_info *sinfo)
--{
-- struct mt7921_sta *msta = (struct mt7921_sta *)sta->drv_priv;
-- struct rate_info *txrate = &msta->wcid.rate;
--
-- if (!txrate->legacy && !txrate->flags)
-- return;
--
-- if (txrate->legacy) {
-- sinfo->txrate.legacy = txrate->legacy;
-- } else {
-- sinfo->txrate.mcs = txrate->mcs;
-- sinfo->txrate.nss = txrate->nss;
-- sinfo->txrate.bw = txrate->bw;
-- sinfo->txrate.he_gi = txrate->he_gi;
-- sinfo->txrate.he_dcm = txrate->he_dcm;
-- sinfo->txrate.he_ru_alloc = txrate->he_ru_alloc;
-- }
-- sinfo->tx_failed = msta->wcid.stats.tx_failed;
-- sinfo->filled |= BIT_ULL(NL80211_STA_INFO_TX_FAILED);
--
-- sinfo->tx_retries = msta->wcid.stats.tx_retries;
-- sinfo->filled |= BIT_ULL(NL80211_STA_INFO_TX_RETRIES);
--
-- sinfo->txrate.flags = txrate->flags;
-- sinfo->filled |= BIT_ULL(NL80211_STA_INFO_TX_BITRATE);
--
-- sinfo->ack_signal = (s8)msta->ack_signal;
-- sinfo->filled |= BIT_ULL(NL80211_STA_INFO_ACK_SIGNAL);
--
-- sinfo->avg_ack_signal = -(s8)ewma_avg_signal_read(&msta->avg_ack_signal);
-- sinfo->filled |= BIT_ULL(NL80211_STA_INFO_ACK_SIGNAL_AVG);
--}
--
- #ifdef CONFIG_PM
- static int mt7921_suspend(struct ieee80211_hw *hw,
- struct cfg80211_wowlan *wowlan)
- {
-- struct mt7921_dev *dev = mt7921_hw_dev(hw);
-- struct mt7921_phy *phy = mt7921_hw_phy(hw);
-+ struct mt792x_dev *dev = mt792x_hw_dev(hw);
-+ struct mt792x_phy *phy = mt792x_hw_phy(hw);
-
- cancel_delayed_work_sync(&phy->scan_work);
- cancel_delayed_work_sync(&phy->mt76->mac_work);
-@@ -1432,7 +1022,7 @@ static int mt7921_suspend(struct ieee80211_hw *hw,
- cancel_delayed_work_sync(&dev->pm.ps_work);
- mt76_connac_free_pending_tx_skbs(&dev->pm, NULL);
-
-- mt7921_mutex_acquire(dev);
-+ mt792x_mutex_acquire(dev);
-
- clear_bit(MT76_STATE_RUNNING, &phy->mt76->state);
- ieee80211_iterate_active_interfaces(hw,
-@@ -1440,17 +1030,17 @@ static int mt7921_suspend(struct ieee80211_hw *hw,
- mt7921_mcu_set_suspend_iter,
- &dev->mphy);
-
-- mt7921_mutex_release(dev);
-+ mt792x_mutex_release(dev);
-
- return 0;
- }
-
- static int mt7921_resume(struct ieee80211_hw *hw)
- {
-- struct mt7921_dev *dev = mt7921_hw_dev(hw);
-- struct mt7921_phy *phy = mt7921_hw_phy(hw);
-+ struct mt792x_dev *dev = mt792x_hw_dev(hw);
-+ struct mt792x_phy *phy = mt792x_hw_phy(hw);
-
-- mt7921_mutex_acquire(dev);
-+ mt792x_mutex_acquire(dev);
-
- set_bit(MT76_STATE_RUNNING, &phy->mt76->state);
- ieee80211_iterate_active_interfaces(hw,
-@@ -1459,51 +1049,34 @@ static int mt7921_resume(struct ieee80211_hw *hw)
- &dev->mphy);
-
- ieee80211_queue_delayed_work(hw, &phy->mt76->mac_work,
-- MT7921_WATCHDOG_TIME);
-+ MT792x_WATCHDOG_TIME);
-
-- mt7921_mutex_release(dev);
-+ mt792x_mutex_release(dev);
-
- return 0;
- }
-
--static void mt7921_set_wakeup(struct ieee80211_hw *hw, bool enabled)
--{
-- struct mt7921_dev *dev = mt7921_hw_dev(hw);
-- struct mt76_dev *mdev = &dev->mt76;
--
-- device_set_wakeup_enable(mdev->dev, enabled);
--}
--
- static void mt7921_set_rekey_data(struct ieee80211_hw *hw,
- struct ieee80211_vif *vif,
- struct cfg80211_gtk_rekey_data *data)
- {
-- struct mt7921_dev *dev = mt7921_hw_dev(hw);
-+ struct mt792x_dev *dev = mt792x_hw_dev(hw);
-
-- mt7921_mutex_acquire(dev);
-+ mt792x_mutex_acquire(dev);
- mt76_connac_mcu_update_gtk_rekey(hw, vif, data);
-- mt7921_mutex_release(dev);
-+ mt792x_mutex_release(dev);
- }
- #endif /* CONFIG_PM */
-
--static void mt7921_flush(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
-- u32 queues, bool drop)
--{
-- struct mt7921_dev *dev = mt7921_hw_dev(hw);
--
-- wait_event_timeout(dev->mt76.tx_wait, !mt76_has_tx_pending(&dev->mphy),
-- HZ / 2);
--}
--
- static void mt7921_sta_set_decap_offload(struct ieee80211_hw *hw,
- struct ieee80211_vif *vif,
- struct ieee80211_sta *sta,
- bool enabled)
- {
-- struct mt7921_sta *msta = (struct mt7921_sta *)sta->drv_priv;
-- struct mt7921_dev *dev = mt7921_hw_dev(hw);
-+ struct mt792x_sta *msta = (struct mt792x_sta *)sta->drv_priv;
-+ struct mt792x_dev *dev = mt792x_hw_dev(hw);
-
-- mt7921_mutex_acquire(dev);
-+ mt792x_mutex_acquire(dev);
-
- if (enabled)
- set_bit(MT_WCID_FLAG_HDR_TRANS, &msta->wcid.flags);
-@@ -1513,7 +1086,7 @@ static void mt7921_sta_set_decap_offload(struct ieee80211_hw *hw,
- mt76_connac_mcu_sta_update_hdr_trans(&dev->mt76, vif, &msta->wcid,
- MCU_UNI_CMD(STA_REC_UPDATE));
-
-- mt7921_mutex_release(dev);
-+ mt792x_mutex_release(dev);
- }
-
- #if IS_ENABLED(CONFIG_IPV6)
-@@ -1521,8 +1094,8 @@ static void mt7921_ipv6_addr_change(struct ieee80211_hw *hw,
- struct ieee80211_vif *vif,
- struct inet6_dev *idev)
- {
-- struct mt7921_vif *mvif = (struct mt7921_vif *)vif->drv_priv;
-- struct mt7921_dev *dev = mvif->phy->dev;
-+ struct mt792x_vif *mvif = (struct mt792x_vif *)vif->drv_priv;
-+ struct mt792x_dev *dev = mvif->phy->dev;
- struct inet6_ifaddr *ifa;
- struct in6_addr ns_addrs[IEEE80211_BSS_ARP_ADDR_LIST_LEN];
- struct sk_buff *skb;
-@@ -1580,28 +1153,25 @@ int mt7921_set_tx_sar_pwr(struct ieee80211_hw *hw,
- const struct cfg80211_sar_specs *sar)
- {
- struct mt76_phy *mphy = hw->priv;
-- int err;
-
- if (sar) {
-- err = mt76_init_sar_power(hw, sar);
-+ int err = mt76_init_sar_power(hw, sar);
-+
- if (err)
- return err;
- }
-+ mt792x_init_acpi_sar_power(mt792x_hw_phy(hw), !sar);
-
-- mt7921_init_acpi_sar_power(mt7921_hw_phy(hw), !sar);
--
-- err = mt76_connac_mcu_set_rate_txpower(mphy);
--
-- return err;
-+ return mt76_connac_mcu_set_rate_txpower(mphy);
- }
-
- static int mt7921_set_sar_specs(struct ieee80211_hw *hw,
- const struct cfg80211_sar_specs *sar)
- {
-- struct mt7921_dev *dev = mt7921_hw_dev(hw);
-+ struct mt792x_dev *dev = mt792x_hw_dev(hw);
- int err;
-
-- mt7921_mutex_acquire(dev);
-+ mt792x_mutex_acquire(dev);
- err = mt7921_mcu_set_clc(dev, dev->mt76.alpha2,
- dev->country_ie_env);
- if (err < 0)
-@@ -1609,7 +1179,7 @@ static int mt7921_set_sar_specs(struct ieee80211_hw *hw,
-
- err = mt7921_set_tx_sar_pwr(hw, sar);
- out:
-- mt7921_mutex_release(dev);
-+ mt792x_mutex_release(dev);
-
- return err;
- }
-@@ -1619,23 +1189,23 @@ mt7921_channel_switch_beacon(struct ieee80211_hw *hw,
- struct ieee80211_vif *vif,
- struct cfg80211_chan_def *chandef)
- {
-- struct mt7921_dev *dev = mt7921_hw_dev(hw);
-+ struct mt792x_dev *dev = mt792x_hw_dev(hw);
-
-- mt7921_mutex_acquire(dev);
-+ mt792x_mutex_acquire(dev);
- mt7921_mcu_uni_add_beacon_offload(dev, hw, vif, true);
-- mt7921_mutex_release(dev);
-+ mt792x_mutex_release(dev);
- }
-
- static int
- mt7921_start_ap(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
- struct ieee80211_bss_conf *link_conf)
- {
-- struct mt7921_vif *mvif = (struct mt7921_vif *)vif->drv_priv;
-- struct mt7921_phy *phy = mt7921_hw_phy(hw);
-- struct mt7921_dev *dev = mt7921_hw_dev(hw);
-+ struct mt792x_vif *mvif = (struct mt792x_vif *)vif->drv_priv;
-+ struct mt792x_phy *phy = mt792x_hw_phy(hw);
-+ struct mt792x_dev *dev = mt792x_hw_dev(hw);
- int err;
-
-- mt7921_mutex_acquire(dev);
-+ mt792x_mutex_acquire(dev);
-
- err = mt76_connac_mcu_uni_add_bss(phy->mt76, vif, &mvif->sta.wcid,
- true, mvif->ctx);
-@@ -1649,7 +1219,7 @@ mt7921_start_ap(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
- err = mt7921_mcu_sta_update(dev, NULL, vif, true,
- MT76_STA_INFO_STATE_NONE);
- out:
-- mt7921_mutex_release(dev);
-+ mt792x_mutex_release(dev);
-
- return err;
- }
-@@ -1658,12 +1228,12 @@ static void
- mt7921_stop_ap(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
- struct ieee80211_bss_conf *link_conf)
- {
-- struct mt7921_vif *mvif = (struct mt7921_vif *)vif->drv_priv;
-- struct mt7921_phy *phy = mt7921_hw_phy(hw);
-- struct mt7921_dev *dev = mt7921_hw_dev(hw);
-+ struct mt792x_vif *mvif = (struct mt792x_vif *)vif->drv_priv;
-+ struct mt792x_phy *phy = mt792x_hw_phy(hw);
-+ struct mt792x_dev *dev = mt792x_hw_dev(hw);
- int err;
-
-- mt7921_mutex_acquire(dev);
-+ mt792x_mutex_acquire(dev);
-
- err = mt7921_mcu_set_bss_pm(dev, vif, false);
- if (err)
-@@ -1673,7 +1243,7 @@ mt7921_stop_ap(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
- mvif->ctx);
-
- out:
-- mt7921_mutex_release(dev);
-+ mt792x_mutex_release(dev);
- }
-
- static int
-@@ -1692,7 +1262,7 @@ mt7921_remove_chanctx(struct ieee80211_hw *hw,
- static void mt7921_ctx_iter(void *priv, u8 *mac,
- struct ieee80211_vif *vif)
- {
-- struct mt7921_vif *mvif = (struct mt7921_vif *)vif->drv_priv;
-+ struct mt792x_vif *mvif = (struct mt792x_vif *)vif->drv_priv;
- struct ieee80211_chanctx_conf *ctx = priv;
-
- if (ctx != mvif->ctx)
-@@ -1709,77 +1279,47 @@ mt7921_change_chanctx(struct ieee80211_hw *hw,
- struct ieee80211_chanctx_conf *ctx,
- u32 changed)
- {
-- struct mt7921_phy *phy = mt7921_hw_phy(hw);
-+ struct mt792x_phy *phy = mt792x_hw_phy(hw);
-
-- mt7921_mutex_acquire(phy->dev);
-+ mt792x_mutex_acquire(phy->dev);
- ieee80211_iterate_active_interfaces(phy->mt76->hw,
- IEEE80211_IFACE_ITER_ACTIVE,
- mt7921_ctx_iter, ctx);
-- mt7921_mutex_release(phy->dev);
--}
--
--static int
--mt7921_assign_vif_chanctx(struct ieee80211_hw *hw,
-- struct ieee80211_vif *vif,
-- struct ieee80211_bss_conf *link_conf,
-- struct ieee80211_chanctx_conf *ctx)
--{
-- struct mt7921_vif *mvif = (struct mt7921_vif *)vif->drv_priv;
-- struct mt7921_dev *dev = mt7921_hw_dev(hw);
--
-- mutex_lock(&dev->mt76.mutex);
-- mvif->ctx = ctx;
-- mutex_unlock(&dev->mt76.mutex);
--
-- return 0;
--}
--
--static void
--mt7921_unassign_vif_chanctx(struct ieee80211_hw *hw,
-- struct ieee80211_vif *vif,
-- struct ieee80211_bss_conf *link_conf,
-- struct ieee80211_chanctx_conf *ctx)
--{
-- struct mt7921_vif *mvif = (struct mt7921_vif *)vif->drv_priv;
-- struct mt7921_dev *dev = mt7921_hw_dev(hw);
--
-- mutex_lock(&dev->mt76.mutex);
-- mvif->ctx = NULL;
-- mutex_unlock(&dev->mt76.mutex);
-+ mt792x_mutex_release(phy->dev);
- }
-
- static void mt7921_mgd_prepare_tx(struct ieee80211_hw *hw,
- struct ieee80211_vif *vif,
- struct ieee80211_prep_tx_info *info)
- {
-- struct mt7921_vif *mvif = (struct mt7921_vif *)vif->drv_priv;
-- struct mt7921_dev *dev = mt7921_hw_dev(hw);
-+ struct mt792x_vif *mvif = (struct mt792x_vif *)vif->drv_priv;
-+ struct mt792x_dev *dev = mt792x_hw_dev(hw);
- u16 duration = info->duration ? info->duration :
- jiffies_to_msecs(HZ);
-
-- mt7921_mutex_acquire(dev);
-+ mt792x_mutex_acquire(dev);
- mt7921_set_roc(mvif->phy, mvif, mvif->ctx->def.chan, duration,
- MT7921_ROC_REQ_JOIN);
-- mt7921_mutex_release(dev);
-+ mt792x_mutex_release(dev);
- }
-
- static void mt7921_mgd_complete_tx(struct ieee80211_hw *hw,
- struct ieee80211_vif *vif,
- struct ieee80211_prep_tx_info *info)
- {
-- struct mt7921_vif *mvif = (struct mt7921_vif *)vif->drv_priv;
-+ struct mt792x_vif *mvif = (struct mt792x_vif *)vif->drv_priv;
-
- mt7921_abort_roc(mvif->phy, mvif);
- }
-
- const struct ieee80211_ops mt7921_ops = {
-- .tx = mt7921_tx,
-+ .tx = mt792x_tx,
- .start = mt7921_start,
- .stop = mt7921_stop,
- .add_interface = mt7921_add_interface,
-- .remove_interface = mt7921_remove_interface,
-+ .remove_interface = mt792x_remove_interface,
- .config = mt7921_config,
-- .conf_tx = mt7921_conf_tx,
-+ .conf_tx = mt792x_conf_tx,
- .configure_filter = mt7921_configure_filter,
- .bss_info_changed = mt7921_bss_info_changed,
- .start_ap = mt7921_start_ap,
-@@ -1797,19 +1337,19 @@ const struct ieee80211_ops mt7921_ops = {
- .release_buffered_frames = mt76_release_buffered_frames,
- .channel_switch_beacon = mt7921_channel_switch_beacon,
- .get_txpower = mt76_get_txpower,
-- .get_stats = mt7921_get_stats,
-- .get_et_sset_count = mt7921_get_et_sset_count,
-- .get_et_strings = mt7921_get_et_strings,
-- .get_et_stats = mt7921_get_et_stats,
-- .get_tsf = mt7921_get_tsf,
-- .set_tsf = mt7921_set_tsf,
-+ .get_stats = mt792x_get_stats,
-+ .get_et_sset_count = mt792x_get_et_sset_count,
-+ .get_et_strings = mt792x_get_et_strings,
-+ .get_et_stats = mt792x_get_et_stats,
-+ .get_tsf = mt792x_get_tsf,
-+ .set_tsf = mt792x_set_tsf,
- .get_survey = mt76_get_survey,
- .get_antenna = mt76_get_antenna,
- .set_antenna = mt7921_set_antenna,
-- .set_coverage_class = mt7921_set_coverage_class,
-+ .set_coverage_class = mt792x_set_coverage_class,
- .hw_scan = mt7921_hw_scan,
- .cancel_hw_scan = mt7921_cancel_hw_scan,
-- .sta_statistics = mt7921_sta_statistics,
-+ .sta_statistics = mt792x_sta_statistics,
- .sched_scan_start = mt7921_start_sched_scan,
- .sched_scan_stop = mt7921_stop_sched_scan,
- CFG80211_TESTMODE_CMD(mt7921_testmode_cmd)
-@@ -1817,18 +1357,18 @@ const struct ieee80211_ops mt7921_ops = {
- #ifdef CONFIG_PM
- .suspend = mt7921_suspend,
- .resume = mt7921_resume,
-- .set_wakeup = mt7921_set_wakeup,
-+ .set_wakeup = mt792x_set_wakeup,
- .set_rekey_data = mt7921_set_rekey_data,
- #endif /* CONFIG_PM */
-- .flush = mt7921_flush,
-+ .flush = mt792x_flush,
- .set_sar_specs = mt7921_set_sar_specs,
- .remain_on_channel = mt7921_remain_on_channel,
- .cancel_remain_on_channel = mt7921_cancel_remain_on_channel,
- .add_chanctx = mt7921_add_chanctx,
- .remove_chanctx = mt7921_remove_chanctx,
- .change_chanctx = mt7921_change_chanctx,
-- .assign_vif_chanctx = mt7921_assign_vif_chanctx,
-- .unassign_vif_chanctx = mt7921_unassign_vif_chanctx,
-+ .assign_vif_chanctx = mt792x_assign_vif_chanctx,
-+ .unassign_vif_chanctx = mt792x_unassign_vif_chanctx,
- .mgd_prepare_tx = mt7921_mgd_prepare_tx,
- .mgd_complete_tx = mt7921_mgd_complete_tx,
- };
-diff --git a/mt7921/mcu.c b/mt7921/mcu.c
-index a0ad18c7..90c93970 100644
---- a/mt7921/mcu.c
-+++ b/mt7921/mcu.c
-@@ -4,9 +4,9 @@
- #include <linux/fs.h>
- #include <linux/firmware.h>
- #include "mt7921.h"
--#include "mt7921_trace.h"
- #include "mcu.h"
- #include "../mt76_connac2_mac.h"
-+#include "../mt792x_trace.h"
-
- #define MT_STA_BFER BIT(0)
- #define MT_STA_BFEE BIT(1)
-@@ -25,7 +25,7 @@ int mt7921_mcu_parse_response(struct mt76_dev *mdev, int cmd,
- if (!skb) {
- dev_err(mdev->dev, "Message %08x (seq %d) timeout\n",
- cmd, seq);
-- mt7921_reset(mdev);
-+ mt792x_reset(mdev);
-
- return -ETIMEDOUT;
- }
-@@ -69,7 +69,7 @@ int mt7921_mcu_parse_response(struct mt76_dev *mdev, int cmd,
- }
- EXPORT_SYMBOL_GPL(mt7921_mcu_parse_response);
-
--static int mt7921_mcu_read_eeprom(struct mt7921_dev *dev, u32 offset, u8 *val)
-+static int mt7921_mcu_read_eeprom(struct mt792x_dev *dev, u32 offset, u8 *val)
- {
- struct mt7921_mcu_eeprom_info *res, req = {
- .addr = cpu_to_le32(round_down(offset,
-@@ -96,7 +96,7 @@ static int
- mt7921_mcu_set_ipv6_ns_filter(struct mt76_dev *dev,
- struct ieee80211_vif *vif, bool suspend)
- {
-- struct mt7921_vif *mvif = (struct mt7921_vif *)vif->drv_priv;
-+ struct mt792x_vif *mvif = (struct mt792x_vif *)vif->drv_priv;
- struct {
- struct {
- u8 bss_idx;
-@@ -134,7 +134,7 @@ void mt7921_mcu_set_suspend_iter(void *priv, u8 *mac, struct ieee80211_vif *vif)
- #endif /* CONFIG_PM */
-
- static void
--mt7921_mcu_uni_roc_event(struct mt7921_dev *dev, struct sk_buff *skb)
-+mt7921_mcu_uni_roc_event(struct mt792x_dev *dev, struct sk_buff *skb)
- {
- struct mt7921_roc_grant_tlv *grant;
- struct mt76_connac2_mcu_rxd *rxd;
-@@ -157,17 +157,17 @@ mt7921_mcu_uni_roc_event(struct mt7921_dev *dev, struct sk_buff *skb)
- }
-
- static void
--mt7921_mcu_scan_event(struct mt7921_dev *dev, struct sk_buff *skb)
-+mt7921_mcu_scan_event(struct mt792x_dev *dev, struct sk_buff *skb)
- {
- struct mt76_phy *mphy = &dev->mt76.phy;
-- struct mt7921_phy *phy = (struct mt7921_phy *)mphy->priv;
-+ struct mt792x_phy *phy = (struct mt792x_phy *)mphy->priv;
-
- spin_lock_bh(&dev->mt76.lock);
- __skb_queue_tail(&phy->scan_event_list, skb);
- spin_unlock_bh(&dev->mt76.lock);
-
- ieee80211_queue_delayed_work(mphy->hw, &phy->scan_work,
-- MT7921_HW_SCAN_TIMEOUT);
-+ MT792x_HW_SCAN_TIMEOUT);
- }
-
- static void
-@@ -188,7 +188,7 @@ mt7921_mcu_connection_loss_iter(void *priv, u8 *mac,
- }
-
- static void
--mt7921_mcu_connection_loss_event(struct mt7921_dev *dev, struct sk_buff *skb)
-+mt7921_mcu_connection_loss_event(struct mt792x_dev *dev, struct sk_buff *skb)
- {
- struct mt76_connac_beacon_loss_event *event;
- struct mt76_phy *mphy = &dev->mt76.phy;
-@@ -202,7 +202,7 @@ mt7921_mcu_connection_loss_event(struct mt7921_dev *dev, struct sk_buff *skb)
- }
-
- static void
--mt7921_mcu_debug_msg_event(struct mt7921_dev *dev, struct sk_buff *skb)
-+mt7921_mcu_debug_msg_event(struct mt792x_dev *dev, struct sk_buff *skb)
- {
- struct mt7921_debug_msg {
- __le16 id;
-@@ -229,7 +229,7 @@ mt7921_mcu_debug_msg_event(struct mt7921_dev *dev, struct sk_buff *skb)
- }
-
- static void
--mt7921_mcu_low_power_event(struct mt7921_dev *dev, struct sk_buff *skb)
-+mt7921_mcu_low_power_event(struct mt792x_dev *dev, struct sk_buff *skb)
- {
- struct mt7921_mcu_lp_event {
- u8 state;
-@@ -243,7 +243,7 @@ mt7921_mcu_low_power_event(struct mt7921_dev *dev, struct sk_buff *skb)
- }
-
- static void
--mt7921_mcu_tx_done_event(struct mt7921_dev *dev, struct sk_buff *skb)
-+mt7921_mcu_tx_done_event(struct mt792x_dev *dev, struct sk_buff *skb)
- {
- struct mt7921_mcu_tx_done_event *event;
-
-@@ -254,7 +254,7 @@ mt7921_mcu_tx_done_event(struct mt7921_dev *dev, struct sk_buff *skb)
- }
-
- static void
--mt7921_mcu_rx_unsolicited_event(struct mt7921_dev *dev, struct sk_buff *skb)
-+mt7921_mcu_rx_unsolicited_event(struct mt792x_dev *dev, struct sk_buff *skb)
- {
- struct mt76_connac2_mcu_rxd *rxd;
-
-@@ -288,7 +288,7 @@ mt7921_mcu_rx_unsolicited_event(struct mt7921_dev *dev, struct sk_buff *skb)
- }
-
- static void
--mt7921_mcu_uni_rx_unsolicited_event(struct mt7921_dev *dev,
-+mt7921_mcu_uni_rx_unsolicited_event(struct mt792x_dev *dev,
- struct sk_buff *skb)
- {
- struct mt76_connac2_mcu_rxd *rxd;
-@@ -305,7 +305,7 @@ mt7921_mcu_uni_rx_unsolicited_event(struct mt7921_dev *dev,
- dev_kfree_skb(skb);
- }
-
--void mt7921_mcu_rx_event(struct mt7921_dev *dev, struct sk_buff *skb)
-+void mt7921_mcu_rx_event(struct mt792x_dev *dev, struct sk_buff *skb)
- {
- struct mt76_connac2_mcu_rxd *rxd;
-
-@@ -339,11 +339,11 @@ void mt7921_mcu_rx_event(struct mt7921_dev *dev, struct sk_buff *skb)
- }
-
- /** starec & wtbl **/
--int mt7921_mcu_uni_tx_ba(struct mt7921_dev *dev,
-+int mt7921_mcu_uni_tx_ba(struct mt792x_dev *dev,
- struct ieee80211_ampdu_params *params,
- bool enable)
- {
-- struct mt7921_sta *msta = (struct mt7921_sta *)params->sta->drv_priv;
-+ struct mt792x_sta *msta = (struct mt792x_sta *)params->sta->drv_priv;
-
- if (enable && !params->amsdu)
- msta->wcid.amsdu = false;
-@@ -353,48 +353,24 @@ int mt7921_mcu_uni_tx_ba(struct mt7921_dev *dev,
- enable, true);
- }
-
--int mt7921_mcu_uni_rx_ba(struct mt7921_dev *dev,
-+int mt7921_mcu_uni_rx_ba(struct mt792x_dev *dev,
- struct ieee80211_ampdu_params *params,
- bool enable)
- {
-- struct mt7921_sta *msta = (struct mt7921_sta *)params->sta->drv_priv;
-+ struct mt792x_sta *msta = (struct mt792x_sta *)params->sta->drv_priv;
-
- return mt76_connac_mcu_sta_ba(&dev->mt76, &msta->vif->mt76, params,
- MCU_UNI_CMD(STA_REC_UPDATE),
- enable, false);
- }
-
--static char *mt7921_patch_name(struct mt7921_dev *dev)
--{
-- char *ret;
--
-- if (is_mt7922(&dev->mt76))
-- ret = MT7922_ROM_PATCH;
-- else
-- ret = MT7921_ROM_PATCH;
--
-- return ret;
--}
--
--static char *mt7921_ram_name(struct mt7921_dev *dev)
--{
-- char *ret;
--
-- if (is_mt7922(&dev->mt76))
-- ret = MT7922_FIRMWARE_WM;
-- else
-- ret = MT7921_FIRMWARE_WM;
--
-- return ret;
--}
--
--static int mt7921_load_clc(struct mt7921_dev *dev, const char *fw_name)
-+static int mt7921_load_clc(struct mt792x_dev *dev, const char *fw_name)
- {
- const struct mt76_connac2_fw_trailer *hdr;
- const struct mt76_connac2_fw_region *region;
- const struct mt7921_clc *clc;
- struct mt76_dev *mdev = &dev->mt76;
-- struct mt7921_phy *phy = &dev->phy;
-+ struct mt792x_phy *phy = &dev->phy;
- const struct firmware *fw;
- int ret, i, len, offset = 0;
- u8 *clc_base = NULL, hw_encap = 0;
-@@ -472,42 +448,7 @@ out:
- return ret;
- }
-
--static int mt7921_load_firmware(struct mt7921_dev *dev)
--{
-- int ret;
--
-- ret = mt76_connac2_load_patch(&dev->mt76, mt7921_patch_name(dev));
-- if (ret)
-- return ret;
--
-- if (mt76_is_sdio(&dev->mt76)) {
-- /* activate again */
-- ret = __mt7921_mcu_fw_pmctrl(dev);
-- if (!ret)
-- ret = __mt7921_mcu_drv_pmctrl(dev);
-- }
--
-- ret = mt76_connac2_load_ram(&dev->mt76, mt7921_ram_name(dev), NULL);
-- if (ret)
-- return ret;
--
-- if (!mt76_poll_msec(dev, MT_CONN_ON_MISC, MT_TOP_MISC2_FW_N9_RDY,
-- MT_TOP_MISC2_FW_N9_RDY, 1500)) {
-- dev_err(dev->mt76.dev, "Timeout for initializing firmware\n");
--
-- return -EIO;
-- }
--
--#ifdef CONFIG_PM
-- dev->mt76.hw->wiphy->wowlan = &mt76_connac_wowlan_support;
--#endif /* CONFIG_PM */
--
-- dev_dbg(dev->mt76.dev, "Firmware init done\n");
--
-- return 0;
--}
--
--int mt7921_mcu_fw_log_2_host(struct mt7921_dev *dev, u8 ctrl)
-+int mt7921_mcu_fw_log_2_host(struct mt792x_dev *dev, u8 ctrl)
- {
- struct {
- u8 ctrl_val;
-@@ -520,11 +461,11 @@ int mt7921_mcu_fw_log_2_host(struct mt7921_dev *dev, u8 ctrl)
- &data, sizeof(data), false);
- }
-
--int mt7921_run_firmware(struct mt7921_dev *dev)
-+int mt7921_run_firmware(struct mt792x_dev *dev)
- {
- int err;
-
-- err = mt7921_load_firmware(dev);
-+ err = mt792x_load_firmware(dev);
- if (err)
- return err;
-
-@@ -533,7 +474,7 @@ int mt7921_run_firmware(struct mt7921_dev *dev)
- return err;
-
- set_bit(MT76_STATE_MCU_RUNNING, &dev->mphy.state);
-- err = mt7921_load_clc(dev, mt7921_ram_name(dev));
-+ err = mt7921_load_clc(dev, mt792x_ram_name(dev));
- if (err)
- return err;
-
-@@ -541,9 +482,9 @@ int mt7921_run_firmware(struct mt7921_dev *dev)
- }
- EXPORT_SYMBOL_GPL(mt7921_run_firmware);
-
--int mt7921_mcu_set_tx(struct mt7921_dev *dev, struct ieee80211_vif *vif)
-+int mt7921_mcu_set_tx(struct mt792x_dev *dev, struct ieee80211_vif *vif)
- {
-- struct mt7921_vif *mvif = (struct mt7921_vif *)vif->drv_priv;
-+ struct mt792x_vif *mvif = (struct mt792x_vif *)vif->drv_priv;
- struct edca {
- __le16 cw_min;
- __le16 cw_max;
-@@ -635,12 +576,12 @@ int mt7921_mcu_set_tx(struct mt7921_dev *dev, struct ieee80211_vif *vif)
- &req_mu, sizeof(req_mu), false);
- }
-
--int mt7921_mcu_set_roc(struct mt7921_phy *phy, struct mt7921_vif *vif,
-+int mt7921_mcu_set_roc(struct mt792x_phy *phy, struct mt792x_vif *vif,
- struct ieee80211_channel *chan, int duration,
- enum mt7921_roc_req type, u8 token_id)
- {
- int center_ch = ieee80211_frequency_to_channel(chan->center_freq);
-- struct mt7921_dev *dev = phy->dev;
-+ struct mt792x_dev *dev = phy->dev;
- struct {
- struct {
- u8 rsv[4];
-@@ -702,10 +643,10 @@ int mt7921_mcu_set_roc(struct mt7921_phy *phy, struct mt7921_vif *vif,
- &req, sizeof(req), false);
- }
-
--int mt7921_mcu_abort_roc(struct mt7921_phy *phy, struct mt7921_vif *vif,
-+int mt7921_mcu_abort_roc(struct mt792x_phy *phy, struct mt792x_vif *vif,
- u8 token_id)
- {
-- struct mt7921_dev *dev = phy->dev;
-+ struct mt792x_dev *dev = phy->dev;
- struct {
- struct {
- u8 rsv[4];
-@@ -732,9 +673,9 @@ int mt7921_mcu_abort_roc(struct mt7921_phy *phy, struct mt7921_vif *vif,
- &req, sizeof(req), false);
- }
-
--int mt7921_mcu_set_chan_info(struct mt7921_phy *phy, int cmd)
-+int mt7921_mcu_set_chan_info(struct mt792x_phy *phy, int cmd)
- {
-- struct mt7921_dev *dev = phy->dev;
-+ struct mt792x_dev *dev = phy->dev;
- struct cfg80211_chan_def *chandef = &phy->mt76->chandef;
- int freq1 = chandef->center_freq1;
- struct {
-@@ -791,7 +732,7 @@ int mt7921_mcu_set_chan_info(struct mt7921_phy *phy, int cmd)
- return mt76_mcu_send_msg(&dev->mt76, cmd, &req, sizeof(req), true);
- }
-
--int mt7921_mcu_set_eeprom(struct mt7921_dev *dev)
-+int mt7921_mcu_set_eeprom(struct mt792x_dev *dev)
- {
- struct req_hdr {
- u8 buffer_mode;
-@@ -807,9 +748,9 @@ int mt7921_mcu_set_eeprom(struct mt7921_dev *dev)
- }
- EXPORT_SYMBOL_GPL(mt7921_mcu_set_eeprom);
-
--int mt7921_mcu_uni_bss_ps(struct mt7921_dev *dev, struct ieee80211_vif *vif)
-+int mt7921_mcu_uni_bss_ps(struct mt792x_dev *dev, struct ieee80211_vif *vif)
- {
-- struct mt7921_vif *mvif = (struct mt7921_vif *)vif->drv_priv;
-+ struct mt792x_vif *mvif = (struct mt792x_vif *)vif->drv_priv;
- struct {
- struct {
- u8 bss_idx;
-@@ -845,10 +786,10 @@ int mt7921_mcu_uni_bss_ps(struct mt7921_dev *dev, struct ieee80211_vif *vif)
- }
-
- static int
--mt7921_mcu_uni_bss_bcnft(struct mt7921_dev *dev, struct ieee80211_vif *vif,
-+mt7921_mcu_uni_bss_bcnft(struct mt792x_dev *dev, struct ieee80211_vif *vif,
- bool enable)
- {
-- struct mt7921_vif *mvif = (struct mt7921_vif *)vif->drv_priv;
-+ struct mt792x_vif *mvif = (struct mt792x_vif *)vif->drv_priv;
- struct {
- struct {
- u8 bss_idx;
-@@ -881,10 +822,10 @@ mt7921_mcu_uni_bss_bcnft(struct mt7921_dev *dev, struct ieee80211_vif *vif,
- }
-
- int
--mt7921_mcu_set_bss_pm(struct mt7921_dev *dev, struct ieee80211_vif *vif,
-+mt7921_mcu_set_bss_pm(struct mt792x_dev *dev, struct ieee80211_vif *vif,
- bool enable)
- {
-- struct mt7921_vif *mvif = (struct mt7921_vif *)vif->drv_priv;
-+ struct mt792x_vif *mvif = (struct mt792x_vif *)vif->drv_priv;
- struct {
- u8 bss_idx;
- u8 dtim_period;
-@@ -918,11 +859,11 @@ mt7921_mcu_set_bss_pm(struct mt7921_dev *dev, struct ieee80211_vif *vif,
- &req, sizeof(req), false);
- }
-
--int mt7921_mcu_sta_update(struct mt7921_dev *dev, struct ieee80211_sta *sta,
-+int mt7921_mcu_sta_update(struct mt792x_dev *dev, struct ieee80211_sta *sta,
- struct ieee80211_vif *vif, bool enable,
- enum mt76_sta_info_state state)
- {
-- struct mt7921_vif *mvif = (struct mt7921_vif *)vif->drv_priv;
-+ struct mt792x_vif *mvif = (struct mt792x_vif *)vif->drv_priv;
- int rssi = -ewma_rssi_read(&mvif->rssi);
- struct mt76_sta_cmd_info info = {
- .sta = sta,
-@@ -933,60 +874,16 @@ int mt7921_mcu_sta_update(struct mt7921_dev *dev, struct ieee80211_sta *sta,
- .offload_fw = true,
- .rcpi = to_rcpi(rssi),
- };
-- struct mt7921_sta *msta;
-+ struct mt792x_sta *msta;
-
-- msta = sta ? (struct mt7921_sta *)sta->drv_priv : NULL;
-+ msta = sta ? (struct mt792x_sta *)sta->drv_priv : NULL;
- info.wcid = msta ? &msta->wcid : &mvif->sta.wcid;
- info.newly = msta ? state != MT76_STA_INFO_STATE_ASSOC : true;
-
- return mt76_connac_mcu_sta_cmd(&dev->mphy, &info);
- }
-
--int mt7921_mcu_drv_pmctrl(struct mt7921_dev *dev)
--{
-- struct mt76_phy *mphy = &dev->mt76.phy;
-- struct mt76_connac_pm *pm = &dev->pm;
-- int err = 0;
--
-- mutex_lock(&pm->mutex);
--
-- if (!test_bit(MT76_STATE_PM, &mphy->state))
-- goto out;
--
-- err = __mt7921_mcu_drv_pmctrl(dev);
--out:
-- mutex_unlock(&pm->mutex);
--
-- if (err)
-- mt7921_reset(&dev->mt76);
--
-- return err;
--}
--EXPORT_SYMBOL_GPL(mt7921_mcu_drv_pmctrl);
--
--int mt7921_mcu_fw_pmctrl(struct mt7921_dev *dev)
--{
-- struct mt76_phy *mphy = &dev->mt76.phy;
-- struct mt76_connac_pm *pm = &dev->pm;
-- int err = 0;
--
-- mutex_lock(&pm->mutex);
--
-- if (mt76_connac_skip_fw_pmctrl(mphy, pm))
-- goto out;
--
-- err = __mt7921_mcu_fw_pmctrl(dev);
--out:
-- mutex_unlock(&pm->mutex);
--
-- if (err)
-- mt7921_reset(&dev->mt76);
--
-- return err;
--}
--EXPORT_SYMBOL_GPL(mt7921_mcu_fw_pmctrl);
--
--int mt7921_mcu_set_beacon_filter(struct mt7921_dev *dev,
-+int mt7921_mcu_set_beacon_filter(struct mt792x_dev *dev,
- struct ieee80211_vif *vif,
- bool enable)
- {
-@@ -1021,7 +918,7 @@ int mt7921_mcu_set_beacon_filter(struct mt7921_dev *dev,
- return 0;
- }
-
--int mt7921_get_txpwr_info(struct mt7921_dev *dev, struct mt7921_txpwr *txpwr)
-+int mt7921_get_txpwr_info(struct mt792x_dev *dev, struct mt7921_txpwr *txpwr)
- {
- struct mt7921_txpwr_event *event;
- struct mt7921_txpwr_req req = {
-@@ -1044,7 +941,7 @@ int mt7921_get_txpwr_info(struct mt7921_dev *dev, struct mt7921_txpwr *txpwr)
- return 0;
- }
-
--int mt7921_mcu_set_sniffer(struct mt7921_dev *dev, struct ieee80211_vif *vif,
-+int mt7921_mcu_set_sniffer(struct mt792x_dev *dev, struct ieee80211_vif *vif,
- bool enable)
- {
- struct mt76_vif *mvif = (struct mt76_vif *)vif->drv_priv;
-@@ -1074,7 +971,7 @@ int mt7921_mcu_set_sniffer(struct mt7921_dev *dev, struct ieee80211_vif *vif,
- true);
- }
-
--int mt7921_mcu_config_sniffer(struct mt7921_vif *vif,
-+int mt7921_mcu_config_sniffer(struct mt792x_vif *vif,
- struct ieee80211_chanctx_conf *ctx)
- {
- struct cfg80211_chan_def *chandef = &ctx->def;
-@@ -1143,12 +1040,12 @@ int mt7921_mcu_config_sniffer(struct mt7921_vif *vif,
- }
-
- int
--mt7921_mcu_uni_add_beacon_offload(struct mt7921_dev *dev,
-+mt7921_mcu_uni_add_beacon_offload(struct mt792x_dev *dev,
- struct ieee80211_hw *hw,
- struct ieee80211_vif *vif,
- bool enable)
- {
-- struct mt7921_vif *mvif = (struct mt7921_vif *)vif->drv_priv;
-+ struct mt792x_vif *mvif = (struct mt792x_vif *)vif->drv_priv;
- struct mt76_wcid *wcid = &dev->mt76.global_wcid;
- struct ieee80211_mutable_offsets offs;
- struct {
-@@ -1221,7 +1118,7 @@ mt7921_mcu_uni_add_beacon_offload(struct mt7921_dev *dev,
- }
-
- static
--int __mt7921_mcu_set_clc(struct mt7921_dev *dev, u8 *alpha2,
-+int __mt7921_mcu_set_clc(struct mt792x_dev *dev, u8 *alpha2,
- enum environment_cap env_cap,
- struct mt7921_clc *clc,
- u8 idx)
-@@ -1241,7 +1138,7 @@ int __mt7921_mcu_set_clc(struct mt7921_dev *dev, u8 *alpha2,
- } __packed req = {
- .idx = idx,
- .env = env_cap,
-- .acpi_conf = mt7921_acpi_get_flags(&dev->phy),
-+ .acpi_conf = mt792x_acpi_get_flags(&dev->phy),
- };
- int ret, valid_cnt = 0;
- u8 i, *pos;
-@@ -1283,10 +1180,10 @@ int __mt7921_mcu_set_clc(struct mt7921_dev *dev, u8 *alpha2,
- return 0;
- }
-
--int mt7921_mcu_set_clc(struct mt7921_dev *dev, u8 *alpha2,
-+int mt7921_mcu_set_clc(struct mt792x_dev *dev, u8 *alpha2,
- enum environment_cap env_cap)
- {
-- struct mt7921_phy *phy = (struct mt7921_phy *)&dev->phy;
-+ struct mt792x_phy *phy = (struct mt792x_phy *)&dev->phy;
- int i, ret;
-
- /* submit all clc config */
-@@ -1305,9 +1202,9 @@ int mt7921_mcu_set_clc(struct mt7921_dev *dev, u8 *alpha2,
- return 0;
- }
-
--int mt7921_mcu_get_temperature(struct mt7921_phy *phy)
-+int mt7921_mcu_get_temperature(struct mt792x_phy *phy)
- {
-- struct mt7921_dev *dev = phy->dev;
-+ struct mt792x_dev *dev = phy->dev;
- struct {
- u8 ctrl_id;
- u8 action;
-@@ -1322,7 +1219,7 @@ int mt7921_mcu_get_temperature(struct mt7921_phy *phy)
- sizeof(req), true);
- }
-
--int mt7921_mcu_set_rxfilter(struct mt7921_dev *dev, u32 fif,
-+int mt7921_mcu_set_rxfilter(struct mt792x_dev *dev, u32 fif,
- u8 bit_op, u32 bit_map)
- {
- struct {
-diff --git a/mt7921/mt7921.h b/mt7921/mt7921.h
-index ec987965..87dd0685 100644
---- a/mt7921/mt7921.h
-+++ b/mt7921/mt7921.h
-@@ -4,21 +4,8 @@
- #ifndef __MT7921_H
- #define __MT7921_H
-
--#include <linux/interrupt.h>
--#include <linux/ktime.h>
--#include "../mt76_connac_mcu.h"
-+#include "../mt792x.h"
- #include "regs.h"
--#include "acpi_sar.h"
--
--#define MT7921_MAX_INTERFACES 4
--#define MT7921_WTBL_SIZE 20
--#define MT7921_WTBL_RESERVED (MT7921_WTBL_SIZE - 1)
--#define MT7921_WTBL_STA (MT7921_WTBL_RESERVED - \
-- MT7921_MAX_INTERFACES)
--
--#define MT7921_PM_TIMEOUT (HZ / 12)
--#define MT7921_HW_SCAN_TIMEOUT (HZ / 10)
--#define MT7921_WATCHDOG_TIME (HZ / 4)
-
- #define MT7921_TX_RING_SIZE 2048
- #define MT7921_TX_MCU_RING_SIZE 256
-@@ -27,27 +14,11 @@
- #define MT7921_RX_RING_SIZE 1536
- #define MT7921_RX_MCU_RING_SIZE 512
-
--#define MT7921_DRV_OWN_RETRY_COUNT 10
--#define MT7921_MCU_INIT_RETRY_COUNT 10
--#define MT7921_WFSYS_INIT_RETRY_COUNT 2
--
--#define MT7921_FW_TAG_FEATURE 4
--#define MT7921_FW_CAP_CNM BIT(7)
--
--#define MT7921_FIRMWARE_WM "mediatek/WIFI_RAM_CODE_MT7961_1.bin"
--#define MT7921_ROM_PATCH "mediatek/WIFI_MT7961_patch_mcu_1_2_hdr.bin"
--
--#define MT7922_FIRMWARE_WM "mediatek/WIFI_RAM_CODE_MT7922_1.bin"
--#define MT7922_ROM_PATCH "mediatek/WIFI_MT7922_patch_mcu_1_1_hdr.bin"
--
- #define MT7921_EEPROM_SIZE 3584
- #define MT7921_TOKEN_SIZE 8192
-
- #define MT7921_EEPROM_BLOCK_SIZE 16
-
--#define MT7921_CFEND_RATE_DEFAULT 0x49 /* OFDM 24M */
--#define MT7921_CFEND_RATE_11B 0x03 /* 11B LP, 11M */
--
- #define MT7921_SKU_RATE_NUM 161
- #define MT7921_SKU_MAX_DELTA_IDX MT7921_SKU_RATE_NUM
- #define MT7921_SKU_TABLE_SIZE (MT7921_SKU_RATE_NUM + 1)
-@@ -127,9 +98,6 @@ struct mt7921_sdio_intr {
- #define to_rssi(field, rxv) ((FIELD_GET(field, rxv) - 220) / 2)
- #define to_rcpi(rssi) (2 * (rssi) + 220)
-
--struct mt7921_vif;
--struct mt7921_sta;
--
- enum mt7921_txq_id {
- MT7921_TXQ_BAND0,
- MT7921_TXQ_BAND1,
-@@ -143,39 +111,6 @@ enum mt7921_rxq_id {
- MT7921_RXQ_MCU_WM = 0,
- };
-
--DECLARE_EWMA(avg_signal, 10, 8)
--
--struct mt7921_sta {
-- struct mt76_wcid wcid; /* must be first */
--
-- struct mt7921_vif *vif;
--
-- u32 airtime_ac[8];
--
-- int ack_signal;
-- struct ewma_avg_signal avg_ack_signal;
--
-- unsigned long last_txs;
--
-- struct mt76_connac_sta_key_conf bip;
--};
--
--DECLARE_EWMA(rssi, 10, 8);
--
--struct mt7921_vif {
-- struct mt76_vif mt76; /* must be first */
--
-- struct mt7921_sta sta;
-- struct mt7921_sta *wep_sta;
--
-- struct mt7921_phy *phy;
--
-- struct ewma_rssi rssi;
--
-- struct ieee80211_tx_queue_params queue_params[IEEE80211_NUM_ACS];
-- struct ieee80211_chanctx_conf *ctx;
--};
--
- enum {
- MT7921_CLC_POWER,
- MT7921_CLC_CHAN,
-@@ -199,41 +134,6 @@ struct mt7921_clc {
- u8 data[];
- } __packed;
-
--struct mt7921_phy {
-- struct mt76_phy *mt76;
-- struct mt7921_dev *dev;
--
-- struct ieee80211_sband_iftype_data iftype[NUM_NL80211_BANDS][NUM_NL80211_IFTYPES];
--
-- u64 omac_mask;
--
-- u16 noise;
--
-- s16 coverage_class;
-- u8 slottime;
--
-- u32 rx_ampdu_ts;
-- u32 ampdu_ref;
--
-- struct mt76_mib_stats mib;
--
-- u8 sta_work_count;
--
-- struct sk_buff_head scan_event_list;
-- struct delayed_work scan_work;
--#ifdef CONFIG_ACPI
-- struct mt7921_acpi_sar *acpisar;
--#endif
--
-- struct mt7921_clc *clc[MT7921_CLC_MAX_NUM];
--
-- struct work_struct roc_work;
-- struct timer_list roc_timer;
-- wait_queue_head_t roc_wait;
-- u8 roc_token_id;
-- bool roc_grant;
--};
--
- enum mt7921_eeprom_field {
- MT_EE_CHIP_ID = 0x000,
- MT_EE_VERSION = 0x002,
-@@ -245,49 +145,6 @@ enum mt7921_eeprom_field {
-
- #define MT_EE_HW_TYPE_ENCAP BIT(0)
-
--#define mt7921_init_reset(dev) ((dev)->hif_ops->init_reset(dev))
--#define mt7921_dev_reset(dev) ((dev)->hif_ops->reset(dev))
--#define mt7921_mcu_init(dev) ((dev)->hif_ops->mcu_init(dev))
--#define __mt7921_mcu_drv_pmctrl(dev) ((dev)->hif_ops->drv_own(dev))
--#define __mt7921_mcu_fw_pmctrl(dev) ((dev)->hif_ops->fw_own(dev))
--struct mt7921_hif_ops {
-- int (*init_reset)(struct mt7921_dev *dev);
-- int (*reset)(struct mt7921_dev *dev);
-- int (*mcu_init)(struct mt7921_dev *dev);
-- int (*drv_own)(struct mt7921_dev *dev);
-- int (*fw_own)(struct mt7921_dev *dev);
--};
--
--struct mt7921_dev {
-- union { /* must be first */
-- struct mt76_dev mt76;
-- struct mt76_phy mphy;
-- };
--
-- const struct mt76_bus_ops *bus_ops;
-- struct mt7921_phy phy;
--
-- struct work_struct reset_work;
-- bool hw_full_reset:1;
-- bool hw_init_done:1;
-- bool fw_assert:1;
--
-- struct work_struct init_work;
--
-- u8 fw_debug;
-- u8 fw_features;
--
-- struct mt76_connac_pm pm;
-- struct mt76_connac_coredump coredump;
-- const struct mt7921_hif_ops *hif_ops;
--
-- struct work_struct ipv6_ns_work;
-- /* IPv6 addresses for WoWLAN */
-- struct sk_buff_head ipv6_ns_list;
--
-- enum environment_cap country_ie_env;
--};
--
- enum {
- TXPWR_USER,
- TXPWR_EEPROM,
-@@ -318,56 +175,31 @@ struct mt7921_txpwr {
- } data[TXPWR_MAX_NUM];
- };
-
--static inline struct mt7921_phy *
--mt7921_hw_phy(struct ieee80211_hw *hw)
--{
-- struct mt76_phy *phy = hw->priv;
--
-- return phy->priv;
--}
--
--static inline struct mt7921_dev *
--mt7921_hw_dev(struct ieee80211_hw *hw)
--{
-- struct mt76_phy *phy = hw->priv;
--
-- return container_of(phy->dev, struct mt7921_dev, mt76);
--}
--
--#define mt7921_mutex_acquire(dev) \
-- mt76_connac_mutex_acquire(&(dev)->mt76, &(dev)->pm)
--#define mt7921_mutex_release(dev) \
-- mt76_connac_mutex_release(&(dev)->mt76, &(dev)->pm)
--
- extern const struct ieee80211_ops mt7921_ops;
-
--u32 mt7921_reg_map(struct mt7921_dev *dev, u32 addr);
--
--int __mt7921_start(struct mt7921_phy *phy);
--int mt7921_register_device(struct mt7921_dev *dev);
--void mt7921_unregister_device(struct mt7921_dev *dev);
--int mt7921_dma_init(struct mt7921_dev *dev);
--int mt7921_wpdma_reset(struct mt7921_dev *dev, bool force);
--int mt7921_wpdma_reinit_cond(struct mt7921_dev *dev);
--void mt7921_dma_cleanup(struct mt7921_dev *dev);
--int mt7921_run_firmware(struct mt7921_dev *dev);
--int mt7921_mcu_set_bss_pm(struct mt7921_dev *dev, struct ieee80211_vif *vif,
-+u32 mt7921_reg_map(struct mt792x_dev *dev, u32 addr);
-+
-+int __mt7921_start(struct mt792x_phy *phy);
-+int mt7921_register_device(struct mt792x_dev *dev);
-+void mt7921_unregister_device(struct mt792x_dev *dev);
-+int mt7921_run_firmware(struct mt792x_dev *dev);
-+int mt7921_mcu_set_bss_pm(struct mt792x_dev *dev, struct ieee80211_vif *vif,
- bool enable);
--int mt7921_mcu_sta_update(struct mt7921_dev *dev, struct ieee80211_sta *sta,
-+int mt7921_mcu_sta_update(struct mt792x_dev *dev, struct ieee80211_sta *sta,
- struct ieee80211_vif *vif, bool enable,
- enum mt76_sta_info_state state);
--int mt7921_mcu_set_chan_info(struct mt7921_phy *phy, int cmd);
--int mt7921_mcu_set_tx(struct mt7921_dev *dev, struct ieee80211_vif *vif);
--int mt7921_mcu_set_eeprom(struct mt7921_dev *dev);
--int mt7921_mcu_get_rx_rate(struct mt7921_phy *phy, struct ieee80211_vif *vif,
-+int mt7921_mcu_set_chan_info(struct mt792x_phy *phy, int cmd);
-+int mt7921_mcu_set_tx(struct mt792x_dev *dev, struct ieee80211_vif *vif);
-+int mt7921_mcu_set_eeprom(struct mt792x_dev *dev);
-+int mt7921_mcu_get_rx_rate(struct mt792x_phy *phy, struct ieee80211_vif *vif,
- struct ieee80211_sta *sta, struct rate_info *rate);
--int mt7921_mcu_fw_log_2_host(struct mt7921_dev *dev, u8 ctrl);
--void mt7921_mcu_rx_event(struct mt7921_dev *dev, struct sk_buff *skb);
--int mt7921_mcu_set_rxfilter(struct mt7921_dev *dev, u32 fif,
-+int mt7921_mcu_fw_log_2_host(struct mt792x_dev *dev, u8 ctrl);
-+void mt7921_mcu_rx_event(struct mt792x_dev *dev, struct sk_buff *skb);
-+int mt7921_mcu_set_rxfilter(struct mt792x_dev *dev, u32 fif,
- u8 bit_op, u32 bit_map);
-
- static inline u32
--mt7921_reg_map_l1(struct mt7921_dev *dev, u32 addr)
-+mt7921_reg_map_l1(struct mt792x_dev *dev, u32 addr)
- {
- u32 offset = FIELD_GET(MT_HIF_REMAP_L1_OFFSET, addr);
- u32 base = FIELD_GET(MT_HIF_REMAP_L1_BASE, addr);
-@@ -380,19 +212,19 @@ mt7921_reg_map_l1(struct mt7921_dev *dev, u32 addr)
- }
-
- static inline u32
--mt7921_l1_rr(struct mt7921_dev *dev, u32 addr)
-+mt7921_l1_rr(struct mt792x_dev *dev, u32 addr)
- {
- return mt76_rr(dev, mt7921_reg_map_l1(dev, addr));
- }
-
- static inline void
--mt7921_l1_wr(struct mt7921_dev *dev, u32 addr, u32 val)
-+mt7921_l1_wr(struct mt792x_dev *dev, u32 addr, u32 val)
- {
- mt76_wr(dev, mt7921_reg_map_l1(dev, addr), val);
- }
-
- static inline u32
--mt7921_l1_rmw(struct mt7921_dev *dev, u32 addr, u32 mask, u32 val)
-+mt7921_l1_rmw(struct mt792x_dev *dev, u32 addr, u32 mask, u32 val)
- {
- val |= mt7921_l1_rr(dev, addr) & ~mask;
- mt7921_l1_wr(dev, addr, val);
-@@ -403,13 +235,8 @@ mt7921_l1_rmw(struct mt7921_dev *dev, u32 addr, u32 mask, u32 val)
- #define mt7921_l1_set(dev, addr, val) mt7921_l1_rmw(dev, addr, 0, val)
- #define mt7921_l1_clear(dev, addr, val) mt7921_l1_rmw(dev, addr, val, 0)
-
--static inline bool mt7921_dma_need_reinit(struct mt7921_dev *dev)
--{
-- return !mt76_get_field(dev, MT_WFDMA_DUMMY_CR, MT_WFDMA_NEED_REINIT);
--}
--
- static inline void
--mt7921_skb_add_usb_sdio_hdr(struct mt7921_dev *dev, struct sk_buff *skb,
-+mt7921_skb_add_usb_sdio_hdr(struct mt792x_dev *dev, struct sk_buff *skb,
- int type)
- {
- u32 hdr, len;
-@@ -422,54 +249,41 @@ mt7921_skb_add_usb_sdio_hdr(struct mt7921_dev *dev, struct sk_buff *skb,
- }
-
- void mt7921_stop(struct ieee80211_hw *hw);
--int mt7921_mac_init(struct mt7921_dev *dev);
--bool mt7921_mac_wtbl_update(struct mt7921_dev *dev, int idx, u32 mask);
--void mt7921_mac_reset_counters(struct mt7921_phy *phy);
--void mt7921_mac_set_timing(struct mt7921_phy *phy);
-+int mt7921_mac_init(struct mt792x_dev *dev);
-+bool mt7921_mac_wtbl_update(struct mt792x_dev *dev, int idx, u32 mask);
- int mt7921_mac_sta_add(struct mt76_dev *mdev, struct ieee80211_vif *vif,
- struct ieee80211_sta *sta);
- void mt7921_mac_sta_assoc(struct mt76_dev *mdev, struct ieee80211_vif *vif,
- struct ieee80211_sta *sta);
- void mt7921_mac_sta_remove(struct mt76_dev *mdev, struct ieee80211_vif *vif,
- struct ieee80211_sta *sta);
--void mt7921_mac_work(struct work_struct *work);
- void mt7921_mac_reset_work(struct work_struct *work);
--void mt7921_mac_update_mib_stats(struct mt7921_phy *phy);
--void mt7921_reset(struct mt76_dev *mdev);
- int mt7921e_tx_prepare_skb(struct mt76_dev *mdev, void *txwi_ptr,
- enum mt76_txq_id qid, struct mt76_wcid *wcid,
- struct ieee80211_sta *sta,
- struct mt76_tx_info *tx_info);
-
--void mt7921_tx_worker(struct mt76_worker *w);
- bool mt7921_rx_check(struct mt76_dev *mdev, void *data, int len);
- void mt7921_queue_rx_skb(struct mt76_dev *mdev, enum mt76_rxq_id q,
- struct sk_buff *skb, u32 *info);
- void mt7921_stats_work(struct work_struct *work);
--void mt7921_set_stream_he_caps(struct mt7921_phy *phy);
--void mt7921_update_channel(struct mt76_phy *mphy);
--int mt7921_init_debugfs(struct mt7921_dev *dev);
-+void mt7921_set_stream_he_caps(struct mt792x_phy *phy);
-+int mt7921_init_debugfs(struct mt792x_dev *dev);
-
--int mt7921_mcu_set_beacon_filter(struct mt7921_dev *dev,
-+int mt7921_mcu_set_beacon_filter(struct mt792x_dev *dev,
- struct ieee80211_vif *vif,
- bool enable);
--int mt7921_mcu_uni_tx_ba(struct mt7921_dev *dev,
-+int mt7921_mcu_uni_tx_ba(struct mt792x_dev *dev,
- struct ieee80211_ampdu_params *params,
- bool enable);
--int mt7921_mcu_uni_rx_ba(struct mt7921_dev *dev,
-+int mt7921_mcu_uni_rx_ba(struct mt792x_dev *dev,
- struct ieee80211_ampdu_params *params,
- bool enable);
- void mt7921_scan_work(struct work_struct *work);
- void mt7921_roc_work(struct work_struct *work);
--void mt7921_roc_timer(struct timer_list *timer);
--int mt7921_mcu_uni_bss_ps(struct mt7921_dev *dev, struct ieee80211_vif *vif);
--int mt7921_mcu_drv_pmctrl(struct mt7921_dev *dev);
--int mt7921_mcu_fw_pmctrl(struct mt7921_dev *dev);
--void mt7921_pm_wake_work(struct work_struct *work);
--void mt7921_pm_power_save_work(struct work_struct *work);
-+int mt7921_mcu_uni_bss_ps(struct mt792x_dev *dev, struct ieee80211_vif *vif);
- void mt7921_coredump_work(struct work_struct *work);
--int mt7921_wfsys_reset(struct mt7921_dev *dev);
--int mt7921_get_txpwr_info(struct mt7921_dev *dev, struct mt7921_txpwr *txpwr);
-+int mt7921_get_txpwr_info(struct mt792x_dev *dev, struct mt7921_txpwr *txpwr);
- int mt7921_testmode_cmd(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
- void *data, int len);
- int mt7921_testmode_dump(struct ieee80211_hw *hw, struct sk_buff *msg,
-@@ -477,30 +291,27 @@ int mt7921_testmode_dump(struct ieee80211_hw *hw, struct sk_buff *msg,
- int mt7921_mcu_parse_response(struct mt76_dev *mdev, int cmd,
- struct sk_buff *skb, int seq);
-
--int mt7921e_driver_own(struct mt7921_dev *dev);
--int mt7921e_mac_reset(struct mt7921_dev *dev);
--int mt7921e_mcu_init(struct mt7921_dev *dev);
--int mt7921s_wfsys_reset(struct mt7921_dev *dev);
--int mt7921s_mac_reset(struct mt7921_dev *dev);
--int mt7921s_init_reset(struct mt7921_dev *dev);
--int __mt7921e_mcu_drv_pmctrl(struct mt7921_dev *dev);
--int mt7921e_mcu_drv_pmctrl(struct mt7921_dev *dev);
--int mt7921e_mcu_fw_pmctrl(struct mt7921_dev *dev);
--
--int mt7921s_mcu_init(struct mt7921_dev *dev);
--int mt7921s_mcu_drv_pmctrl(struct mt7921_dev *dev);
--int mt7921s_mcu_fw_pmctrl(struct mt7921_dev *dev);
--void mt7921_mac_add_txs(struct mt7921_dev *dev, void *data);
--void mt7921_set_runtime_pm(struct mt7921_dev *dev);
-+int mt7921e_driver_own(struct mt792x_dev *dev);
-+int mt7921e_mac_reset(struct mt792x_dev *dev);
-+int mt7921e_mcu_init(struct mt792x_dev *dev);
-+int mt7921s_wfsys_reset(struct mt792x_dev *dev);
-+int mt7921s_mac_reset(struct mt792x_dev *dev);
-+int mt7921s_init_reset(struct mt792x_dev *dev);
-+
-+int mt7921s_mcu_init(struct mt792x_dev *dev);
-+int mt7921s_mcu_drv_pmctrl(struct mt792x_dev *dev);
-+int mt7921s_mcu_fw_pmctrl(struct mt792x_dev *dev);
-+void mt7921_mac_add_txs(struct mt792x_dev *dev, void *data);
-+void mt7921_set_runtime_pm(struct mt792x_dev *dev);
- void mt7921_mcu_set_suspend_iter(void *priv, u8 *mac,
- struct ieee80211_vif *vif);
- void mt7921_set_ipv6_ns_work(struct work_struct *work);
-
--int mt7921_mcu_set_sniffer(struct mt7921_dev *dev, struct ieee80211_vif *vif,
-+int mt7921_mcu_set_sniffer(struct mt792x_dev *dev, struct ieee80211_vif *vif,
- bool enable);
--int mt7921_mcu_config_sniffer(struct mt7921_vif *vif,
-+int mt7921_mcu_config_sniffer(struct mt792x_vif *vif,
- struct ieee80211_chanctx_conf *ctx);
--int mt7921_mcu_get_temperature(struct mt7921_phy *phy);
-+int mt7921_mcu_get_temperature(struct mt792x_phy *phy);
-
- int mt7921_usb_sdio_tx_prepare_skb(struct mt76_dev *mdev, void *txwi_ptr,
- enum mt76_txq_id qid, struct mt76_wcid *wcid,
-@@ -511,51 +322,18 @@ void mt7921_usb_sdio_tx_complete_skb(struct mt76_dev *mdev,
- bool mt7921_usb_sdio_tx_status_data(struct mt76_dev *mdev, u8 *update);
-
- /* usb */
--#define MT_USB_TYPE_VENDOR (USB_TYPE_VENDOR | 0x1f)
--#define MT_USB_TYPE_UHW_VENDOR (USB_TYPE_VENDOR | 0x1e)
--
--int mt7921u_mcu_power_on(struct mt7921_dev *dev);
--int mt7921u_wfsys_reset(struct mt7921_dev *dev);
--int mt7921u_dma_init(struct mt7921_dev *dev, bool resume);
--int mt7921u_init_reset(struct mt7921_dev *dev);
--int mt7921u_mac_reset(struct mt7921_dev *dev);
--int mt7921_mcu_uni_add_beacon_offload(struct mt7921_dev *dev,
-+int mt7921_mcu_uni_add_beacon_offload(struct mt792x_dev *dev,
- struct ieee80211_hw *hw,
- struct ieee80211_vif *vif,
- bool enable);
--#ifdef CONFIG_ACPI
--int mt7921_init_acpi_sar(struct mt7921_dev *dev);
--int mt7921_init_acpi_sar_power(struct mt7921_phy *phy, bool set_default);
--u8 mt7921_acpi_get_flags(struct mt7921_phy *phy);
--#else
--static inline int
--mt7921_init_acpi_sar(struct mt7921_dev *dev)
--{
-- return 0;
--}
--
--static inline int
--mt7921_init_acpi_sar_power(struct mt7921_phy *phy, bool set_default)
--{
-- return 0;
--}
--
--static inline u8
--mt7921_acpi_get_flags(struct mt7921_phy *phy)
--{
-- return 0;
--}
--#endif
- int mt7921_set_tx_sar_pwr(struct ieee80211_hw *hw,
- const struct cfg80211_sar_specs *sar);
-
--int mt7921_mcu_set_clc(struct mt7921_dev *dev, u8 *alpha2,
-+int mt7921_mcu_set_clc(struct mt792x_dev *dev, u8 *alpha2,
- enum environment_cap env_cap);
--int mt7921_mcu_set_roc(struct mt7921_phy *phy, struct mt7921_vif *vif,
-+int mt7921_mcu_set_roc(struct mt792x_phy *phy, struct mt792x_vif *vif,
- struct ieee80211_channel *chan, int duration,
- enum mt7921_roc_req type, u8 token_id);
--int mt7921_mcu_abort_roc(struct mt7921_phy *phy, struct mt7921_vif *vif,
-+int mt7921_mcu_abort_roc(struct mt792x_phy *phy, struct mt792x_vif *vif,
- u8 token_id);
--struct ieee80211_ops *mt7921_get_mac80211_ops(struct device *dev,
-- void *drv_data, u8 *fw_features);
- #endif
-diff --git a/mt7921/pci.c b/mt7921/pci.c
-index 7c8bf719..d869aab7 100644
---- a/mt7921/pci.c
-+++ b/mt7921/pci.c
-@@ -9,8 +9,8 @@
-
- #include "mt7921.h"
- #include "../mt76_connac2_mac.h"
-+#include "../dma.h"
- #include "mcu.h"
--#include "../trace.h"
-
- static const struct pci_device_id mt7921_pci_device_table[] = {
- { PCI_DEVICE(PCI_VENDOR_ID_MEDIATEK, 0x7961),
-@@ -28,81 +28,12 @@ static bool mt7921_disable_aspm;
- module_param_named(disable_aspm, mt7921_disable_aspm, bool, 0644);
- MODULE_PARM_DESC(disable_aspm, "disable PCI ASPM support");
-
--static void
--mt7921_rx_poll_complete(struct mt76_dev *mdev, enum mt76_rxq_id q)
-+static int mt7921e_init_reset(struct mt792x_dev *dev)
- {
-- if (q == MT_RXQ_MAIN)
-- mt76_connac_irq_enable(mdev, MT_INT_RX_DONE_DATA);
-- else if (q == MT_RXQ_MCU_WA)
-- mt76_connac_irq_enable(mdev, MT_INT_RX_DONE_WM2);
-- else
-- mt76_connac_irq_enable(mdev, MT_INT_RX_DONE_WM);
-+ return mt792x_wpdma_reset(dev, true);
- }
-
--static irqreturn_t mt7921_irq_handler(int irq, void *dev_instance)
--{
-- struct mt7921_dev *dev = dev_instance;
--
-- mt76_wr(dev, MT_WFDMA0_HOST_INT_ENA, 0);
--
-- if (!test_bit(MT76_STATE_INITIALIZED, &dev->mphy.state))
-- return IRQ_NONE;
--
-- tasklet_schedule(&dev->mt76.irq_tasklet);
--
-- return IRQ_HANDLED;
--}
--
--static void mt7921_irq_tasklet(unsigned long data)
--{
-- struct mt7921_dev *dev = (struct mt7921_dev *)data;
-- u32 intr, mask = 0;
--
-- mt76_wr(dev, MT_WFDMA0_HOST_INT_ENA, 0);
--
-- intr = mt76_rr(dev, MT_WFDMA0_HOST_INT_STA);
-- intr &= dev->mt76.mmio.irqmask;
-- mt76_wr(dev, MT_WFDMA0_HOST_INT_STA, intr);
--
-- trace_dev_irq(&dev->mt76, intr, dev->mt76.mmio.irqmask);
--
-- mask |= intr & MT_INT_RX_DONE_ALL;
-- if (intr & MT_INT_TX_DONE_MCU)
-- mask |= MT_INT_TX_DONE_MCU;
--
-- if (intr & MT_INT_MCU_CMD) {
-- u32 intr_sw;
--
-- intr_sw = mt76_rr(dev, MT_MCU_CMD);
-- /* ack MCU2HOST_SW_INT_STA */
-- mt76_wr(dev, MT_MCU_CMD, intr_sw);
-- if (intr_sw & MT_MCU_CMD_WAKE_RX_PCIE) {
-- mask |= MT_INT_RX_DONE_DATA;
-- intr |= MT_INT_RX_DONE_DATA;
-- }
-- }
--
-- mt76_set_irq_mask(&dev->mt76, MT_WFDMA0_HOST_INT_ENA, mask, 0);
--
-- if (intr & MT_INT_TX_DONE_ALL)
-- napi_schedule(&dev->mt76.tx_napi);
--
-- if (intr & MT_INT_RX_DONE_WM)
-- napi_schedule(&dev->mt76.napi[MT_RXQ_MCU]);
--
-- if (intr & MT_INT_RX_DONE_WM2)
-- napi_schedule(&dev->mt76.napi[MT_RXQ_MCU_WA]);
--
-- if (intr & MT_INT_RX_DONE_DATA)
-- napi_schedule(&dev->mt76.napi[MT_RXQ_MAIN]);
--}
--
--static int mt7921e_init_reset(struct mt7921_dev *dev)
--{
-- return mt7921_wpdma_reset(dev, true);
--}
--
--static void mt7921e_unregister_device(struct mt7921_dev *dev)
-+static void mt7921e_unregister_device(struct mt792x_dev *dev)
- {
- int i;
- struct mt76_connac_pm *pm = &dev->pm;
-@@ -116,15 +47,15 @@ static void mt7921e_unregister_device(struct mt7921_dev *dev)
- cancel_work_sync(&dev->reset_work);
-
- mt76_connac2_tx_token_put(&dev->mt76);
-- __mt7921_mcu_drv_pmctrl(dev);
-- mt7921_dma_cleanup(dev);
-- mt7921_wfsys_reset(dev);
-+ __mt792x_mcu_drv_pmctrl(dev);
-+ mt792x_dma_cleanup(dev);
-+ mt792x_wfsys_reset(dev);
- skb_queue_purge(&dev->mt76.mcu.res_q);
-
- tasklet_disable(&dev->mt76.irq_tasklet);
- }
-
--static u32 __mt7921_reg_addr(struct mt7921_dev *dev, u32 addr)
-+static u32 __mt7921_reg_addr(struct mt792x_dev *dev, u32 addr)
- {
- static const struct mt76_connac_reg_map fixed_map[] = {
- { 0x820d0000, 0x30000, 0x10000 }, /* WF_LMAC_TOP (WF_WTBLON) */
-@@ -203,7 +134,7 @@ static u32 __mt7921_reg_addr(struct mt7921_dev *dev, u32 addr)
-
- static u32 mt7921_rr(struct mt76_dev *mdev, u32 offset)
- {
-- struct mt7921_dev *dev = container_of(mdev, struct mt7921_dev, mt76);
-+ struct mt792x_dev *dev = container_of(mdev, struct mt792x_dev, mt76);
- u32 addr = __mt7921_reg_addr(dev, offset);
-
- return dev->bus_ops->rr(mdev, addr);
-@@ -211,7 +142,7 @@ static u32 mt7921_rr(struct mt76_dev *mdev, u32 offset)
-
- static void mt7921_wr(struct mt76_dev *mdev, u32 offset, u32 val)
- {
-- struct mt7921_dev *dev = container_of(mdev, struct mt7921_dev, mt76);
-+ struct mt792x_dev *dev = container_of(mdev, struct mt792x_dev, mt76);
- u32 addr = __mt7921_reg_addr(dev, offset);
-
- dev->bus_ops->wr(mdev, addr, val);
-@@ -219,12 +150,77 @@ static void mt7921_wr(struct mt76_dev *mdev, u32 offset, u32 val)
-
- static u32 mt7921_rmw(struct mt76_dev *mdev, u32 offset, u32 mask, u32 val)
- {
-- struct mt7921_dev *dev = container_of(mdev, struct mt7921_dev, mt76);
-+ struct mt792x_dev *dev = container_of(mdev, struct mt792x_dev, mt76);
- u32 addr = __mt7921_reg_addr(dev, offset);
-
- return dev->bus_ops->rmw(mdev, addr, mask, val);
- }
-
-+static int mt7921_dma_init(struct mt792x_dev *dev)
-+{
-+ int ret;
-+
-+ mt76_dma_attach(&dev->mt76);
-+
-+ ret = mt792x_dma_disable(dev, true);
-+ if (ret)
-+ return ret;
-+
-+ /* init tx queue */
-+ ret = mt76_connac_init_tx_queues(dev->phy.mt76, MT7921_TXQ_BAND0,
-+ MT7921_TX_RING_SIZE,
-+ MT_TX_RING_BASE, 0);
-+ if (ret)
-+ return ret;
-+
-+ mt76_wr(dev, MT_WFDMA0_TX_RING0_EXT_CTRL, 0x4);
-+
-+ /* command to WM */
-+ ret = mt76_init_mcu_queue(&dev->mt76, MT_MCUQ_WM, MT7921_TXQ_MCU_WM,
-+ MT7921_TX_MCU_RING_SIZE, MT_TX_RING_BASE);
-+ if (ret)
-+ return ret;
-+
-+ /* firmware download */
-+ ret = mt76_init_mcu_queue(&dev->mt76, MT_MCUQ_FWDL, MT7921_TXQ_FWDL,
-+ MT7921_TX_FWDL_RING_SIZE, MT_TX_RING_BASE);
-+ if (ret)
-+ return ret;
-+
-+ /* event from WM before firmware download */
-+ ret = mt76_queue_alloc(dev, &dev->mt76.q_rx[MT_RXQ_MCU],
-+ MT7921_RXQ_MCU_WM,
-+ MT7921_RX_MCU_RING_SIZE,
-+ MT_RX_BUF_SIZE, MT_RX_EVENT_RING_BASE);
-+ if (ret)
-+ return ret;
-+
-+ /* Change mcu queue after firmware download */
-+ ret = mt76_queue_alloc(dev, &dev->mt76.q_rx[MT_RXQ_MCU_WA],
-+ MT7921_RXQ_MCU_WM,
-+ MT7921_RX_MCU_RING_SIZE,
-+ MT_RX_BUF_SIZE, MT_WFDMA0(0x540));
-+ if (ret)
-+ return ret;
-+
-+ /* rx data */
-+ ret = mt76_queue_alloc(dev, &dev->mt76.q_rx[MT_RXQ_MAIN],
-+ MT7921_RXQ_BAND0, MT7921_RX_RING_SIZE,
-+ MT_RX_BUF_SIZE, MT_RX_DATA_RING_BASE);
-+ if (ret)
-+ return ret;
-+
-+ ret = mt76_init_queues(dev, mt792x_poll_rx);
-+ if (ret < 0)
-+ return ret;
-+
-+ netif_napi_add_tx(&dev->mt76.tx_napi_dev, &dev->mt76.tx_napi,
-+ mt792x_poll_tx);
-+ napi_enable(&dev->mt76.tx_napi);
-+
-+ return mt792x_dma_enable(dev);
-+}
-+
- static int mt7921_pci_probe(struct pci_dev *pdev,
- const struct pci_device_id *id)
- {
-@@ -241,22 +237,34 @@ static int mt7921_pci_probe(struct pci_dev *pdev,
- .tx_complete_skb = mt76_connac_tx_complete_skb,
- .rx_check = mt7921_rx_check,
- .rx_skb = mt7921_queue_rx_skb,
-- .rx_poll_complete = mt7921_rx_poll_complete,
-+ .rx_poll_complete = mt792x_rx_poll_complete,
- .sta_add = mt7921_mac_sta_add,
- .sta_assoc = mt7921_mac_sta_assoc,
- .sta_remove = mt7921_mac_sta_remove,
-- .update_survey = mt7921_update_channel,
-+ .update_survey = mt792x_update_channel,
- };
-- static const struct mt7921_hif_ops mt7921_pcie_ops = {
-+ static const struct mt792x_hif_ops mt7921_pcie_ops = {
- .init_reset = mt7921e_init_reset,
- .reset = mt7921e_mac_reset,
- .mcu_init = mt7921e_mcu_init,
-- .drv_own = mt7921e_mcu_drv_pmctrl,
-- .fw_own = mt7921e_mcu_fw_pmctrl,
-+ .drv_own = mt792xe_mcu_drv_pmctrl,
-+ .fw_own = mt792xe_mcu_fw_pmctrl,
-+ };
-+ static const struct mt792x_irq_map irq_map = {
-+ .host_irq_enable = MT_WFDMA0_HOST_INT_ENA,
-+ .tx = {
-+ .all_complete_mask = MT_INT_TX_DONE_ALL,
-+ .mcu_complete_mask = MT_INT_TX_DONE_MCU,
-+ },
-+ .rx = {
-+ .data_complete_mask = MT_INT_RX_DONE_DATA,
-+ .wm_complete_mask = MT_INT_RX_DONE_WM,
-+ .wm2_complete_mask = MT_INT_RX_DONE_WM2,
-+ },
- };
- struct ieee80211_ops *ops;
- struct mt76_bus_ops *bus_ops;
-- struct mt7921_dev *dev;
-+ struct mt792x_dev *dev;
- struct mt76_dev *mdev;
- u8 features;
- int ret;
-@@ -288,8 +296,8 @@ static int mt7921_pci_probe(struct pci_dev *pdev,
- if (mt7921_disable_aspm)
- mt76_pci_disable_aspm(pdev);
-
-- ops = mt7921_get_mac80211_ops(&pdev->dev, (void *)id->driver_data,
-- &features);
-+ ops = mt792x_get_mac80211_ops(&pdev->dev, &mt7921_ops,
-+ (void *)id->driver_data, &features);
- if (!ops) {
- ret = -ENOMEM;
- goto err_free_pci_vec;
-@@ -303,11 +311,12 @@ static int mt7921_pci_probe(struct pci_dev *pdev,
-
- pci_set_drvdata(pdev, mdev);
-
-- dev = container_of(mdev, struct mt7921_dev, mt76);
-+ dev = container_of(mdev, struct mt792x_dev, mt76);
- dev->fw_features = features;
- dev->hif_ops = &mt7921_pcie_ops;
-+ dev->irq_map = &irq_map;
- mt76_mmio_init(&dev->mt76, pcim_iomap_table(pdev)[0]);
-- tasklet_init(&mdev->irq_tasklet, mt7921_irq_tasklet, (unsigned long)dev);
-+ tasklet_init(&mdev->irq_tasklet, mt792x_irq_tasklet, (unsigned long)dev);
-
- dev->phy.dev = dev;
- dev->phy.mt76 = &dev->mt76.phy;
-@@ -325,11 +334,11 @@ static int mt7921_pci_probe(struct pci_dev *pdev,
- bus_ops->rmw = mt7921_rmw;
- dev->mt76.bus = bus_ops;
-
-- ret = mt7921e_mcu_fw_pmctrl(dev);
-+ ret = mt792xe_mcu_fw_pmctrl(dev);
- if (ret)
- goto err_free_dev;
-
-- ret = __mt7921e_mcu_drv_pmctrl(dev);
-+ ret = __mt792xe_mcu_drv_pmctrl(dev);
- if (ret)
- goto err_free_dev;
-
-@@ -337,15 +346,15 @@ static int mt7921_pci_probe(struct pci_dev *pdev,
- (mt7921_l1_rr(dev, MT_HW_REV) & 0xff);
- dev_info(mdev->dev, "ASIC revision: %04x\n", mdev->rev);
-
-- ret = mt7921_wfsys_reset(dev);
-+ ret = mt792x_wfsys_reset(dev);
- if (ret)
- goto err_free_dev;
-
-- mt76_wr(dev, MT_WFDMA0_HOST_INT_ENA, 0);
-+ mt76_wr(dev, irq_map.host_irq_enable, 0);
-
- mt76_wr(dev, MT_PCIE_MAC_INT_ENABLE, 0xff);
-
-- ret = devm_request_irq(mdev->dev, pdev->irq, mt7921_irq_handler,
-+ ret = devm_request_irq(mdev->dev, pdev->irq, mt792x_irq_handler,
- IRQF_SHARED, KBUILD_MODNAME, dev);
- if (ret)
- goto err_free_dev;
-@@ -373,7 +382,7 @@ err_free_pci_vec:
- static void mt7921_pci_remove(struct pci_dev *pdev)
- {
- struct mt76_dev *mdev = pci_get_drvdata(pdev);
-- struct mt7921_dev *dev = container_of(mdev, struct mt7921_dev, mt76);
-+ struct mt792x_dev *dev = container_of(mdev, struct mt792x_dev, mt76);
-
- mt7921e_unregister_device(dev);
- devm_free_irq(&pdev->dev, pdev->irq, dev);
-@@ -385,7 +394,7 @@ static int mt7921_pci_suspend(struct device *device)
- {
- struct pci_dev *pdev = to_pci_dev(device);
- struct mt76_dev *mdev = pci_get_drvdata(pdev);
-- struct mt7921_dev *dev = container_of(mdev, struct mt7921_dev, mt76);
-+ struct mt792x_dev *dev = container_of(mdev, struct mt792x_dev, mt76);
- struct mt76_connac_pm *pm = &dev->pm;
- int i, err;
-
-@@ -394,7 +403,7 @@ static int mt7921_pci_suspend(struct device *device)
- cancel_delayed_work_sync(&pm->ps_work);
- cancel_work_sync(&pm->wake_work);
-
-- err = mt7921_mcu_drv_pmctrl(dev);
-+ err = mt792x_mcu_drv_pmctrl(dev);
- if (err < 0)
- goto restore_suspend;
-
-@@ -424,12 +433,12 @@ static int mt7921_pci_suspend(struct device *device)
- MT_WFDMA0_GLO_CFG_TX_DMA_EN | MT_WFDMA0_GLO_CFG_RX_DMA_EN);
-
- /* disable interrupt */
-- mt76_wr(dev, MT_WFDMA0_HOST_INT_ENA, 0);
-+ mt76_wr(dev, dev->irq_map->host_irq_enable, 0);
- mt76_wr(dev, MT_PCIE_MAC_INT_ENABLE, 0x0);
- synchronize_irq(pdev->irq);
- tasklet_kill(&mdev->irq_tasklet);
-
-- err = mt7921_mcu_fw_pmctrl(dev);
-+ err = mt792x_mcu_fw_pmctrl(dev);
- if (err)
- goto restore_napi;
-
-@@ -450,7 +459,7 @@ restore_suspend:
- pm->suspended = false;
-
- if (err < 0)
-- mt7921_reset(&dev->mt76);
-+ mt792x_reset(&dev->mt76);
-
- return err;
- }
-@@ -459,21 +468,21 @@ static int mt7921_pci_resume(struct device *device)
- {
- struct pci_dev *pdev = to_pci_dev(device);
- struct mt76_dev *mdev = pci_get_drvdata(pdev);
-- struct mt7921_dev *dev = container_of(mdev, struct mt7921_dev, mt76);
-+ struct mt792x_dev *dev = container_of(mdev, struct mt792x_dev, mt76);
- struct mt76_connac_pm *pm = &dev->pm;
- int i, err;
-
-- err = mt7921_mcu_drv_pmctrl(dev);
-+ err = mt792x_mcu_drv_pmctrl(dev);
- if (err < 0)
- goto failed;
-
-- mt7921_wpdma_reinit_cond(dev);
-+ mt792x_wpdma_reinit_cond(dev);
-
- /* enable interrupt */
- mt76_wr(dev, MT_PCIE_MAC_INT_ENABLE, 0xff);
- mt76_connac_irq_enable(&dev->mt76,
-- MT_INT_RX_DONE_ALL | MT_INT_TX_DONE_ALL |
-- MT_INT_MCU_CMD);
-+ dev->irq_map->tx.all_complete_mask |
-+ MT_INT_RX_DONE_ALL | MT_INT_MCU_CMD);
- mt76_set(dev, MT_MCU2HOST_SW_INT_ENA, MT_MCU_CMD_WAKE_RX_PCIE);
-
- /* put dma enabled */
-@@ -500,7 +509,7 @@ failed:
- pm->suspended = false;
-
- if (err < 0)
-- mt7921_reset(&dev->mt76);
-+ mt792x_reset(&dev->mt76);
-
- return err;
- }
-diff --git a/mt7921/pci_mac.c b/mt7921/pci_mac.c
-index 978c90a0..e7a995e7 100644
---- a/mt7921/pci_mac.c
-+++ b/mt7921/pci_mac.c
-@@ -10,7 +10,7 @@ int mt7921e_tx_prepare_skb(struct mt76_dev *mdev, void *txwi_ptr,
- struct ieee80211_sta *sta,
- struct mt76_tx_info *tx_info)
- {
-- struct mt7921_dev *dev = container_of(mdev, struct mt7921_dev, mt76);
-+ struct mt792x_dev *dev = container_of(mdev, struct mt792x_dev, mt76);
- struct ieee80211_tx_info *info = IEEE80211_SKB_CB(tx_info->skb);
- struct ieee80211_key_conf *key = info->control.hw_key;
- struct mt76_connac_hw_txp *txp;
-@@ -32,7 +32,7 @@ int mt7921e_tx_prepare_skb(struct mt76_dev *mdev, void *txwi_ptr,
- return id;
-
- if (sta) {
-- struct mt7921_sta *msta = (struct mt7921_sta *)sta->drv_priv;
-+ struct mt792x_sta *msta = (struct mt792x_sta *)sta->drv_priv;
-
- if (time_after(jiffies, msta->last_txs + HZ / 4)) {
- info->flags |= IEEE80211_TX_CTL_REQ_TX_STATUS;
-@@ -53,15 +53,15 @@ int mt7921e_tx_prepare_skb(struct mt76_dev *mdev, void *txwi_ptr,
- return 0;
- }
-
--int mt7921e_mac_reset(struct mt7921_dev *dev)
-+int mt7921e_mac_reset(struct mt792x_dev *dev)
- {
- int i, err;
-
-- mt7921e_mcu_drv_pmctrl(dev);
-+ mt792xe_mcu_drv_pmctrl(dev);
-
- mt76_connac_free_pending_tx_skbs(&dev->pm, NULL);
-
-- mt76_wr(dev, MT_WFDMA0_HOST_INT_ENA, 0);
-+ mt76_wr(dev, dev->irq_map->host_irq_enable, 0);
- mt76_wr(dev, MT_PCIE_MAC_INT_ENABLE, 0x0);
-
- set_bit(MT76_RESET, &dev->mphy.state);
-@@ -80,7 +80,7 @@ int mt7921e_mac_reset(struct mt7921_dev *dev)
- mt76_connac2_tx_token_put(&dev->mt76);
- idr_init(&dev->mt76.token);
-
-- mt7921_wpdma_reset(dev, true);
-+ mt792x_wpdma_reset(dev, true);
-
- local_bh_disable();
- mt76_for_each_q_rx(&dev->mt76, i) {
-@@ -92,9 +92,9 @@ int mt7921e_mac_reset(struct mt7921_dev *dev)
- dev->fw_assert = false;
- clear_bit(MT76_MCU_RESET, &dev->mphy.state);
-
-- mt76_wr(dev, MT_WFDMA0_HOST_INT_ENA,
-- MT_INT_RX_DONE_ALL | MT_INT_TX_DONE_ALL |
-- MT_INT_MCU_CMD);
-+ mt76_wr(dev, dev->irq_map->host_irq_enable,
-+ dev->irq_map->tx.all_complete_mask |
-+ MT_INT_RX_DONE_ALL | MT_INT_MCU_CMD);
- mt76_wr(dev, MT_PCIE_MAC_INT_ENABLE, 0xff);
-
- err = mt7921e_driver_own(dev);
-diff --git a/mt7921/pci_mcu.c b/mt7921/pci_mcu.c
-index 1aefbb6c..4cf1f2f0 100644
---- a/mt7921/pci_mcu.c
-+++ b/mt7921/pci_mcu.c
-@@ -4,7 +4,7 @@
- #include "mt7921.h"
- #include "mcu.h"
-
--int mt7921e_driver_own(struct mt7921_dev *dev)
-+int mt7921e_driver_own(struct mt792x_dev *dev)
- {
- u32 reg = mt7921_reg_map_l1(dev, MT_TOP_LPCR_HOST_BAND0);
-
-@@ -22,7 +22,7 @@ static int
- mt7921_mcu_send_message(struct mt76_dev *mdev, struct sk_buff *skb,
- int cmd, int *seq)
- {
-- struct mt7921_dev *dev = container_of(mdev, struct mt7921_dev, mt76);
-+ struct mt792x_dev *dev = container_of(mdev, struct mt792x_dev, mt76);
- enum mt76_mcuq_id txq = MT_MCUQ_WM;
- int ret;
-
-@@ -38,7 +38,7 @@ mt7921_mcu_send_message(struct mt76_dev *mdev, struct sk_buff *skb,
- return mt76_tx_queue_skb_raw(dev, mdev->q_mcu[txq], skb, 0);
- }
-
--int mt7921e_mcu_init(struct mt7921_dev *dev)
-+int mt7921e_mcu_init(struct mt792x_dev *dev)
- {
- static const struct mt76_mcu_ops mt7921_mcu_ops = {
- .headroom = sizeof(struct mt76_connac2_mcu_txd),
-@@ -61,68 +61,3 @@ int mt7921e_mcu_init(struct mt7921_dev *dev)
-
- return err;
- }
--
--int __mt7921e_mcu_drv_pmctrl(struct mt7921_dev *dev)
--{
-- int i, err = 0;
--
-- for (i = 0; i < MT7921_DRV_OWN_RETRY_COUNT; i++) {
-- mt76_wr(dev, MT_CONN_ON_LPCTL, PCIE_LPCR_HOST_CLR_OWN);
-- if (mt76_poll_msec_tick(dev, MT_CONN_ON_LPCTL,
-- PCIE_LPCR_HOST_OWN_SYNC, 0, 50, 1))
-- break;
-- }
--
-- if (i == MT7921_DRV_OWN_RETRY_COUNT) {
-- dev_err(dev->mt76.dev, "driver own failed\n");
-- err = -EIO;
-- }
--
-- return err;
--}
--
--int mt7921e_mcu_drv_pmctrl(struct mt7921_dev *dev)
--{
-- struct mt76_phy *mphy = &dev->mt76.phy;
-- struct mt76_connac_pm *pm = &dev->pm;
-- int err;
--
-- err = __mt7921e_mcu_drv_pmctrl(dev);
-- if (err < 0)
-- goto out;
--
-- mt7921_wpdma_reinit_cond(dev);
-- clear_bit(MT76_STATE_PM, &mphy->state);
--
-- pm->stats.last_wake_event = jiffies;
-- pm->stats.doze_time += pm->stats.last_wake_event -
-- pm->stats.last_doze_event;
--out:
-- return err;
--}
--
--int mt7921e_mcu_fw_pmctrl(struct mt7921_dev *dev)
--{
-- struct mt76_phy *mphy = &dev->mt76.phy;
-- struct mt76_connac_pm *pm = &dev->pm;
-- int i;
--
-- for (i = 0; i < MT7921_DRV_OWN_RETRY_COUNT; i++) {
-- mt76_wr(dev, MT_CONN_ON_LPCTL, PCIE_LPCR_HOST_SET_OWN);
-- if (mt76_poll_msec_tick(dev, MT_CONN_ON_LPCTL,
-- PCIE_LPCR_HOST_OWN_SYNC, 4, 50, 1))
-- break;
-- }
--
-- if (i == MT7921_DRV_OWN_RETRY_COUNT) {
-- dev_err(dev->mt76.dev, "firmware own failed\n");
-- clear_bit(MT76_STATE_PM, &mphy->state);
-- return -EIO;
-- }
--
-- pm->stats.last_doze_event = jiffies;
-- pm->stats.awake_time += pm->stats.last_doze_event -
-- pm->stats.last_wake_event;
--
-- return 0;
--}
-diff --git a/mt7921/regs.h b/mt7921/regs.h
-index b1801425..43427a3a 100644
---- a/mt7921/regs.h
-+++ b/mt7921/regs.h
-@@ -4,26 +4,7 @@
- #ifndef __MT7921_REGS_H
- #define __MT7921_REGS_H
-
--/* MCU WFDMA1 */
--#define MT_MCU_WFDMA1_BASE 0x3000
--#define MT_MCU_WFDMA1(ofs) (MT_MCU_WFDMA1_BASE + (ofs))
--
--#define MT_MCU_INT_EVENT MT_MCU_WFDMA1(0x108)
--#define MT_MCU_INT_EVENT_DMA_STOPPED BIT(0)
--#define MT_MCU_INT_EVENT_DMA_INIT BIT(1)
--#define MT_MCU_INT_EVENT_SER_TRIGGER BIT(2)
--#define MT_MCU_INT_EVENT_RESET_DONE BIT(3)
--
--#define MT_PLE_BASE 0x820c0000
--#define MT_PLE(ofs) (MT_PLE_BASE + (ofs))
--
--#define MT_PLE_FL_Q0_CTRL MT_PLE(0x3e0)
--#define MT_PLE_FL_Q1_CTRL MT_PLE(0x3e4)
--#define MT_PLE_FL_Q2_CTRL MT_PLE(0x3e8)
--#define MT_PLE_FL_Q3_CTRL MT_PLE(0x3ec)
--
--#define MT_PLE_AC_QEMPTY(_n) MT_PLE(0x500 + 0x40 * (_n))
--#define MT_PLE_AMSDU_PACK_MSDU_CNT(n) MT_PLE(0x10e0 + ((n) << 2))
-+#include "../mt792x_regs.h"
-
- #define MT_MDP_BASE 0x820cd000
- #define MT_MDP(ofs) (MT_MDP_BASE + (ofs))
-@@ -47,279 +28,7 @@
- #define MT_MDP_TO_HIF 0
- #define MT_MDP_TO_WM 1
-
--/* TMAC: band 0(0x21000), band 1(0xa1000) */
--#define MT_WF_TMAC_BASE(_band) ((_band) ? 0x820f4000 : 0x820e4000)
--#define MT_WF_TMAC(_band, ofs) (MT_WF_TMAC_BASE(_band) + (ofs))
--
--#define MT_TMAC_TCR0(_band) MT_WF_TMAC(_band, 0)
--#define MT_TMAC_TCR0_TBTT_STOP_CTRL BIT(25)
--
--#define MT_TMAC_CDTR(_band) MT_WF_TMAC(_band, 0x090)
--#define MT_TMAC_ODTR(_band) MT_WF_TMAC(_band, 0x094)
--#define MT_TIMEOUT_VAL_PLCP GENMASK(15, 0)
--#define MT_TIMEOUT_VAL_CCA GENMASK(31, 16)
--
--#define MT_TMAC_ICR0(_band) MT_WF_TMAC(_band, 0x0a4)
--#define MT_IFS_EIFS GENMASK(8, 0)
--#define MT_IFS_RIFS GENMASK(14, 10)
--#define MT_IFS_SIFS GENMASK(22, 16)
--#define MT_IFS_SLOT GENMASK(30, 24)
--
--#define MT_TMAC_CTCR0(_band) MT_WF_TMAC(_band, 0x0f4)
--#define MT_TMAC_CTCR0_INS_DDLMT_REFTIME GENMASK(5, 0)
--#define MT_TMAC_CTCR0_INS_DDLMT_EN BIT(17)
--#define MT_TMAC_CTCR0_INS_DDLMT_VHT_SMPDU_EN BIT(18)
--
--#define MT_TMAC_TRCR0(_band) MT_WF_TMAC(_band, 0x09c)
--#define MT_TMAC_TFCR0(_band) MT_WF_TMAC(_band, 0x1e0)
--
--#define MT_WF_DMA_BASE(_band) ((_band) ? 0x820f7000 : 0x820e7000)
--#define MT_WF_DMA(_band, ofs) (MT_WF_DMA_BASE(_band) + (ofs))
--
--#define MT_DMA_DCR0(_band) MT_WF_DMA(_band, 0x000)
--#define MT_DMA_DCR0_MAX_RX_LEN GENMASK(15, 3)
--#define MT_DMA_DCR0_RXD_G5_EN BIT(23)
--
--/* WTBLOFF TOP: band 0(0x820e9000),band 1(0x820f9000) */
--#define MT_WTBLOFF_TOP_BASE(_band) ((_band) ? 0x820f9000 : 0x820e9000)
--#define MT_WTBLOFF_TOP(_band, ofs) (MT_WTBLOFF_TOP_BASE(_band) + (ofs))
--
--#define MT_WTBLOFF_TOP_RSCR(_band) MT_WTBLOFF_TOP(_band, 0x008)
--#define MT_WTBLOFF_TOP_RSCR_RCPI_MODE GENMASK(31, 30)
--#define MT_WTBLOFF_TOP_RSCR_RCPI_PARAM GENMASK(25, 24)
--
--/* LPON: band 0(0x24200), band 1(0xa4200) */
--#define MT_WF_LPON_BASE(_band) ((_band) ? 0x820fb000 : 0x820eb000)
--#define MT_WF_LPON(_band, ofs) (MT_WF_LPON_BASE(_band) + (ofs))
--
--#define MT_LPON_UTTR0(_band) MT_WF_LPON(_band, 0x080)
--#define MT_LPON_UTTR1(_band) MT_WF_LPON(_band, 0x084)
--
--#define MT_LPON_TCR(_band, n) MT_WF_LPON(_band, 0x0a8 + (n) * 4)
--#define MT_LPON_TCR_SW_MODE GENMASK(1, 0)
--#define MT_LPON_TCR_SW_WRITE BIT(0)
--
--/* ETBF: band 0(0x24000), band 1(0xa4000) */
--#define MT_WF_ETBF_BASE(_band) ((_band) ? 0x820fa000 : 0x820ea000)
--#define MT_WF_ETBF(_band, ofs) (MT_WF_ETBF_BASE(_band) + (ofs))
--
--#define MT_ETBF_TX_APP_CNT(_band) MT_WF_ETBF(_band, 0x150)
--#define MT_ETBF_TX_IBF_CNT GENMASK(31, 16)
--#define MT_ETBF_TX_EBF_CNT GENMASK(15, 0)
--
--#define MT_ETBF_RX_FB_CNT(_band) MT_WF_ETBF(_band, 0x158)
--#define MT_ETBF_RX_FB_ALL GENMASK(31, 24)
--#define MT_ETBF_RX_FB_HE GENMASK(23, 16)
--#define MT_ETBF_RX_FB_VHT GENMASK(15, 8)
--#define MT_ETBF_RX_FB_HT GENMASK(7, 0)
--
--/* MIB: band 0(0x24800), band 1(0xa4800) */
--#define MT_WF_MIB_BASE(_band) ((_band) ? 0x820fd000 : 0x820ed000)
--#define MT_WF_MIB(_band, ofs) (MT_WF_MIB_BASE(_band) + (ofs))
--
--#define MT_MIB_SCR1(_band) MT_WF_MIB(_band, 0x004)
--#define MT_MIB_TXDUR_EN BIT(8)
--#define MT_MIB_RXDUR_EN BIT(9)
--
--#define MT_MIB_SDR3(_band) MT_WF_MIB(_band, 0x698)
--#define MT_MIB_SDR3_FCS_ERR_MASK GENMASK(31, 16)
--
--#define MT_MIB_SDR5(_band) MT_WF_MIB(_band, 0x780)
--
--#define MT_MIB_SDR9(_band) MT_WF_MIB(_band, 0x02c)
--#define MT_MIB_SDR9_BUSY_MASK GENMASK(23, 0)
--
--#define MT_MIB_SDR12(_band) MT_WF_MIB(_band, 0x558)
--#define MT_MIB_SDR14(_band) MT_WF_MIB(_band, 0x564)
--#define MT_MIB_SDR15(_band) MT_WF_MIB(_band, 0x568)
--
--#define MT_MIB_SDR16(_band) MT_WF_MIB(_band, 0x048)
--#define MT_MIB_SDR16_BUSY_MASK GENMASK(23, 0)
--
--#define MT_MIB_SDR22(_band) MT_WF_MIB(_band, 0x770)
--#define MT_MIB_SDR23(_band) MT_WF_MIB(_band, 0x774)
--#define MT_MIB_SDR31(_band) MT_WF_MIB(_band, 0x55c)
--
--#define MT_MIB_SDR32(_band) MT_WF_MIB(_band, 0x7a8)
--#define MT_MIB_SDR9_IBF_CNT_MASK GENMASK(31, 16)
--#define MT_MIB_SDR9_EBF_CNT_MASK GENMASK(15, 0)
--
--#define MT_MIB_SDR34(_band) MT_WF_MIB(_band, 0x090)
--#define MT_MIB_MU_BF_TX_CNT GENMASK(15, 0)
--
--#define MT_MIB_SDR36(_band) MT_WF_MIB(_band, 0x054)
--#define MT_MIB_SDR36_TXTIME_MASK GENMASK(23, 0)
--#define MT_MIB_SDR37(_band) MT_WF_MIB(_band, 0x058)
--#define MT_MIB_SDR37_RXTIME_MASK GENMASK(23, 0)
--
--#define MT_MIB_DR8(_band) MT_WF_MIB(_band, 0x0c0)
--#define MT_MIB_DR9(_band) MT_WF_MIB(_band, 0x0c4)
--#define MT_MIB_DR11(_band) MT_WF_MIB(_band, 0x0cc)
--
--#define MT_MIB_MB_SDR0(_band, n) MT_WF_MIB(_band, 0x100 + ((n) << 4))
--#define MT_MIB_RTS_RETRIES_COUNT_MASK GENMASK(31, 16)
--
--#define MT_MIB_MB_BSDR0(_band) MT_WF_MIB(_band, 0x688)
--#define MT_MIB_RTS_COUNT_MASK GENMASK(15, 0)
--#define MT_MIB_MB_BSDR1(_band) MT_WF_MIB(_band, 0x690)
--#define MT_MIB_RTS_FAIL_COUNT_MASK GENMASK(15, 0)
--#define MT_MIB_MB_BSDR2(_band) MT_WF_MIB(_band, 0x518)
--#define MT_MIB_BA_FAIL_COUNT_MASK GENMASK(15, 0)
--#define MT_MIB_MB_BSDR3(_band) MT_WF_MIB(_band, 0x520)
--#define MT_MIB_ACK_FAIL_COUNT_MASK GENMASK(15, 0)
--
--#define MT_MIB_MB_SDR2(_band, n) MT_WF_MIB(_band, 0x108 + ((n) << 4))
--#define MT_MIB_FRAME_RETRIES_COUNT_MASK GENMASK(15, 0)
--
--#define MT_TX_AGG_CNT(_band, n) MT_WF_MIB(_band, 0x7dc + ((n) << 2))
--#define MT_TX_AGG_CNT2(_band, n) MT_WF_MIB(_band, 0x7ec + ((n) << 2))
--#define MT_MIB_ARNG(_band, n) MT_WF_MIB(_band, 0x0b0 + ((n) << 2))
--#define MT_MIB_ARNCR_RANGE(val, n) (((val) >> ((n) << 3)) & GENMASK(7, 0))
--
--#define MT_WTBLON_TOP_BASE 0x820d4000
--#define MT_WTBLON_TOP(ofs) (MT_WTBLON_TOP_BASE + (ofs))
--#define MT_WTBLON_TOP_WDUCR MT_WTBLON_TOP(0x200)
--#define MT_WTBLON_TOP_WDUCR_GROUP GENMASK(2, 0)
--
--#define MT_WTBL_UPDATE MT_WTBLON_TOP(0x230)
--#define MT_WTBL_UPDATE_WLAN_IDX GENMASK(9, 0)
--#define MT_WTBL_UPDATE_ADM_COUNT_CLEAR BIT(12)
--#define MT_WTBL_UPDATE_BUSY BIT(31)
--
--#define MT_WTBL_BASE 0x820d8000
--#define MT_WTBL_LMAC_ID GENMASK(14, 8)
--#define MT_WTBL_LMAC_DW GENMASK(7, 2)
--#define MT_WTBL_LMAC_OFFS(_id, _dw) (MT_WTBL_BASE | \
-- FIELD_PREP(MT_WTBL_LMAC_ID, _id) | \
-- FIELD_PREP(MT_WTBL_LMAC_DW, _dw))
--
--/* AGG: band 0(0x20800), band 1(0xa0800) */
--#define MT_WF_AGG_BASE(_band) ((_band) ? 0x820f2000 : 0x820e2000)
--#define MT_WF_AGG(_band, ofs) (MT_WF_AGG_BASE(_band) + (ofs))
--
--#define MT_AGG_AWSCR0(_band, _n) MT_WF_AGG(_band, 0x05c + (_n) * 4)
--#define MT_AGG_PCR0(_band, _n) MT_WF_AGG(_band, 0x06c + (_n) * 4)
--#define MT_AGG_PCR0_MM_PROT BIT(0)
--#define MT_AGG_PCR0_GF_PROT BIT(1)
--#define MT_AGG_PCR0_BW20_PROT BIT(2)
--#define MT_AGG_PCR0_BW40_PROT BIT(4)
--#define MT_AGG_PCR0_BW80_PROT BIT(6)
--#define MT_AGG_PCR0_ERP_PROT GENMASK(12, 8)
--#define MT_AGG_PCR0_VHT_PROT BIT(13)
--#define MT_AGG_PCR0_PTA_WIN_DIS BIT(15)
--
--#define MT_AGG_PCR1_RTS0_NUM_THRES GENMASK(31, 23)
--#define MT_AGG_PCR1_RTS0_LEN_THRES GENMASK(19, 0)
--
--#define MT_AGG_ACR0(_band) MT_WF_AGG(_band, 0x084)
--#define MT_AGG_ACR_CFEND_RATE GENMASK(13, 0)
--#define MT_AGG_ACR_BAR_RATE GENMASK(29, 16)
--
--#define MT_AGG_MRCR(_band) MT_WF_AGG(_band, 0x098)
--#define MT_AGG_MRCR_BAR_CNT_LIMIT GENMASK(15, 12)
--#define MT_AGG_MRCR_LAST_RTS_CTS_RN BIT(6)
--#define MT_AGG_MRCR_RTS_FAIL_LIMIT GENMASK(11, 7)
--#define MT_AGG_MRCR_TXCMD_RTS_FAIL_LIMIT GENMASK(28, 24)
--
--#define MT_AGG_ATCR1(_band) MT_WF_AGG(_band, 0x0f0)
--#define MT_AGG_ATCR3(_band) MT_WF_AGG(_band, 0x0f4)
--
--/* ARB: band 0(0x20c00), band 1(0xa0c00) */
--#define MT_WF_ARB_BASE(_band) ((_band) ? 0x820f3000 : 0x820e3000)
--#define MT_WF_ARB(_band, ofs) (MT_WF_ARB_BASE(_band) + (ofs))
--
--#define MT_ARB_SCR(_band) MT_WF_ARB(_band, 0x080)
--#define MT_ARB_SCR_TX_DISABLE BIT(8)
--#define MT_ARB_SCR_RX_DISABLE BIT(9)
--
--#define MT_ARB_DRNGR0(_band, _n) MT_WF_ARB(_band, 0x194 + (_n) * 4)
--
--/* RMAC: band 0(0x21400), band 1(0xa1400) */
--#define MT_WF_RMAC_BASE(_band) ((_band) ? 0x820f5000 : 0x820e5000)
--#define MT_WF_RMAC(_band, ofs) (MT_WF_RMAC_BASE(_band) + (ofs))
--
--#define MT_WF_RFCR(_band) MT_WF_RMAC(_band, 0x000)
--#define MT_WF_RFCR_DROP_STBC_MULTI BIT(0)
--#define MT_WF_RFCR_DROP_FCSFAIL BIT(1)
--#define MT_WF_RFCR_DROP_VERSION BIT(3)
--#define MT_WF_RFCR_DROP_PROBEREQ BIT(4)
--#define MT_WF_RFCR_DROP_MCAST BIT(5)
--#define MT_WF_RFCR_DROP_BCAST BIT(6)
--#define MT_WF_RFCR_DROP_MCAST_FILTERED BIT(7)
--#define MT_WF_RFCR_DROP_A3_MAC BIT(8)
--#define MT_WF_RFCR_DROP_A3_BSSID BIT(9)
--#define MT_WF_RFCR_DROP_A2_BSSID BIT(10)
--#define MT_WF_RFCR_DROP_OTHER_BEACON BIT(11)
--#define MT_WF_RFCR_DROP_FRAME_REPORT BIT(12)
--#define MT_WF_RFCR_DROP_CTL_RSV BIT(13)
--#define MT_WF_RFCR_DROP_CTS BIT(14)
--#define MT_WF_RFCR_DROP_RTS BIT(15)
--#define MT_WF_RFCR_DROP_DUPLICATE BIT(16)
--#define MT_WF_RFCR_DROP_OTHER_BSS BIT(17)
--#define MT_WF_RFCR_DROP_OTHER_UC BIT(18)
--#define MT_WF_RFCR_DROP_OTHER_TIM BIT(19)
--#define MT_WF_RFCR_DROP_NDPA BIT(20)
--#define MT_WF_RFCR_DROP_UNWANTED_CTL BIT(21)
--
--#define MT_WF_RFCR1(_band) MT_WF_RMAC(_band, 0x004)
--#define MT_WF_RFCR1_DROP_ACK BIT(4)
--#define MT_WF_RFCR1_DROP_BF_POLL BIT(5)
--#define MT_WF_RFCR1_DROP_BA BIT(6)
--#define MT_WF_RFCR1_DROP_CFEND BIT(7)
--#define MT_WF_RFCR1_DROP_CFACK BIT(8)
--
--#define MT_WF_RMAC_MIB_TIME0(_band) MT_WF_RMAC(_band, 0x03c4)
--#define MT_WF_RMAC_MIB_RXTIME_CLR BIT(31)
--#define MT_WF_RMAC_MIB_RXTIME_EN BIT(30)
--
--#define MT_WF_RMAC_MIB_AIRTIME14(_band) MT_WF_RMAC(_band, 0x03b8)
--#define MT_MIB_OBSSTIME_MASK GENMASK(23, 0)
--#define MT_WF_RMAC_MIB_AIRTIME0(_band) MT_WF_RMAC(_band, 0x0380)
--
--/* WFDMA0 */
--#define MT_WFDMA0_BASE 0xd4000
--#define MT_WFDMA0(ofs) (MT_WFDMA0_BASE + (ofs))
--
--#define MT_WFDMA0_RST MT_WFDMA0(0x100)
--#define MT_WFDMA0_RST_LOGIC_RST BIT(4)
--#define MT_WFDMA0_RST_DMASHDL_ALL_RST BIT(5)
--
--#define MT_WFDMA0_BUSY_ENA MT_WFDMA0(0x13c)
--#define MT_WFDMA0_BUSY_ENA_TX_FIFO0 BIT(0)
--#define MT_WFDMA0_BUSY_ENA_TX_FIFO1 BIT(1)
--#define MT_WFDMA0_BUSY_ENA_RX_FIFO BIT(2)
--
--#define MT_MCU_CMD MT_WFDMA0(0x1f0)
--#define MT_MCU_CMD_WAKE_RX_PCIE BIT(0)
--#define MT_MCU_CMD_STOP_DMA_FW_RELOAD BIT(1)
--#define MT_MCU_CMD_STOP_DMA BIT(2)
--#define MT_MCU_CMD_RESET_DONE BIT(3)
--#define MT_MCU_CMD_RECOVERY_DONE BIT(4)
--#define MT_MCU_CMD_NORMAL_STATE BIT(5)
--#define MT_MCU_CMD_ERROR_MASK GENMASK(5, 1)
--
--#define MT_MCU2HOST_SW_INT_ENA MT_WFDMA0(0x1f4)
--
--#define MT_WFDMA0_HOST_INT_STA MT_WFDMA0(0x200)
--#define HOST_RX_DONE_INT_STS0 BIT(0) /* Rx mcu */
--#define HOST_RX_DONE_INT_STS2 BIT(2) /* Rx data */
--#define HOST_RX_DONE_INT_STS4 BIT(22) /* Rx mcu after fw downloaded */
--#define HOST_TX_DONE_INT_STS16 BIT(26)
--#define HOST_TX_DONE_INT_STS17 BIT(27) /* MCU tx done*/
--
- #define MT_WFDMA0_HOST_INT_ENA MT_WFDMA0(0x204)
--#define HOST_RX_DONE_INT_ENA0 BIT(0)
--#define HOST_RX_DONE_INT_ENA1 BIT(1)
--#define HOST_RX_DONE_INT_ENA2 BIT(2)
--#define HOST_RX_DONE_INT_ENA3 BIT(3)
--#define HOST_TX_DONE_INT_ENA0 BIT(4)
--#define HOST_TX_DONE_INT_ENA1 BIT(5)
--#define HOST_TX_DONE_INT_ENA2 BIT(6)
--#define HOST_TX_DONE_INT_ENA3 BIT(7)
--#define HOST_TX_DONE_INT_ENA4 BIT(8)
--#define HOST_TX_DONE_INT_ENA5 BIT(9)
--#define HOST_TX_DONE_INT_ENA6 BIT(10)
--#define HOST_TX_DONE_INT_ENA7 BIT(11)
- #define HOST_TX_DONE_INT_ENA8 BIT(12)
- #define HOST_TX_DONE_INT_ENA9 BIT(13)
- #define HOST_TX_DONE_INT_ENA10 BIT(14)
-@@ -327,14 +36,10 @@
- #define HOST_TX_DONE_INT_ENA12 BIT(16)
- #define HOST_TX_DONE_INT_ENA13 BIT(17)
- #define HOST_TX_DONE_INT_ENA14 BIT(18)
--#define HOST_RX_COHERENT_EN BIT(20)
--#define HOST_TX_COHERENT_EN BIT(21)
- #define HOST_RX_DONE_INT_ENA4 BIT(22)
- #define HOST_RX_DONE_INT_ENA5 BIT(23)
- #define HOST_TX_DONE_INT_ENA16 BIT(26)
- #define HOST_TX_DONE_INT_ENA17 BIT(27)
--#define MCU2HOST_SW_INT_ENA BIT(29)
--#define HOST_TX_DONE_INT_ENA18 BIT(30)
-
- /* WFDMA interrupt */
- #define MT_INT_RX_DONE_DATA HOST_RX_DONE_INT_ENA2
-@@ -346,7 +51,6 @@
- #define MT_INT_TX_DONE_MCU_WM HOST_TX_DONE_INT_ENA17
- #define MT_INT_TX_DONE_FWDL HOST_TX_DONE_INT_ENA16
- #define MT_INT_TX_DONE_BAND0 HOST_TX_DONE_INT_ENA0
--#define MT_INT_MCU_CMD MCU2HOST_SW_INT_ENA
-
- #define MT_INT_TX_DONE_MCU (MT_INT_TX_DONE_MCU_WM | \
- MT_INT_TX_DONE_FWDL)
-@@ -354,56 +58,8 @@
- MT_INT_TX_DONE_BAND0 | \
- GENMASK(18, 4))
-
--#define MT_WFDMA0_GLO_CFG MT_WFDMA0(0x208)
--#define MT_WFDMA0_GLO_CFG_TX_DMA_EN BIT(0)
--#define MT_WFDMA0_GLO_CFG_TX_DMA_BUSY BIT(1)
--#define MT_WFDMA0_GLO_CFG_RX_DMA_EN BIT(2)
--#define MT_WFDMA0_GLO_CFG_RX_DMA_BUSY BIT(3)
--#define MT_WFDMA0_GLO_CFG_TX_WB_DDONE BIT(6)
--#define MT_WFDMA0_GLO_CFG_FW_DWLD_BYPASS_DMASHDL BIT(9)
--#define MT_WFDMA0_GLO_CFG_FIFO_LITTLE_ENDIAN BIT(12)
--#define MT_WFDMA0_GLO_CFG_CSR_DISP_BASE_PTR_CHAIN_EN BIT(15)
--#define MT_WFDMA0_GLO_CFG_OMIT_RX_INFO_PFET2 BIT(21)
--#define MT_WFDMA0_GLO_CFG_OMIT_RX_INFO BIT(27)
--#define MT_WFDMA0_GLO_CFG_OMIT_TX_INFO BIT(28)
--#define MT_WFDMA0_GLO_CFG_CLK_GAT_DIS BIT(30)
--
--#define MT_WFDMA0_RST_DTX_PTR MT_WFDMA0(0x20c)
--#define MT_WFDMA0_GLO_CFG_EXT0 MT_WFDMA0(0x2b0)
--#define MT_WFDMA0_CSR_TX_DMASHDL_ENABLE BIT(6)
--#define MT_WFDMA0_PRI_DLY_INT_CFG0 MT_WFDMA0(0x2f0)
--
- #define MT_RX_DATA_RING_BASE MT_WFDMA0(0x520)
-
--#define MT_WFDMA0_TX_RING0_EXT_CTRL MT_WFDMA0(0x600)
--#define MT_WFDMA0_TX_RING1_EXT_CTRL MT_WFDMA0(0x604)
--#define MT_WFDMA0_TX_RING2_EXT_CTRL MT_WFDMA0(0x608)
--#define MT_WFDMA0_TX_RING3_EXT_CTRL MT_WFDMA0(0x60c)
--#define MT_WFDMA0_TX_RING4_EXT_CTRL MT_WFDMA0(0x610)
--#define MT_WFDMA0_TX_RING5_EXT_CTRL MT_WFDMA0(0x614)
--#define MT_WFDMA0_TX_RING6_EXT_CTRL MT_WFDMA0(0x618)
--#define MT_WFDMA0_TX_RING16_EXT_CTRL MT_WFDMA0(0x640)
--#define MT_WFDMA0_TX_RING17_EXT_CTRL MT_WFDMA0(0x644)
--
--#define MT_WPDMA0_MAX_CNT_MASK GENMASK(7, 0)
--#define MT_WPDMA0_BASE_PTR_MASK GENMASK(31, 16)
--
--#define MT_WFDMA0_RX_RING0_EXT_CTRL MT_WFDMA0(0x680)
--#define MT_WFDMA0_RX_RING1_EXT_CTRL MT_WFDMA0(0x684)
--#define MT_WFDMA0_RX_RING2_EXT_CTRL MT_WFDMA0(0x688)
--#define MT_WFDMA0_RX_RING3_EXT_CTRL MT_WFDMA0(0x68c)
--#define MT_WFDMA0_RX_RING4_EXT_CTRL MT_WFDMA0(0x690)
--#define MT_WFDMA0_RX_RING5_EXT_CTRL MT_WFDMA0(0x694)
--
--#define MT_TX_RING_BASE MT_WFDMA0(0x300)
--#define MT_RX_EVENT_RING_BASE MT_WFDMA0(0x500)
--
--/* WFDMA CSR */
--#define MT_WFDMA_EXT_CSR_BASE 0xd7000
--#define MT_WFDMA_EXT_CSR(ofs) (MT_WFDMA_EXT_CSR_BASE + (ofs))
--#define MT_WFDMA_EXT_CSR_HIF_MISC MT_WFDMA_EXT_CSR(0x44)
--#define MT_WFDMA_EXT_CSR_HIF_MISC_BUSY BIT(0)
--
- #define MT_INFRA_CFG_BASE 0xfe000
- #define MT_INFRA(ofs) (MT_INFRA_CFG_BASE + (ofs))
-
-@@ -413,121 +69,13 @@
- #define MT_HIF_REMAP_L1_BASE GENMASK(31, 16)
- #define MT_HIF_REMAP_BASE_L1 0x40000
-
--#define MT_SWDEF_BASE 0x41f200
--#define MT_SWDEF(ofs) (MT_SWDEF_BASE + (ofs))
--#define MT_SWDEF_MODE MT_SWDEF(0x3c)
--#define MT_SWDEF_NORMAL_MODE 0
--#define MT_SWDEF_ICAP_MODE 1
--#define MT_SWDEF_SPECTRUM_MODE 2
--
--#define MT_TOP_BASE 0x18060000
--#define MT_TOP(ofs) (MT_TOP_BASE + (ofs))
--
--#define MT_TOP_LPCR_HOST_BAND0 MT_TOP(0x10)
--#define MT_TOP_LPCR_HOST_FW_OWN BIT(0)
--#define MT_TOP_LPCR_HOST_DRV_OWN BIT(1)
--
--#define MT_TOP_MISC MT_TOP(0xf0)
--#define MT_TOP_MISC_FW_STATE GENMASK(2, 0)
--
--#define MT_MCU_WPDMA0_BASE 0x54000000
--#define MT_MCU_WPDMA0(ofs) (MT_MCU_WPDMA0_BASE + (ofs))
--
--#define MT_WFDMA_DUMMY_CR MT_MCU_WPDMA0(0x120)
--#define MT_WFDMA_NEED_REINIT BIT(1)
--
--#define MT_CBTOP_RGU(ofs) (0x70002000 + (ofs))
--#define MT_CBTOP_RGU_WF_SUBSYS_RST MT_CBTOP_RGU(0x600)
--#define MT_CBTOP_RGU_WF_SUBSYS_RST_WF_WHOLE_PATH BIT(0)
--
--#define MT_HW_BOUND 0x70010020
--#define MT_HW_CHIPID 0x70010200
--#define MT_HW_REV 0x70010204
--
--#define MT_PCIE_MAC_BASE 0x10000
--#define MT_PCIE_MAC(ofs) (MT_PCIE_MAC_BASE + (ofs))
--#define MT_PCIE_MAC_INT_ENABLE MT_PCIE_MAC(0x188)
--#define MT_PCIE_MAC_PM MT_PCIE_MAC(0x194)
--#define MT_PCIE_MAC_PM_L0S_DIS BIT(8)
--
--#define MT_DMA_SHDL(ofs) (0x7c026000 + (ofs))
--#define MT_DMASHDL_SW_CONTROL MT_DMA_SHDL(0x004)
--#define MT_DMASHDL_DMASHDL_BYPASS BIT(28)
--#define MT_DMASHDL_OPTIONAL MT_DMA_SHDL(0x008)
--#define MT_DMASHDL_PAGE MT_DMA_SHDL(0x00c)
--#define MT_DMASHDL_GROUP_SEQ_ORDER BIT(16)
--#define MT_DMASHDL_REFILL MT_DMA_SHDL(0x010)
--#define MT_DMASHDL_REFILL_MASK GENMASK(31, 16)
--#define MT_DMASHDL_PKT_MAX_SIZE MT_DMA_SHDL(0x01c)
--#define MT_DMASHDL_PKT_MAX_SIZE_PLE GENMASK(11, 0)
--#define MT_DMASHDL_PKT_MAX_SIZE_PSE GENMASK(27, 16)
--
--#define MT_DMASHDL_GROUP_QUOTA(_n) MT_DMA_SHDL(0x020 + ((_n) << 2))
--#define MT_DMASHDL_GROUP_QUOTA_MIN GENMASK(11, 0)
--#define MT_DMASHDL_GROUP_QUOTA_MAX GENMASK(27, 16)
--
--#define MT_DMASHDL_Q_MAP(_n) MT_DMA_SHDL(0x060 + ((_n) << 2))
--#define MT_DMASHDL_Q_MAP_MASK GENMASK(3, 0)
--#define MT_DMASHDL_Q_MAP_SHIFT(_n) (4 * ((_n) % 8))
--
--#define MT_DMASHDL_SCHED_SET(_n) MT_DMA_SHDL(0x070 + ((_n) << 2))
--
--#define MT_WFDMA_HOST_CONFIG 0x7c027030
--#define MT_WFDMA_HOST_CONFIG_USB_RXEVT_EP4_EN BIT(6)
--
--#define MT_UMAC(ofs) (0x74000000 + (ofs))
--#define MT_UDMA_TX_QSEL MT_UMAC(0x008)
--#define MT_FW_DL_EN BIT(3)
--
--#define MT_UDMA_WLCFG_1 MT_UMAC(0x00c)
--#define MT_WL_RX_AGG_PKT_LMT GENMASK(7, 0)
--#define MT_WL_TX_TMOUT_LMT GENMASK(27, 8)
--
--#define MT_UDMA_WLCFG_0 MT_UMAC(0x18)
--#define MT_WL_RX_AGG_TO GENMASK(7, 0)
--#define MT_WL_RX_AGG_LMT GENMASK(15, 8)
--#define MT_WL_TX_TMOUT_FUNC_EN BIT(16)
--#define MT_WL_TX_DPH_CHK_EN BIT(17)
--#define MT_WL_RX_MPSZ_PAD0 BIT(18)
--#define MT_WL_RX_FLUSH BIT(19)
--#define MT_TICK_1US_EN BIT(20)
--#define MT_WL_RX_AGG_EN BIT(21)
--#define MT_WL_RX_EN BIT(22)
--#define MT_WL_TX_EN BIT(23)
--#define MT_WL_RX_BUSY BIT(30)
--#define MT_WL_TX_BUSY BIT(31)
--
--#define MT_UDMA_CONN_INFRA_STATUS MT_UMAC(0xa20)
--#define MT_UDMA_CONN_WFSYS_INIT_DONE BIT(22)
--#define MT_UDMA_CONN_INFRA_STATUS_SEL MT_UMAC(0xa24)
--
--#define MT_SSUSB_EPCTL_CSR(ofs) (0x74011800 + (ofs))
--#define MT_SSUSB_EPCTL_CSR_EP_RST_OPT MT_SSUSB_EPCTL_CSR(0x090)
--
--#define MT_UWFDMA0(ofs) (0x7c024000 + (ofs))
--#define MT_UWFDMA0_GLO_CFG MT_UWFDMA0(0x208)
--#define MT_UWFDMA0_GLO_CFG_EXT0 MT_UWFDMA0(0x2b0)
--#define MT_UWFDMA0_TX_RING_EXT_CTRL(_n) MT_UWFDMA0(0x600 + ((_n) << 2))
--
--#define MT_CONN_STATUS 0x7c053c10
--#define MT_WIFI_PATCH_DL_STATE BIT(0)
--
--#define MT_CONN_ON_LPCTL 0x7c060010
--#define PCIE_LPCR_HOST_OWN_SYNC BIT(2)
--#define PCIE_LPCR_HOST_CLR_OWN BIT(1)
--#define PCIE_LPCR_HOST_SET_OWN BIT(0)
--
- #define MT_WFSYS_SW_RST_B 0x18000140
--#define WFSYS_SW_RST_B BIT(0)
--#define WFSYS_SW_INIT_DONE BIT(4)
-
--#define MT_CONN_ON_MISC 0x7c0600f0
--#define MT_TOP_MISC2_FW_PWR_ON BIT(0)
--#define MT_TOP_MISC2_FW_N9_RDY GENMASK(1, 0)
-+#define MT_WTBLON_TOP_WDUCR MT_WTBLON_TOP(0x200)
-+#define MT_WTBLON_TOP_WDUCR_GROUP GENMASK(2, 0)
-
--#define MT_WF_SW_DEF_CR(ofs) (0x401a00 + (ofs))
--#define MT_WF_SW_DEF_CR_USB_MCU_EVENT MT_WF_SW_DEF_CR(0x028)
--#define MT_WF_SW_SER_TRIGGER_SUSPEND BIT(6)
--#define MT_WF_SW_SER_DONE_SUSPEND BIT(7)
-+#define MT_WTBL_UPDATE MT_WTBLON_TOP(0x230)
-+#define MT_WTBL_UPDATE_WLAN_IDX GENMASK(9, 0)
-+#define MT_WTBL_UPDATE_ADM_COUNT_CLEAR BIT(12)
-
- #endif
-diff --git a/mt7921/sdio.c b/mt7921/sdio.c
-index e2e4b2c6..b192d2fa 100644
---- a/mt7921/sdio.c
-+++ b/mt7921/sdio.c
-@@ -27,7 +27,7 @@ static void mt7921s_txrx_worker(struct mt76_worker *w)
- struct mt76_sdio *sdio = container_of(w, struct mt76_sdio,
- txrx_worker);
- struct mt76_dev *mdev = container_of(sdio, struct mt76_dev, sdio);
-- struct mt7921_dev *dev = container_of(mdev, struct mt7921_dev, mt76);
-+ struct mt792x_dev *dev = container_of(mdev, struct mt792x_dev, mt76);
-
- if (!mt76_connac_pm_ref(&dev->mphy, &dev->pm)) {
- queue_work(mdev->wq, &dev->pm.wake_work);
-@@ -38,7 +38,7 @@ static void mt7921s_txrx_worker(struct mt76_worker *w)
- mt76_connac_pm_unref(&dev->mphy, &dev->pm);
- }
-
--static void mt7921s_unregister_device(struct mt7921_dev *dev)
-+static void mt7921s_unregister_device(struct mt792x_dev *dev)
- {
- struct mt76_connac_pm *pm = &dev->pm;
-
-@@ -102,7 +102,7 @@ static int mt7921s_probe(struct sdio_func *func,
- .sta_add = mt7921_mac_sta_add,
- .sta_assoc = mt7921_mac_sta_assoc,
- .sta_remove = mt7921_mac_sta_remove,
-- .update_survey = mt7921_update_channel,
-+ .update_survey = mt792x_update_channel,
- };
- static const struct mt76_bus_ops mt7921s_ops = {
- .rr = mt76s_rr,
-@@ -114,7 +114,7 @@ static int mt7921s_probe(struct sdio_func *func,
- .rd_rp = mt76s_rd_rp,
- .type = MT76_BUS_SDIO,
- };
-- static const struct mt7921_hif_ops mt7921_sdio_ops = {
-+ static const struct mt792x_hif_ops mt7921_sdio_ops = {
- .init_reset = mt7921s_init_reset,
- .reset = mt7921s_mac_reset,
- .mcu_init = mt7921s_mcu_init,
-@@ -122,13 +122,13 @@ static int mt7921s_probe(struct sdio_func *func,
- .fw_own = mt7921s_mcu_fw_pmctrl,
- };
- struct ieee80211_ops *ops;
-- struct mt7921_dev *dev;
-+ struct mt792x_dev *dev;
- struct mt76_dev *mdev;
- u8 features;
- int ret;
-
-- ops = mt7921_get_mac80211_ops(&func->dev, (void *)id->driver_data,
-- &features);
-+ ops = mt792x_get_mac80211_ops(&func->dev, &mt7921_ops,
-+ (void *)id->driver_data, &features);
- if (!ops)
- return -ENOMEM;
-
-@@ -136,7 +136,7 @@ static int mt7921s_probe(struct sdio_func *func,
- if (!mdev)
- return -ENOMEM;
-
-- dev = container_of(mdev, struct mt7921_dev, mt76);
-+ dev = container_of(mdev, struct mt792x_dev, mt76);
- dev->fw_features = features;
- dev->hif_ops = &mt7921_sdio_ops;
- sdio_set_drvdata(func, dev);
-@@ -196,7 +196,7 @@ error:
-
- static void mt7921s_remove(struct sdio_func *func)
- {
-- struct mt7921_dev *dev = sdio_get_drvdata(func);
-+ struct mt792x_dev *dev = sdio_get_drvdata(func);
-
- mt7921s_unregister_device(dev);
- }
-@@ -205,7 +205,7 @@ static void mt7921s_remove(struct sdio_func *func)
- static int mt7921s_suspend(struct device *__dev)
- {
- struct sdio_func *func = dev_to_sdio_func(__dev);
-- struct mt7921_dev *dev = sdio_get_drvdata(func);
-+ struct mt792x_dev *dev = sdio_get_drvdata(func);
- struct mt76_connac_pm *pm = &dev->pm;
- struct mt76_dev *mdev = &dev->mt76;
- int err;
-@@ -217,7 +217,7 @@ static int mt7921s_suspend(struct device *__dev)
- cancel_delayed_work_sync(&pm->ps_work);
- cancel_work_sync(&pm->wake_work);
-
-- err = mt7921_mcu_drv_pmctrl(dev);
-+ err = mt792x_mcu_drv_pmctrl(dev);
- if (err < 0)
- goto restore_suspend;
-
-@@ -245,7 +245,7 @@ static int mt7921s_suspend(struct device *__dev)
- mt76_worker_disable(&mdev->sdio.txrx_worker);
- mt76_worker_disable(&mdev->sdio.net_worker);
-
-- err = mt7921_mcu_fw_pmctrl(dev);
-+ err = mt792x_mcu_fw_pmctrl(dev);
- if (err)
- goto restore_txrx_worker;
-
-@@ -270,7 +270,7 @@ restore_suspend:
- pm->suspended = false;
-
- if (err < 0)
-- mt7921_reset(&dev->mt76);
-+ mt792x_reset(&dev->mt76);
-
- return err;
- }
-@@ -278,14 +278,14 @@ restore_suspend:
- static int mt7921s_resume(struct device *__dev)
- {
- struct sdio_func *func = dev_to_sdio_func(__dev);
-- struct mt7921_dev *dev = sdio_get_drvdata(func);
-+ struct mt792x_dev *dev = sdio_get_drvdata(func);
- struct mt76_connac_pm *pm = &dev->pm;
- struct mt76_dev *mdev = &dev->mt76;
- int err;
-
- clear_bit(MT76_STATE_SUSPEND, &mdev->phy.state);
-
-- err = mt7921_mcu_drv_pmctrl(dev);
-+ err = mt792x_mcu_drv_pmctrl(dev);
- if (err < 0)
- goto failed;
-
-@@ -303,7 +303,7 @@ failed:
- pm->suspended = false;
-
- if (err < 0)
-- mt7921_reset(&dev->mt76);
-+ mt792x_reset(&dev->mt76);
-
- return err;
- }
-diff --git a/mt7921/sdio_mac.c b/mt7921/sdio_mac.c
-index cff9925c..8edd0291 100644
---- a/mt7921/sdio_mac.c
-+++ b/mt7921/sdio_mac.c
-@@ -30,7 +30,7 @@ static u32 mt7921s_read_whcr(struct mt76_dev *dev)
- return sdio_readl(dev->sdio.func, MCR_WHCR, NULL);
- }
-
--int mt7921s_wfsys_reset(struct mt7921_dev *dev)
-+int mt7921s_wfsys_reset(struct mt792x_dev *dev)
- {
- struct mt76_sdio *sdio = &dev->mt76.sdio;
- u32 val, status;
-@@ -71,7 +71,7 @@ int mt7921s_wfsys_reset(struct mt7921_dev *dev)
- return 0;
- }
-
--int mt7921s_init_reset(struct mt7921_dev *dev)
-+int mt7921s_init_reset(struct mt792x_dev *dev)
- {
- set_bit(MT76_MCU_RESET, &dev->mphy.state);
-
-@@ -91,7 +91,7 @@ int mt7921s_init_reset(struct mt7921_dev *dev)
- return 0;
- }
-
--int mt7921s_mac_reset(struct mt7921_dev *dev)
-+int mt7921s_mac_reset(struct mt792x_dev *dev)
- {
- int err;
-
-diff --git a/mt7921/sdio_mcu.c b/mt7921/sdio_mcu.c
-index 177679ce..310eeca0 100644
---- a/mt7921/sdio_mcu.c
-+++ b/mt7921/sdio_mcu.c
-@@ -16,14 +16,14 @@ static int
- mt7921s_mcu_send_message(struct mt76_dev *mdev, struct sk_buff *skb,
- int cmd, int *seq)
- {
-- struct mt7921_dev *dev = container_of(mdev, struct mt7921_dev, mt76);
-+ struct mt792x_dev *dev = container_of(mdev, struct mt792x_dev, mt76);
- enum mt7921_sdio_pkt_type type = MT7921_SDIO_CMD;
- enum mt76_mcuq_id txq = MT_MCUQ_WM;
- int ret, pad;
-
- /* We just return in case firmware assertion to avoid blocking the
- * common workqueue to run, for example, the coredump work might be
-- * blocked by mt7921_mac_work that is excuting register access via sdio
-+ * blocked by mt792x_mac_work that is excuting register access via sdio
- * bus.
- */
- if (dev->fw_assert)
-@@ -51,14 +51,14 @@ mt7921s_mcu_send_message(struct mt76_dev *mdev, struct sk_buff *skb,
- return ret;
- }
-
--static u32 mt7921s_read_rm3r(struct mt7921_dev *dev)
-+static u32 mt7921s_read_rm3r(struct mt792x_dev *dev)
- {
- struct mt76_sdio *sdio = &dev->mt76.sdio;
-
- return sdio_readl(sdio->func, MCR_D2HRM3R, NULL);
- }
-
--static u32 mt7921s_clear_rm3r_drv_own(struct mt7921_dev *dev)
-+static u32 mt7921s_clear_rm3r_drv_own(struct mt792x_dev *dev)
- {
- struct mt76_sdio *sdio = &dev->mt76.sdio;
- u32 val;
-@@ -71,7 +71,7 @@ static u32 mt7921s_clear_rm3r_drv_own(struct mt7921_dev *dev)
- return val;
- }
-
--int mt7921s_mcu_init(struct mt7921_dev *dev)
-+int mt7921s_mcu_init(struct mt792x_dev *dev)
- {
- static const struct mt76_mcu_ops mt7921s_mcu_ops = {
- .headroom = MT_SDIO_HDR_SIZE +
-@@ -97,7 +97,7 @@ int mt7921s_mcu_init(struct mt7921_dev *dev)
- return 0;
- }
-
--int mt7921s_mcu_drv_pmctrl(struct mt7921_dev *dev)
-+int mt7921s_mcu_drv_pmctrl(struct mt792x_dev *dev)
- {
- struct sdio_func *func = dev->mt76.sdio.func;
- struct mt76_phy *mphy = &dev->mt76.phy;
-@@ -133,7 +133,7 @@ int mt7921s_mcu_drv_pmctrl(struct mt7921_dev *dev)
- return 0;
- }
-
--int mt7921s_mcu_fw_pmctrl(struct mt7921_dev *dev)
-+int mt7921s_mcu_fw_pmctrl(struct mt792x_dev *dev)
- {
- struct sdio_func *func = dev->mt76.sdio.func;
- struct mt76_phy *mphy = &dev->mt76.phy;
-diff --git a/mt7921/testmode.c b/mt7921/testmode.c
-index 7f408212..e838d934 100644
---- a/mt7921/testmode.c
-+++ b/mt7921/testmode.c
-@@ -31,7 +31,7 @@ static const struct nla_policy mt7921_tm_policy[NUM_MT7921_TM_ATTRS] = {
- };
-
- static int
--mt7921_tm_set(struct mt7921_dev *dev, struct mt7921_tm_cmd *req)
-+mt7921_tm_set(struct mt792x_dev *dev, struct mt7921_tm_cmd *req)
- {
- struct mt7921_rftest_cmd cmd = {
- .action = req->action,
-@@ -57,7 +57,7 @@ mt7921_tm_set(struct mt7921_dev *dev, struct mt7921_tm_cmd *req)
- pm->enable = false;
- cancel_delayed_work_sync(&pm->ps_work);
- cancel_work_sync(&pm->wake_work);
-- __mt7921_mcu_drv_pmctrl(dev);
-+ __mt792x_mcu_drv_pmctrl(dev);
-
- phy->test.state = MT76_TM_STATE_ON;
- }
-@@ -82,7 +82,7 @@ out:
- }
-
- static int
--mt7921_tm_query(struct mt7921_dev *dev, struct mt7921_tm_cmd *req,
-+mt7921_tm_query(struct mt792x_dev *dev, struct mt7921_tm_cmd *req,
- struct mt7921_tm_evt *evt_resp)
- {
- struct mt7921_rftest_cmd cmd = {
-@@ -113,7 +113,7 @@ int mt7921_testmode_cmd(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
- {
- struct nlattr *tb[NUM_MT76_TM_ATTRS];
- struct mt76_phy *mphy = hw->priv;
-- struct mt7921_phy *phy = mphy->priv;
-+ struct mt792x_phy *phy = mphy->priv;
- int err;
-
- if (!test_bit(MT76_STATE_RUNNING, &mphy->state) ||
-@@ -150,7 +150,7 @@ int mt7921_testmode_dump(struct ieee80211_hw *hw, struct sk_buff *msg,
- {
- struct nlattr *tb[NUM_MT76_TM_ATTRS];
- struct mt76_phy *mphy = hw->priv;
-- struct mt7921_phy *phy = mphy->priv;
-+ struct mt792x_phy *phy = mphy->priv;
- int err;
-
- if (!test_bit(MT76_STATE_RUNNING, &mphy->state) ||
-diff --git a/mt7921/trace.c b/mt7921/trace.c
-deleted file mode 100644
-index 4dc3c7b8..00000000
---- a/mt7921/trace.c
-+++ /dev/null
-@@ -1,12 +0,0 @@
--// SPDX-License-Identifier: ISC
--/*
-- * Copyright (C) 2021 Lorenzo Bianconi <lorenzo@kernel.org>
-- */
--
--#include <linux/module.h>
--
--#ifndef __CHECKER__
--#define CREATE_TRACE_POINTS
--#include "mt7921_trace.h"
--
--#endif
-diff --git a/mt7921/usb.c b/mt7921/usb.c
-index 1f302c43..59cd3d98 100644
---- a/mt7921/usb.c
-+++ b/mt7921/usb.c
-@@ -24,88 +24,11 @@ static const struct usb_device_id mt7921u_device_table[] = {
- { },
- };
-
--static u32 mt7921u_rr(struct mt76_dev *dev, u32 addr)
--{
-- u32 ret;
--
-- mutex_lock(&dev->usb.usb_ctrl_mtx);
-- ret = ___mt76u_rr(dev, MT_VEND_READ_EXT,
-- USB_DIR_IN | MT_USB_TYPE_VENDOR, addr);
-- mutex_unlock(&dev->usb.usb_ctrl_mtx);
--
-- return ret;
--}
--
--static void mt7921u_wr(struct mt76_dev *dev, u32 addr, u32 val)
--{
-- mutex_lock(&dev->usb.usb_ctrl_mtx);
-- ___mt76u_wr(dev, MT_VEND_WRITE_EXT,
-- USB_DIR_OUT | MT_USB_TYPE_VENDOR, addr, val);
-- mutex_unlock(&dev->usb.usb_ctrl_mtx);
--}
--
--static u32 mt7921u_rmw(struct mt76_dev *dev, u32 addr,
-- u32 mask, u32 val)
--{
-- mutex_lock(&dev->usb.usb_ctrl_mtx);
-- val |= ___mt76u_rr(dev, MT_VEND_READ_EXT,
-- USB_DIR_IN | MT_USB_TYPE_VENDOR, addr) & ~mask;
-- ___mt76u_wr(dev, MT_VEND_WRITE_EXT,
-- USB_DIR_OUT | MT_USB_TYPE_VENDOR, addr, val);
-- mutex_unlock(&dev->usb.usb_ctrl_mtx);
--
-- return val;
--}
--
--static void mt7921u_copy(struct mt76_dev *dev, u32 offset,
-- const void *data, int len)
--{
-- struct mt76_usb *usb = &dev->usb;
-- int ret, i = 0, batch_len;
-- const u8 *val = data;
--
-- len = round_up(len, 4);
--
-- mutex_lock(&usb->usb_ctrl_mtx);
-- while (i < len) {
-- batch_len = min_t(int, usb->data_len, len - i);
-- memcpy(usb->data, val + i, batch_len);
-- ret = __mt76u_vendor_request(dev, MT_VEND_WRITE_EXT,
-- USB_DIR_OUT | MT_USB_TYPE_VENDOR,
-- (offset + i) >> 16, offset + i,
-- usb->data, batch_len);
-- if (ret < 0)
-- break;
--
-- i += batch_len;
-- }
-- mutex_unlock(&usb->usb_ctrl_mtx);
--}
--
--int mt7921u_mcu_power_on(struct mt7921_dev *dev)
--{
-- int ret;
--
-- ret = mt76u_vendor_request(&dev->mt76, MT_VEND_POWER_ON,
-- USB_DIR_OUT | MT_USB_TYPE_VENDOR,
-- 0x0, 0x1, NULL, 0);
-- if (ret)
-- return ret;
--
-- if (!mt76_poll_msec(dev, MT_CONN_ON_MISC, MT_TOP_MISC2_FW_PWR_ON,
-- MT_TOP_MISC2_FW_PWR_ON, 500)) {
-- dev_err(dev->mt76.dev, "Timeout for power on\n");
-- ret = -EIO;
-- }
--
-- return ret;
--}
--
- static int
- mt7921u_mcu_send_message(struct mt76_dev *mdev, struct sk_buff *skb,
- int cmd, int *seq)
- {
-- struct mt7921_dev *dev = container_of(mdev, struct mt7921_dev, mt76);
-+ struct mt792x_dev *dev = container_of(mdev, struct mt792x_dev, mt76);
- u32 pad, ep;
- int ret;
-
-@@ -131,7 +54,7 @@ mt7921u_mcu_send_message(struct mt76_dev *mdev, struct sk_buff *skb,
- return ret;
- }
-
--static int mt7921u_mcu_init(struct mt7921_dev *dev)
-+static int mt7921u_mcu_init(struct mt792x_dev *dev)
- {
- static const struct mt76_mcu_ops mcu_ops = {
- .headroom = MT_SDIO_HDR_SIZE +
-@@ -155,20 +78,69 @@ static int mt7921u_mcu_init(struct mt7921_dev *dev)
- return 0;
- }
-
--static void mt7921u_stop(struct ieee80211_hw *hw)
-+static int mt7921u_mac_reset(struct mt792x_dev *dev)
- {
-- struct mt7921_dev *dev = mt7921_hw_dev(hw);
-+ int err;
-+
-+ mt76_txq_schedule_all(&dev->mphy);
-+ mt76_worker_disable(&dev->mt76.tx_worker);
-
-+ set_bit(MT76_RESET, &dev->mphy.state);
-+ set_bit(MT76_MCU_RESET, &dev->mphy.state);
-+
-+ wake_up(&dev->mt76.mcu.wait);
-+ skb_queue_purge(&dev->mt76.mcu.res_q);
-+
-+ mt76u_stop_rx(&dev->mt76);
- mt76u_stop_tx(&dev->mt76);
-- mt7921_stop(hw);
-+
-+ mt792xu_wfsys_reset(dev);
-+
-+ clear_bit(MT76_MCU_RESET, &dev->mphy.state);
-+ err = mt76u_resume_rx(&dev->mt76);
-+ if (err)
-+ goto out;
-+
-+ err = mt792xu_mcu_power_on(dev);
-+ if (err)
-+ goto out;
-+
-+ err = mt792xu_dma_init(dev, false);
-+ if (err)
-+ goto out;
-+
-+ mt76_wr(dev, MT_SWDEF_MODE, MT_SWDEF_NORMAL_MODE);
-+ mt76_set(dev, MT_UDMA_TX_QSEL, MT_FW_DL_EN);
-+
-+ err = mt7921_run_firmware(dev);
-+ if (err)
-+ goto out;
-+
-+ mt76_clear(dev, MT_UDMA_TX_QSEL, MT_FW_DL_EN);
-+
-+ err = mt7921_mcu_set_eeprom(dev);
-+ if (err)
-+ goto out;
-+
-+ err = mt7921_mac_init(dev);
-+ if (err)
-+ goto out;
-+
-+ err = __mt7921_start(&dev->phy);
-+out:
-+ clear_bit(MT76_RESET, &dev->mphy.state);
-+
-+ mt76_worker_enable(&dev->mt76.tx_worker);
-+
-+ return err;
- }
-
--static void mt7921u_cleanup(struct mt7921_dev *dev)
-+static void mt7921u_stop(struct ieee80211_hw *hw)
- {
-- clear_bit(MT76_STATE_INITIALIZED, &dev->mphy.state);
-- mt7921u_wfsys_reset(dev);
-- skb_queue_purge(&dev->mt76.mcu.res_q);
-- mt76u_queues_deinit(&dev->mt76);
-+ struct mt792x_dev *dev = mt792x_hw_dev(hw);
-+
-+ mt76u_stop_tx(&dev->mt76);
-+ mt7921_stop(hw);
- }
-
- static int mt7921u_probe(struct usb_interface *usb_intf,
-@@ -189,31 +161,31 @@ static int mt7921u_probe(struct usb_interface *usb_intf,
- .sta_add = mt7921_mac_sta_add,
- .sta_assoc = mt7921_mac_sta_assoc,
- .sta_remove = mt7921_mac_sta_remove,
-- .update_survey = mt7921_update_channel,
-+ .update_survey = mt792x_update_channel,
- };
-- static const struct mt7921_hif_ops hif_ops = {
-+ static const struct mt792x_hif_ops hif_ops = {
- .mcu_init = mt7921u_mcu_init,
-- .init_reset = mt7921u_init_reset,
-+ .init_reset = mt792xu_init_reset,
- .reset = mt7921u_mac_reset,
- };
- static struct mt76_bus_ops bus_ops = {
-- .rr = mt7921u_rr,
-- .wr = mt7921u_wr,
-- .rmw = mt7921u_rmw,
-+ .rr = mt792xu_rr,
-+ .wr = mt792xu_wr,
-+ .rmw = mt792xu_rmw,
- .read_copy = mt76u_read_copy,
-- .write_copy = mt7921u_copy,
-+ .write_copy = mt792xu_copy,
- .type = MT76_BUS_USB,
- };
- struct usb_device *udev = interface_to_usbdev(usb_intf);
- struct ieee80211_ops *ops;
- struct ieee80211_hw *hw;
-- struct mt7921_dev *dev;
-+ struct mt792x_dev *dev;
- struct mt76_dev *mdev;
- u8 features;
- int ret;
-
-- ops = mt7921_get_mac80211_ops(&usb_intf->dev, (void *)id->driver_info,
-- &features);
-+ ops = mt792x_get_mac80211_ops(&usb_intf->dev, &mt7921_ops,
-+ (void *)id->driver_info, &features);
- if (!ops)
- return -ENOMEM;
-
-@@ -222,7 +194,7 @@ static int mt7921u_probe(struct usb_interface *usb_intf,
- if (!mdev)
- return -ENOMEM;
-
-- dev = container_of(mdev, struct mt7921_dev, mt76);
-+ dev = container_of(mdev, struct mt792x_dev, mt76);
- dev->fw_features = features;
- dev->hif_ops = &hif_ops;
-
-@@ -240,12 +212,12 @@ static int mt7921u_probe(struct usb_interface *usb_intf,
- dev_dbg(mdev->dev, "ASIC revision: %04x\n", mdev->rev);
-
- if (mt76_get_field(dev, MT_CONN_ON_MISC, MT_TOP_MISC2_FW_N9_RDY)) {
-- ret = mt7921u_wfsys_reset(dev);
-+ ret = mt792xu_wfsys_reset(dev);
- if (ret)
- goto error;
- }
-
-- ret = mt7921u_mcu_power_on(dev);
-+ ret = mt792xu_mcu_power_on(dev);
- if (ret)
- goto error;
-
-@@ -257,7 +229,7 @@ static int mt7921u_probe(struct usb_interface *usb_intf,
- if (ret)
- goto error;
-
-- ret = mt7921u_dma_init(dev, false);
-+ ret = mt792xu_dma_init(dev, false);
- if (ret)
- goto error;
-
-@@ -282,27 +254,10 @@ error:
- return ret;
- }
-
--static void mt7921u_disconnect(struct usb_interface *usb_intf)
--{
-- struct mt7921_dev *dev = usb_get_intfdata(usb_intf);
--
-- cancel_work_sync(&dev->init_work);
-- if (!test_bit(MT76_STATE_INITIALIZED, &dev->mphy.state))
-- return;
--
-- mt76_unregister_device(&dev->mt76);
-- mt7921u_cleanup(dev);
--
-- usb_set_intfdata(usb_intf, NULL);
-- usb_put_dev(interface_to_usbdev(usb_intf));
--
-- mt76_free_device(&dev->mt76);
--}
--
- #ifdef CONFIG_PM
- static int mt7921u_suspend(struct usb_interface *intf, pm_message_t state)
- {
-- struct mt7921_dev *dev = usb_get_intfdata(intf);
-+ struct mt792x_dev *dev = usb_get_intfdata(intf);
- struct mt76_connac_pm *pm = &dev->pm;
- int err;
-
-@@ -322,14 +277,14 @@ failed:
- pm->suspended = false;
-
- if (err < 0)
-- mt7921_reset(&dev->mt76);
-+ mt792x_reset(&dev->mt76);
-
- return err;
- }
-
- static int mt7921u_resume(struct usb_interface *intf)
- {
-- struct mt7921_dev *dev = usb_get_intfdata(intf);
-+ struct mt792x_dev *dev = usb_get_intfdata(intf);
- struct mt76_connac_pm *pm = &dev->pm;
- bool reinit = true;
- int err, i;
-@@ -349,8 +304,8 @@ static int mt7921u_resume(struct usb_interface *intf)
- msleep(20);
- }
-
-- if (reinit || mt7921_dma_need_reinit(dev)) {
-- err = mt7921u_dma_init(dev, true);
-+ if (reinit || mt792x_dma_need_reinit(dev)) {
-+ err = mt792xu_dma_init(dev, true);
- if (err)
- goto failed;
- }
-@@ -364,7 +319,7 @@ failed:
- pm->suspended = false;
-
- if (err < 0)
-- mt7921_reset(&dev->mt76);
-+ mt792x_reset(&dev->mt76);
-
- return err;
- }
-@@ -378,7 +333,7 @@ static struct usb_driver mt7921u_driver = {
- .name = KBUILD_MODNAME,
- .id_table = mt7921u_device_table,
- .probe = mt7921u_probe,
-- .disconnect = mt7921u_disconnect,
-+ .disconnect = mt792xu_disconnect,
- #ifdef CONFIG_PM
- .suspend = mt7921u_suspend,
- .resume = mt7921u_resume,
-diff --git a/mt7921/usb_mac.c b/mt7921/usb_mac.c
-deleted file mode 100644
-index 50eb6e7f..00000000
---- a/mt7921/usb_mac.c
-+++ /dev/null
-@@ -1,255 +0,0 @@
--// SPDX-License-Identifier: ISC
--/* Copyright (C) 2022 MediaTek Inc.
-- *
-- * Author: Lorenzo Bianconi <lorenzo@kernel.org>
-- */
--
--#include <linux/kernel.h>
--#include <linux/module.h>
--#include <linux/usb.h>
--
--#include "mt7921.h"
--#include "mcu.h"
--#include "../mt76_connac2_mac.h"
--
--static u32 mt7921u_uhw_rr(struct mt76_dev *dev, u32 addr)
--{
-- u32 ret;
--
-- mutex_lock(&dev->usb.usb_ctrl_mtx);
-- ret = ___mt76u_rr(dev, MT_VEND_DEV_MODE,
-- USB_DIR_IN | MT_USB_TYPE_UHW_VENDOR, addr);
-- mutex_unlock(&dev->usb.usb_ctrl_mtx);
--
-- return ret;
--}
--
--static void mt7921u_uhw_wr(struct mt76_dev *dev, u32 addr, u32 val)
--{
-- mutex_lock(&dev->usb.usb_ctrl_mtx);
-- ___mt76u_wr(dev, MT_VEND_WRITE,
-- USB_DIR_OUT | MT_USB_TYPE_UHW_VENDOR, addr, val);
-- mutex_unlock(&dev->usb.usb_ctrl_mtx);
--}
--
--static void mt7921u_dma_prefetch(struct mt7921_dev *dev)
--{
-- mt76_rmw(dev, MT_UWFDMA0_TX_RING_EXT_CTRL(0),
-- MT_WPDMA0_MAX_CNT_MASK, 4);
-- mt76_rmw(dev, MT_UWFDMA0_TX_RING_EXT_CTRL(0),
-- MT_WPDMA0_BASE_PTR_MASK, 0x80);
--
-- mt76_rmw(dev, MT_UWFDMA0_TX_RING_EXT_CTRL(1),
-- MT_WPDMA0_MAX_CNT_MASK, 4);
-- mt76_rmw(dev, MT_UWFDMA0_TX_RING_EXT_CTRL(1),
-- MT_WPDMA0_BASE_PTR_MASK, 0xc0);
--
-- mt76_rmw(dev, MT_UWFDMA0_TX_RING_EXT_CTRL(2),
-- MT_WPDMA0_MAX_CNT_MASK, 4);
-- mt76_rmw(dev, MT_UWFDMA0_TX_RING_EXT_CTRL(2),
-- MT_WPDMA0_BASE_PTR_MASK, 0x100);
--
-- mt76_rmw(dev, MT_UWFDMA0_TX_RING_EXT_CTRL(3),
-- MT_WPDMA0_MAX_CNT_MASK, 4);
-- mt76_rmw(dev, MT_UWFDMA0_TX_RING_EXT_CTRL(3),
-- MT_WPDMA0_BASE_PTR_MASK, 0x140);
--
-- mt76_rmw(dev, MT_UWFDMA0_TX_RING_EXT_CTRL(4),
-- MT_WPDMA0_MAX_CNT_MASK, 4);
-- mt76_rmw(dev, MT_UWFDMA0_TX_RING_EXT_CTRL(4),
-- MT_WPDMA0_BASE_PTR_MASK, 0x180);
--
-- mt76_rmw(dev, MT_UWFDMA0_TX_RING_EXT_CTRL(16),
-- MT_WPDMA0_MAX_CNT_MASK, 4);
-- mt76_rmw(dev, MT_UWFDMA0_TX_RING_EXT_CTRL(16),
-- MT_WPDMA0_BASE_PTR_MASK, 0x280);
--
-- mt76_rmw(dev, MT_UWFDMA0_TX_RING_EXT_CTRL(17),
-- MT_WPDMA0_MAX_CNT_MASK, 4);
-- mt76_rmw(dev, MT_UWFDMA0_TX_RING_EXT_CTRL(17),
-- MT_WPDMA0_BASE_PTR_MASK, 0x2c0);
--}
--
--static void mt7921u_wfdma_init(struct mt7921_dev *dev)
--{
-- mt7921u_dma_prefetch(dev);
--
-- mt76_clear(dev, MT_UWFDMA0_GLO_CFG, MT_WFDMA0_GLO_CFG_OMIT_RX_INFO);
-- mt76_set(dev, MT_UWFDMA0_GLO_CFG,
-- MT_WFDMA0_GLO_CFG_OMIT_TX_INFO |
-- MT_WFDMA0_GLO_CFG_OMIT_RX_INFO_PFET2 |
-- MT_WFDMA0_GLO_CFG_FW_DWLD_BYPASS_DMASHDL |
-- MT_WFDMA0_GLO_CFG_TX_DMA_EN |
-- MT_WFDMA0_GLO_CFG_RX_DMA_EN);
--
-- /* disable dmashdl */
-- mt76_clear(dev, MT_UWFDMA0_GLO_CFG_EXT0,
-- MT_WFDMA0_CSR_TX_DMASHDL_ENABLE);
-- mt76_set(dev, MT_DMASHDL_SW_CONTROL, MT_DMASHDL_DMASHDL_BYPASS);
--
-- mt76_set(dev, MT_WFDMA_DUMMY_CR, MT_WFDMA_NEED_REINIT);
--}
--
--static int mt7921u_dma_rx_evt_ep4(struct mt7921_dev *dev)
--{
-- if (!mt76_poll(dev, MT_UWFDMA0_GLO_CFG,
-- MT_WFDMA0_GLO_CFG_RX_DMA_BUSY, 0, 1000))
-- return -ETIMEDOUT;
--
-- mt76_clear(dev, MT_UWFDMA0_GLO_CFG, MT_WFDMA0_GLO_CFG_RX_DMA_EN);
-- mt76_set(dev, MT_WFDMA_HOST_CONFIG,
-- MT_WFDMA_HOST_CONFIG_USB_RXEVT_EP4_EN);
-- mt76_set(dev, MT_UWFDMA0_GLO_CFG, MT_WFDMA0_GLO_CFG_RX_DMA_EN);
--
-- return 0;
--}
--
--static void mt7921u_epctl_rst_opt(struct mt7921_dev *dev, bool reset)
--{
-- u32 val;
--
-- /* usb endpoint reset opt
-- * bits[4,9]: out blk ep 4-9
-- * bits[20,21]: in blk ep 4-5
-- * bits[22]: in int ep 6
-- */
-- val = mt7921u_uhw_rr(&dev->mt76, MT_SSUSB_EPCTL_CSR_EP_RST_OPT);
-- if (reset)
-- val |= GENMASK(9, 4) | GENMASK(22, 20);
-- else
-- val &= ~(GENMASK(9, 4) | GENMASK(22, 20));
-- mt7921u_uhw_wr(&dev->mt76, MT_SSUSB_EPCTL_CSR_EP_RST_OPT, val);
--}
--
--int mt7921u_dma_init(struct mt7921_dev *dev, bool resume)
--{
-- int err;
--
-- mt7921u_wfdma_init(dev);
--
-- mt76_clear(dev, MT_UDMA_WLCFG_0, MT_WL_RX_FLUSH);
--
-- mt76_set(dev, MT_UDMA_WLCFG_0,
-- MT_WL_RX_EN | MT_WL_TX_EN |
-- MT_WL_RX_MPSZ_PAD0 | MT_TICK_1US_EN);
-- mt76_clear(dev, MT_UDMA_WLCFG_0,
-- MT_WL_RX_AGG_TO | MT_WL_RX_AGG_LMT);
-- mt76_clear(dev, MT_UDMA_WLCFG_1, MT_WL_RX_AGG_PKT_LMT);
--
-- if (resume)
-- return 0;
--
-- err = mt7921u_dma_rx_evt_ep4(dev);
-- if (err)
-- return err;
--
-- mt7921u_epctl_rst_opt(dev, false);
--
-- return 0;
--}
--
--int mt7921u_wfsys_reset(struct mt7921_dev *dev)
--{
-- u32 val;
-- int i;
--
-- mt7921u_epctl_rst_opt(dev, false);
--
-- val = mt7921u_uhw_rr(&dev->mt76, MT_CBTOP_RGU_WF_SUBSYS_RST);
-- val |= MT_CBTOP_RGU_WF_SUBSYS_RST_WF_WHOLE_PATH;
-- mt7921u_uhw_wr(&dev->mt76, MT_CBTOP_RGU_WF_SUBSYS_RST, val);
--
-- usleep_range(10, 20);
--
-- val = mt7921u_uhw_rr(&dev->mt76, MT_CBTOP_RGU_WF_SUBSYS_RST);
-- val &= ~MT_CBTOP_RGU_WF_SUBSYS_RST_WF_WHOLE_PATH;
-- mt7921u_uhw_wr(&dev->mt76, MT_CBTOP_RGU_WF_SUBSYS_RST, val);
--
-- mt7921u_uhw_wr(&dev->mt76, MT_UDMA_CONN_INFRA_STATUS_SEL, 0);
-- for (i = 0; i < MT7921_WFSYS_INIT_RETRY_COUNT; i++) {
-- val = mt7921u_uhw_rr(&dev->mt76, MT_UDMA_CONN_INFRA_STATUS);
-- if (val & MT_UDMA_CONN_WFSYS_INIT_DONE)
-- break;
--
-- msleep(100);
-- }
--
-- if (i == MT7921_WFSYS_INIT_RETRY_COUNT)
-- return -ETIMEDOUT;
--
-- return 0;
--}
--
--int mt7921u_init_reset(struct mt7921_dev *dev)
--{
-- set_bit(MT76_RESET, &dev->mphy.state);
--
-- wake_up(&dev->mt76.mcu.wait);
-- skb_queue_purge(&dev->mt76.mcu.res_q);
--
-- mt76u_stop_rx(&dev->mt76);
-- mt76u_stop_tx(&dev->mt76);
--
-- mt7921u_wfsys_reset(dev);
--
-- clear_bit(MT76_RESET, &dev->mphy.state);
--
-- return mt76u_resume_rx(&dev->mt76);
--}
--
--int mt7921u_mac_reset(struct mt7921_dev *dev)
--{
-- int err;
--
-- mt76_txq_schedule_all(&dev->mphy);
-- mt76_worker_disable(&dev->mt76.tx_worker);
--
-- set_bit(MT76_RESET, &dev->mphy.state);
-- set_bit(MT76_MCU_RESET, &dev->mphy.state);
--
-- wake_up(&dev->mt76.mcu.wait);
-- skb_queue_purge(&dev->mt76.mcu.res_q);
--
-- mt76u_stop_rx(&dev->mt76);
-- mt76u_stop_tx(&dev->mt76);
--
-- mt7921u_wfsys_reset(dev);
--
-- clear_bit(MT76_MCU_RESET, &dev->mphy.state);
-- err = mt76u_resume_rx(&dev->mt76);
-- if (err)
-- goto out;
--
-- err = mt7921u_mcu_power_on(dev);
-- if (err)
-- goto out;
--
-- err = mt7921u_dma_init(dev, false);
-- if (err)
-- goto out;
--
-- mt76_wr(dev, MT_SWDEF_MODE, MT_SWDEF_NORMAL_MODE);
-- mt76_set(dev, MT_UDMA_TX_QSEL, MT_FW_DL_EN);
--
-- err = mt7921_run_firmware(dev);
-- if (err)
-- goto out;
--
-- mt76_clear(dev, MT_UDMA_TX_QSEL, MT_FW_DL_EN);
--
-- err = mt7921_mcu_set_eeprom(dev);
-- if (err)
-- goto out;
--
-- err = mt7921_mac_init(dev);
-- if (err)
-- goto out;
--
-- err = __mt7921_start(&dev->phy);
--out:
-- clear_bit(MT76_RESET, &dev->mphy.state);
--
-- mt76_worker_enable(&dev->mt76.tx_worker);
--
-- return err;
--}
-diff --git a/mt792x.h b/mt792x.h
-new file mode 100644
-index 00000000..5d5ab863
---- /dev/null
-+++ b/mt792x.h
-@@ -0,0 +1,367 @@
-+/* SPDX-License-Identifier: ISC */
-+/* Copyright (C) 2023 MediaTek Inc. */
-+
-+#ifndef __MT792X_H
-+#define __MT792X_H
-+
-+#include <linux/interrupt.h>
-+#include <linux/ktime.h>
-+
-+#include "mt76_connac_mcu.h"
-+#include "mt792x_regs.h"
-+#include "mt792x_acpi_sar.h"
-+
-+#define MT792x_PM_TIMEOUT (HZ / 12)
-+#define MT792x_HW_SCAN_TIMEOUT (HZ / 10)
-+
-+#define MT792x_MAX_INTERFACES 4
-+#define MT792x_WTBL_SIZE 20
-+#define MT792x_WTBL_RESERVED (MT792x_WTBL_SIZE - 1)
-+#define MT792x_WTBL_STA (MT792x_WTBL_RESERVED - MT792x_MAX_INTERFACES)
-+
-+#define MT792x_CFEND_RATE_DEFAULT 0x49 /* OFDM 24M */
-+#define MT792x_CFEND_RATE_11B 0x03 /* 11B LP, 11M */
-+
-+#define MT792x_FW_TAG_FEATURE 4
-+#define MT792x_FW_CAP_CNM BIT(7)
-+
-+/* NOTE: used to map mt76_rates. idx may change if firmware expands table */
-+#define MT792x_BASIC_RATES_TBL 11
-+
-+#define MT792x_WATCHDOG_TIME (HZ / 4)
-+
-+#define MT792x_DRV_OWN_RETRY_COUNT 10
-+#define MT792x_MCU_INIT_RETRY_COUNT 10
-+#define MT792x_WFSYS_INIT_RETRY_COUNT 2
-+
-+#define MT7921_FIRMWARE_WM "mediatek/WIFI_RAM_CODE_MT7961_1.bin"
-+#define MT7922_FIRMWARE_WM "mediatek/WIFI_RAM_CODE_MT7922_1.bin"
-+
-+#define MT7921_ROM_PATCH "mediatek/WIFI_MT7961_patch_mcu_1_2_hdr.bin"
-+#define MT7922_ROM_PATCH "mediatek/WIFI_MT7922_patch_mcu_1_1_hdr.bin"
-+
-+struct mt792x_vif;
-+struct mt792x_sta;
-+
-+struct mt792x_realease_info {
-+ __le16 len;
-+ u8 pad_len;
-+ u8 tag;
-+} __packed;
-+
-+struct mt792x_fw_features {
-+ u8 segment;
-+ u8 data;
-+ u8 rsv[14];
-+} __packed;
-+
-+enum {
-+ MT792x_CLC_POWER,
-+ MT792x_CLC_CHAN,
-+ MT792x_CLC_MAX_NUM,
-+};
-+
-+DECLARE_EWMA(avg_signal, 10, 8)
-+
-+struct mt792x_sta {
-+ struct mt76_wcid wcid; /* must be first */
-+
-+ struct mt792x_vif *vif;
-+
-+ u32 airtime_ac[8];
-+
-+ int ack_signal;
-+ struct ewma_avg_signal avg_ack_signal;
-+
-+ unsigned long last_txs;
-+
-+ struct mt76_connac_sta_key_conf bip;
-+};
-+
-+DECLARE_EWMA(rssi, 10, 8);
-+
-+struct mt792x_vif {
-+ struct mt76_vif mt76; /* must be first */
-+
-+ struct mt792x_sta sta;
-+ struct mt792x_sta *wep_sta;
-+
-+ struct mt792x_phy *phy;
-+
-+ struct ewma_rssi rssi;
-+
-+ struct ieee80211_tx_queue_params queue_params[IEEE80211_NUM_ACS];
-+ struct ieee80211_chanctx_conf *ctx;
-+};
-+
-+struct mt792x_phy {
-+ struct mt76_phy *mt76;
-+ struct mt792x_dev *dev;
-+
-+ struct ieee80211_sband_iftype_data iftype[NUM_NL80211_BANDS][NUM_NL80211_IFTYPES];
-+
-+ u64 omac_mask;
-+
-+ u16 noise;
-+
-+ s16 coverage_class;
-+ u8 slottime;
-+
-+ u32 rx_ampdu_ts;
-+ u32 ampdu_ref;
-+
-+ struct mt76_mib_stats mib;
-+
-+ u8 sta_work_count;
-+
-+ struct sk_buff_head scan_event_list;
-+ struct delayed_work scan_work;
-+#ifdef CONFIG_ACPI
-+ void *acpisar;
-+#endif
-+ void *clc[MT792x_CLC_MAX_NUM];
-+
-+ struct work_struct roc_work;
-+ struct timer_list roc_timer;
-+ wait_queue_head_t roc_wait;
-+ u8 roc_token_id;
-+ bool roc_grant;
-+};
-+
-+struct mt792x_irq_map {
-+ u32 host_irq_enable;
-+ struct {
-+ u32 all_complete_mask;
-+ u32 mcu_complete_mask;
-+ } tx;
-+ struct {
-+ u32 data_complete_mask;
-+ u32 wm_complete_mask;
-+ u32 wm2_complete_mask;
-+ } rx;
-+};
-+
-+#define mt792x_init_reset(dev) ((dev)->hif_ops->init_reset(dev))
-+#define mt792x_dev_reset(dev) ((dev)->hif_ops->reset(dev))
-+#define mt792x_mcu_init(dev) ((dev)->hif_ops->mcu_init(dev))
-+#define __mt792x_mcu_drv_pmctrl(dev) ((dev)->hif_ops->drv_own(dev))
-+#define __mt792x_mcu_fw_pmctrl(dev) ((dev)->hif_ops->fw_own(dev))
-+
-+struct mt792x_hif_ops {
-+ int (*init_reset)(struct mt792x_dev *dev);
-+ int (*reset)(struct mt792x_dev *dev);
-+ int (*mcu_init)(struct mt792x_dev *dev);
-+ int (*drv_own)(struct mt792x_dev *dev);
-+ int (*fw_own)(struct mt792x_dev *dev);
-+};
-+
-+struct mt792x_dev {
-+ union { /* must be first */
-+ struct mt76_dev mt76;
-+ struct mt76_phy mphy;
-+ };
-+
-+ const struct mt76_bus_ops *bus_ops;
-+ struct mt792x_phy phy;
-+
-+ struct work_struct reset_work;
-+ bool hw_full_reset:1;
-+ bool hw_init_done:1;
-+ bool fw_assert:1;
-+ bool has_eht:1;
-+
-+ struct work_struct init_work;
-+
-+ u8 fw_debug;
-+ u8 fw_features;
-+
-+ struct mt76_connac_pm pm;
-+ struct mt76_connac_coredump coredump;
-+ const struct mt792x_hif_ops *hif_ops;
-+ const struct mt792x_irq_map *irq_map;
-+
-+ struct work_struct ipv6_ns_work;
-+ /* IPv6 addresses for WoWLAN */
-+ struct sk_buff_head ipv6_ns_list;
-+
-+ enum environment_cap country_ie_env;
-+ u32 backup_l1;
-+ u32 backup_l2;
-+};
-+
-+static inline struct mt792x_dev *
-+mt792x_hw_dev(struct ieee80211_hw *hw)
-+{
-+ struct mt76_phy *phy = hw->priv;
-+
-+ return container_of(phy->dev, struct mt792x_dev, mt76);
-+}
-+
-+static inline struct mt792x_phy *
-+mt792x_hw_phy(struct ieee80211_hw *hw)
-+{
-+ struct mt76_phy *phy = hw->priv;
-+
-+ return phy->priv;
-+}
-+
-+static inline void
-+mt792x_get_status_freq_info(struct mt76_rx_status *status, u8 chfreq)
-+{
-+ if (chfreq > 180) {
-+ status->band = NL80211_BAND_6GHZ;
-+ chfreq = (chfreq - 181) * 4 + 1;
-+ } else if (chfreq > 14) {
-+ status->band = NL80211_BAND_5GHZ;
-+ } else {
-+ status->band = NL80211_BAND_2GHZ;
-+ }
-+ status->freq = ieee80211_channel_to_frequency(chfreq, status->band);
-+}
-+
-+static inline bool mt792x_dma_need_reinit(struct mt792x_dev *dev)
-+{
-+ return !mt76_get_field(dev, MT_WFDMA_DUMMY_CR, MT_WFDMA_NEED_REINIT);
-+}
-+
-+#define mt792x_mutex_acquire(dev) \
-+ mt76_connac_mutex_acquire(&(dev)->mt76, &(dev)->pm)
-+#define mt792x_mutex_release(dev) \
-+ mt76_connac_mutex_release(&(dev)->mt76, &(dev)->pm)
-+
-+void mt792x_pm_wake_work(struct work_struct *work);
-+void mt792x_pm_power_save_work(struct work_struct *work);
-+void mt792x_reset(struct mt76_dev *mdev);
-+void mt792x_update_channel(struct mt76_phy *mphy);
-+void mt792x_mac_reset_counters(struct mt792x_phy *phy);
-+void mt792x_mac_init_band(struct mt792x_dev *dev, u8 band);
-+void mt792x_mac_assoc_rssi(struct mt792x_dev *dev, struct sk_buff *skb);
-+struct mt76_wcid *mt792x_rx_get_wcid(struct mt792x_dev *dev, u16 idx,
-+ bool unicast);
-+void mt792x_mac_update_mib_stats(struct mt792x_phy *phy);
-+void mt792x_mac_set_timeing(struct mt792x_phy *phy);
-+void mt792x_mac_work(struct work_struct *work);
-+void mt792x_remove_interface(struct ieee80211_hw *hw,
-+ struct ieee80211_vif *vif);
-+void mt792x_tx(struct ieee80211_hw *hw, struct ieee80211_tx_control *control,
-+ struct sk_buff *skb);
-+int mt792x_conf_tx(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
-+ unsigned int link_id, u16 queue,
-+ const struct ieee80211_tx_queue_params *params);
-+int mt792x_get_stats(struct ieee80211_hw *hw,
-+ struct ieee80211_low_level_stats *stats);
-+u64 mt792x_get_tsf(struct ieee80211_hw *hw, struct ieee80211_vif *vif);
-+void mt792x_set_tsf(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
-+ u64 timestamp);
-+void mt792x_tx_worker(struct mt76_worker *w);
-+void mt792x_roc_timer(struct timer_list *timer);
-+void mt792x_flush(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
-+ u32 queues, bool drop);
-+int mt792x_assign_vif_chanctx(struct ieee80211_hw *hw,
-+ struct ieee80211_vif *vif,
-+ struct ieee80211_bss_conf *link_conf,
-+ struct ieee80211_chanctx_conf *ctx);
-+void mt792x_unassign_vif_chanctx(struct ieee80211_hw *hw,
-+ struct ieee80211_vif *vif,
-+ struct ieee80211_bss_conf *link_conf,
-+ struct ieee80211_chanctx_conf *ctx);
-+void mt792x_set_wakeup(struct ieee80211_hw *hw, bool enabled);
-+void mt792x_get_et_strings(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
-+ u32 sset, u8 *data);
-+int mt792x_get_et_sset_count(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
-+ int sset);
-+void mt792x_get_et_stats(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
-+ struct ethtool_stats *stats, u64 *data);
-+void mt792x_sta_statistics(struct ieee80211_hw *hw,
-+ struct ieee80211_vif *vif,
-+ struct ieee80211_sta *sta,
-+ struct station_info *sinfo);
-+void mt792x_set_coverage_class(struct ieee80211_hw *hw, s16 coverage_class);
-+void mt792x_dma_cleanup(struct mt792x_dev *dev);
-+int mt792x_dma_enable(struct mt792x_dev *dev);
-+int mt792x_wpdma_reset(struct mt792x_dev *dev, bool force);
-+int mt792x_wpdma_reinit_cond(struct mt792x_dev *dev);
-+int mt792x_dma_disable(struct mt792x_dev *dev, bool force);
-+irqreturn_t mt792x_irq_handler(int irq, void *dev_instance);
-+void mt792x_rx_poll_complete(struct mt76_dev *mdev, enum mt76_rxq_id q);
-+int mt792x_poll_tx(struct napi_struct *napi, int budget);
-+int mt792x_poll_rx(struct napi_struct *napi, int budget);
-+void mt792x_irq_tasklet(unsigned long data);
-+int mt792x_wfsys_reset(struct mt792x_dev *dev);
-+int mt792x_tx_stats_show(struct seq_file *file, void *data);
-+int mt792x_queues_acq(struct seq_file *s, void *data);
-+int mt792x_queues_read(struct seq_file *s, void *data);
-+int mt792x_pm_stats(struct seq_file *s, void *data);
-+int mt792x_pm_idle_timeout_set(void *data, u64 val);
-+int mt792x_pm_idle_timeout_get(void *data, u64 *val);
-+int mt792x_init_wiphy(struct ieee80211_hw *hw);
-+struct ieee80211_ops *
-+mt792x_get_mac80211_ops(struct device *dev,
-+ const struct ieee80211_ops *mac80211_ops,
-+ void *drv_data, u8 *fw_features);
-+int mt792x_init_wcid(struct mt792x_dev *dev);
-+int mt792x_mcu_drv_pmctrl(struct mt792x_dev *dev);
-+int mt792x_mcu_fw_pmctrl(struct mt792x_dev *dev);
-+
-+static inline char *mt792x_ram_name(struct mt792x_dev *dev)
-+{
-+ switch (mt76_chip(&dev->mt76)) {
-+ case 0x7922:
-+ return MT7922_FIRMWARE_WM;
-+ default:
-+ return MT7921_FIRMWARE_WM;
-+ }
-+}
-+
-+static inline char *mt792x_patch_name(struct mt792x_dev *dev)
-+{
-+ switch (mt76_chip(&dev->mt76)) {
-+ case 0x7922:
-+ return MT7922_ROM_PATCH;
-+ default:
-+ return MT7921_ROM_PATCH;
-+ }
-+}
-+
-+int mt792x_load_firmware(struct mt792x_dev *dev);
-+
-+/* usb */
-+#define MT_USB_TYPE_VENDOR (USB_TYPE_VENDOR | 0x1f)
-+#define MT_USB_TYPE_UHW_VENDOR (USB_TYPE_VENDOR | 0x1e)
-+int mt792xu_dma_init(struct mt792x_dev *dev, bool resume);
-+int mt792xu_mcu_power_on(struct mt792x_dev *dev);
-+int mt792xu_wfsys_reset(struct mt792x_dev *dev);
-+int mt792xu_init_reset(struct mt792x_dev *dev);
-+u32 mt792xu_rr(struct mt76_dev *dev, u32 addr);
-+void mt792xu_wr(struct mt76_dev *dev, u32 addr, u32 val);
-+u32 mt792xu_rmw(struct mt76_dev *dev, u32 addr, u32 mask, u32 val);
-+void mt792xu_copy(struct mt76_dev *dev, u32 offset, const void *data, int len);
-+void mt792xu_disconnect(struct usb_interface *usb_intf);
-+
-+int __mt792xe_mcu_drv_pmctrl(struct mt792x_dev *dev);
-+int mt792xe_mcu_drv_pmctrl(struct mt792x_dev *dev);
-+int mt792xe_mcu_fw_pmctrl(struct mt792x_dev *dev);
-+
-+#ifdef CONFIG_ACPI
-+int mt792x_init_acpi_sar(struct mt792x_dev *dev);
-+int mt792x_init_acpi_sar_power(struct mt792x_phy *phy, bool set_default);
-+u8 mt792x_acpi_get_flags(struct mt792x_phy *phy);
-+#else
-+static inline int mt792x_init_acpi_sar(struct mt792x_dev *dev)
-+{
-+ return 0;
-+}
-+
-+static inline int mt792x_init_acpi_sar_power(struct mt792x_phy *phy,
-+ bool set_default)
-+{
-+ return 0;
-+}
-+
-+static inline u8 mt792x_acpi_get_flags(struct mt792x_phy *phy)
-+{
-+ return 0;
-+}
-+#endif
-+
-+#endif /* __MT7925_H */
-diff --git a/mt7921/acpi_sar.c b/mt792x_acpi_sar.c
-similarity index 64%
-rename from mt7921/acpi_sar.c
-rename to mt792x_acpi_sar.c
-index 48dd0dec..303c0f5c 100644
---- a/mt7921/acpi_sar.c
-+++ b/mt792x_acpi_sar.c
-@@ -1,15 +1,15 @@
- // SPDX-License-Identifier: ISC
--/* Copyright (C) 2022 MediaTek Inc. */
-+/* Copyright (C) 2023 MediaTek Inc. */
-
- #include <linux/acpi.h>
--#include "mt7921.h"
-+#include "mt792x.h"
-
- static int
--mt7921_acpi_read(struct mt7921_dev *dev, u8 *method, u8 **tbl, u32 *len)
-+mt792x_acpi_read(struct mt792x_dev *dev, u8 *method, u8 **tbl, u32 *len)
- {
- struct acpi_buffer buf = { ACPI_ALLOCATE_BUFFER, NULL };
-- union acpi_object *sar_root, *sar_unit;
- struct mt76_dev *mdev = &dev->mt76;
-+ union acpi_object *sar_root;
- acpi_handle root, handle;
- acpi_status status;
- u32 i = 0;
-@@ -45,18 +45,20 @@ mt7921_acpi_read(struct mt7921_dev *dev, u8 *method, u8 **tbl, u32 *len)
- goto free;
- }
- }
-+
- if (len)
- *len = sar_root->package.count;
-
- for (i = 0; i < sar_root->package.count; i++) {
-- sar_unit = &sar_root->package.elements[i];
-+ union acpi_object *sar_unit = &sar_root->package.elements[i];
-
- if (sar_unit->type != ACPI_TYPE_INTEGER)
- break;
-+
- *(*tbl + i) = (u8)sar_unit->integer.value;
- }
-- ret = (i == sar_root->package.count) ? 0 : -EINVAL;
-
-+ ret = i == sar_root->package.count ? 0 : -EINVAL;
- free:
- kfree(sar_root);
-
-@@ -64,36 +66,37 @@ free:
- }
-
- /* MTCL : Country List Table for 6G band */
--static int
--mt7921_asar_acpi_read_mtcl(struct mt7921_dev *dev, u8 **table, u8 *version)
-+static void
-+mt792x_asar_acpi_read_mtcl(struct mt792x_dev *dev, u8 **table, u8 *version)
- {
-- *version = (mt7921_acpi_read(dev, MT7921_ACPI_MTCL, table, NULL) < 0)
-- ? 1 : 2;
-- return 0;
-+ if (mt792x_acpi_read(dev, MT792x_ACPI_MTCL, table, NULL) < 0)
-+ *version = 1;
-+ else
-+ *version = 2;
- }
-
- /* MTDS : Dynamic SAR Power Table */
- static int
--mt7921_asar_acpi_read_mtds(struct mt7921_dev *dev, u8 **table, u8 version)
-+mt792x_asar_acpi_read_mtds(struct mt792x_dev *dev, u8 **table, u8 version)
- {
- int len, ret, sarlen, prelen, tblcnt;
- bool enable;
-
-- ret = mt7921_acpi_read(dev, MT7921_ACPI_MTDS, table, &len);
-+ ret = mt792x_acpi_read(dev, MT792x_ACPI_MTDS, table, &len);
- if (ret)
- return ret;
-
- /* Table content validation */
- switch (version) {
- case 1:
-- enable = ((struct mt7921_asar_dyn *)*table)->enable;
-- sarlen = sizeof(struct mt7921_asar_dyn_limit);
-- prelen = sizeof(struct mt7921_asar_dyn);
-+ enable = ((struct mt792x_asar_dyn *)*table)->enable;
-+ sarlen = sizeof(struct mt792x_asar_dyn_limit);
-+ prelen = sizeof(struct mt792x_asar_dyn);
- break;
- case 2:
-- enable = ((struct mt7921_asar_dyn_v2 *)*table)->enable;
-- sarlen = sizeof(struct mt7921_asar_dyn_limit_v2);
-- prelen = sizeof(struct mt7921_asar_dyn_v2);
-+ enable = ((struct mt792x_asar_dyn_v2 *)*table)->enable;
-+ sarlen = sizeof(struct mt792x_asar_dyn_limit_v2);
-+ prelen = sizeof(struct mt792x_asar_dyn_v2);
- break;
- default:
- return -EINVAL;
-@@ -101,88 +104,89 @@ mt7921_asar_acpi_read_mtds(struct mt7921_dev *dev, u8 **table, u8 version)
-
- tblcnt = (len - prelen) / sarlen;
- if (!enable ||
-- tblcnt > MT7921_ASAR_MAX_DYN || tblcnt < MT7921_ASAR_MIN_DYN)
-- ret = -EINVAL;
-+ tblcnt > MT792x_ASAR_MAX_DYN || tblcnt < MT792x_ASAR_MIN_DYN)
-+ return -EINVAL;
-
-- return ret;
-+ return 0;
- }
-
- /* MTGS : Geo SAR Power Table */
- static int
--mt7921_asar_acpi_read_mtgs(struct mt7921_dev *dev, u8 **table, u8 version)
-+mt792x_asar_acpi_read_mtgs(struct mt792x_dev *dev, u8 **table, u8 version)
- {
-- int len, ret = 0, sarlen, prelen, tblcnt;
-+ int len, ret, sarlen, prelen, tblcnt;
-
-- ret = mt7921_acpi_read(dev, MT7921_ACPI_MTGS, table, &len);
-+ ret = mt792x_acpi_read(dev, MT792x_ACPI_MTGS, table, &len);
- if (ret)
- return ret;
-
- /* Table content validation */
- switch (version) {
- case 1:
-- sarlen = sizeof(struct mt7921_asar_geo_limit);
-- prelen = sizeof(struct mt7921_asar_geo);
-+ sarlen = sizeof(struct mt792x_asar_geo_limit);
-+ prelen = sizeof(struct mt792x_asar_geo);
- break;
- case 2:
-- sarlen = sizeof(struct mt7921_asar_geo_limit_v2);
-- prelen = sizeof(struct mt7921_asar_geo_v2);
-+ sarlen = sizeof(struct mt792x_asar_geo_limit_v2);
-+ prelen = sizeof(struct mt792x_asar_geo_v2);
- break;
- default:
- return -EINVAL;
- }
-
- tblcnt = (len - prelen) / sarlen;
-- if (tblcnt > MT7921_ASAR_MAX_GEO || tblcnt < MT7921_ASAR_MIN_GEO)
-- ret = -EINVAL;
-+ if (tblcnt > MT792x_ASAR_MAX_GEO || tblcnt < MT792x_ASAR_MIN_GEO)
-+ return -EINVAL;
-
-- return ret;
-+ return 0;
- }
-
- /* MTFG : Flag Table */
- static int
--mt7921_asar_acpi_read_mtfg(struct mt7921_dev *dev, u8 **table)
-+mt792x_asar_acpi_read_mtfg(struct mt792x_dev *dev, u8 **table)
- {
- int len, ret;
-
-- ret = mt7921_acpi_read(dev, MT7921_ACPI_MTFG, table, &len);
-+ ret = mt792x_acpi_read(dev, MT792x_ACPI_MTFG, table, &len);
- if (ret)
- return ret;
-
-- if (len < MT7921_ASAR_MIN_FG)
-- ret = -EINVAL;
-+ if (len < MT792x_ASAR_MIN_FG)
-+ return -EINVAL;
-
-- return ret;
-+ return 0;
- }
-
--int mt7921_init_acpi_sar(struct mt7921_dev *dev)
-+int mt792x_init_acpi_sar(struct mt792x_dev *dev)
- {
-- struct mt7921_acpi_sar *asar;
-+ struct mt792x_acpi_sar *asar;
- int ret;
-
- asar = devm_kzalloc(dev->mt76.dev, sizeof(*asar), GFP_KERNEL);
- if (!asar)
- return -ENOMEM;
-
-- mt7921_asar_acpi_read_mtcl(dev, (u8 **)&asar->countrylist, &asar->ver);
-+ mt792x_asar_acpi_read_mtcl(dev, (u8 **)&asar->countrylist, &asar->ver);
-
- /* MTDS is mandatory. Return error if table is invalid */
-- ret = mt7921_asar_acpi_read_mtds(dev, (u8 **)&asar->dyn, asar->ver);
-+ ret = mt792x_asar_acpi_read_mtds(dev, (u8 **)&asar->dyn, asar->ver);
- if (ret) {
- devm_kfree(dev->mt76.dev, asar->dyn);
- devm_kfree(dev->mt76.dev, asar->countrylist);
- devm_kfree(dev->mt76.dev, asar);
-+
- return ret;
- }
-
- /* MTGS is optional */
-- ret = mt7921_asar_acpi_read_mtgs(dev, (u8 **)&asar->geo, asar->ver);
-+ ret = mt792x_asar_acpi_read_mtgs(dev, (u8 **)&asar->geo, asar->ver);
- if (ret) {
- devm_kfree(dev->mt76.dev, asar->geo);
- asar->geo = NULL;
- }
-
- /* MTFG is optional */
-- ret = mt7921_asar_acpi_read_mtfg(dev, (u8 **)&asar->fg);
-+ ret = mt792x_asar_acpi_read_mtfg(dev, (u8 **)&asar->fg);
- if (ret) {
- devm_kfree(dev->mt76.dev, asar->fg);
- asar->fg = NULL;
-@@ -191,13 +195,14 @@ int mt7921_init_acpi_sar(struct mt7921_dev *dev)
-
- return 0;
- }
-+EXPORT_SYMBOL_GPL(mt792x_init_acpi_sar);
-
- static s8
--mt7921_asar_get_geo_pwr(struct mt7921_phy *phy,
-+mt792x_asar_get_geo_pwr(struct mt792x_phy *phy,
- enum nl80211_band band, s8 dyn_power)
- {
-- struct mt7921_acpi_sar *asar = phy->acpisar;
-- struct mt7921_asar_geo_band *band_pwr;
-+ struct mt792x_acpi_sar *asar = phy->acpisar;
-+ struct mt792x_asar_geo_band *band_pwr;
- s8 geo_power;
- u8 idx, max;
-
-@@ -248,12 +253,12 @@ mt7921_asar_get_geo_pwr(struct mt7921_phy *phy,
- }
-
- static s8
--mt7921_asar_range_pwr(struct mt7921_phy *phy,
-+mt792x_asar_range_pwr(struct mt792x_phy *phy,
- const struct cfg80211_sar_freq_ranges *range,
- u8 idx)
- {
- const struct cfg80211_sar_capa *capa = phy->mt76->hw->wiphy->sar_capa;
-- struct mt7921_acpi_sar *asar = phy->acpisar;
-+ struct mt792x_acpi_sar *asar = phy->acpisar;
- u8 *limit, band, max;
-
- if (!capa)
-@@ -277,10 +282,10 @@ mt7921_asar_range_pwr(struct mt7921_phy *phy,
- else
- band = NL80211_BAND_2GHZ;
-
-- return mt7921_asar_get_geo_pwr(phy, band, limit[idx]);
-+ return mt792x_asar_get_geo_pwr(phy, band, limit[idx]);
- }
-
--int mt7921_init_acpi_sar_power(struct mt7921_phy *phy, bool set_default)
-+int mt792x_init_acpi_sar_power(struct mt792x_phy *phy, bool set_default)
- {
- const struct cfg80211_sar_capa *capa = phy->mt76->hw->wiphy->sar_capa;
- int i;
-@@ -300,41 +305,46 @@ int mt7921_init_acpi_sar_power(struct mt7921_phy *phy, bool set_default)
- continue;
-
- frp->power = min_t(s8, set_default ? 127 : frp->power,
-- mt7921_asar_range_pwr(phy, frp->range, i));
-+ mt792x_asar_range_pwr(phy, frp->range, i));
- }
-
- return 0;
- }
-+EXPORT_SYMBOL_GPL(mt792x_init_acpi_sar_power);
-
--u8 mt7921_acpi_get_flags(struct mt7921_phy *phy)
-+u8 mt792x_acpi_get_flags(struct mt792x_phy *phy)
- {
-- struct mt7921_asar_fg *fg;
-+ struct mt792x_acpi_sar *acpisar = phy->acpisar;
-+ struct mt792x_asar_fg *fg;
- struct {
- u8 acpi_idx;
- u8 chip_idx;
- } map[] = {
-- {1, 1},
-- {4, 2},
-+ { 1, 1 },
-+ { 4, 2 },
- };
- u8 flags = BIT(0);
- int i, j;
-
-- if (!phy->acpisar)
-+ if (!acpisar)
- return 0;
-
-- fg = phy->acpisar->fg;
-+ fg = acpisar->fg;
- if (!fg)
- return flags;
-
- /* pickup necessary settings per device and
- * translate the index of bitmap for chip command.
- */
-- for (i = 0; i < fg->nr_flag; i++)
-- for (j = 0; j < ARRAY_SIZE(map); j++)
-+ for (i = 0; i < fg->nr_flag; i++) {
-+ for (j = 0; j < ARRAY_SIZE(map); j++) {
- if (fg->flag[i] == map[j].acpi_idx) {
- flags |= BIT(map[j].chip_idx);
- break;
- }
-+ }
-+ }
-
- return flags;
- }
-+EXPORT_SYMBOL_GPL(mt792x_acpi_get_flags);
-diff --git a/mt792x_acpi_sar.h b/mt792x_acpi_sar.h
-new file mode 100644
-index 00000000..d6d332e8
---- /dev/null
-+++ b/mt792x_acpi_sar.h
-@@ -0,0 +1,105 @@
-+/* SPDX-License-Identifier: ISC */
-+/* Copyright (C) 2023 MediaTek Inc. */
-+
-+#ifndef __MT7921_ACPI_SAR_H
-+#define __MT7921_ACPI_SAR_H
-+
-+#define MT792x_ASAR_MIN_DYN 1
-+#define MT792x_ASAR_MAX_DYN 8
-+#define MT792x_ASAR_MIN_GEO 3
-+#define MT792x_ASAR_MAX_GEO 8
-+#define MT792x_ASAR_MIN_FG 8
-+
-+#define MT792x_ACPI_MTCL "MTCL"
-+#define MT792x_ACPI_MTDS "MTDS"
-+#define MT792x_ACPI_MTGS "MTGS"
-+#define MT792x_ACPI_MTFG "MTFG"
-+
-+struct mt792x_asar_dyn_limit {
-+ u8 idx;
-+ u8 frp[5];
-+} __packed;
-+
-+struct mt792x_asar_dyn {
-+ u8 names[4];
-+ u8 enable;
-+ u8 nr_tbl;
-+ DECLARE_FLEX_ARRAY(struct mt792x_asar_dyn_limit, tbl);
-+} __packed;
-+
-+struct mt792x_asar_dyn_limit_v2 {
-+ u8 idx;
-+ u8 frp[11];
-+} __packed;
-+
-+struct mt792x_asar_dyn_v2 {
-+ u8 names[4];
-+ u8 enable;
-+ u8 rsvd;
-+ u8 nr_tbl;
-+ DECLARE_FLEX_ARRAY(struct mt792x_asar_dyn_limit_v2, tbl);
-+} __packed;
-+
-+struct mt792x_asar_geo_band {
-+ u8 pwr;
-+ u8 offset;
-+} __packed;
-+
-+struct mt792x_asar_geo_limit {
-+ u8 idx;
-+ /* 0:2G, 1:5G */
-+ struct mt792x_asar_geo_band band[2];
-+} __packed;
-+
-+struct mt792x_asar_geo {
-+ u8 names[4];
-+ u8 version;
-+ u8 nr_tbl;
-+ DECLARE_FLEX_ARRAY(struct mt792x_asar_geo_limit, tbl);
-+} __packed;
-+
-+struct mt792x_asar_geo_limit_v2 {
-+ u8 idx;
-+ /* 0:2G, 1:5G, 2:6G */
-+ struct mt792x_asar_geo_band band[3];
-+} __packed;
-+
-+struct mt792x_asar_geo_v2 {
-+ u8 names[4];
-+ u8 version;
-+ u8 rsvd;
-+ u8 nr_tbl;
-+ DECLARE_FLEX_ARRAY(struct mt792x_asar_geo_limit_v2, tbl);
-+} __packed;
-+
-+struct mt792x_asar_cl {
-+ u8 names[4];
-+ u8 version;
-+ u8 mode_6g;
-+ u8 cl6g[6];
-+} __packed;
-+
-+struct mt792x_asar_fg {
-+ u8 names[4];
-+ u8 version;
-+ u8 rsvd;
-+ u8 nr_flag;
-+ u8 rsvd1;
-+ u8 flag[];
-+} __packed;
-+
-+struct mt792x_acpi_sar {
-+ u8 ver;
-+ union {
-+ struct mt792x_asar_dyn *dyn;
-+ struct mt792x_asar_dyn_v2 *dyn_v2;
-+ };
-+ union {
-+ struct mt792x_asar_geo *geo;
-+ struct mt792x_asar_geo_v2 *geo_v2;
-+ };
-+ struct mt792x_asar_cl *countrylist;
-+ struct mt792x_asar_fg *fg;
-+};
-+
-+#endif
-diff --git a/mt792x_core.c b/mt792x_core.c
-new file mode 100644
-index 00000000..46be7f99
---- /dev/null
-+++ b/mt792x_core.c
-@@ -0,0 +1,844 @@
-+// SPDX-License-Identifier: ISC
-+/* Copyright (C) 2023 MediaTek Inc. */
-+
-+#include <linux/module.h>
-+#include <linux/firmware.h>
-+
-+#include "mt792x.h"
-+#include "dma.h"
-+
-+static const struct ieee80211_iface_limit if_limits[] = {
-+ {
-+ .max = MT792x_MAX_INTERFACES,
-+ .types = BIT(NL80211_IFTYPE_STATION)
-+ },
-+ {
-+ .max = 1,
-+ .types = BIT(NL80211_IFTYPE_AP)
-+ }
-+};
-+
-+static const struct ieee80211_iface_combination if_comb[] = {
-+ {
-+ .limits = if_limits,
-+ .n_limits = ARRAY_SIZE(if_limits),
-+ .max_interfaces = MT792x_MAX_INTERFACES,
-+ .num_different_channels = 1,
-+ .beacon_int_infra_match = true,
-+ },
-+};
-+
-+static const struct ieee80211_iface_limit if_limits_chanctx[] = {
-+ {
-+ .max = 2,
-+ .types = BIT(NL80211_IFTYPE_STATION) |
-+ BIT(NL80211_IFTYPE_P2P_CLIENT)
-+ },
-+ {
-+ .max = 1,
-+ .types = BIT(NL80211_IFTYPE_AP) |
-+ BIT(NL80211_IFTYPE_P2P_GO)
-+ }
-+};
-+
-+static const struct ieee80211_iface_combination if_comb_chanctx[] = {
-+ {
-+ .limits = if_limits_chanctx,
-+ .n_limits = ARRAY_SIZE(if_limits_chanctx),
-+ .max_interfaces = 2,
-+ .num_different_channels = 2,
-+ .beacon_int_infra_match = false,
-+ }
-+};
-+
-+void mt792x_tx(struct ieee80211_hw *hw, struct ieee80211_tx_control *control,
-+ struct sk_buff *skb)
-+{
-+ struct mt792x_dev *dev = mt792x_hw_dev(hw);
-+ struct mt76_phy *mphy = hw->priv;
-+ struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
-+ struct ieee80211_vif *vif = info->control.vif;
-+ struct mt76_wcid *wcid = &dev->mt76.global_wcid;
-+ int qid;
-+
-+ if (control->sta) {
-+ struct mt792x_sta *sta;
-+
-+ sta = (struct mt792x_sta *)control->sta->drv_priv;
-+ wcid = &sta->wcid;
-+ }
-+
-+ if (vif && !control->sta) {
-+ struct mt792x_vif *mvif;
-+
-+ mvif = (struct mt792x_vif *)vif->drv_priv;
-+ wcid = &mvif->sta.wcid;
-+ }
-+
-+ if (mt76_connac_pm_ref(mphy, &dev->pm)) {
-+ mt76_tx(mphy, control->sta, wcid, skb);
-+ mt76_connac_pm_unref(mphy, &dev->pm);
-+ return;
-+ }
-+
-+ qid = skb_get_queue_mapping(skb);
-+ if (qid >= MT_TXQ_PSD) {
-+ qid = IEEE80211_AC_BE;
-+ skb_set_queue_mapping(skb, qid);
-+ }
-+
-+ mt76_connac_pm_queue_skb(hw, &dev->pm, wcid, skb);
-+}
-+EXPORT_SYMBOL_GPL(mt792x_tx);
-+
-+void mt792x_remove_interface(struct ieee80211_hw *hw,
-+ struct ieee80211_vif *vif)
-+{
-+ struct mt792x_vif *mvif = (struct mt792x_vif *)vif->drv_priv;
-+ struct mt792x_sta *msta = &mvif->sta;
-+ struct mt792x_dev *dev = mt792x_hw_dev(hw);
-+ struct mt792x_phy *phy = mt792x_hw_phy(hw);
-+ int idx = msta->wcid.idx;
-+
-+ mt792x_mutex_acquire(dev);
-+ mt76_connac_free_pending_tx_skbs(&dev->pm, &msta->wcid);
-+ mt76_connac_mcu_uni_add_dev(&dev->mphy, vif, &mvif->sta.wcid, false);
-+
-+ rcu_assign_pointer(dev->mt76.wcid[idx], NULL);
-+
-+ dev->mt76.vif_mask &= ~BIT_ULL(mvif->mt76.idx);
-+ phy->omac_mask &= ~BIT_ULL(mvif->mt76.omac_idx);
-+ mt792x_mutex_release(dev);
-+
-+ spin_lock_bh(&dev->mt76.sta_poll_lock);
-+ if (!list_empty(&msta->wcid.poll_list))
-+ list_del_init(&msta->wcid.poll_list);
-+ spin_unlock_bh(&dev->mt76.sta_poll_lock);
-+
-+ mt76_packet_id_flush(&dev->mt76, &msta->wcid);
-+}
-+EXPORT_SYMBOL_GPL(mt792x_remove_interface);
-+
-+int mt792x_conf_tx(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
-+ unsigned int link_id, u16 queue,
-+ const struct ieee80211_tx_queue_params *params)
-+{
-+ struct mt792x_vif *mvif = (struct mt792x_vif *)vif->drv_priv;
-+
-+ /* no need to update right away, we'll get BSS_CHANGED_QOS */
-+ queue = mt76_connac_lmac_mapping(queue);
-+ mvif->queue_params[queue] = *params;
-+
-+ return 0;
-+}
-+EXPORT_SYMBOL_GPL(mt792x_conf_tx);
-+
-+int mt792x_get_stats(struct ieee80211_hw *hw,
-+ struct ieee80211_low_level_stats *stats)
-+{
-+ struct mt792x_phy *phy = mt792x_hw_phy(hw);
-+ struct mt76_mib_stats *mib = &phy->mib;
-+
-+ mt792x_mutex_acquire(phy->dev);
-+
-+ stats->dot11RTSSuccessCount = mib->rts_cnt;
-+ stats->dot11RTSFailureCount = mib->rts_retries_cnt;
-+ stats->dot11FCSErrorCount = mib->fcs_err_cnt;
-+ stats->dot11ACKFailureCount = mib->ack_fail_cnt;
-+
-+ mt792x_mutex_release(phy->dev);
-+
-+ return 0;
-+}
-+EXPORT_SYMBOL_GPL(mt792x_get_stats);
-+
-+u64 mt792x_get_tsf(struct ieee80211_hw *hw, struct ieee80211_vif *vif)
-+{
-+ struct mt792x_vif *mvif = (struct mt792x_vif *)vif->drv_priv;
-+ struct mt792x_dev *dev = mt792x_hw_dev(hw);
-+ u8 omac_idx = mvif->mt76.omac_idx;
-+ union {
-+ u64 t64;
-+ u32 t32[2];
-+ } tsf;
-+ u16 n;
-+
-+ mt792x_mutex_acquire(dev);
-+
-+ n = omac_idx > HW_BSSID_MAX ? HW_BSSID_0 : omac_idx;
-+ /* TSF software read */
-+ mt76_set(dev, MT_LPON_TCR(0, n), MT_LPON_TCR_SW_MODE);
-+ tsf.t32[0] = mt76_rr(dev, MT_LPON_UTTR0(0));
-+ tsf.t32[1] = mt76_rr(dev, MT_LPON_UTTR1(0));
-+
-+ mt792x_mutex_release(dev);
-+
-+ return tsf.t64;
-+}
-+EXPORT_SYMBOL_GPL(mt792x_get_tsf);
-+
-+void mt792x_set_tsf(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
-+ u64 timestamp)
-+{
-+ struct mt792x_vif *mvif = (struct mt792x_vif *)vif->drv_priv;
-+ struct mt792x_dev *dev = mt792x_hw_dev(hw);
-+ u8 omac_idx = mvif->mt76.omac_idx;
-+ union {
-+ u64 t64;
-+ u32 t32[2];
-+ } tsf = { .t64 = timestamp, };
-+ u16 n;
-+
-+ mt792x_mutex_acquire(dev);
-+
-+ n = omac_idx > HW_BSSID_MAX ? HW_BSSID_0 : omac_idx;
-+ mt76_wr(dev, MT_LPON_UTTR0(0), tsf.t32[0]);
-+ mt76_wr(dev, MT_LPON_UTTR1(0), tsf.t32[1]);
-+ /* TSF software overwrite */
-+ mt76_set(dev, MT_LPON_TCR(0, n), MT_LPON_TCR_SW_WRITE);
-+
-+ mt792x_mutex_release(dev);
-+}
-+EXPORT_SYMBOL_GPL(mt792x_set_tsf);
-+
-+void mt792x_tx_worker(struct mt76_worker *w)
-+{
-+ struct mt792x_dev *dev = container_of(w, struct mt792x_dev,
-+ mt76.tx_worker);
-+
-+ if (!mt76_connac_pm_ref(&dev->mphy, &dev->pm)) {
-+ queue_work(dev->mt76.wq, &dev->pm.wake_work);
-+ return;
-+ }
-+
-+ mt76_txq_schedule_all(&dev->mphy);
-+ mt76_connac_pm_unref(&dev->mphy, &dev->pm);
-+}
-+EXPORT_SYMBOL_GPL(mt792x_tx_worker);
-+
-+void mt792x_roc_timer(struct timer_list *timer)
-+{
-+ struct mt792x_phy *phy = from_timer(phy, timer, roc_timer);
-+
-+ ieee80211_queue_work(phy->mt76->hw, &phy->roc_work);
-+}
-+EXPORT_SYMBOL_GPL(mt792x_roc_timer);
-+
-+void mt792x_flush(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
-+ u32 queues, bool drop)
-+{
-+ struct mt792x_dev *dev = mt792x_hw_dev(hw);
-+
-+ wait_event_timeout(dev->mt76.tx_wait,
-+ !mt76_has_tx_pending(&dev->mphy), HZ / 2);
-+}
-+EXPORT_SYMBOL_GPL(mt792x_flush);
-+
-+int mt792x_assign_vif_chanctx(struct ieee80211_hw *hw,
-+ struct ieee80211_vif *vif,
-+ struct ieee80211_bss_conf *link_conf,
-+ struct ieee80211_chanctx_conf *ctx)
-+{
-+ struct mt792x_vif *mvif = (struct mt792x_vif *)vif->drv_priv;
-+ struct mt792x_dev *dev = mt792x_hw_dev(hw);
-+
-+ mutex_lock(&dev->mt76.mutex);
-+ mvif->ctx = ctx;
-+ mutex_unlock(&dev->mt76.mutex);
-+
-+ return 0;
-+}
-+EXPORT_SYMBOL_GPL(mt792x_assign_vif_chanctx);
-+
-+void mt792x_unassign_vif_chanctx(struct ieee80211_hw *hw,
-+ struct ieee80211_vif *vif,
-+ struct ieee80211_bss_conf *link_conf,
-+ struct ieee80211_chanctx_conf *ctx)
-+{
-+ struct mt792x_vif *mvif = (struct mt792x_vif *)vif->drv_priv;
-+ struct mt792x_dev *dev = mt792x_hw_dev(hw);
-+
-+ mutex_lock(&dev->mt76.mutex);
-+ mvif->ctx = NULL;
-+ mutex_unlock(&dev->mt76.mutex);
-+}
-+EXPORT_SYMBOL_GPL(mt792x_unassign_vif_chanctx);
-+
-+void mt792x_set_wakeup(struct ieee80211_hw *hw, bool enabled)
-+{
-+ struct mt792x_dev *dev = mt792x_hw_dev(hw);
-+ struct mt76_dev *mdev = &dev->mt76;
-+
-+ device_set_wakeup_enable(mdev->dev, enabled);
-+}
-+EXPORT_SYMBOL_GPL(mt792x_set_wakeup);
-+
-+static const char mt792x_gstrings_stats[][ETH_GSTRING_LEN] = {
-+ /* tx counters */
-+ "tx_ampdu_cnt",
-+ "tx_mpdu_attempts",
-+ "tx_mpdu_success",
-+ "tx_pkt_ebf_cnt",
-+ "tx_pkt_ibf_cnt",
-+ "tx_ampdu_len:0-1",
-+ "tx_ampdu_len:2-10",
-+ "tx_ampdu_len:11-19",
-+ "tx_ampdu_len:20-28",
-+ "tx_ampdu_len:29-37",
-+ "tx_ampdu_len:38-46",
-+ "tx_ampdu_len:47-55",
-+ "tx_ampdu_len:56-79",
-+ "tx_ampdu_len:80-103",
-+ "tx_ampdu_len:104-127",
-+ "tx_ampdu_len:128-151",
-+ "tx_ampdu_len:152-175",
-+ "tx_ampdu_len:176-199",
-+ "tx_ampdu_len:200-223",
-+ "tx_ampdu_len:224-247",
-+ "ba_miss_count",
-+ "tx_beamformer_ppdu_iBF",
-+ "tx_beamformer_ppdu_eBF",
-+ "tx_beamformer_rx_feedback_all",
-+ "tx_beamformer_rx_feedback_he",
-+ "tx_beamformer_rx_feedback_vht",
-+ "tx_beamformer_rx_feedback_ht",
-+ "tx_msdu_pack_1",
-+ "tx_msdu_pack_2",
-+ "tx_msdu_pack_3",
-+ "tx_msdu_pack_4",
-+ "tx_msdu_pack_5",
-+ "tx_msdu_pack_6",
-+ "tx_msdu_pack_7",
-+ "tx_msdu_pack_8",
-+ /* rx counters */
-+ "rx_mpdu_cnt",
-+ "rx_ampdu_cnt",
-+ "rx_ampdu_bytes_cnt",
-+ "rx_ba_cnt",
-+ /* per vif counters */
-+ "v_tx_mode_cck",
-+ "v_tx_mode_ofdm",
-+ "v_tx_mode_ht",
-+ "v_tx_mode_ht_gf",
-+ "v_tx_mode_vht",
-+ "v_tx_mode_he_su",
-+ "v_tx_mode_he_ext_su",
-+ "v_tx_mode_he_tb",
-+ "v_tx_mode_he_mu",
-+ "v_tx_mode_eht_su",
-+ "v_tx_mode_eht_trig",
-+ "v_tx_mode_eht_mu",
-+ "v_tx_bw_20",
-+ "v_tx_bw_40",
-+ "v_tx_bw_80",
-+ "v_tx_bw_160",
-+ "v_tx_mcs_0",
-+ "v_tx_mcs_1",
-+ "v_tx_mcs_2",
-+ "v_tx_mcs_3",
-+ "v_tx_mcs_4",
-+ "v_tx_mcs_5",
-+ "v_tx_mcs_6",
-+ "v_tx_mcs_7",
-+ "v_tx_mcs_8",
-+ "v_tx_mcs_9",
-+ "v_tx_mcs_10",
-+ "v_tx_mcs_11",
-+ "v_tx_mcs_12",
-+ "v_tx_mcs_13",
-+ "v_tx_nss_1",
-+ "v_tx_nss_2",
-+ "v_tx_nss_3",
-+ "v_tx_nss_4",
-+};
-+
-+void mt792x_get_et_strings(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
-+ u32 sset, u8 *data)
-+{
-+ if (sset != ETH_SS_STATS)
-+ return;
-+
-+ memcpy(data, *mt792x_gstrings_stats, sizeof(mt792x_gstrings_stats));
-+
-+ data += sizeof(mt792x_gstrings_stats);
-+ page_pool_ethtool_stats_get_strings(data);
-+}
-+EXPORT_SYMBOL_GPL(mt792x_get_et_strings);
-+
-+int mt792x_get_et_sset_count(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
-+ int sset)
-+{
-+ if (sset != ETH_SS_STATS)
-+ return 0;
-+
-+ return ARRAY_SIZE(mt792x_gstrings_stats) +
-+ page_pool_ethtool_stats_get_count();
-+}
-+EXPORT_SYMBOL_GPL(mt792x_get_et_sset_count);
-+
-+static void
-+mt792x_ethtool_worker(void *wi_data, struct ieee80211_sta *sta)
-+{
-+ struct mt792x_sta *msta = (struct mt792x_sta *)sta->drv_priv;
-+ struct mt76_ethtool_worker_info *wi = wi_data;
-+
-+ if (msta->vif->mt76.idx != wi->idx)
-+ return;
-+
-+ mt76_ethtool_worker(wi, &msta->wcid.stats, true);
-+}
-+
-+void mt792x_get_et_stats(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
-+ struct ethtool_stats *stats, u64 *data)
-+{
-+ struct mt792x_vif *mvif = (struct mt792x_vif *)vif->drv_priv;
-+ int stats_size = ARRAY_SIZE(mt792x_gstrings_stats);
-+ struct mt792x_phy *phy = mt792x_hw_phy(hw);
-+ struct mt792x_dev *dev = phy->dev;
-+ struct mt76_mib_stats *mib = &phy->mib;
-+ struct mt76_ethtool_worker_info wi = {
-+ .data = data,
-+ .idx = mvif->mt76.idx,
-+ };
-+ int i, ei = 0;
-+
-+ mt792x_mutex_acquire(dev);
-+
-+ mt792x_mac_update_mib_stats(phy);
-+
-+ data[ei++] = mib->tx_ampdu_cnt;
-+ data[ei++] = mib->tx_mpdu_attempts_cnt;
-+ data[ei++] = mib->tx_mpdu_success_cnt;
-+ data[ei++] = mib->tx_pkt_ebf_cnt;
-+ data[ei++] = mib->tx_pkt_ibf_cnt;
-+
-+ /* Tx ampdu stat */
-+ for (i = 0; i < 15; i++)
-+ data[ei++] = phy->mt76->aggr_stats[i];
-+
-+ data[ei++] = phy->mib.ba_miss_cnt;
-+
-+ /* Tx Beamformer monitor */
-+ data[ei++] = mib->tx_bf_ibf_ppdu_cnt;
-+ data[ei++] = mib->tx_bf_ebf_ppdu_cnt;
-+
-+ /* Tx Beamformer Rx feedback monitor */
-+ data[ei++] = mib->tx_bf_rx_fb_all_cnt;
-+ data[ei++] = mib->tx_bf_rx_fb_he_cnt;
-+ data[ei++] = mib->tx_bf_rx_fb_vht_cnt;
-+ data[ei++] = mib->tx_bf_rx_fb_ht_cnt;
-+
-+ /* Tx amsdu info (pack-count histogram) */
-+ for (i = 0; i < ARRAY_SIZE(mib->tx_amsdu); i++)
-+ data[ei++] = mib->tx_amsdu[i];
-+
-+ /* rx counters */
-+ data[ei++] = mib->rx_mpdu_cnt;
-+ data[ei++] = mib->rx_ampdu_cnt;
-+ data[ei++] = mib->rx_ampdu_bytes_cnt;
-+ data[ei++] = mib->rx_ba_cnt;
-+
-+ /* Add values for all stations owned by this vif */
-+ wi.initial_stat_idx = ei;
-+ ieee80211_iterate_stations_atomic(hw, mt792x_ethtool_worker, &wi);
-+
-+ mt792x_mutex_release(dev);
-+
-+ if (!wi.sta_count)
-+ return;
-+
-+ ei += wi.worker_stat_count;
-+
-+ mt76_ethtool_page_pool_stats(&dev->mt76, &data[ei], &ei);
-+ stats_size += page_pool_ethtool_stats_get_count();
-+
-+ if (ei != stats_size)
-+ dev_err(dev->mt76.dev, "ei: %d SSTATS_LEN: %d", ei,
-+ stats_size);
-+}
-+EXPORT_SYMBOL_GPL(mt792x_get_et_stats);
-+
-+void mt792x_sta_statistics(struct ieee80211_hw *hw,
-+ struct ieee80211_vif *vif,
-+ struct ieee80211_sta *sta,
-+ struct station_info *sinfo)
-+{
-+ struct mt792x_sta *msta = (struct mt792x_sta *)sta->drv_priv;
-+ struct rate_info *txrate = &msta->wcid.rate;
-+
-+ if (!txrate->legacy && !txrate->flags)
-+ return;
-+
-+ if (txrate->legacy) {
-+ sinfo->txrate.legacy = txrate->legacy;
-+ } else {
-+ sinfo->txrate.mcs = txrate->mcs;
-+ sinfo->txrate.nss = txrate->nss;
-+ sinfo->txrate.bw = txrate->bw;
-+ sinfo->txrate.he_gi = txrate->he_gi;
-+ sinfo->txrate.he_dcm = txrate->he_dcm;
-+ sinfo->txrate.he_ru_alloc = txrate->he_ru_alloc;
-+ }
-+ sinfo->tx_failed = msta->wcid.stats.tx_failed;
-+ sinfo->filled |= BIT_ULL(NL80211_STA_INFO_TX_FAILED);
-+
-+ sinfo->tx_retries = msta->wcid.stats.tx_retries;
-+ sinfo->filled |= BIT_ULL(NL80211_STA_INFO_TX_RETRIES);
-+
-+ sinfo->txrate.flags = txrate->flags;
-+ sinfo->filled |= BIT_ULL(NL80211_STA_INFO_TX_BITRATE);
-+
-+ sinfo->ack_signal = (s8)msta->ack_signal;
-+ sinfo->filled |= BIT_ULL(NL80211_STA_INFO_ACK_SIGNAL);
-+
-+ sinfo->avg_ack_signal = -(s8)ewma_avg_signal_read(&msta->avg_ack_signal);
-+ sinfo->filled |= BIT_ULL(NL80211_STA_INFO_ACK_SIGNAL_AVG);
-+}
-+EXPORT_SYMBOL_GPL(mt792x_sta_statistics);
-+
-+void mt792x_set_coverage_class(struct ieee80211_hw *hw, s16 coverage_class)
-+{
-+ struct mt792x_phy *phy = mt792x_hw_phy(hw);
-+ struct mt792x_dev *dev = phy->dev;
-+
-+ mt792x_mutex_acquire(dev);
-+
-+ phy->coverage_class = max_t(s16, coverage_class, 0);
-+ mt792x_mac_set_timeing(phy);
-+
-+ mt792x_mutex_release(dev);
-+}
-+EXPORT_SYMBOL_GPL(mt792x_set_coverage_class);
-+
-+int mt792x_init_wiphy(struct ieee80211_hw *hw)
-+{
-+ struct mt792x_phy *phy = mt792x_hw_phy(hw);
-+ struct mt792x_dev *dev = phy->dev;
-+ struct wiphy *wiphy = hw->wiphy;
-+
-+ hw->queues = 4;
-+ if (dev->has_eht) {
-+ hw->max_rx_aggregation_subframes = IEEE80211_MAX_AMPDU_BUF_EHT;
-+ hw->max_tx_aggregation_subframes = IEEE80211_MAX_AMPDU_BUF_EHT;
-+ } else {
-+ hw->max_rx_aggregation_subframes = IEEE80211_MAX_AMPDU_BUF_HE;
-+ hw->max_tx_aggregation_subframes = IEEE80211_MAX_AMPDU_BUF_HE;
-+ }
-+ hw->netdev_features = NETIF_F_RXCSUM;
-+
-+ hw->radiotap_timestamp.units_pos =
-+ IEEE80211_RADIOTAP_TIMESTAMP_UNIT_US;
-+
-+ phy->slottime = 9;
-+
-+ hw->sta_data_size = sizeof(struct mt792x_sta);
-+ hw->vif_data_size = sizeof(struct mt792x_vif);
-+
-+ if (dev->fw_features & MT792x_FW_CAP_CNM) {
-+ wiphy->flags |= WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL;
-+ wiphy->iface_combinations = if_comb_chanctx;
-+ wiphy->n_iface_combinations = ARRAY_SIZE(if_comb_chanctx);
-+ } else {
-+ wiphy->flags &= ~WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL;
-+ wiphy->iface_combinations = if_comb;
-+ wiphy->n_iface_combinations = ARRAY_SIZE(if_comb);
-+ }
-+ wiphy->flags &= ~(WIPHY_FLAG_IBSS_RSN | WIPHY_FLAG_4ADDR_AP |
-+ WIPHY_FLAG_4ADDR_STATION);
-+ wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION) |
-+ BIT(NL80211_IFTYPE_AP) |
-+ BIT(NL80211_IFTYPE_P2P_CLIENT) |
-+ BIT(NL80211_IFTYPE_P2P_GO);
-+ wiphy->max_remain_on_channel_duration = 5000;
-+ wiphy->max_scan_ie_len = MT76_CONNAC_SCAN_IE_LEN;
-+ wiphy->max_scan_ssids = 4;
-+ wiphy->max_sched_scan_plan_interval =
-+ MT76_CONNAC_MAX_TIME_SCHED_SCAN_INTERVAL;
-+ wiphy->max_sched_scan_ie_len = IEEE80211_MAX_DATA_LEN;
-+ wiphy->max_sched_scan_ssids = MT76_CONNAC_MAX_SCHED_SCAN_SSID;
-+ wiphy->max_match_sets = MT76_CONNAC_MAX_SCAN_MATCH;
-+ wiphy->max_sched_scan_reqs = 1;
-+ wiphy->flags |= WIPHY_FLAG_HAS_CHANNEL_SWITCH |
-+ WIPHY_FLAG_SPLIT_SCAN_6GHZ;
-+
-+ wiphy->features |= NL80211_FEATURE_SCHED_SCAN_RANDOM_MAC_ADDR |
-+ NL80211_FEATURE_SCAN_RANDOM_MAC_ADDR;
-+ wiphy_ext_feature_set(wiphy, NL80211_EXT_FEATURE_SET_SCAN_DWELL);
-+ wiphy_ext_feature_set(wiphy, NL80211_EXT_FEATURE_BEACON_RATE_LEGACY);
-+ wiphy_ext_feature_set(wiphy, NL80211_EXT_FEATURE_BEACON_RATE_HT);
-+ wiphy_ext_feature_set(wiphy, NL80211_EXT_FEATURE_BEACON_RATE_VHT);
-+ wiphy_ext_feature_set(wiphy, NL80211_EXT_FEATURE_BEACON_RATE_HE);
-+ wiphy_ext_feature_set(wiphy, NL80211_EXT_FEATURE_ACK_SIGNAL_SUPPORT);
-+ wiphy_ext_feature_set(wiphy, NL80211_EXT_FEATURE_CAN_REPLACE_PTK0);
-+
-+ ieee80211_hw_set(hw, SINGLE_SCAN_ON_ALL_BANDS);
-+ ieee80211_hw_set(hw, HAS_RATE_CONTROL);
-+ ieee80211_hw_set(hw, SUPPORTS_TX_ENCAP_OFFLOAD);
-+ ieee80211_hw_set(hw, SUPPORTS_RX_DECAP_OFFLOAD);
-+ ieee80211_hw_set(hw, WANT_MONITOR_VIF);
-+ ieee80211_hw_set(hw, SUPPORTS_PS);
-+ ieee80211_hw_set(hw, SUPPORTS_DYNAMIC_PS);
-+ ieee80211_hw_set(hw, SUPPORTS_VHT_EXT_NSS_BW);
-+ ieee80211_hw_set(hw, CONNECTION_MONITOR);
-+
-+ if (dev->pm.enable)
-+ ieee80211_hw_set(hw, CONNECTION_MONITOR);
-+
-+ hw->max_tx_fragments = 4;
-+
-+ return 0;
-+}
-+EXPORT_SYMBOL_GPL(mt792x_init_wiphy);
-+
-+static u8
-+mt792x_get_offload_capability(struct device *dev, const char *fw_wm)
-+{
-+ const struct mt76_connac2_fw_trailer *hdr;
-+ struct mt792x_realease_info *rel_info;
-+ const struct firmware *fw;
-+ int ret, i, offset = 0;
-+ const u8 *data, *end;
-+ u8 offload_caps = 0;
-+
-+ ret = request_firmware(&fw, fw_wm, dev);
-+ if (ret)
-+ return ret;
-+
-+ if (!fw || !fw->data || fw->size < sizeof(*hdr)) {
-+ dev_err(dev, "Invalid firmware\n");
-+ goto out;
-+ }
-+
-+ data = fw->data;
-+ hdr = (const void *)(fw->data + fw->size - sizeof(*hdr));
-+
-+ for (i = 0; i < hdr->n_region; i++) {
-+ const struct mt76_connac2_fw_region *region;
-+
-+ region = (const void *)((const u8 *)hdr -
-+ (hdr->n_region - i) * sizeof(*region));
-+ offset += le32_to_cpu(region->len);
-+ }
-+
-+ data += offset + 16;
-+ rel_info = (struct mt792x_realease_info *)data;
-+ data += sizeof(*rel_info);
-+ end = data + le16_to_cpu(rel_info->len);
-+
-+ while (data < end) {
-+ rel_info = (struct mt792x_realease_info *)data;
-+ data += sizeof(*rel_info);
-+
-+ if (rel_info->tag == MT792x_FW_TAG_FEATURE) {
-+ struct mt792x_fw_features *features;
-+
-+ features = (struct mt792x_fw_features *)data;
-+ offload_caps = features->data;
-+ break;
-+ }
-+
-+ data += le16_to_cpu(rel_info->len) + rel_info->pad_len;
-+ }
-+
-+out:
-+ release_firmware(fw);
-+
-+ return offload_caps;
-+}
-+
-+struct ieee80211_ops *
-+mt792x_get_mac80211_ops(struct device *dev,
-+ const struct ieee80211_ops *mac80211_ops,
-+ void *drv_data, u8 *fw_features)
-+{
-+ struct ieee80211_ops *ops;
-+
-+ ops = devm_kmemdup(dev, mac80211_ops, sizeof(struct ieee80211_ops),
-+ GFP_KERNEL);
-+ if (!ops)
-+ return NULL;
-+
-+ *fw_features = mt792x_get_offload_capability(dev, drv_data);
-+ if (!(*fw_features & MT792x_FW_CAP_CNM)) {
-+ ops->remain_on_channel = NULL;
-+ ops->cancel_remain_on_channel = NULL;
-+ ops->add_chanctx = NULL;
-+ ops->remove_chanctx = NULL;
-+ ops->change_chanctx = NULL;
-+ ops->assign_vif_chanctx = NULL;
-+ ops->unassign_vif_chanctx = NULL;
-+ ops->mgd_prepare_tx = NULL;
-+ ops->mgd_complete_tx = NULL;
-+ }
-+ return ops;
-+}
-+EXPORT_SYMBOL_GPL(mt792x_get_mac80211_ops);
-+
-+int mt792x_init_wcid(struct mt792x_dev *dev)
-+{
-+ int idx;
-+
-+ /* Beacon and mgmt frames should occupy wcid 0 */
-+ idx = mt76_wcid_alloc(dev->mt76.wcid_mask, MT792x_WTBL_STA - 1);
-+ if (idx)
-+ return -ENOSPC;
-+
-+ dev->mt76.global_wcid.idx = idx;
-+ dev->mt76.global_wcid.hw_key_idx = -1;
-+ dev->mt76.global_wcid.tx_info |= MT_WCID_TX_INFO_SET;
-+ rcu_assign_pointer(dev->mt76.wcid[idx], &dev->mt76.global_wcid);
-+
-+ return 0;
-+}
-+EXPORT_SYMBOL_GPL(mt792x_init_wcid);
-+
-+int mt792x_mcu_drv_pmctrl(struct mt792x_dev *dev)
-+{
-+ struct mt76_phy *mphy = &dev->mt76.phy;
-+ struct mt76_connac_pm *pm = &dev->pm;
-+ int err = 0;
-+
-+ mutex_lock(&pm->mutex);
-+
-+ if (!test_bit(MT76_STATE_PM, &mphy->state))
-+ goto out;
-+
-+ err = __mt792x_mcu_drv_pmctrl(dev);
-+out:
-+ mutex_unlock(&pm->mutex);
-+
-+ if (err)
-+ mt792x_reset(&dev->mt76);
-+
-+ return err;
-+}
-+EXPORT_SYMBOL_GPL(mt792x_mcu_drv_pmctrl);
-+
-+int mt792x_mcu_fw_pmctrl(struct mt792x_dev *dev)
-+{
-+ struct mt76_phy *mphy = &dev->mt76.phy;
-+ struct mt76_connac_pm *pm = &dev->pm;
-+ int err = 0;
-+
-+ mutex_lock(&pm->mutex);
-+
-+ if (mt76_connac_skip_fw_pmctrl(mphy, pm))
-+ goto out;
-+
-+ err = __mt792x_mcu_fw_pmctrl(dev);
-+out:
-+ mutex_unlock(&pm->mutex);
-+
-+ if (err)
-+ mt792x_reset(&dev->mt76);
-+
-+ return err;
-+}
-+EXPORT_SYMBOL_GPL(mt792x_mcu_fw_pmctrl);
-+
-+int __mt792xe_mcu_drv_pmctrl(struct mt792x_dev *dev)
-+{
-+ int i, err = 0;
-+
-+ for (i = 0; i < MT792x_DRV_OWN_RETRY_COUNT; i++) {
-+ mt76_wr(dev, MT_CONN_ON_LPCTL, PCIE_LPCR_HOST_CLR_OWN);
-+ if (mt76_poll_msec_tick(dev, MT_CONN_ON_LPCTL,
-+ PCIE_LPCR_HOST_OWN_SYNC, 0, 50, 1))
-+ break;
-+ }
-+
-+ if (i == MT792x_DRV_OWN_RETRY_COUNT) {
-+ dev_err(dev->mt76.dev, "driver own failed\n");
-+ err = -EIO;
-+ }
-+
-+ return err;
-+}
-+EXPORT_SYMBOL_GPL(__mt792xe_mcu_drv_pmctrl);
-+
-+int mt792xe_mcu_drv_pmctrl(struct mt792x_dev *dev)
-+{
-+ struct mt76_phy *mphy = &dev->mt76.phy;
-+ struct mt76_connac_pm *pm = &dev->pm;
-+ int err;
-+
-+ err = __mt792xe_mcu_drv_pmctrl(dev);
-+ if (err < 0)
-+ goto out;
-+
-+ mt792x_wpdma_reinit_cond(dev);
-+ clear_bit(MT76_STATE_PM, &mphy->state);
-+
-+ pm->stats.last_wake_event = jiffies;
-+ pm->stats.doze_time += pm->stats.last_wake_event -
-+ pm->stats.last_doze_event;
-+out:
-+ return err;
-+}
-+EXPORT_SYMBOL_GPL(mt792xe_mcu_drv_pmctrl);
-+
-+int mt792xe_mcu_fw_pmctrl(struct mt792x_dev *dev)
-+{
-+ struct mt76_phy *mphy = &dev->mt76.phy;
-+ struct mt76_connac_pm *pm = &dev->pm;
-+ int i;
-+
-+ for (i = 0; i < MT792x_DRV_OWN_RETRY_COUNT; i++) {
-+ mt76_wr(dev, MT_CONN_ON_LPCTL, PCIE_LPCR_HOST_SET_OWN);
-+ if (mt76_poll_msec_tick(dev, MT_CONN_ON_LPCTL,
-+ PCIE_LPCR_HOST_OWN_SYNC, 4, 50, 1))
-+ break;
-+ }
-+
-+ if (i == MT792x_DRV_OWN_RETRY_COUNT) {
-+ dev_err(dev->mt76.dev, "firmware own failed\n");
-+ clear_bit(MT76_STATE_PM, &mphy->state);
-+ return -EIO;
-+ }
-+
-+ pm->stats.last_doze_event = jiffies;
-+ pm->stats.awake_time += pm->stats.last_doze_event -
-+ pm->stats.last_wake_event;
-+
-+ return 0;
-+}
-+EXPORT_SYMBOL_GPL(mt792xe_mcu_fw_pmctrl);
-+
-+int mt792x_load_firmware(struct mt792x_dev *dev)
-+{
-+ int ret;
-+
-+ ret = mt76_connac2_load_patch(&dev->mt76, mt792x_patch_name(dev));
-+ if (ret)
-+ return ret;
-+
-+ if (mt76_is_sdio(&dev->mt76)) {
-+ /* activate again */
-+ ret = __mt792x_mcu_fw_pmctrl(dev);
-+ if (!ret)
-+ ret = __mt792x_mcu_drv_pmctrl(dev);
-+ }
-+
-+ ret = mt76_connac2_load_ram(&dev->mt76, mt792x_ram_name(dev), NULL);
-+ if (ret)
-+ return ret;
-+
-+ if (!mt76_poll_msec(dev, MT_CONN_ON_MISC, MT_TOP_MISC2_FW_N9_RDY,
-+ MT_TOP_MISC2_FW_N9_RDY, 1500)) {
-+ dev_err(dev->mt76.dev, "Timeout for initializing firmware\n");
-+
-+ return -EIO;
-+ }
-+
-+#ifdef CONFIG_PM
-+ dev->mt76.hw->wiphy->wowlan = &mt76_connac_wowlan_support;
-+#endif /* CONFIG_PM */
-+
-+ dev_dbg(dev->mt76.dev, "Firmware init done\n");
-+
-+ return 0;
-+}
-+EXPORT_SYMBOL_GPL(mt792x_load_firmware);
-+
-+MODULE_LICENSE("Dual BSD/GPL");
-+MODULE_AUTHOR("Lorenzo Bianconi <lorenzo@kernel.org>");
-diff --git a/mt792x_debugfs.c b/mt792x_debugfs.c
-new file mode 100644
-index 00000000..9858d9a9
---- /dev/null
-+++ b/mt792x_debugfs.c
-@@ -0,0 +1,168 @@
-+// SPDX-License-Identifier: ISC
-+/* Copyright (C) 2023 MediaTek Inc. */
-+
-+#include "mt792x.h"
-+
-+static void
-+mt792x_ampdu_stat_read_phy(struct mt792x_phy *phy,
-+ struct seq_file *file)
-+{
-+ struct mt792x_dev *dev = file->private;
-+ int bound[15], range[4], i;
-+
-+ if (!phy)
-+ return;
-+
-+ mt792x_mac_update_mib_stats(phy);
-+
-+ /* Tx ampdu stat */
-+ for (i = 0; i < ARRAY_SIZE(range); i++)
-+ range[i] = mt76_rr(dev, MT_MIB_ARNG(0, i));
-+
-+ for (i = 0; i < ARRAY_SIZE(bound); i++)
-+ bound[i] = MT_MIB_ARNCR_RANGE(range[i / 4], i % 4) + 1;
-+
-+ seq_puts(file, "\nPhy0\n");
-+
-+ seq_printf(file, "Length: %8d | ", bound[0]);
-+ for (i = 0; i < ARRAY_SIZE(bound) - 1; i++)
-+ seq_printf(file, "%3d %3d | ", bound[i] + 1, bound[i + 1]);
-+
-+ seq_puts(file, "\nCount: ");
-+ for (i = 0; i < ARRAY_SIZE(bound); i++)
-+ seq_printf(file, "%8d | ", phy->mt76->aggr_stats[i]);
-+ seq_puts(file, "\n");
-+
-+ seq_printf(file, "BA miss count: %d\n", phy->mib.ba_miss_cnt);
-+}
-+
-+int mt792x_tx_stats_show(struct seq_file *file, void *data)
-+{
-+ struct mt792x_dev *dev = file->private;
-+ struct mt792x_phy *phy = &dev->phy;
-+ struct mt76_mib_stats *mib = &phy->mib;
-+ int i;
-+
-+ mt792x_mutex_acquire(dev);
-+
-+ mt792x_ampdu_stat_read_phy(phy, file);
-+
-+ seq_puts(file, "Tx MSDU stat:\n");
-+ for (i = 0; i < ARRAY_SIZE(mib->tx_amsdu); i++) {
-+ seq_printf(file, "AMSDU pack count of %d MSDU in TXD: %8d ",
-+ i + 1, mib->tx_amsdu[i]);
-+ if (mib->tx_amsdu_cnt)
-+ seq_printf(file, "(%3d%%)\n",
-+ mib->tx_amsdu[i] * 100 / mib->tx_amsdu_cnt);
-+ else
-+ seq_puts(file, "\n");
-+ }
-+
-+ mt792x_mutex_release(dev);
-+
-+ return 0;
-+}
-+EXPORT_SYMBOL_GPL(mt792x_tx_stats_show);
-+
-+int mt792x_queues_acq(struct seq_file *s, void *data)
-+{
-+ struct mt792x_dev *dev = dev_get_drvdata(s->private);
-+ int i;
-+
-+ mt792x_mutex_acquire(dev);
-+
-+ for (i = 0; i < 4; i++) {
-+ u32 ctrl, val, qlen = 0;
-+ int j;
-+
-+ val = mt76_rr(dev, MT_PLE_AC_QEMPTY(i));
-+ ctrl = BIT(31) | BIT(11) | (i << 24);
-+
-+ for (j = 0; j < 32; j++) {
-+ if (val & BIT(j))
-+ continue;
-+
-+ mt76_wr(dev, MT_PLE_FL_Q0_CTRL, ctrl | j);
-+ qlen += mt76_get_field(dev, MT_PLE_FL_Q3_CTRL,
-+ GENMASK(11, 0));
-+ }
-+ seq_printf(s, "AC%d: queued=%d\n", i, qlen);
-+ }
-+
-+ mt792x_mutex_release(dev);
-+
-+ return 0;
-+}
-+EXPORT_SYMBOL_GPL(mt792x_queues_acq);
-+
-+int mt792x_queues_read(struct seq_file *s, void *data)
-+{
-+ struct mt792x_dev *dev = dev_get_drvdata(s->private);
-+ struct {
-+ struct mt76_queue *q;
-+ char *queue;
-+ } queue_map[] = {
-+ { dev->mphy.q_tx[MT_TXQ_BE], "WFDMA0" },
-+ { dev->mt76.q_mcu[MT_MCUQ_WM], "MCUWM" },
-+ { dev->mt76.q_mcu[MT_MCUQ_FWDL], "MCUFWQ" },
-+ };
-+ int i;
-+
-+ for (i = 0; i < ARRAY_SIZE(queue_map); i++) {
-+ struct mt76_queue *q = queue_map[i].q;
-+
-+ if (!q)
-+ continue;
-+
-+ seq_printf(s,
-+ "%s: queued=%d head=%d tail=%d\n",
-+ queue_map[i].queue, q->queued, q->head,
-+ q->tail);
-+ }
-+
-+ return 0;
-+}
-+EXPORT_SYMBOL_GPL(mt792x_queues_read);
-+
-+int mt792x_pm_stats(struct seq_file *s, void *data)
-+{
-+ struct mt792x_dev *dev = dev_get_drvdata(s->private);
-+ struct mt76_connac_pm *pm = &dev->pm;
-+
-+ unsigned long awake_time = pm->stats.awake_time;
-+ unsigned long doze_time = pm->stats.doze_time;
-+
-+ if (!test_bit(MT76_STATE_PM, &dev->mphy.state))
-+ awake_time += jiffies - pm->stats.last_wake_event;
-+ else
-+ doze_time += jiffies - pm->stats.last_doze_event;
-+
-+ seq_printf(s, "awake time: %14u\ndoze time: %15u\n",
-+ jiffies_to_msecs(awake_time),
-+ jiffies_to_msecs(doze_time));
-+
-+ seq_printf(s, "low power wakes: %9d\n", pm->stats.lp_wake);
-+
-+ return 0;
-+}
-+EXPORT_SYMBOL_GPL(mt792x_pm_stats);
-+
-+int mt792x_pm_idle_timeout_set(void *data, u64 val)
-+{
-+ struct mt792x_dev *dev = data;
-+
-+ dev->pm.idle_timeout = msecs_to_jiffies(val);
-+
-+ return 0;
-+}
-+EXPORT_SYMBOL_GPL(mt792x_pm_idle_timeout_set);
-+
-+int mt792x_pm_idle_timeout_get(void *data, u64 *val)
-+{
-+ struct mt792x_dev *dev = data;
-+
-+ *val = jiffies_to_msecs(dev->pm.idle_timeout);
-+
-+ return 0;
-+}
-+EXPORT_SYMBOL_GPL(mt792x_pm_idle_timeout_get);
-diff --git a/mt7921/dma.c b/mt792x_dma.c
-similarity index 55%
-rename from mt7921/dma.c
-rename to mt792x_dma.c
-index 4153cd6c..a3dbd386 100644
---- a/mt7921/dma.c
-+++ b/mt792x_dma.c
-@@ -1,52 +1,93 @@
- // SPDX-License-Identifier: ISC
--/* Copyright (C) 2020 MediaTek Inc. */
-+/* Copyright (C) 2023 MediaTek Inc. */
-
--#include "mt7921.h"
--#include "../dma.h"
--#include "../mt76_connac2_mac.h"
-+#include <linux/module.h>
-+#include <linux/firmware.h>
-
--static int mt7921_poll_tx(struct napi_struct *napi, int budget)
-+#include "mt792x.h"
-+#include "dma.h"
-+#include "trace.h"
-+
-+irqreturn_t mt792x_irq_handler(int irq, void *dev_instance)
- {
-- struct mt7921_dev *dev;
-+ struct mt792x_dev *dev = dev_instance;
-
-- dev = container_of(napi, struct mt7921_dev, mt76.tx_napi);
-+ mt76_wr(dev, dev->irq_map->host_irq_enable, 0);
-
-- if (!mt76_connac_pm_ref(&dev->mphy, &dev->pm)) {
-- napi_complete(napi);
-- queue_work(dev->mt76.wq, &dev->pm.wake_work);
-- return 0;
-- }
-+ if (!test_bit(MT76_STATE_INITIALIZED, &dev->mphy.state))
-+ return IRQ_NONE;
-
-- mt76_connac_tx_cleanup(&dev->mt76);
-- if (napi_complete(napi))
-- mt76_connac_irq_enable(&dev->mt76, MT_INT_TX_DONE_ALL);
-- mt76_connac_pm_unref(&dev->mphy, &dev->pm);
-+ tasklet_schedule(&dev->mt76.irq_tasklet);
-
-- return 0;
-+ return IRQ_HANDLED;
- }
-+EXPORT_SYMBOL_GPL(mt792x_irq_handler);
-
--static int mt7921_poll_rx(struct napi_struct *napi, int budget)
-+void mt792x_irq_tasklet(unsigned long data)
- {
-- struct mt7921_dev *dev;
-- int done;
-+ struct mt792x_dev *dev = (struct mt792x_dev *)data;
-+ const struct mt792x_irq_map *irq_map = dev->irq_map;
-+ u32 intr, mask = 0;
-
-- dev = container_of(napi->dev, struct mt7921_dev, mt76.napi_dev);
-+ mt76_wr(dev, irq_map->host_irq_enable, 0);
-
-- if (!mt76_connac_pm_ref(&dev->mphy, &dev->pm)) {
-- napi_complete(napi);
-- queue_work(dev->mt76.wq, &dev->pm.wake_work);
-- return 0;
-+ intr = mt76_rr(dev, MT_WFDMA0_HOST_INT_STA);
-+ intr &= dev->mt76.mmio.irqmask;
-+ mt76_wr(dev, MT_WFDMA0_HOST_INT_STA, intr);
-+
-+ trace_dev_irq(&dev->mt76, intr, dev->mt76.mmio.irqmask);
-+
-+ mask |= intr & (irq_map->rx.data_complete_mask |
-+ irq_map->rx.wm_complete_mask |
-+ irq_map->rx.wm2_complete_mask);
-+ if (intr & dev->irq_map->tx.mcu_complete_mask)
-+ mask |= dev->irq_map->tx.mcu_complete_mask;
-+
-+ if (intr & MT_INT_MCU_CMD) {
-+ u32 intr_sw;
-+
-+ intr_sw = mt76_rr(dev, MT_MCU_CMD);
-+ /* ack MCU2HOST_SW_INT_STA */
-+ mt76_wr(dev, MT_MCU_CMD, intr_sw);
-+ if (intr_sw & MT_MCU_CMD_WAKE_RX_PCIE) {
-+ mask |= irq_map->rx.data_complete_mask;
-+ intr |= irq_map->rx.data_complete_mask;
-+ }
- }
-- done = mt76_dma_rx_poll(napi, budget);
-- mt76_connac_pm_unref(&dev->mphy, &dev->pm);
-
-- return done;
-+ mt76_set_irq_mask(&dev->mt76, irq_map->host_irq_enable, mask, 0);
-+
-+ if (intr & dev->irq_map->tx.all_complete_mask)
-+ napi_schedule(&dev->mt76.tx_napi);
-+
-+ if (intr & irq_map->rx.wm_complete_mask)
-+ napi_schedule(&dev->mt76.napi[MT_RXQ_MCU]);
-+
-+ if (intr & irq_map->rx.wm2_complete_mask)
-+ napi_schedule(&dev->mt76.napi[MT_RXQ_MCU_WA]);
-+
-+ if (intr & irq_map->rx.data_complete_mask)
-+ napi_schedule(&dev->mt76.napi[MT_RXQ_MAIN]);
- }
-+EXPORT_SYMBOL_GPL(mt792x_irq_tasklet);
-
--static void mt7921_dma_prefetch(struct mt7921_dev *dev)
-+void mt792x_rx_poll_complete(struct mt76_dev *mdev, enum mt76_rxq_id q)
- {
--#define PREFETCH(base, depth) ((base) << 16 | (depth))
-+ struct mt792x_dev *dev = container_of(mdev, struct mt792x_dev, mt76);
-+ const struct mt792x_irq_map *irq_map = dev->irq_map;
-+
-+ if (q == MT_RXQ_MAIN)
-+ mt76_connac_irq_enable(mdev, irq_map->rx.data_complete_mask);
-+ else if (q == MT_RXQ_MCU_WA)
-+ mt76_connac_irq_enable(mdev, irq_map->rx.wm2_complete_mask);
-+ else
-+ mt76_connac_irq_enable(mdev, irq_map->rx.wm_complete_mask);
-+}
-+EXPORT_SYMBOL_GPL(mt792x_rx_poll_complete);
-
-+#define PREFETCH(base, depth) ((base) << 16 | (depth))
-+static void mt792x_dma_prefetch(struct mt792x_dev *dev)
-+{
- mt76_wr(dev, MT_WFDMA0_RX_RING0_EXT_CTRL, PREFETCH(0x0, 0x4));
- mt76_wr(dev, MT_WFDMA0_RX_RING2_EXT_CTRL, PREFETCH(0x40, 0x4));
- mt76_wr(dev, MT_WFDMA0_RX_RING3_EXT_CTRL, PREFETCH(0x80, 0x4));
-@@ -64,44 +105,10 @@ static void mt7921_dma_prefetch(struct mt7921_dev *dev)
- mt76_wr(dev, MT_WFDMA0_TX_RING17_EXT_CTRL, PREFETCH(0x380, 0x4));
- }
-
--static int mt7921_dma_disable(struct mt7921_dev *dev, bool force)
--{
-- /* disable WFDMA0 */
-- mt76_clear(dev, MT_WFDMA0_GLO_CFG,
-- MT_WFDMA0_GLO_CFG_TX_DMA_EN | MT_WFDMA0_GLO_CFG_RX_DMA_EN |
-- MT_WFDMA0_GLO_CFG_CSR_DISP_BASE_PTR_CHAIN_EN |
-- MT_WFDMA0_GLO_CFG_OMIT_TX_INFO |
-- MT_WFDMA0_GLO_CFG_OMIT_RX_INFO |
-- MT_WFDMA0_GLO_CFG_OMIT_RX_INFO_PFET2);
--
-- if (!mt76_poll_msec_tick(dev, MT_WFDMA0_GLO_CFG,
-- MT_WFDMA0_GLO_CFG_TX_DMA_BUSY |
-- MT_WFDMA0_GLO_CFG_RX_DMA_BUSY, 0, 100, 1))
-- return -ETIMEDOUT;
--
-- /* disable dmashdl */
-- mt76_clear(dev, MT_WFDMA0_GLO_CFG_EXT0,
-- MT_WFDMA0_CSR_TX_DMASHDL_ENABLE);
-- mt76_set(dev, MT_DMASHDL_SW_CONTROL, MT_DMASHDL_DMASHDL_BYPASS);
--
-- if (force) {
-- /* reset */
-- mt76_clear(dev, MT_WFDMA0_RST,
-- MT_WFDMA0_RST_DMASHDL_ALL_RST |
-- MT_WFDMA0_RST_LOGIC_RST);
--
-- mt76_set(dev, MT_WFDMA0_RST,
-- MT_WFDMA0_RST_DMASHDL_ALL_RST |
-- MT_WFDMA0_RST_LOGIC_RST);
-- }
--
-- return 0;
--}
--
--static int mt7921_dma_enable(struct mt7921_dev *dev)
-+int mt792x_dma_enable(struct mt792x_dev *dev)
- {
- /* configure perfetch settings */
-- mt7921_dma_prefetch(dev);
-+ mt792x_dma_prefetch(dev);
-
- /* reset dma idx */
- mt76_wr(dev, MT_WFDMA0_RST_DTX_PTR, ~0);
-@@ -124,18 +131,23 @@ static int mt7921_dma_enable(struct mt7921_dev *dev)
-
- /* enable interrupts for TX/RX rings */
- mt76_connac_irq_enable(&dev->mt76,
-- MT_INT_RX_DONE_ALL | MT_INT_TX_DONE_ALL |
-+ dev->irq_map->tx.all_complete_mask |
-+ dev->irq_map->rx.data_complete_mask |
-+ dev->irq_map->rx.wm2_complete_mask |
-+ dev->irq_map->rx.wm_complete_mask |
- MT_INT_MCU_CMD);
- mt76_set(dev, MT_MCU2HOST_SW_INT_ENA, MT_MCU_CMD_WAKE_RX_PCIE);
-
- return 0;
- }
-+EXPORT_SYMBOL_GPL(mt792x_dma_enable);
-
--static int mt7921_dma_reset(struct mt7921_dev *dev, bool force)
-+static int
-+mt792x_dma_reset(struct mt792x_dev *dev, bool force)
- {
- int i, err;
-
-- err = mt7921_dma_disable(dev, force);
-+ err = mt792x_dma_disable(dev, force);
- if (err)
- return err;
-
-@@ -151,23 +163,10 @@ static int mt7921_dma_reset(struct mt7921_dev *dev, bool force)
-
- mt76_tx_status_check(&dev->mt76, true);
-
-- return mt7921_dma_enable(dev);
--}
--
--int mt7921_wfsys_reset(struct mt7921_dev *dev)
--{
-- mt76_clear(dev, MT_WFSYS_SW_RST_B, WFSYS_SW_RST_B);
-- msleep(50);
-- mt76_set(dev, MT_WFSYS_SW_RST_B, WFSYS_SW_RST_B);
--
-- if (!__mt76_poll_msec(&dev->mt76, MT_WFSYS_SW_RST_B,
-- WFSYS_SW_INIT_DONE, WFSYS_SW_INIT_DONE, 500))
-- return -ETIMEDOUT;
--
-- return 0;
-+ return mt792x_dma_enable(dev);
- }
-
--int mt7921_wpdma_reset(struct mt7921_dev *dev, bool force)
-+int mt792x_wpdma_reset(struct mt792x_dev *dev, bool force)
- {
- int i, err;
-
-@@ -182,11 +181,11 @@ int mt7921_wpdma_reset(struct mt7921_dev *dev, bool force)
- mt76_queue_rx_cleanup(dev, &dev->mt76.q_rx[i]);
-
- if (force) {
-- err = mt7921_wfsys_reset(dev);
-+ err = mt792x_wfsys_reset(dev);
- if (err)
- return err;
- }
-- err = mt7921_dma_reset(dev, force);
-+ err = mt792x_dma_reset(dev, force);
- if (err)
- return err;
-
-@@ -195,19 +194,20 @@ int mt7921_wpdma_reset(struct mt7921_dev *dev, bool force)
-
- return 0;
- }
-+EXPORT_SYMBOL_GPL(mt792x_wpdma_reset);
-
--int mt7921_wpdma_reinit_cond(struct mt7921_dev *dev)
-+int mt792x_wpdma_reinit_cond(struct mt792x_dev *dev)
- {
- struct mt76_connac_pm *pm = &dev->pm;
- int err;
-
- /* check if the wpdma must be reinitialized */
-- if (mt7921_dma_need_reinit(dev)) {
-+ if (mt792x_dma_need_reinit(dev)) {
- /* disable interrutpts */
-- mt76_wr(dev, MT_WFDMA0_HOST_INT_ENA, 0);
-+ mt76_wr(dev, dev->irq_map->host_irq_enable, 0);
- mt76_wr(dev, MT_PCIE_MAC_INT_ENABLE, 0x0);
-
-- err = mt7921_wpdma_reset(dev, false);
-+ err = mt792x_wpdma_reset(dev, false);
- if (err) {
- dev_err(dev->mt76.dev, "wpdma reset failed\n");
- return err;
-@@ -220,73 +220,44 @@ int mt7921_wpdma_reinit_cond(struct mt7921_dev *dev)
-
- return 0;
- }
-+EXPORT_SYMBOL_GPL(mt792x_wpdma_reinit_cond);
-
--int mt7921_dma_init(struct mt7921_dev *dev)
-+int mt792x_dma_disable(struct mt792x_dev *dev, bool force)
- {
-- int ret;
--
-- mt76_dma_attach(&dev->mt76);
--
-- ret = mt7921_dma_disable(dev, true);
-- if (ret)
-- return ret;
--
-- /* init tx queue */
-- ret = mt76_connac_init_tx_queues(dev->phy.mt76, MT7921_TXQ_BAND0,
-- MT7921_TX_RING_SIZE,
-- MT_TX_RING_BASE, 0);
-- if (ret)
-- return ret;
--
-- mt76_wr(dev, MT_WFDMA0_TX_RING0_EXT_CTRL, 0x4);
--
-- /* command to WM */
-- ret = mt76_init_mcu_queue(&dev->mt76, MT_MCUQ_WM, MT7921_TXQ_MCU_WM,
-- MT7921_TX_MCU_RING_SIZE, MT_TX_RING_BASE);
-- if (ret)
-- return ret;
--
-- /* firmware download */
-- ret = mt76_init_mcu_queue(&dev->mt76, MT_MCUQ_FWDL, MT7921_TXQ_FWDL,
-- MT7921_TX_FWDL_RING_SIZE, MT_TX_RING_BASE);
-- if (ret)
-- return ret;
--
-- /* event from WM before firmware download */
-- ret = mt76_queue_alloc(dev, &dev->mt76.q_rx[MT_RXQ_MCU],
-- MT7921_RXQ_MCU_WM,
-- MT7921_RX_MCU_RING_SIZE,
-- MT_RX_BUF_SIZE, MT_RX_EVENT_RING_BASE);
-- if (ret)
-- return ret;
--
-- /* Change mcu queue after firmware download */
-- ret = mt76_queue_alloc(dev, &dev->mt76.q_rx[MT_RXQ_MCU_WA],
-- MT7921_RXQ_MCU_WM,
-- MT7921_RX_MCU_RING_SIZE,
-- MT_RX_BUF_SIZE, MT_WFDMA0(0x540));
-- if (ret)
-- return ret;
--
-- /* rx data */
-- ret = mt76_queue_alloc(dev, &dev->mt76.q_rx[MT_RXQ_MAIN],
-- MT7921_RXQ_BAND0, MT7921_RX_RING_SIZE,
-- MT_RX_BUF_SIZE, MT_RX_DATA_RING_BASE);
-- if (ret)
-- return ret;
--
-- ret = mt76_init_queues(dev, mt7921_poll_rx);
-- if (ret < 0)
-- return ret;
--
-- netif_napi_add_tx(&dev->mt76.tx_napi_dev, &dev->mt76.tx_napi,
-- mt7921_poll_tx);
-- napi_enable(&dev->mt76.tx_napi);
--
-- return mt7921_dma_enable(dev);
-+ /* disable WFDMA0 */
-+ mt76_clear(dev, MT_WFDMA0_GLO_CFG,
-+ MT_WFDMA0_GLO_CFG_TX_DMA_EN | MT_WFDMA0_GLO_CFG_RX_DMA_EN |
-+ MT_WFDMA0_GLO_CFG_CSR_DISP_BASE_PTR_CHAIN_EN |
-+ MT_WFDMA0_GLO_CFG_OMIT_TX_INFO |
-+ MT_WFDMA0_GLO_CFG_OMIT_RX_INFO |
-+ MT_WFDMA0_GLO_CFG_OMIT_RX_INFO_PFET2);
-+
-+ if (!mt76_poll_msec_tick(dev, MT_WFDMA0_GLO_CFG,
-+ MT_WFDMA0_GLO_CFG_TX_DMA_BUSY |
-+ MT_WFDMA0_GLO_CFG_RX_DMA_BUSY, 0, 100, 1))
-+ return -ETIMEDOUT;
-+
-+ /* disable dmashdl */
-+ mt76_clear(dev, MT_WFDMA0_GLO_CFG_EXT0,
-+ MT_WFDMA0_CSR_TX_DMASHDL_ENABLE);
-+ mt76_set(dev, MT_DMASHDL_SW_CONTROL, MT_DMASHDL_DMASHDL_BYPASS);
-+
-+ if (force) {
-+ /* reset */
-+ mt76_clear(dev, MT_WFDMA0_RST,
-+ MT_WFDMA0_RST_DMASHDL_ALL_RST |
-+ MT_WFDMA0_RST_LOGIC_RST);
-+
-+ mt76_set(dev, MT_WFDMA0_RST,
-+ MT_WFDMA0_RST_DMASHDL_ALL_RST |
-+ MT_WFDMA0_RST_LOGIC_RST);
-+ }
-+
-+ return 0;
- }
-+EXPORT_SYMBOL_GPL(mt792x_dma_disable);
-
--void mt7921_dma_cleanup(struct mt7921_dev *dev)
-+void mt792x_dma_cleanup(struct mt792x_dev *dev)
- {
- /* disable */
- mt76_clear(dev, MT_WFDMA0_GLO_CFG,
-@@ -312,3 +283,62 @@ void mt7921_dma_cleanup(struct mt7921_dev *dev)
-
- mt76_dma_cleanup(&dev->mt76);
- }
-+EXPORT_SYMBOL_GPL(mt792x_dma_cleanup);
-+
-+int mt792x_poll_tx(struct napi_struct *napi, int budget)
-+{
-+ struct mt792x_dev *dev;
-+
-+ dev = container_of(napi, struct mt792x_dev, mt76.tx_napi);
-+
-+ if (!mt76_connac_pm_ref(&dev->mphy, &dev->pm)) {
-+ napi_complete(napi);
-+ queue_work(dev->mt76.wq, &dev->pm.wake_work);
-+ return 0;
-+ }
-+
-+ mt76_connac_tx_cleanup(&dev->mt76);
-+ if (napi_complete(napi))
-+ mt76_connac_irq_enable(&dev->mt76,
-+ dev->irq_map->tx.all_complete_mask);
-+ mt76_connac_pm_unref(&dev->mphy, &dev->pm);
-+
-+ return 0;
-+}
-+EXPORT_SYMBOL_GPL(mt792x_poll_tx);
-+
-+int mt792x_poll_rx(struct napi_struct *napi, int budget)
-+{
-+ struct mt792x_dev *dev;
-+ int done;
-+
-+ dev = container_of(napi->dev, struct mt792x_dev, mt76.napi_dev);
-+
-+ if (!mt76_connac_pm_ref(&dev->mphy, &dev->pm)) {
-+ napi_complete(napi);
-+ queue_work(dev->mt76.wq, &dev->pm.wake_work);
-+ return 0;
-+ }
-+ done = mt76_dma_rx_poll(napi, budget);
-+ mt76_connac_pm_unref(&dev->mphy, &dev->pm);
-+
-+ return done;
-+}
-+EXPORT_SYMBOL_GPL(mt792x_poll_rx);
-+
-+int mt792x_wfsys_reset(struct mt792x_dev *dev)
-+{
-+ u32 addr = is_mt7921(&dev->mt76) ? 0x18000140 : 0x7c000140;
-+
-+ mt76_clear(dev, addr, WFSYS_SW_RST_B);
-+ msleep(50);
-+ mt76_set(dev, addr, WFSYS_SW_RST_B);
-+
-+ if (!__mt76_poll_msec(&dev->mt76, addr, WFSYS_SW_INIT_DONE,
-+ WFSYS_SW_INIT_DONE, 500))
-+ return -ETIMEDOUT;
-+
-+ return 0;
-+}
-+EXPORT_SYMBOL_GPL(mt792x_wfsys_reset);
-+
-diff --git a/mt792x_mac.c b/mt792x_mac.c
-new file mode 100644
-index 00000000..5d1f8229
---- /dev/null
-+++ b/mt792x_mac.c
-@@ -0,0 +1,385 @@
-+// SPDX-License-Identifier: ISC
-+/* Copyright (C) 2023 MediaTek Inc. */
-+
-+#include <linux/module.h>
-+
-+#include "mt792x.h"
-+#include "mt792x_regs.h"
-+
-+void mt792x_mac_work(struct work_struct *work)
-+{
-+ struct mt792x_phy *phy;
-+ struct mt76_phy *mphy;
-+
-+ mphy = (struct mt76_phy *)container_of(work, struct mt76_phy,
-+ mac_work.work);
-+ phy = mphy->priv;
-+
-+ mt792x_mutex_acquire(phy->dev);
-+
-+ mt76_update_survey(mphy);
-+ if (++mphy->mac_work_count == 2) {
-+ mphy->mac_work_count = 0;
-+
-+ mt792x_mac_update_mib_stats(phy);
-+ }
-+
-+ mt792x_mutex_release(phy->dev);
-+
-+ mt76_tx_status_check(mphy->dev, false);
-+ ieee80211_queue_delayed_work(phy->mt76->hw, &mphy->mac_work,
-+ MT792x_WATCHDOG_TIME);
-+}
-+EXPORT_SYMBOL_GPL(mt792x_mac_work);
-+
-+void mt792x_mac_set_timeing(struct mt792x_phy *phy)
-+{
-+ s16 coverage_class = phy->coverage_class;
-+ struct mt792x_dev *dev = phy->dev;
-+ u32 val, reg_offset;
-+ u32 cck = FIELD_PREP(MT_TIMEOUT_VAL_PLCP, 231) |
-+ FIELD_PREP(MT_TIMEOUT_VAL_CCA, 48);
-+ u32 ofdm = FIELD_PREP(MT_TIMEOUT_VAL_PLCP, 60) |
-+ FIELD_PREP(MT_TIMEOUT_VAL_CCA, 28);
-+ bool is_2ghz = phy->mt76->chandef.chan->band == NL80211_BAND_2GHZ;
-+ int sifs = is_2ghz ? 10 : 16, offset;
-+
-+ if (!test_bit(MT76_STATE_RUNNING, &phy->mt76->state))
-+ return;
-+
-+ mt76_set(dev, MT_ARB_SCR(0),
-+ MT_ARB_SCR_TX_DISABLE | MT_ARB_SCR_RX_DISABLE);
-+ udelay(1);
-+
-+ offset = 3 * coverage_class;
-+ reg_offset = FIELD_PREP(MT_TIMEOUT_VAL_PLCP, offset) |
-+ FIELD_PREP(MT_TIMEOUT_VAL_CCA, offset);
-+
-+ mt76_wr(dev, MT_TMAC_CDTR(0), cck + reg_offset);
-+ mt76_wr(dev, MT_TMAC_ODTR(0), ofdm + reg_offset);
-+ mt76_wr(dev, MT_TMAC_ICR0(0),
-+ FIELD_PREP(MT_IFS_EIFS, 360) |
-+ FIELD_PREP(MT_IFS_RIFS, 2) |
-+ FIELD_PREP(MT_IFS_SIFS, sifs) |
-+ FIELD_PREP(MT_IFS_SLOT, phy->slottime));
-+
-+ if (phy->slottime < 20 || !is_2ghz)
-+ val = MT792x_CFEND_RATE_DEFAULT;
-+ else
-+ val = MT792x_CFEND_RATE_11B;
-+
-+ mt76_rmw_field(dev, MT_AGG_ACR0(0), MT_AGG_ACR_CFEND_RATE, val);
-+ mt76_clear(dev, MT_ARB_SCR(0),
-+ MT_ARB_SCR_TX_DISABLE | MT_ARB_SCR_RX_DISABLE);
-+}
-+EXPORT_SYMBOL_GPL(mt792x_mac_set_timeing);
-+
-+void mt792x_mac_update_mib_stats(struct mt792x_phy *phy)
-+{
-+ struct mt76_mib_stats *mib = &phy->mib;
-+ struct mt792x_dev *dev = phy->dev;
-+ int i, aggr0 = 0, aggr1;
-+ u32 val;
-+
-+ mib->fcs_err_cnt += mt76_get_field(dev, MT_MIB_SDR3(0),
-+ MT_MIB_SDR3_FCS_ERR_MASK);
-+ mib->ack_fail_cnt += mt76_get_field(dev, MT_MIB_MB_BSDR3(0),
-+ MT_MIB_ACK_FAIL_COUNT_MASK);
-+ mib->ba_miss_cnt += mt76_get_field(dev, MT_MIB_MB_BSDR2(0),
-+ MT_MIB_BA_FAIL_COUNT_MASK);
-+ mib->rts_cnt += mt76_get_field(dev, MT_MIB_MB_BSDR0(0),
-+ MT_MIB_RTS_COUNT_MASK);
-+ mib->rts_retries_cnt += mt76_get_field(dev, MT_MIB_MB_BSDR1(0),
-+ MT_MIB_RTS_FAIL_COUNT_MASK);
-+
-+ mib->tx_ampdu_cnt += mt76_rr(dev, MT_MIB_SDR12(0));
-+ mib->tx_mpdu_attempts_cnt += mt76_rr(dev, MT_MIB_SDR14(0));
-+ mib->tx_mpdu_success_cnt += mt76_rr(dev, MT_MIB_SDR15(0));
-+
-+ val = mt76_rr(dev, MT_MIB_SDR32(0));
-+ mib->tx_pkt_ebf_cnt += FIELD_GET(MT_MIB_SDR9_EBF_CNT_MASK, val);
-+ mib->tx_pkt_ibf_cnt += FIELD_GET(MT_MIB_SDR9_IBF_CNT_MASK, val);
-+
-+ val = mt76_rr(dev, MT_ETBF_TX_APP_CNT(0));
-+ mib->tx_bf_ibf_ppdu_cnt += FIELD_GET(MT_ETBF_TX_IBF_CNT, val);
-+ mib->tx_bf_ebf_ppdu_cnt += FIELD_GET(MT_ETBF_TX_EBF_CNT, val);
-+
-+ val = mt76_rr(dev, MT_ETBF_RX_FB_CNT(0));
-+ mib->tx_bf_rx_fb_all_cnt += FIELD_GET(MT_ETBF_RX_FB_ALL, val);
-+ mib->tx_bf_rx_fb_he_cnt += FIELD_GET(MT_ETBF_RX_FB_HE, val);
-+ mib->tx_bf_rx_fb_vht_cnt += FIELD_GET(MT_ETBF_RX_FB_VHT, val);
-+ mib->tx_bf_rx_fb_ht_cnt += FIELD_GET(MT_ETBF_RX_FB_HT, val);
-+
-+ mib->rx_mpdu_cnt += mt76_rr(dev, MT_MIB_SDR5(0));
-+ mib->rx_ampdu_cnt += mt76_rr(dev, MT_MIB_SDR22(0));
-+ mib->rx_ampdu_bytes_cnt += mt76_rr(dev, MT_MIB_SDR23(0));
-+ mib->rx_ba_cnt += mt76_rr(dev, MT_MIB_SDR31(0));
-+
-+ for (i = 0; i < ARRAY_SIZE(mib->tx_amsdu); i++) {
-+ val = mt76_rr(dev, MT_PLE_AMSDU_PACK_MSDU_CNT(i));
-+ mib->tx_amsdu[i] += val;
-+ mib->tx_amsdu_cnt += val;
-+ }
-+
-+ for (i = 0, aggr1 = aggr0 + 8; i < 4; i++) {
-+ u32 val2;
-+
-+ val = mt76_rr(dev, MT_TX_AGG_CNT(0, i));
-+ val2 = mt76_rr(dev, MT_TX_AGG_CNT2(0, i));
-+
-+ phy->mt76->aggr_stats[aggr0++] += val & 0xffff;
-+ phy->mt76->aggr_stats[aggr0++] += val >> 16;
-+ phy->mt76->aggr_stats[aggr1++] += val2 & 0xffff;
-+ phy->mt76->aggr_stats[aggr1++] += val2 >> 16;
-+ }
-+}
-+EXPORT_SYMBOL_GPL(mt792x_mac_update_mib_stats);
-+
-+struct mt76_wcid *mt792x_rx_get_wcid(struct mt792x_dev *dev, u16 idx,
-+ bool unicast)
-+{
-+ struct mt792x_sta *sta;
-+ struct mt76_wcid *wcid;
-+
-+ if (idx >= ARRAY_SIZE(dev->mt76.wcid))
-+ return NULL;
-+
-+ wcid = rcu_dereference(dev->mt76.wcid[idx]);
-+ if (unicast || !wcid)
-+ return wcid;
-+
-+ if (!wcid->sta)
-+ return NULL;
-+
-+ sta = container_of(wcid, struct mt792x_sta, wcid);
-+ if (!sta->vif)
-+ return NULL;
-+
-+ return &sta->vif->sta.wcid;
-+}
-+EXPORT_SYMBOL_GPL(mt792x_rx_get_wcid);
-+
-+static void
-+mt792x_mac_rssi_iter(void *priv, u8 *mac, struct ieee80211_vif *vif)
-+{
-+ struct sk_buff *skb = priv;
-+ struct mt76_rx_status *status = (struct mt76_rx_status *)skb->cb;
-+ struct mt792x_vif *mvif = (struct mt792x_vif *)vif->drv_priv;
-+ struct ieee80211_hdr *hdr = mt76_skb_get_hdr(skb);
-+
-+ if (status->signal > 0)
-+ return;
-+
-+ if (!ether_addr_equal(vif->addr, hdr->addr1))
-+ return;
-+
-+ ewma_rssi_add(&mvif->rssi, -status->signal);
-+}
-+
-+void mt792x_mac_assoc_rssi(struct mt792x_dev *dev, struct sk_buff *skb)
-+{
-+ struct ieee80211_hdr *hdr = mt76_skb_get_hdr(skb);
-+
-+ if (!ieee80211_is_assoc_resp(hdr->frame_control) &&
-+ !ieee80211_is_auth(hdr->frame_control))
-+ return;
-+
-+ ieee80211_iterate_active_interfaces_atomic(mt76_hw(dev),
-+ IEEE80211_IFACE_ITER_RESUME_ALL,
-+ mt792x_mac_rssi_iter, skb);
-+}
-+EXPORT_SYMBOL_GPL(mt792x_mac_assoc_rssi);
-+
-+void mt792x_mac_reset_counters(struct mt792x_phy *phy)
-+{
-+ struct mt792x_dev *dev = phy->dev;
-+ int i;
-+
-+ for (i = 0; i < 4; i++) {
-+ mt76_rr(dev, MT_TX_AGG_CNT(0, i));
-+ mt76_rr(dev, MT_TX_AGG_CNT2(0, i));
-+ }
-+
-+ dev->mt76.phy.survey_time = ktime_get_boottime();
-+ memset(phy->mt76->aggr_stats, 0, sizeof(phy->mt76->aggr_stats));
-+
-+ /* reset airtime counters */
-+ mt76_rr(dev, MT_MIB_SDR9(0));
-+ mt76_rr(dev, MT_MIB_SDR36(0));
-+ mt76_rr(dev, MT_MIB_SDR37(0));
-+
-+ mt76_set(dev, MT_WF_RMAC_MIB_TIME0(0), MT_WF_RMAC_MIB_RXTIME_CLR);
-+ mt76_set(dev, MT_WF_RMAC_MIB_AIRTIME0(0), MT_WF_RMAC_MIB_RXTIME_CLR);
-+}
-+EXPORT_SYMBOL_GPL(mt792x_mac_reset_counters);
-+
-+static u8
-+mt792x_phy_get_nf(struct mt792x_phy *phy, int idx)
-+{
-+ return 0;
-+}
-+
-+static void
-+mt792x_phy_update_channel(struct mt76_phy *mphy, int idx)
-+{
-+ struct mt792x_dev *dev = container_of(mphy->dev, struct mt792x_dev, mt76);
-+ struct mt792x_phy *phy = (struct mt792x_phy *)mphy->priv;
-+ struct mt76_channel_state *state;
-+ u64 busy_time, tx_time, rx_time, obss_time;
-+ int nf;
-+
-+ busy_time = mt76_get_field(dev, MT_MIB_SDR9(idx),
-+ MT_MIB_SDR9_BUSY_MASK);
-+ tx_time = mt76_get_field(dev, MT_MIB_SDR36(idx),
-+ MT_MIB_SDR36_TXTIME_MASK);
-+ rx_time = mt76_get_field(dev, MT_MIB_SDR37(idx),
-+ MT_MIB_SDR37_RXTIME_MASK);
-+ obss_time = mt76_get_field(dev, MT_WF_RMAC_MIB_AIRTIME14(idx),
-+ MT_MIB_OBSSTIME_MASK);
-+
-+ nf = mt792x_phy_get_nf(phy, idx);
-+ if (!phy->noise)
-+ phy->noise = nf << 4;
-+ else if (nf)
-+ phy->noise += nf - (phy->noise >> 4);
-+
-+ state = mphy->chan_state;
-+ state->cc_busy += busy_time;
-+ state->cc_tx += tx_time;
-+ state->cc_rx += rx_time + obss_time;
-+ state->cc_bss_rx += rx_time;
-+ state->noise = -(phy->noise >> 4);
-+}
-+
-+void mt792x_update_channel(struct mt76_phy *mphy)
-+{
-+ struct mt792x_dev *dev = container_of(mphy->dev, struct mt792x_dev, mt76);
-+
-+ if (mt76_connac_pm_wake(mphy, &dev->pm))
-+ return;
-+
-+ mt792x_phy_update_channel(mphy, 0);
-+ /* reset obss airtime */
-+ mt76_set(dev, MT_WF_RMAC_MIB_TIME0(0), MT_WF_RMAC_MIB_RXTIME_CLR);
-+ mt76_connac_power_save_sched(mphy, &dev->pm);
-+}
-+EXPORT_SYMBOL_GPL(mt792x_update_channel);
-+
-+void mt792x_reset(struct mt76_dev *mdev)
-+{
-+ struct mt792x_dev *dev = container_of(mdev, struct mt792x_dev, mt76);
-+ struct mt76_connac_pm *pm = &dev->pm;
-+
-+ if (!dev->hw_init_done)
-+ return;
-+
-+ if (dev->hw_full_reset)
-+ return;
-+
-+ if (pm->suspended)
-+ return;
-+
-+ queue_work(dev->mt76.wq, &dev->reset_work);
-+}
-+EXPORT_SYMBOL_GPL(mt792x_reset);
-+
-+void mt792x_mac_init_band(struct mt792x_dev *dev, u8 band)
-+{
-+ u32 mask, set;
-+
-+ mt76_rmw_field(dev, MT_TMAC_CTCR0(band),
-+ MT_TMAC_CTCR0_INS_DDLMT_REFTIME, 0x3f);
-+ mt76_set(dev, MT_TMAC_CTCR0(band),
-+ MT_TMAC_CTCR0_INS_DDLMT_VHT_SMPDU_EN |
-+ MT_TMAC_CTCR0_INS_DDLMT_EN);
-+
-+ mt76_set(dev, MT_WF_RMAC_MIB_TIME0(band), MT_WF_RMAC_MIB_RXTIME_EN);
-+ mt76_set(dev, MT_WF_RMAC_MIB_AIRTIME0(band), MT_WF_RMAC_MIB_RXTIME_EN);
-+
-+ /* enable MIB tx-rx time reporting */
-+ mt76_set(dev, MT_MIB_SCR1(band), MT_MIB_TXDUR_EN);
-+ mt76_set(dev, MT_MIB_SCR1(band), MT_MIB_RXDUR_EN);
-+
-+ mt76_rmw_field(dev, MT_DMA_DCR0(band), MT_DMA_DCR0_MAX_RX_LEN, 1536);
-+ /* disable rx rate report by default due to hw issues */
-+ mt76_clear(dev, MT_DMA_DCR0(band), MT_DMA_DCR0_RXD_G5_EN);
-+
-+ /* filter out non-resp frames and get instantaneous signal reporting */
-+ mask = MT_WTBLOFF_TOP_RSCR_RCPI_MODE | MT_WTBLOFF_TOP_RSCR_RCPI_PARAM;
-+ set = FIELD_PREP(MT_WTBLOFF_TOP_RSCR_RCPI_MODE, 0) |
-+ FIELD_PREP(MT_WTBLOFF_TOP_RSCR_RCPI_PARAM, 0x3);
-+ mt76_rmw(dev, MT_WTBLOFF_TOP_RSCR(band), mask, set);
-+}
-+EXPORT_SYMBOL_GPL(mt792x_mac_init_band);
-+
-+void mt792x_pm_wake_work(struct work_struct *work)
-+{
-+ struct mt792x_dev *dev;
-+ struct mt76_phy *mphy;
-+
-+ dev = (struct mt792x_dev *)container_of(work, struct mt792x_dev,
-+ pm.wake_work);
-+ mphy = dev->phy.mt76;
-+
-+ if (!mt792x_mcu_drv_pmctrl(dev)) {
-+ struct mt76_dev *mdev = &dev->mt76;
-+ int i;
-+
-+ if (mt76_is_sdio(mdev)) {
-+ mt76_connac_pm_dequeue_skbs(mphy, &dev->pm);
-+ mt76_worker_schedule(&mdev->sdio.txrx_worker);
-+ } else {
-+ local_bh_disable();
-+ mt76_for_each_q_rx(mdev, i)
-+ napi_schedule(&mdev->napi[i]);
-+ local_bh_enable();
-+ mt76_connac_pm_dequeue_skbs(mphy, &dev->pm);
-+ mt76_connac_tx_cleanup(mdev);
-+ }
-+ if (test_bit(MT76_STATE_RUNNING, &mphy->state))
-+ ieee80211_queue_delayed_work(mphy->hw, &mphy->mac_work,
-+ MT792x_WATCHDOG_TIME);
-+ }
-+
-+ ieee80211_wake_queues(mphy->hw);
-+ wake_up(&dev->pm.wait);
-+}
-+EXPORT_SYMBOL_GPL(mt792x_pm_wake_work);
-+
-+void mt792x_pm_power_save_work(struct work_struct *work)
-+{
-+ struct mt792x_dev *dev;
-+ unsigned long delta;
-+ struct mt76_phy *mphy;
-+
-+ dev = (struct mt792x_dev *)container_of(work, struct mt792x_dev,
-+ pm.ps_work.work);
-+ mphy = dev->phy.mt76;
-+
-+ delta = dev->pm.idle_timeout;
-+ if (test_bit(MT76_HW_SCANNING, &mphy->state) ||
-+ test_bit(MT76_HW_SCHED_SCANNING, &mphy->state) ||
-+ dev->fw_assert)
-+ goto out;
-+
-+ if (mutex_is_locked(&dev->mt76.mutex))
-+ /* if mt76 mutex is held we should not put the device
-+ * to sleep since we are currently accessing device
-+ * register map. We need to wait for the next power_save
-+ * trigger.
-+ */
-+ goto out;
-+
-+ if (time_is_after_jiffies(dev->pm.last_activity + delta)) {
-+ delta = dev->pm.last_activity + delta - jiffies;
-+ goto out;
-+ }
-+
-+ if (!mt792x_mcu_fw_pmctrl(dev)) {
-+ cancel_delayed_work_sync(&mphy->mac_work);
-+ return;
-+ }
-+out:
-+ queue_delayed_work(dev->mt76.wq, &dev->pm.ps_work, delta);
-+}
-+EXPORT_SYMBOL_GPL(mt792x_pm_power_save_work);
-diff --git a/mt792x_regs.h b/mt792x_regs.h
-new file mode 100644
-index 00000000..a99af23e
---- /dev/null
-+++ b/mt792x_regs.h
-@@ -0,0 +1,479 @@
-+/* SPDX-License-Identifier: ISC */
-+/* Copyright (C) 2023 MediaTek Inc. */
-+
-+#ifndef __MT792X_REGS_H
-+#define __MT792X_REGS_H
-+
-+/* MCU WFDMA1 */
-+#define MT_MCU_WFDMA1_BASE 0x3000
-+#define MT_MCU_WFDMA1(ofs) (MT_MCU_WFDMA1_BASE + (ofs))
-+
-+#define MT_MCU_INT_EVENT MT_MCU_WFDMA1(0x108)
-+#define MT_MCU_INT_EVENT_DMA_STOPPED BIT(0)
-+#define MT_MCU_INT_EVENT_DMA_INIT BIT(1)
-+#define MT_MCU_INT_EVENT_SER_TRIGGER BIT(2)
-+#define MT_MCU_INT_EVENT_RESET_DONE BIT(3)
-+
-+#define MT_PLE_BASE 0x820c0000
-+#define MT_PLE(ofs) (MT_PLE_BASE + (ofs))
-+
-+#define MT_PLE_FL_Q0_CTRL MT_PLE(0x3e0)
-+#define MT_PLE_FL_Q1_CTRL MT_PLE(0x3e4)
-+#define MT_PLE_FL_Q2_CTRL MT_PLE(0x3e8)
-+#define MT_PLE_FL_Q3_CTRL MT_PLE(0x3ec)
-+
-+#define MT_PLE_AC_QEMPTY(_n) MT_PLE(0x500 + 0x40 * (_n))
-+#define MT_PLE_AMSDU_PACK_MSDU_CNT(n) MT_PLE(0x10e0 + ((n) << 2))
-+
-+/* TMAC: band 0(0x21000), band 1(0xa1000) */
-+#define MT_WF_TMAC_BASE(_band) ((_band) ? 0x820f4000 : 0x820e4000)
-+#define MT_WF_TMAC(_band, ofs) (MT_WF_TMAC_BASE(_band) + (ofs))
-+
-+#define MT_TMAC_TCR0(_band) MT_WF_TMAC(_band, 0)
-+#define MT_TMAC_TCR0_TBTT_STOP_CTRL BIT(25)
-+
-+#define MT_TMAC_CDTR(_band) MT_WF_TMAC(_band, 0x090)
-+#define MT_TMAC_ODTR(_band) MT_WF_TMAC(_band, 0x094)
-+#define MT_TIMEOUT_VAL_PLCP GENMASK(15, 0)
-+#define MT_TIMEOUT_VAL_CCA GENMASK(31, 16)
-+
-+#define MT_TMAC_ICR0(_band) MT_WF_TMAC(_band, 0x0a4)
-+#define MT_IFS_EIFS GENMASK(8, 0)
-+#define MT_IFS_RIFS GENMASK(14, 10)
-+#define MT_IFS_SIFS GENMASK(22, 16)
-+#define MT_IFS_SLOT GENMASK(30, 24)
-+
-+#define MT_TMAC_CTCR0(_band) MT_WF_TMAC(_band, 0x0f4)
-+#define MT_TMAC_CTCR0_INS_DDLMT_REFTIME GENMASK(5, 0)
-+#define MT_TMAC_CTCR0_INS_DDLMT_EN BIT(17)
-+#define MT_TMAC_CTCR0_INS_DDLMT_VHT_SMPDU_EN BIT(18)
-+
-+#define MT_TMAC_TRCR0(_band) MT_WF_TMAC(_band, 0x09c)
-+#define MT_TMAC_TFCR0(_band) MT_WF_TMAC(_band, 0x1e0)
-+
-+#define MT_WF_DMA_BASE(_band) ((_band) ? 0x820f7000 : 0x820e7000)
-+#define MT_WF_DMA(_band, ofs) (MT_WF_DMA_BASE(_band) + (ofs))
-+
-+#define MT_DMA_DCR0(_band) MT_WF_DMA(_band, 0x000)
-+#define MT_DMA_DCR0_MAX_RX_LEN GENMASK(15, 3)
-+#define MT_DMA_DCR0_RXD_G5_EN BIT(23)
-+
-+/* WTBLOFF TOP: band 0(0x820e9000),band 1(0x820f9000) */
-+#define MT_WTBLOFF_TOP_BASE(_band) ((_band) ? 0x820f9000 : 0x820e9000)
-+#define MT_WTBLOFF_TOP(_band, ofs) (MT_WTBLOFF_TOP_BASE(_band) + (ofs))
-+
-+#define MT_WTBLOFF_TOP_RSCR(_band) MT_WTBLOFF_TOP(_band, 0x008)
-+#define MT_WTBLOFF_TOP_RSCR_RCPI_MODE GENMASK(31, 30)
-+#define MT_WTBLOFF_TOP_RSCR_RCPI_PARAM GENMASK(25, 24)
-+
-+/* LPON: band 0(0x24200), band 1(0xa4200) */
-+#define MT_WF_LPON_BASE(_band) ((_band) ? 0x820fb000 : 0x820eb000)
-+#define MT_WF_LPON(_band, ofs) (MT_WF_LPON_BASE(_band) + (ofs))
-+
-+#define MT_LPON_UTTR0(_band) MT_WF_LPON(_band, 0x080)
-+#define MT_LPON_UTTR1(_band) MT_WF_LPON(_band, 0x084)
-+
-+#define MT_LPON_TCR(_band, n) MT_WF_LPON(_band, 0x0a8 + (n) * 4)
-+#define MT_LPON_TCR_SW_MODE GENMASK(1, 0)
-+#define MT_LPON_TCR_SW_WRITE BIT(0)
-+
-+/* ETBF: band 0(0x24000), band 1(0xa4000) */
-+#define MT_WF_ETBF_BASE(_band) ((_band) ? 0x820fa000 : 0x820ea000)
-+#define MT_WF_ETBF(_band, ofs) (MT_WF_ETBF_BASE(_band) + (ofs))
-+
-+#define MT_ETBF_TX_APP_CNT(_band) MT_WF_ETBF(_band, 0x150)
-+#define MT_ETBF_TX_IBF_CNT GENMASK(31, 16)
-+#define MT_ETBF_TX_EBF_CNT GENMASK(15, 0)
-+
-+#define MT_ETBF_RX_FB_CNT(_band) MT_WF_ETBF(_band, 0x158)
-+#define MT_ETBF_RX_FB_ALL GENMASK(31, 24)
-+#define MT_ETBF_RX_FB_HE GENMASK(23, 16)
-+#define MT_ETBF_RX_FB_VHT GENMASK(15, 8)
-+#define MT_ETBF_RX_FB_HT GENMASK(7, 0)
-+
-+/* MIB: band 0(0x24800), band 1(0xa4800) */
-+#define MT_WF_MIB_BASE(_band) ((_band) ? 0x820fd000 : 0x820ed000)
-+#define MT_WF_MIB(_band, ofs) (MT_WF_MIB_BASE(_band) + (ofs))
-+
-+#define MT_MIB_SCR1(_band) MT_WF_MIB(_band, 0x004)
-+#define MT_MIB_TXDUR_EN BIT(8)
-+#define MT_MIB_RXDUR_EN BIT(9)
-+
-+#define MT_MIB_SDR3(_band) MT_WF_MIB(_band, 0x698)
-+#define MT_MIB_SDR3_FCS_ERR_MASK GENMASK(31, 16)
-+
-+#define MT_MIB_SDR5(_band) MT_WF_MIB(_band, 0x780)
-+
-+#define MT_MIB_SDR9(_band) MT_WF_MIB(_band, 0x02c)
-+#define MT_MIB_SDR9_BUSY_MASK GENMASK(23, 0)
-+
-+#define MT_MIB_SDR12(_band) MT_WF_MIB(_band, 0x558)
-+#define MT_MIB_SDR14(_band) MT_WF_MIB(_band, 0x564)
-+#define MT_MIB_SDR15(_band) MT_WF_MIB(_band, 0x568)
-+
-+#define MT_MIB_SDR16(_band) MT_WF_MIB(_band, 0x048)
-+#define MT_MIB_SDR16_BUSY_MASK GENMASK(23, 0)
-+
-+#define MT_MIB_SDR22(_band) MT_WF_MIB(_band, 0x770)
-+#define MT_MIB_SDR23(_band) MT_WF_MIB(_band, 0x774)
-+#define MT_MIB_SDR31(_band) MT_WF_MIB(_band, 0x55c)
-+
-+#define MT_MIB_SDR32(_band) MT_WF_MIB(_band, 0x7a8)
-+#define MT_MIB_SDR9_IBF_CNT_MASK GENMASK(31, 16)
-+#define MT_MIB_SDR9_EBF_CNT_MASK GENMASK(15, 0)
-+
-+#define MT_MIB_SDR34(_band) MT_WF_MIB(_band, 0x090)
-+#define MT_MIB_MU_BF_TX_CNT GENMASK(15, 0)
-+
-+#define MT_MIB_SDR36(_band) MT_WF_MIB(_band, 0x054)
-+#define MT_MIB_SDR36_TXTIME_MASK GENMASK(23, 0)
-+#define MT_MIB_SDR37(_band) MT_WF_MIB(_band, 0x058)
-+#define MT_MIB_SDR37_RXTIME_MASK GENMASK(23, 0)
-+
-+#define MT_MIB_DR8(_band) MT_WF_MIB(_band, 0x0c0)
-+#define MT_MIB_DR9(_band) MT_WF_MIB(_band, 0x0c4)
-+#define MT_MIB_DR11(_band) MT_WF_MIB(_band, 0x0cc)
-+
-+#define MT_MIB_MB_SDR0(_band, n) MT_WF_MIB(_band, 0x100 + ((n) << 4))
-+#define MT_MIB_RTS_RETRIES_COUNT_MASK GENMASK(31, 16)
-+
-+#define MT_MIB_MB_BSDR0(_band) MT_WF_MIB(_band, 0x688)
-+#define MT_MIB_RTS_COUNT_MASK GENMASK(15, 0)
-+#define MT_MIB_MB_BSDR1(_band) MT_WF_MIB(_band, 0x690)
-+#define MT_MIB_RTS_FAIL_COUNT_MASK GENMASK(15, 0)
-+#define MT_MIB_MB_BSDR2(_band) MT_WF_MIB(_band, 0x518)
-+#define MT_MIB_BA_FAIL_COUNT_MASK GENMASK(15, 0)
-+#define MT_MIB_MB_BSDR3(_band) MT_WF_MIB(_band, 0x520)
-+#define MT_MIB_ACK_FAIL_COUNT_MASK GENMASK(15, 0)
-+
-+#define MT_MIB_MB_SDR2(_band, n) MT_WF_MIB(_band, 0x108 + ((n) << 4))
-+#define MT_MIB_FRAME_RETRIES_COUNT_MASK GENMASK(15, 0)
-+
-+#define MT_TX_AGG_CNT(_band, n) MT_WF_MIB(_band, 0x7dc + ((n) << 2))
-+#define MT_TX_AGG_CNT2(_band, n) MT_WF_MIB(_band, 0x7ec + ((n) << 2))
-+#define MT_MIB_ARNG(_band, n) MT_WF_MIB(_band, 0x0b0 + ((n) << 2))
-+#define MT_MIB_ARNCR_RANGE(val, n) (((val) >> ((n) << 3)) & GENMASK(7, 0))
-+
-+#define MT_WTBLON_TOP_BASE 0x820d4000
-+#define MT_WTBLON_TOP(ofs) (MT_WTBLON_TOP_BASE + (ofs))
-+
-+#define MT_WTBL_UPDATE_BUSY BIT(31)
-+
-+#define MT_WTBL_ITCR MT_WTBLON_TOP(0x3b0)
-+#define MT_WTBL_ITCR_WR BIT(16)
-+#define MT_WTBL_ITCR_EXEC BIT(31)
-+#define MT_WTBL_ITDR0 MT_WTBLON_TOP(0x3b8)
-+#define MT_WTBL_ITDR1 MT_WTBLON_TOP(0x3bc)
-+#define MT_WTBL_SPE_IDX_SEL BIT(6)
-+
-+#define MT_WTBL_BASE 0x820d8000
-+#define MT_WTBL_LMAC_ID GENMASK(14, 8)
-+#define MT_WTBL_LMAC_DW GENMASK(7, 2)
-+#define MT_WTBL_LMAC_OFFS(_id, _dw) (MT_WTBL_BASE | \
-+ FIELD_PREP(MT_WTBL_LMAC_ID, _id) | \
-+ FIELD_PREP(MT_WTBL_LMAC_DW, _dw))
-+
-+/* AGG: band 0(0x20800), band 1(0xa0800) */
-+#define MT_WF_AGG_BASE(_band) ((_band) ? 0x820f2000 : 0x820e2000)
-+#define MT_WF_AGG(_band, ofs) (MT_WF_AGG_BASE(_band) + (ofs))
-+
-+#define MT_AGG_AWSCR0(_band, _n) MT_WF_AGG(_band, 0x05c + (_n) * 4)
-+#define MT_AGG_PCR0(_band, _n) MT_WF_AGG(_band, 0x06c + (_n) * 4)
-+#define MT_AGG_PCR0_MM_PROT BIT(0)
-+#define MT_AGG_PCR0_GF_PROT BIT(1)
-+#define MT_AGG_PCR0_BW20_PROT BIT(2)
-+#define MT_AGG_PCR0_BW40_PROT BIT(4)
-+#define MT_AGG_PCR0_BW80_PROT BIT(6)
-+#define MT_AGG_PCR0_ERP_PROT GENMASK(12, 8)
-+#define MT_AGG_PCR0_VHT_PROT BIT(13)
-+#define MT_AGG_PCR0_PTA_WIN_DIS BIT(15)
-+
-+#define MT_AGG_PCR1_RTS0_NUM_THRES GENMASK(31, 23)
-+#define MT_AGG_PCR1_RTS0_LEN_THRES GENMASK(19, 0)
-+
-+#define MT_AGG_ACR0(_band) MT_WF_AGG(_band, 0x084)
-+#define MT_AGG_ACR_CFEND_RATE GENMASK(13, 0)
-+#define MT_AGG_ACR_BAR_RATE GENMASK(29, 16)
-+
-+#define MT_AGG_MRCR(_band) MT_WF_AGG(_band, 0x098)
-+#define MT_AGG_MRCR_BAR_CNT_LIMIT GENMASK(15, 12)
-+#define MT_AGG_MRCR_LAST_RTS_CTS_RN BIT(6)
-+#define MT_AGG_MRCR_RTS_FAIL_LIMIT GENMASK(11, 7)
-+#define MT_AGG_MRCR_TXCMD_RTS_FAIL_LIMIT GENMASK(28, 24)
-+
-+#define MT_AGG_ATCR1(_band) MT_WF_AGG(_band, 0x0f0)
-+#define MT_AGG_ATCR3(_band) MT_WF_AGG(_band, 0x0f4)
-+
-+/* ARB: band 0(0x20c00), band 1(0xa0c00) */
-+#define MT_WF_ARB_BASE(_band) ((_band) ? 0x820f3000 : 0x820e3000)
-+#define MT_WF_ARB(_band, ofs) (MT_WF_ARB_BASE(_band) + (ofs))
-+
-+#define MT_ARB_SCR(_band) MT_WF_ARB(_band, 0x080)
-+#define MT_ARB_SCR_TX_DISABLE BIT(8)
-+#define MT_ARB_SCR_RX_DISABLE BIT(9)
-+
-+#define MT_ARB_DRNGR0(_band, _n) MT_WF_ARB(_band, 0x194 + (_n) * 4)
-+
-+/* RMAC: band 0(0x21400), band 1(0xa1400) */
-+#define MT_WF_RMAC_BASE(_band) ((_band) ? 0x820f5000 : 0x820e5000)
-+#define MT_WF_RMAC(_band, ofs) (MT_WF_RMAC_BASE(_band) + (ofs))
-+
-+#define MT_WF_RFCR(_band) MT_WF_RMAC(_band, 0x000)
-+#define MT_WF_RFCR_DROP_STBC_MULTI BIT(0)
-+#define MT_WF_RFCR_DROP_FCSFAIL BIT(1)
-+#define MT_WF_RFCR_DROP_VERSION BIT(3)
-+#define MT_WF_RFCR_DROP_PROBEREQ BIT(4)
-+#define MT_WF_RFCR_DROP_MCAST BIT(5)
-+#define MT_WF_RFCR_DROP_BCAST BIT(6)
-+#define MT_WF_RFCR_DROP_MCAST_FILTERED BIT(7)
-+#define MT_WF_RFCR_DROP_A3_MAC BIT(8)
-+#define MT_WF_RFCR_DROP_A3_BSSID BIT(9)
-+#define MT_WF_RFCR_DROP_A2_BSSID BIT(10)
-+#define MT_WF_RFCR_DROP_OTHER_BEACON BIT(11)
-+#define MT_WF_RFCR_DROP_FRAME_REPORT BIT(12)
-+#define MT_WF_RFCR_DROP_CTL_RSV BIT(13)
-+#define MT_WF_RFCR_DROP_CTS BIT(14)
-+#define MT_WF_RFCR_DROP_RTS BIT(15)
-+#define MT_WF_RFCR_DROP_DUPLICATE BIT(16)
-+#define MT_WF_RFCR_DROP_OTHER_BSS BIT(17)
-+#define MT_WF_RFCR_DROP_OTHER_UC BIT(18)
-+#define MT_WF_RFCR_DROP_OTHER_TIM BIT(19)
-+#define MT_WF_RFCR_DROP_NDPA BIT(20)
-+#define MT_WF_RFCR_DROP_UNWANTED_CTL BIT(21)
-+
-+#define MT_WF_RFCR1(_band) MT_WF_RMAC(_band, 0x004)
-+#define MT_WF_RFCR1_DROP_ACK BIT(4)
-+#define MT_WF_RFCR1_DROP_BF_POLL BIT(5)
-+#define MT_WF_RFCR1_DROP_BA BIT(6)
-+#define MT_WF_RFCR1_DROP_CFEND BIT(7)
-+#define MT_WF_RFCR1_DROP_CFACK BIT(8)
-+
-+#define MT_WF_RMAC_MIB_TIME0(_band) MT_WF_RMAC(_band, 0x03c4)
-+#define MT_WF_RMAC_MIB_RXTIME_CLR BIT(31)
-+#define MT_WF_RMAC_MIB_RXTIME_EN BIT(30)
-+
-+#define MT_WF_RMAC_MIB_AIRTIME14(_band) MT_WF_RMAC(_band, 0x03b8)
-+#define MT_MIB_OBSSTIME_MASK GENMASK(23, 0)
-+#define MT_WF_RMAC_MIB_AIRTIME0(_band) MT_WF_RMAC(_band, 0x0380)
-+
-+/* WFDMA0 */
-+#define MT_WFDMA0_BASE 0xd4000
-+#define MT_WFDMA0(ofs) (MT_WFDMA0_BASE + (ofs))
-+
-+#define MT_WFDMA0_RST MT_WFDMA0(0x100)
-+#define MT_WFDMA0_RST_LOGIC_RST BIT(4)
-+#define MT_WFDMA0_RST_DMASHDL_ALL_RST BIT(5)
-+
-+#define MT_WFDMA0_BUSY_ENA MT_WFDMA0(0x13c)
-+#define MT_WFDMA0_BUSY_ENA_TX_FIFO0 BIT(0)
-+#define MT_WFDMA0_BUSY_ENA_TX_FIFO1 BIT(1)
-+#define MT_WFDMA0_BUSY_ENA_RX_FIFO BIT(2)
-+
-+#define MT_MCU_CMD MT_WFDMA0(0x1f0)
-+#define MT_MCU_CMD_WAKE_RX_PCIE BIT(0)
-+#define MT_MCU_CMD_STOP_DMA_FW_RELOAD BIT(1)
-+#define MT_MCU_CMD_STOP_DMA BIT(2)
-+#define MT_MCU_CMD_RESET_DONE BIT(3)
-+#define MT_MCU_CMD_RECOVERY_DONE BIT(4)
-+#define MT_MCU_CMD_NORMAL_STATE BIT(5)
-+#define MT_MCU_CMD_ERROR_MASK GENMASK(5, 1)
-+
-+#define MT_MCU2HOST_SW_INT_ENA MT_WFDMA0(0x1f4)
-+
-+#define MT_WFDMA0_HOST_INT_STA MT_WFDMA0(0x200)
-+#define HOST_RX_DONE_INT_STS0 BIT(0) /* Rx mcu */
-+#define HOST_RX_DONE_INT_STS2 BIT(2) /* Rx data */
-+#define HOST_RX_DONE_INT_STS4 BIT(22) /* Rx mcu after fw downloaded */
-+#define HOST_TX_DONE_INT_STS16 BIT(26)
-+#define HOST_TX_DONE_INT_STS17 BIT(27) /* MCU tx done*/
-+
-+#define MT_WFDMA0_GLO_CFG MT_WFDMA0(0x208)
-+#define MT_WFDMA0_GLO_CFG_TX_DMA_EN BIT(0)
-+#define MT_WFDMA0_GLO_CFG_TX_DMA_BUSY BIT(1)
-+#define MT_WFDMA0_GLO_CFG_RX_DMA_EN BIT(2)
-+#define MT_WFDMA0_GLO_CFG_RX_DMA_BUSY BIT(3)
-+#define MT_WFDMA0_GLO_CFG_TX_WB_DDONE BIT(6)
-+#define MT_WFDMA0_GLO_CFG_FW_DWLD_BYPASS_DMASHDL BIT(9)
-+#define MT_WFDMA0_GLO_CFG_FIFO_LITTLE_ENDIAN BIT(12)
-+#define MT_WFDMA0_GLO_CFG_CSR_DISP_BASE_PTR_CHAIN_EN BIT(15)
-+#define MT_WFDMA0_GLO_CFG_OMIT_RX_INFO_PFET2 BIT(21)
-+#define MT_WFDMA0_GLO_CFG_OMIT_RX_INFO BIT(27)
-+#define MT_WFDMA0_GLO_CFG_OMIT_TX_INFO BIT(28)
-+#define MT_WFDMA0_GLO_CFG_CLK_GAT_DIS BIT(30)
-+
-+#define HOST_RX_DONE_INT_ENA0 BIT(0)
-+#define HOST_RX_DONE_INT_ENA1 BIT(1)
-+#define HOST_RX_DONE_INT_ENA2 BIT(2)
-+#define HOST_RX_DONE_INT_ENA3 BIT(3)
-+#define HOST_TX_DONE_INT_ENA0 BIT(4)
-+#define HOST_TX_DONE_INT_ENA1 BIT(5)
-+#define HOST_TX_DONE_INT_ENA2 BIT(6)
-+#define HOST_TX_DONE_INT_ENA3 BIT(7)
-+#define HOST_TX_DONE_INT_ENA4 BIT(8)
-+#define HOST_TX_DONE_INT_ENA5 BIT(9)
-+#define HOST_TX_DONE_INT_ENA6 BIT(10)
-+#define HOST_TX_DONE_INT_ENA7 BIT(11)
-+#define HOST_RX_COHERENT_EN BIT(20)
-+#define HOST_TX_COHERENT_EN BIT(21)
-+#define MCU2HOST_SW_INT_ENA BIT(29)
-+#define HOST_TX_DONE_INT_ENA18 BIT(30)
-+
-+#define MT_INT_MCU_CMD MCU2HOST_SW_INT_ENA
-+
-+#define MT_WFDMA0_RST_DTX_PTR MT_WFDMA0(0x20c)
-+#define MT_WFDMA0_RST_DRX_PTR MT_WFDMA0(0x280)
-+#define MT_WFDMA0_GLO_CFG_EXT0 MT_WFDMA0(0x2b0)
-+#define MT_WFDMA0_CSR_TX_DMASHDL_ENABLE BIT(6)
-+#define MT_WFDMA0_PRI_DLY_INT_CFG0 MT_WFDMA0(0x2f0)
-+
-+#define MT_WFDMA0_TX_RING0_EXT_CTRL MT_WFDMA0(0x600)
-+#define MT_WFDMA0_TX_RING1_EXT_CTRL MT_WFDMA0(0x604)
-+#define MT_WFDMA0_TX_RING2_EXT_CTRL MT_WFDMA0(0x608)
-+#define MT_WFDMA0_TX_RING3_EXT_CTRL MT_WFDMA0(0x60c)
-+#define MT_WFDMA0_TX_RING4_EXT_CTRL MT_WFDMA0(0x610)
-+#define MT_WFDMA0_TX_RING5_EXT_CTRL MT_WFDMA0(0x614)
-+#define MT_WFDMA0_TX_RING6_EXT_CTRL MT_WFDMA0(0x618)
-+#define MT_WFDMA0_TX_RING15_EXT_CTRL MT_WFDMA0(0x63c)
-+#define MT_WFDMA0_TX_RING16_EXT_CTRL MT_WFDMA0(0x640)
-+#define MT_WFDMA0_TX_RING17_EXT_CTRL MT_WFDMA0(0x644)
-+
-+#define MT_WPDMA0_MAX_CNT_MASK GENMASK(7, 0)
-+#define MT_WPDMA0_BASE_PTR_MASK GENMASK(31, 16)
-+
-+#define MT_WFDMA0_RX_RING0_EXT_CTRL MT_WFDMA0(0x680)
-+#define MT_WFDMA0_RX_RING1_EXT_CTRL MT_WFDMA0(0x684)
-+#define MT_WFDMA0_RX_RING2_EXT_CTRL MT_WFDMA0(0x688)
-+#define MT_WFDMA0_RX_RING3_EXT_CTRL MT_WFDMA0(0x68c)
-+#define MT_WFDMA0_RX_RING4_EXT_CTRL MT_WFDMA0(0x690)
-+#define MT_WFDMA0_RX_RING5_EXT_CTRL MT_WFDMA0(0x694)
-+#define MT_WFDMA0_RX_RING6_EXT_CTRL MT_WFDMA0(0x698)
-+#define MT_WFDMA0_RX_RING7_EXT_CTRL MT_WFDMA0(0x69c)
-+
-+#define MT_TX_RING_BASE MT_WFDMA0(0x300)
-+#define MT_RX_EVENT_RING_BASE MT_WFDMA0(0x500)
-+
-+/* WFDMA CSR */
-+#define MT_WFDMA_EXT_CSR_BASE 0xd7000
-+#define MT_WFDMA_EXT_CSR(ofs) (MT_WFDMA_EXT_CSR_BASE + (ofs))
-+#define MT_WFDMA_EXT_CSR_HIF_MISC MT_WFDMA_EXT_CSR(0x44)
-+#define MT_WFDMA_EXT_CSR_HIF_MISC_BUSY BIT(0)
-+
-+#define MT_SWDEF_BASE 0x41f200
-+#define MT_SWDEF(ofs) (MT_SWDEF_BASE + (ofs))
-+#define MT_SWDEF_MODE MT_SWDEF(0x3c)
-+#define MT_SWDEF_NORMAL_MODE 0
-+#define MT_SWDEF_ICAP_MODE 1
-+#define MT_SWDEF_SPECTRUM_MODE 2
-+
-+#define MT_TOP_BASE 0x18060000
-+#define MT_TOP(ofs) (MT_TOP_BASE + (ofs))
-+
-+#define MT_TOP_LPCR_HOST_BAND0 MT_TOP(0x10)
-+#define MT_TOP_LPCR_HOST_FW_OWN BIT(0)
-+#define MT_TOP_LPCR_HOST_DRV_OWN BIT(1)
-+
-+#define MT_TOP_MISC MT_TOP(0xf0)
-+#define MT_TOP_MISC_FW_STATE GENMASK(2, 0)
-+
-+#define MT_MCU_WPDMA0_BASE 0x54000000
-+#define MT_MCU_WPDMA0(ofs) (MT_MCU_WPDMA0_BASE + (ofs))
-+
-+#define MT_WFDMA_DUMMY_CR MT_MCU_WPDMA0(0x120)
-+#define MT_WFDMA_NEED_REINIT BIT(1)
-+
-+#define MT_CBTOP_RGU(ofs) (0x70002000 + (ofs))
-+#define MT_CBTOP_RGU_WF_SUBSYS_RST MT_CBTOP_RGU(0x600)
-+#define MT_CBTOP_RGU_WF_SUBSYS_RST_WF_WHOLE_PATH BIT(0)
-+
-+#define MT_HW_BOUND 0x70010020
-+#define MT_HW_CHIPID 0x70010200
-+#define MT_HW_REV 0x70010204
-+
-+#define MT_PCIE_MAC_BASE 0x10000
-+#define MT_PCIE_MAC(ofs) (MT_PCIE_MAC_BASE + (ofs))
-+#define MT_PCIE_MAC_INT_ENABLE MT_PCIE_MAC(0x188)
-+#define MT_PCIE_MAC_PM MT_PCIE_MAC(0x194)
-+#define MT_PCIE_MAC_PM_L0S_DIS BIT(8)
-+
-+#define MT_DMA_SHDL(ofs) (0x7c026000 + (ofs))
-+#define MT_DMASHDL_SW_CONTROL MT_DMA_SHDL(0x004)
-+#define MT_DMASHDL_DMASHDL_BYPASS BIT(28)
-+#define MT_DMASHDL_OPTIONAL MT_DMA_SHDL(0x008)
-+#define MT_DMASHDL_PAGE MT_DMA_SHDL(0x00c)
-+#define MT_DMASHDL_GROUP_SEQ_ORDER BIT(16)
-+#define MT_DMASHDL_REFILL MT_DMA_SHDL(0x010)
-+#define MT_DMASHDL_REFILL_MASK GENMASK(31, 16)
-+#define MT_DMASHDL_PKT_MAX_SIZE MT_DMA_SHDL(0x01c)
-+#define MT_DMASHDL_PKT_MAX_SIZE_PLE GENMASK(11, 0)
-+#define MT_DMASHDL_PKT_MAX_SIZE_PSE GENMASK(27, 16)
-+
-+#define MT_DMASHDL_GROUP_QUOTA(_n) MT_DMA_SHDL(0x020 + ((_n) << 2))
-+#define MT_DMASHDL_GROUP_QUOTA_MIN GENMASK(11, 0)
-+#define MT_DMASHDL_GROUP_QUOTA_MAX GENMASK(27, 16)
-+
-+#define MT_DMASHDL_Q_MAP(_n) MT_DMA_SHDL(0x060 + ((_n) << 2))
-+#define MT_DMASHDL_Q_MAP_MASK GENMASK(3, 0)
-+#define MT_DMASHDL_Q_MAP_SHIFT(_n) (4 * ((_n) % 8))
-+
-+#define MT_DMASHDL_SCHED_SET(_n) MT_DMA_SHDL(0x070 + ((_n) << 2))
-+
-+#define MT_WFDMA_HOST_CONFIG 0x7c027030
-+#define MT_WFDMA_HOST_CONFIG_USB_RXEVT_EP4_EN BIT(6)
-+
-+#define MT_UMAC(ofs) (0x74000000 + (ofs))
-+#define MT_UDMA_TX_QSEL MT_UMAC(0x008)
-+#define MT_FW_DL_EN BIT(3)
-+
-+#define MT_UDMA_WLCFG_1 MT_UMAC(0x00c)
-+#define MT_WL_RX_AGG_PKT_LMT GENMASK(7, 0)
-+#define MT_WL_TX_TMOUT_LMT GENMASK(27, 8)
-+
-+#define MT_UDMA_WLCFG_0 MT_UMAC(0x18)
-+#define MT_WL_RX_AGG_TO GENMASK(7, 0)
-+#define MT_WL_RX_AGG_LMT GENMASK(15, 8)
-+#define MT_WL_TX_TMOUT_FUNC_EN BIT(16)
-+#define MT_WL_TX_DPH_CHK_EN BIT(17)
-+#define MT_WL_RX_MPSZ_PAD0 BIT(18)
-+#define MT_WL_RX_FLUSH BIT(19)
-+#define MT_TICK_1US_EN BIT(20)
-+#define MT_WL_RX_AGG_EN BIT(21)
-+#define MT_WL_RX_EN BIT(22)
-+#define MT_WL_TX_EN BIT(23)
-+#define MT_WL_RX_BUSY BIT(30)
-+#define MT_WL_TX_BUSY BIT(31)
-+
-+#define MT_UDMA_CONN_INFRA_STATUS MT_UMAC(0xa20)
-+#define MT_UDMA_CONN_WFSYS_INIT_DONE BIT(22)
-+#define MT_UDMA_CONN_INFRA_STATUS_SEL MT_UMAC(0xa24)
-+
-+#define MT_SSUSB_EPCTL_CSR(ofs) (0x74011800 + (ofs))
-+#define MT_SSUSB_EPCTL_CSR_EP_RST_OPT MT_SSUSB_EPCTL_CSR(0x090)
-+
-+#define MT_UWFDMA0(ofs) (0x7c024000 + (ofs))
-+#define MT_UWFDMA0_GLO_CFG MT_UWFDMA0(0x208)
-+#define MT_UWFDMA0_GLO_CFG_EXT0 MT_UWFDMA0(0x2b0)
-+#define MT_UWFDMA0_GLO_CFG_EXT1 MT_UWFDMA0(0x2b4)
-+#define MT_UWFDMA0_TX_RING_EXT_CTRL(_n) MT_UWFDMA0(0x600 + ((_n) << 2))
-+
-+#define MT_CONN_STATUS 0x7c053c10
-+#define MT_WIFI_PATCH_DL_STATE BIT(0)
-+
-+#define MT_CONN_ON_LPCTL 0x7c060010
-+#define PCIE_LPCR_HOST_SET_OWN BIT(0)
-+#define PCIE_LPCR_HOST_CLR_OWN BIT(1)
-+#define PCIE_LPCR_HOST_OWN_SYNC BIT(2)
-+
-+#define MT_CONN_ON_MISC 0x7c0600f0
-+#define MT_TOP_MISC2_FW_PWR_ON BIT(0)
-+#define MT_TOP_MISC2_FW_N9_ON BIT(1)
-+#define MT_TOP_MISC2_FW_N9_RDY GENMASK(1, 0)
-+
-+#define MT_WF_SW_DEF_CR(ofs) (0x401a00 + (ofs))
-+#define MT_WF_SW_DEF_CR_USB_MCU_EVENT MT_WF_SW_DEF_CR(0x028)
-+#define MT_WF_SW_SER_TRIGGER_SUSPEND BIT(6)
-+#define MT_WF_SW_SER_DONE_SUSPEND BIT(7)
-+
-+#define WFSYS_SW_RST_B BIT(0)
-+#define WFSYS_SW_INIT_DONE BIT(4)
-+
-+#endif /* __MT792X_REGS_H */
-diff --git a/mt792x_trace.c b/mt792x_trace.c
-new file mode 100644
-index 00000000..b6f284fb
---- /dev/null
-+++ b/mt792x_trace.c
-@@ -0,0 +1,14 @@
-+// SPDX-License-Identifier: ISC
-+/*
-+ * Copyright (C) 2023 Lorenzo Bianconi <lorenzo@kernel.org>
-+ */
-+
-+#include <linux/module.h>
-+
-+#ifndef __CHECKER__
-+#define CREATE_TRACE_POINTS
-+#include "mt792x_trace.h"
-+
-+EXPORT_TRACEPOINT_SYMBOL_GPL(lp_event);
-+
-+#endif
-diff --git a/mt7921/mt7921_trace.h b/mt792x_trace.h
-similarity index 68%
-rename from mt7921/mt7921_trace.h
-rename to mt792x_trace.h
-index 9bc4db67..61f2aa26 100644
---- a/mt7921/mt7921_trace.h
-+++ b/mt792x_trace.h
-@@ -1,27 +1,27 @@
- /* SPDX-License-Identifier: ISC */
- /*
-- * Copyright (C) 2021 Lorenzo Bianconi <lorenzo@kernel.org>
-+ * Copyright (C) 2023 Lorenzo Bianconi <lorenzo@kernel.org>
- */
-
--#if !defined(__MT7921_TRACE_H) || defined(TRACE_HEADER_MULTI_READ)
--#define __MT7921_TRACE_H
-+#if !defined(__MT792X_TRACE_H) || defined(TRACE_HEADER_MULTI_READ)
-+#define __MT792X_TRACE_H
-
- #include <linux/tracepoint.h>
--#include "mt7921.h"
-+#include "mt792x.h"
-
- #undef TRACE_SYSTEM
--#define TRACE_SYSTEM mt7921
-+#define TRACE_SYSTEM mt792x
-
- #define MAXNAME 32
- #define DEV_ENTRY __array(char, wiphy_name, 32)
--#define DEV_ASSIGN strlcpy(__entry->wiphy_name, \
-+#define DEV_ASSIGN strscpy(__entry->wiphy_name, \
- wiphy_name(mt76_hw(dev)->wiphy), MAXNAME)
- #define DEV_PR_FMT "%s"
- #define DEV_PR_ARG __entry->wiphy_name
- #define LP_STATE_PR_ARG __entry->lp_state ? "lp ready" : "lp not ready"
-
- TRACE_EVENT(lp_event,
-- TP_PROTO(struct mt7921_dev *dev, u8 lp_state),
-+ TP_PROTO(struct mt792x_dev *dev, u8 lp_state),
-
- TP_ARGS(dev, lp_state),
-
-@@ -46,6 +46,6 @@ TRACE_EVENT(lp_event,
- #undef TRACE_INCLUDE_PATH
- #define TRACE_INCLUDE_PATH .
- #undef TRACE_INCLUDE_FILE
--#define TRACE_INCLUDE_FILE mt7921_trace
-+#define TRACE_INCLUDE_FILE mt792x_trace
-
- #include <trace/define_trace.h>
-diff --git a/mt792x_usb.c b/mt792x_usb.c
-new file mode 100644
-index 00000000..20e7f9c7
---- /dev/null
-+++ b/mt792x_usb.c
-@@ -0,0 +1,309 @@
-+// SPDX-License-Identifier: ISC
-+/* Copyright (C) 2023 MediaTek Inc.
-+ *
-+ * Author: Lorenzo Bianconi <lorenzo@kernel.org>
-+ */
-+
-+#include <linux/kernel.h>
-+#include <linux/module.h>
-+#include <linux/usb.h>
-+
-+#include "mt792x.h"
-+#include "mt76_connac2_mac.h"
-+
-+u32 mt792xu_rr(struct mt76_dev *dev, u32 addr)
-+{
-+ u32 ret;
-+
-+ mutex_lock(&dev->usb.usb_ctrl_mtx);
-+ ret = ___mt76u_rr(dev, MT_VEND_READ_EXT,
-+ USB_DIR_IN | MT_USB_TYPE_VENDOR, addr);
-+ mutex_unlock(&dev->usb.usb_ctrl_mtx);
-+
-+ return ret;
-+}
-+EXPORT_SYMBOL_GPL(mt792xu_rr);
-+
-+void mt792xu_wr(struct mt76_dev *dev, u32 addr, u32 val)
-+{
-+ mutex_lock(&dev->usb.usb_ctrl_mtx);
-+ ___mt76u_wr(dev, MT_VEND_WRITE_EXT,
-+ USB_DIR_OUT | MT_USB_TYPE_VENDOR, addr, val);
-+ mutex_unlock(&dev->usb.usb_ctrl_mtx);
-+}
-+EXPORT_SYMBOL_GPL(mt792xu_wr);
-+
-+u32 mt792xu_rmw(struct mt76_dev *dev, u32 addr, u32 mask, u32 val)
-+{
-+ mutex_lock(&dev->usb.usb_ctrl_mtx);
-+ val |= ___mt76u_rr(dev, MT_VEND_READ_EXT,
-+ USB_DIR_IN | MT_USB_TYPE_VENDOR, addr) & ~mask;
-+ ___mt76u_wr(dev, MT_VEND_WRITE_EXT,
-+ USB_DIR_OUT | MT_USB_TYPE_VENDOR, addr, val);
-+ mutex_unlock(&dev->usb.usb_ctrl_mtx);
-+
-+ return val;
-+}
-+EXPORT_SYMBOL_GPL(mt792xu_rmw);
-+
-+void mt792xu_copy(struct mt76_dev *dev, u32 offset, const void *data, int len)
-+{
-+ struct mt76_usb *usb = &dev->usb;
-+ int ret, i = 0, batch_len;
-+ const u8 *val = data;
-+
-+ len = round_up(len, 4);
-+
-+ mutex_lock(&usb->usb_ctrl_mtx);
-+ while (i < len) {
-+ batch_len = min_t(int, usb->data_len, len - i);
-+ memcpy(usb->data, val + i, batch_len);
-+ ret = __mt76u_vendor_request(dev, MT_VEND_WRITE_EXT,
-+ USB_DIR_OUT | MT_USB_TYPE_VENDOR,
-+ (offset + i) >> 16, offset + i,
-+ usb->data, batch_len);
-+ if (ret < 0)
-+ break;
-+
-+ i += batch_len;
-+ }
-+ mutex_unlock(&usb->usb_ctrl_mtx);
-+}
-+EXPORT_SYMBOL_GPL(mt792xu_copy);
-+
-+int mt792xu_mcu_power_on(struct mt792x_dev *dev)
-+{
-+ int ret;
-+
-+ ret = mt76u_vendor_request(&dev->mt76, MT_VEND_POWER_ON,
-+ USB_DIR_OUT | MT_USB_TYPE_VENDOR,
-+ 0x0, 0x1, NULL, 0);
-+ if (ret)
-+ return ret;
-+
-+ if (!mt76_poll_msec(dev, MT_CONN_ON_MISC, MT_TOP_MISC2_FW_PWR_ON,
-+ MT_TOP_MISC2_FW_PWR_ON, 500)) {
-+ dev_err(dev->mt76.dev, "Timeout for power on\n");
-+ ret = -EIO;
-+ }
-+
-+ return ret;
-+}
-+EXPORT_SYMBOL_GPL(mt792xu_mcu_power_on);
-+
-+static void mt792xu_cleanup(struct mt792x_dev *dev)
-+{
-+ clear_bit(MT76_STATE_INITIALIZED, &dev->mphy.state);
-+ mt792xu_wfsys_reset(dev);
-+ skb_queue_purge(&dev->mt76.mcu.res_q);
-+ mt76u_queues_deinit(&dev->mt76);
-+}
-+
-+static u32 mt792xu_uhw_rr(struct mt76_dev *dev, u32 addr)
-+{
-+ u32 ret;
-+
-+ mutex_lock(&dev->usb.usb_ctrl_mtx);
-+ ret = ___mt76u_rr(dev, MT_VEND_DEV_MODE,
-+ USB_DIR_IN | MT_USB_TYPE_UHW_VENDOR, addr);
-+ mutex_unlock(&dev->usb.usb_ctrl_mtx);
-+
-+ return ret;
-+}
-+
-+static void mt792xu_uhw_wr(struct mt76_dev *dev, u32 addr, u32 val)
-+{
-+ mutex_lock(&dev->usb.usb_ctrl_mtx);
-+ ___mt76u_wr(dev, MT_VEND_WRITE,
-+ USB_DIR_OUT | MT_USB_TYPE_UHW_VENDOR, addr, val);
-+ mutex_unlock(&dev->usb.usb_ctrl_mtx);
-+}
-+
-+static void mt792xu_dma_prefetch(struct mt792x_dev *dev)
-+{
-+ mt76_rmw(dev, MT_UWFDMA0_TX_RING_EXT_CTRL(0),
-+ MT_WPDMA0_MAX_CNT_MASK, 4);
-+ mt76_rmw(dev, MT_UWFDMA0_TX_RING_EXT_CTRL(0),
-+ MT_WPDMA0_BASE_PTR_MASK, 0x80);
-+
-+ mt76_rmw(dev, MT_UWFDMA0_TX_RING_EXT_CTRL(1),
-+ MT_WPDMA0_MAX_CNT_MASK, 4);
-+ mt76_rmw(dev, MT_UWFDMA0_TX_RING_EXT_CTRL(1),
-+ MT_WPDMA0_BASE_PTR_MASK, 0xc0);
-+
-+ mt76_rmw(dev, MT_UWFDMA0_TX_RING_EXT_CTRL(2),
-+ MT_WPDMA0_MAX_CNT_MASK, 4);
-+ mt76_rmw(dev, MT_UWFDMA0_TX_RING_EXT_CTRL(2),
-+ MT_WPDMA0_BASE_PTR_MASK, 0x100);
-+
-+ mt76_rmw(dev, MT_UWFDMA0_TX_RING_EXT_CTRL(3),
-+ MT_WPDMA0_MAX_CNT_MASK, 4);
-+ mt76_rmw(dev, MT_UWFDMA0_TX_RING_EXT_CTRL(3),
-+ MT_WPDMA0_BASE_PTR_MASK, 0x140);
-+
-+ mt76_rmw(dev, MT_UWFDMA0_TX_RING_EXT_CTRL(4),
-+ MT_WPDMA0_MAX_CNT_MASK, 4);
-+ mt76_rmw(dev, MT_UWFDMA0_TX_RING_EXT_CTRL(4),
-+ MT_WPDMA0_BASE_PTR_MASK, 0x180);
-+
-+ mt76_rmw(dev, MT_UWFDMA0_TX_RING_EXT_CTRL(16),
-+ MT_WPDMA0_MAX_CNT_MASK, 4);
-+ mt76_rmw(dev, MT_UWFDMA0_TX_RING_EXT_CTRL(16),
-+ MT_WPDMA0_BASE_PTR_MASK, 0x280);
-+
-+ mt76_rmw(dev, MT_UWFDMA0_TX_RING_EXT_CTRL(17),
-+ MT_WPDMA0_MAX_CNT_MASK, 4);
-+ mt76_rmw(dev, MT_UWFDMA0_TX_RING_EXT_CTRL(17),
-+ MT_WPDMA0_BASE_PTR_MASK, 0x2c0);
-+}
-+
-+static void mt792xu_wfdma_init(struct mt792x_dev *dev)
-+{
-+ mt792xu_dma_prefetch(dev);
-+
-+ mt76_clear(dev, MT_UWFDMA0_GLO_CFG, MT_WFDMA0_GLO_CFG_OMIT_RX_INFO);
-+ mt76_set(dev, MT_UWFDMA0_GLO_CFG,
-+ MT_WFDMA0_GLO_CFG_OMIT_TX_INFO |
-+ MT_WFDMA0_GLO_CFG_OMIT_RX_INFO_PFET2 |
-+ MT_WFDMA0_GLO_CFG_FW_DWLD_BYPASS_DMASHDL |
-+ MT_WFDMA0_GLO_CFG_TX_DMA_EN |
-+ MT_WFDMA0_GLO_CFG_RX_DMA_EN);
-+
-+ /* disable dmashdl */
-+ mt76_clear(dev, MT_UWFDMA0_GLO_CFG_EXT0,
-+ MT_WFDMA0_CSR_TX_DMASHDL_ENABLE);
-+ mt76_set(dev, MT_DMASHDL_SW_CONTROL, MT_DMASHDL_DMASHDL_BYPASS);
-+
-+ mt76_set(dev, MT_WFDMA_DUMMY_CR, MT_WFDMA_NEED_REINIT);
-+}
-+
-+static int mt792xu_dma_rx_evt_ep4(struct mt792x_dev *dev)
-+{
-+ if (!mt76_poll(dev, MT_UWFDMA0_GLO_CFG,
-+ MT_WFDMA0_GLO_CFG_RX_DMA_BUSY, 0, 1000))
-+ return -ETIMEDOUT;
-+
-+ mt76_clear(dev, MT_UWFDMA0_GLO_CFG, MT_WFDMA0_GLO_CFG_RX_DMA_EN);
-+ mt76_set(dev, MT_WFDMA_HOST_CONFIG,
-+ MT_WFDMA_HOST_CONFIG_USB_RXEVT_EP4_EN);
-+ mt76_set(dev, MT_UWFDMA0_GLO_CFG, MT_WFDMA0_GLO_CFG_RX_DMA_EN);
-+
-+ return 0;
-+}
-+
-+static void mt792xu_epctl_rst_opt(struct mt792x_dev *dev, bool reset)
-+{
-+ u32 val;
-+
-+ /* usb endpoint reset opt
-+ * bits[4,9]: out blk ep 4-9
-+ * bits[20,21]: in blk ep 4-5
-+ * bits[22]: in int ep 6
-+ */
-+ val = mt792xu_uhw_rr(&dev->mt76, MT_SSUSB_EPCTL_CSR_EP_RST_OPT);
-+ if (reset)
-+ val |= GENMASK(9, 4) | GENMASK(22, 20);
-+ else
-+ val &= ~(GENMASK(9, 4) | GENMASK(22, 20));
-+ mt792xu_uhw_wr(&dev->mt76, MT_SSUSB_EPCTL_CSR_EP_RST_OPT, val);
-+}
-+
-+int mt792xu_dma_init(struct mt792x_dev *dev, bool resume)
-+{
-+ int err;
-+
-+ mt792xu_wfdma_init(dev);
-+
-+ mt76_clear(dev, MT_UDMA_WLCFG_0, MT_WL_RX_FLUSH);
-+
-+ mt76_set(dev, MT_UDMA_WLCFG_0,
-+ MT_WL_RX_EN | MT_WL_TX_EN |
-+ MT_WL_RX_MPSZ_PAD0 | MT_TICK_1US_EN);
-+ mt76_clear(dev, MT_UDMA_WLCFG_0,
-+ MT_WL_RX_AGG_TO | MT_WL_RX_AGG_LMT);
-+ mt76_clear(dev, MT_UDMA_WLCFG_1, MT_WL_RX_AGG_PKT_LMT);
-+
-+ if (resume)
-+ return 0;
-+
-+ err = mt792xu_dma_rx_evt_ep4(dev);
-+ if (err)
-+ return err;
-+
-+ mt792xu_epctl_rst_opt(dev, false);
-+
-+ return 0;
-+}
-+EXPORT_SYMBOL_GPL(mt792xu_dma_init);
-+
-+int mt792xu_wfsys_reset(struct mt792x_dev *dev)
-+{
-+ u32 val;
-+ int i;
-+
-+ mt792xu_epctl_rst_opt(dev, false);
-+
-+ val = mt792xu_uhw_rr(&dev->mt76, MT_CBTOP_RGU_WF_SUBSYS_RST);
-+ val |= MT_CBTOP_RGU_WF_SUBSYS_RST_WF_WHOLE_PATH;
-+ mt792xu_uhw_wr(&dev->mt76, MT_CBTOP_RGU_WF_SUBSYS_RST, val);
-+
-+ usleep_range(10, 20);
-+
-+ val = mt792xu_uhw_rr(&dev->mt76, MT_CBTOP_RGU_WF_SUBSYS_RST);
-+ val &= ~MT_CBTOP_RGU_WF_SUBSYS_RST_WF_WHOLE_PATH;
-+ mt792xu_uhw_wr(&dev->mt76, MT_CBTOP_RGU_WF_SUBSYS_RST, val);
-+
-+ mt792xu_uhw_wr(&dev->mt76, MT_UDMA_CONN_INFRA_STATUS_SEL, 0);
-+ for (i = 0; i < MT792x_WFSYS_INIT_RETRY_COUNT; i++) {
-+ val = mt792xu_uhw_rr(&dev->mt76, MT_UDMA_CONN_INFRA_STATUS);
-+ if (val & MT_UDMA_CONN_WFSYS_INIT_DONE)
-+ break;
-+
-+ msleep(100);
-+ }
-+
-+ if (i == MT792x_WFSYS_INIT_RETRY_COUNT)
-+ return -ETIMEDOUT;
-+
-+ return 0;
-+}
-+EXPORT_SYMBOL_GPL(mt792xu_wfsys_reset);
-+
-+int mt792xu_init_reset(struct mt792x_dev *dev)
-+{
-+ set_bit(MT76_RESET, &dev->mphy.state);
-+
-+ wake_up(&dev->mt76.mcu.wait);
-+ skb_queue_purge(&dev->mt76.mcu.res_q);
-+
-+ mt76u_stop_rx(&dev->mt76);
-+ mt76u_stop_tx(&dev->mt76);
-+
-+ mt792xu_wfsys_reset(dev);
-+
-+ clear_bit(MT76_RESET, &dev->mphy.state);
-+
-+ return mt76u_resume_rx(&dev->mt76);
-+}
-+EXPORT_SYMBOL_GPL(mt792xu_init_reset);
-+
-+void mt792xu_disconnect(struct usb_interface *usb_intf)
-+{
-+ struct mt792x_dev *dev = usb_get_intfdata(usb_intf);
-+
-+ cancel_work_sync(&dev->init_work);
-+ if (!test_bit(MT76_STATE_INITIALIZED, &dev->mphy.state))
-+ return;
-+
-+ mt76_unregister_device(&dev->mt76);
-+ mt792xu_cleanup(dev);
-+
-+ usb_set_intfdata(usb_intf, NULL);
-+ usb_put_dev(interface_to_usbdev(usb_intf));
-+
-+ mt76_free_device(&dev->mt76);
-+}
-+EXPORT_SYMBOL_GPL(mt792xu_disconnect);
-+
-+MODULE_LICENSE("Dual BSD/GPL");
-+MODULE_AUTHOR("Lorenzo Bianconi <lorenzo@kernel.org>");
-diff --git a/mt7996/mt7996.h b/mt7996/mt7996.h
-index 726c222e..7354e5cf 100644
---- a/mt7996/mt7996.h
-+++ b/mt7996/mt7996.h
-@@ -254,20 +254,6 @@ enum {
- __MT_WFDMA_MAX,
- };
-
--enum {
-- MT_CTX0,
-- MT_HIF0 = 0x0,
--
-- MT_LMAC_AC00 = 0x0,
-- MT_LMAC_AC01,
-- MT_LMAC_AC02,
-- MT_LMAC_AC03,
-- MT_LMAC_ALTX0 = 0x10,
-- MT_LMAC_BMC0,
-- MT_LMAC_BCN0,
-- MT_LMAC_PSMP0,
--};
--
- enum {
- MT_RX_SEL0,
- MT_RX_SEL1,
-diff --git a/testmode.c b/testmode.c
-index 0accc71a..4644dace 100644
---- a/testmode.c
-+++ b/testmode.c
-@@ -8,6 +8,7 @@ const struct nla_policy mt76_tm_policy[NUM_MT76_TM_ATTRS] = {
- [MT76_TM_ATTR_RESET] = { .type = NLA_FLAG },
- [MT76_TM_ATTR_STATE] = { .type = NLA_U8 },
- [MT76_TM_ATTR_TX_COUNT] = { .type = NLA_U32 },
-+ [MT76_TM_ATTR_TX_LENGTH] = { .type = NLA_U32 },
- [MT76_TM_ATTR_TX_RATE_MODE] = { .type = NLA_U8 },
- [MT76_TM_ATTR_TX_RATE_NSS] = { .type = NLA_U8 },
- [MT76_TM_ATTR_TX_RATE_IDX] = { .type = NLA_U8 },
---
-2.39.2
-
diff --git a/recipes-wifi/linux-mt76/files/patches/0001-wifi-mt76-mt7915-Update-beacon-size-limitation-for-1.patch b/recipes-wifi/linux-mt76/files/patches/0001-wifi-mt76-mt7915-update-beacon-size-limitation.patch
similarity index 87%
rename from recipes-wifi/linux-mt76/files/patches/0001-wifi-mt76-mt7915-Update-beacon-size-limitation-for-1.patch
rename to recipes-wifi/linux-mt76/files/patches/0001-wifi-mt76-mt7915-update-beacon-size-limitation.patch
index cc102c0..b426ae9 100644
--- a/recipes-wifi/linux-mt76/files/patches/0001-wifi-mt76-mt7915-Update-beacon-size-limitation-for-1.patch
+++ b/recipes-wifi/linux-mt76/files/patches/0001-wifi-mt76-mt7915-update-beacon-size-limitation.patch
@@ -1,30 +1,29 @@
-From 64caad5ad0bbb59c105b04436b078de13f30505d Mon Sep 17 00:00:00 2001
+From 5205d81a06d556463a50b163bc6ceb6a6fb2bdeb Mon Sep 17 00:00:00 2001
From: MeiChia Chiu <meichia.chiu@mediatek.com>
Date: Thu, 23 Mar 2023 08:49:48 +0800
-Subject: [PATCH 1/8] wifi: mt76: mt7915: Update beacon size limitation for 11v
+Subject: [PATCH 01/15] wifi: mt76: mt7915: update beacon size limitation
-Separate the beacon offload command into two;
-one is for beacons and the other is for inband discovery frames.
-Also, the TLV size limitation for these two has been expanded to
-accommodate 11v MBSSID IE.
+To accommodate 11v MBSSID IE and support maximum 16 MBSSIDs, expand the
+beacon size limitation for beacon and inband discovery commands.
Co-developed-by: Peter Chiu <chui-hao.chiu@mediatek.com>
Signed-off-by: Peter Chiu <chui-hao.chiu@mediatek.com>
Co-developed-by: Money Wang <Money.Wang@mediatek.com>
Signed-off-by: Money Wang <Money.Wang@mediatek.com>
Signed-off-by: MeiChia Chiu <MeiChia.Chiu@mediatek.com>
+Signed-off-by: Shayne Chen <shayne.chen@mediatek.com>
---
mt7915/main.c | 8 +++++---
- mt7915/mcu.c | 50 +++++++++++++++++++++++++++++--------------------
+ mt7915/mcu.c | 49 +++++++++++++++++++++++++++++--------------------
mt7915/mcu.h | 18 ++++++++----------
mt7915/mt7915.h | 2 ++
- 4 files changed, 45 insertions(+), 33 deletions(-)
+ 4 files changed, 44 insertions(+), 33 deletions(-)
diff --git a/mt7915/main.c b/mt7915/main.c
-index 33bfa4a..f741517 100644
+index 9b79e915..de994ea7 100644
--- a/mt7915/main.c
+++ b/mt7915/main.c
-@@ -645,11 +645,13 @@ static void mt7915_bss_info_changed(struct ieee80211_hw *hw,
+@@ -646,11 +646,13 @@ static void mt7915_bss_info_changed(struct ieee80211_hw *hw,
mt7915_update_bss_color(hw, vif, &info->he_bss_color);
if (changed & (BSS_CHANGED_BEACON |
@@ -42,7 +41,7 @@
mt7915_mcu_add_bss_info(phy, vif, false);
if (set_sta == 0)
diff --git a/mt7915/mcu.c b/mt7915/mcu.c
-index b0328d4..79d2354 100644
+index 8224f8be..6d000841 100644
--- a/mt7915/mcu.c
+++ b/mt7915/mcu.c
@@ -1882,10 +1882,9 @@ mt7915_mcu_beacon_cont(struct mt7915_dev *dev, struct ieee80211_vif *vif,
@@ -59,7 +58,7 @@
{
#define OFFLOAD_TX_MODE_SU BIT(0)
#define OFFLOAD_TX_MODE_MU BIT(1)
-@@ -1895,14 +1894,28 @@ mt7915_mcu_beacon_inband_discov(struct mt7915_dev *dev, struct ieee80211_vif *vi
+@@ -1895,14 +1894,27 @@ mt7915_mcu_beacon_inband_discov(struct mt7915_dev *dev, struct ieee80211_vif *vi
struct cfg80211_chan_def *chandef = &mvif->phy->mt76->chandef;
enum nl80211_band band = chandef->chan->band;
struct mt76_wcid *wcid = &dev->mt76.global_wcid;
@@ -79,7 +78,6 @@
+
+ rskb = __mt76_connac_mcu_alloc_sta_req(&dev->mt76, &mvif->mt76, NULL,
+ MT7915_MAX_BSS_OFFLOAD_SIZE);
-+
+ if (IS_ERR(rskb))
+ return PTR_ERR(rskb);
+
@@ -90,7 +88,7 @@
if (changed & BSS_CHANGED_FILS_DISCOVERY &&
vif->bss_conf.fils_discovery.max_interval) {
interval = vif->bss_conf.fils_discovery.max_interval;
-@@ -1914,26 +1927,25 @@ mt7915_mcu_beacon_inband_discov(struct mt7915_dev *dev, struct ieee80211_vif *vi
+@@ -1914,26 +1926,25 @@ mt7915_mcu_beacon_inband_discov(struct mt7915_dev *dev, struct ieee80211_vif *vi
}
if (!skb)
@@ -123,7 +121,7 @@
discov->tx_mode = OFFLOAD_TX_MODE_SU;
/* 0: UNSOL PROBE RESP, 1: FILS DISCOV */
discov->tx_type = !!(changed & BSS_CHANGED_FILS_DISCOVERY);
-@@ -1941,13 +1953,16 @@ mt7915_mcu_beacon_inband_discov(struct mt7915_dev *dev, struct ieee80211_vif *vi
+@@ -1941,13 +1952,16 @@ mt7915_mcu_beacon_inband_discov(struct mt7915_dev *dev, struct ieee80211_vif *vi
discov->prob_rsp_len = cpu_to_le16(MT_TXD_SIZE + skb->len);
discov->enable = true;
@@ -141,7 +139,7 @@
}
int mt7915_mcu_add_beacon(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
-@@ -1983,7 +1998,7 @@ int mt7915_mcu_add_beacon(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
+@@ -1983,7 +1997,7 @@ int mt7915_mcu_add_beacon(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
if (!skb)
return -EINVAL;
@@ -150,7 +148,7 @@
dev_err(dev->mt76.dev, "Bcn size limit exceed\n");
dev_kfree_skb(skb);
return -EINVAL;
-@@ -1997,11 +2012,6 @@ int mt7915_mcu_add_beacon(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
+@@ -1997,11 +2011,6 @@ int mt7915_mcu_add_beacon(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
mt7915_mcu_beacon_cont(dev, vif, rskb, skb, bcn, &offs);
dev_kfree_skb(skb);
@@ -163,7 +161,7 @@
return mt76_mcu_skb_send_msg(&phy->dev->mt76, rskb,
MCU_EXT_CMD(BSS_INFO_UPDATE), true);
diff --git a/mt7915/mcu.h b/mt7915/mcu.h
-index b9ea297..1592b5d 100644
+index b9ea297f..1592b5d6 100644
--- a/mt7915/mcu.h
+++ b/mt7915/mcu.h
@@ -495,10 +495,14 @@ enum {
@@ -199,7 +197,7 @@
mt7915_get_power_bound(struct mt7915_phy *phy, s8 txpower)
{
diff --git a/mt7915/mt7915.h b/mt7915/mt7915.h
-index 0456e56..21984e9 100644
+index 0456e56f..21984e97 100644
--- a/mt7915/mt7915.h
+++ b/mt7915/mt7915.h
@@ -447,6 +447,8 @@ int mt7915_mcu_add_rx_ba(struct mt7915_dev *dev,
@@ -212,5 +210,5 @@
int enable, u32 changed);
int mt7915_mcu_add_obss_spr(struct mt7915_phy *phy, struct ieee80211_vif *vif,
--
-2.18.0
+2.39.2
diff --git a/recipes-wifi/linux-mt76/files/patches/0002-wifi-mt76-mt7915-check-sta-rx-control-frame-to-multi.patch b/recipes-wifi/linux-mt76/files/patches/0002-wifi-mt76-mt7915-check-sta-rx-control-frame-to-multi.patch
new file mode 100644
index 0000000..0d2b350
--- /dev/null
+++ b/recipes-wifi/linux-mt76/files/patches/0002-wifi-mt76-mt7915-check-sta-rx-control-frame-to-multi.patch
@@ -0,0 +1,32 @@
+From a8a4d23f21cf56ca5d23a2ba15981b1f6459f19b Mon Sep 17 00:00:00 2001
+From: Allen Ye <allen.ye@mediatek.com>
+Date: Wed, 30 Aug 2023 18:34:47 +0800
+Subject: [PATCH 02/15] wifi: mt76: mt7915: check sta rx control frame to
+ multibss capability
+
+Add CAP3_RX_CTRL_FRAME_TO_MULTIBSS check when setting sta_muru_tlv,
+which is used to get stations's capability of receving control frames
+when running OFDMA with MBSSIDs.
+
+Signed-off-by: Allen Ye <allen.ye@mediatek.com>
+Signed-off-by: Shayne Chen <shayne.chen@mediatek.com>
+---
+ mt7915/mcu.c | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/mt7915/mcu.c b/mt7915/mcu.c
+index 6d000841..35cd4fb0 100644
+--- a/mt7915/mcu.c
++++ b/mt7915/mcu.c
+@@ -906,6 +906,8 @@ mt7915_mcu_sta_muru_tlv(struct mt7915_dev *dev, struct sk_buff *skb,
+ HE_MAC(CAP2_MU_CASCADING, elem->mac_cap_info[2]);
+ muru->ofdma_ul.uo_ra =
+ HE_MAC(CAP3_OFDMA_RA, elem->mac_cap_info[3]);
++ muru->ofdma_ul.rx_ctrl_frame_to_mbss =
++ HE_MAC(CAP3_RX_CTRL_FRAME_TO_MULTIBSS, elem->mac_cap_info[3]);
+ }
+
+ static void
+--
+2.39.2
+
diff --git a/recipes-wifi/linux-mt76/files/patches/0003-wifi-mt76-mt7915-fix-potential-memory-leak-of-beacon.patch b/recipes-wifi/linux-mt76/files/patches/0003-wifi-mt76-mt7915-fix-potential-memory-leak-of-beacon.patch
new file mode 100644
index 0000000..fd0a117
--- /dev/null
+++ b/recipes-wifi/linux-mt76/files/patches/0003-wifi-mt76-mt7915-fix-potential-memory-leak-of-beacon.patch
@@ -0,0 +1,58 @@
+From b63b83d4a4af7c51cd4cac1616863829b9308fd4 Mon Sep 17 00:00:00 2001
+From: Bo Jiao <Bo.Jiao@mediatek.com>
+Date: Wed, 30 Aug 2023 18:44:01 +0800
+Subject: [PATCH 03/15] wifi: mt76: mt7915: fix potential memory leak of beacon
+ commands
+
+Fix potential memory leak when setting beacon and inband discovery
+commands.
+
+Signed-off-by: Bo Jiao <Bo.Jiao@mediatek.com>
+Signed-off-by: Shayne Chen <shayne.chen@mediatek.com>
+---
+ mt7915/mcu.c | 10 ++++++++--
+ 1 file changed, 8 insertions(+), 2 deletions(-)
+
+diff --git a/mt7915/mcu.c b/mt7915/mcu.c
+index 35cd4fb0..74fafedb 100644
+--- a/mt7915/mcu.c
++++ b/mt7915/mcu.c
+@@ -1927,8 +1927,10 @@ mt7915_mcu_add_inband_discov(struct mt7915_dev *dev, struct ieee80211_vif *vif,
+ skb = ieee80211_get_unsol_bcast_probe_resp_tmpl(hw, vif);
+ }
+
+- if (!skb)
++ if (!skb) {
++ dev_kfree_skb(rskb);
+ return -EINVAL;
++ }
+
+ info = IEEE80211_SKB_CB(skb);
+ info->control.vif = vif;
+@@ -1940,6 +1942,7 @@ mt7915_mcu_add_inband_discov(struct mt7915_dev *dev, struct ieee80211_vif *vif,
+
+ if (skb->len > MT7915_MAX_BEACON_SIZE) {
+ dev_err(dev->mt76.dev, "inband discovery size limit exceed\n");
++ dev_kfree_skb(rskb);
+ dev_kfree_skb(skb);
+ return -EINVAL;
+ }
+@@ -1996,11 +1999,14 @@ int mt7915_mcu_add_beacon(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
+ goto out;
+
+ skb = ieee80211_beacon_get_template(hw, vif, &offs, 0);
+- if (!skb)
++ if (!skb) {
++ dev_kfree_skb(rskb);
+ return -EINVAL;
++ }
+
+ if (skb->len > MT7915_MAX_BEACON_SIZE) {
+ dev_err(dev->mt76.dev, "Bcn size limit exceed\n");
++ dev_kfree_skb(rskb);
+ dev_kfree_skb(skb);
+ return -EINVAL;
+ }
+--
+2.39.2
+
diff --git a/recipes-wifi/linux-mt76/files/patches/0004-wifi-mt76-mt7915-fix-DFS-CAC-tx-emission-issue-after.patch b/recipes-wifi/linux-mt76/files/patches/0004-wifi-mt76-mt7915-fix-DFS-CAC-tx-emission-issue-after.patch
deleted file mode 100644
index 8c2f287..0000000
--- a/recipes-wifi/linux-mt76/files/patches/0004-wifi-mt76-mt7915-fix-DFS-CAC-tx-emission-issue-after.patch
+++ /dev/null
@@ -1,40 +0,0 @@
-From 57bb66bcdcbf591f14627988603e52cae8465633 Mon Sep 17 00:00:00 2001
-From: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
-Date: Wed, 17 May 2023 17:34:55 +0800
-Subject: [PATCH 4/8] wifi: mt76: mt7915: fix DFS CAC tx emission issue after
- interface down up
-
-FW's channel state is set during the first wifi interface setup. If the switch reason for
-setting the tx/rx path during second-time wifi interface setup is CH_SWITCH_NORMAL,
-then the FW would perform runtime dpd channel calibration during DFS CAC, which leads to
-tx emission. Therefore, in order to bypass tx calibration during DFS CAC, set the switch reason
-to CH_SWITCH_DFS whenever chandef is set to DFS channel.
-
-Signed-off-by: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
----
- mt7915/mcu.c | 6 +++---
- 1 file changed, 3 insertions(+), 3 deletions(-)
-
-diff --git a/mt7915/mcu.c b/mt7915/mcu.c
-index e53d83b..bed4bdc 100644
---- a/mt7915/mcu.c
-+++ b/mt7915/mcu.c
-@@ -2735,12 +2735,12 @@ int mt7915_mcu_set_chan_info(struct mt7915_phy *phy, int cmd)
- if (mt76_connac_spe_idx(phy->mt76->antenna_mask))
- req.tx_path_num = fls(phy->mt76->antenna_mask);
-
-- if (cmd == MCU_EXT_CMD(SET_RX_PATH) ||
-- dev->mt76.hw->conf.flags & IEEE80211_CONF_MONITOR)
-+ if (dev->mt76.hw->conf.flags & IEEE80211_CONF_MONITOR)
- req.switch_reason = CH_SWITCH_NORMAL;
- else if (phy->mt76->hw->conf.flags & IEEE80211_CONF_OFFCHANNEL)
- req.switch_reason = CH_SWITCH_SCAN_BYPASS_DPD;
-- else if (!cfg80211_reg_can_beacon(phy->mt76->hw->wiphy, chandef,
-+ else if (cfg80211_chandef_valid(chandef) &&
-+ !cfg80211_reg_can_beacon(phy->mt76->hw->wiphy, chandef,
- NL80211_IFTYPE_AP))
- req.switch_reason = CH_SWITCH_DFS;
- else
---
-2.18.0
-
diff --git a/recipes-wifi/linux-mt76/files/patches/0004-wifi-mt76-mt7915-get-rid-of-false-alamrs-of-tx-emiss.patch b/recipes-wifi/linux-mt76/files/patches/0004-wifi-mt76-mt7915-get-rid-of-false-alamrs-of-tx-emiss.patch
new file mode 100644
index 0000000..80f8e1d
--- /dev/null
+++ b/recipes-wifi/linux-mt76/files/patches/0004-wifi-mt76-mt7915-get-rid-of-false-alamrs-of-tx-emiss.patch
@@ -0,0 +1,40 @@
+From c521ab8836a3e1a4e4f71896e364802c3cf2d6e7 Mon Sep 17 00:00:00 2001
+From: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
+Date: Wed, 17 May 2023 17:34:55 +0800
+Subject: [PATCH 04/15] wifi: mt76: mt7915: get rid of false alamrs of tx
+ emission issues
+
+When mt7915_mcu_set_chan_info() is set with CH_SWITCH_NORMAL reason,
+even if the action is UNI_CHANNEL_RX_PATH, it'll still generate some
+unexpected tones, which might confuse DFS CAC tests that there are some
+tone leakages. To get rid of these kinds of false alarms, always bypass
+DPD calibration when IEEE80211_CONF_IDLE is set.
+
+Reviewed-by: Evelyn Tsai <evelyn.tsai@mediatek.com>
+Signed-off-by: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
+Signed-off-by: Shayne Chen <shayne.chen@mediatek.com>
+---
+ mt7915/mcu.c | 6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/mt7915/mcu.c b/mt7915/mcu.c
+index 74fafedb..9ee65fa5 100644
+--- a/mt7915/mcu.c
++++ b/mt7915/mcu.c
+@@ -2742,10 +2742,10 @@ int mt7915_mcu_set_chan_info(struct mt7915_phy *phy, int cmd)
+ if (mt76_connac_spe_idx(phy->mt76->antenna_mask))
+ req.tx_path_num = fls(phy->mt76->antenna_mask);
+
+- if (cmd == MCU_EXT_CMD(SET_RX_PATH) ||
+- dev->mt76.hw->conf.flags & IEEE80211_CONF_MONITOR)
++ if (dev->mt76.hw->conf.flags & IEEE80211_CONF_MONITOR)
+ req.switch_reason = CH_SWITCH_NORMAL;
+- else if (phy->mt76->hw->conf.flags & IEEE80211_CONF_OFFCHANNEL)
++ else if (phy->mt76->hw->conf.flags & IEEE80211_CONF_OFFCHANNEL ||
++ phy->mt76->hw->conf.flags & IEEE80211_CONF_IDLE)
+ req.switch_reason = CH_SWITCH_SCAN_BYPASS_DPD;
+ else if (!cfg80211_reg_can_beacon(phy->mt76->hw->wiphy, chandef,
+ NL80211_IFTYPE_AP))
+--
+2.39.2
+
diff --git a/recipes-wifi/linux-mt76/files/patches/0005-wifi-mt76-mt7915-fix-per-band-IEEE80211_CONF_MONITOR.patch b/recipes-wifi/linux-mt76/files/patches/0005-wifi-mt76-mt7915-fix-per-band-IEEE80211_CONF_MONITOR.patch
new file mode 100644
index 0000000..e5bab73
--- /dev/null
+++ b/recipes-wifi/linux-mt76/files/patches/0005-wifi-mt76-mt7915-fix-per-band-IEEE80211_CONF_MONITOR.patch
@@ -0,0 +1,30 @@
+From 5119f4b1da53dfd34e73803a35adf80831db176e Mon Sep 17 00:00:00 2001
+From: Shayne Chen <shayne.chen@mediatek.com>
+Date: Wed, 30 Aug 2023 18:51:08 +0800
+Subject: [PATCH 05/15] wifi: mt76: mt7915: fix per-band IEEE80211_CONF_MONITOR
+ flag comparison
+
+Use the correct ieee80211_conf on each band for IEEE80211_CONF_MONITOR
+comparison.
+
+Signed-off-by: Shayne Chen <shayne.chen@mediatek.com>
+---
+ mt7915/mcu.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/mt7915/mcu.c b/mt7915/mcu.c
+index 9ee65fa5..eae62b9c 100644
+--- a/mt7915/mcu.c
++++ b/mt7915/mcu.c
+@@ -2742,7 +2742,7 @@ int mt7915_mcu_set_chan_info(struct mt7915_phy *phy, int cmd)
+ if (mt76_connac_spe_idx(phy->mt76->antenna_mask))
+ req.tx_path_num = fls(phy->mt76->antenna_mask);
+
+- if (dev->mt76.hw->conf.flags & IEEE80211_CONF_MONITOR)
++ if (phy->mt76->hw->conf.flags & IEEE80211_CONF_MONITOR)
+ req.switch_reason = CH_SWITCH_NORMAL;
+ else if (phy->mt76->hw->conf.flags & IEEE80211_CONF_OFFCHANNEL ||
+ phy->mt76->hw->conf.flags & IEEE80211_CONF_IDLE)
+--
+2.39.2
+
diff --git a/recipes-wifi/linux-mt76/files/patches/0006-wifi-mt76-mt7915-check-vif-type-before-reporting-cca.patch b/recipes-wifi/linux-mt76/files/patches/0006-wifi-mt76-mt7915-check-vif-type-before-reporting-cca.patch
new file mode 100644
index 0000000..22f8981
--- /dev/null
+++ b/recipes-wifi/linux-mt76/files/patches/0006-wifi-mt76-mt7915-check-vif-type-before-reporting-cca.patch
@@ -0,0 +1,40 @@
+From 18d25338da14f4b7de5aabd86ebb066b45d7e916 Mon Sep 17 00:00:00 2001
+From: Peter Chiu <chui-hao.chiu@mediatek.com>
+Date: Mon, 28 Aug 2023 10:59:23 +0800
+Subject: [PATCH 06/15] wifi: mt76: mt7915: check vif type before reporting cca
+ and csa
+
+Don't report cca and csa finish to upper layer on station type vif to
+prevent warnings caused by setting beacon.
+
+Signed-off-by: Peter Chiu <chui-hao.chiu@mediatek.com>
+Signed-off-by: Shayne Chen <shayne.chen@mediatek.com>
+---
+ mt7915/mcu.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/mt7915/mcu.c b/mt7915/mcu.c
+index eae62b9c..cdd1f847 100644
+--- a/mt7915/mcu.c
++++ b/mt7915/mcu.c
+@@ -225,7 +225,7 @@ int mt7915_mcu_wa_cmd(struct mt7915_dev *dev, int cmd, u32 a1, u32 a2, u32 a3)
+ static void
+ mt7915_mcu_csa_finish(void *priv, u8 *mac, struct ieee80211_vif *vif)
+ {
+- if (vif->bss_conf.csa_active)
++ if (vif->bss_conf.csa_active && vif->type != NL80211_IFTYPE_STATION)
+ ieee80211_csa_finish(vif);
+ }
+
+@@ -326,7 +326,7 @@ mt7915_mcu_rx_log_message(struct mt7915_dev *dev, struct sk_buff *skb)
+ static void
+ mt7915_mcu_cca_finish(void *priv, u8 *mac, struct ieee80211_vif *vif)
+ {
+- if (!vif->bss_conf.color_change_active)
++ if (!vif->bss_conf.color_change_active || vif->type == NL80211_IFTYPE_STATION)
+ return;
+
+ ieee80211_color_change_finish(vif);
+--
+2.39.2
+
diff --git a/recipes-wifi/linux-mt76/files/patches/0006-wifi-mt76-mt7915-update-mpdu-density-in-2-5g-capabil.patch b/recipes-wifi/linux-mt76/files/patches/0007-wifi-mt76-mt7915-update-mpdu-density-capability.patch
similarity index 82%
rename from recipes-wifi/linux-mt76/files/patches/0006-wifi-mt76-mt7915-update-mpdu-density-in-2-5g-capabil.patch
rename to recipes-wifi/linux-mt76/files/patches/0007-wifi-mt76-mt7915-update-mpdu-density-capability.patch
index 2311cb2..b87db29 100644
--- a/recipes-wifi/linux-mt76/files/patches/0006-wifi-mt76-mt7915-update-mpdu-density-in-2-5g-capabil.patch
+++ b/recipes-wifi/linux-mt76/files/patches/0007-wifi-mt76-mt7915-update-mpdu-density-capability.patch
@@ -1,19 +1,19 @@
-From f9e99e0dec97a1dfb67e7f364d461ba15449a5e8 Mon Sep 17 00:00:00 2001
+From cb7c72bdaee4dedeea85377f120e12efb070e835 Mon Sep 17 00:00:00 2001
From: Peter Chiu <chui-hao.chiu@mediatek.com>
Date: Wed, 24 May 2023 10:17:38 +0800
-Subject: [PATCH 6/8] wifi: mt76: mt7915: update mpdu density in 2/5g
- capability
+Subject: [PATCH 07/15] wifi: mt76: mt7915: update mpdu density capability
-Set mpdu density to 2 usec to meet hardware capability
-and also update enhance throughput.
+Set mpdu density to 2 usec for non-mt7915 Wi-Fi 6 generation chipsets
+to align to the hardware capability which improves the throughput.
Signed-off-by: Peter Chiu <chui-hao.chiu@mediatek.com>
+Signed-off-by: Shayne Chen <shayne.chen@mediatek.com>
---
mt7915/init.c | 16 ++++++++++++----
1 file changed, 12 insertions(+), 4 deletions(-)
diff --git a/mt7915/init.c b/mt7915/init.c
-index 5baa571..2eec451 100644
+index 688e6bc6..004f41bf 100644
--- a/mt7915/init.c
+++ b/mt7915/init.c
@@ -398,8 +398,12 @@ mt7915_init_wiphy(struct mt7915_phy *phy)
@@ -56,5 +56,5 @@
IEEE80211_VHT_CAP_MAX_MPDU_LENGTH_11454 |
IEEE80211_VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_MASK;
--
-2.18.0
+2.39.2
diff --git a/recipes-wifi/linux-mt76/files/patches/0002-wifi-mt76-mt7915-fix-the-beamformer-issue.patch b/recipes-wifi/linux-mt76/files/patches/0008-wifi-mt76-mt7915-fix-beamforming-availability-check.patch
similarity index 65%
rename from recipes-wifi/linux-mt76/files/patches/0002-wifi-mt76-mt7915-fix-the-beamformer-issue.patch
rename to recipes-wifi/linux-mt76/files/patches/0008-wifi-mt76-mt7915-fix-beamforming-availability-check.patch
index fe5b24f..d3d52fd 100644
--- a/recipes-wifi/linux-mt76/files/patches/0002-wifi-mt76-mt7915-fix-the-beamformer-issue.patch
+++ b/recipes-wifi/linux-mt76/files/patches/0008-wifi-mt76-mt7915-fix-beamforming-availability-check.patch
@@ -1,21 +1,22 @@
-From 6c3be50d5ede7f58bb6225bed563d14d815dd54f Mon Sep 17 00:00:00 2001
+From 47a2c8faf86bd3b3f3e7e0495015eebee53de0e9 Mon Sep 17 00:00:00 2001
From: MeiChia Chiu <meichia.chiu@mediatek.com>
Date: Wed, 12 Apr 2023 15:53:42 +0800
-Subject: [PATCH 2/8] wifi: mt76: mt7915: fix the beamformer issue
+Subject: [PATCH 08/15] wifi: mt76: mt7915: fix beamforming availability check
-without this patch, when ap sets the tx stream number to 2,
-ap doesn't send any beamform packets.
+Without this patch, when ap sets the tx stream number to 2,
+ap won't send any beamforming packet.
Signed-off-by: MeiChia Chiu <MeiChia.Chiu@mediatek.com>
+Signed-off-by: Shayne Chen <shayne.chen@mediatek.com>
---
mt7915/mcu.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/mt7915/mcu.c b/mt7915/mcu.c
-index 79d2354..f2ffa6c 100644
+index cdd1f847..5c4a275c 100644
--- a/mt7915/mcu.c
+++ b/mt7915/mcu.c
-@@ -1015,13 +1015,13 @@ mt7915_is_ebf_supported(struct mt7915_phy *phy, struct ieee80211_vif *vif,
+@@ -1017,13 +1017,13 @@ mt7915_is_ebf_supported(struct mt7915_phy *phy, struct ieee80211_vif *vif,
struct ieee80211_sta *sta, bool bfee)
{
struct mt7915_vif *mvif = (struct mt7915_vif *)vif->drv_priv;
@@ -32,5 +33,5 @@
if (sta->deflink.he_cap.has_he) {
--
-2.18.0
+2.39.2
diff --git a/recipes-wifi/linux-mt76/files/patches/0008-wifi-mt76-mt7915-fix-tx-emission-issue-during-bootup.patch b/recipes-wifi/linux-mt76/files/patches/0008-wifi-mt76-mt7915-fix-tx-emission-issue-during-bootup.patch
deleted file mode 100644
index 322bb3a..0000000
--- a/recipes-wifi/linux-mt76/files/patches/0008-wifi-mt76-mt7915-fix-tx-emission-issue-during-bootup.patch
+++ /dev/null
@@ -1,30 +0,0 @@
-From 56916977daae3317294a905950cdc604d048bddb Mon Sep 17 00:00:00 2001
-From: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
-Date: Wed, 2 Aug 2023 11:26:14 +0800
-Subject: [PATCH] wifi: mt76: mt7915: fix tx emission issue during bootup after
- applying pre-cal
-
-Signed-off-by: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
-Reviewed-by: Shayne Chen <shayne.chen@mediatek.com>
-Reviewed-by: Evelyn Tsai <evelyn.tsai@mediatek.com>
----
- mt7915/mcu.c | 3 ++-
- 1 file changed, 2 insertions(+), 1 deletion(-)
-
-diff --git a/mt7915/mcu.c b/mt7915/mcu.c
-index a34b75d..502610f 100644
---- a/mt7915/mcu.c
-+++ b/mt7915/mcu.c
-@@ -2737,7 +2737,8 @@ int mt7915_mcu_set_chan_info(struct mt7915_phy *phy, int cmd)
-
- if (dev->mt76.hw->conf.flags & IEEE80211_CONF_MONITOR)
- req.switch_reason = CH_SWITCH_NORMAL;
-- else if (phy->mt76->hw->conf.flags & IEEE80211_CONF_OFFCHANNEL)
-+ else if (phy->mt76->hw->conf.flags & IEEE80211_CONF_OFFCHANNEL ||
-+ phy->mt76->hw->conf.flags & IEEE80211_CONF_IDLE)
- req.switch_reason = CH_SWITCH_SCAN_BYPASS_DPD;
- else if (cfg80211_chandef_valid(chandef) &&
- !cfg80211_reg_can_beacon(phy->mt76->hw->wiphy, chandef,
---
-2.18.0
-
diff --git a/recipes-wifi/linux-mt76/files/patches/0003-wifi-mt76-fix-incorrect-HE-TX-GI-report.patch b/recipes-wifi/linux-mt76/files/patches/0009-wifi-mt76-fix-incorrect-HE-TX-GI-report.patch
similarity index 94%
rename from recipes-wifi/linux-mt76/files/patches/0003-wifi-mt76-fix-incorrect-HE-TX-GI-report.patch
rename to recipes-wifi/linux-mt76/files/patches/0009-wifi-mt76-fix-incorrect-HE-TX-GI-report.patch
index e15b23d..b752c0e 100644
--- a/recipes-wifi/linux-mt76/files/patches/0003-wifi-mt76-fix-incorrect-HE-TX-GI-report.patch
+++ b/recipes-wifi/linux-mt76/files/patches/0009-wifi-mt76-fix-incorrect-HE-TX-GI-report.patch
@@ -1,7 +1,7 @@
-From 1e7cc5cecfcf8f233742468d6b60e3619fbf9678 Mon Sep 17 00:00:00 2001
+From 809ef0860a8e3f3fe223cd2842d882e203124639 Mon Sep 17 00:00:00 2001
From: Evelyn Tsai <evelyn.tsai@mediatek.com>
Date: Thu, 18 May 2023 18:11:37 +0800
-Subject: [PATCH 3/8] wifi: mt76: fix incorrect HE TX GI report
+Subject: [PATCH 09/15] wifi: mt76: fix incorrect HE TX GI report
Change GI reporting source from static capability to rate-tuning module.
@@ -17,7 +17,7 @@
7 files changed, 282 insertions(+), 22 deletions(-)
diff --git a/mt76.h b/mt76.h
-index 034ab90..1ca23c9 100644
+index 034ab90c..1ca23c90 100644
--- a/mt76.h
+++ b/mt76.h
@@ -254,12 +254,16 @@ struct mt76_queue_ops {
@@ -38,10 +38,10 @@
MT_PHY_TYPE_HE_EXT_SU,
MT_PHY_TYPE_HE_TB,
diff --git a/mt7915/init.c b/mt7915/init.c
-index 688e6bc..5baa571 100644
+index 004f41bf..2eec451f 100644
--- a/mt7915/init.c
+++ b/mt7915/init.c
-@@ -655,6 +655,8 @@ mt7915_register_ext_phy(struct mt7915_dev *dev, struct mt7915_phy *phy)
+@@ -663,6 +663,8 @@ mt7915_register_ext_phy(struct mt7915_dev *dev, struct mt7915_phy *phy)
struct mt76_phy *mphy = phy->mt76;
int ret;
@@ -50,7 +50,7 @@
INIT_DELAYED_WORK(&mphy->mac_work, mt7915_mac_work);
mt7915_eeprom_parse_hw_cap(dev, phy);
-@@ -1187,6 +1189,8 @@ int mt7915_register_device(struct mt7915_dev *dev)
+@@ -1195,6 +1197,8 @@ int mt7915_register_device(struct mt7915_dev *dev)
dev->phy.dev = dev;
dev->phy.mt76 = &dev->mt76.phy;
dev->mt76.phy.priv = &dev->phy;
@@ -60,7 +60,7 @@
INIT_DELAYED_WORK(&dev->mphy.mac_work, mt7915_mac_work);
INIT_LIST_HEAD(&dev->sta_rc_list);
diff --git a/mt7915/mac.c b/mt7915/mac.c
-index b8b0c0f..789f86a 100644
+index b8b0c0fd..789f86a1 100644
--- a/mt7915/mac.c
+++ b/mt7915/mac.c
@@ -173,15 +173,7 @@ static void mt7915_mac_sta_poll(struct mt7915_dev *dev)
@@ -188,10 +188,10 @@
mt76_tx_status_check(mphy->dev, false);
diff --git a/mt7915/main.c b/mt7915/main.c
-index f741517..86f794f 100644
+index de994ea7..33813259 100644
--- a/mt7915/main.c
+++ b/mt7915/main.c
-@@ -738,6 +738,7 @@ int mt7915_mac_sta_add(struct mt76_dev *mdev, struct ieee80211_vif *vif,
+@@ -739,6 +739,7 @@ int mt7915_mac_sta_add(struct mt76_dev *mdev, struct ieee80211_vif *vif,
INIT_LIST_HEAD(&msta->rc_list);
INIT_LIST_HEAD(&msta->wcid.poll_list);
@@ -199,7 +199,7 @@
msta->vif = mvif;
msta->wcid.sta = 1;
msta->wcid.idx = idx;
-@@ -762,6 +763,7 @@ void mt7915_mac_sta_remove(struct mt76_dev *mdev, struct ieee80211_vif *vif,
+@@ -763,6 +764,7 @@ void mt7915_mac_sta_remove(struct mt76_dev *mdev, struct ieee80211_vif *vif,
{
struct mt7915_dev *dev = container_of(mdev, struct mt7915_dev, mt76);
struct mt7915_sta *msta = (struct mt7915_sta *)sta->drv_priv;
@@ -207,7 +207,7 @@
int i;
mt7915_mcu_add_sta(dev, vif, sta, false);
-@@ -778,6 +780,11 @@ void mt7915_mac_sta_remove(struct mt76_dev *mdev, struct ieee80211_vif *vif,
+@@ -779,6 +781,11 @@ void mt7915_mac_sta_remove(struct mt76_dev *mdev, struct ieee80211_vif *vif,
if (!list_empty(&msta->rc_list))
list_del_init(&msta->rc_list);
spin_unlock_bh(&mdev->sta_poll_lock);
@@ -220,10 +220,10 @@
static void mt7915_tx(struct ieee80211_hw *hw,
diff --git a/mt7915/mcu.c b/mt7915/mcu.c
-index f2ffa6c..e53d83b 100644
+index 5c4a275c..0660843c 100644
--- a/mt7915/mcu.c
+++ b/mt7915/mcu.c
-@@ -3714,6 +3714,167 @@ out:
+@@ -3721,6 +3721,167 @@ out:
return ret;
}
@@ -392,7 +392,7 @@
struct cfg80211_he_bss_color *he_bss_color)
{
diff --git a/mt7915/mcu.h b/mt7915/mcu.h
-index 1592b5d..aebacc7 100644
+index 1592b5d6..aebacc7d 100644
--- a/mt7915/mcu.h
+++ b/mt7915/mcu.h
@@ -152,6 +152,61 @@ struct mt7915_mcu_eeprom_info {
@@ -466,7 +466,7 @@
+};
#endif
diff --git a/mt7915/mt7915.h b/mt7915/mt7915.h
-index 21984e9..3510dbc 100644
+index 21984e97..3510dbcc 100644
--- a/mt7915/mt7915.h
+++ b/mt7915/mt7915.h
@@ -137,6 +137,7 @@ struct mt7915_sta {
@@ -497,5 +497,5 @@
struct ieee80211_sta *sta, struct rate_info *rate);
int mt7915_mcu_rdd_background_enable(struct mt7915_phy *phy,
--
-2.18.0
+2.39.2
diff --git a/recipes-wifi/linux-mt76/files/patches/0005-wifi-mt76-mt7915-add-pc-stack-dump-for-WM-s-coredump.patch b/recipes-wifi/linux-mt76/files/patches/0010-wifi-mt76-mt7915-add-pc-stack-dump-for-WM-s-coredump.patch
similarity index 98%
rename from recipes-wifi/linux-mt76/files/patches/0005-wifi-mt76-mt7915-add-pc-stack-dump-for-WM-s-coredump.patch
rename to recipes-wifi/linux-mt76/files/patches/0010-wifi-mt76-mt7915-add-pc-stack-dump-for-WM-s-coredump.patch
index 2976565..70ca901 100644
--- a/recipes-wifi/linux-mt76/files/patches/0005-wifi-mt76-mt7915-add-pc-stack-dump-for-WM-s-coredump.patch
+++ b/recipes-wifi/linux-mt76/files/patches/0010-wifi-mt76-mt7915-add-pc-stack-dump-for-WM-s-coredump.patch
@@ -1,7 +1,8 @@
-From 242ad39c7c7509c7486050d547723053a78b78b7 Mon Sep 17 00:00:00 2001
+From 5f92b4ac9dd583b733b95455d8d3bf88b14a95b5 Mon Sep 17 00:00:00 2001
From: Bo Jiao <Bo.Jiao@mediatek.com>
Date: Mon, 22 May 2023 13:49:37 +0800
-Subject: [PATCH 5/8] wifi: mt76: mt7915: add pc stack dump for WM's coredump.
+Subject: [PATCH 10/15] wifi: mt76: mt7915: add pc stack dump for WM's
+ coredump.
Signed-off-by: Bo Jiao <Bo.Jiao@mediatek.com>
---
@@ -15,7 +16,7 @@
7 files changed, 207 insertions(+), 71 deletions(-)
diff --git a/mt76.h b/mt76.h
-index 1ca23c9..a4cf9b6 100644
+index 1ca23c90..a4cf9b62 100644
--- a/mt76.h
+++ b/mt76.h
@@ -27,6 +27,8 @@
@@ -51,7 +52,7 @@
struct net_device napi_dev;
struct net_device tx_napi_dev;
diff --git a/mt76_connac_mcu.c b/mt76_connac_mcu.c
-index 0f0a519..cd6ce3c 100644
+index 0f0a519f..cd6ce3c0 100644
--- a/mt76_connac_mcu.c
+++ b/mt76_connac_mcu.c
@@ -3020,6 +3020,9 @@ int mt76_connac2_load_ram(struct mt76_dev *dev, const char *fw_wm,
@@ -85,7 +86,7 @@
struct mt76_connac2_patch_sec *sec;
u32 len, addr, mode;
diff --git a/mt7915/coredump.c b/mt7915/coredump.c
-index 5daf225..298c1ca 100644
+index 5daf2258..298c1cad 100644
--- a/mt7915/coredump.c
+++ b/mt7915/coredump.c
@@ -7,7 +7,7 @@
@@ -413,7 +414,7 @@
}
diff --git a/mt7915/coredump.h b/mt7915/coredump.h
-index 709f8e9..809ccbd 100644
+index 709f8e9c..809ccbdf 100644
--- a/mt7915/coredump.h
+++ b/mt7915/coredump.h
@@ -4,6 +4,7 @@
@@ -513,7 +514,7 @@
return NULL;
}
diff --git a/mt7915/mac.c b/mt7915/mac.c
-index 789f86a..67e7b26 100644
+index 789f86a1..67e7b264 100644
--- a/mt7915/mac.c
+++ b/mt7915/mac.c
@@ -1595,28 +1595,31 @@ void mt7915_mac_reset_work(struct work_struct *work)
@@ -594,7 +595,7 @@
}
diff --git a/mt7915/mt7915.h b/mt7915/mt7915.h
-index 3510dbc..eb66fcd 100644
+index 3510dbcc..eb66fcda 100644
--- a/mt7915/mt7915.h
+++ b/mt7915/mt7915.h
@@ -286,7 +286,7 @@ struct mt7915_dev {
@@ -607,7 +608,7 @@
#endif
diff --git a/mt7915/regs.h b/mt7915/regs.h
-index 588cd87..d01b9ea 100644
+index 588cd87e..d01b9ea9 100644
--- a/mt7915/regs.h
+++ b/mt7915/regs.h
@@ -1218,4 +1218,24 @@ enum offs_rev {
@@ -636,5 +637,5 @@
+
#endif
--
-2.18.0
+2.39.2
diff --git a/recipes-wifi/linux-mt76/files/patches/0007-wifi-mt76-mt7915-move-temperature-margin-check-to-mt.patch b/recipes-wifi/linux-mt76/files/patches/0011-wifi-mt76-mt7915-move-temperature-margin-check-to-mt.patch
similarity index 87%
rename from recipes-wifi/linux-mt76/files/patches/0007-wifi-mt76-mt7915-move-temperature-margin-check-to-mt.patch
rename to recipes-wifi/linux-mt76/files/patches/0011-wifi-mt76-mt7915-move-temperature-margin-check-to-mt.patch
index 1e1811f..1e17d22 100644
--- a/recipes-wifi/linux-mt76/files/patches/0007-wifi-mt76-mt7915-move-temperature-margin-check-to-mt.patch
+++ b/recipes-wifi/linux-mt76/files/patches/0011-wifi-mt76-mt7915-move-temperature-margin-check-to-mt.patch
@@ -1,7 +1,7 @@
-From f15732280a08c2c9f5fb3b18b40fb047189830a5 Mon Sep 17 00:00:00 2001
+From b7d4a039b0f828dfc7758a364c72c389cc500093 Mon Sep 17 00:00:00 2001
From: Howard Hsu <howard-yh.hsu@mediatek.com>
Date: Thu, 13 Jul 2023 15:50:00 +0800
-Subject: [PATCH 7/8] wifi: mt76: mt7915: move temperature margin check to
+Subject: [PATCH 11/15] wifi: mt76: mt7915: move temperature margin check to
mt7915_thermal_temp_store()
Originally, we would reduce the 10-degree margin to the restore
@@ -17,7 +17,7 @@
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/mt7915/init.c b/mt7915/init.c
-index 2eec451..bcd3717 100644
+index 2eec451f..bcd37172 100644
--- a/mt7915/init.c
+++ b/mt7915/init.c
@@ -83,12 +83,13 @@ static ssize_t mt7915_thermal_temp_store(struct device *dev,
@@ -38,10 +38,10 @@
return -EINVAL;
}
diff --git a/mt7915/mcu.c b/mt7915/mcu.c
-index bed4bdc..cc91df8 100644
+index 0660843c..ae488039 100644
--- a/mt7915/mcu.c
+++ b/mt7915/mcu.c
-@@ -3147,8 +3147,7 @@ int mt7915_mcu_set_thermal_protect(struct mt7915_phy *phy)
+@@ -3154,8 +3154,7 @@ int mt7915_mcu_set_thermal_protect(struct mt7915_phy *phy)
/* set high-temperature trigger threshold */
req.ctrl.ctrl_id = THERMAL_PROTECT_ENABLE;
@@ -52,5 +52,5 @@
req.sustain_time = cpu_to_le16(10);
--
-2.18.0
+2.39.2
diff --git a/recipes-wifi/linux-mt76/files/patches/0009-wifi-mt76-mt7915-fix-txpower-issues.patch b/recipes-wifi/linux-mt76/files/patches/0012-wifi-mt76-mt7915-fix-txpower-issues.patch
similarity index 94%
rename from recipes-wifi/linux-mt76/files/patches/0009-wifi-mt76-mt7915-fix-txpower-issues.patch
rename to recipes-wifi/linux-mt76/files/patches/0012-wifi-mt76-mt7915-fix-txpower-issues.patch
index e62d287..d0665af 100644
--- a/recipes-wifi/linux-mt76/files/patches/0009-wifi-mt76-mt7915-fix-txpower-issues.patch
+++ b/recipes-wifi/linux-mt76/files/patches/0012-wifi-mt76-mt7915-fix-txpower-issues.patch
@@ -1,7 +1,7 @@
-From a769a5232abe1ca70f376ef90efc227c9fd56901 Mon Sep 17 00:00:00 2001
+From 285ce41898a1c7c49e89681a31cd7daa1d8b6ad3 Mon Sep 17 00:00:00 2001
From: Evelyn Tsai <evelyn.tsai@mediatek.com>
Date: Sat, 29 Jul 2023 04:53:47 +0800
-Subject: [PATCH] wifi: mt76: mt7915: fix txpower issues
+Subject: [PATCH 12/15] wifi: mt76: mt7915: fix txpower issues
---
eeprom.c | 4 ++--
@@ -13,7 +13,7 @@
6 files changed, 32 insertions(+), 27 deletions(-)
diff --git a/eeprom.c b/eeprom.c
-index 2558788..750e031 100644
+index 2558788f..750e031d 100644
--- a/eeprom.c
+++ b/eeprom.c
@@ -338,7 +338,7 @@ s8 mt76_get_rate_power_limits(struct mt76_phy *phy,
@@ -35,7 +35,7 @@
val = mt76_get_of_array(np, "rates-cck", &len, ARRAY_SIZE(dest->cck));
mt76_apply_array_limit(dest->cck, ARRAY_SIZE(dest->cck), val,
diff --git a/mac80211.c b/mac80211.c
-index 8540738..0a08161 100644
+index 85407387..0a081613 100644
--- a/mac80211.c
+++ b/mac80211.c
@@ -1486,7 +1486,7 @@ int mt76_get_txpower(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
@@ -48,7 +48,7 @@
*dbm = DIV_ROUND_UP(phy->txpower_cur + delta, 2);
diff --git a/mt7915/debugfs.c b/mt7915/debugfs.c
-index 6c3696c..93e549c 100644
+index 6c3696c8..93e549c3 100644
--- a/mt7915/debugfs.c
+++ b/mt7915/debugfs.c
@@ -950,9 +950,9 @@ mt7915_xmit_queues_show(struct seq_file *file, void *data)
@@ -132,7 +132,7 @@
reg = is_mt7915(&dev->mt76) ? MT_WF_PHY_TPC_CTRL_STAT(band) :
MT_WF_PHY_TPC_CTRL_STAT_MT7916(band);
diff --git a/mt7915/init.c b/mt7915/init.c
-index bcd3717..15b719f 100644
+index bcd37172..15b719fa 100644
--- a/mt7915/init.c
+++ b/mt7915/init.c
@@ -281,7 +281,7 @@ static void mt7915_led_set_brightness(struct led_classdev *led_cdev,
@@ -145,7 +145,7 @@
int pwr_delta = mt7915_eeprom_get_power_delta(dev, sband->band);
struct mt76_power_limits limits;
diff --git a/mt7915/main.c b/mt7915/main.c
-index 3381325..a90ac45 100644
+index 33813259..a90ac456 100644
--- a/mt7915/main.c
+++ b/mt7915/main.c
@@ -1063,6 +1063,7 @@ mt7915_set_antenna(struct ieee80211_hw *hw, u32 tx_ant, u32 rx_ant)
@@ -157,7 +157,7 @@
mutex_unlock(&dev->mt76.mutex);
diff --git a/mt7915/mcu.h b/mt7915/mcu.h
-index aebacc7..8f36546 100644
+index aebacc7d..8f365461 100644
--- a/mt7915/mcu.h
+++ b/mt7915/mcu.h
@@ -574,7 +574,7 @@ static inline s8
@@ -170,5 +170,5 @@
txpower = mt76_get_sar_power(mphy, mphy->chandef.chan, txpower * 2);
txpower -= mt76_tx_power_nss_delta(n_chains);
--
-2.18.0
+2.39.2
diff --git a/recipes-wifi/linux-mt76/files/patches/0010-wifi-mt76-mt7915-rework-init-txpower.patch b/recipes-wifi/linux-mt76/files/patches/0013-wifi-mt76-mt7915-rework-init-txpower.patch
similarity index 96%
rename from recipes-wifi/linux-mt76/files/patches/0010-wifi-mt76-mt7915-rework-init-txpower.patch
rename to recipes-wifi/linux-mt76/files/patches/0013-wifi-mt76-mt7915-rework-init-txpower.patch
index 0b8b70c..75c90b7 100644
--- a/recipes-wifi/linux-mt76/files/patches/0010-wifi-mt76-mt7915-rework-init-txpower.patch
+++ b/recipes-wifi/linux-mt76/files/patches/0013-wifi-mt76-mt7915-rework-init-txpower.patch
@@ -1,7 +1,7 @@
-From b69374d52ad77d44692de3c25e91aed3947c82f2 Mon Sep 17 00:00:00 2001
+From 738d720905afdf9abcb85cb6d6e8cd48a69cb82f Mon Sep 17 00:00:00 2001
From: Shayne Chen <shayne.chen@mediatek.com>
Date: Mon, 31 Jul 2023 11:07:35 +0800
-Subject: [PATCH] wifi: mt76: mt7915: rework init txpower
+Subject: [PATCH 13/15] wifi: mt76: mt7915: rework init txpower
Signed-off-by: Shayne Chen <shayne.chen@mediatek.com>
---
diff --git a/recipes-wifi/linux-mt76/files/patches/0011-wifi-mt76-mt7915-rework-mmio-access-flow.patch b/recipes-wifi/linux-mt76/files/patches/0014-wifi-mt76-mt7915-rework-mmio-access-flow.patch
similarity index 96%
rename from recipes-wifi/linux-mt76/files/patches/0011-wifi-mt76-mt7915-rework-mmio-access-flow.patch
rename to recipes-wifi/linux-mt76/files/patches/0014-wifi-mt76-mt7915-rework-mmio-access-flow.patch
index 0e6721d..9ee551a 100644
--- a/recipes-wifi/linux-mt76/files/patches/0011-wifi-mt76-mt7915-rework-mmio-access-flow.patch
+++ b/recipes-wifi/linux-mt76/files/patches/0014-wifi-mt76-mt7915-rework-mmio-access-flow.patch
@@ -1,7 +1,7 @@
-From fdc88d572be3bc32ec03d11126b598039d90f9d2 Mon Sep 17 00:00:00 2001
+From bee24c603808a54783adea0afbb0332eb9726f5f Mon Sep 17 00:00:00 2001
From: Shayne Chen <shayne.chen@mediatek.com>
Date: Tue, 15 Aug 2023 17:28:30 +0800
-Subject: [PATCH] wifi: mt76: mt7915: rework mmio access flow
+Subject: [PATCH 14/15] wifi: mt76: mt7915: rework mmio access flow
Signed-off-by: Shayne Chen <shayne.chen@mediatek.com>
Signed-off-by: Peter Chiu <chui-hao.chiu@mediatek.com>
@@ -118,5 +118,5 @@
u32 hw_pattern;
--
-2.18.0
+2.39.2
diff --git a/recipes-wifi/linux-mt76/files/patches/0015-wifi-mt76-disable-HW-AMSDU-when-using-fixed-rate.patch b/recipes-wifi/linux-mt76/files/patches/0015-wifi-mt76-disable-HW-AMSDU-when-using-fixed-rate.patch
new file mode 100644
index 0000000..c5e2934
--- /dev/null
+++ b/recipes-wifi/linux-mt76/files/patches/0015-wifi-mt76-disable-HW-AMSDU-when-using-fixed-rate.patch
@@ -0,0 +1,39 @@
+From 96656c8856b6e386608b67b15ef4ab10f60af666 Mon Sep 17 00:00:00 2001
+From: Peter Chiu <chui-hao.chiu@mediatek.com>
+Date: Wed, 6 Sep 2023 16:27:25 +0800
+Subject: [PATCH] wifi: mt76: disable HW AMSDU when using fixed rate
+
+When using fixed rate, HW uses txd DW9 to store tx arrivial time if VTA
+is ture. It would overwrite the msdu_id in txd and lead to token pending
+if amsdu is enable.
+
+Signed-off-by: Peter Chiu <chui-hao.chiu@mediatek.com>
+---
+ mt76_connac_mac.c | 4 +++-
+ 1 file changed, 3 insertions(+), 1 deletion(-)
+
+diff --git a/mt76_connac_mac.c b/mt76_connac_mac.c
+index ee5177fd..1ece8754 100644
+--- a/mt76_connac_mac.c
++++ b/mt76_connac_mac.c
+@@ -557,7 +557,7 @@ void mt76_connac2_mac_write_txwi(struct mt76_dev *dev, __le32 *txwi,
+ val = FIELD_PREP(MT_TXD5_PID, pid);
+ if (pid >= MT_PACKET_ID_FIRST) {
+ val |= MT_TXD5_TX_STATUS_HOST;
+- amsdu_en = amsdu_en && !is_mt7921(dev);
++ amsdu_en = 0;
+ }
+
+ txwi[5] = cpu_to_le32(val);
+@@ -592,6 +592,8 @@ void mt76_connac2_mac_write_txwi(struct mt76_dev *dev, __le32 *txwi,
+ spe_idx = 24 + phy_idx;
+ txwi[7] |= cpu_to_le32(FIELD_PREP(MT_TXD7_SPE_IDX, spe_idx));
+ }
++
++ txwi[7] &= ~cpu_to_le32(MT_TXD7_HW_AMSDU);
+ }
+ }
+ EXPORT_SYMBOL_GPL(mt76_connac2_mac_write_txwi);
+--
+2.18.0
+
diff --git a/recipes-wifi/linux-mt76/files/patches/1000-wifi-mt76-mt7915-add-mtk-internal-debug-tools-for-mt.patch b/recipes-wifi/linux-mt76/files/patches/1000-wifi-mt76-mt7915-add-mtk-internal-debug-tools-for-mt.patch
index ad6cc49..0e55e52 100644
--- a/recipes-wifi/linux-mt76/files/patches/1000-wifi-mt76-mt7915-add-mtk-internal-debug-tools-for-mt.patch
+++ b/recipes-wifi/linux-mt76/files/patches/1000-wifi-mt76-mt7915-add-mtk-internal-debug-tools-for-mt.patch
@@ -1,23 +1,22 @@
-From a1535dbab257d4916f6f7a9abb141f3bd8b9e4c1 Mon Sep 17 00:00:00 2001
+From 11e837febd8092b39d13b74c76d9134496c6e9d4 Mon Sep 17 00:00:00 2001
From: Shayne Chen <shayne.chen@mediatek.com>
Date: Wed, 22 Jun 2022 10:39:47 +0800
-Subject: [PATCH 1000/1034] wifi: mt76: mt7915: add mtk internal debug tools
- for mt76
+Subject: [PATCH] wifi: mt76: mt7915: add mtk internal debug tools for mt76
---
mt76_connac_mcu.h | 6 +
mt7915/Makefile | 2 +-
mt7915/debugfs.c | 89 +-
mt7915/mac.c | 14 +
- mt7915/main.c | 4 +
+ mt7915/main.c | 5 +
mt7915/mcu.c | 48 +-
mt7915/mcu.h | 4 +
mt7915/mt7915.h | 43 +
mt7915/mt7915_debug.h | 1418 ++++++++++++++++
- mt7915/mtk_debugfs.c | 3624 +++++++++++++++++++++++++++++++++++++++++
+ mt7915/mtk_debugfs.c | 3622 +++++++++++++++++++++++++++++++++++++++++
mt7915/mtk_mcu.c | 51 +
tools/fwlog.c | 44 +-
- 12 files changed, 5328 insertions(+), 19 deletions(-)
+ 12 files changed, 5327 insertions(+), 19 deletions(-)
create mode 100644 mt7915/mt7915_debug.h
create mode 100644 mt7915/mtk_debugfs.c
create mode 100644 mt7915/mtk_mcu.c
@@ -271,7 +270,7 @@
}
diff --git a/mt7915/main.c b/mt7915/main.c
-index 48970349..df506b01 100644
+index 4e5c138f..b6dc9513 100644
--- a/mt7915/main.c
+++ b/mt7915/main.c
@@ -73,7 +73,11 @@ int mt7915_run(struct ieee80211_hw *hw)
@@ -286,8 +285,16 @@
if (ret)
goto out;
+@@ -253,6 +257,7 @@ static int mt7915_add_interface(struct ieee80211_hw *hw,
+ mvif->sta.wcid.phy_idx = ext_phy;
+ mvif->sta.wcid.hw_key_idx = -1;
+ mvif->sta.wcid.tx_info |= MT_WCID_TX_INFO_SET;
++ mvif->sta.vif = mvif;
+ mt76_packet_id_init(&mvif->sta.wcid);
+
+ mt7915_mac_wtbl_update(dev, idx,
diff --git a/mt7915/mcu.c b/mt7915/mcu.c
-index 50b49e54..897e0dd9 100644
+index 03f84343..6b19af74 100644
--- a/mt7915/mcu.c
+++ b/mt7915/mcu.c
@@ -205,6 +205,11 @@ mt7915_mcu_send_message(struct mt76_dev *mdev, struct sk_buff *skb,
@@ -314,7 +321,7 @@
{
#define RED_DISABLE 0
#define RED_BY_WA_ENABLE 2
-@@ -3351,6 +3359,8 @@ int mt7915_mcu_set_sku_en(struct mt7915_phy *phy, bool enable)
+@@ -3352,6 +3360,8 @@ int mt7915_mcu_set_sku_en(struct mt7915_phy *phy, bool enable)
.sku_enable = enable,
};
@@ -323,7 +330,7 @@
return mt76_mcu_send_msg(&dev->mt76,
MCU_EXT_CMD(TX_POWER_FEATURE_CTRL), &req,
sizeof(req), true);
-@@ -4005,6 +4015,23 @@ out:
+@@ -4006,6 +4016,23 @@ out:
return ret;
}
@@ -347,7 +354,7 @@
int mt7915_mcu_rf_regval(struct mt7915_dev *dev, u32 regidx, u32 *val, bool set)
{
struct {
-@@ -4033,3 +4060,22 @@ int mt7915_mcu_rf_regval(struct mt7915_dev *dev, u32 regidx, u32 *val, bool set)
+@@ -4034,3 +4061,22 @@ int mt7915_mcu_rf_regval(struct mt7915_dev *dev, u32 regidx, u32 *val, bool set)
return 0;
}
@@ -386,7 +393,7 @@
};
diff --git a/mt7915/mt7915.h b/mt7915/mt7915.h
-index f0809291..00476647 100644
+index 24d8da28..f9e6917c 100644
--- a/mt7915/mt7915.h
+++ b/mt7915/mt7915.h
@@ -9,6 +9,7 @@
@@ -397,7 +404,7 @@
#define MT7915_MAX_INTERFACES 19
#define MT7915_WTBL_SIZE 288
#define MT7916_WTBL_SIZE 544
-@@ -319,6 +320,28 @@ struct mt7915_dev {
+@@ -320,6 +321,28 @@ struct mt7915_dev {
struct reset_control *rstc;
void __iomem *dcm;
void __iomem *sku;
@@ -426,7 +433,7 @@
};
enum {
-@@ -598,4 +621,24 @@ void mt7915_sta_add_debugfs(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
+@@ -599,4 +622,24 @@ void mt7915_sta_add_debugfs(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
int mt7915_mmio_wed_init(struct mt7915_dev *dev, void *pdev_ptr,
bool pci, int *irq);
@@ -1877,10 +1884,10 @@
+#endif
diff --git a/mt7915/mtk_debugfs.c b/mt7915/mtk_debugfs.c
new file mode 100644
-index 00000000..e6796bc3
+index 00000000..275acc61
--- /dev/null
+++ b/mt7915/mtk_debugfs.c
-@@ -0,0 +1,3624 @@
+@@ -0,0 +1,3622 @@
+#include<linux/inet.h>
+#include "mt7915.h"
+#include "mt7915_debug.h"
@@ -3275,11 +3282,9 @@
+ u32 wmmidx = 0;
+ struct mt7915_sta *msta;
+ struct mt76_wcid *wcid;
-+ struct ieee80211_sta *sta = NULL;
+
+ wcid = rcu_dereference(dev->mt76.wcid[sta_num]);
-+ sta = wcid_to_sta(wcid);
-+ if (!sta) {
++ if (!wcid) {
+ printk("ERROR!! no found STA wcid=%d\n", sta_num);
+ continue;
+ }
@@ -4428,7 +4433,6 @@
+
+ t = idr_find(&dev->mt76.token, dev->dbg.token_idx);
+
-+ spin_unlock_bh(&dev->mt76.token_lock);
+ if (t != NULL) {
+ struct mt76_dev *mdev = &dev->mt76;
+ txwi = ((u8*)(t)) - (mdev->drv->txwi_size);
@@ -4438,6 +4442,7 @@
+ print_hex_dump(KERN_ERR , "", DUMP_PREFIX_OFFSET, 16, 1, (u8 *)t->skb->data, t->skb->len, false);
+ seq_printf(s, "\n");
+ }
++ spin_unlock_bh(&dev->mt76.token_lock);
+ return 0;
+}
+
@@ -5677,5 +5682,5 @@
return ret;
}
--
-2.39.2
+2.18.0
diff --git a/recipes-wifi/linux-mt76/files/patches/1009-wifi-mt76-testmode-additional-supports.patch b/recipes-wifi/linux-mt76/files/patches/1009-wifi-mt76-testmode-additional-supports.patch
index cb5281c..73fd048 100644
--- a/recipes-wifi/linux-mt76/files/patches/1009-wifi-mt76-testmode-additional-supports.patch
+++ b/recipes-wifi/linux-mt76/files/patches/1009-wifi-mt76-testmode-additional-supports.patch
@@ -1,4 +1,4 @@
-From 333678e670a88fe48c859af6dbb357405f084a52 Mon Sep 17 00:00:00 2001
+From 8f1bea09505a143e4922d4230bf7ad1181c53893 Mon Sep 17 00:00:00 2001
From: Shayne Chen <shayne.chen@mediatek.com>
Date: Thu, 21 Apr 2022 15:43:19 +0800
Subject: [PATCH] wifi: mt76: testmode: additional supports
@@ -29,7 +29,7 @@
20 files changed, 2024 insertions(+), 166 deletions(-)
diff --git a/dma.c b/dma.c
-index c9d2671..fc92e39 100644
+index c9d2671d..fc92e391 100644
--- a/dma.c
+++ b/dma.c
@@ -574,8 +574,7 @@ free:
@@ -43,7 +43,7 @@
#endif
diff --git a/mac80211.c b/mac80211.c
-index eac90b3..ed1d659 100644
+index eac90b3e..ed1d659b 100644
--- a/mac80211.c
+++ b/mac80211.c
@@ -55,6 +55,13 @@ static const struct ieee80211_channel mt76_channels_5ghz[] = {
@@ -73,7 +73,7 @@
static const struct ieee80211_channel mt76_channels_6ghz[] = {
diff --git a/mt76.h b/mt76.h
-index c2ad06a..a5908de 100644
+index c2ad06a2..a5908de4 100644
--- a/mt76.h
+++ b/mt76.h
@@ -657,6 +657,21 @@ struct mt76_testmode_ops {
@@ -235,10 +235,10 @@
static inline void mt76_testmode_reset(struct mt76_phy *phy, bool disable)
{
diff --git a/mt76_connac_mcu.c b/mt76_connac_mcu.c
-index a558c68..74b63f0 100644
+index 80a5cbc0..18812aff 100644
--- a/mt76_connac_mcu.c
+++ b/mt76_connac_mcu.c
-@@ -395,6 +395,7 @@ void mt76_connac_mcu_sta_basic_tlv(struct mt76_dev *dev, struct sk_buff *skb,
+@@ -402,6 +402,7 @@ void mt76_connac_mcu_sta_basic_tlv(struct mt76_dev *dev, struct sk_buff *skb,
switch (vif->type) {
case NL80211_IFTYPE_MESH_POINT:
case NL80211_IFTYPE_AP:
@@ -246,7 +246,7 @@
if (vif->p2p && !is_mt7921(dev))
conn_type = CONNECTION_P2P_GC;
else
-@@ -576,6 +577,9 @@ void mt76_connac_mcu_wtbl_generic_tlv(struct mt76_dev *dev,
+@@ -583,6 +584,9 @@ void mt76_connac_mcu_wtbl_generic_tlv(struct mt76_dev *dev,
rx->rca2 = 1;
rx->rv = 1;
@@ -257,7 +257,7 @@
return;
diff --git a/mt76_connac_mcu.h b/mt76_connac_mcu.h
-index 92e0b91..e3980c3 100644
+index 92e0b912..e3980c37 100644
--- a/mt76_connac_mcu.h
+++ b/mt76_connac_mcu.h
@@ -998,6 +998,7 @@ enum {
@@ -277,7 +277,7 @@
MCU_EXT_CMD_CSI_CTRL = 0xc2,
};
diff --git a/mt7915/eeprom.c b/mt7915/eeprom.c
-index 76be730..f5ab331 100644
+index 76be7308..f5ab3319 100644
--- a/mt7915/eeprom.c
+++ b/mt7915/eeprom.c
@@ -131,7 +131,7 @@ static int mt7915_eeprom_load(struct mt7915_dev *dev)
@@ -290,10 +290,10 @@
return ret;
}
diff --git a/mt7915/init.c b/mt7915/init.c
-index 361c384..6d1c0f7 100644
+index 0ea2af17..c54c1f33 100644
--- a/mt7915/init.c
+++ b/mt7915/init.c
-@@ -730,7 +730,7 @@ static void mt7915_init_work(struct work_struct *work)
+@@ -728,7 +728,7 @@ static void mt7915_init_work(struct work_struct *work)
struct mt7915_dev *dev = container_of(work, struct mt7915_dev,
init_work);
@@ -303,7 +303,7 @@
mt7915_txbf_init(dev);
}
diff --git a/mt7915/mac.c b/mt7915/mac.c
-index 7ae34b7..6c9401d 100644
+index 7ae34b77..6c9401dd 100644
--- a/mt7915/mac.c
+++ b/mt7915/mac.c
@@ -604,16 +604,38 @@ mt7915_mac_write_txwi_tm(struct mt7915_phy *phy, __le32 *txwi,
@@ -385,7 +385,7 @@
goto out;
diff --git a/mt7915/main.c b/mt7915/main.c
-index 9b54ba1..d7bcd5f 100644
+index bb7075ed..60639fe0 100644
--- a/mt7915/main.c
+++ b/mt7915/main.c
@@ -238,7 +238,7 @@ static int mt7915_add_interface(struct ieee80211_hw *hw,
@@ -398,7 +398,7 @@
mvif->mt76.wmm_idx += 2;
diff --git a/mt7915/mcu.c b/mt7915/mcu.c
-index 1f5f938..6a5f204 100644
+index 8a77d7ff..18eaf687 100644
--- a/mt7915/mcu.c
+++ b/mt7915/mcu.c
@@ -389,6 +389,11 @@ mt7915_mcu_rx_ext_event(struct mt7915_dev *dev, struct sk_buff *skb)
@@ -421,7 +421,7 @@
!rxd->seq) &&
!(rxd->eid == MCU_CMD_EXT_CID &&
rxd->ext_eid == MCU_EXT_EVENT_WA_TX_STAT))
-@@ -2755,7 +2761,8 @@ int mt7915_mcu_set_chan_info(struct mt7915_phy *phy, int cmd)
+@@ -2763,7 +2769,8 @@ int mt7915_mcu_set_chan_info(struct mt7915_phy *phy, int cmd)
}
#endif
@@ -430,8 +430,8 @@
+ !mt76_testmode_enabled(phy->mt76))
req.tx_path_num = fls(phy->mt76->antenna_mask);
- if (dev->mt76.hw->conf.flags & IEEE80211_CONF_MONITOR)
-@@ -2823,21 +2830,21 @@ static int mt7915_mcu_set_eeprom_flash(struct mt7915_dev *dev)
+ if (phy->mt76->hw->conf.flags & IEEE80211_CONF_MONITOR)
+@@ -2832,21 +2839,21 @@ static int mt7915_mcu_set_eeprom_flash(struct mt7915_dev *dev)
return 0;
}
@@ -456,7 +456,7 @@
{
struct mt7915_mcu_eeprom_info req = {
.addr = cpu_to_le32(round_down(offset,
-@@ -2846,7 +2853,7 @@ int mt7915_mcu_get_eeprom(struct mt7915_dev *dev, u32 offset)
+@@ -2855,7 +2862,7 @@ int mt7915_mcu_get_eeprom(struct mt7915_dev *dev, u32 offset)
struct mt7915_mcu_eeprom_info *res;
struct sk_buff *skb;
int ret;
@@ -465,7 +465,7 @@
ret = mt76_mcu_send_and_get_msg(&dev->mt76,
MCU_EXT_QUERY(EFUSE_ACCESS),
-@@ -2855,8 +2862,11 @@ int mt7915_mcu_get_eeprom(struct mt7915_dev *dev, u32 offset)
+@@ -2864,8 +2871,11 @@ int mt7915_mcu_get_eeprom(struct mt7915_dev *dev, u32 offset)
return ret;
res = (struct mt7915_mcu_eeprom_info *)skb->data;
@@ -479,7 +479,7 @@
return 0;
diff --git a/mt7915/mcu.h b/mt7915/mcu.h
-index c15b4b7..9982735 100644
+index c15b4b74..99827354 100644
--- a/mt7915/mcu.h
+++ b/mt7915/mcu.h
@@ -8,10 +8,15 @@
@@ -537,7 +537,7 @@
enum {
diff --git a/mt7915/mmio.c b/mt7915/mmio.c
-index b23679a..6505d76 100644
+index 10c2c7d8..87a5c5c4 100644
--- a/mt7915/mmio.c
+++ b/mt7915/mmio.c
@@ -134,6 +134,7 @@ static const u32 mt7915_offs[] = {
@@ -557,7 +557,7 @@
[AGG_PCR0] = 0x040,
[AGG_ACR0] = 0x054,
diff --git a/mt7915/mt7915.h b/mt7915/mt7915.h
-index bf0f7de..c91415f 100644
+index f1c9a9bc..d0a8a99e 100644
--- a/mt7915/mt7915.h
+++ b/mt7915/mt7915.h
@@ -272,6 +272,9 @@ struct mt7915_phy {
@@ -570,7 +570,7 @@
} test;
#endif
-@@ -368,6 +371,14 @@ struct mt7915_dev {
+@@ -369,6 +372,14 @@ struct mt7915_dev {
void __iomem *dcm;
void __iomem *sku;
@@ -585,7 +585,7 @@
#ifdef MTK_DEBUG
u16 wlan_idx;
struct {
-@@ -539,8 +550,8 @@ int mt7915_mcu_set_fixed_rate_ctrl(struct mt7915_dev *dev,
+@@ -540,8 +551,8 @@ int mt7915_mcu_set_fixed_rate_ctrl(struct mt7915_dev *dev,
struct ieee80211_vif *vif,
struct ieee80211_sta *sta,
void *data, u32 field);
@@ -596,7 +596,7 @@
int mt7915_mcu_get_eeprom_free_block(struct mt7915_dev *dev, u8 *block_num);
int mt7915_mcu_set_mac(struct mt7915_dev *dev, int band, bool enable,
bool hdr_trans);
-@@ -579,6 +590,7 @@ int mt7915_mcu_fw_log_2_host(struct mt7915_dev *dev, u8 type, u8 ctrl);
+@@ -580,6 +591,7 @@ int mt7915_mcu_fw_log_2_host(struct mt7915_dev *dev, u8 type, u8 ctrl);
int mt7915_mcu_fw_dbg_ctrl(struct mt7915_dev *dev, u32 module, u8 level);
void mt7915_mcu_rx_event(struct mt7915_dev *dev, struct sk_buff *skb);
void mt7915_mcu_exit(struct mt7915_dev *dev);
@@ -605,7 +605,7 @@
static inline u16 mt7915_wtbl_size(struct mt7915_dev *dev)
{
diff --git a/mt7915/regs.h b/mt7915/regs.h
-index 038596c..428f482 100644
+index 038596c3..428f4820 100644
--- a/mt7915/regs.h
+++ b/mt7915/regs.h
@@ -62,6 +62,7 @@ enum offs_rev {
@@ -626,7 +626,7 @@
(_n) * 4))
#define MT_AGG_PCR0(_band, _n) MT_WF_AGG(_band, (__OFFS(AGG_PCR0) + \
diff --git a/mt7915/testmode.c b/mt7915/testmode.c
-index 4693919..e5d0ef9 100644
+index 46939191..e5d0ef9b 100644
--- a/mt7915/testmode.c
+++ b/mt7915/testmode.c
@@ -9,6 +9,9 @@
@@ -2050,7 +2050,7 @@
+ .set_eeprom = mt7915_tm_set_eeprom,
};
diff --git a/mt7915/testmode.h b/mt7915/testmode.h
-index a1c54c8..eb0e043 100644
+index a1c54c89..eb0e0432 100644
--- a/mt7915/testmode.h
+++ b/mt7915/testmode.h
@@ -4,6 +4,8 @@
@@ -2365,7 +2365,7 @@
+
#endif
diff --git a/testmode.c b/testmode.c
-index 1b37392..d2cef5b 100644
+index 1b37392c..d2cef5b9 100644
--- a/testmode.c
+++ b/testmode.c
@@ -28,28 +28,16 @@ const struct nla_policy mt76_tm_policy[NUM_MT76_TM_ATTRS] = {
@@ -2838,7 +2838,7 @@
if (mt76_testmode_param_present(td, MT76_TM_ATTR_TX_POWER)) {
diff --git a/testmode.h b/testmode.h
-index 8961326..8c55fa0 100644
+index 89613266..8c55fa0f 100644
--- a/testmode.h
+++ b/testmode.h
@@ -6,6 +6,8 @@
@@ -2943,7 +2943,7 @@
+
#endif
diff --git a/tools/fields.c b/tools/fields.c
-index e3f6908..7e564a3 100644
+index e3f69089..7e564a3b 100644
--- a/tools/fields.c
+++ b/tools/fields.c
@@ -10,6 +10,7 @@ static const char * const testmode_state[] = {
@@ -3084,7 +3084,7 @@
};
diff --git a/tx.c b/tx.c
-index 6cc26cc..5d7bf34 100644
+index 6cc26cc6..5d7bf340 100644
--- a/tx.c
+++ b/tx.c
@@ -259,8 +259,7 @@ void __mt76_tx_complete_skb(struct mt76_dev *dev, u16 wcid_idx, struct sk_buff *
@@ -3098,5 +3098,5 @@
wake_up(&dev->tx_wait);
--
-2.18.0
+2.39.2
diff --git a/recipes-wifi/linux-mt76/files/patches/1037-wifi-mt76-mt7915-enable-the-mac80211-hw-bmc-ps-buffe.patch b/recipes-wifi/linux-mt76/files/patches/1037-wifi-mt76-mt7915-enable-the-mac80211-hw-bmc-ps-buffe.patch
new file mode 100644
index 0000000..776c24d
--- /dev/null
+++ b/recipes-wifi/linux-mt76/files/patches/1037-wifi-mt76-mt7915-enable-the-mac80211-hw-bmc-ps-buffe.patch
@@ -0,0 +1,25 @@
+From dda8d4eb5890b402eec2ace7b4e05f4f45fa416c Mon Sep 17 00:00:00 2001
+From: Evelyn Tsai <evelyn.tsai@mediatek.com>
+Date: Thu, 24 Aug 2023 03:01:27 +0800
+Subject: [PATCH 01/11] wifi: mt76: mt7915: enable the mac80211 hw bmc ps
+ buffer function.
+
+---
+ mt7915/init.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/mt7915/init.c b/mt7915/init.c
+index 623b070..be6eb54 100644
+--- a/mt7915/init.c
++++ b/mt7915/init.c
+@@ -408,6 +408,7 @@ mt7915_init_wiphy(struct mt7915_phy *phy)
+ ieee80211_hw_set(hw, SUPPORTS_RX_DECAP_OFFLOAD);
+ ieee80211_hw_set(hw, SUPPORTS_MULTI_BSSID);
+ ieee80211_hw_set(hw, WANT_MONITOR_VIF);
++ ieee80211_hw_set(hw, HOST_BROADCAST_PS_BUFFERING);
+
+ hw->max_tx_fragments = 4;
+
+--
+2.18.0
+
diff --git a/recipes-wifi/linux-mt76/files/patches/1038-wifi-mt76-update-debugfs-knob-to-dump-token-pending-.patch b/recipes-wifi/linux-mt76/files/patches/1038-wifi-mt76-update-debugfs-knob-to-dump-token-pending-.patch
new file mode 100644
index 0000000..e05e710
--- /dev/null
+++ b/recipes-wifi/linux-mt76/files/patches/1038-wifi-mt76-update-debugfs-knob-to-dump-token-pending-.patch
@@ -0,0 +1,76 @@
+From 47058b5552a9597c2dad3e45b3d0396a5b69dfd7 Mon Sep 17 00:00:00 2001
+From: Peter Chiu <chui-hao.chiu@mediatek.com>
+Date: Tue, 29 Aug 2023 09:22:18 +0800
+Subject: [PATCH] wifi: mt76: update debugfs knob to dump token pending time
+
+Signed-off-by: Peter Chiu <chui-hao.chiu@mediatek.com>
+---
+ mt76.h | 2 ++
+ mt7915/mac.c | 6 ++++++
+ mt7915/mtk_debugfs.c | 6 ++----
+ 3 files changed, 10 insertions(+), 4 deletions(-)
+
+diff --git a/mt76.h b/mt76.h
+index aece4eca..9237b22e 100644
+--- a/mt76.h
++++ b/mt76.h
+@@ -365,6 +365,8 @@ struct mt76_txwi_cache {
+ struct list_head list;
+ dma_addr_t dma_addr;
+
++ unsigned long jiffies;
++
+ union {
+ struct sk_buff *skb;
+ void *ptr;
+diff --git a/mt7915/mac.c b/mt7915/mac.c
+index 21e8383a..67b42006 100644
+--- a/mt7915/mac.c
++++ b/mt7915/mac.c
+@@ -802,6 +802,8 @@ int mt7915_tx_prepare_skb(struct mt76_dev *mdev, void *txwi_ptr,
+ if (id < 0)
+ return id;
+
++ t->jiffies = jiffies;
++
+ pid = mt76_tx_status_skb_add(mdev, wcid, tx_info->skb);
+ mt7915_mac_write_txwi(mdev, txwi_ptr, tx_info->skb, wcid, pid, key,
+ qid, 0);
+@@ -1000,6 +1002,8 @@ mt7915_mac_tx_free(struct mt7915_dev *dev, void *data, int len)
+ if (!txwi)
+ continue;
+
++ txwi->jiffies = 0;
++
+ mt76_connac2_txwi_free(mdev, txwi, sta, &free_list);
+ }
+ }
+@@ -1032,6 +1036,8 @@ mt7915_mac_tx_free_v0(struct mt7915_dev *dev, void *data, int len)
+ if (!txwi)
+ continue;
+
++ txwi->jiffies = 0;
++
+ mt76_connac2_txwi_free(mdev, txwi, NULL, &free_list);
+ }
+
+diff --git a/mt7915/mtk_debugfs.c b/mt7915/mtk_debugfs.c
+index 80b7bc1a..46f1b0b6 100644
+--- a/mt7915/mtk_debugfs.c
++++ b/mt7915/mtk_debugfs.c
+@@ -2211,10 +2211,8 @@ static int mt7915_token_read(struct seq_file *s, void *data)
+ seq_printf(s, "Cut through token:\n");
+ spin_lock_bh(&dev->mt76.token_lock);
+ idr_for_each_entry(&dev->mt76.token, txwi, id) {
+- seq_printf(s, "%4d ", id);
+- count++;
+- if (count % 8 == 0)
+- seq_printf(s, "\n");
++ seq_printf(s, "%4d (token pending %u ms)\n", id,
++ jiffies_to_msecs(jiffies - txwi->jiffies));
+ }
+ spin_unlock_bh(&dev->mt76.token_lock);
+ seq_printf(s, "\n");
+--
+2.18.0
+
diff --git a/recipes-wifi/linux-mt76/files/patches/1039-wifi-mt76-mt7915-support-enable-disable-spatial-reus.patch b/recipes-wifi/linux-mt76/files/patches/1039-wifi-mt76-mt7915-support-enable-disable-spatial-reus.patch
new file mode 100644
index 0000000..646fb60
--- /dev/null
+++ b/recipes-wifi/linux-mt76/files/patches/1039-wifi-mt76-mt7915-support-enable-disable-spatial-reus.patch
@@ -0,0 +1,72 @@
+From f8b4b17a84bf10198c67434b246de4a05e3e54dd Mon Sep 17 00:00:00 2001
+From: Howard Hsu <howard-yh.hsu@mediatek.com>
+Date: Tue, 5 Sep 2023 20:17:19 +0800
+Subject: [PATCH] wifi: mt76: mt7915: support enable/disable spatial reuse
+ through debugfs
+
+Signed-off-by: Howard Hsu <howard-yh.hsu@mediatek.com>
+---
+ mt7915/mcu.c | 3 +--
+ mt7915/mt7915.h | 1 +
+ mt7915/mtk_debugfs.c | 12 ++++++++++++
+ 3 files changed, 14 insertions(+), 2 deletions(-)
+
+diff --git a/mt7915/mcu.c b/mt7915/mcu.c
+index f6ba2d5..e8e563e 100644
+--- a/mt7915/mcu.c
++++ b/mt7915/mcu.c
+@@ -3607,8 +3607,7 @@ int mt7915_mcu_set_txbf(struct mt7915_dev *dev, u8 action)
+ sizeof(req), true);
+ }
+
+-static int
+-mt7915_mcu_enable_obss_spr(struct mt7915_phy *phy, u8 action, u8 val)
++int mt7915_mcu_enable_obss_spr(struct mt7915_phy *phy, u8 action, u8 val)
+ {
+ struct mt7915_dev *dev = phy->dev;
+ struct mt7915_mcu_sr_ctrl req = {
+diff --git a/mt7915/mt7915.h b/mt7915/mt7915.h
+index 1c2f113..12049d1 100644
+--- a/mt7915/mt7915.h
++++ b/mt7915/mt7915.h
+@@ -733,6 +733,7 @@ int mt7915_mcu_get_edcca(struct mt7915_phy *phy, u8 mode, s8 *value);
+ int mt7915_mcu_sw_aci_set(struct mt7915_dev *dev, bool val);
+ int mt7915_mcu_ipi_hist_ctrl(struct mt7915_phy *phy, void *data, u8 cmd, bool wait_resp);
+ int mt7915_mcu_ipi_hist_scan(struct mt7915_phy *phy, void *data, u8 mode, bool wait_resp);
++int mt7915_mcu_enable_obss_spr(struct mt7915_phy *phy, u8 action, u8 val);
+
+ #ifdef MTK_DEBUG
+ int mt7915_mtk_init_debugfs(struct mt7915_phy *phy, struct dentry *dir);
+diff --git a/mt7915/mtk_debugfs.c b/mt7915/mtk_debugfs.c
+index 46f1b0b..c58a2d1 100644
+--- a/mt7915/mtk_debugfs.c
++++ b/mt7915/mtk_debugfs.c
+@@ -3655,6 +3655,17 @@ mt7915_sw_aci_set(void *data, u64 val)
+ DEFINE_DEBUGFS_ATTRIBUTE(fops_sw_aci, NULL,
+ mt7915_sw_aci_set, "%llx\n");
+
++static int
++mt7915_sr_enable_set(void *data, u64 val)
++{
++ struct mt7915_phy *phy = data;
++
++ return mt7915_mcu_enable_obss_spr(phy, SPR_ENABLE, val);
++}
++
++DEFINE_DEBUGFS_ATTRIBUTE(fops_sr_enable, NULL,
++ mt7915_sr_enable_set, "%llx\n");
++
+ int mt7915_mtk_init_debugfs(struct mt7915_phy *phy, struct dentry *dir)
+ {
+ struct mt7915_dev *dev = phy->dev;
+@@ -3745,6 +3756,7 @@ int mt7915_mtk_init_debugfs(struct mt7915_phy *phy, struct dentry *dir)
+ mt7915_show_eeprom_mode);
+ debugfs_create_file("sw_aci", 0600, dir, dev,
+ &fops_sw_aci);
++ debugfs_create_file("sr_enable", 0200, dir, phy, &fops_sr_enable);
+ return 0;
+ }
+ #endif
+--
+2.18.0
+
diff --git a/recipes-wifi/linux-mt76/files/patches/2000-wifi-mt76-mt7915-wed-add-wed-tx-support.patch b/recipes-wifi/linux-mt76/files/patches/2000-wifi-mt76-mt7915-wed-add-wed-tx-support.patch
index c04d3e9..fa412b8 100644
--- a/recipes-wifi/linux-mt76/files/patches/2000-wifi-mt76-mt7915-wed-add-wed-tx-support.patch
+++ b/recipes-wifi/linux-mt76/files/patches/2000-wifi-mt76-mt7915-wed-add-wed-tx-support.patch
@@ -1,7 +1,7 @@
-From 8e9d023668453588f5655787950802129a9abc2d Mon Sep 17 00:00:00 2001
+From 5874aad8bb03d3e8d568dca2f0df74b2591eaf55 Mon Sep 17 00:00:00 2001
From: Sujuan Chen <sujuan.chen@mediatek.com>
Date: Fri, 25 Nov 2022 10:38:53 +0800
-Subject: [PATCH 2000/2010] wifi: mt76: mt7915: wed: add wed tx support
+Subject: [PATCH] wifi: mt76: mt7915: wed: add wed tx support
Signed-off-by: Sujuan Chen <sujuan.chen@mediatek.com>
---
@@ -25,10 +25,10 @@
struct mt76_connac_fw_txp {
__le16 flags;
diff --git a/mt7915/mac.c b/mt7915/mac.c
-index 21e8383a..debc2f9d 100644
+index 67b42006..94cfab61 100644
--- a/mt7915/mac.c
+++ b/mt7915/mac.c
-@@ -867,9 +867,9 @@ u32 mt7915_wed_init_buf(void *ptr, dma_addr_t phys, int token_id)
+@@ -869,9 +869,9 @@ u32 mt7915_wed_init_buf(void *ptr, dma_addr_t phys, int token_id)
txp->token = cpu_to_le16(token_id);
txp->nbuf = 1;
@@ -40,7 +40,7 @@
}
static void
-@@ -918,6 +918,7 @@ mt7915_mac_tx_free(struct mt7915_dev *dev, void *data, int len)
+@@ -920,6 +920,7 @@ mt7915_mac_tx_free(struct mt7915_dev *dev, void *data, int len)
LIST_HEAD(free_list);
void *end = data + len;
bool v3, wake = false;
@@ -48,14 +48,16 @@
u16 total, count = 0;
u32 txd = le32_to_cpu(free->txd);
__le32 *cur_info;
-@@ -999,12 +1000,15 @@ mt7915_mac_tx_free(struct mt7915_dev *dev, void *data, int len)
+@@ -1001,6 +1002,8 @@ mt7915_mac_tx_free(struct mt7915_dev *dev, void *data, int len)
txwi = mt76_token_release(mdev, msdu, &wake);
if (!txwi)
continue;
+ else
+ with_txwi = false;
- mt76_connac2_txwi_free(mdev, txwi, sta, &free_list);
+ txwi->jiffies = 0;
+
+@@ -1008,7 +1011,8 @@ mt7915_mac_tx_free(struct mt7915_dev *dev, void *data, int len)
}
}
@@ -66,10 +68,10 @@
static void
diff --git a/mt7915/main.c b/mt7915/main.c
-index 9011d69b..89e994f9 100644
+index 6b3b9e06..0032f463 100644
--- a/mt7915/main.c
+++ b/mt7915/main.c
-@@ -1672,14 +1672,14 @@ mt7915_net_fill_forward_path(struct ieee80211_hw *hw,
+@@ -1673,14 +1673,14 @@ mt7915_net_fill_forward_path(struct ieee80211_hw *hw,
if (!mtk_wed_device_active(wed))
return -ENODEV;
@@ -87,7 +89,7 @@
ctx->dev = NULL;
diff --git a/mt7915/mmio.c b/mt7915/mmio.c
-index 57dfda3a..cb0893e2 100644
+index b47bfffc..cae8b810 100644
--- a/mt7915/mmio.c
+++ b/mt7915/mmio.c
@@ -13,7 +13,7 @@
@@ -99,7 +101,7 @@
module_param(wed_enable, bool, 0644);
MODULE_PARM_DESC(wed_enable, "Enable Wireless Ethernet Dispatch support");
-@@ -569,7 +569,7 @@ static void mt7915_mmio_wed_offload_disable(struct mtk_wed_device *wed)
+@@ -607,7 +607,7 @@ static void mt7915_mmio_wed_offload_disable(struct mtk_wed_device *wed)
dev = container_of(wed, struct mt7915_dev, mt76.mmio.wed);
spin_lock_bh(&dev->mt76.token_lock);
@@ -108,7 +110,7 @@
spin_unlock_bh(&dev->mt76.token_lock);
}
-@@ -817,6 +817,7 @@ int mt7915_mmio_wed_init(struct mt7915_dev *dev, void *pdev_ptr,
+@@ -855,6 +855,7 @@ int mt7915_mmio_wed_init(struct mt7915_dev *dev, void *pdev_ptr,
*irq = wed->irq;
dev->mt76.dma_dev = wed->dev;
@@ -117,7 +119,7 @@
ret = dma_set_mask(wed->dev, DMA_BIT_MASK(32));
if (ret)
diff --git a/mt7915/mt7915.h b/mt7915/mt7915.h
-index d8a321b6..798112e5 100644
+index 1c2f1132..dded050a 100644
--- a/mt7915/mt7915.h
+++ b/mt7915/mt7915.h
@@ -62,7 +62,7 @@
@@ -130,5 +132,5 @@
#define MT7915_CFEND_RATE_DEFAULT 0x49 /* OFDM 24M */
--
-2.39.2
+2.18.0
diff --git a/recipes-wifi/linux-mt76/files/patches/2004-wifi-mt76-mt7915-wed-HW-ATF-support-for-mt7986.patch b/recipes-wifi/linux-mt76/files/patches/2004-wifi-mt76-mt7915-wed-HW-ATF-support-for-mt7986.patch
index 64c5c5a..0df2d7b 100644
--- a/recipes-wifi/linux-mt76/files/patches/2004-wifi-mt76-mt7915-wed-HW-ATF-support-for-mt7986.patch
+++ b/recipes-wifi/linux-mt76/files/patches/2004-wifi-mt76-mt7915-wed-HW-ATF-support-for-mt7986.patch
@@ -1,7 +1,7 @@
-From dd53486dc890333be3569389b1f7b82b031864fe Mon Sep 17 00:00:00 2001
+From e2b7b9b7d48b69eed36443ce889efba749da9347 Mon Sep 17 00:00:00 2001
From: Lian Chen <lian.chen@mediatek.com>
Date: Mon, 7 Nov 2022 14:47:44 +0800
-Subject: [PATCH 2004/2010] wifi: mt76: mt7915: wed: HW ATF support for mt7986
+Subject: [PATCH] wifi: mt76: mt7915: wed: HW ATF support for mt7986
Signed-off-by: Lian Chen <lian.chen@mediatek.com>
---
@@ -11,8 +11,8 @@
mt7915/main.c | 15 ++
mt7915/mcu.c | 165 ++++++++++++++++++
mt7915/mt7915.h | 68 ++++++++
- mt7915/mtk_debugfs.c | 133 +++++++++++++-
- 7 files changed, 826 insertions(+), 1 deletion(-)
+ mt7915/mtk_debugfs.c | 131 +++++++++++++-
+ 7 files changed, 824 insertions(+), 1 deletion(-)
diff --git a/mt76_connac_mcu.h b/mt76_connac_mcu.h
index 8228bbb1..1257dfa1 100644
@@ -35,7 +35,7 @@
MCU_EXT_CMD_EFUSE_FREE_BLOCK = 0x4f,
MCU_EXT_CMD_TX_POWER_FEATURE_CTRL = 0x58,
diff --git a/mt7915/debugfs.c b/mt7915/debugfs.c
-index 2bf907c0..4b3af79c 100644
+index bb312eeb..fefa4540 100644
--- a/mt7915/debugfs.c
+++ b/mt7915/debugfs.c
@@ -12,6 +12,10 @@
@@ -456,7 +456,7 @@
static int
mt7915_radar_trigger(void *data, u64 val)
{
-@@ -1437,6 +1841,7 @@ int mt7915_init_debugfs(struct mt7915_phy *phy)
+@@ -1476,6 +1880,7 @@ int mt7915_init_debugfs(struct mt7915_phy *phy)
debugfs_create_devm_seqfile(dev->mt76.dev, "twt_stats", dir,
mt7915_twt_stats);
debugfs_create_file("rf_regval", 0600, dir, dev, &fops_rf_regval);
@@ -465,10 +465,10 @@
if (!dev->dbdc_support || phy->mt76->band_idx) {
debugfs_create_u32("dfs_hw_pattern", 0400, dir,
diff --git a/mt7915/init.c b/mt7915/init.c
-index ac61febb..58e044ea 100644
+index 623b0703..bfcdf3eb 100644
--- a/mt7915/init.c
+++ b/mt7915/init.c
-@@ -597,10 +597,46 @@ mt7915_init_led_mux(struct mt7915_dev *dev)
+@@ -602,10 +602,46 @@ mt7915_init_led_mux(struct mt7915_dev *dev)
}
}
@@ -515,7 +515,7 @@
/* config pse qid6 wfdma port selection */
if (!is_mt7915(&dev->mt76) && dev->hif2)
-@@ -624,6 +660,9 @@ void mt7915_mac_init(struct mt7915_dev *dev)
+@@ -629,6 +665,9 @@ void mt7915_mac_init(struct mt7915_dev *dev)
mt7915_mac_init_band(dev, i);
mt7915_init_led_mux(dev);
@@ -526,7 +526,7 @@
int mt7915_txbf_init(struct mt7915_dev *dev)
diff --git a/mt7915/main.c b/mt7915/main.c
-index 00c66000..03697bac 100644
+index 7a853825..deef1bb6 100644
--- a/mt7915/main.c
+++ b/mt7915/main.c
@@ -217,6 +217,7 @@ int mt7915_init_vif(struct mt7915_phy *phy, struct ieee80211_vif *vif, bool bf_e
@@ -537,7 +537,7 @@
struct mt76_txq *mtxq;
bool ext_phy = phy != &dev->phy;
int idx, ret = 0;
-@@ -278,6 +279,9 @@ int mt7915_init_vif(struct mt7915_phy *phy, struct ieee80211_vif *vif, bool bf_e
+@@ -279,6 +280,9 @@ int mt7915_init_vif(struct mt7915_phy *phy, struct ieee80211_vif *vif, bool bf_e
mt7915_mcu_add_sta(dev, vif, NULL, true);
rcu_assign_pointer(dev->mt76.wcid[idx], &mvif->sta.wcid);
@@ -547,7 +547,7 @@
return ret;
}
-@@ -756,6 +760,7 @@ int mt7915_mac_sta_add(struct mt76_dev *mdev, struct ieee80211_vif *vif,
+@@ -757,6 +761,7 @@ int mt7915_mac_sta_add(struct mt76_dev *mdev, struct ieee80211_vif *vif,
struct mt7915_sta *msta = (struct mt7915_sta *)sta->drv_priv;
struct mt7915_vif *mvif = (struct mt7915_vif *)vif->drv_priv;
bool ext_phy = mvif->phy != &dev->phy;
@@ -555,7 +555,7 @@
#ifdef CONFIG_MTK_VENDOR
struct mt7915_phy *phy = ext_phy ? mt7915_ext_phy(dev) : &dev->phy;
#endif
-@@ -806,6 +811,16 @@ int mt7915_mac_sta_add(struct mt76_dev *mdev, struct ieee80211_vif *vif,
+@@ -807,6 +812,16 @@ int mt7915_mac_sta_add(struct mt76_dev *mdev, struct ieee80211_vif *vif,
if (phy->muru_onoff & MUMIMO_DL_CERT)
mt7915_mcu_set_mimo(phy, 0);
#endif
@@ -573,10 +573,10 @@
}
diff --git a/mt7915/mcu.c b/mt7915/mcu.c
-index 4eaeed68..9e282b88 100644
+index 490058df..06b8acdf 100644
--- a/mt7915/mcu.c
+++ b/mt7915/mcu.c
-@@ -3559,6 +3559,171 @@ int mt7915_mcu_set_ser(struct mt7915_dev *dev, u8 action, u8 set, u8 band)
+@@ -3560,6 +3560,171 @@ int mt7915_mcu_set_ser(struct mt7915_dev *dev, u8 action, u8 set, u8 band)
&req, sizeof(req), false);
}
@@ -749,7 +749,7 @@
{
#define MT_BF_PROCESSING 4
diff --git a/mt7915/mt7915.h b/mt7915/mt7915.h
-index 798112e5..6123a2db 100644
+index dded050a..c60521b1 100644
--- a/mt7915/mt7915.h
+++ b/mt7915/mt7915.h
@@ -141,6 +141,58 @@ struct mt7915_twt_flow {
@@ -819,7 +819,7 @@
};
struct mt7915_vif_cap {
-@@ -416,6 +469,8 @@ struct mt7915_dev {
+@@ -417,6 +470,8 @@ struct mt7915_dev {
} dbg;
const struct mt7915_dbg_reg_desc *dbg_reg;
#endif
@@ -828,7 +828,7 @@
};
enum {
-@@ -448,6 +503,15 @@ enum mt7915_rdd_cmd {
+@@ -449,6 +504,15 @@ enum mt7915_rdd_cmd {
RDD_IRQ_OFF,
};
@@ -844,7 +844,7 @@
static inline struct mt7915_phy *
mt7915_hw_phy(struct ieee80211_hw *hw)
{
-@@ -577,6 +641,10 @@ int mt7915_mcu_set_mac(struct mt7915_dev *dev, int band, bool enable,
+@@ -578,6 +642,10 @@ int mt7915_mcu_set_mac(struct mt7915_dev *dev, int band, bool enable,
int mt7915_mcu_set_test_param(struct mt7915_dev *dev, u8 param, bool test_mode,
u8 en);
int mt7915_mcu_set_ser(struct mt7915_dev *dev, u8 action, u8 set, u8 band);
@@ -856,7 +856,7 @@
int mt7915_mcu_set_txpower_sku(struct mt7915_phy *phy);
int mt7915_mcu_get_txpower_sku(struct mt7915_phy *phy, s8 *txpower, int len,
diff --git a/mt7915/mtk_debugfs.c b/mt7915/mtk_debugfs.c
-index 55c54436..75ce5f99 100644
+index 80b7bc1a..b12aff80 100644
--- a/mt7915/mtk_debugfs.c
+++ b/mt7915/mtk_debugfs.c
@@ -1368,7 +1368,6 @@ static EMPTY_QUEUE_INFO_T ple_txcmd_queue_empty_info[] = {
@@ -867,7 +867,7 @@
static char* sta_ctrl_reg[] = {"ENABLE", "DISABLE", "PAUSE"};
static u32 chip_show_sta_acq_info(struct seq_file *s, struct mt7915_dev *dev, u32 *ple_stat,
u32 *sta_pause, u32 *dis_sta_map,
-@@ -1522,6 +1521,138 @@ static void chip_get_sta_pause(struct mt7915_dev *dev, u32 *sta_pause)
+@@ -1520,6 +1519,136 @@ static void chip_get_sta_pause(struct mt7915_dev *dev, u32 *sta_pause)
}
}
@@ -892,11 +892,9 @@
+ u32 wmmidx = 0;
+ struct mt7915_sta *msta;
+ struct mt76_wcid *wcid;
-+ struct ieee80211_sta *sta = NULL;
+
+ wcid = rcu_dereference(dev->mt76.wcid[sta_num]);
-+ sta = wcid_to_sta(wcid);
-+ if (!sta) {
++ if (!wcid) {
+ printk("ERROR!! no found STA wcid=%d\n", sta_num);
+ continue;
+ }
@@ -1007,5 +1005,5 @@
{
struct mt7915_dev *dev = dev_get_drvdata(s->private);
--
-2.39.2
+2.18.0
diff --git a/recipes-wifi/linux-mt76/files/patches/2005-wifi-mt76-mt7915-wed-add-rxwi-for-further-in-chip-rr.patch b/recipes-wifi/linux-mt76/files/patches/2005-wifi-mt76-mt7915-wed-add-rxwi-for-further-in-chip-rr.patch
index 8384af6..5a29596 100644
--- a/recipes-wifi/linux-mt76/files/patches/2005-wifi-mt76-mt7915-wed-add-rxwi-for-further-in-chip-rr.patch
+++ b/recipes-wifi/linux-mt76/files/patches/2005-wifi-mt76-mt7915-wed-add-rxwi-for-further-in-chip-rr.patch
@@ -1,8 +1,7 @@
-From c3a50c7e22166936473ecc6116a33660d0df6f52 Mon Sep 17 00:00:00 2001
+From cc7a9202984360cdc476d3aa860bebd9fc248a16 Mon Sep 17 00:00:00 2001
From: Sujuan Chen <sujuan.chen@mediatek.com>
Date: Fri, 6 Jan 2023 18:18:50 +0800
-Subject: [PATCH 2005/2010] wifi: mt76: mt7915: wed: add rxwi for further in
- chip rro
+Subject: [PATCH] wifi: mt76: mt7915: wed: add rxwi for further in chip rro
Signed-off-by: Sujuan Chen <sujuan.chen@mediatek.com>
---
@@ -264,7 +263,7 @@
for (i = 0; i < ARRAY_SIZE(dev->q_rx); i++)
skb_queue_head_init(&dev->rx_skb[i]);
diff --git a/mt76.h b/mt76.h
-index e315fc1e..6c488bd1 100644
+index 70146064..828d3e8b 100644
--- a/mt76.h
+++ b/mt76.h
@@ -173,6 +173,7 @@ struct mt76_queue_entry {
@@ -275,9 +274,9 @@
struct urb *urb;
int buf_sz;
};
-@@ -371,10 +372,15 @@ struct mt76_txwi_cache {
- struct list_head list;
- dma_addr_t dma_addr;
+@@ -373,10 +374,15 @@ struct mt76_txwi_cache {
+
+ unsigned long jiffies;
- union {
- struct sk_buff *skb;
@@ -295,7 +294,7 @@
};
struct mt76_rx_tid {
-@@ -460,6 +466,7 @@ struct mt76_driver_ops {
+@@ -462,6 +468,7 @@ struct mt76_driver_ops {
u16 txwi_size;
u16 token_size;
u8 mcs_rates;
@@ -303,7 +302,7 @@
void (*update_survey)(struct mt76_phy *phy);
-@@ -833,7 +840,6 @@ struct mt76_dev {
+@@ -835,7 +842,6 @@ struct mt76_dev {
struct ieee80211_hw *hw;
@@ -311,7 +310,7 @@
spinlock_t lock;
spinlock_t cc_lock;
-@@ -1523,8 +1529,8 @@ mt76_tx_status_get_hw(struct mt76_dev *dev, struct sk_buff *skb)
+@@ -1525,8 +1531,8 @@ mt76_tx_status_get_hw(struct mt76_dev *dev, struct sk_buff *skb)
}
void mt76_put_txwi(struct mt76_dev *dev, struct mt76_txwi_cache *t);
@@ -322,7 +321,7 @@
void mt76_free_pending_rxwi(struct mt76_dev *dev);
void mt76_rx_complete(struct mt76_dev *dev, struct sk_buff_head *frames,
struct napi_struct *napi);
-@@ -1676,9 +1682,9 @@ struct mt76_txwi_cache *
+@@ -1681,9 +1687,9 @@ struct mt76_txwi_cache *
mt76_token_release(struct mt76_dev *dev, int token, bool *wake);
int mt76_token_consume(struct mt76_dev *dev, struct mt76_txwi_cache **ptxwi);
void __mt76_set_tx_blocked(struct mt76_dev *dev, bool blocked);
@@ -355,10 +354,10 @@
/* rx data queue for band1 */
diff --git a/mt7915/mmio.c b/mt7915/mmio.c
-index cb0893e2..a59e3118 100644
+index cae8b810..d7393901 100644
--- a/mt7915/mmio.c
+++ b/mt7915/mmio.c
-@@ -584,18 +584,18 @@ static void mt7915_mmio_wed_release_rx_buf(struct mtk_wed_device *wed)
+@@ -622,18 +622,18 @@ static void mt7915_mmio_wed_release_rx_buf(struct mtk_wed_device *wed)
sizeof(struct skb_shared_info));
for (i = 0; i < dev->mt76.rx_token_size; i++) {
@@ -384,7 +383,7 @@
}
mt76_free_pending_rxwi(&dev->mt76);
-@@ -613,18 +613,18 @@ static u32 mt7915_mmio_wed_init_rx_buf(struct mtk_wed_device *wed, int size)
+@@ -651,18 +651,18 @@ static u32 mt7915_mmio_wed_init_rx_buf(struct mtk_wed_device *wed, int size)
sizeof(struct skb_shared_info));
for (i = 0; i < size; i++) {
@@ -406,7 +405,7 @@
goto unmap;
}
-@@ -634,17 +634,17 @@ static u32 mt7915_mmio_wed_init_rx_buf(struct mtk_wed_device *wed, int size)
+@@ -672,17 +672,17 @@ static u32 mt7915_mmio_wed_init_rx_buf(struct mtk_wed_device *wed, int size)
DMA_TO_DEVICE);
if (unlikely(dma_mapping_error(dev->mt76.dev, phy_addr))) {
__free_pages(page, get_order(length));
@@ -427,7 +426,7 @@
goto unmap;
}
-@@ -810,7 +810,7 @@ int mt7915_mmio_wed_init(struct mt7915_dev *dev, void *pdev_ptr,
+@@ -848,7 +848,7 @@ int mt7915_mmio_wed_init(struct mt7915_dev *dev, void *pdev_ptr,
wed->wlan.reset = mt7915_mmio_wed_reset;
wed->wlan.reset_complete = mt7915_mmio_wed_reset_complete;
@@ -436,7 +435,7 @@
if (mtk_wed_device_attach(wed))
return 0;
-@@ -1017,6 +1017,7 @@ struct mt7915_dev *mt7915_mmio_probe(struct device *pdev,
+@@ -1056,6 +1056,7 @@ struct mt7915_dev *mt7915_mmio_probe(struct device *pdev,
SURVEY_INFO_TIME_RX |
SURVEY_INFO_TIME_BSS_RX,
.token_size = MT7915_TOKEN_SIZE,
@@ -445,7 +444,7 @@
.tx_complete_skb = mt76_connac_tx_complete_skb,
.rx_skb = mt7915_queue_rx_skb,
diff --git a/mt7915/mt7915.h b/mt7915/mt7915.h
-index 6123a2db..3734c8e9 100644
+index c60521b1..4d3ff13b 100644
--- a/mt7915/mt7915.h
+++ b/mt7915/mt7915.h
@@ -64,6 +64,7 @@
@@ -502,5 +501,5 @@
}
EXPORT_SYMBOL_GPL(mt76_rx_token_release);
--
-2.39.2
+2.18.0
diff --git a/recipes-wifi/linux-mt76/files/patches/2006-wifi-mt76-add-debugfs-knob-to-show-packet-error-rate.patch b/recipes-wifi/linux-mt76/files/patches/2006-wifi-mt76-add-debugfs-knob-to-show-packet-error-rate.patch
index 86190c9..36e68cc 100644
--- a/recipes-wifi/linux-mt76/files/patches/2006-wifi-mt76-add-debugfs-knob-to-show-packet-error-rate.patch
+++ b/recipes-wifi/linux-mt76/files/patches/2006-wifi-mt76-add-debugfs-knob-to-show-packet-error-rate.patch
@@ -1,8 +1,7 @@
-From cffa7c8bb58e234747364d4bb702d52bf6e77e24 Mon Sep 17 00:00:00 2001
+From 99ebe10c9bc4259528c225fd6ab64edaa02d9d15 Mon Sep 17 00:00:00 2001
From: Peter Chiu <chui-hao.chiu@mediatek.com>
Date: Wed, 11 Jan 2023 10:56:27 +0800
-Subject: [PATCH 2006/2010] wifi: mt76: add debugfs knob to show packet error
- rate
+Subject: [PATCH] wifi: mt76: add debugfs knob to show packet error rate
Get tx count and tx failed from mcu command
---
@@ -15,7 +14,7 @@
6 files changed, 194 insertions(+), 1 deletion(-)
diff --git a/mt76.h b/mt76.h
-index 6c488bd1..cbd63695 100644
+index 828d3e8..3fbe02a 100644
--- a/mt76.h
+++ b/mt76.h
@@ -297,8 +297,10 @@ struct mt76_sta_stats {
@@ -30,7 +29,7 @@
u64 rx_bytes;
u32 rx_packets;
diff --git a/mt76_connac_mcu.h b/mt76_connac_mcu.h
-index 1257dfa1..cfdee7c1 100644
+index 1257dfa..cfdee7c 100644
--- a/mt76_connac_mcu.h
+++ b/mt76_connac_mcu.h
@@ -1162,6 +1162,7 @@ enum {
@@ -42,10 +41,10 @@
MCU_EXT_CMD_SET_DRR_CTRL = 0x36,
MCU_EXT_CMD_SET_FEATURE_CTRL = 0x38,
diff --git a/mt7915/mcu.c b/mt7915/mcu.c
-index 9e282b88..a4225675 100644
+index 170b3f1..148a687 100644
--- a/mt7915/mcu.c
+++ b/mt7915/mcu.c
-@@ -4226,6 +4226,114 @@ int mt7915_mcu_get_tx_rate(struct mt7915_phy *phy, u16 wcidx)
+@@ -4232,6 +4232,114 @@ int mt7915_mcu_get_tx_rate(struct mt7915_phy *phy, u16 wcidx)
return mt7915_mcu_get_tx_rate_v2(phy, wcidx);
}
@@ -161,7 +160,7 @@
struct cfg80211_he_bss_color *he_bss_color)
{
diff --git a/mt7915/mcu.h b/mt7915/mcu.h
-index 825bb7df..12c98c5e 100644
+index 825bb7d..12c98c5 100644
--- a/mt7915/mcu.h
+++ b/mt7915/mcu.h
@@ -791,7 +791,8 @@ mt7915_get_power_bound(struct mt7915_phy *phy, s8 txpower)
@@ -200,10 +199,10 @@
CAPI_SU,
CAPI_MU,
diff --git a/mt7915/mt7915.h b/mt7915/mt7915.h
-index 3734c8e9..70e92734 100644
+index e36fb84..e8f7ca5 100644
--- a/mt7915/mt7915.h
+++ b/mt7915/mt7915.h
-@@ -674,6 +674,7 @@ int mt7915_mcu_get_rx_rate(struct mt7915_phy *phy, struct ieee80211_vif *vif,
+@@ -675,6 +675,7 @@ int mt7915_mcu_get_rx_rate(struct mt7915_phy *phy, struct ieee80211_vif *vif,
int mt7915_mcu_rdd_background_enable(struct mt7915_phy *phy,
struct cfg80211_chan_def *chandef);
int mt7915_mcu_wed_wa_tx_stats(struct mt7915_dev *dev, u16 wcid);
@@ -212,12 +211,12 @@
int mt7915_mcu_wa_cmd(struct mt7915_dev *dev, int cmd, u32 a1, u32 a2, u32 a3);
int mt7915_mcu_fw_log_2_host(struct mt7915_dev *dev, u8 type, u8 ctrl);
diff --git a/mt7915/mtk_debugfs.c b/mt7915/mtk_debugfs.c
-index 75ce5f99..401b4dd6 100644
+index 928bb50..4defc17 100644
--- a/mt7915/mtk_debugfs.c
+++ b/mt7915/mtk_debugfs.c
-@@ -3790,6 +3790,66 @@ mt7915_sw_aci_set(void *data, u64 val)
- DEFINE_DEBUGFS_ATTRIBUTE(fops_sw_aci, NULL,
- mt7915_sw_aci_set, "%llx\n");
+@@ -3795,6 +3795,66 @@ mt7915_sr_enable_set(void *data, u64 val)
+ DEFINE_DEBUGFS_ATTRIBUTE(fops_sr_enable, NULL,
+ mt7915_sr_enable_set, "%llx\n");
+static int mt7915_reset_counter(void *data, u64 val)
+{
@@ -282,15 +281,15 @@
int mt7915_mtk_init_debugfs(struct mt7915_phy *phy, struct dentry *dir)
{
struct mt7915_dev *dev = phy->dev;
-@@ -3880,6 +3940,8 @@ int mt7915_mtk_init_debugfs(struct mt7915_phy *phy, struct dentry *dir)
- mt7915_show_eeprom_mode);
+@@ -3886,6 +3946,8 @@ int mt7915_mtk_init_debugfs(struct mt7915_phy *phy, struct dentry *dir)
debugfs_create_file("sw_aci", 0600, dir, dev,
&fops_sw_aci);
+ debugfs_create_file("sr_enable", 0200, dir, phy, &fops_sr_enable);
+ debugfs_create_file("reset_counter", 0200, dir, dev, &fops_reset_counter);
+ debugfs_create_devm_seqfile(dev->mt76.dev, "per", dir, mt7915_per_read);
return 0;
}
#endif
--
-2.39.2
+2.18.0
diff --git a/recipes-wifi/linux-mt76/files/patches/2009-wifi-mt76-mt7915-wed-add-per-bss-statistic-info.patch b/recipes-wifi/linux-mt76/files/patches/2009-wifi-mt76-mt7915-wed-add-per-bss-statistic-info.patch
deleted file mode 100644
index 4aa4280..0000000
--- a/recipes-wifi/linux-mt76/files/patches/2009-wifi-mt76-mt7915-wed-add-per-bss-statistic-info.patch
+++ /dev/null
@@ -1,211 +0,0 @@
-From a3bc2ff25993c37117aad833b5f4cb39cbedd5bf Mon Sep 17 00:00:00 2001
-From: "sujuan.chen" <sujuan.chen@mediatek.com>
-Date: Wed, 28 Jun 2023 17:11:18 +0800
-Subject: [PATCH 2009/2010] wifi: mt76: mt7915: wed: add per bss statistic info
-
-Signed-off-by: sujuan.chen <sujuan.chen@mediatek.com>
----
- mt7915/init.c | 1 +
- mt7915/mac.c | 19 +++++++++++++++++++
- mt7915/main.c | 2 +-
- mt7915/mcu.c | 29 ++++++++++++++++++++++++++---
- mt7915/mmio.c | 26 ++++++++++++++++++++++++++
- mt7915/mt7915.h | 3 ++-
- mt7915/mtk_debugfs.c | 2 +-
- 7 files changed, 76 insertions(+), 6 deletions(-)
-
-diff --git a/mt7915/init.c b/mt7915/init.c
-index 58e044ea..a2aca371 100644
---- a/mt7915/init.c
-+++ b/mt7915/init.c
-@@ -386,6 +386,7 @@ mt7915_init_wiphy(struct mt7915_phy *phy)
- wiphy_ext_feature_set(wiphy, NL80211_EXT_FEATURE_FILS_DISCOVERY);
- wiphy_ext_feature_set(wiphy, NL80211_EXT_FEATURE_ACK_SIGNAL_SUPPORT);
- wiphy_ext_feature_set(wiphy, NL80211_EXT_FEATURE_CAN_REPLACE_PTK0);
-+ wiphy_ext_feature_set(wiphy, NL80211_EXT_FEATURE_STAS_COUNT);
-
- if (!is_mt7915(&dev->mt76))
- wiphy_ext_feature_set(wiphy, NL80211_EXT_FEATURE_STA_TX_PWR);
-diff --git a/mt7915/mac.c b/mt7915/mac.c
-index debc2f9d..244dff46 100644
---- a/mt7915/mac.c
-+++ b/mt7915/mac.c
-@@ -1048,6 +1048,7 @@ static void mt7915_mac_add_txs(struct mt7915_dev *dev, void *data)
- struct mt7915_phy *phy;
- struct mt76_wcid *wcid;
- __le32 *txs_data = data;
-+ u64 last_bytes;
- u16 wcidx;
- u8 pid;
-
-@@ -1066,6 +1067,7 @@ static void mt7915_mac_add_txs(struct mt7915_dev *dev, void *data)
- if (!wcid)
- goto out;
-
-+ last_bytes = wcid->stats.tx_bytes;
- msta = container_of(wcid, struct mt7915_sta, wcid);
-
- if (pid == MT_PACKET_ID_WED)
-@@ -1076,6 +1078,22 @@ static void mt7915_mac_add_txs(struct mt7915_dev *dev, void *data)
- if (!wcid->sta)
- goto out;
-
-+ if (wiphy_ext_feature_isset(dev->mphy.hw->wiphy,
-+ NL80211_EXT_FEATURE_STAS_COUNT)) {
-+ struct ieee80211_vif *vif;
-+ struct wireless_dev *wdev;
-+ struct pcpu_sw_netstats *tstats;
-+
-+ vif = container_of((void *)msta->vif, struct ieee80211_vif,
-+ drv_priv);
-+ if (!vif)
-+ goto out;
-+
-+ wdev = ieee80211_vif_to_wdev(vif);
-+ tstats = this_cpu_ptr(wdev->netdev->tstats);
-+
-+ tstats->tx_bytes += wcid->stats.tx_bytes - last_bytes;
-+ }
- spin_lock_bh(&dev->mt76.sta_poll_lock);
- if (list_empty(&msta->wcid.poll_list))
- list_add_tail(&msta->wcid.poll_list, &dev->mt76.sta_poll_list);
-@@ -2053,6 +2071,7 @@ static void mt7915_mac_sta_stats_work(struct mt7915_phy *phy)
- spin_unlock_bh(&phy->stats_lock);
-
- mt7915_mcu_get_tx_rate(phy, sta->wcid.idx);
-+ mt7915_mcu_wed_wa_tx_stats(phy->dev, sta->wcid.idx, sta);
-
- spin_lock_bh(&phy->stats_lock);
- }
-diff --git a/mt7915/main.c b/mt7915/main.c
-index 03697bac..22d1d25b 100644
---- a/mt7915/main.c
-+++ b/mt7915/main.c
-@@ -1173,7 +1173,7 @@ static void mt7915_sta_statistics(struct ieee80211_hw *hw,
- sinfo->tx_bytes = msta->wcid.stats.tx_bytes;
- sinfo->filled |= BIT_ULL(NL80211_STA_INFO_TX_BYTES64);
-
-- if (!mt7915_mcu_wed_wa_tx_stats(phy->dev, msta->wcid.idx)) {
-+ if (!mt7915_mcu_wed_wa_tx_stats(phy->dev, msta->wcid.idx, msta)) {
- sinfo->tx_packets = msta->wcid.stats.tx_packets;
- sinfo->filled |= BIT_ULL(NL80211_STA_INFO_TX_PACKETS);
- }
-diff --git a/mt7915/mcu.c b/mt7915/mcu.c
-index a4225675..6f93b3b0 100644
---- a/mt7915/mcu.c
-+++ b/mt7915/mcu.c
-@@ -4408,7 +4408,8 @@ int mt7915_mcu_twt_agrt_update(struct mt7915_dev *dev,
- &req, sizeof(req), true);
- }
-
--int mt7915_mcu_wed_wa_tx_stats(struct mt7915_dev *dev, u16 wlan_idx)
-+int mt7915_mcu_wed_wa_tx_stats(struct mt7915_dev *dev, u16 wlan_idx,
-+ struct mt7915_sta *sta)
- {
- struct {
- __le32 cmd;
-@@ -4452,11 +4453,33 @@ int mt7915_mcu_wed_wa_tx_stats(struct mt7915_dev *dev, u16 wlan_idx)
- rcu_read_lock();
-
- wcid = rcu_dereference(dev->mt76.wcid[wlan_idx]);
-- if (wcid)
-+ if (wcid) {
-+ struct ieee80211_vif *vif;
-+ struct wireless_dev *wdev;
-+ struct pcpu_sw_netstats *tstats;
-+
- wcid->stats.tx_packets += le32_to_cpu(res->tx_packets);
-- else
-+
-+ if (!wiphy_ext_feature_isset(dev->mphy.hw->wiphy,
-+ NL80211_EXT_FEATURE_STAS_COUNT) ||
-+ !sta)
-+ goto unlock;
-+
-+ vif = container_of((void *)sta->vif,
-+ struct ieee80211_vif,
-+ drv_priv);
-+ if (!vif)
-+ goto unlock;
-+
-+ wdev = ieee80211_vif_to_wdev(vif);
-+
-+ tstats = this_cpu_ptr(wdev->netdev->tstats);
-+ tstats->tx_packets += le32_to_cpu(res->tx_packets);
-+ } else {
- ret = -EINVAL;
-+ }
-
-+unlock:
- rcu_read_unlock();
- out:
- dev_kfree_skb(skb);
-diff --git a/mt7915/mmio.c b/mt7915/mmio.c
-index 89523a52..00c190c7 100644
---- a/mt7915/mmio.c
-+++ b/mt7915/mmio.c
-@@ -704,8 +704,34 @@ static void mt7915_mmio_wed_update_rx_stats(struct mtk_wed_device *wed,
- wcid->stats.rx_packets += le32_to_cpu(stats->rx_pkt_cnt);
- wcid->stats.rx_errors += le32_to_cpu(stats->rx_err_cnt);
- wcid->stats.rx_drops += le32_to_cpu(stats->rx_drop_cnt);
-+
-+ if (wiphy_ext_feature_isset(dev->mphy.hw->wiphy,
-+ NL80211_EXT_FEATURE_STAS_COUNT)) {
-+ struct mt7915_sta *msta;
-+ struct ieee80211_vif *vif;
-+ struct wireless_dev *wdev;
-+ struct pcpu_sw_netstats *tstats;
-+
-+ msta = container_of(wcid, struct mt7915_sta, wcid);
-+
-+ if (!msta || !msta->vif)
-+ goto unlock;
-+
-+ vif = container_of((void *)msta->vif,
-+ struct ieee80211_vif,
-+ drv_priv);
-+ if (!vif)
-+ goto unlock;
-+
-+ wdev = ieee80211_vif_to_wdev(vif);
-+ tstats = this_cpu_ptr(wdev->netdev->tstats);
-+
-+ tstats->rx_packets += le32_to_cpu(stats->rx_pkt_cnt);
-+ tstats->rx_bytes += le32_to_cpu(stats->rx_byte_cnt);
-+ }
- }
-
-+unlock:
- rcu_read_unlock();
- }
-
-diff --git a/mt7915/mt7915.h b/mt7915/mt7915.h
-index 70e92734..8171ea8a 100644
---- a/mt7915/mt7915.h
-+++ b/mt7915/mt7915.h
-@@ -673,7 +673,8 @@ int mt7915_mcu_get_rx_rate(struct mt7915_phy *phy, struct ieee80211_vif *vif,
- struct ieee80211_sta *sta, struct rate_info *rate);
- int mt7915_mcu_rdd_background_enable(struct mt7915_phy *phy,
- struct cfg80211_chan_def *chandef);
--int mt7915_mcu_wed_wa_tx_stats(struct mt7915_dev *dev, u16 wcid);
-+int mt7915_mcu_wed_wa_tx_stats(struct mt7915_dev *dev, u16 wcid,
-+ struct mt7915_sta *sta);
- int mt7915_get_tx_stat(struct mt7915_phy *phy, u16 wlan_idx);
- int mt7915_mcu_rf_regval(struct mt7915_dev *dev, u32 regidx, u32 *val, bool set);
- int mt7915_mcu_wa_cmd(struct mt7915_dev *dev, int cmd, u32 a1, u32 a2, u32 a3);
-diff --git a/mt7915/mtk_debugfs.c b/mt7915/mtk_debugfs.c
-index 401b4dd6..7a641b10 100644
---- a/mt7915/mtk_debugfs.c
-+++ b/mt7915/mtk_debugfs.c
-@@ -3797,7 +3797,7 @@ static int mt7915_reset_counter(void *data, u64 val)
- struct mt76_wcid *wcid;
-
- /* Clear the firmware counters */
-- mt7915_mcu_wed_wa_tx_stats(dev, dev->wlan_idx);
-+ mt7915_mcu_wed_wa_tx_stats(dev, dev->wlan_idx, NULL);
- mt7915_get_tx_stat(phy, dev->wlan_idx);
-
- rcu_read_lock();
---
-2.39.2
-
diff --git a/recipes-wifi/linux-mt76/files/patches/9999-mt76-revert-for-backports-5.15-wireless-stack.patch b/recipes-wifi/linux-mt76/files/patches/9999-mt76-revert-for-backports-5.15-wireless-stack.patch
index 7f3503a..95eeb1e 100644
--- a/recipes-wifi/linux-mt76/files/patches/9999-mt76-revert-for-backports-5.15-wireless-stack.patch
+++ b/recipes-wifi/linux-mt76/files/patches/9999-mt76-revert-for-backports-5.15-wireless-stack.patch
@@ -1,7 +1,7 @@
-From 21aafdc92be1e262d1e669e4919b11b51484ff2f Mon Sep 17 00:00:00 2001
+From 7b82a7ca86e377e26747dd57ec4cd5badc9d4bcb Mon Sep 17 00:00:00 2001
From: Evelyn Tsai <evelyn.tsai@mediatek.com>
Date: Wed, 5 Apr 2023 08:29:19 +0800
-Subject: [PATCH 2010/2010] mt76: revert for backports-5.15 wireless stack
+Subject: [PATCH] mt76: revert for backports-5.15 wireless stack
wifi: mt76: mt7915: add support for he ldpc control from hostapd
---
@@ -145,7 +145,7 @@
.bcn_interval = cpu_to_le16(vif->bss_conf.beacon_int),
};
diff --git a/mt76_connac_mac.c b/mt76_connac_mac.c
-index ff3cefad..fdb0142f 100644
+index b87b7335..08a92ace 100644
--- a/mt76_connac_mac.c
+++ b/mt76_connac_mac.c
@@ -1122,7 +1122,7 @@ void mt76_connac2_tx_check_aggr(struct ieee80211_sta *sta, __le32 *txwi)
@@ -524,10 +524,10 @@
if (info->flags & IEEE80211_TX_CTL_RATE_CTRL_PROBE)
ba_size = 0;
diff --git a/mt7915/debugfs.c b/mt7915/debugfs.c
-index 4b3af79c..ebf7c9a7 100644
+index fefa4540..848ba4ee 100644
--- a/mt7915/debugfs.c
+++ b/mt7915/debugfs.c
-@@ -2006,8 +2006,8 @@ static ssize_t mt7915_sta_fixed_rate_set(struct file *file,
+@@ -2045,8 +2045,8 @@ static ssize_t mt7915_sta_fixed_rate_set(struct file *file,
phy.ldpc = (phy.bw || phy.ldpc) * GENMASK(2, 0);
for (i = 0; i <= phy.bw; i++) {
@@ -554,10 +554,10 @@
mt7915_dma_enable(dev, false);
diff --git a/mt7915/init.c b/mt7915/init.c
-index a2aca371..7858bf60 100644
+index 2e9c94fb..b30aaea2 100644
--- a/mt7915/init.c
+++ b/mt7915/init.c
-@@ -1152,8 +1152,7 @@ mt7915_init_he_caps(struct mt7915_phy *phy, enum nl80211_band band,
+@@ -1157,8 +1157,7 @@ mt7915_init_he_caps(struct mt7915_phy *phy, enum nl80211_band band,
mt76_connac_gen_ppe_thresh(he_cap->ppe_thres, nss);
} else {
he_cap_elem->phy_cap_info[9] |=
@@ -568,10 +568,10 @@
if (band == NL80211_BAND_6GHZ) {
diff --git a/mt7915/main.c b/mt7915/main.c
-index 22d1d25b..4dbae9a5 100644
+index deef1bb6..14b691a2 100644
--- a/mt7915/main.c
+++ b/mt7915/main.c
-@@ -531,7 +531,7 @@ static int mt7915_config(struct ieee80211_hw *hw, u32 changed)
+@@ -532,7 +532,7 @@ static int mt7915_config(struct ieee80211_hw *hw, u32 changed)
static int
mt7915_conf_tx(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
@@ -580,7 +580,7 @@
const struct ieee80211_tx_queue_params *params)
{
struct mt7915_vif *mvif = (struct mt7915_vif *)vif->drv_priv;
-@@ -626,7 +626,7 @@ mt7915_update_bss_color(struct ieee80211_hw *hw,
+@@ -627,7 +627,7 @@ mt7915_update_bss_color(struct ieee80211_hw *hw,
static void mt7915_bss_info_changed(struct ieee80211_hw *hw,
struct ieee80211_vif *vif,
struct ieee80211_bss_conf *info,
@@ -589,7 +589,7 @@
{
struct mt7915_phy *phy = mt7915_hw_phy(hw);
struct mt7915_dev *dev = mt7915_hw_dev(hw);
-@@ -642,7 +642,7 @@ static void mt7915_bss_info_changed(struct ieee80211_hw *hw,
+@@ -643,7 +643,7 @@ static void mt7915_bss_info_changed(struct ieee80211_hw *hw,
vif->type == NL80211_IFTYPE_STATION)
set_bss_info = set_sta = !is_zero_ether_addr(info->bssid);
if (changed & BSS_CHANGED_ASSOC)
@@ -598,7 +598,7 @@
if (changed & BSS_CHANGED_BEACON_ENABLED &&
vif->type != NL80211_IFTYPE_AP)
set_bss_info = set_sta = info->enable_beacon;
-@@ -690,27 +690,8 @@ static void mt7915_bss_info_changed(struct ieee80211_hw *hw,
+@@ -691,27 +691,8 @@ static void mt7915_bss_info_changed(struct ieee80211_hw *hw,
mutex_unlock(&dev->mt76.mutex);
}
@@ -627,7 +627,7 @@
{
struct mt7915_phy *phy = mt7915_hw_phy(hw);
struct mt7915_dev *dev = mt7915_hw_dev(hw);
-@@ -718,8 +699,6 @@ mt7915_start_ap(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
+@@ -719,8 +700,6 @@ mt7915_start_ap(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
mutex_lock(&dev->mt76.mutex);
@@ -636,7 +636,7 @@
err = mt7915_mcu_add_bss_info(phy, vif, true);
if (err)
goto out;
-@@ -731,8 +710,7 @@ out:
+@@ -732,8 +711,7 @@ out:
}
static void
@@ -646,7 +646,7 @@
{
struct mt7915_dev *dev = mt7915_hw_dev(hw);
-@@ -1295,10 +1273,10 @@ static int mt7915_sta_set_txpwr(struct ieee80211_hw *hw,
+@@ -1296,10 +1274,10 @@ static int mt7915_sta_set_txpwr(struct ieee80211_hw *hw,
{
struct mt7915_phy *phy = mt7915_hw_phy(hw);
struct mt7915_dev *dev = mt7915_hw_dev(hw);
@@ -660,7 +660,7 @@
mutex_lock(&dev->mt76.mutex);
diff --git a/mt7915/mcu.c b/mt7915/mcu.c
-index 6f93b3b0..1bba999d 100644
+index 7c3e25c6..8dce1dea 100644
--- a/mt7915/mcu.c
+++ b/mt7915/mcu.c
@@ -67,7 +67,7 @@ mt7915_mcu_set_sta_he_mcs(struct ieee80211_sta *sta, __le16 *he_mcs,
@@ -718,8 +718,8 @@
static void
mt7915_mcu_csa_finish(void *priv, u8 *mac, struct ieee80211_vif *vif)
{
-- if (vif->bss_conf.csa_active)
-+ if (vif->csa_active)
+- if (vif->bss_conf.csa_active && vif->type != NL80211_IFTYPE_STATION)
++ if (vif->csa_active && vif->type != NL80211_IFTYPE_STATION)
ieee80211_csa_finish(vif);
}
@@ -727,8 +727,8 @@
static void
mt7915_mcu_cca_finish(void *priv, u8 *mac, struct ieee80211_vif *vif)
{
-- if (!vif->bss_conf.color_change_active)
-+ if (!vif->color_change_active)
+- if (!vif->bss_conf.color_change_active || vif->type == NL80211_IFTYPE_STATION)
++ if (!vif->color_change_active || vif->type == NL80211_IFTYPE_STATION)
return;
ieee80211_color_change_finish(vif);
@@ -783,7 +783,7 @@
return;
muru->mimo_dl.partial_bw_dl_mimo =
-@@ -958,13 +958,13 @@ mt7915_mcu_sta_ht_tlv(struct sk_buff *skb, struct ieee80211_sta *sta)
+@@ -960,13 +960,13 @@ mt7915_mcu_sta_ht_tlv(struct sk_buff *skb, struct ieee80211_sta *sta)
struct sta_rec_ht *ht;
struct tlv *tlv;
@@ -799,7 +799,7 @@
}
static void
-@@ -973,15 +973,15 @@ mt7915_mcu_sta_vht_tlv(struct sk_buff *skb, struct ieee80211_sta *sta)
+@@ -975,15 +975,15 @@ mt7915_mcu_sta_vht_tlv(struct sk_buff *skb, struct ieee80211_sta *sta)
struct sta_rec_vht *vht;
struct tlv *tlv;
@@ -819,7 +819,7 @@
}
static void
-@@ -996,7 +996,7 @@ mt7915_mcu_sta_amsdu_tlv(struct mt7915_dev *dev, struct sk_buff *skb,
+@@ -998,7 +998,7 @@ mt7915_mcu_sta_amsdu_tlv(struct mt7915_dev *dev, struct sk_buff *skb,
vif->type != NL80211_IFTYPE_AP)
return;
@@ -828,7 +828,7 @@
return;
tlv = mt76_connac_mcu_add_tlv(skb, STA_REC_HW_AMSDU, sizeof(*amsdu));
-@@ -1005,7 +1005,7 @@ mt7915_mcu_sta_amsdu_tlv(struct mt7915_dev *dev, struct sk_buff *skb,
+@@ -1007,7 +1007,7 @@ mt7915_mcu_sta_amsdu_tlv(struct mt7915_dev *dev, struct sk_buff *skb,
amsdu->amsdu_en = true;
msta->wcid.amsdu = true;
@@ -837,7 +837,7 @@
case IEEE80211_MAX_MPDU_LEN_VHT_11454:
if (!is_mt7915(&dev->mt76)) {
amsdu->max_mpdu_size =
-@@ -1068,8 +1068,8 @@ mt7915_is_ebf_supported(struct mt7915_phy *phy, struct ieee80211_vif *vif,
+@@ -1070,8 +1070,8 @@ mt7915_is_ebf_supported(struct mt7915_phy *phy, struct ieee80211_vif *vif,
if (!bfee && sts < 2)
return false;
@@ -848,7 +848,7 @@
if (bfee)
return mvif->cap.he_su_ebfee &&
-@@ -1079,8 +1079,8 @@ mt7915_is_ebf_supported(struct mt7915_phy *phy, struct ieee80211_vif *vif,
+@@ -1081,8 +1081,8 @@ mt7915_is_ebf_supported(struct mt7915_phy *phy, struct ieee80211_vif *vif,
HE_PHY(CAP4_SU_BEAMFORMEE, pe->phy_cap_info[4]);
}
@@ -859,7 +859,7 @@
if (bfee)
return mvif->cap.vht_su_ebfee &&
-@@ -1106,7 +1106,7 @@ static void
+@@ -1108,7 +1108,7 @@ static void
mt7915_mcu_sta_bfer_ht(struct ieee80211_sta *sta, struct mt7915_phy *phy,
struct sta_rec_bf *bf)
{
@@ -868,7 +868,7 @@
u8 n = 0;
bf->tx_mode = MT_PHY_TYPE_HT;
-@@ -1131,7 +1131,7 @@ static void
+@@ -1133,7 +1133,7 @@ static void
mt7915_mcu_sta_bfer_vht(struct ieee80211_sta *sta, struct mt7915_phy *phy,
struct sta_rec_bf *bf, bool explicit)
{
@@ -877,7 +877,7 @@
struct ieee80211_sta_vht_cap *vc = &phy->mt76->sband_5g.sband.vht_cap;
u16 mcs_map = le16_to_cpu(pc->vht_mcs.rx_mcs_map);
u8 nss_mcs = mt7915_mcu_get_sta_nss(mcs_map);
-@@ -1152,14 +1152,14 @@ mt7915_mcu_sta_bfer_vht(struct ieee80211_sta *sta, struct mt7915_phy *phy,
+@@ -1154,14 +1154,14 @@ mt7915_mcu_sta_bfer_vht(struct ieee80211_sta *sta, struct mt7915_phy *phy,
bf->ncol = min_t(u8, nss_mcs, bf->nrow);
bf->ibf_ncol = bf->ncol;
@@ -894,7 +894,7 @@
bf->ibf_nrow = 1;
}
}
-@@ -1168,7 +1168,7 @@ static void
+@@ -1170,7 +1170,7 @@ static void
mt7915_mcu_sta_bfer_he(struct ieee80211_sta *sta, struct ieee80211_vif *vif,
struct mt7915_phy *phy, struct sta_rec_bf *bf)
{
@@ -903,7 +903,7 @@
struct ieee80211_he_cap_elem *pe = &pc->he_cap_elem;
const struct ieee80211_sta_he_cap *vc =
mt76_connac_get_he_phy_cap(phy->mt76, vif);
-@@ -1193,7 +1193,7 @@ mt7915_mcu_sta_bfer_he(struct ieee80211_sta *sta, struct ieee80211_vif *vif,
+@@ -1195,7 +1195,7 @@ mt7915_mcu_sta_bfer_he(struct ieee80211_sta *sta, struct ieee80211_vif *vif,
bf->ncol = min_t(u8, nss_mcs, bf->nrow);
bf->ibf_ncol = bf->ncol;
@@ -912,7 +912,7 @@
return;
/* go over for 160MHz and 80p80 */
-@@ -1241,7 +1241,7 @@ mt7915_mcu_sta_bfer_tlv(struct mt7915_dev *dev, struct sk_buff *skb,
+@@ -1243,7 +1243,7 @@ mt7915_mcu_sta_bfer_tlv(struct mt7915_dev *dev, struct sk_buff *skb,
};
bool ebf;
@@ -921,7 +921,7 @@
return;
ebf = mt7915_is_ebf_supported(phy, vif, sta, false);
-@@ -1255,21 +1255,21 @@ mt7915_mcu_sta_bfer_tlv(struct mt7915_dev *dev, struct sk_buff *skb,
+@@ -1257,21 +1257,21 @@ mt7915_mcu_sta_bfer_tlv(struct mt7915_dev *dev, struct sk_buff *skb,
* vht: support eBF and iBF
* ht: iBF only, since mac80211 lacks of eBF support
*/
@@ -949,7 +949,7 @@
bf->ibf_timeout = 0x48;
else
bf->ibf_timeout = 0x18;
-@@ -1279,7 +1279,7 @@ mt7915_mcu_sta_bfer_tlv(struct mt7915_dev *dev, struct sk_buff *skb,
+@@ -1281,7 +1281,7 @@ mt7915_mcu_sta_bfer_tlv(struct mt7915_dev *dev, struct sk_buff *skb,
else
bf->mem_20m = matrix[bf->nrow][bf->ncol];
@@ -958,7 +958,7 @@
case IEEE80211_STA_RX_BW_160:
case IEEE80211_STA_RX_BW_80:
bf->mem_total = bf->mem_20m * 2;
-@@ -1304,7 +1304,7 @@ mt7915_mcu_sta_bfee_tlv(struct mt7915_dev *dev, struct sk_buff *skb,
+@@ -1306,7 +1306,7 @@ mt7915_mcu_sta_bfee_tlv(struct mt7915_dev *dev, struct sk_buff *skb,
struct tlv *tlv;
u8 nrow = 0;
@@ -967,7 +967,7 @@
return;
if (!mt7915_is_ebf_supported(phy, vif, sta, true))
-@@ -1313,13 +1313,13 @@ mt7915_mcu_sta_bfee_tlv(struct mt7915_dev *dev, struct sk_buff *skb,
+@@ -1315,13 +1315,13 @@ mt7915_mcu_sta_bfee_tlv(struct mt7915_dev *dev, struct sk_buff *skb,
tlv = mt76_connac_mcu_add_tlv(skb, STA_REC_BFEE, sizeof(*bfee));
bfee = (struct sta_rec_bfee *)tlv;
@@ -985,7 +985,7 @@
nrow = FIELD_GET(IEEE80211_VHT_CAP_SOUNDING_DIMENSIONS_MASK,
pc->cap);
-@@ -1375,7 +1375,7 @@ int mt7915_mcu_set_fixed_rate_ctrl(struct mt7915_dev *dev,
+@@ -1377,7 +1377,7 @@ int mt7915_mcu_set_fixed_rate_ctrl(struct mt7915_dev *dev,
ra->phy = *phy;
break;
case RATE_PARAM_MMPS_UPDATE:
@@ -994,7 +994,7 @@
break;
case RATE_PARAM_SPE_UPDATE:
ra->spe_idx = *(u8 *)data;
-@@ -1450,7 +1450,7 @@ mt7915_mcu_add_rate_ctrl_fixed(struct mt7915_dev *dev,
+@@ -1452,7 +1452,7 @@ mt7915_mcu_add_rate_ctrl_fixed(struct mt7915_dev *dev,
do { \
u8 i, gi = mask->control[band]._gi; \
gi = (_he) ? gi : gi == NL80211_TXRATE_FORCE_SGI; \
@@ -1003,7 +1003,7 @@
phy.sgi |= gi << (i << (_he)); \
phy.he_ltf |= mask->control[band].he_ltf << (i << (_he));\
} \
-@@ -1464,11 +1464,11 @@ mt7915_mcu_add_rate_ctrl_fixed(struct mt7915_dev *dev,
+@@ -1466,11 +1466,11 @@ mt7915_mcu_add_rate_ctrl_fixed(struct mt7915_dev *dev,
} \
} while (0)
@@ -1018,7 +1018,7 @@
__sta_phy_bitrate_mask_check(ht_mcs, gi, 1, 0);
} else {
nrates = hweight32(mask->control[band].legacy);
-@@ -1502,7 +1502,7 @@ mt7915_mcu_add_rate_ctrl_fixed(struct mt7915_dev *dev,
+@@ -1504,7 +1504,7 @@ mt7915_mcu_add_rate_ctrl_fixed(struct mt7915_dev *dev,
* actual txrate hardware sends out.
*/
addr = mt7915_mac_wtbl_lmac_addr(dev, msta->wcid.idx, 7);
@@ -1027,7 +1027,7 @@
mt76_rmw_field(dev, addr, GENMASK(31, 24), phy.sgi);
else
mt76_rmw_field(dev, addr, GENMASK(15, 12), phy.sgi);
-@@ -1535,7 +1535,7 @@ mt7915_mcu_sta_rate_ctrl_tlv(struct sk_buff *skb, struct mt7915_dev *dev,
+@@ -1537,7 +1537,7 @@ mt7915_mcu_sta_rate_ctrl_tlv(struct sk_buff *skb, struct mt7915_dev *dev,
enum nl80211_band band = chandef->chan->band;
struct sta_rec_ra *ra;
struct tlv *tlv;
@@ -1036,7 +1036,7 @@
u32 cap = sta->wme ? STA_CAP_WMM : 0;
tlv = mt76_connac_mcu_add_tlv(skb, STA_REC_RA, sizeof(*ra));
-@@ -1545,9 +1545,9 @@ mt7915_mcu_sta_rate_ctrl_tlv(struct sk_buff *skb, struct mt7915_dev *dev,
+@@ -1547,9 +1547,9 @@ mt7915_mcu_sta_rate_ctrl_tlv(struct sk_buff *skb, struct mt7915_dev *dev,
ra->auto_rate = true;
ra->phy_mode = mt76_connac_get_phy_mode(mphy, vif, band, sta);
ra->channel = chandef->chan->hw_value;
@@ -1049,7 +1049,7 @@
if (supp_rate) {
supp_rate &= mask->control[band].legacy;
-@@ -1567,22 +1567,22 @@ mt7915_mcu_sta_rate_ctrl_tlv(struct sk_buff *skb, struct mt7915_dev *dev,
+@@ -1569,22 +1569,22 @@ mt7915_mcu_sta_rate_ctrl_tlv(struct sk_buff *skb, struct mt7915_dev *dev,
}
}
@@ -1080,7 +1080,7 @@
cap |= STA_CAP_LDPC;
mt7915_mcu_set_sta_ht_mcs(sta, ra->ht_mcs,
-@@ -1590,37 +1590,37 @@ mt7915_mcu_sta_rate_ctrl_tlv(struct sk_buff *skb, struct mt7915_dev *dev,
+@@ -1592,37 +1592,37 @@ mt7915_mcu_sta_rate_ctrl_tlv(struct sk_buff *skb, struct mt7915_dev *dev,
ra->supp_ht_mcs = *(__le32 *)ra->ht_mcs;
}
@@ -1128,7 +1128,7 @@
IEEE80211_HE_6GHZ_CAP_MAX_AMPDU_LEN_EXP);
}
-@@ -1829,7 +1829,7 @@ mt7915_mcu_beacon_cntdwn(struct ieee80211_vif *vif, struct sk_buff *rskb,
+@@ -1831,7 +1831,7 @@ mt7915_mcu_beacon_cntdwn(struct ieee80211_vif *vif, struct sk_buff *rskb,
if (!offs->cntdwn_counter_offs[0])
return;
@@ -1137,7 +1137,7 @@
tlv = mt7915_mcu_add_nested_subtlv(rskb, sub_tag, sizeof(*info),
&bcn->sub_ntlv, &bcn->len);
info = (struct bss_info_bcn_cntdwn *)tlv;
-@@ -1914,9 +1914,9 @@ mt7915_mcu_beacon_cont(struct mt7915_dev *dev, struct ieee80211_vif *vif,
+@@ -1916,9 +1916,9 @@ mt7915_mcu_beacon_cont(struct mt7915_dev *dev, struct ieee80211_vif *vif,
if (offs->cntdwn_counter_offs[0]) {
u16 offset = offs->cntdwn_counter_offs[0];
@@ -1149,7 +1149,7 @@
cont->bcc_ofs = cpu_to_le16(offset - 3);
}
-@@ -1926,6 +1926,85 @@ mt7915_mcu_beacon_cont(struct mt7915_dev *dev, struct ieee80211_vif *vif,
+@@ -1928,6 +1928,85 @@ mt7915_mcu_beacon_cont(struct mt7915_dev *dev, struct ieee80211_vif *vif,
memcpy(buf + MT_TXD_SIZE, skb->data, skb->len);
}
@@ -1235,16 +1235,16 @@
int
mt7915_mcu_add_inband_discov(struct mt7915_dev *dev, struct ieee80211_vif *vif,
u32 changed)
-@@ -2037,7 +2116,7 @@ int mt7915_mcu_add_beacon(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
+@@ -2041,7 +2120,7 @@ int mt7915_mcu_add_beacon(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
if (!en)
goto out;
- skb = ieee80211_beacon_get_template(hw, vif, &offs, 0);
+ skb = ieee80211_beacon_get_template(hw, vif, &offs);
- if (!skb)
+ if (!skb) {
+ dev_kfree_skb(rskb);
return -EINVAL;
-
-@@ -2050,6 +2129,7 @@ int mt7915_mcu_add_beacon(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
+@@ -2057,6 +2136,7 @@ int mt7915_mcu_add_beacon(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
info = IEEE80211_SKB_CB(skb);
info->hw_queue = FIELD_PREP(MT_TX_HW_QUEUE_PHY, ext_phy);
@@ -1252,7 +1252,7 @@
mt7915_mcu_beacon_cntdwn(vif, rskb, skb, bcn, &offs);
mt7915_mcu_beacon_mbss(rskb, skb, vif, bcn, &offs);
mt7915_mcu_beacon_cont(dev, vif, rskb, skb, bcn, &offs);
-@@ -3322,17 +3402,17 @@ int mt7915_mcu_set_txpower_frame(struct mt7915_phy *phy,
+@@ -3329,17 +3409,17 @@ int mt7915_mcu_set_txpower_frame(struct mt7915_phy *phy,
if (txpower) {
u32 offs, len, i;
@@ -1274,10 +1274,10 @@
len = sku_len[SKU_HE_RU242] * 4;
}
diff --git a/mt7915/mmio.c b/mt7915/mmio.c
-index 00c190c7..54362d4b 100644
+index aa5c5dd6..08e7c52f 100644
--- a/mt7915/mmio.c
+++ b/mt7915/mmio.c
-@@ -651,7 +651,7 @@ static u32 mt7915_mmio_wed_init_rx_buf(struct mtk_wed_device *wed, int size)
+@@ -689,7 +689,7 @@ static u32 mt7915_mmio_wed_init_rx_buf(struct mtk_wed_device *wed, int size)
phy_addr = dma_map_single(dev->mt76.dma_dev, ptr,
wed->wlan.rx_size,
DMA_TO_DEVICE);
@@ -1287,7 +1287,7 @@
skb_free_frag(ptr);
mt76_put_rxwi(&dev->mt76, r);
diff --git a/mt7915/testmode.c b/mt7915/testmode.c
-index fafe9095..b10dec55 100644
+index d5c74dfd..38ac79d6 100644
--- a/mt7915/testmode.c
+++ b/mt7915/testmode.c
@@ -416,12 +416,12 @@ mt7915_tm_entry_add(struct mt7915_phy *phy, u8 aid)
diff --git a/recipes-wifi/linux-mt76/files/patches/patches.inc b/recipes-wifi/linux-mt76/files/patches/patches.inc
index 93c7e24..167020d 100644
--- a/recipes-wifi/linux-mt76/files/patches/patches.inc
+++ b/recipes-wifi/linux-mt76/files/patches/patches.inc
@@ -1,17 +1,20 @@
#patch patches (come from openwrt/lede/target/linux/mediatek)
SRC_URI_append = " \
- file://0000-sync-to-master-codebase.patch \
- file://0001-wifi-mt76-mt7915-Update-beacon-size-limitation-for-1.patch \
- file://0002-wifi-mt76-mt7915-fix-the-beamformer-issue.patch \
- file://0003-wifi-mt76-fix-incorrect-HE-TX-GI-report.patch \
- file://0004-wifi-mt76-mt7915-fix-DFS-CAC-tx-emission-issue-after.patch \
- file://0005-wifi-mt76-mt7915-add-pc-stack-dump-for-WM-s-coredump.patch \
- file://0006-wifi-mt76-mt7915-update-mpdu-density-in-2-5g-capabil.patch \
- file://0007-wifi-mt76-mt7915-move-temperature-margin-check-to-mt.patch \
- file://0008-wifi-mt76-mt7915-fix-tx-emission-issue-during-bootup.patch \
- file://0009-wifi-mt76-mt7915-fix-txpower-issues.patch \
- file://0010-wifi-mt76-mt7915-rework-init-txpower.patch \
- file://0011-wifi-mt76-mt7915-rework-mmio-access-flow.patch \
+ file://0001-wifi-mt76-mt7915-update-beacon-size-limitation.patch \
+ file://0002-wifi-mt76-mt7915-check-sta-rx-control-frame-to-multi.patch \
+ file://0003-wifi-mt76-mt7915-fix-potential-memory-leak-of-beacon.patch \
+ file://0004-wifi-mt76-mt7915-get-rid-of-false-alamrs-of-tx-emiss.patch \
+ file://0005-wifi-mt76-mt7915-fix-per-band-IEEE80211_CONF_MONITOR.patch \
+ file://0006-wifi-mt76-mt7915-check-vif-type-before-reporting-cca.patch \
+ file://0007-wifi-mt76-mt7915-update-mpdu-density-capability.patch \
+ file://0008-wifi-mt76-mt7915-fix-beamforming-availability-check.patch \
+ file://0009-wifi-mt76-fix-incorrect-HE-TX-GI-report.patch \
+ file://0010-wifi-mt76-mt7915-add-pc-stack-dump-for-WM-s-coredump.patch \
+ file://0011-wifi-mt76-mt7915-move-temperature-margin-check-to-mt.patch \
+ file://0012-wifi-mt76-mt7915-fix-txpower-issues.patch \
+ file://0013-wifi-mt76-mt7915-rework-init-txpower.patch \
+ file://0014-wifi-mt76-mt7915-rework-mmio-access-flow.patch \
+ file://0015-wifi-mt76-disable-HW-AMSDU-when-using-fixed-rate.patch \
file://0999-wifi-mt76-mt7915-build-pass-for-Linux-Kernel-5.4-fix.patch \
file://1000-wifi-mt76-mt7915-add-mtk-internal-debug-tools-for-mt.patch \
file://1001-wifi-mt76-mt7915-csi-implement-csi-support.patch \
@@ -50,6 +53,9 @@
file://1034-wifi-mt76-mt7915-report-tx-and-rx-byte-to-tpt_led-wh.patch \
file://1035-wifi-mt76-mt7915-Establish-BA-in-VO-queue.patch \
file://1036-wifi-mt76-mt7915-Disable-RegDB-when-enable-single-sk.patch \
+ file://1037-wifi-mt76-mt7915-enable-the-mac80211-hw-bmc-ps-buffe.patch \
+ file://1038-wifi-mt76-update-debugfs-knob-to-dump-token-pending-.patch \
+ file://1039-wifi-mt76-mt7915-support-enable-disable-spatial-reus.patch \
file://2000-wifi-mt76-mt7915-wed-add-wed-tx-support.patch \
file://2001-wifi-mt76-mt7915-wed-add-wds-support-when-wed-is-ena.patch \
file://2002-wifi-mt76-mt7915-wed-add-fill-receive-path-to-report.patch \
@@ -59,6 +65,5 @@
file://2006-wifi-mt76-add-debugfs-knob-to-show-packet-error-rate.patch \
file://2007-wifi-mt76-mt7915-add-ctxd-support-for-mt7916.patch \
file://2008-wifi-mt76-connac-wed-add-wed-rx-copy-skb.patch \
- file://2009-wifi-mt76-mt7915-wed-add-per-bss-statistic-info.patch \
file://9999-mt76-revert-for-backports-5.15-wireless-stack.patch \
"
diff --git a/recipes-wifi/linux-mt76/mt76.inc b/recipes-wifi/linux-mt76/mt76.inc
index edabeb0..b81583a 100644
--- a/recipes-wifi/linux-mt76/mt76.inc
+++ b/recipes-wifi/linux-mt76/mt76.inc
@@ -1 +1 @@
-SRCREV ?= "cd3dfe39276905307cc028ac8edf2c06963cda23"
+SRCREV ?= "b14c2351ddb8601c322576d84029e463d456caef"
diff --git a/recipes-wifi/wireless-regdb/wireless-regdb_2023.05.03.bb b/recipes-wifi/wireless-regdb/wireless-regdb_2023.09.01.bb
similarity index 94%
rename from recipes-wifi/wireless-regdb/wireless-regdb_2023.05.03.bb
rename to recipes-wifi/wireless-regdb/wireless-regdb_2023.09.01.bb
index d23af12..e016041 100644
--- a/recipes-wifi/wireless-regdb/wireless-regdb_2023.05.03.bb
+++ b/recipes-wifi/wireless-regdb/wireless-regdb_2023.09.01.bb
@@ -5,7 +5,7 @@
LIC_FILES_CHKSUM = "file://LICENSE;md5=07c4f6dea3845b02a18dc00c8c87699c"
SRC_URI = "https://www.kernel.org/pub/software/network/${BPN}/${BP}.tar.xz"
-SRC_URI[sha256sum] = "f254d08ab3765aeae2b856222e11a95d44aef519a6663877c71ef68fae4c8c12"
+SRC_URI[sha256sum] = "26d4c2a727cc59239b84735aad856b7c7d0b04e30aa5c235c4f7f47f5f053491"
FILESEXTRAPATHS_prepend := "${THISDIR}/files/patches:"
require files/patches/patches.inc
diff --git a/recipes-wifi/wpa-supplicant/files/patches-2.10.3/100-daemonize_fix.patch b/recipes-wifi/wpa-supplicant/files/patches-2.10.3/100-daemonize_fix.patch
deleted file mode 100644
index 687bd40..0000000
--- a/recipes-wifi/wpa-supplicant/files/patches-2.10.3/100-daemonize_fix.patch
+++ /dev/null
@@ -1,97 +0,0 @@
---- a/src/utils/os_unix.c
-+++ b/src/utils/os_unix.c
-@@ -10,6 +10,7 @@
-
- #include <time.h>
- #include <sys/wait.h>
-+#include <fcntl.h>
-
- #ifdef ANDROID
- #include <sys/capability.h>
-@@ -188,59 +189,46 @@ int os_gmtime(os_time_t t, struct os_tm
- return 0;
- }
-
--
--#ifdef __APPLE__
--#include <fcntl.h>
--static int os_daemon(int nochdir, int noclose)
-+int os_daemonize(const char *pid_file)
- {
-- int devnull;
-+ int pid = 0, i, devnull;
-
-- if (chdir("/") < 0)
-- return -1;
-+#if defined(__uClinux__) || defined(__sun__)
-+ return -1;
-+#else /* defined(__uClinux__) || defined(__sun__) */
-
-- devnull = open("/dev/null", O_RDWR);
-- if (devnull < 0)
-+#ifndef __APPLE__
-+ pid = fork();
-+ if (pid < 0)
- return -1;
-+#endif
-
-- if (dup2(devnull, STDIN_FILENO) < 0) {
-- close(devnull);
-- return -1;
-+ if (pid > 0) {
-+ if (pid_file) {
-+ FILE *f = fopen(pid_file, "w");
-+ if (f) {
-+ fprintf(f, "%u\n", pid);
-+ fclose(f);
-+ }
-+ }
-+ _exit(0);
- }
-
-- if (dup2(devnull, STDOUT_FILENO) < 0) {
-- close(devnull);
-+ if (setsid() < 0)
- return -1;
-- }
-
-- if (dup2(devnull, STDERR_FILENO) < 0) {
-- close(devnull);
-+ if (chdir("/") < 0)
- return -1;
-- }
--
-- return 0;
--}
--#else /* __APPLE__ */
--#define os_daemon daemon
--#endif /* __APPLE__ */
-
--
--int os_daemonize(const char *pid_file)
--{
--#if defined(__uClinux__) || defined(__sun__)
-- return -1;
--#else /* defined(__uClinux__) || defined(__sun__) */
-- if (os_daemon(0, 0)) {
-- perror("daemon");
-+ devnull = open("/dev/null", O_RDWR);
-+ if (devnull < 0)
- return -1;
-- }
-
-- if (pid_file) {
-- FILE *f = fopen(pid_file, "w");
-- if (f) {
-- fprintf(f, "%u\n", getpid());
-- fclose(f);
-- }
-- }
-+ for (i = 0; i <= STDERR_FILENO; i++)
-+ dup2(devnull, i);
-+
-+ if (devnull > 2)
-+ close(devnull);
-
- return -0;
- #endif /* defined(__uClinux__) || defined(__sun__) */
diff --git a/recipes-wifi/wpa-supplicant/files/patches-2.10.3/340-reload_freq_change.patch b/recipes-wifi/wpa-supplicant/files/patches-2.10.3/340-reload_freq_change.patch
deleted file mode 100644
index ae6cd81..0000000
--- a/recipes-wifi/wpa-supplicant/files/patches-2.10.3/340-reload_freq_change.patch
+++ /dev/null
@@ -1,80 +0,0 @@
---- a/src/ap/hostapd.c
-+++ b/src/ap/hostapd.c
-@@ -143,6 +143,29 @@ static void hostapd_reload_bss(struct ho
- #endif /* CONFIG_NO_RADIUS */
-
- ssid = &hapd->conf->ssid;
-+
-+ hostapd_set_freq(hapd, hapd->iconf->hw_mode, hapd->iface->freq,
-+ hapd->iconf->channel,
-+ hapd->iconf->enable_edmg,
-+ hapd->iconf->edmg_channel,
-+ hapd->iconf->ieee80211n,
-+ hapd->iconf->ieee80211ac,
-+ hapd->iconf->ieee80211ax,
-+ hapd->iconf->ieee80211be,
-+ hapd->iconf->secondary_channel,
-+ hostapd_get_oper_chwidth(hapd->iconf),
-+ hostapd_get_oper_centr_freq_seg0_idx(hapd->iconf),
-+ hostapd_get_oper_centr_freq_seg1_idx(hapd->iconf));
-+
-+ if (hapd->iface->current_mode) {
-+ if (hostapd_prepare_rates(hapd->iface, hapd->iface->current_mode)) {
-+ wpa_printf(MSG_ERROR, "Failed to prepare rates table.");
-+ hostapd_logger(hapd, NULL, HOSTAPD_MODULE_IEEE80211,
-+ HOSTAPD_LEVEL_WARNING,
-+ "Failed to prepare rates table.");
-+ }
-+ }
-+
- if (!ssid->wpa_psk_set && ssid->wpa_psk && !ssid->wpa_psk->next &&
- ssid->wpa_passphrase_set && ssid->wpa_passphrase) {
- /*
-@@ -251,6 +274,7 @@ int hostapd_reload_config(struct hostapd
- struct hostapd_data *hapd = iface->bss[0];
- struct hostapd_config *newconf, *oldconf;
- size_t j;
-+ int i;
-
- if (iface->config_fname == NULL) {
- /* Only in-memory config in use - assume it has been updated */
-@@ -301,6 +325,17 @@ int hostapd_reload_config(struct hostapd
- }
- iface->conf = newconf;
-
-+ for (i = 0; i < iface->num_hw_features; i++) {
-+ struct hostapd_hw_modes *mode = &iface->hw_features[i];
-+ if (mode->mode == iface->conf->hw_mode) {
-+ iface->current_mode = mode;
-+ break;
-+ }
-+ }
-+
-+ if (iface->conf->channel)
-+ iface->freq = hostapd_hw_get_freq(hapd, iface->conf->channel);
-+
- for (j = 0; j < iface->num_bss; j++) {
- hapd = iface->bss[j];
- if (!hapd->conf->config_id || !newconf->bss[j]->config_id ||
-@@ -308,21 +343,6 @@ int hostapd_reload_config(struct hostapd
- newconf->bss[j]->config_id) != 0)
- hostapd_clear_old_bss(hapd);
- hapd->iconf = newconf;
-- hapd->iconf->channel = oldconf->channel;
-- hapd->iconf->acs = oldconf->acs;
-- hapd->iconf->secondary_channel = oldconf->secondary_channel;
-- hapd->iconf->ieee80211n = oldconf->ieee80211n;
-- hapd->iconf->ieee80211ac = oldconf->ieee80211ac;
-- hapd->iconf->ht_capab = oldconf->ht_capab;
-- hapd->iconf->vht_capab = oldconf->vht_capab;
-- hostapd_set_oper_chwidth(hapd->iconf,
-- hostapd_get_oper_chwidth(oldconf));
-- hostapd_set_oper_centr_freq_seg0_idx(
-- hapd->iconf,
-- hostapd_get_oper_centr_freq_seg0_idx(oldconf));
-- hostapd_set_oper_centr_freq_seg1_idx(
-- hapd->iconf,
-- hostapd_get_oper_centr_freq_seg1_idx(oldconf));
- hapd->conf = newconf->bss[j];
- hostapd_reload_bss(hapd);
- }
diff --git a/recipes-wifi/wpa-supplicant/files/patches-2.10.3/360-ctrl_iface_reload.patch b/recipes-wifi/wpa-supplicant/files/patches-2.10.3/360-ctrl_iface_reload.patch
deleted file mode 100644
index 4d85ea1..0000000
--- a/recipes-wifi/wpa-supplicant/files/patches-2.10.3/360-ctrl_iface_reload.patch
+++ /dev/null
@@ -1,106 +0,0 @@
---- a/hostapd/ctrl_iface.c
-+++ b/hostapd/ctrl_iface.c
-@@ -68,6 +68,7 @@
- #include "fst/fst_ctrl_iface.h"
- #include "config_file.h"
- #include "ctrl_iface.h"
-+#include "config_file.h"
-
-
- #define HOSTAPD_CLI_DUP_VALUE_MAX_LEN 256
-@@ -83,6 +84,7 @@ static void hostapd_ctrl_iface_send(stru
- enum wpa_msg_type type,
- const char *buf, size_t len);
-
-+static char *reload_opts = NULL;
-
- static int hostapd_ctrl_iface_attach(struct hostapd_data *hapd,
- struct sockaddr_storage *from,
-@@ -134,6 +136,61 @@ static int hostapd_ctrl_iface_new_sta(st
- return 0;
- }
-
-+static char *get_option(char *opt, char *str)
-+{
-+ int len = strlen(str);
-+
-+ if (!strncmp(opt, str, len))
-+ return opt + len;
-+ else
-+ return NULL;
-+}
-+
-+static struct hostapd_config *hostapd_ctrl_iface_config_read(const char *fname)
-+{
-+ struct hostapd_config *conf;
-+ char *opt, *val;
-+
-+ conf = hostapd_config_read(fname);
-+ if (!conf)
-+ return NULL;
-+
-+ for (opt = strtok(reload_opts, " ");
-+ opt;
-+ opt = strtok(NULL, " ")) {
-+
-+ if ((val = get_option(opt, "channel=")))
-+ conf->channel = atoi(val);
-+ else if ((val = get_option(opt, "ht_capab=")))
-+ conf->ht_capab = atoi(val);
-+ else if ((val = get_option(opt, "ht_capab_mask=")))
-+ conf->ht_capab &= atoi(val);
-+ else if ((val = get_option(opt, "sec_chan=")))
-+ conf->secondary_channel = atoi(val);
-+ else if ((val = get_option(opt, "hw_mode=")))
-+ conf->hw_mode = atoi(val);
-+ else if ((val = get_option(opt, "ieee80211n=")))
-+ conf->ieee80211n = atoi(val);
-+ else
-+ break;
-+ }
-+
-+ return conf;
-+}
-+
-+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;
-+
-+ config_read_cb = iface->interfaces->config_read_cb;
-+ iface->interfaces->config_read_cb = hostapd_ctrl_iface_config_read;
-+ reload_opts = txt;
-+
-+ hostapd_reload_config(iface);
-+
-+ iface->interfaces->config_read_cb = config_read_cb;
-+}
-
- #ifdef NEED_AP_MLME
- static int hostapd_ctrl_iface_sa_query(struct hostapd_data *hapd,
-@@ -3564,6 +3621,8 @@ static int hostapd_ctrl_iface_receive_pr
- } else if (os_strncmp(buf, "VENDOR ", 7) == 0) {
- reply_len = hostapd_ctrl_iface_vendor(hapd, buf + 7, reply,
- reply_size);
-+ } else if (os_strncmp(buf, "UPDATE ", 7) == 0) {
-+ hostapd_ctrl_iface_update(hapd, buf + 7);
- } else if (os_strcmp(buf, "ERP_FLUSH") == 0) {
- ieee802_1x_erp_flush(hapd);
- #ifdef RADIUS_SERVER
---- a/src/ap/ctrl_iface_ap.c
-+++ b/src/ap/ctrl_iface_ap.c
-@@ -1023,7 +1023,13 @@ int hostapd_parse_csa_settings(const cha
-
- int hostapd_ctrl_iface_stop_ap(struct hostapd_data *hapd)
- {
-- return hostapd_drv_stop_ap(hapd);
-+ struct hostapd_iface *iface = hapd->iface;
-+ int i;
-+
-+ for (i = 0; i < iface->num_bss; i++)
-+ hostapd_drv_stop_ap(iface->bss[i]);
-+
-+ return 0;
- }
-
-
diff --git a/recipes-wifi/wpa-supplicant/files/patches-2.10.3/370-ap_sta_support.patch b/recipes-wifi/wpa-supplicant/files/patches-2.10.3/370-ap_sta_support.patch
deleted file mode 100644
index 3baad2a..0000000
--- a/recipes-wifi/wpa-supplicant/files/patches-2.10.3/370-ap_sta_support.patch
+++ /dev/null
@@ -1,392 +0,0 @@
---- a/wpa_supplicant/Makefile
-+++ b/wpa_supplicant/Makefile
-@@ -126,6 +126,8 @@ OBJS_c += ../src/utils/common.o
- OBJS_c += ../src/common/cli.o
- OBJS += wmm_ac.o
-
-+OBJS += ../src/common/wpa_ctrl.o
-+
- ifndef CONFIG_OS
- ifdef CONFIG_NATIVE_WINDOWS
- CONFIG_OS=win32
---- a/wpa_supplicant/bss.c
-+++ b/wpa_supplicant/bss.c
-@@ -11,6 +11,7 @@
- #include "utils/common.h"
- #include "utils/eloop.h"
- #include "common/ieee802_11_defs.h"
-+#include "common/ieee802_11_common.h"
- #include "drivers/driver.h"
- #include "eap_peer/eap.h"
- #include "wpa_supplicant_i.h"
-@@ -283,6 +284,10 @@ void calculate_update_time(const struct
- static void wpa_bss_copy_res(struct wpa_bss *dst, struct wpa_scan_res *src,
- struct os_reltime *fetch_time)
- {
-+ struct ieee80211_ht_capabilities *capab;
-+ struct ieee80211_ht_operation *oper;
-+ struct ieee802_11_elems elems;
-+
- dst->flags = src->flags;
- os_memcpy(dst->bssid, src->bssid, ETH_ALEN);
- dst->freq = src->freq;
-@@ -296,6 +301,15 @@ static void wpa_bss_copy_res(struct wpa_
- dst->est_throughput = src->est_throughput;
- dst->snr = src->snr;
-
-+ memset(&elems, 0, sizeof(elems));
-+ ieee802_11_parse_elems((u8 *) (src + 1), src->ie_len, &elems, 0);
-+ capab = (struct ieee80211_ht_capabilities *) elems.ht_capabilities;
-+ oper = (struct ieee80211_ht_operation *) elems.ht_operation;
-+ if (capab)
-+ dst->ht_capab = le_to_host16(capab->ht_capabilities_info);
-+ if (oper)
-+ dst->ht_param = oper->ht_param;
-+
- calculate_update_time(fetch_time, src->age, &dst->last_update);
- }
-
---- a/wpa_supplicant/bss.h
-+++ b/wpa_supplicant/bss.h
-@@ -94,6 +94,10 @@ struct wpa_bss {
- u8 ssid[SSID_MAX_LEN];
- /** Length of SSID */
- size_t ssid_len;
-+ /** HT capabilities */
-+ u16 ht_capab;
-+ /* Five octets of HT Operation Information */
-+ u8 ht_param;
- /** Frequency of the channel in MHz (e.g., 2412 = channel 1) */
- int freq;
- /** Beacon interval in TUs (host byte order) */
---- a/wpa_supplicant/main.c
-+++ b/wpa_supplicant/main.c
-@@ -35,7 +35,7 @@ static void usage(void)
- "vW] [-P<pid file>] "
- "[-g<global ctrl>] \\\n"
- " [-G<group>] \\\n"
-- " -i<ifname> -c<config file> [-C<ctrl>] [-D<driver>] "
-+ " -i<ifname> -c<config file> [-C<ctrl>] [-D<driver>] [-H<hostapd path>] "
- "[-p<driver_param>] \\\n"
- " [-b<br_ifname>] [-e<entropy file>]"
- #ifdef CONFIG_DEBUG_FILE
-@@ -75,6 +75,7 @@ static void usage(void)
- " -g = global ctrl_interface\n"
- " -G = global ctrl_interface group\n"
- " -h = show this help text\n"
-+ " -H = connect to a hostapd instance to manage state changes\n"
- " -i = interface name\n"
- " -I = additional configuration file\n"
- " -K = include keys (passwords, etc.) in debug output\n"
-@@ -202,7 +203,7 @@ int main(int argc, char *argv[])
-
- for (;;) {
- c = getopt(argc, argv,
-- "b:Bc:C:D:de:f:g:G:hi:I:KLMm:No:O:p:P:qsTtuvW");
-+ "b:Bc:C:D:de:f:g:G:hH:i:I:KLMm:No:O:p:P:qsTtuvW");
- if (c < 0)
- break;
- switch (c) {
-@@ -249,6 +250,9 @@ int main(int argc, char *argv[])
- usage();
- exitcode = 0;
- goto out;
-+ case 'H':
-+ iface->hostapd_ctrl = optarg;
-+ break;
- case 'i':
- iface->ifname = optarg;
- break;
---- a/wpa_supplicant/wpa_supplicant.c
-+++ b/wpa_supplicant/wpa_supplicant.c
-@@ -131,6 +131,54 @@ static void wpas_update_fils_connect_par
- static void wpas_update_owe_connect_params(struct wpa_supplicant *wpa_s);
- #endif /* CONFIG_OWE */
-
-+static int hostapd_stop(struct wpa_supplicant *wpa_s)
-+{
-+ const char *cmd = "STOP_AP";
-+ char buf[256];
-+ size_t len = sizeof(buf);
-+
-+ if (wpa_ctrl_request(wpa_s->hostapd, cmd, os_strlen(cmd), buf, &len, NULL) < 0) {
-+ wpa_printf(MSG_ERROR, "\nFailed to stop hostapd AP interfaces\n");
-+ return -1;
-+ }
-+ return 0;
-+}
-+
-+static int hostapd_reload(struct wpa_supplicant *wpa_s, struct wpa_bss *bss)
-+{
-+ char *cmd = NULL;
-+ char buf[256];
-+ size_t len = sizeof(buf);
-+ enum hostapd_hw_mode hw_mode;
-+ u8 channel;
-+ int sec_chan = 0;
-+ int ret;
-+
-+ if (!bss)
-+ return -1;
-+
-+ if (bss->ht_param & HT_INFO_HT_PARAM_STA_CHNL_WIDTH) {
-+ int sec = bss->ht_param & HT_INFO_HT_PARAM_SECONDARY_CHNL_OFF_MASK;
-+ if (sec == HT_INFO_HT_PARAM_SECONDARY_CHNL_ABOVE)
-+ sec_chan = 1;
-+ else if (sec == HT_INFO_HT_PARAM_SECONDARY_CHNL_BELOW)
-+ sec_chan = -1;
-+ }
-+
-+ hw_mode = ieee80211_freq_to_chan(bss->freq, &channel);
-+ if (asprintf(&cmd, "UPDATE channel=%d sec_chan=%d hw_mode=%d",
-+ channel, sec_chan, hw_mode) < 0)
-+ return -1;
-+
-+ ret = wpa_ctrl_request(wpa_s->hostapd, cmd, os_strlen(cmd), buf, &len, NULL);
-+ free(cmd);
-+
-+ if (ret < 0) {
-+ wpa_printf(MSG_ERROR, "\nFailed to reload hostapd AP interfaces\n");
-+ return -1;
-+ }
-+ return 0;
-+}
-
- #ifdef CONFIG_WEP
- /* Configure default/group WEP keys for static WEP */
-@@ -1026,6 +1074,8 @@ void wpa_supplicant_set_state(struct wpa
-
- sme_sched_obss_scan(wpa_s, 1);
-
-+ if (wpa_s->hostapd)
-+ hostapd_reload(wpa_s, wpa_s->current_bss);
- #if defined(CONFIG_FILS) && defined(IEEE8021X_EAPOL)
- if (!fils_hlp_sent && ssid && ssid->eap.erp)
- update_fils_connect_params = true;
-@@ -1036,6 +1086,8 @@ void wpa_supplicant_set_state(struct wpa
- #endif /* CONFIG_OWE */
- } else if (state == WPA_DISCONNECTED || state == WPA_ASSOCIATING ||
- state == WPA_ASSOCIATED) {
-+ if (wpa_s->hostapd)
-+ hostapd_stop(wpa_s);
- wpa_s->new_connection = 1;
- wpa_drv_set_operstate(wpa_s, 0);
- #ifndef IEEE8021X_EAPOL
-@@ -2537,6 +2589,8 @@ void wpa_supplicant_associate(struct wpa
- return;
- }
- wpa_s->current_bss = bss;
-+ if (wpa_s->hostapd)
-+ hostapd_reload(wpa_s, wpa_s->current_bss);
- #else /* CONFIG_MESH */
- wpa_msg(wpa_s, MSG_ERROR,
- "mesh mode support not included in the build");
-@@ -7037,6 +7091,16 @@ static int wpa_supplicant_init_iface(str
- sizeof(wpa_s->bridge_ifname));
- }
-
-+ if (iface->hostapd_ctrl) {
-+ wpa_s->hostapd = wpa_ctrl_open(iface->hostapd_ctrl);
-+ if (!wpa_s->hostapd) {
-+ wpa_printf(MSG_ERROR, "\nFailed to connect to hostapd\n");
-+ return -1;
-+ }
-+ if (hostapd_stop(wpa_s) < 0)
-+ return -1;
-+ }
-+
- /* RSNA Supplicant Key Management - INITIALIZE */
- eapol_sm_notify_portEnabled(wpa_s->eapol, false);
- eapol_sm_notify_portValid(wpa_s->eapol, false);
-@@ -7379,6 +7443,11 @@ static void wpa_supplicant_deinit_iface(
- if (terminate)
- wpa_msg(wpa_s, MSG_INFO, WPA_EVENT_TERMINATING);
-
-+ if (wpa_s->hostapd) {
-+ wpa_ctrl_close(wpa_s->hostapd);
-+ wpa_s->hostapd = NULL;
-+ }
-+
- wpa_supplicant_ctrl_iface_deinit(wpa_s, wpa_s->ctrl_iface);
- wpa_s->ctrl_iface = NULL;
-
---- a/wpa_supplicant/wpa_supplicant_i.h
-+++ b/wpa_supplicant/wpa_supplicant_i.h
-@@ -106,6 +106,11 @@ struct wpa_interface {
- const char *ifname;
-
- /**
-+ * hostapd_ctrl - path to hostapd control socket for notification
-+ */
-+ const char *hostapd_ctrl;
-+
-+ /**
- * bridge_ifname - Optional bridge interface name
- *
- * If the driver interface (ifname) is included in a Linux bridge
-@@ -665,6 +670,8 @@ struct wpa_supplicant {
- #endif /* CONFIG_CTRL_IFACE_BINDER */
- char bridge_ifname[16];
-
-+ struct wpa_ctrl *hostapd;
-+
- char *confname;
- char *confanother;
-
---- a/hostapd/ctrl_iface.c
-+++ b/hostapd/ctrl_iface.c
-@@ -2751,6 +2751,12 @@ static int hostapd_ctrl_iface_chan_switc
- return 0;
- }
-
-+ if (os_strstr(pos, " auto-ht")) {
-+ settings.freq_params.ht_enabled = iface->conf->ieee80211n;
-+ settings.freq_params.vht_enabled = iface->conf->ieee80211ac;
-+ settings.freq_params.he_enabled = iface->conf->ieee80211ax;
-+ }
-+
- for (i = 0; i < iface->num_bss; i++) {
-
- /* Save CHAN_SWITCH VHT, HE, and EHT config */
---- a/src/ap/beacon.c
-+++ b/src/ap/beacon.c
-@@ -2108,11 +2108,6 @@ static int __ieee802_11_set_beacon(struc
- return -1;
- }
-
-- if (hapd->csa_in_progress) {
-- wpa_printf(MSG_ERROR, "Cannot set beacons during CSA period");
-- return -1;
-- }
--
- hapd->beacon_set_done = 1;
-
- if (ieee802_11_build_ap_params(hapd, ¶ms) < 0)
---- a/wpa_supplicant/events.c
-+++ b/wpa_supplicant/events.c
-@@ -5345,6 +5345,60 @@ static void wpas_link_reconfig(struct wp
- }
-
-
-+static void
-+supplicant_ch_switch_started(struct wpa_supplicant *wpa_s,
-+ union wpa_event_data *data)
-+{
-+ char buf[256];
-+ size_t len = sizeof(buf);
-+ char *cmd = NULL;
-+ int width = 20;
-+ int ret;
-+
-+ if (!wpa_s->hostapd)
-+ return;
-+
-+ wpa_msg(wpa_s, MSG_INFO, WPA_EVENT_CHANNEL_SWITCH
-+ "count=%d freq=%d ht_enabled=%d ch_offset=%d ch_width=%s cf1=%d cf2=%d",
-+ data->ch_switch.count,
-+ data->ch_switch.freq,
-+ data->ch_switch.ht_enabled,
-+ data->ch_switch.ch_offset,
-+ channel_width_to_string(data->ch_switch.ch_width),
-+ data->ch_switch.cf1,
-+ data->ch_switch.cf2);
-+
-+ switch (data->ch_switch.ch_width) {
-+ case CHAN_WIDTH_20_NOHT:
-+ case CHAN_WIDTH_20:
-+ width = 20;
-+ break;
-+ case CHAN_WIDTH_40:
-+ width = 40;
-+ break;
-+ case CHAN_WIDTH_80:
-+ width = 80;
-+ break;
-+ case CHAN_WIDTH_160:
-+ case CHAN_WIDTH_80P80:
-+ width = 160;
-+ break;
-+ }
-+
-+ asprintf(&cmd, "CHAN_SWITCH %d %d sec_channel_offset=%d center_freq1=%d center_freq2=%d, bandwidth=%d auto-ht\n",
-+ data->ch_switch.count - 1,
-+ data->ch_switch.freq,
-+ data->ch_switch.ch_offset,
-+ data->ch_switch.cf1,
-+ data->ch_switch.cf2,
-+ width);
-+ ret = wpa_ctrl_request(wpa_s->hostapd, cmd, os_strlen(cmd), buf, &len, NULL);
-+ free(cmd);
-+
-+ if (ret < 0)
-+ wpa_printf(MSG_ERROR, "\nFailed to reload hostapd AP interfaces\n");
-+}
-+
- void supplicant_event(void *ctx, enum wpa_event_type event,
- union wpa_event_data *data)
- {
-@@ -5697,8 +5751,10 @@ void supplicant_event(void *ctx, enum wp
- channel_width_to_string(data->ch_switch.ch_width),
- data->ch_switch.cf1,
- data->ch_switch.cf2);
-- if (event == EVENT_CH_SWITCH_STARTED)
-+ if (event == EVENT_CH_SWITCH_STARTED) {
-+ supplicant_ch_switch_started(wpa_s, data);
- break;
-+ }
-
- wpa_s->assoc_freq = data->ch_switch.freq;
- wpa_s->current_ssid->frequency = data->ch_switch.freq;
---- a/src/drivers/driver.h
-+++ b/src/drivers/driver.h
-@@ -6421,6 +6421,7 @@ union wpa_event_data {
-
- /**
- * struct ch_switch
-+ * @count: Count until channel switch activates
- * @freq: Frequency of new channel in MHz
- * @ht_enabled: Whether this is an HT channel
- * @ch_offset: Secondary channel offset
-@@ -6431,6 +6432,7 @@ union wpa_event_data {
- * @punct_bitmap: Puncturing bitmap
- */
- struct ch_switch {
-+ int count;
- int freq;
- int ht_enabled;
- int ch_offset;
---- a/src/drivers/driver_nl80211_event.c
-+++ b/src/drivers/driver_nl80211_event.c
-@@ -1202,6 +1202,7 @@ static void mlme_event_ch_switch(struct
- struct nlattr *bw, struct nlattr *cf1,
- struct nlattr *cf2,
- struct nlattr *punct_bitmap,
-+ struct nlattr *count,
- int finished)
- {
- struct i802_bss *bss;
-@@ -1265,6 +1266,8 @@ static void mlme_event_ch_switch(struct
- data.ch_switch.cf1 = nla_get_u32(cf1);
- if (cf2)
- data.ch_switch.cf2 = nla_get_u32(cf2);
-+ if (count)
-+ data.ch_switch.count = nla_get_u32(count);
-
- if (finished)
- bss->flink->freq = data.ch_switch.freq;
-@@ -3848,6 +3851,7 @@ static void do_process_drv_event(struct
- tb[NL80211_ATTR_CENTER_FREQ1],
- tb[NL80211_ATTR_CENTER_FREQ2],
- tb[NL80211_ATTR_PUNCT_BITMAP],
-+ tb[NL80211_ATTR_CH_SWITCH_COUNT],
- 0);
- break;
- case NL80211_CMD_CH_SWITCH_NOTIFY:
-@@ -3860,6 +3864,7 @@ static void do_process_drv_event(struct
- tb[NL80211_ATTR_CENTER_FREQ1],
- tb[NL80211_ATTR_CENTER_FREQ2],
- tb[NL80211_ATTR_PUNCT_BITMAP],
-+ NULL,
- 1);
- break;
- case NL80211_CMD_DISCONNECT:
diff --git a/recipes-wifi/wpa-supplicant/files/patches-2.10.3/380-disable_ctrl_iface_mib.patch b/recipes-wifi/wpa-supplicant/files/patches-2.10.3/380-disable_ctrl_iface_mib.patch
index 456599d..54a736f 100644
--- a/recipes-wifi/wpa-supplicant/files/patches-2.10.3/380-disable_ctrl_iface_mib.patch
+++ b/recipes-wifi/wpa-supplicant/files/patches-2.10.3/380-disable_ctrl_iface_mib.patch
@@ -12,7 +12,7 @@
else
--- a/hostapd/ctrl_iface.c
+++ b/hostapd/ctrl_iface.c
-@@ -3377,6 +3377,7 @@ static int hostapd_ctrl_iface_receive_pr
+@@ -3314,6 +3314,7 @@ static int hostapd_ctrl_iface_receive_pr
reply_size);
} else if (os_strcmp(buf, "STATUS-DRIVER") == 0) {
reply_len = hostapd_drv_status(hapd, reply, reply_size);
@@ -20,7 +20,7 @@
} else if (os_strcmp(buf, "MIB") == 0) {
reply_len = ieee802_11_get_mib(hapd, reply, reply_size);
if (reply_len >= 0) {
-@@ -3418,6 +3419,7 @@ static int hostapd_ctrl_iface_receive_pr
+@@ -3355,6 +3356,7 @@ static int hostapd_ctrl_iface_receive_pr
} else if (os_strncmp(buf, "STA-NEXT ", 9) == 0) {
reply_len = hostapd_ctrl_iface_sta_next(hapd, buf + 9, reply,
reply_size);
@@ -30,7 +30,7 @@
reply_len = -1;
--- a/wpa_supplicant/Makefile
+++ b/wpa_supplicant/Makefile
-@@ -985,6 +985,9 @@ ifdef CONFIG_FILS
+@@ -983,6 +983,9 @@ ifdef CONFIG_FILS
OBJS += ../src/ap/fils_hlp.o
endif
ifdef CONFIG_CTRL_IFACE
diff --git a/recipes-wifi/wpa-supplicant/files/patches-2.10.3/420-indicate-features.patch b/recipes-wifi/wpa-supplicant/files/patches-2.10.3/420-indicate-features.patch
index 786b83d..3b28b6e 100644
--- a/recipes-wifi/wpa-supplicant/files/patches-2.10.3/420-indicate-features.patch
+++ b/recipes-wifi/wpa-supplicant/files/patches-2.10.3/420-indicate-features.patch
@@ -37,16 +37,16 @@
#include "crypto/crypto.h"
#include "fst/fst.h"
#include "wpa_supplicant_i.h"
-@@ -203,7 +204,7 @@ int main(int argc, char *argv[])
+@@ -202,7 +203,7 @@ int main(int argc, char *argv[])
for (;;) {
c = getopt(argc, argv,
-- "b:Bc:C:D:de:f:g:G:hH:i:I:KLMm:No:O:p:P:qsTtuvW");
-+ "b:Bc:C:D:de:f:g:G:hH:i:I:KLMm:No:O:p:P:qsTtuv::W");
+- "b:Bc:C:D:de:f:g:G:hi:I:KLMm:No:O:p:P:qsTtuvW");
++ "b:Bc:C:D:de:f:g:G:hi:I:KLMm:No:O:p:P:qsTtuv::W");
if (c < 0)
break;
switch (c) {
-@@ -306,8 +307,12 @@ int main(int argc, char *argv[])
+@@ -302,8 +303,12 @@ int main(int argc, char *argv[])
break;
#endif /* CONFIG_CTRL_IFACE_DBUS_NEW */
case 'v':
diff --git a/recipes-wifi/wpa-supplicant/files/patches-2.10.3/450-scan_wait.patch b/recipes-wifi/wpa-supplicant/files/patches-2.10.3/450-scan_wait.patch
deleted file mode 100644
index 4588689..0000000
--- a/recipes-wifi/wpa-supplicant/files/patches-2.10.3/450-scan_wait.patch
+++ /dev/null
@@ -1,73 +0,0 @@
---- a/hostapd/main.c
-+++ b/hostapd/main.c
-@@ -39,6 +39,8 @@ struct hapd_global {
- };
-
- static struct hapd_global global;
-+static int daemonize = 0;
-+static char *pid_file = NULL;
-
-
- #ifndef CONFIG_NO_HOSTAPD_LOGGER
-@@ -146,6 +148,14 @@ static void hostapd_logger_cb(void *ctx,
- }
- #endif /* CONFIG_NO_HOSTAPD_LOGGER */
-
-+static void hostapd_setup_complete_cb(void *ctx)
-+{
-+ if (daemonize && os_daemonize(pid_file)) {
-+ perror("daemon");
-+ return;
-+ }
-+ daemonize = 0;
-+}
-
- /**
- * hostapd_driver_init - Preparate driver interface
-@@ -217,6 +227,8 @@ static int hostapd_driver_init(struct ho
- }
- #endif /* CONFIG_IEEE80211BE */
-
-+ hapd->setup_complete_cb = hostapd_setup_complete_cb;
-+
- /* Initialize the driver interface */
- if (!(b[0] | b[1] | b[2] | b[3] | b[4] | b[5]))
- b = NULL;
-@@ -497,8 +509,6 @@ static void hostapd_global_deinit(const
- #endif /* CONFIG_NATIVE_WINDOWS */
-
- eap_server_unregister_methods();
--
-- os_daemonize_terminate(pid_file);
- }
-
-
-@@ -524,18 +534,6 @@ static int hostapd_global_run(struct hap
- }
- #endif /* EAP_SERVER_TNC */
-
-- if (daemonize) {
-- if (os_daemonize(pid_file)) {
-- wpa_printf(MSG_ERROR, "daemon: %s", strerror(errno));
-- return -1;
-- }
-- if (eloop_sock_requeue()) {
-- wpa_printf(MSG_ERROR, "eloop_sock_requeue: %s",
-- strerror(errno));
-- return -1;
-- }
-- }
--
- eloop_run();
-
- return 0;
-@@ -739,8 +737,7 @@ int main(int argc, char *argv[])
- struct hapd_interfaces interfaces;
- int ret = 1;
- size_t i, j;
-- int c, debug = 0, daemonize = 0;
-- char *pid_file = NULL;
-+ int c, debug = 0;
- const char *log_file = NULL;
- const char *entropy_file = NULL;
- char **bss_config = NULL, **tmp_bss;
diff --git a/recipes-wifi/wpa-supplicant/files/patches-2.10.3/460-wpa_supplicant-add-new-config-params-to-be-used-with.patch b/recipes-wifi/wpa-supplicant/files/patches-2.10.3/460-wpa_supplicant-add-new-config-params-to-be-used-with.patch
index 4c72868..e50c609 100644
--- a/recipes-wifi/wpa-supplicant/files/patches-2.10.3/460-wpa_supplicant-add-new-config-params-to-be-used-with.patch
+++ b/recipes-wifi/wpa-supplicant/files/patches-2.10.3/460-wpa_supplicant-add-new-config-params-to-be-used-with.patch
@@ -174,7 +174,7 @@
* macsec_policy - Determines the policy for MACsec secure session
--- a/wpa_supplicant/wpa_supplicant.c
+++ b/wpa_supplicant/wpa_supplicant.c
-@@ -4203,6 +4203,12 @@ static void wpas_start_assoc_cb(struct w
+@@ -4149,6 +4149,12 @@ static void wpas_start_assoc_cb(struct w
params.beacon_int = ssid->beacon_int;
else
params.beacon_int = wpa_s->conf->beacon_int;
diff --git a/recipes-wifi/wpa-supplicant/files/patches-2.10.3/464-fix-mesh-obss-check.patch b/recipes-wifi/wpa-supplicant/files/patches-2.10.3/464-fix-mesh-obss-check.patch
index c7e8cf2..4d7d85f 100644
--- a/recipes-wifi/wpa-supplicant/files/patches-2.10.3/464-fix-mesh-obss-check.patch
+++ b/recipes-wifi/wpa-supplicant/files/patches-2.10.3/464-fix-mesh-obss-check.patch
@@ -1,6 +1,6 @@
--- a/wpa_supplicant/wpa_supplicant.c
+++ b/wpa_supplicant/wpa_supplicant.c
-@@ -3094,6 +3094,10 @@ void ibss_mesh_setup_freq(struct wpa_sup
+@@ -3040,6 +3040,10 @@ void ibss_mesh_setup_freq(struct wpa_sup
freq->freq = ssid->frequency;
diff --git a/recipes-wifi/wpa-supplicant/files/patches-2.10.3/500-lto-jobserver-support.patch b/recipes-wifi/wpa-supplicant/files/patches-2.10.3/500-lto-jobserver-support.patch
index 046da42..67312c5 100644
--- a/recipes-wifi/wpa-supplicant/files/patches-2.10.3/500-lto-jobserver-support.patch
+++ b/recipes-wifi/wpa-supplicant/files/patches-2.10.3/500-lto-jobserver-support.patch
@@ -20,7 +20,7 @@
NOBJS = nt_password_hash.o ../src/crypto/ms_funcs.o $(SHA1OBJS)
--- a/wpa_supplicant/Makefile
+++ b/wpa_supplicant/Makefile
-@@ -2039,31 +2039,31 @@ wpa_supplicant_multi.a: .config $(BCHECK
+@@ -2037,31 +2037,31 @@ wpa_supplicant_multi.a: .config $(BCHECK
@$(AR) cr $@ wpa_supplicant_multi.o $(OBJS)
wpa_supplicant: $(BCHECK) $(OBJS) $(EXTRA_progs)
diff --git a/recipes-wifi/wpa-supplicant/files/patches-2.10.3/600-ubus_support.patch b/recipes-wifi/wpa-supplicant/files/patches-2.10.3/600-ubus_support.patch
index f420c18..5b2745a 100644
--- a/recipes-wifi/wpa-supplicant/files/patches-2.10.3/600-ubus_support.patch
+++ b/recipes-wifi/wpa-supplicant/files/patches-2.10.3/600-ubus_support.patch
@@ -41,7 +41,7 @@
struct hostapd_iface * hostapd_alloc_iface(void);
--- a/src/ap/hostapd.c
+++ b/src/ap/hostapd.c
-@@ -455,6 +455,7 @@ void hostapd_free_hapd_data(struct hosta
+@@ -435,6 +435,7 @@ void hostapd_free_hapd_data(struct hosta
hapd->beacon_set_done = 0;
wpa_printf(MSG_DEBUG, "%s(%s)", __func__, hapd->conf->iface);
@@ -49,7 +49,7 @@
accounting_deinit(hapd);
hostapd_deinit_wpa(hapd);
vlan_deinit(hapd);
-@@ -1207,6 +1208,8 @@ static int hostapd_start_beacon(struct h
+@@ -1187,6 +1188,8 @@ static int hostapd_start_beacon(struct h
if (hapd->driver && hapd->driver->set_operstate)
hapd->driver->set_operstate(hapd->drv_priv, 1);
@@ -58,7 +58,7 @@
return 0;
}
-@@ -2295,6 +2298,7 @@ static int hostapd_setup_interface_compl
+@@ -2275,6 +2278,7 @@ static int hostapd_setup_interface_compl
if (err)
goto fail;
@@ -66,7 +66,7 @@
wpa_printf(MSG_DEBUG, "Completing interface initialization");
if (iface->freq) {
#ifdef NEED_AP_MLME
-@@ -2514,6 +2518,7 @@ dfs_offload:
+@@ -2494,6 +2498,7 @@ dfs_offload:
fail:
wpa_printf(MSG_ERROR, "Interface initialization failed");
@@ -74,7 +74,7 @@
if (iface->is_no_ir) {
hostapd_set_state(iface, HAPD_IFACE_NO_IR);
-@@ -3004,6 +3009,7 @@ void hostapd_interface_deinit_free(struc
+@@ -2984,6 +2989,7 @@ void hostapd_interface_deinit_free(struc
(unsigned int) iface->conf->num_bss);
driver = iface->bss[0]->driver;
drv_priv = iface->bss[0]->drv_priv;
@@ -322,7 +322,7 @@
--- a/wpa_supplicant/Makefile
+++ b/wpa_supplicant/Makefile
-@@ -194,6 +194,13 @@ ifdef CONFIG_EAPOL_TEST
+@@ -192,6 +192,13 @@ ifdef CONFIG_EAPOL_TEST
CFLAGS += -Werror -DEAPOL_TEST
endif
@@ -336,7 +336,7 @@
ifdef CONFIG_CODE_COVERAGE
CFLAGS += -O0 -fprofile-arcs -ftest-coverage
LIBS += -lgcov
-@@ -989,6 +996,9 @@ ifdef CONFIG_CTRL_IFACE_MIB
+@@ -987,6 +994,9 @@ ifdef CONFIG_CTRL_IFACE_MIB
CFLAGS += -DCONFIG_CTRL_IFACE_MIB
endif
OBJS += ../src/ap/ctrl_iface_ap.o
@@ -348,7 +348,7 @@
CFLAGS += -DEAP_SERVER -DEAP_SERVER_IDENTITY
--- a/wpa_supplicant/wpa_supplicant.c
+++ b/wpa_supplicant/wpa_supplicant.c
-@@ -7635,6 +7635,8 @@ struct wpa_supplicant * wpa_supplicant_a
+@@ -7566,6 +7566,8 @@ struct wpa_supplicant * wpa_supplicant_a
}
#endif /* CONFIG_P2P */
@@ -357,7 +357,7 @@
return wpa_s;
}
-@@ -7661,6 +7663,8 @@ int wpa_supplicant_remove_iface(struct w
+@@ -7592,6 +7594,8 @@ int wpa_supplicant_remove_iface(struct w
struct wpa_supplicant *parent = wpa_s->parent;
#endif /* CONFIG_MESH */
@@ -366,7 +366,7 @@
/* Remove interface from the global list of interfaces */
prev = global->ifaces;
if (prev == wpa_s) {
-@@ -8007,8 +8011,12 @@ int wpa_supplicant_run(struct wpa_global
+@@ -7938,8 +7942,12 @@ int wpa_supplicant_run(struct wpa_global
eloop_register_signal_terminate(wpa_supplicant_terminate, global);
eloop_register_signal_reconfig(wpa_supplicant_reconfig, global);
@@ -389,7 +389,7 @@
extern const char *const wpa_supplicant_version;
extern const char *const wpa_supplicant_license;
-@@ -324,6 +325,8 @@ struct wpa_global {
+@@ -319,6 +320,8 @@ struct wpa_global {
#endif /* CONFIG_WIFI_DISPLAY */
struct psk_list_entry *add_psk; /* From group formation */
@@ -398,7 +398,7 @@
};
-@@ -655,6 +658,7 @@ struct wpa_supplicant {
+@@ -650,6 +653,7 @@ struct wpa_supplicant {
unsigned char own_addr[ETH_ALEN];
unsigned char perm_addr[ETH_ALEN];
char ifname[100];
@@ -427,16 +427,16 @@
--- a/wpa_supplicant/main.c
+++ b/wpa_supplicant/main.c
-@@ -204,7 +204,7 @@ int main(int argc, char *argv[])
+@@ -203,7 +203,7 @@ int main(int argc, char *argv[])
for (;;) {
c = getopt(argc, argv,
-- "b:Bc:C:D:de:f:g:G:hH:i:I:KLMm:No:O:p:P:qsTtuv::W");
-+ "b:Bc:C:D:de:f:g:G:hH:i:I:KLMm:nNo:O:p:P:qsTtuv::W");
+- "b:Bc:C:D:de:f:g:G:hi:I:KLMm:No:O:p:P:qsTtuv::W");
++ "b:Bc:C:D:de:f:g:G:hi:I:KLMm:nNo:O:p:P:qsTtuv::W");
if (c < 0)
break;
switch (c) {
-@@ -272,6 +272,9 @@ int main(int argc, char *argv[])
+@@ -268,6 +268,9 @@ int main(int argc, char *argv[])
params.conf_p2p_dev = optarg;
break;
#endif /* CONFIG_P2P */
diff --git a/recipes-wifi/wpa-supplicant/files/patches-2.10.3/601-ucode_support.patch b/recipes-wifi/wpa-supplicant/files/patches-2.10.3/601-ucode_support.patch
index ff1a9dd..e0bbf13 100644
--- a/recipes-wifi/wpa-supplicant/files/patches-2.10.3/601-ucode_support.patch
+++ b/recipes-wifi/wpa-supplicant/files/patches-2.10.3/601-ucode_support.patch
@@ -26,7 +26,7 @@
ifdef CONFIG_CODE_COVERAGE
--- a/hostapd/main.c
+++ b/hostapd/main.c
-@@ -991,6 +991,7 @@ int main(int argc, char *argv[])
+@@ -994,6 +994,7 @@ int main(int argc, char *argv[])
}
hostapd_global_ctrl_iface_init(&interfaces);
@@ -34,7 +34,7 @@
if (hostapd_global_run(&interfaces, daemonize, pid_file)) {
wpa_printf(MSG_ERROR, "Failed to start eloop");
-@@ -1000,6 +1001,7 @@ int main(int argc, char *argv[])
+@@ -1003,6 +1004,7 @@ int main(int argc, char *argv[])
ret = 0;
out:
@@ -79,18 +79,27 @@
void *owner;
char *config_fname;
struct hostapd_config *conf;
+@@ -706,6 +713,8 @@ struct hostapd_iface * hostapd_init(stru
+ struct hostapd_iface *
+ hostapd_interface_init_bss(struct hapd_interfaces *interfaces, const char *phy,
+ const char *config_fname, int debug);
++int hostapd_setup_bss(struct hostapd_data *hapd, int first, bool start_beacon);
++void hostapd_bss_deinit(struct hostapd_data *hapd);
+ void hostapd_new_assoc_sta(struct hostapd_data *hapd, struct sta_info *sta,
+ int reassoc);
+ void hostapd_interface_deinit_free(struct hostapd_iface *iface);
--- a/src/ap/hostapd.c
+++ b/src/ap/hostapd.c
-@@ -276,6 +276,8 @@ int hostapd_reload_config(struct hostapd
+@@ -252,6 +252,8 @@ int hostapd_reload_config(struct hostapd
+ struct hostapd_config *newconf, *oldconf;
size_t j;
- int i;
-+ hostapd_ucode_reload_bss(hapd, reconf);
++ hostapd_ucode_reload_bss(hapd);
+
if (iface->config_fname == NULL) {
/* Only in-memory config in use - assume it has been updated */
hostapd_clear_old(iface);
-@@ -455,6 +457,7 @@ void hostapd_free_hapd_data(struct hosta
+@@ -435,6 +437,7 @@ void hostapd_free_hapd_data(struct hosta
hapd->beacon_set_done = 0;
wpa_printf(MSG_DEBUG, "%s(%s)", __func__, hapd->conf->iface);
@@ -98,7 +107,7 @@
hostapd_ubus_free_bss(hapd);
accounting_deinit(hapd);
hostapd_deinit_wpa(hapd);
-@@ -619,6 +622,7 @@ void hostapd_cleanup_iface_partial(struc
+@@ -599,6 +602,7 @@ void hostapd_cleanup_iface_partial(struc
static void hostapd_cleanup_iface(struct hostapd_iface *iface)
{
wpa_printf(MSG_DEBUG, "%s(%p)", __func__, iface);
@@ -106,7 +115,7 @@
eloop_cancel_timeout(channel_list_update_timeout, iface, NULL);
eloop_cancel_timeout(hostapd_interface_setup_failure_handler, iface,
NULL);
-@@ -1209,6 +1213,7 @@ static int hostapd_start_beacon(struct h
+@@ -1189,6 +1193,7 @@ static int hostapd_start_beacon(struct h
hapd->driver->set_operstate(hapd->drv_priv, 1);
hostapd_ubus_add_bss(hapd);
@@ -114,9 +123,28 @@
return 0;
}
+@@ -1211,8 +1216,7 @@ static int hostapd_start_beacon(struct h
+ * initialized. Most of the modules that are initialized here will be
+ * deinitialized in hostapd_cleanup().
+ */
+-static int hostapd_setup_bss(struct hostapd_data *hapd, int first,
+- bool start_beacon)
++int hostapd_setup_bss(struct hostapd_data *hapd, int first, bool start_beacon)
+ {
+ struct hostapd_bss_config *conf = hapd->conf;
+ u8 ssid[SSID_MAX_LEN + 1];
+@@ -2698,7 +2702,7 @@ hostapd_alloc_bss_data(struct hostapd_if
+ }
+
+
+-static void hostapd_bss_deinit(struct hostapd_data *hapd)
++void hostapd_bss_deinit(struct hostapd_data *hapd)
+ {
+ if (!hapd)
+ return;
--- a/wpa_supplicant/Makefile
+++ b/wpa_supplicant/Makefile
-@@ -197,8 +197,20 @@ endif
+@@ -195,8 +195,20 @@ endif
ifdef CONFIG_UBUS
CFLAGS += -DUBUS_SUPPORT
OBJS += ubus.o
@@ -138,7 +166,7 @@
endif
ifdef CONFIG_CODE_COVERAGE
-@@ -999,6 +1011,9 @@ OBJS += ../src/ap/ctrl_iface_ap.o
+@@ -997,6 +1009,9 @@ OBJS += ../src/ap/ctrl_iface_ap.o
ifdef CONFIG_UBUS
OBJS += ../src/ap/ubus.o
endif
@@ -150,7 +178,15 @@
CFLAGS += -DEAP_SERVER -DEAP_SERVER_IDENTITY
--- a/wpa_supplicant/wpa_supplicant.c
+++ b/wpa_supplicant/wpa_supplicant.c
-@@ -7636,6 +7636,7 @@ struct wpa_supplicant * wpa_supplicant_a
+@@ -1044,6 +1044,7 @@ void wpa_supplicant_set_state(struct wpa
+ sme_sched_obss_scan(wpa_s, 0);
+ }
+ wpa_s->wpa_state = state;
++ wpas_ucode_update_state(wpa_s);
+
+ #ifdef CONFIG_BGSCAN
+ if (state == WPA_COMPLETED && wpa_s->current_ssid != wpa_s->bgscan_ssid)
+@@ -7567,6 +7568,7 @@ struct wpa_supplicant * wpa_supplicant_a
#endif /* CONFIG_P2P */
wpas_ubus_add_bss(wpa_s);
@@ -158,7 +194,7 @@
return wpa_s;
}
-@@ -7663,6 +7664,7 @@ int wpa_supplicant_remove_iface(struct w
+@@ -7594,6 +7596,7 @@ int wpa_supplicant_remove_iface(struct w
struct wpa_supplicant *parent = wpa_s->parent;
#endif /* CONFIG_MESH */
@@ -166,7 +202,7 @@
wpas_ubus_free_bss(wpa_s);
/* Remove interface from the global list of interfaces */
-@@ -7973,6 +7975,7 @@ struct wpa_global * wpa_supplicant_init(
+@@ -7904,6 +7907,7 @@ struct wpa_global * wpa_supplicant_init(
eloop_register_timeout(WPA_SUPPLICANT_CLEANUP_INTERVAL, 0,
wpas_periodic, global, NULL);
@@ -174,7 +210,7 @@
return global;
}
-@@ -8011,12 +8014,8 @@ int wpa_supplicant_run(struct wpa_global
+@@ -7942,12 +7946,8 @@ int wpa_supplicant_run(struct wpa_global
eloop_register_signal_terminate(wpa_supplicant_terminate, global);
eloop_register_signal_reconfig(wpa_supplicant_reconfig, global);
@@ -187,7 +223,7 @@
return 0;
}
-@@ -8049,6 +8048,8 @@ void wpa_supplicant_deinit(struct wpa_gl
+@@ -7980,6 +7980,8 @@ void wpa_supplicant_deinit(struct wpa_gl
wpas_notify_supplicant_deinitialized(global);
@@ -206,7 +242,7 @@
extern const char *const wpa_supplicant_version;
extern const char *const wpa_supplicant_license;
-@@ -659,6 +660,7 @@ struct wpa_supplicant {
+@@ -654,6 +655,7 @@ struct wpa_supplicant {
unsigned char perm_addr[ETH_ALEN];
char ifname[100];
struct wpas_ubus_bss ubus;
@@ -216,7 +252,7 @@
#endif /* CONFIG_MATCH_IFACE */
--- a/hostapd/ctrl_iface.c
+++ b/hostapd/ctrl_iface.c
-@@ -4921,6 +4921,7 @@ try_again:
+@@ -4856,6 +4856,7 @@ try_again:
return -1;
}
@@ -224,7 +260,7 @@
wpa_msg_register_cb(hostapd_ctrl_iface_msg_cb);
return 0;
-@@ -5022,6 +5023,7 @@ fail:
+@@ -4957,6 +4958,7 @@ fail:
os_free(fname);
interface->global_ctrl_sock = s;
@@ -232,3 +268,66 @@
eloop_register_read_sock(s, hostapd_global_ctrl_iface_receive,
interface, NULL);
+--- a/src/drivers/driver.h
++++ b/src/drivers/driver.h
+@@ -6426,6 +6426,7 @@ union wpa_event_data {
+
+ /**
+ * struct ch_switch
++ * @count: Count until channel switch activates
+ * @freq: Frequency of new channel in MHz
+ * @ht_enabled: Whether this is an HT channel
+ * @ch_offset: Secondary channel offset
+@@ -6436,6 +6437,7 @@ union wpa_event_data {
+ * @punct_bitmap: Puncturing bitmap
+ */
+ struct ch_switch {
++ int count;
+ int freq;
+ int ht_enabled;
+ int ch_offset;
+--- a/src/drivers/driver_nl80211_event.c
++++ b/src/drivers/driver_nl80211_event.c
+@@ -1202,6 +1202,7 @@ static void mlme_event_ch_switch(struct
+ struct nlattr *bw, struct nlattr *cf1,
+ struct nlattr *cf2,
+ struct nlattr *punct_bitmap,
++ struct nlattr *count,
+ int finished)
+ {
+ struct i802_bss *bss;
+@@ -1265,6 +1266,8 @@ static void mlme_event_ch_switch(struct
+ data.ch_switch.cf1 = nla_get_u32(cf1);
+ if (cf2)
+ data.ch_switch.cf2 = nla_get_u32(cf2);
++ if (count)
++ data.ch_switch.count = nla_get_u32(count);
+
+ if (finished)
+ bss->flink->freq = data.ch_switch.freq;
+@@ -3848,6 +3851,7 @@ static void do_process_drv_event(struct
+ tb[NL80211_ATTR_CENTER_FREQ1],
+ tb[NL80211_ATTR_CENTER_FREQ2],
+ tb[NL80211_ATTR_PUNCT_BITMAP],
++ tb[NL80211_ATTR_CH_SWITCH_COUNT],
+ 0);
+ break;
+ case NL80211_CMD_CH_SWITCH_NOTIFY:
+@@ -3860,6 +3864,7 @@ static void do_process_drv_event(struct
+ tb[NL80211_ATTR_CENTER_FREQ1],
+ tb[NL80211_ATTR_CENTER_FREQ2],
+ tb[NL80211_ATTR_PUNCT_BITMAP],
++ NULL,
+ 1);
+ break;
+ case NL80211_CMD_DISCONNECT:
+--- a/wpa_supplicant/events.c
++++ b/wpa_supplicant/events.c
+@@ -5381,6 +5381,7 @@ void supplicant_event(void *ctx, enum wp
+ event_to_string(event), event);
+ #endif /* CONFIG_NO_STDOUT_DEBUG */
+
++ wpas_ucode_event(wpa_s, event, data);
+ switch (event) {
+ case EVENT_AUTH:
+ #ifdef CONFIG_FST
diff --git a/recipes-wifi/wpa-supplicant/files/patches-2.10.3/700-wifi-reload.patch b/recipes-wifi/wpa-supplicant/files/patches-2.10.3/700-wifi-reload.patch
deleted file mode 100644
index c0e7e4d..0000000
--- a/recipes-wifi/wpa-supplicant/files/patches-2.10.3/700-wifi-reload.patch
+++ /dev/null
@@ -1,232 +0,0 @@
---- a/hostapd/config_file.c
-+++ b/hostapd/config_file.c
-@@ -2420,6 +2420,8 @@ static int hostapd_config_fill(struct ho
- bss->isolate = atoi(pos);
- } else if (os_strcmp(buf, "ap_max_inactivity") == 0) {
- bss->ap_max_inactivity = atoi(pos);
-+ } else if (os_strcmp(buf, "config_id") == 0) {
-+ bss->config_id = os_strdup(pos);
- } else if (os_strcmp(buf, "skip_inactivity_poll") == 0) {
- bss->skip_inactivity_poll = atoi(pos);
- } else if (os_strcmp(buf, "config_id") == 0) {
-@@ -3130,6 +3132,8 @@ static int hostapd_config_fill(struct ho
- }
- } else if (os_strcmp(buf, "acs_exclude_dfs") == 0) {
- conf->acs_exclude_dfs = atoi(pos);
-+ } else if (os_strcmp(buf, "radio_config_id") == 0) {
-+ conf->config_id = os_strdup(pos);
- } else if (os_strcmp(buf, "op_class") == 0) {
- conf->op_class = atoi(pos);
- } else if (os_strcmp(buf, "channel") == 0) {
---- a/src/ap/ap_config.c
-+++ b/src/ap/ap_config.c
-@@ -998,6 +998,7 @@ void hostapd_config_free(struct hostapd_
-
- for (i = 0; i < conf->num_bss; i++)
- hostapd_config_free_bss(conf->bss[i]);
-+ os_free(conf->config_id);
- os_free(conf->bss);
- os_free(conf->supported_rates);
- os_free(conf->basic_rates);
---- a/src/ap/ap_config.h
-+++ b/src/ap/ap_config.h
-@@ -998,6 +998,7 @@ struct eht_phy_capabilities_info {
- struct hostapd_config {
- struct hostapd_bss_config **bss, *last_bss;
- size_t num_bss;
-+ char *config_id;
-
- u16 beacon_int;
- int rts_threshold;
---- a/src/ap/hostapd.c
-+++ b/src/ap/hostapd.c
-@@ -127,7 +127,7 @@ void hostapd_reconfig_encryption(struct
- }
-
-
--static void hostapd_reload_bss(struct hostapd_data *hapd)
-+void hostapd_reload_bss(struct hostapd_data *hapd)
- {
- struct hostapd_ssid *ssid;
-
-@@ -255,6 +255,10 @@ static int hostapd_iface_conf_changed(st
- {
- size_t i;
-
-+ if (newconf->config_id != oldconf->config_id)
-+ if (strcmp(newconf->config_id, oldconf->config_id))
-+ return 1;
-+
- if (newconf->num_bss != oldconf->num_bss)
- return 1;
-
-@@ -268,7 +272,7 @@ static int hostapd_iface_conf_changed(st
- }
-
-
--int hostapd_reload_config(struct hostapd_iface *iface)
-+int hostapd_reload_config(struct hostapd_iface *iface, int reconf)
- {
- struct hapd_interfaces *interfaces = iface->interfaces;
- struct hostapd_data *hapd = iface->bss[0];
-@@ -298,6 +302,9 @@ int hostapd_reload_config(struct hostapd
- char *fname;
- int res;
-
-+ if (reconf)
-+ return -1;
-+
- hostapd_clear_old(iface);
-
- wpa_printf(MSG_DEBUG,
-@@ -324,6 +331,24 @@ int hostapd_reload_config(struct hostapd
- wpa_printf(MSG_ERROR,
- "Failed to enable interface on config reload");
- return res;
-+ } else {
-+ for (j = 0; j < iface->num_bss; j++) {
-+ hapd = iface->bss[j];
-+ if (!hapd->config_id || strcmp(hapd->config_id, newconf->bss[j]->config_id)) {
-+ hostapd_flush_old_stations(iface->bss[j],
-+ WLAN_REASON_PREV_AUTH_NOT_VALID);
-+#ifdef CONFIG_WEP
-+ hostapd_broadcast_wep_clear(iface->bss[j]);
-+#endif
-+
-+#ifndef CONFIG_NO_RADIUS
-+ /* TODO: update dynamic data based on changed configuration
-+ * items (e.g., open/close sockets, etc.) */
-+ radius_client_flush(iface->bss[j]->radius, 0);
-+#endif /* CONFIG_NO_RADIUS */
-+ wpa_printf(MSG_INFO, "bss %zu changed", j);
-+ }
-+ }
- }
- iface->conf = newconf;
-
-@@ -340,6 +365,12 @@ int hostapd_reload_config(struct hostapd
-
- for (j = 0; j < iface->num_bss; j++) {
- hapd = iface->bss[j];
-+ if (hapd->config_id) {
-+ os_free(hapd->config_id);
-+ hapd->config_id = NULL;
-+ }
-+ if (newconf->bss[j]->config_id)
-+ hapd->config_id = strdup(newconf->bss[j]->config_id);
- if (!hapd->conf->config_id || !newconf->bss[j]->config_id ||
- os_strcmp(hapd->conf->config_id,
- newconf->bss[j]->config_id) != 0)
-@@ -1236,8 +1267,7 @@ static int hostapd_start_beacon(struct h
- * initialized. Most of the modules that are initialized here will be
- * deinitialized in hostapd_cleanup().
- */
--static int hostapd_setup_bss(struct hostapd_data *hapd, int first,
-- bool start_beacon)
-+int hostapd_setup_bss(struct hostapd_data *hapd, int first, bool start_beacon)
- {
- struct hostapd_bss_config *conf = hapd->conf;
- u8 ssid[SSID_MAX_LEN + 1];
-@@ -2705,6 +2735,10 @@ hostapd_alloc_bss_data(struct hostapd_if
- hapd->iconf = conf;
- hapd->conf = bss;
- hapd->iface = hapd_iface;
-+ if (bss && bss->config_id)
-+ hapd->config_id = strdup(bss->config_id);
-+ else
-+ hapd->config_id = NULL;
- if (conf)
- hapd->driver = conf->driver;
- hapd->ctrl_sock = -1;
-@@ -2723,7 +2757,7 @@ hostapd_alloc_bss_data(struct hostapd_if
- }
-
-
--static void hostapd_bss_deinit(struct hostapd_data *hapd)
-+void hostapd_bss_deinit(struct hostapd_data *hapd)
- {
- if (!hapd)
- return;
---- a/src/ap/hostapd.h
-+++ b/src/ap/hostapd.h
-@@ -48,7 +48,7 @@ struct mesh_conf;
- struct hostapd_iface;
-
- struct hapd_interfaces {
-- int (*reload_config)(struct hostapd_iface *iface);
-+ int (*reload_config)(struct hostapd_iface *iface, int reconf);
- struct hostapd_config * (*config_read_cb)(const char *config_fname);
- int (*ctrl_iface_init)(struct hostapd_data *hapd);
- void (*ctrl_iface_deinit)(struct hostapd_data *hapd);
-@@ -192,6 +192,7 @@ struct hostapd_data {
- struct hostapd_bss_config *conf;
- struct hostapd_ubus_bss ubus;
- struct hostapd_ucode_bss ucode;
-+ char *config_id;
- int interface_added; /* virtual interface added for this BSS */
- unsigned int started:1;
- unsigned int disabled:1;
-@@ -696,7 +697,9 @@ struct hostapd_iface {
- int hostapd_for_each_interface(struct hapd_interfaces *interfaces,
- int (*cb)(struct hostapd_iface *iface,
- void *ctx), void *ctx);
--int hostapd_reload_config(struct hostapd_iface *iface);
-+int hostapd_reload_config(struct hostapd_iface *iface, int reconf);
-+void hostapd_reload_bss(struct hostapd_data *hapd);
-+void hostapd_bss_deinit(struct hostapd_data *hapd);
- void hostapd_reconfig_encryption(struct hostapd_data *hapd);
- struct hostapd_data *
- hostapd_alloc_bss_data(struct hostapd_iface *hapd_iface,
-@@ -713,6 +716,7 @@ struct hostapd_iface * hostapd_init(stru
- struct hostapd_iface *
- hostapd_interface_init_bss(struct hapd_interfaces *interfaces, const char *phy,
- const char *config_fname, int debug);
-+int hostapd_setup_bss(struct hostapd_data *hapd, int first, bool start_beacon);
- void hostapd_new_assoc_sta(struct hostapd_data *hapd, struct sta_info *sta,
- int reassoc);
- void hostapd_interface_deinit_free(struct hostapd_iface *iface);
---- a/src/drivers/driver_nl80211.c
-+++ b/src/drivers/driver_nl80211.c
-@@ -5322,6 +5322,9 @@ static int wpa_driver_nl80211_set_ap(voi
- if (ret) {
- wpa_printf(MSG_DEBUG, "nl80211: Beacon set failed: %d (%s)",
- ret, strerror(-ret));
-+ if (!bss->flink->beacon_set)
-+ ret = 0;
-+ bss->flink->beacon_set = 0;
- } else {
- link->beacon_set = 1;
- nl80211_set_bss(bss, params->cts_protect, params->preamble,
---- a/hostapd/ctrl_iface.c
-+++ b/hostapd/ctrl_iface.c
-@@ -187,7 +187,7 @@ static int hostapd_ctrl_iface_update(str
- iface->interfaces->config_read_cb = hostapd_ctrl_iface_config_read;
- reload_opts = txt;
-
-- hostapd_reload_config(iface);
-+ hostapd_reload_config(iface, 0);
-
- iface->interfaces->config_read_cb = config_read_cb;
- }
---- a/hostapd/main.c
-+++ b/hostapd/main.c
-@@ -410,7 +410,7 @@ static void handle_term(int sig, void *s
-
- static int handle_reload_iface(struct hostapd_iface *iface, void *ctx)
- {
-- if (hostapd_reload_config(iface) < 0) {
-+ if (hostapd_reload_config(iface, 0) < 0) {
- wpa_printf(MSG_WARNING, "Failed to read new configuration "
- "file - continuing with old.");
- }
---- a/src/ap/wps_hostapd.c
-+++ b/src/ap/wps_hostapd.c
-@@ -315,7 +315,7 @@ static void wps_reload_config(void *eloo
-
- wpa_printf(MSG_DEBUG, "WPS: Reload configuration data");
- if (iface->interfaces == NULL ||
-- iface->interfaces->reload_config(iface) < 0) {
-+ iface->interfaces->reload_config(iface, 1) < 0) {
- wpa_printf(MSG_WARNING, "WPS: Failed to reload the updated "
- "configuration");
- }
diff --git a/recipes-wifi/wpa-supplicant/files/patches-2.10.3/701-reload_config_inline.patch b/recipes-wifi/wpa-supplicant/files/patches-2.10.3/701-reload_config_inline.patch
index 071281e..44c8892 100644
--- a/recipes-wifi/wpa-supplicant/files/patches-2.10.3/701-reload_config_inline.patch
+++ b/recipes-wifi/wpa-supplicant/files/patches-2.10.3/701-reload_config_inline.patch
@@ -1,6 +1,6 @@
--- a/hostapd/config_file.c
+++ b/hostapd/config_file.c
-@@ -4814,7 +4814,12 @@ struct hostapd_config * hostapd_config_r
+@@ -4810,7 +4810,12 @@ struct hostapd_config * hostapd_config_r
int errors = 0;
size_t i;
diff --git a/recipes-wifi/wpa-supplicant/files/patches-2.10.3/710-vlan_no_bridge.patch b/recipes-wifi/wpa-supplicant/files/patches-2.10.3/710-vlan_no_bridge.patch
index 61f33ac..63d1b8a 100644
--- a/recipes-wifi/wpa-supplicant/files/patches-2.10.3/710-vlan_no_bridge.patch
+++ b/recipes-wifi/wpa-supplicant/files/patches-2.10.3/710-vlan_no_bridge.patch
@@ -30,7 +30,7 @@
--- a/hostapd/config_file.c
+++ b/hostapd/config_file.c
-@@ -3355,6 +3355,8 @@ static int hostapd_config_fill(struct ho
+@@ -3351,6 +3351,8 @@ static int hostapd_config_fill(struct ho
#ifndef CONFIG_NO_VLAN
} else if (os_strcmp(buf, "dynamic_vlan") == 0) {
bss->ssid.dynamic_vlan = atoi(pos);
diff --git a/recipes-wifi/wpa-supplicant/files/patches-2.10.3/720-iface_max_num_sta.patch b/recipes-wifi/wpa-supplicant/files/patches-2.10.3/720-iface_max_num_sta.patch
index 5f40aab..1aa4456 100644
--- a/recipes-wifi/wpa-supplicant/files/patches-2.10.3/720-iface_max_num_sta.patch
+++ b/recipes-wifi/wpa-supplicant/files/patches-2.10.3/720-iface_max_num_sta.patch
@@ -1,6 +1,6 @@
--- a/hostapd/config_file.c
+++ b/hostapd/config_file.c
-@@ -2850,6 +2850,14 @@ static int hostapd_config_fill(struct ho
+@@ -2848,6 +2848,14 @@ static int hostapd_config_fill(struct ho
line, bss->max_num_sta, MAX_STA_COUNT);
return 1;
}
@@ -17,7 +17,7 @@
} else if (os_strcmp(buf, "extended_key_id") == 0) {
--- a/src/ap/hostapd.h
+++ b/src/ap/hostapd.h
-@@ -744,6 +744,7 @@ void hostapd_cleanup_cs_params(struct ho
+@@ -742,6 +742,7 @@ void hostapd_cleanup_cs_params(struct ho
void hostapd_periodic_iface(struct hostapd_iface *iface);
int hostapd_owe_trans_get_info(struct hostapd_data *hapd);
void hostapd_ocv_check_csa_sa_query(void *eloop_ctx, void *timeout_ctx);
@@ -27,10 +27,10 @@
void hostapd_cleanup_cca_params(struct hostapd_data *hapd);
--- a/src/ap/hostapd.c
+++ b/src/ap/hostapd.c
-@@ -272,6 +272,30 @@ static int hostapd_iface_conf_changed(st
+@@ -244,6 +244,29 @@ static int hostapd_iface_conf_changed(st
+ return 0;
}
-
+static inline int hostapd_iface_num_sta(struct hostapd_iface *iface)
+{
+ int num_sta = 0;
@@ -54,10 +54,9 @@
+
+ return 0;
+}
-+
- int hostapd_reload_config(struct hostapd_iface *iface, int reconf)
+
+ int hostapd_reload_config(struct hostapd_iface *iface)
{
- struct hapd_interfaces *interfaces = iface->interfaces;
--- a/src/ap/beacon.c
+++ b/src/ap/beacon.c
@@ -1252,7 +1252,7 @@ void handle_probe_req(struct hostapd_dat
@@ -71,7 +70,7 @@
" since no room for additional STA",
--- a/src/ap/ap_config.h
+++ b/src/ap/ap_config.h
-@@ -1037,6 +1037,8 @@ struct hostapd_config {
+@@ -1036,6 +1036,8 @@ struct hostapd_config {
unsigned int track_sta_max_num;
unsigned int track_sta_max_age;
diff --git a/recipes-wifi/wpa-supplicant/files/patches-2.10.3/730-ft_iface.patch b/recipes-wifi/wpa-supplicant/files/patches-2.10.3/730-ft_iface.patch
index 563fe5b..0795ed1 100644
--- a/recipes-wifi/wpa-supplicant/files/patches-2.10.3/730-ft_iface.patch
+++ b/recipes-wifi/wpa-supplicant/files/patches-2.10.3/730-ft_iface.patch
@@ -1,6 +1,6 @@
--- a/hostapd/config_file.c
+++ b/hostapd/config_file.c
-@@ -3009,6 +3009,8 @@ static int hostapd_config_fill(struct ho
+@@ -3007,6 +3007,8 @@ static int hostapd_config_fill(struct ho
wpa_printf(MSG_INFO,
"Line %d: Obsolete peerkey parameter ignored", line);
#ifdef CONFIG_IEEE80211R_AP
diff --git a/recipes-wifi/wpa-supplicant/files/patches-2.10.3/750-qos_map_set_without_interworking.patch b/recipes-wifi/wpa-supplicant/files/patches-2.10.3/750-qos_map_set_without_interworking.patch
index 3e282b4..97c32df 100644
--- a/recipes-wifi/wpa-supplicant/files/patches-2.10.3/750-qos_map_set_without_interworking.patch
+++ b/recipes-wifi/wpa-supplicant/files/patches-2.10.3/750-qos_map_set_without_interworking.patch
@@ -18,7 +18,7 @@
#ifdef CONFIG_HS20
static int hs20_parse_conn_capab(struct hostapd_bss_config *bss, char *buf,
-@@ -4066,10 +4066,10 @@ static int hostapd_config_fill(struct ho
+@@ -4062,10 +4062,10 @@ static int hostapd_config_fill(struct ho
bss->gas_frag_limit = val;
} else if (os_strcmp(buf, "gas_comeback_delay") == 0) {
bss->gas_comeback_delay = atoi(pos);
@@ -32,7 +32,7 @@
os_free(bss->dump_msk_file);
--- a/src/ap/hostapd.c
+++ b/src/ap/hostapd.c
-@@ -1538,6 +1538,7 @@ int hostapd_setup_bss(struct hostapd_dat
+@@ -1486,6 +1486,7 @@ int hostapd_setup_bss(struct hostapd_dat
wpa_printf(MSG_ERROR, "GAS server initialization failed");
return -1;
}
@@ -40,7 +40,7 @@
if (conf->qos_map_set_len &&
hostapd_drv_set_qos_map(hapd, conf->qos_map_set,
-@@ -1545,7 +1546,6 @@ int hostapd_setup_bss(struct hostapd_dat
+@@ -1493,7 +1494,6 @@ int hostapd_setup_bss(struct hostapd_dat
wpa_printf(MSG_ERROR, "Failed to initialize QoS Map");
return -1;
}
diff --git a/recipes-wifi/wpa-supplicant/files/patches-2.10.3/760-dynamic_own_ip.patch b/recipes-wifi/wpa-supplicant/files/patches-2.10.3/760-dynamic_own_ip.patch
index 946b453..2c705a6 100644
--- a/recipes-wifi/wpa-supplicant/files/patches-2.10.3/760-dynamic_own_ip.patch
+++ b/recipes-wifi/wpa-supplicant/files/patches-2.10.3/760-dynamic_own_ip.patch
@@ -98,7 +98,7 @@
hapd->conf->own_ip_addr.af == AF_INET &&
--- a/hostapd/config_file.c
+++ b/hostapd/config_file.c
-@@ -2690,6 +2690,8 @@ static int hostapd_config_fill(struct ho
+@@ -2688,6 +2688,8 @@ static int hostapd_config_fill(struct ho
} else if (os_strcmp(buf, "iapp_interface") == 0) {
wpa_printf(MSG_INFO, "DEPRECATED: iapp_interface not used");
#endif /* CONFIG_IAPP */
diff --git a/recipes-wifi/wpa-supplicant/files/patches-2.10.3/761-shared_das_port.patch b/recipes-wifi/wpa-supplicant/files/patches-2.10.3/761-shared_das_port.patch
index d60764a..cbb2a1b 100644
--- a/recipes-wifi/wpa-supplicant/files/patches-2.10.3/761-shared_das_port.patch
+++ b/recipes-wifi/wpa-supplicant/files/patches-2.10.3/761-shared_das_port.patch
@@ -10,7 +10,7 @@
unsigned int time_window;
--- a/src/ap/hostapd.c
+++ b/src/ap/hostapd.c
-@@ -1475,6 +1475,7 @@ int hostapd_setup_bss(struct hostapd_dat
+@@ -1423,6 +1423,7 @@ int hostapd_setup_bss(struct hostapd_dat
os_memset(&das_conf, 0, sizeof(das_conf));
das_conf.port = conf->radius_das_port;
diff --git a/recipes-wifi/wpa-supplicant/files/patches-2.10.3/770-radius_server.patch b/recipes-wifi/wpa-supplicant/files/patches-2.10.3/770-radius_server.patch
index 6fca86d..e4690c7 100644
--- a/recipes-wifi/wpa-supplicant/files/patches-2.10.3/770-radius_server.patch
+++ b/recipes-wifi/wpa-supplicant/files/patches-2.10.3/770-radius_server.patch
@@ -13,15 +13,15 @@
OBJS += ../src/ap/drv_callbacks.o
--- a/hostapd/main.c
+++ b/hostapd/main.c
-@@ -42,6 +42,7 @@ static struct hapd_global global;
- static int daemonize = 0;
- static char *pid_file = NULL;
+@@ -40,6 +40,7 @@ struct hapd_global {
+
+ static struct hapd_global global;
+extern int radius_main(int argc, char **argv);
#ifndef CONFIG_NO_HOSTAPD_LOGGER
static void hostapd_logger_cb(void *ctx, const u8 *addr, unsigned int module,
-@@ -755,6 +756,11 @@ int main(int argc, char *argv[])
+@@ -758,6 +759,11 @@ int main(int argc, char *argv[])
if (os_program_init())
return -1;
diff --git a/recipes-wifi/wpa-supplicant/files/patches-2.10.3/991-Fix-OpenWrt-13156.patch b/recipes-wifi/wpa-supplicant/files/patches-2.10.3/991-Fix-OpenWrt-13156.patch
new file mode 100644
index 0000000..3f10fb1
--- /dev/null
+++ b/recipes-wifi/wpa-supplicant/files/patches-2.10.3/991-Fix-OpenWrt-13156.patch
@@ -0,0 +1,63 @@
+From 26cd9bafc1d25e602952ee86cd2a5b8c3a995490 Mon Sep 17 00:00:00 2001
+From: Stijn Tintel <stijn@linux-ipv6.be>
+Date: Fri, 28 Jul 2023 16:27:47 +0300
+Subject: [PATCH] Revert "Do prune_association only after the STA is
+ authorized"
+
+Commit e978072baaca ("Do prune_association only after the STA is
+authorized") causes issues when an STA roams from one interface to
+another interface on the same PHY. The mt7915 driver is not able to
+handle this properly. While the commits fixes a DoS, there are other
+devices and drivers with the same limitation, so revert to the orginal
+behavior for now, until we have a better solution in place.
+
+Ref: https://github.com/openwrt/openwrt/issues/13156
+Signed-off-by: Stijn Tintel <stijn@linux-ipv6.be>
+---
+ src/ap/hostapd.c | 14 +++++++++++---
+ src/ap/sta_info.c | 3 ---
+ 2 files changed, 11 insertions(+), 6 deletions(-)
+
+--- a/src/ap/hostapd.c
++++ b/src/ap/hostapd.c
+@@ -3563,6 +3563,8 @@ int hostapd_remove_iface(struct hapd_int
+ void hostapd_new_assoc_sta(struct hostapd_data *hapd, struct sta_info *sta,
+ int reassoc)
+ {
++ int mld_assoc_link_id = -1;
++
+ if (hapd->tkip_countermeasures) {
+ hostapd_drv_sta_deauth(hapd, sta->addr,
+ WLAN_REASON_MICHAEL_MIC_FAILURE);
+@@ -3570,10 +3572,16 @@ void hostapd_new_assoc_sta(struct hostap
+ }
+
+ #ifdef CONFIG_IEEE80211BE
+- if (hapd->conf->mld_ap && sta->mld_info.mld_sta &&
+- sta->mld_assoc_link_id != hapd->mld_link_id)
+- return;
++ if (hapd->conf->mld_ap && sta->mld_info.mld_sta) {
++ if (sta->mld_assoc_link_id == hapd->mld_link_id) {
++ mld_assoc_link_id = sta->mld_assoc_link_id;
++ } else {
++ return;
++ }
++ }
+ #endif /* CONFIG_IEEE80211BE */
++ if (mld_assoc_link_id != -2)
++ hostapd_prune_associations(hapd, sta->addr, mld_assoc_link_id);
+
+ ap_sta_clear_disconnect_timeouts(hapd, sta);
+ sta->post_csa_sa_query = 0;
+--- a/src/ap/sta_info.c
++++ b/src/ap/sta_info.c
+@@ -1318,9 +1318,6 @@ void ap_sta_set_authorized(struct hostap
+ mld_assoc_link_id = -2;
+ }
+ #endif /* CONFIG_IEEE80211BE */
+- if (mld_assoc_link_id != -2)
+- hostapd_prune_associations(hapd, sta->addr,
+- mld_assoc_link_id);
+ sta->flags |= WLAN_STA_AUTHORIZED;
+ } else {
+ sta->flags &= ~WLAN_STA_AUTHORIZED;
diff --git a/recipes-wifi/wpa-supplicant/files/patches-2.10.3/mtk-0001-hostapd-mtk-Add-neighbor-report-and-BSS-Termination-.patch b/recipes-wifi/wpa-supplicant/files/patches-2.10.3/mtk-0001-hostapd-mtk-Add-neighbor-report-and-BSS-Termination-.patch
index 4fa2dfb..ebd951f 100644
--- a/recipes-wifi/wpa-supplicant/files/patches-2.10.3/mtk-0001-hostapd-mtk-Add-neighbor-report-and-BSS-Termination-.patch
+++ b/recipes-wifi/wpa-supplicant/files/patches-2.10.3/mtk-0001-hostapd-mtk-Add-neighbor-report-and-BSS-Termination-.patch
@@ -1,8 +1,8 @@
-From bfca3c43597bf827e4d5faec91ac8f420d33c921 Mon Sep 17 00:00:00 2001
+From 66102db35a595a1b2754e13a95123e55d378332e Mon Sep 17 00:00:00 2001
From: "howard.hsu" <howard-yh.hsu@mediatek.com>
Date: Wed, 19 Jan 2022 19:18:07 +0800
-Subject: [PATCH] hostapd: mtk: Add neighbor report and BSS Termination for MBO
- certification
+Subject: [PATCH 01/40] hostapd: mtk: Add neighbor report and BSS Termination
+ for MBO certification
1. Add hostapd_neighbor_count() and hostapd_neighbor_insert_buffer ()
The first function can count the number of neighbor report in neighbore report
@@ -31,10 +31,10 @@
9 files changed, 223 insertions(+), 4 deletions(-)
diff --git a/hostapd/ctrl_iface.c b/hostapd/ctrl_iface.c
-index 55711ab..fab1287 100644
+index 0a892c9..98d598e 100644
--- a/hostapd/ctrl_iface.c
+++ b/hostapd/ctrl_iface.c
-@@ -1347,6 +1347,11 @@ static int hostapd_ctrl_iface_set(struct hostapd_data *hapd, char *cmd)
+@@ -1290,6 +1290,11 @@ static int hostapd_ctrl_iface_set(struct hostapd_data *hapd, char *cmd)
#endif /* CONFIG_DPP */
} else if (os_strcasecmp(cmd, "setband") == 0) {
ret = hostapd_ctrl_iface_set_band(hapd, value);
@@ -47,7 +47,7 @@
ret = hostapd_set_iface(hapd->iconf, hapd->conf, cmd, value);
if (ret)
diff --git a/src/ap/ap_config.c b/src/ap/ap_config.c
-index 41c7070..7d0de12 100644
+index 298216a..73b33b4 100644
--- a/src/ap/ap_config.c
+++ b/src/ap/ap_config.c
@@ -171,6 +171,7 @@ void hostapd_config_defaults_bss(struct hostapd_bss_config *bss)
@@ -59,7 +59,7 @@
diff --git a/src/ap/ap_config.h b/src/ap/ap_config.h
-index 02fd494..dc60252 100644
+index 44b62f8..774f64e 100644
--- a/src/ap/ap_config.h
+++ b/src/ap/ap_config.h
@@ -558,6 +558,7 @@ struct hostapd_bss_config {
@@ -71,10 +71,10 @@
/* IEEE 802.11u - Interworking */
int interworking;
diff --git a/src/ap/ctrl_iface_ap.c b/src/ap/ctrl_iface_ap.c
-index 50a4dc4..cf1cff4 100644
+index 42c9593..0e173f1 100644
--- a/src/ap/ctrl_iface_ap.c
+++ b/src/ap/ctrl_iface_ap.c
-@@ -1280,6 +1280,10 @@ int hostapd_ctrl_iface_bss_tm_req(struct hostapd_data *hapd,
+@@ -1274,6 +1274,10 @@ int hostapd_ctrl_iface_bss_tm_req(struct hostapd_data *hapd,
wpa_printf(MSG_DEBUG, "Invalid bss_term data");
return -1;
}
@@ -85,7 +85,7 @@
end++;
WPA_PUT_LE16(&bss_term_dur[10], atoi(end));
}
-@@ -1306,14 +1310,25 @@ int hostapd_ctrl_iface_bss_tm_req(struct hostapd_data *hapd,
+@@ -1300,14 +1304,25 @@ int hostapd_ctrl_iface_bss_tm_req(struct hostapd_data *hapd,
req_mode |= WNM_BSS_TM_REQ_ESS_DISASSOC_IMMINENT;
}
diff --git a/recipes-wifi/wpa-supplicant/files/patches-2.10.3/mtk-0002-hostapd-mtk-print-sae-groups-by-hostapd-ctrl.patch b/recipes-wifi/wpa-supplicant/files/patches-2.10.3/mtk-0002-hostapd-mtk-print-sae-groups-by-hostapd-ctrl.patch
index 9a4638d..70486da 100644
--- a/recipes-wifi/wpa-supplicant/files/patches-2.10.3/mtk-0002-hostapd-mtk-print-sae-groups-by-hostapd-ctrl.patch
+++ b/recipes-wifi/wpa-supplicant/files/patches-2.10.3/mtk-0002-hostapd-mtk-print-sae-groups-by-hostapd-ctrl.patch
@@ -1,17 +1,17 @@
-From a1c40b639dfdb7ebfbc4ee75f5d0ea35ff7d17fc Mon Sep 17 00:00:00 2001
+From a915b2e10f342705ab26158efebaa7a7024042ae Mon Sep 17 00:00:00 2001
From: Shayne Chen <shayne.chen@mediatek.com>
Date: Tue, 20 Sep 2022 19:33:45 +0800
-Subject: [PATCH 02/32] hostapd: mtk: print sae groups by hostapd ctrl
+Subject: [PATCH 02/40] hostapd: mtk: print sae groups by hostapd ctrl
---
hostapd/ctrl_iface.c | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/hostapd/ctrl_iface.c b/hostapd/ctrl_iface.c
-index fab1287cd..4624d9afd 100644
+index 98d598e..c03e6f6 100644
--- a/hostapd/ctrl_iface.c
+++ b/hostapd/ctrl_iface.c
-@@ -1421,6 +1421,19 @@ static int hostapd_ctrl_iface_get(struct hostapd_data *hapd, char *cmd,
+@@ -1364,6 +1364,19 @@ static int hostapd_ctrl_iface_get(struct hostapd_data *hapd, char *cmd,
if (os_snprintf_error(buflen, res))
return -1;
return res;
@@ -32,5 +32,5 @@
return -1;
--
-2.39.2
+2.18.0
diff --git a/recipes-wifi/wpa-supplicant/files/patches-2.10.3/mtk-0003-hostapd-mtk-add-support-for-runtime-set-in-band-disc.patch b/recipes-wifi/wpa-supplicant/files/patches-2.10.3/mtk-0003-hostapd-mtk-add-support-for-runtime-set-in-band-disc.patch
index dae1d21..377b04a 100644
--- a/recipes-wifi/wpa-supplicant/files/patches-2.10.3/mtk-0003-hostapd-mtk-add-support-for-runtime-set-in-band-disc.patch
+++ b/recipes-wifi/wpa-supplicant/files/patches-2.10.3/mtk-0003-hostapd-mtk-add-support-for-runtime-set-in-band-disc.patch
@@ -1,7 +1,7 @@
-From 713b2663c91c55f00c6b9bfbf44922306aab6ad3 Mon Sep 17 00:00:00 2001
+From e2ecc047a72c3069c9f05975e612a37864da5885 Mon Sep 17 00:00:00 2001
From: MeiChia Chiu <meichia.chiu@mediatek.com>
Date: Tue, 31 May 2022 21:15:54 +0800
-Subject: [PATCH 03/32] hostapd: mtk: add support for runtime set in-band
+Subject: [PATCH 03/40] hostapd: mtk: add support for runtime set in-band
discovery
Usage:
@@ -21,10 +21,10 @@
5 files changed, 98 insertions(+), 4 deletions(-)
diff --git a/hostapd/ctrl_iface.c b/hostapd/ctrl_iface.c
-index 4624d9afd..d4737958a 100644
+index c03e6f6..ee6d492 100644
--- a/hostapd/ctrl_iface.c
+++ b/hostapd/ctrl_iface.c
-@@ -827,6 +827,69 @@ static int hostapd_ctrl_iface_send_qos_map_conf(struct hostapd_data *hapd,
+@@ -770,6 +770,69 @@ static int hostapd_ctrl_iface_send_qos_map_conf(struct hostapd_data *hapd,
#endif /* CONFIG_INTERWORKING */
@@ -94,7 +94,7 @@
#ifdef CONFIG_WNM_AP
-@@ -3546,6 +3609,9 @@ static int hostapd_ctrl_iface_receive_process(struct hostapd_data *hapd,
+@@ -3483,6 +3546,9 @@ static int hostapd_ctrl_iface_receive_process(struct hostapd_data *hapd,
if (hostapd_ctrl_iface_coloc_intf_req(hapd, buf + 15))
reply_len = -1;
#endif /* CONFIG_WNM_AP */
@@ -105,7 +105,7 @@
reply_len = hostapd_ctrl_iface_get_config(hapd, reply,
reply_size);
diff --git a/hostapd/hostapd_cli.c b/hostapd/hostapd_cli.c
-index 61f8cba12..dfc996d49 100644
+index 61f8cba..dfc996d 100644
--- a/hostapd/hostapd_cli.c
+++ b/hostapd/hostapd_cli.c
@@ -655,6 +655,24 @@ static int hostapd_cli_cmd_wps_config(struct wpa_ctrl *ctrl, int argc,
@@ -143,7 +143,7 @@
};
diff --git a/src/ap/beacon.c b/src/ap/beacon.c
-index 78b347618..f26e5254c 100644
+index 9454cdf..3dc217f 100644
--- a/src/ap/beacon.c
+++ b/src/ap/beacon.c
@@ -1648,6 +1648,8 @@ static u8 * hostapd_fils_discovery(struct hostapd_data *hapd,
@@ -166,7 +166,7 @@
¶ms->fd_frame_tmpl_len);
diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c
-index 70d98e7d4..37e156fc8 100644
+index 99870a6..7867e69 100644
--- a/src/drivers/driver_nl80211.c
+++ b/src/drivers/driver_nl80211.c
@@ -4686,9 +4686,10 @@ static int nl80211_fils_discovery(struct i802_bss *bss, struct nl_msg *msg,
@@ -195,7 +195,7 @@
#endif /* CONFIG_FILS */
diff --git a/src/drivers/nl80211_copy.h b/src/drivers/nl80211_copy.h
-index c59fec406..82860ae32 100644
+index c59fec4..82860ae 100644
--- a/src/drivers/nl80211_copy.h
+++ b/src/drivers/nl80211_copy.h
@@ -7591,6 +7591,7 @@ enum nl80211_fils_discovery_attributes {
@@ -207,5 +207,5 @@
/* keep last */
__NL80211_FILS_DISCOVERY_ATTR_LAST,
--
-2.39.2
+2.18.0
diff --git a/recipes-wifi/wpa-supplicant/files/patches-2.10.3/mtk-0004-hostapd-mtk-Add-mtk_vendor.h.patch b/recipes-wifi/wpa-supplicant/files/patches-2.10.3/mtk-0004-hostapd-mtk-Add-mtk_vendor.h.patch
index e3e5973..11971cd 100644
--- a/recipes-wifi/wpa-supplicant/files/patches-2.10.3/mtk-0004-hostapd-mtk-Add-mtk_vendor.h.patch
+++ b/recipes-wifi/wpa-supplicant/files/patches-2.10.3/mtk-0004-hostapd-mtk-Add-mtk_vendor.h.patch
@@ -1,7 +1,7 @@
-From 4fd45869d5a3ca0e99ce7d14c925828f1b027881 Mon Sep 17 00:00:00 2001
+From bb0f79fb5a04b7ba10bf3ff03634110dd25aa31f Mon Sep 17 00:00:00 2001
From: Howard Hsu <howard-yh.hsu@mediatek.com>
Date: Mon, 30 May 2022 15:04:57 +0800
-Subject: [PATCH 04/32] hostapd: mtk: Add mtk_vendor.h
+Subject: [PATCH 04/40] hostapd: mtk: Add mtk_vendor.h
---
src/common/mtk_vendor.h | 197 ++++++++++++++++++++++++++++++++++++++++
@@ -10,7 +10,7 @@
diff --git a/src/common/mtk_vendor.h b/src/common/mtk_vendor.h
new file mode 100644
-index 000000000..4a19d2fc9
+index 0000000..4a19d2f
--- /dev/null
+++ b/src/common/mtk_vendor.h
@@ -0,0 +1,197 @@
@@ -212,5 +212,5 @@
+};
+#endif /* MTK_VENDOR_H */
--
-2.39.2
+2.18.0
diff --git a/recipes-wifi/wpa-supplicant/files/patches-2.10.3/mtk-0005-hostapd-mtk-Support-EDCCA-hostapd-configuration.patch b/recipes-wifi/wpa-supplicant/files/patches-2.10.3/mtk-0005-hostapd-mtk-Support-EDCCA-hostapd-configuration.patch
index 4f85cf2..272ebf8 100644
--- a/recipes-wifi/wpa-supplicant/files/patches-2.10.3/mtk-0005-hostapd-mtk-Support-EDCCA-hostapd-configuration.patch
+++ b/recipes-wifi/wpa-supplicant/files/patches-2.10.3/mtk-0005-hostapd-mtk-Support-EDCCA-hostapd-configuration.patch
@@ -1,7 +1,7 @@
-From 68bb1314767dfb84656385e38a1c05862312d76e Mon Sep 17 00:00:00 2001
+From 6b321709940a2feaa79a5e6d63f19a83bde83bb7 Mon Sep 17 00:00:00 2001
From: Howard Hsu <howard-yh.hsu@mediatek.com>
Date: Mon, 30 May 2022 16:31:34 +0800
-Subject: [PATCH 05/32] hostapd: mtk: Support EDCCA hostapd configuration
+Subject: [PATCH 05/40] hostapd: mtk: Support EDCCA hostapd configuration
edcca_enable and edcca_compensation and implement edcca related handlers.
---
@@ -20,10 +20,10 @@
12 files changed, 428 insertions(+), 6 deletions(-)
diff --git a/hostapd/config_file.c b/hostapd/config_file.c
-index 45b4d457b..339d6915e 100644
+index 3557bef..1fc6456 100644
--- a/hostapd/config_file.c
+++ b/hostapd/config_file.c
-@@ -4805,6 +4805,40 @@ static int hostapd_config_fill(struct hostapd_config *conf,
+@@ -4803,6 +4803,40 @@ static int hostapd_config_fill(struct hostapd_config *conf,
} else if (os_strcmp(buf, "mld_id") == 0) {
bss->mld_id = atoi(pos);
#endif /* CONFIG_IEEE80211BE */
@@ -65,10 +65,10 @@
wpa_printf(MSG_ERROR,
"Line %d: unknown configuration item '%s'",
diff --git a/hostapd/ctrl_iface.c b/hostapd/ctrl_iface.c
-index d4737958a..d8afba992 100644
+index ee6d492..cad3f86 100644
--- a/hostapd/ctrl_iface.c
+++ b/hostapd/ctrl_iface.c
-@@ -599,6 +599,19 @@ static const char * pbc_status_str(enum pbc_status status)
+@@ -542,6 +542,19 @@ static const char * pbc_status_str(enum pbc_status status)
}
@@ -88,7 +88,7 @@
static int hostapd_ctrl_iface_wps_get_status(struct hostapd_data *hapd,
char *buf, size_t buflen)
{
-@@ -3432,6 +3445,112 @@ static int hostapd_ctrl_iface_driver_cmd(struct hostapd_data *hapd, char *cmd,
+@@ -3369,6 +3382,112 @@ static int hostapd_ctrl_iface_driver_cmd(struct hostapd_data *hapd, char *cmd,
#endif /* ANDROID */
@@ -201,7 +201,7 @@
static int hostapd_ctrl_iface_receive_process(struct hostapd_data *hapd,
char *buf, char *reply,
int reply_size,
-@@ -3987,6 +4106,12 @@ static int hostapd_ctrl_iface_receive_process(struct hostapd_data *hapd,
+@@ -3922,6 +4041,12 @@ static int hostapd_ctrl_iface_receive_process(struct hostapd_data *hapd,
reply_len = hostapd_ctrl_iface_driver_cmd(hapd, buf + 7, reply,
reply_size);
#endif /* ANDROID */
@@ -215,7 +215,7 @@
os_memcpy(reply, "UNKNOWN COMMAND\n", 16);
reply_len = 16;
diff --git a/src/ap/ap_config.c b/src/ap/ap_config.c
-index 7d0de122d..35ea6b7f3 100644
+index 73b33b4..8e56d10 100644
--- a/src/ap/ap_config.c
+++ b/src/ap/ap_config.c
@@ -295,6 +295,9 @@ struct hostapd_config * hostapd_config_defaults(void)
@@ -228,7 +228,7 @@
return conf;
}
-@@ -1009,6 +1012,7 @@ void hostapd_config_free(struct hostapd_config *conf)
+@@ -1008,6 +1011,7 @@ void hostapd_config_free(struct hostapd_config *conf)
#ifdef CONFIG_ACS
os_free(conf->acs_chan_bias);
#endif /* CONFIG_ACS */
@@ -237,10 +237,10 @@
wpabuf_free(conf->civic);
diff --git a/src/ap/ap_config.h b/src/ap/ap_config.h
-index dc6025279..9186fbda8 100644
+index 774f64e..0e829c0 100644
--- a/src/ap/ap_config.h
+++ b/src/ap/ap_config.h
-@@ -1191,8 +1191,38 @@ struct hostapd_config {
+@@ -1190,8 +1190,38 @@ struct hostapd_config {
MBSSID_ENABLED = 1,
ENHANCED_MBSSID_ENABLED = 2,
} mbssid;
@@ -280,7 +280,7 @@
static inline enum oper_chan_width
hostapd_get_oper_chwidth(struct hostapd_config *conf)
diff --git a/src/ap/ap_drv_ops.c b/src/ap/ap_drv_ops.c
-index 75ddfa15c..99ba973aa 100644
+index 75ddfa1..99ba973 100644
--- a/src/ap/ap_drv_ops.c
+++ b/src/ap/ap_drv_ops.c
@@ -1137,3 +1137,27 @@ int hostapd_drv_set_secure_ranging_ctx(struct hostapd_data *hapd,
@@ -312,7 +312,7 @@
+ return hapd->driver->get_edcca(hapd->drv_priv, mode, value);
+}
diff --git a/src/ap/ap_drv_ops.h b/src/ap/ap_drv_ops.h
-index 331b0eaf4..8806217bb 100644
+index 331b0ea..8806217 100644
--- a/src/ap/ap_drv_ops.h
+++ b/src/ap/ap_drv_ops.h
@@ -144,6 +144,10 @@ int hostapd_drv_set_secure_ranging_ctx(struct hostapd_data *hapd,
@@ -327,10 +327,10 @@
#include "drivers/driver.h"
diff --git a/src/ap/hostapd.c b/src/ap/hostapd.c
-index 0b7d2c1f4..b67698a72 100644
+index 96ab02b..b34c9d2 100644
--- a/src/ap/hostapd.c
+++ b/src/ap/hostapd.c
-@@ -2559,6 +2559,13 @@ dfs_offload:
+@@ -2511,6 +2511,13 @@ dfs_offload:
}
#endif /* CONFIG_MESH */
@@ -345,7 +345,7 @@
iface->bss[0]->conf->iface);
if (iface->interfaces && iface->interfaces->terminate_on_error > 0)
diff --git a/src/common/mtk_vendor.h b/src/common/mtk_vendor.h
-index 4a19d2fc9..6121857dd 100644
+index 4a19d2f..6121857 100644
--- a/src/common/mtk_vendor.h
+++ b/src/common/mtk_vendor.h
@@ -30,14 +30,22 @@ enum mtk_vendor_attr_edcca_ctrl {
@@ -378,7 +378,7 @@
[MTK_VENDOR_ATTR_EDCCA_CTRL_MODE] = { .type = NLA_U8 },
[MTK_VENDOR_ATTR_EDCCA_CTRL_PRI20_VAL] = { .type = NLA_U8 },
diff --git a/src/drivers/driver.h b/src/drivers/driver.h
-index 969cbda6b..443c4a79d 100644
+index 969cbda..443c4a7 100644
--- a/src/drivers/driver.h
+++ b/src/drivers/driver.h
@@ -5080,6 +5080,10 @@ struct wpa_driver_ops {
@@ -393,7 +393,7 @@
/**
diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c
-index 37e156fc8..c4e0bc9fe 100644
+index 7867e69..5a3e208 100644
--- a/src/drivers/driver_nl80211.c
+++ b/src/drivers/driver_nl80211.c
@@ -37,6 +37,8 @@
@@ -405,7 +405,7 @@
#ifndef NETLINK_CAP_ACK
-@@ -13635,6 +13637,174 @@ static int testing_nl80211_radio_disable(void *priv, int disabled)
+@@ -13632,6 +13634,174 @@ static int testing_nl80211_radio_disable(void *priv, int disabled)
#endif /* CONFIG_TESTING_OPTIONS */
@@ -580,7 +580,7 @@
const struct wpa_driver_ops wpa_driver_nl80211_ops = {
.name = "nl80211",
-@@ -13789,4 +13959,8 @@ const struct wpa_driver_ops wpa_driver_nl80211_ops = {
+@@ -13786,4 +13956,8 @@ const struct wpa_driver_ops wpa_driver_nl80211_ops = {
.register_frame = testing_nl80211_register_frame,
.radio_disable = testing_nl80211_radio_disable,
#endif /* CONFIG_TESTING_OPTIONS */
@@ -590,7 +590,7 @@
+ .get_edcca = nl80211_get_edcca,
};
diff --git a/src/drivers/driver_nl80211.h b/src/drivers/driver_nl80211.h
-index aee8c4512..51b3fbec8 100644
+index aee8c45..51b3fbe 100644
--- a/src/drivers/driver_nl80211.h
+++ b/src/drivers/driver_nl80211.h
@@ -202,6 +202,7 @@ struct wpa_driver_nl80211_data {
@@ -602,7 +602,7 @@
u64 vendor_scan_cookie;
u64 remain_on_chan_cookie;
diff --git a/src/drivers/driver_nl80211_capa.c b/src/drivers/driver_nl80211_capa.c
-index 5e6406885..5dadf2450 100644
+index 5e64068..5dadf24 100644
--- a/src/drivers/driver_nl80211_capa.c
+++ b/src/drivers/driver_nl80211_capa.c
@@ -18,6 +18,7 @@
@@ -627,5 +627,5 @@
wpa_printf(MSG_DEBUG, "nl80211: Supported vendor command: vendor_id=0x%x subcmd=%u",
--
-2.39.2
+2.18.0
diff --git a/recipes-wifi/wpa-supplicant/files/patches-2.10.3/mtk-0006-hostapd-mtk-Add-hostapd-MU-SET-GET-control.patch b/recipes-wifi/wpa-supplicant/files/patches-2.10.3/mtk-0006-hostapd-mtk-Add-hostapd-MU-SET-GET-control.patch
index 747cafe..7ae38e3 100644
--- a/recipes-wifi/wpa-supplicant/files/patches-2.10.3/mtk-0006-hostapd-mtk-Add-hostapd-MU-SET-GET-control.patch
+++ b/recipes-wifi/wpa-supplicant/files/patches-2.10.3/mtk-0006-hostapd-mtk-Add-hostapd-MU-SET-GET-control.patch
@@ -1,7 +1,7 @@
-From 8bfd442787c9b455d73a157f5879421b0b1ca9d4 Mon Sep 17 00:00:00 2001
+From 2ae0d6fb6b676f76081a9edd3416d93b26091400 Mon Sep 17 00:00:00 2001
From: TomLiu <tomml.liu@mediatek.com>
Date: Tue, 9 Aug 2022 10:23:44 -0700
-Subject: [PATCH 06/32] hostapd: mtk: Add hostapd MU SET/GET control
+Subject: [PATCH 06/40] hostapd: mtk: Add hostapd MU SET/GET control
---
hostapd/config_file.c | 9 +++
@@ -20,10 +20,10 @@
13 files changed, 251 insertions(+)
diff --git a/hostapd/config_file.c b/hostapd/config_file.c
-index 339d6915e..1918d0340 100644
+index 1fc6456..0e67796 100644
--- a/hostapd/config_file.c
+++ b/hostapd/config_file.c
-@@ -3679,6 +3679,15 @@ static int hostapd_config_fill(struct hostapd_config *conf,
+@@ -3677,6 +3677,15 @@ static int hostapd_config_fill(struct hostapd_config *conf,
return 1;
}
conf->mbssid = mbssid;
@@ -40,10 +40,10 @@
} else if (os_strcmp(buf, "max_listen_interval") == 0) {
bss->max_listen_interval = atoi(pos);
diff --git a/hostapd/ctrl_iface.c b/hostapd/ctrl_iface.c
-index d8afba992..342cec820 100644
+index cad3f86..c5d92b0 100644
--- a/hostapd/ctrl_iface.c
+++ b/hostapd/ctrl_iface.c
-@@ -3551,6 +3551,63 @@ hostapd_ctrl_iface_get_edcca(struct hostapd_data *hapd, char *cmd, char *buf,
+@@ -3488,6 +3488,63 @@ hostapd_ctrl_iface_get_edcca(struct hostapd_data *hapd, char *cmd, char *buf,
}
@@ -107,7 +107,7 @@
static int hostapd_ctrl_iface_receive_process(struct hostapd_data *hapd,
char *buf, char *reply,
int reply_size,
-@@ -4112,6 +4169,11 @@ static int hostapd_ctrl_iface_receive_process(struct hostapd_data *hapd,
+@@ -4047,6 +4104,11 @@ static int hostapd_ctrl_iface_receive_process(struct hostapd_data *hapd,
} else if (os_strncmp(buf, "GET_EDCCA ", 10) == 0) {
reply_len = hostapd_ctrl_iface_get_edcca(hapd, buf+10, reply,
reply_size);
@@ -120,7 +120,7 @@
os_memcpy(reply, "UNKNOWN COMMAND\n", 16);
reply_len = 16;
diff --git a/hostapd/hostapd_cli.c b/hostapd/hostapd_cli.c
-index dfc996d49..98892ee9d 100644
+index dfc996d..98892ee 100644
--- a/hostapd/hostapd_cli.c
+++ b/hostapd/hostapd_cli.c
@@ -1400,6 +1400,20 @@ static int hostapd_cli_cmd_driver_flags(struct wpa_ctrl *ctrl, int argc,
@@ -156,7 +156,7 @@
{ "dpp_qr_code", hostapd_cli_cmd_dpp_qr_code, NULL,
"report a scanned DPP URI from a QR Code" },
diff --git a/src/ap/ap_config.c b/src/ap/ap_config.c
-index 35ea6b7f3..5d04e60c1 100644
+index 8e56d10..cf7f563 100644
--- a/src/ap/ap_config.c
+++ b/src/ap/ap_config.c
@@ -281,6 +281,7 @@ struct hostapd_config * hostapd_config_defaults(void)
@@ -168,10 +168,10 @@
/* The third octet of the country string uses an ASCII space character
diff --git a/src/ap/ap_config.h b/src/ap/ap_config.h
-index 9186fbda8..3df378ed2 100644
+index 0e829c0..0bd6254 100644
--- a/src/ap/ap_config.h
+++ b/src/ap/ap_config.h
-@@ -1144,6 +1144,7 @@ struct hostapd_config {
+@@ -1143,6 +1143,7 @@ struct hostapd_config {
u8 he_6ghz_tx_ant_pat;
u8 he_6ghz_reg_pwr_type;
bool require_he;
@@ -180,7 +180,7 @@
/* VHT enable/disable config from CHAN_SWITCH */
diff --git a/src/ap/ap_drv_ops.c b/src/ap/ap_drv_ops.c
-index 99ba973aa..44f494ed9 100644
+index 99ba973..44f494e 100644
--- a/src/ap/ap_drv_ops.c
+++ b/src/ap/ap_drv_ops.c
@@ -1161,3 +1161,17 @@ int hostapd_drv_get_edcca(struct hostapd_data *hapd, const u8 mode, u8 *value)
@@ -202,7 +202,7 @@
+ return hapd->driver->mu_dump(hapd->drv_priv, mu_onoff);
+}
diff --git a/src/ap/ap_drv_ops.h b/src/ap/ap_drv_ops.h
-index 8806217bb..6e0cf814c 100644
+index 8806217..6e0cf81 100644
--- a/src/ap/ap_drv_ops.h
+++ b/src/ap/ap_drv_ops.h
@@ -148,6 +148,8 @@ int hostapd_drv_configure_edcca_enable(struct hostapd_data *hapd);
@@ -215,10 +215,10 @@
#include "drivers/driver.h"
diff --git a/src/ap/hostapd.c b/src/ap/hostapd.c
-index b67698a72..aa0568175 100644
+index b34c9d2..4251699 100644
--- a/src/ap/hostapd.c
+++ b/src/ap/hostapd.c
-@@ -2565,6 +2565,8 @@ dfs_offload:
+@@ -2517,6 +2517,8 @@ dfs_offload:
if (hostapd_drv_configure_edcca_threshold(hapd,
hapd->iconf->edcca_threshold) < 0)
goto fail;
@@ -228,7 +228,7 @@
wpa_printf(MSG_DEBUG, "%s: Setup of interface done.",
iface->bss[0]->conf->iface);
diff --git a/src/common/mtk_vendor.h b/src/common/mtk_vendor.h
-index 6121857dd..60bc4cd4c 100644
+index 6121857..60bc4cd 100644
--- a/src/common/mtk_vendor.h
+++ b/src/common/mtk_vendor.h
@@ -10,6 +10,8 @@ enum mtk_nl80211_vendor_subcmds {
@@ -261,7 +261,7 @@
#define ETH_ALEN 6
diff --git a/src/drivers/driver.h b/src/drivers/driver.h
-index 443c4a79d..1471ba2ef 100644
+index 443c4a7..1471ba2 100644
--- a/src/drivers/driver.h
+++ b/src/drivers/driver.h
@@ -176,6 +176,11 @@ struct hostapd_channel_data {
@@ -292,10 +292,10 @@
/**
diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c
-index c4e0bc9fe..e7bfc35fa 100644
+index 5a3e208..8e8a4fd 100644
--- a/src/drivers/driver_nl80211.c
+++ b/src/drivers/driver_nl80211.c
-@@ -13500,6 +13500,114 @@ fail:
+@@ -13497,6 +13497,114 @@ fail:
}
@@ -410,7 +410,7 @@
#ifdef CONFIG_DPP
static int nl80211_dpp_listen(void *priv, bool enable)
{
-@@ -13950,6 +14058,8 @@ const struct wpa_driver_ops wpa_driver_nl80211_ops = {
+@@ -13947,6 +14055,8 @@ const struct wpa_driver_ops wpa_driver_nl80211_ops = {
.update_connect_params = nl80211_update_connection_params,
.send_external_auth_status = nl80211_send_external_auth_status,
.set_4addr_mode = nl80211_set_4addr_mode,
@@ -420,7 +420,7 @@
.dpp_listen = nl80211_dpp_listen,
#endif /* CONFIG_DPP */
diff --git a/src/drivers/driver_nl80211.h b/src/drivers/driver_nl80211.h
-index 51b3fbec8..bd5d28404 100644
+index 51b3fbe..bd5d284 100644
--- a/src/drivers/driver_nl80211.h
+++ b/src/drivers/driver_nl80211.h
@@ -203,6 +203,7 @@ struct wpa_driver_nl80211_data {
@@ -432,7 +432,7 @@
u64 vendor_scan_cookie;
u64 remain_on_chan_cookie;
diff --git a/src/drivers/driver_nl80211_capa.c b/src/drivers/driver_nl80211_capa.c
-index 5dadf2450..ac66a916b 100644
+index 5dadf24..ac66a91 100644
--- a/src/drivers/driver_nl80211_capa.c
+++ b/src/drivers/driver_nl80211_capa.c
@@ -1113,6 +1113,9 @@ static int wiphy_info_handler(struct nl_msg *msg, void *arg)
@@ -446,5 +446,5 @@
}
--
-2.39.2
+2.18.0
diff --git a/recipes-wifi/wpa-supplicant/files/patches-2.10.3/mtk-0007-hostapd-mtk-Add-three-wire-PTA-ctrl-hostapd-vendor-c.patch b/recipes-wifi/wpa-supplicant/files/patches-2.10.3/mtk-0007-hostapd-mtk-Add-three-wire-PTA-ctrl-hostapd-vendor-c.patch
index 6f55c61..0488ba3 100644
--- a/recipes-wifi/wpa-supplicant/files/patches-2.10.3/mtk-0007-hostapd-mtk-Add-three-wire-PTA-ctrl-hostapd-vendor-c.patch
+++ b/recipes-wifi/wpa-supplicant/files/patches-2.10.3/mtk-0007-hostapd-mtk-Add-three-wire-PTA-ctrl-hostapd-vendor-c.patch
@@ -1,7 +1,7 @@
-From 9b68a2d7cbffa1c1ee28c6a785649d90b621b95b Mon Sep 17 00:00:00 2001
+From 74fde855e7d167f93908a70b50b029c42b796be8 Mon Sep 17 00:00:00 2001
From: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
Date: Fri, 2 Sep 2022 01:03:23 +0800
-Subject: [PATCH 07/32] hostapd: mtk: Add three wire PTA ctrl hostapd vendor
+Subject: [PATCH 07/40] hostapd: mtk: Add three wire PTA ctrl hostapd vendor
command
Signed-off-by: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
@@ -20,10 +20,10 @@
11 files changed, 93 insertions(+)
diff --git a/hostapd/config_file.c b/hostapd/config_file.c
-index 1918d0340..01880249d 100644
+index 0e67796..c716630 100644
--- a/hostapd/config_file.c
+++ b/hostapd/config_file.c
-@@ -4848,6 +4848,10 @@ static int hostapd_config_fill(struct hostapd_config *conf,
+@@ -4846,6 +4846,10 @@ static int hostapd_config_fill(struct hostapd_config *conf,
return 1;
}
conf->edcca_compensation = (s8) val;
@@ -35,7 +35,7 @@
wpa_printf(MSG_ERROR,
"Line %d: unknown configuration item '%s'",
diff --git a/src/ap/ap_config.c b/src/ap/ap_config.c
-index 5d04e60c1..8a1d51382 100644
+index cf7f563..8b11545 100644
--- a/src/ap/ap_config.c
+++ b/src/ap/ap_config.c
@@ -298,6 +298,7 @@ struct hostapd_config * hostapd_config_defaults(void)
@@ -47,10 +47,10 @@
return conf;
}
diff --git a/src/ap/ap_config.h b/src/ap/ap_config.h
-index 3df378ed2..e42656f82 100644
+index 0bd6254..8f4f79e 100644
--- a/src/ap/ap_config.h
+++ b/src/ap/ap_config.h
-@@ -1196,6 +1196,19 @@ struct hostapd_config {
+@@ -1195,6 +1195,19 @@ struct hostapd_config {
u8 edcca_enable;
s8 edcca_compensation;
int *edcca_threshold;
@@ -71,7 +71,7 @@
enum edcca_mode {
diff --git a/src/ap/ap_drv_ops.c b/src/ap/ap_drv_ops.c
-index 44f494ed9..2f15f99f4 100644
+index 44f494e..2f15f99 100644
--- a/src/ap/ap_drv_ops.c
+++ b/src/ap/ap_drv_ops.c
@@ -1175,3 +1175,14 @@ int hostapd_drv_mu_dump(struct hostapd_data *hapd, u8 *mu_onoff)
@@ -90,7 +90,7 @@
+ return hapd->driver->three_wire_ctrl(hapd->drv_priv, hapd->iconf->three_wire_enable);
+}
diff --git a/src/ap/ap_drv_ops.h b/src/ap/ap_drv_ops.h
-index 6e0cf814c..960a110b7 100644
+index 6e0cf81..960a110 100644
--- a/src/ap/ap_drv_ops.h
+++ b/src/ap/ap_drv_ops.h
@@ -150,6 +150,7 @@ int hostapd_drv_configure_edcca_threshold(struct hostapd_data *hapd,
@@ -102,10 +102,10 @@
#include "drivers/driver.h"
diff --git a/src/ap/hostapd.c b/src/ap/hostapd.c
-index aa0568175..eb39b9ae3 100644
+index 4251699..798852e 100644
--- a/src/ap/hostapd.c
+++ b/src/ap/hostapd.c
-@@ -2567,6 +2567,8 @@ dfs_offload:
+@@ -2519,6 +2519,8 @@ dfs_offload:
goto fail;
if (hostapd_drv_mu_ctrl(hapd) < 0)
goto fail;
@@ -115,7 +115,7 @@
wpa_printf(MSG_DEBUG, "%s: Setup of interface done.",
iface->bss[0]->conf->iface);
diff --git a/src/common/mtk_vendor.h b/src/common/mtk_vendor.h
-index 60bc4cd4c..99ecbaf71 100644
+index 60bc4cd..99ecbaf 100644
--- a/src/common/mtk_vendor.h
+++ b/src/common/mtk_vendor.h
@@ -13,6 +13,7 @@ enum mtk_nl80211_vendor_subcmds {
@@ -149,7 +149,7 @@
MTK_VENDOR_ATTR_CSI_CTRL_UNSPEC,
diff --git a/src/drivers/driver.h b/src/drivers/driver.h
-index 1471ba2ef..cd7afef33 100644
+index 1471ba2..cd7afef 100644
--- a/src/drivers/driver.h
+++ b/src/drivers/driver.h
@@ -5097,6 +5097,14 @@ struct wpa_driver_ops {
@@ -168,10 +168,10 @@
/**
diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c
-index e7bfc35fa..86d08a721 100644
+index 8e8a4fd..621515d 100644
--- a/src/drivers/driver_nl80211.c
+++ b/src/drivers/driver_nl80211.c
-@@ -13913,6 +13913,38 @@ static int nl80211_get_edcca(void *priv, const u8 mode, u8 *value)
+@@ -13910,6 +13910,38 @@ static int nl80211_get_edcca(void *priv, const u8 mode, u8 *value)
return ret;
}
@@ -210,14 +210,14 @@
const struct wpa_driver_ops wpa_driver_nl80211_ops = {
.name = "nl80211",
-@@ -14073,4 +14105,5 @@ const struct wpa_driver_ops wpa_driver_nl80211_ops = {
+@@ -14070,4 +14102,5 @@ const struct wpa_driver_ops wpa_driver_nl80211_ops = {
.configure_edcca_enable = nl80211_configure_edcca_enable,
.configure_edcca_threshold = nl80211_configure_edcca_threshold,
.get_edcca = nl80211_get_edcca,
+ .three_wire_ctrl = nl80211_enable_three_wire,
};
diff --git a/src/drivers/driver_nl80211.h b/src/drivers/driver_nl80211.h
-index bd5d28404..99af8b075 100644
+index bd5d284..99af8b0 100644
--- a/src/drivers/driver_nl80211.h
+++ b/src/drivers/driver_nl80211.h
@@ -204,6 +204,7 @@ struct wpa_driver_nl80211_data {
@@ -229,7 +229,7 @@
u64 vendor_scan_cookie;
u64 remain_on_chan_cookie;
diff --git a/src/drivers/driver_nl80211_capa.c b/src/drivers/driver_nl80211_capa.c
-index ac66a916b..3ff47f3e8 100644
+index ac66a91..3ff47f3 100644
--- a/src/drivers/driver_nl80211_capa.c
+++ b/src/drivers/driver_nl80211_capa.c
@@ -1116,6 +1116,9 @@ static int wiphy_info_handler(struct nl_msg *msg, void *arg)
@@ -243,5 +243,5 @@
}
--
-2.39.2
+2.18.0
diff --git a/recipes-wifi/wpa-supplicant/files/patches-2.10.3/mtk-0008-hostapd-mtk-Add-hostapd-iBF-control.patch b/recipes-wifi/wpa-supplicant/files/patches-2.10.3/mtk-0008-hostapd-mtk-Add-hostapd-iBF-control.patch
index 8c1d923..6d807ee 100644
--- a/recipes-wifi/wpa-supplicant/files/patches-2.10.3/mtk-0008-hostapd-mtk-Add-hostapd-iBF-control.patch
+++ b/recipes-wifi/wpa-supplicant/files/patches-2.10.3/mtk-0008-hostapd-mtk-Add-hostapd-iBF-control.patch
@@ -1,7 +1,7 @@
-From 0ec269fc9ad3ceb566093ee1b67ea73da7efa8e4 Mon Sep 17 00:00:00 2001
+From a527e4f9a557f751fa0b3ef8b3d40e5edef56d38 Mon Sep 17 00:00:00 2001
From: mtk27835 <shurong.wen@mediatek.com>
Date: Wed, 7 Sep 2022 14:41:51 -0700
-Subject: [PATCH 08/32] hostapd: mtk: Add hostapd iBF control
+Subject: [PATCH 08/40] hostapd: mtk: Add hostapd iBF control
Signed-off-by: mtk27835 <shurong.wen@mediatek.com>
---
@@ -21,10 +21,10 @@
13 files changed, 224 insertions(+), 1 deletion(-)
diff --git a/hostapd/config_file.c b/hostapd/config_file.c
-index 01880249d..81bfe81d5 100644
+index c716630..dea124a 100644
--- a/hostapd/config_file.c
+++ b/hostapd/config_file.c
-@@ -4852,6 +4852,9 @@ static int hostapd_config_fill(struct hostapd_config *conf,
+@@ -4850,6 +4850,9 @@ static int hostapd_config_fill(struct hostapd_config *conf,
u8 en = atoi(pos);
conf->three_wire_enable = en;
@@ -35,10 +35,10 @@
wpa_printf(MSG_ERROR,
"Line %d: unknown configuration item '%s'",
diff --git a/hostapd/ctrl_iface.c b/hostapd/ctrl_iface.c
-index 342cec820..f2cb7af1e 100644
+index c5d92b0..7d7ebe3 100644
--- a/hostapd/ctrl_iface.c
+++ b/hostapd/ctrl_iface.c
-@@ -3608,6 +3608,30 @@ hostapd_ctrl_iface_get_mu(struct hostapd_data *hapd, char *buf,
+@@ -3545,6 +3545,30 @@ hostapd_ctrl_iface_get_mu(struct hostapd_data *hapd, char *buf,
}
@@ -69,7 +69,7 @@
static int hostapd_ctrl_iface_receive_process(struct hostapd_data *hapd,
char *buf, char *reply,
int reply_size,
-@@ -4174,6 +4198,8 @@ static int hostapd_ctrl_iface_receive_process(struct hostapd_data *hapd,
+@@ -4109,6 +4133,8 @@ static int hostapd_ctrl_iface_receive_process(struct hostapd_data *hapd,
reply_size);
} else if (os_strncmp(buf, "GET_MU", 6) == 0) {
reply_len = hostapd_ctrl_iface_get_mu(hapd, reply, reply_size);
@@ -79,7 +79,7 @@
os_memcpy(reply, "UNKNOWN COMMAND\n", 16);
reply_len = 16;
diff --git a/hostapd/hostapd_cli.c b/hostapd/hostapd_cli.c
-index 98892ee9d..4fa2d323d 100644
+index 98892ee..4fa2d32 100644
--- a/hostapd/hostapd_cli.c
+++ b/hostapd/hostapd_cli.c
@@ -1606,6 +1606,13 @@ static int hostapd_cli_cmd_driver(struct wpa_ctrl *ctrl, int argc, char *argv[])
@@ -106,7 +106,7 @@
};
diff --git a/src/ap/ap_config.c b/src/ap/ap_config.c
-index 8a1d51382..7fd9dce48 100644
+index 8b11545..c9b9683 100644
--- a/src/ap/ap_config.c
+++ b/src/ap/ap_config.c
@@ -299,6 +299,7 @@ struct hostapd_config * hostapd_config_defaults(void)
@@ -118,10 +118,10 @@
return conf;
}
diff --git a/src/ap/ap_config.h b/src/ap/ap_config.h
-index e42656f82..3a3d2b542 100644
+index 8f4f79e..9758439 100644
--- a/src/ap/ap_config.h
+++ b/src/ap/ap_config.h
-@@ -1197,6 +1197,7 @@ struct hostapd_config {
+@@ -1196,6 +1196,7 @@ struct hostapd_config {
s8 edcca_compensation;
int *edcca_threshold;
u8 three_wire_enable;
@@ -129,7 +129,7 @@
};
enum three_wire_mode {
-@@ -1322,6 +1323,7 @@ hostapd_set_oper_centr_freq_seg1_idx(struct hostapd_config *conf,
+@@ -1321,6 +1322,7 @@ hostapd_set_oper_centr_freq_seg1_idx(struct hostapd_config *conf,
conf->vht_oper_centr_freq_seg1_idx = oper_centr_freq_seg1_idx;
}
@@ -138,7 +138,7 @@
int hostapd_mac_comp(const void *a, const void *b);
struct hostapd_config * hostapd_config_defaults(void);
diff --git a/src/ap/ap_drv_ops.c b/src/ap/ap_drv_ops.c
-index 2f15f99f4..41e76aa54 100644
+index 2f15f99..41e76aa 100644
--- a/src/ap/ap_drv_ops.c
+++ b/src/ap/ap_drv_ops.c
@@ -1186,3 +1186,17 @@ int hostapd_drv_three_wire_ctrl(struct hostapd_data *hapd)
@@ -161,7 +161,7 @@
+}
\ No newline at end of file
diff --git a/src/ap/ap_drv_ops.h b/src/ap/ap_drv_ops.h
-index 960a110b7..3f1df5d2c 100644
+index 960a110..3f1df5d 100644
--- a/src/ap/ap_drv_ops.h
+++ b/src/ap/ap_drv_ops.h
@@ -151,6 +151,8 @@ int hostapd_drv_get_edcca(struct hostapd_data *hapd, const u8 mode, u8 *value);
@@ -174,10 +174,10 @@
#include "drivers/driver.h"
diff --git a/src/ap/hostapd.c b/src/ap/hostapd.c
-index eb39b9ae3..4212f3fcd 100644
+index 798852e..a513236 100644
--- a/src/ap/hostapd.c
+++ b/src/ap/hostapd.c
-@@ -2569,6 +2569,8 @@ dfs_offload:
+@@ -2521,6 +2521,8 @@ dfs_offload:
goto fail;
if (hostapd_drv_three_wire_ctrl(hapd) < 0)
goto fail;
@@ -187,7 +187,7 @@
wpa_printf(MSG_DEBUG, "%s: Setup of interface done.",
iface->bss[0]->conf->iface);
diff --git a/src/common/mtk_vendor.h b/src/common/mtk_vendor.h
-index 99ecbaf71..9811f266e 100644
+index 99ecbaf..9811f26 100644
--- a/src/common/mtk_vendor.h
+++ b/src/common/mtk_vendor.h
@@ -13,7 +13,8 @@ enum mtk_nl80211_vendor_subcmds {
@@ -240,7 +240,7 @@
#define CSI_MAX_COUNT 256
#define ETH_ALEN 6
diff --git a/src/drivers/driver.h b/src/drivers/driver.h
-index cd7afef33..7ac02845b 100644
+index cd7afef..7ac0284 100644
--- a/src/drivers/driver.h
+++ b/src/drivers/driver.h
@@ -181,6 +181,11 @@ struct hostapd_channel_data {
@@ -277,10 +277,10 @@
/**
diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c
-index 86d08a721..ec85621ab 100644
+index 621515d..936a4f8 100644
--- a/src/drivers/driver_nl80211.c
+++ b/src/drivers/driver_nl80211.c
-@@ -13946,6 +13946,112 @@ static int nl80211_enable_three_wire(void *priv, const u8 three_wire_enable)
+@@ -13943,6 +13943,112 @@ static int nl80211_enable_three_wire(void *priv, const u8 three_wire_enable)
return ret;
}
@@ -393,7 +393,7 @@
const struct wpa_driver_ops wpa_driver_nl80211_ops = {
.name = "nl80211",
.desc = "Linux nl80211/cfg80211",
-@@ -14106,4 +14212,6 @@ const struct wpa_driver_ops wpa_driver_nl80211_ops = {
+@@ -14103,4 +14209,6 @@ const struct wpa_driver_ops wpa_driver_nl80211_ops = {
.configure_edcca_threshold = nl80211_configure_edcca_threshold,
.get_edcca = nl80211_get_edcca,
.three_wire_ctrl = nl80211_enable_three_wire,
@@ -401,7 +401,7 @@
+ .ibf_dump = nl80211_ibf_dump,
};
diff --git a/src/drivers/driver_nl80211.h b/src/drivers/driver_nl80211.h
-index 99af8b075..4e64e7d31 100644
+index 99af8b0..4e64e7d 100644
--- a/src/drivers/driver_nl80211.h
+++ b/src/drivers/driver_nl80211.h
@@ -205,6 +205,7 @@ struct wpa_driver_nl80211_data {
@@ -413,7 +413,7 @@
u64 vendor_scan_cookie;
u64 remain_on_chan_cookie;
diff --git a/src/drivers/driver_nl80211_capa.c b/src/drivers/driver_nl80211_capa.c
-index 3ff47f3e8..7ad15bafd 100644
+index 3ff47f3..7ad15ba 100644
--- a/src/drivers/driver_nl80211_capa.c
+++ b/src/drivers/driver_nl80211_capa.c
@@ -1119,6 +1119,9 @@ static int wiphy_info_handler(struct nl_msg *msg, void *arg)
@@ -427,5 +427,5 @@
}
--
-2.39.2
+2.18.0
diff --git a/recipes-wifi/wpa-supplicant/files/patches-2.10.3/mtk-0009-hostapd-mtk-Do-not-include-HE-capab-IE-if-associated.patch b/recipes-wifi/wpa-supplicant/files/patches-2.10.3/mtk-0009-hostapd-mtk-Do-not-include-HE-capab-IE-if-associated.patch
index c22efa9..40fccf5 100644
--- a/recipes-wifi/wpa-supplicant/files/patches-2.10.3/mtk-0009-hostapd-mtk-Do-not-include-HE-capab-IE-if-associated.patch
+++ b/recipes-wifi/wpa-supplicant/files/patches-2.10.3/mtk-0009-hostapd-mtk-Do-not-include-HE-capab-IE-if-associated.patch
@@ -1,7 +1,7 @@
-From 63e4c07d235e07d0616ecb1328067f7157271c30 Mon Sep 17 00:00:00 2001
+From 46e29c26ddaa503b6af4dc33784a2998c453d6c9 Mon Sep 17 00:00:00 2001
From: Howard Hsu <howard-yh.hsu@mediatek.com>
Date: Thu, 22 Sep 2022 16:08:09 +0800
-Subject: [PATCH 09/32] hostapd: mtk: Do not include HE capab IE if associated
+Subject: [PATCH 09/40] hostapd: mtk: Do not include HE capab IE if associated
sta's HE capab IE is invalid
---
@@ -9,7 +9,7 @@
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/ap/ieee802_11.c b/src/ap/ieee802_11.c
-index db48b7cb7..1bf5bea9d 100644
+index db48b7c..1bf5bea 100644
--- a/src/ap/ieee802_11.c
+++ b/src/ap/ieee802_11.c
@@ -4843,7 +4843,8 @@ static u16 send_assoc_resp(struct hostapd_data *hapd, struct sta_info *sta,
@@ -23,5 +23,5 @@
p = hostapd_eid_he_operation(hapd, p);
p = hostapd_eid_cca(hapd, p);
--
-2.39.2
+2.18.0
diff --git a/recipes-wifi/wpa-supplicant/files/patches-2.10.3/mtk-0010-hostapd-mtk-Add-DFS-detection-mode.patch b/recipes-wifi/wpa-supplicant/files/patches-2.10.3/mtk-0010-hostapd-mtk-Add-DFS-detection-mode.patch
index 6bb78ff..1b4dadf 100644
--- a/recipes-wifi/wpa-supplicant/files/patches-2.10.3/mtk-0010-hostapd-mtk-Add-DFS-detection-mode.patch
+++ b/recipes-wifi/wpa-supplicant/files/patches-2.10.3/mtk-0010-hostapd-mtk-Add-DFS-detection-mode.patch
@@ -1,7 +1,7 @@
-From 28af790c74e862e0c23ced4e458e4149e69a1427 Mon Sep 17 00:00:00 2001
+From a257091386c0bf12de2934730b874d240f34d1bb Mon Sep 17 00:00:00 2001
From: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
Date: Mon, 20 Feb 2023 14:55:49 +0800
-Subject: [PATCH 10/32] hostapd: mtk: Add DFS detection mode
+Subject: [PATCH 10/40] hostapd: mtk: Add DFS detection mode
Add DFS detection mode for testing radar detection rate.
If DFS detection mode is on, AP will not switch channels when receiving
@@ -17,10 +17,10 @@
4 files changed, 50 insertions(+)
diff --git a/hostapd/config_file.c b/hostapd/config_file.c
-index 81bfe81d5..d4eed008c 100644
+index dea124a..a4a8e71 100644
--- a/hostapd/config_file.c
+++ b/hostapd/config_file.c
-@@ -4855,6 +4855,10 @@ static int hostapd_config_fill(struct hostapd_config *conf,
+@@ -4853,6 +4853,10 @@ static int hostapd_config_fill(struct hostapd_config *conf,
} else if (os_strcmp(buf, "ibf_enable") == 0) { /*ibf setting is per device*/
int val = atoi(pos);
conf->ibf_enable = !!val;
@@ -32,10 +32,10 @@
wpa_printf(MSG_ERROR,
"Line %d: unknown configuration item '%s'",
diff --git a/hostapd/ctrl_iface.c b/hostapd/ctrl_iface.c
-index f2cb7af1e..0d978be7e 100644
+index 7d7ebe3..d8f6663 100644
--- a/hostapd/ctrl_iface.c
+++ b/hostapd/ctrl_iface.c
-@@ -3632,6 +3632,26 @@ hostapd_ctrl_iface_get_ibf(struct hostapd_data *hapd, char *buf,
+@@ -3569,6 +3569,26 @@ hostapd_ctrl_iface_get_ibf(struct hostapd_data *hapd, char *buf,
}
@@ -62,7 +62,7 @@
static int hostapd_ctrl_iface_receive_process(struct hostapd_data *hapd,
char *buf, char *reply,
int reply_size,
-@@ -4200,6 +4220,9 @@ static int hostapd_ctrl_iface_receive_process(struct hostapd_data *hapd,
+@@ -4135,6 +4155,9 @@ static int hostapd_ctrl_iface_receive_process(struct hostapd_data *hapd,
reply_len = hostapd_ctrl_iface_get_mu(hapd, reply, reply_size);
} else if (os_strncmp(buf, "GET_IBF", 7) == 0) {
reply_len = hostapd_ctrl_iface_get_ibf(hapd, reply, reply_size);
@@ -73,10 +73,10 @@
os_memcpy(reply, "UNKNOWN COMMAND\n", 16);
reply_len = 16;
diff --git a/src/ap/ap_config.h b/src/ap/ap_config.h
-index 3a3d2b542..7b3e21f7b 100644
+index 9758439..c50c2e2 100644
--- a/src/ap/ap_config.h
+++ b/src/ap/ap_config.h
-@@ -1198,6 +1198,7 @@ struct hostapd_config {
+@@ -1197,6 +1197,7 @@ struct hostapd_config {
int *edcca_threshold;
u8 three_wire_enable;
u8 ibf_enable;
@@ -84,7 +84,7 @@
};
enum three_wire_mode {
-@@ -1212,6 +1213,18 @@ enum three_wire_mode {
+@@ -1211,6 +1212,18 @@ enum three_wire_mode {
NUM_THREE_WIRE_MODE - 1
};
@@ -104,7 +104,7 @@
EDCCA_MODE_FORCE_DISABLE = 0,
EDCCA_MODE_AUTO = 1,
diff --git a/src/ap/dfs.c b/src/ap/dfs.c
-index a19afb03f..644a7eae7 100644
+index a19afb0..644a7ea 100644
--- a/src/ap/dfs.c
+++ b/src/ap/dfs.c
@@ -1322,6 +1322,11 @@ hostapd_dfs_background_start_channel_switch(struct hostapd_iface *iface,
@@ -132,5 +132,5 @@
if (hostapd_csa_in_progress(iface))
return 0;
--
-2.39.2
+2.18.0
diff --git a/recipes-wifi/wpa-supplicant/files/patches-2.10.3/mtk-0011-hostapd-mtk-Add-DFS-offchan-channel-switch.patch b/recipes-wifi/wpa-supplicant/files/patches-2.10.3/mtk-0011-hostapd-mtk-Add-DFS-offchan-channel-switch.patch
index 058e0d5..11b11fc 100644
--- a/recipes-wifi/wpa-supplicant/files/patches-2.10.3/mtk-0011-hostapd-mtk-Add-DFS-offchan-channel-switch.patch
+++ b/recipes-wifi/wpa-supplicant/files/patches-2.10.3/mtk-0011-hostapd-mtk-Add-DFS-offchan-channel-switch.patch
@@ -1,7 +1,7 @@
-From 575a8605a68d47f7ecf45ab81f704cc49a8aef65 Mon Sep 17 00:00:00 2001
+From 4802aabaad0a2e7a02d32a365f6d8fec344d264c Mon Sep 17 00:00:00 2001
From: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
Date: Mon, 20 Feb 2023 14:56:55 +0800
-Subject: [PATCH 11/32] hostapd: mtk: Add DFS offchan channel switch
+Subject: [PATCH 11/40] hostapd: mtk: Add DFS offchan channel switch
Add DFS background chain channel switch command for testing purpose.
This feature is implemented via hostapd_cli command.
@@ -16,10 +16,10 @@
3 files changed, 96 insertions(+), 16 deletions(-)
diff --git a/hostapd/ctrl_iface.c b/hostapd/ctrl_iface.c
-index 0d978be7e..78eb80bf0 100644
+index d8f6663..2399979 100644
--- a/hostapd/ctrl_iface.c
+++ b/hostapd/ctrl_iface.c
-@@ -3652,6 +3652,76 @@ hostapd_ctrl_iface_set_dfs_detect_mode(struct hostapd_data *hapd, char *value,
+@@ -3589,6 +3589,76 @@ hostapd_ctrl_iface_set_dfs_detect_mode(struct hostapd_data *hapd, char *value,
}
@@ -96,7 +96,7 @@
static int hostapd_ctrl_iface_receive_process(struct hostapd_data *hapd,
char *buf, char *reply,
int reply_size,
-@@ -4223,6 +4293,8 @@ static int hostapd_ctrl_iface_receive_process(struct hostapd_data *hapd,
+@@ -4158,6 +4228,8 @@ static int hostapd_ctrl_iface_receive_process(struct hostapd_data *hapd,
} else if (os_strncmp(buf, "DFS_DETECT_MODE ", 16) == 0) {
reply_len = hostapd_ctrl_iface_set_dfs_detect_mode(hapd, buf + 16,
reply, reply_size);
@@ -106,7 +106,7 @@
os_memcpy(reply, "UNKNOWN COMMAND\n", 16);
reply_len = 16;
diff --git a/src/ap/dfs.c b/src/ap/dfs.c
-index 644a7eae7..48c5fc917 100644
+index 644a7ea..48c5fc9 100644
--- a/src/ap/dfs.c
+++ b/src/ap/dfs.c
@@ -19,13 +19,6 @@
@@ -156,7 +156,7 @@
if (!iface->conf->ieee80211ac && !iface->conf->ieee80211ax)
return;
diff --git a/src/ap/dfs.h b/src/ap/dfs.h
-index 606c1b393..c2556d2d9 100644
+index 606c1b3..c2556d2 100644
--- a/src/ap/dfs.h
+++ b/src/ap/dfs.h
@@ -9,6 +9,12 @@
@@ -188,5 +188,5 @@
#endif /* DFS_H */
--
-2.39.2
+2.18.0
diff --git a/recipes-wifi/wpa-supplicant/files/patches-2.10.3/mtk-0012-hostapd-mtk-Add-amsdu-set-get-ctrl.patch b/recipes-wifi/wpa-supplicant/files/patches-2.10.3/mtk-0012-hostapd-mtk-Add-amsdu-set-get-ctrl.patch
index b59fffc..aa32d0f 100644
--- a/recipes-wifi/wpa-supplicant/files/patches-2.10.3/mtk-0012-hostapd-mtk-Add-amsdu-set-get-ctrl.patch
+++ b/recipes-wifi/wpa-supplicant/files/patches-2.10.3/mtk-0012-hostapd-mtk-Add-amsdu-set-get-ctrl.patch
@@ -1,7 +1,7 @@
-From ae49d6fffebb8314cc36eb3ba2241f0e70ae8ce6 Mon Sep 17 00:00:00 2001
+From 4f54451e436ca42946b3f0f294b6e784d2f61862 Mon Sep 17 00:00:00 2001
From: Evelyn Tsai <evelyn.tsai@mediatek.com>
Date: Fri, 16 Dec 2022 03:57:11 +0800
-Subject: [PATCH 12/32] hostapd: mtk: Add amsdu set get ctrl
+Subject: [PATCH 12/40] hostapd: mtk: Add amsdu set get ctrl
---
hostapd/config_file.c | 9 +++
@@ -20,10 +20,10 @@
13 files changed, 207 insertions(+), 1 deletion(-)
diff --git a/hostapd/config_file.c b/hostapd/config_file.c
-index d4eed008c..ecd290717 100644
+index a4a8e71..d17e50e 100644
--- a/hostapd/config_file.c
+++ b/hostapd/config_file.c
-@@ -4859,6 +4859,15 @@ static int hostapd_config_fill(struct hostapd_config *conf,
+@@ -4857,6 +4857,15 @@ static int hostapd_config_fill(struct hostapd_config *conf,
u8 en = strtol(pos, NULL, 10);
conf->dfs_detect_mode = en;
@@ -40,10 +40,10 @@
wpa_printf(MSG_ERROR,
"Line %d: unknown configuration item '%s'",
diff --git a/hostapd/ctrl_iface.c b/hostapd/ctrl_iface.c
-index 78eb80bf0..ed17211e0 100644
+index 2399979..c54cbb9 100644
--- a/hostapd/ctrl_iface.c
+++ b/hostapd/ctrl_iface.c
-@@ -3722,6 +3722,30 @@ hostapd_ctrl_iface_set_offchan_ctrl(struct hostapd_data *hapd, char *cmd,
+@@ -3659,6 +3659,30 @@ hostapd_ctrl_iface_set_offchan_ctrl(struct hostapd_data *hapd, char *cmd,
}
@@ -74,7 +74,7 @@
static int hostapd_ctrl_iface_receive_process(struct hostapd_data *hapd,
char *buf, char *reply,
int reply_size,
-@@ -4295,6 +4319,8 @@ static int hostapd_ctrl_iface_receive_process(struct hostapd_data *hapd,
+@@ -4230,6 +4254,8 @@ static int hostapd_ctrl_iface_receive_process(struct hostapd_data *hapd,
reply, reply_size);
} else if (os_strncmp(buf, "SET_OFFCHAN_CTRL", 16) == 0) {
reply_len = hostapd_ctrl_iface_set_offchan_ctrl(hapd, buf + 16, reply, reply_size);
@@ -84,7 +84,7 @@
os_memcpy(reply, "UNKNOWN COMMAND\n", 16);
reply_len = 16;
diff --git a/hostapd/hostapd_cli.c b/hostapd/hostapd_cli.c
-index 4fa2d323d..d59373062 100644
+index 4fa2d32..d593730 100644
--- a/hostapd/hostapd_cli.c
+++ b/hostapd/hostapd_cli.c
@@ -1613,6 +1613,13 @@ static int hostapd_cli_cmd_get_ibf(struct wpa_ctrl *ctrl, int argc,
@@ -111,7 +111,7 @@
};
diff --git a/src/ap/ap_config.c b/src/ap/ap_config.c
-index 7fd9dce48..83e2ea121 100644
+index c9b9683..f519a76 100644
--- a/src/ap/ap_config.c
+++ b/src/ap/ap_config.c
@@ -300,6 +300,7 @@ struct hostapd_config * hostapd_config_defaults(void)
@@ -123,10 +123,10 @@
return conf;
}
diff --git a/src/ap/ap_config.h b/src/ap/ap_config.h
-index 7b3e21f7b..94056157b 100644
+index c50c2e2..b8f6680 100644
--- a/src/ap/ap_config.h
+++ b/src/ap/ap_config.h
-@@ -1199,6 +1199,7 @@ struct hostapd_config {
+@@ -1198,6 +1198,7 @@ struct hostapd_config {
u8 three_wire_enable;
u8 ibf_enable;
u8 dfs_detect_mode;
@@ -135,7 +135,7 @@
enum three_wire_mode {
diff --git a/src/ap/ap_drv_ops.c b/src/ap/ap_drv_ops.c
-index 41e76aa54..a7226cfa9 100644
+index 41e76aa..a7226cf 100644
--- a/src/ap/ap_drv_ops.c
+++ b/src/ap/ap_drv_ops.c
@@ -1199,4 +1199,18 @@ int hostapd_drv_ibf_dump(struct hostapd_data *hapd, u8 *ibf_enable)
@@ -159,7 +159,7 @@
}
\ No newline at end of file
diff --git a/src/ap/ap_drv_ops.h b/src/ap/ap_drv_ops.h
-index 3f1df5d2c..422cb5222 100644
+index 3f1df5d..422cb52 100644
--- a/src/ap/ap_drv_ops.h
+++ b/src/ap/ap_drv_ops.h
@@ -153,6 +153,8 @@ int hostapd_drv_mu_dump(struct hostapd_data *hapd, u8 *mu_onoff);
@@ -172,10 +172,10 @@
#include "drivers/driver.h"
diff --git a/src/ap/hostapd.c b/src/ap/hostapd.c
-index 4212f3fcd..abadd1ad0 100644
+index a513236..24e5df8 100644
--- a/src/ap/hostapd.c
+++ b/src/ap/hostapd.c
-@@ -2571,6 +2571,8 @@ dfs_offload:
+@@ -2523,6 +2523,8 @@ dfs_offload:
goto fail;
if (hostapd_drv_ibf_ctrl(hapd) < 0)
goto fail;
@@ -185,7 +185,7 @@
wpa_printf(MSG_DEBUG, "%s: Setup of interface done.",
iface->bss[0]->conf->iface);
diff --git a/src/common/mtk_vendor.h b/src/common/mtk_vendor.h
-index 9811f266e..7b4d7c11a 100644
+index 9811f26..7b4d7c1 100644
--- a/src/common/mtk_vendor.h
+++ b/src/common/mtk_vendor.h
@@ -170,7 +170,6 @@ enum mtk_vendor_attr_wireless_ctrl {
@@ -220,7 +220,7 @@
MTK_VENDOR_ATTR_RFEATURE_CTRL_UNSPEC,
diff --git a/src/drivers/driver.h b/src/drivers/driver.h
-index 7ac02845b..87a5a9b64 100644
+index 7ac0284..87a5a9b 100644
--- a/src/drivers/driver.h
+++ b/src/drivers/driver.h
@@ -5124,6 +5124,15 @@ struct wpa_driver_ops {
@@ -240,10 +240,10 @@
/**
diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c
-index ec85621ab..4ac8b6e0b 100644
+index 936a4f8..ce09d9f 100644
--- a/src/drivers/driver_nl80211.c
+++ b/src/drivers/driver_nl80211.c
-@@ -14052,6 +14052,118 @@ fail:
+@@ -14049,6 +14049,118 @@ fail:
return -ENOBUFS;
}
@@ -362,7 +362,7 @@
const struct wpa_driver_ops wpa_driver_nl80211_ops = {
.name = "nl80211",
.desc = "Linux nl80211/cfg80211",
-@@ -14214,4 +14326,6 @@ const struct wpa_driver_ops wpa_driver_nl80211_ops = {
+@@ -14211,4 +14323,6 @@ const struct wpa_driver_ops wpa_driver_nl80211_ops = {
.three_wire_ctrl = nl80211_enable_three_wire,
.ibf_ctrl = nl80211_ibf_enable,
.ibf_dump = nl80211_ibf_dump,
@@ -370,7 +370,7 @@
+ .amsdu_dump = nl80211_dump_amsdu,
};
diff --git a/src/drivers/driver_nl80211.h b/src/drivers/driver_nl80211.h
-index 4e64e7d31..0100314ba 100644
+index 4e64e7d..0100314 100644
--- a/src/drivers/driver_nl80211.h
+++ b/src/drivers/driver_nl80211.h
@@ -206,6 +206,7 @@ struct wpa_driver_nl80211_data {
@@ -382,7 +382,7 @@
u64 vendor_scan_cookie;
u64 remain_on_chan_cookie;
diff --git a/src/drivers/driver_nl80211_capa.c b/src/drivers/driver_nl80211_capa.c
-index 7ad15bafd..f14706d77 100644
+index 7ad15ba..f14706d 100644
--- a/src/drivers/driver_nl80211_capa.c
+++ b/src/drivers/driver_nl80211_capa.c
@@ -1122,6 +1122,9 @@ static int wiphy_info_handler(struct nl_msg *msg, void *arg)
@@ -396,5 +396,5 @@
}
--
-2.39.2
+2.18.0
diff --git a/recipes-wifi/wpa-supplicant/files/patches-2.10.3/mtk-0013-hostapd-mtk-Add-he_ldpc-configuration.patch b/recipes-wifi/wpa-supplicant/files/patches-2.10.3/mtk-0013-hostapd-mtk-Add-he_ldpc-configuration.patch
index 8a9696f..dd96623 100644
--- a/recipes-wifi/wpa-supplicant/files/patches-2.10.3/mtk-0013-hostapd-mtk-Add-he_ldpc-configuration.patch
+++ b/recipes-wifi/wpa-supplicant/files/patches-2.10.3/mtk-0013-hostapd-mtk-Add-he_ldpc-configuration.patch
@@ -1,7 +1,7 @@
-From 65f862e0db364352657f0f19245339208dc0a966 Mon Sep 17 00:00:00 2001
+From ea7da2297d396febe75de0d7cf77cba9d2eab778 Mon Sep 17 00:00:00 2001
From: MeiChia Chiu <meichia.chiu@mediatek.com>
Date: Thu, 12 Jan 2023 15:18:19 +0800
-Subject: [PATCH 13/32] hostapd: mtk: Add he_ldpc configuration
+Subject: [PATCH 13/40] hostapd: mtk: Add he_ldpc configuration
---
hostapd/config_file.c | 2 ++
@@ -13,10 +13,10 @@
6 files changed, 19 insertions(+)
diff --git a/hostapd/config_file.c b/hostapd/config_file.c
-index ecd290717..8c5831dbb 100644
+index d17e50e..04ca433 100644
--- a/hostapd/config_file.c
+++ b/hostapd/config_file.c
-@@ -3517,6 +3517,8 @@ static int hostapd_config_fill(struct hostapd_config *conf,
+@@ -3515,6 +3515,8 @@ static int hostapd_config_fill(struct hostapd_config *conf,
conf->he_phy_capab.he_su_beamformee = atoi(pos);
} else if (os_strcmp(buf, "he_mu_beamformer") == 0) {
conf->he_phy_capab.he_mu_beamformer = atoi(pos);
@@ -26,7 +26,7 @@
conf->he_op.he_bss_color = atoi(pos) & 0x3f;
conf->he_op.he_bss_color_disabled = 0;
diff --git a/hostapd/hostapd.conf b/hostapd/hostapd.conf
-index 30fb06d1c..fd42c5038 100644
+index 30fb06d..fd42c50 100644
--- a/hostapd/hostapd.conf
+++ b/hostapd/hostapd.conf
@@ -833,6 +833,11 @@ wmm_ac_vo_acm=0
@@ -42,7 +42,7 @@
#he_bss_color=1
diff --git a/src/ap/ap_config.c b/src/ap/ap_config.c
-index 83e2ea121..1f27543bf 100644
+index f519a76..223db56 100644
--- a/src/ap/ap_config.c
+++ b/src/ap/ap_config.c
@@ -269,6 +269,7 @@ struct hostapd_config * hostapd_config_defaults(void)
@@ -54,7 +54,7 @@
HE_OPERATION_RTS_THRESHOLD_OFFSET;
/* Set default basic MCS/NSS set to single stream MCS 0-7 */
diff --git a/src/ap/ap_config.h b/src/ap/ap_config.h
-index 94056157b..195816c28 100644
+index b8f6680..5b2dbff 100644
--- a/src/ap/ap_config.h
+++ b/src/ap/ap_config.h
@@ -956,6 +956,7 @@ struct hostapd_bss_config {
@@ -66,7 +66,7 @@
bool he_su_beamformee;
bool he_mu_beamformer;
diff --git a/src/ap/ieee802_11_he.c b/src/ap/ieee802_11_he.c
-index 548a44821..9407dd6e5 100644
+index 548a448..9407dd6 100644
--- a/src/ap/ieee802_11_he.c
+++ b/src/ap/ieee802_11_he.c
@@ -138,6 +138,13 @@ u8 * hostapd_eid_he_capab(struct hostapd_data *hapd, u8 *eid,
@@ -84,10 +84,10 @@
cap->he_phy_capab_info[HE_PHYCAP_SU_BEAMFORMER_CAPAB_IDX] |=
HE_PHYCAP_SU_BEAMFORMER_CAPAB;
diff --git a/src/common/ieee802_11_defs.h b/src/common/ieee802_11_defs.h
-index 571ace2f5..74301178f 100644
+index 0b7b776..cf3ef98 100644
--- a/src/common/ieee802_11_defs.h
+++ b/src/common/ieee802_11_defs.h
-@@ -2355,6 +2355,9 @@ struct ieee80211_spatial_reuse {
+@@ -2357,6 +2357,9 @@ struct ieee80211_spatial_reuse {
#define HE_PHYCAP_CHANNEL_WIDTH_SET_160MHZ_IN_5G ((u8) BIT(3))
#define HE_PHYCAP_CHANNEL_WIDTH_SET_80PLUS80MHZ_IN_5G ((u8) BIT(4))
@@ -98,5 +98,5 @@
#define HE_PHYCAP_SU_BEAMFORMER_CAPAB ((u8) BIT(7))
#define HE_PHYCAP_SU_BEAMFORMEE_CAPAB_IDX 4
--
-2.39.2
+2.18.0
diff --git a/recipes-wifi/wpa-supplicant/files/patches-2.10.3/mtk-0014-hostapd-mtk-Add-vendor-command-attribute-for-RTS-BW-.patch b/recipes-wifi/wpa-supplicant/files/patches-2.10.3/mtk-0014-hostapd-mtk-Add-vendor-command-attribute-for-RTS-BW-.patch
index 0751337..6003cfb 100644
--- a/recipes-wifi/wpa-supplicant/files/patches-2.10.3/mtk-0014-hostapd-mtk-Add-vendor-command-attribute-for-RTS-BW-.patch
+++ b/recipes-wifi/wpa-supplicant/files/patches-2.10.3/mtk-0014-hostapd-mtk-Add-vendor-command-attribute-for-RTS-BW-.patch
@@ -1,7 +1,7 @@
-From 2694ff1a1eb124938848bf46361990f13cf4d277 Mon Sep 17 00:00:00 2001
+From 41ccc468e3ce6727b237390bcedf1ab734d749e4 Mon Sep 17 00:00:00 2001
From: "himanshu.goyal" <himanshu.goyal@mediatek.com>
Date: Tue, 24 Jan 2023 19:06:44 +0800
-Subject: [PATCH 14/32] hostapd: mtk: Add vendor command attribute for RTS BW
+Subject: [PATCH 14/40] hostapd: mtk: Add vendor command attribute for RTS BW
signaling.
Signed-off-by: himanshu.goyal <himanshu.goyal@mediatek.com>
@@ -10,7 +10,7 @@
1 file changed, 1 insertion(+)
diff --git a/src/common/mtk_vendor.h b/src/common/mtk_vendor.h
-index 7b4d7c11a..ace993bc8 100644
+index 7b4d7c1..ace993b 100644
--- a/src/common/mtk_vendor.h
+++ b/src/common/mtk_vendor.h
@@ -172,6 +172,7 @@ enum mtk_vendor_attr_wireless_ctrl {
@@ -22,5 +22,5 @@
/* keep last */
NUM_MTK_VENDOR_ATTRS_WIRELESS_CTRL,
--
-2.39.2
+2.18.0
diff --git a/recipes-wifi/wpa-supplicant/files/patches-2.10.3/mtk-0015-hostapd-mtk-6G-band-does-not-require-DFS.patch b/recipes-wifi/wpa-supplicant/files/patches-2.10.3/mtk-0015-hostapd-mtk-6G-band-does-not-require-DFS.patch
index a850c6d..3b19e78 100644
--- a/recipes-wifi/wpa-supplicant/files/patches-2.10.3/mtk-0015-hostapd-mtk-6G-band-does-not-require-DFS.patch
+++ b/recipes-wifi/wpa-supplicant/files/patches-2.10.3/mtk-0015-hostapd-mtk-6G-band-does-not-require-DFS.patch
@@ -1,14 +1,14 @@
-From cd2d0f7ee500cbdf302b2042e9e4804107e06148 Mon Sep 17 00:00:00 2001
+From 0381565e342ecf407ffb6a32212c6d7123417c73 Mon Sep 17 00:00:00 2001
From: Peter Chiu <chui-hao.chiu@mediatek.com>
Date: Mon, 13 Feb 2023 11:03:53 +0800
-Subject: [PATCH 15/32] hostapd: mtk: 6G band does not require DFS
+Subject: [PATCH 15/40] hostapd: mtk: 6G band does not require DFS
---
src/ap/dfs.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/ap/dfs.c b/src/ap/dfs.c
-index 48c5fc917..dcf89ce62 100644
+index 48c5fc9..dcf89ce 100644
--- a/src/ap/dfs.c
+++ b/src/ap/dfs.c
@@ -1511,6 +1511,7 @@ int hostapd_is_dfs_required(struct hostapd_iface *iface)
@@ -20,5 +20,5 @@
return 0;
--
-2.39.2
+2.18.0
diff --git a/recipes-wifi/wpa-supplicant/files/patches-2.10.3/mtk-0016-hostapd-mtk-Fix-sending-wrong-VHT-operation-IE-in-CS.patch b/recipes-wifi/wpa-supplicant/files/patches-2.10.3/mtk-0016-hostapd-mtk-Fix-sending-wrong-VHT-operation-IE-in-CS.patch
index f9c3cb7..206a8d3 100644
--- a/recipes-wifi/wpa-supplicant/files/patches-2.10.3/mtk-0016-hostapd-mtk-Fix-sending-wrong-VHT-operation-IE-in-CS.patch
+++ b/recipes-wifi/wpa-supplicant/files/patches-2.10.3/mtk-0016-hostapd-mtk-Fix-sending-wrong-VHT-operation-IE-in-CS.patch
@@ -1,7 +1,7 @@
-From e8e838a2dffaa6ba5ea66f6638d4ba7f01302bf6 Mon Sep 17 00:00:00 2001
+From b810754f20e0bad1b1be74bd71fc96f6b74b8c4d Mon Sep 17 00:00:00 2001
From: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
Date: Mon, 20 Feb 2023 11:01:18 +0800
-Subject: [PATCH 16/32] hostapd: mtk: Fix sending wrong VHT operation IE in CSA
+Subject: [PATCH 16/40] hostapd: mtk: Fix sending wrong VHT operation IE in CSA
while using ZWDFS
Signed-off-by: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
@@ -10,7 +10,7 @@
1 file changed, 9 insertions(+), 5 deletions(-)
diff --git a/src/ap/dfs.c b/src/ap/dfs.c
-index dcf89ce62..e5ed645d6 100644
+index dcf89ce..e5ed645 100644
--- a/src/ap/dfs.c
+++ b/src/ap/dfs.c
@@ -1115,6 +1115,14 @@ static int
@@ -42,5 +42,5 @@
--
-2.39.2
+2.18.0
diff --git a/recipes-wifi/wpa-supplicant/files/patches-2.10.3/mtk-0017-hostapd-mtk-Add-sta-assisted-DFS-state-update-mechan.patch b/recipes-wifi/wpa-supplicant/files/patches-2.10.3/mtk-0017-hostapd-mtk-Add-sta-assisted-DFS-state-update-mechan.patch
index 8c35888..f2e966a 100644
--- a/recipes-wifi/wpa-supplicant/files/patches-2.10.3/mtk-0017-hostapd-mtk-Add-sta-assisted-DFS-state-update-mechan.patch
+++ b/recipes-wifi/wpa-supplicant/files/patches-2.10.3/mtk-0017-hostapd-mtk-Add-sta-assisted-DFS-state-update-mechan.patch
@@ -1,7 +1,7 @@
-From c5b6477df27a7da54a56ee0cc94b147072b25749 Mon Sep 17 00:00:00 2001
+From 20f21e3ff3c5d5db5daea650e22c6fa8ca6071a4 Mon Sep 17 00:00:00 2001
From: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
Date: Mon, 20 Feb 2023 10:51:47 +0800
-Subject: [PATCH 17/32] hostapd: mtk: Add sta-assisted DFS state update
+Subject: [PATCH 17/40] hostapd: mtk: Add sta-assisted DFS state update
mechanism
Signed-off-by: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
@@ -16,7 +16,7 @@
7 files changed, 78 insertions(+)
diff --git a/src/ap/dfs.c b/src/ap/dfs.c
-index e5ed645d6..d52a60e0d 100644
+index e5ed645..d52a60e 100644
--- a/src/ap/dfs.c
+++ b/src/ap/dfs.c
@@ -1508,6 +1508,26 @@ int hostapd_dfs_nop_finished(struct hostapd_iface *iface, int freq,
@@ -47,7 +47,7 @@
{
int n_chans, n_chans1, start_chan_idx, start_chan_idx1, res;
diff --git a/src/ap/dfs.h b/src/ap/dfs.h
-index c2556d2d9..25ba29ca1 100644
+index c2556d2..25ba29c 100644
--- a/src/ap/dfs.h
+++ b/src/ap/dfs.h
@@ -30,6 +30,9 @@ int hostapd_dfs_radar_detected(struct hostapd_iface *iface, int freq,
@@ -61,7 +61,7 @@
int hostapd_is_dfs_chan_available(struct hostapd_iface *iface);
int hostapd_dfs_start_cac(struct hostapd_iface *iface, int freq,
diff --git a/src/ap/drv_callbacks.c b/src/ap/drv_callbacks.c
-index b0bba9906..694056b42 100644
+index 903eab3..c3fc419 100644
--- a/src/ap/drv_callbacks.c
+++ b/src/ap/drv_callbacks.c
@@ -1912,6 +1912,24 @@ static void hostapd_event_dfs_cac_started(struct hostapd_data *hapd,
@@ -107,7 +107,7 @@
/* channel list changed (regulatory?), update channel list */
/* TODO: check this. hostapd_get_hw_features() initializes
diff --git a/src/common/wpa_ctrl.h b/src/common/wpa_ctrl.h
-index ccff0ee09..e209ac6d7 100644
+index ccff0ee..e209ac6 100644
--- a/src/common/wpa_ctrl.h
+++ b/src/common/wpa_ctrl.h
@@ -374,6 +374,7 @@ extern "C" {
@@ -119,7 +119,7 @@
#define AP_CSA_FINISHED "AP-CSA-FINISHED "
diff --git a/src/drivers/driver.h b/src/drivers/driver.h
-index 87a5a9b64..592f506ec 100644
+index 87a5a9b..592f506 100644
--- a/src/drivers/driver.h
+++ b/src/drivers/driver.h
@@ -5760,6 +5760,20 @@ enum wpa_event_type {
@@ -144,7 +144,7 @@
diff --git a/src/drivers/driver_nl80211_event.c b/src/drivers/driver_nl80211_event.c
-index 3e8ace052..3d0d9b7bb 100644
+index 8566b2a..ab988fa 100644
--- a/src/drivers/driver_nl80211_event.c
+++ b/src/drivers/driver_nl80211_event.c
@@ -2447,6 +2447,12 @@ static void nl80211_radar_event(struct wpa_driver_nl80211_data *drv,
@@ -161,7 +161,7 @@
wpa_printf(MSG_DEBUG, "nl80211: Unknown radar event %d "
"received", event_type);
diff --git a/src/drivers/nl80211_copy.h b/src/drivers/nl80211_copy.h
-index 82860ae32..225864b94 100644
+index 82860ae..225864b 100644
--- a/src/drivers/nl80211_copy.h
+++ b/src/drivers/nl80211_copy.h
@@ -6643,6 +6643,10 @@ enum nl80211_smps_mode {
@@ -185,5 +185,5 @@
/**
--
-2.39.2
+2.18.0
diff --git a/recipes-wifi/wpa-supplicant/files/patches-2.10.3/mtk-0018-hostapd-mtk-Fix-auto-ht-issue-when-switching-to-DFS-.patch b/recipes-wifi/wpa-supplicant/files/patches-2.10.3/mtk-0018-hostapd-mtk-Fix-auto-ht-issue-when-switching-to-DFS-.patch
deleted file mode 100644
index ea43585..0000000
--- a/recipes-wifi/wpa-supplicant/files/patches-2.10.3/mtk-0018-hostapd-mtk-Fix-auto-ht-issue-when-switching-to-DFS-.patch
+++ /dev/null
@@ -1,45 +0,0 @@
-From cf17d8510dd96dc092b73236b6e74d8ea1c5990c Mon Sep 17 00:00:00 2001
-From: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
-Date: Mon, 20 Feb 2023 16:58:20 +0800
-Subject: [PATCH 18/32] hostapd: mtk: Fix auto ht issue when switching to DFS
- channel
-
-Signed-off-by: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
----
- hostapd/ctrl_iface.c | 13 +++++++------
- 1 file changed, 7 insertions(+), 6 deletions(-)
-
-diff --git a/hostapd/ctrl_iface.c b/hostapd/ctrl_iface.c
-index ed17211e0..f89bb58f1 100644
---- a/hostapd/ctrl_iface.c
-+++ b/hostapd/ctrl_iface.c
-@@ -2808,6 +2808,13 @@ static int hostapd_ctrl_iface_chan_switch(struct hostapd_iface *iface,
- break;
- }
-
-+ if (os_strstr(pos, " auto-ht")) {
-+ settings.freq_params.ht_enabled = iface->conf->ieee80211n;
-+ settings.freq_params.vht_enabled = iface->conf->ieee80211ac;
-+ settings.freq_params.he_enabled = iface->conf->ieee80211ax;
-+ settings.freq_params.eht_enabled = iface->conf->ieee80211be;
-+ }
-+
- if (settings.freq_params.center_freq1)
- dfs_range += hostapd_is_dfs_overlap(
- iface, bandwidth, settings.freq_params.center_freq1);
-@@ -2845,12 +2852,6 @@ static int hostapd_ctrl_iface_chan_switch(struct hostapd_iface *iface,
- return 0;
- }
-
-- if (os_strstr(pos, " auto-ht")) {
-- settings.freq_params.ht_enabled = iface->conf->ieee80211n;
-- settings.freq_params.vht_enabled = iface->conf->ieee80211ac;
-- settings.freq_params.he_enabled = iface->conf->ieee80211ax;
-- }
--
- for (i = 0; i < iface->num_bss; i++) {
-
- /* Save CHAN_SWITCH VHT, HE, and EHT config */
---
-2.39.2
-
diff --git a/recipes-wifi/wpa-supplicant/files/patches-2.10.3/mtk-0019-hostapd-mtk-Mark-DFS-channel-as-available-for-CSA.patch b/recipes-wifi/wpa-supplicant/files/patches-2.10.3/mtk-0018-hostapd-mtk-Mark-DFS-channel-as-available-for-CSA.patch
similarity index 85%
rename from recipes-wifi/wpa-supplicant/files/patches-2.10.3/mtk-0019-hostapd-mtk-Mark-DFS-channel-as-available-for-CSA.patch
rename to recipes-wifi/wpa-supplicant/files/patches-2.10.3/mtk-0018-hostapd-mtk-Mark-DFS-channel-as-available-for-CSA.patch
index 9e93011..a9c1842 100644
--- a/recipes-wifi/wpa-supplicant/files/patches-2.10.3/mtk-0019-hostapd-mtk-Mark-DFS-channel-as-available-for-CSA.patch
+++ b/recipes-wifi/wpa-supplicant/files/patches-2.10.3/mtk-0018-hostapd-mtk-Mark-DFS-channel-as-available-for-CSA.patch
@@ -1,7 +1,7 @@
-From ece45354ac0191c2474b3f57cdfc26060db9efec Mon Sep 17 00:00:00 2001
+From 2471c86d25da6898dd8840b7267211a5dba036b1 Mon Sep 17 00:00:00 2001
From: "himanshu.goyal" <himanshu.goyal@mediatek.com>
Date: Fri, 3 Mar 2023 12:45:42 +0800
-Subject: [PATCH 19/32] hostapd: mtk: Mark DFS channel as available for CSA.
+Subject: [PATCH 18/40] hostapd: mtk: Mark DFS channel as available for CSA.
---
hostapd/ctrl_iface.c | 10 ++++++++++
@@ -10,11 +10,11 @@
3 files changed, 12 insertions(+), 1 deletion(-)
diff --git a/hostapd/ctrl_iface.c b/hostapd/ctrl_iface.c
-index f89bb58f1..bad9790ca 100644
+index c54cbb9..aab5c0a 100644
--- a/hostapd/ctrl_iface.c
+++ b/hostapd/ctrl_iface.c
-@@ -2815,6 +2815,16 @@ static int hostapd_ctrl_iface_chan_switch(struct hostapd_iface *iface,
- settings.freq_params.eht_enabled = iface->conf->ieee80211be;
+@@ -2751,6 +2751,16 @@ static int hostapd_ctrl_iface_chan_switch(struct hostapd_iface *iface,
+ break;
}
+ if (settings.freq_params.radar_background) {
@@ -31,7 +31,7 @@
dfs_range += hostapd_is_dfs_overlap(
iface, bandwidth, settings.freq_params.center_freq1);
diff --git a/hostapd/hostapd_cli.c b/hostapd/hostapd_cli.c
-index d59373062..0a374be8e 100644
+index d593730..0a374be 100644
--- a/hostapd/hostapd_cli.c
+++ b/hostapd/hostapd_cli.c
@@ -1715,7 +1715,7 @@ static const struct hostapd_cli_cmd hostapd_cli_commands[] = {
@@ -44,7 +44,7 @@
{ "hs20_wnm_notif", hostapd_cli_cmd_hs20_wnm_notif, NULL,
"<addr> <url>\n"
diff --git a/src/ap/ctrl_iface_ap.c b/src/ap/ctrl_iface_ap.c
-index cf1cff447..aab8a4665 100644
+index 0e173f1..7bdefb4 100644
--- a/src/ap/ctrl_iface_ap.c
+++ b/src/ap/ctrl_iface_ap.c
@@ -1014,6 +1014,7 @@ int hostapd_parse_csa_settings(const char *pos,
@@ -56,5 +56,5 @@
#undef SET_CSA_SETTING
#undef SET_CSA_SETTING_EXT
--
-2.39.2
+2.18.0
diff --git a/recipes-wifi/hostapd/files/patches-2.10.3/mtk-0020-hostapd-mtk-Add-available-color-bitmap.patch b/recipes-wifi/wpa-supplicant/files/patches-2.10.3/mtk-0019-hostapd-mtk-Add-available-color-bitmap.patch
similarity index 94%
copy from recipes-wifi/hostapd/files/patches-2.10.3/mtk-0020-hostapd-mtk-Add-available-color-bitmap.patch
copy to recipes-wifi/wpa-supplicant/files/patches-2.10.3/mtk-0019-hostapd-mtk-Add-available-color-bitmap.patch
index de6ffe6..01aa4d5 100644
--- a/recipes-wifi/hostapd/files/patches-2.10.3/mtk-0020-hostapd-mtk-Add-available-color-bitmap.patch
+++ b/recipes-wifi/wpa-supplicant/files/patches-2.10.3/mtk-0019-hostapd-mtk-Add-available-color-bitmap.patch
@@ -1,7 +1,7 @@
-From 71b229a9e0a12ebc6d5f298f40042cc67fb285e1 Mon Sep 17 00:00:00 2001
+From 236e82d01cd015135468166e6d00b05b16e4c5f8 Mon Sep 17 00:00:00 2001
From: Yi-Chia Hsieh <yi-chia.hsieh@mediatek.com>
Date: Thu, 26 Jan 2023 09:16:00 +0800
-Subject: [PATCH 20/32] hostapd: mtk: Add available color bitmap
+Subject: [PATCH 19/40] hostapd: mtk: Add available color bitmap
Signed-off-by: Yi-Chia Hsieh <yi-chia.hsieh@mediatek.com>
---
@@ -17,10 +17,10 @@
9 files changed, 324 insertions(+), 2 deletions(-)
diff --git a/hostapd/ctrl_iface.c b/hostapd/ctrl_iface.c
-index bad9790ca..997b50aad 100644
+index aab5c0a..a6be199 100644
--- a/hostapd/ctrl_iface.c
+++ b/hostapd/ctrl_iface.c
-@@ -3756,6 +3756,76 @@ hostapd_ctrl_iface_get_amsdu(struct hostapd_data *hapd, char *buf,
+@@ -3692,6 +3692,76 @@ hostapd_ctrl_iface_get_amsdu(struct hostapd_data *hapd, char *buf,
return ret;
}
@@ -97,7 +97,7 @@
static int hostapd_ctrl_iface_receive_process(struct hostapd_data *hapd,
char *buf, char *reply,
-@@ -4332,6 +4402,10 @@ static int hostapd_ctrl_iface_receive_process(struct hostapd_data *hapd,
+@@ -4266,6 +4336,10 @@ static int hostapd_ctrl_iface_receive_process(struct hostapd_data *hapd,
reply_len = hostapd_ctrl_iface_set_offchan_ctrl(hapd, buf + 16, reply, reply_size);
} else if (os_strncmp(buf, "GET_AMSDU", 9) == 0) {
reply_len = hostapd_ctrl_iface_get_amsdu(hapd, reply, reply_size);
@@ -109,7 +109,7 @@
os_memcpy(reply, "UNKNOWN COMMAND\n", 16);
reply_len = 16;
diff --git a/hostapd/hostapd_cli.c b/hostapd/hostapd_cli.c
-index 0a374be8e..e9e156d28 100644
+index 0a374be..e9e156d 100644
--- a/hostapd/hostapd_cli.c
+++ b/hostapd/hostapd_cli.c
@@ -1598,6 +1598,20 @@ static int hostapd_cli_cmd_reload_wpa_psk(struct wpa_ctrl *ctrl, int argc,
@@ -145,7 +145,7 @@
{ "driver", hostapd_cli_cmd_driver, NULL,
"<driver sub command> [<hex formatted data>] = send driver command data" },
diff --git a/src/ap/ap_drv_ops.c b/src/ap/ap_drv_ops.c
-index a7226cfa9..9615ca8ce 100644
+index a7226cf..9615ca8 100644
--- a/src/ap/ap_drv_ops.c
+++ b/src/ap/ap_drv_ops.c
@@ -1213,4 +1213,12 @@ int hostapd_drv_amsdu_dump(struct hostapd_data *hapd, u8 *amsdu)
@@ -164,7 +164,7 @@
+ return hapd->driver->get_aval_color_bmp(hapd->drv_priv, aval_color_bmp);
+}
diff --git a/src/ap/ap_drv_ops.h b/src/ap/ap_drv_ops.h
-index 422cb5222..136ea2349 100644
+index 422cb52..136ea23 100644
--- a/src/ap/ap_drv_ops.h
+++ b/src/ap/ap_drv_ops.h
@@ -155,6 +155,8 @@ int hostapd_drv_ibf_ctrl(struct hostapd_data *hapd);
@@ -177,7 +177,7 @@
#include "drivers/driver.h"
diff --git a/src/common/mtk_vendor.h b/src/common/mtk_vendor.h
-index ace993bc8..e27fe69b3 100644
+index ace993b..e27fe69 100644
--- a/src/common/mtk_vendor.h
+++ b/src/common/mtk_vendor.h
@@ -15,6 +15,7 @@ enum mtk_nl80211_vendor_subcmds {
@@ -206,7 +206,7 @@
#define CSI_MAX_COUNT 256
#define ETH_ALEN 6
diff --git a/src/drivers/driver.h b/src/drivers/driver.h
-index 592f506ec..91cb475ac 100644
+index 592f506..91cb475 100644
--- a/src/drivers/driver.h
+++ b/src/drivers/driver.h
@@ -5133,6 +5133,14 @@ struct wpa_driver_ops {
@@ -225,10 +225,10 @@
/**
diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c
-index 4ac8b6e0b..b8730472d 100644
+index ce09d9f..8b8ddfa 100644
--- a/src/drivers/driver_nl80211.c
+++ b/src/drivers/driver_nl80211.c
-@@ -12736,7 +12736,6 @@ static void nl80211_parse_btm_candidate_info(struct candidate_list *candidate,
+@@ -12733,7 +12733,6 @@ static void nl80211_parse_btm_candidate_info(struct candidate_list *candidate,
num, MAC2STR(candidate->bssid), buf);
}
@@ -236,7 +236,7 @@
static int
nl80211_get_bss_transition_status_handler(struct nl_msg *msg, void *arg)
{
-@@ -14164,6 +14163,203 @@ fail:
+@@ -14161,6 +14160,203 @@ fail:
return -ENOBUFS;
}
@@ -440,14 +440,14 @@
const struct wpa_driver_ops wpa_driver_nl80211_ops = {
.name = "nl80211",
.desc = "Linux nl80211/cfg80211",
-@@ -14328,4 +14524,5 @@ const struct wpa_driver_ops wpa_driver_nl80211_ops = {
+@@ -14325,4 +14521,5 @@ const struct wpa_driver_ops wpa_driver_nl80211_ops = {
.ibf_dump = nl80211_ibf_dump,
.amsdu_ctrl = nl80211_enable_amsdu,
.amsdu_dump = nl80211_dump_amsdu,
+ .get_aval_color_bmp = nl80211_get_aval_color_bmp,
};
diff --git a/src/drivers/driver_nl80211.h b/src/drivers/driver_nl80211.h
-index 0100314ba..fd1e57cc2 100644
+index 0100314..fd1e57c 100644
--- a/src/drivers/driver_nl80211.h
+++ b/src/drivers/driver_nl80211.h
@@ -207,6 +207,7 @@ struct wpa_driver_nl80211_data {
@@ -459,7 +459,7 @@
u64 vendor_scan_cookie;
u64 remain_on_chan_cookie;
diff --git a/src/drivers/driver_nl80211_capa.c b/src/drivers/driver_nl80211_capa.c
-index f14706d77..4f8e92024 100644
+index f14706d..4f8e920 100644
--- a/src/drivers/driver_nl80211_capa.c
+++ b/src/drivers/driver_nl80211_capa.c
@@ -1125,6 +1125,9 @@ static int wiphy_info_handler(struct nl_msg *msg, void *arg)
@@ -473,5 +473,5 @@
}
--
-2.39.2
+2.18.0
diff --git a/recipes-wifi/wpa-supplicant/files/patches-2.10.3/mtk-0020-hostapd-mtk-Add-available-color-bitmap.patch b/recipes-wifi/wpa-supplicant/files/patches-2.10.3/mtk-0020-hostapd-mtk-Add-available-color-bitmap.patch
deleted file mode 100644
index de6ffe6..0000000
--- a/recipes-wifi/wpa-supplicant/files/patches-2.10.3/mtk-0020-hostapd-mtk-Add-available-color-bitmap.patch
+++ /dev/null
@@ -1,477 +0,0 @@
-From 71b229a9e0a12ebc6d5f298f40042cc67fb285e1 Mon Sep 17 00:00:00 2001
-From: Yi-Chia Hsieh <yi-chia.hsieh@mediatek.com>
-Date: Thu, 26 Jan 2023 09:16:00 +0800
-Subject: [PATCH 20/32] hostapd: mtk: Add available color bitmap
-
-Signed-off-by: Yi-Chia Hsieh <yi-chia.hsieh@mediatek.com>
----
- hostapd/ctrl_iface.c | 74 +++++++++++
- hostapd/hostapd_cli.c | 18 +++
- src/ap/ap_drv_ops.c | 10 +-
- src/ap/ap_drv_ops.h | 2 +
- src/common/mtk_vendor.h | 11 ++
- src/drivers/driver.h | 8 ++
- src/drivers/driver_nl80211.c | 199 +++++++++++++++++++++++++++++-
- src/drivers/driver_nl80211.h | 1 +
- src/drivers/driver_nl80211_capa.c | 3 +
- 9 files changed, 324 insertions(+), 2 deletions(-)
-
-diff --git a/hostapd/ctrl_iface.c b/hostapd/ctrl_iface.c
-index bad9790ca..997b50aad 100644
---- a/hostapd/ctrl_iface.c
-+++ b/hostapd/ctrl_iface.c
-@@ -3756,6 +3756,76 @@ hostapd_ctrl_iface_get_amsdu(struct hostapd_data *hapd, char *buf,
- return ret;
- }
-
-+static int
-+hostapd_ctrl_iface_get_bss_color(struct hostapd_data *hapd, char *buf,
-+ size_t buflen)
-+{
-+ int ret;
-+ char *pos, *end;
-+ int i;
-+
-+ pos = buf;
-+ end = buf + buflen;
-+
-+ if (hapd->iface->conf->he_op.he_bss_color_disabled)
-+ ret = os_snprintf(buf, buflen, "BSS Color disabled\n");
-+ else
-+ ret = os_snprintf(buf, buflen, "BSS Color=%u\n",
-+ hapd->iface->conf->he_op.he_bss_color);
-+
-+ pos += ret;
-+
-+ return pos - buf;
-+}
-+
-+
-+static int
-+hostapd_ctrl_iface_get_aval_color_bmp(struct hostapd_data *hapd, char *buf,
-+ size_t buflen)
-+{
-+ int ret;
-+ char *pos, *end;
-+ int i;
-+ u64 aval_color_bmp = 0;
-+
-+ hostapd_drv_get_aval_bss_color_bmp(hapd, &aval_color_bmp);
-+ hapd->color_collision_bitmap = ~aval_color_bmp;
-+
-+ pos = buf;
-+ end = buf + buflen;
-+
-+ ret = os_snprintf(buf, buflen,
-+ "available color bitmap=0x%llx\n",
-+ aval_color_bmp);
-+ if (os_snprintf_error(end - pos, ret))
-+ return pos - buf;
-+ pos += ret;
-+
-+ for (i = 0; i < HE_OPERATION_BSS_COLOR_MAX; i++) {
-+ int bit = !!((aval_color_bmp >> i) & 1LLU);
-+
-+ if (i % 8 == 0) {
-+ ret = os_snprintf(pos, end - pos, "%2d: ", i);
-+ if (os_snprintf_error(end - pos, ret))
-+ return pos - buf;
-+ pos += ret;
-+ }
-+
-+ ret = os_snprintf(pos, end - pos, "%d ", bit);
-+ if (os_snprintf_error(end - pos, ret))
-+ return pos - buf;
-+ pos += ret;
-+
-+ if (i % 8 == 7) {
-+ ret = os_snprintf(pos, end - pos, "\n");
-+ if (os_snprintf_error(end - pos, ret))
-+ return pos - buf;
-+ pos += ret;
-+ }
-+ }
-+ return pos - buf;
-+}
-+
-
- static int hostapd_ctrl_iface_receive_process(struct hostapd_data *hapd,
- char *buf, char *reply,
-@@ -4332,6 +4402,10 @@ static int hostapd_ctrl_iface_receive_process(struct hostapd_data *hapd,
- reply_len = hostapd_ctrl_iface_set_offchan_ctrl(hapd, buf + 16, reply, reply_size);
- } else if (os_strncmp(buf, "GET_AMSDU", 9) == 0) {
- reply_len = hostapd_ctrl_iface_get_amsdu(hapd, reply, reply_size);
-+ } else if (os_strncmp(buf, "GET_BSS_COLOR", 13) == 0) {
-+ reply_len = hostapd_ctrl_iface_get_bss_color(hapd, reply, reply_size);
-+ } else if (os_strncmp(buf, "AVAL_COLOR_BMP", 14) == 0) {
-+ reply_len = hostapd_ctrl_iface_get_aval_color_bmp(hapd, reply, reply_size);
- } else {
- os_memcpy(reply, "UNKNOWN COMMAND\n", 16);
- reply_len = 16;
-diff --git a/hostapd/hostapd_cli.c b/hostapd/hostapd_cli.c
-index 0a374be8e..e9e156d28 100644
---- a/hostapd/hostapd_cli.c
-+++ b/hostapd/hostapd_cli.c
-@@ -1598,6 +1598,20 @@ static int hostapd_cli_cmd_reload_wpa_psk(struct wpa_ctrl *ctrl, int argc,
- }
-
-
-+static int hostapd_cli_cmd_get_bss_color(struct wpa_ctrl *ctrl, int argc,
-+ char *argv[])
-+{
-+ return wpa_ctrl_command(ctrl, "GET_BSS_COLOR");
-+}
-+
-+
-+static int hostapd_cli_cmd_get_aval_color_bmp(struct wpa_ctrl *ctrl, int argc,
-+ char *argv[])
-+{
-+ return wpa_ctrl_command(ctrl, "AVAL_COLOR_BMP");
-+}
-+
-+
- #ifdef ANDROID
- static int hostapd_cli_cmd_driver(struct wpa_ctrl *ctrl, int argc, char *argv[])
- {
-@@ -1819,6 +1833,10 @@ static const struct hostapd_cli_cmd hostapd_cli_commands[] = {
- "<addr> [req_mode=] <measurement request hexdump> = send a Beacon report request to a station" },
- { "reload_wpa_psk", hostapd_cli_cmd_reload_wpa_psk, NULL,
- "= reload wpa_psk_file only" },
-+ { "get_bss_color", hostapd_cli_cmd_get_bss_color, NULL,
-+ "= get current BSS color" },
-+ { "get_color_bmp", hostapd_cli_cmd_get_aval_color_bmp, NULL,
-+ "= get available BSS color bitmap" },
- #ifdef ANDROID
- { "driver", hostapd_cli_cmd_driver, NULL,
- "<driver sub command> [<hex formatted data>] = send driver command data" },
-diff --git a/src/ap/ap_drv_ops.c b/src/ap/ap_drv_ops.c
-index a7226cfa9..9615ca8ce 100644
---- a/src/ap/ap_drv_ops.c
-+++ b/src/ap/ap_drv_ops.c
-@@ -1213,4 +1213,12 @@ int hostapd_drv_amsdu_dump(struct hostapd_data *hapd, u8 *amsdu)
- if (!hapd->driver || !hapd->driver->amsdu_dump)
- return 0;
- return hapd->driver->amsdu_dump(hapd->drv_priv, amsdu);
--}
-\ No newline at end of file
-+}
-+
-+int hostapd_drv_get_aval_bss_color_bmp(struct hostapd_data *hapd, u64 *aval_color_bmp)
-+{
-+ if (!hapd->driver || !hapd->driver->get_aval_color_bmp ||
-+ hapd->iface->conf->he_op.he_bss_color_disabled)
-+ return 0;
-+ return hapd->driver->get_aval_color_bmp(hapd->drv_priv, aval_color_bmp);
-+}
-diff --git a/src/ap/ap_drv_ops.h b/src/ap/ap_drv_ops.h
-index 422cb5222..136ea2349 100644
---- a/src/ap/ap_drv_ops.h
-+++ b/src/ap/ap_drv_ops.h
-@@ -155,6 +155,8 @@ int hostapd_drv_ibf_ctrl(struct hostapd_data *hapd);
- int hostapd_drv_ibf_dump(struct hostapd_data *hapd, u8 *ibf_enable);
- int hostapd_drv_amsdu_ctrl(struct hostapd_data *hapd);
- int hostapd_drv_amsdu_dump(struct hostapd_data *hapd, u8 *amsdu);
-+int hostapd_drv_get_aval_bss_color_bmp(struct hostapd_data *hapd,
-+ u64 *aval_color_bmp);
-
- #include "drivers/driver.h"
-
-diff --git a/src/common/mtk_vendor.h b/src/common/mtk_vendor.h
-index ace993bc8..e27fe69b3 100644
---- a/src/common/mtk_vendor.h
-+++ b/src/common/mtk_vendor.h
-@@ -15,6 +15,7 @@ enum mtk_nl80211_vendor_subcmds {
- MTK_NL80211_VENDOR_SUBCMD_EDCCA_CTRL = 0xc7,
- MTK_NL80211_VENDOR_SUBCMD_3WIRE_CTRL = 0xc8,
- MTK_NL80211_VENDOR_SUBCMD_IBF_CTRL = 0xc9,
-+ MTK_NL80211_VENDOR_SUBCMD_BSS_COLOR_CTRL = 0xca,
- };
-
- enum mtk_vendor_attr_edcca_ctrl {
-@@ -256,6 +257,16 @@ ibf_dump_policy[NUM_MTK_VENDOR_ATTRS_IBF_DUMP] = {
- [MTK_VENDOR_ATTR_IBF_DUMP_ENABLE] = { .type = NLA_U8 },
- };
-
-+enum mtk_vendor_attr_bss_color_ctrl {
-+ MTK_VENDOR_ATTR_BSS_COLOR_CTRL_UNSPEC,
-+
-+ MTK_VENDOR_ATTR_AVAL_BSS_COLOR_BMP,
-+
-+ /* keep last */
-+ NUM_MTK_VENDOR_ATTRS_BSS_COLOR_CTRL,
-+ MTK_VENDOR_ATTR_BSS_COLOR_CTRL_MAX =
-+ NUM_MTK_VENDOR_ATTRS_BSS_COLOR_CTRL - 1
-+};
-
- #define CSI_MAX_COUNT 256
- #define ETH_ALEN 6
-diff --git a/src/drivers/driver.h b/src/drivers/driver.h
-index 592f506ec..91cb475ac 100644
---- a/src/drivers/driver.h
-+++ b/src/drivers/driver.h
-@@ -5133,6 +5133,14 @@ struct wpa_driver_ops {
- */
- int (*amsdu_ctrl)(void *priv, u8 amsdu);
- int (*amsdu_dump)(void *priv, u8 *amsdu);
-+
-+ /**
-+ * get_aval_color_bmp - get available BSS color bitmap
-+ * @priv: Private driver interface data
-+ * @aval_color_bmp: available bss color bitmap
-+ *
-+ */
-+ int (*get_aval_color_bmp)(void *priv, u64 *aval_color_bmp);
- };
-
- /**
-diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c
-index 4ac8b6e0b..b8730472d 100644
---- a/src/drivers/driver_nl80211.c
-+++ b/src/drivers/driver_nl80211.c
-@@ -12736,7 +12736,6 @@ static void nl80211_parse_btm_candidate_info(struct candidate_list *candidate,
- num, MAC2STR(candidate->bssid), buf);
- }
-
--
- static int
- nl80211_get_bss_transition_status_handler(struct nl_msg *msg, void *arg)
- {
-@@ -14164,6 +14163,203 @@ fail:
- return -ENOBUFS;
- }
-
-+static int nl80211_get_aval_color_bmp_handler(struct nl_msg *msg, void *arg)
-+{
-+ u64 *aval_color_bmp = arg;
-+ struct nlattr *tb[NL80211_ATTR_MAX + 1];
-+ struct nlattr *tb_vendor[MTK_VENDOR_ATTR_BSS_COLOR_CTRL_MAX + 1];
-+ struct genlmsghdr *gnlh = nlmsg_data(nlmsg_hdr(msg));
-+ struct nlattr *nl_vend, *attr;
-+
-+ static const struct nla_policy
-+ bss_color_ctrl_policy[NUM_MTK_VENDOR_ATTRS_BSS_COLOR_CTRL + 1] = {
-+ [MTK_VENDOR_ATTR_AVAL_BSS_COLOR_BMP] = { .type = NLA_U64 },
-+ };
-+
-+ nla_parse(tb, NL80211_ATTR_MAX, genlmsg_attrdata(gnlh, 0),
-+ genlmsg_attrlen(gnlh, 0), NULL);
-+
-+ nl_vend = tb[NL80211_ATTR_VENDOR_DATA];
-+ if (!nl_vend)
-+ return NL_SKIP;
-+
-+ nla_parse(tb_vendor, MTK_VENDOR_ATTR_BSS_COLOR_CTRL_MAX,
-+ nla_data(nl_vend), nla_len(nl_vend), NULL);
-+
-+ *aval_color_bmp = nla_get_u64(tb_vendor[MTK_VENDOR_ATTR_AVAL_BSS_COLOR_BMP]);
-+
-+ return 0;
-+}
-+
-+static int nl80211_get_aval_color_bmp(void *priv, u64 *aval_color_bmp)
-+{
-+ struct i802_bss *bss = priv;
-+ struct wpa_driver_nl80211_data *drv = bss->drv;
-+ struct nl_msg *msg;
-+ struct nlattr *attr;
-+ int ret;
-+
-+ if (!drv->mtk_bss_color_vendor_cmd_avail) {
-+ wpa_printf(MSG_INFO,
-+ "nl80211: Driver does not support BSS COLOR vendor cmd");
-+ return 0;
-+ }
-+
-+ if (!(msg = nl80211_drv_msg(drv, NLM_F_DUMP, NL80211_CMD_VENDOR)) ||
-+ nla_put_u32(msg, NL80211_ATTR_VENDOR_ID, OUI_MTK) ||
-+ nla_put_u32(msg, NL80211_ATTR_VENDOR_SUBCMD,
-+ MTK_NL80211_VENDOR_SUBCMD_BSS_COLOR_CTRL))
-+ return -ENOBUFS;
-+
-+ attr = nla_nest_start(msg, NL80211_ATTR_VENDOR_DATA);
-+ if (!attr) {
-+ nlmsg_free(msg);
-+ return -1;
-+ }
-+
-+ nla_nest_end(msg, attr);
-+
-+ ret = send_and_recv_msgs(drv, msg,
-+ nl80211_get_aval_color_bmp_handler, aval_color_bmp, NULL, NULL);
-+
-+ if (ret) {
-+ wpa_printf(MSG_ERROR, "Failed to send BSS COLOR vendor cmd. ret=%d (%s) ",
-+ ret, strerror(-ret));
-+ }
-+ return ret;
-+}
-+
-+static int nl80211_ap_wireless(void *priv, u8 sub_vendor_id, int value)
-+{
-+ struct i802_bss *bss = priv;
-+ struct wpa_driver_nl80211_data *drv = bss->drv;
-+ struct nl_msg *msg;
-+ struct nlattr *data;
-+ int ret;
-+
-+ if (!drv->mtk_wireless_vendor_cmd_avail) {
-+ wpa_printf(MSG_INFO,
-+ "nl80211: Driver does not support setting ap wireless control");
-+ return 0;
-+ }
-+
-+ msg = nl80211_drv_msg(drv, 0, NL80211_CMD_VENDOR);
-+ if (!msg)
-+ goto fail;
-+
-+ if (nla_put_u32(msg, NL80211_ATTR_VENDOR_ID, OUI_MTK) ||
-+ nla_put_u32(msg, NL80211_ATTR_VENDOR_SUBCMD, MTK_NL80211_VENDOR_SUBCMD_WIRELESS_CTRL))
-+ goto fail;
-+
-+ data = nla_nest_start(msg, NL80211_ATTR_VENDOR_DATA);
-+ if (!data)
-+ goto fail;
-+
-+ if (sub_vendor_id == MTK_VENDOR_ATTR_WIRELESS_CTRL_BA_BUFFER_SIZE)
-+ nla_put_u16(msg, sub_vendor_id, (u16) value);
-+ else
-+ nla_put_u8(msg, sub_vendor_id, (u8) value);
-+
-+ nla_nest_end(msg, data);
-+ ret = send_and_recv_msgs(drv, msg, NULL, NULL, NULL, NULL);
-+ if (ret)
-+ wpa_printf(MSG_ERROR, "Failed to set ap_wireless. ret=%d (%s)", ret, strerror(-ret));
-+
-+ return ret;
-+
-+fail:
-+ nlmsg_free(msg);
-+ return -ENOBUFS;
-+}
-+
-+static int nl80211_ap_rfeatures(void *priv, u8 sub_vendor_id, int value)
-+{
-+ struct i802_bss *bss = priv;
-+ struct wpa_driver_nl80211_data *drv = bss->drv;
-+ struct nl_msg *msg;
-+ struct nlattr *data;
-+ int ret;
-+
-+ if (!drv->mtk_rfeatures_vendor_cmd_avail) {
-+ wpa_printf(MSG_INFO,
-+ "nl80211: Driver does not support setting ap rfeatures control");
-+ return 0;
-+ }
-+
-+ msg = nl80211_drv_msg(drv, 0, NL80211_CMD_VENDOR);
-+ if (!msg)
-+ goto fail;
-+
-+ if (nla_put_u32(msg, NL80211_ATTR_VENDOR_ID, OUI_MTK) ||
-+ nla_put_u32(msg, NL80211_ATTR_VENDOR_SUBCMD, MTK_NL80211_VENDOR_SUBCMD_RFEATURE_CTRL))
-+ goto fail;
-+
-+ data = nla_nest_start(msg, NL80211_ATTR_VENDOR_DATA);
-+ if (!data)
-+ goto fail;
-+
-+ nla_put_u8(msg, sub_vendor_id, (u8) value);
-+
-+ nla_nest_end(msg, data);
-+
-+ ret = send_and_recv_msgs(drv, msg, NULL, NULL, NULL, NULL);
-+ if (ret)
-+ wpa_printf(MSG_ERROR, "Failed to set rf_features. ret=%d (%s)", ret, strerror(-ret));
-+
-+ return ret;
-+
-+fail:
-+ nlmsg_free(msg);
-+ return -ENOBUFS;
-+}
-+
-+static int nl80211_ap_trigtype(void *priv, u8 enable, u8 type)
-+{
-+ struct i802_bss *bss = priv;
-+ struct wpa_driver_nl80211_data *drv = bss->drv;
-+ struct nl_msg *msg;
-+ struct nlattr *data, *data2;
-+ int ret;
-+
-+ if (!drv->mtk_rfeatures_vendor_cmd_avail) {
-+ wpa_printf(MSG_INFO,
-+ "nl80211: Driver does not support setting ap rfeatures control");
-+ return 0;
-+ }
-+
-+ msg = nl80211_drv_msg(drv, 0, NL80211_CMD_VENDOR);
-+ if (!msg)
-+ goto fail;
-+
-+ if (nla_put_u32(msg, NL80211_ATTR_VENDOR_ID, OUI_MTK) ||
-+ nla_put_u32(msg, NL80211_ATTR_VENDOR_SUBCMD, MTK_NL80211_VENDOR_SUBCMD_RFEATURE_CTRL))
-+ goto fail;
-+
-+ data = nla_nest_start(msg, NL80211_ATTR_VENDOR_DATA);
-+ if (!data)
-+ goto fail;
-+
-+ data2 = nla_nest_start(msg, MTK_VENDOR_ATTR_RFEATURE_CTRL_TRIG_TYPE_CFG);
-+ if (!data2)
-+ goto fail;
-+
-+ nla_put_u8(msg, MTK_VENDOR_ATTR_RFEATURE_CTRL_TRIG_TYPE_EN, enable);
-+ nla_put_u8(msg, MTK_VENDOR_ATTR_RFEATURE_CTRL_TRIG_TYPE, type);
-+
-+ nla_nest_end(msg, data2);
-+ nla_nest_end(msg, data);
-+
-+ ret = send_and_recv_msgs(drv, msg, NULL, NULL, NULL, NULL);
-+ if (ret)
-+ wpa_printf(MSG_ERROR, "Failed to set trig_type. ret=%d (%s)", ret, strerror(-ret));
-+
-+ return ret;
-+
-+fail:
-+ nlmsg_free(msg);
-+ return -ENOBUFS;
-+}
-+
- const struct wpa_driver_ops wpa_driver_nl80211_ops = {
- .name = "nl80211",
- .desc = "Linux nl80211/cfg80211",
-@@ -14328,4 +14524,5 @@ const struct wpa_driver_ops wpa_driver_nl80211_ops = {
- .ibf_dump = nl80211_ibf_dump,
- .amsdu_ctrl = nl80211_enable_amsdu,
- .amsdu_dump = nl80211_dump_amsdu,
-+ .get_aval_color_bmp = nl80211_get_aval_color_bmp,
- };
-diff --git a/src/drivers/driver_nl80211.h b/src/drivers/driver_nl80211.h
-index 0100314ba..fd1e57cc2 100644
---- a/src/drivers/driver_nl80211.h
-+++ b/src/drivers/driver_nl80211.h
-@@ -207,6 +207,7 @@ struct wpa_driver_nl80211_data {
- unsigned int mtk_3wire_vendor_cmd_avail:1;
- unsigned int mtk_ibf_vendor_cmd_avail:1;
- unsigned int mtk_wireless_vendor_cmd_avail:1;
-+ unsigned int mtk_bss_color_vendor_cmd_avail:1;
-
- u64 vendor_scan_cookie;
- u64 remain_on_chan_cookie;
-diff --git a/src/drivers/driver_nl80211_capa.c b/src/drivers/driver_nl80211_capa.c
-index f14706d77..4f8e92024 100644
---- a/src/drivers/driver_nl80211_capa.c
-+++ b/src/drivers/driver_nl80211_capa.c
-@@ -1125,6 +1125,9 @@ static int wiphy_info_handler(struct nl_msg *msg, void *arg)
- case MTK_NL80211_VENDOR_SUBCMD_WIRELESS_CTRL:
- drv->mtk_wireless_vendor_cmd_avail = 1;
- break;
-+ case MTK_NL80211_VENDOR_SUBCMD_BSS_COLOR_CTRL :
-+ drv->mtk_bss_color_vendor_cmd_avail = 1;
-+ break;
- }
- }
-
---
-2.39.2
-
diff --git a/recipes-wifi/hostapd/files/patches-2.10.3/mtk-0022-hostapd-mtk-Fix-ZWDFS-issue-in-BW-160.patch b/recipes-wifi/wpa-supplicant/files/patches-2.10.3/mtk-0020-hostapd-mtk-Fix-ZWDFS-issue-in-BW-160.patch
similarity index 97%
copy from recipes-wifi/hostapd/files/patches-2.10.3/mtk-0022-hostapd-mtk-Fix-ZWDFS-issue-in-BW-160.patch
copy to recipes-wifi/wpa-supplicant/files/patches-2.10.3/mtk-0020-hostapd-mtk-Fix-ZWDFS-issue-in-BW-160.patch
index 88dc605..67950bf 100644
--- a/recipes-wifi/hostapd/files/patches-2.10.3/mtk-0022-hostapd-mtk-Fix-ZWDFS-issue-in-BW-160.patch
+++ b/recipes-wifi/wpa-supplicant/files/patches-2.10.3/mtk-0020-hostapd-mtk-Fix-ZWDFS-issue-in-BW-160.patch
@@ -1,7 +1,7 @@
-From 2b0d1e11b72e96c4af1c428b9e3d4de494e40c52 Mon Sep 17 00:00:00 2001
+From 4518e45497260d319663621eca8cea4c0f79b668 Mon Sep 17 00:00:00 2001
From: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
Date: Mon, 20 Mar 2023 16:08:30 +0800
-Subject: [PATCH 22/32] hostapd: mtk: Fix ZWDFS issue in BW 160
+Subject: [PATCH 20/40] hostapd: mtk: Fix ZWDFS issue in BW 160
When background radar is enabled and bandwidth is set to 160, AP will
fail to startup due to the lack of non-DFS channel.
@@ -14,7 +14,7 @@
1 file changed, 79 insertions(+), 19 deletions(-)
diff --git a/src/ap/dfs.c b/src/ap/dfs.c
-index d52a60e0d..2f5c86eb6 100644
+index d52a60e..2f5c86e 100644
--- a/src/ap/dfs.c
+++ b/src/ap/dfs.c
@@ -69,15 +69,22 @@ static int dfs_get_used_n_chans(struct hostapd_iface *iface, int *seg1)
@@ -206,5 +206,5 @@
} else if (hostapd_dfs_is_background_event(iface, freq)) {
iface->radar_background.cac_started = 0;
--
-2.39.2
+2.18.0
diff --git a/recipes-wifi/wpa-supplicant/files/patches-2.10.3/mtk-0021-hostapd-mtk-Add-channel-information-for-hostapd-relo.patch b/recipes-wifi/wpa-supplicant/files/patches-2.10.3/mtk-0021-hostapd-mtk-Add-channel-information-for-hostapd-relo.patch
deleted file mode 100644
index df803ef..0000000
--- a/recipes-wifi/wpa-supplicant/files/patches-2.10.3/mtk-0021-hostapd-mtk-Add-channel-information-for-hostapd-relo.patch
+++ /dev/null
@@ -1,79 +0,0 @@
-From 84337cd7cc25c227b19f8dde3138c40fdbf863b4 Mon Sep 17 00:00:00 2001
-From: Michael Lee <michael-cy.lee@mediatek.com>
-Date: Wed, 22 Mar 2023 13:59:29 +0800
-Subject: [PATCH 21/32] hostapd: mtk: Add channel information for hostapd
- reload
-
-Add center channel, operating class, and bandwidth into the UPDATE
-command when wpa_supplciant reloads hostapd.
-Hostapd can correctly update its channel information.
-
-Signed-off-by: Michael Lee <michael-cy.lee@mediatek.com>
----
- hostapd/ctrl_iface.c | 11 +++++++++++
- wpa_supplicant/wpa_supplicant.c | 17 ++++++++++++++---
- 2 files changed, 25 insertions(+), 3 deletions(-)
-
-diff --git a/hostapd/ctrl_iface.c b/hostapd/ctrl_iface.c
-index 997b50aad..3abf06a09 100644
---- a/hostapd/ctrl_iface.c
-+++ b/hostapd/ctrl_iface.c
-@@ -171,6 +171,17 @@ static struct hostapd_config *hostapd_ctrl_iface_config_read(const char *fname)
- conf->hw_mode = atoi(val);
- else if ((val = get_option(opt, "ieee80211n=")))
- conf->ieee80211n = atoi(val);
-+ else if ((val = get_option(opt, "center_segment0=")))
-+ hostapd_set_oper_centr_freq_seg0_idx(conf, atoi(val));
-+ else if ((val = get_option(opt, "center_segment1=")))
-+ hostapd_set_oper_centr_freq_seg1_idx(conf, atoi(val));
-+ else if ((val = get_option(opt, "op_class="))) {
-+ enum oper_chan_width ch_width;
-+
-+ conf->op_class = atoi(val);
-+ ch_width = op_class_to_ch_width(conf->op_class);
-+ hostapd_set_oper_chwidth(conf, ch_width);
-+ }
- else
- break;
- }
-diff --git a/wpa_supplicant/wpa_supplicant.c b/wpa_supplicant/wpa_supplicant.c
-index deb14632c..2ca2bd263 100644
---- a/wpa_supplicant/wpa_supplicant.c
-+++ b/wpa_supplicant/wpa_supplicant.c
-@@ -150,9 +150,10 @@ static int hostapd_reload(struct wpa_supplicant *wpa_s, struct wpa_bss *bss)
- char buf[256];
- size_t len = sizeof(buf);
- enum hostapd_hw_mode hw_mode;
-- u8 channel;
-+ u8 channel, center_segment0, center_segment1 = 0, op_class;
- int sec_chan = 0;
- int ret;
-+ struct wpa_channel_info ci;
-
- if (!bss)
- return -1;
-@@ -165,9 +166,19 @@ static int hostapd_reload(struct wpa_supplicant *wpa_s, struct wpa_bss *bss)
- sec_chan = -1;
- }
-
-+ ret = wpa_drv_channel_info(wpa_s, &ci);
-+ if (ret)
-+ return -1;
-+
-+ ieee80211_freq_to_chan(ci.center_frq1, ¢er_segment0);
-+ ieee80211_freq_to_chan(ci.center_frq2, ¢er_segment1);
-+ ieee80211_chaninfo_to_channel(ci.frequency, ci.chanwidth, sec_chan,
-+ &op_class, &channel);
- hw_mode = ieee80211_freq_to_chan(bss->freq, &channel);
-- if (asprintf(&cmd, "UPDATE channel=%d sec_chan=%d hw_mode=%d",
-- channel, sec_chan, hw_mode) < 0)
-+ if (asprintf(&cmd, "UPDATE channel=%d center_segment0=%d "
-+ "center_segment1=%d sec_chan=%d hw_mode=%d op_class=%d",
-+ channel, center_segment0, center_segment1, sec_chan,
-+ hw_mode, op_class) < 0)
- return -1;
-
- ret = wpa_ctrl_request(wpa_s->hostapd, cmd, os_strlen(cmd), buf, &len, NULL);
---
-2.39.2
-
diff --git a/recipes-wifi/wpa-supplicant/files/patches-2.10.3/mtk-0023-hostapd-mtk-Add-vendor-for-CAPI-certification-comman.patch b/recipes-wifi/wpa-supplicant/files/patches-2.10.3/mtk-0021-hostapd-mtk-Add-vendor-for-CAPI-certification-comman.patch
similarity index 94%
rename from recipes-wifi/wpa-supplicant/files/patches-2.10.3/mtk-0023-hostapd-mtk-Add-vendor-for-CAPI-certification-comman.patch
rename to recipes-wifi/wpa-supplicant/files/patches-2.10.3/mtk-0021-hostapd-mtk-Add-vendor-for-CAPI-certification-comman.patch
index 9ff8a4f..43905c6 100644
--- a/recipes-wifi/wpa-supplicant/files/patches-2.10.3/mtk-0023-hostapd-mtk-Add-vendor-for-CAPI-certification-comman.patch
+++ b/recipes-wifi/wpa-supplicant/files/patches-2.10.3/mtk-0021-hostapd-mtk-Add-vendor-for-CAPI-certification-comman.patch
@@ -1,11 +1,11 @@
-From 69b54dc64a95701f5e949e55399dacb598d23142 Mon Sep 17 00:00:00 2001
+From 014cf359542aeefc995d936ab4843491c4a3b8b6 Mon Sep 17 00:00:00 2001
From: Evelyn Tsai <evelyn.tsai@mediatek.com>
Date: Fri, 17 Mar 2023 16:17:14 +0800
-Subject: [PATCH 23/32] hostapd: mtk: Add vendor for CAPI certification
+Subject: [PATCH 21/40] hostapd: mtk: Add vendor for CAPI certification
commands
---
- hostapd/ctrl_iface.c | 95 +++++++++++++++++++++++++++++++
+ hostapd/ctrl_iface.c | 97 +++++++++++++++++++++++++++++++
src/ap/ap_drv_ops.c | 21 +++++++
src/ap/ap_drv_ops.h | 3 +
src/common/mtk_vendor.h | 33 +----------
@@ -13,21 +13,21 @@
src/drivers/driver_nl80211.c | 55 ++++++++++++++++++
src/drivers/driver_nl80211.h | 1 +
src/drivers/driver_nl80211_capa.c | 3 +
- 8 files changed, 202 insertions(+), 31 deletions(-)
+ 8 files changed, 204 insertions(+), 31 deletions(-)
diff --git a/hostapd/ctrl_iface.c b/hostapd/ctrl_iface.c
-index 3abf06a09..e0ed700db 100644
+index a6be199..92c94c0 100644
--- a/hostapd/ctrl_iface.c
+++ b/hostapd/ctrl_iface.c
-@@ -70,6 +70,7 @@
- #include "ctrl_iface.h"
+@@ -69,6 +69,7 @@
#include "config_file.h"
+ #include "ctrl_iface.h"
+#include "common/mtk_vendor.h"
#define HOSTAPD_CLI_DUP_VALUE_MAX_LEN 256
-@@ -3837,6 +3838,96 @@ hostapd_ctrl_iface_get_aval_color_bmp(struct hostapd_data *hapd, char *buf,
+@@ -3762,6 +3763,98 @@ hostapd_ctrl_iface_get_aval_color_bmp(struct hostapd_data *hapd, char *buf,
return pos - buf;
}
@@ -61,6 +61,8 @@
+ sub_cmd = MTK_VENDOR_ATTR_WIRELESS_CTRL_MIMO;
+ else if (os_strncmp(config, "cert", 4) == 0)
+ sub_cmd = MTK_VENDOR_ATTR_WIRELESS_CTRL_CERT ;
++ else if (os_strncmp(config, "amsdu", 5) == 0)
++ sub_cmd = MTK_VENDOR_ATTR_WIRELESS_CTRL_AMSDU;
+ else {
+ wpa_printf(MSG_ERROR,
+ "Unsupported parameter %s for ap_wireless", config);
@@ -124,7 +126,7 @@
static int hostapd_ctrl_iface_receive_process(struct hostapd_data *hapd,
char *buf, char *reply,
-@@ -4417,6 +4508,10 @@ static int hostapd_ctrl_iface_receive_process(struct hostapd_data *hapd,
+@@ -4340,6 +4433,10 @@ static int hostapd_ctrl_iface_receive_process(struct hostapd_data *hapd,
reply_len = hostapd_ctrl_iface_get_bss_color(hapd, reply, reply_size);
} else if (os_strncmp(buf, "AVAL_COLOR_BMP", 14) == 0) {
reply_len = hostapd_ctrl_iface_get_aval_color_bmp(hapd, reply, reply_size);
@@ -136,7 +138,7 @@
os_memcpy(reply, "UNKNOWN COMMAND\n", 16);
reply_len = 16;
diff --git a/src/ap/ap_drv_ops.c b/src/ap/ap_drv_ops.c
-index 9615ca8ce..11444c7eb 100644
+index 9615ca8..11444c7 100644
--- a/src/ap/ap_drv_ops.c
+++ b/src/ap/ap_drv_ops.c
@@ -1222,3 +1222,24 @@ int hostapd_drv_get_aval_bss_color_bmp(struct hostapd_data *hapd, u64 *aval_colo
@@ -165,7 +167,7 @@
+ return hapd->driver->ap_trigtype(hapd->drv_priv, enable, type);
+}
diff --git a/src/ap/ap_drv_ops.h b/src/ap/ap_drv_ops.h
-index 136ea2349..946ee2d68 100644
+index 136ea23..946ee2d 100644
--- a/src/ap/ap_drv_ops.h
+++ b/src/ap/ap_drv_ops.h
@@ -157,6 +157,9 @@ int hostapd_drv_amsdu_ctrl(struct hostapd_data *hapd);
@@ -179,7 +181,7 @@
#include "drivers/driver.h"
diff --git a/src/common/mtk_vendor.h b/src/common/mtk_vendor.h
-index e27fe69b3..0b23c76ad 100644
+index e27fe69..0b23c76 100644
--- a/src/common/mtk_vendor.h
+++ b/src/common/mtk_vendor.h
@@ -50,17 +50,6 @@ enum mtk_vendor_attr_edcca_dump {
@@ -258,7 +260,7 @@
MTK_VENDOR_ATTR_BSS_COLOR_CTRL_UNSPEC,
diff --git a/src/drivers/driver.h b/src/drivers/driver.h
-index 91cb475ac..3efea9f68 100644
+index 91cb475..3efea9f 100644
--- a/src/drivers/driver.h
+++ b/src/drivers/driver.h
@@ -5141,6 +5141,28 @@ struct wpa_driver_ops {
@@ -291,7 +293,7 @@
/**
diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c
-index b8730472d..642d75bd1 100644
+index 8b8ddfa..6a42633 100644
--- a/src/drivers/driver_nl80211.c
+++ b/src/drivers/driver_nl80211.c
@@ -76,6 +76,58 @@ enum nlmsgerr_attrs {
@@ -353,7 +355,7 @@
static struct nl_sock * nl_create_handle(struct nl_cb *cb, const char *dbg)
{
struct nl_sock *handle;
-@@ -14525,4 +14577,7 @@ const struct wpa_driver_ops wpa_driver_nl80211_ops = {
+@@ -14522,4 +14574,7 @@ const struct wpa_driver_ops wpa_driver_nl80211_ops = {
.amsdu_ctrl = nl80211_enable_amsdu,
.amsdu_dump = nl80211_dump_amsdu,
.get_aval_color_bmp = nl80211_get_aval_color_bmp,
@@ -362,7 +364,7 @@
+ .ap_trigtype = nl80211_ap_trigtype,
};
diff --git a/src/drivers/driver_nl80211.h b/src/drivers/driver_nl80211.h
-index fd1e57cc2..fc5217d61 100644
+index fd1e57c..fc5217d 100644
--- a/src/drivers/driver_nl80211.h
+++ b/src/drivers/driver_nl80211.h
@@ -208,6 +208,7 @@ struct wpa_driver_nl80211_data {
@@ -374,7 +376,7 @@
u64 vendor_scan_cookie;
u64 remain_on_chan_cookie;
diff --git a/src/drivers/driver_nl80211_capa.c b/src/drivers/driver_nl80211_capa.c
-index 4f8e92024..c1cf5b533 100644
+index 4f8e920..c1cf5b5 100644
--- a/src/drivers/driver_nl80211_capa.c
+++ b/src/drivers/driver_nl80211_capa.c
@@ -1128,6 +1128,9 @@ static int wiphy_info_handler(struct nl_msg *msg, void *arg)
@@ -388,5 +390,5 @@
}
--
-2.39.2
+2.18.0
diff --git a/recipes-wifi/wpa-supplicant/files/patches-2.10.3/mtk-0024-hostapd-mtk-Air-Monitor-support-in-hostapd-by-vendor.patch b/recipes-wifi/wpa-supplicant/files/patches-2.10.3/mtk-0022-hostapd-mtk-Air-Monitor-support-in-hostapd-by-vendor.patch
similarity index 95%
rename from recipes-wifi/wpa-supplicant/files/patches-2.10.3/mtk-0024-hostapd-mtk-Air-Monitor-support-in-hostapd-by-vendor.patch
rename to recipes-wifi/wpa-supplicant/files/patches-2.10.3/mtk-0022-hostapd-mtk-Air-Monitor-support-in-hostapd-by-vendor.patch
index 28a7167..90f9965 100644
--- a/recipes-wifi/wpa-supplicant/files/patches-2.10.3/mtk-0024-hostapd-mtk-Air-Monitor-support-in-hostapd-by-vendor.patch
+++ b/recipes-wifi/wpa-supplicant/files/patches-2.10.3/mtk-0022-hostapd-mtk-Air-Monitor-support-in-hostapd-by-vendor.patch
@@ -1,7 +1,7 @@
-From 06f750bee3e0a9798aa583b27257ef26dd4a1a8c Mon Sep 17 00:00:00 2001
+From 7e2055111b854c61eaa7ad485ebd3bf171b93df5 Mon Sep 17 00:00:00 2001
From: Evelyn Tsai <evelyn.tsai@mediatek.com>
Date: Fri, 12 May 2023 05:18:48 +0800
-Subject: [PATCH 24/32] hostapd: mtk: Air Monitor support in hostapd by vendor
+Subject: [PATCH 22/40] hostapd: mtk: Air Monitor support in hostapd by vendor
Signed-off-by: mtk23888 <dipanshu.mittal@mediatek.com>
---
@@ -17,10 +17,10 @@
9 files changed, 352 insertions(+)
diff --git a/hostapd/ctrl_iface.c b/hostapd/ctrl_iface.c
-index e0ed700db..9989a04ce 100644
+index 92c94c0..1bb64ea 100644
--- a/hostapd/ctrl_iface.c
+++ b/hostapd/ctrl_iface.c
-@@ -3876,6 +3876,44 @@ hostapd_ctrl_iface_ap_wireless(struct hostapd_data *hapd, char *cmd,
+@@ -3803,6 +3803,44 @@ hostapd_ctrl_iface_ap_wireless(struct hostapd_data *hapd, char *cmd,
if (hostapd_drv_ap_wireless(hapd, (u8) sub_cmd, atoi(value)) != 0)
return -1;
@@ -65,7 +65,7 @@
return os_snprintf(buf, buflen, "OK\n");
}
-@@ -3929,6 +3967,75 @@ exit:
+@@ -3856,6 +3894,75 @@ exit:
return os_snprintf(buf, buflen, "OK\n");
}
@@ -141,7 +141,7 @@
static int hostapd_ctrl_iface_receive_process(struct hostapd_data *hapd,
char *buf, char *reply,
int reply_size,
-@@ -4512,6 +4619,12 @@ static int hostapd_ctrl_iface_receive_process(struct hostapd_data *hapd,
+@@ -4437,6 +4544,12 @@ static int hostapd_ctrl_iface_receive_process(struct hostapd_data *hapd,
reply_len = hostapd_ctrl_iface_ap_wireless(hapd, buf + 12, reply, reply_size);
} else if (os_strncmp(buf, "ap_rfeatures ", 13) == 0) {
reply_len = hostapd_ctrl_iface_ap_rfeatures(hapd, buf + 13, reply, reply_size);
@@ -155,7 +155,7 @@
os_memcpy(reply, "UNKNOWN COMMAND\n", 16);
reply_len = 16;
diff --git a/hostapd/hostapd_cli.c b/hostapd/hostapd_cli.c
-index e9e156d28..6d763f327 100644
+index e9e156d..6d763f3 100644
--- a/hostapd/hostapd_cli.c
+++ b/hostapd/hostapd_cli.c
@@ -1633,6 +1633,17 @@ static int hostapd_cli_cmd_get_amsdu(struct wpa_ctrl *ctrl, int argc,
@@ -188,7 +188,7 @@
};
diff --git a/src/ap/ap_drv_ops.c b/src/ap/ap_drv_ops.c
-index 11444c7eb..b90dd5722 100644
+index 11444c7..b90dd57 100644
--- a/src/ap/ap_drv_ops.c
+++ b/src/ap/ap_drv_ops.c
@@ -1243,3 +1243,17 @@ int hostapd_drv_ap_trig_type(struct hostapd_data *hapd, u8 enable, u8 type)
@@ -210,7 +210,7 @@
+ return hapd->driver->amnt_dump(hapd->drv_priv, amnt_idx, amnt_dump_buf);
+}
diff --git a/src/ap/ap_drv_ops.h b/src/ap/ap_drv_ops.h
-index 946ee2d68..1e2a92acb 100644
+index 946ee2d..1e2a92a 100644
--- a/src/ap/ap_drv_ops.h
+++ b/src/ap/ap_drv_ops.h
@@ -161,6 +161,9 @@ int hostapd_drv_ap_wireless(struct hostapd_data *hapd, u8 sub_vendor_id, int val
@@ -224,7 +224,7 @@
int hostapd_drv_wnm_oper(struct hostapd_data *hapd,
diff --git a/src/common/mtk_vendor.h b/src/common/mtk_vendor.h
-index 0b23c76ad..dd1ca2164 100644
+index 0b23c76..dd1ca21 100644
--- a/src/common/mtk_vendor.h
+++ b/src/common/mtk_vendor.h
@@ -258,10 +258,18 @@ struct csi_data {
@@ -247,7 +247,7 @@
+
#endif /* MTK_VENDOR_H */
diff --git a/src/drivers/driver.h b/src/drivers/driver.h
-index 3efea9f68..5c70ec78f 100644
+index 3efea9f..5c70ec7 100644
--- a/src/drivers/driver.h
+++ b/src/drivers/driver.h
@@ -5163,6 +5163,22 @@ struct wpa_driver_ops {
@@ -274,7 +274,7 @@
/**
diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c
-index 642d75bd1..b923e5c7e 100644
+index 6a42633..3d8cb95 100644
--- a/src/drivers/driver_nl80211.c
+++ b/src/drivers/driver_nl80211.c
@@ -128,6 +128,19 @@ wireless_ctrl_policy[NUM_MTK_VENDOR_ATTRS_WIRELESS_CTRL] = {
@@ -297,7 +297,7 @@
static struct nl_sock * nl_create_handle(struct nl_cb *cb, const char *dbg)
{
struct nl_sock *handle;
-@@ -14412,6 +14425,171 @@ fail:
+@@ -14409,6 +14422,171 @@ fail:
return -ENOBUFS;
}
@@ -469,7 +469,7 @@
const struct wpa_driver_ops wpa_driver_nl80211_ops = {
.name = "nl80211",
.desc = "Linux nl80211/cfg80211",
-@@ -14580,4 +14758,6 @@ const struct wpa_driver_ops wpa_driver_nl80211_ops = {
+@@ -14577,4 +14755,6 @@ const struct wpa_driver_ops wpa_driver_nl80211_ops = {
.ap_wireless = nl80211_ap_wireless,
.ap_rfeatures = nl80211_ap_rfeatures,
.ap_trigtype = nl80211_ap_trigtype,
@@ -477,7 +477,7 @@
+ .amnt_dump = nl80211_amnt_dump,
};
diff --git a/src/drivers/driver_nl80211.h b/src/drivers/driver_nl80211.h
-index fc5217d61..0d85adfee 100644
+index fc5217d..0d85adf 100644
--- a/src/drivers/driver_nl80211.h
+++ b/src/drivers/driver_nl80211.h
@@ -209,6 +209,7 @@ struct wpa_driver_nl80211_data {
@@ -489,7 +489,7 @@
u64 vendor_scan_cookie;
u64 remain_on_chan_cookie;
diff --git a/src/drivers/driver_nl80211_capa.c b/src/drivers/driver_nl80211_capa.c
-index c1cf5b533..8c8b84ed3 100644
+index c1cf5b5..8c8b84e 100644
--- a/src/drivers/driver_nl80211_capa.c
+++ b/src/drivers/driver_nl80211_capa.c
@@ -1127,6 +1127,8 @@ static int wiphy_info_handler(struct nl_msg *msg, void *arg)
@@ -502,5 +502,5 @@
case MTK_NL80211_VENDOR_SUBCMD_RFEATURE_CTRL:
drv->mtk_rfeatures_vendor_cmd_avail = 1;
--
-2.39.2
+2.18.0
diff --git a/recipes-wifi/wpa-supplicant/files/patches-2.10.3/mtk-0022-hostapd-mtk-Fix-ZWDFS-issue-in-BW-160.patch b/recipes-wifi/wpa-supplicant/files/patches-2.10.3/mtk-0022-hostapd-mtk-Fix-ZWDFS-issue-in-BW-160.patch
deleted file mode 100644
index 88dc605..0000000
--- a/recipes-wifi/wpa-supplicant/files/patches-2.10.3/mtk-0022-hostapd-mtk-Fix-ZWDFS-issue-in-BW-160.patch
+++ /dev/null
@@ -1,210 +0,0 @@
-From 2b0d1e11b72e96c4af1c428b9e3d4de494e40c52 Mon Sep 17 00:00:00 2001
-From: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
-Date: Mon, 20 Mar 2023 16:08:30 +0800
-Subject: [PATCH 22/32] hostapd: mtk: Fix ZWDFS issue in BW 160
-
-When background radar is enabled and bandwidth is set to 160, AP will
-fail to startup due to the lack of non-DFS channel.
-Under this circumstance, AP should perform CAC itself, and the background
-chain could also perform CAC simultaneously.
-
-Signed-off-by: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
----
- src/ap/dfs.c | 98 ++++++++++++++++++++++++++++++++++++++++++----------
- 1 file changed, 79 insertions(+), 19 deletions(-)
-
-diff --git a/src/ap/dfs.c b/src/ap/dfs.c
-index d52a60e0d..2f5c86eb6 100644
---- a/src/ap/dfs.c
-+++ b/src/ap/dfs.c
-@@ -69,15 +69,22 @@ static int dfs_get_used_n_chans(struct hostapd_iface *iface, int *seg1)
- static int dfs_channel_available(struct hostapd_channel_data *chan,
- enum dfs_channel_type type)
- {
-+ int dfs_status = chan->flag & HOSTAPD_CHAN_DFS_MASK;
-+
-+ if (chan->flag & HOSTAPD_CHAN_DISABLED)
-+ return -1;
-+
- if (type == DFS_NO_CAC_YET) {
- /* Select only radar channel where CAC has not been
- * performed yet
- */
-- if ((chan->flag & HOSTAPD_CHAN_RADAR) &&
-- (chan->flag & HOSTAPD_CHAN_DFS_MASK) ==
-- HOSTAPD_CHAN_DFS_USABLE)
-+ if (!(chan->flag & HOSTAPD_CHAN_RADAR))
-+ return 0;
-+
-+ if (dfs_status == HOSTAPD_CHAN_DFS_USABLE)
- return 1;
-- return 0;
-+
-+ return -1;
- }
-
- /*
-@@ -86,16 +93,14 @@ static int dfs_channel_available(struct hostapd_channel_data *chan,
- * channel for CSA, unless they are available for immediate use.
- */
- if (type == DFS_AVAILABLE && (chan->flag & HOSTAPD_CHAN_RADAR) &&
-- ((chan->flag & HOSTAPD_CHAN_DFS_MASK) !=
-- HOSTAPD_CHAN_DFS_AVAILABLE))
-- return 0;
-+ (dfs_status != HOSTAPD_CHAN_DFS_AVAILABLE))
-+ return -1;
-
-- if (chan->flag & HOSTAPD_CHAN_DISABLED)
-- return 0;
- if ((chan->flag & HOSTAPD_CHAN_RADAR) &&
-- ((chan->flag & HOSTAPD_CHAN_DFS_MASK) ==
-- HOSTAPD_CHAN_DFS_UNAVAILABLE))
-- return 0;
-+ ((dfs_status == HOSTAPD_CHAN_DFS_UNAVAILABLE) ||
-+ (dfs_status == HOSTAPD_CHAN_DFS_UNKNOWN)))
-+ return -1;
-+
- return 1;
- }
-
-@@ -167,7 +172,7 @@ static int dfs_chan_range_available(struct hostapd_hw_modes *mode,
- enum dfs_channel_type type)
- {
- struct hostapd_channel_data *first_chan, *chan;
-- int i;
-+ int i, available = 0, ret = 0;
- u32 bw = num_chan_to_bw(num_chans);
-
- if (first_chan_idx + num_chans > mode->num_channels) {
-@@ -203,14 +208,17 @@ static int dfs_chan_range_available(struct hostapd_hw_modes *mode,
- return 0;
- }
-
-- if (!dfs_channel_available(chan, type)) {
-+ ret = dfs_channel_available(chan, type);
-+ if (ret < 0) {
- wpa_printf(MSG_DEBUG, "DFS: channel not available %d",
- first_chan->freq + i * 20);
- return 0;
- }
-+
-+ available |= ret;
- }
-
-- return 1;
-+ return available;
- }
-
-
-@@ -831,8 +839,12 @@ static unsigned int dfs_get_cac_time(struct hostapd_iface *iface,
- */
- int hostapd_handle_dfs(struct hostapd_iface *iface)
- {
-+ struct hostapd_channel_data *channel;
- int res, n_chans, n_chans1, start_chan_idx, start_chan_idx1;
-- int skip_radar = 0;
-+ int sec = 0, skip_radar = 0;
-+ u8 cf1 = 0, cf2 = 0;
-+ bool use_radar_background = dfs_use_radar_background(iface);
-+ enum dfs_channel_type channel_type = DFS_NO_CAC_YET;
-
- if (is_6ghz_freq(iface->freq))
- return 1;
-@@ -895,7 +907,7 @@ int hostapd_handle_dfs(struct hostapd_iface *iface)
- /* Finally start CAC */
- hostapd_set_state(iface, HAPD_IFACE_DFS);
- wpa_printf(MSG_DEBUG, "DFS start CAC on %d MHz%s", iface->freq,
-- dfs_use_radar_background(iface) ? " (background)" : "");
-+ use_radar_background ? " (background)" : "");
- wpa_msg(iface->bss[0]->msg_ctx, MSG_INFO, DFS_EVENT_CAC_START
- "freq=%d chan=%d sec_chan=%d, width=%d, seg0=%d, seg1=%d, cac_time=%ds",
- iface->freq,
-@@ -905,6 +917,16 @@ int hostapd_handle_dfs(struct hostapd_iface *iface)
- hostapd_get_oper_centr_freq_seg1_idx(iface->conf),
- iface->dfs_cac_ms / 1000);
-
-+ if (use_radar_background) {
-+ channel = dfs_get_valid_channel(iface, &sec, &cf1, &cf2, DFS_AVAILABLE);
-+ /*
-+ * AP cannot get any random available channel.
-+ * Let AP and dedicated radar chain both perform CAC.
-+ */
-+ if (!channel)
-+ use_radar_background = false;
-+ }
-+
- res = hostapd_start_dfs_cac(
- iface, iface->conf->hw_mode, iface->freq, iface->conf->channel,
- iface->conf->ieee80211n, iface->conf->ieee80211ac,
-@@ -913,14 +935,14 @@ int hostapd_handle_dfs(struct hostapd_iface *iface)
- hostapd_get_oper_chwidth(iface->conf),
- hostapd_get_oper_centr_freq_seg0_idx(iface->conf),
- hostapd_get_oper_centr_freq_seg1_idx(iface->conf),
-- dfs_use_radar_background(iface));
-+ use_radar_background);
-
- if (res) {
- wpa_printf(MSG_ERROR, "DFS start_dfs_cac() failed, %d", res);
- return -1;
- }
-
-- if (dfs_use_radar_background(iface)) {
-+ if (use_radar_background) {
- /* Cache background radar parameters. */
- iface->radar_background.channel = iface->conf->channel;
- iface->radar_background.secondary_channel =
-@@ -941,6 +963,35 @@ int hostapd_handle_dfs(struct hostapd_iface *iface)
-
- iface->radar_background.temp_ch = 1;
- return 1;
-+ } else if (dfs_use_radar_background(iface)) {
-+ if (iface->dfs_domain == HOSTAPD_DFS_REGION_ETSI)
-+ channel_type = DFS_ANY_CHANNEL;
-+
-+ channel = dfs_get_valid_channel(iface, &sec, &cf1, &cf2, channel_type);
-+
-+ if (!channel ||
-+ (channel->chan == iface->conf->channel &&
-+ cf1 == hostapd_get_oper_centr_freq_seg0_idx(iface->conf) &&
-+ cf2 == hostapd_get_oper_centr_freq_seg1_idx(iface->conf))) {
-+ wpa_printf(MSG_ERROR, "Background radar could not get valid channel\n");
-+ iface->radar_background.channel = -1;
-+ return 0;
-+ }
-+
-+ hostapd_start_dfs_cac(iface, iface->conf->hw_mode,
-+ channel->freq, channel->chan,
-+ iface->conf->ieee80211n,
-+ iface->conf->ieee80211ac,
-+ iface->conf->ieee80211ax,
-+ iface->conf->ieee80211be,
-+ sec, hostapd_get_oper_chwidth(iface->conf),
-+ cf1, cf2, true);
-+
-+ iface->radar_background.channel = channel->chan;
-+ iface->radar_background.freq = channel->freq;
-+ iface->radar_background.secondary_channel = sec;
-+ iface->radar_background.centr_freq_seg0_idx = cf1;
-+ iface->radar_background.centr_freq_seg1_idx = cf2;
- }
-
- return 0;
-@@ -1190,6 +1241,15 @@ int hostapd_dfs_complete_cac(struct hostapd_iface *iface, int success, int freq,
- hostapd_setup_interface_complete(iface, 0);
- iface->cac_started = 0;
- }
-+
-+ /*
-+ * When background radar is enabled but the CAC completion
-+ * is not received from the background chain.
-+ * Then, reset radar background chain.
-+ */
-+ if (dfs_use_radar_background(iface) &&
-+ iface->radar_background.channel == -1)
-+ hostpad_dfs_update_background_chain(iface);
- }
- } else if (hostapd_dfs_is_background_event(iface, freq)) {
- iface->radar_background.cac_started = 0;
---
-2.39.2
-
diff --git a/recipes-wifi/hostapd/files/patches-2.10.3/mtk-0027-hostapd-mtk-Fix-setting-wrong-seg0-index-for-5G-cent.patch b/recipes-wifi/wpa-supplicant/files/patches-2.10.3/mtk-0023-hostapd-mtk-Fix-setting-wrong-seg0-index-for-5G-cent.patch
similarity index 77%
copy from recipes-wifi/hostapd/files/patches-2.10.3/mtk-0027-hostapd-mtk-Fix-setting-wrong-seg0-index-for-5G-cent.patch
copy to recipes-wifi/wpa-supplicant/files/patches-2.10.3/mtk-0023-hostapd-mtk-Fix-setting-wrong-seg0-index-for-5G-cent.patch
index 85c4ad4..cd30f92 100644
--- a/recipes-wifi/hostapd/files/patches-2.10.3/mtk-0027-hostapd-mtk-Fix-setting-wrong-seg0-index-for-5G-cent.patch
+++ b/recipes-wifi/wpa-supplicant/files/patches-2.10.3/mtk-0023-hostapd-mtk-Fix-setting-wrong-seg0-index-for-5G-cent.patch
@@ -1,7 +1,7 @@
-From 6583d6a35c98648fc5726b16c5c528def0dd4a38 Mon Sep 17 00:00:00 2001
+From a397fa2ee7a72fafbfa5480adfacad75352d7d2a Mon Sep 17 00:00:00 2001
From: Evelyn Tsai <evelyn.tsai@mediatek.com>
Date: Fri, 12 May 2023 05:23:00 +0800
-Subject: [PATCH 27/32] hostapd: mtk: Fix setting wrong seg0 index for 5G
+Subject: [PATCH 23/40] hostapd: mtk: Fix setting wrong seg0 index for 5G
center chan 159 BW40
Signed-off-by: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
@@ -10,10 +10,10 @@
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/ap/ap_config.h b/src/ap/ap_config.h
-index 195816c28..1eb871f10 100644
+index 5b2dbff..b329e81 100644
--- a/src/ap/ap_config.h
+++ b/src/ap/ap_config.h
-@@ -1306,7 +1306,8 @@ hostapd_set_oper_centr_freq_seg0_idx(struct hostapd_config *conf,
+@@ -1305,7 +1305,8 @@ hostapd_set_oper_centr_freq_seg0_idx(struct hostapd_config *conf,
#ifdef CONFIG_IEEE80211BE
if (conf->ieee80211be)
conf->eht_oper_centr_freq_seg0_idx = oper_centr_freq_seg0_idx;
@@ -24,5 +24,5 @@
conf->channel > oper_centr_freq_seg0_idx ? 16 : -16;
#endif /* CONFIG_IEEE80211BE */
--
-2.39.2
+2.18.0
diff --git a/recipes-wifi/hostapd/files/patches-2.10.3/mtk-0028-hostapd-mtk-Add-muru-user-number-debug-command.patch b/recipes-wifi/wpa-supplicant/files/patches-2.10.3/mtk-0024-hostapd-mtk-Add-muru-user-number-debug-command.patch
similarity index 89%
copy from recipes-wifi/hostapd/files/patches-2.10.3/mtk-0028-hostapd-mtk-Add-muru-user-number-debug-command.patch
copy to recipes-wifi/wpa-supplicant/files/patches-2.10.3/mtk-0024-hostapd-mtk-Add-muru-user-number-debug-command.patch
index 85cd75c..95dae39 100644
--- a/recipes-wifi/hostapd/files/patches-2.10.3/mtk-0028-hostapd-mtk-Add-muru-user-number-debug-command.patch
+++ b/recipes-wifi/wpa-supplicant/files/patches-2.10.3/mtk-0024-hostapd-mtk-Add-muru-user-number-debug-command.patch
@@ -1,7 +1,7 @@
-From b232336ca798430ca9d920d1fa58b1418999eeb0 Mon Sep 17 00:00:00 2001
+From de53629544ee0f9508554049bc5927ce2f04fcf9 Mon Sep 17 00:00:00 2001
From: Evelyn Tsai <evelyn.tsai@mediatek.com>
Date: Fri, 12 May 2023 05:24:19 +0800
-Subject: [PATCH 28/32] hostapd: mtk: Add muru user number debug command
+Subject: [PATCH 24/40] hostapd: mtk: Add muru user number debug command
---
hostapd/ctrl_iface.c | 13 ++++++++++++-
@@ -14,10 +14,10 @@
7 files changed, 55 insertions(+), 15 deletions(-)
diff --git a/hostapd/ctrl_iface.c b/hostapd/ctrl_iface.c
-index 4952bef89..972393e77 100644
+index 1bb64ea..f36c138 100644
--- a/hostapd/ctrl_iface.c
+++ b/hostapd/ctrl_iface.c
-@@ -3477,6 +3477,8 @@ hostapd_ctrl_iface_set_edcca(struct hostapd_data *hapd, char *cmd,
+@@ -3398,6 +3398,8 @@ hostapd_ctrl_iface_set_edcca(struct hostapd_data *hapd, char *cmd,
char *buf, size_t buflen)
{
char *pos, *config, *value;
@@ -26,7 +26,7 @@
config = cmd;
pos = os_strchr(config, ' ');
if (pos == NULL)
-@@ -3583,6 +3585,8 @@ hostapd_ctrl_iface_set_mu(struct hostapd_data *hapd, char *cmd,
+@@ -3504,6 +3506,8 @@ hostapd_ctrl_iface_set_mu(struct hostapd_data *hapd, char *cmd,
char *buf, size_t buflen)
{
char *pos, *config, *value;
@@ -35,7 +35,7 @@
config = cmd;
pos = os_strchr(config, ' ');
if (pos == NULL)
-@@ -3600,13 +3604,20 @@ hostapd_ctrl_iface_set_mu(struct hostapd_data *hapd, char *cmd,
+@@ -3521,13 +3525,20 @@ hostapd_ctrl_iface_set_mu(struct hostapd_data *hapd, char *cmd,
return -1;
}
hapd->iconf->mu_onoff = (u8) mu;
@@ -58,7 +58,7 @@
} else {
return -1;
diff --git a/src/ap/ap_drv_ops.c b/src/ap/ap_drv_ops.c
-index b90dd5722..0aec9e925 100644
+index b90dd57..0aec9e9 100644
--- a/src/ap/ap_drv_ops.c
+++ b/src/ap/ap_drv_ops.c
@@ -1162,11 +1162,11 @@ int hostapd_drv_get_edcca(struct hostapd_data *hapd, const u8 mode, u8 *value)
@@ -76,7 +76,7 @@
int hostapd_drv_mu_dump(struct hostapd_data *hapd, u8 *mu_onoff)
diff --git a/src/ap/ap_drv_ops.h b/src/ap/ap_drv_ops.h
-index 1e2a92acb..5dd701e10 100644
+index 1e2a92a..5dd701e 100644
--- a/src/ap/ap_drv_ops.h
+++ b/src/ap/ap_drv_ops.h
@@ -148,7 +148,7 @@ int hostapd_drv_configure_edcca_enable(struct hostapd_data *hapd);
@@ -89,7 +89,7 @@
int hostapd_drv_three_wire_ctrl(struct hostapd_data *hapd);
int hostapd_drv_ibf_ctrl(struct hostapd_data *hapd);
diff --git a/src/ap/hostapd.c b/src/ap/hostapd.c
-index 6e6ae77d7..c684d7e39 100644
+index 24e5df8..25ae08f 100644
--- a/src/ap/hostapd.c
+++ b/src/ap/hostapd.c
@@ -57,6 +57,7 @@
@@ -100,7 +100,7 @@
static int hostapd_flush_old_stations(struct hostapd_data *hapd, u16 reason);
#ifdef CONFIG_WEP
-@@ -2567,7 +2568,7 @@ dfs_offload:
+@@ -2517,7 +2518,7 @@ dfs_offload:
if (hostapd_drv_configure_edcca_threshold(hapd,
hapd->iconf->edcca_threshold) < 0)
goto fail;
@@ -110,7 +110,7 @@
if (hostapd_drv_three_wire_ctrl(hapd) < 0)
goto fail;
diff --git a/src/common/mtk_vendor.h b/src/common/mtk_vendor.h
-index dd1ca2164..99371bf73 100644
+index dd1ca21..99371bf 100644
--- a/src/common/mtk_vendor.h
+++ b/src/common/mtk_vendor.h
@@ -199,6 +199,8 @@ enum mtk_vendor_attr_mu_ctrl {
@@ -133,7 +133,7 @@
+};
#endif /* MTK_VENDOR_H */
diff --git a/src/drivers/driver.h b/src/drivers/driver.h
-index 5c70ec78f..84387a6d7 100644
+index 5c70ec7..84387a6 100644
--- a/src/drivers/driver.h
+++ b/src/drivers/driver.h
@@ -5096,11 +5096,11 @@ struct wpa_driver_ops {
@@ -151,10 +151,10 @@
/**
diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c
-index b923e5c7e..0e7ee4306 100644
+index 3d8cb95..b682620 100644
--- a/src/drivers/driver_nl80211.c
+++ b/src/drivers/driver_nl80211.c
-@@ -13565,13 +13565,13 @@ fail:
+@@ -13562,13 +13562,13 @@ fail:
#ifdef CONFIG_IEEE80211AX
@@ -170,7 +170,7 @@
if (!drv->mtk_mu_vendor_cmd_avail) {
wpa_printf(MSG_INFO,
-@@ -13582,17 +13582,38 @@ static int nl80211_mu_onoff(void *priv, u8 mu_onoff)
+@@ -13579,17 +13579,38 @@ static int nl80211_mu_onoff(void *priv, u8 mu_onoff)
if (!(msg = nl80211_drv_msg(drv, 0, NL80211_CMD_VENDOR)) ||
nla_put_u32(msg, NL80211_ATTR_VENDOR_ID, OUI_MTK) ||
nla_put_u32(msg, NL80211_ATTR_VENDOR_SUBCMD, MTK_NL80211_VENDOR_SUBCMD_MU_CTRL) ||
@@ -214,7 +214,7 @@
}
-@@ -14734,7 +14755,7 @@ const struct wpa_driver_ops wpa_driver_nl80211_ops = {
+@@ -14731,7 +14752,7 @@ const struct wpa_driver_ops wpa_driver_nl80211_ops = {
.update_connect_params = nl80211_update_connection_params,
.send_external_auth_status = nl80211_send_external_auth_status,
.set_4addr_mode = nl80211_set_4addr_mode,
@@ -224,5 +224,5 @@
#ifdef CONFIG_DPP
.dpp_listen = nl80211_dpp_listen,
--
-2.39.2
+2.18.0
diff --git a/recipes-wifi/wpa-supplicant/files/patches-2.10.3/mtk-0025-hostapd-mtk-Fix-scan-result-updating-issue.patch b/recipes-wifi/wpa-supplicant/files/patches-2.10.3/mtk-0025-hostapd-mtk-Fix-scan-result-updating-issue.patch
deleted file mode 100644
index cbd0111..0000000
--- a/recipes-wifi/wpa-supplicant/files/patches-2.10.3/mtk-0025-hostapd-mtk-Fix-scan-result-updating-issue.patch
+++ /dev/null
@@ -1,33 +0,0 @@
-From eb14389eb6c2e30a702ee7ebc98330fbc62edb44 Mon Sep 17 00:00:00 2001
-From: Michael Lee <michael-cy.lee@mediatek.com>
-Date: Wed, 19 Apr 2023 17:18:33 +0800
-Subject: [PATCH 25/32] hostapd: mtk: Fix scan result updating issue
-
-There are no HT capability and operation in beacon of AP operating in
-NOHT.
-Therefore, when updating scan results, HT capability and operation
-should be assigned the default value for this kind of AP.
----
- wpa_supplicant/bss.c | 4 ++++
- 1 file changed, 4 insertions(+)
-
-diff --git a/wpa_supplicant/bss.c b/wpa_supplicant/bss.c
-index 3bfcf7ef4..004d4a639 100644
---- a/wpa_supplicant/bss.c
-+++ b/wpa_supplicant/bss.c
-@@ -307,8 +307,12 @@ static void wpa_bss_copy_res(struct wpa_bss *dst, struct wpa_scan_res *src,
- oper = (struct ieee80211_ht_operation *) elems.ht_operation;
- if (capab)
- dst->ht_capab = le_to_host16(capab->ht_capabilities_info);
-+ else
-+ dst->ht_capab = 0;
- if (oper)
- dst->ht_param = oper->ht_param;
-+ else
-+ dst->ht_param = 0;
-
- calculate_update_time(fetch_time, src->age, &dst->last_update);
- }
---
-2.39.2
-
diff --git a/recipes-wifi/hostapd/files/patches-2.10.3/mtk-0031-hostapd-mtk-add-connac3-PHY-MURU-manual-mode-config-.patch b/recipes-wifi/wpa-supplicant/files/patches-2.10.3/mtk-0025-hostapd-mtk-add-connac3-PHY-MURU-manual-mode-config-.patch
similarity index 95%
copy from recipes-wifi/hostapd/files/patches-2.10.3/mtk-0031-hostapd-mtk-add-connac3-PHY-MURU-manual-mode-config-.patch
copy to recipes-wifi/wpa-supplicant/files/patches-2.10.3/mtk-0025-hostapd-mtk-add-connac3-PHY-MURU-manual-mode-config-.patch
index 6354d3c..19a3c79 100644
--- a/recipes-wifi/hostapd/files/patches-2.10.3/mtk-0031-hostapd-mtk-add-connac3-PHY-MURU-manual-mode-config-.patch
+++ b/recipes-wifi/wpa-supplicant/files/patches-2.10.3/mtk-0025-hostapd-mtk-add-connac3-PHY-MURU-manual-mode-config-.patch
@@ -1,7 +1,8 @@
-From 78107269ba6f1ef6449e385e0182970ad85d7f43 Mon Sep 17 00:00:00 2001
+From 7f1a652729514a0f9a885be30185810c18110c4d Mon Sep 17 00:00:00 2001
From: Howard Hsu <howard-yh.hsu@mediatek.com>
Date: Sat, 3 Jun 2023 17:12:15 +0800
-Subject: [PATCH] hostapd: mtk: add connac3 PHY MURU manual mode config support
+Subject: [PATCH 25/40] hostapd: mtk: add connac3 PHY MURU manual mode config
+ support
This commit supports read the following two formats to set MU/RU manual
mode:
@@ -46,10 +47,10 @@
8 files changed, 390 insertions(+), 43 deletions(-)
diff --git a/hostapd/ctrl_iface.c b/hostapd/ctrl_iface.c
-index 972393e..b280a04 100644
+index f36c138..c288352 100644
--- a/hostapd/ctrl_iface.c
+++ b/hostapd/ctrl_iface.c
-@@ -3579,22 +3579,61 @@ hostapd_ctrl_iface_get_edcca(struct hostapd_data *hapd, char *cmd, char *buf,
+@@ -3500,22 +3500,61 @@ hostapd_ctrl_iface_get_edcca(struct hostapd_data *hapd, char *cmd, char *buf,
}
}
@@ -118,7 +119,7 @@
value = pos;
if (os_strcmp(config, "onoff") == 0) {
-@@ -3604,24 +3643,167 @@ hostapd_ctrl_iface_set_mu(struct hostapd_data *hapd, char *cmd,
+@@ -3525,24 +3564,167 @@ hostapd_ctrl_iface_set_mu(struct hostapd_data *hapd, char *cmd,
return -1;
}
hapd->iconf->mu_onoff = (u8) mu;
@@ -300,7 +301,7 @@
}
-@@ -4613,8 +4795,7 @@ static int hostapd_ctrl_iface_receive_process(struct hostapd_data *hapd,
+@@ -4534,8 +4716,7 @@ static int hostapd_ctrl_iface_receive_process(struct hostapd_data *hapd,
reply_len = hostapd_ctrl_iface_get_edcca(hapd, buf+10, reply,
reply_size);
} else if (os_strncmp(buf, "SET_MU ", 7) == 0) {
@@ -310,7 +311,7 @@
} else if (os_strncmp(buf, "GET_MU", 6) == 0) {
reply_len = hostapd_ctrl_iface_get_mu(hapd, reply, reply_size);
} else if (os_strncmp(buf, "GET_IBF", 7) == 0) {
-@@ -4640,6 +4821,14 @@ static int hostapd_ctrl_iface_receive_process(struct hostapd_data *hapd,
+@@ -4561,6 +4742,14 @@ static int hostapd_ctrl_iface_receive_process(struct hostapd_data *hapd,
} else if (os_strncmp(buf, "DUMP_AMNT", 9) == 0) {
reply_len = hostapd_ctrl_iface_dump_amnt(hapd, buf+10,
reply, reply_size);
@@ -326,10 +327,10 @@
os_memcpy(reply, "UNKNOWN COMMAND\n", 16);
reply_len = 16;
diff --git a/src/ap/ap_config.h b/src/ap/ap_config.h
-index 1eb871f..4e38e67 100644
+index b329e81..d43f1a6 100644
--- a/src/ap/ap_config.h
+++ b/src/ap/ap_config.h
-@@ -1201,6 +1201,7 @@ struct hostapd_config {
+@@ -1200,6 +1200,7 @@ struct hostapd_config {
u8 ibf_enable;
u8 dfs_detect_mode;
u8 amsdu;
@@ -369,10 +370,10 @@
int hostapd_drv_three_wire_ctrl(struct hostapd_data *hapd);
int hostapd_drv_ibf_ctrl(struct hostapd_data *hapd);
diff --git a/src/ap/hostapd.c b/src/ap/hostapd.c
-index c684d7e..52d04d6 100644
+index 25ae08f..0dc86bf 100644
--- a/src/ap/hostapd.c
+++ b/src/ap/hostapd.c
-@@ -2568,7 +2568,7 @@ dfs_offload:
+@@ -2518,7 +2518,7 @@ dfs_offload:
if (hostapd_drv_configure_edcca_threshold(hapd,
hapd->iconf->edcca_threshold) < 0)
goto fail;
@@ -579,10 +580,10 @@
/**
diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c
-index ab121ca..fdd8505 100644
+index b682620..22c56f9 100644
--- a/src/drivers/driver_nl80211.c
+++ b/src/drivers/driver_nl80211.c
-@@ -13566,12 +13566,13 @@ fail:
+@@ -13562,12 +13562,13 @@ fail:
#ifdef CONFIG_IEEE80211AX
@@ -597,7 +598,7 @@
int ret = -ENOBUFS;
if (!drv->mtk_mu_vendor_cmd_avail) {
-@@ -13588,17 +13589,16 @@ static int nl80211_mu_ctrl(void *priv, u8 mode, u8 val)
+@@ -13584,17 +13585,16 @@ static int nl80211_mu_ctrl(void *priv, u8 mode, u8 val)
switch (mode) {
case MU_CTRL_ONOFF:
@@ -622,7 +623,7 @@
ret = -EINVAL;
goto fail;
}
-@@ -13606,9 +13606,8 @@ static int nl80211_mu_ctrl(void *priv, u8 mode, u8 val)
+@@ -13602,9 +13602,8 @@ static int nl80211_mu_ctrl(void *priv, u8 mode, u8 val)
nla_nest_end(msg, data);
ret = send_and_recv_msgs(drv, msg, NULL, NULL, NULL, NULL);
diff --git a/recipes-wifi/wpa-supplicant/files/patches-2.10.3/mtk-0032-hostapd-mtk-Add-HE-capabilities-check.patch b/recipes-wifi/wpa-supplicant/files/patches-2.10.3/mtk-0026-hostapd-mtk-Add-HE-capabilities-check.patch
similarity index 91%
rename from recipes-wifi/wpa-supplicant/files/patches-2.10.3/mtk-0032-hostapd-mtk-Add-HE-capabilities-check.patch
rename to recipes-wifi/wpa-supplicant/files/patches-2.10.3/mtk-0026-hostapd-mtk-Add-HE-capabilities-check.patch
index 4b7c8b4..a93ae69 100644
--- a/recipes-wifi/wpa-supplicant/files/patches-2.10.3/mtk-0032-hostapd-mtk-Add-HE-capabilities-check.patch
+++ b/recipes-wifi/wpa-supplicant/files/patches-2.10.3/mtk-0026-hostapd-mtk-Add-HE-capabilities-check.patch
@@ -1,7 +1,7 @@
-From bb2459cc960ea017702c11e19cf3dbef4df599b8 Mon Sep 17 00:00:00 2001
+From 963b6800d4416d5a88053097128a33d8bdc8f56b Mon Sep 17 00:00:00 2001
From: MeiChia Chiu <meichia.chiu@mediatek.com>
Date: Fri, 9 Jun 2023 09:03:05 +0800
-Subject: [PATCH 32/32] hostapd: mtk: Add HE capabilities check
+Subject: [PATCH 26/40] hostapd: mtk: Add HE capabilities check
Add HE capabilities check.
Since "HE capabilities" check has been removed by driver,
@@ -11,7 +11,7 @@
1 file changed, 26 insertions(+)
diff --git a/src/ap/hw_features.c b/src/ap/hw_features.c
-index 828b9261b..991af2c45 100644
+index 828b926..991af2c 100644
--- a/src/ap/hw_features.c
+++ b/src/ap/hw_features.c
@@ -680,6 +680,32 @@ static int ieee80211ac_supported_vht_capab(struct hostapd_iface *iface)
@@ -48,5 +48,5 @@
}
#endif /* CONFIG_IEEE80211AX */
--
-2.39.2
+2.18.0
diff --git a/recipes-wifi/wpa-supplicant/files/patches-2.10.3/mtk-0026-hostapd-mtk-Avoid-setting-beacon-after-wpa_supplican.patch b/recipes-wifi/wpa-supplicant/files/patches-2.10.3/mtk-0026-hostapd-mtk-Avoid-setting-beacon-after-wpa_supplican.patch
deleted file mode 100644
index dbd7163..0000000
--- a/recipes-wifi/wpa-supplicant/files/patches-2.10.3/mtk-0026-hostapd-mtk-Avoid-setting-beacon-after-wpa_supplican.patch
+++ /dev/null
@@ -1,165 +0,0 @@
-From 67e2363c4875dd918418dd84b43f86041db690c7 Mon Sep 17 00:00:00 2001
-From: Evelyn Tsai <evelyn.tsai@mediatek.com>
-Date: Fri, 12 May 2023 05:21:28 +0800
-Subject: [PATCH] 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 e575c37d1..0e352c5c7 100644
---- a/hostapd/ctrl_iface.c
-+++ b/hostapd/ctrl_iface.c
-@@ -194,11 +194,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 f26e5254c..1aaeaa8e4 100644
---- a/src/ap/beacon.c
-+++ b/src/ap/beacon.c
-@@ -2246,7 +2246,8 @@ int ieee802_11_set_beacon(struct hostapd_data *hapd)
- continue;
-
- for (i = 0; i < other->num_bss; i++) {
-- if (other->bss[i] && other->bss[i]->started)
-+ if (other->bss[i] && other->bss[i]->started &&
-+ !other->bss[i]->stopped_by_supplicant)
- __ieee802_11_set_beacon(other->bss[i]);
- }
- }
-@@ -2262,6 +2263,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;
- }
-@@ -2278,6 +2280,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 725d3cd34..78fd9d8ec 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 aab8a4665..d52188bb7 100644
---- a/src/ap/ctrl_iface_ap.c
-+++ b/src/ap/ctrl_iface_ap.c
-@@ -1028,8 +1028,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 28e549b61..be75613c8 100644
---- a/src/ap/hostapd.c
-+++ b/src/ap/hostapd.c
-@@ -510,6 +510,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_ucode_free_bss(hapd);
-@@ -1320,6 +1321,7 @@ int hostapd_setup_bss(struct hostapd_data *hapd, int first, bool start_beacon)
- return -1;
- }
- hapd->started = 1;
-+ hapd->stopped_by_supplicant = 0;
-
- if (!first || first == -1) {
- u8 *addr = hapd->own_addr;
-@@ -4289,7 +4291,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 5bd1537fe..435dbd027 100644
---- a/src/ap/hostapd.h
-+++ b/src/ap/hostapd.h
-@@ -197,6 +197,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];
- u8 mld_addr[ETH_ALEN];
---
-2.39.2
-
diff --git a/recipes-wifi/hostapd/files/patches-2.10.3/mtk-0033-hostapd-mtk-Fix-background-channel-overlapping-opera.patch b/recipes-wifi/wpa-supplicant/files/patches-2.10.3/mtk-0027-hostapd-mtk-Fix-background-channel-overlapping-opera.patch
similarity index 92%
copy from recipes-wifi/hostapd/files/patches-2.10.3/mtk-0033-hostapd-mtk-Fix-background-channel-overlapping-opera.patch
copy to recipes-wifi/wpa-supplicant/files/patches-2.10.3/mtk-0027-hostapd-mtk-Fix-background-channel-overlapping-opera.patch
index dd121ca..1134253 100644
--- a/recipes-wifi/hostapd/files/patches-2.10.3/mtk-0033-hostapd-mtk-Fix-background-channel-overlapping-opera.patch
+++ b/recipes-wifi/wpa-supplicant/files/patches-2.10.3/mtk-0027-hostapd-mtk-Fix-background-channel-overlapping-opera.patch
@@ -1,8 +1,8 @@
-From 76e54b095fdd8ab65a562c28fba330afcfb519ec Mon Sep 17 00:00:00 2001
+From b79b625e3790f0d9152f736629fbc0dcd826bf62 Mon Sep 17 00:00:00 2001
From: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
Date: Wed, 5 Jul 2023 10:44:15 +0800
-Subject: [PATCH] hostapd: mtk: Fix background channel overlapping operating
- channel issue
+Subject: [PATCH 27/40] hostapd: mtk: Fix background channel overlapping
+ operating channel issue
Signed-off-by: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
---
diff --git a/recipes-wifi/wpa-supplicant/files/patches-2.10.3/mtk-0027-hostapd-mtk-Fix-setting-wrong-seg0-index-for-5G-cent.patch b/recipes-wifi/wpa-supplicant/files/patches-2.10.3/mtk-0027-hostapd-mtk-Fix-setting-wrong-seg0-index-for-5G-cent.patch
deleted file mode 100644
index 85c4ad4..0000000
--- a/recipes-wifi/wpa-supplicant/files/patches-2.10.3/mtk-0027-hostapd-mtk-Fix-setting-wrong-seg0-index-for-5G-cent.patch
+++ /dev/null
@@ -1,28 +0,0 @@
-From 6583d6a35c98648fc5726b16c5c528def0dd4a38 Mon Sep 17 00:00:00 2001
-From: Evelyn Tsai <evelyn.tsai@mediatek.com>
-Date: Fri, 12 May 2023 05:23:00 +0800
-Subject: [PATCH 27/32] hostapd: mtk: Fix setting wrong seg0 index for 5G
- center chan 159 BW40
-
-Signed-off-by: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
----
- src/ap/ap_config.h | 3 ++-
- 1 file changed, 2 insertions(+), 1 deletion(-)
-
-diff --git a/src/ap/ap_config.h b/src/ap/ap_config.h
-index 195816c28..1eb871f10 100644
---- a/src/ap/ap_config.h
-+++ b/src/ap/ap_config.h
-@@ -1306,7 +1306,8 @@ hostapd_set_oper_centr_freq_seg0_idx(struct hostapd_config *conf,
- #ifdef CONFIG_IEEE80211BE
- if (conf->ieee80211be)
- conf->eht_oper_centr_freq_seg0_idx = oper_centr_freq_seg0_idx;
-- if (center_idx_to_bw_6ghz(oper_centr_freq_seg0_idx) == 4)
-+ if (is_6ghz_op_class(conf->op_class) &&
-+ center_idx_to_bw_6ghz(oper_centr_freq_seg0_idx) == 4)
- oper_centr_freq_seg0_idx +=
- conf->channel > oper_centr_freq_seg0_idx ? 16 : -16;
- #endif /* CONFIG_IEEE80211BE */
---
-2.39.2
-
diff --git a/recipes-wifi/wpa-supplicant/files/patches-2.10.3/mtk-0028-hostapd-mtk-Add-muru-user-number-debug-command.patch b/recipes-wifi/wpa-supplicant/files/patches-2.10.3/mtk-0028-hostapd-mtk-Add-muru-user-number-debug-command.patch
deleted file mode 100644
index 85cd75c..0000000
--- a/recipes-wifi/wpa-supplicant/files/patches-2.10.3/mtk-0028-hostapd-mtk-Add-muru-user-number-debug-command.patch
+++ /dev/null
@@ -1,228 +0,0 @@
-From b232336ca798430ca9d920d1fa58b1418999eeb0 Mon Sep 17 00:00:00 2001
-From: Evelyn Tsai <evelyn.tsai@mediatek.com>
-Date: Fri, 12 May 2023 05:24:19 +0800
-Subject: [PATCH 28/32] hostapd: mtk: Add muru user number debug command
-
----
- hostapd/ctrl_iface.c | 13 ++++++++++++-
- src/ap/ap_drv_ops.c | 4 ++--
- src/ap/ap_drv_ops.h | 2 +-
- src/ap/hostapd.c | 3 ++-
- src/common/mtk_vendor.h | 7 +++++++
- src/drivers/driver.h | 4 ++--
- src/drivers/driver_nl80211.c | 37 ++++++++++++++++++++++++++++--------
- 7 files changed, 55 insertions(+), 15 deletions(-)
-
-diff --git a/hostapd/ctrl_iface.c b/hostapd/ctrl_iface.c
-index 4952bef89..972393e77 100644
---- a/hostapd/ctrl_iface.c
-+++ b/hostapd/ctrl_iface.c
-@@ -3477,6 +3477,8 @@ hostapd_ctrl_iface_set_edcca(struct hostapd_data *hapd, char *cmd,
- char *buf, size_t buflen)
- {
- char *pos, *config, *value;
-+ u8 mode;
-+
- config = cmd;
- pos = os_strchr(config, ' ');
- if (pos == NULL)
-@@ -3583,6 +3585,8 @@ hostapd_ctrl_iface_set_mu(struct hostapd_data *hapd, char *cmd,
- char *buf, size_t buflen)
- {
- char *pos, *config, *value;
-+ u8 mode;
-+
- config = cmd;
- pos = os_strchr(config, ' ');
- if (pos == NULL)
-@@ -3600,13 +3604,20 @@ hostapd_ctrl_iface_set_mu(struct hostapd_data *hapd, char *cmd,
- return -1;
- }
- hapd->iconf->mu_onoff = (u8) mu;
-+ mode = MU_CTRL_ONOFF;
-+ } else if (os_strcmp(config, "ul_user_cnt") == 0) {
-+ mode = MU_CTRL_UL_USER_CNT;
-+ wpa_printf(MSG_ERROR, "ul_user_cnt:%d\n", (u8)atoi(value));
-+ } else if (os_strcmp(config, "dl_user_cnt") == 0) {
-+ mode = MU_CTRL_DL_USER_CNT;
-+ wpa_printf(MSG_ERROR, "dl_user_cnt:%d\n", (u8)atoi(value));
- } else {
- wpa_printf(MSG_ERROR,
- "Unsupported parameter %s for SET_MU", config);
- return -1;
- }
-
-- if(hostapd_drv_mu_ctrl(hapd) == 0) {
-+ if(hostapd_drv_mu_ctrl(hapd, mode, (u8)atoi(value)) == 0) {
- return os_snprintf(buf, buflen, "OK\n");
- } else {
- return -1;
-diff --git a/src/ap/ap_drv_ops.c b/src/ap/ap_drv_ops.c
-index b90dd5722..0aec9e925 100644
---- a/src/ap/ap_drv_ops.c
-+++ b/src/ap/ap_drv_ops.c
-@@ -1162,11 +1162,11 @@ int hostapd_drv_get_edcca(struct hostapd_data *hapd, const u8 mode, u8 *value)
- return hapd->driver->get_edcca(hapd->drv_priv, mode, value);
- }
-
--int hostapd_drv_mu_ctrl(struct hostapd_data *hapd)
-+int hostapd_drv_mu_ctrl(struct hostapd_data *hapd, u8 mode, u8 val)
- {
- if (!hapd->driver || !hapd->driver->mu_ctrl)
- return 0;
-- return hapd->driver->mu_ctrl(hapd->drv_priv, hapd->iconf->mu_onoff);
-+ return hapd->driver->mu_ctrl(hapd->drv_priv, mode, val);
- }
-
- int hostapd_drv_mu_dump(struct hostapd_data *hapd, u8 *mu_onoff)
-diff --git a/src/ap/ap_drv_ops.h b/src/ap/ap_drv_ops.h
-index 1e2a92acb..5dd701e10 100644
---- a/src/ap/ap_drv_ops.h
-+++ b/src/ap/ap_drv_ops.h
-@@ -148,7 +148,7 @@ int hostapd_drv_configure_edcca_enable(struct hostapd_data *hapd);
- int hostapd_drv_configure_edcca_threshold(struct hostapd_data *hapd,
- const int *threshold);
- int hostapd_drv_get_edcca(struct hostapd_data *hapd, const u8 mode, u8 *value);
--int hostapd_drv_mu_ctrl(struct hostapd_data *hapd);
-+int hostapd_drv_mu_ctrl(struct hostapd_data *hapd, u8 mode, u8 val);
- int hostapd_drv_mu_dump(struct hostapd_data *hapd, u8 *mu_onoff);
- int hostapd_drv_three_wire_ctrl(struct hostapd_data *hapd);
- int hostapd_drv_ibf_ctrl(struct hostapd_data *hapd);
-diff --git a/src/ap/hostapd.c b/src/ap/hostapd.c
-index 6e6ae77d7..c684d7e39 100644
---- a/src/ap/hostapd.c
-+++ b/src/ap/hostapd.c
-@@ -57,6 +57,7 @@
- #include "wpa_auth_kay.h"
- #include "hw_features.h"
-
-+#include "common/mtk_vendor.h"
-
- static int hostapd_flush_old_stations(struct hostapd_data *hapd, u16 reason);
- #ifdef CONFIG_WEP
-@@ -2567,7 +2568,7 @@ dfs_offload:
- if (hostapd_drv_configure_edcca_threshold(hapd,
- hapd->iconf->edcca_threshold) < 0)
- goto fail;
-- if (hostapd_drv_mu_ctrl(hapd) < 0)
-+ if (hostapd_drv_mu_ctrl(hapd, MU_CTRL_ONOFF, hapd->iconf->mu_onoff) < 0)
- goto fail;
- if (hostapd_drv_three_wire_ctrl(hapd) < 0)
- goto fail;
-diff --git a/src/common/mtk_vendor.h b/src/common/mtk_vendor.h
-index dd1ca2164..99371bf73 100644
---- a/src/common/mtk_vendor.h
-+++ b/src/common/mtk_vendor.h
-@@ -199,6 +199,8 @@ enum mtk_vendor_attr_mu_ctrl {
-
- MTK_VENDOR_ATTR_MU_CTRL_ONOFF,
- MTK_VENDOR_ATTR_MU_CTRL_DUMP,
-+ MTK_VENDOR_ATTR_MU_CTRL_OFDMA_MODE,
-+ MTK_VENDOR_ATTR_MU_CTRL_OFDMA_VAL,
-
- /* keep last */
- NUM_MTK_VENDOR_ATTRS_MU_CTRL,
-@@ -272,4 +274,9 @@ struct amnt_resp_data {
- struct amnt_data resp_data[0];
- };
-
-+enum {
-+ MU_CTRL_ONOFF,
-+ MU_CTRL_DL_USER_CNT,
-+ MU_CTRL_UL_USER_CNT,
-+};
- #endif /* MTK_VENDOR_H */
-diff --git a/src/drivers/driver.h b/src/drivers/driver.h
-index 5c70ec78f..84387a6d7 100644
---- a/src/drivers/driver.h
-+++ b/src/drivers/driver.h
-@@ -5096,11 +5096,11 @@ struct wpa_driver_ops {
- int (*get_edcca)(void *priv, const u8 mode, u8 *value);
-
- /**
-- * mu_ctrl - ctrl on off for UL/DL MURU
-+ * mu_ctrl - ctrl for UL/DL MURU
- * @priv: Private driver interface data
- *
- */
-- int (*mu_ctrl)(void *priv, u8 mu_onoff);
-+ int (*mu_ctrl)(void *priv, u8 mode, u8 val);
- int (*mu_dump)(void *priv, u8 *mu_onoff);
-
- /**
-diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c
-index b923e5c7e..0e7ee4306 100644
---- a/src/drivers/driver_nl80211.c
-+++ b/src/drivers/driver_nl80211.c
-@@ -13565,13 +13565,13 @@ fail:
-
-
- #ifdef CONFIG_IEEE80211AX
--static int nl80211_mu_onoff(void *priv, u8 mu_onoff)
-+static int nl80211_mu_ctrl(void *priv, u8 mode, u8 val)
- {
- struct i802_bss *bss = priv;
- struct wpa_driver_nl80211_data *drv = bss->drv;
- struct nl_msg *msg;
- struct nlattr *data;
-- int ret;
-+ int ret = -ENOBUFS;
-
- if (!drv->mtk_mu_vendor_cmd_avail) {
- wpa_printf(MSG_INFO,
-@@ -13582,17 +13582,38 @@ static int nl80211_mu_onoff(void *priv, u8 mu_onoff)
- if (!(msg = nl80211_drv_msg(drv, 0, NL80211_CMD_VENDOR)) ||
- nla_put_u32(msg, NL80211_ATTR_VENDOR_ID, OUI_MTK) ||
- nla_put_u32(msg, NL80211_ATTR_VENDOR_SUBCMD, MTK_NL80211_VENDOR_SUBCMD_MU_CTRL) ||
-- !(data = nla_nest_start(msg, NL80211_ATTR_VENDOR_DATA)) ||
-- nla_put_u8(msg, MTK_VENDOR_ATTR_MU_CTRL_ONOFF, mu_onoff)) {
-- nlmsg_free(msg);
-- return -ENOBUFS;
-+ !(data = nla_nest_start(msg, NL80211_ATTR_VENDOR_DATA)))
-+ goto fail;
-+
-+ switch (mode) {
-+ case MU_CTRL_ONOFF:
-+ if (nla_put_u8(msg, MTK_VENDOR_ATTR_MU_CTRL_ONOFF, val))
-+ goto fail;
-+ break;
-+ case MU_CTRL_UL_USER_CNT:
-+ case MU_CTRL_DL_USER_CNT:
-+ if (nla_put_u8(msg, MTK_VENDOR_ATTR_MU_CTRL_OFDMA_MODE, mode) ||
-+ nla_put_u8(msg, MTK_VENDOR_ATTR_MU_CTRL_OFDMA_VAL, val))
-+ goto fail;
-+ break;
-+ default:
-+ wpa_printf(MSG_ERROR, "nl80211: Wrong mu mode !");
-+ ret = -EINVAL;
-+ goto fail;
- }
-+
- nla_nest_end(msg, data);
-+
- ret = send_and_recv_msgs(drv, msg, NULL, NULL, NULL, NULL);
- if(ret){
-- wpa_printf(MSG_ERROR, "Failed to set mu_onoff. ret=%d (%s)", ret, strerror(-ret));
-+ wpa_printf(MSG_ERROR, "Failed to set mu_ctrl. ret=%d (%s)", ret, strerror(-ret));
- }
- return ret;
-+
-+fail:
-+ nl80211_nlmsg_clear(msg);
-+ nlmsg_free(msg);
-+ return ret;
- }
-
-
-@@ -14734,7 +14755,7 @@ const struct wpa_driver_ops wpa_driver_nl80211_ops = {
- .update_connect_params = nl80211_update_connection_params,
- .send_external_auth_status = nl80211_send_external_auth_status,
- .set_4addr_mode = nl80211_set_4addr_mode,
-- .mu_ctrl = nl80211_mu_onoff,
-+ .mu_ctrl = nl80211_mu_ctrl,
- .mu_dump = nl80211_mu_dump,
- #ifdef CONFIG_DPP
- .dpp_listen = nl80211_dpp_listen,
---
-2.39.2
-
diff --git a/recipes-wifi/wpa-supplicant/files/patches-2.10.3/mtk-0034-hostapd-mtk-Fix-hostapd_dfs_start_cac-log.patch b/recipes-wifi/wpa-supplicant/files/patches-2.10.3/mtk-0028-hostapd-mtk-Fix-hostapd_dfs_start_cac-log.patch
similarity index 81%
rename from recipes-wifi/wpa-supplicant/files/patches-2.10.3/mtk-0034-hostapd-mtk-Fix-hostapd_dfs_start_cac-log.patch
rename to recipes-wifi/wpa-supplicant/files/patches-2.10.3/mtk-0028-hostapd-mtk-Fix-hostapd_dfs_start_cac-log.patch
index 96522dd..b85fdca 100644
--- a/recipes-wifi/wpa-supplicant/files/patches-2.10.3/mtk-0034-hostapd-mtk-Fix-hostapd_dfs_start_cac-log.patch
+++ b/recipes-wifi/wpa-supplicant/files/patches-2.10.3/mtk-0028-hostapd-mtk-Fix-hostapd_dfs_start_cac-log.patch
@@ -1,7 +1,7 @@
-From fba1094daa7efaea9e2e3e9342b6eb6bd00ca174 Mon Sep 17 00:00:00 2001
+From aeabc47685135ee69cdeca5f5753c4057ca0f608 Mon Sep 17 00:00:00 2001
From: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
Date: Wed, 5 Jul 2023 10:47:20 +0800
-Subject: [PATCH 34/34] hostapd: mtk: Fix hostapd_dfs_start_cac log
+Subject: [PATCH 28/40] hostapd: mtk: Fix hostapd_dfs_start_cac log
Signed-off-by: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
---
@@ -9,10 +9,10 @@
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/src/ap/dfs.c b/src/ap/dfs.c
-index 6506d7a..c255978 100644
+index c9a9c6c..593a468 100644
--- a/src/ap/dfs.c
+++ b/src/ap/dfs.c
-@@ -1655,9 +1655,11 @@ int hostapd_dfs_start_cac(struct hostapd_iface *iface, int freq,
+@@ -1650,9 +1650,11 @@ int hostapd_dfs_start_cac(struct hostapd_iface *iface, int freq,
/* TODO: How to check CAC time for ETSI weather channels? */
iface->dfs_cac_ms = 60000;
wpa_msg(iface->bss[0]->msg_ctx, MSG_INFO, DFS_EVENT_CAC_START
diff --git a/recipes-wifi/hostapd/files/patches-2.10.3/mtk-0035-hostapd-mtk-Check-the-bridge-after-ioctl-SIOCBRADDIF.patch b/recipes-wifi/wpa-supplicant/files/patches-2.10.3/mtk-0029-hostapd-mtk-Check-the-bridge-after-ioctl-SIOCBRADDIF.patch
similarity index 90%
copy from recipes-wifi/hostapd/files/patches-2.10.3/mtk-0035-hostapd-mtk-Check-the-bridge-after-ioctl-SIOCBRADDIF.patch
copy to recipes-wifi/wpa-supplicant/files/patches-2.10.3/mtk-0029-hostapd-mtk-Check-the-bridge-after-ioctl-SIOCBRADDIF.patch
index 1937640..3d6f958 100644
--- a/recipes-wifi/hostapd/files/patches-2.10.3/mtk-0035-hostapd-mtk-Check-the-bridge-after-ioctl-SIOCBRADDIF.patch
+++ b/recipes-wifi/wpa-supplicant/files/patches-2.10.3/mtk-0029-hostapd-mtk-Check-the-bridge-after-ioctl-SIOCBRADDIF.patch
@@ -1,7 +1,8 @@
-From 99159b174eb245a7162fe38900971cdff017cf75 Mon Sep 17 00:00:00 2001
+From 1bc32b7308d9460116954f048eca89f02204825c Mon Sep 17 00:00:00 2001
From: Michael Lee <michael-cy.lee@mediatek.com>
Date: Thu, 13 Jul 2023 13:14:26 +0800
-Subject: [PATCH] hostapd: mtk: Check the bridge after ioctl SIOCBRADDIF failed
+Subject: [PATCH 29/40] hostapd: mtk: Check the bridge after ioctl SIOCBRADDIF
+ failed
If ioctl returns EBUSY on command SIOCBRADDIF, the interface might
already be bridged by others, and linux_br_add_if should not indicate an
@@ -51,5 +52,5 @@
return 0;
--
-2.25.1
+2.18.0
diff --git a/recipes-wifi/wpa-supplicant/files/patches-2.10.3/mtk-0030-hostapd-mtk-Fix-unexpected-AP-beacon-state-transitio.patch b/recipes-wifi/wpa-supplicant/files/patches-2.10.3/mtk-0030-hostapd-mtk-Fix-unexpected-AP-beacon-state-transitio.patch
deleted file mode 100644
index 69d1a31..0000000
--- a/recipes-wifi/wpa-supplicant/files/patches-2.10.3/mtk-0030-hostapd-mtk-Fix-unexpected-AP-beacon-state-transitio.patch
+++ /dev/null
@@ -1,36 +0,0 @@
-From 62c4fa824adefc85ec7820b431f5d617aaf07bc7 Mon Sep 17 00:00:00 2001
-From: Michael Lee <michael-cy.lee@mediatek.com>
-Date: Wed, 3 May 2023 16:10:57 +0800
-Subject: [PATCH 30/32] hostapd: mtk: Fix unexpected AP beacon state transition
-
-When AP fails to set the beacon, it assigns bss->beacon_set to 0 no
-matter what the error number is.
-However, in the case that the error number is -EBUSY, the driver might
-not free the beacon and expect a later beacon re-setting. If hostapd set
-a new beacon under this case, the driver will return -EALREADY.
-This patch checks the error number after hostapd fails to set the
-beacon. If the error number is -EBUSY, bss->beacon_set will not be
-assigned to 0.
-
-Signed-off-by: Michael Lee <michael-cy.lee@mediatek.com>
----
- src/drivers/driver_nl80211.c | 3 ++-
- 1 file changed, 2 insertions(+), 1 deletion(-)
-
-diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c
-index 0e7ee4306..ab121ca16 100644
---- a/src/drivers/driver_nl80211.c
-+++ b/src/drivers/driver_nl80211.c
-@@ -5395,7 +5395,8 @@ static int wpa_driver_nl80211_set_ap(void *priv,
- ret, strerror(-ret));
- if (!bss->flink->beacon_set)
- ret = 0;
-- bss->flink->beacon_set = 0;
-+ if (ret != -EBUSY)
-+ bss->flink->beacon_set = 0;
- } else {
- link->beacon_set = 1;
- nl80211_set_bss(bss, params->cts_protect, params->preamble,
---
-2.39.2
-
diff --git a/recipes-wifi/hostapd/files/patches-2.10.3/mtk-0036-hostapd-mtk-Update-parameter_set_count-in-MU-EDCA-IE.patch b/recipes-wifi/wpa-supplicant/files/patches-2.10.3/mtk-0030-hostapd-mtk-Update-parameter_set_count-in-MU-EDCA-IE.patch
similarity index 84%
copy from recipes-wifi/hostapd/files/patches-2.10.3/mtk-0036-hostapd-mtk-Update-parameter_set_count-in-MU-EDCA-IE.patch
copy to recipes-wifi/wpa-supplicant/files/patches-2.10.3/mtk-0030-hostapd-mtk-Update-parameter_set_count-in-MU-EDCA-IE.patch
index 295ce2b..8073974 100644
--- a/recipes-wifi/hostapd/files/patches-2.10.3/mtk-0036-hostapd-mtk-Update-parameter_set_count-in-MU-EDCA-IE.patch
+++ b/recipes-wifi/wpa-supplicant/files/patches-2.10.3/mtk-0030-hostapd-mtk-Update-parameter_set_count-in-MU-EDCA-IE.patch
@@ -1,7 +1,7 @@
-From 11c7b9e7b7d4dfef23b2f8f2d72591c1c3590fd5 Mon Sep 17 00:00:00 2001
+From c6557f76857bc80128d2d02e615ce32de8a0c998 Mon Sep 17 00:00:00 2001
From: MeiChia Chiu <meichia.chiu@mediatek.com>
Date: Fri, 14 Jul 2023 17:19:13 +0800
-Subject: [PATCH] hostapd: mtk: Update parameter_set_count in MU EDCA IE
+Subject: [PATCH 30/40] hostapd: mtk: Update parameter_set_count in MU EDCA IE
without this patch, MU EDCA Parameter update count not equal to
WMM Parameter set count.
@@ -24,5 +24,5 @@
pos, sizeof(*edca));
--
-2.39.0
+2.18.0
diff --git a/recipes-wifi/wpa-supplicant/files/patches-2.10.3/mtk-0031-hostapd-mtk-add-connac3-PHY-MURU-manual-mode-config-.patch b/recipes-wifi/wpa-supplicant/files/patches-2.10.3/mtk-0031-hostapd-mtk-add-connac3-PHY-MURU-manual-mode-config-.patch
deleted file mode 100644
index 6354d3c..0000000
--- a/recipes-wifi/wpa-supplicant/files/patches-2.10.3/mtk-0031-hostapd-mtk-add-connac3-PHY-MURU-manual-mode-config-.patch
+++ /dev/null
@@ -1,638 +0,0 @@
-From 78107269ba6f1ef6449e385e0182970ad85d7f43 Mon Sep 17 00:00:00 2001
-From: Howard Hsu <howard-yh.hsu@mediatek.com>
-Date: Sat, 3 Jun 2023 17:12:15 +0800
-Subject: [PATCH] hostapd: mtk: add connac3 PHY MURU manual mode config support
-
-This commit supports read the following two formats to set MU/RU manual
-mode:
-1. hostapd_cli -i <intf> raw set_muru_manual_config=<field>:<value>
-2. hostapd_cli -i <intf> set_mu <field> <value>
-
-For the <field>, we support the following field:
-1. ul_comm_user_cnt/dl_comm_user_cnt: set the number of user
-2. ul_comm_bw/dl_comm_bw: set the bandwith
-3. ul_user_ru_alloc/dl_user_ru_alloc: set the RU band idx and RU
-allocate idx
-4. ul_user_mcs/dl_user_mcs: set the mcs for each user
-5. ul_user_ssAlloc_raru: set the number of ss for each user
-6. ul_comm_gi_ltf: set the combinations of gi and ltf for UL only.
-7. dl_comm_toneplan: fix ru toneplan allocation
-8. dl_comm_ack_policy: fix station ack policy
-9. update : trigger driver to send mcu command to set muru manual mode.
-
-For the value of each field, please check wiki to learn the details:
-https://wiki.mediatek.inc/display/GWKB/muru_mancfg_user_guide
-
-For the fields that mt76 support to use, we will update in this wiki:
-https://wiki.mediatek.inc/pages/viewpage.action?pageId=1271741116
-
-Please noted that this commit is only for connac 3 gen chips. If this
-feature is to be used in other generations, the following actions must
-be taken:
-1. Different data structue needs to be defined for different
-generations, e.g. connac4_muru_comm, connac4_muru_dl.
-2. hostapd_ctrl_iface_set_mu() shall be modified.
-3. A new code level configuration shall be defined to differentiate the
-code flow that different generations will go through.
----
- hostapd/ctrl_iface.c | 235 +++++++++++++++++++++++++++++++----
- src/ap/ap_config.h | 1 +
- src/ap/ap_drv_ops.c | 4 +-
- src/ap/ap_drv_ops.h | 2 +-
- src/ap/hostapd.c | 2 +-
- src/common/mtk_vendor.h | 166 ++++++++++++++++++++++++-
- src/drivers/driver.h | 2 +-
- src/drivers/driver_nl80211.c | 21 ++--
- 8 files changed, 390 insertions(+), 43 deletions(-)
-
-diff --git a/hostapd/ctrl_iface.c b/hostapd/ctrl_iface.c
-index 972393e..b280a04 100644
---- a/hostapd/ctrl_iface.c
-+++ b/hostapd/ctrl_iface.c
-@@ -3579,22 +3579,61 @@ hostapd_ctrl_iface_get_edcca(struct hostapd_data *hapd, char *cmd, char *buf,
- }
- }
-
-+static int
-+hostapd_parse_argument_helper(char *value, u16 **ptr_input)
-+{
-+#define MAX_MU_CTRL_NUM 17
-+
-+ u16 *input;
-+ char *endptr;
-+ int cnt = 0;
-+
-+ input = os_zalloc(MAX_MU_CTRL_NUM * sizeof(u16));
-+ if (input == NULL) {
-+ wpa_printf(MSG_ERROR, "Failed to allocate memory.\n");
-+ return -1;
-+ }
-+ while (value) {
-+ u8 val = strtol(value, &endptr, 10);
-+
-+ if (value != endptr) {
-+ input[cnt++] = val;
-+ value = os_strchr(endptr, ':');
-+ if (value)
-+ value++;
-+ } else {
-+ break;
-+ }
-+ }
-
-+ *ptr_input = input;
-+ return cnt;
-+}
-+
-+#define MURU_CFG_DEPENDENCE_CHECK(_val, _mask) do { \
-+ if ((le_to_host32(_val) & (_mask)) != _mask) { \
-+ wpa_printf(MSG_ERROR, "Set %s first\n", #_mask); \
-+ goto fail; \
-+ } \
-+ } while(0)
- static int
- hostapd_ctrl_iface_set_mu(struct hostapd_data *hapd, char *cmd,
-- char *buf, size_t buflen)
-+ char *buf, size_t buflen)
- {
- char *pos, *config, *value;
-- u8 mode;
-+ u8 i;
-+ int cnt = 0, ret;
-+ u16 *val;
-+ struct connac3_muru *muru;
-+ struct connac3_muru_dl *dl;
-+ struct connac3_muru_ul *ul;
-+ struct connac3_muru_comm *comm;
-
- config = cmd;
- pos = os_strchr(config, ' ');
-- if (pos == NULL)
-- return -1;
-- *pos++ = '\0';
-+ if (pos != NULL)
-+ *pos++ = '\0';
-
-- if(pos == NULL)
-- return -1;
- value = pos;
-
- if (os_strcmp(config, "onoff") == 0) {
-@@ -3604,24 +3643,167 @@ hostapd_ctrl_iface_set_mu(struct hostapd_data *hapd, char *cmd,
- return -1;
- }
- hapd->iconf->mu_onoff = (u8) mu;
-- mode = MU_CTRL_ONOFF;
-- } else if (os_strcmp(config, "ul_user_cnt") == 0) {
-- mode = MU_CTRL_UL_USER_CNT;
-- wpa_printf(MSG_ERROR, "ul_user_cnt:%d\n", (u8)atoi(value));
-- } else if (os_strcmp(config, "dl_user_cnt") == 0) {
-- mode = MU_CTRL_DL_USER_CNT;
-- wpa_printf(MSG_ERROR, "dl_user_cnt:%d\n", (u8)atoi(value));
-- } else {
-- wpa_printf(MSG_ERROR,
-- "Unsupported parameter %s for SET_MU", config);
-- return -1;
-+
-+ if (hostapd_drv_mu_ctrl(hapd, MU_CTRL_ONOFF) == 0)
-+ return os_snprintf(buf, buflen, "OK\n");
-+ else
-+ goto fail;
- }
-
-- if(hostapd_drv_mu_ctrl(hapd, mode, (u8)atoi(value)) == 0) {
-- return os_snprintf(buf, buflen, "OK\n");
-+ if (hapd->iconf->muru_config == NULL)
-+ hapd->iconf->muru_config = os_zalloc(sizeof(struct connac3_muru));
-+
-+ muru = hapd->iconf->muru_config;
-+ dl = &muru->dl;
-+ ul = &muru->ul;
-+ comm = &muru->comm;
-+
-+ if (os_strncmp(config, "update", 6) == 0) {
-+ ret = hostapd_drv_mu_ctrl(hapd, MU_CTRL_UPDATE);
-+
-+ os_free(hapd->iconf->muru_config);
-+ hapd->iconf->muru_config = NULL;
-+
-+ if (ret)
-+ goto fail;
-+ } else if (os_strcmp(config, "ul_comm_user_cnt") == 0) {
-+ ul->user_num = (u8)atoi(value);
-+ comm->ppdu_format |= MURU_PPDU_HE_TRIG;
-+ comm->sch_type |= MURU_OFDMA_SCH_TYPE_UL;
-+ muru->cfg_comm |= host_to_le32(MURU_COMM_SET);
-+ muru->cfg_ul |= host_to_le32(MURU_FIXED_UL_TOTAL_USER_CNT);
-+ } else if (os_strcmp(config, "dl_comm_user_cnt") == 0) {
-+ dl->user_num = (u8)atoi(value);
-+ comm->ppdu_format |= MURU_PPDU_HE_MU;
-+ comm->sch_type |= MURU_OFDMA_SCH_TYPE_DL;
-+ muru->cfg_comm |= host_to_le32(MURU_COMM_SET);
-+ muru->cfg_dl |= host_to_le32(MURU_FIXED_DL_TOTAL_USER_CNT);
-+ } else if (os_strcmp(config, "dl_comm_bw") == 0) {
-+ dl->bw = (u8)atoi(value);
-+ muru->cfg_dl |= host_to_le32(MURU_FIXED_DL_BW);
-+ } else if (os_strcmp(config, "ul_comm_bw") == 0) {
-+ ul->bw = (u8)atoi(value);
-+ muru->cfg_ul |= host_to_le32(MURU_FIXED_UL_BW);
-+ } else if (os_strcmp(config, "dl_user_ru_alloc") == 0) {
-+ MURU_CFG_DEPENDENCE_CHECK(muru->cfg_dl, MURU_FIXED_DL_TOTAL_USER_CNT);
-+ cnt = hostapd_parse_argument_helper(value, &val);
-+ if (cnt == -1)
-+ goto fail;
-+ if (cnt != (dl->user_num * 2))
-+ goto para_fail;
-+ for (i = 0; i < dl->user_num; i++) {
-+ dl->usr[i].ru_alloc_seg = (val[2 * i] & 0x1);
-+ dl->usr[i].ru_allo_ps160 = ((val[2 * i] & 0x2) >> 1);
-+ dl->usr[i].ru_idx = val[(2 * i) + 1];
-+ }
-+ os_free(val);
-+ muru->cfg_dl |= host_to_le32(MURU_FIXED_USER_DL_RU_ALLOC);
-+ } else if (os_strcmp(config, "ul_user_ru_alloc") == 0) {
-+ MURU_CFG_DEPENDENCE_CHECK(muru->cfg_ul, MURU_FIXED_UL_TOTAL_USER_CNT);
-+ cnt = hostapd_parse_argument_helper(value, &val);
-+ if (cnt == -1)
-+ goto fail;
-+ if (cnt != (ul->user_num * 2))
-+ goto para_fail;
-+ for (i = 0; i < ul->user_num; i++) {
-+ ul->usr[i].ru_alloc_seg = (val[2 * i] & 0x1);
-+ ul->usr[i].ru_allo_ps160 = ((val[2 * i] & 0x2) >> 1);
-+ ul->usr[i].ru_idx = val[(2 * i) + 1];
-+ }
-+ os_free(val);
-+ muru->cfg_ul |= host_to_le32(MURU_FIXED_USER_UL_RU_ALLOC);
-+ } else if (os_strcmp(config, "dl_user_mcs") == 0) {
-+ MURU_CFG_DEPENDENCE_CHECK(muru->cfg_dl, MURU_FIXED_DL_TOTAL_USER_CNT);
-+ cnt = hostapd_parse_argument_helper(value, &val);
-+ if (cnt == -1)
-+ goto fail;
-+ if (cnt != dl->user_num)
-+ goto para_fail;
-+ for (i = 0; i < cnt; i++)
-+ dl->usr[i].mcs = (u8) val[i];
-+ os_free(val);
-+ muru->cfg_dl |= host_to_le32(MURU_FIXED_USER_DL_MCS);
-+ } else if (os_strcmp(config, "ul_user_mcs") == 0) {
-+ MURU_CFG_DEPENDENCE_CHECK(muru->cfg_ul, MURU_FIXED_UL_TOTAL_USER_CNT);
-+ cnt = hostapd_parse_argument_helper(value, &val);
-+ if (cnt == -1)
-+ goto fail;
-+ if (cnt != ul->user_num)
-+ goto para_fail;
-+ for (i = 0; i < cnt; i++)
-+ ul->usr[i].mcs = (u8) val[i];
-+ os_free(val);
-+ muru->cfg_ul |= host_to_le32(MURU_FIXED_USER_UL_MCS);
-+ } else if (os_strcmp(config, "dl_user_cod") == 0) {
-+ MURU_CFG_DEPENDENCE_CHECK(muru->cfg_dl, MURU_FIXED_DL_TOTAL_USER_CNT);
-+ cnt = hostapd_parse_argument_helper(value, &val);
-+ if (cnt == -1)
-+ goto fail;
-+ if (cnt != dl->user_num)
-+ goto para_fail;
-+ for (i = 0; i < cnt; i++)
-+ dl->usr[i].ldpc = (u8) val[i];
-+ os_free(val);
-+ muru->cfg_dl |= host_to_le32(MURU_FIXED_USER_DL_COD);
-+ } else if (os_strcmp(config, "ul_user_cod") == 0) {
-+ MURU_CFG_DEPENDENCE_CHECK(muru->cfg_ul, MURU_FIXED_UL_TOTAL_USER_CNT);
-+ cnt = hostapd_parse_argument_helper(value, &val);
-+ if (cnt == -1)
-+ goto fail;
-+ if (cnt != ul->user_num)
-+ goto para_fail;
-+ for (i = 0; i < cnt; i++)
-+ ul->usr[i].ldpc = (u8) val[i];
-+ os_free(val);
-+ muru->cfg_ul |= host_to_le32(MURU_FIXED_USER_UL_COD);
-+ } else if (os_strcmp(config, "ul_user_ssAlloc_raru") == 0) {
-+ MURU_CFG_DEPENDENCE_CHECK(muru->cfg_ul, MURU_FIXED_UL_TOTAL_USER_CNT);
-+ cnt = hostapd_parse_argument_helper(value, &val);
-+ if (cnt == -1)
-+ goto fail;
-+ if (cnt != ul->user_num)
-+ goto para_fail;
-+ for (i = 0; i < cnt; i++)
-+ ul->usr[i].nss = (u8) val[i];
-+ os_free(val);
-+ muru->cfg_ul |= host_to_le32(MURU_FIXED_USER_UL_NSS);
-+ } else if (os_strcmp(config, "dl_comm_gi") == 0) {
-+ dl->gi = (u8)atoi(value);
-+ muru->cfg_dl |= host_to_le32(MURU_FIXED_DL_GI);
-+ } else if (os_strcmp(config, "dl_comm_ltf") == 0) {
-+ dl->ltf = (u8)atoi(value);
-+ muru->cfg_dl |= host_to_le32(MURU_FIXED_DL_LTF);
-+ } else if (os_strcmp(config, "ul_comm_gi_ltf") == 0) {
-+ ul->gi_ltf = (u8)atoi(value);
-+ muru->cfg_ul |= host_to_le32(MURU_FIXED_UL_GILTF);
-+ } else if (os_strcmp(config, "dl_comm_ack_policy") == 0) {
-+ dl->ack_policy = (u8)atoi(value);
-+ muru->cfg_dl |= host_to_le32(MURU_FIXED_DL_ACK_PLY);
-+ } else if (os_strcmp(config, "dl_comm_toneplan") == 0) {
-+ MURU_CFG_DEPENDENCE_CHECK(muru->cfg_dl, MURU_FIXED_DL_BW);
-+ cnt = hostapd_parse_argument_helper(value, &val);
-+ if (cnt == -1)
-+ goto fail;
-+ i = pow(2, dl->bw);
-+ if (cnt != i)
-+ goto para_fail;
-+ for (i = 0; i < cnt; i++)
-+ dl->ru[i] = host_to_le16(val[i]);
-+ os_free(val);
-+ muru->cfg_dl |= host_to_le32(MURU_FIXED_DL_TONE_PLAN);
- } else {
-- return -1;
-+ wpa_printf(MSG_ERROR,
-+ "Unsupported parameter %s for SET_MU", config);
-+ goto fail;
- }
-+
-+ return os_snprintf(buf, buflen, "OK\n");
-+
-+para_fail:
-+ os_free(val);
-+ wpa_printf(MSG_ERROR, "Incorrect input number\n");
-+fail:
-+ return os_snprintf(buf, buflen, "FAIL\n");
- }
-
-
-@@ -4613,8 +4795,7 @@ static int hostapd_ctrl_iface_receive_process(struct hostapd_data *hapd,
- reply_len = hostapd_ctrl_iface_get_edcca(hapd, buf+10, reply,
- reply_size);
- } else if (os_strncmp(buf, "SET_MU ", 7) == 0) {
-- reply_len = hostapd_ctrl_iface_set_mu(hapd, buf + 7, reply,
-- reply_size);
-+ reply_len = hostapd_ctrl_iface_set_mu(hapd, buf + 7, reply, reply_size);
- } else if (os_strncmp(buf, "GET_MU", 6) == 0) {
- reply_len = hostapd_ctrl_iface_get_mu(hapd, reply, reply_size);
- } else if (os_strncmp(buf, "GET_IBF", 7) == 0) {
-@@ -4640,6 +4821,14 @@ static int hostapd_ctrl_iface_receive_process(struct hostapd_data *hapd,
- } else if (os_strncmp(buf, "DUMP_AMNT", 9) == 0) {
- reply_len = hostapd_ctrl_iface_dump_amnt(hapd, buf+10,
- reply, reply_size);
-+ } else if (os_strncmp(buf, "set_muru_manual_config=", 23) == 0) {
-+ // Replace first ':' with a single space ' '
-+ char *pos = buf + 23;
-+
-+ pos = os_strchr(pos, ':');
-+ if (pos)
-+ *pos = ' ';
-+ reply_len = hostapd_ctrl_iface_set_mu(hapd, buf + 23, reply, reply_size);
- } else {
- os_memcpy(reply, "UNKNOWN COMMAND\n", 16);
- reply_len = 16;
-diff --git a/src/ap/ap_config.h b/src/ap/ap_config.h
-index 1eb871f..4e38e67 100644
---- a/src/ap/ap_config.h
-+++ b/src/ap/ap_config.h
-@@ -1201,6 +1201,7 @@ struct hostapd_config {
- u8 ibf_enable;
- u8 dfs_detect_mode;
- u8 amsdu;
-+ void *muru_config;
- };
-
- enum three_wire_mode {
-diff --git a/src/ap/ap_drv_ops.c b/src/ap/ap_drv_ops.c
-index 0aec9e9..721bfa0 100644
---- a/src/ap/ap_drv_ops.c
-+++ b/src/ap/ap_drv_ops.c
-@@ -1162,11 +1162,11 @@ int hostapd_drv_get_edcca(struct hostapd_data *hapd, const u8 mode, u8 *value)
- return hapd->driver->get_edcca(hapd->drv_priv, mode, value);
- }
-
--int hostapd_drv_mu_ctrl(struct hostapd_data *hapd, u8 mode, u8 val)
-+int hostapd_drv_mu_ctrl(struct hostapd_data *hapd, u8 mode)
- {
- if (!hapd->driver || !hapd->driver->mu_ctrl)
- return 0;
-- return hapd->driver->mu_ctrl(hapd->drv_priv, mode, val);
-+ return hapd->driver->mu_ctrl(hapd->drv_priv, mode, hapd->iconf);
- }
-
- int hostapd_drv_mu_dump(struct hostapd_data *hapd, u8 *mu_onoff)
-diff --git a/src/ap/ap_drv_ops.h b/src/ap/ap_drv_ops.h
-index 5dd701e..741fdab 100644
---- a/src/ap/ap_drv_ops.h
-+++ b/src/ap/ap_drv_ops.h
-@@ -148,7 +148,7 @@ int hostapd_drv_configure_edcca_enable(struct hostapd_data *hapd);
- int hostapd_drv_configure_edcca_threshold(struct hostapd_data *hapd,
- const int *threshold);
- int hostapd_drv_get_edcca(struct hostapd_data *hapd, const u8 mode, u8 *value);
--int hostapd_drv_mu_ctrl(struct hostapd_data *hapd, u8 mode, u8 val);
-+int hostapd_drv_mu_ctrl(struct hostapd_data *hapd, u8 mode);
- int hostapd_drv_mu_dump(struct hostapd_data *hapd, u8 *mu_onoff);
- int hostapd_drv_three_wire_ctrl(struct hostapd_data *hapd);
- int hostapd_drv_ibf_ctrl(struct hostapd_data *hapd);
-diff --git a/src/ap/hostapd.c b/src/ap/hostapd.c
-index c684d7e..52d04d6 100644
---- a/src/ap/hostapd.c
-+++ b/src/ap/hostapd.c
-@@ -2568,7 +2568,7 @@ dfs_offload:
- if (hostapd_drv_configure_edcca_threshold(hapd,
- hapd->iconf->edcca_threshold) < 0)
- goto fail;
-- if (hostapd_drv_mu_ctrl(hapd, MU_CTRL_ONOFF, hapd->iconf->mu_onoff) < 0)
-+ if (hostapd_drv_mu_ctrl(hapd, MU_CTRL_ONOFF) < 0)
- goto fail;
- if (hostapd_drv_three_wire_ctrl(hapd) < 0)
- goto fail;
-diff --git a/src/common/mtk_vendor.h b/src/common/mtk_vendor.h
-index 99371bf..e140de6 100644
---- a/src/common/mtk_vendor.h
-+++ b/src/common/mtk_vendor.h
-@@ -199,8 +199,11 @@ enum mtk_vendor_attr_mu_ctrl {
-
- MTK_VENDOR_ATTR_MU_CTRL_ONOFF,
- MTK_VENDOR_ATTR_MU_CTRL_DUMP,
-- MTK_VENDOR_ATTR_MU_CTRL_OFDMA_MODE,
-- MTK_VENDOR_ATTR_MU_CTRL_OFDMA_VAL,
-+ /**
-+ * The above attrs are also used by connac 2. It is best not to modify the
-+ * above data structure.
-+ */
-+ MTK_VENDOR_ATTR_MU_CTRL_STRUCT,
-
- /* keep last */
- NUM_MTK_VENDOR_ATTRS_MU_CTRL,
-@@ -275,8 +278,163 @@ struct amnt_resp_data {
- };
-
- enum {
-+ MU_CTRL_UPDATE,
- MU_CTRL_ONOFF,
-- MU_CTRL_DL_USER_CNT,
-- MU_CTRL_UL_USER_CNT,
- };
-+
-+struct connac3_muru_comm {
-+ u8 pda_pol;
-+ u8 band;
-+ u8 spe_idx;
-+ u8 proc_type;
-+
-+ le16 mlo_ctrl;
-+ u8 sch_type;
-+ u8 ppdu_format;
-+ u8 ac;
-+ u8 _rsv[3];
-+};
-+
-+struct connac3_muru_dl {
-+ u8 user_num;
-+ u8 tx_mode;
-+ u8 bw;
-+ u8 gi;
-+
-+ u8 ltf;
-+ u8 mcs;
-+ u8 dcm;
-+ u8 cmprs;
-+
-+ le16 ru[16];
-+
-+ u8 c26[2];
-+ u8 ack_policy;
-+ u8 tx_power;
-+
-+ le16 mu_ppdu_duration;
-+ u8 agc_disp_order;
-+ u8 _rsv1;
-+
-+ u8 agc_disp_pol;
-+ u8 agc_disp_ratio;
-+ le16 agc_disp_linkMFG;
-+
-+ le16 prmbl_punc_bmp;
-+ u8 _rsv2[2];
-+
-+ struct {
-+ le16 wlan_idx;
-+ u8 ru_alloc_seg;
-+ u8 ru_idx;
-+ u8 ldpc;
-+ u8 nss;
-+ u8 mcs;
-+ u8 mu_group_idx;
-+ u8 vht_groud_id;
-+ u8 vht_up;
-+ u8 he_start_stream;
-+ u8 he_mu_spatial;
-+ le16 tx_power_alpha;
-+ u8 ack_policy;
-+ u8 ru_allo_ps160;
-+ } usr[16];
-+};
-+
-+struct connac3_muru_ul {
-+ u8 user_num;
-+ u8 tx_mode;
-+
-+ u8 ba_type;
-+ u8 _rsv;
-+
-+ u8 bw;
-+ u8 gi_ltf;
-+ le16 ul_len;
-+
-+ le16 trig_cnt;
-+ u8 pad;
-+ u8 trig_type;
-+
-+ le16 trig_intv;
-+ u8 trig_ta[ETH_ALEN];
-+ le16 ul_ru[16];
-+
-+ u8 c26[2];
-+ le16 agc_disp_linkMFG;
-+
-+ u8 agc_disp_mu_len;
-+ u8 agc_disp_pol;
-+ u8 agc_disp_ratio;
-+ u8 agc_disp_pu_idx;
-+
-+ struct {
-+ le16 wlan_idx;
-+ u8 ru_alloc_seg;
-+ u8 ru_idx;
-+ u8 ldpc;
-+ u8 nss;
-+ u8 mcs;
-+ u8 target_rssi;
-+ le32 trig_pkt_size;
-+ u8 ru_allo_ps160;
-+ u8 _rsv2[3];
-+ } usr[16];
-+};
-+
-+struct connac3_muru_dbg {
-+ /* HE TB RX Debug */
-+ le32 rx_hetb_nonsf_en_bitmap;
-+ le32 rx_hetb_cfg[2];
-+};
-+
-+struct connac3_muru {
-+ le32 cfg_comm;
-+ le32 cfg_dl;
-+ le32 cfg_ul;
-+ le32 cfg_dbg;
-+
-+ struct connac3_muru_comm comm;
-+ struct connac3_muru_dl dl;
-+ struct connac3_muru_ul ul;
-+ struct connac3_muru_dbg dbg;
-+};
-+
-+#define MURU_OFDMA_SCH_TYPE_DL BIT(0)
-+#define MURU_OFDMA_SCH_TYPE_UL BIT(1)
-+#define MURU_PPDU_HE_TRIG BIT(2)
-+#define MURU_PPDU_HE_MU BIT(3)
-+
-+/* Common Config */
-+#define MURU_COMM_PPDU_FMT BIT(0)
-+#define MURU_COMM_BAND BIT(2)
-+#define MURU_COMM_WMM BIT(3)
-+#define MURU_COMM_SPE_IDX BIT(4)
-+#define MURU_COMM_SET (MURU_COMM_PPDU_FMT | MURU_COMM_BAND | \
-+ MURU_COMM_WMM | MURU_COMM_SPE_IDX)
-+
-+/* DL Common config */
-+#define MURU_FIXED_DL_BW BIT(0)
-+#define MURU_FIXED_DL_GI BIT(1)
-+#define MURU_FIXED_DL_TONE_PLAN BIT(3)
-+#define MURU_FIXED_DL_TOTAL_USER_CNT BIT(4)
-+#define MURU_FIXED_DL_LTF BIT(5)
-+#define MURU_FIXED_DL_ACK_PLY BIT(9)
-+
-+/* DL Per User Config */
-+#define MURU_FIXED_USER_DL_COD BIT(17)
-+#define MURU_FIXED_USER_DL_MCS BIT(18)
-+#define MURU_FIXED_USER_DL_RU_ALLOC BIT(20)
-+
-+/* UL Common Config */
-+#define MURU_FIXED_UL_TOTAL_USER_CNT BIT(4)
-+#define MURU_FIXED_UL_BW BIT(5)
-+#define MURU_FIXED_UL_GILTF BIT(6)
-+
-+/* UL Per User Config */
-+#define MURU_FIXED_USER_UL_COD BIT(18)
-+#define MURU_FIXED_USER_UL_MCS BIT(19)
-+#define MURU_FIXED_USER_UL_NSS BIT(20)
-+#define MURU_FIXED_USER_UL_RU_ALLOC BIT(21)
-+
- #endif /* MTK_VENDOR_H */
-diff --git a/src/drivers/driver.h b/src/drivers/driver.h
-index 84387a6..9ec0e96 100644
---- a/src/drivers/driver.h
-+++ b/src/drivers/driver.h
-@@ -5100,7 +5100,7 @@ struct wpa_driver_ops {
- * @priv: Private driver interface data
- *
- */
-- int (*mu_ctrl)(void *priv, u8 mode, u8 val);
-+ int (*mu_ctrl)(void *priv, u8 mode, void *config);
- int (*mu_dump)(void *priv, u8 *mu_onoff);
-
- /**
-diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c
-index ab121ca..fdd8505 100644
---- a/src/drivers/driver_nl80211.c
-+++ b/src/drivers/driver_nl80211.c
-@@ -13566,12 +13566,13 @@ fail:
-
-
- #ifdef CONFIG_IEEE80211AX
--static int nl80211_mu_ctrl(void *priv, u8 mode, u8 val)
-+static int nl80211_mu_ctrl(void *priv, u8 mode, void *config)
- {
- struct i802_bss *bss = priv;
- struct wpa_driver_nl80211_data *drv = bss->drv;
- struct nl_msg *msg;
- struct nlattr *data;
-+ struct hostapd_config *cfg = config;
- int ret = -ENOBUFS;
-
- if (!drv->mtk_mu_vendor_cmd_avail) {
-@@ -13588,17 +13589,16 @@ static int nl80211_mu_ctrl(void *priv, u8 mode, u8 val)
-
- switch (mode) {
- case MU_CTRL_ONOFF:
-- if (nla_put_u8(msg, MTK_VENDOR_ATTR_MU_CTRL_ONOFF, val))
-- goto fail;
-+ if (nla_put_u8(msg, MTK_VENDOR_ATTR_MU_CTRL_ONOFF, cfg->mu_onoff))
-+ goto fail;
- break;
-- case MU_CTRL_UL_USER_CNT:
-- case MU_CTRL_DL_USER_CNT:
-- if (nla_put_u8(msg, MTK_VENDOR_ATTR_MU_CTRL_OFDMA_MODE, mode) ||
-- nla_put_u8(msg, MTK_VENDOR_ATTR_MU_CTRL_OFDMA_VAL, val))
-- goto fail;
-+ case MU_CTRL_UPDATE:
-+ if (nla_put(msg, MTK_VENDOR_ATTR_MU_CTRL_STRUCT,
-+ sizeof(struct connac3_muru), cfg->muru_config))
-+ goto fail;
- break;
- default:
-- wpa_printf(MSG_ERROR, "nl80211: Wrong mu mode !");
-+ wpa_printf(MSG_ERROR, "nl80211: Wrong mu mode %u!", mode);
- ret = -EINVAL;
- goto fail;
- }
-@@ -13606,9 +13606,8 @@ static int nl80211_mu_ctrl(void *priv, u8 mode, u8 val)
- nla_nest_end(msg, data);
-
- ret = send_and_recv_msgs(drv, msg, NULL, NULL, NULL, NULL);
-- if(ret){
-+ if (ret)
- wpa_printf(MSG_ERROR, "Failed to set mu_ctrl. ret=%d (%s)", ret, strerror(-ret));
-- }
- return ret;
-
- fail:
---
-2.18.0
-
diff --git a/recipes-wifi/wpa-supplicant/files/patches-2.10.3/mtk-0037-hostapd-mtk-Add-extension-IE-list-for-non-inherit-IE.patch b/recipes-wifi/wpa-supplicant/files/patches-2.10.3/mtk-0031-hostapd-mtk-add-extension-IE-list-for-non-inherit-IE.patch
similarity index 89%
rename from recipes-wifi/wpa-supplicant/files/patches-2.10.3/mtk-0037-hostapd-mtk-Add-extension-IE-list-for-non-inherit-IE.patch
rename to recipes-wifi/wpa-supplicant/files/patches-2.10.3/mtk-0031-hostapd-mtk-add-extension-IE-list-for-non-inherit-IE.patch
index 45a340d..52deb06 100644
--- a/recipes-wifi/wpa-supplicant/files/patches-2.10.3/mtk-0037-hostapd-mtk-Add-extension-IE-list-for-non-inherit-IE.patch
+++ b/recipes-wifi/wpa-supplicant/files/patches-2.10.3/mtk-0031-hostapd-mtk-add-extension-IE-list-for-non-inherit-IE.patch
@@ -1,8 +1,8 @@
-From d65c803ab5583dddc6574b09fee47ccfb39cb99b Mon Sep 17 00:00:00 2001
+From de15bbc394a478d141e416114297213d4e4b027d Mon Sep 17 00:00:00 2001
From: mtk20656 <chank.chen@mediatek.com>
Date: Mon, 24 Jul 2023 11:30:27 +0800
-Subject: [PATCH] hostapd: mtk: add extension IE list for non-inherit IE in
- mbssid
+Subject: [PATCH 31/40] hostapd: mtk: add extension IE list for non-inherit IE
+ in mbssid
Certain clients do not scan all non tx profiles due to absence of
element ID extension list which is mandatory field in non inheritance
@@ -14,6 +14,7 @@
---
src/ap/ieee802_11.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
+ mode change 100644 => 100755 src/ap/ieee802_11.c
diff --git a/src/ap/ieee802_11.c b/src/ap/ieee802_11.c
old mode 100644
diff --git a/recipes-wifi/wpa-supplicant/files/patches-2.10.3/mtk-0038-hostapd-mtk-Fix-11vmbss-aid-using-wrong-pool.patch b/recipes-wifi/wpa-supplicant/files/patches-2.10.3/mtk-0032-hostapd-mtk-Fix-11vmbss-aid-using-wrong-pool.patch
similarity index 85%
rename from recipes-wifi/wpa-supplicant/files/patches-2.10.3/mtk-0038-hostapd-mtk-Fix-11vmbss-aid-using-wrong-pool.patch
rename to recipes-wifi/wpa-supplicant/files/patches-2.10.3/mtk-0032-hostapd-mtk-Fix-11vmbss-aid-using-wrong-pool.patch
index 7cd34cd..7eb42ad 100644
--- a/recipes-wifi/wpa-supplicant/files/patches-2.10.3/mtk-0038-hostapd-mtk-Fix-11vmbss-aid-using-wrong-pool.patch
+++ b/recipes-wifi/wpa-supplicant/files/patches-2.10.3/mtk-0032-hostapd-mtk-Fix-11vmbss-aid-using-wrong-pool.patch
@@ -1,7 +1,7 @@
-From 1671a37b5990929bd11823158d496e7877d83d92 Mon Sep 17 00:00:00 2001
+From b99fd7f0b86a87fc82d63ec809fd9a73f308dd08 Mon Sep 17 00:00:00 2001
From: "Allen.Ye" <allen.ye@mediatek.com>
Date: Wed, 2 Aug 2023 18:33:31 +0800
-Subject: [PATCH 38/38] hostapd: mtk: Fix 11vmbss aid using wrong pool
+Subject: [PATCH 32/40] hostapd: mtk: Fix 11vmbss aid using wrong pool
Fix 11vmbss aid using wrong pool.
All STAs use the aid pool in transmitted bss.
diff --git a/recipes-wifi/wpa-supplicant/files/patches-2.10.3/mtk-0033-hostapd-mtk-Fix-background-channel-overlapping-opera.patch b/recipes-wifi/wpa-supplicant/files/patches-2.10.3/mtk-0033-hostapd-mtk-Fix-background-channel-overlapping-opera.patch
deleted file mode 100644
index dd121ca..0000000
--- a/recipes-wifi/wpa-supplicant/files/patches-2.10.3/mtk-0033-hostapd-mtk-Fix-background-channel-overlapping-opera.patch
+++ /dev/null
@@ -1,64 +0,0 @@
-From 76e54b095fdd8ab65a562c28fba330afcfb519ec Mon Sep 17 00:00:00 2001
-From: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
-Date: Wed, 5 Jul 2023 10:44:15 +0800
-Subject: [PATCH] hostapd: mtk: Fix background channel overlapping operating
- channel issue
-
-Signed-off-by: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
----
- src/ap/dfs.c | 18 ++++++++++++++++++
- 1 file changed, 18 insertions(+)
-
-diff --git a/src/ap/dfs.c b/src/ap/dfs.c
-index 2f5c86e..c9a9c6c 100644
---- a/src/ap/dfs.c
-+++ b/src/ap/dfs.c
-@@ -807,6 +807,20 @@ static int dfs_are_channels_overlapped(struct hostapd_iface *iface, int freq,
- }
-
-
-+static void dfs_check_background_overlapped(struct hostapd_iface *iface)
-+{
-+ int width = hostapd_get_oper_chwidth(iface->conf);
-+
-+ if (!dfs_use_radar_background(iface))
-+ return;
-+
-+ if (dfs_are_channels_overlapped(iface, iface->radar_background.freq,
-+ width, iface->radar_background.centr_freq_seg0_idx,
-+ iface->radar_background.centr_freq_seg1_idx))
-+ iface->radar_background.channel = -1;
-+}
-+
-+
- static unsigned int dfs_get_cac_time(struct hostapd_iface *iface,
- int start_chan_idx, int n_chans)
- {
-@@ -1127,6 +1141,8 @@ static void hostpad_dfs_update_background_chain(struct hostapd_iface *iface)
- &oper_centr_freq_seg1_idx,
- &channel_type);
- if (!channel ||
-+ channel->chan == iface->conf->channel ||
-+ channel->chan == iface->radar_background.channel ||
- hostapd_start_dfs_cac(iface, iface->conf->hw_mode,
- channel->freq, channel->chan,
- iface->conf->ieee80211n,
-@@ -1361,6 +1377,7 @@ static int hostapd_dfs_start_channel_switch_cac(struct hostapd_iface *iface)
- hostapd_set_oper_centr_freq_seg1_idx(iface->conf,
- oper_centr_freq_seg1_idx);
- err = 0;
-+ dfs_check_background_overlapped(iface);
-
- hostapd_setup_interface_complete(iface, err);
- return err;
-@@ -1488,6 +1505,7 @@ static int hostapd_dfs_start_channel_switch(struct hostapd_iface *iface)
- hostapd_set_oper_centr_freq_seg1_idx(
- iface->conf, oper_centr_freq_seg1_idx);
-
-+ dfs_check_background_overlapped(iface);
- hostapd_disable_iface(iface);
- hostapd_enable_iface(iface);
- return 0;
---
-2.18.0
-
diff --git a/recipes-wifi/hostapd/files/patches-2.10.3/mtk-0039-hostapd-mtk-Fix-rnr-ie-length-when-no-need-to-report.patch b/recipes-wifi/wpa-supplicant/files/patches-2.10.3/mtk-0033-hostapd-mtk-Fix-rnr-ie-length-when-no-need-to-report.patch
similarity index 87%
copy from recipes-wifi/hostapd/files/patches-2.10.3/mtk-0039-hostapd-mtk-Fix-rnr-ie-length-when-no-need-to-report.patch
copy to recipes-wifi/wpa-supplicant/files/patches-2.10.3/mtk-0033-hostapd-mtk-Fix-rnr-ie-length-when-no-need-to-report.patch
index 9218f9b..c9df793 100644
--- a/recipes-wifi/hostapd/files/patches-2.10.3/mtk-0039-hostapd-mtk-Fix-rnr-ie-length-when-no-need-to-report.patch
+++ b/recipes-wifi/wpa-supplicant/files/patches-2.10.3/mtk-0033-hostapd-mtk-Fix-rnr-ie-length-when-no-need-to-report.patch
@@ -1,7 +1,7 @@
-From ea3e20d6cc8d11750e509a701131297da81ef35d Mon Sep 17 00:00:00 2001
+From ee4aa23d0c87c8fe69f8ba28fe5faf95bf0103d8 Mon Sep 17 00:00:00 2001
From: "Allen.Ye" <allen.ye@mediatek.com>
Date: Mon, 7 Aug 2023 15:27:27 +0800
-Subject: [PATCH 39/39] hostapd: mtk: Fix rnr ie length when no need to report
+Subject: [PATCH 33/40] hostapd: mtk: Fix rnr ie length when no need to report
bss
Fix rnr ie length when no need to report bss. If we don't have content in
diff --git a/recipes-wifi/hostapd/files/patches-2.10.3/mtk-0040-hostapd-mtk-add-back-ht-vht-cap-missing-field-before.patch b/recipes-wifi/wpa-supplicant/files/patches-2.10.3/mtk-0034-hostapd-mtk-add-back-ht-vht-cap-missing-field-before.patch
similarity index 85%
copy from recipes-wifi/hostapd/files/patches-2.10.3/mtk-0040-hostapd-mtk-add-back-ht-vht-cap-missing-field-before.patch
copy to recipes-wifi/wpa-supplicant/files/patches-2.10.3/mtk-0034-hostapd-mtk-add-back-ht-vht-cap-missing-field-before.patch
index 0a27496..80b7589 100644
--- a/recipes-wifi/hostapd/files/patches-2.10.3/mtk-0040-hostapd-mtk-add-back-ht-vht-cap-missing-field-before.patch
+++ b/recipes-wifi/wpa-supplicant/files/patches-2.10.3/mtk-0034-hostapd-mtk-add-back-ht-vht-cap-missing-field-before.patch
@@ -1,8 +1,8 @@
-From 2ea36366ea036e3063ff553a2939c9cac17c6ac8 Mon Sep 17 00:00:00 2001
+From 26e0cd2739dc56e02cc7e1b5582220d0fcde795b Mon Sep 17 00:00:00 2001
From: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
Date: Tue, 8 Aug 2023 19:21:41 +0800
-Subject: [PATCH] hostapd: mtk: add back ht vht cap missing field before dfs
- channel fallback
+Subject: [PATCH 34/40] hostapd: mtk: add back ht vht cap missing field before
+ dfs channel fallback
hostapd_event_ch_switch would set / clear ht_capab and vht_capab, based
on the bandwidth of switched channel.
@@ -22,10 +22,10 @@
1 file changed, 7 insertions(+)
diff --git a/src/ap/hostapd.c b/src/ap/hostapd.c
-index c2e0b13..4b7ebc5 100644
+index 0dc86bf..2283b19 100644
--- a/src/ap/hostapd.c
+++ b/src/ap/hostapd.c
-@@ -4161,6 +4161,13 @@ hostapd_switch_channel_fallback(struct hostapd_iface *iface,
+@@ -4111,6 +4111,13 @@ hostapd_switch_channel_fallback(struct hostapd_iface *iface,
break;
}
diff --git a/recipes-wifi/wpa-supplicant/files/patches-2.10.3/mtk-0035-hostapd-mtk-Check-the-bridge-after-ioctl-SIOCBRADDIF.patch b/recipes-wifi/wpa-supplicant/files/patches-2.10.3/mtk-0035-hostapd-mtk-Check-the-bridge-after-ioctl-SIOCBRADDIF.patch
deleted file mode 100644
index 1937640..0000000
--- a/recipes-wifi/wpa-supplicant/files/patches-2.10.3/mtk-0035-hostapd-mtk-Check-the-bridge-after-ioctl-SIOCBRADDIF.patch
+++ /dev/null
@@ -1,55 +0,0 @@
-From 99159b174eb245a7162fe38900971cdff017cf75 Mon Sep 17 00:00:00 2001
-From: Michael Lee <michael-cy.lee@mediatek.com>
-Date: Thu, 13 Jul 2023 13:14:26 +0800
-Subject: [PATCH] hostapd: mtk: Check the bridge after ioctl SIOCBRADDIF failed
-
-If ioctl returns EBUSY on command SIOCBRADDIF, the interface might
-already be bridged by others, and linux_br_add_if should not indicate an
-error in the case.
-
-This patch checks whether the interface is correctly brigded when ioctl
-returns EBUSY.
-
-Signed-off-by: Michael Lee <michael-cy.lee@mediatek.com>
----
- src/drivers/linux_ioctl.c | 16 ++++++++++++++--
- 1 file changed, 14 insertions(+), 2 deletions(-)
-
-diff --git a/src/drivers/linux_ioctl.c b/src/drivers/linux_ioctl.c
-index 7edb9df..b8c1af2 100644
---- a/src/drivers/linux_ioctl.c
-+++ b/src/drivers/linux_ioctl.c
-@@ -150,7 +150,8 @@ int linux_br_del(int sock, const char *brname)
- int linux_br_add_if(int sock, const char *brname, const char *ifname)
- {
- struct ifreq ifr;
-- int ifindex;
-+ int ifindex, ret;
-+ char in_br[IFNAMSIZ];
-
- ifindex = if_nametoindex(ifname);
- if (ifindex == 0)
-@@ -164,8 +165,19 @@ int linux_br_add_if(int sock, const char *brname, const char *ifname)
-
- wpa_printf(MSG_DEBUG, "Could not add interface %s into bridge "
- "%s: %s", ifname, brname, strerror(errno));
-+
-+ /* If ioctl returns -EBUSY when adding interface into bridge,
-+ * the interface might already be added by netifd, so here we
-+ * check whether the interface is currently on the right
-+ * bridge. */
-+ if(errno == EBUSY && linux_br_get(in_br, ifname) == 0 &&
-+ os_strcmp(in_br, brname) == 0)
-+ ret = 0;
-+ else
-+ ret = -1;
-+
- errno = saved_errno;
-- return -1;
-+ return ret;
- }
-
- return 0;
---
-2.25.1
-
diff --git a/recipes-wifi/wpa-supplicant/files/patches-2.10.3/mtk-0035-hostapd-mtk-update-op_class-when-AP-channel-switchin.patch b/recipes-wifi/wpa-supplicant/files/patches-2.10.3/mtk-0035-hostapd-mtk-update-op_class-when-AP-channel-switchin.patch
new file mode 100644
index 0000000..05b2121
--- /dev/null
+++ b/recipes-wifi/wpa-supplicant/files/patches-2.10.3/mtk-0035-hostapd-mtk-update-op_class-when-AP-channel-switchin.patch
@@ -0,0 +1,36 @@
+From ef5f744c72f2e6ec6b7d4ec1ce4f233470ff7689 Mon Sep 17 00:00:00 2001
+From: Michael-CY Lee <michael-cy.lee@mediatek.com>
+Date: Wed, 23 Aug 2023 17:44:50 +0800
+Subject: [PATCH 35/40] hostapd: mtk: update op_class when AP channel switching
+
+Signed-off-by: Michael Lee <michael-cy.lee@mediatek.com>
+---
+ src/ap/drv_callbacks.c | 5 ++++-
+ 1 file changed, 4 insertions(+), 1 deletion(-)
+
+diff --git a/src/ap/drv_callbacks.c b/src/ap/drv_callbacks.c
+index c3fc419..1911f85 100644
+--- a/src/ap/drv_callbacks.c
++++ b/src/ap/drv_callbacks.c
+@@ -873,7 +873,7 @@ void hostapd_event_ch_switch(struct hostapd_data *hapd, int freq, int ht,
+ {
+ #ifdef NEED_AP_MLME
+ int channel, chwidth, is_dfs0, is_dfs;
+- u8 seg0_idx = 0, seg1_idx = 0;
++ u8 seg0_idx = 0, seg1_idx = 0, op_class, chan_no;
+ size_t i;
+
+ hostapd_logger(hapd, NULL, HOSTAPD_MODULE_IEEE80211,
+@@ -995,6 +995,9 @@ void hostapd_event_ch_switch(struct hostapd_data *hapd, int freq, int ht,
+ hapd->iconf->ht_capab &= ~HT_CAP_INFO_SUPP_CHANNEL_WIDTH_SET;
+
+ hapd->iconf->secondary_channel = offset;
++ ieee80211_freq_to_channel_ext(freq, offset, chwidth,
++ &op_class, &chan_no);
++ hapd->iconf->op_class = op_class;
+ hostapd_set_oper_chwidth(hapd->iconf, chwidth);
+ hostapd_set_oper_centr_freq_seg0_idx(hapd->iconf, seg0_idx);
+ hostapd_set_oper_centr_freq_seg1_idx(hapd->iconf, seg1_idx);
+--
+2.18.0
+
diff --git a/recipes-wifi/hostapd/files/patches-2.10.3/mtk-1001-hostapd-mtk-Add-support-for-gtk-rekeying-in-hostapd-.patch b/recipes-wifi/wpa-supplicant/files/patches-2.10.3/mtk-0036-hostapd-mtk-Add-support-for-gtk-rekeying-in-hostapd-.patch
similarity index 86%
copy from recipes-wifi/hostapd/files/patches-2.10.3/mtk-1001-hostapd-mtk-Add-support-for-gtk-rekeying-in-hostapd-.patch
copy to recipes-wifi/wpa-supplicant/files/patches-2.10.3/mtk-0036-hostapd-mtk-Add-support-for-gtk-rekeying-in-hostapd-.patch
index 25a401d..3dd5457 100644
--- a/recipes-wifi/hostapd/files/patches-2.10.3/mtk-1001-hostapd-mtk-Add-support-for-gtk-rekeying-in-hostapd-.patch
+++ b/recipes-wifi/wpa-supplicant/files/patches-2.10.3/mtk-0036-hostapd-mtk-Add-support-for-gtk-rekeying-in-hostapd-.patch
@@ -1,8 +1,8 @@
-From d9ddfb581c40edd45b7c1a30bfc2889ddb2102a4 Mon Sep 17 00:00:00 2001
+From eaff9afb87f172b09eac63237b099f7c4e5def3c Mon Sep 17 00:00:00 2001
From: mtk23510 <rudra.shahi@mediatek.com>
Date: Fri, 26 May 2023 14:52:35 +0800
-Subject: [PATCH 1001/1001] hostapd: mtk: Add support for gtk rekeying in
- hostapd cli
+Subject: [PATCH 36/40] hostapd: mtk: Add support for gtk rekeying in hostapd
+ cli
Signed-off-by: mtk23510 <rudra.shahi@mediatek.com>
---
@@ -10,7 +10,7 @@
1 file changed, 13 insertions(+)
diff --git a/hostapd/hostapd_cli.c b/hostapd/hostapd_cli.c
-index 6d763f327..363a6bb93 100644
+index 6d763f3..363a6bb 100644
--- a/hostapd/hostapd_cli.c
+++ b/hostapd/hostapd_cli.c
@@ -1256,6 +1256,15 @@ static int hostapd_cli_cmd_update_beacon(struct wpa_ctrl *ctrl, int argc,
@@ -41,5 +41,5 @@
"= drop all ERP keys"},
{ "log_level", hostapd_cli_cmd_log_level, NULL,
--
-2.39.2
+2.18.0
diff --git a/recipes-wifi/wpa-supplicant/files/patches-2.10.3/mtk-0036-hostapd-mtk-Update-parameter_set_count-in-MU-EDCA-IE.patch b/recipes-wifi/wpa-supplicant/files/patches-2.10.3/mtk-0036-hostapd-mtk-Update-parameter_set_count-in-MU-EDCA-IE.patch
deleted file mode 100644
index 295ce2b..0000000
--- a/recipes-wifi/wpa-supplicant/files/patches-2.10.3/mtk-0036-hostapd-mtk-Update-parameter_set_count-in-MU-EDCA-IE.patch
+++ /dev/null
@@ -1,28 +0,0 @@
-From 11c7b9e7b7d4dfef23b2f8f2d72591c1c3590fd5 Mon Sep 17 00:00:00 2001
-From: MeiChia Chiu <meichia.chiu@mediatek.com>
-Date: Fri, 14 Jul 2023 17:19:13 +0800
-Subject: [PATCH] hostapd: mtk: Update parameter_set_count in MU EDCA IE
-
-without this patch, MU EDCA Parameter update count not equal to
-WMM Parameter set count.
----
- src/ap/ieee802_11_he.c | 3 +++
- 1 file changed, 3 insertions(+)
-
-diff --git a/src/ap/ieee802_11_he.c b/src/ap/ieee802_11_he.c
-index 9407dd6..353e815 100644
---- a/src/ap/ieee802_11_he.c
-+++ b/src/ap/ieee802_11_he.c
-@@ -316,6 +316,9 @@ u8 * hostapd_eid_he_mu_edca_parameter_set(struct hostapd_data *hapd, u8 *eid)
- edca = (struct ieee80211_he_mu_edca_parameter_set *) pos;
- os_memcpy(edca, &hapd->iface->conf->he_mu_edca, sizeof(*edca));
-
-+ if (hapd->conf->wmm_enabled)
-+ edca->he_qos_info = hapd->parameter_set_count % 0xf;
-+
- wpa_hexdump(MSG_DEBUG, "HE: MU EDCA Parameter Set element",
- pos, sizeof(*edca));
-
---
-2.39.0
-
diff --git a/recipes-wifi/wpa-supplicant/files/patches-2.10.3/mtk-0037-hostapd-mtk-Fix-wpa_supplicant-configuration-parsing.patch b/recipes-wifi/wpa-supplicant/files/patches-2.10.3/mtk-0037-hostapd-mtk-Fix-wpa_supplicant-configuration-parsing.patch
new file mode 100644
index 0000000..f7f22d8
--- /dev/null
+++ b/recipes-wifi/wpa-supplicant/files/patches-2.10.3/mtk-0037-hostapd-mtk-Fix-wpa_supplicant-configuration-parsing.patch
@@ -0,0 +1,33 @@
+From a1fd2056b0e3820920778fd9252cec645cbb6389 Mon Sep 17 00:00:00 2001
+From: Michael Lee <michael-cy.lee@mediatek.com>
+Date: Fri, 7 Jul 2023 17:14:40 +0800
+Subject: [PATCH 37/40] hostapd: mtk: Fix wpa_supplicant configuration parsing
+ error
+
+In the original flow, after hostapd_config_tx_queue successfully
+parses a tx_queue variable, it would not return immediately. Then it
+would print out "unknow global field" later and set return val to -1.
+
+This patch returns immediately after hostapd_config_tx_queue
+successfully parses a tx_queue variable.
+
+Signed-off-by: Michael Lee <michael-cy.lee@mediatek.com>
+---
+ wpa_supplicant/config.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/wpa_supplicant/config.c b/wpa_supplicant/config.c
+index 325ab8d..2652c8a 100644
+--- a/wpa_supplicant/config.c
++++ b/wpa_supplicant/config.c
+@@ -5715,6 +5715,7 @@ int wpa_config_process_global(struct wpa_config *config, char *pos, int line)
+ line);
+ return -1;
+ }
++ return ret;
+ }
+
+ if (os_strncmp(pos, "wmm_ac_", 7) == 0) {
+--
+2.18.0
+
diff --git a/recipes-wifi/wpa-supplicant/files/patches-2.10.3/mtk-0038-hostapd-mtk-Set-WMM-and-TX-queue-parameters-for-wpa_.patch b/recipes-wifi/wpa-supplicant/files/patches-2.10.3/mtk-0038-hostapd-mtk-Set-WMM-and-TX-queue-parameters-for-wpa_.patch
new file mode 100644
index 0000000..27beaf7
--- /dev/null
+++ b/recipes-wifi/wpa-supplicant/files/patches-2.10.3/mtk-0038-hostapd-mtk-Set-WMM-and-TX-queue-parameters-for-wpa_.patch
@@ -0,0 +1,48 @@
+From b52a1f04b4a897e88b5a14f61befd71f65cdc062 Mon Sep 17 00:00:00 2001
+From: Michael Lee <michael-cy.lee@mediatek.com>
+Date: Tue, 11 Jul 2023 14:17:43 +0800
+Subject: [PATCH 38/40] hostapd: mtk: Set WMM and TX queue parameters for
+ wpa_supplicant
+
+Since most of the time, wpa_supplicant will be used to setup an STA
+interface, it's default WMM and TX queue parameters should be set for
+STA.
+
+Signed-off-by: Michael Lee <michael-cy.lee@mediatek.com>
+---
+ wpa_supplicant/config.c | 12 ++++++------
+ 1 file changed, 6 insertions(+), 6 deletions(-)
+
+diff --git a/wpa_supplicant/config.c b/wpa_supplicant/config.c
+index 2652c8a..cd40258 100644
+--- a/wpa_supplicant/config.c
++++ b/wpa_supplicant/config.c
+@@ -4673,19 +4673,19 @@ struct wpa_config * wpa_config_alloc_empty(const char *ctrl_interface,
+ const struct hostapd_wmm_ac_params ac_bk =
+ { aCWmin, aCWmax, 7, 0, 0 }; /* background traffic */
+ const struct hostapd_wmm_ac_params ac_be =
+- { aCWmin, aCWmax, 3, 0, 0 }; /* best effort traffic */
++ { aCWmin, aCWmin + 2, 3, 0, 0 }; /* best effort traffic */
+ const struct hostapd_wmm_ac_params ac_vi = /* video traffic */
+- { aCWmin - 1, aCWmin, 2, 3008 / 32, 0 };
++ { aCWmin - 1, aCWmin, 1, 3008 / 32, 0 };
+ const struct hostapd_wmm_ac_params ac_vo = /* voice traffic */
+- { aCWmin - 2, aCWmin - 1, 2, 1504 / 32, 0 };
++ { aCWmin - 2, aCWmin - 1, 1, 1504 / 32, 0 };
+ const struct hostapd_tx_queue_params txq_bk =
+ { 7, ecw2cw(aCWmin), ecw2cw(aCWmax), 0 };
+ const struct hostapd_tx_queue_params txq_be =
+- { 3, ecw2cw(aCWmin), 4 * (ecw2cw(aCWmin) + 1) - 1, 0 };
++ { 3, ecw2cw(aCWmin), ecw2cw(aCWmax), 0 };
+ const struct hostapd_tx_queue_params txq_vi =
+- { 1, (ecw2cw(aCWmin) + 1) / 2 - 1, ecw2cw(aCWmin), 30 };
++ { 2, (ecw2cw(aCWmin) + 1) / 2 - 1, ecw2cw(aCWmin), 30 };
+ const struct hostapd_tx_queue_params txq_vo =
+- { 1, (ecw2cw(aCWmin) + 1) / 4 - 1,
++ { 2, (ecw2cw(aCWmin) + 1) / 4 - 1,
+ (ecw2cw(aCWmin) + 1) / 2 - 1, 15 };
+
+ #undef ecw2cw
+--
+2.18.0
+
diff --git a/recipes-wifi/wpa-supplicant/files/patches-2.10.3/mtk-0039-hostapd-mtk-Fix-rnr-ie-length-when-no-need-to-report.patch b/recipes-wifi/wpa-supplicant/files/patches-2.10.3/mtk-0039-hostapd-mtk-Fix-rnr-ie-length-when-no-need-to-report.patch
deleted file mode 100644
index 9218f9b..0000000
--- a/recipes-wifi/wpa-supplicant/files/patches-2.10.3/mtk-0039-hostapd-mtk-Fix-rnr-ie-length-when-no-need-to-report.patch
+++ /dev/null
@@ -1,34 +0,0 @@
-From ea3e20d6cc8d11750e509a701131297da81ef35d Mon Sep 17 00:00:00 2001
-From: "Allen.Ye" <allen.ye@mediatek.com>
-Date: Mon, 7 Aug 2023 15:27:27 +0800
-Subject: [PATCH 39/39] hostapd: mtk: Fix rnr ie length when no need to report
- bss
-
-Fix rnr ie length when no need to report bss. If we don't have content in
-TBTT then don't change the length of the ie (*size_offset).
-
-Signed-off-by: Allen.Ye <allen.ye@mediatek.com>
----
- src/ap/ieee802_11.c | 6 ++++--
- 1 file changed, 4 insertions(+), 2 deletions(-)
-
-diff --git a/src/ap/ieee802_11.c b/src/ap/ieee802_11.c
-index f20073c..ef520c8 100755
---- a/src/ap/ieee802_11.c
-+++ b/src/ap/ieee802_11.c
-@@ -7494,8 +7494,10 @@ static u8 * hostapd_eid_rnr_iface(struct hostapd_data *hapd,
- }
-
- start = i;
-- *tbtt_count_pos = RNR_TBTT_INFO_COUNT(tbtt_count - 1);
-- *size_offset = (eid - size_offset) - 1;
-+ if (tbtt_count != 0) {
-+ *tbtt_count_pos = RNR_TBTT_INFO_COUNT(tbtt_count - 1);
-+ *size_offset = (eid - size_offset) - 1;
-+ }
- }
-
- if (tbtt_count == 0)
---
-2.18.0
-
diff --git a/recipes-wifi/wpa-supplicant/files/patches-2.10.3/mtk-0039-hostapd-mtk-Set-STA-TX-queue-parameters-configuratio.patch b/recipes-wifi/wpa-supplicant/files/patches-2.10.3/mtk-0039-hostapd-mtk-Set-STA-TX-queue-parameters-configuratio.patch
new file mode 100644
index 0000000..9c8c63b
--- /dev/null
+++ b/recipes-wifi/wpa-supplicant/files/patches-2.10.3/mtk-0039-hostapd-mtk-Set-STA-TX-queue-parameters-configuratio.patch
@@ -0,0 +1,78 @@
+From 55837ad406c9af8a398d6073809151f7a3779b74 Mon Sep 17 00:00:00 2001
+From: Michael Lee <michael-cy.lee@mediatek.com>
+Date: Fri, 7 Jul 2023 17:16:11 +0800
+Subject: [PATCH 39/40] hostapd: mtk: Set STA TX queue parameters configuration
+ after association
+
+This patch adds the way for wpa_supplicant to set driver's TX queue
+parameters.
+Since STA parses and apply TX queue parameters from AP beacon's WMM IE
+during association, wpa_supplicant set driver's TX queue parameters
+after the association.
+
+Signed-off-by: Michael Lee <michael-cy.lee@mediatek.com>
+---
+ wpa_supplicant/driver_i.h | 12 ++++++++++++
+ wpa_supplicant/events.c | 16 ++++++++++++++++
+ 2 files changed, 28 insertions(+)
+
+diff --git a/wpa_supplicant/driver_i.h b/wpa_supplicant/driver_i.h
+index 48953c1..0699689 100644
+--- a/wpa_supplicant/driver_i.h
++++ b/wpa_supplicant/driver_i.h
+@@ -321,6 +321,18 @@ static inline int wpa_drv_set_country(struct wpa_supplicant *wpa_s,
+ return 0;
+ }
+
++static inline int wpa_drv_set_tx_queue_params(struct wpa_supplicant *wpa_s,
++ int q, int aifs, int cw_min,
++ int cw_max, int burst_time)
++{
++ int link_id = -1;
++ if (wpa_s->driver->set_tx_queue_params)
++ return wpa_s->driver->set_tx_queue_params(wpa_s->drv_priv, q,
++ aifs, cw_min, cw_max,
++ burst_time, link_id);
++ return 0;
++}
++
+ static inline int wpa_drv_send_mlme(struct wpa_supplicant *wpa_s,
+ const u8 *data, size_t data_len, int noack,
+ unsigned int freq, unsigned int wait)
+diff --git a/wpa_supplicant/events.c b/wpa_supplicant/events.c
+index 03442f5..5eb5248 100644
+--- a/wpa_supplicant/events.c
++++ b/wpa_supplicant/events.c
+@@ -3557,6 +3557,20 @@ out:
+ return wpa_sm_set_mlo_params(wpa_s->wpa, &wpa_mlo);
+ }
+
++static void wpa_supplicant_tx_queue_params(struct wpa_supplicant *wpa_s){
++ struct hostapd_tx_queue_params *p;
++
++ for (int i = 0; i < NUM_TX_QUEUES; i++){
++ p = &wpa_s->conf->tx_queue[i];
++ if(wpa_drv_set_tx_queue_params(wpa_s, i, p->aifs,
++ p->cwmin, p->cwmax,
++ p->burst)) {
++ wpa_printf(MSG_DEBUG, "Failed to set TX queue "
++ "parameters for queue %d.", i);
++ /* Continue anyway */
++ }
++ }
++}
+
+ static void wpa_supplicant_event_assoc(struct wpa_supplicant *wpa_s,
+ union wpa_event_data *data)
+@@ -3884,6 +3898,8 @@ static void wpa_supplicant_event_assoc(struct wpa_supplicant *wpa_s,
+
+ if (wpa_s->current_ssid && wpa_s->current_ssid->enable_4addr_mode)
+ wpa_supplicant_set_4addr_mode(wpa_s);
++
++ wpa_supplicant_tx_queue_params(wpa_s);
+ }
+
+
+--
+2.18.0
+
diff --git a/recipes-wifi/wpa-supplicant/files/patches-2.10.3/mtk-0040-hostapd-mtk-add-back-ht-vht-cap-missing-field-before.patch b/recipes-wifi/wpa-supplicant/files/patches-2.10.3/mtk-0040-hostapd-mtk-add-back-ht-vht-cap-missing-field-before.patch
deleted file mode 100644
index 0a27496..0000000
--- a/recipes-wifi/wpa-supplicant/files/patches-2.10.3/mtk-0040-hostapd-mtk-add-back-ht-vht-cap-missing-field-before.patch
+++ /dev/null
@@ -1,44 +0,0 @@
-From 2ea36366ea036e3063ff553a2939c9cac17c6ac8 Mon Sep 17 00:00:00 2001
-From: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
-Date: Tue, 8 Aug 2023 19:21:41 +0800
-Subject: [PATCH] hostapd: mtk: add back ht vht cap missing field before dfs
- channel fallback
-
-hostapd_event_ch_switch would set / clear ht_capab and vht_capab, based
-on the bandwidth of switched channel.
-For example, vht bw 160 support field would be cleared if we switch to
-non bw 160 channel.
-This design works fine with NON-DFS channel switch.
-However, for those DFS channels who require CAC, channel switch command
-calls hostapd_switch_channel_fallback instead of hostapd_switch_channel.
-This is simply restarting the interface not CHANNEL SWITCHING, so
-hostapd will not receive any ch_switch event from kernel.
-Therefore, the cleared field in vht_capab will not be set back to 1,
-even if we channel switch to dfs channel bw 160.
-
-Signed-off-by: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
----
- src/ap/hostapd.c | 7 +++++++
- 1 file changed, 7 insertions(+)
-
-diff --git a/src/ap/hostapd.c b/src/ap/hostapd.c
-index c2e0b13..4b7ebc5 100644
---- a/src/ap/hostapd.c
-+++ b/src/ap/hostapd.c
-@@ -4161,6 +4161,13 @@ hostapd_switch_channel_fallback(struct hostapd_iface *iface,
- break;
- }
-
-+ if ((iface->current_mode->ht_capab & HT_CAP_INFO_SUPP_CHANNEL_WIDTH_SET) &&
-+ freq_params->bandwidth > 20)
-+ iface->conf->ht_capab |= HT_CAP_INFO_SUPP_CHANNEL_WIDTH_SET;
-+ if ((iface->current_mode->vht_capab & VHT_CAP_SUPP_CHAN_WIDTH_160MHZ) &&
-+ freq_params->bandwidth == 160)
-+ iface->conf->vht_capab |= VHT_CAP_SUPP_CHAN_WIDTH_160MHZ;
-+
- iface->freq = freq_params->freq;
- iface->conf->channel = freq_params->channel;
- iface->conf->secondary_channel = freq_params->sec_channel_offset;
---
-2.18.0
-
diff --git a/recipes-wifi/wpa-supplicant/files/patches-2.10.3/mtk-0040-hostapd-mtk-avoid-color-switch-when-beacon-is-not-se.patch b/recipes-wifi/wpa-supplicant/files/patches-2.10.3/mtk-0040-hostapd-mtk-avoid-color-switch-when-beacon-is-not-se.patch
new file mode 100644
index 0000000..d31b6c2
--- /dev/null
+++ b/recipes-wifi/wpa-supplicant/files/patches-2.10.3/mtk-0040-hostapd-mtk-avoid-color-switch-when-beacon-is-not-se.patch
@@ -0,0 +1,26 @@
+From 100dae9224afa0c9dbd1117ab97b60e427657afc Mon Sep 17 00:00:00 2001
+From: Michael-CY Lee <michael-cy.lee@mediatek.com>
+Date: Fri, 1 Sep 2023 15:31:24 +0800
+Subject: [PATCH 40/40] hostapd: mtk: avoid color switch when beacon is not set
+
+Signed-off-by: Michael-CY Lee <michael-cy.lee@mediatek.com>
+---
+ src/ap/hostapd.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/ap/hostapd.c b/src/ap/hostapd.c
+index 2283b19..6d86993 100644
+--- a/src/ap/hostapd.c
++++ b/src/ap/hostapd.c
+@@ -4249,7 +4249,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->beacon_set_done)
+ return;
+
+ if (os_get_reltime(&now))
+--
+2.18.0
+
diff --git a/recipes-wifi/wpa-supplicant/files/patches-2.10.3/mtk-1000-hostapd-mtk-update-eht-operation-element.patch b/recipes-wifi/wpa-supplicant/files/patches-2.10.3/mtk-1000-hostapd-mtk-update-eht-operation-element.patch
deleted file mode 100644
index f25ae08..0000000
--- a/recipes-wifi/wpa-supplicant/files/patches-2.10.3/mtk-1000-hostapd-mtk-update-eht-operation-element.patch
+++ /dev/null
@@ -1,29 +0,0 @@
-From 04a5e0bf7a0f13759a4df7ca7d6789c67c837017 Mon Sep 17 00:00:00 2001
-From: Evelyn Tsai <evelyn.tsai@mediatek.com>
-Date: Wed, 10 May 2023 13:11:34 +0800
-Subject: [PATCH 1000/1001] hostapd: mtk: update eht operation element
-
----
- src/ap/ieee802_11_eht.c | 6 +++---
- 1 file changed, 3 insertions(+), 3 deletions(-)
-
-diff --git a/src/ap/ieee802_11_eht.c b/src/ap/ieee802_11_eht.c
-index 9a07f7501..f132e1d9c 100644
---- a/src/ap/ieee802_11_eht.c
-+++ b/src/ap/ieee802_11_eht.c
-@@ -215,9 +215,9 @@ u8 * hostapd_eid_eht_operation(struct hostapd_data *hapd, u8 *eid)
-
- /* TODO: Fill in appropriate EHT-MCS max Nss information */
- oper->basic_eht_mcs_nss_set[0] = 0x11;
-- oper->basic_eht_mcs_nss_set[1] = 0x00;
-- oper->basic_eht_mcs_nss_set[2] = 0x00;
-- oper->basic_eht_mcs_nss_set[3] = 0x00;
-+ oper->basic_eht_mcs_nss_set[1] = 0x11;
-+ oper->basic_eht_mcs_nss_set[2] = 0x11;
-+ oper->basic_eht_mcs_nss_set[3] = 0x11;
-
- if (is_6ghz_op_class(conf->op_class))
- chwidth = op_class_to_ch_width(conf->op_class);
---
-2.39.2
-
diff --git a/recipes-wifi/wpa-supplicant/files/patches-2.10.3/mtk-1001-hostapd-mtk-Add-support-for-gtk-rekeying-in-hostapd-.patch b/recipes-wifi/wpa-supplicant/files/patches-2.10.3/mtk-1001-hostapd-mtk-Add-support-for-gtk-rekeying-in-hostapd-.patch
deleted file mode 100644
index 25a401d..0000000
--- a/recipes-wifi/wpa-supplicant/files/patches-2.10.3/mtk-1001-hostapd-mtk-Add-support-for-gtk-rekeying-in-hostapd-.patch
+++ /dev/null
@@ -1,45 +0,0 @@
-From d9ddfb581c40edd45b7c1a30bfc2889ddb2102a4 Mon Sep 17 00:00:00 2001
-From: mtk23510 <rudra.shahi@mediatek.com>
-Date: Fri, 26 May 2023 14:52:35 +0800
-Subject: [PATCH 1001/1001] hostapd: mtk: Add support for gtk rekeying in
- hostapd cli
-
-Signed-off-by: mtk23510 <rudra.shahi@mediatek.com>
----
- hostapd/hostapd_cli.c | 13 +++++++++++++
- 1 file changed, 13 insertions(+)
-
-diff --git a/hostapd/hostapd_cli.c b/hostapd/hostapd_cli.c
-index 6d763f327..363a6bb93 100644
---- a/hostapd/hostapd_cli.c
-+++ b/hostapd/hostapd_cli.c
-@@ -1256,6 +1256,15 @@ static int hostapd_cli_cmd_update_beacon(struct wpa_ctrl *ctrl, int argc,
- }
-
-
-+#ifdef CONFIG_TESTING_OPTIONS
-+static int hostapd_cli_cmd_rekey_gtk(struct wpa_ctrl *ctrl, int argc,
-+ char *argv[])
-+{
-+ return wpa_ctrl_command(ctrl, "REKEY_GTK");
-+}
-+#endif
-+
-+
- static int hostapd_cli_cmd_vendor(struct wpa_ctrl *ctrl, int argc, char *argv[])
- {
- char cmd[256];
-@@ -1761,6 +1770,10 @@ static const struct hostapd_cli_cmd hostapd_cli_commands[] = {
- "= disable hostapd on current interface" },
- { "update_beacon", hostapd_cli_cmd_update_beacon, NULL,
- "= update Beacon frame contents\n"},
-+#ifdef CONFIG_TESTING_OPTIONS
-+ { "rekey_gtk", hostapd_cli_cmd_rekey_gtk, NULL,
-+ "= rekey gtk\n"},
-+#endif
- { "erp_flush", hostapd_cli_cmd_erp_flush, NULL,
- "= drop all ERP keys"},
- { "log_level", hostapd_cli_cmd_log_level, NULL,
---
-2.39.2
-
diff --git a/recipes-wifi/hostapd/files/patches-2.10.3/mtk-1000-hostapd-mtk-update-eht-operation-element.patch b/recipes-wifi/wpa-supplicant/files/patches-2.10.3/mtk-1001-hostapd-mtk-update-eht-operation-element.patch
similarity index 83%
copy from recipes-wifi/hostapd/files/patches-2.10.3/mtk-1000-hostapd-mtk-update-eht-operation-element.patch
copy to recipes-wifi/wpa-supplicant/files/patches-2.10.3/mtk-1001-hostapd-mtk-update-eht-operation-element.patch
index f25ae08..e2c6d87 100644
--- a/recipes-wifi/hostapd/files/patches-2.10.3/mtk-1000-hostapd-mtk-update-eht-operation-element.patch
+++ b/recipes-wifi/wpa-supplicant/files/patches-2.10.3/mtk-1001-hostapd-mtk-update-eht-operation-element.patch
@@ -1,14 +1,14 @@
-From 04a5e0bf7a0f13759a4df7ca7d6789c67c837017 Mon Sep 17 00:00:00 2001
+From 3b4b9812c97b0b75579829c96a19e8a8cc0bfa7b Mon Sep 17 00:00:00 2001
From: Evelyn Tsai <evelyn.tsai@mediatek.com>
Date: Wed, 10 May 2023 13:11:34 +0800
-Subject: [PATCH 1000/1001] hostapd: mtk: update eht operation element
+Subject: [PATCH 1001/1004] hostapd: mtk: update eht operation element
---
src/ap/ieee802_11_eht.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/ap/ieee802_11_eht.c b/src/ap/ieee802_11_eht.c
-index 9a07f7501..f132e1d9c 100644
+index 9a07f75..f132e1d 100644
--- a/src/ap/ieee802_11_eht.c
+++ b/src/ap/ieee802_11_eht.c
@@ -215,9 +215,9 @@ u8 * hostapd_eid_eht_operation(struct hostapd_data *hapd, u8 *eid)
@@ -25,5 +25,5 @@
if (is_6ghz_op_class(conf->op_class))
chwidth = op_class_to_ch_width(conf->op_class);
--
-2.39.2
+2.18.0
diff --git a/recipes-wifi/wpa-supplicant/files/patches-2.10.3/mtk-1002-hostapd-mtk-ucode-add-support-for-ucode-to-parse-BW3.patch b/recipes-wifi/wpa-supplicant/files/patches-2.10.3/mtk-1002-hostapd-mtk-ucode-add-support-for-ucode-to-parse-BW3.patch
new file mode 100644
index 0000000..1b51a28
--- /dev/null
+++ b/recipes-wifi/wpa-supplicant/files/patches-2.10.3/mtk-1002-hostapd-mtk-ucode-add-support-for-ucode-to-parse-BW3.patch
@@ -0,0 +1,28 @@
+From 5ed678c7562b1acf04f1b6c63ab25a5f3043325f Mon Sep 17 00:00:00 2001
+From: Evelyn Tsai <evelyn.tsai@mediatek.com>
+Date: Wed, 30 Aug 2023 04:23:37 +0800
+Subject: [PATCH 1002/1004] hostapd: mtk: ucode: add support for ucode to parse
+ BW320MHz info
+
+---
+ src/utils/ucode.c | 4 ++++
+ 1 file changed, 4 insertions(+)
+
+diff --git a/src/utils/ucode.c b/src/utils/ucode.c
+index 896ef46..4448738 100644
+--- a/src/utils/ucode.c
++++ b/src/utils/ucode.c
+@@ -85,6 +85,10 @@ uc_value_t *uc_wpa_freq_info(uc_vm_t *vm, size_t nargs)
+ case 2:
+ chanwidth = CONF_OPER_CHWIDTH_160MHZ;
+ break;
++ case 9:
++ width = 3;
++ chanwidth = CONF_OPER_CHWIDTH_320MHZ;
++ break;
+ default:
+ return NULL;
+ }
+--
+2.18.0
+
diff --git a/recipes-wifi/wpa-supplicant/files/patches-2.10.3/mtk-1003-hostapd-mtk-synchronize-bandwidth-in-AP-STA-support.patch b/recipes-wifi/wpa-supplicant/files/patches-2.10.3/mtk-1003-hostapd-mtk-synchronize-bandwidth-in-AP-STA-support.patch
new file mode 100644
index 0000000..74c685b
--- /dev/null
+++ b/recipes-wifi/wpa-supplicant/files/patches-2.10.3/mtk-1003-hostapd-mtk-synchronize-bandwidth-in-AP-STA-support.patch
@@ -0,0 +1,61 @@
+From 25b1c0f5e4f674ea2b72949bce83c05204d19653 Mon Sep 17 00:00:00 2001
+From: Michael-CY Lee <michael-cy.lee@mediatek.com>
+Date: Thu, 24 Aug 2023 16:44:30 +0800
+Subject: [PATCH] hostapd: mtk: synchronize bandwidth in AP/STA support
+
+Signed-off-by: Michael Lee <michael-cy.lee@mediatek.com>
+---
+ src/utils/ucode.c | 1 +
+ wpa_supplicant/ucode.c | 10 ++++++++++
+ 2 files changed, 11 insertions(+)
+
+diff --git a/src/utils/ucode.c b/src/utils/ucode.c
+index 44169f0..41c19fb 100644
+--- a/src/utils/ucode.c
++++ b/src/utils/ucode.c
+@@ -115,6 +115,7 @@ uc_value_t *uc_wpa_freq_info(uc_vm_t *vm, size_t nargs)
+ ucv_object_add(ret, "hw_mode_str", ucv_get(ucv_string_new(modestr)));
+ ucv_object_add(ret, "sec_channel", ucv_int64_new(sec_channel));
+ ucv_object_add(ret, "frequency", ucv_int64_new(freq_val));
++ ucv_object_add(ret, "oper_chwidth", ucv_int64_new(chanwidth));
+
+ if (!sec_channel)
+ return ret;
+diff --git a/wpa_supplicant/ucode.c b/wpa_supplicant/ucode.c
+index d0a78d1..dbf57fa 100644
+--- a/wpa_supplicant/ucode.c
++++ b/wpa_supplicant/ucode.c
+@@ -6,6 +6,7 @@
+ #include "wps_supplicant.h"
+ #include "bss.h"
+ #include "ucode.h"
++#include "driver_i.h"
+
+ static struct wpa_global *wpa_global;
+ static uc_resource_type_t *global_type, *iface_type;
+@@ -194,6 +195,9 @@ uc_wpas_iface_status(uc_vm_t *vm, size_t nargs)
+ struct wpa_supplicant *wpa_s = uc_fn_thisval("wpas.iface");
+ struct wpa_bss *bss;
+ uc_value_t *ret, *val;
++ struct wpa_channel_info ci;
++ u8 op_class, channel;
++ enum oper_chan_width ch_width;
+
+ if (!wpa_s)
+ return NULL;
+@@ -222,6 +226,12 @@ uc_wpas_iface_status(uc_vm_t *vm, size_t nargs)
+
+ ucv_object_add(ret, "sec_chan_offset", ucv_int64_new(sec_chan));
+ ucv_object_add(ret, "frequency", ucv_int64_new(bss->freq));
++
++ wpa_drv_channel_info(wpa_s, &ci);
++ ieee80211_chaninfo_to_channel(ci.frequency, ci.chanwidth,
++ sec_chan, &op_class, &channel);
++ ch_width = op_class_to_ch_width(op_class);
++ ucv_object_add(ret, "ch_width", ucv_int64_new(ch_width));
+ }
+
+ return ret;
+--
+2.25.1
+
diff --git a/recipes-wifi/wpa-supplicant/files/patches-2.10.3/patches.inc b/recipes-wifi/wpa-supplicant/files/patches-2.10.3/patches.inc
index 89585bc..02810bf 100644
--- a/recipes-wifi/wpa-supplicant/files/patches-2.10.3/patches.inc
+++ b/recipes-wifi/wpa-supplicant/files/patches-2.10.3/patches.inc
@@ -9,7 +9,6 @@
file://030-driver_nl80211-rewrite-neigh-code-to-not-depend-on-l.patch \
file://040-mesh-allow-processing-authentication-frames-in-block.patch \
file://050-build_fix.patch \
- file://100-daemonize_fix.patch \
file://110-mbedtls-TLS-crypto-option-initial-port.patch \
file://120-mbedtls-fips186_2_prf.patch \
file://130-mbedtls-annotate-with-TEST_FAIL-for-hwsim-tests.patch \
@@ -24,11 +23,8 @@
file://310-rescan_immediately.patch \
file://320-optional_rfkill.patch \
file://330-nl80211_fix_set_freq.patch \
- file://340-reload_freq_change.patch \
file://341-mesh-ctrl-iface-channel-switch.patch \
file://350-nl80211_del_beacon_bss.patch \
- file://360-ctrl_iface_reload.patch \
- file://370-ap_sta_support.patch \
file://380-disable_ctrl_iface_mib.patch \
file://381-hostapd_cli_UNKNOWN-COMMAND.patch \
file://390-wpa_ie_cap_workaround.patch \
@@ -37,7 +33,6 @@
file://420-indicate-features.patch \
file://430-hostapd_cli_ifdef.patch \
file://431-wpa_cli_ifdef.patch \
- file://450-scan_wait.patch;apply=no \
file://460-wpa_supplicant-add-new-config-params-to-be-used-with.patch \
file://463-add-mcast_rate-to-11s.patch \
file://464-fix-mesh-obss-check.patch \
@@ -49,7 +44,6 @@
file://600-ubus_support.patch \
file://601-ucode_support.patch \
file://610-hostapd_cli_ujail_permission.patch \
- file://700-wifi-reload.patch \
file://701-reload_config_inline.patch \
file://710-vlan_no_bridge.patch \
file://711-wds_bridge_force.patch \
@@ -62,6 +56,7 @@
file://761-shared_das_port.patch \
file://770-radius_server.patch \
file://990-ctrl-make-WNM_AP-functions-dependant-on-CONFIG_AP.patch \
+ file://991-Fix-OpenWrt-13156.patch \
file://mtk-0001-hostapd-mtk-Add-neighbor-report-and-BSS-Termination-.patch \
file://mtk-0002-hostapd-mtk-print-sae-groups-by-hostapd-ctrl.patch \
file://mtk-0003-hostapd-mtk-add-support-for-runtime-set-in-band-disc.patch \
@@ -79,28 +74,30 @@
file://mtk-0015-hostapd-mtk-6G-band-does-not-require-DFS.patch \
file://mtk-0016-hostapd-mtk-Fix-sending-wrong-VHT-operation-IE-in-CS.patch \
file://mtk-0017-hostapd-mtk-Add-sta-assisted-DFS-state-update-mechan.patch \
- file://mtk-0018-hostapd-mtk-Fix-auto-ht-issue-when-switching-to-DFS-.patch \
- file://mtk-0019-hostapd-mtk-Mark-DFS-channel-as-available-for-CSA.patch \
- file://mtk-0020-hostapd-mtk-Add-available-color-bitmap.patch \
- file://mtk-0021-hostapd-mtk-Add-channel-information-for-hostapd-relo.patch \
- file://mtk-0022-hostapd-mtk-Fix-ZWDFS-issue-in-BW-160.patch \
- file://mtk-0023-hostapd-mtk-Add-vendor-for-CAPI-certification-comman.patch \
- file://mtk-0024-hostapd-mtk-Air-Monitor-support-in-hostapd-by-vendor.patch \
- file://mtk-0025-hostapd-mtk-Fix-scan-result-updating-issue.patch \
- file://mtk-0026-hostapd-mtk-Avoid-setting-beacon-after-wpa_supplican.patch \
- file://mtk-0027-hostapd-mtk-Fix-setting-wrong-seg0-index-for-5G-cent.patch \
- file://mtk-0028-hostapd-mtk-Add-muru-user-number-debug-command.patch \
- file://mtk-0030-hostapd-mtk-Fix-unexpected-AP-beacon-state-transitio.patch \
- file://mtk-0031-hostapd-mtk-add-connac3-PHY-MURU-manual-mode-config-.patch \
- file://mtk-0032-hostapd-mtk-Add-HE-capabilities-check.patch \
- file://mtk-0033-hostapd-mtk-Fix-background-channel-overlapping-opera.patch \
- file://mtk-0034-hostapd-mtk-Fix-hostapd_dfs_start_cac-log.patch \
- file://mtk-0035-hostapd-mtk-Check-the-bridge-after-ioctl-SIOCBRADDIF.patch \
- file://mtk-0036-hostapd-mtk-Update-parameter_set_count-in-MU-EDCA-IE.patch \
- file://mtk-0037-hostapd-mtk-Add-extension-IE-list-for-non-inherit-IE.patch \
- file://mtk-0038-hostapd-mtk-Fix-11vmbss-aid-using-wrong-pool.patch \
- file://mtk-0039-hostapd-mtk-Fix-rnr-ie-length-when-no-need-to-report.patch \
- file://mtk-0040-hostapd-mtk-add-back-ht-vht-cap-missing-field-before.patch \
- file://mtk-1000-hostapd-mtk-update-eht-operation-element.patch \
- file://mtk-1001-hostapd-mtk-Add-support-for-gtk-rekeying-in-hostapd-.patch \
+ file://mtk-0018-hostapd-mtk-Mark-DFS-channel-as-available-for-CSA.patch \
+ file://mtk-0019-hostapd-mtk-Add-available-color-bitmap.patch \
+ file://mtk-0020-hostapd-mtk-Fix-ZWDFS-issue-in-BW-160.patch \
+ file://mtk-0021-hostapd-mtk-Add-vendor-for-CAPI-certification-comman.patch \
+ file://mtk-0022-hostapd-mtk-Air-Monitor-support-in-hostapd-by-vendor.patch \
+ file://mtk-0023-hostapd-mtk-Fix-setting-wrong-seg0-index-for-5G-cent.patch \
+ file://mtk-0024-hostapd-mtk-Add-muru-user-number-debug-command.patch \
+ file://mtk-0025-hostapd-mtk-add-connac3-PHY-MURU-manual-mode-config-.patch \
+ file://mtk-0026-hostapd-mtk-Add-HE-capabilities-check.patch \
+ file://mtk-0027-hostapd-mtk-Fix-background-channel-overlapping-opera.patch \
+ file://mtk-0028-hostapd-mtk-Fix-hostapd_dfs_start_cac-log.patch \
+ file://mtk-0029-hostapd-mtk-Check-the-bridge-after-ioctl-SIOCBRADDIF.patch \
+ file://mtk-0030-hostapd-mtk-Update-parameter_set_count-in-MU-EDCA-IE.patch \
+ file://mtk-0031-hostapd-mtk-add-extension-IE-list-for-non-inherit-IE.patch \
+ file://mtk-0032-hostapd-mtk-Fix-11vmbss-aid-using-wrong-pool.patch \
+ file://mtk-0033-hostapd-mtk-Fix-rnr-ie-length-when-no-need-to-report.patch \
+ file://mtk-0034-hostapd-mtk-add-back-ht-vht-cap-missing-field-before.patch \
+ file://mtk-0035-hostapd-mtk-update-op_class-when-AP-channel-switchin.patch \
+ file://mtk-0036-hostapd-mtk-Add-support-for-gtk-rekeying-in-hostapd-.patch \
+ file://mtk-0037-hostapd-mtk-Fix-wpa_supplicant-configuration-parsing.patch \
+ file://mtk-0038-hostapd-mtk-Set-WMM-and-TX-queue-parameters-for-wpa_.patch \
+ file://mtk-0039-hostapd-mtk-Set-STA-TX-queue-parameters-configuratio.patch \
+ file://mtk-0040-hostapd-mtk-avoid-color-switch-when-beacon-is-not-se.patch \
+ file://mtk-1001-hostapd-mtk-update-eht-operation-element.patch \
+ file://mtk-1002-hostapd-mtk-ucode-add-support-for-ucode-to-parse-BW3.patch \
+ file://mtk-1003-hostapd-mtk-synchronize-bandwidth-in-AP-STA-support.patch \
"
diff --git a/recipes-wifi/wpa-supplicant/files/patches/mtk-0039-hostapd-mtk-avoid-color-switch-when-beacon-is-not-se.patch b/recipes-wifi/wpa-supplicant/files/patches/mtk-0039-hostapd-mtk-avoid-color-switch-when-beacon-is-not-se.patch
new file mode 100755
index 0000000..2883c1f
--- /dev/null
+++ b/recipes-wifi/wpa-supplicant/files/patches/mtk-0039-hostapd-mtk-avoid-color-switch-when-beacon-is-not-se.patch
@@ -0,0 +1,28 @@
+From 33117ec15f94315f7671cfdaf47e8d5eeddee4ae Mon Sep 17 00:00:00 2001
+From: MeiChia Chiu <meichia.chiu@mediatek.com>
+Date: Fri, 1 Sep 2023 15:20:19 +0800
+Subject: [PATCH] hostapd: mtk: avoid color switch when beacon is not set
+
+Signed-off-by: MeiChia Chiu <meichia.chiu@mediatek.com>
+Signed-off-by: Michael-CY Lee <michael-cy.lee@mediatek.com>
+---
+ src/ap/hostapd.c | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/src/ap/hostapd.c b/src/ap/hostapd.c
+index abc6156..f2eb638 100644
+--- a/src/ap/hostapd.c
++++ b/src/ap/hostapd.c
+@@ -4024,7 +4024,8 @@ void hostapd_switch_color(struct hostapd_data *hapd, u64 bitmap)
+ {
+ struct os_reltime now;
+
+- if (hapd->cca_in_progress || hapd->stopped_by_supplicant)
++ if (hapd->cca_in_progress || hapd->stopped_by_supplicant ||
++ !hapd->beacon_set_done)
+ return;
+
+ if (os_get_reltime(&now))
+--
+2.39.0
+
diff --git a/recipes-wifi/wpa-supplicant/files/patches/patches.inc b/recipes-wifi/wpa-supplicant/files/patches/patches.inc
index f783c48..34e183e 100644
--- a/recipes-wifi/wpa-supplicant/files/patches/patches.inc
+++ b/recipes-wifi/wpa-supplicant/files/patches/patches.inc
@@ -102,4 +102,5 @@
file://mtk-0037-hostapd-mtk-Fix-11vmbss-aid-using-wrong-pool.patch \
file://mtk-0037-hostapd-mtk-add-back-ht-vht-cap-missing-field-before.patch \
file://mtk-0038-hostapd-mtk-Fix-rnr-ie-length-when-no-need-to-report.patch \
+ file://mtk-0039-hostapd-mtk-avoid-color-switch-when-beacon-is-not-se.patch \
"
diff --git a/recipes-wifi/wpa-supplicant/files/src-2.10.3/src/ap/ubus.c b/recipes-wifi/wpa-supplicant/files/src-2.10.3/src/ap/ubus.c
index a609eb1..6ff2257 100644
--- a/recipes-wifi/wpa-supplicant/files/src-2.10.3/src/ap/ubus.c
+++ b/recipes-wifi/wpa-supplicant/files/src-2.10.3/src/ap/ubus.c
@@ -163,7 +163,7 @@
{
struct hostapd_data *hapd = container_of(obj, struct hostapd_data, ubus.obj);
- return hostapd_reload_config(hapd->iface, 1);
+ return hostapd_reload_config(hapd->iface);
}
diff --git a/recipes-wifi/wpa-supplicant/files/src-2.10.3/src/ap/ucode.c b/recipes-wifi/wpa-supplicant/files/src-2.10.3/src/ap/ucode.c
index 137cb81..0326f6f 100644
--- a/recipes-wifi/wpa-supplicant/files/src-2.10.3/src/ap/ucode.c
+++ b/recipes-wifi/wpa-supplicant/files/src-2.10.3/src/ap/ucode.c
@@ -4,7 +4,10 @@
#include "utils/common.h"
#include "utils/ucode.h"
#include "hostapd.h"
+#include "beacon.h"
+#include "hw_features.h"
#include "ap_drv_ops.h"
+#include "dfs.h"
#include <libubox/uloop.h>
static uc_resource_type_t *global_type, *bss_type, *iface_type;
@@ -21,7 +24,7 @@
return wpa_ucode_registry_get(bss_registry, hapd->ucode.idx);
val = uc_resource_new(bss_type, hapd);
- wpa_ucode_registry_add(bss_registry, val, &hapd->ucode.idx);
+ hapd->ucode.idx = wpa_ucode_registry_add(bss_registry, val);
return val;
}
@@ -35,46 +38,46 @@
return wpa_ucode_registry_get(iface_registry, hapd->ucode.idx);
val = uc_resource_new(iface_type, hapd);
- wpa_ucode_registry_add(iface_registry, val, &hapd->ucode.idx);
+ hapd->ucode.idx = wpa_ucode_registry_add(iface_registry, val);
return val;
}
static void
-hostapd_ucode_update_bss_list(struct hostapd_iface *iface)
+hostapd_ucode_update_bss_list(struct hostapd_iface *iface, uc_value_t *if_bss, uc_value_t *bss)
{
- uc_value_t *ifval, *list;
+ uc_value_t *list;
int i;
list = ucv_array_new(vm);
for (i = 0; i < iface->num_bss; i++) {
struct hostapd_data *hapd = iface->bss[i];
uc_value_t *val = hostapd_ucode_bss_get_uval(hapd);
- uc_value_t *proto = ucv_prototype_get(val);
- ucv_object_add(proto, "name", ucv_get(ucv_string_new(hapd->conf->iface)));
- ucv_object_add(proto, "index", ucv_int64_new(i));
- ucv_array_set(list, i, ucv_get(val));
+ ucv_array_set(list, i, ucv_get(ucv_string_new(hapd->conf->iface)));
+ ucv_object_add(bss, hapd->conf->iface, ucv_get(val));
}
-
- ifval = hostapd_ucode_iface_get_uval(iface);
- ucv_object_add(ucv_prototype_get(ifval), "bss", ucv_get(list));
+ ucv_object_add(if_bss, iface->phy, ucv_get(list));
}
static void
hostapd_ucode_update_interfaces(void)
{
uc_value_t *ifs = ucv_object_new(vm);
+ uc_value_t *if_bss = ucv_array_new(vm);
+ uc_value_t *bss = ucv_object_new(vm);
int i;
for (i = 0; i < interfaces->count; i++) {
struct hostapd_iface *iface = interfaces->iface[i];
ucv_object_add(ifs, iface->phy, ucv_get(hostapd_ucode_iface_get_uval(iface)));
- hostapd_ucode_update_bss_list(iface);
+ hostapd_ucode_update_bss_list(iface, if_bss, bss);
}
ucv_object_add(ucv_prototype_get(global), "interfaces", ucv_get(ifs));
+ ucv_object_add(ucv_prototype_get(global), "interface_bss", ucv_get(if_bss));
+ ucv_object_add(ucv_prototype_get(global), "bss", ucv_get(bss));
ucv_gc(vm);
}
@@ -197,7 +200,7 @@
hostapd_config_free_bss(hapd->conf);
os_free(hapd);
- hostapd_ucode_update_bss_list(iface);
+ hostapd_ucode_update_interfaces();
ucv_gc(vm);
return NULL;
@@ -250,7 +253,7 @@
iface->conf->bss[iface->conf->num_bss] = bss;
conf->bss[idx] = NULL;
ret = hostapd_ucode_bss_get_uval(hapd);
- hostapd_ucode_update_bss_list(iface);
+ hostapd_ucode_update_interfaces();
goto out;
deinit_ctrl:
@@ -289,12 +292,149 @@
return ucv_string_new_length(reply, reply_len);
}
+static uc_value_t *
+uc_hostapd_iface_stop(uc_vm_t *vm, size_t nargs)
+{
+ struct hostapd_iface *iface = uc_fn_thisval("hostapd.iface");
+ int i;
+
+ for (i = 0; i < iface->num_bss; i++) {
+ struct hostapd_data *hapd = iface->bss[i];
+
+ hostapd_drv_stop_ap(hapd);
+ hapd->started = 0;
+ }
+}
+
+static uc_value_t *
+uc_hostapd_iface_start(uc_vm_t *vm, size_t nargs)
+{
+ struct hostapd_iface *iface = uc_fn_thisval("hostapd.iface");
+ uc_value_t *info = uc_fn_arg(0);
+ struct hostapd_config *conf;
+ uint64_t intval;
+ int i;
+
+ if (!iface)
+ return NULL;
+
+ if (!info)
+ goto out;
+
+ if (ucv_type(info) != UC_OBJECT)
+ return NULL;
+
+ conf = iface->conf;
+ if ((intval = ucv_int64_get(ucv_object_get(info, "op_class", NULL))) && !errno)
+ conf->op_class = intval;
+ if ((intval = ucv_int64_get(ucv_object_get(info, "hw_mode", NULL))) && !errno)
+ conf->hw_mode = intval;
+ if ((intval = ucv_int64_get(ucv_object_get(info, "channel", NULL))) && !errno)
+ conf->channel = intval;
+ if ((intval = ucv_int64_get(ucv_object_get(info, "sec_channel", NULL))) && !errno)
+ conf->secondary_channel = intval;
+
+ intval = ucv_int64_get(ucv_object_get(info, "center_seg0_idx", NULL));
+ if (!errno)
+ hostapd_set_oper_centr_freq_seg0_idx(conf, intval);
+
+ intval = ucv_int64_get(ucv_object_get(info, "center_seg1_idx", NULL));
+ if (!errno)
+ hostapd_set_oper_centr_freq_seg1_idx(conf, intval);
+
+ intval = ucv_int64_get(ucv_object_get(info, "oper_chwidth", NULL));
+ if (!errno)
+ hostapd_set_oper_chwidth(conf, intval);
+
+out:
+ if (conf->channel)
+ iface->freq = hostapd_hw_get_freq(iface->bss[0], conf->channel);
+
+ if (hostapd_is_dfs_required(iface) && !hostapd_is_dfs_chan_available(iface)) {
+ wpa_printf(MSG_INFO, "DFS CAC required on new channel, restart interface");
+ hostapd_disable_iface(iface);
+ hostapd_enable_iface(iface);
+ return ucv_boolean_new(true);
+ }
+
+ for (i = 0; i < iface->num_bss; i++) {
+ struct hostapd_data *hapd = iface->bss[i];
+ int ret;
+
+ hapd->started = 1;
+ hapd->conf->start_disabled = 0;
+ hostapd_set_freq(hapd, conf->hw_mode, iface->freq,
+ conf->channel,
+ conf->enable_edmg,
+ conf->edmg_channel,
+ conf->ieee80211n,
+ conf->ieee80211ac,
+ conf->ieee80211ax,
+ conf->ieee80211be,
+ conf->secondary_channel,
+ hostapd_get_oper_chwidth(conf),
+ hostapd_get_oper_centr_freq_seg0_idx(conf),
+ hostapd_get_oper_centr_freq_seg1_idx(conf));
+
+ ieee802_11_set_beacon(hapd);
+ }
+
+ return ucv_boolean_new(true);
+}
+
+static uc_value_t *
+uc_hostapd_iface_switch_channel(uc_vm_t *vm, size_t nargs)
+{
+ struct hostapd_iface *iface = uc_fn_thisval("hostapd.iface");
+ uc_value_t *info = uc_fn_arg(0);
+ struct hostapd_config *conf;
+ struct csa_settings csa = {};
+ uint64_t intval;
+ int i, ret = 0;
+
+ if (!iface || ucv_type(info) != UC_OBJECT)
+ return NULL;
+
+ conf = iface->conf;
+ if ((intval = ucv_int64_get(ucv_object_get(info, "csa_count", NULL))) && !errno)
+ csa.cs_count = intval;
+ if ((intval = ucv_int64_get(ucv_object_get(info, "sec_channel", NULL))) && !errno)
+ csa.freq_params.sec_channel_offset = intval;
+
+ csa.freq_params.ht_enabled = conf->ieee80211n;
+ csa.freq_params.vht_enabled = conf->ieee80211ac;
+ csa.freq_params.he_enabled = conf->ieee80211ax;
+#ifdef CONFIG_IEEE80211BE
+ csa.freq_params.eht_enabled = conf->ieee80211be;
+#endif
+ intval = ucv_int64_get(ucv_object_get(info, "oper_chwidth", NULL));
+ if (errno)
+ intval = hostapd_get_oper_chwidth(conf);
+ if (intval)
+ csa.freq_params.bandwidth = 40 << intval;
+ else
+ csa.freq_params.bandwidth = csa.freq_params.sec_channel_offset ? 40 : 20;
+
+ if ((intval = ucv_int64_get(ucv_object_get(info, "frequency", NULL))) && !errno)
+ csa.freq_params.freq = intval;
+ if ((intval = ucv_int64_get(ucv_object_get(info, "center_freq1", NULL))) && !errno)
+ csa.freq_params.center_freq1 = intval;
+ if ((intval = ucv_int64_get(ucv_object_get(info, "center_freq2", NULL))) && !errno)
+ csa.freq_params.center_freq2 = intval;
+
+ for (i = 0; i < iface->num_bss; i++)
+ ret = hostapd_switch_channel(iface->bss[i], &csa);
+
+ return ucv_boolean_new(!ret);
+}
+
int hostapd_ucode_init(struct hapd_interfaces *ifaces)
{
static const uc_function_list_t global_fns[] = {
{ "printf", uc_wpa_printf },
{ "getpid", uc_wpa_getpid },
{ "sha1", uc_wpa_sha1 },
+ { "freq_info", uc_wpa_freq_info },
{ "add_iface", uc_hostapd_add_iface },
{ "remove_iface", uc_hostapd_remove_iface },
};
@@ -304,7 +444,10 @@
{ "delete", uc_hostapd_bss_delete },
};
static const uc_function_list_t iface_fns[] = {
- { "add_bss", uc_hostapd_iface_add_bss }
+ { "add_bss", uc_hostapd_iface_add_bss },
+ { "stop", uc_hostapd_iface_stop },
+ { "start", uc_hostapd_iface_start },
+ { "switch_channel", uc_hostapd_iface_switch_channel },
};
uc_value_t *data, *proto;
@@ -360,7 +503,7 @@
ucv_gc(vm);
}
-void hostapd_ucode_reload_bss(struct hostapd_data *hapd, int reconf)
+void hostapd_ucode_reload_bss(struct hostapd_data *hapd)
{
uc_value_t *val;
@@ -370,8 +513,7 @@
val = hostapd_ucode_bss_get_uval(hapd);
uc_value_push(ucv_get(ucv_string_new(hapd->conf->iface)));
uc_value_push(ucv_get(val));
- uc_value_push(ucv_int64_new(reconf));
- ucv_put(wpa_ucode_call(3));
+ ucv_put(wpa_ucode_call(2));
ucv_gc(vm);
}
diff --git a/recipes-wifi/wpa-supplicant/files/src-2.10.3/src/ap/ucode.h b/recipes-wifi/wpa-supplicant/files/src-2.10.3/src/ap/ucode.h
index dbc49e6..d00b787 100644
--- a/recipes-wifi/wpa-supplicant/files/src-2.10.3/src/ap/ucode.h
+++ b/recipes-wifi/wpa-supplicant/files/src-2.10.3/src/ap/ucode.h
@@ -25,7 +25,7 @@
void hostapd_ucode_free_iface(struct hostapd_iface *iface);
void hostapd_ucode_add_bss(struct hostapd_data *hapd);
void hostapd_ucode_free_bss(struct hostapd_data *hapd);
-void hostapd_ucode_reload_bss(struct hostapd_data *hapd, int reconf);
+void hostapd_ucode_reload_bss(struct hostapd_data *hapd);
#else
@@ -39,7 +39,7 @@
static inline void hostapd_ucode_free_iface(struct hostapd_iface *iface)
{
}
-static inline void hostapd_ucode_reload_bss(struct hostapd_data *hapd, int reconf)
+static inline void hostapd_ucode_reload_bss(struct hostapd_data *hapd)
{
}
static inline void hostapd_ucode_add_bss(struct hostapd_data *hapd)
diff --git a/recipes-wifi/wpa-supplicant/files/src-2.10.3/src/utils/ucode.c b/recipes-wifi/wpa-supplicant/files/src-2.10.3/src/utils/ucode.c
index a92913a..896ef46 100644
--- a/recipes-wifi/wpa-supplicant/files/src-2.10.3/src/utils/ucode.c
+++ b/recipes-wifi/wpa-supplicant/files/src-2.10.3/src/utils/ucode.c
@@ -3,6 +3,7 @@
#include "utils/eloop.h"
#include "crypto/crypto.h"
#include "crypto/sha1.h"
+#include "common/ieee802_11_common.h"
#include <libubox/uloop.h>
#include <ucode/compiler.h>
@@ -45,6 +46,100 @@
return NULL;
}
+uc_value_t *uc_wpa_freq_info(uc_vm_t *vm, size_t nargs)
+{
+ uc_value_t *freq = uc_fn_arg(0);
+ uc_value_t *sec = uc_fn_arg(1);
+ int width = ucv_uint64_get(uc_fn_arg(2));
+ int freq_val, center_idx, center_ofs;
+ enum oper_chan_width chanwidth;
+ enum hostapd_hw_mode hw_mode;
+ u8 op_class, channel, tmp_channel;
+ const char *modestr;
+ int sec_channel = 0;
+ uc_value_t *ret;
+
+ if (ucv_type(freq) != UC_INTEGER)
+ return NULL;
+
+ freq_val = ucv_int64_get(freq);
+ if (ucv_type(sec) == UC_INTEGER)
+ sec_channel = ucv_int64_get(sec);
+ else if (sec)
+ return NULL;
+ else if (freq_val > 4000)
+ sec_channel = (freq_val / 20) & 1 ? 1 : -1;
+ else
+ sec_channel = freq_val < 2442 ? 1 : -1;
+
+ if (sec_channel != -1 && sec_channel != 1 && sec_channel != 0)
+ return NULL;
+
+ switch (width) {
+ case 0:
+ chanwidth = CONF_OPER_CHWIDTH_USE_HT;
+ break;
+ case 1:
+ chanwidth = CONF_OPER_CHWIDTH_80MHZ;
+ break;
+ case 2:
+ chanwidth = CONF_OPER_CHWIDTH_160MHZ;
+ break;
+ default:
+ return NULL;
+ }
+
+ hw_mode = ieee80211_freq_to_channel_ext(freq_val, sec_channel,
+ chanwidth, &op_class, &channel);
+ switch (hw_mode) {
+ case HOSTAPD_MODE_IEEE80211B:
+ modestr = "b";
+ break;
+ case HOSTAPD_MODE_IEEE80211G:
+ modestr = "g";
+ break;
+ case HOSTAPD_MODE_IEEE80211A:
+ modestr = "a";
+ break;
+ case HOSTAPD_MODE_IEEE80211AD:
+ modestr = "ad";
+ break;
+ default:
+ return NULL;
+ }
+
+ ret = ucv_object_new(vm);
+ ucv_object_add(ret, "op_class", ucv_int64_new(op_class));
+ ucv_object_add(ret, "channel", ucv_int64_new(channel));
+ ucv_object_add(ret, "hw_mode", ucv_int64_new(hw_mode));
+ ucv_object_add(ret, "hw_mode_str", ucv_get(ucv_string_new(modestr)));
+ ucv_object_add(ret, "sec_channel", ucv_int64_new(sec_channel));
+ ucv_object_add(ret, "frequency", ucv_int64_new(freq_val));
+
+ if (!sec_channel)
+ return ret;
+
+ if (freq_val >= 5900)
+ center_ofs = 0;
+ else if (freq_val >= 5745)
+ center_ofs = 20;
+ else
+ center_ofs = 35;
+ tmp_channel = channel - center_ofs;
+ tmp_channel &= ~((8 << width) - 1);
+ center_idx = tmp_channel + center_ofs + (4 << width) - 1;
+
+ if (freq_val < 3000)
+ ucv_object_add(ret, "center_seg0_idx", ucv_int64_new(0));
+ else
+ ucv_object_add(ret, "center_seg0_idx", ucv_int64_new(center_idx));
+ center_idx = (center_idx - channel) * 5 + freq_val;
+ ucv_object_add(ret, "center_freq1", ucv_int64_new(center_idx));
+
+out:
+ return ret;
+}
+
uc_value_t *uc_wpa_getpid(uc_vm_t *vm, size_t nargs)
{
return ucv_int64_new(getpid());
@@ -179,21 +274,7 @@
return global;
}
-static uc_value_t *wpa_ucode_prototype_clone(uc_value_t *uval)
-{
- uc_value_t *proto, *proto_new;
-
- proto = ucv_prototype_get(uval);
- proto_new = ucv_object_new(&vm);
-
- ucv_object_foreach(proto, key, val)
- ucv_object_add(proto_new, key, ucv_get(val));
- ucv_prototype_set(uval, ucv_get(proto));
-
- return proto;
-}
-
-void wpa_ucode_registry_add(uc_value_t *reg, uc_value_t *val, int *idx)
+int wpa_ucode_registry_add(uc_value_t *reg, uc_value_t *val)
{
uc_value_t *data;
int i = 0;
@@ -203,10 +284,7 @@
ucv_array_set(reg, i, ucv_get(val));
- data = ucv_object_new(&vm);
- ucv_object_add(wpa_ucode_prototype_clone(val), "data", ucv_get(data));
-
- *idx = i + 1;
+ return i + 1;
}
uc_value_t *wpa_ucode_registry_get(uc_value_t *reg, int idx)
diff --git a/recipes-wifi/wpa-supplicant/files/src-2.10.3/src/utils/ucode.h b/recipes-wifi/wpa-supplicant/files/src-2.10.3/src/utils/ucode.h
index 4caf8ad..2c18869 100644
--- a/recipes-wifi/wpa-supplicant/files/src-2.10.3/src/utils/ucode.h
+++ b/recipes-wifi/wpa-supplicant/files/src-2.10.3/src/utils/ucode.h
@@ -17,12 +17,13 @@
uc_value_t *wpa_ucode_global_init(const char *name, uc_resource_type_t *global_type);
-void wpa_ucode_registry_add(uc_value_t *reg, uc_value_t *val, int *idx);
+int wpa_ucode_registry_add(uc_value_t *reg, uc_value_t *val);
uc_value_t *wpa_ucode_registry_get(uc_value_t *reg, int idx);
uc_value_t *wpa_ucode_registry_remove(uc_value_t *reg, int idx);
uc_value_t *uc_wpa_printf(uc_vm_t *vm, size_t nargs);
uc_value_t *uc_wpa_getpid(uc_vm_t *vm, size_t nargs);
uc_value_t *uc_wpa_sha1(uc_vm_t *vm, size_t nargs);
+uc_value_t *uc_wpa_freq_info(uc_vm_t *vm, size_t nargs);
#endif
diff --git a/recipes-wifi/wpa-supplicant/files/src-2.10.3/wpa_supplicant/ucode.c b/recipes-wifi/wpa-supplicant/files/src-2.10.3/wpa_supplicant/ucode.c
index eec3980..d120ed6 100644
--- a/recipes-wifi/wpa-supplicant/files/src-2.10.3/wpa_supplicant/ucode.c
+++ b/recipes-wifi/wpa-supplicant/files/src-2.10.3/wpa_supplicant/ucode.c
@@ -1,8 +1,10 @@
#include "utils/includes.h"
#include "utils/common.h"
#include "utils/ucode.h"
+#include "drivers/driver.h"
#include "wpa_supplicant_i.h"
#include "wps_supplicant.h"
+#include "bss.h"
#include "ucode.h"
static struct wpa_global *wpa_global;
@@ -19,7 +21,7 @@
return wpa_ucode_registry_get(iface_registry, wpa_s->ucode.idx);
val = uc_resource_new(iface_type, wpa_s);
- wpa_ucode_registry_add(iface_registry, val, &wpa_s->ucode.idx);
+ wpa_s->ucode.idx = wpa_ucode_registry_add(iface_registry, val);
return val;
}
@@ -69,6 +71,59 @@
ucv_gc(vm);
}
+void wpas_ucode_update_state(struct wpa_supplicant *wpa_s)
+{
+ const char *state;
+ uc_value_t *val;
+
+ val = wpa_ucode_registry_get(iface_registry, wpa_s->ucode.idx);
+ if (!val)
+ return;
+
+ if (wpa_ucode_call_prepare("state"))
+ return;
+
+ state = wpa_supplicant_state_txt(wpa_s->wpa_state);
+ uc_value_push(ucv_get(ucv_string_new(wpa_s->ifname)));
+ uc_value_push(ucv_get(val));
+ uc_value_push(ucv_get(ucv_string_new(state)));
+ ucv_put(wpa_ucode_call(3));
+ ucv_gc(vm);
+}
+
+void wpas_ucode_event(struct wpa_supplicant *wpa_s, int event, union wpa_event_data *data)
+{
+ const char *state;
+ uc_value_t *val;
+
+ if (event != EVENT_CH_SWITCH_STARTED)
+ return;
+
+ val = wpa_ucode_registry_get(iface_registry, wpa_s->ucode.idx);
+ if (!val)
+ return;
+
+ if (wpa_ucode_call_prepare("event"))
+ return;
+
+ uc_value_push(ucv_get(ucv_string_new(wpa_s->ifname)));
+ uc_value_push(ucv_get(val));
+ uc_value_push(ucv_get(ucv_string_new(event_to_string(event))));
+ val = ucv_object_new(vm);
+ uc_value_push(ucv_get(val));
+
+ if (event == EVENT_CH_SWITCH_STARTED) {
+ ucv_object_add(val, "csa_count", ucv_int64_new(data->ch_switch.count));
+ ucv_object_add(val, "frequency", ucv_int64_new(data->ch_switch.freq));
+ ucv_object_add(val, "sec_chan_offset", ucv_int64_new(data->ch_switch.ch_offset));
+ ucv_object_add(val, "center_freq1", ucv_int64_new(data->ch_switch.cf1));
+ ucv_object_add(val, "center_freq2", ucv_int64_new(data->ch_switch.cf2));
+ }
+
+ ucv_put(wpa_ucode_call(4));
+ ucv_gc(vm);
+}
+
static const char *obj_stringval(uc_value_t *obj, const char *name)
{
uc_value_t *val = ucv_object_get(obj, name, NULL);
@@ -84,7 +139,6 @@
uc_value_t *bridge = ucv_object_get(info, "bridge", NULL);
uc_value_t *config = ucv_object_get(info, "config", NULL);
uc_value_t *ctrl = ucv_object_get(info, "ctrl", NULL);
- uc_value_t *hapd_ctrl = ucv_object_get(info, "hostapd_ctrl", NULL);
struct wpa_interface iface;
int ret = -1;
@@ -97,7 +151,6 @@
.bridge_ifname = ucv_string_get(bridge),
.confname = ucv_string_get(config),
.ctrl_interface = ucv_string_get(ctrl),
- .hostapd_ctrl = ucv_string_get(hapd_ctrl),
};
if (!iface.ifname || !iface.confname)
@@ -135,6 +188,46 @@
return ucv_int64_new(ret);
}
+static uc_value_t *
+uc_wpas_iface_status(uc_vm_t *vm, size_t nargs)
+{
+ struct wpa_supplicant *wpa_s = uc_fn_thisval("wpas.iface");
+ struct wpa_bss *bss;
+ uc_value_t *ret, *val;
+
+ if (!wpa_s)
+ return NULL;
+
+ ret = ucv_object_new(vm);
+
+ val = ucv_string_new(wpa_supplicant_state_txt(wpa_s->wpa_state));
+ ucv_object_add(ret, "state", ucv_get(val));
+
+ bss = wpa_s->current_bss;
+ if (bss) {
+ int sec_chan = 0;
+ const u8 *ie;
+
+ ie = wpa_bss_get_ie(bss, WLAN_EID_HT_OPERATION);
+ if (ie && ie[1] >= 2) {
+ const struct ieee80211_ht_operation *ht_oper;
+ int sec;
+
+ ht_oper = (const void *) (ie + 2);
+ sec = ht_oper->ht_param & HT_INFO_HT_PARAM_SECONDARY_CHNL_OFF_MASK;
+ if (sec == HT_INFO_HT_PARAM_SECONDARY_CHNL_ABOVE)
+ sec_chan = 1;
+ else if (sec == HT_INFO_HT_PARAM_SECONDARY_CHNL_BELOW)
+ sec_chan = -1;
+ }
+
+ ucv_object_add(ret, "sec_chan_offset", ucv_int64_new(sec_chan));
+ ucv_object_add(ret, "frequency", ucv_int64_new(bss->freq));
+ }
+
+ return ret;
+}
+
int wpas_ucode_init(struct wpa_global *gl)
{
static const uc_function_list_t global_fns[] = {
@@ -144,6 +237,7 @@
{ "remove_iface", uc_wpas_remove_iface },
};
static const uc_function_list_t iface_fns[] = {
+ { "status", uc_wpas_iface_status },
};
uc_value_t *data, *proto;
@@ -151,10 +245,10 @@
vm = wpa_ucode_create_vm();
global_type = uc_type_declare(vm, "wpas.global", global_fns, NULL);
- iface_type = uc_type_declare(vm, "hostapd.iface", iface_fns, NULL);
+ iface_type = uc_type_declare(vm, "wpas.iface", iface_fns, NULL);
iface_registry = ucv_array_new(vm);
- uc_vm_registry_set(vm, "hostap.iface_registry", iface_registry);
+ uc_vm_registry_set(vm, "wpas.iface_registry", iface_registry);
global = wpa_ucode_global_init("wpas", global_type);
diff --git a/recipes-wifi/wpa-supplicant/files/src-2.10.3/wpa_supplicant/ucode.h b/recipes-wifi/wpa-supplicant/files/src-2.10.3/wpa_supplicant/ucode.h
index fcd2313..a429a0e 100644
--- a/recipes-wifi/wpa-supplicant/files/src-2.10.3/wpa_supplicant/ucode.h
+++ b/recipes-wifi/wpa-supplicant/files/src-2.10.3/wpa_supplicant/ucode.h
@@ -4,6 +4,7 @@
#include "utils/ucode.h"
struct wpa_global;
+union wpa_event_data;
struct wpa_supplicant;
struct wpas_ucode_bss {
@@ -17,6 +18,8 @@
void wpas_ucode_free(void);
void wpas_ucode_add_bss(struct wpa_supplicant *wpa_s);
void wpas_ucode_free_bss(struct wpa_supplicant *wpa_s);
+void wpas_ucode_update_state(struct wpa_supplicant *wpa_s);
+void wpas_ucode_event(struct wpa_supplicant *wpa_s, int event, union wpa_event_data *data);
#else
static inline int wpas_ucode_init(struct wpa_global *gl)
{
@@ -33,6 +36,14 @@
{
}
+static inline void wpas_ucode_update_state(struct wpa_supplicant *wpa_s)
+{
+}
+
+static inline void wpas_ucode_event(struct wpa_supplicant *wpa_s, int event, union wpa_event_data *data)
+{
+}
+
#endif
#endif