Browse Source

qcacld-3.0: Use link_info pointer to get hostapd context

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

Change-Id: I01ef675de40779b386b72a033e76806488bc36e7
CRs-Fixed: 3447737
Vinod Kumar Pirla 2 years ago
parent
commit
0c086574b1

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

@@ -1373,8 +1373,8 @@ struct hdd_adapter {
 #define WLAN_HDD_GET_STATION_CTX_PTR(link_info) (&(link_info)->session.station)
 #define WLAN_HDD_GET_AP_CTX_PTR(link_info) (&(link_info)->session.ap)
 #define WLAN_HDD_GET_CTX(adapter) ((adapter)->hdd_ctx)
-#define WLAN_HDD_GET_HOSTAP_STATE_PTR(adapter) \
-				(&(adapter)->deflink->session.ap.hostapd_state)
+#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)
 

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

@@ -21329,7 +21329,7 @@ static int wlan_hdd_add_key_sap(struct hdd_adapter *adapter,
 	struct wlan_objmgr_vdev *vdev;
 	int errno = 0;
 	struct hdd_hostapd_state *hostapd_state =
-		WLAN_HDD_GET_HOSTAP_STATE_PTR(adapter);
+		WLAN_HDD_GET_HOSTAP_STATE_PTR(adapter->deflink);
 
 	vdev = hdd_objmgr_get_vdev_by_user(adapter, WLAN_OSIF_ID);
 	if (!vdev)
@@ -23324,7 +23324,7 @@ int __wlan_hdd_cfg80211_del_station(struct wiphy *wiphy,
 	    QDF_P2P_GO_MODE != adapter->device_mode)
 		goto fn_end;
 
-	hapd_state = WLAN_HDD_GET_HOSTAP_STATE_PTR(adapter);
+	hapd_state = WLAN_HDD_GET_HOSTAP_STATE_PTR(adapter->deflink);
 	if (!hapd_state) {
 		hdd_err("Hostapd State is Null");
 		return 0;
@@ -24483,7 +24483,7 @@ static int __wlan_hdd_cfg80211_set_mac_acl(struct wiphy *wiphy,
 	if (0 != status)
 		return status;
 
-	hostapd_state = WLAN_HDD_GET_HOSTAP_STATE_PTR(adapter);
+	hostapd_state = WLAN_HDD_GET_HOSTAP_STATE_PTR(adapter->deflink);
 
 	if (!hostapd_state) {
 		hdd_err("hostapd_state is Null");
@@ -24935,7 +24935,7 @@ static int __wlan_hdd_cfg80211_channel_switch(struct wiphy *wiphy,
 	hdd_debug("Freq %d width %d ch_width %d",
 		  csa_params->chandef.chan->center_freq,
 		  csa_params->chandef.width, ch_width);
-	hostapd_state = WLAN_HDD_GET_HOSTAP_STATE_PTR(adapter);
+	hostapd_state = WLAN_HDD_GET_HOSTAP_STATE_PTR(adapter->deflink);
 	qdf_event_reset(&hostapd_state->qdf_event);
 
 	ret =

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

@@ -690,7 +690,7 @@ def_chan:
 			  ch_bw);
 	}
 
-	hostapd_state = WLAN_HDD_GET_HOSTAP_STATE_PTR(ap_adapter);
+	hostapd_state = WLAN_HDD_GET_HOSTAP_STATE_PTR(ap_adapter->deflink);
 	qdf_event_reset(&hostapd_state->qdf_event);
 	wlan_hdd_set_sap_csa_reason(hdd_ctx->psoc, ap_adapter->deflink->vdev_id,
 				    CSA_REASON_STA_CONNECT_DFS_TO_NON_DFS);

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

@@ -373,7 +373,7 @@ static void hdd_hostapd_channel_allow_suspend(struct hdd_adapter *adapter,
 
 	struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
 	struct hdd_hostapd_state *hostapd_state =
-		WLAN_HDD_GET_HOSTAP_STATE_PTR(adapter);
+		WLAN_HDD_GET_HOSTAP_STATE_PTR(adapter->deflink);
 
 	hdd_debug("bss_state: %d, chan_freq: %d, dfs_ref_cnt: %d",
 		  hostapd_state->bss_state, chan_freq,
@@ -411,7 +411,7 @@ static void hdd_hostapd_channel_prevent_suspend(struct hdd_adapter *adapter,
 {
 	struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
 	struct hdd_hostapd_state *hostapd_state =
-		WLAN_HDD_GET_HOSTAP_STATE_PTR(adapter);
+		WLAN_HDD_GET_HOSTAP_STATE_PTR(adapter->deflink);
 
 	hdd_debug("bss_state: %d, chan_freq: %d, dfs_ref_cnt: %d",
 		  hostapd_state->bss_state, chan_freq,
@@ -2042,7 +2042,7 @@ QDF_STATUS hdd_hostapd_sap_event_cb(struct sap_event *sap_event,
 		return QDF_STATUS_E_FAILURE;
 	}
 
-	hostapd_state = WLAN_HDD_GET_HOSTAP_STATE_PTR(adapter);
+	hostapd_state = WLAN_HDD_GET_HOSTAP_STATE_PTR(adapter->deflink);
 	ap_ctx = WLAN_HDD_GET_AP_CTX_PTR(adapter->deflink);
 
 	if (!sap_event) {
@@ -4209,7 +4209,7 @@ QDF_STATUS hdd_init_ap_mode(struct hdd_adapter *adapter, bool reinit)
 					 acs_with_more_param);
 
 	/* Allocate the Wireless Extensions state structure */
-	phostapdBuf = WLAN_HDD_GET_HOSTAP_STATE_PTR(adapter);
+	phostapdBuf = WLAN_HDD_GET_HOSTAP_STATE_PTR(adapter->deflink);
 
 	ap_pwr_type = wlan_reg_decide_6g_ap_pwr_type(hdd_ctx->pdev);
 	hdd_debug("selecting AP power type %d", ap_pwr_type);
@@ -5620,7 +5620,7 @@ hdd_handle_acs_2g_preferred_sap_conc(struct wlan_objmgr_psoc *psoc,
 
 	wlan_hdd_set_sap_csa_reason(psoc, go_vdev_id,
 				    CSA_REASON_SAP_ACS);
-	hostapd_state = WLAN_HDD_GET_HOSTAP_STATE_PTR(go_adapter);
+	hostapd_state = WLAN_HDD_GET_HOSTAP_STATE_PTR(go_adapter->deflink);
 	qdf_event_reset(&hostapd_state->qdf_event);
 
 	ret = hdd_softap_set_channel_change(go_adapter->dev, go_new_ch_freq,
@@ -5720,7 +5720,7 @@ hdd_handle_p2p_go_for_3rd_ap_conc(struct wlan_objmgr_psoc *psoc,
 
 	wlan_hdd_set_sap_csa_reason(psoc, go_vdev_id,
 				    CSA_REASON_SAP_FIX_CH_CONC_WITH_GO);
-	hostapd_state = WLAN_HDD_GET_HOSTAP_STATE_PTR(go_adapter);
+	hostapd_state = WLAN_HDD_GET_HOSTAP_STATE_PTR(go_adapter->deflink);
 	qdf_event_reset(&hostapd_state->qdf_event);
 
 	ret = hdd_softap_set_channel_change(go_adapter->dev, go_new_ch_freq,
@@ -6205,7 +6205,7 @@ int wlan_hdd_cfg80211_start_bss(struct hdd_adapter *adapter,
 		goto free;
 	}
 
-	hostapd_state = WLAN_HDD_GET_HOSTAP_STATE_PTR(adapter);
+	hostapd_state = WLAN_HDD_GET_HOSTAP_STATE_PTR(adapter->deflink);
 
 	config = &ap_ctx->sap_config;
 	if (!config->chan_freq) {
@@ -6983,7 +6983,7 @@ static int __wlan_hdd_cfg80211_stop_ap(struct wiphy *wiphy,
 	mutex_lock(&hdd_ctx->sap_lock);
 	if (test_bit(SOFTAP_BSS_STARTED, &adapter->event_flags)) {
 		struct hdd_hostapd_state *hostapd_state =
-			WLAN_HDD_GET_HOSTAP_STATE_PTR(adapter);
+			WLAN_HDD_GET_HOSTAP_STATE_PTR(adapter->deflink);
 
 		hdd_place_marker(adapter, "TRY TO STOP", NULL);
 		qdf_event_reset(&hostapd_state->qdf_stop_bss_event);

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

@@ -68,7 +68,7 @@ static int hdd_sap_get_chan_width(struct hdd_adapter *adapter, int *value)
 	struct hdd_hostapd_state *hostapdstate;
 
 	hdd_enter();
-	hostapdstate = WLAN_HDD_GET_HOSTAP_STATE_PTR(adapter);
+	hostapdstate = WLAN_HDD_GET_HOSTAP_STATE_PTR(adapter->deflink);
 
 	if (hostapdstate->bss_state != BSS_START) {
 		*value = -EINVAL;
@@ -2173,7 +2173,7 @@ __iw_softap_stopbss(struct net_device *dev,
 
 	if (test_bit(SOFTAP_BSS_STARTED, &adapter->event_flags)) {
 		struct hdd_hostapd_state *hostapd_state =
-			WLAN_HDD_GET_HOSTAP_STATE_PTR(adapter);
+			WLAN_HDD_GET_HOSTAP_STATE_PTR(adapter->deflink);
 
 		qdf_event_reset(&hostapd_state->qdf_stop_bss_event);
 		status = wlansap_stop_bss(

+ 6 - 4
core/hdd/src/wlan_hdd_main.c

@@ -8631,7 +8631,7 @@ QDF_STATUS hdd_stop_adapter_ext(struct hdd_context *hdd_ctx,
 		mutex_lock(&hdd_ctx->sap_lock);
 		if (test_bit(SOFTAP_BSS_STARTED, &adapter->event_flags)) {
 			struct hdd_hostapd_state *hostapd_state =
-				WLAN_HDD_GET_HOSTAP_STATE_PTR(adapter);
+				WLAN_HDD_GET_HOSTAP_STATE_PTR(adapter->deflink);
 
 			qdf_event_reset(&hostapd_state->qdf_stop_bss_event);
 			status = wlansap_stop_bss(
@@ -16966,7 +16966,8 @@ void wlan_hdd_stop_sap(struct hdd_adapter *ap_adapter)
 	mutex_lock(&hdd_ctx->sap_lock);
 	if (test_bit(SOFTAP_BSS_STARTED, &ap_adapter->event_flags)) {
 		wlan_hdd_del_station(ap_adapter, NULL);
-		hostapd_state = WLAN_HDD_GET_HOSTAP_STATE_PTR(ap_adapter);
+		hostapd_state =
+			WLAN_HDD_GET_HOSTAP_STATE_PTR(ap_adapter->deflink);
 		hdd_debug("Now doing SAP STOPBSS");
 		qdf_event_reset(&hostapd_state->qdf_stop_bss_event);
 		if (QDF_STATUS_SUCCESS == wlansap_stop_bss(hdd_ap_ctx->
@@ -17063,7 +17064,7 @@ void wlan_hdd_start_sap(struct hdd_adapter *ap_adapter, bool reinit)
 
 	hdd_ctx = WLAN_HDD_GET_CTX(ap_adapter);
 	hdd_ap_ctx = WLAN_HDD_GET_AP_CTX_PTR(ap_adapter->deflink);
-	hostapd_state = WLAN_HDD_GET_HOSTAP_STATE_PTR(ap_adapter);
+	hostapd_state = WLAN_HDD_GET_HOSTAP_STATE_PTR(ap_adapter->deflink);
 	sap_config = &ap_adapter->deflink->session.ap.sap_config;
 
 	mutex_lock(&hdd_ctx->sap_lock);
@@ -19758,7 +19759,8 @@ void hdd_restart_sap(struct hdd_adapter *ap_adapter)
 	mutex_lock(&hdd_ctx->sap_lock);
 	if (test_bit(SOFTAP_BSS_STARTED, &ap_adapter->event_flags)) {
 		wlan_hdd_del_station(ap_adapter, NULL);
-		hostapd_state = WLAN_HDD_GET_HOSTAP_STATE_PTR(ap_adapter);
+		hostapd_state =
+			WLAN_HDD_GET_HOSTAP_STATE_PTR(ap_adapter->deflink);
 		qdf_event_reset(&hostapd_state->qdf_stop_bss_event);
 		if (QDF_STATUS_SUCCESS == wlansap_stop_bss(sap_ctx)) {
 			qdf_status = qdf_wait_single_event(

+ 12 - 17
core/hdd/src/wlan_hdd_power.c

@@ -2529,6 +2529,7 @@ static int __wlan_hdd_cfg80211_suspend_wlan(struct wiphy *wiphy,
 	enum pmo_suspend_mode mode;
 	int rc;
 	wlan_net_dev_ref_dbgid dbgid = NET_DEV_HOLD_CFG80211_SUSPEND_WLAN;
+	struct hdd_ap_ctx *ap_ctx;
 	struct hdd_hostapd_state *hapd_state;
 	struct csr_del_sta_params params = {
 		.peerMacAddr = QDF_MAC_ADDR_BCAST_INIT,
@@ -2581,11 +2582,11 @@ static int __wlan_hdd_cfg80211_suspend_wlan(struct wiphy *wiphy,
 		}
 
 		if (QDF_SAP_MODE == adapter->device_mode) {
-			if (BSS_START ==
-			    WLAN_HDD_GET_HOSTAP_STATE_PTR(adapter)->bss_state &&
-			    true ==
-			    WLAN_HDD_GET_AP_CTX_PTR(adapter->deflink)->
-			    dfs_cac_block_tx) {
+			hapd_state =
+				WLAN_HDD_GET_HOSTAP_STATE_PTR(adapter->deflink);
+			ap_ctx = WLAN_HDD_GET_AP_CTX_PTR(adapter->deflink);
+			if (BSS_START == hapd_state->bss_state &&
+			    true == ap_ctx->dfs_cac_block_tx) {
 				hdd_err("RADAR detection in progress, do not allow suspend");
 				wlan_hdd_inc_suspend_stats(hdd_ctx,
 							   SUSPEND_FAIL_RADAR);
@@ -2607,14 +2608,12 @@ static int __wlan_hdd_cfg80211_suspend_wlan(struct wiphy *wiphy,
 				return -EOPNOTSUPP;
 			} else if (ucfg_pmo_get_disconnect_sap_tdls_in_wow(
 				   hdd_ctx->psoc)) {
-				hapd_state =
-					WLAN_HDD_GET_HOSTAP_STATE_PTR(adapter);
-				if (hapd_state)
-					hdd_softap_deauth_all_sta(adapter,
-								  hapd_state,
-								  &params);
+				hdd_softap_deauth_all_sta(adapter, hapd_state,
+							  &params);
 			}
 		} else if (QDF_P2P_GO_MODE == adapter->device_mode) {
+			hapd_state =
+				WLAN_HDD_GET_HOSTAP_STATE_PTR(adapter->deflink);
 			if (!ucfg_pmo_get_enable_sap_suspend(
 				   hdd_ctx->psoc)) {
 				/* return -EOPNOTSUPP if GO does not support
@@ -2628,12 +2627,8 @@ static int __wlan_hdd_cfg80211_suspend_wlan(struct wiphy *wiphy,
 				return -EOPNOTSUPP;
 			} else if (ucfg_pmo_get_disconnect_sap_tdls_in_wow(
 				   hdd_ctx->psoc)) {
-				hapd_state =
-					WLAN_HDD_GET_HOSTAP_STATE_PTR(adapter);
-				if (hapd_state)
-					hdd_softap_deauth_all_sta(adapter,
-								  hapd_state,
-								  &params);
+				hdd_softap_deauth_all_sta(adapter, hapd_state,
+							  &params);
 			}
 		} else if (QDF_TDLS_MODE == adapter->device_mode &&
 			   ucfg_pmo_get_disconnect_sap_tdls_in_wow(

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

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

+ 16 - 35
core/hdd/src/wlan_hdd_tx_rx.c

@@ -1639,9 +1639,10 @@ void wlan_hdd_set_tx_flow_info(void)
 {
 	struct hdd_adapter *adapter, *next_adapter = NULL;
 	struct hdd_station_ctx *sta_ctx;
-	struct hdd_ap_ctx *hdd_ap_ctx;
+	struct hdd_ap_ctx *ap_ctx;
 	struct hdd_hostapd_state *hostapd_state;
-	uint8_t sta_channel = 0, p2p_channel = 0, ap_channel = 0;
+	uint8_t sta_chan = 0, ap_chan = 0;
+	uint32_t chan_freq;
 	struct hdd_context *hdd_ctx;
 	uint8_t target_channel = 0;
 	uint8_t pre_adp_channel = 0;
@@ -1656,47 +1657,27 @@ void wlan_hdd_set_tx_flow_info(void)
 					   dbgid) {
 		switch (adapter->device_mode) {
 		case QDF_STA_MODE:
-			sta_ctx =
-				WLAN_HDD_GET_STATION_CTX_PTR(adapter->deflink);
-			if (hdd_cm_is_vdev_associated(adapter)) {
-				sta_channel = wlan_reg_freq_to_chan(
-						hdd_ctx->pdev,
-						sta_ctx->conn_info.chan_freq);
-				target_channel = sta_channel;
-			}
-			break;
 		case QDF_P2P_CLIENT_MODE:
 			sta_ctx =
 				WLAN_HDD_GET_STATION_CTX_PTR(adapter->deflink);
 			if (hdd_cm_is_vdev_associated(adapter)) {
-				p2p_channel = wlan_reg_freq_to_chan(
-					hdd_ctx->pdev,
-					sta_ctx->conn_info.chan_freq);
-				target_channel = p2p_channel;
-			}
-			break;
-		case QDF_P2P_GO_MODE:
-			hdd_ap_ctx = WLAN_HDD_GET_AP_CTX_PTR(adapter->deflink);
-			hostapd_state = WLAN_HDD_GET_HOSTAP_STATE_PTR(adapter);
-			if (hostapd_state->bss_state == BSS_START &&
-			    hostapd_state->qdf_status ==
-			    QDF_STATUS_SUCCESS) {
-				p2p_channel = wlan_reg_freq_to_chan(
-					hdd_ctx->pdev,
-					hdd_ap_ctx->operating_chan_freq);
-				target_channel = p2p_channel;
+				chan_freq = sta_ctx->conn_info.chan_freq;
+				sta_chan = wlan_reg_freq_to_chan(hdd_ctx->pdev,
+								 chan_freq);
+				target_channel = sta_chan;
 			}
 			break;
 		case QDF_SAP_MODE:
-			hdd_ap_ctx = WLAN_HDD_GET_AP_CTX_PTR(adapter->deflink);
-			hostapd_state = WLAN_HDD_GET_HOSTAP_STATE_PTR(adapter);
+		case QDF_P2P_GO_MODE:
+			ap_ctx = WLAN_HDD_GET_AP_CTX_PTR(adapter->deflink);
+			hostapd_state =
+				WLAN_HDD_GET_HOSTAP_STATE_PTR(adapter->deflink);
 			if (hostapd_state->bss_state == BSS_START &&
-			    hostapd_state->qdf_status ==
-			    QDF_STATUS_SUCCESS) {
-				ap_channel = wlan_reg_freq_to_chan(
-					hdd_ctx->pdev,
-					hdd_ap_ctx->operating_chan_freq);
-				target_channel = ap_channel;
+			    hostapd_state->qdf_status == QDF_STATUS_SUCCESS) {
+				chan_freq = ap_ctx->operating_chan_freq;
+				ap_chan = wlan_reg_freq_to_chan(hdd_ctx->pdev,
+								chan_freq);
+				target_channel = ap_chan;
 			}
 			break;
 		default: