Jelajahi Sumber

qcacld-3.0: Remove SME global lock from the scan APIs

Remove SME global lock use from the scan APIs as scan has its
own lock and thus no need to hold global lock while accessing
scan database.

Also cleanup unused csr scan functions.

Change-Id: I7ad5a61e69c200f9dee6b9158c4d27708fdc98dc
CRs-Fixed: 3160360
Abhishek Singh 3 tahun lalu
induk
melakukan
553e074021

+ 0 - 2
core/sme/inc/csr_internal.h

@@ -479,8 +479,6 @@ csr_get_vdev_dot11_mode(struct mac_context *mac,
 
 QDF_STATUS csr_get_channel_and_power_list(struct mac_context *mac);
 
-QDF_STATUS csr_scan_filter_results(struct mac_context *mac);
-
 QDF_STATUS csr_set_modify_profile_fields(struct mac_context *mac,
 		uint32_t sessionId, tCsrRoamModifyProfileFields *
 		pModifyProfileFields);

+ 0 - 43
core/sme/inc/sme_api.h

@@ -503,15 +503,6 @@ sme_register_bcn_report_pe_cb(mac_handle_t mac_handle, beacon_report_cb cb)
 QDF_STATUS sme_ser_cmd_callback(struct wlan_serialization_command *cmd,
 				enum wlan_serialization_cb_reason reason);
 
-/**
- * sme_purge_pdev_all_ser_cmd_list() - purge all scan and non-scan
- * active and pending cmds for pdev
- * @mac_handle: pointer to global MAC context
- *
- * Return : none
- */
-void sme_purge_pdev_all_ser_cmd_list(mac_handle_t mac_handle);
-
 /*
  * sme_process_msg() - The main message processor for SME.
  * @mac: The global mac context
@@ -527,24 +518,6 @@ void sme_purge_pdev_all_ser_cmd_list(mac_handle_t mac_handle);
 QDF_STATUS sme_process_msg(struct mac_context *mac, struct scheduler_msg *pMsg);
 
 QDF_STATUS sme_mc_process_handler(struct scheduler_msg *msg);
-/*
- * sme_scan_get_result() - Return scan results based on filter
- * @mac: Pointer to Global MAC structure
- * @vdev_id: vdev_id
- * @filter: If pFilter is NULL, all cached results are returned
- * @phResult: an object for the result.
- *
- * Return QDF_STATUS
- */
-QDF_STATUS sme_scan_get_result(mac_handle_t mac_handle, uint8_t vdev_id,
-			       struct scan_filter *filter,
-			       tScanResultHandle *phResult);
-
-tCsrScanResultInfo *sme_scan_result_get_first(mac_handle_t,
-		tScanResultHandle hScanResult);
-tCsrScanResultInfo *sme_scan_result_get_next(mac_handle_t,
-		tScanResultHandle hScanResult);
-QDF_STATUS sme_scan_result_purge(tScanResultHandle hScanResult);
 
 #ifndef SAP_CP_CLEANUP
 /**
@@ -2181,9 +2154,6 @@ static inline void sme_register_p2p_lo_event(mac_handle_t mac_handle,
 }
 #endif
 
-QDF_STATUS sme_remove_bssid_from_scan_list(mac_handle_t mac_handle,
-	tSirMacAddr bssid);
-
 QDF_STATUS sme_process_mac_pwr_dbg_cmd(mac_handle_t mac_handle,
 				       uint32_t session_id,
 				       struct sir_mac_pwr_dbg_cmd*
@@ -2874,19 +2844,6 @@ QDF_STATUS sme_set_he_bss_color(mac_handle_t mac_handle, uint8_t session_id,
  */
 bool sme_is_conn_state_connected(mac_handle_t mac_handle, uint8_t session_id);
 
-/**
- * sme_scan_get_result_for_bssid - gets the scan result from scan cache for the
- * bssid specified
- * @mac_handle: handle returned by mac_open
- * @bssid: bssid to get the scan result for
- * @res: pointer to tCsrScanResultInfo allocated from caller
- *
- * Return: QDF_STATUS
- */
-QDF_STATUS sme_scan_get_result_for_bssid(mac_handle_t mac_handle,
-					 struct qdf_mac_addr *bssid,
-					 tCsrScanResultInfo *res);
-
 /**
  * sme_get_bss_transition_status() - get bss transition status all cadidates
  * @mac_handle: handle returned by mac_open

+ 3 - 157
core/sme/src/common/sme_api.c

@@ -281,19 +281,6 @@ static QDF_STATUS sme_process_hw_mode_trans_ind(struct mac_context *mac,
 	return QDF_STATUS_SUCCESS;
 }
 
-void sme_purge_pdev_all_ser_cmd_list(mac_handle_t mac_handle)
-{
-	QDF_STATUS status;
-	struct mac_context *mac_ctx = MAC_CONTEXT(mac_handle);
-
-	status = sme_acquire_global_lock(&mac_ctx->sme);
-	if (QDF_IS_STATUS_ERROR(status))
-		return;
-
-	csr_purge_pdev_all_ser_cmd_list(mac_ctx);
-	sme_release_global_lock(&mac_ctx->sme);
-}
-
 /**
  * free_sme_cmds() - This function frees memory allocated for SME commands
  * @mac_ctx:      Pointer to Global MAC structure
@@ -3104,147 +3091,6 @@ QDF_STATUS sme_close(mac_handle_t mac_handle)
 	return fail_status;
 }
 
-/**
- * sme_remove_bssid_from_scan_list() - wrapper to remove the bssid from
- * scan list
- * @mac_handle: Opaque handle to the global MAC context.
- * @bssid: bssid to be removed
- *
- * This function remove the given bssid from scan list.
- *
- * Return: QDF status.
- */
-QDF_STATUS sme_remove_bssid_from_scan_list(mac_handle_t mac_handle,
-					   tSirMacAddr bssid)
-{
-	QDF_STATUS status = QDF_STATUS_E_FAILURE;
-	struct mac_context *mac_ctx = MAC_CONTEXT(mac_handle);
-
-	status = sme_acquire_global_lock(&mac_ctx->sme);
-	if (QDF_IS_STATUS_SUCCESS(status)) {
-		csr_remove_bssid_from_scan_list(mac_ctx, bssid);
-		sme_release_global_lock(&mac_ctx->sme);
-	}
-
-	return status;
-}
-
-QDF_STATUS sme_scan_get_result(mac_handle_t mac_handle, uint8_t vdev_id,
-			       struct scan_filter *filter,
-			       tScanResultHandle *phResult)
-{
-	QDF_STATUS status = QDF_STATUS_E_FAILURE;
-	struct mac_context *mac = MAC_CONTEXT(mac_handle);
-
-	MTRACE(qdf_trace(QDF_MODULE_ID_SME,
-			 TRACE_CODE_SME_RX_HDD_MSG_SCAN_GET_RESULTS, vdev_id,
-			 0));
-	status = sme_acquire_global_lock(&mac->sme);
-	if (QDF_IS_STATUS_SUCCESS(status)) {
-		status = csr_scan_get_result(mac, filter, phResult);
-		sme_release_global_lock(&mac->sme);
-	}
-
-	return status;
-}
-
-QDF_STATUS sme_scan_get_result_for_bssid(mac_handle_t mac_handle,
-					 struct qdf_mac_addr *bssid,
-					 tCsrScanResultInfo *res)
-{
-	struct mac_context *mac_ctx = MAC_CONTEXT(mac_handle);
-	QDF_STATUS status;
-
-	status = sme_acquire_global_lock(&mac_ctx->sme);
-	if (QDF_IS_STATUS_SUCCESS(status)) {
-		status = csr_scan_get_result_for_bssid(mac_ctx, bssid, res);
-		sme_release_global_lock(&mac_ctx->sme);
-	}
-
-	return status;
-}
-
-/*
- * sme_scan_result_get_first() -
- * A wrapper function to request CSR to returns the first element of
- * scan result.
- * This is a synchronous call
- *
- * hScanResult - returned from csr_scan_get_result
- * Return tCsrScanResultInfo * - NULL if no result
- */
-tCsrScanResultInfo *sme_scan_result_get_first(mac_handle_t mac_handle,
-					      tScanResultHandle hScanResult)
-{
-	QDF_STATUS status = QDF_STATUS_E_FAILURE;
-	struct mac_context *mac = MAC_CONTEXT(mac_handle);
-	tCsrScanResultInfo *pRet = NULL;
-
-	MTRACE(qdf_trace(QDF_MODULE_ID_SME,
-			 TRACE_CODE_SME_RX_HDD_MSG_SCAN_RESULT_GETFIRST,
-			 NO_SESSION, 0));
-	status = sme_acquire_global_lock(&mac->sme);
-	if (QDF_IS_STATUS_SUCCESS(status)) {
-		pRet = csr_scan_result_get_first(mac, hScanResult);
-		sme_release_global_lock(&mac->sme);
-	}
-
-	return pRet;
-}
-
-/*
- * sme_scan_result_get_next() -
- * A wrapper function to request CSR to returns the next element of
- * scan result. It can be called without calling csr_scan_result_get_first first
- *   This is a synchronous call
- *
- * hScanResult - returned from csr_scan_get_result
- * Return Null if no result or reach the end
- */
-tCsrScanResultInfo *sme_scan_result_get_next(mac_handle_t mac_handle,
-					     tScanResultHandle hScanResult)
-{
-	QDF_STATUS status = QDF_STATUS_E_FAILURE;
-	struct mac_context *mac = MAC_CONTEXT(mac_handle);
-	tCsrScanResultInfo *pRet = NULL;
-
-	status = sme_acquire_global_lock(&mac->sme);
-	if (QDF_IS_STATUS_SUCCESS(status)) {
-		pRet = csr_scan_result_get_next(mac, hScanResult);
-		sme_release_global_lock(&mac->sme);
-	}
-
-	return pRet;
-}
-
-/*
- * sme_scan_result_purge() -
- * A wrapper function to request CSR to remove all items(tCsrScanResult)
- * in the list and free memory for each item
- *   This is a synchronous call
- *
- * hScanResult - returned from csr_scan_get_result. hScanResult is
- *	considered gone by
- *  calling this function and even before this function reutrns.
- * Return QDF_STATUS
- */
-QDF_STATUS sme_scan_result_purge(tScanResultHandle hScanResult)
-{
-	QDF_STATUS status = QDF_STATUS_E_FAILURE;
-	struct mac_context *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(&mac_ctx->sme);
-	if (QDF_IS_STATUS_SUCCESS(status)) {
-		status = csr_scan_result_purge(mac_ctx, hScanResult);
-		sme_release_global_lock(&mac_ctx->sme);
-	}
-
-	return status;
-}
-
 eCsrPhyMode sme_get_phy_mode(mac_handle_t mac_handle)
 {
 	struct mac_context *mac = MAC_CONTEXT(mac_handle);
@@ -14659,6 +14505,7 @@ QDF_STATUS sme_get_bss_transition_status(mac_handle_t mac_handle,
 					 uint16_t n_candidates,
 					 bool is_bt_in_progress)
 {
+	struct mac_context *mac_ctx = MAC_CONTEXT(mac_handle);
 	QDF_STATUS status = QDF_STATUS_SUCCESS;
 	struct bss_description *bss_desc, *conn_bss_desc;
 	tCsrScanResultInfo *res, *conn_res;
@@ -14680,7 +14527,7 @@ QDF_STATUS sme_get_bss_transition_status(mac_handle_t mac_handle,
 	}
 
 	/* Get the connected BSS descriptor */
-	status = sme_scan_get_result_for_bssid(mac_handle, bssid, conn_res);
+	status = csr_scan_get_result_for_bssid(mac_ctx, bssid, conn_res);
 	if (!QDF_IS_STATUS_SUCCESS(status)) {
 		sme_err("Failed to find connected BSS in scan list");
 		goto free;
@@ -14689,8 +14536,7 @@ QDF_STATUS sme_get_bss_transition_status(mac_handle_t mac_handle,
 
 	for (i = 0; i < n_candidates; i++) {
 		/* Get candidate BSS descriptors */
-		status = sme_scan_get_result_for_bssid(mac_handle,
-						       &info[i].bssid,
+		status = csr_scan_get_result_for_bssid(mac_ctx, &info[i].bssid,
 						       res);
 		if (!QDF_IS_STATUS_SUCCESS(status)) {
 			sme_err("BSS "QDF_MAC_ADDR_FMT" not present in scan list",

+ 0 - 56
core/sme/src/csr/csr_api_scan.c

@@ -1002,62 +1002,6 @@ free_filter:
 	return status;
 }
 
-static inline QDF_STATUS
-csr_flush_scan_results(struct mac_context *mac_ctx,
-		       struct scan_filter *filter)
-{
-	struct wlan_objmgr_pdev *pdev = NULL;
-	QDF_STATUS status;
-
-	pdev = wlan_objmgr_get_pdev_by_id(mac_ctx->psoc,
-		0, WLAN_LEGACY_MAC_ID);
-	if (!pdev) {
-		sme_err("pdev is NULL");
-		return QDF_STATUS_E_INVAL;
-	}
-	status = ucfg_scan_flush_results(pdev, filter);
-
-	wlan_objmgr_pdev_release_ref(pdev, WLAN_LEGACY_MAC_ID);
-	return status;
-}
-
-static inline void csr_flush_bssid(struct mac_context *mac_ctx,
-				   uint8_t *bssid)
-{
-	struct scan_filter *filter;
-
-	filter = qdf_mem_malloc(sizeof(*filter));
-	if (!filter)
-		return;
-
-	filter->num_of_bssid = 1;
-	qdf_mem_copy(filter->bssid_list[0].bytes,
-		     bssid, QDF_MAC_ADDR_SIZE);
-
-	csr_flush_scan_results(mac_ctx, filter);
-	sme_debug("Removed BSS entry:"QDF_MAC_ADDR_FMT,
-		   QDF_MAC_ADDR_REF(bssid));
-	if (filter)
-		qdf_mem_free(filter);
-}
-
-void csr_remove_bssid_from_scan_list(struct mac_context *mac_ctx,
-				     tSirMacAddr bssid)
-{
-	csr_flush_bssid(mac_ctx, bssid);
-}
-
-/**
- * csr_scan_filter_results: filter scan result based
- * on valid channel list number.
- * @mac_ctx: mac context
- *
- * Get scan result from scan list and Check Scan result channel number
- * with 11d channel list if channel number is found in 11d channel list
- * then do not remove scan result entry from scan list
- *
- * return: QDF Status
- */
 QDF_STATUS csr_scan_filter_results(struct mac_context *mac_ctx)
 {
 	uint32_t len = mac_ctx->mlme_cfg->reg.valid_channel_list_num;

+ 9 - 18
core/sme/src/csr/csr_inside_api.h

@@ -254,12 +254,16 @@ QDF_STATUS csr_scan_get_result_for_bssid(struct mac_context *mac_ctx,
 					 struct qdf_mac_addr *bssid,
 					 tCsrScanResultInfo *res);
 
-/*
- * csr_scan_filter_results() -
- *  Filter scan results based on valid channel list.
+/**
+ * csr_scan_filter_results: filter scan result based
+ * on valid channel list number.
+ * @mac_ctx: mac context
  *
- * mac - Pointer to Global MAC structure
- * Return QDF_STATUS
+ * Get scan result from scan list and Check Scan result channel number
+ * with 11d channel list if channel number is found in 11d channel list
+ * then do not remove scan result entry from scan list
+ *
+ * return: QDF Status
  */
 QDF_STATUS csr_scan_filter_results(struct mac_context *mac);
 
@@ -588,19 +592,6 @@ csr_roam_prepare_bss_params(struct mac_context *mac_ctx, uint32_t session_id,
 			    struct csr_roam_profile *profile,
 			    struct bss_config_param *bss_cfg);
 
-/**
- * csr_remove_bssid_from_scan_list() - remove the bssid from
- * scan list
- * @mac_tx: mac context.
- * @bssid: bssid to be removed
- *
- * This function remove the given bssid from scan list.
- *
- * Return: void.
- */
-void csr_remove_bssid_from_scan_list(struct mac_context *mac_ctx,
-				     tSirMacAddr bssid);
-
 #ifndef SAP_CP_CLEANUP
 QDF_STATUS
 csr_roam_set_bss_config_cfg(struct mac_context *mac_ctx, uint32_t session_id,

+ 5 - 6
core/sme/src/rrm/sme_rrm.c

@@ -1,5 +1,6 @@
 /*
  * Copyright (c) 2011-2021 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
  *
  * Permission to use, copy, modify, and/or distribute this software for
  * any purpose with or without fee is hereby granted, provided that the
@@ -441,7 +442,6 @@ static QDF_STATUS sme_rrm_send_scan_result(struct mac_context *mac_ctx,
 					   uint32_t *freq_list,
 					   uint8_t measurementdone)
 {
-	mac_handle_t mac_handle = MAC_HANDLE(mac_ctx);
 	struct scan_filter *filter;
 	tScanResultHandle result_handle;
 	tCsrScanResultInfo *scan_results, *next_result;
@@ -507,8 +507,7 @@ static QDF_STATUS sme_rrm_send_scan_result(struct mac_context *mac_ctx,
 		sme_debug("BSSID mismatch, using current session_id");
 		session_id = mac_ctx->roam.roamSession->vdev_id;
 	}
-	status = sme_scan_get_result(mac_handle, (uint8_t)session_id,
-				     filter, &result_handle);
+	status = csr_scan_get_result(mac_ctx, filter, &result_handle);
 	qdf_mem_free(filter);
 
 	sme_debug("RRM Measurement Done %d for index:%d",
@@ -542,7 +541,7 @@ static QDF_STATUS sme_rrm_send_scan_result(struct mac_context *mac_ctx,
 							measurementdone, 0);
 		return status;
 	}
-	scan_results = sme_scan_result_get_first(mac_handle, result_handle);
+	scan_results = csr_scan_result_get_first(mac_ctx, result_handle);
 	if (!scan_results && measurementdone) {
 #ifdef FEATURE_WLAN_ESE
 		if (eRRM_MSG_SOURCE_ESE_UPLOAD == rrm_ctx->msgSource) {
@@ -614,7 +613,7 @@ static QDF_STATUS sme_rrm_send_scan_result(struct mac_context *mac_ctx,
 				sme_debug("Non Tx BSS of Conn AP in results");
 			}
 		}
-		next_result = sme_scan_result_get_next(mac_handle,
+		next_result = csr_scan_result_get_next(mac_ctx,
 						       result_handle);
 		sme_debug("Scan res timer:%lu, rrm scan timer:%llu",
 				scan_results->timer, rrm_scan_timer);
@@ -653,7 +652,7 @@ static QDF_STATUS sme_rrm_send_scan_result(struct mac_context *mac_ctx,
 rrm_send_scan_results_done:
 	if (scanresults_arr)
 		qdf_mem_free(scanresults_arr);
-	sme_scan_result_purge(result_handle);
+	csr_scan_result_purge(mac_ctx, result_handle);
 
 	return status;
 }