Browse Source

qcacld-3.0: Clean up code for sme apis

Clean up code for sme_get_valid_channels() and
sme_get_roam_intra_band() apis and
replace it with ucfg api.

Change-Id: Ic2f07e2193186d1e1ac81f6e5909417c10ab9c89
CRs-Fixed: 3335898
Krupali Dhanvijay 2 years ago
parent
commit
a3a9866f7d

+ 0 - 1
components/cmn_services/policy_mgr/inc/wlan_policy_mgr_api.h

@@ -1815,7 +1815,6 @@ typedef void (*policy_mgr_nss_update_cback)(struct wlan_objmgr_psoc *psoc,
 /**
  * struct policy_mgr_sme_cbacks - SME Callbacks to be invoked
  * from policy manager
- * @sme_get_valid_channels: Get valid channel list
  * @sme_get_nss_for_vdev: Get the allowed nss value for the vdev
  * @sme_soc_set_dual_mac_config: Set the dual MAC scan & FW
  *                             config

+ 15 - 0
components/mlme/dispatcher/inc/wlan_mlme_ucfg_api.h

@@ -4932,4 +4932,19 @@ ucfg_mlme_get_sr_enable_modes(struct wlan_objmgr_psoc *psoc,
 	*val = 0;
 }
 #endif
+
+/**
+ * ucfg_mlme_get_valid_channels  - get valid channels for
+ * current regulatory domain
+ * @psoc: pointer to psoc object
+ * @ch_freq_list: list of the valid channel frequencies
+ * @list_len: length of the channel list
+ *
+ * This function will get valid channels for current regulatory domain
+ *
+ * Return: QDF_STATUS_SUCCESS or non-zero on failure
+ */
+QDF_STATUS
+ucfg_mlme_get_valid_channels(struct wlan_objmgr_psoc *psoc,
+			     uint32_t *ch_freq_list, uint32_t *list_len);
 #endif /* _WLAN_MLME_UCFG_API_H_ */

+ 28 - 0
components/mlme/dispatcher/src/wlan_mlme_ucfg_api.c

@@ -1956,3 +1956,31 @@ done:
 
 	return phymode;
 }
+
+QDF_STATUS
+ucfg_mlme_get_valid_channels(struct wlan_objmgr_psoc *psoc,
+			     uint32_t *ch_freq_list, uint32_t *list_len)
+{
+	struct wlan_mlme_psoc_ext_obj *mlme_obj;
+	uint32_t num_valid_chan;
+	uint8_t i;
+
+	mlme_obj = mlme_get_psoc_ext_obj(psoc);
+	if (!mlme_obj) {
+		*list_len = 0;
+		mlme_legacy_err("Failed to get MLME Obj");
+		return QDF_STATUS_E_FAILURE;
+	}
+
+	num_valid_chan =  mlme_obj->cfg.reg.valid_channel_list_num;
+	if (num_valid_chan > *list_len) {
+		mlme_err("list len size %d less than expected %d", *list_len,
+			 num_valid_chan);
+		num_valid_chan = *list_len;
+	}
+	*list_len = num_valid_chan;
+	for (i = 0; i < *list_len; i++)
+		ch_freq_list[i] = mlme_obj->cfg.reg.valid_channel_freq_list[i];
+
+	return QDF_STATUS_SUCCESS;
+}

+ 10 - 0
components/umac/mlme/connection_mgr/dispatcher/inc/wlan_cm_roam_ucfg_api.h

@@ -432,4 +432,14 @@ ucfg_cm_get_sae_auth_ta(struct wlan_objmgr_pdev *pdev,
 {
 	return wlan_cm_get_sae_auth_ta(pdev, vdev_id, sae_auth_ta);
 }
+
+/*
+ * ucfg_cm_get_roam_intra_band() - get Intra band roaming
+ * @psoc: pointer to psoc object
+ * @val:  Infra band value
+ *
+ * Return Success or failure
+ */
+QDF_STATUS
+ucfg_cm_get_roam_intra_band(struct wlan_objmgr_psoc *psoc, uint16_t *val);
 #endif /* _WLAN_CM_ROAM_UCFG_API_H_ */

+ 14 - 0
components/umac/mlme/connection_mgr/dispatcher/src/wlan_cm_roam_ucfg_api.c

@@ -515,3 +515,17 @@ ucfg_cm_roam_is_vendor_handoff_control_enable(struct wlan_objmgr_psoc *psoc)
 
 #endif
 #endif /* WLAN_FEATURE_ROAM_OFFLOAD */
+
+QDF_STATUS
+ucfg_cm_get_roam_intra_band(struct wlan_objmgr_psoc *psoc, uint16_t *val)
+{
+	struct wlan_mlme_psoc_ext_obj *mlme_obj;
+
+	mlme_obj = mlme_get_psoc_ext_obj(psoc);
+	if (!mlme_obj)
+		return QDF_STATUS_E_INVAL;
+
+	*val = mlme_obj->cfg.lfr.roam_intra_band;
+
+	return QDF_STATUS_SUCCESS;
+}

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

@@ -13432,8 +13432,9 @@ static int __wlan_hdd_cfg80211_get_preferred_freq_list(struct wiphy *wiphy,
 	for (i = 0; i < pcl_len_legacy; i++)
 		freq_list_legacy[i] = chan_weights->pcl_list[i];
 	chan_weights->saved_num_chan = NUM_CHANNELS;
-	sme_get_valid_channels(chan_weights->saved_chan_list,
-			       &chan_weights->saved_num_chan);
+	ucfg_mlme_get_valid_channels(hdd_ctx->psoc,
+				     chan_weights->saved_chan_list,
+				     &chan_weights->saved_num_chan);
 	policy_mgr_get_valid_chan_weights(hdd_ctx->psoc, chan_weights,
 					  intf_mode,
 					  adapter->vdev);

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

@@ -3864,10 +3864,11 @@ static int drv_cmd_get_roam_intra_band(struct hdd_adapter *adapter,
 				       struct hdd_priv_data *priv_data)
 {
 	int ret = 0;
-	uint16_t val = sme_get_roam_intra_band(hdd_ctx->mac_handle);
+	uint16_t val = 0;
 	char extra[32];
 	uint8_t len = 0;
 
+	ucfg_cm_get_roam_intra_band(hdd_ctx->psoc, &val);
 	/* value is interms of msec */
 	len = scnprintf(extra, sizeof(extra), "%s %d",
 			"GETROAMINTRABAND", val);

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

@@ -972,8 +972,6 @@ sme_update_roam_scan_home_away_time(mac_handle_t mac_handle, uint8_t vdev_id,
 				    const uint16_t roam_scan_home_away_time,
 				    const bool send_offload_cmd);
 
-bool sme_get_roam_intra_band(mac_handle_t mac_handle);
-
 /**
  * sme_get_roam_scan_n_probes() - get Roam scan number of probes
  * @mac_handle: The handle returned by mac_open
@@ -2694,19 +2692,6 @@ QDF_STATUS sme_get_fw_state(mac_handle_t mac_handle,
 			    void *context);
 #endif /* FEATURE_FW_STATE */
 
-/**
- * sme_get_valid_channels() - sme api to get valid channels for
- * current regulatory domain
- * @ch_freq_list: list of the valid channel frequencies
- * @list_len: length of the channel list
- *
- * This function will get valid channels for current regulatory
- * domain
- *
- * Return: QDF_STATUS_SUCCESS or non-zero on failure
- */
-QDF_STATUS sme_get_valid_channels(uint32_t *ch_freq_list, uint32_t *list_len);
-
 /**
  * sme_get_mac_context() - sme api to get the pmac context
  *

+ 1 - 1
core/sme/inc/sme_trace.h

@@ -1,5 +1,6 @@
 /*
  * Copyright (c) 2013-2020 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
@@ -106,7 +107,6 @@ enum smecodetype {
 	TRACE_CODE_SME_RX_HDD_RESET_PW5G,
 	TRACE_CODE_SME_RX_HDD_UPDATE_RP5G,
 	TRACE_CODE_SME_RX_HDD_SET_ROAMIBAND,
-	TRACE_CODE_SME_RX_HDD_GET_ROAMIBAND,
 	TRACE_CODE_SME_RX_HDD_UPDATE_RSSIDIFF,
 	TRACE_CODE_SME_RX_HDD_UPDATE_IMMRSSIDIFF,
 	TRACE_CODE_SME_RX_HDD_UPDATE_FTENABLED,

+ 0 - 45
core/sme/src/common/sme_api.c

@@ -1156,34 +1156,6 @@ sme_register_bcn_report_pe_cb(mac_handle_t mac_handle, beacon_report_cb cb)
 }
 #endif
 
-QDF_STATUS sme_get_valid_channels(uint32_t *ch_freq_list, uint32_t *list_len)
-{
-	struct mac_context *mac_ctx = sme_get_mac_context();
-	uint32_t num_valid_chan;
-	uint8_t i;
-
-	if (!mac_ctx) {
-		sme_err("Invalid MAC context");
-		*list_len = 0;
-		return QDF_STATUS_E_FAILURE;
-	}
-
-	num_valid_chan = mac_ctx->mlme_cfg->reg.valid_channel_list_num;
-
-	if (num_valid_chan > *list_len) {
-		sme_err("list len size %d less than expected %d", *list_len,
-			num_valid_chan);
-		num_valid_chan = *list_len;
-	}
-	*list_len = num_valid_chan;
-	for (i = 0; i < *list_len; i++) {
-		ch_freq_list[i] =
-			mac_ctx->mlme_cfg->reg.valid_channel_freq_list[i];
-	}
-
-	return QDF_STATUS_SUCCESS;
-}
-
 #ifdef WLAN_CONV_SPECTRAL_ENABLE
 static QDF_STATUS sme_register_spectral_cb(struct mac_context *mac_ctx)
 {
@@ -6100,23 +6072,6 @@ QDF_STATUS sme_ext_change_freq(mac_handle_t mac_handle, qdf_freq_t ch_freq,
 	return status;
 }
 
-/*
- * sme_get_roam_intra_band() -
- * get Intra band roaming
- *
- * mac_handle: Opaque handle to the global MAC context
- * Return Success or failure
- */
-bool sme_get_roam_intra_band(mac_handle_t mac_handle)
-{
-	struct mac_context *mac = MAC_CONTEXT(mac_handle);
-
-	MTRACE(qdf_trace(QDF_MODULE_ID_SME,
-			 TRACE_CODE_SME_RX_HDD_GET_ROAMIBAND, NO_SESSION, 0));
-
-	return mac->mlme_cfg->lfr.roam_intra_band;
-}
-
 QDF_STATUS sme_get_roam_scan_n_probes(mac_handle_t mac_handle, uint8_t vdev_id,
 				      uint8_t *roam_scan_n_probes)
 {

+ 1 - 1
core/sme/src/common/sme_trace.c

@@ -1,5 +1,6 @@
 /*
  * Copyright (c) 2013-2020 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
@@ -122,7 +123,6 @@ static uint8_t *sme_trace_get_rx_msg_string(uint32_t code)
 		CASE_RETURN_STRING(TRACE_CODE_SME_RX_HDD_RESET_PW5G);
 		CASE_RETURN_STRING(TRACE_CODE_SME_RX_HDD_UPDATE_RP5G);
 		CASE_RETURN_STRING(TRACE_CODE_SME_RX_HDD_SET_ROAMIBAND);
-		CASE_RETURN_STRING(TRACE_CODE_SME_RX_HDD_GET_ROAMIBAND);
 		CASE_RETURN_STRING(TRACE_CODE_SME_RX_HDD_UPDATE_RSSIDIFF);
 		CASE_RETURN_STRING(TRACE_CODE_SME_RX_HDD_UPDATE_IMMRSSIDIFF);
 		CASE_RETURN_STRING(TRACE_CODE_SME_RX_HDD_UPDATE_FTENABLED);