PageRenderTime 60ms CodeModel.GetById 14ms RepoModel.GetById 0ms app.codeStats 1ms

/drivers/net/wireless/tiwlan1251/common/src/core/sme/siteMgr/siteMgr.c

http://github.com/CyanogenMod/cm-kernel
C | 1533 lines | 1057 code | 282 blank | 194 comment | 195 complexity | fc5aa5f93c7269c70b6e0b8c26ae5906 MD5 | raw file
Possible License(s): AGPL-1.0, GPL-2.0, LGPL-2.0

Large files files are truncated, but you can click here to view the full file

  1. /****************************************************************************
  2. **+-----------------------------------------------------------------------+**
  3. **| |**
  4. **| Copyright(c) 1998 - 2008 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. ****************************************************************************/
  35. /** \file siteMgr.c
  36. * \brief Site Manager implementation
  37. *
  38. * \see siteMgr.h
  39. */
  40. #include "report.h"
  41. #include "osTIType.h"
  42. #include "osApi.h"
  43. #include "siteMgrApi.h"
  44. #include "siteHash.h"
  45. #include "smeApi.h"
  46. #include "utils.h"
  47. #include "connApi.h"
  48. #include "mlmeSm.h"
  49. #include "smeSmApi.h"
  50. #include "DataCtrl_Api.h"
  51. #include "regulatoryDomainApi.h"
  52. #include "rsnApi.h"
  53. #include "measurementMgrApi.h"
  54. #include "qosMngr_API.h"
  55. #include "PowerMgr_API.h"
  56. #include "EvHandler.h"
  57. #include "TI_IPC_Api.h"
  58. #include "MacServices_api.h"
  59. #include "whalHwDefs.h"
  60. #include "apConn.h"
  61. #include "currBss.h"
  62. #include "PowerMgr.h"
  63. #ifdef EXC_MODULE_INCLUDED
  64. #include "excMngr.h"
  65. #endif
  66. #include "configMgr.h"
  67. /* definitions */
  68. #define JOIN_RATE_MASK_1M 0x01
  69. #define JOIN_RATE_MASK_2M 0x02
  70. #define JOIN_RATE_MASK_5_5M 0x04
  71. #define JOIN_RATE_MASK_11M 0x08
  72. #define JOIN_RATE_MASK_22M 0x10
  73. #define SITE_MGR_INIT_BIT 1
  74. #define TIMER_INIT_BIT 2
  75. #define DESIRED_PARAMS_INIT_BIT 3
  76. #define MGMT_PARAMS_INIT_BIT 4
  77. #define BUILT_IN_TEST_PERIOD 500
  78. #define KEEP_ALIVE_SEND_NULL_DATA_PERIOD 10000
  79. #define SITE_MGR_IBSS_AGING_TIMEOUT_DEF 10 * 1000 /* 10 seconds */
  80. #define DEAFULT_BEACON_FILTERING_NUM (10)
  81. /* Reconfig constants */
  82. #define SCAN_FAIL_THRESHOLD_FOR_RECONFIG 4 /* After 4 times we reset the 580 register and still no AP found - make recovery */
  83. #define SCAN_FAIL_THRESHOLD_FOR_RESET_REG_580 90 /* After 90 times (45 seconds) and no AP found - reset the 580 register */
  84. #define SCAN_FAIL_RECONFIG_ENABLED TRUE
  85. #define SCAN_FAIL_RECONFIG_DISABLED FALSE
  86. /* Local Macros */
  87. #define UPDATE_BEACON_INTERVAL(pSite, pFrameInfo) pSite->beaconInterval = pFrameInfo->content.iePacket.beaconInerval
  88. #define UPDATE_CAPABILITIES(pSite, pFrameInfo) pSite->capabilities = pFrameInfo->content.iePacket.capabilities
  89. #define UPDATE_PRIVACY(pSite, pFrameInfo) pSite->privacy = ((pFrameInfo->content.iePacket.capabilities >> CAP_PRIVACY_SHIFT) & CAP_PRIVACY_MASK) ? TRUE : FALSE
  90. #define UPDATE_AGILITY(pSite, pFrameInfo) pSite->agility = ((pFrameInfo->content.iePacket.capabilities >> CAP_AGILE_SHIFT) & CAP_AGILE_MASK) ? TRUE : FALSE
  91. #define UPDATE_SLOT_TIME(pSite, pFrameInfo) pSite->newSlotTime = ((pFrameInfo->content.iePacket.capabilities >> CAP_SLOT_TIME_SHIFT) & CAP_SLOT_TIME_MASK) ? PHY_SLOT_TIME_SHORT : PHY_SLOT_TIME_LONG
  92. #define UPDATE_PROTECTION(pSite, pFrameInfo) pSite->useProtection = (pFrameInfo->content.iePacket.useProtection)
  93. #define UPDATE_SSID(pSite, pFrameInfo) if (pFrameInfo->content.iePacket.pSsid != NULL) { \
  94. pSite->ssid.len = pFrameInfo->content.iePacket.pSsid->hdr.eleLen; \
  95. os_memoryCopy(pSiteMgr->hOs, (void *)pSite->ssid.ssidString, (void *)pFrameInfo->content.iePacket.pSsid->serviceSetId, pFrameInfo->content.iePacket.pSsid->hdr.eleLen) ;}
  96. #define UPDATE_CHANNEL(pSite, pFrameInfo, rxChannel) if (pFrameInfo->content.iePacket.pDSParamsSet == NULL) \
  97. pSite->channel = rxChannel; \
  98. else \
  99. pSite->channel = pFrameInfo->content.iePacket.pDSParamsSet->currChannel;
  100. #define UPDATE_DTIM_PERIOD(pSite, pFrameInfo) if (pFrameInfo->content.iePacket.pTIM != NULL) \
  101. pSite->dtimPeriod = pFrameInfo->content.iePacket.pTIM->dtimPeriod
  102. #define UPDATE_ATIM_WINDOW(pSite, pFrameInfo) if (pFrameInfo->content.iePacket.pIBSSParamsSet != NULL) \
  103. pSite->atimWindow = pFrameInfo->content.iePacket.pIBSSParamsSet->atimWindow
  104. #define UPDATE_BEACON_AP_TX_POWER(pSite, pFrameInfo) if (pFrameInfo->content.iePacket.TPCReport != NULL) \
  105. pSite->APTxPower = pFrameInfo->content.iePacket.TPCReport->transmitPower
  106. #define UPDATE_PROBE_AP_TX_POWER(pSite, pFrameInfo) if (pFrameInfo->content.iePacket.TPCReport != NULL) \
  107. pSite->APTxPower = pFrameInfo->content.iePacket.TPCReport->transmitPower
  108. #define UPDATE_BSS_TYPE(pSite, pFrameInfo) pSite->bssType = ((pFrameInfo->content.iePacket.capabilities >> CAP_ESS_SHIFT) & CAP_ESS_MASK) ? BSS_INFRASTRUCTURE : BSS_INDEPENDENT
  109. #define UPDATE_LOCAL_TIME_STAMP(pSiteMgr, pSite, pFrameInfo) pSite->localTimeStamp = os_timeStampMs(pSiteMgr->hOs)
  110. #define UPDATE_DTIM_TIME(pSiteMgr, pSite, pFrameInfo) pSite->dtimTimeStamp = os_timeStampMs(pSiteMgr->hOs)
  111. /* Updated from beacons */
  112. #define UPDATE_BEACON_MODULATION(pSite, pFrameInfo) pSite->beaconModulation = ((pFrameInfo->content.iePacket.capabilities >> CAP_PBCC_SHIFT) & CAP_PBCC_MASK) ? DRV_MODULATION_PBCC : DRV_MODULATION_CCK
  113. /* Updated from probes */
  114. #define UPDATE_PROBE_MODULATION(pSite, pFrameInfo) pSite->probeModulation = ((pFrameInfo->content.iePacket.capabilities >> CAP_PBCC_SHIFT) & CAP_PBCC_MASK) ? DRV_MODULATION_PBCC : DRV_MODULATION_CCK
  115. #define UPDATE_BEACON_RECV(pSite) pSite->beaconRecv = TRUE
  116. #define UPDATE_PROBE_RECV(pSite) pSite->probeRecv = TRUE
  117. #define UPDATE_RSN_IE(pSite, pRsnIe, rsnIeLen) if (pRsnIe != NULL) { \
  118. UINT8 length=0, index=0;\
  119. pSite->rsnIeLen = rsnIeLen;\
  120. while ((length < pSite->rsnIeLen) && (index<MAX_RSN_IE)){\
  121. pSite->pRsnIe[index].hdr = pRsnIe->hdr;\
  122. os_memoryCopy(pSiteMgr->hOs, (void *)pSite->pRsnIe[index].rsnIeData, (void *)pRsnIe->rsnIeData, pRsnIe->hdr.eleLen);\
  123. length += (pRsnIe->hdr.eleLen+2); \
  124. pRsnIe += 1; \
  125. index++;}\
  126. } \
  127. else {pSite->rsnIeLen = 0;}
  128. #define UPDATE_BEACON_TIMESTAMP(pSiteMgr, pSite, pFrameInfo) os_memoryCopy(pSiteMgr->hOs, pSite->tsfTimeStamp, (void *)pFrameInfo->content.iePacket.timestamp, TIME_STAMP_LEN)
  129. #define SET_ENTRY_FLAG_IN_SITE_TABLE(pSite) pSite->Not_Received = 0
  130. /* Local functions definitions*/
  131. static void update_apsd(siteEntry_t *pSite, mlmeFrameInfo_t *pFrameInfo);
  132. static void release_module(siteMgr_t *pSiteMgr, UINT32 initVec);
  133. static void updateSiteInfo(siteMgr_t *pSiteMgr, mlmeFrameInfo_t *pFrameInfo, siteEntry_t *pSite, UINT8 rxChannel);
  134. static void updateRates(siteMgr_t *pSiteMgr, siteEntry_t *pSite, mlmeFrameInfo_t *pFrameInfo);
  135. static void updateBeaconQosParams(siteMgr_t *pSiteMgr, siteEntry_t *pSite, mlmeFrameInfo_t *pFrameInfo);
  136. static void updateProbeQosParams(siteMgr_t *pSiteMgr, siteEntry_t *pSite, mlmeFrameInfo_t *pFrameInfo);
  137. static void updatePreamble(siteMgr_t *pSiteMgr, siteEntry_t *pSite, mlmeFrameInfo_t *pFrameInfo);
  138. static void updateFourX(siteMgr_t *pSiteMgr, siteEntry_t *pSite, mlmeFrameInfo_t *pFrameInfo);
  139. static TI_STATUS getBssidList(siteMgr_t *pSiteMgr, OS_802_11_BSSID_LIST_EX *bssidList, UINT32* pLength, BOOL allVarIes);
  140. static void getPrimarySiteDesc(siteMgr_t *pSiteMgr, OS_802_11_BSSID *pPrimarySiteDesc, BOOL supplyExtendedInfo);
  141. static TI_STATUS getPrimaryBssid(siteMgr_t *pSiteMgr, OS_802_11_BSSID_EX *primaryBssid, UINT32 *pLength);
  142. static rate_e translateRateMaskToValue(siteMgr_t *pSiteMgr, UINT32 rateMask);
  143. static void getSupportedRateSet(siteMgr_t *pSiteMgr, rates_t *pRatesSet);
  144. static TI_STATUS setSupportedRateSet(siteMgr_t *pSiteMgr, rates_t *pRatesSet);
  145. static void validateDesiredTxRate(rate_e desiredTxRate,modulationType_e desiredModulation,UINT32 suppRates,UINT32 *bitMap,BOOL *txDesiredRateSupported);
  146. static TI_STATUS calculateBssidListSize(siteMgr_t *pSiteMgr, UINT32 *pLength, BOOL allVarIes);
  147. static void siteMgr_externalConfigurationParametersSet(TI_HANDLE hSiteMgr);
  148. void siteMgr_gotFirstBcn(TI_HANDLE hSiteMgr);
  149. /**************************************************************/
  150. /* DEBUG CLI CRASH */
  151. /**************************************************************/
  152. static whalCtrl_joinBss_t joinParams;
  153. static whalCtrl_setTemplate_t templateStruct;
  154. static probeRspTemplate_t probeRspTemplate;
  155. static nullDataTemplate_t nullDataTemplate;
  156. static psPollTemplate_t psPollTemplate;
  157. static QosNullDataTemplate_t QosNullDataTemplate;
  158. /**************************************************************/
  159. #define CHAN_FREQ_TABLE_SIZE (sizeof(ChanFreq) / sizeof(struct CHAN_FREQ))
  160. struct CHAN_FREQ {
  161. UINT8 chan;
  162. UINT32 freq;
  163. } ChanFreq[] = {
  164. {1,2412000}, {2,2417000}, {3,2422000}, {4,2427000},
  165. {5,2432000}, {6,2437000}, {7,2442000}, {8,2447000},
  166. {9,2452000},
  167. {10,2457000}, {11,2462000}, {12,2467000}, {13,2472000},
  168. {14,2484000}, {36,5180000}, {40,5200000}, {44,5220000},
  169. {48,5240000}, {52,5260000}, {56,5280000}, {60,5300000},
  170. {64,5320000},
  171. {100,5500000}, {104,5520000}, {108,5540000}, {112,5560000},
  172. {116,5580000}, {120,5600000}, {124,5620000}, {128,5640000},
  173. {132,5660000}, {136,5680000}, {140,5700000}, {149,5745000},
  174. {153,5765000}, {157,5785000}, {161,5805000} };
  175. static UINT8 Freq2Chan(UINT32 freq)
  176. {
  177. UINT32 i;
  178. for(i=0; i<CHAN_FREQ_TABLE_SIZE; i++)
  179. if(ChanFreq[i].freq == freq) return ChanFreq[i].chan;
  180. return 0;
  181. }
  182. static UINT32 Chan2Freq(UINT8 chan)
  183. {
  184. UINT32 i;
  185. for(i=0; i<CHAN_FREQ_TABLE_SIZE; i++)
  186. if(ChanFreq[i].chan == chan) return ChanFreq[i].freq;
  187. return 0;
  188. }
  189. /************************************************************************
  190. * siteMgr_setTemporaryTxPower *
  191. *************************************************************************
  192. DESCRIPTION: This function is used to start the Tx Power Control adjust mechanism
  193. in regulatoryDomain.
  194. INPUT: bActivateTempFix - Whether the power should be adjusted
  195. ************************************************************************/
  196. void siteMgr_setTemporaryTxPower(siteMgr_t* pSiteMgr, BOOL bActivateTempFix)
  197. {
  198. paramInfo_t param;
  199. WLAN_REPORT_INFORMATION(pSiteMgr->hReport, SITE_MGR_MODULE_LOG,
  200. ("siteMgr_setTemporaryTxPower is = %s \n", (bActivateTempFix ? "ON" : "OFF")));
  201. /* Set the temporary Power Level via the Regulatory Domain*/
  202. param.paramType = REGULATORY_DOMAIN_TEMPORARY_TX_ATTENUATION_PARAM;
  203. param.content.bActivateTempPowerFix = bActivateTempFix;
  204. regulatoryDomain_setParam(pSiteMgr->hRegulatoryDomain,&param);
  205. }
  206. /* Interface functions Implementation */
  207. /*static void UPDATE_RSN_IE (siteMgr_t* pSiteMgr, siteEntry_t *pSite, dot11_RSN_t *pRsnIe, UINT8 rsnIeLen)
  208. {
  209. if (pRsnIe != NULL) {
  210. UINT8 length=0, index=0;
  211. pSite->rsnIeLen = rsnIeLen;
  212. while ((length < pSite->rsnIeLen) && (index<MAX_RSN_IE)){
  213. pSite->pRsnIe[index].hdr = pRsnIe->hdr;
  214. os_memoryCopy(pSiteMgr->hOs, pSite->pRsnIe[index].rsnIeData, pRsnIe->rsnIeData, pRsnIe->hdr.eleLen);
  215. length += (pRsnIe->hdr.eleLen+2);
  216. pRsnIe += 1;
  217. index++;}
  218. }
  219. else {pSite->rsnIeLen = 0;}
  220. }*/
  221. /************************************************************************
  222. * siteMgr_create *
  223. ************************************************************************
  224. DESCRIPTION: Site manager module creation function, called by the config mgr in creation phase
  225. performs the following:
  226. - Allocate the site manager handle
  227. - Allocate the desired & mgmt params structure
  228. INPUT: hOs - Handle to OS
  229. OUTPUT:
  230. RETURN: Handle to the site manager module on success, NULL otherwise
  231. ************************************************************************/
  232. TI_HANDLE siteMgr_create(TI_HANDLE hOs)
  233. {
  234. siteMgr_t *pSiteMgr;
  235. UINT32 initVec;
  236. initVec = 0;
  237. pSiteMgr = os_memoryAlloc(hOs, sizeof(siteMgr_t));
  238. if (pSiteMgr == NULL)
  239. return NULL;
  240. os_memoryZero(hOs, pSiteMgr, sizeof(siteMgr_t));
  241. initVec |= (1 << SITE_MGR_INIT_BIT);
  242. pSiteMgr->pDesiredParams = os_memoryAlloc(hOs, sizeof(siteMgrInitParams_t));
  243. if (pSiteMgr->pDesiredParams == NULL)
  244. {
  245. release_module(pSiteMgr, initVec);
  246. return NULL;
  247. }
  248. initVec |= (1 << DESIRED_PARAMS_INIT_BIT);
  249. pSiteMgr->pSitesMgmtParams = os_memoryAlloc(hOs, sizeof(sitesMgmtParams_t));
  250. if (pSiteMgr->pSitesMgmtParams == NULL)
  251. {
  252. release_module(pSiteMgr, initVec);
  253. return NULL;
  254. }
  255. initVec |= (1 << MGMT_PARAMS_INIT_BIT);
  256. pSiteMgr->hOs = hOs;
  257. return(pSiteMgr);
  258. }
  259. /************************************************************************
  260. * siteMgr_config *
  261. ************************************************************************
  262. DESCRIPTION: Site manager module configuration function, called by the config mgr in configuration phase
  263. performs the following:
  264. - Reset & initiailzes local variables
  265. - Init the handles to be used by the module
  266. INPUT: hSiteMgr - site manager handle
  267. List of handles to be used by the module
  268. pSiteMgrInitParams - Init table of the module, contains the following:
  269. - Parameters read from registry
  270. - Chip parameters
  271. OUTPUT:
  272. RETURN: OK on success, NOK otherwise
  273. ************************************************************************/
  274. TI_STATUS siteMgr_config( TI_HANDLE hSiteMgr,
  275. TI_HANDLE hConn,
  276. TI_HANDLE hSmeSm,
  277. TI_HANDLE hCtrlData,
  278. TI_HANDLE hRxData,
  279. TI_HANDLE hTxData,
  280. TI_HANDLE hRsn,
  281. TI_HANDLE hAuth,
  282. TI_HANDLE hAssoc,
  283. TI_HANDLE hHalCtrl,
  284. TI_HANDLE hMlmeSm,
  285. TI_HANDLE hRegulatoryDomain,
  286. TI_HANDLE hMeasurementMgr,
  287. TI_HANDLE hApConn,
  288. TI_HANDLE hCurrBss,
  289. TI_HANDLE hReport,
  290. TI_HANDLE hOs ,
  291. TI_HANDLE hExcMngr,
  292. TI_HANDLE hQosMngr,
  293. TI_HANDLE thePowerMgrHandle,
  294. TI_HANDLE hScr,
  295. TI_HANDLE hEvHandler,
  296. TI_HANDLE hMacServices,
  297. siteMgrInitParams_t *pSiteMgrInitParams)
  298. {
  299. siteMgr_t *pSiteMgr = (siteMgr_t *)hSiteMgr;
  300. UINT32 timestamp;
  301. slotTime_e slotTime;
  302. paramInfo_t saParam;
  303. TI_STATUS status;
  304. /* Init handles */
  305. pSiteMgr->hConn = hConn;
  306. pSiteMgr->hSmeSm = hSmeSm;
  307. pSiteMgr->hHalCtrl = hHalCtrl;
  308. pSiteMgr->hCtrlData = hCtrlData;
  309. pSiteMgr->hRxData = hRxData;
  310. pSiteMgr->hTxData = hTxData;
  311. pSiteMgr->hRsn = hRsn;
  312. pSiteMgr->hAuth = hAuth;
  313. pSiteMgr->hAssoc = hAssoc;
  314. pSiteMgr->hRegulatoryDomain = hRegulatoryDomain;
  315. pSiteMgr->hMeasurementMgr = hMeasurementMgr;
  316. pSiteMgr->hReport = hReport;
  317. pSiteMgr->hOs = hOs;
  318. pSiteMgr->hMlmeSm = hMlmeSm;
  319. pSiteMgr->hAssoc = hAssoc;
  320. pSiteMgr->hReport = hReport;
  321. pSiteMgr->hExcMngr = hExcMngr;
  322. pSiteMgr->hApConn = hApConn;
  323. pSiteMgr->hCurrBss = hCurrBss;
  324. pSiteMgr->hQosMngr = hQosMngr;
  325. pSiteMgr->hPowerMgr = thePowerMgrHandle;
  326. pSiteMgr->hScr = hScr;
  327. pSiteMgr->hEvHandler = hEvHandler;
  328. pSiteMgr->hMacServices = hMacServices;
  329. /* Reset counter for Tx Power Control adjustment */
  330. pSiteMgr->siteMgrTxPowerCheckTime = 0;
  331. /* Init desired parameters */
  332. os_memoryCopy(hOs, pSiteMgr->pDesiredParams, pSiteMgrInitParams, sizeof(siteMgrInitParams_t));
  333. /* Init Beacon Filter Desired State */
  334. pSiteMgr->beaconFilterParams.desiredState = pSiteMgrInitParams->beaconFilterParams.desiredState;
  335. /* Init Beacon Filter numOfStored parameter */
  336. pSiteMgr->beaconFilterParams.numOfStored = pSiteMgrInitParams->beaconFilterParams.numOfStored;
  337. /* Init management params */
  338. pSiteMgr->pSitesMgmtParams->dot11A_sitesTables.maxNumOfSites = MAX_SITES_A_BAND;
  339. siteMgr_resetSiteTable(pSiteMgr,(siteTablesParams_t *)&pSiteMgr->pSitesMgmtParams->dot11A_sitesTables);
  340. pSiteMgr->pSitesMgmtParams->dot11BG_sitesTables.maxNumOfSites = MAX_SITES_BG_BAND;
  341. siteMgr_resetSiteTable(pSiteMgr,&pSiteMgr->pSitesMgmtParams->dot11BG_sitesTables);
  342. /* calculate random BSSID for usage in IBSS */
  343. timestamp = os_timeStampMs(pSiteMgr->hOs);
  344. os_memoryCopy(pSiteMgr->hOs, (void *)&(pSiteMgr->ibssBssid.addr[0]), &timestamp, sizeof(UINT32));
  345. pSiteMgr->ibssBssid.addr[0] = 0x00;
  346. timestamp = os_timeStampMs(pSiteMgr->hOs);
  347. os_memoryCopy(pSiteMgr->hOs, (void *)&(pSiteMgr->ibssBssid.addr[2]), &timestamp, sizeof(UINT32));
  348. /* Get the Source MAC address in order to use it for AD-Hoc BSSID, solving Conexant ST issue for WiFi test */
  349. saParam.paramType = CTRL_DATA_MAC_ADDRESS;
  350. status = ctrlData_getParam(hCtrlData, &saParam);
  351. if (status != OK)
  352. {
  353. WLAN_OS_REPORT(("\n ERROR !!! : siteMgr_config - Error in getting MAC address\n" ));
  354. return NOK;
  355. }
  356. pSiteMgr->ibssBssid.addr[0] = 0x02;
  357. pSiteMgr->ibssBssid.addr[1] = saParam.content.ctrlDataDeviceMacAddress.addr[1];
  358. pSiteMgr->ibssBssid.addr[2] = saParam.content.ctrlDataDeviceMacAddress.addr[2];
  359. pSiteMgr->keepAliveEnable = pSiteMgrInitParams->siteMgrDesiredkeepAliveEnable;
  360. pSiteMgr->numOfBeaconFiltering = DEAFULT_BEACON_FILTERING_NUM;
  361. switch(pSiteMgr->pDesiredParams->siteMgrRadioValues.siteMgr_radioType)
  362. {
  363. case MAXIM:
  364. pSiteMgr->pDesiredParams->siteMgrRadioValues.pSiteMgr_selectedRadioValues =
  365. &pSiteMgr->pDesiredParams->siteMgrRadioValues.siteMgr_maximRadioValues;
  366. pSiteMgr->pDesiredParams->siteMgrSupportedBand = RADIO_BAND_2_4_GHZ;
  367. WLAN_REPORT_INIT(pSiteMgr->hReport, SITE_MGR_MODULE_LOG, ("MAXIM !!! \n"));
  368. break;
  369. case RFMD:
  370. pSiteMgr->pDesiredParams->siteMgrRadioValues.pSiteMgr_selectedRadioValues =
  371. &pSiteMgr->pDesiredParams->siteMgrRadioValues.siteMgr_rfmdRadioValues;
  372. pSiteMgr->pDesiredParams->siteMgrSupportedBand = RADIO_BAND_2_4_GHZ;
  373. WLAN_REPORT_INIT(pSiteMgr->hReport, SITE_MGR_MODULE_LOG, ("RFMD !!! \n"));
  374. break;
  375. case RADIA_BG:
  376. pSiteMgr->pDesiredParams->siteMgrRadioValues.pSiteMgr_selectedRadioValues =
  377. &pSiteMgr->pDesiredParams->siteMgrRadioValues.siteMgr_radiaRadioValues;
  378. pSiteMgr->pDesiredParams->siteMgrSupportedBand = RADIO_BAND_2_4_GHZ;
  379. WLAN_REPORT_INIT(pSiteMgr->hReport, SITE_MGR_MODULE_LOG, ("RADIA bg !!! \n"));
  380. break;
  381. case RADIA_ABG:
  382. pSiteMgr->pDesiredParams->siteMgrRadioValues.pSiteMgr_selectedRadioValues =
  383. &pSiteMgr->pDesiredParams->siteMgrRadioValues.siteMgr_radiaRadioValues;
  384. pSiteMgr->pDesiredParams->siteMgrSupportedBand = RADIO_BAND_DUAL;
  385. WLAN_REPORT_INIT(pSiteMgr->hReport, SITE_MGR_MODULE_LOG, ("RADIA abg !!! \n"));
  386. break;
  387. default:
  388. pSiteMgr->pDesiredParams->siteMgrRadioValues.pSiteMgr_selectedRadioValues = NULL;
  389. WLAN_REPORT_ERROR(pSiteMgr->hReport, SITE_MGR_MODULE_LOG,
  390. ("!!!.....UnKnown Radio Type !!!\n"));
  391. }
  392. pSiteMgr->beaconSentCount = 0;
  393. pSiteMgr->pDesiredParams->siteMgrDesiredAtimWindow = 0;
  394. if(pSiteMgr->pDesiredParams->siteMgrDesiredDot11Mode == DOT11_DUAL_MODE)
  395. {
  396. if(pSiteMgr->pDesiredParams->siteMgrSupportedBand == RADIO_BAND_DUAL)
  397. {
  398. pSiteMgr->siteMgrOperationalMode = DOT11_G_MODE;
  399. pSiteMgr->radioBand = RADIO_BAND_2_4_GHZ;
  400. slotTime = pSiteMgr->pDesiredParams->siteMgrDesiredSlotTime;
  401. pSiteMgr->pSitesMgmtParams->pCurrentSiteTable = &pSiteMgr->pSitesMgmtParams->dot11BG_sitesTables;
  402. }
  403. else if(pSiteMgr->pDesiredParams->siteMgrSupportedBand == RADIO_BAND_2_4_GHZ)
  404. {
  405. pSiteMgr->pDesiredParams->siteMgrDesiredDot11Mode = DOT11_G_MODE;
  406. pSiteMgr->siteMgrOperationalMode = DOT11_G_MODE;
  407. pSiteMgr->radioBand = RADIO_BAND_2_4_GHZ;
  408. slotTime = pSiteMgr->pDesiredParams->siteMgrDesiredSlotTime;
  409. pSiteMgr->pSitesMgmtParams->pCurrentSiteTable = &pSiteMgr->pSitesMgmtParams->dot11BG_sitesTables;
  410. }
  411. else
  412. {
  413. pSiteMgr->pDesiredParams->siteMgrDesiredDot11Mode = DOT11_A_MODE;
  414. pSiteMgr->siteMgrOperationalMode = DOT11_A_MODE;
  415. pSiteMgr->radioBand = RADIO_BAND_5_0_GHZ;
  416. slotTime = PHY_SLOT_TIME_SHORT;
  417. pSiteMgr->pSitesMgmtParams->pCurrentSiteTable = (siteTablesParams_t *)&pSiteMgr->pSitesMgmtParams->dot11A_sitesTables;
  418. }
  419. }
  420. else if(pSiteMgr->pDesiredParams->siteMgrDesiredDot11Mode == DOT11_G_MODE)
  421. {
  422. slotTime = pSiteMgr->pDesiredParams->siteMgrDesiredSlotTime;
  423. pSiteMgr->radioBand = RADIO_BAND_2_4_GHZ;
  424. if((pSiteMgr->pDesiredParams->siteMgrSupportedBand == RADIO_BAND_DUAL) ||
  425. (pSiteMgr->pDesiredParams->siteMgrSupportedBand == RADIO_BAND_2_4_GHZ))
  426. {
  427. pSiteMgr->pSitesMgmtParams->pCurrentSiteTable = &pSiteMgr->pSitesMgmtParams->dot11BG_sitesTables;
  428. pSiteMgr->siteMgrOperationalMode = pSiteMgr->pDesiredParams->siteMgrDesiredDot11Mode;
  429. }
  430. else
  431. {
  432. WLAN_OS_REPORT(("\nERROR !!!.....The radio doesn't support the desired dot11 mode !!! \n"));
  433. return NOK;
  434. }
  435. }
  436. else if(pSiteMgr->pDesiredParams->siteMgrDesiredDot11Mode == DOT11_B_MODE)
  437. {
  438. slotTime = PHY_SLOT_TIME_LONG;
  439. pSiteMgr->radioBand = RADIO_BAND_2_4_GHZ;
  440. if((pSiteMgr->pDesiredParams->siteMgrSupportedBand == RADIO_BAND_DUAL) ||
  441. (pSiteMgr->pDesiredParams->siteMgrSupportedBand == RADIO_BAND_2_4_GHZ))
  442. {
  443. pSiteMgr->pSitesMgmtParams->pCurrentSiteTable = &pSiteMgr->pSitesMgmtParams->dot11BG_sitesTables;
  444. pSiteMgr->siteMgrOperationalMode = pSiteMgr->pDesiredParams->siteMgrDesiredDot11Mode;
  445. }
  446. else
  447. {
  448. WLAN_OS_REPORT(("\nERROR !!!.....The radio doesn't support the desired dot11 mode !!! \n"));
  449. return NOK;
  450. }
  451. }
  452. else
  453. {
  454. slotTime = PHY_SLOT_TIME_SHORT;
  455. pSiteMgr->radioBand = RADIO_BAND_5_0_GHZ;
  456. if((pSiteMgr->pDesiredParams->siteMgrSupportedBand == RADIO_BAND_DUAL) ||
  457. (pSiteMgr->pDesiredParams->siteMgrSupportedBand == RADIO_BAND_5_0_GHZ))
  458. {
  459. pSiteMgr->siteMgrOperationalMode = pSiteMgr->pDesiredParams->siteMgrDesiredDot11Mode;
  460. pSiteMgr->pSitesMgmtParams->pCurrentSiteTable = (siteTablesParams_t *)&pSiteMgr->pSitesMgmtParams->dot11A_sitesTables;
  461. }
  462. else
  463. {
  464. WLAN_OS_REPORT(("\nERROR !!!.....The radio doesn't support the desired dot11 mode !!! \n"));
  465. return NOK;
  466. }
  467. }
  468. /* configure hal with common core-hal parameters */
  469. whalCtrl_SetRadioBand(pSiteMgr->hHalCtrl, pSiteMgr->radioBand);
  470. whalCtrl_SetSlotTime(pSiteMgr->hHalCtrl, slotTime);
  471. siteMgr_ConfigRate(hSiteMgr);
  472. WLAN_REPORT_INIT(hReport, SITE_MGR_MODULE_LOG,
  473. (" SiteMgr - numOfElements = %d IETableSize = %d\n" , pSiteMgrInitParams->beaconFilterParams.numOfElements, pSiteMgrInitParams->beaconFilterParams.IETableSize)) ;
  474. /*send the table regardless to the state*/
  475. whalCtrl_SetBeaconFilterIETable(pSiteMgr->hHalCtrl ,(UINT8 *)&(pSiteMgrInitParams->beaconFilterParams.numOfElements), (UINT8 *)&(pSiteMgrInitParams->beaconFilterParams.IETable[0]) , (UINT8 *)&(pSiteMgrInitParams->beaconFilterParams.IETableSize)) ;
  476. /* At start-up Set the Beacon Filter state as the User required */
  477. whalCtrl_SetBeaconFiltering(pSiteMgr->hHalCtrl, pSiteMgrInitParams->beaconFilterParams.desiredState, pSiteMgr->beaconFilterParams.numOfStored);
  478. pSiteMgr->pSitesMgmtParams->pPrevPrimarySite = NULL;
  479. pSiteMgr->powerSaveLdMode = FALSE;
  480. WLAN_REPORT_INIT(hReport, SITE_MGR_MODULE_LOG, (".....Site manager configured successfully\n"));
  481. return OK;
  482. }
  483. /************************************************************************
  484. * siteMgr_unLoad *
  485. ************************************************************************
  486. DESCRIPTION: site manager module unload function, called by the config mgr in the unlod phase
  487. performs the following:
  488. - Free all memory aloocated by the module
  489. INPUT: hSiteMgr - site mgr handle.
  490. OUTPUT:
  491. RETURN: OK on success, NOK otherwise
  492. ************************************************************************/
  493. TI_STATUS siteMgr_unLoad(TI_HANDLE hSiteMgr)
  494. {
  495. UINT32 initVec;
  496. siteMgr_t *pSiteMgr = (siteMgr_t *)hSiteMgr;
  497. if (!pSiteMgr)
  498. return OK;
  499. initVec = 0xFFFF;
  500. release_module(pSiteMgr, initVec);
  501. return OK;
  502. }
  503. /***********************************************************************
  504. * siteMgr_setParam
  505. ***********************************************************************
  506. DESCRIPTION: site mgr set param function, called by the following:
  507. - config mgr in order to set a parameter from the OS abstraction layer.
  508. In this fuction, the site manager OS abstraction layer configures the site manager to the desired params.
  509. Sometimes it requires a re scan, depending in the parameter type
  510. INPUT: hSiteMgr - Connection handle.
  511. pParam - Pointer to the parameter
  512. OUTPUT:
  513. RETURN: RE_SCAN_NEEDED if re scan needed, OK on success, NOK on failure
  514. ************************************************************************/
  515. TI_STATUS siteMgr_setParam(TI_HANDLE hSiteMgr,
  516. paramInfo_t *pParam)
  517. {
  518. siteMgr_t *pSiteMgr = (siteMgr_t *)hSiteMgr;
  519. siteEntry_t *pPrimarySite = pSiteMgr->pSitesMgmtParams->pPrimarySite;
  520. OS_802_11_CONFIGURATION *pConfig;
  521. UINT32 channel;
  522. slotTime_e slotTime;
  523. switch(pParam->paramType)
  524. {
  525. case SITE_MGR_CONFIGURATION_PARAM:
  526. pConfig = pParam->content.pSiteMgrConfiguration;
  527. /* for(channel = 0; channel < SITE_MGR_CHANNEL_MAX+1; channel++)
  528. {
  529. if(pConfig->channel == pSiteMgr->pDesiredParams->siteMgrFreq2ChannelTable[channel])
  530. break;
  531. }*/
  532. channel = Freq2Chan(pConfig->Union.channel);
  533. if(channel == 0 || channel > SITE_MGR_CHANNEL_MAX)
  534. return PARAM_VALUE_NOT_VALID;
  535. else
  536. pConfig->Union.channel = channel;
  537. if((pSiteMgr->pDesiredParams->siteMgrDesiredChannel != pConfig->Union.channel) ||
  538. (pSiteMgr->pDesiredParams->siteMgrDesiredChannel != pConfig->Union.channel) ||
  539. (pSiteMgr->pDesiredParams->siteMgrDesiredAtimWindow != pConfig->ATIMWindow))
  540. {
  541. pSiteMgr->pDesiredParams->siteMgrDesiredChannel = (UINT8)pConfig->Union.channel;
  542. pSiteMgr->pDesiredParams->siteMgrDesiredBeaconInterval = (UINT16)pConfig->BeaconPeriod;
  543. pSiteMgr->pDesiredParams->siteMgrDesiredAtimWindow = pConfig->ATIMWindow;
  544. }
  545. return OK;
  546. case SITE_MGR_DESIRED_CHANNEL_PARAM:
  547. if (pParam->content.siteMgrDesiredChannel > SITE_MGR_CHANNEL_MAX)
  548. return PARAM_VALUE_NOT_VALID;
  549. if (pSiteMgr->pDesiredParams->siteMgrDesiredChannel != pParam->content.siteMgrDesiredChannel)
  550. pSiteMgr->pDesiredParams->siteMgrDesiredChannel = (UINT8)pParam->content.siteMgrDesiredChannel;
  551. return OK;
  552. case SITE_MGR_DESIRED_BSSID_PARAM:
  553. os_memoryCopy(pSiteMgr->hOs, (void *)pSiteMgr->pDesiredParams->siteMgrDesiredBSSID.addr, (void *)pParam->content.siteMgrDesiredBSSID.addr, sizeof(macAddress_t));
  554. #if 0
  555. WLAN_REPORT_INFORMATION(pSiteMgr->hReport, SITE_MGR_MODULE_LOG, ("Set BSSID = 0x%02x:0x%02x:0x%02x:0x%02x:0x%02x:0x%02x \n",
  556. pSiteMgr->pDesiredParams->siteMgrDesiredBSSID.addr[0],
  557. pSiteMgr->pDesiredParams->siteMgrDesiredBSSID.addr[1],
  558. pSiteMgr->pDesiredParams->siteMgrDesiredBSSID.addr[2],
  559. pSiteMgr->pDesiredParams->siteMgrDesiredBSSID.addr[3],
  560. pSiteMgr->pDesiredParams->siteMgrDesiredBSSID.addr[4],
  561. pSiteMgr->pDesiredParams->siteMgrDesiredBSSID.addr[5]));
  562. #endif
  563. return OK;
  564. case SITE_MGR_DESIRED_SSID_PARAM:
  565. WLAN_REPORT_INFORMATION(pSiteMgr->hReport, SITE_MGR_MODULE_LOG,
  566. ("\nSet new SSID=%s (len=%d) \n",
  567. pParam->content.siteMgrDesiredSSID.ssidString,
  568. pParam->content.siteMgrDesiredSSID.len));
  569. if (pParam->content.siteMgrDesiredSSID.len > MAX_SSID_LEN)
  570. return PARAM_VALUE_NOT_VALID;
  571. os_memoryCopy(pSiteMgr->hOs, &pSiteMgr->pDesiredParams->siteMgrDesiredSSID, &pParam->content.siteMgrDesiredSSID, sizeof(ssid_t));
  572. /* only add null at the end of the string if the string length is less than 32 bytes and so we have one char left
  573. TODO: another byte must be added, and the alignment change MUST be tested (esp. in CLI commands with ssid_t */
  574. if ( MAX_SSID_LEN > pSiteMgr->pDesiredParams->siteMgrDesiredSSID.len )
  575. {
  576. pSiteMgr->pDesiredParams->siteMgrDesiredSSID.ssidString[pSiteMgr->pDesiredParams->siteMgrDesiredSSID.len] = '\0';
  577. }
  578. /* increase the random IBSS BSSID calculated during init */
  579. pSiteMgr->ibssBssid.addr[MAC_ADDR_LEN - 1] ++;
  580. if (utils_isJunkSSID(&pSiteMgr->pDesiredParams->siteMgrDesiredSSID))
  581. {
  582. rsn_removedDefKeys(pSiteMgr->hRsn);
  583. }
  584. return RE_SCAN_NEEDED;
  585. case SITE_MGR_DESIRED_BSS_TYPE_PARAM:
  586. WLAN_REPORT_INFORMATION(pSiteMgr->hReport, SITE_MGR_MODULE_LOG,
  587. ("\nSet BssType = %d\n", pParam->content.siteMgrDesiredBSSType));
  588. if (pParam->content.siteMgrDesiredBSSType > BSS_ANY)
  589. return PARAM_VALUE_NOT_VALID;
  590. if (pSiteMgr->pDesiredParams->siteMgrDesiredBSSType != pParam->content.siteMgrDesiredBSSType)
  591. {
  592. pSiteMgr->pDesiredParams->siteMgrDesiredBSSType = pParam->content.siteMgrDesiredBSSType;
  593. /* If the new BSS type is NOT Ad_Hoc, We make sure that the rate masks are set to G */
  594. if(pSiteMgr->pDesiredParams->siteMgrDesiredBSSType != BSS_INDEPENDENT)
  595. {
  596. pSiteMgr->siteMgrOperationalMode = DOT11_G_MODE;
  597. siteMgr_ConfigRate(pSiteMgr);
  598. }
  599. /* If the new BSS type is Ad_Hoc, increase the random BSSID calculated during init */
  600. if(pSiteMgr->pDesiredParams->siteMgrDesiredBSSType == BSS_INDEPENDENT)
  601. {
  602. pSiteMgr->ibssBssid.addr[MAC_ADDR_LEN - 1] ++;
  603. }
  604. /* go to B_ONLY Mode only if WiFI bit is Set*/
  605. if (pSiteMgr->pDesiredParams->siteMgrWiFiAdhoc == TRUE)
  606. { /* Configuration For AdHoc when using external configuration */
  607. if(pSiteMgr->pDesiredParams->siteMgrExternalConfiguration == FALSE)
  608. {
  609. siteMgr_externalConfigurationParametersSet(hSiteMgr);
  610. }
  611. }
  612. }
  613. return OK;
  614. case SITE_MGR_DESIRED_MODULATION_TYPE_PARAM:
  615. if ((pParam->content.siteMgrDesiredModulationType < DRV_MODULATION_CCK) ||
  616. (pParam->content.siteMgrDesiredModulationType > DRV_MODULATION_OFDM))
  617. return PARAM_VALUE_NOT_VALID;
  618. if (pSiteMgr->pDesiredParams->siteMgrDesiredModulationType != pParam->content.siteMgrDesiredModulationType)
  619. {
  620. pSiteMgr->pDesiredParams->siteMgrDesiredModulationType = pParam->content.siteMgrDesiredModulationType;
  621. /* means that we are moving from non-pbcc network to pbcc */
  622. if (pParam->content.siteMgrDesiredModulationType == DRV_MODULATION_PBCC)
  623. return RE_SCAN_NEEDED;
  624. return OK;
  625. }
  626. return OK;
  627. case SITE_MGR_BEACON_RECV:
  628. if (!pPrimarySite)
  629. {
  630. return NO_SITE_SELECTED_YET;
  631. }
  632. pPrimarySite->beaconRecv = pParam->content.siteMgrBeaconRecv;
  633. return OK;
  634. case SITE_MGR_DESIRED_BEACON_INTERVAL_PARAM:
  635. if (pParam->content.siteMgrDesiredBeaconInterval < SITE_MGR_BEACON_INTERVAL_MIN)
  636. return PARAM_VALUE_NOT_VALID;
  637. if (pSiteMgr->pDesiredParams->siteMgrDesiredBeaconInterval != pParam->content.siteMgrDesiredBeaconInterval)
  638. pSiteMgr->pDesiredParams->siteMgrDesiredBeaconInterval = pParam->content.siteMgrDesiredBeaconInterval;
  639. return OK;
  640. case SITE_MGR_DESIRED_PREAMBLE_TYPE_PARAM:
  641. if ((pParam->content.siteMgrDesiredPreambleType != PREAMBLE_LONG) &&
  642. (pParam->content.siteMgrDesiredPreambleType != PREAMBLE_SHORT))
  643. return PARAM_VALUE_NOT_VALID;
  644. if (pSiteMgr->pDesiredParams->siteMgrDesiredPreambleType != pParam->content.siteMgrDesiredPreambleType)
  645. {
  646. pSiteMgr->pDesiredParams->siteMgrDesiredPreambleType = pParam->content.siteMgrDesiredPreambleType;
  647. }
  648. return OK;
  649. case SITE_MGR_DESIRED_SUPPORTED_RATE_SET_PARAM:
  650. return setSupportedRateSet(pSiteMgr, &(pParam->content.siteMgrDesiredSupportedRateSet));
  651. case SITE_MGR_DESIRED_DOT11_MODE_PARAM:
  652. if(pParam->content.siteMgrDot11Mode > DOT11_MAX_MODE)
  653. return PARAM_VALUE_NOT_VALID;
  654. if(pSiteMgr->pDesiredParams->siteMgrDesiredDot11Mode != pParam->content.siteMgrDot11Mode)
  655. {
  656. pSiteMgr->pDesiredParams->siteMgrDesiredDot11Mode = pParam->content.siteMgrDot11Mode;
  657. /* since the dot11ABAmode changed, the STA operational mode should be changed */
  658. if(pSiteMgr->pDesiredParams->siteMgrDesiredDot11Mode == DOT11_DUAL_MODE)
  659. {
  660. if(pSiteMgr->pDesiredParams->siteMgrSupportedBand == RADIO_BAND_DUAL)
  661. {
  662. pSiteMgr->siteMgrOperationalMode = DOT11_G_MODE;
  663. }
  664. else if(pSiteMgr->pDesiredParams->siteMgrSupportedBand == RADIO_BAND_2_4_GHZ)
  665. {
  666. pSiteMgr->pDesiredParams->siteMgrDesiredDot11Mode = DOT11_G_MODE;
  667. pSiteMgr->siteMgrOperationalMode = DOT11_G_MODE;
  668. }
  669. else
  670. {
  671. pSiteMgr->pDesiredParams->siteMgrDesiredDot11Mode = DOT11_G_MODE;
  672. pSiteMgr->siteMgrOperationalMode = DOT11_A_MODE;
  673. }
  674. }
  675. else
  676. pSiteMgr->siteMgrOperationalMode = pSiteMgr->pDesiredParams->siteMgrDesiredDot11Mode;
  677. /* configure HAL with new parameters update rates and select site table */
  678. pSiteMgr->prevRadioBand = pSiteMgr->radioBand;
  679. if(pSiteMgr->siteMgrOperationalMode == DOT11_A_MODE)
  680. {
  681. pSiteMgr->pSitesMgmtParams->pCurrentSiteTable = (siteTablesParams_t *)&pSiteMgr->pSitesMgmtParams->dot11A_sitesTables;
  682. pSiteMgr->radioBand = RADIO_BAND_5_0_GHZ;
  683. slotTime = PHY_SLOT_TIME_SHORT;
  684. }
  685. else if(pSiteMgr->siteMgrOperationalMode == DOT11_G_MODE)
  686. {
  687. pSiteMgr->pSitesMgmtParams->pCurrentSiteTable = &pSiteMgr->pSitesMgmtParams->dot11BG_sitesTables;
  688. pSiteMgr->radioBand = RADIO_BAND_2_4_GHZ;
  689. slotTime = pSiteMgr->pDesiredParams->siteMgrDesiredSlotTime;
  690. }
  691. else
  692. {
  693. pSiteMgr->pSitesMgmtParams->pCurrentSiteTable = &pSiteMgr->pSitesMgmtParams->dot11BG_sitesTables;
  694. pSiteMgr->radioBand = RADIO_BAND_2_4_GHZ;
  695. slotTime = PHY_SLOT_TIME_LONG;
  696. }
  697. if(pSiteMgr->prevRadioBand != pSiteMgr->radioBand)
  698. siteMgr_bandParamsConfig(pSiteMgr, TRUE);
  699. /* configure HAL */
  700. whalCtrl_SetRadioBand(pSiteMgr->hHalCtrl, pSiteMgr->radioBand);
  701. whalCtrl_SetSlotTime(pSiteMgr->hHalCtrl, slotTime);
  702. /* If the BSS type is Ad_Hoc, increase the random BSSID calculated during init */
  703. if(pSiteMgr->pDesiredParams->siteMgrDesiredBSSType == BSS_INDEPENDENT)
  704. {
  705. pSiteMgr->ibssBssid.addr[MAC_ADDR_LEN - 1] ++;
  706. }
  707. /*siteMgr_resetAllSiteTables(pSiteMgr); */
  708. return RE_SCAN_NEEDED;
  709. }
  710. return OK;
  711. case SITE_MGR_OPERATIONAL_MODE_PARAM:
  712. if(pParam->content.siteMgrDot11OperationalMode < DOT11_B_MODE ||
  713. pParam->content.siteMgrDot11OperationalMode > DOT11_G_MODE )
  714. return PARAM_VALUE_NOT_VALID;
  715. pSiteMgr->siteMgrOperationalMode = pParam->content.siteMgrDot11OperationalMode;
  716. break;
  717. case SITE_MGR_USE_DRAFT_NUM_PARAM:
  718. if(pParam->content.siteMgrUseDraftNum != DRAFT_5_AND_EARLIER &&
  719. pParam->content.siteMgrUseDraftNum != DRAFT_6_AND_LATER)
  720. return PARAM_VALUE_NOT_VALID;
  721. if(pSiteMgr->pDesiredParams->siteMgrUseDraftNum != pParam->content.siteMgrUseDraftNum)
  722. {
  723. pSiteMgr->pDesiredParams->siteMgrUseDraftNum = pParam->content.siteMgrUseDraftNum;
  724. return RE_SCAN_NEEDED;
  725. }
  726. return OK;
  727. case SITE_MGR_RADIO_BAND_PARAM:
  728. if((INT8)pParam->content.siteMgrRadioBand < RADIO_BAND_2_4_GHZ ||
  729. (INT8)pParam->content.siteMgrRadioBand > RADIO_BAND_DUAL )
  730. return PARAM_VALUE_NOT_VALID;
  731. pSiteMgr->prevRadioBand = pSiteMgr->radioBand;
  732. pSiteMgr->radioBand = pParam->content.siteMgrRadioBand;
  733. if(pSiteMgr->prevRadioBand != pSiteMgr->radioBand)
  734. siteMgr_bandParamsConfig(pSiteMgr, FALSE);
  735. break;
  736. case SITE_MGR_DESIRED_SLOT_TIME_PARAM:
  737. if(pParam->content.siteMgrSlotTime != PHY_SLOT_TIME_LONG &&
  738. pParam->content.siteMgrSlotTime != PHY_SLOT_TIME_SHORT)
  739. return PARAM_VALUE_NOT_VALID;
  740. if(pSiteMgr->pDesiredParams->siteMgrDesiredSlotTime != pParam->content.siteMgrSlotTime)
  741. {
  742. if(pSiteMgr->siteMgrOperationalMode == DOT11_G_MODE)
  743. {
  744. pSiteMgr->pDesiredParams->siteMgrDesiredSlotTime = pParam->content.siteMgrSlotTime;
  745. if(!pPrimarySite)
  746. whalCtrl_SetSlotTime(pSiteMgr->hHalCtrl, pSiteMgr->pDesiredParams->siteMgrDesiredSlotTime);
  747. else if(pPrimarySite->bssType != BSS_INFRASTRUCTURE)
  748. whalCtrl_SetSlotTime(pSiteMgr->hHalCtrl, pSiteMgr->pDesiredParams->siteMgrDesiredSlotTime);
  749. }
  750. }
  751. return OK;
  752. case SITE_MGR_BEACON_FILTER_DESIRED_STATE_PARAM:
  753. {
  754. int desiredStateBeforeChange = pSiteMgr->beaconFilterParams.desiredState;
  755. /* Set the New Desired User request of Beacon Filter */
  756. pSiteMgr->beaconFilterParams.desiredState = pParam->content.siteMgrDesiredBeaconFilterState;
  757. /* Check if the Desired mode has changed - If not no need to send the MIB to the FW */
  758. if ( pSiteMgr->beaconFilterParams.desiredState == desiredStateBeforeChange )
  759. {
  760. WLAN_REPORT_DEBUG_CONTROL(pSiteMgr->hReport,
  761. ("Beacon Filter already %s" , (TRUE == desiredStateBeforeChange)? "ENABLED":"DISABLED" ) );
  762. break;
  763. }
  764. WLAN_REPORT_DEBUG_CONTROL(pSiteMgr->hReport,
  765. ("\n New Beacon Filter Desired State is : %s pSiteMgr->beaconFilterParams.currentState %s\n" , ( TRUE == (pSiteMgr->beaconFilterParams.desiredState) )?"ENABLED":"DISABLED",( TRUE == (pSiteMgr->beaconFilterParams.currentState) )?"ENABLED":"DISABLED"));
  766. /* Check if the new Desired state is TRUE then Also check the Current State and then if FALSEdo not send the MIB to FW*/
  767. if ( (TRUE == pSiteMgr->beaconFilterParams.desiredState ) && (FALSE == pSiteMgr->beaconFilterParams.currentState ))
  768. {
  769. WLAN_REPORT_DEBUG_CONTROL(pSiteMgr->hReport,
  770. ("\n New Beacon Filter Desired State is TRUE But Current State is DISABLED So the MIBwill be sent Later !!!!"));
  771. }
  772. /* In any other cases the User required Beacon Filter Configuration will be sent to FW immediately */
  773. else
  774. {
  775. WLAN_REPORT_DEBUG_CONTROL(pSiteMgr->hReport,
  776. ("\n New Sending Beacon Filter Desired State To FW !!!!"));
  777. whalCtrl_SetBeaconFiltering(pSiteMgr->hHalCtrl, pSiteMgr->beaconFilterParams.desiredState, pSiteMgr->beaconFilterParams.numOfStored);
  778. }
  779. }
  780. break;
  781. case SITE_MGR_DISASSOCIATE_PARAM:
  782. case SITE_MGR_DEAUTHENTICATE_PARAM:
  783. if(!pPrimarySite)
  784. return OK;
  785. else { /* Set Junk SSID */
  786. pSiteMgr->pDesiredParams->siteMgrDesiredSSID.len = 4;
  787. pSiteMgr->pDesiredParams->siteMgrDesiredSSID.ssidString[0]=1;
  788. pSiteMgr->pDesiredParams->siteMgrDesiredSSID.ssidString[1]=1;
  789. pSiteMgr->pDesiredParams->siteMgrDesiredSSID.ssidString[2]=1;
  790. pSiteMgr->pDesiredParams->siteMgrDesiredSSID.ssidString[3]=1;
  791. return RE_SCAN_NEEDED;
  792. }
  793. case SITE_MGR_BSSID_LIST_SCAN_PARAM:
  794. #if 0
  795. /* TODO - merge fix from WinCE version (and generalize it if time permits) */
  796. /* Must return NOK in each case the scan is not actually performed */
  797. if(!pPrimarySite)
  798. {
  799. WLAN_REPORT_INFORMATION(pSiteMgr->hReport, SITE_MGR_MODULE_LOG,
  800. ("Not connected to Network => do the BSSID_LIST_SCAN command\n"));
  801. smeSm_startScan(pSiteMgr->hSmeSm);
  802. }
  803. param.paramType = RX_DATA_COUNTERS_PARAM;
  804. rxData_getParam(pSiteMgr->hRxData, &param);
  805. /* get current received data frames counter */
  806. currRxPacketsCount = param.content.siteMgrTiWlanCounters.DirectedFramesRecv;
  807. if((pSiteMgr->rxPacketsCount + 1) < currRxPacketsCount)
  808. {
  809. WLAN_REPORT_INFORMATION(pSiteMgr->hReport, SITE_MGR_MODULE_LOG,
  810. ("Traffic is active now => ignoring the BSSID_LIST_SCAN command\n"));
  811. return NOK;
  812. }
  813. else
  814. {
  815. WLAN_REPORT_INFORMATION(pSiteMgr->hReport, SITE_MGR_MODULE_LOG,
  816. ("Traffic is not active now => do the BSSID_LIST_SCAN command\n"));
  817. smeSm_startScan(pSiteMgr->hSmeSm);
  818. }
  819. }
  820. #endif
  821. return OK;
  822. case SITE_MGR_LAST_RX_RATE_PARAM:
  823. if (pPrimarySite != NULL)
  824. {
  825. pPrimarySite->rxRate = pParam->content.ctrlDataCurrentBasicRate;
  826. }
  827. break;
  828. case SITE_MGR_CURRENT_CHANNEL_PARAM:
  829. if (!pPrimarySite)
  830. {
  831. return NO_SITE_SELECTED_YET;
  832. }
  833. pPrimarySite->channel = pParam->content.siteMgrCurrentChannel;
  834. break;
  835. case SITE_MGR_CURRENT_SIGNAL_PARAM:
  836. if (!pPrimarySite)
  837. {
  838. return NO_SITE_SELECTED_YET;
  839. }
  840. pPrimarySite->rssi = pParam->content.siteMgrCurrentSignal.rssi;
  841. break;
  842. default:
  843. WLAN_REPORT_ERROR(pSiteMgr->hReport, SITE_MGR_MODULE_LOG, ("Set param, Params is not supported, %d\n", pParam->paramType));
  844. return PARAM_NOT_SUPPORTED;
  845. }
  846. return OK;
  847. }
  848. /***********************************************************************
  849. * siteMgr_getParam
  850. ***********************************************************************
  851. DESCRIPTION: Site mgr get param function, called by the following:
  852. - config mgr in order to get a parameter from the OS abstraction layer.
  853. - From inside the dirver
  854. INPUT: hSiteMgr - site mgr handle.
  855. pParam - Pointer to the parameter
  856. OUTPUT:
  857. RETURN: OK on success, NOK otherwise
  858. ************************************************************************/
  859. TI_STATUS siteMgr_getParam(TI_HANDLE hSiteMgr,
  860. paramInfo_t *pParam)
  861. {
  862. siteMgr_t *pSiteMgr = (siteMgr_t *)hSiteMgr;
  863. siteEntry_t *pPrimarySite = pSiteMgr->pSitesMgmtParams->pPrimarySite;
  864. TI_STATUS status = OK;
  865. UINT8 siteEntryIndex;
  866. UINT32 dtimInterval;
  867. UINT32 delta;
  868. whalParamInfo_t whalParam;
  869. switch(pParam->paramType)
  870. {
  871. case SITE_MGR_CONFIGURATION_PARAM:
  872. pParam->content.pSiteMgrConfiguration->Length = sizeof(OS_802_11_CONFIGURATION);
  873. pParam->content.pSiteMgrConfiguration->ATIMWindow = pSiteMgr->pDesiredParams->siteMgrDesiredAtimWindow;
  874. pParam->content.pSiteMgrConfiguration->BeaconPeriod = pSiteMgr->pDesiredParams->siteMgrDesiredBeaconInterval;
  875. pParam->content.pSiteMgrConfiguration->Union.channel =
  876. Chan2Freq(pSiteMgr->pDesiredParams->siteMgrDesiredChannel);
  877. /*pSiteMgr->pDesiredParams->siteMgrFreq2ChannelTable[pSiteMgr->pDesiredParams->siteMgrDesiredChannel];*/
  878. if(pPrimarySite) {
  879. pParam->content.pSiteMgrConfiguration->FHConfig.DwellTime = pPrimarySite->FHParams.dwellTime;
  880. pParam->content.pSiteMgrConfiguration->FHConfig.HopPattern = pPrimarySite->FHParams.hopPattern;
  881. pParam->content.pSiteMgrConfiguration->FHConfig.HopSet = pPrimarySite->FHParams.hopSet;
  882. }
  883. else {
  884. pParam->content.pSiteMgrConfiguration->FHConfig.DwellTime = 0;
  885. pParam->content.pSiteMgrConfiguration->FHConfig.HopPattern = 0;
  886. pParam->content.pSiteMgrConfiguration->FHConfig.HopSet = 0;

Large files files are truncated, but you can click here to view the full file