Jelajahi Sumber

qcacld-3.0: Initialize channel info for ACS even if channel is unsafe

Channel info for ACS is not getting initialized if channel is unsafe.
So, channel number, rssi, ACS weight, etc. is not getting initialized
and is 0 for all the unsafe channels. As a result, wrong weights are
getting calculated in ACS algo and wrong channel number is getting
printed in logs for all these channels.

Initialize channel info for ACS even if channel is unsafe.

Change-Id: Iec315ea818b5b51aef6879831b8be29ba4515983
CRs-Fixed: 2260798
Himanshu Agarwal 7 tahun lalu
induk
melakukan
052ce25534
1 mengubah file dengan 14 tambahan dan 9 penghapusan
  1. 14 9
      core/sap/src/sap_ch_select.c

+ 14 - 9
core/sap/src/sap_ch_select.c

@@ -604,8 +604,9 @@ static bool sap_chan_sel_init(tHalHandle halHandle,
 
 
 	/* Allocate memory for weight computation of 2.4GHz */
 	/* Allocate memory for weight computation of 2.4GHz */
 	pSpectCh =
 	pSpectCh =
-		(tSapSpectChInfo *) qdf_mem_malloc((pSpectInfoParams->numSpectChans)
-						   * sizeof(*pSpectCh));
+		(tSapSpectChInfo *)qdf_mem_malloc(
+					(pSpectInfoParams->numSpectChans) *
+					sizeof(*pSpectCh));
 
 
 	if (pSpectCh == NULL) {
 	if (pSpectCh == NULL) {
 		QDF_TRACE(QDF_MODULE_ID_SAP, QDF_TRACE_LEVEL_ERROR,
 		QDF_TRACE(QDF_MODULE_ID_SAP, QDF_TRACE_LEVEL_ERROR,
@@ -634,9 +635,18 @@ static bool sap_chan_sel_init(tHalHandle halHandle,
 	     channelnum++, pChans++, pSpectCh++) {
 	     channelnum++, pChans++, pSpectCh++) {
 		chSafe = true;
 		chSafe = true;
 
 
+		pSpectCh->chNum = *pChans;
+		/* Initialise for all channels */
+		pSpectCh->rssiAgr = SOFTAP_MIN_RSSI;
+		/* Initialise 20MHz for all the Channels */
+		pSpectCh->channelWidth = SOFTAP_HT20_CHANNELWIDTH;
+		/* Initialise max ACS weight for all channels */
+		pSpectCh->weight = SAP_ACS_WEIGHT_MAX;
+
 		/* check if the channel is in NOL blacklist */
 		/* check if the channel is in NOL blacklist */
-		if (sap_dfs_is_channel_in_nol_list(sap_ctx, *pChans,
-						   PHY_SINGLE_CHANNEL_CENTERED)) {
+		if (sap_dfs_is_channel_in_nol_list(
+					sap_ctx, *pChans,
+					PHY_SINGLE_CHANNEL_CENTERED)) {
 			QDF_TRACE(QDF_MODULE_ID_SAP, QDF_TRACE_LEVEL_INFO_HIGH,
 			QDF_TRACE(QDF_MODULE_ID_SAP, QDF_TRACE_LEVEL_INFO_HIGH,
 				  "In %s, Ch %d is in NOL list", __func__,
 				  "In %s, Ch %d is in NOL list", __func__,
 				  *pChans);
 				  *pChans);
@@ -680,12 +690,7 @@ static bool sap_chan_sel_init(tHalHandle halHandle,
 			continue;
 			continue;
 
 
 		if (true == chSafe) {
 		if (true == chSafe) {
-			pSpectCh->chNum = *pChans;
 			pSpectCh->valid = true;
 			pSpectCh->valid = true;
-			pSpectCh->rssiAgr = SOFTAP_MIN_RSSI;    /* Initialise for all channels */
-			pSpectCh->channelWidth = SOFTAP_HT20_CHANNELWIDTH;      /* Initialise 20MHz for all the Channels */
-			/* Initialise max ACS weight for all channels */
-			pSpectCh->weight = SAP_ACS_WEIGHT_MAX;
 			for (chan_num = 0; chan_num < sap_ctx->num_of_channel;
 			for (chan_num = 0; chan_num < sap_ctx->num_of_channel;
 			     chan_num++) {
 			     chan_num++) {
 				if (pSpectCh->chNum !=
 				if (pSpectCh->chNum !=