wlan: Updating the Channel list based on 11d info from AP
Taking the channel list from AP and the other band channel
list retriving from nv.bin
CRs-Fixed: 449915
Change-Id: I58b84d60d8082d34a88a70e92b95f62a7bc208e7
diff --git a/CORE/SME/inc/csrInternal.h b/CORE/SME/inc/csrInternal.h
index d4c1a14..83a3b8e 100644
--- a/CORE/SME/inc/csrInternal.h
+++ b/CORE/SME/inc/csrInternal.h
@@ -1081,6 +1081,10 @@
void csrScanResumeIMPS( tpAniSirGlobal pMac );
eHalStatus csrInitGetChannels(tpAniSirGlobal pMac);
+// Getting the 5GHz Channel list
+eHalStatus csrGet5GChannels(tpAniSirGlobal pMac);
+// Getting the 2.4GHz Channel list
+eHalStatus csrGet24GChannels(tpAniSirGlobal pMac);
eHalStatus csrSetModifyProfileFields(tpAniSirGlobal pMac, tANI_U32 sessionId,
tCsrRoamModifyProfileFields *pModifyProfileFields);
diff --git a/CORE/SME/src/csr/csrApiRoam.c b/CORE/SME/src/csr/csrApiRoam.c
index b465002..a5f5982 100644
--- a/CORE/SME/src/csr/csrApiRoam.c
+++ b/CORE/SME/src/csr/csrApiRoam.c
@@ -1877,6 +1877,117 @@
}
return status;
}
+
+eHalStatus csrGet5GChannels(tpAniSirGlobal pMac)
+{
+ eHalStatus status = eHAL_STATUS_SUCCESS;
+ tANI_U8 num20MHzChannelsFound = 0;
+ VOS_STATUS vosStatus;
+ tANI_U8 num40MHzChannelsFound = 0;
+ tANI_U8 Index = 0;
+ tANI_U8 channelList = 0;
+
+ // Updating the defaultpower Table for changed Domain Id
+ vosStatus = vos_nv_getChannelListWithPower( pMac->scan.defaultPowerTable, &num20MHzChannelsFound,
+ pMac->scan.defaultPowerTable40MHz, &num40MHzChannelsFound);
+
+ if ( (VOS_STATUS_SUCCESS != vosStatus) || (num20MHzChannelsFound == 0) )
+ {
+ smsLog( pMac, LOGE, FL("failed to get channels"));
+ status = eHAL_STATUS_FAILURE;
+ }
+ else
+ {
+ if ( num20MHzChannelsFound > WNI_CFG_VALID_CHANNEL_LIST_LEN )
+ {
+ num20MHzChannelsFound = WNI_CFG_VALID_CHANNEL_LIST_LEN;
+ }
+
+ // Move the only 5GHZ channel list to the global data,
+ // As 2.4GHZ list coming from the AP for the changed domain
+ // structure -- this will be used as the scan list
+ for(channelList = 0; channelList < WNI_CFG_VALID_CHANNEL_LIST_LEN; channelList++)
+ {
+ // If Channel is 5GHz just break the for loop
+ if(!(pMac->scan.base20MHzChannels.channelList[ channelList ] > 0 && pMac->scan.base20MHzChannels.channelList[ channelList ] <= 14))
+ break;
+ }
+ // Update the 5G channels from nv.bin
+ for ( Index = 0; Index < num20MHzChannelsFound; Index++)
+ {
+ if(pMac->scan.defaultPowerTable[Index].chanId >= 36 && pMac->scan.defaultPowerTable[Index].chanId <= 165)
+ {
+ pMac->scan.base20MHzChannels.channelList[ channelList ] = pMac->scan.defaultPowerTable[Index].chanId;
+ channelList++;
+ }
+ }
+
+ pMac->scan.numChannelsDefault = (num20MHzChannelsFound > channelList) ? num20MHzChannelsFound : channelList;
+ pMac->scan.base20MHzChannels.numChannels = (num20MHzChannelsFound > channelList) ? num20MHzChannelsFound : channelList;
+ // Filling the remaining index as Zero Just for causion
+ for(Index = pMac->scan.base20MHzChannels.numChannels; Index < WNI_CFG_VALID_CHANNEL_LIST_LEN; Index++)
+ pMac->scan.base20MHzChannels.channelList[ Index ] = 0;
+ }
+ return status;
+}
+
+eHalStatus csrGet24GChannels(tpAniSirGlobal pMac)
+{
+ eHalStatus status = eHAL_STATUS_SUCCESS;
+ tANI_U8 num20MHzChannelsFound = 0;
+ VOS_STATUS vosStatus;
+ tANI_U8 Index = 0;
+ tANI_U8 num40MHzChannelsFound = 0;
+ tANI_U8 channelList5GBackup[WNI_CFG_VALID_CHANNEL_LIST_LEN] = {0}, nuum5GchannelListBackup;
+ tANI_U8 channelList = 0;
+
+ // Read the scan channel list (including the power limit) from EEPROM
+ vosStatus = vos_nv_getChannelListWithPower( pMac->scan.defaultPowerTable, &num20MHzChannelsFound,
+ pMac->scan.defaultPowerTable40MHz, &num40MHzChannelsFound);
+
+ if ( (VOS_STATUS_SUCCESS != vosStatus) || (num20MHzChannelsFound == 0) )
+ {
+ smsLog( pMac, LOGE, FL("failed to get channels \n"));
+ status = eHAL_STATUS_FAILURE;
+ }
+ else
+ {
+ if ( num20MHzChannelsFound > WNI_CFG_VALID_CHANNEL_LIST_LEN )
+ {
+ num20MHzChannelsFound = WNI_CFG_VALID_CHANNEL_LIST_LEN;
+ }
+
+ // Move the 2.4GHZ channel list only to the global data,
+ // As 5GHz list been provided by AP as part of 11d IE
+ // structure -- this will be used as the scan list
+ for(channelList = 0, nuum5GchannelListBackup = 0; channelList < WNI_CFG_VALID_CHANNEL_LIST_LEN; channelList++)
+ {
+ if(pMac->scan.base20MHzChannels.channelList[ channelList ] >= 36 && pMac->scan.base20MHzChannels.channelList[ channelList ] <= 165)
+ {
+ // First taking the 5GHz channel list backup
+ channelList5GBackup[nuum5GchannelListBackup] = pMac->scan.base20MHzChannels.channelList[ channelList ];
+ nuum5GchannelListBackup++;
+ }
+ }
+ // Updating the 2.4GHz list
+ for ( Index = 0; Index < num20MHzChannelsFound; Index++)
+ {
+ if(pMac->scan.defaultPowerTable[Index].chanId > 0 && pMac->scan.defaultPowerTable[Index].chanId <= 14)
+ pMac->scan.base20MHzChannels.channelList[ Index ] = pMac->scan.defaultPowerTable[Index].chanId;
+ }
+ // Restoring the Backed up 5 GHZ channels
+ for(channelList = 0;channelList < nuum5GchannelListBackup; channelList++ )
+ {
+ pMac->scan.base20MHzChannels.channelList[ Index ] = channelList5GBackup[channelList];
+ Index++;
+ }
+
+ pMac->scan.numChannelsDefault = (num20MHzChannelsFound > Index) ? num20MHzChannelsFound : Index;
+ pMac->scan.base20MHzChannels.numChannels = (num20MHzChannelsFound > Index) ? num20MHzChannelsFound : Index;
+ }
+ return (status);
+}
+
eHalStatus csrInitGetChannels(tpAniSirGlobal pMac)
{
eHalStatus status = eHAL_STATUS_SUCCESS;
diff --git a/CORE/SME/src/csr/csrApiScan.c b/CORE/SME/src/csr/csrApiScan.c
index 825aa54..689aa5f 100644
--- a/CORE/SME/src/csr/csrApiScan.c
+++ b/CORE/SME/src/csr/csrApiScan.c
@@ -3504,14 +3504,12 @@
if ( CSR_IS_CHANNEL_5GHZ( pMac->scan.channelOf11dInfo ) )
{
// and the 2.4 band is empty, then populate the 2.4 channel info
- if ( !csrLLIsListEmpty( &pMac->scan.channelPowerInfoList24, LL_ACCESS_LOCK ) ) break;
fPopulate5GBand = FALSE;
}
else
{
// else, we found channel info in the 2.4 GHz band. If the 5.0 band is empty
// set the 5.0 band info from the 2.4 country code.
- if ( !csrLLIsListEmpty( &pMac->scan.channelPowerInfoList5G, LL_ACCESS_LOCK ) ) break;
fPopulate5GBand = TRUE;
}
csrSaveChannelPowerForBand( pMac, fPopulate5GBand );
@@ -3737,6 +3735,24 @@
// set the indicator of the channel where the country IE was found...
pMac->scan.channelOf11dInfo = pSirBssDesc->channelId;
+ csrGetRegulatoryDomainForCountry(pMac, pIesLocal->Country.country, &domainId );
+ // Checking for Domain Id change
+ if ( domainId != pMac->scan.domainIdCurrent )
+ {
+ tSirMacChanInfo* pMacChnSet = (tSirMacChanInfo *)(&pIesLocal->Country.triplets[0]);
+ WDA_SetRegDomain(pMac, domainId);
+ // Check weather AP provided the 2.4GHZ list or 5GHZ list
+ if(CSR_IS_CHANNEL_24GHZ(pMacChnSet[0].firstChanNum))
+ {
+ // AP Provided the 2.4 Channels, Update the 5GHz channels from nv.bin
+ csrGet5GChannels(pMac );
+ }
+ else
+ {
+ // AP Provided the 5G Channels, Update the 2.4GHZ channel list from nv.bin
+ csrGet24GChannels(pMac );
+ }
+ }
// Populate both band channel lists based on what we found in the country information...
csrSetOppositeBandChannelInfo( pMac );
bMaxNumChn = WNI_CFG_VALID_CHANNEL_LIST_LEN;