[][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/99917-hostapd-mtk-Add-hostapd-AMPDU-AMSDU-control.patch b/autobuild_mac80211_release/package/network/services/hostapd/patches/99917-hostapd-mtk-Add-hostapd-AMPDU-AMSDU-control.patch
index b568620..c1f276c 100644
--- a/autobuild_mac80211_release/package/network/services/hostapd/patches/99917-hostapd-mtk-Add-hostapd-AMPDU-AMSDU-control.patch
+++ b/autobuild_mac80211_release/package/network/services/hostapd/patches/99917-hostapd-mtk-Add-hostapd-AMPDU-AMSDU-control.patch
@@ -1,7 +1,7 @@
-From b58c77a1500824465bb3eb003a7b9be5d35d06f4 Mon Sep 17 00:00:00 2001
+From 15784701fb4b10ac058ae41763c5d4bda15366f0 Mon Sep 17 00:00:00 2001
 From: TomLiu <tomml.liu@mediatek.com>
 Date: Wed, 21 Sep 2022 15:14:11 -0700
-Subject: [PATCH][MAC80211][hostapd][add hostapd AMPDU and AMSDU control command]
+Subject: [PATCH 99917/99920] add hostapd AMPDU and AMSDU control command
 
 ---
  hostapd/config_file.c             |  18 ++++
@@ -20,10 +20,10 @@
  13 files changed, 297 insertions(+), 1 deletion(-)
 
 diff --git a/hostapd/config_file.c b/hostapd/config_file.c
-index 50bb536..71d1a5a 100644
+index 9b79be1..310f97d 100644
 --- a/hostapd/config_file.c
 +++ b/hostapd/config_file.c
-@@ -4777,6 +4777,24 @@ static int hostapd_config_fill(struct hostapd_config *conf,
+@@ -4789,6 +4789,24 @@ 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;
@@ -49,10 +49,10 @@
  		wpa_printf(MSG_ERROR,
  			   "Line %d: unknown configuration item '%s'",
 diff --git a/hostapd/ctrl_iface.c b/hostapd/ctrl_iface.c
-index 75bf6e6..41386ce 100644
+index a010e7f..0c40175 100644
 --- a/hostapd/ctrl_iface.c
 +++ b/hostapd/ctrl_iface.c
-@@ -3480,6 +3480,48 @@ hostapd_ctrl_iface_get_ibf(struct hostapd_data *hapd, char *buf,
+@@ -3495,6 +3495,48 @@ hostapd_ctrl_iface_get_ibf(struct hostapd_data *hapd, char *buf,
  }
  
  
@@ -101,7 +101,7 @@
  static int hostapd_ctrl_iface_receive_process(struct hostapd_data *hapd,
  					      char *buf, char *reply,
  					      int reply_size,
-@@ -4027,6 +4069,8 @@ static int hostapd_ctrl_iface_receive_process(struct hostapd_data *hapd,
+@@ -4055,6 +4097,8 @@ 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);
@@ -111,10 +111,10 @@
  		os_memcpy(reply, "UNKNOWN COMMAND\n", 16);
  		reply_len = 16;
 diff --git a/hostapd/hostapd_cli.c b/hostapd/hostapd_cli.c
-index e98a0a4..aa0bf58 100644
+index c2a123a..9a5a6b1 100644
 --- a/hostapd/hostapd_cli.c
 +++ b/hostapd/hostapd_cli.c
-@@ -1584,6 +1584,13 @@ static int hostapd_cli_cmd_get_ibf(struct wpa_ctrl *ctrl, int argc,
+@@ -1593,6 +1593,13 @@ static int hostapd_cli_cmd_get_ibf(struct wpa_ctrl *ctrl, int argc,
  }
  
  
@@ -128,7 +128,7 @@
  struct hostapd_cli_cmd {
  	const char *cmd;
  	int (*handler)(struct wpa_ctrl *ctrl, int argc, char *argv[]);
-@@ -1783,6 +1790,8 @@ static const struct hostapd_cli_cmd hostapd_cli_commands[] = {
+@@ -1796,6 +1803,8 @@ static const struct hostapd_cli_cmd hostapd_cli_commands[] = {
            "<tx type(0/1/2)> <interval> = runtime set inband discovery" },
  	{ "get_ibf", hostapd_cli_cmd_get_ibf, NULL,
  	  " = show iBF state (enabled/disabled)"},
@@ -138,7 +138,7 @@
  };
  
 diff --git a/src/ap/ap_config.c b/src/ap/ap_config.c
-index f28aa65..6fc99b9 100644
+index 14b21cb..910231b 100644
 --- a/src/ap/ap_config.c
 +++ b/src/ap/ap_config.c
 @@ -299,6 +299,8 @@ struct hostapd_config * hostapd_config_defaults(void)
@@ -151,10 +151,10 @@
  	return conf;
  }
 diff --git a/src/ap/ap_config.h b/src/ap/ap_config.h
-index 9c73e40..6f94fc6 100644
+index 2a74e09..01b051d 100644
 --- a/src/ap/ap_config.h
 +++ b/src/ap/ap_config.h
-@@ -1155,6 +1155,8 @@ struct hostapd_config {
+@@ -1158,6 +1158,8 @@ struct hostapd_config {
  	s8 edcca_compensation;
  	u8 three_wire_enable;
  	u8 ibf_enable;
@@ -164,10 +164,10 @@
  
  enum three_wire_mode {
 diff --git a/src/ap/ap_drv_ops.c b/src/ap/ap_drv_ops.c
-index 7b3af9c..48a6d71 100644
+index 0b9b410..be6dcb8 100644
 --- a/src/ap/ap_drv_ops.c
 +++ b/src/ap/ap_drv_ops.c
-@@ -1059,4 +1059,25 @@ int hostapd_drv_ibf_dump(struct hostapd_data *hapd, u8 *ibf_enable)
+@@ -1062,4 +1062,25 @@ int hostapd_drv_ibf_dump(struct hostapd_data *hapd, u8 *ibf_enable)
  	if (!hapd->driver || !hapd->driver->ibf_dump)
  		return 0;
  	return hapd->driver->ibf_dump(hapd->drv_priv, ibf_enable);
@@ -210,7 +210,7 @@
  #include "drivers/driver.h"
  
 diff --git a/src/ap/hostapd.c b/src/ap/hostapd.c
-index c8a76b2..4adad23 100644
+index f095fe4..5fc998e 100644
 --- a/src/ap/hostapd.c
 +++ b/src/ap/hostapd.c
 @@ -2303,6 +2303,10 @@ dfs_offload:
@@ -254,10 +254,10 @@
  	MTK_VENDOR_ATTR_RFEATURE_CTRL_UNSPEC,
  
 diff --git a/src/drivers/driver.h b/src/drivers/driver.h
-index 8ce11ba..449da42 100644
+index dab37f9..3286429 100644
 --- a/src/drivers/driver.h
 +++ b/src/drivers/driver.h
-@@ -4708,6 +4708,17 @@ struct wpa_driver_ops {
+@@ -4718,6 +4718,17 @@ struct wpa_driver_ops {
  	 *
  	 */
  	int (*ibf_dump)(void *priv, u8 *ibf_enable);
@@ -276,10 +276,10 @@
  
  /**
 diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c
-index 8cac145..2e902e6 100644
+index 1c065d4..a06ac58 100644
 --- a/src/drivers/driver_nl80211.c
 +++ b/src/drivers/driver_nl80211.c
-@@ -12639,6 +12639,163 @@ fail:
+@@ -12655,6 +12655,163 @@ fail:
  	return -ENOBUFS;
  }
  
@@ -443,7 +443,7 @@
  const struct wpa_driver_ops wpa_driver_nl80211_ops = {
  	.name = "nl80211",
  	.desc = "Linux nl80211/cfg80211",
-@@ -12791,4 +12948,7 @@ const struct wpa_driver_ops wpa_driver_nl80211_ops = {
+@@ -12807,4 +12964,7 @@ 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,
@@ -452,10 +452,10 @@
 +	.aggregation_dump = nl80211_dump_aggregation,
  };
 diff --git a/src/drivers/driver_nl80211.h b/src/drivers/driver_nl80211.h
-index 11dd93a..e5c151f 100644
+index 607592c..e570224 100644
 --- a/src/drivers/driver_nl80211.h
 +++ b/src/drivers/driver_nl80211.h
-@@ -184,6 +184,7 @@ struct wpa_driver_nl80211_data {
+@@ -185,6 +185,7 @@ struct wpa_driver_nl80211_data {
  	unsigned int mtk_hemu_vendor_cmd_avail:1;
  	unsigned int mtk_3wire_vendor_cmd_avail:1;
  	unsigned int mtk_ibf_vendor_cmd_avail:1;
@@ -464,10 +464,10 @@
  	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 8cf67fe..d97d64d 100644
+index 9ecc0ff..fcfa68b 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)
+@@ -1065,6 +1065,9 @@ static int wiphy_info_handler(struct nl_msg *msg, void *arg)
  				case MTK_NL80211_VENDOR_SUBCMD_IBF_CTRL:
  					drv->mtk_ibf_vendor_cmd_avail = 1;
  					break;
@@ -478,5 +478,5 @@
  			}
  
 -- 
-2.32.0
+2.18.0