[rdkb][common][bsp][Refactor and sync wifi from openwrt]
[Description]
e44e196 [MAC80211][misc][Remvoe start_disabled from netifd mac80211 script]
c4869e7 [MAC80211][core][Add sta-assisted DFS state update mechansim in core]
4b4782e [MAC80211][core][Remove using start disable in core]
27a2b88 [MAC80211][hostapd][Add sta-assisted DFS state update mechanism in hostapd]
86ee2ed [MAC80211][hostapd][Fix sending wrong VHT operation IE in CSA while using ZWDFS]
6070281 [MAC80211][hostapd][Remove sending start disable to core]
84c0326 [mac80211][mt76][Update firmware bin for mt7981]
0f34f54 [MAC80211][netifd][Fix netifd set AP sequence is out of order]
[Release-log]
Change-Id: Ib6575ac415af785dd5f4b728b7ef070eeb357b12
diff --git a/recipes-wifi/hostapd/files/patches-2.10.3/mtk-0010-hostapd-mtk-Add-DFS-and-ZWDFS-support.patch b/recipes-wifi/hostapd/files/patches-2.10.3/mtk-0010-hostapd-mtk-Add-DFS-and-ZWDFS-support.patch
deleted file mode 100644
index 3237aa3..0000000
--- a/recipes-wifi/hostapd/files/patches-2.10.3/mtk-0010-hostapd-mtk-Add-DFS-and-ZWDFS-support.patch
+++ /dev/null
@@ -1,376 +0,0 @@
-From 4e7c861c971ca49ea162bd908fef6021a62b9018 Mon Sep 17 00:00:00 2001
-From: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
-Date: Fri, 7 Oct 2022 10:46:29 +0800
-Subject: [PATCH 10/15] hostapd: mtk: Add DFS and ZWDFS support
-
-Signed-off-by: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
----
- hostapd/config_file.c | 4 ++
- hostapd/ctrl_iface.c | 95 ++++++++++++++++++++++++++++++++++++
- src/ap/ap_config.h | 13 +++++
- src/ap/dfs.c | 35 +++++++------
- src/ap/dfs.h | 15 ++++++
- src/ap/hostapd.c | 4 +-
- src/drivers/driver.h | 7 +++
- src/drivers/driver_nl80211.c | 29 +++++++++++
- src/drivers/nl80211_copy.h | 1 +
- 9 files changed, 186 insertions(+), 17 deletions(-)
-
-diff --git a/hostapd/config_file.c b/hostapd/config_file.c
-index 63c9d40be..cd1534952 100644
---- a/hostapd/config_file.c
-+++ b/hostapd/config_file.c
-@@ -4803,6 +4803,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;
-+ } else if (os_strcmp(buf, "dfs_detect_mode") == 0) { /*bypass channel switch*/
-+ u8 en = strtol(pos, NULL, 10);
-+
-+ conf->dfs_detect_mode = en;
- } else {
- wpa_printf(MSG_ERROR,
- "Line %d: unknown configuration item '%s'",
-diff --git a/hostapd/ctrl_iface.c b/hostapd/ctrl_iface.c
-index c881d3717..6ea1573b8 100644
---- a/hostapd/ctrl_iface.c
-+++ b/hostapd/ctrl_iface.c
-@@ -3522,6 +3522,96 @@ hostapd_ctrl_iface_get_ibf(struct hostapd_data *hapd, char *buf,
- }
-
-
-+static int
-+hostapd_ctrl_iface_set_dfs_detect_mode(struct hostapd_data *hapd, char *value,
-+ char *buf, size_t buflen)
-+{
-+ u8 dfs_detect_mode;
-+
-+ if (!value)
-+ return -1;
-+
-+ dfs_detect_mode = strtol(value, NULL, 10);
-+ if (dfs_detect_mode > DFS_DETECT_MODE_MAX) {
-+ wpa_printf(MSG_ERROR, "Invalid value for dfs detect mode");
-+ return -1;
-+ }
-+ hapd->iconf->dfs_detect_mode = dfs_detect_mode;
-+
-+ return os_snprintf(buf, buflen, "OK\n");
-+}
-+
-+
-+static int
-+hostapd_ctrl_iface_set_offchan_ctrl(struct hostapd_data *hapd, char *cmd,
-+ char *buf, size_t buflen)
-+{
-+ struct hostapd_iface *iface = hapd->iface;
-+ char *pos, *param;
-+ enum hostapd_hw_mode hw_mode;
-+ bool chan_found = false;
-+ int i, num_available_chandefs, channel, chan_width, sec = 0;
-+ int sec_chan_idx_80p80 = -1;
-+ u8 oper_centr_freq_seg0_idx, oper_centr_freq_seg1_idx;
-+ struct hostapd_channel_data *chan;
-+ enum dfs_channel_type type = DFS_NO_CAC_YET;
-+
-+ param = os_strchr(cmd, ' ');
-+ if (!param)
-+ return -1;
-+ *param++ = '\0';
-+
-+ pos = os_strstr(param, "chan=");
-+ if (pos)
-+ channel = strtol(pos + 5, NULL, 10);
-+ else
-+ return -1;
-+
-+ num_available_chandefs = dfs_find_channel(iface, NULL, 0, type);
-+ for (i = 0; i < num_available_chandefs; i++) {
-+ dfs_find_channel(iface, &chan, i, type);
-+ if (chan->chan == channel) {
-+ chan_found = true;
-+ break;
-+ }
-+ }
-+
-+ if (!chan_found)
-+ return -1;
-+
-+ if (iface->conf->secondary_channel)
-+ sec = 1;
-+
-+ dfs_adjust_center_freq(iface, chan,
-+ sec,
-+ sec_chan_idx_80p80,
-+ &oper_centr_freq_seg0_idx,
-+ &oper_centr_freq_seg1_idx);
-+
-+ if (hostapd_start_dfs_cac(iface, iface->conf->hw_mode,
-+ chan->freq, chan->chan,
-+ iface->conf->ieee80211n,
-+ iface->conf->ieee80211ac,
-+ iface->conf->ieee80211ax,
-+ iface->conf->ieee80211be,
-+ sec, hostapd_get_oper_chwidth(iface->conf),
-+ oper_centr_freq_seg0_idx,
-+ oper_centr_freq_seg1_idx, true)) {
-+ wpa_printf(MSG_ERROR, "DFS failed to start CAC offchannel");
-+ iface->radar_background.channel = -1;
-+ return -1;
-+ }
-+
-+ iface->radar_background.channel = chan->chan;
-+ iface->radar_background.freq = chan->freq;
-+ iface->radar_background.secondary_channel = sec;
-+ iface->radar_background.centr_freq_seg0_idx = oper_centr_freq_seg0_idx;
-+ iface->radar_background.centr_freq_seg1_idx = oper_centr_freq_seg1_idx;
-+
-+ return os_snprintf(buf, buflen, "OK\n");
-+}
-+
-+
- static int hostapd_ctrl_iface_receive_process(struct hostapd_data *hapd,
- char *buf, char *reply,
- int reply_size,
-@@ -4081,6 +4171,11 @@ 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);
-+ } 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);
-+ } else if (os_strncmp(buf, "SET_OFFCHAN_CTRL", 16) == 0) {
-+ reply_len = hostapd_ctrl_iface_set_offchan_ctrl(hapd, buf + 16, 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 a9e3d2aeb..77f6169d2 100644
---- a/src/ap/ap_config.h
-+++ b/src/ap/ap_config.h
-@@ -1160,6 +1160,7 @@ struct hostapd_config {
- int *edcca_threshold;
- u8 three_wire_enable;
- u8 ibf_enable;
-+ u8 dfs_detect_mode;
- };
-
- enum three_wire_mode {
-@@ -1174,6 +1175,18 @@ enum three_wire_mode {
- NUM_THREE_WIRE_MODE - 1
- };
-
-+enum dfs_mode {
-+ DFS_DETECT_MODE_DISABLE,
-+ DFS_DETECT_MODE_AP_ENABLE,
-+ DFS_DETECT_MODE_BACKGROUND_ENABLE,
-+ DFS_DETECT_MODE_ALL_ENABLE,
-+
-+ /* keep last */
-+ NUM_DFS_DETECT_MODE,
-+ DFS_DETECT_MODE_MAX =
-+ NUM_DFS_DETECT_MODE - 1
-+};
-+
- enum edcca_mode {
- EDCCA_MODE_FORCE_DISABLE = 0,
- EDCCA_MODE_AUTO = 1,
-diff --git a/src/ap/dfs.c b/src/ap/dfs.c
-index b5d105d6a..1c3f6785b 100644
---- a/src/ap/dfs.c
-+++ b/src/ap/dfs.c
-@@ -19,13 +19,6 @@
- #include "dfs.h"
- #include "crypto/crypto.h"
-
--
--enum dfs_channel_type {
-- DFS_ANY_CHANNEL,
-- DFS_AVAILABLE, /* non-radar or radar-available */
-- DFS_NO_CAC_YET, /* radar-not-yet-available */
--};
--
- static struct hostapd_channel_data *
- dfs_downgrade_bandwidth(struct hostapd_iface *iface, int *secondary_channel,
- u8 *oper_centr_freq_seg0_idx,
-@@ -238,9 +231,9 @@ static int is_in_chanlist(struct hostapd_iface *iface,
- * - hapd->vht/he_oper_centr_freq_seg0_idx
- * - hapd->vht/he_oper_centr_freq_seg1_idx
- */
--static int dfs_find_channel(struct hostapd_iface *iface,
-- struct hostapd_channel_data **ret_chan,
-- int idx, enum dfs_channel_type type)
-+int dfs_find_channel(struct hostapd_iface *iface,
-+ struct hostapd_channel_data **ret_chan,
-+ int idx, enum dfs_channel_type type)
- {
- struct hostapd_hw_modes *mode;
- struct hostapd_channel_data *chan;
-@@ -299,12 +292,12 @@ static int dfs_find_channel(struct hostapd_iface *iface,
- }
-
-
--static void dfs_adjust_center_freq(struct hostapd_iface *iface,
-- struct hostapd_channel_data *chan,
-- int secondary_channel,
-- int sec_chan_idx_80p80,
-- u8 *oper_centr_freq_seg0_idx,
-- u8 *oper_centr_freq_seg1_idx)
-+void dfs_adjust_center_freq(struct hostapd_iface *iface,
-+ struct hostapd_channel_data *chan,
-+ int secondary_channel,
-+ int sec_chan_idx_80p80,
-+ u8 *oper_centr_freq_seg0_idx,
-+ u8 *oper_centr_freq_seg1_idx)
- {
- if (!iface->conf->ieee80211ac && !iface->conf->ieee80211ax)
- return;
-@@ -1317,6 +1310,11 @@ hostapd_dfs_background_start_channel_switch(struct hostapd_iface *iface,
- __func__, iface->radar_background.cac_started ? "yes" : "no",
- hostapd_csa_in_progress(iface) ? "yes" : "no");
-
-+ /* Skip channel switch when background dfs detect mode is on */
-+ if (iface->conf->dfs_detect_mode == DFS_DETECT_MODE_BACKGROUND_ENABLE ||
-+ iface->conf->dfs_detect_mode == DFS_DETECT_MODE_ALL_ENABLE)
-+ return 0;
-+
- /* Check if CSA in progress */
- if (hostapd_csa_in_progress(iface))
- return 0;
-@@ -1365,6 +1363,11 @@ static int hostapd_dfs_start_channel_switch(struct hostapd_iface *iface)
- __func__, iface->cac_started ? "yes" : "no",
- hostapd_csa_in_progress(iface) ? "yes" : "no");
-
-+ /* Skip channel switch when dfs detect mode is on */
-+ if (iface->conf->dfs_detect_mode == DFS_DETECT_MODE_AP_ENABLE ||
-+ iface->conf->dfs_detect_mode == DFS_DETECT_MODE_ALL_ENABLE)
-+ return 0;
-+
- /* Check if CSA in progress */
- if (hostapd_csa_in_progress(iface))
- return 0;
-diff --git a/src/ap/dfs.h b/src/ap/dfs.h
-index 606c1b393..c2556d2d9 100644
---- a/src/ap/dfs.h
-+++ b/src/ap/dfs.h
-@@ -9,6 +9,12 @@
- #ifndef DFS_H
- #define DFS_H
-
-+enum dfs_channel_type {
-+ DFS_ANY_CHANNEL,
-+ DFS_AVAILABLE, /* non-radar or radar-available */
-+ DFS_NO_CAC_YET, /* radar-not-yet-available */
-+};
-+
- int hostapd_handle_dfs(struct hostapd_iface *iface);
-
- int hostapd_dfs_complete_cac(struct hostapd_iface *iface, int success, int freq,
-@@ -32,5 +38,14 @@ int hostapd_dfs_start_cac(struct hostapd_iface *iface, int freq,
- int hostapd_handle_dfs_offload(struct hostapd_iface *iface);
- int hostapd_is_dfs_overlap(struct hostapd_iface *iface, enum chan_width width,
- int center_freq);
-+int dfs_find_channel(struct hostapd_iface *iface,
-+ struct hostapd_channel_data **ret_chan,
-+ int idx, enum dfs_channel_type type);
-+void dfs_adjust_center_freq(struct hostapd_iface *iface,
-+ struct hostapd_channel_data *chan,
-+ int secondary_channel,
-+ int sec_chan_idx_80p80,
-+ u8 *oper_centr_freq_seg0_idx,
-+ u8 *oper_centr_freq_seg1_idx);
-
- #endif /* DFS_H */
-diff --git a/src/ap/hostapd.c b/src/ap/hostapd.c
-index da7f7d87b..a0229c9ca 100644
---- a/src/ap/hostapd.c
-+++ b/src/ap/hostapd.c
-@@ -1464,7 +1464,9 @@ static int hostapd_setup_bss(struct hostapd_data *hapd, int first)
- return -1;
- }
-
-- if (!conf->start_disabled && ieee802_11_set_beacon(hapd) < 0)
-+ if (conf->start_disabled)
-+ hapd->driver->start_disabled(hapd->drv_priv);
-+ else if (ieee802_11_set_beacon(hapd) < 0)
- return -1;
-
- if (flush_old_stations && !conf->start_disabled &&
-diff --git a/src/drivers/driver.h b/src/drivers/driver.h
-index 71ded617f..aa23fbdb3 100644
---- a/src/drivers/driver.h
-+++ b/src/drivers/driver.h
-@@ -4720,6 +4720,13 @@ struct wpa_driver_ops {
- *
- */
- int (*ibf_dump)(void *priv, u8 *ibf_enable);
-+
-+ /**
-+ * start_disabled - set start_disabled to cfg80211
-+ * @priv: Private driver interface data
-+ *
-+ */
-+ int (*start_disabled)(void *priv);
- };
-
- /**
-diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c
-index 5c2a291ca..7472542cc 100644
---- a/src/drivers/driver_nl80211.c
-+++ b/src/drivers/driver_nl80211.c
-@@ -12776,6 +12776,34 @@ fail:
- return -ENOBUFS;
- }
-
-+static int nl80211_start_disabled(void *priv)
-+{
-+ struct i802_bss *bss = priv;
-+ struct wpa_driver_nl80211_data *drv = bss->drv;
-+ struct nl_msg *msg;
-+ struct nlattr *data;
-+ int ret;
-+
-+ msg = nl80211_bss_msg(bss, 0, NL80211_CMD_NEW_BEACON);
-+ if (!msg)
-+ goto fail;
-+
-+ if (nla_put_flag(msg, NL80211_ATTR_START_DISABLED))
-+ goto fail;
-+
-+ ret = send_and_recv_msgs_connect_handle(drv, msg, bss, 1);
-+
-+ if (ret)
-+ wpa_printf(MSG_ERROR, "Failed to set start_disabled. ret=%d (%s)",
-+ ret, strerror(-ret));
-+
-+ return ret;
-+
-+fail:
-+ nlmsg_free(msg);
-+ return ret;
-+}
-+
- const struct wpa_driver_ops wpa_driver_nl80211_ops = {
- .name = "nl80211",
- .desc = "Linux nl80211/cfg80211",
-@@ -12930,4 +12958,5 @@ 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,
-+ .start_disabled = nl80211_start_disabled,
- };
-diff --git a/src/drivers/nl80211_copy.h b/src/drivers/nl80211_copy.h
-index c4bf3ad35..79bc76c57 100644
---- a/src/drivers/nl80211_copy.h
-+++ b/src/drivers/nl80211_copy.h
-@@ -3176,6 +3176,7 @@ enum nl80211_attrs {
- NL80211_ATTR_EHT_CAPABILITY,
-
- /* add attributes here, update the policy in nl80211.c */
-+ NL80211_ATTR_START_DISABLED = 999,
-
- __NL80211_ATTR_AFTER_LAST,
- NUM_NL80211_ATTR = __NL80211_ATTR_AFTER_LAST,
---
-2.25.1
-
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
new file mode 100644
index 0000000..2ceb639
--- /dev/null
+++ b/recipes-wifi/hostapd/files/patches-2.10.3/mtk-0010-hostapd-mtk-Add-DFS-detection-mode.patch
@@ -0,0 +1,136 @@
+From 6828156c206701f5a0e5d30afcc514f452ce0ada 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/16] 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
+a radar signal.
+This detection mode also supports background chain.
+
+Signed-off-by: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
+---
+ hostapd/config_file.c | 4 ++++
+ hostapd/ctrl_iface.c | 23 +++++++++++++++++++++++
+ src/ap/ap_config.h | 13 +++++++++++++
+ src/ap/dfs.c | 10 ++++++++++
+ 4 files changed, 50 insertions(+)
+
+diff --git a/hostapd/config_file.c b/hostapd/config_file.c
+index 63c9d40..cd15349 100644
+--- a/hostapd/config_file.c
++++ b/hostapd/config_file.c
+@@ -4803,6 +4803,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;
++ } else if (os_strcmp(buf, "dfs_detect_mode") == 0) { /*bypass channel switch*/
++ u8 en = strtol(pos, NULL, 10);
++
++ conf->dfs_detect_mode = en;
+ } else {
+ wpa_printf(MSG_ERROR,
+ "Line %d: unknown configuration item '%s'",
+diff --git a/hostapd/ctrl_iface.c b/hostapd/ctrl_iface.c
+index c881d37..0b4c234 100644
+--- a/hostapd/ctrl_iface.c
++++ b/hostapd/ctrl_iface.c
+@@ -3522,6 +3522,26 @@ hostapd_ctrl_iface_get_ibf(struct hostapd_data *hapd, char *buf,
+ }
+
+
++static int
++hostapd_ctrl_iface_set_dfs_detect_mode(struct hostapd_data *hapd, char *value,
++ char *buf, size_t buflen)
++{
++ u8 dfs_detect_mode;
++
++ if (!value)
++ return -1;
++
++ dfs_detect_mode = strtol(value, NULL, 10);
++ if (dfs_detect_mode > DFS_DETECT_MODE_MAX) {
++ wpa_printf(MSG_ERROR, "Invalid value for dfs detect mode");
++ return -1;
++ }
++ hapd->iconf->dfs_detect_mode = dfs_detect_mode;
++
++ return os_snprintf(buf, buflen, "OK\n");
++}
++
++
+ static int hostapd_ctrl_iface_receive_process(struct hostapd_data *hapd,
+ char *buf, char *reply,
+ int reply_size,
+@@ -4081,6 +4101,9 @@ static int hostapd_ctrl_iface_receive_process(struct hostapd_data *hapd,
+ reply_len = hostapd_ctrl_iface_get_hemu(hapd, reply, reply_size);
+ } else if (os_strncmp(buf, "GET_IBF", 7) == 0) {
+ reply_len = hostapd_ctrl_iface_get_ibf(hapd, reply, reply_size);
++ } 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);
+ } 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 a9e3d2a..77f6169 100644
+--- a/src/ap/ap_config.h
++++ b/src/ap/ap_config.h
+@@ -1160,6 +1160,7 @@ struct hostapd_config {
+ int *edcca_threshold;
+ u8 three_wire_enable;
+ u8 ibf_enable;
++ u8 dfs_detect_mode;
+ };
+
+ enum three_wire_mode {
+@@ -1174,6 +1175,18 @@ enum three_wire_mode {
+ NUM_THREE_WIRE_MODE - 1
+ };
+
++enum dfs_mode {
++ DFS_DETECT_MODE_DISABLE,
++ DFS_DETECT_MODE_AP_ENABLE,
++ DFS_DETECT_MODE_BACKGROUND_ENABLE,
++ DFS_DETECT_MODE_ALL_ENABLE,
++
++ /* keep last */
++ NUM_DFS_DETECT_MODE,
++ DFS_DETECT_MODE_MAX =
++ NUM_DFS_DETECT_MODE - 1
++};
++
+ enum edcca_mode {
+ EDCCA_MODE_FORCE_DISABLE = 0,
+ EDCCA_MODE_AUTO = 1,
+diff --git a/src/ap/dfs.c b/src/ap/dfs.c
+index b5d105d..5cb7799 100644
+--- a/src/ap/dfs.c
++++ b/src/ap/dfs.c
+@@ -1317,6 +1317,11 @@ hostapd_dfs_background_start_channel_switch(struct hostapd_iface *iface,
+ __func__, iface->radar_background.cac_started ? "yes" : "no",
+ hostapd_csa_in_progress(iface) ? "yes" : "no");
+
++ /* Skip channel switch when background dfs detect mode is on */
++ if (iface->conf->dfs_detect_mode == DFS_DETECT_MODE_BACKGROUND_ENABLE ||
++ iface->conf->dfs_detect_mode == DFS_DETECT_MODE_ALL_ENABLE)
++ return 0;
++
+ /* Check if CSA in progress */
+ if (hostapd_csa_in_progress(iface))
+ return 0;
+@@ -1365,6 +1370,11 @@ static int hostapd_dfs_start_channel_switch(struct hostapd_iface *iface)
+ __func__, iface->cac_started ? "yes" : "no",
+ hostapd_csa_in_progress(iface) ? "yes" : "no");
+
++ /* Skip channel switch when dfs detect mode is on */
++ if (iface->conf->dfs_detect_mode == DFS_DETECT_MODE_AP_ENABLE ||
++ iface->conf->dfs_detect_mode == DFS_DETECT_MODE_ALL_ENABLE)
++ return 0;
++
+ /* Check if CSA in progress */
+ if (hostapd_csa_in_progress(iface))
+ return 0;
+--
+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
new file mode 100644
index 0000000..1d8baf8
--- /dev/null
+++ b/recipes-wifi/hostapd/files/patches-2.10.3/mtk-0011-hostapd-mtk-Add-DFS-offchan-channel-switch.patch
@@ -0,0 +1,192 @@
+From 88dd3df28e3736af4cca0daf4f7d19ab888ea6c4 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/16] 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.
+Command format:
+hostapd_cli -i <interface> raw SET_OFFCHAN_CTRL chan=<dfs_channel>
+
+Signed-off-by: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
+---
+ hostapd/ctrl_iface.c | 72 ++++++++++++++++++++++++++++++++++++++++++++
+ src/ap/dfs.c | 25 ++++++---------
+ src/ap/dfs.h | 15 +++++++++
+ 3 files changed, 96 insertions(+), 16 deletions(-)
+
+diff --git a/hostapd/ctrl_iface.c b/hostapd/ctrl_iface.c
+index 0b4c234..6ea1573 100644
+--- a/hostapd/ctrl_iface.c
++++ b/hostapd/ctrl_iface.c
+@@ -3542,6 +3542,76 @@ hostapd_ctrl_iface_set_dfs_detect_mode(struct hostapd_data *hapd, char *value,
+ }
+
+
++static int
++hostapd_ctrl_iface_set_offchan_ctrl(struct hostapd_data *hapd, char *cmd,
++ char *buf, size_t buflen)
++{
++ struct hostapd_iface *iface = hapd->iface;
++ char *pos, *param;
++ enum hostapd_hw_mode hw_mode;
++ bool chan_found = false;
++ int i, num_available_chandefs, channel, chan_width, sec = 0;
++ int sec_chan_idx_80p80 = -1;
++ u8 oper_centr_freq_seg0_idx, oper_centr_freq_seg1_idx;
++ struct hostapd_channel_data *chan;
++ enum dfs_channel_type type = DFS_NO_CAC_YET;
++
++ param = os_strchr(cmd, ' ');
++ if (!param)
++ return -1;
++ *param++ = '\0';
++
++ pos = os_strstr(param, "chan=");
++ if (pos)
++ channel = strtol(pos + 5, NULL, 10);
++ else
++ return -1;
++
++ num_available_chandefs = dfs_find_channel(iface, NULL, 0, type);
++ for (i = 0; i < num_available_chandefs; i++) {
++ dfs_find_channel(iface, &chan, i, type);
++ if (chan->chan == channel) {
++ chan_found = true;
++ break;
++ }
++ }
++
++ if (!chan_found)
++ return -1;
++
++ if (iface->conf->secondary_channel)
++ sec = 1;
++
++ dfs_adjust_center_freq(iface, chan,
++ sec,
++ sec_chan_idx_80p80,
++ &oper_centr_freq_seg0_idx,
++ &oper_centr_freq_seg1_idx);
++
++ if (hostapd_start_dfs_cac(iface, iface->conf->hw_mode,
++ chan->freq, chan->chan,
++ iface->conf->ieee80211n,
++ iface->conf->ieee80211ac,
++ iface->conf->ieee80211ax,
++ iface->conf->ieee80211be,
++ sec, hostapd_get_oper_chwidth(iface->conf),
++ oper_centr_freq_seg0_idx,
++ oper_centr_freq_seg1_idx, true)) {
++ wpa_printf(MSG_ERROR, "DFS failed to start CAC offchannel");
++ iface->radar_background.channel = -1;
++ return -1;
++ }
++
++ iface->radar_background.channel = chan->chan;
++ iface->radar_background.freq = chan->freq;
++ iface->radar_background.secondary_channel = sec;
++ iface->radar_background.centr_freq_seg0_idx = oper_centr_freq_seg0_idx;
++ iface->radar_background.centr_freq_seg1_idx = oper_centr_freq_seg1_idx;
++
++ return os_snprintf(buf, buflen, "OK\n");
++}
++
++
+ static int hostapd_ctrl_iface_receive_process(struct hostapd_data *hapd,
+ char *buf, char *reply,
+ int reply_size,
+@@ -4104,6 +4174,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);
++ } else if (os_strncmp(buf, "SET_OFFCHAN_CTRL", 16) == 0) {
++ reply_len = hostapd_ctrl_iface_set_offchan_ctrl(hapd, buf + 16, reply, reply_size);
+ } else {
+ os_memcpy(reply, "UNKNOWN COMMAND\n", 16);
+ reply_len = 16;
+diff --git a/src/ap/dfs.c b/src/ap/dfs.c
+index 5cb7799..1c3f678 100644
+--- a/src/ap/dfs.c
++++ b/src/ap/dfs.c
+@@ -19,13 +19,6 @@
+ #include "dfs.h"
+ #include "crypto/crypto.h"
+
+-
+-enum dfs_channel_type {
+- DFS_ANY_CHANNEL,
+- DFS_AVAILABLE, /* non-radar or radar-available */
+- DFS_NO_CAC_YET, /* radar-not-yet-available */
+-};
+-
+ static struct hostapd_channel_data *
+ dfs_downgrade_bandwidth(struct hostapd_iface *iface, int *secondary_channel,
+ u8 *oper_centr_freq_seg0_idx,
+@@ -238,9 +231,9 @@ static int is_in_chanlist(struct hostapd_iface *iface,
+ * - hapd->vht/he_oper_centr_freq_seg0_idx
+ * - hapd->vht/he_oper_centr_freq_seg1_idx
+ */
+-static int dfs_find_channel(struct hostapd_iface *iface,
+- struct hostapd_channel_data **ret_chan,
+- int idx, enum dfs_channel_type type)
++int dfs_find_channel(struct hostapd_iface *iface,
++ struct hostapd_channel_data **ret_chan,
++ int idx, enum dfs_channel_type type)
+ {
+ struct hostapd_hw_modes *mode;
+ struct hostapd_channel_data *chan;
+@@ -299,12 +292,12 @@ static int dfs_find_channel(struct hostapd_iface *iface,
+ }
+
+
+-static void dfs_adjust_center_freq(struct hostapd_iface *iface,
+- struct hostapd_channel_data *chan,
+- int secondary_channel,
+- int sec_chan_idx_80p80,
+- u8 *oper_centr_freq_seg0_idx,
+- u8 *oper_centr_freq_seg1_idx)
++void dfs_adjust_center_freq(struct hostapd_iface *iface,
++ struct hostapd_channel_data *chan,
++ int secondary_channel,
++ int sec_chan_idx_80p80,
++ u8 *oper_centr_freq_seg0_idx,
++ u8 *oper_centr_freq_seg1_idx)
+ {
+ if (!iface->conf->ieee80211ac && !iface->conf->ieee80211ax)
+ return;
+diff --git a/src/ap/dfs.h b/src/ap/dfs.h
+index 606c1b3..c2556d2 100644
+--- a/src/ap/dfs.h
++++ b/src/ap/dfs.h
+@@ -9,6 +9,12 @@
+ #ifndef DFS_H
+ #define DFS_H
+
++enum dfs_channel_type {
++ DFS_ANY_CHANNEL,
++ DFS_AVAILABLE, /* non-radar or radar-available */
++ DFS_NO_CAC_YET, /* radar-not-yet-available */
++};
++
+ int hostapd_handle_dfs(struct hostapd_iface *iface);
+
+ int hostapd_dfs_complete_cac(struct hostapd_iface *iface, int success, int freq,
+@@ -32,5 +38,14 @@ int hostapd_dfs_start_cac(struct hostapd_iface *iface, int freq,
+ int hostapd_handle_dfs_offload(struct hostapd_iface *iface);
+ int hostapd_is_dfs_overlap(struct hostapd_iface *iface, enum chan_width width,
+ int center_freq);
++int dfs_find_channel(struct hostapd_iface *iface,
++ struct hostapd_channel_data **ret_chan,
++ int idx, enum dfs_channel_type type);
++void dfs_adjust_center_freq(struct hostapd_iface *iface,
++ struct hostapd_channel_data *chan,
++ int secondary_channel,
++ int sec_chan_idx_80p80,
++ u8 *oper_centr_freq_seg0_idx,
++ u8 *oper_centr_freq_seg1_idx);
+
+ #endif /* DFS_H */
+--
+2.18.0
+
diff --git a/recipes-wifi/hostapd/files/patches-2.10.3/mtk-0011-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
similarity index 92%
rename from recipes-wifi/hostapd/files/patches-2.10.3/mtk-0011-hostapd-mtk-Add-amsdu-set-get-ctrl.patch
rename to recipes-wifi/hostapd/files/patches-2.10.3/mtk-0012-hostapd-mtk-Add-amsdu-set-get-ctrl.patch
index dba90d1..7db3ae2 100644
--- a/recipes-wifi/hostapd/files/patches-2.10.3/mtk-0011-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 bc0722ebc1cc08be6239879fddaef37e0db2d9e0 Mon Sep 17 00:00:00 2001
+From d0128fc60d38ce4f20f8368bdc5ea9ed19a329b7 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 11/15] hostapd: mtk: Add amsdu set get ctrl
+Subject: [PATCH 12/16] hostapd: mtk: Add amsdu set get ctrl
---
hostapd/config_file.c | 9 +++
@@ -20,7 +20,7 @@
13 files changed, 207 insertions(+), 1 deletion(-)
diff --git a/hostapd/config_file.c b/hostapd/config_file.c
-index cd1534952..10ea52518 100644
+index cd15349..10ea525 100644
--- a/hostapd/config_file.c
+++ b/hostapd/config_file.c
@@ -4807,6 +4807,15 @@ static int hostapd_config_fill(struct hostapd_config *conf,
@@ -40,7 +40,7 @@
wpa_printf(MSG_ERROR,
"Line %d: unknown configuration item '%s'",
diff --git a/hostapd/ctrl_iface.c b/hostapd/ctrl_iface.c
-index 6ea1573b8..0ad8451aa 100644
+index 6ea1573..0ad8451 100644
--- a/hostapd/ctrl_iface.c
+++ b/hostapd/ctrl_iface.c
@@ -3612,6 +3612,30 @@ hostapd_ctrl_iface_set_offchan_ctrl(struct hostapd_data *hapd, char *cmd,
@@ -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 c2a123a8c..30b3392e6 100644
+index c2a123a..30b3392 100644
--- a/hostapd/hostapd_cli.c
+++ b/hostapd/hostapd_cli.c
@@ -1593,6 +1593,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 7a96cb8b2..85ad5e444 100644
+index 7a96cb8..85ad5e4 100644
--- a/src/ap/ap_config.c
+++ b/src/ap/ap_config.c
@@ -299,6 +299,7 @@ struct hostapd_config * hostapd_config_defaults(void)
@@ -123,7 +123,7 @@
return conf;
}
diff --git a/src/ap/ap_config.h b/src/ap/ap_config.h
-index 77f6169d2..a9ac39619 100644
+index 77f6169..a9ac396 100644
--- a/src/ap/ap_config.h
+++ b/src/ap/ap_config.h
@@ -1161,6 +1161,7 @@ struct hostapd_config {
@@ -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 60ae8253b..1a82f234c 100644
+index 60ae825..1a82f23 100644
--- a/src/ap/ap_drv_ops.c
+++ b/src/ap/ap_drv_ops.c
@@ -1077,4 +1077,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 ab9aedcee..4406666fd 100644
+index ab9aedc..4406666 100644
--- a/src/ap/ap_drv_ops.h
+++ b/src/ap/ap_drv_ops.h
@@ -147,6 +147,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 a0229c9ca..152060db4 100644
+index da7f7d8..a18e744 100644
--- a/src/ap/hostapd.c
+++ b/src/ap/hostapd.c
-@@ -2310,6 +2310,8 @@ dfs_offload:
+@@ -2308,6 +2308,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 4050cf886..0999ea9e2 100644
+index 4050cf8..0999ea9 100644
--- a/src/common/mtk_vendor.h
+++ b/src/common/mtk_vendor.h
@@ -167,7 +167,6 @@ enum mtk_vendor_attr_wireless_ctrl {
@@ -220,13 +220,13 @@
MTK_VENDOR_ATTR_RFEATURE_CTRL_UNSPEC,
diff --git a/src/drivers/driver.h b/src/drivers/driver.h
-index aa23fbdb3..b07aaf3fe 100644
+index 71ded61..265d86d 100644
--- a/src/drivers/driver.h
+++ b/src/drivers/driver.h
-@@ -4727,6 +4727,15 @@ struct wpa_driver_ops {
+@@ -4720,6 +4720,15 @@ struct wpa_driver_ops {
*
*/
- int (*start_disabled)(void *priv);
+ int (*ibf_dump)(void *priv, u8 *ibf_enable);
+
+ /**
+ * amsdu_ctrl - enable/disable amsdu
@@ -240,11 +240,11 @@
/**
diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c
-index 7472542cc..6702384ef 100644
+index 5c2a291..d91b29c 100644
--- a/src/drivers/driver_nl80211.c
+++ b/src/drivers/driver_nl80211.c
-@@ -12804,6 +12804,118 @@ fail:
- return ret;
+@@ -12776,6 +12776,118 @@ fail:
+ return -ENOBUFS;
}
+static int nl80211_enable_amsdu(void *priv, u8 amsdu)
@@ -362,15 +362,15 @@
const struct wpa_driver_ops wpa_driver_nl80211_ops = {
.name = "nl80211",
.desc = "Linux nl80211/cfg80211",
-@@ -12959,4 +13071,6 @@ const struct wpa_driver_ops wpa_driver_nl80211_ops = {
+@@ -12930,4 +13042,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,
- .start_disabled = nl80211_start_disabled,
+ .amsdu_ctrl = nl80211_enable_amsdu,
+ .amsdu_dump = nl80211_dump_amsdu,
};
diff --git a/src/drivers/driver_nl80211.h b/src/drivers/driver_nl80211.h
-index 607592ceb..e57022409 100644
+index 607592c..e570224 100644
--- a/src/drivers/driver_nl80211.h
+++ b/src/drivers/driver_nl80211.h
@@ -185,6 +185,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 9ecc0ff9a..fcfa68bf7 100644
+index 9ecc0ff..fcfa68b 100644
--- a/src/drivers/driver_nl80211_capa.c
+++ b/src/drivers/driver_nl80211_capa.c
@@ -1065,6 +1065,9 @@ static int wiphy_info_handler(struct nl_msg *msg, void *arg)
@@ -396,5 +396,5 @@
}
--
-2.25.1
+2.18.0
diff --git a/recipes-wifi/hostapd/files/patches-2.10.3/mtk-0012-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
similarity index 90%
rename from recipes-wifi/hostapd/files/patches-2.10.3/mtk-0012-hostapd-mtk-Add-he_ldpc-configuration.patch
rename to recipes-wifi/hostapd/files/patches-2.10.3/mtk-0013-hostapd-mtk-Add-he_ldpc-configuration.patch
index 63101e0..4df0ba6 100644
--- a/recipes-wifi/hostapd/files/patches-2.10.3/mtk-0012-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 b49ce922afa13fe8ea5d847753dfb7641b70c9a4 Mon Sep 17 00:00:00 2001
+From ebbf23ac8c19224b34523e8b9820e32f0789fe11 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 12/15] hostapd: mtk: Add he_ldpc configuration
+Subject: [PATCH 13/16] hostapd: mtk: Add he_ldpc configuration
---
hostapd/config_file.c | 2 ++
@@ -13,7 +13,7 @@
6 files changed, 19 insertions(+)
diff --git a/hostapd/config_file.c b/hostapd/config_file.c
-index 10ea52518..4237a5cca 100644
+index 10ea525..4237a5c 100644
--- a/hostapd/config_file.c
+++ b/hostapd/config_file.c
@@ -3508,6 +3508,8 @@ static int hostapd_config_fill(struct hostapd_config *conf,
@@ -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 ea67aa100..e3a5eb365 100644
+index ea67aa1..e3a5eb3 100644
--- a/hostapd/hostapd.conf
+++ b/hostapd/hostapd.conf
@@ -830,6 +830,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 85ad5e444..b283de624 100644
+index 85ad5e4..b283de6 100644
--- a/src/ap/ap_config.c
+++ b/src/ap/ap_config.c
@@ -268,6 +268,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 a9ac39619..b8b20a7aa 100644
+index a9ac396..b8b20a7 100644
--- a/src/ap/ap_config.h
+++ b/src/ap/ap_config.h
@@ -929,6 +929,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 b5b7e5d46..f27aeb196 100644
+index b5b7e5d..f27aeb1 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,7 +84,7 @@
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 65e125e83..62088bda6 100644
+index 65e125e..62088bd 100644
--- a/src/common/ieee802_11_defs.h
+++ b/src/common/ieee802_11_defs.h
@@ -2298,6 +2298,9 @@ struct ieee80211_spatial_reuse {
@@ -98,5 +98,5 @@
#define HE_PHYCAP_SU_BEAMFORMER_CAPAB ((u8) BIT(7))
#define HE_PHYCAP_SU_BEAMFORMEE_CAPAB_IDX 4
--
-2.25.1
+2.18.0
diff --git a/recipes-wifi/hostapd/files/patches-2.10.3/mtk-0013-hostapd-mtk-Add-the-broadcast-destination-address-of.patch b/recipes-wifi/hostapd/files/patches-2.10.3/mtk-0014-hostapd-mtk-Add-the-broadcast-destination-address-of.patch
similarity index 89%
rename from recipes-wifi/hostapd/files/patches-2.10.3/mtk-0013-hostapd-mtk-Add-the-broadcast-destination-address-of.patch
rename to recipes-wifi/hostapd/files/patches-2.10.3/mtk-0014-hostapd-mtk-Add-the-broadcast-destination-address-of.patch
index 1222510..f0d25c6 100644
--- a/recipes-wifi/hostapd/files/patches-2.10.3/mtk-0013-hostapd-mtk-Add-the-broadcast-destination-address-of.patch
+++ b/recipes-wifi/hostapd/files/patches-2.10.3/mtk-0014-hostapd-mtk-Add-the-broadcast-destination-address-of.patch
@@ -1,7 +1,7 @@
-From 52a1775318c9926a1dbf4f7c563e95b5be3c9bd6 Mon Sep 17 00:00:00 2001
+From bb5cb086162828392a04820063ad7997d8ae26d7 Mon Sep 17 00:00:00 2001
From: MeiChia Chiu <meichia.chiu@mediatek.com>
Date: Tue, 17 Jan 2023 13:25:18 +0800
-Subject: [PATCH 13/15] hostapd: mtk: Add the broadcast destination address of
+Subject: [PATCH 14/16] hostapd: mtk: Add the broadcast destination address of
Probe Response frame on 6 GHz
According to IEEE 802.11ax 26.17.2.3.2,
@@ -19,7 +19,7 @@
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/src/ap/beacon.c b/src/ap/beacon.c
-index 1a26f11ff..f3ea5c277 100644
+index 1a26f11..f3ea5c2 100644
--- a/src/ap/beacon.c
+++ b/src/ap/beacon.c
@@ -1156,8 +1156,13 @@ void handle_probe_req(struct hostapd_data *hapd,
@@ -39,5 +39,5 @@
return;
--
-2.25.1
+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-0015-hostapd-mtk-Add-vendor-command-attribute-for-RTS-BW-.patch
similarity index 79%
rename from recipes-wifi/hostapd/files/patches-2.10.3/mtk-0014-hostapd-mtk-Add-vendor-command-attribute-for-RTS-BW-.patch
rename to recipes-wifi/hostapd/files/patches-2.10.3/mtk-0015-hostapd-mtk-Add-vendor-command-attribute-for-RTS-BW-.patch
index 3689f74..5fcd0c5 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-0015-hostapd-mtk-Add-vendor-command-attribute-for-RTS-BW-.patch
@@ -1,7 +1,7 @@
-From 7d741c99f2e211abe70593ff6e8265633bed0d8a Mon Sep 17 00:00:00 2001
+From 1db373190399a907b27141c199841aeafd4643da 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/15] hostapd: mtk: Add vendor command attribute for RTS BW
+Subject: [PATCH 15/16] 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 0999ea9e2..fb12895ce 100644
+index 0999ea9..fb12895 100644
--- a/src/common/mtk_vendor.h
+++ b/src/common/mtk_vendor.h
@@ -169,6 +169,7 @@ enum mtk_vendor_attr_wireless_ctrl {
@@ -22,5 +22,5 @@
/* keep last */
NUM_MTK_VENDOR_ATTRS_WIRELESS_CTRL,
--
-2.25.1
+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-0016-hostapd-mtk-6G-band-does-not-require-DFS.patch
similarity index 76%
rename from recipes-wifi/hostapd/files/patches-2.10.3/mtk-0015-hostapd-mtk-6G-band-does-not-require-DFS.patch
rename to recipes-wifi/hostapd/files/patches-2.10.3/mtk-0016-hostapd-mtk-6G-band-does-not-require-DFS.patch
index 642c625..33fea78 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-0016-hostapd-mtk-6G-band-does-not-require-DFS.patch
@@ -1,14 +1,14 @@
-From 619075bb430c908c61a818c45e36f1ca76020741 Mon Sep 17 00:00:00 2001
+From efa1d271d28c84b8ca77ffc3ca7cb75e727088a0 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/15] hostapd: mtk: 6G band does not require DFS
+Subject: [PATCH 16/16] 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 1c3f6785b..4b1e64246 100644
+index 1c3f678..4b1e642 100644
--- a/src/ap/dfs.c
+++ b/src/ap/dfs.c
@@ -1506,6 +1506,7 @@ int hostapd_is_dfs_required(struct hostapd_iface *iface)
@@ -20,5 +20,5 @@
return 0;
--
-2.25.1
+2.18.0
diff --git a/recipes-wifi/hostapd/files/patches-2.10.3/mtk-0017-hostapd-mtk-Fix-sending-wrong-VHT-operation-IE-in-CS.patch b/recipes-wifi/hostapd/files/patches-2.10.3/mtk-0017-hostapd-mtk-Fix-sending-wrong-VHT-operation-IE-in-CS.patch
new file mode 100644
index 0000000..265c37a
--- /dev/null
+++ b/recipes-wifi/hostapd/files/patches-2.10.3/mtk-0017-hostapd-mtk-Fix-sending-wrong-VHT-operation-IE-in-CS.patch
@@ -0,0 +1,46 @@
+From f6bfd9a4a6c0d08e0dec9311873c9e863a07c9a8 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] hostapd: mtk: Fix sending wrong VHT operation IE in CSA while
+ using ZWDFS
+
+Signed-off-by: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
+---
+ src/ap/dfs.c | 14 +++++++++-----
+ 1 file changed, 9 insertions(+), 5 deletions(-)
+
+diff --git a/src/ap/dfs.c b/src/ap/dfs.c
+index 4b1e642..307a4e1 100644
+--- a/src/ap/dfs.c
++++ b/src/ap/dfs.c
+@@ -1110,6 +1110,14 @@ static int
+ hostapd_dfs_start_channel_switch_background(struct hostapd_iface *iface)
+ {
+ u8 current_vht_oper_chwidth = hostapd_get_oper_chwidth(iface->conf);
++ int ret;
++
++ ret = hostapd_dfs_request_channel_switch(iface, iface->radar_background.channel,
++ iface->radar_background.freq,
++ iface->radar_background.secondary_channel,
++ current_vht_oper_chwidth,
++ iface->radar_background.centr_freq_seg0_idx,
++ iface->radar_background.centr_freq_seg1_idx);
+
+ iface->conf->channel = iface->radar_background.channel;
+ iface->freq = iface->radar_background.freq;
+@@ -1122,11 +1130,7 @@ hostapd_dfs_start_channel_switch_background(struct hostapd_iface *iface)
+
+ hostpad_dfs_update_background_chain(iface);
+
+- return hostapd_dfs_request_channel_switch(
+- iface, iface->conf->channel, iface->freq,
+- iface->conf->secondary_channel, current_vht_oper_chwidth,
+- hostapd_get_oper_centr_freq_seg0_idx(iface->conf),
+- hostapd_get_oper_centr_freq_seg1_idx(iface->conf));
++ return ret;
+ }
+
+
+--
+2.18.0
+
diff --git a/recipes-wifi/hostapd/files/patches-2.10.3/mtk-0018-hostapd-mtk-Add-sta-assisted-DFS-state-update-mechan.patch b/recipes-wifi/hostapd/files/patches-2.10.3/mtk-0018-hostapd-mtk-Add-sta-assisted-DFS-state-update-mechan.patch
new file mode 100644
index 0000000..db3c813
--- /dev/null
+++ b/recipes-wifi/hostapd/files/patches-2.10.3/mtk-0018-hostapd-mtk-Add-sta-assisted-DFS-state-update-mechan.patch
@@ -0,0 +1,189 @@
+From 3337e7b4f75a66e53e1320e49deba2b58a8a80b0 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 18/19] hostapd: mtk: Add sta-assisted DFS state update
+ mechanism
+
+Signed-off-by: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
+---
+ src/ap/dfs.c | 20 ++++++++++++++++++++
+ src/ap/dfs.h | 3 +++
+ src/ap/drv_callbacks.c | 28 ++++++++++++++++++++++++++++
+ src/common/wpa_ctrl.h | 1 +
+ src/drivers/driver.h | 14 ++++++++++++++
+ src/drivers/driver_nl80211_event.c | 6 ++++++
+ src/drivers/nl80211_copy.h | 6 ++++++
+ 7 files changed, 78 insertions(+)
+
+diff --git a/src/ap/dfs.c b/src/ap/dfs.c
+index 307a4e1..d082fe0 100644
+--- a/src/ap/dfs.c
++++ b/src/ap/dfs.c
+@@ -1503,6 +1503,26 @@ int hostapd_dfs_nop_finished(struct hostapd_iface *iface, int freq,
+ }
+
+
++int hostapd_dfs_sta_update_state(struct hostapd_iface *iface, int freq,
++ int ht_enabled, int chan_offset, int chan_width,
++ int cf1, int cf2, u32 state)
++{
++ wpa_msg(iface->bss[0]->msg_ctx, MSG_INFO, DFS_EVENT_STA_UPDATE
++ "freq=%d ht_enabled=%d chan_offset=%d chan_width=%d cf1=%d cf2=%d state=%s",
++ freq, ht_enabled, chan_offset, chan_width, cf1, cf2,
++ (state == HOSTAPD_CHAN_DFS_AVAILABLE) ? "available" : "usable");
++
++ /* Proceed only if DFS is not offloaded to the driver */
++ if (iface->drv_flags & WPA_DRIVER_FLAGS_DFS_OFFLOAD)
++ return 0;
++
++ set_dfs_state(iface, freq, ht_enabled, chan_offset, chan_width,
++ cf1, cf2, state);
++
++ return 0;
++}
++
++
+ int hostapd_is_dfs_required(struct hostapd_iface *iface)
+ {
+ 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 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,
+ int hostapd_dfs_nop_finished(struct hostapd_iface *iface, int freq,
+ int ht_enabled,
+ int chan_offset, int chan_width, int cf1, int cf2);
++int hostapd_dfs_sta_update_state(struct hostapd_iface *iface, int freq,
++ int ht_enabled, int chan_offset, int chan_width,
++ int cf1, int cf2, u32 state);
+ int hostapd_is_dfs_required(struct hostapd_iface *iface);
+ 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 09783cb..275f6b3 100644
+--- a/src/ap/drv_callbacks.c
++++ b/src/ap/drv_callbacks.c
+@@ -1790,6 +1790,24 @@ static void hostapd_event_dfs_cac_started(struct hostapd_data *hapd,
+ radar->cf1, radar->cf2);
+ }
+
++static void hostapd_event_dfs_sta_cac_skipped(struct hostapd_data *hapd,
++ struct dfs_event *radar)
++{
++ wpa_printf(MSG_DEBUG, "DFS CAC skipped (by STA) on %d MHz", radar->freq);
++ hostapd_dfs_sta_update_state(hapd->iface, radar->freq, radar->ht_enabled,
++ radar->chan_offset, radar->chan_width,
++ radar->cf1, radar->cf2, HOSTAPD_CHAN_DFS_AVAILABLE);
++}
++
++static void hostapd_event_dfs_sta_cac_expired(struct hostapd_data *hapd,
++ struct dfs_event *radar)
++{
++ wpa_printf(MSG_DEBUG, "DFS CAC expired (by STA) on %d MHz", radar->freq);
++ hostapd_dfs_sta_update_state(hapd->iface, radar->freq, radar->ht_enabled,
++ radar->chan_offset, radar->chan_width,
++ radar->cf1, radar->cf2, HOSTAPD_CHAN_DFS_USABLE);
++}
++
+ #endif /* NEED_AP_MLME */
+
+
+@@ -2064,6 +2082,16 @@ void hostapd_wpa_event(void *ctx, enum wpa_event_type event,
+ break;
+ hostapd_event_dfs_nop_finished(hapd, &data->dfs_event);
+ break;
++ case EVENT_DFS_STA_CAC_SKIPPED:
++ if (!data)
++ break;
++ hostapd_event_dfs_sta_cac_skipped(hapd, &data->dfs_event);
++ break;
++ case EVENT_DFS_STA_CAC_EXPIRED:
++ if (!data)
++ break;
++ hostapd_event_dfs_sta_cac_expired(hapd, &data->dfs_event);
++ break;
+ case EVENT_CHANNEL_LIST_CHANGED:
+ /* 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 3435084..79c8a82 100644
+--- a/src/common/wpa_ctrl.h
++++ b/src/common/wpa_ctrl.h
+@@ -360,6 +360,7 @@ extern "C" {
+ #define DFS_EVENT_CAC_COMPLETED "DFS-CAC-COMPLETED "
+ #define DFS_EVENT_NOP_FINISHED "DFS-NOP-FINISHED "
+ #define DFS_EVENT_PRE_CAC_EXPIRED "DFS-PRE-CAC-EXPIRED "
++#define DFS_EVENT_STA_UPDATE "DFS-STA-UPDATE "
+
+ #define AP_CSA_FINISHED "AP-CSA-FINISHED "
+
+diff --git a/src/drivers/driver.h b/src/drivers/driver.h
+index 265d86d..b5de0e6 100644
+--- a/src/drivers/driver.h
++++ b/src/drivers/driver.h
+@@ -5317,6 +5317,20 @@ enum wpa_event_type {
+ * EVENT_CCA_NOTIFY - Notification that CCA has completed
+ */
+ EVENT_CCA_NOTIFY,
++
++ /**
++ * EVENT_DFS_STA_CAC_SKIPPED - Notification that CAC has been skipped
++ *
++ * The channel in the notification is now marked as available.
++ */
++ EVENT_DFS_STA_CAC_SKIPPED,
++
++ /**
++ * EVENT_DFS_STA_CAC_EXPIRED - Notification that CAC has expired
++ *
++ * The channel in the notification is now marked as usable.
++ */
++ EVENT_DFS_STA_CAC_EXPIRED,
+ };
+
+
+diff --git a/src/drivers/driver_nl80211_event.c b/src/drivers/driver_nl80211_event.c
+index 73bb7a4..ee922ac 100644
+--- a/src/drivers/driver_nl80211_event.c
++++ b/src/drivers/driver_nl80211_event.c
+@@ -1854,6 +1854,12 @@ static void nl80211_radar_event(struct wpa_driver_nl80211_data *drv,
+ case NL80211_RADAR_CAC_STARTED:
+ wpa_supplicant_event(drv->ctx, EVENT_DFS_CAC_STARTED, &data);
+ break;
++ case NL80211_RADAR_STA_CAC_SKIPPED:
++ wpa_supplicant_event(drv->ctx, EVENT_DFS_STA_CAC_SKIPPED, &data);
++ break;
++ case NL80211_RADAR_STA_CAC_EXPIRED:
++ wpa_supplicant_event(drv->ctx, EVENT_DFS_STA_CAC_EXPIRED, &data);
++ break;
+ default:
+ 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 c4bf3ad..0937752 100644
+--- a/src/drivers/nl80211_copy.h
++++ b/src/drivers/nl80211_copy.h
+@@ -6431,6 +6431,10 @@ enum nl80211_smps_mode {
+ * applicable for ETSI dfs domain where pre-CAC is valid for ever.
+ * @NL80211_RADAR_CAC_STARTED: Channel Availability Check has been started,
+ * should be generated by HW if NL80211_EXT_FEATURE_DFS_OFFLOAD is enabled.
++ * @NL80211_RADAR_STA_CAC_SKIPPED: STA set the DFS state to available
++ * when receiving CSA/assoc resp
++ * @NL80211_RADAR_STA_CAC_EXPIRED: STA set the DFS state to usable
++ * when STA is disconnected or leaving the channel
+ */
+ enum nl80211_radar_event {
+ NL80211_RADAR_DETECTED,
+@@ -6439,6 +6443,8 @@ enum nl80211_radar_event {
+ NL80211_RADAR_NOP_FINISHED,
+ NL80211_RADAR_PRE_CAC_EXPIRED,
+ NL80211_RADAR_CAC_STARTED,
++ NL80211_RADAR_STA_CAC_SKIPPED,
++ NL80211_RADAR_STA_CAC_EXPIRED,
+ };
+
+ /**
+--
+2.18.0
+
diff --git a/recipes-wifi/hostapd/files/patches-2.10.3/mtk-0019-hostapd-mtk-Fix-auto-ht-issue-when-switching-to-DFS-.patch b/recipes-wifi/hostapd/files/patches-2.10.3/mtk-0019-hostapd-mtk-Fix-auto-ht-issue-when-switching-to-DFS-.patch
new file mode 100644
index 0000000..8340fd9
--- /dev/null
+++ b/recipes-wifi/hostapd/files/patches-2.10.3/mtk-0019-hostapd-mtk-Fix-auto-ht-issue-when-switching-to-DFS-.patch
@@ -0,0 +1,43 @@
+From 83ab1a9cc51225095842d3c62bf75cf4efe63075 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] hostapd: mtk: Fix auto ht issue when switching to DFS channel
+
+Signed-off-by: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
+---
+ hostapd/ctrl_iface.c | 12 ++++++------
+ 1 file changed, 6 insertions(+), 6 deletions(-)
+
+diff --git a/hostapd/ctrl_iface.c b/hostapd/ctrl_iface.c
+index 0ad8451..407790f 100644
+--- a/hostapd/ctrl_iface.c
++++ b/hostapd/ctrl_iface.c
+@@ -2698,6 +2698,12 @@ 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;
++ }
++
+ if (settings.freq_params.center_freq1)
+ dfs_range += hostapd_is_dfs_overlap(
+ iface, bandwidth, settings.freq_params.center_freq1);
+@@ -2735,12 +2741,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.18.0
+
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 4a42f53..78d5240 100644
--- a/recipes-wifi/hostapd/files/patches-2.10.3/patches.inc
+++ b/recipes-wifi/hostapd/files/patches-2.10.3/patches.inc
@@ -71,11 +71,15 @@
file://mtk-0007-hostapd-mtk-Add-three-wire-PTA-ctrl-hostapd-vendor-c.patch \
file://mtk-0008-hostapd-mtk-Add-hostapd-iBF-control.patch \
file://mtk-0009-hostapd-mtk-Do-not-include-HE-capab-IE-if-associated.patch \
- file://mtk-0010-hostapd-mtk-Add-DFS-and-ZWDFS-support.patch \
- file://mtk-0011-hostapd-mtk-Add-amsdu-set-get-ctrl.patch \
- file://mtk-0012-hostapd-mtk-Add-he_ldpc-configuration.patch \
- file://mtk-0013-hostapd-mtk-Add-the-broadcast-destination-address-of.patch \
- file://mtk-0014-hostapd-mtk-Add-vendor-command-attribute-for-RTS-BW-.patch \
- file://mtk-0015-hostapd-mtk-6G-band-does-not-require-DFS.patch \
+ file://mtk-0010-hostapd-mtk-Add-DFS-detection-mode.patch \
+ file://mtk-0011-hostapd-mtk-Add-DFS-offchan-channel-switch.patch \
+ file://mtk-0012-hostapd-mtk-Add-amsdu-set-get-ctrl.patch \
+ file://mtk-0013-hostapd-mtk-Add-he_ldpc-configuration.patch \
+ file://mtk-0014-hostapd-mtk-Add-the-broadcast-destination-address-of.patch \
+ file://mtk-0015-hostapd-mtk-Add-vendor-command-attribute-for-RTS-BW-.patch \
+ file://mtk-0016-hostapd-mtk-6G-band-does-not-require-DFS.patch \
+ file://mtk-0017-hostapd-mtk-Fix-sending-wrong-VHT-operation-IE-in-CS.patch \
+ file://mtk-0018-hostapd-mtk-Add-sta-assisted-DFS-state-update-mechan.patch \
+ file://mtk-0019-hostapd-mtk-Fix-auto-ht-issue-when-switching-to-DFS-.patch \
file://mtk-0100-hostapd-mtk-update-eht-operation-elem.patch \
"