Sfoglia il codice sorgente

qcacld-3.0: Refactor roam enab/disable APIs

Club the almost similar implementation of of below two APIs and
refactor to a single API to enable and disable roaming on other
VDEVs.

Removed:
1) wlan_hdd_enable_roaming()
2) wlan_hdd_disable_roaming()

New API: wlan_hdd_set_roaming_state()

Change-Id: If59ca593a6a994bbc879c5fda8ae36ce34c5839a
CRs-Fixed: 3523066
Vinod Kumar Pirla 2 anni fa
parent
commit
704def9b08

+ 12 - 20
core/hdd/inc/wlan_hdd_main.h

@@ -3426,32 +3426,24 @@ hdd_store_nss_chains_cfg_in_vdev(struct hdd_context *hdd_ctx,
 				 struct wlan_objmgr_vdev *vdev);
 
 /**
- * wlan_hdd_disable_roaming() - disable roaming on all STAs except the input one
- * @cur_adapter: Current HDD adapter passed from caller
+ * wlan_hdd_set_roaming_state() - Enable or disable roaming
+ * on all STAs except the input one
+ * @cur_link_info: Current link info pointer in HDD adapter
  * @rso_op_requestor: roam disable requestor
+ * @enab_roam: Set to true to enable roaming or else set false
  *
- * This function loops through all adapters and disables roaming on each STA
- * mode adapter except the current adapter passed from the caller
+ * This function loops through all adapters and enables or
+ * disables roaming on each STA mode adapter except the
+ * current adapter passed from the caller.
+ * If @enab_roam is true, roaming is enabled or else
+ * roaming is disabled
  *
  * Return: None
  */
 void
-wlan_hdd_disable_roaming(struct hdd_adapter *cur_adapter,
-			 enum wlan_cm_rso_control_requestor rso_op_requestor);
-
-/**
- * wlan_hdd_enable_roaming() - enable roaming on all STAs except the input one
- * @cur_adapter: Current HDD adapter passed from caller
- * @rso_op_requestor: roam disable requestor
- *
- * This function loops through all adapters and enables roaming on each STA
- * mode adapter except the current adapter passed from the caller
- *
- * Return: None
- */
-void
-wlan_hdd_enable_roaming(struct hdd_adapter *cur_adapter,
-			enum wlan_cm_rso_control_requestor rso_op_requestor);
+wlan_hdd_set_roaming_state(struct wlan_hdd_link_info *cur_link_info,
+			   enum wlan_cm_rso_control_requestor rso_op_requestor,
+			   bool enab_roam);
 
 QDF_STATUS hdd_post_cds_enable_config(struct hdd_context *hdd_ctx);
 

+ 19 - 16
core/hdd/src/wlan_hdd_hostapd.c

@@ -3040,8 +3040,8 @@ QDF_STATUS hdd_hostapd_sap_event_cb(struct sap_event *sap_event,
 		 */
 		qdf_atomic_set(&ap_ctx->ch_switch_in_progress, 0);
 		policy_mgr_set_chan_switch_complete_evt(hdd_ctx->psoc);
-		wlan_hdd_enable_roaming(adapter,
-					RSO_SAP_CHANNEL_CHANGE);
+		wlan_hdd_set_roaming_state(link_info, RSO_SAP_CHANNEL_CHANGE,
+					   true);
 
 		/* Indoor channels are also marked DFS, therefore
 		 * check if the channel has REGULATORY_CHAN_RADAR
@@ -3376,6 +3376,7 @@ int hdd_softap_set_channel_change(struct net_device *dev, int target_chan_freq,
 	struct wlan_crypto_params crypto_params = {0};
 	bool capable, is_wps;
 	int32_t keymgmt;
+	struct wlan_hdd_link_info *link_info;
 
 	hdd_ctx = WLAN_HDD_GET_CTX(adapter);
 	ret = wlan_hdd_validate_context(hdd_ctx);
@@ -3385,11 +3386,13 @@ 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->deflink);
+
+	link_info = adapter->deflink;
+	sap_ctx = WLAN_HDD_GET_SAP_CTX_PTR(link_info);
 	if (!sap_ctx)
 		return -EINVAL;
 
-	ap_ctx = WLAN_HDD_GET_AP_CTX_PTR(adapter->deflink);
+	ap_ctx = WLAN_HDD_GET_AP_CTX_PTR(link_info);
 	/*
 	 * If sta connection is in progress do not allow SAP channel change from
 	 * user space as it may change the HW mode requirement, for which sta is
@@ -3470,7 +3473,7 @@ int hdd_softap_set_channel_change(struct net_device *dev, int target_chan_freq,
 
 	if (!policy_mgr_is_sap_go_interface_allowed_on_indoor(
 						hdd_ctx->pdev,
-						adapter->deflink->vdev_id,
+						link_info->vdev_id,
 						target_chan_freq)) {
 		hdd_debug("Channel switch is not allowed to indoor frequency %d",
 			  target_chan_freq);
@@ -3520,7 +3523,7 @@ int hdd_softap_set_channel_change(struct net_device *dev, int target_chan_freq,
 				policy_mgr_convert_device_mode_to_qdf_type(
 					adapter->device_mode),
 				target_chan_freq, policy_mgr_get_bw(target_bw),
-				adapter->deflink->vdev_id,
+				link_info->vdev_id,
 				forced,
 				sap_ctx->csa_reason)) {
 		hdd_err("Channel switch failed due to concurrency check failure");
@@ -3540,16 +3543,17 @@ int hdd_softap_set_channel_change(struct net_device *dev, int target_chan_freq,
 		return -EINVAL;
 	}
 	/* Disable Roaming on all adapters before doing channel change */
-	wlan_hdd_disable_roaming(adapter, RSO_SAP_CHANNEL_CHANGE);
+	wlan_hdd_set_roaming_state(link_info, RSO_SAP_CHANNEL_CHANGE, false);
 
 	/*
 	 * Post the Channel Change request to SAP.
 	 */
 
-	vdev = hdd_objmgr_get_vdev_by_user(adapter->deflink, WLAN_OSIF_ID);
+	vdev = hdd_objmgr_get_vdev_by_user(link_info, WLAN_OSIF_ID);
 	if (!vdev) {
 		qdf_atomic_set(&ap_ctx->ch_switch_in_progress, 0);
-		wlan_hdd_enable_roaming(adapter, RSO_SAP_CHANNEL_CHANGE);
+		wlan_hdd_set_roaming_state(link_info, RSO_SAP_CHANNEL_CHANGE,
+					   true);
 		return -EINVAL;
 	}
 	if (wlan_vdev_mlme_get_opmode(vdev) == QDF_P2P_GO_MODE)
@@ -3564,10 +3568,8 @@ 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->deflink),
-		target_chan_freq,
-		target_bw,
-		strict);
+		WLAN_HDD_GET_SAP_CTX_PTR(link_info),
+		target_chan_freq, target_bw, strict);
 
 	if (QDF_STATUS_SUCCESS != status) {
 		hdd_err("SAP set channel failed for channel freq: %d, bw: %d",
@@ -3583,8 +3585,8 @@ int hdd_softap_set_channel_change(struct net_device *dev, int target_chan_freq,
 		 * If Posting of the Channel Change request fails
 		 * enable roaming on all adapters
 		 */
-		wlan_hdd_enable_roaming(adapter,
-					RSO_SAP_CHANNEL_CHANGE);
+		wlan_hdd_set_roaming_state(link_info, RSO_SAP_CHANNEL_CHANGE,
+					   true);
 
 		ret = -EINVAL;
 	}
@@ -4395,7 +4397,8 @@ void hdd_deinit_ap_mode(struct hdd_context *hdd_ctx,
 		policy_mgr_set_chan_switch_complete_evt(hdd_ctx->psoc);
 
 		/* Re-enable roaming on all connected STA vdev */
-		wlan_hdd_enable_roaming(adapter, RSO_SAP_CHANNEL_CHANGE);
+		wlan_hdd_set_roaming_state(adapter->deflink,
+					   RSO_SAP_CHANNEL_CHANGE, true);
 	}
 
 	if (hdd_hostapd_deinit_sap_session(adapter))

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

@@ -482,14 +482,15 @@ static __iw_softap_setparam(struct net_device *dev,
 		 * Disable Roaming on all adapters before start of
 		 * start of Hidden ssid connection
 		 */
-		wlan_hdd_disable_roaming(adapter, RSO_START_BSS);
+		wlan_hdd_set_roaming_state(link_info, RSO_START_BSS, false);
 
 		status = sme_update_session_param(mac_handle,
 				link_info->vdev_id,
 				SIR_PARAM_SSID_HIDDEN, set_value);
 		if (QDF_STATUS_SUCCESS != status) {
 			hdd_err("QCSAP_PARAM_HIDE_SSID failed");
-			wlan_hdd_enable_roaming(adapter, RSO_START_BSS);
+			wlan_hdd_set_roaming_state(link_info, RSO_START_BSS,
+						   true);
 			return -EIO;
 		}
 		break;

+ 30 - 47
core/hdd/src/wlan_hdd_main.c

@@ -1573,10 +1573,10 @@ void hdd_indicate_active_ndp_cnt(struct wlan_objmgr_psoc *psoc,
 	hdd_debug("vdev_id:%d%s active ndp sessions present", vdev_id,
 		  cnt ? "" : " no more");
 	if (!cnt)
-		wlan_hdd_enable_roaming(link_info->adapter, RSO_NDP_CON_ON_NDI);
+		wlan_hdd_set_roaming_state(link_info, RSO_NDP_CON_ON_NDI, true);
 	else
-		wlan_hdd_disable_roaming(link_info->adapter,
-					 RSO_NDP_CON_ON_NDI);
+		wlan_hdd_set_roaming_state(link_info, RSO_NDP_CON_ON_NDI,
+					   false);
 }
 
 #ifdef WLAN_FEATURE_ROAM_OFFLOAD
@@ -16782,58 +16782,41 @@ void hdd_softap_sta_disassoc(struct hdd_adapter *adapter,
 }
 
 void
-wlan_hdd_disable_roaming(struct hdd_adapter *cur_adapter,
-			 enum wlan_cm_rso_control_requestor rso_op_requestor)
+wlan_hdd_set_roaming_state(struct wlan_hdd_link_info *cur_link_info,
+			   enum wlan_cm_rso_control_requestor rso_op_requestor,
+			   bool enab_roam)
 {
-	struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(cur_adapter);
+	struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(cur_link_info->adapter);
 	struct hdd_adapter *adapter = NULL, *next_adapter = NULL;
-	struct hdd_station_ctx *sta_ctx;
 	wlan_net_dev_ref_dbgid dbgid = NET_DEV_HOLD_DISABLE_ROAMING;
-	uint8_t vdev_id;
-
-	if (!policy_mgr_is_sta_active_connection_exists(hdd_ctx->psoc))
-		return;
-
-	hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter,
-					   dbgid) {
-		sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter->deflink);
-		vdev_id = adapter->deflink->vdev_id;
-		if (cur_adapter->deflink->vdev_id != vdev_id &&
-		    adapter->device_mode == QDF_STA_MODE &&
-		    hdd_cm_is_vdev_associated(adapter->deflink)) {
-			hdd_debug("%d Disable roaming", vdev_id);
-			sme_stop_roaming(hdd_ctx->mac_handle, vdev_id,
-					 REASON_DRIVER_DISABLED,
-					 rso_op_requestor);
-		}
-		hdd_adapter_dev_put_debug(adapter, dbgid);
-	}
-}
-
-void
-wlan_hdd_enable_roaming(struct hdd_adapter *cur_adapter,
-			enum wlan_cm_rso_control_requestor rso_op_requestor)
-{
-	struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(cur_adapter);
-	struct hdd_adapter *adapter = NULL, *next_adapter = NULL;
-	struct hdd_station_ctx *sta_ctx;
-	wlan_net_dev_ref_dbgid dbgid = NET_DEV_HOLD_ENABLE_ROAMING;
-	uint8_t vdev_id;
+	uint8_t vdev_id, cur_vdev_id = cur_link_info->vdev_id;
+	struct wlan_hdd_link_info *link_info;
 
 	if (!policy_mgr_is_sta_active_connection_exists(hdd_ctx->psoc))
 		return;
 
 	hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter,
 					   dbgid) {
-		sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter->deflink);
-		vdev_id = adapter->deflink->vdev_id;
-		if (cur_adapter->deflink->vdev_id != vdev_id &&
-		    adapter->device_mode == QDF_STA_MODE &&
-		    hdd_cm_is_vdev_associated(adapter->deflink)) {
-			hdd_debug("%d Enable roaming", vdev_id);
-			sme_start_roaming(hdd_ctx->mac_handle, vdev_id,
-					  REASON_DRIVER_ENABLED,
-					  rso_op_requestor);
+		hdd_adapter_for_each_active_link_info(adapter, link_info) {
+			vdev_id = link_info->vdev_id;
+			if (cur_vdev_id != link_info->vdev_id &&
+			    adapter->device_mode == QDF_STA_MODE &&
+			    hdd_cm_is_vdev_associated(link_info)) {
+				if (enab_roam) {
+					hdd_debug("%d Enable roaming", vdev_id);
+					sme_start_roaming(hdd_ctx->mac_handle,
+							  vdev_id,
+							  REASON_DRIVER_ENABLED,
+							  rso_op_requestor);
+				} else {
+					hdd_debug("%d Disable roaming",
+						  vdev_id);
+					sme_stop_roaming(hdd_ctx->mac_handle,
+							 vdev_id,
+							 REASON_DRIVER_DISABLED,
+							 rso_op_requestor);
+				}
+			}
 		}
 		hdd_adapter_dev_put_debug(adapter, dbgid);
 	}
@@ -20260,7 +20243,7 @@ void hdd_hidden_ssid_enable_roaming(hdd_handle_t hdd_handle, uint8_t vdev_id)
 		return;
 	}
 	/* enable roaming on all adapters once hdd get hidden ssid rsp */
-	wlan_hdd_enable_roaming(link_info->adapter, RSO_START_BSS);
+	wlan_hdd_set_roaming_state(link_info, RSO_START_BSS, true);
 }
 
 #ifdef WLAN_FEATURE_PKT_CAPTURE