Эх сурвалжийг харах

qcacld-3.0: Refactor SAP/DCS channel change APIs

To manage the channel switch on each link of SAP,
change the following APIs to take link info pointer
instead of adapter.
Existing callers moved to deflink.

1) hdd_switch_sap_channel()
2) hdd_dcs_hostapd_set_chan()

Change-Id: I7607559a24ab98037ae71e48bc14e111add3db64
CRs-Fixed: 3463836
Vinod Kumar Pirla 2 жил өмнө
parent
commit
b7fcc00a10

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

@@ -3254,7 +3254,7 @@ int hdd_update_acs_timer_reason(struct hdd_adapter *adapter, uint8_t reason);
 
 /**
  * hdd_switch_sap_channel() - Move SAP to the given channel
- * @adapter: AP adapter
+ * @link_info: Pointer of link_info in adapter
  * @channel: Channel
  * @forced: Force to switch channel, ignore SCC/MCC check
  *
@@ -3263,8 +3263,8 @@ int hdd_update_acs_timer_reason(struct hdd_adapter *adapter, uint8_t reason);
  *
  * Return: QDF_STATUS
  */
-QDF_STATUS hdd_switch_sap_channel(struct hdd_adapter *adapter, uint8_t channel,
-				  bool forced);
+QDF_STATUS hdd_switch_sap_channel(struct wlan_hdd_link_info *link_info,
+				  uint8_t channel, bool forced);
 
 /**
  * hdd_switch_sap_chan_freq() - Move SAP to the given channel

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

@@ -16288,7 +16288,7 @@ static int hdd_update_acs_channel(struct hdd_adapter *adapter, uint8_t reason,
 		wlan_hdd_set_sap_csa_reason(hdd_ctx->psoc,
 					    adapter->deflink->vdev_id,
 					    CSA_REASON_LTE_COEX);
-		hdd_switch_sap_channel(adapter, (uint8_t)ch, true);
+		hdd_switch_sap_channel(adapter->deflink, (uint8_t)ch, true);
 		break;
 
 	default:

+ 8 - 11
core/hdd/src/wlan_hdd_dcs.c

@@ -380,7 +380,7 @@ QDF_STATUS hdd_dcs_hostapd_set_chan(struct hdd_context *hdd_ctx,
 	QDF_STATUS status;
 	uint8_t mac_id;
 	uint32_t list[MAX_NUMBER_OF_CONC_CONNECTIONS];
-	uint32_t conn_index, count;
+	uint32_t conn_idx, count;
 	struct wlan_hdd_link_info *link_info;
 	uint32_t dcs_ch = wlan_reg_freq_to_chan(hdd_ctx->pdev, dcs_ch_freq);
 
@@ -398,12 +398,11 @@ QDF_STATUS hdd_dcs_hostapd_set_chan(struct hdd_context *hdd_ctx,
 	 * Set vdev starting for every vdev before doing csa.
 	 * The CSA triggered by DCS will be done in serial.
 	 */
-	for (conn_index = 0; conn_index < count; conn_index++) {
-		link_info =
-			hdd_get_link_info_by_vdev(hdd_ctx, list[conn_index]);
+	for (conn_idx = 0; conn_idx < count; conn_idx++) {
+		link_info = hdd_get_link_info_by_vdev(hdd_ctx, list[conn_idx]);
 		if (!link_info) {
 			hdd_err("vdev_id %u does not exist with host",
-				list[conn_index]);
+				list[conn_idx]);
 			return QDF_STATUS_E_INVAL;
 		}
 
@@ -414,12 +413,11 @@ QDF_STATUS hdd_dcs_hostapd_set_chan(struct hdd_context *hdd_ctx,
 		else
 			wlansap_dcs_set_vdev_starting(sap_ctx, false);
 	}
-	for (conn_index = 0; conn_index < count; conn_index++) {
-		link_info =
-			hdd_get_link_info_by_vdev(hdd_ctx, list[conn_index]);
+	for (conn_idx = 0; conn_idx < count; conn_idx++) {
+		link_info = hdd_get_link_info_by_vdev(hdd_ctx, list[conn_idx]);
 		if (!link_info) {
 			hdd_err("vdev_id %u does not exist with host",
-				list[conn_index]);
+				list[conn_idx]);
 			return QDF_STATUS_E_INVAL;
 		}
 
@@ -432,8 +430,7 @@ QDF_STATUS hdd_dcs_hostapd_set_chan(struct hdd_context *hdd_ctx,
 			  ap_ctx->operating_chan_freq, dcs_ch_freq);
 		wlan_hdd_set_sap_csa_reason(hdd_ctx->psoc,
 					    link_info->vdev_id, CSA_REASON_DCS);
-		status = hdd_switch_sap_channel(link_info->adapter,
-						dcs_ch, true);
+		status = hdd_switch_sap_channel(link_info, dcs_ch, true);
 		if (status == QDF_STATUS_SUCCESS)
 			status = QDF_STATUS_E_PENDING;
 		return status;

+ 25 - 40
core/hdd/src/wlan_hdd_main.c

@@ -12049,46 +12049,28 @@ static void hdd_set_thermal_level_cb(hdd_handle_t hdd_handle, u_int8_t level)
 }
 #endif
 
-/**
- * hdd_switch_sap_channel() - Move SAP to the given channel
- * @adapter: AP adapter
- * @channel: Channel
- * @forced: Force to switch channel, ignore SCC/MCC check
- *
- * Moves the SAP interface by invoking the function which
- * executes the callback to perform channel switch using (E)CSA.
- *
- * Return: None
- */
-QDF_STATUS hdd_switch_sap_channel(struct hdd_adapter *adapter, uint8_t channel,
-				  bool forced)
+QDF_STATUS hdd_switch_sap_channel(struct wlan_hdd_link_info *link_info,
+				  uint8_t channel, bool forced)
 {
-	struct hdd_ap_ctx *hdd_ap_ctx;
-	struct hdd_context *hdd_ctx;
+	struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(link_info->adapter);
 	mac_handle_t mac_handle;
+	struct sap_config *sap_cfg;
+	qdf_freq_t freq;
 
-	if (!adapter) {
-		hdd_err("invalid adapter");
-		return QDF_STATUS_E_INVAL;
-	}
-
-	hdd_ap_ctx = WLAN_HDD_GET_AP_CTX_PTR(adapter->deflink);
-
-	mac_handle = hdd_adapter_get_mac_handle(adapter);
+	mac_handle = hdd_adapter_get_mac_handle(link_info->adapter);
 	if (!mac_handle) {
 		hdd_err("invalid MAC handle");
 		return QDF_STATUS_E_INVAL;
 	}
 
-	hdd_ctx = WLAN_HDD_GET_CTX(adapter);
-
-	hdd_debug("chan:%d width:%d",
-		channel, hdd_ap_ctx->sap_config.ch_width_orig);
+	freq = wlan_reg_legacy_chan_to_freq(hdd_ctx->pdev, channel);
+	sap_cfg = &(WLAN_HDD_GET_AP_CTX_PTR(link_info)->sap_config);
+	hdd_debug("chan:%d width:%d", channel, sap_cfg->ch_width_orig);
 
-	return policy_mgr_change_sap_channel_with_csa(
-		hdd_ctx->psoc, adapter->deflink->vdev_id,
-		wlan_reg_legacy_chan_to_freq(hdd_ctx->pdev, channel),
-		hdd_ap_ctx->sap_config.ch_width_orig, forced);
+	return policy_mgr_change_sap_channel_with_csa(hdd_ctx->psoc,
+						      link_info->vdev_id, freq,
+						      sap_cfg->ch_width_orig,
+						      forced);
 }
 
 QDF_STATUS hdd_switch_sap_chan_freq(struct hdd_adapter *adapter,
@@ -12489,7 +12471,7 @@ static void hdd_lte_coex_restart_sap(struct hdd_adapter *adapter,
 				    WLAN_SVC_LTE_COEX_IND, NULL, 0);
 	wlan_hdd_set_sap_csa_reason(hdd_ctx->psoc, adapter->deflink->vdev_id,
 				    CSA_REASON_LTE_COEX);
-	hdd_switch_sap_channel(adapter, restart_chan, true);
+	hdd_switch_sap_channel(adapter->deflink, restart_chan, true);
 }
 
 int hdd_clone_local_unsafe_chan(struct hdd_context *hdd_ctx,
@@ -20008,6 +19990,7 @@ void hdd_check_and_restart_sap_with_non_dfs_acs(void)
 	struct cds_context *cds_ctx;
 	uint8_t restart_chan;
 	uint32_t restart_freq;
+	struct wlan_hdd_link_info *link_info;
 
 	hdd_ctx = cds_get_context(QDF_MODULE_ID_HDD);
 	if (!hdd_ctx)
@@ -20024,20 +20007,22 @@ void hdd_check_and_restart_sap_with_non_dfs_acs(void)
 	}
 
 	ap_adapter = hdd_get_adapter(hdd_ctx, QDF_SAP_MODE);
-	if (ap_adapter &&
-	    test_bit(SOFTAP_BSS_STARTED, &ap_adapter->deflink->link_flags) &&
+	if (!ap_adapter)
+		return;
+
+	link_info = ap_adapter->deflink;
+	if (test_bit(SOFTAP_BSS_STARTED, &link_info->link_flags) &&
 	    wlan_reg_is_dfs_for_freq(
 			hdd_ctx->pdev,
-			ap_adapter->deflink->session.ap.operating_chan_freq)) {
+			link_info->session.ap.operating_chan_freq)) {
 		if (policy_mgr_get_dfs_master_dynamic_enabled(
-				hdd_ctx->psoc, ap_adapter->deflink->vdev_id))
+				hdd_ctx->psoc, link_info->vdev_id))
 			return;
 		hdd_warn("STA-AP Mode DFS not supported, Switch SAP channel to Non DFS");
 
 		restart_freq =
 			wlansap_get_safe_channel_from_pcl_and_acs_range(
-				WLAN_HDD_GET_SAP_CTX_PTR(ap_adapter->deflink),
-				NULL);
+				WLAN_HDD_GET_SAP_CTX_PTR(link_info), NULL);
 
 		restart_chan = wlan_reg_freq_to_chan(hdd_ctx->pdev,
 						     restart_freq);
@@ -20046,9 +20031,9 @@ void hdd_check_and_restart_sap_with_non_dfs_acs(void)
 			restart_chan = SAP_DEFAULT_5GHZ_CHANNEL;
 		wlan_hdd_set_sap_csa_reason(
 					hdd_ctx->psoc,
-					ap_adapter->deflink->vdev_id,
+					link_info->vdev_id,
 					CSA_REASON_STA_CONNECT_DFS_TO_NON_DFS);
-		hdd_switch_sap_channel(ap_adapter, restart_chan, true);
+		hdd_switch_sap_channel(link_info, restart_chan, true);
 	}
 }