Ver código fonte

qcacld-3.0: Refactor SAP start BSS and other related APIs

Modify the following APIs to pass link info pointer as function
argument to configure SAP on per link basis.
The existing callers moved to deflink.
1) hdd_restart_sap()
2) wlan_hdd_cfg80211_update_apies()
3) wlan_hdd_start_sap()
4) wlan_hdd_cfg80211_start_bss()
5) wlan_hdd_add_sap_obss_scan_ie()

Change-Id: I874650cbce512424c6ab2150817ab6e9e5401683
CRs-Fixed: 3522834
Vinod Kumar Pirla 2 anos atrás
pai
commit
07cbf4ab6f

+ 35 - 8
core/hdd/inc/wlan_hdd_main.h

@@ -3458,7 +3458,17 @@ QDF_STATUS hdd_post_cds_enable_config(struct hdd_context *hdd_ctx);
 QDF_STATUS hdd_abort_mac_scan_all_adapters(struct hdd_context *hdd_ctx);
 
 void wlan_hdd_stop_sap(struct hdd_adapter *ap_adapter);
-void wlan_hdd_start_sap(struct hdd_adapter *ap_adapter, bool reinit);
+
+/**
+ * wlan_hdd_start_sap() - this function starts bss of SAP.
+ * @link_info: Link info pointer in SAP/GO adapter
+ * @reinit: true if this is a re-init, otherwise initial int
+ *
+ * This function will process the starting of sap adapter.
+ *
+ * Return: None
+ */
+void wlan_hdd_start_sap(struct wlan_hdd_link_info *link_info, bool reinit);
 
 #ifdef QCA_CONFIG_SMP
 int wlan_hdd_get_cpu(void);
@@ -3620,11 +3630,23 @@ int wlan_hdd_set_channel(struct wiphy *wiphy,
 		struct net_device *dev,
 		struct cfg80211_chan_def *chandef,
 		enum nl80211_channel_type channel_type);
-int wlan_hdd_cfg80211_start_bss(struct hdd_adapter *adapter,
-		struct cfg80211_beacon_data *params,
-		const u8 *ssid, size_t ssid_len,
-		enum nl80211_hidden_ssid hidden_ssid,
-		bool check_for_concurrency);
+
+/**
+ * wlan_hdd_cfg80211_start_bss() - start bss
+ * @link_info: Link info pointer in hostapd adapter
+ * @params: Pointer to start bss beacon parameters
+ * @ssid: Pointer ssid
+ * @ssid_len: Length of ssid
+ * @hidden_ssid: Hidden SSID parameter
+ * @check_for_concurrency: Flag to indicate if check for concurrency is needed
+ *
+ * Return: 0 for success non-zero for failure
+ */
+int wlan_hdd_cfg80211_start_bss(struct wlan_hdd_link_info *link_info,
+				struct cfg80211_beacon_data *params,
+				const u8 *ssid, size_t ssid_len,
+				enum nl80211_hidden_ssid hidden_ssid,
+				bool check_for_concurrency);
 
 #if !defined(REMOVE_PKT_LOG)
 int hdd_process_pktlog_command(struct hdd_context *hdd_ctx, uint32_t set_value,
@@ -4019,7 +4041,13 @@ bool hdd_is_roaming_in_progress(struct hdd_context *hdd_ctx);
 bool hdd_is_connection_in_progress(uint8_t *out_vdev_id,
 				   enum scan_reject_states *out_reason);
 
-void hdd_restart_sap(struct hdd_adapter *ap_adapter);
+/**
+ * hdd_restart_sap() - to restart SAP in driver internally
+ * @link_info: Link info pointer of SAP adapter
+ *
+ * Return: None
+ */
+void hdd_restart_sap(struct wlan_hdd_link_info *link_info);
 void hdd_check_and_restart_sap_with_non_dfs_acs(void);
 bool hdd_set_connection_in_progress(bool value);
 
@@ -4042,7 +4070,6 @@ void wlan_hdd_init_chan_info(struct hdd_context *hdd_ctx);
  * Return: None
  */
 void wlan_hdd_deinit_chan_info(struct hdd_context *hdd_ctx);
-void wlan_hdd_start_sap(struct hdd_adapter *ap_adapter, bool reinit);
 
 /**
  * hdd_is_any_interface_open() - Check for interface up

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

@@ -114,7 +114,7 @@ wlan_hdd_btc_chain_mode_handler(struct wlan_objmgr_vdev *vdev)
 		break;
 	case QDF_SAP_MODE:
 	case QDF_P2P_GO_MODE:
-		hdd_restart_sap(adapter);
+		hdd_restart_sap(link_info);
 		break;
 	default:
 		break;

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

@@ -1182,7 +1182,7 @@ static void hdd_set_sap_nss_params(struct wlan_hdd_link_info *link_info,
 				   uint8_t tx_nss, uint8_t rx_nss)
 {
 	hdd_update_nss_in_vdev(link_info, mac_handle, tx_nss, rx_nss);
-	hdd_restart_sap(link_info->adapter);
+	hdd_restart_sap(link_info);
 }
 
 QDF_STATUS hdd_update_nss(struct wlan_hdd_link_info *link_info,

+ 5 - 4
core/hdd/src/wlan_hdd_cfg80211.c

@@ -15690,6 +15690,7 @@ __wlan_hdd_cfg80211_sap_configuration_set(struct wiphy *wiphy,
 	uint32_t chan_freq = 0;
 	bool chan_freq_present = false;
 	QDF_STATUS status;
+	struct wlan_hdd_link_info *link_info;
 
 	hdd_enter();
 
@@ -15702,6 +15703,7 @@ __wlan_hdd_cfg80211_sap_configuration_set(struct wiphy *wiphy,
 	if (0 != ret)
 		return -EINVAL;
 
+	link_info = hostapd_adapter->deflink;
 	if (wlan_cfg80211_nla_parse(tb, QCA_WLAN_VENDOR_ATTR_SAP_CONFIG_MAX,
 				    data, data_len,
 				    wlan_hdd_sap_config_policy)) {
@@ -15723,8 +15725,7 @@ __wlan_hdd_cfg80211_sap_configuration_set(struct wiphy *wiphy,
 	}
 
 	if (chan_freq_present) {
-		if (!test_bit(SOFTAP_BSS_STARTED,
-			      &hostapd_adapter->deflink->link_flags)) {
+		if (!test_bit(SOFTAP_BSS_STARTED, &link_info->link_flags)) {
 			hdd_err("SAP is not started yet. Restart sap will be invalid");
 			return -EINVAL;
 		}
@@ -15737,7 +15738,7 @@ __wlan_hdd_cfg80211_sap_configuration_set(struct wiphy *wiphy,
 			return -ENOTSUPP;
 		}
 
-		ap_ctx = WLAN_HDD_GET_AP_CTX_PTR(hostapd_adapter->deflink);
+		ap_ctx = WLAN_HDD_GET_AP_CTX_PTR(link_info);
 		ap_ctx->sap_config.chan_freq = chan_freq;
 		ap_ctx->sap_config.ch_params.ch_width =
 					ap_ctx->sap_config.ch_width_orig;
@@ -15752,7 +15753,7 @@ __wlan_hdd_cfg80211_sap_configuration_set(struct wiphy *wiphy,
 				&ap_ctx->sap_config.ch_params,
 				REG_CURRENT_PWR_MODE);
 
-		hdd_restart_sap(hostapd_adapter);
+		hdd_restart_sap(link_info);
 	}
 
 	if (tb[QCA_WLAN_VENDOR_ATTR_SAP_MANDATORY_FREQUENCY_LIST]) {

+ 7 - 1
core/hdd/src/wlan_hdd_cfg80211.h

@@ -585,7 +585,13 @@ void hdd_send_roam_scan_ch_list_event(struct hdd_context *hdd_ctx,
 }
 #endif
 
-int wlan_hdd_cfg80211_update_apies(struct hdd_adapter *adapter);
+/**
+ * wlan_hdd_cfg80211_update_apies() - update ap mode ies
+ * @link_info: Link info pointer in hostapd adapter
+ *
+ * Return: 0 for success non-zero for failure
+ */
+int wlan_hdd_cfg80211_update_apies(struct wlan_hdd_link_info *link_info);
 
 int wlan_hdd_sap_cfg_dfs_override(struct hdd_adapter *adapter);
 

+ 51 - 56
core/hdd/src/wlan_hdd_hostapd.c

@@ -5092,13 +5092,8 @@ static int hdd_update_11be_apies(struct wlan_hdd_link_info *link_info,
 }
 #endif
 
-/**
- * wlan_hdd_cfg80211_update_apies() - update ap mode ies
- * @adapter: Pointer to hostapd adapter
- *
- * Return: 0 for success non-zero for failure
- */
-int wlan_hdd_cfg80211_update_apies(struct hdd_adapter *adapter)
+int
+wlan_hdd_cfg80211_update_apies(struct wlan_hdd_link_info *link_info)
 {
 	uint8_t *genie;
 	uint16_t total_ielen = 0;
@@ -5109,9 +5104,10 @@ int wlan_hdd_cfg80211_update_apies(struct hdd_adapter *adapter)
 	uint16_t proberesp_ies_len;
 	uint8_t *proberesp_ies = NULL;
 	mac_handle_t mac_handle;
+	struct hdd_adapter *adapter = link_info->adapter;
 
-	config = &adapter->deflink->session.ap.sap_config;
-	beacon = adapter->deflink->session.ap.beacon;
+	config = &link_info->session.ap.sap_config;
+	beacon = link_info->session.ap.beacon;
 	if (!beacon) {
 		hdd_err("Beacon is NULL !");
 		return -EINVAL;
@@ -5128,42 +5124,42 @@ int wlan_hdd_cfg80211_update_apies(struct hdd_adapter *adapter)
 		return -ENOMEM;
 
 	/* Extract and add the extended capabilities and interworking IE */
-	wlan_hdd_add_extra_ie(adapter->deflink, genie, &total_ielen,
+	wlan_hdd_add_extra_ie(link_info, genie, &total_ielen,
 			      WLAN_EID_EXT_CAPABILITY);
 
-	wlan_hdd_add_extra_ie(adapter->deflink, genie, &total_ielen,
+	wlan_hdd_add_extra_ie(link_info, genie, &total_ielen,
 			      WLAN_EID_INTERWORKING);
-	wlan_hdd_add_extra_ie(adapter->deflink, genie, &total_ielen,
+	wlan_hdd_add_extra_ie(link_info, genie, &total_ielen,
 			      WLAN_EID_ADVERTISEMENT_PROTOCOL);
-	wlan_hdd_add_extra_ie(adapter->deflink, genie,
+	wlan_hdd_add_extra_ie(link_info, genie,
 			      &total_ielen, WLAN_ELEMID_RSNXE);
-	wlan_hdd_add_extra_ie(adapter->deflink, genie, &total_ielen,
+	wlan_hdd_add_extra_ie(link_info, genie, &total_ielen,
 			      WLAN_ELEMID_MOBILITY_DOMAIN);
 #ifdef FEATURE_WLAN_WAPI
 	if (QDF_SAP_MODE == adapter->device_mode) {
-		wlan_hdd_add_extra_ie(adapter->deflink, genie, &total_ielen,
+		wlan_hdd_add_extra_ie(link_info, genie, &total_ielen,
 				      WLAN_ELEMID_WAPI);
 	}
 #endif
 	/* extract and add rrm ie from hostapd */
-	wlan_hdd_add_extra_ie(adapter->deflink, genie,
+	wlan_hdd_add_extra_ie(link_info, genie,
 			      &total_ielen, WLAN_ELEMID_RRM);
 
-	wlan_hdd_add_hostapd_conf_vsie(adapter->deflink, genie,
+	wlan_hdd_add_hostapd_conf_vsie(link_info, genie,
 				       &total_ielen);
 
-	ret = hdd_update_11ax_apies(adapter->deflink, genie, &total_ielen);
+	ret = hdd_update_11ax_apies(link_info, genie, &total_ielen);
 	if (ret)
 		goto done;
 
-	ret = hdd_update_11be_apies(adapter->deflink, genie, &total_ielen);
+	ret = hdd_update_11be_apies(link_info, genie, &total_ielen);
 	if (ret)
 		goto done;
 
-	wlan_hdd_add_sap_obss_scan_ie(adapter->deflink, genie, &total_ielen);
+	wlan_hdd_add_sap_obss_scan_ie(link_info, genie, &total_ielen);
 
 	qdf_copy_macaddr(&update_ie.bssid, &adapter->mac_addr);
-	update_ie.vdev_id = adapter->deflink->vdev_id;
+	update_ie.vdev_id = link_info->vdev_id;
 
 	/* Added for Probe Response IE */
 	proberesp_ies = qdf_mem_malloc(beacon->proberesp_ies_len +
@@ -5176,14 +5172,14 @@ int wlan_hdd_cfg80211_update_apies(struct hdd_adapter *adapter)
 		    beacon->proberesp_ies_len);
 	proberesp_ies_len = beacon->proberesp_ies_len;
 
-	wlan_hdd_add_sap_obss_scan_ie(adapter->deflink, proberesp_ies,
+	wlan_hdd_add_sap_obss_scan_ie(link_info, proberesp_ies,
 				      &proberesp_ies_len);
-	wlan_hdd_add_extra_ie(adapter->deflink, proberesp_ies,
+	wlan_hdd_add_extra_ie(link_info, proberesp_ies,
 			      &proberesp_ies_len, WLAN_ELEMID_RSNXE);
-	wlan_hdd_add_extra_ie(adapter->deflink, proberesp_ies,
+	wlan_hdd_add_extra_ie(link_info, proberesp_ies,
 			      &proberesp_ies_len, WLAN_ELEMID_MOBILITY_DOMAIN);
 
-	if (test_bit(SOFTAP_BSS_STARTED, &adapter->deflink->link_flags)) {
+	if (test_bit(SOFTAP_BSS_STARTED, &link_info->link_flags)) {
 		update_ie.ieBufferlength = proberesp_ies_len;
 		update_ie.pAdditionIEBuffer = proberesp_ies;
 		update_ie.append = false;
@@ -5205,7 +5201,7 @@ int wlan_hdd_cfg80211_update_apies(struct hdd_adapter *adapter)
 	}
 
 	/* Assoc resp Add ie Data */
-	if (test_bit(SOFTAP_BSS_STARTED, &adapter->deflink->link_flags)) {
+	if (test_bit(SOFTAP_BSS_STARTED, &link_info->link_flags)) {
 		update_ie.ieBufferlength = beacon->assocresp_ies_len;
 		update_ie.pAdditionIEBuffer = (uint8_t *) beacon->assocresp_ies;
 		update_ie.append = false;
@@ -5226,7 +5222,7 @@ int wlan_hdd_cfg80211_update_apies(struct hdd_adapter *adapter)
 						 eUPDATE_IE_ASSOC_RESP);
 	}
 
-	if (test_bit(SOFTAP_BSS_STARTED, &adapter->deflink->link_flags)) {
+	if (test_bit(SOFTAP_BSS_STARTED, &link_info->link_flags)) {
 		update_ie.ieBufferlength = total_ielen;
 		update_ie.pAdditionIEBuffer = genie;
 		update_ie.append = false;
@@ -6238,7 +6234,7 @@ wlan_hdd_set_multipass(struct wlan_objmgr_vdev *vdev)
 
 /**
  * wlan_hdd_cfg80211_start_bss() - start bss
- * @adapter: Pointer to hostapd adapter
+ * @link_info: Link info pointer in HDD adapter
  * @params: Pointer to start bss beacon parameters
  * @ssid: Pointer ssid
  * @ssid_len: Length of ssid
@@ -6247,12 +6243,13 @@ wlan_hdd_set_multipass(struct wlan_objmgr_vdev *vdev)
  *
  * Return: 0 for success non-zero for failure
  */
-int wlan_hdd_cfg80211_start_bss(struct hdd_adapter *adapter,
-				       struct cfg80211_beacon_data *params,
-				       const u8 *ssid, size_t ssid_len,
-				       enum nl80211_hidden_ssid hidden_ssid,
-				       bool check_for_concurrency)
+int wlan_hdd_cfg80211_start_bss(struct wlan_hdd_link_info *link_info,
+				struct cfg80211_beacon_data *params,
+				const u8 *ssid, size_t ssid_len,
+				enum nl80211_hidden_ssid hidden_ssid,
+				bool check_for_concurrency)
 {
+	struct hdd_adapter *adapter = link_info->adapter;
 	struct sap_config *config;
 	struct hdd_beacon_data *beacon = NULL;
 	struct ieee80211_mgmt *mgmt_frame;
@@ -6297,18 +6294,17 @@ int wlan_hdd_cfg80211_start_bss(struct hdd_adapter *adapter,
 	if (policy_mgr_is_sta_mon_concurrency(hdd_ctx->psoc))
 		return -EINVAL;
 
-	vdev = hdd_objmgr_get_vdev_by_user(adapter->deflink,
-					   WLAN_HDD_ID_OBJ_MGR);
+	vdev = hdd_objmgr_get_vdev_by_user(link_info, WLAN_HDD_ID_OBJ_MGR);
 	if (!vdev)
 		return -EINVAL;
 
-	ap_ctx = WLAN_HDD_GET_AP_CTX_PTR(adapter->deflink);
+	ap_ctx = WLAN_HDD_GET_AP_CTX_PTR(link_info);
 	ucfg_mlme_get_sap_force_11n_for_11ac(hdd_ctx->psoc,
 					     &sap_force_11n_for_11ac);
 	ucfg_mlme_get_go_force_11n_for_11ac(hdd_ctx->psoc,
 					    &go_force_11n_for_11ac);
 
-	if (test_bit(SOFTAP_BSS_STARTED, &adapter->deflink->link_flags))
+	if (test_bit(SOFTAP_BSS_STARTED, &link_info->link_flags))
 		deliver_start_evt = false;
 
 	if (deliver_start_evt) {
@@ -6330,7 +6326,7 @@ int wlan_hdd_cfg80211_start_bss(struct hdd_adapter *adapter,
 		goto free;
 	}
 
-	hostapd_state = WLAN_HDD_GET_HOSTAP_STATE_PTR(adapter->deflink);
+	hostapd_state = WLAN_HDD_GET_HOSTAP_STATE_PTR(link_info);
 
 	config = &ap_ctx->sap_config;
 	if (!config->chan_freq) {
@@ -6503,7 +6499,6 @@ int wlan_hdd_cfg80211_start_bss(struct hdd_adapter *adapter,
 	}
 
 	ap_ctx->encryption_type = eCSR_ENCRYPT_TYPE_NONE;
-
 	config->RSNWPAReqIELength = 0;
 	memset(&config->RSNWPAReqIE[0], 0, sizeof(config->RSNWPAReqIE));
 	ie = wlan_get_ie_ptr_from_eid(WLAN_EID_RSN, beacon->tail,
@@ -6554,7 +6549,7 @@ int wlan_hdd_cfg80211_start_bss(struct hdd_adapter *adapter,
 					   config->akm_list.numEntries);
 
 			hdd_softap_update_pasn_vdev_params(
-					hdd_ctx, adapter->deflink->vdev_id,
+					hdd_ctx, link_info->vdev_id,
 					beacon, mfp_capable, mfp_required);
 		}
 	}
@@ -6730,9 +6725,9 @@ int wlan_hdd_cfg80211_start_bss(struct hdd_adapter *adapter,
 	}
 
 	if (!cds_is_sub_20_mhz_enabled())
-		wlan_hdd_set_sap_hwmode(adapter->deflink);
+		wlan_hdd_set_sap_hwmode(link_info);
 
-	qdf_status = wlan_hdd_mlo_update(adapter->deflink);
+	qdf_status = wlan_hdd_mlo_update(link_info);
 	if (QDF_IS_STATUS_ERROR(qdf_status)) {
 		ret = -EINVAL;
 		goto error;
@@ -6816,7 +6811,7 @@ int wlan_hdd_cfg80211_start_bss(struct hdd_adapter *adapter,
 						config->sec_ch_freq,
 						&config->ch_params,
 						REG_CURRENT_PWR_MODE);
-	if (0 != wlan_hdd_cfg80211_update_apies(adapter)) {
+	if (0 != wlan_hdd_cfg80211_update_apies(link_info)) {
 		hdd_err("SAP Not able to set AP IEs");
 		ret = -EINVAL;
 		goto error;
@@ -6844,7 +6839,7 @@ int wlan_hdd_cfg80211_start_bss(struct hdd_adapter *adapter,
 		goto error;
 	}
 
-	if (test_bit(SOFTAP_BSS_STARTED, &adapter->deflink->link_flags)) {
+	if (test_bit(SOFTAP_BSS_STARTED, &link_info->link_flags)) {
 		mutex_unlock(&hdd_ctx->sap_lock);
 
 		wlansap_reset_sap_config_add_ie(config, eUPDATE_IE_ALL);
@@ -6863,7 +6858,7 @@ int wlan_hdd_cfg80211_start_bss(struct hdd_adapter *adapter,
 					adapter->device_mode),
 				config->chan_freq, HW_MODE_20_MHZ,
 				policy_mgr_get_conc_ext_flags(vdev, false),
-				adapter->deflink->vdev_id)) {
+				link_info->vdev_id)) {
 			mutex_unlock(&hdd_ctx->sap_lock);
 
 			hdd_err("This concurrency combination is not allowed");
@@ -6885,13 +6880,13 @@ int wlan_hdd_cfg80211_start_bss(struct hdd_adapter *adapter,
 	sap_event_callback = hdd_hostapd_sap_event_cb;
 
 	ap_ctx->dfs_cac_block_tx = true;
-	set_bit(SOFTAP_INIT_DONE, &adapter->deflink->link_flags);
+	set_bit(SOFTAP_INIT_DONE, &link_info->link_flags);
 
 	ucfg_dp_set_dfs_cac_tx(vdev, true);
 
 	qdf_event_reset(&hostapd_state->qdf_event);
 
-	sap_ctx = WLAN_HDD_GET_SAP_CTX_PTR(adapter->deflink);
+	sap_ctx = WLAN_HDD_GET_SAP_CTX_PTR(link_info);
 	if (!sap_ctx) {
 		ret = -EINVAL;
 		goto error;
@@ -6924,14 +6919,14 @@ 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->deflink));
+		wlansap_stop_bss(WLAN_HDD_GET_SAP_CTX_PTR(link_info));
 		if (!cds_is_driver_recovering())
 			QDF_ASSERT(0);
 		ret = -EINVAL;
 		goto error;
 	}
 	/* Successfully started Bss update the state bit. */
-	set_bit(SOFTAP_BSS_STARTED, &adapter->deflink->link_flags);
+	set_bit(SOFTAP_BSS_STARTED, &link_info->link_flags);
 
 	mutex_unlock(&hdd_ctx->sap_lock);
 
@@ -6940,14 +6935,14 @@ int wlan_hdd_cfg80211_start_bss(struct hdd_adapter *adapter,
 	if (hostapd_state->bss_state == BSS_START) {
 		policy_mgr_incr_active_session(hdd_ctx->psoc,
 					adapter->device_mode,
-					adapter->deflink->vdev_id);
+					link_info->vdev_id);
 
 		hdd_green_ap_start_state_mc(hdd_ctx, adapter->device_mode,
 					    true);
 		wlan_set_sap_user_config_freq(vdev, user_config_freq);
 	}
 
-	wlan_hdd_dhcp_offload_enable(adapter->deflink);
+	wlan_hdd_dhcp_offload_enable(link_info);
 	ucfg_p2p_status_start_bss(vdev);
 
 	/* Check and restart SAP if it is on unsafe channel */
@@ -6963,13 +6958,13 @@ int wlan_hdd_cfg80211_start_bss(struct hdd_adapter *adapter,
 	goto free;
 
 error:
-	wlan_hdd_mlo_reset(adapter->deflink);
+	wlan_hdd_mlo_reset(link_info);
 	/* Revert the indoor to passive marking if START BSS fails */
 	if (indoor_chnl_marking && adapter->device_mode == QDF_SAP_MODE) {
 		hdd_update_indoor_channel(hdd_ctx, false);
 		sme_update_channel_list(mac_handle);
 	}
-	clear_bit(SOFTAP_INIT_DONE, &adapter->deflink->link_flags);
+	clear_bit(SOFTAP_INIT_DONE, &link_info->link_flags);
 	qdf_atomic_set(&ap_ctx->acs_in_progress, 0);
 	wlansap_reset_sap_config_add_ie(config, eUPDATE_IE_ALL);
 
@@ -7981,7 +7976,7 @@ static int __wlan_hdd_cfg80211_start_ap(struct wiphy *wiphy,
 		hdd_update_he_obss_pd(link_info, params);
 
 		hdd_place_marker(adapter, "TRY TO START", NULL);
-		status = wlan_hdd_cfg80211_start_bss(adapter, &params->beacon,
+		status = wlan_hdd_cfg80211_start_bss(link_info, &params->beacon,
 						     params->ssid,
 						     params->ssid_len,
 						     params->hidden_ssid, true);
@@ -8132,8 +8127,8 @@ static int __wlan_hdd_cfg80211_change_beacon(struct wiphy *wiphy,
 
 	link_info->session.ap.beacon = new;
 	hdd_debug("update beacon for P2P GO/SAP");
-	status = wlan_hdd_cfg80211_start_bss(adapter, params, NULL,
-					0, 0, false);
+	status = wlan_hdd_cfg80211_start_bss(link_info, params,
+					     NULL, 0, 0, false);
 
 	hdd_exit();
 	return status;

+ 24 - 41
core/hdd/src/wlan_hdd_main.c

@@ -17236,27 +17236,15 @@ wlan_hdd_mlo_sap_reinit(struct wlan_hdd_link_info *link_info)
 	return QDF_STATUS_SUCCESS;
 }
 #endif
-/**
- * wlan_hdd_start_sap() - this function starts bss of SAP.
- * @ap_adapter: SAP adapter
- * @reinit: true if this is a re-init, otherwise initial int
- *
- * This function will process the starting of sap adapter.
- *
- * Return: None
- */
-void wlan_hdd_start_sap(struct hdd_adapter *ap_adapter, bool reinit)
+
+void wlan_hdd_start_sap(struct wlan_hdd_link_info *link_info, bool reinit)
 {
 	struct hdd_ap_ctx *ap_ctx;
 	struct hdd_hostapd_state *hostapd_state;
 	QDF_STATUS qdf_status;
 	struct hdd_context *hdd_ctx;
 	struct sap_config *sap_config;
-
-	if (!ap_adapter) {
-		hdd_err("ap_adapter is NULL here");
-		return;
-	}
+	struct hdd_adapter *ap_adapter = link_info->adapter;
 
 	if (QDF_SAP_MODE != ap_adapter->device_mode) {
 		hdd_err("SoftAp role has not been enabled");
@@ -17264,15 +17252,15 @@ void wlan_hdd_start_sap(struct hdd_adapter *ap_adapter, bool reinit)
 	}
 
 	hdd_ctx = WLAN_HDD_GET_CTX(ap_adapter);
-	ap_ctx = WLAN_HDD_GET_AP_CTX_PTR(ap_adapter->deflink);
-	hostapd_state = WLAN_HDD_GET_HOSTAP_STATE_PTR(ap_adapter->deflink);
+	ap_ctx = WLAN_HDD_GET_AP_CTX_PTR(link_info);
+	hostapd_state = WLAN_HDD_GET_HOSTAP_STATE_PTR(link_info);
 	sap_config = &ap_ctx->sap_config;
 
 	mutex_lock(&hdd_ctx->sap_lock);
-	if (test_bit(SOFTAP_BSS_STARTED, &ap_adapter->deflink->link_flags))
+	if (test_bit(SOFTAP_BSS_STARTED, &link_info->link_flags))
 		goto end;
 
-	if (wlan_hdd_cfg80211_update_apies(ap_adapter)) {
+	if (wlan_hdd_cfg80211_update_apies(link_info)) {
 		hdd_err("SAP Not able to set AP IEs");
 		goto end;
 	}
@@ -17280,7 +17268,7 @@ void wlan_hdd_start_sap(struct hdd_adapter *ap_adapter, bool reinit)
 						sap_config->chan_freq, 0,
 						&sap_config->ch_params,
 						REG_CURRENT_PWR_MODE);
-	qdf_status = wlan_hdd_mlo_sap_reinit(ap_adapter->deflink);
+	qdf_status = wlan_hdd_mlo_sap_reinit(link_info);
 	if (QDF_IS_STATUS_ERROR(qdf_status)) {
 		hdd_err("SAP Not able to do mlo attach");
 		goto end;
@@ -17305,11 +17293,11 @@ 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->deflink->link_flags);
+	set_bit(SOFTAP_BSS_STARTED, &link_info->link_flags);
 	if (hostapd_state->bss_state == BSS_START) {
 		policy_mgr_incr_active_session(hdd_ctx->psoc,
 					ap_adapter->device_mode,
-					ap_adapter->deflink->vdev_id);
+					link_info->vdev_id);
 		hdd_green_ap_start_state_mc(hdd_ctx, ap_adapter->device_mode,
 					    true);
 	}
@@ -17317,7 +17305,7 @@ void wlan_hdd_start_sap(struct hdd_adapter *ap_adapter, bool reinit)
 
 	return;
 end:
-	wlan_hdd_mlo_reset(ap_adapter->deflink);
+	wlan_hdd_mlo_reset(link_info);
 	wlansap_reset_sap_config_add_ie(sap_config, eUPDATE_IE_ALL);
 	mutex_unlock(&hdd_ctx->sap_lock);
 	/* SAP context and beacon cleanup will happen during driver unload
@@ -19978,28 +19966,23 @@ bool hdd_is_connection_in_progress(uint8_t *out_vdev_id,
 	return hdd_conn.connection_in_progress;
 }
 
-/**
- * hdd_restart_sap() - to restart SAP in driver internally
- * @ap_adapter: Pointer to SAP struct hdd_adapter structure
- *
- * Return: None
- */
-void hdd_restart_sap(struct hdd_adapter *ap_adapter)
+void hdd_restart_sap(struct wlan_hdd_link_info *link_info)
 {
 	struct hdd_hostapd_state *hapd_state;
 	QDF_STATUS status;
+	struct hdd_adapter *ap_adapter = link_info->adapter;
 	struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(ap_adapter);
 	struct sap_config *sap_config;
 	void *sap_ctx;
 
 	sap_config =
-		&(WLAN_HDD_GET_AP_CTX_PTR(ap_adapter->deflink)->sap_config);
-	sap_ctx = WLAN_HDD_GET_SAP_CTX_PTR(ap_adapter->deflink);
+		&(WLAN_HDD_GET_AP_CTX_PTR(link_info)->sap_config);
+	sap_ctx = WLAN_HDD_GET_SAP_CTX_PTR(link_info);
 
 	mutex_lock(&hdd_ctx->sap_lock);
-	if (test_bit(SOFTAP_BSS_STARTED, &ap_adapter->deflink->link_flags)) {
+	if (test_bit(SOFTAP_BSS_STARTED, &link_info->link_flags)) {
 		wlan_hdd_del_station(ap_adapter, NULL);
-		hapd_state = WLAN_HDD_GET_HOSTAP_STATE_PTR(ap_adapter->deflink);
+		hapd_state = WLAN_HDD_GET_HOSTAP_STATE_PTR(link_info);
 		qdf_event_reset(&hapd_state->qdf_stop_bss_event);
 		if (QDF_STATUS_SUCCESS == wlansap_stop_bss(sap_ctx)) {
 			status = qdf_wait_single_event(&hapd_state->qdf_stop_bss_event,
@@ -20010,19 +19993,19 @@ void hdd_restart_sap(struct hdd_adapter *ap_adapter)
 				goto end;
 			}
 		}
-		clear_bit(SOFTAP_BSS_STARTED, &ap_adapter->deflink->link_flags);
+		clear_bit(SOFTAP_BSS_STARTED, &link_info->link_flags);
 		policy_mgr_decr_session_set_pcl(hdd_ctx->psoc,
-			ap_adapter->device_mode, ap_adapter->deflink->vdev_id);
+			ap_adapter->device_mode, link_info->vdev_id);
 		hdd_green_ap_start_state_mc(hdd_ctx, ap_adapter->device_mode,
 					    false);
 		hdd_err("SAP Stop Success");
 
-		if (0 != wlan_hdd_cfg80211_update_apies(ap_adapter)) {
+		if (0 != wlan_hdd_cfg80211_update_apies(link_info)) {
 			hdd_err("SAP Not able to set AP IEs");
 			goto end;
 		}
 
-		status = wlan_hdd_mlo_sap_reinit(ap_adapter->deflink);
+		status = wlan_hdd_mlo_sap_reinit(link_info);
 		if (QDF_IS_STATUS_ERROR(status)) {
 			hdd_err("SAP Not able to do mlo attach");
 			goto deinit_mlo;
@@ -20046,11 +20029,11 @@ void hdd_restart_sap(struct hdd_adapter *ap_adapter)
 		wlansap_reset_sap_config_add_ie(sap_config, eUPDATE_IE_ALL);
 		hdd_err("SAP Start Success");
 		hdd_medium_assess_init();
-		set_bit(SOFTAP_BSS_STARTED, &ap_adapter->deflink->link_flags);
+		set_bit(SOFTAP_BSS_STARTED, &link_info->link_flags);
 		if (hapd_state->bss_state == BSS_START) {
 			policy_mgr_incr_active_session(hdd_ctx->psoc,
 						ap_adapter->device_mode,
-						ap_adapter->deflink->vdev_id);
+						link_info->vdev_id);
 			hdd_green_ap_start_state_mc(hdd_ctx,
 						    ap_adapter->device_mode,
 						    true);
@@ -20060,7 +20043,7 @@ void hdd_restart_sap(struct hdd_adapter *ap_adapter)
 	return;
 
 deinit_mlo:
-	wlan_hdd_mlo_reset(ap_adapter->deflink);
+	wlan_hdd_mlo_reset(link_info);
 end:
 	wlansap_reset_sap_config_add_ie(sap_config, eUPDATE_IE_ALL);
 	mutex_unlock(&hdd_ctx->sap_lock);

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

@@ -1829,7 +1829,7 @@ static void hdd_ssr_restart_sap(struct hdd_context *hdd_ctx)
 				  adapter->deflink->link_flags,
 				  adapter->dev->name);
 			wlan_hdd_set_twt_responder(hdd_ctx, adapter);
-			wlan_hdd_start_sap(adapter, true);
+			wlan_hdd_start_sap(adapter->deflink, true);
 		}
 next_adapter:
 		hdd_adapter_dev_put_debug(adapter,

+ 12 - 9
core/hdd/src/wlan_hdd_pre_cac.c

@@ -225,6 +225,7 @@ static int __wlan_hdd_request_pre_cac(struct hdd_context *hdd_ctx,
 	mac_handle_t mac_handle;
 	enum phy_ch_width cac_ch_width;
 	struct hdd_adapter_create_param params = {0};
+	struct wlan_hdd_link_info *pre_cac_link_info, *link_info;
 
 	if (!policy_mgr_is_hw_dbs_capable(hdd_ctx->psoc)) {
 		hdd_debug("Pre CAC is not supported on non-dbs platforms");
@@ -238,6 +239,7 @@ static int __wlan_hdd_request_pre_cac(struct hdd_context *hdd_ctx,
 		hdd_err("pre cac not allowed in concurrency");
 		return -EINVAL;
 	}
+	pre_cac_link_info = pre_cac_adapter->deflink;
 
 	ap_adapter = hdd_get_adapter(hdd_ctx, QDF_SAP_MODE);
 	if (!ap_adapter) {
@@ -245,7 +247,8 @@ static int __wlan_hdd_request_pre_cac(struct hdd_context *hdd_ctx,
 		return -EINVAL;
 	}
 
-	hdd_ap_ctx = WLAN_HDD_GET_AP_CTX_PTR(ap_adapter->deflink);
+	link_info = ap_adapter->deflink;
+	hdd_ap_ctx = WLAN_HDD_GET_AP_CTX_PTR(link_info);
 
 	if (qdf_atomic_read(&hdd_ap_ctx->ch_switch_in_progress)) {
 		hdd_err("pre cac not allowed during CSA");
@@ -316,7 +319,7 @@ static int __wlan_hdd_request_pre_cac(struct hdd_context *hdd_ctx,
 		}
 	}
 
-	pre_cac_ap_ctx = WLAN_HDD_GET_AP_CTX_PTR(pre_cac_adapter->deflink);
+	pre_cac_ap_ctx = WLAN_HDD_GET_AP_CTX_PTR(pre_cac_link_info);
 	sap_clear_global_dfs_param(mac_handle, pre_cac_ap_ctx->sap_context);
 
 	/*
@@ -380,7 +383,7 @@ static int __wlan_hdd_request_pre_cac(struct hdd_context *hdd_ctx,
 	 */
 	status = policy_mgr_update_and_wait_for_connection_update(
 					    hdd_ctx->psoc,
-					    ap_adapter->deflink->vdev_id,
+					    link_info->vdev_id,
 					    pre_cac_chan_freq,
 					    POLICY_MGR_UPDATE_REASON_PRE_CAC);
 	if (QDF_IS_STATUS_ERROR(status)) {
@@ -394,8 +397,8 @@ static int __wlan_hdd_request_pre_cac(struct hdd_context *hdd_ctx,
 		goto stop_close_pre_cac_adapter;
 	}
 
-	status = wlan_hdd_cfg80211_start_bss(pre_cac_adapter, NULL,
-					     PRE_CAC_SSID,
+	status = wlan_hdd_cfg80211_start_bss(pre_cac_link_info,
+					     NULL, PRE_CAC_SSID,
 					     qdf_str_len(PRE_CAC_SSID),
 					     NL80211_HIDDEN_SSID_NOT_IN_USE,
 					     false);
@@ -409,16 +412,16 @@ static int __wlan_hdd_request_pre_cac(struct hdd_context *hdd_ctx,
 	 * anywhere, since after the pre cac success/failure, the pre cac
 	 * adapter itself would be removed.
 	 */
-	ret = ucfg_pre_cac_set_status(pre_cac_adapter->deflink->vdev, true);
+	ret = ucfg_pre_cac_set_status(pre_cac_link_info->vdev, true);
 	if (ret != 0) {
 		hdd_err("failed to set pre cac status");
 		goto stop_close_pre_cac_adapter;
 	}
 
-	ucfg_pre_cac_set_freq_before_pre_cac(ap_adapter->deflink->vdev,
+	ucfg_pre_cac_set_freq_before_pre_cac(link_info->vdev,
 					     hdd_ap_ctx->operating_chan_freq);
-	ucfg_pre_cac_set_freq(ap_adapter->deflink->vdev, pre_cac_chan_freq);
-	ucfg_pre_cac_adapter_set(pre_cac_adapter->deflink->vdev, true);
+	ucfg_pre_cac_set_freq(link_info->vdev, pre_cac_chan_freq);
+	ucfg_pre_cac_adapter_set(pre_cac_link_info->vdev, true);
 	*out_adapter = pre_cac_adapter;
 
 	return 0;

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

@@ -908,6 +908,7 @@ static int hdd_son_set_phymode(struct wlan_objmgr_vdev *vdev,
 	QDF_STATUS status;
 	struct hdd_ap_ctx *hdd_ap_ctx;
 	struct sap_config *sap_config;
+	struct wlan_hdd_link_info *link_info;
 
 	if (!vdev) {
 		hdd_err("null vdev");
@@ -916,7 +917,7 @@ static int hdd_son_set_phymode(struct wlan_objmgr_vdev *vdev,
 
 	link_info = wlan_hdd_get_link_info_from_objmgr(vdev);
 	if (!link_info) {
-		hdd_err("null adapter");
+		hdd_err("Invalid VDEV %d", wlan_vdev_get_id(vdev));
 		return -EINVAL;
 	}
 
@@ -936,7 +937,7 @@ static int hdd_son_set_phymode(struct wlan_objmgr_vdev *vdev,
 		return -EINVAL;
 	}
 
-	hdd_restart_sap(adapter);
+	hdd_restart_sap(link_info);
 
 	return 0;
 }