Bladeren bron

qcacld-3.0: Use link_info pointer to get SAP context

As part of single netdev multi vdev changes, AP context is
now per link. To get the SAP context pointer from AP context,
pass link_info pointer instead of adapter.
The existing callers are moved to deflink pointer.

Change-Id: If49ce9dcbf58710d8184dfbef1d0a99567f3111b
CRs-Fixed: 3448342
Vinod Kumar Pirla 2 jaren geleden
bovenliggende
commit
d88f5412f8

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

@@ -1375,8 +1375,8 @@ struct hdd_adapter {
 #define WLAN_HDD_GET_CTX(adapter) ((adapter)->hdd_ctx)
 #define WLAN_HDD_GET_HOSTAP_STATE_PTR(link_info) \
 		(&(WLAN_HDD_GET_AP_CTX_PTR((link_info))->hostapd_state))
-#define WLAN_HDD_GET_SAP_CTX_PTR(adapter) \
-			((adapter)->deflink->session.ap.sap_context)
+#define WLAN_HDD_GET_SAP_CTX_PTR(link_info) \
+		(WLAN_HDD_GET_AP_CTX_PTR((link_info))->sap_context)
 
 #ifdef WLAN_FEATURE_NAN
 #define WLAN_HDD_IS_NDP_ENABLED(hdd_ctx) ((hdd_ctx)->nan_datapath_enabled)

+ 45 - 41
core/hdd/src/wlan_hdd_cfg80211.c

@@ -2281,6 +2281,8 @@ int wlan_hdd_cfg80211_start_acs(struct hdd_adapter *adapter)
 {
 	struct hdd_context *hdd_ctx;
 	struct sap_config *sap_config;
+	struct sap_context *sap_ctx;
+	struct hdd_ap_ctx *ap_ctx;
 	sap_event_cb acs_event_callback;
 	uint8_t mcc_to_scc_switch = 0;
 	int status;
@@ -2295,7 +2297,9 @@ int wlan_hdd_cfg80211_start_acs(struct hdd_adapter *adapter)
 	if (0 != status)
 		return status;
 
-	sap_config = &adapter->deflink->session.ap.sap_config;
+	ap_ctx = WLAN_HDD_GET_AP_CTX_PTR(adapter->deflink);
+	sap_ctx = WLAN_HDD_GET_SAP_CTX_PTR(adapter->deflink);
+	sap_config = &ap_ctx->sap_config;
 	if (!sap_config) {
 		hdd_err("SAP config is NULL");
 		return -EINVAL;
@@ -2314,8 +2318,7 @@ int wlan_hdd_cfg80211_start_acs(struct hdd_adapter *adapter)
 	    mcc_to_scc_switch &&
 	    !(policy_mgr_is_hw_dbs_capable(hdd_ctx->psoc) &&
 	    WLAN_REG_IS_24GHZ_CH_FREQ(sap_config->acs_cfg.end_ch_freq)) &&
-	    !wlansap_dcs_is_wlan_interference_mitigation_enabled(
-					WLAN_HDD_GET_SAP_CTX_PTR(adapter))) {
+	    !wlansap_dcs_is_wlan_interference_mitigation_enabled(sap_ctx)) {
 		status = wlan_hdd_sap_cfg_dfs_override(adapter);
 		if (status < 0)
 			return status;
@@ -2323,9 +2326,8 @@ int wlan_hdd_cfg80211_start_acs(struct hdd_adapter *adapter)
 		if (status > 0) {
 			/*notify hostapd about channel override */
 			wlan_hdd_cfg80211_acs_ch_select_evt(adapter);
-			wlansap_dcs_set_wlan_interference_mitigation_on_band(
-						WLAN_HDD_GET_SAP_CTX_PTR(adapter),
-						sap_config);
+			wlansap_dcs_set_wlan_interference_mitigation_on_band(sap_ctx,
+									     sap_config);
 			return 0;
 		}
 	}
@@ -2367,22 +2369,21 @@ int wlan_hdd_cfg80211_start_acs(struct hdd_adapter *adapter)
 	qdf_mem_copy(sap_config->self_macaddr.bytes,
 		adapter->mac_addr.bytes, sizeof(struct qdf_mac_addr));
 
-	qdf_status = wlansap_acs_chselect(WLAN_HDD_GET_SAP_CTX_PTR(adapter),
-				      acs_event_callback,
-				      sap_config, adapter->dev);
+	qdf_status = wlansap_acs_chselect(sap_ctx, acs_event_callback,
+					  sap_config, adapter->dev);
 
 	if (QDF_IS_STATUS_ERROR(qdf_status)) {
 		hdd_err("ACS channel select failed");
 		return -EINVAL;
 	}
-	if (sap_is_auto_channel_select(WLAN_HDD_GET_SAP_CTX_PTR(adapter)))
+	if (sap_is_auto_channel_select(sap_ctx))
 		sap_config->acs_cfg.acs_mode = true;
 
 	/* If ACS scan is skipped then ACS request would be completed by now,
 	 * so no need to set acs in progress
 	 */
 	if (!sap_config->acs_cfg.skip_acs_scan)
-		qdf_atomic_set(&adapter->deflink->session.ap.acs_in_progress, 1);
+		qdf_atomic_set(&ap_ctx->acs_in_progress, 1);
 
 	return 0;
 }
@@ -3119,11 +3120,11 @@ int hdd_start_vendor_acs(struct hdd_adapter *adapter)
 
 	if (is_acs_support_for_dfs_ltecoex)
 		status = qdf_status_to_os_return(wlan_sap_set_vendor_acs(
-				WLAN_HDD_GET_SAP_CTX_PTR(adapter),
+				WLAN_HDD_GET_SAP_CTX_PTR(adapter->deflink),
 				true));
 	else
 		status = qdf_status_to_os_return(wlan_sap_set_vendor_acs(
-				WLAN_HDD_GET_SAP_CTX_PTR(adapter),
+				WLAN_HDD_GET_SAP_CTX_PTR(adapter->deflink),
 				false));
 
 	return status;
@@ -3339,9 +3340,9 @@ wlan_hdd_handle_single_ch_in_acs_list(struct hdd_context *hdd_ctx,
 	}
 
 	wlan_sap_set_sap_ctx_acs_cfg(
-		WLAN_HDD_GET_SAP_CTX_PTR(adapter), sap_config);
+		WLAN_HDD_GET_SAP_CTX_PTR(adapter->deflink), sap_config);
 	sap_config_acs_result(hdd_ctx->mac_handle,
-			      WLAN_HDD_GET_SAP_CTX_PTR(adapter),
+			      WLAN_HDD_GET_SAP_CTX_PTR(adapter->deflink),
 			    sap_config->acs_cfg.ht_sec_ch_freq);
 	sap_config->ch_params.ch_width =
 			sap_config->acs_cfg.ch_width;
@@ -3364,7 +3365,7 @@ wlan_hdd_handle_single_ch_in_acs_list(struct hdd_context *hdd_ctx,
 	/*notify hostapd about channel override */
 	wlan_hdd_cfg80211_acs_ch_select_evt(adapter);
 	wlansap_dcs_set_wlan_interference_mitigation_on_band(
-		WLAN_HDD_GET_SAP_CTX_PTR(adapter),
+		WLAN_HDD_GET_SAP_CTX_PTR(adapter->deflink),
 		sap_config);
 }
 
@@ -3664,6 +3665,8 @@ static int __wlan_hdd_cfg80211_do_acs(struct wiphy *wiphy,
 	struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(ndev);
 	struct hdd_context *hdd_ctx = wiphy_priv(wiphy);
 	struct sap_config *sap_config;
+	struct sap_context *sap_ctx;
+	struct hdd_ap_ctx *ap_ctx;
 	struct sk_buff *temp_skbuff;
 	int ret, i;
 	struct nlattr *tb[QCA_WLAN_VENDOR_ATTR_ACS_MAX + 1];
@@ -3718,7 +3721,9 @@ static int __wlan_hdd_cfg80211_do_acs(struct wiphy *wiphy,
 		return -EINVAL;
 	}
 
-	if (qdf_atomic_read(&adapter->deflink->session.ap.acs_in_progress) > 0) {
+	ap_ctx = WLAN_HDD_GET_AP_CTX_PTR(adapter->deflink);
+
+	if (qdf_atomic_read(&ap_ctx->acs_in_progress) > 0) {
 		if (wlan_hdd_check_is_acs_request_same(adapter,
 						       data, data_len)) {
 			hdd_debug("Same ACS req as ongoing is received, return success");
@@ -3728,8 +3733,7 @@ static int __wlan_hdd_cfg80211_do_acs(struct wiphy *wiphy,
 		hdd_err("ACS rejected as previous ACS req already in progress");
 		return -EINVAL;
 	} else {
-		qdf_atomic_set(&adapter->deflink->session.ap.acs_in_progress,
-			       1);
+		qdf_atomic_set(&ap_ctx->acs_in_progress, 1);
 		qdf_event_reset(&adapter->acs_complete_event);
 	}
 
@@ -3749,7 +3753,8 @@ static int __wlan_hdd_cfg80211_do_acs(struct wiphy *wiphy,
 		goto out;
 	}
 
-	sap_config = &adapter->deflink->session.ap.sap_config;
+	sap_config = &ap_ctx->sap_config;
+	sap_ctx = WLAN_HDD_GET_SAP_CTX_PTR(adapter->deflink);
 
 	/* Check and free if memory is already allocated for acs channel list */
 	wlan_hdd_undo_acs(adapter);
@@ -3940,9 +3945,8 @@ static int __wlan_hdd_cfg80211_do_acs(struct wiphy *wiphy,
 	    policy_mgr_get_connection_count(hdd_ctx->psoc)) {
 		if (adapter->device_mode == QDF_SAP_MODE)
 			is_vendor_unsafe_ch_present =
-			wlansap_filter_vendor_unsafe_ch_freq(
-					WLAN_HDD_GET_SAP_CTX_PTR(adapter),
-					sap_config);
+				wlansap_filter_vendor_unsafe_ch_freq(sap_ctx,
+								     sap_config);
 		wlan_hdd_trim_acs_channel_list(
 					sap_config->acs_cfg.pcl_chan_freq,
 					sap_config->acs_cfg.pcl_ch_count,
@@ -3971,12 +3975,10 @@ static int __wlan_hdd_cfg80211_do_acs(struct wiphy *wiphy,
 			goto out;
 		}
 	} else if (adapter->device_mode == QDF_SAP_MODE) {
-		wlansap_filter_vendor_unsafe_ch_freq(
-					WLAN_HDD_GET_SAP_CTX_PTR(adapter),
-					sap_config);
+		wlansap_filter_vendor_unsafe_ch_freq(sap_ctx, sap_config);
 		if (sap_config->acs_cfg.ch_list_count == 1) {
-			wlan_hdd_handle_single_ch_in_acs_list(
-					hdd_ctx, adapter, sap_config);
+			wlan_hdd_handle_single_ch_in_acs_list(hdd_ctx, adapter,
+							      sap_config);
 			ret = 0;
 			goto out;
 		} else if (!sap_config->acs_cfg.ch_list_count) {
@@ -4051,7 +4053,7 @@ static int __wlan_hdd_cfg80211_do_acs(struct wiphy *wiphy,
 	sap_dump_acs_channel(&sap_config->acs_cfg);
 
 	qdf_status = ucfg_mlme_get_vendor_acs_support(hdd_ctx->psoc,
-						&is_vendor_acs_support);
+						      &is_vendor_acs_support);
 	if (QDF_IS_STATUS_ERROR(qdf_status))
 		hdd_err("get_vendor_acs_support failed, set default");
 
@@ -4069,7 +4071,7 @@ out:
 		if (temp_skbuff)
 			return wlan_cfg80211_vendor_cmd_reply(temp_skbuff);
 	}
-	qdf_atomic_set(&adapter->deflink->session.ap.acs_in_progress, 0);
+	qdf_atomic_set(&ap_ctx->acs_in_progress, 0);
 
 	return ret;
 }
@@ -4116,7 +4118,7 @@ static int wlan_hdd_cfg80211_do_acs(struct wiphy *wiphy,
  */
 void wlan_hdd_undo_acs(struct hdd_adapter *adapter)
 {
-	sap_undo_acs(WLAN_HDD_GET_SAP_CTX_PTR(adapter),
+	sap_undo_acs(WLAN_HDD_GET_SAP_CTX_PTR(adapter->deflink),
 		     &adapter->deflink->session.ap.sap_config);
 }
 
@@ -15761,20 +15763,21 @@ static int __wlan_hdd_cfg80211_setband(struct wiphy *wiphy,
 static QDF_STATUS wlan_hdd_validate_acs_channel(struct hdd_adapter *adapter,
 						uint32_t chan_freq, int chan_bw)
 {
+	struct sap_context *sap_context;
+
 	if (QDF_STATUS_SUCCESS !=
 	    wlan_hdd_validate_operation_channel(adapter, chan_freq))
 		return QDF_STATUS_E_FAILURE;
 
-	if ((wlansap_is_channel_in_nol_list(WLAN_HDD_GET_SAP_CTX_PTR(adapter),
-				chan_freq,
-				PHY_SINGLE_CHANNEL_CENTERED))) {
+	sap_context = WLAN_HDD_GET_SAP_CTX_PTR(adapter->deflink);
+	if ((wlansap_is_channel_in_nol_list(sap_context, chan_freq,
+					    PHY_SINGLE_CHANNEL_CENTERED))) {
 		hdd_info("channel %d is in nol", chan_freq);
 		return -EINVAL;
 	}
 
-	if ((wlansap_is_channel_leaking_in_nol(
-				WLAN_HDD_GET_SAP_CTX_PTR(adapter),
-				chan_freq, chan_bw))) {
+	if ((wlansap_is_channel_leaking_in_nol(sap_context,
+					       chan_freq, chan_bw))) {
 		hdd_info("channel freq %d is leaking in nol", chan_freq);
 		return -EINVAL;
 	}
@@ -15878,7 +15881,7 @@ static int hdd_update_acs_channel(struct hdd_adapter *adapter, uint8_t reason,
 					   channel_list->pri_chan_freq);
 
 		wlan_sap_update_next_channel(
-			WLAN_HDD_GET_SAP_CTX_PTR(adapter), (uint8_t)ch,
+			WLAN_HDD_GET_SAP_CTX_PTR(adapter->deflink), (uint8_t)ch,
 			hdd_map_nl_chan_width(channel_list->chan_width));
 		status = sme_update_new_channel_event(
 					mac_handle,
@@ -24217,6 +24220,7 @@ __wlan_hdd_cfg80211_update_owe_info(struct wiphy *wiphy,
 	struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
 	QDF_STATUS status;
 	int errno;
+	struct sap_context *sap_ctx;
 
 	hdd_enter_dev(dev);
 
@@ -24234,8 +24238,8 @@ __wlan_hdd_cfg80211_update_owe_info(struct wiphy *wiphy,
 
 	hdd_debug("owe_status %d", owe_info->status);
 
-	status = wlansap_update_owe_info(WLAN_HDD_GET_SAP_CTX_PTR(adapter),
-					 owe_info->peer, owe_info->ie,
+	sap_ctx = WLAN_HDD_GET_SAP_CTX_PTR(adapter->deflink);
+	status = wlansap_update_owe_info(sap_ctx, owe_info->peer, owe_info->ie,
 					 owe_info->ie_len, owe_info->status);
 	if (QDF_IS_STATUS_ERROR(status)) {
 		hdd_err("Failed to update OWE info");
@@ -24583,7 +24587,7 @@ static int __wlan_hdd_cfg80211_set_mac_acl(struct wiphy *wiphy,
 			}
 		}
 		qdf_status = wlansap_set_mac_acl(
-			WLAN_HDD_GET_SAP_CTX_PTR(adapter), config);
+			WLAN_HDD_GET_SAP_CTX_PTR(adapter->deflink), config);
 		if (!QDF_IS_STATUS_SUCCESS(qdf_status)) {
 			hdd_err("SAP Set Mac Acl fail");
 			return -EINVAL;

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

@@ -696,7 +696,7 @@ def_chan:
 				    CSA_REASON_STA_CONNECT_DFS_TO_NON_DFS);
 
 	status = wlansap_set_channel_change_with_csa(
-			WLAN_HDD_GET_SAP_CTX_PTR(ap_adapter), ch_freq,
+			WLAN_HDD_GET_SAP_CTX_PTR(ap_adapter->deflink), ch_freq,
 			ch_bw, false);
 
 	if (QDF_STATUS_SUCCESS != status) {

+ 23 - 23
core/hdd/src/wlan_hdd_dcs.c

@@ -290,7 +290,7 @@ static void hdd_dcs_cb(struct wlan_objmgr_psoc *psoc, uint8_t mac_id,
 		}
 
 		if (wlansap_dcs_is_wlan_interference_mitigation_enabled(
-			WLAN_HDD_GET_SAP_CTX_PTR(adapter))) {
+			WLAN_HDD_GET_SAP_CTX_PTR(adapter->deflink))) {
 			hdd_debug("DCS triggers ACS on vdev_id=%u, mac_id=%u",
 				  list[index], mac_id);
 			/*
@@ -346,7 +346,7 @@ static qdf_freq_t hdd_dcs_afc_sel_chan_cb(void *arg,
 	if (!adapter)
 		return 0;
 
-	sap_ctx = WLAN_HDD_GET_SAP_CTX_PTR(adapter);
+	sap_ctx = WLAN_HDD_GET_SAP_CTX_PTR(adapter->deflink);
 	if (!sap_ctx)
 		return 0;
 
@@ -379,6 +379,7 @@ QDF_STATUS hdd_dcs_hostapd_set_chan(struct hdd_context *hdd_ctx,
 				    qdf_freq_t dcs_ch_freq)
 {
 	struct hdd_ap_ctx *ap_ctx;
+	struct sap_context *sap_ctx;
 	QDF_STATUS status;
 	uint8_t mac_id;
 	uint32_t list[MAX_NUMBER_OF_CONC_CONNECTIONS];
@@ -408,13 +409,12 @@ QDF_STATUS hdd_dcs_hostapd_set_chan(struct hdd_context *hdd_ctx,
 			return QDF_STATUS_E_INVAL;
 		}
 
-		if (adapter->deflink->session.ap.operating_chan_freq !=
-		    dcs_ch_freq)
-			wlansap_dcs_set_vdev_starting(
-				WLAN_HDD_GET_SAP_CTX_PTR(adapter), true);
+		ap_ctx = WLAN_HDD_GET_AP_CTX_PTR(adapter->deflink);
+		sap_ctx = WLAN_HDD_GET_SAP_CTX_PTR(adapter->deflink);
+		if (ap_ctx->operating_chan_freq != dcs_ch_freq)
+			wlansap_dcs_set_vdev_starting(sap_ctx, true);
 		else
-			wlansap_dcs_set_vdev_starting(
-				WLAN_HDD_GET_SAP_CTX_PTR(adapter), false);
+			wlansap_dcs_set_vdev_starting(sap_ctx, false);
 	}
 	for (conn_index = 0; conn_index < count; conn_index++) {
 		adapter = hdd_get_adapter_by_vdev(hdd_ctx, list[conn_index]);
@@ -425,12 +425,10 @@ QDF_STATUS hdd_dcs_hostapd_set_chan(struct hdd_context *hdd_ctx,
 		}
 
 		ap_ctx = WLAN_HDD_GET_AP_CTX_PTR(adapter->deflink);
-
 		if (ap_ctx->operating_chan_freq != dcs_ch_freq) {
 			hdd_ctx->acs_policy.acs_chan_freq = AUTO_CHANNEL_SELECT;
 			hdd_debug("dcs triggers old ch:%d new ch:%d",
-				  ap_ctx->operating_chan_freq,
-				  dcs_ch_freq);
+				  ap_ctx->operating_chan_freq, dcs_ch_freq);
 			wlan_hdd_set_sap_csa_reason(hdd_ctx->psoc,
 						    adapter->deflink->vdev_id,
 						    CSA_REASON_DCS);
@@ -462,6 +460,7 @@ static void hdd_dcs_hostapd_enable_wlan_interference_mitigation(
 	QDF_STATUS status;
 	uint8_t mac_id;
 	struct hdd_adapter *adapter;
+	struct hdd_ap_ctx *ap_ctx;
 
 	status = policy_mgr_get_mac_id_by_session_id(hdd_ctx->psoc, vdev_id,
 						     &mac_id);
@@ -475,10 +474,10 @@ static void hdd_dcs_hostapd_enable_wlan_interference_mitigation(
 		return;
 	}
 
+	ap_ctx = WLAN_HDD_GET_AP_CTX_PTR(adapter->deflink);
 	if (wlansap_dcs_is_wlan_interference_mitigation_enabled(
-			WLAN_HDD_GET_SAP_CTX_PTR(adapter)) &&
-	    !WLAN_REG_IS_24GHZ_CH_FREQ(
-		    adapter->deflink->session.ap.operating_chan_freq))
+			WLAN_HDD_GET_SAP_CTX_PTR(adapter->deflink)) &&
+	    !WLAN_REG_IS_24GHZ_CH_FREQ(ap_ctx->operating_chan_freq))
 		ucfg_config_dcs_event_data(hdd_ctx->psoc, mac_id, true);
 }
 
@@ -487,6 +486,7 @@ void hdd_dcs_chan_select_complete(struct hdd_adapter *adapter)
 	qdf_freq_t dcs_freq;
 	struct hdd_context *hdd_ctx;
 	uint32_t chan_freq;
+	struct hdd_ap_ctx *ap_ctx;
 
 	hdd_ctx = WLAN_HDD_GET_CTX(adapter);
 	if (!hdd_ctx) {
@@ -494,8 +494,9 @@ void hdd_dcs_chan_select_complete(struct hdd_adapter *adapter)
 		return;
 	}
 
-	dcs_freq = wlansap_dcs_get_freq(WLAN_HDD_GET_SAP_CTX_PTR(adapter));
-	chan_freq = adapter->deflink->session.ap.operating_chan_freq;
+	ap_ctx = WLAN_HDD_GET_AP_CTX_PTR(adapter->deflink);
+	dcs_freq = wlansap_dcs_get_freq(ap_ctx->sap_context);
+	chan_freq = ap_ctx->operating_chan_freq;
 	if (dcs_freq && dcs_freq != chan_freq)
 		hdd_dcs_hostapd_set_chan(hdd_ctx, adapter->deflink->vdev_id,
 					 dcs_freq);
@@ -503,7 +504,7 @@ void hdd_dcs_chan_select_complete(struct hdd_adapter *adapter)
 		hdd_dcs_hostapd_enable_wlan_interference_mitigation(
 					hdd_ctx, adapter->deflink->vdev_id);
 
-	qdf_atomic_set(&adapter->deflink->session.ap.acs_in_progress, 0);
+	qdf_atomic_set(&ap_ctx->acs_in_progress, 0);
 }
 
 void hdd_dcs_clear(struct hdd_adapter *adapter)
@@ -513,6 +514,7 @@ void hdd_dcs_clear(struct hdd_adapter *adapter)
 	struct hdd_context *hdd_ctx;
 	struct wlan_objmgr_psoc *psoc;
 	uint32_t list[MAX_NUMBER_OF_CONC_CONNECTIONS];
+	struct sap_context *sap_ctx;
 
 	hdd_ctx = WLAN_HDD_GET_CTX(adapter);
 	if (!hdd_ctx) {
@@ -530,16 +532,14 @@ void hdd_dcs_clear(struct hdd_adapter *adapter)
 		return;
 	}
 
+	sap_ctx = WLAN_HDD_GET_SAP_CTX_PTR(adapter->deflink);
 	if (policy_mgr_get_sap_go_count_on_mac(psoc, list, mac_id) <= 1) {
 		ucfg_config_dcs_disable(psoc, mac_id, WLAN_HOST_DCS_WLANIM);
 		ucfg_wlan_dcs_cmd(psoc, mac_id, true);
-		if (wlansap_dcs_is_wlan_interference_mitigation_enabled(
-					WLAN_HDD_GET_SAP_CTX_PTR(adapter)))
+		if (wlansap_dcs_is_wlan_interference_mitigation_enabled(sap_ctx))
 			ucfg_dcs_clear(psoc, mac_id);
 	}
 
-	wlansap_dcs_set_vdev_wlan_interference_mitigation(
-				WLAN_HDD_GET_SAP_CTX_PTR(adapter), false);
-	wlansap_dcs_set_vdev_starting(
-				WLAN_HDD_GET_SAP_CTX_PTR(adapter), false);
+	wlansap_dcs_set_vdev_wlan_interference_mitigation(sap_ctx, false);
+	wlansap_dcs_set_vdev_starting(sap_ctx, false);
 }

+ 30 - 29
core/hdd/src/wlan_hdd_hostapd.c

@@ -332,7 +332,7 @@ static int hdd_hostapd_deinit_sap_session(struct hdd_adapter *adapter)
 		return -EINVAL;
 	}
 
-	sap_ctx = WLAN_HDD_GET_SAP_CTX_PTR(adapter);
+	sap_ctx = WLAN_HDD_GET_SAP_CTX_PTR(adapter->deflink);
 	if (!sap_ctx) {
 		hdd_debug("sap context already released, nothing to be done");
 		return 0;
@@ -888,7 +888,7 @@ static int hdd_stop_bss_link(struct hdd_adapter *adapter)
 
 	if (test_bit(SOFTAP_BSS_STARTED, &adapter->event_flags)) {
 		status = wlansap_stop_bss(
-			WLAN_HDD_GET_SAP_CTX_PTR(adapter));
+			WLAN_HDD_GET_SAP_CTX_PTR(adapter->deflink));
 		if (QDF_IS_STATUS_SUCCESS(status))
 			hdd_debug("Deleting SAP/P2P link!!!!!!");
 
@@ -1639,14 +1639,17 @@ void hdd_stop_sap_due_to_invalid_channel(struct work_struct *work)
 	struct hdd_adapter *sap_adapter = container_of(work, struct hdd_adapter,
 						       sap_stop_bss_work);
 	struct osif_vdev_sync *vdev_sync;
+	struct sap_context *sap_ctx;
 
 	if (osif_vdev_sync_op_start(sap_adapter->dev, &vdev_sync))
 		return;
 
 	hdd_debug("work started for sap session[%d]",
 		  sap_adapter->deflink->vdev_id);
+
+	sap_ctx = WLAN_HDD_GET_SAP_CTX_PTR(sap_adapter->deflink);
 	wlan_hdd_stop_sap(sap_adapter);
-	wlansap_cleanup_cac_timer(WLAN_HDD_GET_SAP_CTX_PTR(sap_adapter));
+	wlansap_cleanup_cac_timer(sap_ctx);
 	hdd_debug("work finished for sap");
 
 	osif_vdev_sync_op_stop(vdev_sync);
@@ -1773,7 +1776,7 @@ static QDF_STATUS hdd_hostapd_chan_change(struct hdd_adapter *adapter,
 		&sap_ch_param, REG_CURRENT_PWR_MODE);
 
 	phy_mode = wlan_sap_get_phymode(
-			WLAN_HDD_GET_SAP_CTX_PTR(adapter));
+			WLAN_HDD_GET_SAP_CTX_PTR(adapter->deflink));
 
 	switch (phy_mode) {
 	case eCSR_DOT11_MODE_11n:
@@ -2110,8 +2113,7 @@ QDF_STATUS hdd_hostapd_sap_event_cb(struct sap_event *sap_event,
 				hdd_ctx->psoc, adapter->deflink->vdev_id))
 			ignoreCAC = true;
 
-		wlansap_get_dfs_cac_state(mac_handle,
-					  WLAN_HDD_GET_SAP_CTX_PTR(adapter),
+		wlansap_get_dfs_cac_state(mac_handle, ap_ctx->sap_context,
 					  &cac_state);
 
 		/* DFS requirement: DO NOT transmit during CAC. */
@@ -2237,7 +2239,7 @@ QDF_STATUS hdd_hostapd_sap_event_cb(struct sap_event *sap_event,
 		we_event = IWEVCUSTOM;
 		we_custom_event_generic = we_custom_start_event;
 		wlan_hdd_set_tx_flow_info();
-		sap_ctx = WLAN_HDD_GET_SAP_CTX_PTR(adapter);
+		sap_ctx = WLAN_HDD_GET_SAP_CTX_PTR(adapter->deflink);
 		if (!sap_ctx) {
 			hdd_err("sap ctx is null");
 			return QDF_STATUS_E_FAILURE;
@@ -2905,7 +2907,7 @@ QDF_STATUS hdd_hostapd_sap_event_cb(struct sap_event *sap_event,
 		cdp_hl_fc_set_td_limit(cds_get_context(QDF_MODULE_ID_SOC),
 				       adapter->deflink->vdev_id,
 				       ap_ctx->operating_chan_freq);
-		sap_ctx = WLAN_HDD_GET_SAP_CTX_PTR(adapter);
+		sap_ctx = WLAN_HDD_GET_SAP_CTX_PTR(adapter->deflink);
 		if (!sap_ctx) {
 			hdd_err("sap ctx is null");
 			return QDF_STATUS_E_FAILURE;
@@ -2949,7 +2951,7 @@ QDF_STATUS hdd_hostapd_sap_event_cb(struct sap_event *sap_event,
 		} else {
 			wlan_hdd_cfg80211_acs_ch_select_evt(adapter);
 			wlansap_dcs_set_wlan_interference_mitigation_on_band(
-					WLAN_HDD_GET_SAP_CTX_PTR(adapter),
+					WLAN_HDD_GET_SAP_CTX_PTR(adapter->deflink),
 					&ap_ctx->sap_config);
 		}
 
@@ -3326,7 +3328,7 @@ int hdd_softap_set_channel_change(struct net_device *dev, int target_chan_freq,
 	if (adapter->device_mode != QDF_SAP_MODE &&
 	    adapter->device_mode != QDF_P2P_GO_MODE)
 		return -EINVAL;
-	sap_ctx = WLAN_HDD_GET_SAP_CTX_PTR(adapter);
+	sap_ctx = WLAN_HDD_GET_SAP_CTX_PTR(adapter->deflink);
 	if (!sap_ctx)
 		return -EINVAL;
 	/*
@@ -3497,7 +3499,7 @@ int hdd_softap_set_channel_change(struct net_device *dev, int target_chan_freq,
 	strict = strict || forced;
 	hdd_place_marker(adapter, "CHANNEL CHANGE", NULL);
 	status = wlansap_set_channel_change_with_csa(
-		WLAN_HDD_GET_SAP_CTX_PTR(adapter),
+		WLAN_HDD_GET_SAP_CTX_PTR(adapter->deflink),
 		target_chan_freq,
 		target_bw,
 		strict);
@@ -3577,7 +3579,7 @@ void hdd_stop_sap_set_tx_power(struct wlan_objmgr_psoc *psoc,
 	}
 
 	restriction_mask = wlan_hdd_get_sap_restriction_mask(hdd_ctx);
-	sap_ctx = WLAN_HDD_GET_SAP_CTX_PTR(adapter);
+	sap_ctx = WLAN_HDD_GET_SAP_CTX_PTR(adapter->deflink);
 	chan_freq = sap_ctx->chan_freq;
 	unsafe_ch_list = &psoc_priv_obj->unsafe_chan_list;
 
@@ -3681,7 +3683,7 @@ QDF_STATUS wlan_hdd_check_cc_intf_cb(struct wlan_objmgr_psoc *psoc,
 		return QDF_STATUS_E_FAILURE;
 	}
 
-	sap_context = WLAN_HDD_GET_SAP_CTX_PTR(ap_adapter);
+	sap_context = WLAN_HDD_GET_SAP_CTX_PTR(ap_adapter->deflink);
 	if (!sap_context) {
 		hdd_err("sap_context is null");
 		return QDF_STATUS_E_FAILURE;
@@ -3708,7 +3710,7 @@ void wlan_hdd_set_sap_csa_reason(struct wlan_objmgr_psoc *psoc, uint8_t vdev_id,
 		hdd_err("ap adapter is NULL");
 		return;
 	}
-	sap_ctx = WLAN_HDD_GET_SAP_CTX_PTR(ap_adapter);
+	sap_ctx = WLAN_HDD_GET_SAP_CTX_PTR(ap_adapter->deflink);
 	if (sap_ctx)
 		sap_ctx->csa_reason = reason;
 	hdd_nofl_debug("set csa reason %d %s vdev %d",
@@ -6766,7 +6768,7 @@ int wlan_hdd_cfg80211_start_bss(struct hdd_adapter *adapter,
 
 	qdf_event_reset(&hostapd_state->qdf_event);
 
-	sap_ctx = WLAN_HDD_GET_SAP_CTX_PTR(adapter);
+	sap_ctx = WLAN_HDD_GET_SAP_CTX_PTR(adapter->deflink);
 	if (!sap_ctx) {
 		ret = -EINVAL;
 		goto error;
@@ -6799,7 +6801,7 @@ int wlan_hdd_cfg80211_start_bss(struct hdd_adapter *adapter,
 				hostapd_state->qdf_status);
 		hdd_set_connection_in_progress(false);
 		sme_get_command_q_status(mac_handle);
-		wlansap_stop_bss(WLAN_HDD_GET_SAP_CTX_PTR(adapter));
+		wlansap_stop_bss(WLAN_HDD_GET_SAP_CTX_PTR(adapter->deflink));
 		if (!cds_is_driver_recovering())
 			QDF_ASSERT(0);
 		ret = -EINVAL;
@@ -6914,9 +6916,12 @@ static int __wlan_hdd_cfg80211_stop_ap(struct wiphy *wiphy,
 	tSirUpdateIE update_ie;
 	int ret;
 	mac_handle_t mac_handle;
+	struct hdd_ap_ctx *ap_ctx;
 
 	hdd_enter_dev(dev);
 
+	ap_ctx = WLAN_HDD_GET_AP_CTX_PTR(adapter->deflink);
+
 	ret = wlan_hdd_validate_context(hdd_ctx);
 	/*
 	 * In case of SSR and other FW down cases, validate context will
@@ -6970,9 +6975,9 @@ static int __wlan_hdd_cfg80211_stop_ap(struct wiphy *wiphy,
 	}
 
 	cds_flush_work(&adapter->sap_stop_bss_work);
-	adapter->deflink->session.ap.sap_config.acs_cfg.acs_mode = false;
+	ap_ctx->sap_config.acs_cfg.acs_mode = false;
 	hdd_dcs_clear(adapter);
-	qdf_atomic_set(&adapter->deflink->session.ap.acs_in_progress, 0);
+	qdf_atomic_set(&ap_ctx->acs_in_progress, 0);
 	hdd_debug("Disabling queues");
 	wlan_hdd_netif_queue_control(adapter,
 				     WLAN_STOP_ALL_NETIF_QUEUE_N_CARRIER,
@@ -6987,7 +6992,7 @@ static int __wlan_hdd_cfg80211_stop_ap(struct wiphy *wiphy,
 
 		hdd_place_marker(adapter, "TRY TO STOP", NULL);
 		qdf_event_reset(&hostapd_state->qdf_stop_bss_event);
-		status = wlansap_stop_bss(WLAN_HDD_GET_SAP_CTX_PTR(adapter));
+		status = wlansap_stop_bss(ap_ctx->sap_context);
 		if (QDF_IS_STATUS_SUCCESS(status)) {
 			qdf_status =
 				qdf_wait_single_event(&hostapd_state->
@@ -7020,10 +7025,8 @@ static int __wlan_hdd_cfg80211_stop_ap(struct wiphy *wiphy,
 			hdd_err("Stopping the BSS failed");
 			goto exit;
 		}
-		if (adapter->deflink->session.ap.beacon) {
-			qdf_mem_free(adapter->deflink->session.ap.beacon);
-			adapter->deflink->session.ap.beacon = NULL;
-		}
+		qdf_mem_free(ap_ctx->beacon);
+		ap_ctx->beacon = NULL;
 	} else {
 		hdd_debug("SAP already down");
 		mutex_unlock(&hdd_ctx->sap_lock);
@@ -7068,10 +7071,8 @@ static int __wlan_hdd_cfg80211_stop_ap(struct wiphy *wiphy,
 					    FTM_TIME_SYNC_BSS_STOPPED);
 
 exit:
-	if (adapter->deflink->session.ap.beacon) {
-		qdf_mem_free(adapter->deflink->session.ap.beacon);
-		adapter->deflink->session.ap.beacon = NULL;
-	}
+	qdf_mem_free(ap_ctx->beacon);
+	ap_ctx->beacon = NULL;
 	if (QDF_IS_STATUS_SUCCESS(status))
 		hdd_place_marker(adapter, "STOP with SUCCESS", NULL);
 	else
@@ -7239,7 +7240,7 @@ wlan_hdd_get_sap_ch_params(struct hdd_context *hdd_ctx,
 	if (!adapter)
 		return QDF_STATUS_E_INVAL;
 
-	if (!wlan_sap_get_ch_params(WLAN_HDD_GET_SAP_CTX_PTR(adapter),
+	if (!wlan_sap_get_ch_params(WLAN_HDD_GET_SAP_CTX_PTR(adapter->deflink),
 				    ch_params))
 		wlan_reg_set_channel_params_for_pwrmode(hdd_ctx->pdev, freq, 0,
 							ch_params,
@@ -8112,7 +8113,7 @@ void hdd_sap_indicate_disconnect_for_sta(struct hdd_adapter *adapter)
 
 	hdd_enter();
 
-	sap_ctx = WLAN_HDD_GET_SAP_CTX_PTR(adapter);
+	sap_ctx = WLAN_HDD_GET_SAP_CTX_PTR(adapter->deflink);
 	if (!sap_ctx) {
 		hdd_err("invalid sap context");
 		return;

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

@@ -75,7 +75,7 @@ static int hdd_sap_get_chan_width(struct hdd_adapter *adapter, int *value)
 		return -EINVAL;
 	}
 
-	sap_ctx = WLAN_HDD_GET_SAP_CTX_PTR(adapter);
+	sap_ctx = WLAN_HDD_GET_SAP_CTX_PTR(adapter->deflink);
 
 	*value = wlansap_get_chan_width(sap_ctx);
 	hdd_debug("chan_width = %d", *value);
@@ -307,7 +307,7 @@ static QDF_STATUS hdd_print_acl(struct hdd_adapter *adapter)
 	uint16_t listnum;
 	struct sap_context *sap_ctx;
 
-	sap_ctx = WLAN_HDD_GET_SAP_CTX_PTR(adapter);
+	sap_ctx = WLAN_HDD_GET_SAP_CTX_PTR(adapter->deflink);
 	qdf_mem_zero(&maclist[0], sizeof(maclist));
 	if (QDF_STATUS_SUCCESS == wlansap_get_acl_mode(sap_ctx, &acl_mode)) {
 		pr_info("******** ACL MODE *********\n");
@@ -395,7 +395,7 @@ static __iw_softap_setparam(struct net_device *dev,
 
 	case QCSAP_PARAM_CLR_ACL:
 		if (QDF_STATUS_SUCCESS != wlansap_clear_acl(
-		    WLAN_HDD_GET_SAP_CTX_PTR(adapter))) {
+		    WLAN_HDD_GET_SAP_CTX_PTR(adapter->deflink))) {
 			ret = -EIO;
 		}
 		break;
@@ -407,7 +407,7 @@ static __iw_softap_setparam(struct net_device *dev,
 			ret = -EINVAL;
 		} else {
 			wlansap_set_acl_mode(
-				WLAN_HDD_GET_SAP_CTX_PTR(adapter),
+				WLAN_HDD_GET_SAP_CTX_PTR(adapter->deflink),
 				set_value);
 		}
 		break;
@@ -872,7 +872,7 @@ static __iw_softap_setparam(struct net_device *dev,
 		break;
 	case QCASAP_SET_DFS_NOL:
 		wlansap_set_dfs_nol(
-			WLAN_HDD_GET_SAP_CTX_PTR(adapter),
+			WLAN_HDD_GET_SAP_CTX_PTR(adapter->deflink),
 			(eSapDfsNolType) set_value);
 		break;
 
@@ -1466,7 +1466,7 @@ int __iw_softap_modify_acl(struct net_device *dev,
 	       QDF_MAC_ADDR_REF(peer_mac), list_type, cmd);
 
 	qdf_status = wlansap_modify_acl(
-		WLAN_HDD_GET_SAP_CTX_PTR(adapter),
+		WLAN_HDD_GET_SAP_CTX_PTR(adapter->deflink),
 		peer_mac, (eSapACLType) list_type, (eSapACLCmdType) cmd);
 	if (!QDF_IS_STATUS_SUCCESS(qdf_status)) {
 		hdd_err("Modify ACL failed");
@@ -2111,7 +2111,7 @@ int __iw_get_genie(struct net_device *dev,
 	 * (We previously sent it down in the CSR Roam Profile.)
 	 */
 	status = wlan_sap_getstation_ie_information(
-		WLAN_HDD_GET_SAP_CTX_PTR(adapter),
+		WLAN_HDD_GET_SAP_CTX_PTR(adapter->deflink),
 		&length, genIeBytes);
 	if (status == QDF_STATUS_SUCCESS) {
 		wrqu->data.length = length;
@@ -2177,7 +2177,7 @@ __iw_softap_stopbss(struct net_device *dev,
 
 		qdf_event_reset(&hostapd_state->qdf_stop_bss_event);
 		status = wlansap_stop_bss(
-			WLAN_HDD_GET_SAP_CTX_PTR(adapter));
+			WLAN_HDD_GET_SAP_CTX_PTR(adapter->deflink));
 		if (QDF_IS_STATUS_SUCCESS(status)) {
 			status = qdf_wait_single_event(&hostapd_state->
 					qdf_stop_bss_event,

+ 13 - 15
core/hdd/src/wlan_hdd_main.c

@@ -8634,8 +8634,7 @@ QDF_STATUS hdd_stop_adapter_ext(struct hdd_context *hdd_ctx,
 				WLAN_HDD_GET_HOSTAP_STATE_PTR(adapter->deflink);
 
 			qdf_event_reset(&hostapd_state->qdf_stop_bss_event);
-			status = wlansap_stop_bss(
-					WLAN_HDD_GET_SAP_CTX_PTR(adapter));
+			status = wlansap_stop_bss(ap_ctx->sap_context);
 
 			if (QDF_IS_STATUS_SUCCESS(status)) {
 				status = qdf_wait_single_event(
@@ -8708,7 +8707,7 @@ QDF_STATUS hdd_stop_adapter_ext(struct hdd_context *hdd_ctx,
 #ifdef WLAN_NS_OFFLOAD
 		cancel_work_sync(&adapter->ipv6_notifier_work);
 #endif
-		sap_release_vdev_ref(WLAN_HDD_GET_SAP_CTX_PTR(adapter));
+		sap_release_vdev_ref(ap_ctx->sap_context);
 
 		if (adapter->device_mode == QDF_SAP_MODE) {
 			ucfg_ipa_flush_pending_vdev_events(
@@ -12214,8 +12213,8 @@ QDF_STATUS hdd_unsafe_channel_restart_sap(struct hdd_context *hdd_ctxt)
 		if (!restart_freq) {
 			restart_freq =
 				wlansap_get_safe_channel_from_pcl_and_acs_range(
-					WLAN_HDD_GET_SAP_CTX_PTR(adapter),
-					&ch_width);
+				    WLAN_HDD_GET_SAP_CTX_PTR(adapter->deflink),
+				    &ch_width);
 		}
 		if (!restart_freq) {
 			wlan_hdd_set_sap_csa_reason(hdd_ctxt->psoc,
@@ -12331,7 +12330,7 @@ static void hdd_lte_coex_restart_sap(struct hdd_adapter *adapter,
 	uint32_t restart_freq;
 
 	restart_freq = wlansap_get_safe_channel_from_pcl_and_acs_range(
-				WLAN_HDD_GET_SAP_CTX_PTR(adapter),
+				WLAN_HDD_GET_SAP_CTX_PTR(adapter->deflink),
 				NULL);
 
 	restart_chan = wlan_reg_freq_to_chan(hdd_ctx->pdev,
@@ -12549,6 +12548,7 @@ void hdd_acs_response_timeout_handler(void *context)
 	struct hdd_adapter *adapter;
 	struct hdd_context *hdd_ctx;
 	uint8_t reason;
+	struct sap_context *sap_context;
 
 	hdd_enter();
 	if (!timer_context) {
@@ -12576,17 +12576,16 @@ void hdd_acs_response_timeout_handler(void *context)
 	hdd_err("ACS timeout happened for %s reason %d",
 				adapter->dev->name, reason);
 
+	sap_context = WLAN_HDD_GET_SAP_CTX_PTR(adapter->deflink);
 	switch (reason) {
 	/* SAP init case */
 	case QCA_WLAN_VENDOR_ACS_SELECT_REASON_INIT:
-		wlan_sap_set_vendor_acs(WLAN_HDD_GET_SAP_CTX_PTR(adapter),
-					false);
+		wlan_sap_set_vendor_acs(sap_context, false);
 		wlan_hdd_cfg80211_start_acs(adapter);
 		break;
 	/* DFS detected on current channel */
 	case QCA_WLAN_VENDOR_ACS_SELECT_REASON_DFS:
-		wlan_sap_update_next_channel(
-				WLAN_HDD_GET_SAP_CTX_PTR(adapter), 0, 0);
+		wlan_sap_update_next_channel(sap_context, 0, 0);
 		sme_update_new_channel_event(hdd_ctx->mac_handle,
 					     adapter->deflink->vdev_id);
 		break;
@@ -12596,7 +12595,6 @@ void hdd_acs_response_timeout_handler(void *context)
 		break;
 	default:
 		hdd_info("invalid reason for timer invoke");
-
 	}
 }
 
@@ -13612,7 +13610,7 @@ int hdd_start_ap_adapter(struct hdd_adapter *adapter)
 		goto sap_destroy_ctx;
 	}
 
-	sap_ctx = WLAN_HDD_GET_SAP_CTX_PTR(adapter);
+	sap_ctx = WLAN_HDD_GET_SAP_CTX_PTR(adapter->deflink);
 	status = sap_acquire_vdev_ref(hdd_ctx->psoc, sap_ctx,
 				      adapter->deflink->vdev_id);
 	if (!QDF_IS_STATUS_SUCCESS(status)) {
@@ -16555,7 +16553,7 @@ QDF_STATUS hdd_softap_sta_deauth(struct hdd_adapter *adapter,
 			return qdf_status;
 
 	qdf_status =
-		wlansap_deauth_sta(WLAN_HDD_GET_SAP_CTX_PTR(adapter),
+		wlansap_deauth_sta(WLAN_HDD_GET_SAP_CTX_PTR(adapter->deflink),
 				   param);
 
 	hdd_exit();
@@ -16580,7 +16578,7 @@ void hdd_softap_sta_disassoc(struct hdd_adapter *adapter,
 	if (param->peerMacAddr.bytes[0] & 0x1)
 		return;
 
-	wlansap_disassoc_sta(WLAN_HDD_GET_SAP_CTX_PTR(adapter),
+	wlansap_disassoc_sta(WLAN_HDD_GET_SAP_CTX_PTR(adapter->deflink),
 			     param);
 }
 
@@ -19881,7 +19879,7 @@ void hdd_check_and_restart_sap_with_non_dfs_acs(void)
 
 		restart_freq =
 			wlansap_get_safe_channel_from_pcl_and_acs_range(
-				WLAN_HDD_GET_SAP_CTX_PTR(ap_adapter),
+				WLAN_HDD_GET_SAP_CTX_PTR(ap_adapter->deflink),
 				NULL);
 
 		restart_chan = wlan_reg_freq_to_chan(hdd_ctx->pdev,

+ 18 - 23
core/hdd/src/wlan_hdd_pre_cac.c

@@ -75,7 +75,7 @@ static void wlan_hdd_pre_cac_success(struct hdd_adapter *adapter)
 	}
 
 	pre_cac_ch_width = wlansap_get_chan_width(
-				WLAN_HDD_GET_SAP_CTX_PTR(adapter));
+				WLAN_HDD_GET_SAP_CTX_PTR(adapter->deflink));
 
 	hdd_stop_adapter(hdd_ctx, adapter);
 
@@ -216,7 +216,7 @@ static int __wlan_hdd_request_pre_cac(struct hdd_context *hdd_ctx,
 	uint32_t pre_cac_chan_freq = 0;
 	int ret;
 	struct hdd_adapter *ap_adapter, *pre_cac_adapter;
-	struct hdd_ap_ctx *hdd_ap_ctx;
+	struct hdd_ap_ctx *hdd_ap_ctx, *pre_cac_ap_ctx;
 	QDF_STATUS status;
 	struct wiphy *wiphy;
 	struct net_device *dev;
@@ -320,8 +320,8 @@ static int __wlan_hdd_request_pre_cac(struct hdd_context *hdd_ctx,
 		}
 	}
 
-	sap_clear_global_dfs_param(mac_handle,
-				   WLAN_HDD_GET_SAP_CTX_PTR(pre_cac_adapter));
+	pre_cac_ap_ctx = WLAN_HDD_GET_AP_CTX_PTR(pre_cac_adapter->deflink);
+	sap_clear_global_dfs_param(mac_handle, pre_cac_ap_ctx->sap_context);
 
 	/*
 	 * This interface is internally created by the driver. So, no interface
@@ -342,18 +342,15 @@ static int __wlan_hdd_request_pre_cac(struct hdd_context *hdd_ctx,
 	 * other active SAP interface. In regular scenarios, these IEs would
 	 * come from the user space entity
 	 */
-	pre_cac_adapter->deflink->session.ap.beacon = qdf_mem_malloc(
-			sizeof(*ap_adapter->deflink->session.ap.beacon));
-	if (!pre_cac_adapter->deflink->session.ap.beacon)
+	pre_cac_ap_ctx->beacon = qdf_mem_malloc(sizeof(*hdd_ap_ctx->beacon));
+	if (!pre_cac_ap_ctx->beacon)
 		goto stop_close_pre_cac_adapter;
 
-	qdf_mem_copy(pre_cac_adapter->deflink->session.ap.beacon,
-		     ap_adapter->deflink->session.ap.beacon,
-		     sizeof(*pre_cac_adapter->deflink->session.ap.beacon));
-	pre_cac_adapter->deflink->session.ap.sap_config.ch_width_orig =
-		ap_adapter->deflink->session.ap.sap_config.ch_width_orig;
-	pre_cac_adapter->deflink->session.ap.sap_config.authType =
-			ap_adapter->deflink->session.ap.sap_config.authType;
+	qdf_mem_copy(pre_cac_ap_ctx->beacon, hdd_ap_ctx->beacon,
+		     sizeof(*pre_cac_ap_ctx->beacon));
+	pre_cac_ap_ctx->sap_config.authType = hdd_ap_ctx->sap_config.authType;
+	pre_cac_ap_ctx->sap_config.ch_width_orig =
+					hdd_ap_ctx->sap_config.ch_width_orig;
 
 	/* The original premise is that on moving from 2.4GHz to 5GHz, the SAP
 	 * will continue to operate on the same bandwidth as that of the 2.4GHz
@@ -362,23 +359,21 @@ static int __wlan_hdd_request_pre_cac(struct hdd_context *hdd_ctx,
 	 * Hence use max possible supported BW based on phymode configurated
 	 * on SAP.
 	 */
-	cac_ch_width = wlansap_get_max_bw_by_phymode(
-			WLAN_HDD_GET_SAP_CTX_PTR(ap_adapter));
+	cac_ch_width = wlansap_get_max_bw_by_phymode(hdd_ap_ctx->sap_context);
 	if (cac_ch_width > DEFAULT_PRE_CAC_BANDWIDTH)
 		cac_ch_width = DEFAULT_PRE_CAC_BANDWIDTH;
 
 	qdf_mem_zero(&chandef, sizeof(struct cfg80211_chan_def));
-	if (wlan_set_def_pre_cac_chan(hdd_ctx, pre_cac_chan_freq,
-				      &chandef, &channel_type,
-				      &cac_ch_width)) {
+	if (wlan_set_def_pre_cac_chan(hdd_ctx, pre_cac_chan_freq, &chandef,
+				      &channel_type, &cac_ch_width)) {
 		hdd_err("error set pre_cac channel %d", pre_cac_chan_freq);
 		goto close_pre_cac_adapter;
 	}
-	pre_cac_adapter->deflink->session.ap.sap_config.ch_width_orig =
+	pre_cac_ap_ctx->sap_config.ch_width_orig =
 					hdd_map_nl_chan_width(chandef.width);
 
 	hdd_debug("existing ap phymode:%d pre cac ch_width:%d freq:%d",
-		  ap_adapter->deflink->session.ap.sap_config.SapHw_mode,
+		  hdd_ap_ctx->sap_config.SapHw_mode,
 		  cac_ch_width, pre_cac_chan_freq);
 	/*
 	 * Doing update after opening and starting pre-cac adapter will make
@@ -434,8 +429,8 @@ static int __wlan_hdd_request_pre_cac(struct hdd_context *hdd_ctx,
 
 stop_close_pre_cac_adapter:
 	hdd_stop_adapter(hdd_ctx, pre_cac_adapter);
-	qdf_mem_free(pre_cac_adapter->deflink->session.ap.beacon);
-	pre_cac_adapter->deflink->session.ap.beacon = NULL;
+	qdf_mem_free(pre_cac_ap_ctx->beacon);
+	pre_cac_ap_ctx->beacon = NULL;
 close_pre_cac_adapter:
 	hdd_close_adapter(hdd_ctx, pre_cac_adapter, false);
 release_intf_addr_and_return_failure:

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

@@ -1718,7 +1718,7 @@ static void hdd_restart_sap_with_new_phymode(struct hdd_context *hdd_ctx,
 	QDF_STATUS status;
 
 	hostapd_state = WLAN_HDD_GET_HOSTAP_STATE_PTR(adapter->deflink);
-	sap_ctx = WLAN_HDD_GET_SAP_CTX_PTR(adapter);
+	sap_ctx = WLAN_HDD_GET_SAP_CTX_PTR(adapter->deflink);
 
 	if (!test_bit(SOFTAP_BSS_STARTED, &adapter->event_flags)) {
 		sap_config->sap_orig_hw_mode = sap_config->SapHw_mode;

+ 26 - 27
core/hdd/src/wlan_hdd_son.c

@@ -728,7 +728,7 @@ static int hdd_son_set_candidate_freq(struct wlan_objmgr_vdev *vdev,
 		return -EINVAL;
 	}
 
-	sap_ctx = WLAN_HDD_GET_SAP_CTX_PTR(adapter);
+	sap_ctx = WLAN_HDD_GET_SAP_CTX_PTR(adapter->deflink);
 	if (!sap_ctx) {
 		hdd_err("null sap_ctx");
 		return -EINVAL;
@@ -765,7 +765,7 @@ static qdf_freq_t hdd_son_get_candidate_freq(struct wlan_objmgr_vdev *vdev)
 		return freq;
 	}
 
-	sap_ctx = WLAN_HDD_GET_SAP_CTX_PTR(adapter);
+	sap_ctx = WLAN_HDD_GET_SAP_CTX_PTR(adapter->deflink);
 	if (!sap_ctx) {
 		hdd_err("null sap_ctx");
 		return freq;
@@ -1194,6 +1194,7 @@ static QDF_STATUS hdd_son_set_acl_policy(struct wlan_objmgr_vdev *vdev,
 {
 	struct hdd_adapter *adapter;
 	QDF_STATUS status = QDF_STATUS_E_INVAL;
+	struct sap_context *sap_context;
 
 	if (!vdev) {
 		hdd_err("null vdev");
@@ -1205,22 +1206,22 @@ static QDF_STATUS hdd_son_set_acl_policy(struct wlan_objmgr_vdev *vdev,
 		return status;
 	}
 
+	sap_context = WLAN_HDD_GET_SAP_CTX_PTR(adapter->deflink);
 	switch (son_acl_policy) {
 	case IEEE80211_MACCMD_POLICY_OPEN:
-		status = wlansap_set_acl_mode(WLAN_HDD_GET_SAP_CTX_PTR(adapter),
-					      eSAP_ALLOW_ALL);
+		status = wlansap_set_acl_mode(sap_context, eSAP_ALLOW_ALL);
 		break;
 	case IEEE80211_MACCMD_POLICY_ALLOW:
-		status = wlansap_set_acl_mode(WLAN_HDD_GET_SAP_CTX_PTR(adapter),
+		status = wlansap_set_acl_mode(sap_context,
 					      eSAP_DENY_UNLESS_ACCEPTED);
 		break;
 	case IEEE80211_MACCMD_POLICY_DENY:
-		status = wlansap_set_acl_mode(WLAN_HDD_GET_SAP_CTX_PTR(adapter),
+		status = wlansap_set_acl_mode(sap_context,
 					      eSAP_ACCEPT_UNLESS_DENIED);
 		break;
 	case IEEE80211_MACCMD_FLUSH:
 	case IEEE80211_MACCMD_DETACH:
-		status = wlansap_clear_acl(WLAN_HDD_GET_SAP_CTX_PTR(adapter));
+		status = wlansap_clear_acl(sap_context);
 		break;
 	default:
 		hdd_err("invalid son acl policy %d", son_acl_policy);
@@ -1281,7 +1282,8 @@ static ieee80211_acl_cmd hdd_son_get_acl_policy(struct wlan_objmgr_vdev *vdev)
 		return son_acl_policy;
 	}
 
-	wlansap_get_acl_mode(WLAN_HDD_GET_SAP_CTX_PTR(adapter), &acl_policy);
+	wlansap_get_acl_mode(WLAN_HDD_GET_SAP_CTX_PTR(adapter->deflink),
+			     &acl_policy);
 
 	son_acl_policy = hdd_acl_policy_to_son_acl_policy(acl_policy);
 
@@ -1302,6 +1304,7 @@ static int hdd_son_add_acl_mac(struct wlan_objmgr_vdev *vdev,
 	QDF_STATUS qdf_status;
 	eSapMacAddrACL acl_policy;
 	struct hdd_adapter *adapter;
+	struct sap_context *sap_context;
 
 	if (!vdev) {
 		hdd_err("null vdev");
@@ -1317,7 +1320,8 @@ static int hdd_son_add_acl_mac(struct wlan_objmgr_vdev *vdev,
 		return -EINVAL;
 	}
 
-	wlansap_get_acl_mode(WLAN_HDD_GET_SAP_CTX_PTR(adapter), &acl_policy);
+	sap_context = WLAN_HDD_GET_SAP_CTX_PTR(adapter->deflink);
+	wlansap_get_acl_mode(sap_context, &acl_policy);
 
 	if (acl_policy == eSAP_ACCEPT_UNLESS_DENIED) {
 		list_type = SAP_DENY_LIST;
@@ -1327,8 +1331,7 @@ static int hdd_son_add_acl_mac(struct wlan_objmgr_vdev *vdev,
 		hdd_err("Invalid ACL policy %d.", acl_policy);
 		return -EINVAL;
 	}
-	qdf_status = wlansap_modify_acl(WLAN_HDD_GET_SAP_CTX_PTR(adapter),
-					acl_mac->bytes, list_type,
+	qdf_status = wlansap_modify_acl(sap_context, acl_mac->bytes, list_type,
 					ADD_STA_TO_ACL_NO_DEAUTH);
 	if (QDF_IS_STATUS_ERROR(qdf_status)) {
 		hdd_err("Modify ACL failed");
@@ -1368,7 +1371,7 @@ static int hdd_son_del_acl_mac(struct wlan_objmgr_vdev *vdev,
 		return -EINVAL;
 	}
 
-	sap_ctx = WLAN_HDD_GET_SAP_CTX_PTR(adapter);
+	sap_ctx = WLAN_HDD_GET_SAP_CTX_PTR(adapter->deflink);
 	if (!sap_ctx) {
 		hdd_err("null sap ctx");
 		return -EINVAL;
@@ -1465,6 +1468,7 @@ static void hdd_son_modify_acl(struct wlan_objmgr_vdev *vdev,
 {
 	QDF_STATUS status;
 	struct hdd_adapter *adapter = wlan_hdd_get_adapter_from_objmgr(vdev);
+	struct sap_context *sap_context;
 
 	if (!adapter) {
 		hdd_err("null adapter");
@@ -1472,24 +1476,19 @@ static void hdd_son_modify_acl(struct wlan_objmgr_vdev *vdev,
 	}
 	hdd_debug("Peer - " QDF_MAC_ADDR_FMT " Allow Auth - %u",
 		  QDF_MAC_ADDR_REF(peer_mac), allow_auth);
+
+	sap_context = WLAN_HDD_GET_SAP_CTX_PTR(adapter->deflink);
 	if (allow_auth) {
-		status = wlansap_modify_acl(WLAN_HDD_GET_SAP_CTX_PTR(adapter),
-					    peer_mac,
-					    SAP_DENY_LIST,
-					    DELETE_STA_FROM_ACL);
-		status = wlansap_modify_acl(WLAN_HDD_GET_SAP_CTX_PTR(adapter),
-					    peer_mac,
-					    SAP_ALLOW_LIST,
-					    ADD_STA_TO_ACL);
+		status = wlansap_modify_acl(sap_context, peer_mac,
+					    SAP_DENY_LIST, DELETE_STA_FROM_ACL);
+		status = wlansap_modify_acl(sap_context, peer_mac,
+					    SAP_ALLOW_LIST, ADD_STA_TO_ACL);
 	} else {
-		status = wlansap_modify_acl(WLAN_HDD_GET_SAP_CTX_PTR(adapter),
-					    peer_mac,
+		status = wlansap_modify_acl(sap_context, peer_mac,
 					    SAP_ALLOW_LIST,
 					    DELETE_STA_FROM_ACL);
-		status = wlansap_modify_acl(WLAN_HDD_GET_SAP_CTX_PTR(adapter),
-					    peer_mac,
-					    SAP_DENY_LIST,
-					    ADD_STA_TO_ACL);
+		status = wlansap_modify_acl(sap_context, peer_mac,
+					    SAP_DENY_LIST, ADD_STA_TO_ACL);
 	}
 }
 
@@ -2217,7 +2216,7 @@ static int hdd_son_get_acs_report(struct wlan_objmgr_vdev *vdev,
 		ret = -ENOMEM;
 		goto end;
 	}
-	sap_ctx = WLAN_HDD_GET_SAP_CTX_PTR(adapter);
+	sap_ctx = WLAN_HDD_GET_SAP_CTX_PTR(adapter->deflink);
 	acs_cfg = &adapter->deflink->session.ap.sap_config.acs_cfg;
 	if (!acs_cfg->freq_list &&
 	    (hdd_son_init_acs_channels(adapter, hdd_ctx,

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

@@ -98,7 +98,7 @@ __hdd_sysfs_dfsnol_store(struct net_device *net_dev,
 	if (!wlan_hdd_validate_modules_state(hdd_ctx))
 		return -EINVAL;
 
-	sap_ctx = WLAN_HDD_GET_SAP_CTX_PTR(adapter);
+	sap_ctx = WLAN_HDD_GET_SAP_CTX_PTR(adapter->deflink);
 	if (!sap_ctx) {
 		hdd_err_rl("Null SAP Context");
 		return -EINVAL;

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

@@ -1,5 +1,6 @@
 /*
  * Copyright (c) 2011-2020, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2023 Qualcomm Innovation Center, Inc. All rights reserved.
  *
  * Permission to use, copy, modify, and/or distribute this software for any
  * purpose with or without fee is hereby granted, provided that the above
@@ -94,7 +95,7 @@ static ssize_t __hdd_sysfs_modify_acl_store(
 		  QDF_MAC_ADDR_REF(peer_mac), list_type, cmd_type);
 
 	qdf_status = wlansap_modify_acl(
-		WLAN_HDD_GET_SAP_CTX_PTR(adapter),
+		WLAN_HDD_GET_SAP_CTX_PTR(adapter->deflink),
 		peer_mac, list_type, cmd_type);
 	if (!QDF_IS_STATUS_SUCCESS(qdf_status)) {
 		hdd_err("Modify ACL failed");