Browse Source

qcacld-3.0: Move SOFTAP_BSS_STARTED event flag to per link

The flag determines the state of softap bss,
hence move it to per link flags.
The references of this event are moved to deflink.

Change-Id: I1838cdf6067eb93421b424c4965258a9a497923d
CRs-Fixed: 3452220
Vinod Kumar Pirla 2 years ago
parent
commit
fb8255fe08

+ 2 - 3
core/hdd/inc/wlan_hdd_main.h

@@ -258,7 +258,6 @@ static inline bool in_compat_syscall(void) { return is_compat_task(); }
  * enum hdd_adapter_flags - event bitmap flags registered net device
  * @NET_DEVICE_REGISTERED: Adapter is registered with the kernel
  * @WMM_INIT_DONE: Adapter is initialized
- * @SOFTAP_BSS_STARTED: Software Access Point (SAP) is running
  * @DEVICE_IFACE_OPENED: Adapter has been "opened" via the kernel
  * @SOFTAP_INIT_DONE: Software Access Point (SAP) is initialized
  * @VENDOR_ACS_RESPONSE_PENDING: Waiting for event for vendor acs
@@ -267,7 +266,6 @@ static inline bool in_compat_syscall(void) { return is_compat_task(); }
 enum hdd_adapter_flags {
 	NET_DEVICE_REGISTERED,
 	WMM_INIT_DONE,
-	SOFTAP_BSS_STARTED,
 	DEVICE_IFACE_OPENED,
 	SOFTAP_INIT_DONE,
 	VENDOR_ACS_RESPONSE_PENDING,
@@ -277,10 +275,11 @@ enum hdd_adapter_flags {
 /**
  * enum hdd_link_flags - Event bitmap flags specific to per link
  * @SME_SESSION_OPENED: Firmware vdev has been created
- *
+ * @SOFTAP_BSS_STARTED: Software Access Point (SAP) is running
  */
 enum hdd_link_flags {
 	SME_SESSION_OPENED,
+	SOFTAP_BSS_STARTED,
 };
 
 /**

+ 3 - 2
core/hdd/src/wlan_hdd_cfg80211.c

@@ -15346,7 +15346,7 @@ __wlan_hdd_cfg80211_sap_configuration_set(struct wiphy *wiphy,
 
 	if (chan_freq_present) {
 		if (!test_bit(SOFTAP_BSS_STARTED,
-					&hostapd_adapter->event_flags)) {
+			      &hostapd_adapter->deflink->link_flags)) {
 			hdd_err("SAP is not started yet. Restart sap will be invalid");
 			return -EINVAL;
 		}
@@ -26592,7 +26592,8 @@ static int __wlan_hdd_cfg80211_get_channel(struct wiphy *wiphy,
 
 		ap_ctx = WLAN_HDD_GET_AP_CTX_PTR(adapter->deflink);
 
-		if (!test_bit(SOFTAP_BSS_STARTED, &adapter->event_flags))
+		if (!test_bit(SOFTAP_BSS_STARTED,
+			      &adapter->deflink->link_flags))
 			return -EINVAL;
 
 		switch (ap_ctx->sap_config.SapHw_mode) {

+ 3 - 2
core/hdd/src/wlan_hdd_cm_connect.c

@@ -509,8 +509,9 @@ static struct hdd_adapter
 		 * sap is not in started state and also not under doing CAC,
 		 * so it is fine to go ahead with sta.
 		 */
-		if (!test_bit(SOFTAP_BSS_STARTED, &(adapter)->event_flags) &&
-		    (hdd_ctx->dev_dfs_cac_status != DFS_CAC_IN_PROGRESS))
+		if (!test_bit(SOFTAP_BSS_STARTED,
+			      &adapter->deflink->link_flags) &&
+		    hdd_ctx->dev_dfs_cac_status != DFS_CAC_IN_PROGRESS)
 			goto loop_next;
 
 		chan = wlan_vdev_get_active_channel(adapter->deflink->vdev);

+ 2 - 1
core/hdd/src/wlan_hdd_dcs.c

@@ -116,7 +116,8 @@ static QDF_STATUS hdd_dcs_switch_chan_cb(struct wlan_objmgr_vdev *vdev,
 					    tgt_freq, tgt_width);
 		break;
 	case QDF_SAP_MODE:
-		if (!test_bit(SOFTAP_BSS_STARTED, &adapter->event_flags))
+		if (!test_bit(SOFTAP_BSS_STARTED,
+			      &adapter->deflink->link_flags))
 			return QDF_STATUS_E_INVAL;
 
 		/* stop sap if got invalid freq or width */

+ 15 - 14
core/hdd/src/wlan_hdd_hostapd.c

@@ -887,13 +887,13 @@ static int hdd_stop_bss_link(struct hdd_adapter *adapter)
 	if (errno)
 		return errno;
 
-	if (test_bit(SOFTAP_BSS_STARTED, &adapter->event_flags)) {
+	if (test_bit(SOFTAP_BSS_STARTED, &adapter->deflink->link_flags)) {
 		status = wlansap_stop_bss(
 			WLAN_HDD_GET_SAP_CTX_PTR(adapter->deflink));
 		if (QDF_IS_STATUS_SUCCESS(status))
 			hdd_debug("Deleting SAP/P2P link!!!!!!");
 
-		clear_bit(SOFTAP_BSS_STARTED, &adapter->event_flags);
+		clear_bit(SOFTAP_BSS_STARTED, &adapter->deflink->link_flags);
 		policy_mgr_decr_session_set_pcl(hdd_ctx->psoc,
 					adapter->device_mode,
 					adapter->deflink->vdev_id);
@@ -3016,7 +3016,8 @@ QDF_STATUS hdd_hostapd_sap_event_cb(struct sap_event *sap_event,
 			      ap_ctx->sap_config.acs_cfg.ch_width);
 
 		if (qdf_atomic_read(&ap_ctx->acs_in_progress) &&
-		    test_bit(SOFTAP_BSS_STARTED, &adapter->event_flags)) {
+		    test_bit(SOFTAP_BSS_STARTED,
+			     &adapter->deflink->link_flags)) {
 			hdd_dcs_chan_select_complete(adapter);
 		} else {
 			wlan_hdd_cfg80211_acs_ch_select_evt(adapter, true);
@@ -3757,7 +3758,7 @@ QDF_STATUS wlan_hdd_check_cc_intf_cb(struct wlan_objmgr_psoc *psoc,
 		return QDF_STATUS_E_FAILURE;
 	}
 
-	if (!test_bit(SOFTAP_BSS_STARTED, &link_info->adapter->event_flags)) {
+	if (!test_bit(SOFTAP_BSS_STARTED, &link_info->link_flags)) {
 		hdd_err("SOFTAP_BSS_STARTED not set");
 		return QDF_STATUS_E_FAILURE;
 	}
@@ -3834,7 +3835,7 @@ QDF_STATUS wlan_hdd_get_channel_for_sap_restart(struct wlan_objmgr_psoc *psoc,
 		return QDF_STATUS_E_FAILURE;
 	}
 
-	if (!test_bit(SOFTAP_BSS_STARTED, &ap_adapter->event_flags)) {
+	if (!test_bit(SOFTAP_BSS_STARTED, &ap_adapter->deflink->link_flags)) {
 		hdd_err("SOFTAP_BSS_STARTED not set");
 		return QDF_STATUS_E_FAILURE;
 	}
@@ -4090,7 +4091,7 @@ uint32_t hdd_get_ap_6ghz_capable(struct wlan_objmgr_psoc *psoc, uint8_t vdev_id)
 	 * b. SAP is configured on 6Ghz fixed channel from userspace.
 	 * c. SAP is configured by ACS range which includes any 6Ghz channel.
 	 */
-	if (test_bit(SOFTAP_BSS_STARTED, &ap_adapter->event_flags)) {
+	if (test_bit(SOFTAP_BSS_STARTED, &ap_adapter->deflink->link_flags)) {
 		if (WLAN_REG_IS_6GHZ_CHAN_FREQ(
 				ap_ctx->operating_chan_freq))
 			capable |= CONN_6GHZ_FLAG_ACS_OR_USR_ALLOWED;
@@ -5176,7 +5177,7 @@ int wlan_hdd_cfg80211_update_apies(struct hdd_adapter *adapter)
 	wlan_hdd_add_extra_ie(adapter, proberesp_ies, &proberesp_ies_len,
 			      WLAN_ELEMID_MOBILITY_DOMAIN);
 
-	if (test_bit(SOFTAP_BSS_STARTED, &adapter->event_flags)) {
+	if (test_bit(SOFTAP_BSS_STARTED, &adapter->deflink->link_flags)) {
 		update_ie.ieBufferlength = proberesp_ies_len;
 		update_ie.pAdditionIEBuffer = proberesp_ies;
 		update_ie.append = false;
@@ -5198,7 +5199,7 @@ int wlan_hdd_cfg80211_update_apies(struct hdd_adapter *adapter)
 	}
 
 	/* Assoc resp Add ie Data */
-	if (test_bit(SOFTAP_BSS_STARTED, &adapter->event_flags)) {
+	if (test_bit(SOFTAP_BSS_STARTED, &adapter->deflink->link_flags)) {
 		update_ie.ieBufferlength = beacon->assocresp_ies_len;
 		update_ie.pAdditionIEBuffer = (uint8_t *) beacon->assocresp_ies;
 		update_ie.append = false;
@@ -5219,7 +5220,7 @@ int wlan_hdd_cfg80211_update_apies(struct hdd_adapter *adapter)
 						 eUPDATE_IE_ASSOC_RESP);
 	}
 
-	if (test_bit(SOFTAP_BSS_STARTED, &adapter->event_flags)) {
+	if (test_bit(SOFTAP_BSS_STARTED, &adapter->deflink->link_flags)) {
 		update_ie.ieBufferlength = total_ielen;
 		update_ie.pAdditionIEBuffer = genie;
 		update_ie.append = false;
@@ -6292,7 +6293,7 @@ int wlan_hdd_cfg80211_start_bss(struct hdd_adapter *adapter,
 	ucfg_mlme_get_go_force_11n_for_11ac(hdd_ctx->psoc,
 					    &go_force_11n_for_11ac);
 
-	if (test_bit(SOFTAP_BSS_STARTED, &adapter->event_flags))
+	if (test_bit(SOFTAP_BSS_STARTED, &adapter->deflink->link_flags))
 		deliver_start_evt = false;
 
 	if (deliver_start_evt) {
@@ -6830,7 +6831,7 @@ int wlan_hdd_cfg80211_start_bss(struct hdd_adapter *adapter,
 		goto error;
 	}
 
-	if (test_bit(SOFTAP_BSS_STARTED, &adapter->event_flags)) {
+	if (test_bit(SOFTAP_BSS_STARTED, &adapter->deflink->link_flags)) {
 		mutex_unlock(&hdd_ctx->sap_lock);
 
 		wlansap_reset_sap_config_add_ie(config, eUPDATE_IE_ALL);
@@ -6917,7 +6918,7 @@ int wlan_hdd_cfg80211_start_bss(struct hdd_adapter *adapter,
 		goto error;
 	}
 	/* Successfully started Bss update the state bit. */
-	set_bit(SOFTAP_BSS_STARTED, &adapter->event_flags);
+	set_bit(SOFTAP_BSS_STARTED, &adapter->deflink->link_flags);
 
 	mutex_unlock(&hdd_ctx->sap_lock);
 
@@ -7093,7 +7094,7 @@ static int __wlan_hdd_cfg80211_stop_ap(struct wiphy *wiphy,
 	wlan_hdd_cleanup_actionframe(adapter);
 	wlan_hdd_cleanup_remain_on_channel_ctx(adapter);
 	mutex_lock(&hdd_ctx->sap_lock);
-	if (test_bit(SOFTAP_BSS_STARTED, &adapter->event_flags)) {
+	if (test_bit(SOFTAP_BSS_STARTED, &adapter->deflink->link_flags)) {
 		struct hdd_hostapd_state *hostapd_state =
 			WLAN_HDD_GET_HOSTAP_STATE_PTR(adapter->deflink);
 
@@ -7115,7 +7116,7 @@ static int __wlan_hdd_cfg80211_stop_ap(struct wiphy *wiphy,
 				QDF_ASSERT(0);
 			}
 		}
-		clear_bit(SOFTAP_BSS_STARTED, &adapter->event_flags);
+		clear_bit(SOFTAP_BSS_STARTED, &adapter->deflink->link_flags);
 
 		/*BSS stopped, clear the active sessions for this device mode*/
 		policy_mgr_decr_session_set_pcl(hdd_ctx->psoc,

+ 3 - 3
core/hdd/src/wlan_hdd_hostapd_wext.c

@@ -1519,7 +1519,7 @@ static __iw_softap_getchannel(struct net_device *dev,
 
 	*value = 0;
 	ap_ctx = WLAN_HDD_GET_AP_CTX_PTR(adapter->deflink);
-	if (test_bit(SOFTAP_BSS_STARTED, &adapter->event_flags))
+	if (test_bit(SOFTAP_BSS_STARTED, &adapter->deflink->link_flags))
 		*value = wlan_reg_freq_to_chan(
 				hdd_ctx->pdev,
 				ap_ctx->operating_chan_freq);
@@ -2171,7 +2171,7 @@ __iw_softap_stopbss(struct net_device *dev,
 	if (0 != ret)
 		return ret;
 
-	if (test_bit(SOFTAP_BSS_STARTED, &adapter->event_flags)) {
+	if (test_bit(SOFTAP_BSS_STARTED, &adapter->deflink->link_flags)) {
 		struct hdd_hostapd_state *hostapd_state =
 			WLAN_HDD_GET_HOSTAP_STATE_PTR(adapter->deflink);
 
@@ -2188,7 +2188,7 @@ __iw_softap_stopbss(struct net_device *dev,
 				QDF_ASSERT(0);
 			}
 		}
-		clear_bit(SOFTAP_BSS_STARTED, &adapter->event_flags);
+		clear_bit(SOFTAP_BSS_STARTED, &adapter->deflink->link_flags);
 		policy_mgr_decr_session_set_pcl(hdd_ctx->psoc,
 					     adapter->device_mode,
 					     adapter->deflink->vdev_id);

+ 20 - 16
core/hdd/src/wlan_hdd_main.c

@@ -724,7 +724,7 @@ uint32_t hdd_get_adapter_home_channel(struct hdd_adapter *adapter)
 
 	if ((adapter->device_mode == QDF_SAP_MODE ||
 	     adapter->device_mode == QDF_P2P_GO_MODE) &&
-	    test_bit(SOFTAP_BSS_STARTED, &adapter->event_flags)) {
+	    test_bit(SOFTAP_BSS_STARTED, &adapter->deflink->link_flags)) {
 		home_chan_freq =
 			adapter->deflink->session.ap.operating_chan_freq;
 	} else if ((adapter->device_mode == QDF_STA_MODE ||
@@ -750,7 +750,7 @@ enum phy_ch_width hdd_get_adapter_width(struct hdd_adapter *adapter)
 
 	if ((adapter->device_mode == QDF_SAP_MODE ||
 	     adapter->device_mode == QDF_P2P_GO_MODE) &&
-	    test_bit(SOFTAP_BSS_STARTED, &adapter->event_flags)) {
+	    test_bit(SOFTAP_BSS_STARTED, &adapter->deflink->link_flags)) {
 		width = adapter->deflink->session.ap.sap_config.ch_params.ch_width;
 	} else if ((adapter->device_mode == QDF_STA_MODE ||
 		    adapter->device_mode == QDF_P2P_CLIENT_MODE) &&
@@ -5479,7 +5479,8 @@ bool hdd_is_dynamic_set_mac_addr_allowed(struct hdd_adapter *adapter)
 	case QDF_P2P_DEVICE_MODE:
 		return true;
 	case QDF_SAP_MODE:
-		if (test_bit(SOFTAP_BSS_STARTED, &adapter->event_flags)) {
+		if (test_bit(SOFTAP_BSS_STARTED,
+			     &adapter->deflink->link_flags)) {
 			hdd_info_rl("SAP is in up state, set mac address isn't supported");
 			return false;
 		} else {
@@ -6744,7 +6745,7 @@ bool hdd_is_vdev_in_conn_state(struct hdd_adapter *adapter)
 	case QDF_SAP_MODE:
 	case QDF_P2P_GO_MODE:
 		return (test_bit(SOFTAP_BSS_STARTED,
-				 &adapter->event_flags));
+				 &adapter->deflink->link_flags));
 	default:
 		hdd_err("Device mode %d invalid", adapter->device_mode);
 		return 0;
@@ -8694,7 +8695,8 @@ QDF_STATUS hdd_stop_adapter_ext(struct hdd_context *hdd_ctx,
 		wlan_hdd_scan_abort(adapter);
 		hdd_abort_ongoing_sta_connection(hdd_ctx);
 		/* Diassociate with all the peers before stop ap post */
-		if (test_bit(SOFTAP_BSS_STARTED, &adapter->event_flags)) {
+		if (test_bit(SOFTAP_BSS_STARTED,
+			     &adapter->deflink->link_flags)) {
 			if (wlan_hdd_del_station(adapter, NULL))
 				hdd_sap_indicate_disconnect_for_sta(adapter);
 		}
@@ -8737,7 +8739,8 @@ QDF_STATUS hdd_stop_adapter_ext(struct hdd_context *hdd_ctx,
 		hdd_destroy_acs_timer(adapter);
 
 		mutex_lock(&hdd_ctx->sap_lock);
-		if (test_bit(SOFTAP_BSS_STARTED, &adapter->event_flags)) {
+		if (test_bit(SOFTAP_BSS_STARTED,
+			     &adapter->deflink->link_flags)) {
 			struct hdd_hostapd_state *hostapd_state =
 				WLAN_HDD_GET_HOSTAP_STATE_PTR(adapter->deflink);
 
@@ -8758,7 +8761,8 @@ QDF_STATUS hdd_stop_adapter_ext(struct hdd_context *hdd_ctx,
 				hdd_err("failure in wlansap_stop_bss");
 			}
 
-			clear_bit(SOFTAP_BSS_STARTED, &adapter->event_flags);
+			clear_bit(SOFTAP_BSS_STARTED,
+				  &adapter->deflink->link_flags);
 			policy_mgr_decr_session_set_pcl(hdd_ctx->psoc,
 						adapter->device_mode,
 						adapter->deflink->vdev_id);
@@ -16993,7 +16997,7 @@ hdd_get_con_sap_adapter(struct hdd_adapter *this_sap_adapter,
 						adapter != this_sap_adapter) {
 			if (check_start_bss) {
 				if (test_bit(SOFTAP_BSS_STARTED,
-						&adapter->event_flags)) {
+					     &adapter->deflink->link_flags)) {
 					con_sap_adapter = adapter;
 					hdd_adapter_dev_put_debug(adapter,
 								  dbgid);
@@ -17116,7 +17120,7 @@ void wlan_hdd_stop_sap(struct hdd_adapter *ap_adapter)
 		return;
 
 	mutex_lock(&hdd_ctx->sap_lock);
-	if (test_bit(SOFTAP_BSS_STARTED, &ap_adapter->event_flags)) {
+	if (test_bit(SOFTAP_BSS_STARTED, &ap_adapter->deflink->link_flags)) {
 		wlan_hdd_del_station(ap_adapter, NULL);
 		hostapd_state =
 			WLAN_HDD_GET_HOSTAP_STATE_PTR(ap_adapter->deflink);
@@ -17133,7 +17137,7 @@ void wlan_hdd_stop_sap(struct hdd_adapter *ap_adapter)
 				return;
 			}
 		}
-		clear_bit(SOFTAP_BSS_STARTED, &ap_adapter->event_flags);
+		clear_bit(SOFTAP_BSS_STARTED, &ap_adapter->deflink->link_flags);
 		policy_mgr_decr_session_set_pcl(hdd_ctx->psoc,
 						ap_adapter->device_mode,
 						ap_adapter->deflink->vdev_id);
@@ -17220,7 +17224,7 @@ void wlan_hdd_start_sap(struct hdd_adapter *ap_adapter, bool reinit)
 	sap_config = &ap_adapter->deflink->session.ap.sap_config;
 
 	mutex_lock(&hdd_ctx->sap_lock);
-	if (test_bit(SOFTAP_BSS_STARTED, &ap_adapter->event_flags))
+	if (test_bit(SOFTAP_BSS_STARTED, &ap_adapter->deflink->link_flags))
 		goto end;
 
 	if (0 != wlan_hdd_cfg80211_update_apies(ap_adapter)) {
@@ -17257,7 +17261,7 @@ void wlan_hdd_start_sap(struct hdd_adapter *ap_adapter, bool reinit)
 	if (reinit)
 		hdd_medium_assess_init();
 	wlansap_reset_sap_config_add_ie(sap_config, eUPDATE_IE_ALL);
-	set_bit(SOFTAP_BSS_STARTED, &ap_adapter->event_flags);
+	set_bit(SOFTAP_BSS_STARTED, &ap_adapter->deflink->link_flags);
 	if (hostapd_state->bss_state == BSS_START) {
 		policy_mgr_incr_active_session(hdd_ctx->psoc,
 					ap_adapter->device_mode,
@@ -19919,7 +19923,7 @@ void hdd_restart_sap(struct hdd_adapter *ap_adapter)
 	sap_ctx = hdd_ap_ctx->sap_context;
 
 	mutex_lock(&hdd_ctx->sap_lock);
-	if (test_bit(SOFTAP_BSS_STARTED, &ap_adapter->event_flags)) {
+	if (test_bit(SOFTAP_BSS_STARTED, &ap_adapter->deflink->link_flags)) {
 		wlan_hdd_del_station(ap_adapter, NULL);
 		hostapd_state =
 			WLAN_HDD_GET_HOSTAP_STATE_PTR(ap_adapter->deflink);
@@ -19934,7 +19938,7 @@ void hdd_restart_sap(struct hdd_adapter *ap_adapter)
 				goto end;
 			}
 		}
-		clear_bit(SOFTAP_BSS_STARTED, &ap_adapter->event_flags);
+		clear_bit(SOFTAP_BSS_STARTED, &ap_adapter->deflink->link_flags);
 		policy_mgr_decr_session_set_pcl(hdd_ctx->psoc,
 			ap_adapter->device_mode, ap_adapter->deflink->vdev_id);
 		hdd_green_ap_start_state_mc(hdd_ctx, ap_adapter->device_mode,
@@ -19973,7 +19977,7 @@ void hdd_restart_sap(struct hdd_adapter *ap_adapter)
 						eUPDATE_IE_ALL);
 		hdd_err("SAP Start Success");
 		hdd_medium_assess_init();
-		set_bit(SOFTAP_BSS_STARTED, &ap_adapter->event_flags);
+		set_bit(SOFTAP_BSS_STARTED, &ap_adapter->deflink->link_flags);
 		if (hostapd_state->bss_state == BSS_START) {
 			policy_mgr_incr_active_session(hdd_ctx->psoc,
 						ap_adapter->device_mode,
@@ -20025,7 +20029,7 @@ void hdd_check_and_restart_sap_with_non_dfs_acs(void)
 
 	ap_adapter = hdd_get_adapter(hdd_ctx, QDF_SAP_MODE);
 	if (ap_adapter &&
-	    test_bit(SOFTAP_BSS_STARTED, &ap_adapter->event_flags) &&
+	    test_bit(SOFTAP_BSS_STARTED, &ap_adapter->deflink->link_flags) &&
 	    wlan_reg_is_dfs_for_freq(
 			hdd_ctx->pdev,
 			ap_adapter->deflink->session.ap.operating_chan_freq)) {

+ 2 - 2
core/hdd/src/wlan_hdd_nan_datapath.c

@@ -131,7 +131,7 @@ static bool hdd_is_ndp_allowed(struct hdd_context *hdd_ctx)
 		switch (adapter->device_mode) {
 		case QDF_P2P_GO_MODE:
 			if (test_bit(SOFTAP_BSS_STARTED,
-				     &adapter->event_flags)) {
+				     &adapter->deflink->link_flags)) {
 				hdd_adapter_dev_put_debug(adapter, dbgid);
 				if (next_adapter)
 					hdd_adapter_dev_put_debug(next_adapter,
@@ -172,7 +172,7 @@ static bool hdd_is_ndp_allowed(struct hdd_context *hdd_ctx)
 		case QDF_P2P_GO_MODE:
 		case QDF_SAP_MODE:
 			if (test_bit(SOFTAP_BSS_STARTED,
-				     &adapter->event_flags)) {
+				     &adapter->deflink->link_flags)) {
 				hdd_adapter_dev_put_debug(adapter, dbgid);
 				if (next_adapter)
 					hdd_adapter_dev_put_debug(next_adapter,

+ 2 - 1
core/hdd/src/wlan_hdd_power.c

@@ -3407,7 +3407,8 @@ static int __wlan_hdd_cfg80211_get_txpower(struct wiphy *wiphy,
 		break;
 	case QDF_SAP_MODE:
 	case QDF_P2P_GO_MODE:
-		if (!test_bit(SOFTAP_BSS_STARTED, &adapter->event_flags)) {
+		if (!test_bit(SOFTAP_BSS_STARTED,
+			      &adapter->deflink->link_flags)) {
 			hdd_debug("SAP is not started yet");
 			return 0;
 		}

+ 1 - 1
core/hdd/src/wlan_hdd_regulatory.c

@@ -1728,7 +1728,7 @@ static void hdd_restart_sap_with_new_phymode(struct hdd_context *hdd_ctx,
 	hostapd_state = WLAN_HDD_GET_HOSTAP_STATE_PTR(adapter->deflink);
 	sap_ctx = WLAN_HDD_GET_SAP_CTX_PTR(adapter->deflink);
 
-	if (!test_bit(SOFTAP_BSS_STARTED, &adapter->event_flags)) {
+	if (!test_bit(SOFTAP_BSS_STARTED, &adapter->deflink->link_flags)) {
 		sap_config->sap_orig_hw_mode = sap_config->SapHw_mode;
 		sap_config->SapHw_mode = csr_phy_mode;
 		hdd_err("Can't restart AP because it is not started");

+ 7 - 7
core/hdd/src/wlan_hdd_stats.c

@@ -917,12 +917,11 @@ bool hdd_get_interface_info(struct hdd_adapter *adapter,
 		}
 	}
 
-	if ((adapter->device_mode == QDF_SAP_MODE) ||
-	    (adapter->device_mode == QDF_P2P_GO_MODE)) {
-		if (test_bit(SOFTAP_BSS_STARTED, &adapter->event_flags)) {
-			config = &adapter->deflink->session.ap.sap_config;
-			qdf_copy_macaddr(&info->bssid, &config->self_macaddr);
-		}
+	if ((adapter->device_mode == QDF_SAP_MODE ||
+	     adapter->device_mode == QDF_P2P_GO_MODE) &&
+	    test_bit(SOFTAP_BSS_STARTED, &adapter->deflink->link_flags)) {
+		config = &adapter->deflink->session.ap.sap_config;
+		qdf_copy_macaddr(&info->bssid, &config->self_macaddr);
 	}
 	wlan_reg_get_cc_and_src(adapter->hdd_ctx->psoc, info->countryStr);
 	wlan_reg_get_cc_and_src(adapter->hdd_ctx->psoc, info->apCountryStr);
@@ -7139,7 +7138,8 @@ static bool hdd_is_rcpi_applicable(struct hdd_adapter *adapter,
 		}
 	} else if (adapter->device_mode == QDF_SAP_MODE ||
 		   adapter->device_mode == QDF_P2P_GO_MODE) {
-		if (!test_bit(SOFTAP_BSS_STARTED, &adapter->event_flags)) {
+		if (!test_bit(SOFTAP_BSS_STARTED,
+			      &adapter->deflink->link_flags)) {
 			hdd_err("Invalid rcpi request, softap not started");
 			return false;
 		}

+ 1 - 1
core/hdd/src/wlan_hdd_sysfs_channel.c

@@ -48,7 +48,7 @@ static ssize_t __show_channel_number(struct net_device *net_dev, char *buf)
 		goto exit;
 
 	ap_ctx = WLAN_HDD_GET_AP_CTX_PTR(adapter->deflink);
-	if (test_bit(SOFTAP_BSS_STARTED, &adapter->event_flags)) {
+	if (test_bit(SOFTAP_BSS_STARTED, &adapter->deflink->link_flags)) {
 		chan_num = wlan_reg_freq_to_chan(hdd_ctx->pdev,
 						 ap_ctx->operating_chan_freq);
 		ret_val = scnprintf(buf, PAGE_SIZE, "%s    getchannel:%d\n",

+ 10 - 9
core/hdd/src/wlan_hdd_tsf.c

@@ -130,20 +130,21 @@ static inline bool hdd_get_th_sync_status(struct hdd_adapter *adapter)
 static
 enum hdd_tsf_get_state hdd_tsf_check_conn_state(struct hdd_adapter *adapter)
 {
+	enum QDF_OPMODE mode;
 	enum hdd_tsf_get_state ret = TSF_RETURN;
 
-	if (adapter->device_mode == QDF_STA_MODE ||
-	    adapter->device_mode == QDF_P2P_CLIENT_MODE) {
-		if (!hdd_cm_is_vdev_associated(adapter->deflink)) {
-			hdd_err("failed to cap tsf, not connect with ap");
-			ret = TSF_STA_NOT_CONNECTED_NO_TSF;
-		}
-	} else if ((adapter->device_mode == QDF_SAP_MODE ||
-		    adapter->device_mode == QDF_P2P_GO_MODE) &&
-		   !(test_bit(SOFTAP_BSS_STARTED, &adapter->event_flags))) {
+	mode = adapter->device_mode;
+
+	if (!test_bit(SOFTAP_BSS_STARTED, &adapter->deflink->link_flags) &&
+	    (mode == QDF_SAP_MODE || mode == QDF_P2P_GO_MODE)) {
 		hdd_err("Soft AP / P2p GO not beaconing");
 		ret = TSF_SAP_NOT_STARTED_NO_TSF;
+	} else if (!hdd_cm_is_vdev_associated(adapter->deflink) &&
+		   (mode == QDF_STA_MODE || mode == QDF_P2P_CLIENT_MODE)) {
+		hdd_err("failed to cap tsf, not connect with ap");
+		ret = TSF_STA_NOT_CONNECTED_NO_TSF;
 	}
+
 	return ret;
 }