Răsfoiți Sursa

qcacld-3.0: Refactor code to store chan info status in cp_stats

Currently channel info stats are stored in LIM. Refactor
code to store channel info stats in cp stats component.

Change-Id: I2e7219c112e96916d3b73f974dd9803b9c2821c3
CRs-Fixed: 3265722
Surabhi Vishnoi 2 ani în urmă
părinte
comite
1981726d18

+ 45 - 0
components/cp_stats/dispatcher/inc/wlan_cp_stats_mc_defs.h

@@ -329,6 +329,49 @@ struct pdev_mc_cp_extd_stats {
 	uint32_t rx_other_11ax_msdu_cnt;
 };
 
+/**
+ * struct channel_status
+ * @channel_freq: Channel freq
+ * @noise_floor: Noise Floor value
+ * @rx_clear_count: rx clear count
+ * @cycle_count: cycle count
+ * @chan_tx_pwr_range: channel tx power per range in 0.5dBm steps
+ * @chan_tx_pwr_throughput: channel tx power per throughput
+ * @rx_frame_count: rx frame count (cumulative)
+ * @bss_rx_cycle_count: BSS rx cycle count
+ * @rx_11b_mode_data_duration: b-mode data rx time (units are microseconds)
+ * @tx_frame_count: BSS tx cycle count
+ * @mac_clk_mhz: sample frequency
+ * @channel_id: channel index
+ * @cmd_flags: indicate which stat event is this status coming from
+ */
+struct channel_status {
+	uint32_t    channel_freq;
+	uint32_t    noise_floor;
+	uint32_t    rx_clear_count;
+	uint32_t    cycle_count;
+	uint32_t    chan_tx_pwr_range;
+	uint32_t    chan_tx_pwr_throughput;
+	uint32_t    rx_frame_count;
+	uint32_t    bss_rx_cycle_count;
+	uint32_t    rx_11b_mode_data_duration;
+	uint32_t    tx_frame_count;
+	uint32_t    mac_clk_mhz;
+	uint32_t    channel_id;
+	uint32_t    cmd_flags;
+};
+
+/**
+ * struct per_channel_stats
+ * @total_channel: total number of be scanned channel
+ * @channel_status_list: channel status info store in this array
+ */
+struct per_channel_stats {
+	uint8_t total_channel;
+	struct channel_status
+		 channel_status_list[NUM_CHANNELS];
+};
+
 /**
  * struct pdev_mc_cp_stats: pdev specific stats
  * @max_pwr: max tx power for pdev
@@ -336,6 +379,7 @@ struct pdev_mc_cp_extd_stats {
  * @rx_clear_count: accumulative rx clear count (busy time) of pdev
  * @cycle_count: accumulative cycle count (total time) of pdev
  * @tx_frame_count: accumulative tx frame count (total time) of pdev
+ * @chan_stats: per channel info stats
  */
 struct pdev_mc_cp_stats {
 	int32_t max_pwr;
@@ -343,6 +387,7 @@ struct pdev_mc_cp_stats {
 	uint32_t rx_clear_count;
 	uint32_t cycle_count;
 	uint32_t tx_frame_count;
+	struct per_channel_stats chan_stats;
 };
 
 /**

+ 48 - 0
components/cp_stats/dispatcher/inc/wlan_cp_stats_mc_ucfg_api.h

@@ -378,6 +378,36 @@ wlan_cfg80211_mc_bmiss_get_infra_cp_stats(
 }
 #endif /* CONFIG_WLAN_BMISS */
 
+/**
+ * wlan_cp_stats_update_chan_info() - API to update chan stats
+ * @psoc: pointer to psoc
+ * @chan_stat: channel stats
+ * @vdev_id: vdev id
+ *
+ * Return: None
+ */
+void wlan_cp_stats_update_chan_info(struct wlan_objmgr_psoc *psoc,
+				    struct channel_status *chan_stat,
+				    uint8_t vdev_id);
+
+/**
+ * ucfg_mc_cp_stats_clear_channel_status() - API to clear chan stats
+ * @pdev: pointer to pdev object
+ *
+ * Return: None
+ */
+void ucfg_mc_cp_stats_clear_channel_status(struct wlan_objmgr_pdev *pdev);
+
+/**
+ * ucfg_mc_cp_stats_get_channel_status() - API to get chan stats
+ * @pdev: pointer to pdev object
+ * @chan_freq: channel freq of which stats are needed
+ *
+ * Return: channel status
+ */
+struct channel_status *
+ucfg_mc_cp_stats_get_channel_status(struct wlan_objmgr_pdev *pdev,
+				    uint32_t chan_freq);
 #else /* QCA_SUPPORT_CP_STATS */
 
 void static inline ucfg_mc_cp_stats_register_pmo_handler(void) { };
@@ -465,5 +495,23 @@ ucfg_mc_cp_stats_get_tx_power(struct wlan_objmgr_vdev *vdev,
 			      int *dbm)
 {}
 
+static inline
+void wlan_cp_stats_update_chan_info(struct wlan_objmgr_psoc *psoc,
+				    struct channel_status *chan_stat,
+				    uint8_t vdev_id)
+{
+}
+
+static inline
+void ucfg_mc_cp_stats_clear_channel_status(struct wlan_objmgr_pdev *pdev)
+{
+}
+
+static inline struct channel_status *
+ucfg_mc_cp_stats_get_channel_status(struct wlan_objmgr_pdev *pdev,
+				    uint32_t chan_freq)
+{
+	return NULL;
+}
 #endif /* QCA_SUPPORT_CP_STATS */
 #endif /* __WLAN_CP_STATS_MC_UCFG_API_H__ */

+ 117 - 0
components/cp_stats/dispatcher/src/wlan_cp_stats_mc_ucfg_api.c

@@ -1072,4 +1072,121 @@ void ucfg_mc_cp_stats_register_pmo_handler(void)
 	pmo_register_resume_handler(WLAN_UMAC_COMP_CP_STATS,
 				    ucfg_mc_cp_stats_resume_handler, NULL);
 }
+
+void wlan_cp_stats_update_chan_info(struct wlan_objmgr_psoc *psoc,
+				    struct channel_status *channel_stat,
+				    uint8_t vdev_id)
+{
+	struct wlan_objmgr_pdev *pdev;
+	struct wlan_objmgr_vdev *vdev;
+	struct pdev_cp_stats *pdev_cp_stats_priv;
+	struct per_channel_stats *channel_stats;
+	struct channel_status *channel_status_list;
+	uint8_t total_channel;
+	uint8_t i;
+	bool found = false;
+
+	vdev = wlan_objmgr_get_vdev_by_id_from_psoc(psoc, vdev_id,
+						    WLAN_CP_STATS_ID);
+	if (!vdev)
+		return;
+
+	pdev = wlan_vdev_get_pdev(vdev);
+	if (!pdev)
+		return;
+
+	pdev_cp_stats_priv = wlan_cp_stats_get_pdev_stats_obj(pdev);
+	if (!pdev_cp_stats_priv) {
+		wlan_objmgr_vdev_release_ref(vdev, WLAN_CP_STATS_ID);
+		cp_stats_err("pdev cp stats object is null");
+		return;
+	}
+
+	channel_stats = &pdev_cp_stats_priv->pdev_stats->chan_stats;
+	channel_status_list = channel_stats->channel_status_list;
+	total_channel = channel_stats->total_channel;
+
+	for (i = 0; i < total_channel; i++) {
+		if (channel_status_list[i].channel_id ==
+		    channel_stat->channel_id) {
+			if (channel_stat->cmd_flags ==
+			    WMI_CHAN_InFO_END_RESP &&
+			    channel_status_list[i].cmd_flags ==
+			    WMI_CHAN_InFO_START_RESP) {
+				/* adjust to delta value for counts */
+				channel_stat->rx_clear_count -=
+				    channel_status_list[i].rx_clear_count;
+				channel_stat->cycle_count -=
+				    channel_status_list[i].cycle_count;
+				channel_stat->rx_frame_count -=
+				    channel_status_list[i].rx_frame_count;
+				channel_stat->tx_frame_count -=
+				    channel_status_list[i].tx_frame_count;
+				channel_stat->bss_rx_cycle_count -=
+				    channel_status_list[i].bss_rx_cycle_count;
+			}
+			qdf_mem_copy(&channel_status_list[i], channel_stat,
+				     sizeof(*channel_status_list));
+			found = true;
+			break;
+		}
+	}
+
+	if (!found) {
+		if (total_channel < NUM_CHANNELS) {
+			qdf_mem_copy(&channel_status_list[total_channel++],
+				     channel_stat,
+				     sizeof(*channel_status_list));
+			channel_stats->total_channel = total_channel;
+		} else {
+			cp_stats_err("Chan cnt exceed, channel_id=%d",
+				     channel_stat->channel_id);
+		}
+	}
+
+	wlan_objmgr_vdev_release_ref(vdev, WLAN_CP_STATS_ID);
+}
+
+struct channel_status *
+ucfg_mc_cp_stats_get_channel_status(struct wlan_objmgr_pdev *pdev,
+				    uint32_t chan_freq)
+{
+	struct pdev_cp_stats *pdev_cp_stats_priv;
+	struct per_channel_stats *channel_stats;
+	struct channel_status *entry;
+	uint8_t i;
+
+	pdev_cp_stats_priv = wlan_cp_stats_get_pdev_stats_obj(pdev);
+	if (!pdev_cp_stats_priv) {
+		cp_stats_err("pdev cp stats object is null");
+		return NULL;
+	}
+
+	channel_stats = &pdev_cp_stats_priv->pdev_stats->chan_stats;
+
+	for (i = 0; i < channel_stats->total_channel; i++) {
+		entry = &channel_stats->channel_status_list[i];
+		if (entry->channel_freq == chan_freq)
+			return entry;
+	}
+	cp_stats_err("Channel %d status info not exist", chan_freq);
+
+	return NULL;
+}
+
+void ucfg_mc_cp_stats_clear_channel_status(struct wlan_objmgr_pdev *pdev)
+{
+	struct pdev_cp_stats *pdev_cp_stats_priv;
+	struct per_channel_stats *channel_stats;
+
+	pdev_cp_stats_priv = wlan_cp_stats_get_pdev_stats_obj(pdev);
+	if (!pdev_cp_stats_priv) {
+		cp_stats_err("pdev cp stats object is null");
+		return;
+	}
+
+	channel_stats = &pdev_cp_stats_priv->pdev_stats->chan_stats;
+	channel_stats->total_channel = 0;
+}
+
 #endif

+ 0 - 2
core/mac/inc/ani_global.h

@@ -306,8 +306,6 @@ typedef struct sAniSirLim {
 
 	/* ////////////////////////////////////     TIMER RELATED END /////////////////////////////////////////// */
 
-	struct lim_scan_channel_status scan_channel_status;
-
 	uint8_t gLimCurrentBssUapsd;
 
 	/* */

+ 0 - 43
core/mac/inc/sir_api.h

@@ -1517,49 +1517,6 @@ typedef struct sSmeIbssPeerInd {
 	/* Beacon will be appended for new Peer indication. */
 } tSmeIbssPeerInd, *tpSmeIbssPeerInd;
 
-/**
- * struct lim_channel_status
- * @channelfreq: Channel freq
- * @noise_floor: Noise Floor value
- * @rx_clear_count: rx clear count
- * @cycle_count: cycle count
- * @chan_tx_pwr_range: channel tx power per range in 0.5dBm steps
- * @chan_tx_pwr_throughput: channel tx power per throughput
- * @rx_frame_count: rx frame count (cumulative)
- * @bss_rx_cycle_count: BSS rx cycle count
- * @rx_11b_mode_data_duration: b-mode data rx time (units are microseconds)
- * @tx_frame_count: BSS tx cycle count
- * @mac_clk_mhz: sample frequency
- * @channel_id: channel index
- * @cmd_flags: indicate which stat event is this status coming from
- */
-struct lim_channel_status {
-	uint32_t    channelfreq;
-	uint32_t    noise_floor;
-	uint32_t    rx_clear_count;
-	uint32_t    cycle_count;
-	uint32_t    chan_tx_pwr_range;
-	uint32_t    chan_tx_pwr_throughput;
-	uint32_t    rx_frame_count;
-	uint32_t    bss_rx_cycle_count;
-	uint32_t    rx_11b_mode_data_duration;
-	uint32_t    tx_frame_count;
-	uint32_t    mac_clk_mhz;
-	uint32_t    channel_id;
-	uint32_t    cmd_flags;
-};
-
-/**
- * struct lim_scan_channel_status
- * @total_channel: total number of be scanned channel
- * @channel_status_list: channel status info store in this array
- */
-struct lim_scan_channel_status {
-	uint8_t total_channel;
-	struct lim_channel_status
-		 channel_status_list[SIR_MAX_SUPPORTED_CHANNEL_LIST];
-};
-
 typedef struct sSmeMaxAssocInd {
 	uint16_t mesgType;      /* eWNI_SME_MAX_ASSOC_EXCEEDED */
 	uint16_t mesgLen;

+ 2 - 1
core/mac/inc/wni_api.h

@@ -236,7 +236,8 @@ enum eWniMsgTypes {
 	eWNI_SME_CSA_REQ = SIR_SME_MSG_TYPES_BEGIN + 176,
 	CM_ABORT_CONN_TIMER = SIR_SME_MSG_TYPES_BEGIN + 177,
 	WIFI_POS_PASN_PEER_DELETE_ALL = SIR_SME_MSG_TYPES_BEGIN + 178,
-	eWNI_SME_MSG_TYPES_END = SIR_SME_MSG_TYPES_BEGIN + 179
+	eWNI_SME_CHAN_INFO_EVENT = SIR_SME_MSG_TYPES_BEGIN + 179,
+	eWNI_SME_MSG_TYPES_END = SIR_SME_MSG_TYPES_BEGIN + 180
 };
 
 typedef struct sAniCfgTxRateCtrs {

+ 0 - 3
core/mac/src/pe/lim/lim_process_message_queue.c

@@ -1868,9 +1868,6 @@ static void lim_process_messages(struct mac_context *mac_ctx,
 	case WMA_AGGR_QOS_RSP:
 		lim_process_ft_aggr_qos_rsp(mac_ctx, msg);
 		break;
-	case WMA_RX_CHN_STATUS_EVENT:
-		lim_process_rx_channel_status_event(mac_ctx, msg->bodyptr);
-		break;
 	case WMA_DFS_BEACON_TX_SUCCESS_IND:
 		lim_process_beacon_tx_success_ind(mac_ctx, msg->type,
 				(void *)msg->bodyptr);

+ 0 - 21
core/mac/src/pe/lim/lim_process_mlm_rsp_messages.c

@@ -3183,24 +3183,3 @@ QDF_STATUS lim_send_beacon_ind(struct mac_context *mac,
 
 	return sch_process_pre_beacon_ind(mac, &msg, reason);
 }
-
-void lim_process_rx_channel_status_event(struct mac_context *mac_ctx, void *buf)
-{
-	struct lim_channel_status *chan_status = buf;
-
-	if (!chan_status) {
-		pe_err("ACS evt report buf NULL");
-		return;
-	}
-
-	if (mac_ctx->sap.acs_with_more_param ||
-	    sap_is_acs_scan_optimize_enable())
-		lim_add_channel_status_info(mac_ctx, chan_status,
-					    chan_status->channel_id);
-	else
-		pe_warn("Error evt report");
-
-	qdf_mem_free(buf);
-
-	return;
-}

+ 0 - 54
core/mac/src/pe/lim/lim_utils.c

@@ -4211,60 +4211,6 @@ lim_get_b_dfrom_rx_packet(struct mac_context *mac, void *body, uint32_t **pRxPac
 	*pRxPacketInfo = (uint32_t *) body;
 } /*** end lim_get_b_dfrom_rx_packet() ***/
 
-void lim_add_channel_status_info(struct mac_context *p_mac,
-				 struct lim_channel_status *channel_stat,
-				 uint8_t channel_id)
-{
-	uint8_t i;
-	bool found = false;
-	struct lim_scan_channel_status *channel_info =
-		&p_mac->lim.scan_channel_status;
-	struct lim_channel_status *channel_status_list =
-		channel_info->channel_status_list;
-	uint8_t total_channel = channel_info->total_channel;
-
-	if (!p_mac->sap.acs_with_more_param)
-		return;
-
-	for (i = 0; i < total_channel; i++) {
-		if (channel_status_list[i].channel_id == channel_id) {
-			if (channel_stat->cmd_flags ==
-			    WMI_CHAN_InFO_END_RESP &&
-			    channel_status_list[i].cmd_flags ==
-			    WMI_CHAN_InFO_START_RESP) {
-				/* adjust to delta value for counts */
-				channel_stat->rx_clear_count -=
-				    channel_status_list[i].rx_clear_count;
-				channel_stat->cycle_count -=
-				    channel_status_list[i].cycle_count;
-				channel_stat->rx_frame_count -=
-				    channel_status_list[i].rx_frame_count;
-				channel_stat->tx_frame_count -=
-				    channel_status_list[i].tx_frame_count;
-				channel_stat->bss_rx_cycle_count -=
-				    channel_status_list[i].bss_rx_cycle_count;
-			}
-			qdf_mem_copy(&channel_status_list[i], channel_stat,
-				     sizeof(*channel_status_list));
-			found = true;
-			break;
-		}
-	}
-
-	if (!found) {
-		if (total_channel < SIR_MAX_SUPPORTED_CHANNEL_LIST) {
-			qdf_mem_copy(&channel_status_list[total_channel++],
-				     channel_stat,
-				     sizeof(*channel_status_list));
-			channel_info->total_channel = total_channel;
-		} else {
-			pe_warn("Chan cnt exceed, channel_id=%d", channel_id);
-		}
-	}
-
-	return;
-}
-
 bool lim_is_channel_valid_for_channel_switch(struct mac_context *mac,
 					     uint32_t channel_freq)
 {

+ 0 - 13
core/mac/src/pe/lim/lim_utils.h

@@ -691,19 +691,6 @@ QDF_STATUS lim_post_sm_state_update(struct mac_context *mac,
 void lim_delete_sta_context(struct mac_context *mac, struct scheduler_msg *limMsg);
 void lim_delete_dialogue_token_list(struct mac_context *mac);
 
-/**
- * lim_add_channel_status_info() - store
- * chan status info into Global MAC structure
- * @p_mac: Pointer to Global MAC structure
- * @channel_stat: Pointer to chan status info reported by firmware
- * @channel_id: current channel id
- *
- * Return: None
- */
-void lim_add_channel_status_info(struct mac_context *p_mac,
-				 struct lim_channel_status *channel_stat,
-				 uint8_t channel_id);
-
 /**
  * lim_get_channel_from_beacon() - extract channel number
  * from beacon and convert to channel frequency

+ 0 - 1
core/mac/src/sys/legacy/src/utils/src/mac_trace.c

@@ -498,7 +498,6 @@ uint8_t *mac_trace_get_wma_msg_string(uint16_t wma_msg)
 		CASE_RETURN_STRING(WMA_TWT_NUDGE_DIALOG_REQUEST);
 #endif
 		CASE_RETURN_STRING(WMA_RX_SCAN_EVENT);
-		CASE_RETURN_STRING(WMA_RX_CHN_STATUS_EVENT);
 		CASE_RETURN_STRING(WMA_DEL_PERIODIC_TX_PTRN_IND);
 #ifdef FEATURE_WLAN_TDLS
 		CASE_RETURN_STRING(WMA_TDLS_SHOULD_DISCOVER_CMD);

+ 22 - 16
core/sap/src/sap_ch_select.c

@@ -50,6 +50,7 @@
 #include "pld_common.h"
 #include "wlan_reg_services_api.h"
 #include <wlan_scan_utils_api.h>
+#include <wlan_cp_stats_mc_ucfg_api.h>
 
 /*--------------------------------------------------------------------------
    Function definitions
@@ -583,10 +584,13 @@ uint32_t sapweight_rssi_count(struct sap_context *sap_ctx, int8_t rssi,
  *
  * Return: chan status info
  */
-static struct lim_channel_status *sap_get_channel_status
+static struct channel_status *sap_get_channel_status
 	(struct mac_context *p_mac, uint32_t chan_freq)
 {
-	return csr_get_channel_status(p_mac, chan_freq);
+	if (!p_mac->sap.acs_with_more_param)
+		return NULL;
+
+	return ucfg_mc_cp_stats_get_channel_status(p_mac->pdev, chan_freq);
 }
 
 /**
@@ -597,9 +601,11 @@ static struct lim_channel_status *sap_get_channel_status
  */
 static void sap_clear_channel_status(struct mac_context *p_mac)
 {
-	csr_clear_channel_status(p_mac);
-}
+	if (!p_mac->sap.acs_with_more_param)
+		return;
 
+	ucfg_mc_cp_stats_clear_channel_status(p_mac->pdev);
+}
 /**
  * sap_weight_channel_noise_floor() - compute noise floor weight
  * @sap_ctx:  sap context
@@ -608,7 +614,7 @@ static void sap_clear_channel_status(struct mac_context *p_mac)
  * Return: channel noise floor weight
  */
 static uint32_t sap_weight_channel_noise_floor(struct sap_context *sap_ctx,
-					       struct lim_channel_status
+					       struct channel_status
 						*channel_stat)
 {
 	uint32_t    noise_floor_weight;
@@ -623,7 +629,7 @@ static uint32_t sap_weight_channel_noise_floor(struct sap_context *sap_ctx,
 	    ACS_WEIGHT_CFG_TO_LOCAL(sap_ctx->auto_channel_select_weight,
 				    softap_nf_weight_cfg);
 
-	if (!channel_stat || channel_stat->channelfreq == 0)
+	if (!channel_stat || channel_stat->channel_freq == 0)
 		return softap_nf_weight_local;
 
 	noise_floor_weight = (channel_stat->noise_floor == 0) ? 0 :
@@ -640,7 +646,7 @@ static uint32_t sap_weight_channel_noise_floor(struct sap_context *sap_ctx,
 	sap_debug("nf=%d, nfwc=%d, nfwl=%d, nfw=%d freq=%d",
 		  channel_stat->noise_floor,
 		  softap_nf_weight_cfg, softap_nf_weight_local,
-		  noise_floor_weight, channel_stat->channelfreq);
+		  noise_floor_weight, channel_stat->channel_freq);
 
 	return noise_floor_weight;
 }
@@ -653,7 +659,7 @@ static uint32_t sap_weight_channel_noise_floor(struct sap_context *sap_ctx,
  * Return: channel free weight
  */
 static uint32_t sap_weight_channel_free(struct sap_context *sap_ctx,
-					struct lim_channel_status
+					struct channel_status
 					*channel_stat)
 {
 	uint32_t     channel_free_weight;
@@ -670,7 +676,7 @@ static uint32_t sap_weight_channel_free(struct sap_context *sap_ctx,
 	    ACS_WEIGHT_CFG_TO_LOCAL(sap_ctx->auto_channel_select_weight,
 				    softap_channel_free_weight_cfg);
 
-	if (!channel_stat || channel_stat->channelfreq == 0)
+	if (!channel_stat || channel_stat->channel_freq == 0)
 		return softap_channel_free_weight_local;
 
 	rx_clear_count = channel_stat->rx_clear_count -
@@ -711,7 +717,7 @@ static uint32_t sap_weight_channel_free(struct sap_context *sap_ctx,
  * Return: tx power range weight
  */
 static uint32_t sap_weight_channel_txpwr_range(struct sap_context *sap_ctx,
-					       struct lim_channel_status
+					       struct channel_status
 					       *channel_stat)
 {
 	uint32_t     txpwr_weight_low_speed;
@@ -726,7 +732,7 @@ static uint32_t sap_weight_channel_txpwr_range(struct sap_context *sap_ctx,
 	    ACS_WEIGHT_CFG_TO_LOCAL(sap_ctx->auto_channel_select_weight,
 				    softap_txpwr_range_weight_cfg);
 
-	if (!channel_stat || channel_stat->channelfreq == 0)
+	if (!channel_stat || channel_stat->channel_freq == 0)
 		return softap_txpwr_range_weight_local;
 
 
@@ -759,7 +765,7 @@ static uint32_t sap_weight_channel_txpwr_range(struct sap_context *sap_ctx,
  * Return: tx power throughput weight
  */
 static uint32_t sap_weight_channel_txpwr_tput(struct sap_context *sap_ctx,
-					      struct lim_channel_status
+					      struct channel_status
 					      *channel_stat)
 {
 	uint32_t     txpwr_weight_high_speed;
@@ -774,7 +780,7 @@ static uint32_t sap_weight_channel_txpwr_tput(struct sap_context *sap_ctx,
 	    ACS_WEIGHT_CFG_TO_LOCAL(sap_ctx->auto_channel_select_weight,
 				    softap_txpwr_tput_weight_cfg);
 
-	if (!channel_stat || channel_stat->channelfreq == 0)
+	if (!channel_stat || channel_stat->channel_freq == 0)
 		return softap_txpwr_tput_weight_local;
 
 	txpwr_weight_high_speed = (channel_stat->chan_tx_pwr_throughput == 0)
@@ -806,7 +812,7 @@ static uint32_t sap_weight_channel_txpwr_tput(struct sap_context *sap_ctx,
  */
 static
 uint32_t sap_weight_channel_status(struct sap_context *sap_ctx,
-				   struct lim_channel_status *channel_stat)
+				   struct channel_status *channel_stat)
 {
 	return sap_weight_channel_noise_floor(sap_ctx, channel_stat) +
 	       sap_weight_channel_free(sap_ctx, channel_stat) +
@@ -1403,8 +1409,8 @@ static void sap_compute_spect_weight(tSapChSelSpectInfo *pSpectInfoParams,
 				SAPDFS_NORMALISE_1000 *
 				(sapweight_rssi_count(sap_ctx, rssi,
 				pSpectCh->bssCount) + sap_weight_channel_status(
-				sap_ctx, sap_get_channel_status(mac,
-							 pSpectCh->chan_freq)));
+				sap_ctx, sap_get_channel_status(
+						mac, pSpectCh->chan_freq)));
 		else {
 			pSpectCh->weight = SAP_ACS_WEIGHT_MAX;
 			pSpectCh->rssiAgr = SOFTAP_MIN_RSSI;

+ 0 - 18
core/sme/inc/csr_api.h

@@ -845,24 +845,6 @@ static inline void csr_packetdump_timer_stop(void) {}
 static inline void csr_packetdump_timer_start(void) {}
 #endif
 
-/**
- * csr_get_channel_status() - get chan info via channel number
- * @mac: Pointer to Global MAC structure
- * @chan_freq: channel frequency
- *
- * Return: chan status info
- */
-struct lim_channel_status *
-csr_get_channel_status(struct mac_context *mac, uint32_t chan_freq);
-
-/**
- * csr_clear_channel_status() - clear chan info
- * @mac: Pointer to Global MAC structure
- *
- * Return: none
- */
-void csr_clear_channel_status(struct mac_context *mac);
-
 /**
  * csr_update_owe_info() - Update OWE info
  * @mac: mac context

+ 20 - 2
core/sme/src/common/sme_api.c

@@ -82,6 +82,7 @@
 #include <wlan_mlo_mgr_main.h>
 #include "wlan_policy_mgr_ucfg.h"
 #include "wlan_wifi_pos_interface.h"
+#include "wlan_cp_stats_mc_ucfg_api.h"
 
 static QDF_STATUS init_sme_cmd_list(struct mac_context *mac);
 
@@ -2601,6 +2602,19 @@ static void sme_link_lost_ind(struct mac_context *mac,
 		mac->sme.lost_link_info_cb(mac->hdd_handle, ind);
 }
 
+static void sme_process_chan_info_event(struct mac_context *mac,
+					struct channel_status *chan_stats,
+					uint8_t vdev_id)
+{
+	if (!chan_stats) {
+		sme_err("Chan info report is NULL\n");
+		return;
+	}
+
+	if (mac->sap.acs_with_more_param || sap_is_acs_scan_optimize_enable())
+		wlan_cp_stats_update_chan_info(mac->psoc, chan_stats, vdev_id);
+}
+
 QDF_STATUS sme_process_msg(struct mac_context *mac, struct scheduler_msg *pMsg)
 {
 	QDF_STATUS status = QDF_STATUS_E_FAILURE;
@@ -2922,6 +2936,10 @@ QDF_STATUS sme_process_msg(struct mac_context *mac, struct scheduler_msg *pMsg)
 							      pMsg->bodyptr);
 		qdf_mem_free(pMsg->bodyptr);
 		break;
+	case eWNI_SME_CHAN_INFO_EVENT:
+		sme_process_chan_info_event(mac, pMsg->bodyptr, pMsg->bodyval);
+		qdf_mem_free(pMsg->bodyptr);
+		break;
 	default:
 
 		if ((pMsg->type >= eWNI_SME_MSG_TYPES_BEGIN)
@@ -3252,8 +3270,8 @@ uint32_t sme_get_11b_data_duration(mac_handle_t mac_handle, uint32_t chan_freq)
 {
 	uint32_t rx_11b_data_duration = 0;
 	struct mac_context *mac = MAC_CONTEXT(mac_handle);
-	struct lim_channel_status *chan_status =
-					csr_get_channel_status(mac, chan_freq);
+	struct channel_status *chan_status =
+		ucfg_mc_cp_stats_get_channel_status(mac->pdev, chan_freq);
 
 	if (chan_status)
 		rx_11b_data_duration = chan_status->rx_11b_mode_data_duration;

+ 0 - 34
core/sme/src/csr/csr_util.c

@@ -1209,40 +1209,6 @@ uint16_t sme_chn_to_freq(uint8_t chanNum)
 	return 0;
 }
 
-struct lim_channel_status *
-csr_get_channel_status(struct mac_context *mac, uint32_t chan_freq)
-{
-	uint8_t i;
-	struct lim_scan_channel_status *channel_status;
-	struct lim_channel_status *entry;
-
-	if (!mac->sap.acs_with_more_param)
-		return NULL;
-
-	channel_status = &mac->lim.scan_channel_status;
-	for (i = 0; i < channel_status->total_channel; i++) {
-		entry = &channel_status->channel_status_list[i];
-		if (entry->channelfreq == chan_freq)
-			return entry;
-	}
-	sme_err("Channel %d status info not exist", chan_freq);
-
-	return NULL;
-}
-
-void csr_clear_channel_status(struct mac_context *mac)
-{
-	struct lim_scan_channel_status *channel_status;
-
-	if (!mac->sap.acs_with_more_param)
-		return;
-
-	channel_status = &mac->lim.scan_channel_status;
-	channel_status->total_channel = 0;
-
-	return;
-}
-
 /**
  * sme_bsstype_to_string() - converts bss type to string.
  * @bss_type: bss type enum

+ 0 - 1
core/wma/inc/wma_types.h

@@ -266,7 +266,6 @@ enum wmamsgtype {
 
 	WMA_UPDATE_CHAN_LIST_REQ = SIR_HAL_UPDATE_CHAN_LIST_REQ,
 	WMA_RX_SCAN_EVENT = SIR_HAL_RX_SCAN_EVENT,
-	WMA_RX_CHN_STATUS_EVENT = SIR_HAL_RX_CHN_STATUS_EVENT,
 
 	WMA_CLI_SET_CMD = SIR_HAL_CLI_SET_CMD,
 

+ 13 - 4
core/wma/src/wma_features.c

@@ -5071,10 +5071,11 @@ int wma_chan_info_event_handler(void *handle, uint8_t *event_buf,
 	wmi_chan_info_event_fixed_param *event;
 	struct scan_chan_info buf;
 	struct mac_context *mac = NULL;
-	struct lim_channel_status *channel_status;
+	struct channel_status *channel_status;
 	bool snr_monitor_enabled;
 	struct wlan_objmgr_vdev *vdev;
 	enum QDF_OPMODE mode;
+	struct scheduler_msg sme_msg = {0};
 
 	if (wma && wma->cds_context)
 		mac = (struct mac_context *)cds_get_context(QDF_MODULE_ID_PE);
@@ -5126,7 +5127,7 @@ int wma_chan_info_event_handler(void *handle, uint8_t *event_buf,
 			  event->rx_clear_count, event->cycle_count,
 			  event->chan_tx_pwr_range, event->chan_tx_pwr_tp);
 
-		channel_status->channelfreq = event->freq;
+		channel_status->channel_freq = event->freq;
 		channel_status->noise_floor = event->noise_floor;
 		channel_status->rx_clear_count =
 			 event->rx_clear_count;
@@ -5148,8 +5149,16 @@ int wma_chan_info_event_handler(void *handle, uint8_t *event_buf,
 		channel_status->cmd_flags =
 			event->cmd_flags;
 
-		wma_send_msg(handle, WMA_RX_CHN_STATUS_EVENT,
-			     (void *)channel_status, 0);
+		sme_msg.type = eWNI_SME_CHAN_INFO_EVENT;
+		sme_msg.bodyptr = channel_status;
+		sme_msg.bodyval = event->vdev_id;
+
+		if (QDF_STATUS_SUCCESS !=
+			scheduler_post_message(QDF_MODULE_ID_WMA,
+					       QDF_MODULE_ID_SME,
+					       QDF_MODULE_ID_SME, &sme_msg))
+			qdf_mem_free(channel_status);
+
 	}
 
 	return 0;