Selaa lähdekoodia

qcacld-3.0: Register legacy callbacks with Policy Manager part 2

Register legacy callbacks with Policy Manager part 2.

Change-Id: Ia2d2999d75866bf1f9ca5984ae49cbbe7c5a3192
CRs-Fixed: 2009818
Archana Ramachandran 8 vuotta sitten
vanhempi
sitoutus
2eb7a61aeb

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

@@ -12559,7 +12559,7 @@ int wlan_hdd_cfg80211_update_bss(struct wiphy *wiphy,
 		pScanResult = sme_scan_result_get_next(hHal, pResult);
 	}
 
-	sme_scan_result_purge(hHal, pResult);
+	sme_scan_result_purge(pResult);
 	/*
 	 * For SAP mode, scan is invoked by hostapd during SAP start
 	 * if hostapd is restarted, we need to flush previous scan

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

@@ -9762,8 +9762,7 @@ QDF_STATUS wlan_hdd_check_custom_con_channel_rules(hdd_adapter_t *sta_adapter,
 
 	hdd_ap_ctx = WLAN_HDD_GET_AP_CTX_PTR(ap_adapter);
 	status =
-	 sme_get_ap_channel_from_scan_cache(WLAN_HDD_GET_HAL_CTX(sta_adapter),
-					    roam_profile,
+	 sme_get_ap_channel_from_scan_cache(roam_profile,
 					    scan_cache,
 					    &channel_id);
 	if ((QDF_STATUS_SUCCESS == status)) {

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

@@ -984,7 +984,7 @@ static int __iw_get_scan(struct net_device *dev,
 		pScanResult = sme_scan_result_get_next(hHal, pResult);
 	}
 
-	sme_scan_result_purge(hHal, pResult);
+	sme_scan_result_purge(pResult);
 
 	hdd_notice("exit total %d BSS reported !!!", i);
 	EXIT();

+ 2 - 2
core/sap/src/sap_api_link_cntl.c

@@ -169,7 +169,7 @@ QDF_STATUS wlansap_scan_callback(tHalHandle hal_handle,
 				"Selecting operating channel as starting channel from preferred channel list: %d",
 				operChannel);
 		}
-		sme_scan_result_purge(hal_handle, result);
+		sme_scan_result_purge(result);
 		break;
 
 	default:
@@ -378,7 +378,7 @@ wlansap_pre_start_bss_acs_scan_callback(tHalHandle hal_handle, void *pcontext,
 				"Selecting operating channel as starting channel from preferred channel list: %d",
 				oper_channel);
 		}
-		sme_scan_result_purge(hal_handle, presult);
+		sme_scan_result_purge(presult);
 	}
 
 	if (oper_channel == SAP_CHANNEL_NOT_SELECTED) {

+ 6 - 4
core/sme/inc/sme_api.h

@@ -261,10 +261,13 @@ QDF_STATUS sme_scan_request(tHalHandle hHal, uint8_t sessionId,
 QDF_STATUS sme_scan_get_result(tHalHandle hHal, uint8_t sessionId,
 		tCsrScanResultFilter *pFilter,
 		tScanResultHandle *phResult);
-QDF_STATUS sme_get_ap_channel_from_scan_cache(tHalHandle hHal,
+QDF_STATUS sme_get_ap_channel_from_scan_cache(
 		tCsrRoamProfile *profile,
 		tScanResultHandle *scan_cache,
 		uint8_t *ap_chnl_id);
+QDF_STATUS sme_get_ap_channel_from_scan(void *profile,
+		tScanResultHandle *scan_cache,
+		uint8_t *ap_chnl_id);
 bool sme_store_joinreq_param(tHalHandle hal_handle,
 		tCsrRoamProfile *profile,
 		tScanResultHandle scan_cache,
@@ -282,8 +285,7 @@ tCsrScanResultInfo *sme_scan_result_get_first(tHalHandle,
 		tScanResultHandle hScanResult);
 tCsrScanResultInfo *sme_scan_result_get_next(tHalHandle,
 		tScanResultHandle hScanResult);
-QDF_STATUS sme_scan_result_purge(tHalHandle hHal,
-		tScanResultHandle hScanResult);
+QDF_STATUS sme_scan_result_purge(tScanResultHandle hScanResult);
 QDF_STATUS sme_scan_get_pmkid_candidate_list(tHalHandle hHal, uint8_t sessionId,
 		tPmkidCandidateInfo *pPmkidList,
 		uint32_t *pNumItems);
@@ -481,7 +483,7 @@ QDF_STATUS sme_roam_update_apwpsie(tHalHandle, uint8_t sessionId,
 		tSirAPWPSIEs * pAPWPSIES);
 QDF_STATUS sme_roam_update_apwparsni_es(tHalHandle hHal, uint8_t sessionId,
 		tSirRSNie *pAPSirRSNie);
-QDF_STATUS sme_change_mcc_beacon_interval(tHalHandle hHal, uint8_t sessionId);
+QDF_STATUS sme_change_mcc_beacon_interval(uint8_t sessionId);
 QDF_STATUS sme_set_host_offload(tHalHandle hHal, uint8_t sessionId,
 		tpSirHostOffloadReq pRequest);
 QDF_STATUS sme_set_keep_alive(tHalHandle hHal, uint8_t sessionId,

+ 69 - 39
core/sme/src/common/sme_api.c

@@ -124,6 +124,28 @@ QDF_STATUS sme_release_global_lock(tSmeStruct *psSme)
 	return status;
 }
 
+static tpAniSirGlobal sme_get_mac_context(void)
+{
+	tpAniSirGlobal mac_ctx;
+	tHalHandle h_hal;
+
+	h_hal = cds_get_context(QDF_MODULE_ID_SME);
+	if (NULL == h_hal) {
+		QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_FATAL,
+		FL("invalid h_hal"));
+		return NULL;
+	}
+
+	mac_ctx = PMAC_STRUCT(h_hal);
+	if (NULL == mac_ctx) {
+		QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR,
+		FL("Invalid MAC context"));
+		return NULL;
+	}
+
+	return mac_ctx;
+}
+
 /**
  * sme_process_set_hw_mode_resp() - Process set HW mode response
  * @mac: Global MAC pointer
@@ -1336,6 +1358,11 @@ QDF_STATUS sme_start(tHalHandle hHal)
 		sme_cbacks.sme_pdev_set_pcl = sme_pdev_set_pcl;
 		sme_cbacks.sme_soc_set_dual_mac_config =
 			sme_soc_set_dual_mac_config;
+		sme_cbacks.sme_change_mcc_beacon_interval =
+			sme_change_mcc_beacon_interval;
+		sme_cbacks.sme_get_ap_channel_from_scan =
+			sme_get_ap_channel_from_scan;
+		sme_cbacks.sme_scan_result_purge = sme_scan_result_purge;
 		status = policy_mgr_register_sme_cb(pMac->psoc, &sme_cbacks);
 		if (!QDF_IS_STATUS_SUCCESS(status)) {
 			sms_log(pMac, LOGE,
@@ -3087,6 +3114,31 @@ QDF_STATUS sme_scan_get_result(tHalHandle hHal, uint8_t sessionId,
 	return status;
 }
 
+/**
+ * sme_get_ap_channel_from_scan() - a wrapper function to get
+ *      				  AP's channel id from
+ *      				  CSR by filtering the
+ *      				  result which matches
+ *      				  our roam profile.
+ * @profile: SAP profile
+ * @ap_chnl_id: pointer to channel id of SAP. Fill the value after finding the
+ *              best ap from scan cache.
+ *
+ * This function is written to get AP's channel id from CSR by filtering
+ * the result which matches our roam profile. This is a synchronous call.
+ *
+ * Return: QDF_STATUS.
+ */
+QDF_STATUS sme_get_ap_channel_from_scan(void *profile,
+					tScanResultHandle *scan_cache,
+					uint8_t *ap_chnl_id)
+{
+	return sme_get_ap_channel_from_scan_cache((tCsrRoamProfile *)
+						  profile,
+						  scan_cache,
+						  ap_chnl_id);
+}
+
 /**
  * sme_get_ap_channel_from_scan_cache() - a wrapper function to get AP's
  *                                        channel id from CSR by filtering the
@@ -3100,13 +3152,12 @@ QDF_STATUS sme_scan_get_result(tHalHandle hHal, uint8_t sessionId,
  *
  * Return: QDF_STATUS.
  */
-QDF_STATUS sme_get_ap_channel_from_scan_cache(tHalHandle hal_handle,
-					tCsrRoamProfile *profile,
-					tScanResultHandle *scan_cache,
-					uint8_t *ap_chnl_id)
+QDF_STATUS sme_get_ap_channel_from_scan_cache(
+	tCsrRoamProfile *profile, tScanResultHandle *scan_cache,
+	uint8_t *ap_chnl_id)
 {
 	QDF_STATUS status = QDF_STATUS_E_FAILURE;
-	tpAniSirGlobal mac_ctx = PMAC_STRUCT(hal_handle);
+	tpAniSirGlobal mac_ctx = sme_get_mac_context();
 	tCsrScanResultFilter *scan_filter = NULL;
 	tScanResultHandle filtered_scan_result = NULL;
 	tSirBssDescription first_ap_profile;
@@ -3155,7 +3206,7 @@ QDF_STATUS sme_get_ap_channel_from_scan_cache(tHalHandle hal_handle,
 	}
 	status = sme_acquire_global_lock(&mac_ctx->sme);
 	if (QDF_STATUS_SUCCESS == status) {
-		status = csr_scan_get_result(hal_handle, scan_filter,
+		status = csr_scan_get_result(mac_ctx, scan_filter,
 					  &filtered_scan_result);
 		if (QDF_STATUS_SUCCESS == status) {
 			csr_get_bssdescr_from_scan_handle(filtered_scan_result,
@@ -3437,18 +3488,18 @@ tCsrScanResultInfo *sme_scan_result_get_next(tHalHandle hHal,
     calling this function and even before this function reutrns.
     \return QDF_STATUS
    ---------------------------------------------------------------------------*/
-QDF_STATUS sme_scan_result_purge(tHalHandle hHal, tScanResultHandle hScanResult)
+QDF_STATUS sme_scan_result_purge(tScanResultHandle hScanResult)
 {
 	QDF_STATUS status = QDF_STATUS_E_FAILURE;
-	tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
+	tpAniSirGlobal mac_ctx = sme_get_mac_context();
 
 	MTRACE(qdf_trace(QDF_MODULE_ID_SME,
 			 TRACE_CODE_SME_RX_HDD_MSG_SCAN_RESULT_PURGE,
 			 NO_SESSION, 0));
-	status = sme_acquire_global_lock(&pMac->sme);
+	status = sme_acquire_global_lock(&mac_ctx->sme);
 	if (QDF_IS_STATUS_SUCCESS(status)) {
-		status = csr_scan_result_purge(hHal, hScanResult);
-		sme_release_global_lock(&pMac->sme);
+		status = csr_scan_result_purge(mac_ctx, hScanResult);
+		sme_release_global_lock(&mac_ctx->sme);
 	}
 
 	return status;
@@ -5926,16 +5977,17 @@ QDF_STATUS sme_roam_update_apwparsni_es(tHalHandle hHal, uint8_t sessionId,
 			The API finished and failed.
 
    -------------------------------------------------------------------------------*/
-QDF_STATUS sme_change_mcc_beacon_interval(tHalHandle hHal, uint8_t sessionId)
+QDF_STATUS sme_change_mcc_beacon_interval(uint8_t sessionId)
 {
 	QDF_STATUS status = QDF_STATUS_E_FAILURE;
-	tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
+	tpAniSirGlobal mac_ctx = sme_get_mac_context();
 
-	sms_log(pMac, LOG1, FL("Update Beacon PARAMS "));
-	status = sme_acquire_global_lock(&pMac->sme);
+	sms_log(mac_ctx, LOG1, FL("Update Beacon PARAMS "));
+	status = sme_acquire_global_lock(&mac_ctx->sme);
 	if (QDF_IS_STATUS_SUCCESS(status)) {
-		status = csr_send_chng_mcc_beacon_interval(pMac, sessionId);
-		sme_release_global_lock(&pMac->sme);
+		status = csr_send_chng_mcc_beacon_interval(mac_ctx,
+							   sessionId);
+		sme_release_global_lock(&mac_ctx->sme);
 	}
 	return status;
 }
@@ -6997,28 +7049,6 @@ QDF_STATUS sme_set_tsf_gpio(tHalHandle h_hal, uint32_t pinvalue)
 }
 #endif
 
-static tpAniSirGlobal sme_get_mac_context(void)
-{
-	tpAniSirGlobal mac_ctx;
-	tHalHandle h_hal;
-
-	h_hal = cds_get_context(QDF_MODULE_ID_SME);
-	if (NULL == h_hal) {
-		QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_FATAL,
-		FL("invalid h_hal"));
-		return NULL;
-	}
-
-	mac_ctx = PMAC_STRUCT(h_hal);
-	if (NULL == mac_ctx) {
-		QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR,
-		FL("Invalid MAC context"));
-		return NULL;
-	}
-
-	return mac_ctx;
-}
-
 QDF_STATUS sme_get_cfg_valid_channels(uint8_t *aValidChannels,
 				      uint32_t *len)
 {

+ 1 - 1
core/sme/src/rrm/sme_rrm.c

@@ -570,7 +570,7 @@ static QDF_STATUS sme_rrm_send_scan_result(tpAniSirGlobal mac_ctx,
 	}
 
 rrm_send_scan_results_done:
-	sme_scan_result_purge(mac_ctx, result_handle);
+	sme_scan_result_purge(result_handle);
 	return status;
 }