[][MAC80211][hostapd][Fix the issue of AP and STA starting on DFS channel conccurrently]

[Description]
Fix AP no beacon when start_disabled is set to 1.
Fix STA cannot connect to AP when start_disbaled is set to 0.
Add AP CAC skip when STA is already associated to another AP
on the same DFS channel.

[Release-log]
N/A

Change-Id: I63486fe7e7cad22dc2511a2e4bf25e687ed3cbf2
Reviewed-on: https://gerrit.mediatek.inc/c/openwrt/feeds/mtk_openwrt_feeds/+/6607300
Build: srv_hbgsm110
diff --git a/autobuild_mac80211_release/package/network/services/hostapd/patches/99915-hostapd-mtk-Add-three-wire-PTA-ctrl-hostapd-vendor-command.patch b/autobuild_mac80211_release/package/network/services/hostapd/patches/99915-hostapd-mtk-Add-three-wire-PTA-ctrl-hostapd-vendor-command.patch
index a3183d7..bdc20dd 100644
--- a/autobuild_mac80211_release/package/network/services/hostapd/patches/99915-hostapd-mtk-Add-three-wire-PTA-ctrl-hostapd-vendor-command.patch
+++ b/autobuild_mac80211_release/package/network/services/hostapd/patches/99915-hostapd-mtk-Add-three-wire-PTA-ctrl-hostapd-vendor-command.patch
@@ -1,7 +1,7 @@
-From 476f2fe6698c32ddaca8e5f8c564b499f5dc4772 Mon Sep 17 00:00:00 2001
+From dac510add166575a332b46013346707bb1c2c2b0 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 99915/99916] Add three wire PTA ctrl hostapd vendor command
+Subject: [PATCH 99915/99920] Add three wire PTA ctrl hostapd vendor command
 
 Signed-off-by: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
 ---
@@ -12,14 +12,14 @@
  src/ap/ap_drv_ops.h               |  1 +
  src/ap/hostapd.c                  |  2 ++
  src/common/mtk_vendor.h           | 16 +++++++++++++++
- src/drivers/driver.h              |  1 +
+ src/drivers/driver.h              |  8 ++++++++
  src/drivers/driver_nl80211.c      | 33 +++++++++++++++++++++++++++++++
  src/drivers/driver_nl80211.h      |  1 +
  src/drivers/driver_nl80211_capa.c |  3 +++
- 11 files changed, 86 insertions(+)
+ 11 files changed, 93 insertions(+)
 
 diff --git a/hostapd/config_file.c b/hostapd/config_file.c
-index 0be53044a..0bf8b6c72 100644
+index 0be5304..0bf8b6c 100644
 --- a/hostapd/config_file.c
 +++ b/hostapd/config_file.c
 @@ -4782,6 +4782,10 @@ static int hostapd_config_fill(struct hostapd_config *conf,
@@ -34,7 +34,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 8ce4d9a16..2d720095a 100644
+index 8ce4d9a..2d72009 100644
 --- a/src/ap/ap_config.c
 +++ b/src/ap/ap_config.c
 @@ -297,6 +297,7 @@ struct hostapd_config * hostapd_config_defaults(void)
@@ -46,7 +46,7 @@
  	return conf;
  }
 diff --git a/src/ap/ap_config.h b/src/ap/ap_config.h
-index 4462f29b7..8b9e8873d 100644
+index 4462f29..8b9e887 100644
 --- a/src/ap/ap_config.h
 +++ b/src/ap/ap_config.h
 @@ -1156,6 +1156,19 @@ struct hostapd_config {
@@ -70,7 +70,7 @@
  
  enum edcca_mode {
 diff --git a/src/ap/ap_drv_ops.c b/src/ap/ap_drv_ops.c
-index 55452323d..77d5f8990 100644
+index 5545232..77d5f89 100644
 --- a/src/ap/ap_drv_ops.c
 +++ b/src/ap/ap_drv_ops.c
 @@ -1038,3 +1038,14 @@ int hostapd_drv_hemu_dump(struct hostapd_data *hapd, u8 *hemu_onoff)
@@ -89,7 +89,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 5bcb2251a..0a8bf0c7e 100644
+index 5bcb225..0a8bf0c 100644
 --- a/src/ap/ap_drv_ops.h
 +++ b/src/ap/ap_drv_ops.h
 @@ -141,6 +141,7 @@ int hostapd_drv_dpp_listen(struct hostapd_data *hapd, bool enable);
@@ -101,7 +101,7 @@
  #include "drivers/driver.h"
  
 diff --git a/src/ap/hostapd.c b/src/ap/hostapd.c
-index 0f3691ba3..32b75dca7 100644
+index 0f3691b..32b75dc 100644
 --- a/src/ap/hostapd.c
 +++ b/src/ap/hostapd.c
 @@ -2299,6 +2299,8 @@ dfs_offload:
@@ -114,7 +114,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 5c8f1792e..99a4d7f94 100644
+index 5c8f179..99a4d7f 100644
 --- a/src/common/mtk_vendor.h
 +++ b/src/common/mtk_vendor.h
 @@ -13,6 +13,7 @@ enum mtk_nl80211_vendor_subcmds {
@@ -148,19 +148,26 @@
  	MTK_VENDOR_ATTR_CSI_CTRL_UNSPEC,
  
 diff --git a/src/drivers/driver.h b/src/drivers/driver.h
-index 88b371d61..a137ffc14 100644
+index 88b371d..e725433 100644
 --- a/src/drivers/driver.h
 +++ b/src/drivers/driver.h
-@@ -4691,6 +4691,7 @@ struct wpa_driver_ops {
+@@ -4691,6 +4691,14 @@ struct wpa_driver_ops {
  	 */
  	 int (*hemu_ctrl)(void *priv, u8 hemu_onoff);
  	 int (*hemu_dump)(void *priv, u8 *hemu_onoff);
++
++	/**
++	 * three_wire_ctrl - set three_wire_ctrl mode
++	 * @priv: Private driver interface data
++	 * @three_wire_enable: three_wire_ctrl mode
++	 *
++	 */
 +	 int (*three_wire_ctrl)(void *priv, u8 three_wire_enable);
  };
  
  /**
 diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c
-index b06de0687..03babd8a2 100644
+index b06de06..03babd8 100644
 --- a/src/drivers/driver_nl80211.c
 +++ b/src/drivers/driver_nl80211.c
 @@ -12516,6 +12516,38 @@ static int nl80211_configure_edcca_threshold(void *priv,
@@ -209,7 +216,7 @@
 +	.three_wire_ctrl = nl80211_enable_three_wire,
  };
 diff --git a/src/drivers/driver_nl80211.h b/src/drivers/driver_nl80211.h
-index 57f02497e..9fe7811b9 100644
+index 57f0249..9fe7811 100644
 --- a/src/drivers/driver_nl80211.h
 +++ b/src/drivers/driver_nl80211.h
 @@ -183,6 +183,7 @@ struct wpa_driver_nl80211_data {
@@ -221,7 +228,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 cc146d9fc..04bc54e77 100644
+index cc146d9..04bc54e 100644
 --- a/src/drivers/driver_nl80211_capa.c
 +++ b/src/drivers/driver_nl80211_capa.c
 @@ -1059,6 +1059,9 @@ static int wiphy_info_handler(struct nl_msg *msg, void *arg)
@@ -235,5 +242,5 @@
  			}
  
 -- 
-2.25.1
+2.18.0