1 /* 2 * systemConfig.c 3 * 4 * Copyright(c) 1998 - 2010 Texas Instruments. All rights reserved. 5 * All rights reserved. 6 * 7 * Redistribution and use in source and binary forms, with or without 8 * modification, are permitted provided that the following conditions 9 * are met: 10 * 11 * * Redistributions of source code must retain the above copyright 12 * notice, this list of conditions and the following disclaimer. 13 * * Redistributions in binary form must reproduce the above copyright 14 * notice, this list of conditions and the following disclaimer in 15 * the documentation and/or other materials provided with the 16 * distribution. 17 * * Neither the name Texas Instruments nor the names of its 18 * contributors may be used to endorse or promote products derived 19 * from this software without specific prior written permission. 20 * 21 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 22 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 23 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 24 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 25 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 26 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 27 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 28 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 29 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 30 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 31 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 32 */ 33 34 /** \file reportReplvl.c 35 * \brief Report level implementation 36 * 37 * \see reportReplvl.h 38 */ 39 40 /***************************************************************************/ 41 /* */ 42 /* MODULE: reportReplvl.c */ 43 /* PURPOSE: Report level implementation */ 44 /* */ 45 /***************************************************************************/ 46 #define __FILE_ID__ FILE_ID_87 47 #include "tidef.h" 48 #include "osApi.h" 49 #include "siteHash.h" 50 #include "sme.h" 51 #include "rate.h" 52 #include "smeApi.h" 53 #include "rsnApi.h" 54 #include "report.h" 55 #include "TWDriver.h" 56 #include "connApi.h" 57 #include "DataCtrl_Api.h" 58 #include "siteMgrApi.h" 59 #include "EvHandler.h" 60 #include "TI_IPC_Api.h" 61 #include "regulatoryDomainApi.h" 62 #include "measurementMgrApi.h" 63 #ifdef XCC_MODULE_INCLUDED 64 #include "XCCMngr.h" 65 #include "TransmitPowerXCC.h" 66 #include "XCCRMMngr.h" 67 #endif 68 69 #include "qosMngr_API.h" 70 #include "StaCap.h" 71 72 73 /**************************************************************************** 74 MATRIC ISSUE 75 Each function in the select process returns a MATCH, NO_MATCH value in order to 76 skip non relevant sites. In addition, some of the functions also measures a matching level of a site. 77 The matching level is returned as a bit map. The select function 'OR's those bit maps in order to 78 select the site that has the biggest matching level. If a function returns a NO_MATCH value, the matching level of the 79 site is reset. 80 Following is the site matching level bit map structure. 81 Please notice, that if all the match functions returned MATCH for a site, its matric must be different than 0, 82 because of the rates bits. 83 84 85 31 - 24 23 - 20 20 - 16 15 - 10 9 - 8 7 6 5 4 - 0 86 +---------------+---------------+-----------------------+-------------+------------+----------+---------+-----------+-----------+ 87 | Rx Level | Privacy | Attempts |Rates | Modulation |Preamble | Channel | Spectrum | Reserved | 88 | | | | | | | | management| | 89 +---------------+---------------+-----------------------+-------------+------------+----------+---------+-----------+-----------+ 90 ****************************************************************************/ 91 92 /* Matric bit map definition */ 93 typedef enum 94 { 95 /* Rx level */ 96 METRIC_RX_LEVEL_MASK = 0xFF, 97 METRIC_RX_LEVEL_SHIFT = 24, 98 99 /* Privacy */ 100 METRIC_PRIVACY_MASK = 0x0F, 101 METRIC_PRIVACY_SHIFT = 20, 102 103 /* Number of attempts */ 104 METRIC_ATTEMPTS_NUMBER_MASK = 0x0F, 105 METRIC_ATTEMPTS_NUMBER_SHIFT = 16, 106 107 108 /* Rates */ 109 METRIC_RATES_MASK = 0x3F, 110 METRIC_RATES_SHIFT = 10, 111 112 /* PBCC */ 113 METRIC_MODULATION_MASK = 0x03, 114 METRIC_MODULATION_SHIFT = 8, 115 116 /* Preamble*/ 117 METRIC_PREAMBLE_MASK = 0x01, 118 METRIC_PREAMBLE_SHIFT = 7, 119 120 /* Channel */ 121 METRIC_CHANNEL_MASK = 0x01, 122 METRIC_CHANNEL_SHIFT = 6, 123 124 /* Spectrum management Capability */ 125 METRIC_SPECTRUM_MANAGEMENT_MASK = 0x01, 126 METRIC_SPECTRUM_MANAGEMENT_SHIFT= 5, 127 128 /* Priority Site */ 129 METRIC_PRIORITY_SITE_MASK = 0x01, 130 METRIC_PRIORITY_SITE_SHIFT = 4 131 132 } matric_e; 133 134 #define MAX_GB_MODE_CHANEL 14 135 136 #define MAX_RSN_DATA_SIZE 256 137 138 /* RSSI values boundaries and metric values for best, good, etc signals */ 139 #define SELECT_RSSI_BEST_LEVEL (-22) 140 #define SELECT_RSSI_GOOD_LEVEL (-38) 141 #define SELECT_RSSI_NORMAL_LEVEL (-56) 142 #define SELECT_RSSI_POOR_LEVEL (-72) 143 #define SELECT_RSSI_BAD_LEVEL (-82) 144 145 146 #define RSSI_METRIC_BEST 6 147 #define RSSI_METRIC_GOOD 5 148 #define RSSI_METRIC_NORMAL 4 149 #define RSSI_METRIC_POOR 3 150 #define RSSI_METRIC_BAD 2 151 #define RSSI_METRIC_NOSIGNAL 1 152 153 /* Local functions prototypes */ 154 155 static TI_STATUS sendProbeResponse(siteMgr_t *pSiteMgr, TMacAddr *pBssid); 156 157 /* Interface functions Implementation */ 158 159 /*********************************************************************** 160 * addSelfSite 161 *********************************************************************** 162 DESCRIPTION: This function is called if the selection fails and desired BSS type is IBSS 163 That means we creating our own network and wait for other stations to join us. 164 the best site for teh station. 165 Performs the following: 166 - If the desired BSSID is broadcast, we generate a random BSSId, otherwise we use the desired one. 167 - If the site table is full we remove the most old site 168 - We send a probe response with our oiwn desired attributes in order to add the site to the site table 169 170 INPUT: pSiteMgr - site mgr handle. 171 172 OUTPUT: 173 174 RETURN: Pointer to rthe self site entry in the site table 175 176 ************************************************************************/ 177 siteEntry_t *addSelfSite(TI_HANDLE hSiteMgr) 178 { 179 siteMgr_t *pSiteMgr = (siteMgr_t *)hSiteMgr; 180 siteEntry_t *pSite; 181 TMacAddr bssid; 182 TSsid *pSsid = &pSiteMgr->pDesiredParams->siteMgrDesiredSSID; 183 184 if (OS_802_11_SSID_JUNK (pSsid->str, pSsid->len)) 185 return NULL; 186 187 if ((MAC_BROADCAST (pSiteMgr->pDesiredParams->siteMgrDesiredBSSID)) || 188 (BSS_INDEPENDENT == pSiteMgr->pDesiredParams->siteMgrDesiredBSSType)) 189 { 190 MAC_COPY (bssid, pSiteMgr->ibssBssid); 191 } 192 else 193 { 194 MAC_COPY (bssid, pSiteMgr->pDesiredParams->siteMgrDesiredBSSID); 195 } 196 197 if(pSiteMgr->pDesiredParams->siteMgrDesiredChannel <= 14) 198 { 199 pSiteMgr->pSitesMgmtParams->pCurrentSiteTable = &pSiteMgr->pSitesMgmtParams->dot11BG_sitesTables; 200 pSiteMgr->siteMgrOperationalMode = DOT11_G_MODE; 201 } 202 else 203 { 204 pSiteMgr->pSitesMgmtParams->pCurrentSiteTable = (siteTablesParams_t *)&pSiteMgr->pSitesMgmtParams->dot11A_sitesTables; 205 pSiteMgr->siteMgrOperationalMode = DOT11_A_MODE; 206 } 207 208 siteMgr_ConfigRate(pSiteMgr); 209 210 /* First make sure that there is a place in the site table, if not, reomve the eldest site. */ 211 if (pSiteMgr->pSitesMgmtParams->pCurrentSiteTable->numOfSites == pSiteMgr->pSitesMgmtParams->pCurrentSiteTable->maxNumOfSites) 212 removeEldestSite(pSiteMgr); 213 214 sendProbeResponse(pSiteMgr, &bssid); 215 216 /* Now find the site in the site table. */ 217 pSite = findSiteEntry(pSiteMgr, &bssid); 218 if (pSite == NULL) 219 { 220 return NULL; 221 } 222 pSite->beaconModulation = pSite->probeModulation; 223 pSite->barkerPreambleType = PREAMBLE_UNSPECIFIED; 224 225 pSiteMgr->pSitesMgmtParams->pPrimarySite = pSite; 226 pSite->siteType = SITE_SELF; 227 pSite->bssType = BSS_INDEPENDENT; 228 229 return pSite; 230 } 231 232 /*********************************************************************** 233 * sendProbeResponse 234 *********************************************************************** 235 DESCRIPTION: This function is called by the function 'addSelfSite()' in order to send a probe response 236 to the site mgr. This will cause the site manager to add a new entry to the site table, the self site entry. 237 238 INPUT: pSiteMgr - site mgr handle. 239 pBssid - Received BSSID 240 241 OUTPUT: 242 243 RETURN: TI_OK 244 245 ************************************************************************/ 246 static TI_STATUS sendProbeResponse(siteMgr_t *pSiteMgr, TMacAddr *pBssid) 247 { 248 mlmeFrameInfo_t frame; 249 ECipherSuite rsnStatus; 250 dot11_SSID_t ssid; 251 dot11_RATES_t rates; 252 dot11_FH_PARAMS_t FHParamsSet; 253 dot11_DS_PARAMS_t DSParamsSet; 254 dot11_CF_PARAMS_t CFParamsSet; 255 dot11_IBSS_PARAMS_t IBSSParamsSet; 256 TI_UINT32 len = 0, ofdmIndex = 0; 257 ERadioBand band; 258 dot11_RATES_t extRates; 259 TI_UINT8 ratesBuf[DOT11_MAX_SUPPORTED_RATES]; 260 TI_BOOL extRatesInd = TI_FALSE; 261 262 /* The easiest way to add a site to the site table is to simulate a probe frame. */ 263 frame.subType = PROBE_RESPONSE; 264 os_memoryZero(pSiteMgr->hOs, &frame, sizeof(mlmeFrameInfo_t)); 265 /* Initialize the frame fields */ 266 frame.subType = PROBE_RESPONSE; 267 os_memoryZero(pSiteMgr->hOs, (void *)frame.content.iePacket.timestamp, TIME_STAMP_LEN); 268 269 /* Build Beacon interval */ 270 frame.content.iePacket.beaconInerval = pSiteMgr->pDesiredParams->siteMgrDesiredBeaconInterval; 271 272 /* Build capability field */ 273 frame.content.iePacket.capabilities = 0; 274 frame.content.iePacket.capabilities |= (TI_TRUE << CAP_IBSS_SHIFT); /* Bss type must be independent */ 275 276 if ((pSiteMgr->pDesiredParams->siteMgrDesiredPreambleType == PREAMBLE_SHORT)) 277 frame.content.iePacket.capabilities |= (TI_TRUE << CAP_PREAMBLE_SHIFT); 278 279 /* call RSN to get the privacy desired */ 280 rsn_getParamEncryptionStatus(pSiteMgr->hRsn, &rsnStatus); /* RSN_ENCRYPTION_STATUS_PARAM */ 281 if (rsnStatus == TWD_CIPHER_NONE) 282 { 283 frame.content.iePacket.capabilities |= (TI_FALSE << CAP_PRIVACY_SHIFT); 284 } 285 else 286 { 287 frame.content.iePacket.capabilities |= (TI_TRUE << CAP_PRIVACY_SHIFT); 288 } 289 290 if (pSiteMgr->pDesiredParams->siteMgrDesiredModulationType == DRV_MODULATION_PBCC) 291 frame.content.iePacket.capabilities |= (TI_TRUE << CAP_PBCC_SHIFT); 292 293 if (pSiteMgr->siteMgrOperationalMode == DOT11_G_MODE) 294 { 295 if(pSiteMgr->pDesiredParams->siteMgrDesiredSlotTime == PHY_SLOT_TIME_SHORT) 296 frame.content.iePacket.capabilities |= (TI_TRUE << CAP_SLOT_TIME_SHIFT); 297 } 298 299 /* Build ssid */ 300 os_memoryZero(pSiteMgr->hOs, (void *)ssid.serviceSetId, MAX_SSID_LEN); 301 302 ssid.hdr[1] = pSiteMgr->pDesiredParams->siteMgrDesiredSSID.len; 303 if (ssid.hdr[1] > MAX_SSID_LEN) 304 { 305 TRACE2(pSiteMgr->hReport, REPORT_SEVERITY_ERROR, 306 "sendProbeResponse. siteMgrDesiredSSID.len=%d exceeds the limit %d\n", 307 pSiteMgr->pDesiredParams->siteMgrDesiredSSID.len, MAX_SSID_LEN); 308 ssid.hdr[1] = MAX_SSID_LEN; 309 } 310 os_memoryCopy(pSiteMgr->hOs, (void *)ssid.serviceSetId, (void *)pSiteMgr->pDesiredParams->siteMgrDesiredSSID.str, ssid.hdr[1]); 311 312 if(pSiteMgr->pDesiredParams->siteMgrDesiredChannel <= MAX_GB_MODE_CHANEL) 313 siteMgr_updateRates(pSiteMgr, TI_FALSE, TI_TRUE); 314 else 315 siteMgr_updateRates(pSiteMgr, TI_TRUE, TI_TRUE); 316 317 /* Build Rates */ 318 rate_DrvBitmapToNetStr (pSiteMgr->pDesiredParams->siteMgrCurrentDesiredRateMask.supportedRateMask, 319 pSiteMgr->pDesiredParams->siteMgrCurrentDesiredRateMask.basicRateMask, 320 ratesBuf, 321 &len, 322 &ofdmIndex); 323 324 if(pSiteMgr->siteMgrOperationalMode != DOT11_G_MODE || 325 pSiteMgr->pDesiredParams->siteMgrUseDraftNum == DRAFT_5_AND_EARLIER || 326 ofdmIndex == len) 327 { 328 rates.hdr[0] = DOT11_SUPPORTED_RATES_ELE_ID; 329 rates.hdr[1] = len; 330 os_memoryCopy(pSiteMgr->hOs, (void *)rates.rates, ratesBuf, rates.hdr[1]); 331 } 332 else 333 { 334 rates.hdr[0] = DOT11_SUPPORTED_RATES_ELE_ID; 335 rates.hdr[1] = ofdmIndex; 336 os_memoryCopy(pSiteMgr->hOs, (void *)rates.rates, ratesBuf, rates.hdr[1]); 337 338 extRates.hdr[0] = DOT11_EXT_SUPPORTED_RATES_ELE_ID; 339 extRates.hdr[1] = len - ofdmIndex; 340 os_memoryCopy(pSiteMgr->hOs, (void *)extRates.rates, &ratesBuf[ofdmIndex], extRates.hdr[1]); 341 extRatesInd = TI_TRUE; 342 } 343 344 if((pSiteMgr->siteMgrOperationalMode == DOT11_G_MODE) || (pSiteMgr->siteMgrOperationalMode == DOT11_DUAL_MODE)) 345 { 346 erpProtectionType_e protType; 347 ctrlData_getParamProtType(pSiteMgr->hCtrlData, &protType); /* CTRL_DATA_CURRENT_IBSS_PROTECTION_PARAM */ 348 frame.content.iePacket.useProtection = protType; 349 } 350 else 351 { 352 frame.content.iePacket.useProtection = ERP_PROTECTION_NONE; 353 } 354 355 /* Build FH */ 356 os_memoryZero(pSiteMgr->hOs, &FHParamsSet, sizeof(dot11_FH_PARAMS_t)); 357 358 /* Build DS */ 359 DSParamsSet.hdr[1] = 1; 360 DSParamsSet.currChannel = pSiteMgr->pDesiredParams->siteMgrDesiredChannel; 361 362 /* Build CF */ 363 os_memoryZero(pSiteMgr->hOs, &CFParamsSet, sizeof(dot11_CF_PARAMS_t)); 364 365 /* Build IBSS */ 366 os_memoryZero(pSiteMgr->hOs, &IBSSParamsSet, sizeof(dot11_IBSS_PARAMS_t)); 367 IBSSParamsSet.hdr[1] = 2; 368 IBSSParamsSet.atimWindow = pSiteMgr->pDesiredParams->siteMgrDesiredAtimWindow; 369 370 frame.content.iePacket.pSsid = &ssid; 371 frame.content.iePacket.pRates = &rates; 372 373 if(extRatesInd) 374 frame.content.iePacket.pExtRates = &extRates; 375 else 376 frame.content.iePacket.pExtRates = NULL; 377 378 frame.content.iePacket.pFHParamsSet = &FHParamsSet; 379 frame.content.iePacket.pDSParamsSet = &DSParamsSet; 380 frame.content.iePacket.pCFParamsSet = &CFParamsSet; 381 frame.content.iePacket.pIBSSParamsSet = &IBSSParamsSet; 382 383 band = ( MAX_GB_MODE_CHANEL >= pSiteMgr->pDesiredParams->siteMgrDesiredChannel ? RADIO_BAND_2_4_GHZ : RADIO_BAND_5_0_GHZ ); 384 /* Update site */ 385 siteMgr_updateSite(pSiteMgr, pBssid, &frame ,pSiteMgr->pDesiredParams->siteMgrDesiredChannel, band, TI_FALSE); 386 387 return TI_OK; 388 } 389 390 /*********************************************************************** 391 * systemConfig 392 *********************************************************************** 393 DESCRIPTION: This function is called by the function 'siteMgr_selectSite()' in order to configure 394 the system with the chosen site attribute. 395 396 INPUT: pSiteMgr - site mgr handle. 397 398 OUTPUT: 399 400 RETURN: TI_OK 401 402 ************************************************************************/ 403 TI_STATUS systemConfig(siteMgr_t *pSiteMgr) 404 { 405 paramInfo_t *pParam; 406 siteEntry_t *pPrimarySite = pSiteMgr->pSitesMgmtParams->pPrimarySite; 407 TRsnData rsnData; 408 TI_UINT8 rsnAssocIeLen; 409 dot11_RSN_t *pRsnIe; 410 TI_UINT8 rsnIECount=0; 411 TI_UINT8 *curRsnData; 412 TI_UINT16 length; 413 TI_UINT16 capabilities; 414 TI_UINT16 PktLength=0; 415 TI_UINT8 *pIeBuffer=NULL; 416 TI_BOOL b11nEnable; 417 TI_BOOL bWmeEnable; 418 419 #ifdef XCC_MODULE_INCLUDED 420 TI_UINT8 ExternTxPower; 421 #endif 422 TI_STATUS status; 423 ESlotTime slotTime; 424 TI_UINT32 StaTotalRates; 425 dot11_ACParameters_t *p_ACParametersDummy = NULL; 426 TtxCtrlHtControl tHtControl; 427 428 curRsnData = os_memoryAlloc(pSiteMgr->hOs, MAX_RSN_DATA_SIZE); 429 if (!curRsnData) 430 return TI_NOK; 431 pParam = (paramInfo_t *)os_memoryAlloc(pSiteMgr->hOs, sizeof(paramInfo_t)); 432 if (!pParam) { 433 os_memoryFree(pSiteMgr->hOs, curRsnData, MAX_RSN_DATA_SIZE); 434 return TI_NOK; 435 } 436 437 if (pPrimarySite->probeRecv) 438 { 439 pIeBuffer = pPrimarySite->probeRespBuffer; 440 PktLength = pPrimarySite->probeRespLength; 441 } 442 else if (pPrimarySite->beaconRecv) 443 { 444 pIeBuffer = pPrimarySite->beaconBuffer; 445 PktLength = pPrimarySite->beaconLength; 446 } 447 448 pSiteMgr->prevRadioBand = pSiteMgr->radioBand; 449 450 TRACE2(pSiteMgr->hReport, REPORT_SEVERITY_INFORMATION, ": Capabilities, Slot Time Bit = %d (capabilities = %d)\n", (pPrimarySite->capabilities >> CAP_SLOT_TIME_SHIFT) & 1, pPrimarySite->capabilities); 451 452 if(pPrimarySite->channel <= MAX_GB_MODE_CHANEL) 453 { 454 if(pSiteMgr->pDesiredParams->siteMgrDesiredDot11Mode == DOT11_B_MODE) 455 { 456 pSiteMgr->siteMgrOperationalMode = DOT11_B_MODE; 457 slotTime = PHY_SLOT_TIME_LONG; 458 459 TRACE1(pSiteMgr->hReport, REPORT_SEVERITY_INFORMATION, ": 11b Mode, Slot Time = %d\n", (TI_UINT8)slotTime); 460 } 461 else 462 { 463 pSiteMgr->siteMgrOperationalMode = DOT11_G_MODE; 464 465 if (((pPrimarySite->capabilities >> CAP_SLOT_TIME_SHIFT) & CAP_SLOT_TIME_MASK) == PHY_SLOT_TIME_SHORT) 466 { 467 slotTime = pSiteMgr->pDesiredParams->siteMgrDesiredSlotTime; 468 469 TRACE1(pSiteMgr->hReport, REPORT_SEVERITY_INFORMATION, ": 11g Mode, Slot Time = %d (desired)\n", (TI_UINT8)slotTime); 470 } 471 else 472 { 473 slotTime = PHY_SLOT_TIME_LONG; 474 475 TRACE1(pSiteMgr->hReport, REPORT_SEVERITY_INFORMATION, ": 11g Mode, Slot Time = %d\n", (TI_UINT8) slotTime); 476 } 477 } 478 479 pSiteMgr->radioBand = RADIO_BAND_2_4_GHZ; 480 pSiteMgr->pSitesMgmtParams->pCurrentSiteTable = &pSiteMgr->pSitesMgmtParams->dot11BG_sitesTables; 481 } 482 else 483 { 484 pSiteMgr->siteMgrOperationalMode = DOT11_A_MODE; 485 pSiteMgr->radioBand = RADIO_BAND_5_0_GHZ; 486 slotTime = PHY_SLOT_TIME_SHORT; 487 488 TRACE1(pSiteMgr->hReport, REPORT_SEVERITY_INFORMATION, ": 11a Mode, Slot Time = %d\n", (TI_UINT8)slotTime); 489 490 pSiteMgr->pSitesMgmtParams->pCurrentSiteTable = (siteTablesParams_t *)&pSiteMgr->pSitesMgmtParams->dot11A_sitesTables; 491 } 492 493 /* since we are moving to the different band, the siteMgr should be reconfigured */ 494 if(pSiteMgr->prevRadioBand != pSiteMgr->radioBand) 495 siteMgr_bandParamsConfig(pSiteMgr, TI_TRUE); 496 497 if(pPrimarySite->channel <= MAX_GB_MODE_CHANEL) 498 siteMgr_updateRates(pSiteMgr, TI_FALSE, TI_TRUE); 499 else 500 siteMgr_updateRates(pSiteMgr, TI_TRUE, TI_TRUE); 501 502 /* configure hal with common core-hal parameters */ 503 TWD_SetRadioBand (pSiteMgr->hTWD, pSiteMgr->radioBand); 504 505 pPrimarySite->currentSlotTime = slotTime; 506 TWD_CfgSlotTime (pSiteMgr->hTWD, slotTime); 507 508 /***************** Config Site Manager *************************/ 509 /* L.M. Should be fixed, should take into account the AP's rates */ 510 if(pSiteMgr->pDesiredParams->siteMgrDesiredModulationType == DRV_MODULATION_CCK) 511 pSiteMgr->chosenModulation = DRV_MODULATION_CCK; 512 else if(pSiteMgr->pDesiredParams->siteMgrDesiredModulationType == DRV_MODULATION_PBCC) 513 { 514 if(pPrimarySite->probeModulation != DRV_MODULATION_NONE) 515 pSiteMgr->chosenModulation = pPrimarySite->probeModulation; 516 else 517 pSiteMgr->chosenModulation = pPrimarySite->beaconModulation; 518 } 519 else 520 pSiteMgr->chosenModulation = DRV_MODULATION_OFDM; 521 522 /* We use this variable in order tp perform the PBCC algorithm. */ 523 pSiteMgr->currentDataModulation = pSiteMgr->chosenModulation; 524 /***************** Config Data CTRL *************************/ 525 526 pParam->paramType = CTRL_DATA_CURRENT_BSSID_PARAM; /* Current BSSID */ 527 MAC_COPY (pParam->content.ctrlDataCurrentBSSID, pPrimarySite->bssid); 528 ctrlData_setParam(pSiteMgr->hCtrlData, pParam); 529 530 pParam->paramType = CTRL_DATA_CURRENT_BSS_TYPE_PARAM; /* Current BSS Type */ 531 pParam->content.ctrlDataCurrentBssType = pPrimarySite->bssType; 532 ctrlData_setParam(pSiteMgr->hCtrlData, pParam); 533 534 pParam->paramType = CTRL_DATA_CURRENT_PREAMBLE_TYPE_PARAM; /* Current Preamble Type */ 535 if ((pSiteMgr->pDesiredParams->siteMgrDesiredPreambleType == PREAMBLE_SHORT) && 536 (pPrimarySite->currentPreambleType == PREAMBLE_SHORT)) 537 pParam->content.ctrlDataCurrentPreambleType = PREAMBLE_SHORT; 538 else 539 pParam->content.ctrlDataCurrentPreambleType = PREAMBLE_LONG; 540 ctrlData_setParam(pSiteMgr->hCtrlData, pParam); 541 542 /* Mutual Rates Matching */ 543 StaTotalRates = pSiteMgr->pDesiredParams->siteMgrCurrentDesiredRateMask.basicRateMask | 544 pSiteMgr->pDesiredParams->siteMgrCurrentDesiredRateMask.supportedRateMask; 545 546 547 pSiteMgr->pDesiredParams->siteMgrMatchedSuppRateMask = StaTotalRates & 548 pPrimarySite->rateMask.supportedRateMask; 549 550 pSiteMgr->pDesiredParams->siteMgrMatchedBasicRateMask = StaTotalRates & 551 pPrimarySite->rateMask.basicRateMask; 552 if (pSiteMgr->pDesiredParams->siteMgrMatchedBasicRateMask == 0) 553 { 554 pSiteMgr->pDesiredParams->siteMgrMatchedBasicRateMask = 555 pSiteMgr->pDesiredParams->siteMgrCurrentDesiredRateMask.basicRateMask; 556 } 557 558 /* set protection */ 559 if(BSS_INDEPENDENT == pPrimarySite->bssType) 560 { 561 pParam->paramType = CTRL_DATA_CURRENT_IBSS_PROTECTION_PARAM; 562 } 563 else 564 { 565 pParam->paramType = CTRL_DATA_CURRENT_PROTECTION_STATUS_PARAM; 566 } 567 pParam->content.ctrlDataProtectionEnabled = pPrimarySite->useProtection; 568 ctrlData_setParam(pSiteMgr->hCtrlData, pParam); 569 570 pbccAlgorithm(pSiteMgr); 571 572 /********** Set Site QOS protocol support *************/ 573 574 /* Set WME Params */ 575 status = siteMgr_getWMEParamsSite(pSiteMgr,&p_ACParametersDummy); 576 if(status == TI_OK) 577 { 578 pParam->content.qosSiteProtocol = QOS_WME; 579 } 580 else 581 { 582 pParam->content.qosSiteProtocol = QOS_NONE; 583 } 584 585 TRACE1(pSiteMgr->hReport, REPORT_SEVERITY_INFORMATION, " systemConfigt() : pParam->content.qosSiteProtoco %d\n", pParam->content.qosSiteProtocol); 586 587 pParam->paramType = QOS_MNGR_SET_SITE_PROTOCOL; 588 qosMngr_setParams(pSiteMgr->hQosMngr, pParam); 589 590 /* Set active protocol in qosMngr according to station desired mode and site capabilities 591 Must be called BEFORE setting the "CURRENT_PS_MODE" into the QosMngr */ 592 qosMngr_selectActiveProtocol(pSiteMgr->hQosMngr); 593 594 /* set PS capability parameter */ 595 pParam->paramType = QOS_MNGR_CURRENT_PS_MODE; 596 if(pPrimarySite->APSDSupport == TI_TRUE) 597 pParam->content.currentPsMode = PS_SCHEME_UPSD_TRIGGER; 598 else 599 pParam->content.currentPsMode = PS_SCHEME_LEGACY; 600 qosMngr_setParams(pSiteMgr->hQosMngr, pParam); 601 602 /* Set upsd/ps_poll configuration */ 603 /* Must be done AFTER setting the active Protocol */ 604 qosMngr_setAcPsDeliveryMode (pSiteMgr->hQosMngr); 605 606 607 /********** Set Site HT setting support *************/ 608 /* set HT setting to the FW */ 609 /* verify 11n_Enable and Chip type */ 610 StaCap_IsHtEnable (pSiteMgr->hStaCap, &b11nEnable); 611 612 /* verify that WME flag enable */ 613 qosMngr_GetWmeEnableFlag (pSiteMgr->hQosMngr, &bWmeEnable); 614 615 if ((b11nEnable != TI_FALSE) && 616 (bWmeEnable != TI_FALSE) && 617 (pPrimarySite->tHtCapabilities.tHdr[0] != TI_FALSE) && 618 (pPrimarySite->tHtInformation.tHdr[0] != TI_FALSE)) 619 { 620 TWD_CfgSetFwHtCapabilities (pSiteMgr->hTWD, &pPrimarySite->tHtCapabilities, TI_TRUE); 621 TWD_CfgSetFwHtInformation (pSiteMgr->hTWD, &pPrimarySite->tHtInformation); 622 623 /* the FW not supported in HT control field in TX */ 624 625 tHtControl.bHtEnable = TI_FALSE; 626 txCtrlParams_SetHtControl (pSiteMgr->hTxCtrl, &tHtControl); 627 } 628 else 629 { 630 TWD_CfgSetFwHtCapabilities (pSiteMgr->hTWD, &pPrimarySite->tHtCapabilities, TI_FALSE); 631 632 tHtControl.bHtEnable = TI_FALSE; 633 txCtrlParams_SetHtControl (pSiteMgr->hTxCtrl, &tHtControl); 634 } 635 636 /***************** Config RSN *************************/ 637 /* Get the RSN IE data */ 638 pRsnIe = pPrimarySite->pRsnIe; 639 length = 0; 640 rsnIECount = 0; 641 while ((length < pPrimarySite->rsnIeLen) && (pPrimarySite->rsnIeLen < 255) 642 && (rsnIECount < MAX_RSN_IE)) 643 { 644 curRsnData[0+length] = pRsnIe->hdr[0]; 645 curRsnData[1+length] = pRsnIe->hdr[1]; 646 os_memoryCopy(pSiteMgr->hOs, &curRsnData[2+length], (void *)pRsnIe->rsnIeData, pRsnIe->hdr[1]); 647 length += pRsnIe->hdr[1]+2; 648 pRsnIe += 1; 649 rsnIECount++; 650 } 651 if (length<pPrimarySite->rsnIeLen) 652 { 653 TRACE2(pSiteMgr->hReport, REPORT_SEVERITY_ERROR, "siteMgr_selectSiteFromTable, RSN IE is too long: rsnIeLen=%d, MAX_RSN_IE=%d\n", pPrimarySite->rsnIeLen, MAX_RSN_IE); 654 } 655 656 rsnData.pIe = (pPrimarySite->rsnIeLen==0) ? NULL : curRsnData; 657 rsnData.ieLen = pPrimarySite->rsnIeLen; 658 rsnData.privacy = pPrimarySite->privacy; 659 660 rsn_setSite(pSiteMgr->hRsn, &rsnData, NULL, &rsnAssocIeLen); 661 662 /***************** Config RegulatoryDomain **************************/ 663 664 #ifdef XCC_MODULE_INCLUDED 665 /* set XCC TPC if present */ 666 if(XCC_ParseClientTP(pSiteMgr->hOs,pPrimarySite,(TI_INT8 *)&ExternTxPower,pIeBuffer,PktLength) == TI_OK) 667 { 668 TRACE1(pSiteMgr->hReport, REPORT_SEVERITY_INFORMATION, "Select XCC_ParseClientTP == OK: Dbm = %d\n",ExternTxPower); 669 pParam->paramType = REGULATORY_DOMAIN_EXTERN_TX_POWER_PREFERRED; 670 pParam->content.ExternTxPowerPreferred = ExternTxPower; 671 regulatoryDomain_setParam(pSiteMgr->hRegulatoryDomain, pParam); 672 } 673 /* Parse and save the XCC Version Number if exists */ 674 XCCMngr_parseXCCVer(pSiteMgr->hXCCMngr, pIeBuffer, PktLength); 675 676 #endif 677 678 /* Note: TX Power Control adjustment is now done through siteMgr_assocReport() */ 679 if (pPrimarySite->powerConstraint>0) 680 { /* setting power constraint */ 681 pParam->paramType = REGULATORY_DOMAIN_SET_POWER_CONSTRAINT_PARAM; 682 pParam->content.powerConstraint = pPrimarySite->powerConstraint; 683 regulatoryDomain_setParam(pSiteMgr->hRegulatoryDomain, pParam); 684 } 685 686 687 /***************** Config MeasurementMgr object **************************/ 688 capabilities = pPrimarySite->capabilities; 689 690 /* Updating the Measurement Module Mode */ 691 measurementMgr_setMeasurementMode(pSiteMgr->hMeasurementMgr, capabilities, 692 pIeBuffer, PktLength); 693 os_memoryFree(pSiteMgr->hOs, curRsnData, MAX_RSN_DATA_SIZE); 694 os_memoryFree(pSiteMgr->hOs, pParam, sizeof(paramInfo_t)); 695 return TI_OK; 696 } 697 698