summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeng Xu <pxu@qca.qualcomm.com>2014-11-14 16:00:19 -0800
committerAnjaneeDevi Kapparapu <c_akappa@qti.qualcomm.com>2014-11-20 16:57:59 +0530
commit10cb1f961bf5666bff4e41bb7b8a3bfa7e858ddf (patch)
treef209b04b5c070688fdc6090168912281cfcc6ef9
parent04c64159c0ccf6d3bfd65607f29e041cec5bad6a (diff)
qca-cld:sap: Fix ACS channel selection for HT40 and VHT80 cases
Currently the maximum weightage of a single channel is used as a threshold to determine if a channel can be picked. But in HT40 and VHT80 case the combined weightage of channels may exceed this threshold value. This fixes the threshold values for determine if a channel should be picked. Change-Id: I71ae3c48b329cca7989874034cfd9254c04520f5 CRs-fixed: 759593
-rw-r--r--CORE/SAP/src/sapChSelect.c51
-rw-r--r--CORE/SAP/src/sapChSelect.h1
2 files changed, 27 insertions, 25 deletions
diff --git a/CORE/SAP/src/sapChSelect.c b/CORE/SAP/src/sapChSelect.c
index 4599d1a441f7..f093bde15efd 100644
--- a/CORE/SAP/src/sapChSelect.c
+++ b/CORE/SAP/src/sapChSelect.c
@@ -1864,6 +1864,7 @@ void sapComputeSpectWeight( tSapChSelSpectInfo* pSpectInfoParams,
rssi = (v_S7_t)pSpectCh->rssiAgr;
pSpectCh->weight = SAPDFS_NORMALISE_1000 * sapweightRssiCount(rssi, pSpectCh->bssCount);
+ pSpectCh->weight_copy = pSpectCh->weight;
//------ Debug Info ------
VOS_TRACE(VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH,
@@ -2014,7 +2015,7 @@ void sapSortChlWeightHT80(tSapChSelSpectInfo *pSpectInfoParams)
best channel as the selected primary channel, update its
weightage with the combined weight value */
for (n=0; n<4; n++)
- pSpectInfo[j+n].weight = ACS_WEIGHT_MAX;
+ pSpectInfo[j+n].weight = ACS_WEIGHT_MAX * 4;
pSpectInfo[j+minIdx].weight = acsHT80Channels[i].weight;
}
@@ -2024,11 +2025,11 @@ void sapSortChlWeightHT80(tSapChSelSpectInfo *pSpectInfoParams)
skip this channel and those in the same HT80 width*/
pSpectInfo[j].weight = ACS_WEIGHT_MAX;
if ((pSpectInfo[j].chNum +4) == pSpectInfo[j+1].chNum)
- pSpectInfo[j+1].weight = ACS_WEIGHT_MAX;
+ pSpectInfo[j+1].weight = ACS_WEIGHT_MAX * 4;
if ((pSpectInfo[j].chNum +8) == pSpectInfo[j+2].chNum)
- pSpectInfo[j+2].weight = ACS_WEIGHT_MAX;
+ pSpectInfo[j+2].weight = ACS_WEIGHT_MAX * 4;
if ((pSpectInfo[j].chNum +12) == pSpectInfo[j+3].chNum)
- pSpectInfo[j+3].weight = ACS_WEIGHT_MAX;
+ pSpectInfo[j+3].weight = ACS_WEIGHT_MAX * 4;
}
}
@@ -2037,7 +2038,7 @@ void sapSortChlWeightHT80(tSapChSelSpectInfo *pSpectInfoParams)
{
if ( CHANNEL_165 == pSpectInfo[j].chNum )
{
- pSpectInfo[j].weight = ACS_WEIGHT_MAX;
+ pSpectInfo[j].weight = ACS_WEIGHT_MAX * 4;
break;
}
}
@@ -2106,15 +2107,15 @@ void sapSortChlWeightHT40_24G(tSapChSelSpectInfo *pSpectInfoParams)
if (pSpectInfo[j].weight <= pSpectInfo[j+4].weight)
{
pSpectInfo[j].weight = tmpWeight1;
- pSpectInfo[j+4].weight = ACS_WEIGHT_MAX;
- pSpectInfo[j+8].weight = ACS_WEIGHT_MAX;
+ pSpectInfo[j+4].weight = ACS_WEIGHT_MAX * 2;
+ pSpectInfo[j+8].weight = ACS_WEIGHT_MAX * 2;
}
else
{
pSpectInfo[j+4].weight = tmpWeight1;
/* for secondary channel selection */
- pSpectInfo[j].weight = ACS_WEIGHT_MAX - 1;
- pSpectInfo[j+8].weight = ACS_WEIGHT_MAX;
+ pSpectInfo[j].weight = ACS_WEIGHT_MAX * 2 - 1;
+ pSpectInfo[j+8].weight = ACS_WEIGHT_MAX * 2;
}
}
else
@@ -2122,15 +2123,15 @@ void sapSortChlWeightHT40_24G(tSapChSelSpectInfo *pSpectInfoParams)
if (pSpectInfo[j+4].weight <= pSpectInfo[j+8].weight)
{
pSpectInfo[j+4].weight = tmpWeight2;
- pSpectInfo[j].weight = ACS_WEIGHT_MAX;
+ pSpectInfo[j].weight = ACS_WEIGHT_MAX * 2;
/* for secondary channel selection */
- pSpectInfo[j+8].weight = ACS_WEIGHT_MAX - 1;
+ pSpectInfo[j+8].weight = ACS_WEIGHT_MAX * 2 - 1;
}
else
{
pSpectInfo[j+8].weight = tmpWeight2;
- pSpectInfo[j].weight = ACS_WEIGHT_MAX;
- pSpectInfo[j+4].weight = ACS_WEIGHT_MAX;
+ pSpectInfo[j].weight = ACS_WEIGHT_MAX * 2;
+ pSpectInfo[j+4].weight = ACS_WEIGHT_MAX * 2;
}
}
}
@@ -2140,17 +2141,17 @@ void sapSortChlWeightHT40_24G(tSapChSelSpectInfo *pSpectInfoParams)
if (pSpectInfo[j].weight <= pSpectInfo[j+4].weight)
{
pSpectInfo[j].weight = tmpWeight1;
- pSpectInfo[j+4].weight = ACS_WEIGHT_MAX;
+ pSpectInfo[j+4].weight = ACS_WEIGHT_MAX * 2;
}
else
{
pSpectInfo[j+4].weight = tmpWeight1;
- pSpectInfo[j].weight = ACS_WEIGHT_MAX;
+ pSpectInfo[j].weight = ACS_WEIGHT_MAX * 2;
}
}
}
else
- pSpectInfo[j].weight = ACS_WEIGHT_MAX;
+ pSpectInfo[j].weight = ACS_WEIGHT_MAX * 2;
}
sapSortChlWeight(pSpectInfoParams);
@@ -2205,19 +2206,19 @@ void sapSortChlWeightHT40_5G(tSapChSelSpectInfo *pSpectInfoParams)
pSpectInfo[j].weight = acsHT40Channels5G[i].weight;
/* mark the adjacent channel's weight as max value so
that it will be sorted to the bottom */
- pSpectInfo[j+1].weight = ACS_WEIGHT_MAX;
+ pSpectInfo[j+1].weight = ACS_WEIGHT_MAX * 2;
}
else
{
pSpectInfo[j+1].weight = acsHT40Channels5G[i].weight;
/* mark the adjacent channel's weight as max value so
that it will be sorted to the bottom */
- pSpectInfo[j].weight = ACS_WEIGHT_MAX;
+ pSpectInfo[j].weight = ACS_WEIGHT_MAX * 2;
}
}
else
- pSpectInfo[j].weight = ACS_WEIGHT_MAX;
+ pSpectInfo[j].weight = ACS_WEIGHT_MAX * 2;
}
/* avoid channel 165 by setting its weight to max */
@@ -2226,7 +2227,7 @@ void sapSortChlWeightHT40_5G(tSapChSelSpectInfo *pSpectInfoParams)
{
if ( CHANNEL_165 == pSpectInfo[j].chNum )
{
- pSpectInfo[j].weight = ACS_WEIGHT_MAX;
+ pSpectInfo[j].weight = ACS_WEIGHT_MAX * 2;
break;
}
}
@@ -2563,7 +2564,7 @@ v_U8_t sapSelectChannel(tHalHandle halHandle, ptSapContext pSapCtx, tScanResult
continue;
}
- if (pSpectInfoParams->pSpectCh[count].weight >
+ if (pSpectInfoParams->pSpectCh[count].weight_copy >
pSapCtx->acsBandSwitchThreshold)
{
/* the best channel exceeds the threshold
@@ -2582,7 +2583,7 @@ v_U8_t sapSelectChannel(tHalHandle halHandle, ptSapContext pSapCtx, tScanResult
{
/* all bands are scanned, compare current best channel
with channel scanned previously */
- if ( pSpectInfoParams->pSpectCh[count].weight >
+ if ( pSpectInfoParams->pSpectCh[count].weight_copy >
pSapCtx->acsBestChannelInfo.weight)
{
/* previous stored channel is better */
@@ -2592,7 +2593,7 @@ v_U8_t sapSelectChannel(tHalHandle halHandle, ptSapContext pSapCtx, tScanResult
{
pSapCtx->acsBestChannelInfo.channelNum = bestChNum;
pSapCtx->acsBestChannelInfo.weight =
- pSpectInfoParams->pSpectCh[count].weight;
+ pSpectInfoParams->pSpectCh[count].weight_copy;
}
}
}
@@ -2600,7 +2601,7 @@ v_U8_t sapSelectChannel(tHalHandle halHandle, ptSapContext pSapCtx, tScanResult
{
pSapCtx->acsBestChannelInfo.channelNum = bestChNum;
pSapCtx->acsBestChannelInfo.weight =
- pSpectInfoParams->pSpectCh[count].weight;
+ pSpectInfoParams->pSpectCh[count].weight_copy;
}
}
@@ -2611,7 +2612,7 @@ v_U8_t sapSelectChannel(tHalHandle halHandle, ptSapContext pSapCtx, tScanResult
/* Give preference to Non-overlap channels */
if (sapFilterOverLapCh(pSapCtx,
pSpectInfoParams->pSpectCh[count].chNum) &&
- (pSpectInfoParams->pSpectCh[count].weight <=
+ (pSpectInfoParams->pSpectCh[count].weight_copy <=
pSapCtx->acsBestChannelInfo.weight))
{
tmpChNum = pSpectInfoParams->pSpectCh[count].chNum;
diff --git a/CORE/SAP/src/sapChSelect.h b/CORE/SAP/src/sapChSelect.h
index f4455e2d6e92..1e2d1daf74c0 100644
--- a/CORE/SAP/src/sapChSelect.h
+++ b/CORE/SAP/src/sapChSelect.h
@@ -158,6 +158,7 @@ typedef struct {
v_U16_t bssCount; // bss found in scanresult for this channel
v_S31_t rssiAgr; // Max value of rssi among all BSS(es) from scanresult for this channel
v_U32_t weight; // Weightage of this channel
+ v_U32_t weight_copy; //copy of the orignal weight
v_BOOL_t valid; // Is this a valid center frequency for regulatory domain
} tSapSpectChInfo;//tDfsSpectChInfo;