1981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt/*
2981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * siteMgr.c
3981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt *
4981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * Copyright(c) 1998 - 2009 Texas Instruments. All rights reserved.
5981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * All rights reserved.
6981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt *
7981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * Redistribution and use in source and binary forms, with or without
8981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * modification, are permitted provided that the following conditions
9981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * are met:
10981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt *
11981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt *  * Redistributions of source code must retain the above copyright
12981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt *    notice, this list of conditions and the following disclaimer.
13981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt *  * Redistributions in binary form must reproduce the above copyright
14981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt *    notice, this list of conditions and the following disclaimer in
15981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt *    the documentation and/or other materials provided with the
16981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt *    distribution.
17981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt *  * Neither the name Texas Instruments nor the names of its
18981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt *    contributors may be used to endorse or promote products derived
19981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt *    from this software without specific prior written permission.
20981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt *
21981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
24981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
25981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
26981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
27981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
28981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
29981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
31981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt */
33981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
34981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt/** \file siteMgr.c
35981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt *  \brief Site Manager implementation
36981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt *
37981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt *  \see siteMgr.h
38981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt */
39981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
40981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt/****************************************************************************/
41981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt/*                                                                          */
42981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt/*      MODULE: siteMgr.c                                                   */
43981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt/*    PURPOSE:  Site Manager implementation                                 */
44981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt/*                                                                          */
45981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt/***************************************************************************/
46981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
47981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt#define __FILE_ID__  FILE_ID_85
48981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt#include "tidef.h"
49981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt#include "report.h"
50981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt#include "osApi.h"
51981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt#include "siteMgrApi.h"
52981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt#include "siteHash.h"
53981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt#include "smeApi.h"
54981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt#include "rate.h"
55981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt#include "connApi.h"
56981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt#include "mlmeSm.h"
57981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt#include "sme.h"
58981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt#include "DataCtrl_Api.h"
59981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt#include "regulatoryDomainApi.h"
60981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt#include "rsnApi.h"
61981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt#include "measurementMgrApi.h"
62981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt#include "qosMngr_API.h"
63981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt#include "PowerMgr_API.h"
64981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt#include "EvHandler.h"
65981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt#include "TI_IPC_Api.h"
66981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt#include "MacServices_api.h"
67981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt#include "apConn.h"
68981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt#include "currBss.h"
69981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt#include "PowerMgr.h"
70981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt#include "TWDriver.h"
71981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt#include "admCtrl.h"
72981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt#include "DrvMainModules.h"
73981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt#include "StaCap.h"
74981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt#include "freq.h"
75653850f71f9caaa41af19cadbab24bb5e655daf4Dmitry Shmidt#include "currBssApi.h"
76653850f71f9caaa41af19cadbab24bb5e655daf4Dmitry Shmidt#include "CmdBld.h"
77981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt#ifdef XCC_MODULE_INCLUDED
78981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt#include "XCCMngr.h"
79981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt#endif
80981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
81981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt/* definitions */
82981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
83981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt#define JOIN_RATE_MASK_1M   0x01
84981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt#define JOIN_RATE_MASK_2M   0x02
85981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt#define JOIN_RATE_MASK_5_5M 0x04
86981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt#define JOIN_RATE_MASK_11M  0x08
87981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt#define JOIN_RATE_MASK_22M  0x10
88981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
89981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
90981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt#define SITE_MGR_INIT_BIT           1
91981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt#define TIMER_INIT_BIT              2
92981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt#define DESIRED_PARAMS_INIT_BIT     3
93981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt#define MGMT_PARAMS_INIT_BIT        4
94981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
95981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt#define BUILT_IN_TEST_PERIOD 500
96981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
97981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt#define KEEP_ALIVE_SEND_NULL_DATA_PERIOD  10000
98981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
99981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt/* Reconfig constants */
100981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt#define SCAN_FAIL_THRESHOLD_FOR_RECONFIG        4  /* After 4 times we reset the 580 register and still no AP found - make recovery */
101981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt#define SCAN_FAIL_THRESHOLD_FOR_RESET_REG_580   90  /* After 90 times (45 seconds) and  no AP found - reset the 580 register */
102981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt#define SCAN_FAIL_RECONFIG_ENABLED              TI_TRUE
103981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt#define SCAN_FAIL_RECONFIG_DISABLED             TI_FALSE
104981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
105981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt#define TRIGGER_HIGH_TX_PW_PACING 10
106981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt#define TRIGGER_LOW_TX_PW_PACING 10
107981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt#define TRIGGER_HIGH_TX_PW_HYSTERESIS 3
108981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt#define TRIGGER_LOW_TX_PW_HYSTERESIS 3
109981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
110981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt/* Local Macros */
111981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
112981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt#define UPDATE_BEACON_INTERVAL(pSite, pFrameInfo)       pSite->beaconInterval = pFrameInfo->content.iePacket.beaconInerval
113981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
114981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt#define UPDATE_CAPABILITIES(pSite, pFrameInfo)          pSite->capabilities = pFrameInfo->content.iePacket.capabilities
115981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
116981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt#define UPDATE_PRIVACY(pSite, pFrameInfo)               pSite->privacy = ((pFrameInfo->content.iePacket.capabilities >> CAP_PRIVACY_SHIFT) & CAP_PRIVACY_MASK) ? TI_TRUE : TI_FALSE
117981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
118981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt#define UPDATE_AGILITY(pSite, pFrameInfo)               pSite->agility = ((pFrameInfo->content.iePacket.capabilities >> CAP_AGILE_SHIFT) & CAP_AGILE_MASK) ? TI_TRUE : TI_FALSE
119981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
120981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt#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
121981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt#define UPDATE_PROTECTION(pSite, pFrameInfo)            pSite->useProtection = (pFrameInfo->content.iePacket.useProtection)
122981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
123981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt#define UPDATE_SSID(pSite, pFrameInfo)                  if (pFrameInfo->content.iePacket.pSsid != NULL) { \
124981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                                                        pSite->ssid.len = pFrameInfo->content.iePacket.pSsid->hdr[1]; \
125981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                                                        os_memoryCopy(pSiteMgr->hOs, \
126981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                                                        (void *)pSite->ssid.str, \
127981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                                                        (void *)pFrameInfo->content.iePacket.pSsid->serviceSetId, \
128981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                                                        pFrameInfo->content.iePacket.pSsid->hdr[1]) ;}
129981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
130981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt#define UPDATE_CHANNEL(pSite, pFrameInfo, rxChannel)    if (pFrameInfo->content.iePacket.pDSParamsSet == NULL) \
131981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                                                            pSite->channel = rxChannel; \
132981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                                                        else \
133981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                                                            pSite->channel = pFrameInfo->content.iePacket.pDSParamsSet->currChannel;
134981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
135981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
136981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
137981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt#define UPDATE_DTIM_PERIOD(pSite, pFrameInfo)           if (pFrameInfo->content.iePacket.pTIM != NULL) \
138981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                                                        pSite->dtimPeriod = pFrameInfo->content.iePacket.pTIM->dtimPeriod
139981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
140981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt#define UPDATE_ATIM_WINDOW(pSite, pFrameInfo)           if (pFrameInfo->content.iePacket.pIBSSParamsSet != NULL) \
141981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                                                        pSite->atimWindow = pFrameInfo->content.iePacket.pIBSSParamsSet->atimWindow
142981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
143981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt#define UPDATE_BEACON_AP_TX_POWER(pSite, pFrameInfo)    if (pFrameInfo->content.iePacket.TPCReport != NULL) \
144981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                                                        pSite->APTxPower = pFrameInfo->content.iePacket.TPCReport->transmitPower
145981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
146981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt#define UPDATE_PROBE_AP_TX_POWER(pSite, pFrameInfo)     if (pFrameInfo->content.iePacket.TPCReport != NULL) \
147981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                                                        pSite->APTxPower = pFrameInfo->content.iePacket.TPCReport->transmitPower
148981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
149981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt#define UPDATE_BSS_TYPE(pSite, pFrameInfo)              pSite->bssType = ((pFrameInfo->content.iePacket.capabilities >> CAP_ESS_SHIFT) & CAP_ESS_MASK) ? BSS_INFRASTRUCTURE : BSS_INDEPENDENT
150981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
151981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt#define UPDATE_LOCAL_TIME_STAMP(pSiteMgr, pSite, pFrameInfo)        pSite->localTimeStamp = os_timeStampMs(pSiteMgr->hOs)
152981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
153981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt/* Updated from beacons */
154981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt#define UPDATE_BEACON_MODULATION(pSite, pFrameInfo)     pSite->beaconModulation = ((pFrameInfo->content.iePacket.capabilities >> CAP_PBCC_SHIFT) & CAP_PBCC_MASK) ? DRV_MODULATION_PBCC : DRV_MODULATION_CCK
155981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
156981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt/* Updated from probes */
157981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt#define UPDATE_PROBE_MODULATION(pSite, pFrameInfo)          pSite->probeModulation = ((pFrameInfo->content.iePacket.capabilities >> CAP_PBCC_SHIFT) & CAP_PBCC_MASK) ? DRV_MODULATION_PBCC : DRV_MODULATION_CCK
158981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
159981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt#define UPDATE_BEACON_RECV(pSite)                       pSite->beaconRecv = TI_TRUE
160981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
161981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt#define UPDATE_PROBE_RECV(pSite)                        pSite->probeRecv = TI_TRUE
162981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
163981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
164981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt#define UPDATE_RSN_IE(pSite, pRsnIe, rsnIeLen)              if (pRsnIe != NULL) { \
165981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                                                            TI_UINT8 length=0, index=0;\
166981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                                                            pSite->rsnIeLen = rsnIeLen;\
167981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                                                            while ((length < pSite->rsnIeLen) && (index<MAX_RSN_IE)){\
168981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                                                                pSite->pRsnIe[index].hdr[0] = pRsnIe->hdr[0];\
169981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                                                                pSite->pRsnIe[index].hdr[1] = pRsnIe->hdr[1];\
170981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                                                                os_memoryCopy(pSiteMgr->hOs, (void *)pSite->pRsnIe[index].rsnIeData, (void *)pRsnIe->rsnIeData, pRsnIe->hdr[1]);\
171981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                                                                length += (pRsnIe->hdr[1]+2); \
172981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                                                                pRsnIe += 1; \
173981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                                                                index++;}\
174981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                                                        } \
175981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                                                        else {pSite->rsnIeLen = 0;}
176981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
177981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt#define UPDATE_BEACON_TIMESTAMP(pSiteMgr, pSite, pFrameInfo)    os_memoryCopy(pSiteMgr->hOs, pSite->tsfTimeStamp, (void *)pFrameInfo->content.iePacket.timestamp, TIME_STAMP_LEN)
178981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
179981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
180981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
181981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
182981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt/* Local  functions definitions*/
183981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
184981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidtstatic void update_apsd(siteEntry_t *pSite, mlmeFrameInfo_t *pFrameInfo);
185981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
186981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidtstatic void release_module(siteMgr_t *pSiteMgr, TI_UINT32 initVec);
187981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
188981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidtstatic void updateSiteInfo(siteMgr_t *pSiteMgr, mlmeFrameInfo_t *pFrameInfo, siteEntry_t    *pSite, TI_UINT8 rxChannel);
189981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
190981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidtstatic void updateRates(siteMgr_t *pSiteMgr, siteEntry_t *pSite, mlmeFrameInfo_t *pFrameInfo);
191981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
192981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidtstatic void updateBeaconQosParams(siteMgr_t *pSiteMgr, siteEntry_t *pSite, mlmeFrameInfo_t *pFrameInfo);
193981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
194981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidtstatic void updateProbeQosParams(siteMgr_t *pSiteMgr, siteEntry_t *pSite, mlmeFrameInfo_t *pFrameInfo);
195981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
196981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidtstatic void siteMgr_UpdatHtParams (siteMgr_t *pSiteMgr, siteEntry_t *pSite, mlmeFrameInfo_t *pFrameInfo);
197981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
198981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidtstatic void updateWSCParams(siteMgr_t *pSiteMgr, siteEntry_t *pSite, mlmeFrameInfo_t *pFrameInfo);
199981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
200981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidtstatic void updatePreamble(siteMgr_t *pSiteMgr, siteEntry_t *pSite, mlmeFrameInfo_t *pFrameInfo);
201981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
202981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidtstatic void getPrimarySiteDesc(siteMgr_t *pSiteMgr, OS_802_11_BSSID *pPrimarySiteDesc, TI_BOOL supplyExtendedInfo);
203981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
204981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidtstatic TI_STATUS getPrimaryBssid(siteMgr_t *pSiteMgr, OS_802_11_BSSID_EX *primaryBssid, TI_UINT32 *pLength);
205981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
206981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidtstatic ERate translateRateMaskToValue(siteMgr_t *pSiteMgr, TI_UINT32 rateMask);
207981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
208981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidtstatic void getSupportedRateSet(siteMgr_t *pSiteMgr, TRates *pRatesSet);
209981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
210981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidtstatic TI_STATUS setSupportedRateSet(siteMgr_t *pSiteMgr, TRates *pRatesSet);
211981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
212981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidtstatic void siteMgr_externalConfigurationParametersSet(TI_HANDLE hSiteMgr);
213981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
214981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidtstatic int parseWscMethodFromIE (siteMgr_t *pSiteMgr, dot11_WSC_t *WSCParams, TIWLN_SIMPLE_CONFIG_MODE *pSelectedMethod);
215981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
216981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidtstatic TI_UINT16 incrementTxSessionCount(siteMgr_t *pSiteMgr);
217981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidtstatic void siteMgr_TxPowerAdaptation(TI_HANDLE hSiteMgr, RssiEventDir_e highLowEdge);
218981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidtstatic void siteMgr_TxPowerLowThreshold(TI_HANDLE hSiteMgr, TI_UINT8 *data, TI_UINT8 dataLength);
219981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidtstatic void siteMgr_TxPowerHighThreshold(TI_HANDLE hSiteMgr, TI_UINT8 *data, TI_UINT8 dataLength);
220981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
221981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
222981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt/************************************************************************
223981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt*                        siteMgr_setTemporaryTxPower                    *
224981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt*************************************************************************
225981801b95b81e6d1c7a2085967406e86af0f08fcDmitry ShmidtDESCRIPTION:	This function is used to start the Tx Power Control adjust mechanism
226981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt				in regulatoryDomain.
227981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
228981801b95b81e6d1c7a2085967406e86af0f08fcDmitry ShmidtINPUT:      bActivateTempFix             -   Whether the power should be adjusted
229981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt************************************************************************/
230981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidtvoid siteMgr_setTemporaryTxPower(siteMgr_t* pSiteMgr, TI_BOOL bActivateTempFix)
231981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt{
232981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	paramInfo_t         param;
233981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
234981801b95b81e6d1c7a2085967406e86af0f08fcDmitry ShmidtTRACE0(pSiteMgr->hReport, REPORT_SEVERITY_INFORMATION, "siteMgr_setTemporaryTxPower is =  \n");
235981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
236981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	/* Set the temporary Power Level via the Regulatory Domain*/
237981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	param.paramType = REGULATORY_DOMAIN_TEMPORARY_TX_ATTENUATION_PARAM;
238981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	param.content.bActivateTempPowerFix = bActivateTempFix;
239981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	regulatoryDomain_setParam(pSiteMgr->hRegulatoryDomain,&param);
240981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt}
241981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
242981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt/* Interface functions Implementation */
243981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
244981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
245981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt/*static void UPDATE_RSN_IE (siteMgr_t* pSiteMgr, siteEntry_t   *pSite, dot11_RSN_t *pRsnIe, TI_UINT8 rsnIeLen)
246981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt{
247981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
248981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    if (pRsnIe != NULL) {
249981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            TI_UINT8 length=0, index=0;
250981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            pSite->rsnIeLen = rsnIeLen;
251981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            while ((length < pSite->rsnIeLen) && (index<MAX_RSN_IE)){
252981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                pSite->pRsnIe[index].hdr = pRsnIe->hdr;
253981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                os_memoryCopy(pSiteMgr->hOs, pSite->pRsnIe[index].rsnIeData, pRsnIe->rsnIeData, pRsnIe->hdr[1]);
254981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                length += (pRsnIe->hdr[1] + 2);
255981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                pRsnIe += 1;
256981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                index++;}
257981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        }
258981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        else {pSite->rsnIeLen = 0;}
259981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt}*/
260981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt/************************************************************************
261981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt *                        siteMgr_create                                *
262981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt ************************************************************************
263981801b95b81e6d1c7a2085967406e86af0f08fcDmitry ShmidtDESCRIPTION: Site manager module creation function, called by the config mgr in creation phase
264981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                performs the following:
265981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                -   Allocate the site manager handle
266981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                -   Allocate the desired & mgmt params structure
267981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
268981801b95b81e6d1c7a2085967406e86af0f08fcDmitry ShmidtINPUT:      hOs             -   Handle to OS
269981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
270981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
271981801b95b81e6d1c7a2085967406e86af0f08fcDmitry ShmidtOUTPUT:
272981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
273981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
274981801b95b81e6d1c7a2085967406e86af0f08fcDmitry ShmidtRETURN:     Handle to the site manager module on success, NULL otherwise
275981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt************************************************************************/
276981801b95b81e6d1c7a2085967406e86af0f08fcDmitry ShmidtTI_HANDLE siteMgr_create(TI_HANDLE hOs)
277981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt{
278981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    siteMgr_t       *pSiteMgr;
279981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    TI_UINT32          initVec;
280981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
281981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    initVec = 0;
282981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
283981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    pSiteMgr = os_memoryAlloc(hOs, sizeof(siteMgr_t));
284981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    if (pSiteMgr == NULL)
285981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        return NULL;
286981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
287981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    os_memoryZero(hOs, pSiteMgr, sizeof(siteMgr_t));
288981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
289981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    initVec |= (1 << SITE_MGR_INIT_BIT);
290981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
291981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    pSiteMgr->pDesiredParams = os_memoryAlloc(hOs, sizeof(siteMgrInitParams_t));
292981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    if (pSiteMgr->pDesiredParams == NULL)
293981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    {
294981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        release_module(pSiteMgr, initVec);
295981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        return NULL;
296981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    }
297981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
298981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    initVec |= (1 << DESIRED_PARAMS_INIT_BIT);
299981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
300981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    pSiteMgr->pSitesMgmtParams = os_memoryAlloc(hOs, sizeof(sitesMgmtParams_t));
301981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    if (pSiteMgr->pSitesMgmtParams == NULL)
302981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    {
303981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        release_module(pSiteMgr, initVec);
304981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        return NULL;
305981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    }
306981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
307981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    initVec |= (1 << MGMT_PARAMS_INIT_BIT);
308981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
309981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    pSiteMgr->hOs = hOs;
310981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
311981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    return(pSiteMgr);
312981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt}
313981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
314981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
315981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
316981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt/************************************************************************
317981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt *                        siteMgr_init                                  *
318981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt ************************************************************************
319981801b95b81e6d1c7a2085967406e86af0f08fcDmitry ShmidtDESCRIPTION: Module init function, called by the DrvMain in init phase
320981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                performs the following:
321981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                -   Reset & initiailzes local variables
322981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                -   Init the handles to be used by the module
323981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
324981801b95b81e6d1c7a2085967406e86af0f08fcDmitry ShmidtINPUT:      pStadHandles -  List of handles to be used by the module
325981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
326981801b95b81e6d1c7a2085967406e86af0f08fcDmitry ShmidtOUTPUT:
327981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
328981801b95b81e6d1c7a2085967406e86af0f08fcDmitry ShmidtRETURN:     void
329981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt************************************************************************/
330981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidtvoid siteMgr_init (TStadHandlesList *pStadHandles)
331981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt{
332981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    siteMgr_t *pSiteMgr = (siteMgr_t *)(pStadHandles->hSiteMgr);
333981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
334981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    /* Init handles */
335981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    pSiteMgr->hConn                 = pStadHandles->hConn;
336981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    pSiteMgr->hSmeSm                = pStadHandles->hSme;
337981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    pSiteMgr->hTWD                  = pStadHandles->hTWD;
338981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    pSiteMgr->hCtrlData             = pStadHandles->hCtrlData;
339981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    pSiteMgr->hRxData               = pStadHandles->hRxData;
340981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    pSiteMgr->hTxCtrl               = pStadHandles->hTxCtrl;
341981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    pSiteMgr->hRsn                  = pStadHandles->hRsn;
342981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    pSiteMgr->hAuth                 = pStadHandles->hAuth;
343981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    pSiteMgr->hAssoc                = pStadHandles->hAssoc;
344981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    pSiteMgr->hRegulatoryDomain     = pStadHandles->hRegulatoryDomain;
345981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    pSiteMgr->hMeasurementMgr       = pStadHandles->hMeasurementMgr;
346981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    pSiteMgr->hReport               = pStadHandles->hReport;
347981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    pSiteMgr->hOs                   = pStadHandles->hOs;
348981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    pSiteMgr->hMlmeSm               = pStadHandles->hMlmeSm;
349981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    pSiteMgr->hAssoc                = pStadHandles->hAssoc;
350981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    pSiteMgr->hReport               = pStadHandles->hReport;
351981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    pSiteMgr->hXCCMngr              = pStadHandles->hXCCMngr;
352981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    pSiteMgr->hApConn               = pStadHandles->hAPConnection;
353981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    pSiteMgr->hCurrBss              = pStadHandles->hCurrBss;
354981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    pSiteMgr->hQosMngr              = pStadHandles->hQosMngr;
355981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    pSiteMgr->hPowerMgr             = pStadHandles->hPowerMgr;
356981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    pSiteMgr->hScr                  = pStadHandles->hSCR;
357981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    pSiteMgr->hEvHandler            = pStadHandles->hEvHandler;
358981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    pSiteMgr->hStaCap               = pStadHandles->hStaCap;
359981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt}
360981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
361981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
362981801b95b81e6d1c7a2085967406e86af0f08fcDmitry ShmidtTI_STATUS siteMgr_SetDefaults (TI_HANDLE                hSiteMgr,
363981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                               siteMgrInitParams_t     *pSiteMgrInitParams)
364981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt{
365981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    siteMgr_t       *pSiteMgr = (siteMgr_t *)hSiteMgr;
366981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    TI_UINT32       timestamp;
367981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    ESlotTime       slotTime;
368023547f11f3d7c84ab64acaab9b9e821f8c528e7Dmitry Shmidt    TMacAddr        saBssid;
369981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    TI_STATUS       status;
370981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    RssiSnrTriggerCfg_t tTriggerCfg;
371981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
372981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    pSiteMgr->siteMgrTxPowerCheckTime   = 0;
373981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    pSiteMgr->siteMgrWSCCurrMode        = TIWLN_SIMPLE_CONFIG_OFF;
374981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    pSiteMgr->includeWSCinProbeReq      = pSiteMgrInitParams->includeWSCinProbeReq;
375981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
376981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    /* Init desired parameters */
377981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    os_memoryCopy(pSiteMgr->hOs, pSiteMgr->pDesiredParams, pSiteMgrInitParams, sizeof(siteMgrInitParams_t));
378981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
379981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    /* Init Beacon Filter Desired State */
380981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    pSiteMgr->beaconFilterParams.desiredState = pSiteMgrInitParams->beaconFilterParams.desiredState;
381981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    /* Init Beacon Filter numOfStored parameter */
382981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    pSiteMgr->beaconFilterParams.numOfStored = pSiteMgrInitParams->beaconFilterParams.numOfStored;
383981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
384981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    /* Init management params */
385981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    pSiteMgr->pSitesMgmtParams->dot11A_sitesTables.maxNumOfSites = MAX_SITES_A_BAND;
386981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    siteMgr_resetSiteTable(pSiteMgr,(siteTablesParams_t *)&pSiteMgr->pSitesMgmtParams->dot11A_sitesTables);
387981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    pSiteMgr->pSitesMgmtParams->dot11BG_sitesTables.maxNumOfSites = MAX_SITES_BG_BAND;
388981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    siteMgr_resetSiteTable(pSiteMgr,&pSiteMgr->pSitesMgmtParams->dot11BG_sitesTables);
389981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
390981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    /* calculate random BSSID for usage in IBSS */
391981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    timestamp = os_timeStampMs(pSiteMgr->hOs);
392981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    os_memoryCopy(pSiteMgr->hOs, (void *)&(pSiteMgr->ibssBssid[0]), &timestamp, sizeof(TI_UINT32));
393981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
394981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    timestamp = os_timeStampMs(pSiteMgr->hOs);
395981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    os_memoryCopy(pSiteMgr->hOs, (void *)&(pSiteMgr->ibssBssid[2]), &timestamp, sizeof(TI_UINT32));
396981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
397981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    /* Get the Source MAC address in order to use it for AD-Hoc BSSID, solving Conexant ST issue for WiFi test */
398023547f11f3d7c84ab64acaab9b9e821f8c528e7Dmitry Shmidt    status = ctrlData_getParamBssid(pSiteMgr->hCtrlData, CTRL_DATA_MAC_ADDRESS, saBssid);
399981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    if (status != TI_OK)
400981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    {
401981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        TRACE0(pSiteMgr->hReport, REPORT_SEVERITY_CONSOLE ,"\n ERROR !!! : siteMgr_config - Error in getting MAC address\n" );
402981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        WLAN_OS_REPORT(("\n ERROR !!! : siteMgr_config - Error in getting MAC address\n" ));
403981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        return TI_NOK;
404981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    }
405981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    pSiteMgr->ibssBssid[0] = 0x02;
406023547f11f3d7c84ab64acaab9b9e821f8c528e7Dmitry Shmidt    pSiteMgr->ibssBssid[1] = saBssid[1];
407023547f11f3d7c84ab64acaab9b9e821f8c528e7Dmitry Shmidt    pSiteMgr->ibssBssid[2] = saBssid[2];
408981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
409981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    pSiteMgr->pDesiredParams->siteMgrSupportedBand = RADIO_BAND_DUAL;
410981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
411981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    pSiteMgr->beaconSentCount = 0;
412981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    pSiteMgr->pDesiredParams->siteMgrDesiredAtimWindow = 0;
413981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	pSiteMgr->txSessionCount = MIN_TX_SESSION_COUNT;
414981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
415981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    if(pSiteMgr->pDesiredParams->siteMgrDesiredDot11Mode == DOT11_DUAL_MODE)
416981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    {
417981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt       if(pSiteMgr->pDesiredParams->siteMgrSupportedBand == RADIO_BAND_DUAL)
418981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt       {
419981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt           pSiteMgr->siteMgrOperationalMode = DOT11_G_MODE;
420981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt           pSiteMgr->radioBand = RADIO_BAND_2_4_GHZ;
421981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt           slotTime = pSiteMgr->pDesiredParams->siteMgrDesiredSlotTime;
422981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt           pSiteMgr->pSitesMgmtParams->pCurrentSiteTable = &pSiteMgr->pSitesMgmtParams->dot11BG_sitesTables;
423981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt       }
424981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt       else if(pSiteMgr->pDesiredParams->siteMgrSupportedBand == RADIO_BAND_2_4_GHZ)
425981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt       {
426981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt           pSiteMgr->pDesiredParams->siteMgrDesiredDot11Mode = DOT11_G_MODE;
427981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt           pSiteMgr->siteMgrOperationalMode = DOT11_G_MODE;
428981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt           pSiteMgr->radioBand = RADIO_BAND_2_4_GHZ;
429981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt           slotTime = pSiteMgr->pDesiredParams->siteMgrDesiredSlotTime;
430981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt           pSiteMgr->pSitesMgmtParams->pCurrentSiteTable = &pSiteMgr->pSitesMgmtParams->dot11BG_sitesTables;
431981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt       }
432981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt       else
433981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt       {
434981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt           pSiteMgr->pDesiredParams->siteMgrDesiredDot11Mode = DOT11_A_MODE;
435981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt           pSiteMgr->siteMgrOperationalMode = DOT11_A_MODE;
436981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt           pSiteMgr->radioBand = RADIO_BAND_5_0_GHZ;
437981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt           slotTime = PHY_SLOT_TIME_SHORT;
438981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt           pSiteMgr->pSitesMgmtParams->pCurrentSiteTable = (siteTablesParams_t *)&pSiteMgr->pSitesMgmtParams->dot11A_sitesTables;
439981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt       }
440981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    }
441981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    else if(pSiteMgr->pDesiredParams->siteMgrDesiredDot11Mode == DOT11_G_MODE)
442981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    {
443981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        slotTime = pSiteMgr->pDesiredParams->siteMgrDesiredSlotTime;
444981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        pSiteMgr->radioBand = RADIO_BAND_2_4_GHZ;
445981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        if((pSiteMgr->pDesiredParams->siteMgrSupportedBand == RADIO_BAND_DUAL) ||
446981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt           (pSiteMgr->pDesiredParams->siteMgrSupportedBand == RADIO_BAND_2_4_GHZ))
447981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        {
448981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            pSiteMgr->pSitesMgmtParams->pCurrentSiteTable = &pSiteMgr->pSitesMgmtParams->dot11BG_sitesTables;
449981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            pSiteMgr->siteMgrOperationalMode = pSiteMgr->pDesiredParams->siteMgrDesiredDot11Mode;
450981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
451981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        }
452981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        else
453981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        {   TRACE0(pSiteMgr->hReport, REPORT_SEVERITY_CONSOLE ,"\nERROR !!!.....The radio doesn't support the desired dot11 mode !!! \n");
454981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            WLAN_OS_REPORT(("\nERROR !!!.....The radio doesn't support the desired dot11 mode !!! \n"));
455981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            return TI_NOK;
456981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        }
457981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    }
458981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    else if(pSiteMgr->pDesiredParams->siteMgrDesiredDot11Mode == DOT11_B_MODE)
459981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    {
460981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        slotTime = PHY_SLOT_TIME_LONG;
461981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        pSiteMgr->radioBand = RADIO_BAND_2_4_GHZ;
462981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        if((pSiteMgr->pDesiredParams->siteMgrSupportedBand == RADIO_BAND_DUAL) ||
463981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt           (pSiteMgr->pDesiredParams->siteMgrSupportedBand == RADIO_BAND_2_4_GHZ))
464981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        {
465981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            pSiteMgr->pSitesMgmtParams->pCurrentSiteTable = &pSiteMgr->pSitesMgmtParams->dot11BG_sitesTables;
466981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            pSiteMgr->siteMgrOperationalMode = pSiteMgr->pDesiredParams->siteMgrDesiredDot11Mode;
467981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        }
468981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        else
469981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        {
470981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            TRACE0(pSiteMgr->hReport, REPORT_SEVERITY_CONSOLE ,"\nERROR !!!.....The radio doesn't support the desired dot11 mode !!! \n");
471981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            WLAN_OS_REPORT(("\nERROR !!!.....The radio doesn't support the desired dot11 mode !!! \n"));
472981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            return TI_NOK;
473981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        }
474981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    }
475981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    else
476981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    {
477981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        slotTime = PHY_SLOT_TIME_SHORT;
478981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        pSiteMgr->radioBand = RADIO_BAND_5_0_GHZ;
479981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        if((pSiteMgr->pDesiredParams->siteMgrSupportedBand == RADIO_BAND_DUAL) ||
480981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt           (pSiteMgr->pDesiredParams->siteMgrSupportedBand == RADIO_BAND_5_0_GHZ))
481981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        {
482981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            pSiteMgr->siteMgrOperationalMode = pSiteMgr->pDesiredParams->siteMgrDesiredDot11Mode;
483981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            pSiteMgr->pSitesMgmtParams->pCurrentSiteTable = (siteTablesParams_t *)&pSiteMgr->pSitesMgmtParams->dot11A_sitesTables;
484981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        }
485981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        else
486981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        {
487981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            TRACE0(pSiteMgr->hReport, REPORT_SEVERITY_CONSOLE ,"\nERROR !!!.....The radio doesn't support the desired dot11 mode !!! \n");
488981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            WLAN_OS_REPORT(("\nERROR !!!.....The radio doesn't support the desired dot11 mode !!! \n"));
489981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            return TI_NOK;
490981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        }
491981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    }
492981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
493981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    /* Configure hal with common core-hal parameters */
494981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    TWD_SetRadioBand(pSiteMgr->hTWD, pSiteMgr->radioBand);
495981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    TWD_CfgSlotTime (pSiteMgr->hTWD, slotTime);
496981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    siteMgr_ConfigRate(hSiteMgr);
497981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
498981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    TRACE2(pSiteMgr->hReport, REPORT_SEVERITY_INIT, " SiteMgr - numOfElements = %d IETableSize = %d\n" , pSiteMgrInitParams->beaconFilterParams.numOfElements, pSiteMgrInitParams->beaconFilterParams.IETableSize);
499981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    /* Send the table regardless to the state */
500981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    TWD_CfgBeaconFilterTable (pSiteMgr->hTWD,
501981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                              pSiteMgrInitParams->beaconFilterParams.numOfElements,
502981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                              pSiteMgrInitParams->beaconFilterParams.IETable,
503981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                              pSiteMgrInitParams->beaconFilterParams.IETableSize);
504981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
505981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    /*  At start-up Set the Beacon Filter state as the User required */
506981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    TWD_CfgBeaconFilterOpt (pSiteMgr->hTWD, pSiteMgrInitParams->beaconFilterParams.desiredState, pSiteMgr->beaconFilterParams.numOfStored);
507981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
508981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    pSiteMgr->pSitesMgmtParams->pPrevPrimarySite = NULL;
509981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
510981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    /* Clears the ProbeReqWSC IE */
511981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    os_memoryZero(pSiteMgr->hOs,&pSiteMgr->siteMgrWSCProbeReqParams,sizeof(DOT11_WSC_PROBE_REQ_MAX_LENGTH));
512981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
513653850f71f9caaa41af19cadbab24bb5e655daf4Dmitry Shmidt    /* Register the RSSI Trigger events at the currBss RSSI/SNR static table*/
514653850f71f9caaa41af19cadbab24bb5e655daf4Dmitry Shmidt    currBSS_RegisterTriggerEvent(pSiteMgr->hCurrBss, TWD_OWN_EVENT_RSSI_SNR_TRIGGER_2, (TI_UINT8)0,(void*)siteMgr_TxPowerHighThreshold,hSiteMgr);
515653850f71f9caaa41af19cadbab24bb5e655daf4Dmitry Shmidt    currBSS_RegisterTriggerEvent(pSiteMgr->hCurrBss, TWD_OWN_EVENT_RSSI_SNR_TRIGGER_3, (TI_UINT8)0,(void*)siteMgr_TxPowerLowThreshold, hSiteMgr);
516981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
517981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    tTriggerCfg.index     = TRIGGER_EVENT_HIGH_TX_PW;
518981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    tTriggerCfg.threshold = (0 - pSiteMgr->pDesiredParams->TxPowerRssiThresh);
519981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    tTriggerCfg.pacing    = TRIGGER_HIGH_TX_PW_PACING;
520981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    tTriggerCfg.metric    = METRIC_EVENT_RSSI_DATA;
521981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    tTriggerCfg.type      = RX_QUALITY_EVENT_EDGE;
522981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    tTriggerCfg.direction = RSSI_EVENT_DIR_HIGH;
523981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    tTriggerCfg.hystersis = TRIGGER_HIGH_TX_PW_HYSTERESIS;
524981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    tTriggerCfg.enable     = TI_TRUE;
525981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    TWD_CfgRssiSnrTrigger (pSiteMgr->hTWD, &tTriggerCfg);
526981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
527981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    tTriggerCfg.index     = TRIGGER_EVENT_LOW_TX_PW;
528981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    tTriggerCfg.threshold = (0 - pSiteMgr->pDesiredParams->TxPowerRssiRestoreThresh);
529981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    tTriggerCfg.pacing    = TRIGGER_LOW_TX_PW_PACING;
530981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    tTriggerCfg.metric    = METRIC_EVENT_RSSI_DATA;
531981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    tTriggerCfg.type      = RX_QUALITY_EVENT_EDGE;
532981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    tTriggerCfg.direction = RSSI_EVENT_DIR_LOW;
533981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    tTriggerCfg.hystersis = TRIGGER_LOW_TX_PW_HYSTERESIS;
534981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    tTriggerCfg.enable    = TI_TRUE;
535981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    TWD_CfgRssiSnrTrigger (pSiteMgr->hTWD, &tTriggerCfg);
536981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
537981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    TRACE0(pSiteMgr->hReport, REPORT_SEVERITY_INIT, ".....Site manager configured successfully\n");
538981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
539981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    return TI_OK;
540981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt}
541981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
542981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
543981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt/************************************************************************
544981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt *                        siteMgr_unLoad                                    *
545981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt ************************************************************************
546981801b95b81e6d1c7a2085967406e86af0f08fcDmitry ShmidtDESCRIPTION: site manager module unload function, called by the config mgr in the unlod phase
547981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                performs the following:
548981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                -   Free all memory aloocated by the module
549981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
550981801b95b81e6d1c7a2085967406e86af0f08fcDmitry ShmidtINPUT:      hSiteMgr    -   site mgr handle.
551981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
552981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
553981801b95b81e6d1c7a2085967406e86af0f08fcDmitry ShmidtOUTPUT:
554981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
555981801b95b81e6d1c7a2085967406e86af0f08fcDmitry ShmidtRETURN:     TI_OK on success, TI_NOK otherwise
556981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
557981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt************************************************************************/
558981801b95b81e6d1c7a2085967406e86af0f08fcDmitry ShmidtTI_STATUS siteMgr_unLoad(TI_HANDLE hSiteMgr)
559981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt{
560981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    TI_UINT32          initVec;
561981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    siteMgr_t       *pSiteMgr = (siteMgr_t *)hSiteMgr;
562981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
563981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    if (!pSiteMgr)
564981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        return TI_OK;
565981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
566981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    initVec = 0xFFFF;
567981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    release_module(pSiteMgr, initVec);
568981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
569981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    return TI_OK;
570981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt}
571981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
572981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt/***********************************************************************
573981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt *                        siteMgr_setParam
574981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt ***********************************************************************
575981801b95b81e6d1c7a2085967406e86af0f08fcDmitry ShmidtDESCRIPTION: site mgr set param function, called by the following:
576981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                -   config mgr in order to set a parameter from the OS abstraction layer.
577981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                In this fuction, the site manager OS abstraction layer configures the site manager to the desired params.
578981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                Sometimes it requires a re scan, depending in the parameter type
579981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
580981801b95b81e6d1c7a2085967406e86af0f08fcDmitry ShmidtINPUT:      hSiteMgr    -   Connection handle.
581981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            pParam  -   Pointer to the parameter
582981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
583981801b95b81e6d1c7a2085967406e86af0f08fcDmitry ShmidtOUTPUT:
584981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
585981801b95b81e6d1c7a2085967406e86af0f08fcDmitry ShmidtRETURN:     TI_OK on success, TI_NOK on failure
586981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
587981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt************************************************************************/
588981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
589981801b95b81e6d1c7a2085967406e86af0f08fcDmitry ShmidtTI_STATUS siteMgr_setParam(TI_HANDLE        hSiteMgr,
590981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                        paramInfo_t     *pParam)
591981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt{
592981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    siteMgr_t *pSiteMgr = (siteMgr_t *)hSiteMgr;
593981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    siteEntry_t *pPrimarySite = pSiteMgr->pSitesMgmtParams->pPrimarySite;
594981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    OS_802_11_CONFIGURATION *pConfig;
595981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    TI_UINT32      channel;
596981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    ESlotTime  slotTime;
597981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    paramInfo_t	param;
598981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
599981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    switch(pParam->paramType)
600981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    {
601981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    case SITE_MGR_CONFIGURATION_PARAM:
602981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        pConfig = pParam->content.pSiteMgrConfiguration;
603981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
604981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt/*      for(channel = 0; channel < SITE_MGR_CHANNEL_MAX+1; channel++)
605981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        {
606981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            if(pConfig->channel == pSiteMgr->pDesiredParams->siteMgrFreq2ChannelTable[channel])
607981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                break;
608981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        }*/
609981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
610981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        channel = Freq2Chan(pConfig->Union.channel);
611981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
612981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        if(channel == 0 || channel > SITE_MGR_CHANNEL_MAX)
613981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            return PARAM_VALUE_NOT_VALID;
614981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        else
615981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            pConfig->Union.channel = channel;
616981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
617981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        if((pSiteMgr->pDesiredParams->siteMgrDesiredChannel != pConfig->Union.channel) ||
618981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt           (pSiteMgr->pDesiredParams->siteMgrDesiredAtimWindow != pConfig->ATIMWindow))
619981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        {
620981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            pSiteMgr->pDesiredParams->siteMgrDesiredChannel = (TI_UINT8)pConfig->Union.channel;
621981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            pSiteMgr->pDesiredParams->siteMgrDesiredBeaconInterval = (TI_UINT16)pConfig->BeaconPeriod;
622981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            pSiteMgr->pDesiredParams->siteMgrDesiredAtimWindow = pConfig->ATIMWindow;
623981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        }
624981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
625981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        return TI_OK;
626981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
627981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    case SITE_MGR_DESIRED_CHANNEL_PARAM:
628981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        if (pParam->content.siteMgrDesiredChannel > SITE_MGR_CHANNEL_MAX)
629981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            return PARAM_VALUE_NOT_VALID;
630981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
631981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        if (pSiteMgr->pDesiredParams->siteMgrDesiredChannel != pParam->content.siteMgrDesiredChannel)
632981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            pSiteMgr->pDesiredParams->siteMgrDesiredChannel = (TI_UINT8)pParam->content.siteMgrDesiredChannel;
633981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        return TI_OK;
634981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
635981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    case SITE_MGR_DESIRED_BSSID_PARAM:
636981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            MAC_COPY (pSiteMgr->pDesiredParams->siteMgrDesiredBSSID, pParam->content.siteMgrDesiredBSSID);
637981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt           return TI_OK;
638981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
639981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    case SITE_MGR_DESIRED_SSID_PARAM:
640981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
641981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        TRACE1(pSiteMgr->hReport, REPORT_SEVERITY_INFORMATION, "\nSet new SSID= (len=%d)  \n", pParam->content.siteMgrDesiredSSID.len);
642981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
643981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        if (pParam->content.siteMgrDesiredSSID.len > MAX_SSID_LEN)
644981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            return PARAM_VALUE_NOT_VALID;
645981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
646981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        os_memoryCopy(pSiteMgr->hOs, &pSiteMgr->pDesiredParams->siteMgrDesiredSSID, &pParam->content.siteMgrDesiredSSID, sizeof(TSsid));
647653850f71f9caaa41af19cadbab24bb5e655daf4Dmitry Shmidt        /* 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
648653850f71f9caaa41af19cadbab24bb5e655daf4Dmitry Shmidt        */
649981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        if ( MAX_SSID_LEN > pSiteMgr->pDesiredParams->siteMgrDesiredSSID.len )
650981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        {
651981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            pSiteMgr->pDesiredParams->siteMgrDesiredSSID.str[pSiteMgr->pDesiredParams->siteMgrDesiredSSID.len] = '\0';
652981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        }
653981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
654981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        /* increase the random IBSS BSSID calculated during init */
655981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt		pSiteMgr->ibssBssid[MAC_ADDR_LEN - 1] ++;
656981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
657981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        if (OS_802_11_SSID_JUNK (pSiteMgr->pDesiredParams->siteMgrDesiredSSID.str, pSiteMgr->pDesiredParams->siteMgrDesiredSSID.len))
658981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        {
659981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            rsn_removedDefKeys(pSiteMgr->hRsn);
660981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        }
661981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
662981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        /* due to the fact we call to SME_DESIRED_SSID_ACT_PARAM also we not need to call sme_Restart */
663981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        return TI_OK;
664981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
665981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    case SITE_MGR_DESIRED_BSS_TYPE_PARAM:
666981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
667981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt         TRACE1(pSiteMgr->hReport, REPORT_SEVERITY_INFORMATION, "\nSet BssType = %d\n", pParam->content.siteMgrDesiredBSSType);
668981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        if (pParam->content.siteMgrDesiredBSSType > BSS_ANY)
669981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            return PARAM_VALUE_NOT_VALID;
670981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
671981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        if (pSiteMgr->pDesiredParams->siteMgrDesiredBSSType != pParam->content.siteMgrDesiredBSSType)
672981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        {
673981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            pSiteMgr->pDesiredParams->siteMgrDesiredBSSType = pParam->content.siteMgrDesiredBSSType;
674981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
675981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt			/* If the new BSS type is NOT Ad_Hoc, We make sure that the rate masks are set to G */
676981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt			 if(pSiteMgr->pDesiredParams->siteMgrDesiredBSSType != BSS_INDEPENDENT)
677981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
678981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            {
679981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt				 pSiteMgr->siteMgrOperationalMode = DOT11_G_MODE;
680981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                 siteMgr_ConfigRate(pSiteMgr);
681981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            }
682981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
683981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            /* If the new BSS type is Ad_Hoc, increase the random BSSID calculated during init */
684981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            if(pSiteMgr->pDesiredParams->siteMgrDesiredBSSType == BSS_INDEPENDENT)
685981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            {
686981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                pSiteMgr->ibssBssid[MAC_ADDR_LEN - 1] ++;
687981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            }
688981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
689981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            /* go to B_ONLY Mode only if WiFI bit is Set*/
690981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            if (pSiteMgr->pDesiredParams->siteMgrWiFiAdhoc == TI_TRUE)
691981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            {   /* Configuration For AdHoc when using external configuration */
692981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                if(pSiteMgr->pDesiredParams->siteMgrExternalConfiguration == TI_FALSE)
693981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                {
694981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                    siteMgr_externalConfigurationParametersSet(hSiteMgr);
695981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                }
696981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            }
697981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        }
698981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
699981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        return TI_OK;
700981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
701981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    case SITE_MGR_SIMPLE_CONFIG_MODE: /* Setting the WiFiSimpleConfig mode */
702981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
703981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt		/* Modify the current mode */
704981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt		pSiteMgr->siteMgrWSCCurrMode = pParam->content.siteMgrWSCMode.WSCMode;
705981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
706981801b95b81e6d1c7a2085967406e86af0f08fcDmitry ShmidtTRACE1(pSiteMgr->hReport, REPORT_SEVERITY_INFORMATION, "Setting SimpleConfig Mode to %d\n", pSiteMgr->siteMgrWSCCurrMode);
707981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
708981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt		/* In case the WSC is on ,the ProbeReq WSC IE need to be updated */
709981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
710981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt		if(pSiteMgr->siteMgrWSCCurrMode != TIWLN_SIMPLE_CONFIG_OFF)
711981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt		{
712981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt			os_memoryCopy(pSiteMgr->hOs, &pSiteMgr->siteMgrWSCProbeReqParams, &pParam->content.siteMgrWSCMode.probeReqWSCIE, DOT11_WSC_PROBE_REQ_MAX_LENGTH);
713981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
714981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt			param.paramType = RSN_WPA_PROMOTE_OPTIONS;
715981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt           	param.content.rsnWPAPromoteFlags = ADMCTRL_WPA_OPTION_ENABLE_PROMOTE_AUTH_MODE;
716981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt           	rsn_setParam(pSiteMgr->hRsn, &param);
717981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
718981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            /* update the SME on the WPS mode */
719981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            param.paramType = SME_WSC_PB_MODE_PARAM;
720981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            sme_SetParam (pSiteMgr->hSmeSm, &param);
721981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt		}
722981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt		else
723981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt		{
724981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt			param.paramType = RSN_WPA_PROMOTE_OPTIONS;
725981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt           	param.content.rsnWPAPromoteFlags = ADMCTRL_WPA_OPTION_NONE;
726981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt           	rsn_setParam(pSiteMgr->hRsn, &param);
727981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt		}
728981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
729981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        return TI_OK;
730981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
731981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    case SITE_MGR_DESIRED_MODULATION_TYPE_PARAM:
732981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        if ((pParam->content.siteMgrDesiredModulationType < DRV_MODULATION_CCK) ||
733981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            (pParam->content.siteMgrDesiredModulationType > DRV_MODULATION_OFDM))
734981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            return PARAM_VALUE_NOT_VALID;
735981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
736981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        if (pSiteMgr->pDesiredParams->siteMgrDesiredModulationType != pParam->content.siteMgrDesiredModulationType)
737981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        {
738981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            pSiteMgr->pDesiredParams->siteMgrDesiredModulationType = pParam->content.siteMgrDesiredModulationType;
739981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            /* means that we are moving from non-pbcc network to pbcc */
740981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            if (pParam->content.siteMgrDesiredModulationType == DRV_MODULATION_PBCC)
741981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                sme_Restart (pSiteMgr->hSmeSm);
742981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            return TI_OK;
743981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        }
744981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        return TI_OK;
745981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
746981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    case SITE_MGR_BEACON_RECV:
747981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        if (!pPrimarySite)
748981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        {
749981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            return NO_SITE_SELECTED_YET;
750981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        }
751981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        pPrimarySite->beaconRecv = pParam->content.siteMgrBeaconRecv;
752981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        return TI_OK;
753981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
754981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
755981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    case SITE_MGR_DESIRED_BEACON_INTERVAL_PARAM:
756981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        if (pParam->content.siteMgrDesiredBeaconInterval < SITE_MGR_BEACON_INTERVAL_MIN)
757981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            return PARAM_VALUE_NOT_VALID;
758981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
759981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        if (pSiteMgr->pDesiredParams->siteMgrDesiredBeaconInterval != pParam->content.siteMgrDesiredBeaconInterval)
760981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            pSiteMgr->pDesiredParams->siteMgrDesiredBeaconInterval = pParam->content.siteMgrDesiredBeaconInterval;
761981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        return TI_OK;
762981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
763981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    case SITE_MGR_DESIRED_PREAMBLE_TYPE_PARAM:
764981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        if ((pParam->content.siteMgrDesiredPreambleType != PREAMBLE_LONG) &&
765981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            (pParam->content.siteMgrDesiredPreambleType != PREAMBLE_SHORT))
766981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            return PARAM_VALUE_NOT_VALID;
767981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
768981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        if (pSiteMgr->pDesiredParams->siteMgrDesiredPreambleType != pParam->content.siteMgrDesiredPreambleType)
769981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        {
770981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            pSiteMgr->pDesiredParams->siteMgrDesiredPreambleType = pParam->content.siteMgrDesiredPreambleType;
771981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        }
772981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        return TI_OK;
773981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
774981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    case SITE_MGR_DESIRED_SUPPORTED_RATE_SET_PARAM:
775981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        return setSupportedRateSet(pSiteMgr, &(pParam->content.siteMgrDesiredSupportedRateSet));
776981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
777981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    case SITE_MGR_DESIRED_DOT11_MODE_PARAM:
778981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        if(pParam->content.siteMgrDot11Mode > DOT11_MAX_MODE)
779981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            return PARAM_VALUE_NOT_VALID;
780981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
781981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        if(pSiteMgr->pDesiredParams->siteMgrDesiredDot11Mode != pParam->content.siteMgrDot11Mode)
782981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        {
783981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            pSiteMgr->pDesiredParams->siteMgrDesiredDot11Mode = pParam->content.siteMgrDot11Mode;
784981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
785981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            /* since the dot11ABAmode changed, the STA operational mode should be changed */
786981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            if(pSiteMgr->pDesiredParams->siteMgrDesiredDot11Mode == DOT11_DUAL_MODE)
787981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            {
788981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                if(pSiteMgr->pDesiredParams->siteMgrSupportedBand == RADIO_BAND_DUAL)
789981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                {
790981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                    pSiteMgr->siteMgrOperationalMode = DOT11_G_MODE;
791981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                }
792981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                else if(pSiteMgr->pDesiredParams->siteMgrSupportedBand == RADIO_BAND_2_4_GHZ)
793981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                {
794981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                    pSiteMgr->pDesiredParams->siteMgrDesiredDot11Mode = DOT11_G_MODE;
795981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                    pSiteMgr->siteMgrOperationalMode = DOT11_G_MODE;
796981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                }
797981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                else
798981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                {
799981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                    pSiteMgr->pDesiredParams->siteMgrDesiredDot11Mode = DOT11_G_MODE;
800981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                    pSiteMgr->siteMgrOperationalMode = DOT11_A_MODE;
801981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                }
802981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
803981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            }
804981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            else
805981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                pSiteMgr->siteMgrOperationalMode = pSiteMgr->pDesiredParams->siteMgrDesiredDot11Mode;
806981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
807981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            /* configure HAL with new parameters update rates and select site table */
808981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            pSiteMgr->prevRadioBand = pSiteMgr->radioBand;
809981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            if(pSiteMgr->siteMgrOperationalMode == DOT11_A_MODE)
810981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            {
811981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                pSiteMgr->pSitesMgmtParams->pCurrentSiteTable = (siteTablesParams_t *)&pSiteMgr->pSitesMgmtParams->dot11A_sitesTables;
812981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                pSiteMgr->radioBand = RADIO_BAND_5_0_GHZ;
813981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                slotTime = PHY_SLOT_TIME_SHORT;
814981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            }
815981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            else if(pSiteMgr->siteMgrOperationalMode == DOT11_G_MODE)
816981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            {
817981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                pSiteMgr->pSitesMgmtParams->pCurrentSiteTable = &pSiteMgr->pSitesMgmtParams->dot11BG_sitesTables;
818981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                pSiteMgr->radioBand = RADIO_BAND_2_4_GHZ;
819981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                slotTime = pSiteMgr->pDesiredParams->siteMgrDesiredSlotTime;
820981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            }
821981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            else
822981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            {
823981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                pSiteMgr->pSitesMgmtParams->pCurrentSiteTable = &pSiteMgr->pSitesMgmtParams->dot11BG_sitesTables;
824981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                pSiteMgr->radioBand = RADIO_BAND_2_4_GHZ;
825981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                slotTime = PHY_SLOT_TIME_LONG;
826981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            }
827981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
828981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            if(pSiteMgr->prevRadioBand != pSiteMgr->radioBand)
829981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                siteMgr_bandParamsConfig(pSiteMgr, TI_TRUE);
830981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
831981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            /* Configure TWD */
832981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            TWD_SetRadioBand(pSiteMgr->hTWD, pSiteMgr->radioBand);
833981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            TWD_CfgSlotTime (pSiteMgr->hTWD, slotTime);
834981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
835981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            /* If the BSS type is Ad_Hoc, increase the random BSSID calculated during init */
836981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            if(pSiteMgr->pDesiredParams->siteMgrDesiredBSSType == BSS_INDEPENDENT)
837981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            {
838981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                pSiteMgr->ibssBssid[MAC_ADDR_LEN - 1] ++;
839981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            }
840981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
841981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            /*siteMgr_resetAllSiteTables(pSiteMgr); */
842981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            sme_Restart (pSiteMgr->hSmeSm);
843981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        }
844981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        return TI_OK;
845981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
846981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    case SITE_MGR_OPERATIONAL_MODE_PARAM:
847981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
848981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        if(pParam->content.siteMgrDot11OperationalMode < DOT11_B_MODE ||
849981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            pParam->content.siteMgrDot11OperationalMode > DOT11_G_MODE )
850981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            return PARAM_VALUE_NOT_VALID;
851981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
852981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        pSiteMgr->siteMgrOperationalMode = pParam->content.siteMgrDot11OperationalMode;
853981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        break;
854981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
855981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
856981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    case SITE_MGR_RADIO_BAND_PARAM:
857981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        if((TI_INT8)pParam->content.siteMgrRadioBand < RADIO_BAND_2_4_GHZ ||
858981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt           (TI_INT8)pParam->content.siteMgrRadioBand > RADIO_BAND_DUAL )
859981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            return PARAM_VALUE_NOT_VALID;
860981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
861981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        pSiteMgr->prevRadioBand = pSiteMgr->radioBand;
862981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        pSiteMgr->radioBand = pParam->content.siteMgrRadioBand;
863981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        if(pSiteMgr->prevRadioBand != pSiteMgr->radioBand)
864981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            siteMgr_bandParamsConfig(pSiteMgr, TI_FALSE);
865981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
866981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        break;
867981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
868981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    case SITE_MGR_DESIRED_SLOT_TIME_PARAM:
869981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        if(pParam->content.siteMgrSlotTime != PHY_SLOT_TIME_LONG &&
870981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt           pParam->content.siteMgrSlotTime != PHY_SLOT_TIME_SHORT)
871981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            return PARAM_VALUE_NOT_VALID;
872981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
873981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        if (pSiteMgr->pDesiredParams->siteMgrDesiredSlotTime != pParam->content.siteMgrSlotTime)
874981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        {
875981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            if (pSiteMgr->siteMgrOperationalMode == DOT11_G_MODE)
876981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            {
877981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                pSiteMgr->pDesiredParams->siteMgrDesiredSlotTime = pParam->content.siteMgrSlotTime;
878981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                if (!pPrimarySite)
879981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                    TWD_CfgSlotTime (pSiteMgr->hTWD, pSiteMgr->pDesiredParams->siteMgrDesiredSlotTime);
880981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                else if (pPrimarySite->bssType != BSS_INFRASTRUCTURE)
881981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                    TWD_CfgSlotTime (pSiteMgr->hTWD, pSiteMgr->pDesiredParams->siteMgrDesiredSlotTime);
882981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            }
883981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
884981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        }
885981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        return TI_OK;
886981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
887981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    case SITE_MGR_BEACON_FILTER_DESIRED_STATE_PARAM:
888981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        {
889981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            /* Check if the Desired  mode has changed - If not no need to send the MIB to the FW */
890981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            if (pSiteMgr->beaconFilterParams.desiredState == pParam->content.siteMgrDesiredBeaconFilterState)
891981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            {
892981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                TRACE0(pSiteMgr->hReport, REPORT_SEVERITY_INFORMATION, "Beacon Filter already \n");
893981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                break;
894981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            }
895981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
896981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            /* Set the New Desired User request of Beacon Filter */
897981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            pSiteMgr->beaconFilterParams.desiredState = pParam->content.siteMgrDesiredBeaconFilterState;
898981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
899981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            TRACE0(pSiteMgr->hReport, REPORT_SEVERITY_INFORMATION, "New Beacon Filter State is: \n");
900981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
901981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            /* Send the User required Beacon Filter Configuration to the FW */
902981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            TWD_CfgBeaconFilterOpt (pSiteMgr->hTWD, pSiteMgr->beaconFilterParams.desiredState, pSiteMgr->beaconFilterParams.numOfStored);
903981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        }
904981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
905981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        break;
906981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
907981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    case SITE_MGR_LAST_RX_RATE_PARAM:
908981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        if (pPrimarySite != NULL)
909981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        {
910981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            pPrimarySite->rxRate = pParam->content.ctrlDataCurrentBasicRate;
911981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        }
912981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        break;
913981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
914981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    case SITE_MGR_CURRENT_CHANNEL_PARAM:
915981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        if (!pPrimarySite)
916981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        {
917981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            return NO_SITE_SELECTED_YET;
918981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        }
919981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        pPrimarySite->channel = pParam->content.siteMgrCurrentChannel;
920981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        break;
921981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
922981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    case SITE_MGR_CURRENT_SIGNAL_PARAM:
923981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        if (!pPrimarySite)
924981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        {
925981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            return NO_SITE_SELECTED_YET;
926981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        }
927981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
928981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        pPrimarySite->rssi = pParam->content.siteMgrCurrentSignal.rssi;
929981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        break;
930981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
931653850f71f9caaa41af19cadbab24bb5e655daf4Dmitry Shmidt    case SITE_MGRT_SET_RATE_MANAGMENT:
932653850f71f9caaa41af19cadbab24bb5e655daf4Dmitry Shmidt        TWD_SetRateMngDebug(pSiteMgr->hTWD,&pParam ->content.RateMng);
933653850f71f9caaa41af19cadbab24bb5e655daf4Dmitry Shmidt        break;
934653850f71f9caaa41af19cadbab24bb5e655daf4Dmitry Shmidt
935981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    default:
936981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        TRACE1(pSiteMgr->hReport, REPORT_SEVERITY_ERROR, "Set param, Params is not supported, %d\n", pParam->paramType);
937981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        return PARAM_NOT_SUPPORTED;
938981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    }
939981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
940981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    return TI_OK;
941981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt}
942981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
943023547f11f3d7c84ab64acaab9b9e821f8c528e7Dmitry ShmidtTI_STATUS siteMgr_getParamWSC(TI_HANDLE hSiteMgr, TIWLN_SIMPLE_CONFIG_MODE *wscParam)
944023547f11f3d7c84ab64acaab9b9e821f8c528e7Dmitry Shmidt{ /* SITE_MGR_SIMPLE_CONFIG_MODE: - Retrieving the WiFiSimpleConfig mode */
945023547f11f3d7c84ab64acaab9b9e821f8c528e7Dmitry Shmidt    siteMgr_t       *pSiteMgr = (siteMgr_t *)hSiteMgr;
946023547f11f3d7c84ab64acaab9b9e821f8c528e7Dmitry Shmidt
947023547f11f3d7c84ab64acaab9b9e821f8c528e7Dmitry Shmidt	if (pSiteMgr == NULL)
948023547f11f3d7c84ab64acaab9b9e821f8c528e7Dmitry Shmidt	{
949023547f11f3d7c84ab64acaab9b9e821f8c528e7Dmitry Shmidt		return TI_NOK;
950023547f11f3d7c84ab64acaab9b9e821f8c528e7Dmitry Shmidt	}
951023547f11f3d7c84ab64acaab9b9e821f8c528e7Dmitry Shmidt
952023547f11f3d7c84ab64acaab9b9e821f8c528e7Dmitry Shmidt    *wscParam = pSiteMgr->siteMgrWSCCurrMode;
953023547f11f3d7c84ab64acaab9b9e821f8c528e7Dmitry Shmidt    return TI_OK;
954023547f11f3d7c84ab64acaab9b9e821f8c528e7Dmitry Shmidt}
955023547f11f3d7c84ab64acaab9b9e821f8c528e7Dmitry Shmidt
956981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt/***********************************************************************
957981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt *                        siteMgr_getParam
958981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt ***********************************************************************
959981801b95b81e6d1c7a2085967406e86af0f08fcDmitry ShmidtDESCRIPTION: Site mgr get param function, called by the following:
960981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            -   config mgr in order to get a parameter from the OS abstraction layer.
961981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            -   From inside the dirver
962981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
963981801b95b81e6d1c7a2085967406e86af0f08fcDmitry ShmidtINPUT:      hSiteMgr    -   site mgr handle.
964981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            pParam  -   Pointer to the parameter
965981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
966981801b95b81e6d1c7a2085967406e86af0f08fcDmitry ShmidtOUTPUT:
967981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
968981801b95b81e6d1c7a2085967406e86af0f08fcDmitry ShmidtRETURN:     TI_OK on success, TI_NOK otherwise
969981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
970981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt************************************************************************/
971981801b95b81e6d1c7a2085967406e86af0f08fcDmitry ShmidtTI_STATUS siteMgr_getParam(TI_HANDLE        hSiteMgr,
972653850f71f9caaa41af19cadbab24bb5e655daf4Dmitry Shmidt                            paramInfo_t     *pParam)
973981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt{
974981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    siteMgr_t       *pSiteMgr = (siteMgr_t *)hSiteMgr;
975981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    siteEntry_t     *pPrimarySite = pSiteMgr->pSitesMgmtParams->pPrimarySite;
976981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    TI_STATUS       status = TI_OK;
977981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    TI_UINT8           siteEntryIndex;
978981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    TTwdParamInfo   tTwdParam;
979981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
980653850f71f9caaa41af19cadbab24bb5e655daf4Dmitry Shmidt	if(pSiteMgr == NULL)
981653850f71f9caaa41af19cadbab24bb5e655daf4Dmitry Shmidt	{
982653850f71f9caaa41af19cadbab24bb5e655daf4Dmitry Shmidt		return TI_NOK;
983653850f71f9caaa41af19cadbab24bb5e655daf4Dmitry Shmidt	}
984653850f71f9caaa41af19cadbab24bb5e655daf4Dmitry Shmidt
985981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    switch(pParam->paramType)
986981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    {
987981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
988981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    case SITE_MGR_CONFIGURATION_PARAM:
989981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        pParam->content.pSiteMgrConfiguration->Length = sizeof(OS_802_11_CONFIGURATION);
990981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        pParam->content.pSiteMgrConfiguration->ATIMWindow = pSiteMgr->pDesiredParams->siteMgrDesiredAtimWindow;
991981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        pParam->content.pSiteMgrConfiguration->BeaconPeriod = pSiteMgr->pDesiredParams->siteMgrDesiredBeaconInterval;
992981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        pParam->content.pSiteMgrConfiguration->Union.channel =
993981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            Chan2Freq(pSiteMgr->pDesiredParams->siteMgrDesiredChannel);
994981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            /*pSiteMgr->pDesiredParams->siteMgrFreq2ChannelTable[pSiteMgr->pDesiredParams->siteMgrDesiredChannel];*/
995981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        break;
996981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
997981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    case SITE_MGR_DESIRED_CHANNEL_PARAM:
998981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        pParam->content.siteMgrDesiredChannel = pSiteMgr->pDesiredParams->siteMgrDesiredChannel;
999981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        break;
1000981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
1001981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	case SITE_MGR_SIMPLE_CONFIG_MODE: /* Retrieving the WiFiSimpleConfig mode */
1002981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt		pParam->content.siteMgrWSCMode.WSCMode = pSiteMgr->siteMgrWSCCurrMode;
1003981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
1004023547f11f3d7c84ab64acaab9b9e821f8c528e7Dmitry Shmidt        TRACE1(pSiteMgr->hReport, REPORT_SEVERITY_INFORMATION, "Retrieving the SimpleConfig Mode (%d) \n", pSiteMgr->siteMgrWSCCurrMode);
1005981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt		break;
1006981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
1007981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    case SITE_MGR_DESIRED_SUPPORTED_RATE_SET_PARAM:
1008981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        getSupportedRateSet(pSiteMgr, &(pParam->content.siteMgrDesiredSupportedRateSet));
1009981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        break;
1010981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
1011981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    case SITE_MGR_DESIRED_MODULATION_TYPE_PARAM:
1012981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        pParam->content.siteMgrDesiredModulationType = pSiteMgr->pDesiredParams->siteMgrDesiredModulationType;
1013981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        break;
1014981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
1015981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    case SITE_MGR_DESIRED_BEACON_INTERVAL_PARAM:
1016981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        pParam->content.siteMgrDesiredBeaconInterval = pSiteMgr->pDesiredParams->siteMgrDesiredBeaconInterval;
1017981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        break;
1018981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
1019981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    case SITE_MGR_DESIRED_PREAMBLE_TYPE_PARAM:
1020981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        pParam->content.siteMgrDesiredPreambleType = pSiteMgr->pDesiredParams->siteMgrDesiredPreambleType;
1021981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        break;
1022981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
1023981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    case SITE_MGR_CURRENT_SIGNAL_PARAM:
1024981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        if (!pPrimarySite)
1025981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        {
1026981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            pParam->content.siteMgrCurrentSignal.rssi = 0;
1027981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            pParam->content.siteMgrCurrentSignal.snr = 0;
1028981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            return NO_SITE_SELECTED_YET;
1029981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        }
1030981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
1031981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        pParam->content.siteMgrCurrentSignal.rssi = pPrimarySite->rssi;
1032981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        pParam->content.siteMgrCurrentSignal.snr = pPrimarySite->snr;
1033981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        break;
1034981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
1035981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    case SITE_MGR_POWER_CONSTRAINT_PARAM:
1036981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        if (!pPrimarySite)
1037981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        {
1038981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            pParam->content.powerConstraint = 0;
1039981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            return NO_SITE_SELECTED_YET;
1040981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        }
1041981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        pParam->content.powerConstraint = pPrimarySite->powerConstraint;
1042981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        break;
1043981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
1044981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
1045981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    case SITE_MGR_DTIM_PERIOD_PARAM:
1046981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        if (!pPrimarySite)
1047981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        {
1048981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            pParam->content.siteMgrDtimPeriod = 0;
1049981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            return NO_SITE_SELECTED_YET;
1050981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        }
1051981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        pParam->content.siteMgrDtimPeriod = pPrimarySite->dtimPeriod;
1052981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        break;
1053981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
1054981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    case SITE_MGR_BEACON_RECV:
1055981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        if (!pPrimarySite)
1056981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        {
1057981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            pParam->content.siteMgrBeaconRecv = TI_FALSE;
1058981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            return NO_SITE_SELECTED_YET;
1059981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        }
1060981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        pParam->content.siteMgrBeaconRecv = pPrimarySite->beaconRecv;
1061981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        break;
1062981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
1063981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
1064981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    case SITE_MGR_BEACON_INTERVAL_PARAM:
1065981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        if (!pPrimarySite)
1066981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        {
1067981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            pParam->content.beaconInterval = 0;
1068981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            return NO_SITE_SELECTED_YET;
1069981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        }
1070981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        pParam->content.beaconInterval = pPrimarySite->beaconInterval;
1071981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        break;
1072981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
1073981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    case SITE_MGR_AP_TX_POWER_PARAM:
1074981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        if (!pPrimarySite)
1075981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        {
1076981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            pParam->content.APTxPower = 0;
1077981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            return NO_SITE_SELECTED_YET;
1078981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        }
1079981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        pParam->content.APTxPower = pPrimarySite->APTxPower;
1080981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        break;
1081981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
1082981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    case SITE_MGR_SITE_CAPABILITY_PARAM:
1083981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        if (!pPrimarySite)
1084981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        {
1085981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            pParam->content.siteMgrSiteCapability = 0;
1086981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            return NO_SITE_SELECTED_YET;
1087981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        }
1088981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        pParam->content.siteMgrSiteCapability = pPrimarySite->capabilities;
1089981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        break;
1090981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
1091981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    case SITE_MGR_CURRENT_CHANNEL_PARAM:
1092981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        if (!pPrimarySite)
1093981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        {
1094981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            pParam->content.siteMgrCurrentChannel = 0;
1095981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            return NO_SITE_SELECTED_YET;
1096981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        }
1097981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        pParam->content.siteMgrCurrentChannel = pPrimarySite->channel;
1098981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        break;
1099981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
1100981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    case SITE_MGR_CURRENT_SSID_PARAM:
1101981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        if (!pPrimarySite)
1102981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        {
1103981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            os_memoryZero(pSiteMgr->hOs, (void *)pParam->content.siteMgrCurrentSSID.str, MAX_SSID_LEN);
1104981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            pParam->content.siteMgrCurrentSSID.len = 0;
1105981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            return NO_SITE_SELECTED_YET;
1106981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        }
1107981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        if(pPrimarySite->ssid.len == 0)
1108981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            TRACE0(pSiteMgr->hReport, REPORT_SEVERITY_ERROR, "siteMgr_getParam: ssid length is zero, while primarySite is selected \n");
1109981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        os_memoryCopy(pSiteMgr->hOs, &pParam->content.siteMgrCurrentSSID, &pPrimarySite->ssid, sizeof(TSsid));
1110981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        break;
1111981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
1112981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
1113981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    case SITE_MGR_CURRENT_BSS_TYPE_PARAM:
1114981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        if (!pPrimarySite)
1115981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        {
1116981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            pParam->content.siteMgrCurrentBSSType = pSiteMgr->pDesiredParams->siteMgrDesiredBSSType;
1117981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            TRACE0(pSiteMgr->hReport, REPORT_SEVERITY_ERROR, "Trying to get current BSS Type while no site is selected\n");
1118981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
1119981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        }
1120981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        else{
1121981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            pParam->content.siteMgrCurrentBSSType = pPrimarySite->bssType;
1122981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        }
1123981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
1124981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        break;
1125981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
1126981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
1127981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    case SITE_MGR_CURRENT_RATE_PAIR_PARAM:
1128981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        if (!pPrimarySite)
1129981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        {
1130981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            pParam->content.siteMgrCurrentRateMask.basicRateMask = 0;
1131981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            pParam->content.siteMgrCurrentRateMask.supportedRateMask = 0;
1132981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            return NO_SITE_SELECTED_YET;
1133981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        }
1134981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        pParam->content.siteMgrCurrentRateMask.basicRateMask = pSiteMgr->pDesiredParams->siteMgrMatchedBasicRateMask;
1135981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        pParam->content.siteMgrCurrentRateMask.supportedRateMask = pSiteMgr->pDesiredParams->siteMgrMatchedSuppRateMask;
1136981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        TRACE4(pSiteMgr->hReport, REPORT_SEVERITY_INFORMATION, "SITE_MGR: bitmapBasicPrimary= 0x%X,bitMapBasicDesired = 0x%X,bitMapSuppPrimary = 0x%X, bitMapSuppDesired = 0x%X\n", pPrimarySite->rateMask.basicRateMask,pSiteMgr->pDesiredParams->siteMgrCurrentDesiredRateMask.basicRateMask, pPrimarySite->rateMask.supportedRateMask,pSiteMgr->pDesiredParams->siteMgrCurrentDesiredRateMask.supportedRateMask);
1137981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        break;
1138981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
1139981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    case SITE_MGR_CURRENT_MODULATION_TYPE_PARAM:
1140981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        if (!pPrimarySite)
1141981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        {
1142981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            pParam->content.siteMgrCurrentModulationType = DRV_MODULATION_NONE;
1143981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            return NO_SITE_SELECTED_YET;
1144981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        }
1145981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        pParam->content.siteMgrCurrentModulationType = pSiteMgr->chosenModulation;
1146981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        break;
1147981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
1148981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    case SITE_MGR_DESIRED_SLOT_TIME_PARAM:
1149981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        pParam->content.siteMgrSlotTime = pSiteMgr->pDesiredParams->siteMgrDesiredSlotTime;
1150981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        break;
1151981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
1152981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    case SITE_MGR_CURRENT_SLOT_TIME_PARAM:
1153981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
1154981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        if(pSiteMgr->siteMgrOperationalMode == DOT11_G_MODE)
1155981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        {
1156981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            if(!pPrimarySite)
1157981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                pParam->content.siteMgrSlotTime = pSiteMgr->pDesiredParams->siteMgrDesiredSlotTime;
1158981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            else
1159981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                pParam->content.siteMgrSlotTime = pPrimarySite->currentSlotTime;
1160981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        }
1161981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        else if(pSiteMgr->siteMgrOperationalMode == DOT11_A_MODE)
1162981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            pParam->content.siteMgrSlotTime = PHY_SLOT_TIME_SHORT;
1163981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        else
1164981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            pParam->content.siteMgrSlotTime = PHY_SLOT_TIME_LONG;
1165981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
1166981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        break;
1167981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
1168981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    case SITE_MGR_LAST_BEACON_BUF_PARAM:
1169981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        if (pPrimarySite != NULL)
1170981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        {
1171981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            if (pPrimarySite->probeRecv)
1172981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            {
1173981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                pParam->content.siteMgrLastBeacon.isBeacon = TI_FALSE;
1174981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                pParam->content.siteMgrLastBeacon.bufLength = pPrimarySite->probeRespLength;
1175981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                pParam->content.siteMgrLastBeacon.buffer = pPrimarySite->probeRespBuffer;
1176981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            }
1177981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            else
1178981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            {
1179981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                pParam->content.siteMgrLastBeacon.isBeacon = TI_TRUE;
1180981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                pParam->content.siteMgrLastBeacon.bufLength = pPrimarySite->beaconLength;
1181981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                pParam->content.siteMgrLastBeacon.buffer = pPrimarySite->beaconBuffer;
1182981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            }
1183981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        }
1184981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        break;
1185981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
1186981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    case SITE_MGR_BEACON_FILTER_DESIRED_STATE_PARAM:
1187981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        {
1188981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            if ( NULL != pSiteMgr )
1189981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            {
1190981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                pParam->content.siteMgrDesiredBeaconFilterState = pSiteMgr->beaconFilterParams.desiredState;
1191981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            }
1192981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            else
1193981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            {
1194981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                TRACE0(pSiteMgr->hReport, REPORT_SEVERITY_ERROR, "pSite = NULL ! No info available");
1195981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            }
1196981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        }
1197981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        break;
1198981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
1199981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    case SITE_MGR_GET_SELECTED_BSSID_INFO:
1200981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        getPrimarySiteDesc(pSiteMgr, pParam->content.pSiteMgrPrimarySiteDesc, TI_FALSE);
1201981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        break;
1202981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
1203981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	case SITE_MGR_GET_SELECTED_BSSID_INFO_EX:
1204981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt       getPrimarySiteDesc(pSiteMgr, (OS_802_11_BSSID *)pParam->content.pSiteMgrSelectedSiteInfo,TI_TRUE);
1205981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt       break;
1206981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
1207981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    case SITE_MGR_PRIMARY_SITE_PARAM:
1208981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt       status = getPrimaryBssid(pSiteMgr, (OS_802_11_BSSID_EX *)pParam->content.pSiteMgrSelectedSiteInfo, &pParam->paramLength);
1209981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt       break;
1210981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
1211981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
1212981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    case SITE_MGR_TI_WLAN_COUNTERS_PARAM:
1213981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        pParam->paramType = RX_DATA_COUNTERS_PARAM;
1214981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        rxData_getParam(pSiteMgr->hRxData, pParam);
1215981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
1216981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        tTwdParam.paramType = TWD_COUNTERS_PARAM_ID;
1217981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        TWD_GetParam (pSiteMgr->hTWD, &tTwdParam);
1218981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        pParam->content.siteMgrTiWlanCounters.RecvNoBuffer = tTwdParam.content.halCtrlCounters.RecvNoBuffer;
1219981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        pParam->content.siteMgrTiWlanCounters.FragmentsRecv = tTwdParam.content.halCtrlCounters.FragmentsRecv;
1220981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        pParam->content.siteMgrTiWlanCounters.FrameDuplicates = tTwdParam.content.halCtrlCounters.FrameDuplicates;
1221981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        pParam->content.siteMgrTiWlanCounters.FcsErrors = tTwdParam.content.halCtrlCounters.FcsErrors;
1222981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        pParam->content.siteMgrTiWlanCounters.RecvError = tTwdParam.content.halCtrlCounters.RecvError;
1223981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
1224981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        pParam->paramType = AUTH_COUNTERS_PARAM;
1225981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        auth_getParam(pSiteMgr->hAuth, pParam);
1226981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
1227981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt		pParam->paramType = MLME_BEACON_RECV;
1228981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        mlme_getParam(pSiteMgr->hMlmeSm, pParam);
1229981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
1230981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        pParam->paramType = ASSOC_COUNTERS_PARAM;
1231981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        assoc_getParam(pSiteMgr->hAssoc, pParam);
1232981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        pParam->content.siteMgrTiWlanCounters.BeaconsXmit = pSiteMgr->beaconSentCount;
1233981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        break;
1234981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
1235981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    case SITE_MGR_FIRMWARE_VERSION_PARAM:
1236981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        {
1237981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            TFwInfo *pFwInfo = TWD_GetFWInfo (pSiteMgr->hTWD);
1238981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            os_memoryCopy(pSiteMgr->hOs,
1239981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                          pParam->content.siteMgrFwVersion,
1240981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                          pFwInfo->fwVer,
1241981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                          sizeof(pFwInfo->fwVer));
1242981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        }
1243981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        break;
1244981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
1245981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    case SITE_MGR_CURRENT_TX_RATE_PARAM:
1246981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        {
1247981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            ERate rate = txCtrlParams_GetTxRate (pSiteMgr->hTxCtrl);
1248981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            pParam->content.siteMgrCurrentTxRate = rate_DrvToNet (rate);
1249981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        }
1250981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        break;
1251981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
1252653850f71f9caaa41af19cadbab24bb5e655daf4Dmitry Shmidt    case SITE_MGR_CURRENT_RX_RATE_PARAM:
1253653850f71f9caaa41af19cadbab24bb5e655daf4Dmitry Shmidt        {
1254653850f71f9caaa41af19cadbab24bb5e655daf4Dmitry Shmidt            pParam->paramType = RX_DATA_RATE_PARAM;
1255653850f71f9caaa41af19cadbab24bb5e655daf4Dmitry Shmidt            rxData_getParam (pSiteMgr->hRxData, pParam);
1256653850f71f9caaa41af19cadbab24bb5e655daf4Dmitry Shmidt            pParam->content.siteMgrCurrentRxRate =
1257653850f71f9caaa41af19cadbab24bb5e655daf4Dmitry Shmidt                (TI_UINT8)rate_DrvToNet ((ERate)pParam->content.siteMgrCurrentRxRate);
1258653850f71f9caaa41af19cadbab24bb5e655daf4Dmitry Shmidt        }
1259653850f71f9caaa41af19cadbab24bb5e655daf4Dmitry Shmidt        break;
1260653850f71f9caaa41af19cadbab24bb5e655daf4Dmitry Shmidt
1261981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    case SITE_MGR_DESIRED_DOT11_MODE_PARAM:
1262981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        pParam->content.siteMgrDot11Mode = pSiteMgr->pDesiredParams->siteMgrDesiredDot11Mode;
1263981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        break;
1264981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
1265981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	case SITE_MGR_NETWORK_TYPE_IN_USE:
1266981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt		if (pPrimarySite)
1267981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt		{ /* Connected - return the current mode */
1268981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt			pParam->content.siteMgrDot11Mode = pSiteMgr->siteMgrOperationalMode;
1269981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt		}
1270981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt		else
1271981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt		{ /* Disconnected - return the desired mode */
1272981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt			pParam->content.siteMgrDot11Mode = pSiteMgr->pDesiredParams->siteMgrDesiredDot11Mode;
1273981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt		}
1274981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        break;
1275981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
1276981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
1277981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    case SITE_MGR_OPERATIONAL_MODE_PARAM:
1278981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        pParam->content.siteMgrDot11OperationalMode = pSiteMgr->siteMgrOperationalMode;
1279981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        break;
1280981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
1281981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    case SITE_MGR_RADIO_BAND_PARAM:
1282981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        pParam->content.siteMgrRadioBand = pSiteMgr->radioBand;
1283981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        break;
1284981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
1285981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    case SITE_MGR_CURRENT_PREAMBLE_TYPE_PARAM:
1286981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        if (!pPrimarySite)
1287981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            return NO_SITE_SELECTED_YET;
1288981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
1289981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        pParam->content.siteMgrCurrentPreambleType = pPrimarySite->currentPreambleType;
1290981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        break;
1291981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
1292981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    case SITE_MGR_CURRENT_BSSID_PARAM:
1293981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        if (pPrimarySite != NULL)
1294981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        {
1295981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            MAC_COPY (pParam->content.siteMgrDesiredBSSID, pPrimarySite->bssid);
1296981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        }
1297981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt		else
1298981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt			return NO_SITE_SELECTED_YET;
1299981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        break;
1300981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
1301981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    case SITE_MGR_LAST_RX_RATE_PARAM:
1302981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        if (pPrimarySite != NULL)
1303981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        {
1304981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            pParam->content.ctrlDataCurrentBasicRate = pPrimarySite->rxRate;
1305981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        }
1306981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        break;
1307981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
1308981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    case SITE_MGR_PREV_SITE_BSSID_PARAM:
1309981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        if (pSiteMgr->pSitesMgmtParams->pPrevPrimarySite==NULL)
1310981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        {
1311981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            return TI_NOK;
1312981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        }
1313981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        MAC_COPY (pParam->content.siteMgrDesiredBSSID, pSiteMgr->pSitesMgmtParams->pPrevPrimarySite->bssid);
1314981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        break;
1315981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
1316981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    case SITE_MGR_PREV_SITE_SSID_PARAM:
1317981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        if (pSiteMgr->pSitesMgmtParams->pPrevPrimarySite==NULL)
1318981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        {
1319981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            return TI_NOK;
1320981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        }
1321981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        pParam->content.siteMgrDesiredSSID.len = pSiteMgr->pSitesMgmtParams->pPrevPrimarySite->ssid.len;
1322981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        os_memoryCopy(pSiteMgr->hOs,
1323981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                      (void *)pParam->content.siteMgrDesiredSSID.str,
1324981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                      (void *)pSiteMgr->pSitesMgmtParams->pPrevPrimarySite->ssid.str,
1325981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                      pSiteMgr->pSitesMgmtParams->pPrevPrimarySite->ssid.len);
1326981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        break;
1327981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
1328981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    case SITE_MGR_PREV_SITE_CHANNEL_PARAM:
1329981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        if (pSiteMgr->pSitesMgmtParams->pPrevPrimarySite==NULL)
1330981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        {
1331981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            return TI_NOK;
1332981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        }
1333981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        pParam->content.siteMgrDesiredChannel = pSiteMgr->pSitesMgmtParams->pPrevPrimarySite->channel;
1334981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        break;
1335981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
1336981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    case SITE_MGR_SITE_ENTRY_BY_INDEX:
1337981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        siteEntryIndex = pParam->content.siteMgrIndexOfDesiredSiteEntry;
1338981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        if(siteEntryIndex >= MAX_SITES_BG_BAND)
1339981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        {
1340981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            return TI_NOK;
1341981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        }
1342981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        pParam->content.pSiteMgrDesiredSiteEntry =
1343981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            (TI_UINT8*)(&(pSiteMgr->pSitesMgmtParams->pCurrentSiteTable->siteTable[siteEntryIndex]));
1344981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        break;
1345981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
1346981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    case SITE_MGR_CUR_NUM_OF_SITES:
1347981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        pParam->content.siteMgrNumberOfSites = pSiteMgr->pSitesMgmtParams->pCurrentSiteTable->numOfSites;
1348981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        break;
1349981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
1350981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    case SITE_MGR_CURRENT_TSF_TIME_STAMP:
1351981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        os_memoryCopy(pSiteMgr->hOs, pParam->content.siteMgrCurrentTsfTimeStamp,
1352981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                      pSiteMgr->pSitesMgmtParams->pPrimarySite->tsfTimeStamp,
1353981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                      TIME_STAMP_LEN);
1354981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        break;
1355981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
1356981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    case SITE_MGR_GET_AP_QOS_CAPABILITIES:
1357981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt       if (!pPrimarySite)
1358981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt       {
1359981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt           pParam->content.qosApCapabilities.uQOSFlag = 0;
1360981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt           pParam->content.qosApCapabilities.uAPSDFlag = 0;
1361981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt           TRACE0(pSiteMgr->hReport, REPORT_SEVERITY_ERROR, "Not connected to an AP...\n");
1362981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt           return NOT_CONNECTED;
1363981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt       }
1364981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt       pParam->content.qosApCapabilities.uQOSFlag = pPrimarySite->WMESupported;
1365981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt       pParam->content.qosApCapabilities.uAPSDFlag = pPrimarySite->APSDSupport;
1366981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt       break;
1367981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
1368981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    case SITE_MGR_GET_PRIMARY_SITE:
1369981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt       if (!pPrimarySite)
1370981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt       {
1371981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt           pParam->content.pPrimarySite = (void *)NULL;
1372981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt           return NOT_CONNECTED;
1373981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt       }
1374981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt       else
1375981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt       {
1376981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt           pParam->content.pPrimarySite = (void *)pPrimarySite;
1377981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt       }
1378981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt       break;
1379981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
1380981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    case SITE_MGR_PRIMARY_SITE_HT_SUPPORT:
1381981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt       if (!pPrimarySite)
1382981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt       {
1383981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt           pParam->content.bPrimarySiteHtSupport = TI_FALSE;
1384981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt           return NOT_CONNECTED;
1385981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt       }
1386981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt       else
1387981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt       {
1388981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt           if((pPrimarySite->tHtCapabilities.tHdr[0] != TI_FALSE) && (pPrimarySite->tHtInformation.tHdr[0] != TI_FALSE))
1389981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt           {
1390981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt               pParam->content.bPrimarySiteHtSupport = TI_TRUE;
1391981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt           }
1392981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt           else
1393981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt           {
1394981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt               pParam->content.bPrimarySiteHtSupport = TI_FALSE;
1395981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt           }
1396981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt       }
1397981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt       break;
1398653850f71f9caaa41af19cadbab24bb5e655daf4Dmitry Shmidt    case SITE_MGRT_GET_RATE_MANAGMENT:
1399653850f71f9caaa41af19cadbab24bb5e655daf4Dmitry Shmidt         return cmdBld_ItrRateParams (pSiteMgr->hTWD,
1400653850f71f9caaa41af19cadbab24bb5e655daf4Dmitry Shmidt                                      pParam->content.interogateCmdCBParams.fCb,
1401653850f71f9caaa41af19cadbab24bb5e655daf4Dmitry Shmidt                                      pParam->content.interogateCmdCBParams.hCb,
1402653850f71f9caaa41af19cadbab24bb5e655daf4Dmitry Shmidt                                      (void*)pParam->content.interogateCmdCBParams.pCb);
1403981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
1404981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    default:
1405981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        {
1406981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            TRACE1(pSiteMgr->hReport, REPORT_SEVERITY_ERROR, "Get param, Params is not supported, 0x%x\n", pParam->paramType);
1407981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        }
1408981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
1409981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        return PARAM_NOT_SUPPORTED;
1410981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    }
1411981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
1412981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    return status;
1413981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt}
1414981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
1415981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
1416981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt/***********************************************************************
1417981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt *                        siteMgr_join
1418981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt ***********************************************************************
1419981801b95b81e6d1c7a2085967406e86af0f08fcDmitry ShmidtDESCRIPTION: Called by the connection state machine in order to join a BSS.
1420981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                -   If the BSS is infrastructure, sets a NULL data template to the HAL
1421981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                -   If the BSS is IBSS, sets a probe response & beacon template to the HAL
1422981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            Call the HAL with the join parameters
1423981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
1424981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
1425981801b95b81e6d1c7a2085967406e86af0f08fcDmitry ShmidtINPUT:      hSiteMgr    -   site mgr handle.
1426981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            JoinCompleteCB - join command complete callback function ptr
1427981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            CB_handle - handle to pass to callback function
1428981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
1429981801b95b81e6d1c7a2085967406e86af0f08fcDmitry ShmidtOUTPUT:
1430981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
1431981801b95b81e6d1c7a2085967406e86af0f08fcDmitry ShmidtRETURN:     TI_OK on success, TI_NOK otherwise
1432981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
1433981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt************************************************************************/
1434981801b95b81e6d1c7a2085967406e86af0f08fcDmitry ShmidtTI_STATUS siteMgr_join(TI_HANDLE    hSiteMgr)
1435981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt{
1436981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    siteMgr_t               *pSiteMgr = (siteMgr_t *)hSiteMgr;
1437981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    TJoinBss                joinParams;
1438981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    TSetTemplate            templateStruct;
1439981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    probeRspTemplate_t      probeRspTemplate;
1440981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    nullDataTemplate_t      nullDataTemplate;
1441981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    disconnTemplate_t       disconnTemplate;
1442981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    psPollTemplate_t        psPollTemplate;
1443981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    QosNullDataTemplate_t   QosNullDataTemplate;
1444981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    siteEntry_t             *pPrimarySite = pSiteMgr->pSitesMgmtParams->pPrimarySite;
1445023547f11f3d7c84ab64acaab9b9e821f8c528e7Dmitry Shmidt    EPreamble               curPreamble;
1446981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
1447981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    if (pPrimarySite == NULL)
1448981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    {
1449981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        TRACE0(pSiteMgr->hReport, REPORT_SEVERITY_ERROR, "Join BSS, Primary Site is NULL\n");
1450981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        return TI_OK;
1451981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    }
1452981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
1453981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    /* Configure the system according to parameters of Primary Site */
1454981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    systemConfig(pSiteMgr);
1455981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
1456981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    joinParams.bssType = pPrimarySite->bssType;
1457981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    joinParams.beaconInterval = pPrimarySite->beaconInterval;
1458981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    joinParams.dtimInterval = pPrimarySite->dtimPeriod;
1459981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    joinParams.pBSSID = (TI_UINT8 *)&pPrimarySite->bssid;
1460981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    joinParams.pSSID = (TI_UINT8 *)&pPrimarySite->ssid.str;
1461981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    joinParams.ssidLength = pPrimarySite->ssid.len;
1462981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
1463981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    /*
1464981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt     * Set the radio band and the HW management Tx rate according to operational mode.
1465981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt     * The HW management frames includes Beacon and Probe-Response (in IBSS).
1466981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt     */
1467981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    if(pSiteMgr->siteMgrOperationalMode == DOT11_A_MODE)
1468981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    {
1469981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        joinParams.radioBand = RADIO_BAND_5_0_GHZ;
1470981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    }
1471981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    else
1472981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    {
1473981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        joinParams.radioBand = RADIO_BAND_2_4_GHZ;
1474981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    }
1475981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
1476981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    joinParams.channel = pPrimarySite->channel;
1477981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    if (joinParams.channel == SPECIAL_BG_CHANNEL)
1478981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    {
1479981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt         joinParams.basicRateSet     = (TI_UINT16)rate_GetDrvBitmapForDefaultBasicSet ();
1480981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    }
1481981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    else /* != SPECIAL_BG_CHANNEL */
1482981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    {
1483981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        joinParams.basicRateSet = (TI_UINT16)pSiteMgr->pDesiredParams->siteMgrMatchedBasicRateMask;
1484981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    }
1485981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
1486023547f11f3d7c84ab64acaab9b9e821f8c528e7Dmitry Shmidt    ctrlData_getParamPreamble(pSiteMgr->hCtrlData, &curPreamble); /* CTRL_DATA_CURRENT_PREAMBLE_TYPE_PARAM */
1487981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    /* Set the preamble before the join */
1488023547f11f3d7c84ab64acaab9b9e821f8c528e7Dmitry Shmidt    TWD_CfgPreamble (pSiteMgr->hTWD, curPreamble);
1489981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
1490981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    /* Now, Set templates to the HAL */
1491981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    templateStruct.uRateMask = RATE_MASK_UNSPECIFIED;
1492981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    if (pPrimarySite->bssType == BSS_INDEPENDENT)
1493981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    {
1494981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        templateStruct.ptr = (TI_UINT8 *)&probeRspTemplate;
1495981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        templateStruct.type = PROBE_RESPONSE_TEMPLATE;
1496981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        buildProbeRspTemplate(pSiteMgr, &templateStruct);
1497981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        TWD_CmdTemplate (pSiteMgr->hTWD, &templateStruct, NULL, NULL);
1498981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
1499981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        /* We don't have to build a beacon template, because it is equal to probe response,
1500981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        we only have to change the frame sup type */
1501981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        probeRspTemplate.hdr.fc = ENDIAN_HANDLE_WORD(DOT11_FC_BEACON);
1502981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        templateStruct.type = BEACON_TEMPLATE;
1503981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        TWD_CmdTemplate (pSiteMgr->hTWD, &templateStruct, NULL, NULL);
1504981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    }
1505981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    else
1506981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    {
1507981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        templateStruct.ptr = (TI_UINT8 *)&nullDataTemplate;
1508981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        templateStruct.type = NULL_DATA_TEMPLATE;
1509981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        buildNullTemplate(pSiteMgr, &templateStruct);
1510981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        TWD_CmdTemplate (pSiteMgr->hTWD, &templateStruct, NULL, NULL);
1511981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
1512981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        /* Send PsPoll template to HAL */
1513981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        templateStruct.ptr = (TI_UINT8 *)&psPollTemplate;
1514981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        templateStruct.type = PS_POLL_TEMPLATE;
1515981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        buildPsPollTemplate(pSiteMgr, &templateStruct);
1516981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        TWD_CmdTemplate (pSiteMgr->hTWD, &templateStruct, NULL, NULL);
1517981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
1518981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        /* Set QOS Null data template to the firmware.
1519981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            Note:  the AC to use with this template may change in QoS-manager. */
1520981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        templateStruct.ptr = (TI_UINT8 *)&QosNullDataTemplate;
1521981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        templateStruct.type = QOS_NULL_DATA_TEMPLATE;
1522981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        buildQosNullDataTemplate(pSiteMgr, &templateStruct, 0);
1523981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        TWD_CmdTemplate (pSiteMgr->hTWD, &templateStruct, NULL, NULL);
1524981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
1525981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        /* Send disconnect (Deauth/Disassoc) template to HAL */
1526981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        templateStruct.ptr = (TI_UINT8 *)&disconnTemplate;
1527981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        templateStruct.type = DISCONN_TEMPLATE;
1528981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        buildDisconnTemplate(pSiteMgr, &templateStruct);
1529981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        TWD_CmdTemplate (pSiteMgr->hTWD, &templateStruct, NULL, NULL);
1530981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
1531981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    }
1532981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
1533981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    /* Reset the Tx Power Control adjustment in RegulatoryDomain */
1534981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    siteMgr_setTemporaryTxPower(pSiteMgr, TI_FALSE);
1535981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
1536981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	/* Get a new Tx-Session-Count (also updates the TxCtrl module). */
1537981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	joinParams.txSessionCount = incrementTxSessionCount(pSiteMgr);
1538981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
1539981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    return TWD_CmdJoinBss (((siteMgr_t *)hSiteMgr)->hTWD, &joinParams);
1540981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt}
1541981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
1542981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
1543981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt/***********************************************************************
1544981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt *                        siteMgr_removeSelfSite
1545981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt ***********************************************************************
1546981801b95b81e6d1c7a2085967406e86af0f08fcDmitry ShmidtDESCRIPTION: Called by the Self connection state machine in order to remove the self site from the site table.
1547981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                Remove the site entry form the table and reset the primary site pointer
1548981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
1549981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
1550981801b95b81e6d1c7a2085967406e86af0f08fcDmitry ShmidtINPUT:      hSiteMgr    -   site mgr handle.
1551981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
1552981801b95b81e6d1c7a2085967406e86af0f08fcDmitry ShmidtOUTPUT:
1553981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
1554981801b95b81e6d1c7a2085967406e86af0f08fcDmitry ShmidtRETURN:     TI_OK on success, TI_NOK otherwise
1555981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
1556981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt************************************************************************/
1557981801b95b81e6d1c7a2085967406e86af0f08fcDmitry ShmidtTI_STATUS siteMgr_removeSelfSite(TI_HANDLE  hSiteMgr)
1558981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt{
1559981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    siteMgr_t           *pSiteMgr  = (siteMgr_t *)hSiteMgr;
1560981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    siteTablesParams_t  *currTable = pSiteMgr->pSitesMgmtParams->pCurrentSiteTable;
1561981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
1562981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    if(pSiteMgr->pSitesMgmtParams->pPrimarySite == NULL)
1563981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    {
1564981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        TRACE0(pSiteMgr->hReport, REPORT_SEVERITY_WARNING, "Remove self site Failure, pointer is NULL\n\n");
1565981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        return TI_OK;
1566981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    }
1567981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
1568981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    if(pSiteMgr->pSitesMgmtParams->pPrimarySite->siteType != SITE_SELF)
1569981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    {
1570981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        TRACE0(pSiteMgr->hReport, REPORT_SEVERITY_ERROR, "Remove self site Failure, site is not self\n\n");
1571981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        return TI_OK;
1572981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    }
1573981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
1574981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    removeSiteEntry(pSiteMgr, currTable, pSiteMgr->pSitesMgmtParams->pPrimarySite);
1575981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    pSiteMgr->pSitesMgmtParams->pPrimarySite = NULL;
1576981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
1577981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    return TI_OK;
1578981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt}
1579981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
1580981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt/***********************************************************************
1581981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt *                        siteMgr_IbssMerge
1582981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt ***********************************************************************/
1583981801b95b81e6d1c7a2085967406e86af0f08fcDmitry ShmidtTI_STATUS siteMgr_IbssMerge(TI_HANDLE       hSiteMgr,
1584981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                          TMacAddr      	our_bssid,
1585981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt						  TMacAddr      	new_bssid,
1586981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                          mlmeFrameInfo_t   *pFrameInfo,
1587981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                          TI_UINT8          rxChannel,
1588981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                          ERadioBand        band)
1589981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt{
1590981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	siteMgr_t   *pSiteMgr = (siteMgr_t *)hSiteMgr;
1591981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    siteEntry_t *pSite;
1592981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	paramInfo_t Param;
1593981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
1594981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	pSite = findAndInsertSiteEntry(pSiteMgr, (TMacAddr*)&our_bssid, band);
1595981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
1596981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	if(!pSite) {
1597981801b95b81e6d1c7a2085967406e86af0f08fcDmitry ShmidtTRACE6(pSiteMgr->hReport, REPORT_SEVERITY_ERROR, "siteMgr_IbssMerge, cannot find our site table entry, our_bssid: %X-%X-%X-%X-%X-%X\n", 						   (our_bssid)[0], (our_bssid)[1], (our_bssid)[2], (our_bssid)[3], 						   (our_bssid)[4], (our_bssid)[5]);
1598981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt		return TI_NOK;
1599981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	}
1600981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
1601981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	updateSiteInfo(pSiteMgr, pFrameInfo, pSite, rxChannel);
1602981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
1603981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	pSite->siteType = SITE_PRIMARY;
1604981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	pSiteMgr->pSitesMgmtParams->pPrimarySite = pSite;
1605981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
1606981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	MAC_COPY(pSite->bssid, new_bssid);
1607981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
1608981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	Param.paramType   = SITE_MGR_DESIRED_BSSID_PARAM;
1609981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    Param.paramLength = sizeof(TMacAddr);
1610981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	MAC_COPY(Param.content.siteMgrDesiredBSSID, new_bssid);
1611981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
1612981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	siteMgr_setParam ( hSiteMgr, &Param );
1613981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
1614981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	conn_ibssMerge(pSiteMgr->hConn);
1615981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
1616981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	return TI_OK;
1617981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt}
1618981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
1619981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
1620981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
1621981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt/***********************************************************************
1622981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt *                        siteMgr_updateSite
1623981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt ***********************************************************************
1624981801b95b81e6d1c7a2085967406e86af0f08fcDmitry ShmidtDESCRIPTION: Called by the MLME parser upon receiving a beacon or probe response.
1625981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            Performs the following:
1626981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                -   Insert the site entry into the site hash table
1627981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                -   Update the site information in the site table
1628981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                -   If the site is the primary site, it handles the PBCC algorithm if needed
1629981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                -   If the site is NULL (means it is the first frame received from this site)
1630981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                    we update the site type to be regular
1631981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                -   If the site type is self, we inform the self connection SM
1632981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                    that another station joined the network we created
1633981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
1634981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
1635981801b95b81e6d1c7a2085967406e86af0f08fcDmitry ShmidtINPUT:      hSiteMgr    -   site mgr handle.
1636981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            bssid       -   BSSID received
1637981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            pFrameInfo  -   Frame content after the parsing
1638981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            rxChannel   -   The channel on which frame was received
1639981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            band        -   Band on which frame was received
1640981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            measuring   -   Determines whether the beacon or probe response
1641981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                            has been received while a beacon measurement
1642981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                            took place
1643981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
1644981801b95b81e6d1c7a2085967406e86af0f08fcDmitry ShmidtOUTPUT:
1645981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
1646981801b95b81e6d1c7a2085967406e86af0f08fcDmitry ShmidtRETURN:     TI_OK on success, TI_NOK otherwise
1647981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
1648981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt************************************************************************/
1649981801b95b81e6d1c7a2085967406e86af0f08fcDmitry ShmidtTI_STATUS siteMgr_updateSite(TI_HANDLE          hSiteMgr,
1650981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                          TMacAddr      *bssid,
1651981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                          mlmeFrameInfo_t   *pFrameInfo,
1652981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                          TI_UINT8             rxChannel,
1653981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                          ERadioBand       band,
1654981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                          TI_BOOL              measuring)
1655981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt{
1656981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    siteEntry_t *pSite;
1657981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    siteMgr_t   *pSiteMgr = (siteMgr_t *)hSiteMgr;
1658981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    paramInfo_t param;
1659981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
1660981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
1661981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    /* The following is not required, since the scanCncn is responsible to check
1662981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        the channels validity before scanning.
1663981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        The problem it caused was that when 802.11d is enabled,
1664981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        channels that are valid for Passive only, will not be updated.*/
1665981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    /*if (isChannelSupprted(pSiteMgr->hRegulatoryDomain , rxChannel) == TI_FALSE)
1666981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    {
1667981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        TRACE1(pSiteMgr->hReport, REPORT_SEVERITY_WARNING, "Channel ERROR - try to register a site that its channel (=%d) isn't in the regulatory domain.\n\            registration ABORTED!!!", rxChannel);
1668981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        return TI_NOK;
1669981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    }*/
1670981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
1671981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
1672981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    pSite = findAndInsertSiteEntry(pSiteMgr, bssid, band);
1673981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
1674981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
1675981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
1676981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    if (pSite == NULL)
1677981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    {
1678981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        TRACE6(pSiteMgr->hReport, REPORT_SEVERITY_INFORMATION, "Site Update failure, table is full, bssid: %X-%X-%X-%X-%X-%X\n", (*bssid)[0], (*bssid)[1], (*bssid)[2], (*bssid)[3], (*bssid)[4], (*bssid)[5]);
1679981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        return TI_OK;
1680981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    }
1681981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
1682981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    updateSiteInfo(pSiteMgr, pFrameInfo, pSite, rxChannel);
1683981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
1684981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    switch(pSite->siteType)
1685981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    {
1686981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    case SITE_PRIMARY:
1687981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        TRACE6(pSiteMgr->hReport, REPORT_SEVERITY_INFORMATION, "PRIMARY site updated, bssid: %X-%X-%X-%X-%X-%X\n\n", (*bssid)[0], (*bssid)[1], (*bssid)[2], (*bssid)[3], (*bssid)[4], (*bssid)[5]);
1688981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        if (pSiteMgr->pSitesMgmtParams->pPrimarySite == NULL)
1689981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        {
1690981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            TRACE0(pSiteMgr->hReport, REPORT_SEVERITY_ERROR, "siteMgr_updateSite: Primary Site Is NULL\n");
1691981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            pSite->siteType = SITE_REGULAR;
1692981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            break;
1693981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        }
1694981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        /* Now, if the following is TI_TRUE we perform the PBCC algorithm: */
1695981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        /* If the BSS type is infrastructure, &&
1696981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            The chosen modulation is PBCC &&
1697981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            The beacon modulation is not NONE &&
1698981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            The current data modulation is different than the beacon modulation. */
1699981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        if ((pSite->bssType == BSS_INFRASTRUCTURE) &&
1700981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            (pSiteMgr->chosenModulation == DRV_MODULATION_PBCC) &&
1701981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            (pSite->beaconModulation != DRV_MODULATION_NONE) &&
1702981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            (pSiteMgr->currentDataModulation != pSite->beaconModulation))
1703981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        {
1704981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            pSiteMgr->currentDataModulation = pSite->beaconModulation;
1705981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            pbccAlgorithm(pSiteMgr);
1706981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        }
1707981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
1708981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        /* Now handle the slot time, first check if the slot time changed since the last
1709981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt           setting to the HAL ,and if yes set the new value */
1710981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        if((pSiteMgr->siteMgrOperationalMode == DOT11_G_MODE) &&
1711981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt           (pSite->bssType == BSS_INFRASTRUCTURE))
1712981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        {
1713981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            if (pSite->currentSlotTime != pSite->newSlotTime)
1714981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            {
1715981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                pSite->currentSlotTime = pSite->newSlotTime;
1716981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                TWD_CfgSlotTime (pSiteMgr->hTWD, pSite->currentSlotTime);
1717981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            }
1718981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        }
1719981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
1720981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        /* Now handle the current protection status */
1721981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        if((pSiteMgr->siteMgrOperationalMode == DOT11_G_MODE) && (pSite->bssType == BSS_INFRASTRUCTURE))
1722981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        {
1723981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            param.paramType = CTRL_DATA_CURRENT_PROTECTION_STATUS_PARAM;
1724981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            param.content.ctrlDataProtectionEnabled = pSite->useProtection;
1725981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            ctrlData_setParam(pSiteMgr->hCtrlData, &param);
1726981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        }
1727981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
1728981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        /* Now handle the current preamble type,
1729981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt           if desired preamble type is long, the ctrl data param should not be changed */
1730981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        if((pSiteMgr->siteMgrOperationalMode == DOT11_G_MODE) &&
1731981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt           (pSite->bssType == BSS_INFRASTRUCTURE) &&
1732981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt           (pSiteMgr->pDesiredParams->siteMgrDesiredPreambleType != PREAMBLE_LONG))
1733981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        {
1734981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            param.paramType = CTRL_DATA_CURRENT_PREAMBLE_TYPE_PARAM;
1735981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            if((pSite->preambleAssRspCap == PREAMBLE_LONG) ||
1736981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt               (pSite->barkerPreambleType == PREAMBLE_LONG))
1737981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                  {
1738981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                param.content.ctrlDataCurrentPreambleType = PREAMBLE_LONG;
1739981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            }
1740981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            else
1741981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                param.content.ctrlDataCurrentPreambleType = PREAMBLE_SHORT;
1742981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
1743981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            ctrlData_setParam(pSiteMgr->hCtrlData, &param);
1744981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        }
1745981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
1746981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        param.paramType = CTRL_DATA_RATE_CONTROL_ENABLE_PARAM;
1747981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        ctrlData_setParam(pSiteMgr->hCtrlData, &param);
1748981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        break;
1749981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
1750981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    case SITE_NULL:
1751981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        pSite->siteType = SITE_REGULAR;
1752981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        TRACE6(pSiteMgr->hReport, REPORT_SEVERITY_INFORMATION, "REGULAR site added, bssid: %X-%X-%X-%X-%X-%X\n\n", (*bssid)[0], (*bssid)[1], (*bssid)[2], (*bssid)[3], (*bssid)[4], (*bssid)[5]);
1753981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        break;
1754981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
1755981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    case SITE_SELF:
1756981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        pSite->siteType = SITE_PRIMARY;
1757981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        TRACE6(pSiteMgr->hReport, REPORT_SEVERITY_INFORMATION, "SELF ----> PRIMARY site , bssid: %X-%X-%X-%X-%X-%X\n\n", (*bssid)[0], (*bssid)[1], (*bssid)[2], (*bssid)[3], (*bssid)[4], (*bssid)[5]);
1758981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        conn_ibssStaJoined(pSiteMgr->hConn);
1759981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        break;
1760981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
1761981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    case SITE_REGULAR:
1762981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        TRACE6(pSiteMgr->hReport, REPORT_SEVERITY_INFORMATION, "REGULAR site updated, bssid: %X-%X-%X-%X-%X-%X\n\n", (*bssid)[0], (*bssid)[1], (*bssid)[2], (*bssid)[3], (*bssid)[4], (*bssid)[5]);
1763981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        break;
1764981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
1765981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    default:
1766981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        TRACE6(pSiteMgr->hReport, REPORT_SEVERITY_INFORMATION, "Setting site type failure, bssid: %X-%X-%X-%X-%X-%X\n\n", (*bssid)[0], (*bssid)[1], (*bssid)[2], (*bssid)[3], (*bssid)[4], (*bssid)[5]);
1767981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        break;
1768981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    }
1769981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
1770981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    return TI_OK;
1771981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt}
1772981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
1773981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt/***********************************************************************
1774981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt *                        siteMgr_start
1775981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt ***********************************************************************
1776981801b95b81e6d1c7a2085967406e86af0f08fcDmitry ShmidtDESCRIPTION: Called by the SME SM in order to start the aging timer
1777981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
1778981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
1779981801b95b81e6d1c7a2085967406e86af0f08fcDmitry ShmidtINPUT:      hSiteMgr    -   site mgr handle.
1780981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
1781981801b95b81e6d1c7a2085967406e86af0f08fcDmitry ShmidtOUTPUT:
1782981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
1783981801b95b81e6d1c7a2085967406e86af0f08fcDmitry ShmidtRETURN:     TI_OK on success, TI_NOK otherwise
1784981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
1785981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt************************************************************************/
1786981801b95b81e6d1c7a2085967406e86af0f08fcDmitry ShmidtTI_STATUS siteMgr_start(TI_HANDLE   hSiteMgr)
1787981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt{
1788981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    siteMgr_t       *pSiteMgr = (siteMgr_t *)hSiteMgr;
1789981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
1790981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    /* update timestamp each time aging started (needed for quiet scan) */
1791981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    if(pSiteMgr->pSitesMgmtParams->pPrimarySite)
1792981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        pSiteMgr->pSitesMgmtParams->pPrimarySite->localTimeStamp = os_timeStampMs(pSiteMgr->hOs);
1793981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
1794981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    return TI_OK;
1795981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt}
1796981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
1797981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
1798981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt/***********************************************************************
1799981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt *                        siteMgr_stop
1800981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt ***********************************************************************
1801981801b95b81e6d1c7a2085967406e86af0f08fcDmitry ShmidtDESCRIPTION: Called by the SME SM in order to stop site mgr timers
1802981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
1803981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
1804981801b95b81e6d1c7a2085967406e86af0f08fcDmitry ShmidtINPUT:      hSiteMgr    -   site mgr handle.
1805981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
1806981801b95b81e6d1c7a2085967406e86af0f08fcDmitry ShmidtOUTPUT:
1807981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
1808981801b95b81e6d1c7a2085967406e86af0f08fcDmitry ShmidtRETURN:     TI_OK on success, TI_NOK otherwise
1809981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
1810981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt************************************************************************/
1811981801b95b81e6d1c7a2085967406e86af0f08fcDmitry ShmidtTI_STATUS siteMgr_stop(TI_HANDLE    hSiteMgr)
1812981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt{
1813981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
1814981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    return TI_OK;
1815981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt}
1816981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
1817981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
1818981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt/***********************************************************************
1819981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt *                        siteMgr_updatePrimarySiteFailStatus
1820981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt ***********************************************************************
1821981801b95b81e6d1c7a2085967406e86af0f08fcDmitry ShmidtDESCRIPTION: Called by the SME SM when the connection with the primary site fails
1822981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                If the primary site is NULL, return.
1823981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
1824981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
1825981801b95b81e6d1c7a2085967406e86af0f08fcDmitry ShmidtINPUT:      hSiteMgr    -   site mgr handle.
1826981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            bRemoveSite -   Whether to remove the site
1827981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
1828981801b95b81e6d1c7a2085967406e86af0f08fcDmitry ShmidtOUTPUT:
1829981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
1830981801b95b81e6d1c7a2085967406e86af0f08fcDmitry ShmidtRETURN:     TI_OK on success, TI_NOK otherwise
1831981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
1832981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt************************************************************************/
1833981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
1834981801b95b81e6d1c7a2085967406e86af0f08fcDmitry ShmidtTI_STATUS siteMgr_updatePrimarySiteFailStatus(TI_HANDLE hSiteMgr,
1835981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                                           TI_BOOL bRemoveSite)
1836981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt{
1837981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    siteMgr_t           *pSiteMgr = (siteMgr_t *)hSiteMgr;
1838981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    siteTablesParams_t  *currTable = pSiteMgr->pSitesMgmtParams->pCurrentSiteTable;
1839981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
1840981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    if (pSiteMgr->pSitesMgmtParams->pPrimarySite == NULL)
1841981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        return TI_OK;
1842981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
1843981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    TRACE1(pSiteMgr->hReport, REPORT_SEVERITY_INFORMATION, " SITE MGR: bRemoveSite = %d \n", bRemoveSite);
1844981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
1845981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    if (bRemoveSite)
1846981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    {
1847981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        removeSiteEntry(pSiteMgr, currTable, pSiteMgr->pSitesMgmtParams->pPrimarySite);
1848981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        pSiteMgr->pSitesMgmtParams->pPrimarySite = NULL;
1849981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    }
1850981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    else	/* Currently never used */
1851981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    {
1852981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        pSiteMgr->pSitesMgmtParams->pPrimarySite->failStatus = STATUS_UNSPECIFIED;
1853981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    }
1854981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
1855981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    return TI_OK;
1856981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt}
1857981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
1858981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
1859981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt/***********************************************************************
1860981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt *                        siteMgr_isCurrentBand24
1861981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt ***********************************************************************
1862981801b95b81e6d1c7a2085967406e86af0f08fcDmitry ShmidtDESCRIPTION: The function checks the current operational mode and
1863981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                returns if the current band is 2.4Ghz or 5Ghz.
1864981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
1865981801b95b81e6d1c7a2085967406e86af0f08fcDmitry ShmidtINPUT:      hSiteMgr    -   site mgr handle.
1866981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
1867981801b95b81e6d1c7a2085967406e86af0f08fcDmitry ShmidtOUTPUT:
1868981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
1869981801b95b81e6d1c7a2085967406e86af0f08fcDmitry ShmidtRETURN:     TI_TRUE if current band is 2.4Ghz, TI_FALSE otherwise.
1870981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
1871981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt************************************************************************/
1872981801b95b81e6d1c7a2085967406e86af0f08fcDmitry ShmidtTI_BOOL siteMgr_isCurrentBand24(TI_HANDLE  hSiteMgr)
1873981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt{
1874981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    siteMgr_t   *pSiteMgr =     (siteMgr_t *)hSiteMgr;
1875981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
1876981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    if(pSiteMgr->siteMgrOperationalMode == DOT11_A_MODE)
1877981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        return TI_FALSE;
1878981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
1879981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    return TI_TRUE; /* 802.11b supports onlty 2.4G band */
1880981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
1881981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt}
1882981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
1883981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt/***********************************************************************
1884981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt *                        removeEldestSite
1885981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt ***********************************************************************
1886981801b95b81e6d1c7a2085967406e86af0f08fcDmitry ShmidtDESCRIPTION: Called by the select when trying to create an IBSS and site table is full
1887981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                Remove the eldest site from the table
1888981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
1889981801b95b81e6d1c7a2085967406e86af0f08fcDmitry ShmidtINPUT:      hSiteMgr    -   site mgr handle.
1890981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
1891981801b95b81e6d1c7a2085967406e86af0f08fcDmitry ShmidtOUTPUT:
1892981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
1893981801b95b81e6d1c7a2085967406e86af0f08fcDmitry ShmidtRETURN:     TI_OK on success, TI_NOK otherwise
1894981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
1895981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt************************************************************************/
1896981801b95b81e6d1c7a2085967406e86af0f08fcDmitry ShmidtTI_STATUS removeEldestSite(siteMgr_t *pSiteMgr)
1897981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt{
1898981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    int             i;
1899981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    siteEntry_t     *pEldestSite = NULL, *pSiteTable = pSiteMgr->pSitesMgmtParams->pCurrentSiteTable->siteTable;
1900981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    siteTablesParams_t  *currTable = pSiteMgr->pSitesMgmtParams->pCurrentSiteTable;
1901981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    TI_UINT32          currentTimsStamp = os_timeStampMs(pSiteMgr->hOs);
1902981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    TI_UINT32          biggestGap = 0;
1903981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
1904981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    for (i = 0; i < currTable->maxNumOfSites; i++)
1905981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    {
1906981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        if (biggestGap < ((TI_UINT32)(currentTimsStamp - pSiteTable[i].localTimeStamp)))
1907981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        {
1908981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            biggestGap = ((TI_UINT32)(currentTimsStamp - pSiteTable[i].localTimeStamp));
1909981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            pEldestSite = &(pSiteTable[i]);
1910981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        }
1911981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    }
1912981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
1913981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    removeSiteEntry(pSiteMgr, currTable, pEldestSite);
1914981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
1915981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    return TI_OK;
1916981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt}
1917981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
1918981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
1919981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt/***********************************************************************
1920981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt *                        update_apsd
1921981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt ***********************************************************************
1922981801b95b81e6d1c7a2085967406e86af0f08fcDmitry ShmidtDESCRIPTION:    Sets the site APSD support flag according to the
1923981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                beacon's capabilities vector and the WME-params IE if exists.
1924981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
1925981801b95b81e6d1c7a2085967406e86af0f08fcDmitry ShmidtINPUT:      pSite       -   Pointer to the site entry in the site table
1926981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            pFrameInfo  -   Frame information after the parsing
1927981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
1928981801b95b81e6d1c7a2085967406e86af0f08fcDmitry ShmidtOUTPUT:     pSite->APSDSupport flag
1929981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
1930981801b95b81e6d1c7a2085967406e86af0f08fcDmitry ShmidtRETURN:
1931981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
1932981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt************************************************************************/
1933981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidtstatic void update_apsd(siteEntry_t *pSite, mlmeFrameInfo_t *pFrameInfo)
1934981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt{
1935981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    /* If WME-Params IE is not included in the beacon, set the APSD-Support flag
1936981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt         only by the beacons capabilities bit map. */
1937981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    if (pFrameInfo->content.iePacket.WMEParams == NULL)
1938981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        pSite->APSDSupport = (((pFrameInfo->content.iePacket.capabilities >> CAP_APSD_SHIFT) & CAP_APSD_MASK) ? TI_TRUE : TI_FALSE);
1939981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
1940981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    /* Else, set the APSD-Support flag if either the capabilities APSD bit or the
1941981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt         WME-Params APSD bit indicate so. */
1942981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    else
1943981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        pSite->APSDSupport = ((((pFrameInfo->content.iePacket.capabilities >> CAP_APSD_SHIFT) & CAP_APSD_MASK) ? TI_TRUE : TI_FALSE) ||
1944981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        (((pFrameInfo->content.iePacket.WMEParams->ACInfoField >> AP_QOS_INFO_UAPSD_SHIFT) & AP_QOS_INFO_UAPSD_MASK) ? TI_TRUE : TI_FALSE));
1945981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt}
1946981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
1947981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
1948981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt/***********************************************************************
1949981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt *                        release_module
1950981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt ***********************************************************************
1951981801b95b81e6d1c7a2085967406e86af0f08fcDmitry ShmidtDESCRIPTION:    Called by the un load function
1952981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                Go over the vector, for each bit that is set, release the corresponding module.
1953981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
1954981801b95b81e6d1c7a2085967406e86af0f08fcDmitry ShmidtINPUT:      pSiteMgr    -   site mgr handle.
1955981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            initVec -   Vector that contains a bit set for each module thah had been initiualized
1956981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
1957981801b95b81e6d1c7a2085967406e86af0f08fcDmitry ShmidtOUTPUT:
1958981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
1959981801b95b81e6d1c7a2085967406e86af0f08fcDmitry ShmidtRETURN:     TI_OK on success, TI_NOK otherwise
1960981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
1961981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt************************************************************************/
1962981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidtstatic void release_module(siteMgr_t *pSiteMgr, TI_UINT32 initVec)
1963981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt{
1964981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    if ( (initVec & (1 << MGMT_PARAMS_INIT_BIT)) && pSiteMgr->pSitesMgmtParams)
1965981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        os_memoryFree(pSiteMgr->hOs, pSiteMgr->pSitesMgmtParams, sizeof(sitesMgmtParams_t));
1966981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
1967981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    if ( (initVec & (1 << DESIRED_PARAMS_INIT_BIT)) && pSiteMgr->pDesiredParams)
1968981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        os_memoryFree(pSiteMgr->hOs, pSiteMgr->pDesiredParams, sizeof(siteMgrInitParams_t));
1969981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
1970981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    if (initVec & (1 << SITE_MGR_INIT_BIT))
1971981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        os_memoryFree(pSiteMgr->hOs, pSiteMgr, sizeof(siteMgr_t));
1972981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
1973981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    initVec = 0;
1974981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt}
1975981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
1976981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
1977981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidtstatic TI_BOOL isIeSsidBroadcast (dot11_SSID_t *pIESsid)
1978981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt{
1979981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    if ((pIESsid == NULL) || (pIESsid->hdr[1] == 0))
1980981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    {
1981981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        return TI_TRUE;
1982981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    }
1983981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
1984981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    /* According to 802.11, Broadcast SSID should be with length 0,
1985981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        however, different vendors use invalid chanrs for Broadcast SSID. */
1986981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    if (pIESsid->serviceSetId[0] < OS_802_11_SSID_FIRST_VALID_CHAR)
1987981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    {
1988981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        return TI_TRUE;
1989981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    }
1990981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
1991981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    return TI_FALSE;
1992981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt}
1993981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
1994981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
1995981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt/***********************************************************************
1996981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt *                        updateSiteInfo
1997981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt ***********************************************************************
1998981801b95b81e6d1c7a2085967406e86af0f08fcDmitry ShmidtDESCRIPTION:    Called upon receiving a beacon or probe response
1999981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                Go over the vector, for each bit that is set, release the corresponding module.
2000981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                Update theaite entry in the site table with the information received in the frame
2001981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
2002981801b95b81e6d1c7a2085967406e86af0f08fcDmitry ShmidtINPUT:      pSiteMgr    -   site mgr handle.
2003981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            pFrameInfo  -   Frame information after the parsing
2004981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            pSite       -   Pointer to the site entry in the site table
2005981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
2006981801b95b81e6d1c7a2085967406e86af0f08fcDmitry ShmidtOUTPUT:
2007981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
2008981801b95b81e6d1c7a2085967406e86af0f08fcDmitry ShmidtRETURN:     TI_OK on success, TI_NOK otherwise
2009981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
2010981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt************************************************************************/
2011981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidtstatic void updateSiteInfo(siteMgr_t *pSiteMgr, mlmeFrameInfo_t *pFrameInfo, siteEntry_t    *pSite, TI_UINT8 rxChannel)
2012981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt{
2013981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    paramInfo_t param;
2014981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    TI_BOOL        ssidUpdated = TI_FALSE;
2015981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
2016981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    switch (pFrameInfo->subType)
2017981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    {
2018981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    case BEACON:
2019981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
2020981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        UPDATE_BEACON_INTERVAL(pSite, pFrameInfo);
2021981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
2022981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        UPDATE_CAPABILITIES(pSite, pFrameInfo);
2023981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
2024981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
2025981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        /***********************************/
2026981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        /* Must be before UPDATE_PRIVACY and UPDATE_RSN_IE */
2027981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        if (pSite->ssid.len==0)
2028981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        {   /* Update the SSID only if the site's SSID is NULL */
2029981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            if (isIeSsidBroadcast(pFrameInfo->content.iePacket.pSsid) == TI_FALSE)
2030981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            {   /* And the SSID is not Broadcast */
2031981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                ssidUpdated = TI_TRUE;
2032981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                UPDATE_SSID(pSite, pFrameInfo);
2033981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            }
2034981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        }
2035981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        else if (pSiteMgr->pDesiredParams->siteMgrDesiredSSID.len > 0)
2036981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        {   /* There is a desired SSID */
2037981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            if (pFrameInfo->content.iePacket.pSsid != NULL)
2038981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            {
2039981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                if (os_memoryCompare (pSiteMgr->hOs,
2040981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                                      (TI_UINT8 *)pSiteMgr->pDesiredParams->siteMgrDesiredSSID.str,
2041981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                                      (TI_UINT8 *)pFrameInfo->content.iePacket.pSsid->serviceSetId,
2042981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                                      pSiteMgr->pDesiredParams->siteMgrDesiredSSID.len)==0)
2043981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                {   /* update only SSID that equals the desired SSID */
2044981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                    ssidUpdated = TI_TRUE;
2045981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                    UPDATE_SSID(pSite, pFrameInfo);
2046981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                }
2047981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            }
2048981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            else
2049981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            {
2050981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                TRACE0(pSiteMgr->hReport, REPORT_SEVERITY_ERROR, "updateSiteInfo BEACON, pSsid=NULL\n");
2051981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            }
2052981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        }
2053981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        /***********************************/
2054981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
2055981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        if (ssidUpdated)
2056981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        {
2057981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
2058981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            UPDATE_PRIVACY(pSite, pFrameInfo);
2059981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        }
2060981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
2061981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        update_apsd(pSite, pFrameInfo);
2062981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
2063981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        updatePreamble(pSiteMgr, pSite, pFrameInfo);
2064981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
2065981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        UPDATE_AGILITY(pSite, pFrameInfo);
2066981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
2067981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
2068981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        if(pSiteMgr->siteMgrOperationalMode == DOT11_G_MODE)
2069981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        {
2070981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            UPDATE_SLOT_TIME(pSite, pFrameInfo);
2071981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            UPDATE_PROTECTION(pSite, pFrameInfo);
2072981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        }
2073981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
2074981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        /* Updating HT params */
2075981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        siteMgr_UpdatHtParams (pSiteMgr, pSite, pFrameInfo);
2076981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
2077981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        updateRates(pSiteMgr, pSite, pFrameInfo);
2078981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
2079981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        if ((pFrameInfo->content.iePacket.pDSParamsSet != NULL)  &&
2080981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            (pFrameInfo->content.iePacket.pDSParamsSet->currChannel!=rxChannel))
2081981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        {
2082981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            TRACE2(pSiteMgr->hReport, REPORT_SEVERITY_ERROR, "updateSiteInfo, wrong CHANNELS:rxChannel=%d,currChannel=%d\n", rxChannel, pFrameInfo->content.iePacket.pDSParamsSet->currChannel);
2083981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        }
2084981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        else
2085981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            UPDATE_CHANNEL(pSite, pFrameInfo , rxChannel);
2086981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
2087981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
2088981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        UPDATE_BSS_TYPE(pSite, pFrameInfo);
2089981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
2090981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        if (pSite->bssType == BSS_INFRASTRUCTURE)
2091981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            UPDATE_DTIM_PERIOD(pSite, pFrameInfo);
2092981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
2093981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        UPDATE_ATIM_WINDOW(pSite, pFrameInfo);
2094981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
2095981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        UPDATE_BEACON_AP_TX_POWER(pSite, pFrameInfo);
2096981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
2097981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        /* Updating QoS params */
2098981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        updateBeaconQosParams(pSiteMgr, pSite, pFrameInfo);
2099981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
2100981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
2101981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        /* updating CountryIE  */
2102981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        if ((pFrameInfo->content.iePacket.country  != NULL) &&
2103981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt			(pFrameInfo->content.iePacket.country->hdr[1] != 0))
2104981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        {
2105981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            /* set the country info in the regulatory domain - If a different code was detected earlier
2106981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt               the regDomain will ignore it */
2107981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            param.paramType = REGULATORY_DOMAIN_COUNTRY_PARAM;
2108981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            param.content.pCountry = (TCountry *)pFrameInfo->content.iePacket.country;
2109981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            regulatoryDomain_setParam(pSiteMgr->hRegulatoryDomain,&param);
2110981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        }
2111981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
2112981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        /* Updating WSC params */
2113981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        updateWSCParams(pSiteMgr, pSite, pFrameInfo);
2114981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
2115981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        UPDATE_LOCAL_TIME_STAMP(pSiteMgr, pSite, pFrameInfo);
2116981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
2117981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        UPDATE_BEACON_MODULATION(pSite, pFrameInfo);
2118981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
2119981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        /* If the BSS type is independent, the beacon & probe modulation are equal,
2120981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            It is important to update this field here for dynamic PBCC algorithm compatibility */
2121981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        if (pSite->bssType == BSS_INDEPENDENT)
2122981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            UPDATE_PROBE_MODULATION(pSite, pFrameInfo);
2123981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
2124981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
2125981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        if (pSite->siteType == SITE_PRIMARY)
2126981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        {
2127981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
2128981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            if (pSiteMgr->pSitesMgmtParams->pPrimarySite == NULL)
2129981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            {
2130981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                TRACE0(pSiteMgr->hReport, REPORT_SEVERITY_ERROR, "updateSiteInfo: Primary Site Is NULL\n");
2131981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                pSite->siteType = SITE_REGULAR;
2132981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            }
2133981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            else
2134981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            {
2135981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                /*  If the site that we got the beacon on is the primary site - which means we are either trying */
2136981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                /*  to connect to it or we are already connected - send the EVENT_GOT_BEACON to the conn module (through the SME module) */
2137981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                /*  so the conn module will be aware of the beacon status of the site it's trying to connect to */
2138981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
2139981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt#ifdef XCC_MODULE_INCLUDED
2140981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                TI_INT8 ExternTxPower;
2141981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
2142981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                if (pFrameInfo->content.iePacket.cellTP != NULL)
2143981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                {
2144981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                    ExternTxPower = pFrameInfo->content.iePacket.cellTP->power;
2145981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                }
2146981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                else	/* Set to maximum possible. Note that we add +1 so that Dbm = 26 and not 25 */
2147981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                {
2148981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                    ExternTxPower = MAX_TX_POWER / DBM_TO_TX_POWER_FACTOR + 1;
2149981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                }
2150981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
2151981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                param.paramType = REGULATORY_DOMAIN_EXTERN_TX_POWER_PREFERRED;
2152981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                param.content.ExternTxPowerPreferred = ExternTxPower;
2153981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                regulatoryDomain_setParam(pSiteMgr->hRegulatoryDomain, &param);
2154981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt#endif
2155981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
2156981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                /* Updating the Tx Power according to the received Power Constraint  */
2157981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                if(pFrameInfo->content.iePacket.powerConstraint  != NULL)
2158981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                {   /* Checking if the recieved constraint is different from the one that is already known  */
2159981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                    if( pFrameInfo->content.iePacket.powerConstraint->powerConstraint != pSite->powerConstraint)
2160981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                    {   /* check if Spectrum Management is enabled */
2161981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                        param.paramType = REGULATORY_DOMAIN_MANAGEMENT_CAPABILITY_ENABLED_PARAM;
2162981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                        regulatoryDomain_getParam(pSiteMgr->hRegulatoryDomain,&param);
2163981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                        if(param.content.spectrumManagementEnabled)
2164981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                        {   /* setting power constraint */
2165981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                            pSite->powerConstraint = pFrameInfo->content.iePacket.powerConstraint->powerConstraint;
2166981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                            param.paramType = REGULATORY_DOMAIN_SET_POWER_CONSTRAINT_PARAM;
2167981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                            param.content.powerConstraint = pSite->powerConstraint;
2168981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                            regulatoryDomain_setParam(pSiteMgr->hRegulatoryDomain,&param);
2169981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
2170981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                        }
2171981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                    }
2172981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                }
2173981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                /* update HT Information IE at the FW whenever any of its relevant fields is changed. */
2174981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                if (pSite->bHtInfoUpdate == TI_TRUE)
2175981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                {
2176981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                    TI_BOOL b11nEnable, bWmeEnable;
2177981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
2178981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                    /* verify 11n_Enable and Chip type */
2179981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                    StaCap_IsHtEnable (pSiteMgr->hStaCap, &b11nEnable);
2180981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
2181981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                    /* verify that WME flag enable */
2182981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                    qosMngr_GetWmeEnableFlag (pSiteMgr->hQosMngr, &bWmeEnable);
2183981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
2184981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                    if ((b11nEnable != TI_FALSE) && (bWmeEnable != TI_FALSE))
2185981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                    {
2186981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                        TWD_CfgSetFwHtInformation (pSiteMgr->hTWD, &pSite->tHtInformation);
2187981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                    }
2188981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                }
2189981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            }
2190981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        }
2191981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
2192981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        UPDATE_BEACON_RECV(pSite);
2193981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
2194981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        if (ssidUpdated)
2195981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        {
2196981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            dot11_RSN_t *pRsnIe = pFrameInfo->content.iePacket.pRsnIe;
2197981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            TI_UINT8       rsnIeLen = pFrameInfo->content.iePacket.rsnIeLen;
2198981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            UPDATE_RSN_IE(pSite, pRsnIe, rsnIeLen);
2199981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        }
2200981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
2201981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        UPDATE_BEACON_TIMESTAMP(pSiteMgr, pSite, pFrameInfo);
2202981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
2203981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
2204981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
2205981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        TWD_UpdateDtimTbtt (pSiteMgr->hTWD, pSite->dtimPeriod, pSite->beaconInterval);
2206981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
2207981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        break;
2208981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
2209981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
2210981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    case PROBE_RESPONSE:
2211981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
2212981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        UPDATE_BEACON_INTERVAL(pSite, pFrameInfo);
2213981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
2214981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        UPDATE_CAPABILITIES(pSite, pFrameInfo);
2215981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
2216981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                ssidUpdated = TI_TRUE;
2217981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        if (pSite->siteType == SITE_PRIMARY)
2218981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        {   /* Primary SITE */
2219981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            if (pFrameInfo->content.iePacket.pSsid != NULL &&
2220981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                pSiteMgr->pDesiredParams->siteMgrDesiredSSID.len > 0)
2221981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            {   /* There's a desired SSID*/
2222981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                if (os_memoryCompare (pSiteMgr->hOs,
2223981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                                      (TI_UINT8*)pSiteMgr->pDesiredParams->siteMgrDesiredSSID.str,
2224981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                                      (TI_UINT8*)pFrameInfo->content.iePacket.pSsid->serviceSetId,
2225981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                                      pFrameInfo->content.iePacket.pSsid->hdr[1])!=0)
2226981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                {   /* Do not overwrite the primary site's SSID with a different than the desired SSID*/
2227981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                    ssidUpdated = TI_FALSE;
2228981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                }
2229981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
2230981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            }
2231981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            else if (pFrameInfo->content.iePacket.pSsid == NULL)
2232981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            {
2233981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                TRACE0(pSiteMgr->hReport, REPORT_SEVERITY_ERROR, "updateSiteInfo PROBE_RESP, pSsid=NULL\n");
2234981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            }
2235981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        }
2236981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
2237981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        if (ssidUpdated)
2238981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        {
2239981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            UPDATE_SSID(pSite, pFrameInfo);
2240981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            UPDATE_PRIVACY(pSite, pFrameInfo);
2241981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        }
2242981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
2243981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        update_apsd(pSite, pFrameInfo);
2244981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
2245981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
2246981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        if(pSiteMgr->siteMgrOperationalMode == DOT11_G_MODE)
2247981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        {
2248981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            UPDATE_PROTECTION(pSite, pFrameInfo);
2249981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        }
2250981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
2251981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        updatePreamble(pSiteMgr, pSite, pFrameInfo);
2252981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
2253981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        UPDATE_AGILITY(pSite, pFrameInfo);
2254981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
2255981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        /* Updating HT params */
2256981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        siteMgr_UpdatHtParams (pSiteMgr, pSite, pFrameInfo);
2257981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
2258981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        updateRates(pSiteMgr, pSite, pFrameInfo);
2259981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
2260981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        if ((pFrameInfo->content.iePacket.pDSParamsSet != NULL)  &&
2261981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            (pFrameInfo->content.iePacket.pDSParamsSet->currChannel!=rxChannel))
2262981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        {
2263981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            TRACE2(pSiteMgr->hReport, REPORT_SEVERITY_ERROR, "updateSiteInfo, wrong CHANNELS:rxChannel=%d,currChannel=%d\n", rxChannel, pFrameInfo->content.iePacket.pDSParamsSet->currChannel);
2264981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        }
2265981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        else
2266981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            UPDATE_CHANNEL(pSite, pFrameInfo, rxChannel);
2267981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
2268981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
2269981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        UPDATE_BSS_TYPE(pSite, pFrameInfo);
2270981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
2271981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        UPDATE_ATIM_WINDOW(pSite, pFrameInfo);
2272981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
2273981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        UPDATE_PROBE_AP_TX_POWER(pSite, pFrameInfo);
2274981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
2275981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        /* Updating WME params */
2276981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        updateProbeQosParams(pSiteMgr, pSite, pFrameInfo);
2277981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
2278981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
2279981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        /* updating CountryIE  */
2280981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        if ((pFrameInfo->content.iePacket.country  != NULL) &&
2281981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt			(pFrameInfo->content.iePacket.country->hdr[1] != 0))
2282981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        {
2283981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            /* set the country info in the regulatory domain - If a different code was detected earlier
2284981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt               the regDomain will ignore it */
2285981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            param.paramType = REGULATORY_DOMAIN_COUNTRY_PARAM;
2286981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            param.content.pCountry = (TCountry *)pFrameInfo->content.iePacket.country;
2287981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            regulatoryDomain_setParam(pSiteMgr->hRegulatoryDomain,&param);
2288981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        }
2289981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
2290981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        /* Updating WSC params */
2291981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        updateWSCParams(pSiteMgr, pSite, pFrameInfo);
2292981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
2293981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        UPDATE_LOCAL_TIME_STAMP(pSiteMgr, pSite, pFrameInfo);
2294981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
2295981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        UPDATE_PROBE_MODULATION(pSite, pFrameInfo);
2296981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
2297981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        /* If the BSS type is independent, the beacon & probe modulation are equal,
2298981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            It is important to update this field here for dynamic PBCC algorithm compatibility */
2299981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        if (pSite->bssType == BSS_INDEPENDENT)
2300981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            UPDATE_BEACON_MODULATION(pSite, pFrameInfo);
2301981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
2302981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        UPDATE_PROBE_RECV(pSite);
2303981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
2304981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        if (ssidUpdated)
2305981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        {
2306981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            dot11_RSN_t *pRsnIe = pFrameInfo->content.iePacket.pRsnIe;
2307981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            TI_UINT8       rsnIeLen = pFrameInfo->content.iePacket.rsnIeLen;
2308981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            UPDATE_RSN_IE(pSite, pRsnIe, rsnIeLen);
2309981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
2310981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        }
2311981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
2312981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        UPDATE_BEACON_TIMESTAMP(pSiteMgr, pSite, pFrameInfo);
2313981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
2314981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        break;
2315981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
2316981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    default:
2317981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        TRACE1(pSiteMgr->hReport, REPORT_SEVERITY_ERROR, "Site Update failure, un known frame sub type %d\n\n", pFrameInfo->subType);
2318981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        break;
2319981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    }
2320981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt}
2321981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
2322981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt/***********************************************************************
2323981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt *                        updatePreamble
2324981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt ***********************************************************************
2325981801b95b81e6d1c7a2085967406e86af0f08fcDmitry ShmidtDESCRIPTION:    Called by the function 'updateSiteInfo()'
2326981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
2327981801b95b81e6d1c7a2085967406e86af0f08fcDmitry ShmidtINPUT:      pSiteMgr    -   site mgr handle.
2328981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            pFrameInfo  -   Frame information after the parsing
2329981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            pSite       -   Pointer to the site entry in the site table
2330981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
2331981801b95b81e6d1c7a2085967406e86af0f08fcDmitry ShmidtOUTPUT:
2332981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
2333981801b95b81e6d1c7a2085967406e86af0f08fcDmitry ShmidtRETURN:
2334981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
2335981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt************************************************************************/
2336981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidtstatic void updatePreamble(siteMgr_t *pSiteMgr, siteEntry_t *pSite, mlmeFrameInfo_t *pFrameInfo)
2337981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt{
2338981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    pSite->currentPreambleType = ((pFrameInfo->content.iePacket.capabilities >> CAP_PREAMBLE_SHIFT) & CAP_PREAMBLE_MASK) ? PREAMBLE_SHORT : PREAMBLE_LONG;
2339981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
2340981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    pSite->barkerPreambleType = pFrameInfo->content.iePacket.barkerPreambleMode;
2341981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt}
2342981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
2343981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt/***********************************************************************
2344981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt *                        updateBeaconQosParams
2345981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt ***********************************************************************
2346981801b95b81e6d1c7a2085967406e86af0f08fcDmitry ShmidtDESCRIPTION:    Called by the function 'updateSiteInfo()'
2347981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
2348981801b95b81e6d1c7a2085967406e86af0f08fcDmitry ShmidtINPUT:      pSiteMgr    -   site mgr handle.
2349981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            pFrameInfo  -   Frame information after the parsing
2350981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            pSite       -   Pointer to the site entry in the site table
2351981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
2352981801b95b81e6d1c7a2085967406e86af0f08fcDmitry ShmidtOUTPUT:
2353981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
2354981801b95b81e6d1c7a2085967406e86af0f08fcDmitry ShmidtRETURN:
2355981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
2356981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt************************************************************************/
2357981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
2358981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidtstatic void updateBeaconQosParams(siteMgr_t *pSiteMgr, siteEntry_t *pSite, mlmeFrameInfo_t *pFrameInfo)
2359981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt{
2360981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    /* Updating WME params */
2361981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    if (pFrameInfo->content.iePacket.WMEParams  != NULL)
2362981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    {
2363981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        /* Checking if this is IE includes new WME Parameters */
2364981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        if(( ((pFrameInfo->content.iePacket.WMEParams->ACInfoField) & dot11_WME_ACINFO_MASK ) != pSite->lastWMEParameterCnt) ||
2365981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            (!pSite->WMESupported) )
2366981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        {
2367981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            pSite->WMESupported = TI_TRUE;
2368981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
2369981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            /* Checking if this IE is information only or is a paremeters IE */
2370981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            if(pFrameInfo->content.iePacket.WMEParams->OUISubType == dot11_WME_OUI_SUB_TYPE_PARAMS_IE)
2371981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            {
2372981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                if(pSite->siteType == SITE_PRIMARY)
2373981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                {
2374981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                    qosMngr_updateIEinfo(pSiteMgr->hQosMngr,(TI_UINT8 *)(pFrameInfo->content.iePacket.WMEParams), QOS_WME);
2375981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                }
2376981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                /* updating the QOS_WME paraeters into the site table. */
2377981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                os_memoryCopy(pSiteMgr->hOs, &pSite->WMEParameters, &(pFrameInfo->content.iePacket.WMEParams->WME_ACParameteres), sizeof( dot11_ACParameters_t));
2378981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                pSite->lastWMEParameterCnt = (pFrameInfo->content.iePacket.WMEParams->ACInfoField) & dot11_WME_ACINFO_MASK;
2379981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                TRACE1(pSiteMgr->hReport, REPORT_SEVERITY_INFORMATION, "$$$$$$ QOS_WME parameters were updates according to beacon, cntSeq = %d\n",pSite->lastWMEParameterCnt);
2380981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            }
2381981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        }
2382981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    }else
2383981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    {
2384981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        pSite->WMESupported = TI_FALSE;
2385981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        }
2386981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
2387981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt}
2388981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
2389981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt/***********************************************************************
2390981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt *                        updateProbeQosParams
2391981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt ***********************************************************************
2392981801b95b81e6d1c7a2085967406e86af0f08fcDmitry ShmidtDESCRIPTION:    Called by the function 'updateSiteInfo()'
2393981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
2394981801b95b81e6d1c7a2085967406e86af0f08fcDmitry ShmidtINPUT:      pSiteMgr    -   site mgr handle.
2395981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            pFrameInfo  -   Frame information after the parsing
2396981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            pSite       -   Pointer to the site entry in the site table
2397981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
2398981801b95b81e6d1c7a2085967406e86af0f08fcDmitry ShmidtOUTPUT:
2399981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
2400981801b95b81e6d1c7a2085967406e86af0f08fcDmitry ShmidtRETURN:
2401981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
2402981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt************************************************************************/
2403981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidtstatic void updateProbeQosParams(siteMgr_t *pSiteMgr, siteEntry_t *pSite, mlmeFrameInfo_t *pFrameInfo)
2404981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt{
2405981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    /* Updating QOS_WME params */
2406981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    if (pFrameInfo->content.iePacket.WMEParams  != NULL)
2407981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    {
2408981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        /* Checking if this is IE includes new QOS_WME Parameters */
2409981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        if(( ((pFrameInfo->content.iePacket.WMEParams->ACInfoField) & dot11_WME_ACINFO_MASK ) != pSite->lastWMEParameterCnt) ||
2410981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            (!pSite->WMESupported) )
2411981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        {
2412981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            pSite->WMESupported = TI_TRUE;
2413981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
2414981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            /* Checking if this IE is information only or is a paremeters IE */
2415981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            if(pFrameInfo->content.iePacket.WMEParams->OUISubType == dot11_WME_OUI_SUB_TYPE_PARAMS_IE)
2416981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            {
2417981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                if(pSite->siteType == SITE_PRIMARY)
2418981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                {
2419981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                    qosMngr_updateIEinfo(pSiteMgr->hQosMngr,(TI_UINT8 *)(pFrameInfo->content.iePacket.WMEParams),QOS_WME);
2420981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                }
2421981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                /* updating the QOS_WME paraeters into the site table. */
2422981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                os_memoryCopy(pSiteMgr->hOs, &pSite->WMEParameters, &(pFrameInfo->content.iePacket.WMEParams->WME_ACParameteres), sizeof( dot11_ACParameters_t));
2423981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                pSite->lastWMEParameterCnt = (pFrameInfo->content.iePacket.WMEParams->ACInfoField) & dot11_WME_ACINFO_MASK;
2424981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                TRACE1(pSiteMgr->hReport, REPORT_SEVERITY_INFORMATION, "$$$$$$ QOS_WME parameters were updates according to  probe response, cntSeq = %d\n",pSite->lastWMEParameterCnt);
2425981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            }
2426981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        }
2427981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    }else
2428981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    {
2429981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        pSite->WMESupported = TI_FALSE;
2430981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        }
2431981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
2432981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt}
2433981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
2434981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt/***********************************************************************
2435981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt *                        siteMgr_UpdatHtParams
2436981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt ***********************************************************************
2437981801b95b81e6d1c7a2085967406e86af0f08fcDmitry ShmidtDESCRIPTION:    Called by the function 'updateSiteInfo()'
2438981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
2439981801b95b81e6d1c7a2085967406e86af0f08fcDmitry ShmidtINPUT:      pSiteMgr    -   site mgr handle.
2440981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            pSite       -   Pointer to the site entry in the site table
2441981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            pFrameInfo  -   Frame information after the parsing
2442981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
2443981801b95b81e6d1c7a2085967406e86af0f08fcDmitry ShmidtOUTPUT:
2444981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
2445981801b95b81e6d1c7a2085967406e86af0f08fcDmitry ShmidtRETURN:
2446981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
2447981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt************************************************************************/
2448981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidtstatic void siteMgr_UpdatHtParams (siteMgr_t *pSiteMgr, siteEntry_t *pSite, mlmeFrameInfo_t *pFrameInfo)
2449981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt{
2450981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    /* Updating HT capabilites IE params */
2451981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    if (pFrameInfo->content.iePacket.pHtCapabilities != NULL)
2452981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    {
2453981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	   /* updating the HT capabilities unparse format into the site table. */
2454981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt       os_memoryCopy (pSiteMgr->hOs, &pSite->tHtCapabilities,
2455981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                      (TI_UINT8 *)(pFrameInfo->content.iePacket.pHtCapabilities),
2456981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                      sizeof(Tdot11HtCapabilitiesUnparse));
2457981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
2458981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt       TRACE0(pSiteMgr->hReport, REPORT_SEVERITY_INFORMATION , "$$$$$$ HT capabilites parameters were updates.\n");
2459981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    }
2460981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    else
2461981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    {
2462981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        pSite->tHtCapabilities.tHdr[0] = TI_FALSE;
2463981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    }
2464981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
2465981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    /* Updating HT Information IE params */
2466981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	if (pFrameInfo->content.iePacket.pHtInformation != NULL)
2467981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	{
2468981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	   /* update in case different setting vlaue from the last one */
2469981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt       if (os_memoryCompare (pSiteMgr->hOs,
2470653850f71f9caaa41af19cadbab24bb5e655daf4Dmitry Shmidt                             (TI_UINT8 *)&pSite->tHtInformation,
2471981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                             (TI_UINT8 *)pFrameInfo->content.iePacket.pHtInformation,
2472981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                             sizeof(Tdot11HtInformationUnparse)) != 0)
2473981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt       {
2474981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt           pSite->bHtInfoUpdate = TI_TRUE;
2475981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt           /* updating the HT Information unparse pormat into the site table. */
2476653850f71f9caaa41af19cadbab24bb5e655daf4Dmitry Shmidt           os_memoryCopy (pSiteMgr->hOs, &pSite->tHtInformation, pFrameInfo->content.iePacket.pHtInformation, sizeof(Tdot11HtInformationUnparse));
2477981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt           TRACE0(pSiteMgr->hReport, REPORT_SEVERITY_INFORMATION , "$$$$$$ HT Information parameters were updates.\n");
2478981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt       }
2479981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt       else
2480981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt       {
2481981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt           pSite->bHtInfoUpdate = TI_FALSE;
2482981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt       }
2483981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    }
2484981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	else
2485981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    {
2486981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt		pSite->tHtInformation.tHdr[0] = TI_FALSE;
2487981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    }
2488981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt}
2489981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
2490981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
2491981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt/***********************************************************************
2492981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt *                        updateWSCParams
2493981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt ***********************************************************************
2494981801b95b81e6d1c7a2085967406e86af0f08fcDmitry ShmidtDESCRIPTION:    Called by the function 'updateSiteInfo()'
2495981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
2496981801b95b81e6d1c7a2085967406e86af0f08fcDmitry ShmidtINPUT:      pSiteMgr    -   site mgr handle.
2497981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            pFrameInfo  -   Frame information after the parsing
2498981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            pSite       -   Pointer to the site entry in the site table
2499981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
2500981801b95b81e6d1c7a2085967406e86af0f08fcDmitry ShmidtOUTPUT:
2501981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
2502981801b95b81e6d1c7a2085967406e86af0f08fcDmitry ShmidtRETURN:
2503981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
2504981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt************************************************************************/
2505981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidtstatic void updateWSCParams(siteMgr_t *pSiteMgr, siteEntry_t *pSite, mlmeFrameInfo_t *pFrameInfo)
2506981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt{
2507981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt   int res;
2508981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
2509981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt   TRACE6(pSiteMgr->hReport, REPORT_SEVERITY_INFORMATION, "updateWSCParams called (BSSID: %X-%X-%X-%X-%X-%X)\n",pSite->bssid[0], pSite->bssid[1], pSite->bssid[2], pSite->bssid[3], pSite->bssid[4], pSite->bssid[5]);
2510981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
2511981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	/* if the IE is not null => the WSC is on - check which method is supported */
2512981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	if (pFrameInfo->content.iePacket.WSCParams  != NULL)
2513981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	{
2514981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt         res = parseWscMethodFromIE (pSiteMgr, pFrameInfo->content.iePacket.WSCParams, &pSite->WSCSiteMode);
2515981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
2516981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt         TRACE1(pSiteMgr->hReport, REPORT_SEVERITY_INFORMATION, "pSite->WSCSiteMode = %d\n",pSite->WSCSiteMode);
2517981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	}
2518981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	else
2519981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	{
2520981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt			pSite->WSCSiteMode = TIWLN_SIMPLE_CONFIG_OFF;
2521981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	}
2522981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
2523981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt}
2524981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
2525981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidtstatic int parseWscMethodFromIE (siteMgr_t *pSiteMgr, dot11_WSC_t *WSCParams, TIWLN_SIMPLE_CONFIG_MODE *pSelectedMethod)
2526981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt{
2527981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt   TI_UINT8 *tlvPtr,*endPtr;
2528981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt   TI_UINT16   tlvPtrType,tlvPtrLen,selectedMethod=0;
2529981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
2530981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt   tlvPtr = (TI_UINT8*)WSCParams->WSCBeaconOrProbIE;
2531981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt   endPtr = tlvPtr + WSCParams->hdr[1] - (DOT11_OUI_LEN + 1);
2532981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
2533981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt   do
2534981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt   {
2535981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt      os_memoryCopy (pSiteMgr->hOs, (void *)&tlvPtrType, (void *)tlvPtr, 2);
2536981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt      tlvPtrType = WLANTOHS(tlvPtrType);
2537981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
2538981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt      /*if (tlvPtrType == DOT11_WSC_SELECTED_REGISTRAR_CONFIG_METHODS)*/
2539981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt      if (tlvPtrType == DOT11_WSC_DEVICE_PASSWORD_ID)
2540981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt      {
2541981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt         tlvPtr+=2;
2542981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt         tlvPtr+=2;
2543981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt         os_memoryCopy (pSiteMgr->hOs, (void *)&selectedMethod, (void *)tlvPtr, 2);
2544981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt         selectedMethod = WLANTOHS (selectedMethod);
2545981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt         break;
2546981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt      }
2547981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt      else
2548981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt      {
2549981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt         tlvPtr+=2;
2550981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt         os_memoryCopy (pSiteMgr->hOs, (void *)&tlvPtrLen, (void *)tlvPtr, 2);
2551981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt         tlvPtrLen = WLANTOHS (tlvPtrLen);
2552981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt         tlvPtr+=tlvPtrLen+2;
2553981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt      }
2554981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt   } while ((tlvPtr < endPtr) && (selectedMethod == 0));
2555981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
2556981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt   if (tlvPtr >= endPtr)
2557981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt   {
2558981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt      return TI_NOK;
2559981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt   }
2560981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
2561981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt   if (selectedMethod == DOT11_WSC_DEVICE_PASSWORD_ID_PIN)
2562981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt      *pSelectedMethod = TIWLN_SIMPLE_CONFIG_PIN_METHOD;
2563981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt   else if (selectedMethod == DOT11_WSC_DEVICE_PASSWORD_ID_PBC)
2564981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt      *pSelectedMethod = TIWLN_SIMPLE_CONFIG_PBC_METHOD;
2565981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt   else return TI_NOK;
2566981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
2567981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt   return TI_OK;
2568981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt}
2569981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
2570981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
2571981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt/***********************************************************************
2572981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt *                        updateRates
2573981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt ***********************************************************************
2574981801b95b81e6d1c7a2085967406e86af0f08fcDmitry ShmidtDESCRIPTION:    Called by the function 'updateSiteInfo()' in order to translate the rates received
2575981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                in the beacon or probe response to rate used by the driver. Perfoms the following:
2576981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                    -   Check the rates validity. If rates are invalid, return
2577981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                    -   Get the max active rate & max basic rate, if invalid, return
2578981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                    -   Translate the max active rate and max basic rate from network rates to host rates.
2579981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                        The max active & max basic rate are used by the driver from now on in all the processes:
2580981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                        (selection, join, transmission, etc....)
2581981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
2582981801b95b81e6d1c7a2085967406e86af0f08fcDmitry ShmidtINPUT:      pSiteMgr    -   site mgr handle.
2583981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            pFrameInfo  -   Frame information after the parsing
2584981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            pSite       -   Pointer to the site entry in the site table
2585981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
2586981801b95b81e6d1c7a2085967406e86af0f08fcDmitry ShmidtOUTPUT:
2587981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
2588981801b95b81e6d1c7a2085967406e86af0f08fcDmitry ShmidtRETURN:     TI_OK on success, TI_NOK otherwise
2589981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
2590981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt************************************************************************/
2591981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidtstatic void updateRates(siteMgr_t *pSiteMgr, siteEntry_t *pSite, mlmeFrameInfo_t *pFrameInfo)
2592981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt{
2593981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    TI_UINT8   maxBasicRate = 0, maxActiveRate = 0;
2594981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    TI_UINT32  bitMapExtSupp = 0;
2595981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    paramInfo_t param;
2596981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    TI_UINT32   uMcsbasicRateMask, uMcsSupportedRateMask;
2597981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
2598981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    if (pFrameInfo->content.iePacket.pRates == NULL)
2599981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    {
2600981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        TRACE0(pSiteMgr->hReport, REPORT_SEVERITY_ERROR, "updateRates, pRates=NULL, beacon & probeResp are: \n");
2601981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        return;
2602981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    }
2603981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
2604981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    /* Update the rate elements */
2605981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    maxBasicRate = rate_GetMaxBasicFromStr ((TI_UINT8 *)pFrameInfo->content.iePacket.pRates->rates,pFrameInfo->content.iePacket.pRates->hdr[1], maxBasicRate);
2606981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    maxActiveRate = rate_GetMaxActiveFromStr ((TI_UINT8 *)pFrameInfo->content.iePacket.pRates->rates,pFrameInfo->content.iePacket.pRates->hdr[1], maxActiveRate);
2607981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
2608981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    if(pFrameInfo->content.iePacket.pExtRates)
2609981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    {
2610981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        maxBasicRate = rate_GetMaxBasicFromStr ((TI_UINT8 *)pFrameInfo->content.iePacket.pExtRates->rates,pFrameInfo->content.iePacket.pExtRates->hdr[1], maxBasicRate);
2611981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        maxActiveRate = rate_GetMaxActiveFromStr ((TI_UINT8 *)pFrameInfo->content.iePacket.pExtRates->rates,pFrameInfo->content.iePacket.pExtRates->hdr[1], maxActiveRate);
2612981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    }
2613981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
2614981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
2615981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    /*
2616981801b95b81e6d1c7a2085967406e86af0f08fcDmitry ShmidtTRACE2(pSiteMgr->hReport, REPORT_SEVERITY_INFORMATION, "1- maxBasicRate = 0x%X, maxActiveRate = 0x%X \n", maxBasicRate,maxActiveRate);
2617981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	*/
2618981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
2619981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    if (maxActiveRate == 0)
2620981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        maxActiveRate = maxBasicRate;
2621981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
2622981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    /* Now update it from network to host rates */
2623981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    pSite->maxBasicRate = rate_NetToDrv (maxBasicRate);
2624981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    pSite->maxActiveRate = rate_NetToDrv (maxActiveRate);
2625981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
2626981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    /* for now we use constat MCS rate */
2627981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    if (pFrameInfo->content.iePacket.pHtInformation != NULL)
2628981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    {
2629981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        pSite->maxBasicRate = DRV_RATE_MCS_7;
2630981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        pSite->maxActiveRate = DRV_RATE_MCS_7;
2631981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    }
2632981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
2633981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    if (pSite->maxActiveRate == DRV_RATE_INVALID)
2634981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            TRACE0(pSiteMgr->hReport, REPORT_SEVERITY_ERROR, "Network To Host Rate failure, no active network rate\n");
2635981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
2636981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    if (pSite->maxBasicRate != DRV_RATE_INVALID)
2637981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    {
2638981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        if (pSite->maxActiveRate != DRV_RATE_INVALID)
2639981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        {
2640981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            pSite->maxActiveRate = TI_MAX (pSite->maxActiveRate, pSite->maxBasicRate);
2641981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        }
2642981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    } else { /* in case some vendors don't specify basic rates */
2643981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        TRACE0(pSiteMgr->hReport, REPORT_SEVERITY_WARNING, "Network To Host Rate failure, no basic network rate");
2644981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        pSite->maxBasicRate = pSite->maxActiveRate;
2645981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    }
2646981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
2647981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    /* build rates bit map */
2648981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    rate_NetStrToDrvBitmap (&pSite->rateMask.supportedRateMask,
2649981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                            pFrameInfo->content.iePacket.pRates->rates,
2650981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                            pFrameInfo->content.iePacket.pRates->hdr[1]);
2651981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    rate_NetBasicStrToDrvBitmap (&pSite->rateMask.basicRateMask,
2652981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                                 pFrameInfo->content.iePacket.pRates->rates,
2653981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                                 pFrameInfo->content.iePacket.pRates->hdr[1]);
2654981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
2655981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    if(pFrameInfo->content.iePacket.pExtRates)
2656981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    {
2657981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        rate_NetStrToDrvBitmap (&bitMapExtSupp,
2658981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                                pFrameInfo->content.iePacket.pExtRates->rates,
2659981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                                       pFrameInfo->content.iePacket.pExtRates->hdr[1]);
2660981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
2661981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        pSite->rateMask.supportedRateMask |= bitMapExtSupp;
2662981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
2663981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        rate_NetBasicStrToDrvBitmap (&bitMapExtSupp,
2664981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                                     pFrameInfo->content.iePacket.pExtRates->rates,
2665981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                                        pFrameInfo->content.iePacket.pExtRates->hdr[1]);
2666981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
2667981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        pSite->rateMask.basicRateMask |= bitMapExtSupp;
2668981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    }
2669981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
2670981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
2671981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    if (pFrameInfo->content.iePacket.pHtCapabilities != NULL)
2672981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    {
2673981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        /* MCS build rates bit map */
2674981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        rate_McsNetStrToDrvBitmap (&uMcsSupportedRateMask,
2675981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                                   (pFrameInfo->content.iePacket.pHtCapabilities->aHtCapabilitiesIe + DOT11_HT_CAPABILITIES_MCS_RATE_OFFSET));
2676981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
2677981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        pSite->rateMask.supportedRateMask |= uMcsSupportedRateMask;
2678981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    }
2679981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
2680981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    if (pFrameInfo->content.iePacket.pHtInformation != NULL)
2681981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    {
2682981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        /* MCS build rates bit map */
2683981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        rate_McsNetStrToDrvBitmap (&uMcsbasicRateMask,
2684981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                                   (pFrameInfo->content.iePacket.pHtInformation->aHtInformationIe + DOT11_HT_INFORMATION_MCS_RATE_OFFSET));
2685981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
2686981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        pSite->rateMask.basicRateMask |= uMcsbasicRateMask;
2687981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    }
2688981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
2689981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
2690981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    param.paramType = CTRL_DATA_CURRENT_SUPPORTED_RATE_MASK_PARAM;
2691981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    param.content.ctrlDataCurrentRateMask = pSite->rateMask.supportedRateMask;
2692981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    /* clear the 22Mbps bit in case the PBCC is not allowed */
2693981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    if(pSiteMgr->currentDataModulation != DRV_MODULATION_PBCC && pSiteMgr->currentDataModulation != DRV_MODULATION_OFDM)
2694981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    {
2695981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt      param.content.ctrlDataCurrentRateMask &= ~DRV_RATE_MASK_22_PBCC;
2696981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    }
2697981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    ctrlData_setParam(pSiteMgr->hCtrlData, &param);
2698981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt}
2699981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
2700981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt/***********************************************************************
2701981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt *                        getPrimaryBssid
2702981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt ***********************************************************************
2703981801b95b81e6d1c7a2085967406e86af0f08fcDmitry ShmidtDESCRIPTION:    Called by the OS abstraction layer in order to get the BSSID list from the site table
2704981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
2705981801b95b81e6d1c7a2085967406e86af0f08fcDmitry ShmidtINPUT:      pSiteMgr    -   site mgr handle.
2706981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
2707981801b95b81e6d1c7a2085967406e86af0f08fcDmitry ShmidtOUTPUT:     bssidList   -   BSSID list pointer
2708981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
2709981801b95b81e6d1c7a2085967406e86af0f08fcDmitry ShmidtRETURN:
2710981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
2711981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt************************************************************************/
2712981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidtstatic TI_STATUS getPrimaryBssid(siteMgr_t *pSiteMgr, OS_802_11_BSSID_EX *primaryBssid, TI_UINT32 *pLength)
2713981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt{
2714981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    siteEntry_t *pPrimarySite = pSiteMgr->pSitesMgmtParams->pPrimarySite;
2715981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    TI_UINT32                  len, firstOFDMloc = 0;
2716981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    OS_802_11_FIXED_IEs     *pFixedIes;
2717981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    OS_802_11_VARIABLE_IEs  *pVarIes;
2718981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    TI_UINT32                  length;
2719981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
2720981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
2721981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    if ((primaryBssid==NULL) || (pLength==NULL))
2722981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    {
2723981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        *pLength = 0;
2724653850f71f9caaa41af19cadbab24bb5e655daf4Dmitry Shmidt        TRACE1(pSiteMgr->hReport, REPORT_SEVERITY_ERROR, "getPrimaryBssid, one of the ptr is NULL, primaryBssid=%p, pLength is NULL\n", primaryBssid);
2725981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        return TI_NOK;
2726981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
2727981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    }
2728981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
2729981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    if (pPrimarySite==NULL)
2730981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    {
2731981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        *pLength = 0;
2732981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        TRACE0(pSiteMgr->hReport, REPORT_SEVERITY_INFORMATION, "getPrimaryBssid, pPrimarySite is NULL \n");
2733981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        return TI_NOK;
2734981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
2735981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    }
2736981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    length = pPrimarySite->beaconLength + sizeof(OS_802_11_BSSID_EX) + sizeof(OS_802_11_FIXED_IEs);
2737981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    if (length > *pLength)
2738981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    {
2739981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        TRACE2(pSiteMgr->hReport, REPORT_SEVERITY_INFORMATION, "getPrimaryBssid, insufficient length,  required length=%d, pLength=%d \n", length, *pLength);
2740981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        *pLength = length;
2741981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
2742981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        return TI_NOK;
2743981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    }
2744981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
2745981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    TRACE1(pSiteMgr->hReport, REPORT_SEVERITY_INFORMATION, "Entering getPrimaryBssid, length = %d\n", *pLength);
2746981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
2747981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    primaryBssid->Length = length;
2748981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    /* MacAddress */
2749981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    MAC_COPY (primaryBssid->MacAddress, pPrimarySite->bssid);
2750981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
2751981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    /* Capabilities */
2752981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    primaryBssid->Capabilities = pPrimarySite->capabilities;
2753981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
2754981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    /* SSID */
2755981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    os_memoryZero(pSiteMgr->hOs, primaryBssid->Ssid.Ssid, MAX_SSID_LEN);
2756981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    if (pPrimarySite->ssid.len > MAX_SSID_LEN)
2757981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    {
2758981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        pPrimarySite->ssid.len = MAX_SSID_LEN;
2759981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    }
2760981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    os_memoryCopy (pSiteMgr->hOs,
2761981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                   (void *)primaryBssid->Ssid.Ssid,
2762981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                   (void *)pPrimarySite->ssid.str,
2763981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                   pPrimarySite->ssid.len);
2764981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    primaryBssid->Ssid.SsidLength = pPrimarySite->ssid.len;
2765981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
2766981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    /* privacy */
2767981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    primaryBssid->Privacy = pPrimarySite->privacy;
2768981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
2769981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    /* RSSI */
2770981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    primaryBssid->Rssi = pPrimarySite->rssi;
2771981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
2772981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    /* NetworkTypeInUse & SupportedRates */
2773981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    /* SupportedRates */
2774981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    os_memoryZero(pSiteMgr->hOs, (void *)primaryBssid->SupportedRates, sizeof(OS_802_11_RATES_EX));
2775981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
2776981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    rate_DrvBitmapToNetStr (pPrimarySite->rateMask.supportedRateMask,
2777981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                            pPrimarySite->rateMask.basicRateMask,
2778981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                            (TI_UINT8 *)primaryBssid->SupportedRates,
2779981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                            &len,
2780981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                            &firstOFDMloc);
2781981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
2782981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    /* set network type acording to band and rates */
2783981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    if (pPrimarySite->channel <= SITE_MGR_CHANNEL_B_G_MAX)
2784981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    {
2785981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        if (firstOFDMloc == len)
2786981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        {
2787981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            primaryBssid->NetworkTypeInUse = os802_11DS;
2788981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        } else {
2789981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            primaryBssid->NetworkTypeInUse = os802_11OFDM24;
2790981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        }
2791981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    } else {
2792981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        primaryBssid->NetworkTypeInUse = os802_11OFDM5;
2793981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    }
2794981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
2795981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    /* Configuration */
2796981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    primaryBssid->Configuration.Length = sizeof(OS_802_11_CONFIGURATION);
2797981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    primaryBssid->Configuration.BeaconPeriod = pPrimarySite->beaconInterval;
2798981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    primaryBssid->Configuration.ATIMWindow = pPrimarySite->atimWindow;
2799981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    primaryBssid->Configuration.Union.channel = Chan2Freq(pPrimarySite->channel);
2800981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
2801981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    /* InfrastructureMode */
2802981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    if  (pPrimarySite->bssType == BSS_INDEPENDENT)
2803981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        primaryBssid->InfrastructureMode = os802_11IBSS;
2804981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    else
2805981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        primaryBssid->InfrastructureMode = os802_11Infrastructure;
2806981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    primaryBssid->IELength = 0;
2807981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
2808981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    /* copy fixed IEs from site entry */
2809981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    pFixedIes = (OS_802_11_FIXED_IEs*)&primaryBssid->IEs[primaryBssid->IELength];
2810981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    os_memoryCopy(pSiteMgr->hOs, (void *)pFixedIes->TimeStamp, (void *)&pPrimarySite->tsfTimeStamp, TIME_STAMP_LEN);
2811981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    pFixedIes->BeaconInterval = pPrimarySite->beaconInterval;
2812981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    pFixedIes->Capabilities = pPrimarySite->capabilities;
2813981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    primaryBssid->IELength += sizeof(OS_802_11_FIXED_IEs);
2814981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    pVarIes = (OS_802_11_VARIABLE_IEs*)&primaryBssid->IEs[primaryBssid->IELength];
2815981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
2816981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    /* Copy all variable IEs */
2817981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    TRACE2(pSiteMgr->hReport, REPORT_SEVERITY_INFORMATION, "Copy all variable beaconLength=%d, IELength=%d\n", pPrimarySite->beaconLength, primaryBssid->IELength);
2818981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    TRACE_INFO_HEX(pSiteMgr->hReport, pPrimarySite->beaconBuffer, pPrimarySite->beaconLength);
2819981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
2820981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    os_memoryCopy(pSiteMgr->hOs, pVarIes, pPrimarySite->beaconBuffer, pPrimarySite->beaconLength);
2821981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
2822981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    primaryBssid->IELength += pPrimarySite->beaconLength;
2823981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
2824981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
2825981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    primaryBssid->Length = sizeof(OS_802_11_BSSID_EX) + primaryBssid->IELength - 1;
2826981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
2827981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    TRACE6(pSiteMgr->hReport, REPORT_SEVERITY_INFORMATION, "BSSID MAC = %x-%x-%x-%x-%x-%x\n", primaryBssid->MacAddress[0], primaryBssid->MacAddress[1], primaryBssid->MacAddress[2], primaryBssid->MacAddress[3], primaryBssid->MacAddress[4], primaryBssid->MacAddress[5]);
2828981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
2829981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
2830981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    TRACE0(pSiteMgr->hReport, REPORT_SEVERITY_INFORMATION, "primaryBssid is\n");
2831981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    TRACE_INFO_HEX(pSiteMgr->hReport, (TI_UINT8*)primaryBssid, primaryBssid->Length);
2832981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
2833981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
2834981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    TRACE2(pSiteMgr->hReport, REPORT_SEVERITY_INFORMATION, "Exiting getBssidList, length =%d, IELength=%d \n", primaryBssid->Length, primaryBssid->IELength);
2835981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
2836981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    *pLength = primaryBssid->Length;
2837981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
2838981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    return TI_OK;
2839981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt}
2840981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
2841981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt#ifdef REPORT_LOG
2842981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt/***********************************************************************
2843981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt *                        siteMgr_printPrimarySiteDesc
2844981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt ***********************************************************************
2845981801b95b81e6d1c7a2085967406e86af0f08fcDmitry ShmidtDESCRIPTION:    Called by the OS abstraction layer in order to get the primary site description
2846981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
2847981801b95b81e6d1c7a2085967406e86af0f08fcDmitry ShmidtINPUT:      pSiteMgr            -   site mgr handle.
2848981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            supplyExtendedInfo  - If OS_802_11_BSSID_EX structure should be used (extended info)
2849981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                                  (Assuming that if this function is called with TI_TRUE, enough memory was allocated to hold the extended info)
2850981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
2851981801b95b81e6d1c7a2085967406e86af0f08fcDmitry ShmidtOUTPUT:     pPrimarySiteDesc    -   Primary site description pointer
2852981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
2853981801b95b81e6d1c7a2085967406e86af0f08fcDmitry ShmidtRETURN:
2854981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
2855981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt************************************************************************/
2856981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidtvoid siteMgr_printPrimarySiteDesc(TI_HANDLE hSiteMgr )
2857981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt{
2858653850f71f9caaa41af19cadbab24bb5e655daf4Dmitry Shmidt    siteMgr_t *pSiteMgr = (siteMgr_t*) hSiteMgr;
2859981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
2860653850f71f9caaa41af19cadbab24bb5e655daf4Dmitry Shmidt    siteEntry_t *pPrimarySite = pSiteMgr->pSitesMgmtParams->pPrimarySite;
2861981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
2862653850f71f9caaa41af19cadbab24bb5e655daf4Dmitry Shmidt    /* the driver logger can't print %s
2863653850f71f9caaa41af19cadbab24bb5e655daf4Dmitry Shmidt     * TRACE1(pSiteMgr->hReport, REPORT_SEVERITY_CONSOLE, "-- SSID  = %s \n",pPrimarySite->ssid.str);
2864653850f71f9caaa41af19cadbab24bb5e655daf4Dmitry Shmidt     */
2865653850f71f9caaa41af19cadbab24bb5e655daf4Dmitry Shmidt    TRACE6(pSiteMgr->hReport, REPORT_SEVERITY_CONSOLE,"-- BSSID = %x-%x-%x-%x-%x-%x\n",
2866653850f71f9caaa41af19cadbab24bb5e655daf4Dmitry Shmidt                    pPrimarySite->bssid[0], pPrimarySite->bssid[1], pPrimarySite->bssid[2], pPrimarySite->bssid[3],
2867653850f71f9caaa41af19cadbab24bb5e655daf4Dmitry Shmidt                    pPrimarySite->bssid[4], pPrimarySite->bssid[5]);
2868981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
2869981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
2870981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	WLAN_OS_REPORT(("-- SSID  = %s \n",pPrimarySite->ssid.str));
2871653850f71f9caaa41af19cadbab24bb5e655daf4Dmitry Shmidt	WLAN_OS_REPORT(("-- BSSID = %x-%x-%x-%x-%x-%x\n",
2872653850f71f9caaa41af19cadbab24bb5e655daf4Dmitry Shmidt					pPrimarySite->bssid[0], pPrimarySite->bssid[1], pPrimarySite->bssid[2], pPrimarySite->bssid[3],
2873653850f71f9caaa41af19cadbab24bb5e655daf4Dmitry Shmidt					pPrimarySite->bssid[4], pPrimarySite->bssid[5]));
2874981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt}
2875981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt#endif
2876981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
2877981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt/***********************************************************************
2878981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt *                        getPrimarySiteDesc
2879981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt ***********************************************************************
2880981801b95b81e6d1c7a2085967406e86af0f08fcDmitry ShmidtDESCRIPTION:    Called by the OS abstraction layer in order to get the primary site description
2881981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
2882981801b95b81e6d1c7a2085967406e86af0f08fcDmitry ShmidtINPUT:      pSiteMgr            - site mgr handle.
2883981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            supplyExtendedInfo  - If OS_802_11_BSSID_EX structure should be used (extended info)
2884981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                                  (Assuming that if this function is called with TI_TRUE, enough memory was allocated to hold the extended info)
2885981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
2886981801b95b81e6d1c7a2085967406e86af0f08fcDmitry ShmidtOUTPUT:     pPrimarySiteDesc    - Primary site description pointer
2887981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
2888981801b95b81e6d1c7a2085967406e86af0f08fcDmitry ShmidtRETURN:
2889981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
2890981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt************************************************************************/
2891981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidtstatic void getPrimarySiteDesc(siteMgr_t *pSiteMgr, OS_802_11_BSSID *pPrimarySiteDesc, TI_BOOL supplyExtendedInfo)
2892981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt{
2893981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    siteEntry_t *pPrimarySite = pSiteMgr->pSitesMgmtParams->pPrimarySite;
2894981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    OS_802_11_BSSID_EX *pExPrimarySiteDesc = (OS_802_11_BSSID_EX *) pPrimarySiteDesc;
2895981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    TI_UINT32  len, firstOFDMloc = 0;
2896981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    OS_802_11_FIXED_IEs     *pFixedIes;
2897981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    OS_802_11_VARIABLE_IEs  *pVarIes;
2898981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    TI_UINT8 rsnIeLength,index;
2899981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    OS_802_11_RATES_EX  SupportedRates;
2900981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
2901981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
2902981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    if (pPrimarySiteDesc == NULL)
2903981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    {
2904981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        return;
2905981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    }
2906981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    if (pPrimarySite == NULL)
2907981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    {
2908981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        os_memoryZero(pSiteMgr->hOs, pPrimarySiteDesc, sizeof(OS_802_11_BSSID));
2909981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        return;
2910981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    }
2911981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
2912981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    TRACE0(pSiteMgr->hReport, REPORT_SEVERITY_INFORMATION, "getPrimarySiteDesc - enter\n");
2913981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
2914981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
2915981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    /* If an "extended" request has been made - update the length accordingly */
2916981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt   if (supplyExtendedInfo == TI_FALSE)
2917981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    pPrimarySiteDesc->Length = sizeof(OS_802_11_BSSID);
2918981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt   else
2919981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    pPrimarySiteDesc->Length = sizeof(OS_802_11_BSSID_EX);
2920981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
2921981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    /* MacAddress */
2922981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    MAC_COPY (pPrimarySiteDesc->MacAddress, pPrimarySite->bssid);
2923981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
2924981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    /* Capabilities */
2925981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    pPrimarySiteDesc->Capabilities = pPrimarySite->capabilities;
2926981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
2927981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    /* SSID */
2928981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    os_memoryCopy (pSiteMgr->hOs,
2929981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                   (void *)pPrimarySiteDesc->Ssid.Ssid,
2930981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                   (void *)pPrimarySite->ssid.str,
2931981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                   pPrimarySite->ssid.len);
2932981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    pPrimarySiteDesc->Ssid.SsidLength = pPrimarySite->ssid.len;
2933981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
2934981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    /* privacy */
2935981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    pPrimarySiteDesc->Privacy = pPrimarySite->privacy;
2936981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
2937981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    /* RSSI */
2938981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
2939981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    pPrimarySiteDesc->Rssi = pPrimarySite->rssi;
2940981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
2941981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    pPrimarySiteDesc->NetworkTypeInUse = os802_11DS;
2942981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
2943981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    pPrimarySiteDesc->Configuration.Length = sizeof(OS_802_11_CONFIGURATION);
2944981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    pPrimarySiteDesc->Configuration.BeaconPeriod = pPrimarySite->beaconInterval;
2945981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    pPrimarySiteDesc->Configuration.ATIMWindow = pPrimarySite->atimWindow;
2946981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    pPrimarySiteDesc->Configuration.Union.channel = pPrimarySite->channel;
2947981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
2948981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    if  (pPrimarySite->bssType == BSS_INDEPENDENT)
2949981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        pPrimarySiteDesc->InfrastructureMode = os802_11IBSS;
2950981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    else
2951981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        pPrimarySiteDesc->InfrastructureMode = os802_11Infrastructure;
2952981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
2953981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt   /* SupportedRates */
2954981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt   if (supplyExtendedInfo == TI_FALSE)
2955981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt      os_memoryZero(pSiteMgr->hOs, (void *)pPrimarySiteDesc->SupportedRates, sizeof(OS_802_11_RATES));
2956981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt   else
2957981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt      os_memoryZero(pSiteMgr->hOs, (void *)pPrimarySiteDesc->SupportedRates, sizeof(OS_802_11_RATES_EX));
2958981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
2959981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt   rate_DrvBitmapToNetStr (pPrimarySite->rateMask.supportedRateMask,
2960981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                           pPrimarySite->rateMask.basicRateMask,
2961981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                           &SupportedRates[0],
2962981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                           &len,
2963981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                           &firstOFDMloc);
2964981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
2965981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt   if (supplyExtendedInfo == TI_FALSE)
2966981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt       os_memoryCopy(pSiteMgr->hOs, (void *)pPrimarySiteDesc->SupportedRates, (void *)SupportedRates, sizeof(OS_802_11_RATES));
2967981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt   else
2968981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt       os_memoryCopy(pSiteMgr->hOs, (void *)pPrimarySiteDesc->SupportedRates, (void *)SupportedRates, sizeof(OS_802_11_RATES_EX));
2969981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
2970981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
2971981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt   if (supplyExtendedInfo == TI_TRUE)
2972981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt   {
2973981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt      pExPrimarySiteDesc->IELength = 0;
2974981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
2975981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt     /* copy fixed IEs from site entry */
2976981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt     pFixedIes = (OS_802_11_FIXED_IEs*)&pExPrimarySiteDesc->IEs[pExPrimarySiteDesc->IELength];
2977981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt     os_memoryCopy(pSiteMgr->hOs, (void *)pFixedIes->TimeStamp, (void *)&pPrimarySite->tsfTimeStamp, TIME_STAMP_LEN);
2978981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt     pFixedIes->BeaconInterval = pPrimarySite->beaconInterval;
2979981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt     pFixedIes->Capabilities = pPrimarySite->capabilities;
2980981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt     pExPrimarySiteDesc->IELength += sizeof(OS_802_11_FIXED_IEs);
2981981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
2982981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt     /* copy variable IEs */
2983981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt     /* copy SSID */
2984981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt     pVarIes = (OS_802_11_VARIABLE_IEs*)&pExPrimarySiteDesc->IEs[pExPrimarySiteDesc->IELength];
2985981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt     pVarIes->ElementID = SSID_IE_ID;
2986981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt     pVarIes->Length = pPrimarySite->ssid.len;
2987981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt     os_memoryCopy (pSiteMgr->hOs,
2988981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                    (void *)pVarIes->data,
2989981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                    (void *)pPrimarySite->ssid.str,
2990981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                    pPrimarySite->ssid.len);
2991981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt     pExPrimarySiteDesc->IELength += (pVarIes->Length + 2);
2992981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
2993981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
2994981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt     /* copy RSN information elements */
2995981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt     rsnIeLength = 0;
2996981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt     for (index=0; index<MAX_RSN_IE && pPrimarySite->pRsnIe[index].hdr[1] > 0; index++)
2997981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt       {
2998981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            pVarIes =  (OS_802_11_VARIABLE_IEs*)&pExPrimarySiteDesc->IEs[pExPrimarySiteDesc->IELength+rsnIeLength];
2999981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt         pVarIes->ElementID = pPrimarySite->pRsnIe[index].hdr[0];
3000981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt             pVarIes->Length = pPrimarySite->pRsnIe[index].hdr[1];
3001981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt             os_memoryCopy(pSiteMgr->hOs, (void *)pVarIes->data, (void *)pPrimarySite->pRsnIe[index].rsnIeData, pPrimarySite->pRsnIe[index].hdr[1]);
3002981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt             rsnIeLength += pPrimarySite->pRsnIe[index].hdr[1] + 2;
3003981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            TRACE2(pSiteMgr->hReport, REPORT_SEVERITY_INFORMATION, "RSN IE ID=%d, Length=%x\n", pVarIes->ElementID, pVarIes->Length);
3004981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
3005981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            TRACE_INFO_HEX(pSiteMgr->hReport, (TI_UINT8 *)pVarIes->data,pVarIes->Length);
3006981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt         }
3007981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
3008981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt         pExPrimarySiteDesc->IELength += pPrimarySite->rsnIeLen;
3009981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
3010981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt         pExPrimarySiteDesc->Length = sizeof(OS_802_11_BSSID_EX) + pExPrimarySiteDesc->IELength - 1;
3011981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
3012981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt         TRACE6(pSiteMgr->hReport, REPORT_SEVERITY_INFORMATION, "BSSID MAC = %x-%x-%x-%x-%x-%x\n", pExPrimarySiteDesc->MacAddress[0], pExPrimarySiteDesc->MacAddress[1], pExPrimarySiteDesc->MacAddress[2], pExPrimarySiteDesc->MacAddress[3], pExPrimarySiteDesc->MacAddress[4], pExPrimarySiteDesc->MacAddress[5]);
3013981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
3014981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt         TRACE1(pSiteMgr->hReport, REPORT_SEVERITY_INFORMATION, "pExPrimarySiteDesc length before alignment = %d\n", pExPrimarySiteDesc->Length);
3015981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
3016981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt         /* make sure length is 4 bytes aligned */
3017981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt         if (pExPrimarySiteDesc->Length % 4)
3018981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt         {
3019981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            pExPrimarySiteDesc->Length += (4 - (pExPrimarySiteDesc->Length % 4));
3020981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt         }
3021981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
3022981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt         TRACE1(pSiteMgr->hReport, REPORT_SEVERITY_INFORMATION, "pExPrimarySiteDesc length after alignment = %d\n", pExPrimarySiteDesc->Length);
3023981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
3024981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        }
3025981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
3026981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt}
3027981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
3028981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
3029981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt/***********************************************************************
3030981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt *                        translateRateMaskToValue
3031981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt ***********************************************************************
3032981801b95b81e6d1c7a2085967406e86af0f08fcDmitry ShmidtDESCRIPTION:    Called by the function 'siteMgr_config()' in order to translate the rate mask read
3033981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                from registry to rate value
3034981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
3035981801b95b81e6d1c7a2085967406e86af0f08fcDmitry ShmidtINPUT:      pSiteMgr            -   site mgr handle.
3036981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            rateMask            -   Rate mask
3037981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
3038981801b95b81e6d1c7a2085967406e86af0f08fcDmitry ShmidtOUTPUT:     The rate after the translation
3039981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
3040981801b95b81e6d1c7a2085967406e86af0f08fcDmitry ShmidtRETURN:
3041981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
3042981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt************************************************************************/
3043981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidtstatic ERate translateRateMaskToValue(siteMgr_t *pSiteMgr, TI_UINT32 rateMask)
3044981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt{
3045981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    if (rateMask & DRV_RATE_MASK_54_OFDM)
3046981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        return DRV_RATE_54M;
3047981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    if (rateMask & DRV_RATE_MASK_48_OFDM)
3048981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        return DRV_RATE_48M;
3049981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    if (rateMask & DRV_RATE_MASK_36_OFDM)
3050981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        return DRV_RATE_36M;
3051981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    if (rateMask & DRV_RATE_MASK_24_OFDM)
3052981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        return DRV_RATE_24M;
3053981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    if (rateMask & DRV_RATE_MASK_22_PBCC)
3054981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        return DRV_RATE_22M;
3055981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    if (rateMask & DRV_RATE_MASK_18_OFDM)
3056981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        return DRV_RATE_18M;
3057981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    if (rateMask & DRV_RATE_MASK_12_OFDM)
3058981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        return DRV_RATE_12M;
3059981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    if (rateMask & DRV_RATE_MASK_11_CCK)
3060981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        return DRV_RATE_11M;
3061981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    if (rateMask & DRV_RATE_MASK_9_OFDM)
3062981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        return DRV_RATE_9M;
3063981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    if (rateMask & DRV_RATE_MASK_6_OFDM)
3064981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        return DRV_RATE_6M;
3065981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    if (rateMask & DRV_RATE_MASK_5_5_CCK)
3066981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        return DRV_RATE_5_5M;
3067981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    if (rateMask & DRV_RATE_MASK_2_BARKER)
3068981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        return DRV_RATE_2M;
3069981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    if (rateMask & DRV_RATE_MASK_1_BARKER)
3070981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        return DRV_RATE_1M;
3071981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
3072981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    TRACE1(pSiteMgr->hReport, REPORT_SEVERITY_WARNING, "Translate rate mask to value, mask is 0x%X\n", rateMask);
3073981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    if(pSiteMgr->siteMgrOperationalMode != DOT11_A_MODE)
3074981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        return DRV_RATE_1M;
3075981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    else
3076981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        return DRV_RATE_6M;
3077981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt}
3078981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
3079981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
3080981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt/***********************************************************************
3081981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt *                        getSupportedRateSet
3082981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt ***********************************************************************
3083981801b95b81e6d1c7a2085967406e86af0f08fcDmitry ShmidtDESCRIPTION:    Called by the function 'siteMgr_getParam()' in order to get the supported rate set
3084981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                Build an array of network rates based on the max active & max basic rates
3085981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
3086981801b95b81e6d1c7a2085967406e86af0f08fcDmitry ShmidtINPUT:      pSiteMgr            -   site mgr handle.
3087981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
3088981801b95b81e6d1c7a2085967406e86af0f08fcDmitry ShmidtOUTPUT:     pRatesSet           -   The array built
3089981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
3090981801b95b81e6d1c7a2085967406e86af0f08fcDmitry ShmidtRETURN:
3091981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
3092981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt************************************************************************/
3093981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidtstatic void getSupportedRateSet(siteMgr_t *pSiteMgr, TRates *pRatesSet)
3094981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt{
3095981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    TI_UINT32 dontCareParam;
3096981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    TI_UINT32 len = 0;
3097981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
3098981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    rate_DrvBitmapToNetStr (pSiteMgr->pDesiredParams->siteMgrRegstrySuppRateMask,
3099981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                               pSiteMgr->pDesiredParams->siteMgrRegstryBasicRateMask,
3100981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                            (TI_UINT8 *)pRatesSet->ratesString,
3101981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                            &len,
3102981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                            &dontCareParam);
3103981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
3104981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    pRatesSet->len = (TI_UINT8) len;
3105981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt}
3106981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
3107981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt/***********************************************************************
3108981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt *                        setSupportedRateSet
3109981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt ***********************************************************************
3110981801b95b81e6d1c7a2085967406e86af0f08fcDmitry ShmidtDESCRIPTION:    Called by the function 'siteMgr_setParam()' in order to set the supported rate set
3111981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                Go over the input array and set the max active & max basic rates. (after translation from network
3112981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                rates to host rates ofcourse)
3113981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                If max basic rate is bigger than the mac active one, print an error.
3114981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                If the basic or active rate are different than the ones already stored by the site manager,
3115981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                it initiates a reconnection by calling sme_Restart
3116981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
3117981801b95b81e6d1c7a2085967406e86af0f08fcDmitry ShmidtINPUT:      pSiteMgr            -   site mgr handle.
3118981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            pRatesSet           -   The rates array received
3119981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
3120981801b95b81e6d1c7a2085967406e86af0f08fcDmitry ShmidtOUTPUT:
3121981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
3122981801b95b81e6d1c7a2085967406e86af0f08fcDmitry ShmidtRETURN:     TI_OK on success
3123981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
3124981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt************************************************************************/
3125981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidtstatic TI_STATUS setSupportedRateSet(siteMgr_t *pSiteMgr, TRates *pRatesSet)
3126981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt{
3127981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    TI_UINT8  i,j, drvRate;
3128981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    ERate maxActiveRate = (ERate)0, maxBasicRate = (ERate)0;
3129981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    TI_UINT32 suppBitMap, basicBitMap;
3130981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    static  ERate basicRates_G[]  = {DRV_RATE_1M,DRV_RATE_2M,DRV_RATE_5_5M,DRV_RATE_11M};
3131981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    static ERate basicRates_A[]  = {DRV_RATE_6M,DRV_RATE_12M,DRV_RATE_24M};
3132981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    ERate* currentBasicRates;
3133981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    TI_UINT32 currentBasicRatesLength;
3134981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
3135981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt#ifndef NET_BASIC_MASK
3136981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt#define NET_BASIC_MASK      0x80    /* defined in common/src/utils/utils.c */
3137981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt#endif
3138981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
3139981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    if(pSiteMgr->siteMgrOperationalMode == DOT11_A_MODE)
3140981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    {
3141981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        currentBasicRates = &basicRates_A[0];
3142981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        currentBasicRatesLength = sizeof(basicRates_A) / sizeof(basicRates_A[0]);
3143981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    }
3144981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    else
3145981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    {
3146981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        currentBasicRates = &basicRates_G[0];
3147981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        currentBasicRatesLength = sizeof(basicRates_G) / sizeof(basicRates_G[0]);
3148981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    }
3149981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
3150981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        /* Basic rates must be supported. If one of 1M,2M,5.5M,11M is not supported fail.*/
3151981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
3152981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    for (j=0;j < currentBasicRatesLength;j++)
3153981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    {
3154981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        for (i = 0; i < pRatesSet->len; i++)
3155981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        {
3156981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            drvRate = rate_NetToDrv (pRatesSet->ratesString[i]);
3157981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            if ((drvRate & ( NET_BASIC_MASK-1)) == currentBasicRates[j])
3158981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                break;
3159981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        }
3160981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        /* not all the basic rates are supported! Failure*/
3161981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        if (i == pRatesSet->len)
3162981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        {
3163981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            TRACE0(pSiteMgr->hReport, REPORT_SEVERITY_ERROR, "Rates set must contain the basic set! Failing\n");
3164981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            return PARAM_VALUE_NOT_VALID;
3165981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        }
3166981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    }
3167981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
3168981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    for (i = 0; i < pRatesSet->len; i++)
3169981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    {
3170981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        drvRate = rate_NetToDrv (pRatesSet->ratesString[i]);
3171981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        if(pSiteMgr->siteMgrOperationalMode == DOT11_A_MODE)
3172981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        {
3173981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            if(drvRate < DRV_RATE_6M)
3174981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            {
3175981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                TRACE0(pSiteMgr->hReport, REPORT_SEVERITY_ERROR, "Notice, the driver configured in 11a mode, but CCK rate appears\n");
3176981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                return PARAM_VALUE_NOT_VALID;
3177981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            }
3178981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        }
3179981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        else if(pSiteMgr->siteMgrOperationalMode == DOT11_B_MODE)
3180981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        {
3181981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            if(drvRate >= DRV_RATE_6M)
3182981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            {
3183981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                TRACE0(pSiteMgr->hReport, REPORT_SEVERITY_ERROR, "Notice, the driver configured in 11b mode, but OFDM rate appears\n");
3184981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                return PARAM_VALUE_NOT_VALID;
3185981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            }
3186981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        }
3187981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        maxActiveRate = TI_MAX ((ERate)drvRate, maxActiveRate);
3188981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    }
3189981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
3190981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    for (i = 0; i < pRatesSet->len; i++)
3191981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    {
3192981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        if (NET_BASIC_RATE(pRatesSet->ratesString[i]))
3193981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            maxBasicRate = TI_MAX (rate_NetToDrv (pRatesSet->ratesString[i]), maxBasicRate);
3194981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    }
3195981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
3196981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    /* If the basic rate is bigger than the supported one, we print an error */
3197981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    if (pSiteMgr->pDesiredParams->siteMgrDesiredRatePair.maxBasic > pSiteMgr->pDesiredParams->siteMgrDesiredRatePair.maxActive)
3198981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    {
3199981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        TRACE2(pSiteMgr->hReport, REPORT_SEVERITY_ERROR, "Notice, the rates configuration is invalid, basic rate is bigger than supported, Max Basic: %d Max Supported: %d\n", pSiteMgr->pDesiredParams->siteMgrDesiredRatePair.maxBasic, pSiteMgr->pDesiredParams->siteMgrDesiredRatePair.maxActive);
3200981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        return PARAM_VALUE_NOT_VALID;
3201981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    }
3202981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
3203981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    pSiteMgr->pDesiredParams->siteMgrDesiredRatePair.maxActive = maxActiveRate;
3204981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    pSiteMgr->pDesiredParams->siteMgrDesiredRatePair.maxBasic = maxBasicRate;
3205981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
3206981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    /* configure desired modulation */
3207981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    if(maxActiveRate == DRV_RATE_22M)
3208981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        pSiteMgr->pDesiredParams->siteMgrDesiredModulationType = DRV_MODULATION_PBCC;
3209981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    else if(maxActiveRate < DRV_RATE_22M)
3210981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        pSiteMgr->pDesiredParams->siteMgrDesiredModulationType = DRV_MODULATION_CCK;
3211981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    else
3212981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        pSiteMgr->pDesiredParams->siteMgrDesiredModulationType = DRV_MODULATION_OFDM;
3213981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
3214981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
3215981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    rate_NetStrToDrvBitmap (&suppBitMap, pRatesSet->ratesString, pRatesSet->len);
3216981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    rate_NetBasicStrToDrvBitmap (&basicBitMap, pRatesSet->ratesString, pRatesSet->len);
3217981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
3218981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    if((pSiteMgr->pDesiredParams->siteMgrRegstryBasicRateMask != basicBitMap) ||
3219981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt       (pSiteMgr->pDesiredParams->siteMgrRegstrySuppRateMask != suppBitMap))
3220981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    {
3221981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        pSiteMgr->pDesiredParams->siteMgrCurrentDesiredRateMask.supportedRateMask = suppBitMap;
3222981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        pSiteMgr->pDesiredParams->siteMgrCurrentDesiredRateMask.basicRateMask = basicBitMap;
3223981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        pSiteMgr->pDesiredParams->siteMgrRegstryBasicRateMask = basicBitMap;
3224981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        pSiteMgr->pDesiredParams->siteMgrRegstrySuppRateMask = suppBitMap;
3225981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        /* Initialize Mutual Rates Matching */
3226981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        pSiteMgr->pDesiredParams->siteMgrMatchedBasicRateMask = pSiteMgr->pDesiredParams->siteMgrCurrentDesiredRateMask.basicRateMask;
3227981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        pSiteMgr->pDesiredParams->siteMgrMatchedSuppRateMask = pSiteMgr->pDesiredParams->siteMgrCurrentDesiredRateMask.supportedRateMask;
3228981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
3229981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        sme_Restart (pSiteMgr->hSmeSm);
3230981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    }
3231981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
3232981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    return TI_OK;
3233981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt}
3234981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
3235981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt/***********************************************************************
3236981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt *                        pbccAlgorithm
3237981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt ***********************************************************************
3238981801b95b81e6d1c7a2085967406e86af0f08fcDmitry ShmidtDESCRIPTION:    Called by the following functions:
3239981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                -   systemConfig(), in the system configuration phase after the selection
3240981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                -   siteMgr_updateSite(), in a case of a primary site update & if a PBCC algorithm
3241981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                    is needed to be performed
3242981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                Performs the PBCC algorithm
3243981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
3244981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
3245981801b95b81e6d1c7a2085967406e86af0f08fcDmitry ShmidtINPUT:      hSiteMgr            -   site mgr handle.
3246981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
3247981801b95b81e6d1c7a2085967406e86af0f08fcDmitry ShmidtOUTPUT:
3248981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
3249981801b95b81e6d1c7a2085967406e86af0f08fcDmitry ShmidtRETURN:     TI_OK on always
3250981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
3251981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt************************************************************************/
3252981801b95b81e6d1c7a2085967406e86af0f08fcDmitry ShmidtTI_STATUS pbccAlgorithm(TI_HANDLE hSiteMgr)
3253981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt{
3254981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    siteMgr_t   *pSiteMgr = (siteMgr_t *)hSiteMgr;
3255981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    paramInfo_t param;
3256981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    siteEntry_t *pPrimarySite = pSiteMgr->pSitesMgmtParams->pPrimarySite;
3257981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    TI_UINT32   supportedRateMask ;
3258981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
3259981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
3260981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    if (pPrimarySite->channel == SPECIAL_BG_CHANNEL)
3261981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        supportedRateMask = (rate_GetDrvBitmapForDefaultSupporteSet() & pSiteMgr->pDesiredParams->siteMgrMatchedSuppRateMask) ;
3262981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    else
3263981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        supportedRateMask = pSiteMgr->pDesiredParams->siteMgrMatchedSuppRateMask ;
3264981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
3265981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    param.paramType = CTRL_DATA_CURRENT_SUPPORTED_RATE_MASK_PARAM;
3266981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    param.content.ctrlDataCurrentRateMask = supportedRateMask;
3267981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    /* clear the 22Mbps bit in case the PBCC is not allowed */
3268981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    if(pSiteMgr->currentDataModulation != DRV_MODULATION_PBCC &&
3269981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt       pSiteMgr->currentDataModulation != DRV_MODULATION_OFDM)
3270981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            param.content.ctrlDataCurrentRateMask &= ~DRV_RATE_MASK_22_PBCC;
3271981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    ctrlData_setParam(pSiteMgr->hCtrlData, &param);
3272981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
3273981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    param.paramType = CTRL_DATA_RATE_CONTROL_ENABLE_PARAM;
3274981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    ctrlData_setParam(pSiteMgr->hCtrlData, &param);
3275981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
3276981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    return TI_OK;
3277981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt}
3278981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
3279981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
3280981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt/***********************************************************************
3281981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt *                        siteMgr_assocReport
3282981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt ***********************************************************************
3283981801b95b81e6d1c7a2085967406e86af0f08fcDmitry ShmidtDESCRIPTION:    Called by the following functions:
3284981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                -   assoc_recv()
3285981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
3286981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
3287981801b95b81e6d1c7a2085967406e86af0f08fcDmitry ShmidtINPUT:      hSiteMgr            -   siteMgr handle.
3288981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            capabilities        -   assoc rsp capabilities field.
3289981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt			bCiscoAP			-   whether we are connected to a Cisco AP. Used for Tx Power Control adjustment
3290981801b95b81e6d1c7a2085967406e86af0f08fcDmitry ShmidtOUTPUT:
3291981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
3292981801b95b81e6d1c7a2085967406e86af0f08fcDmitry ShmidtRETURN:     TI_OK on always
3293981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
3294981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt************************************************************************/
3295981801b95b81e6d1c7a2085967406e86af0f08fcDmitry ShmidtTI_STATUS siteMgr_assocReport(TI_HANDLE hSiteMgr, TI_UINT16 capabilities, TI_BOOL bCiscoAP)
3296981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt{
3297981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    siteMgr_t   *pSiteMgr = (siteMgr_t *)hSiteMgr;
3298981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    siteEntry_t *pPrimarySite = pSiteMgr->pSitesMgmtParams->pPrimarySite;
3299981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
3300981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    /* handle AP's preamble capability */
3301981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    pPrimarySite->preambleAssRspCap = ((capabilities >> CAP_PREAMBLE_SHIFT) & CAP_PREAMBLE_MASK)  ? PREAMBLE_SHORT : PREAMBLE_LONG;
3302981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
3303981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	/*
3304981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	 * Enable/Disable the Tx Power Control adjustment.
3305981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	 * When we are connected to Cisco AP - TX Power Control adjustment is disabled.
3306981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	 */
3307981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	pSiteMgr->siteMgrTxPowerEnabled = ( !bCiscoAP ) && ( pSiteMgr->pDesiredParams->TxPowerControlOn );
3308981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
3309981801b95b81e6d1c7a2085967406e86af0f08fcDmitry ShmidtTRACE1(pSiteMgr->hReport, REPORT_SEVERITY_INFORMATION, ": Tx Power Control adjustment is %d\n", pSiteMgr->siteMgrTxPowerEnabled);
3310981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
3311981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    return TI_OK;
3312981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt}
3313981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
3314981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt/***********************************************************************
3315981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt *                        siteMgr_setWMEParamsSite
3316981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt ***********************************************************************
3317981801b95b81e6d1c7a2085967406e86af0f08fcDmitry ShmidtDESCRIPTION:    Set the QOS_WME params as received from the associated
3318981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                AP. The function is called by the QoS Mgr
3319981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                after receving association response succefully.
3320981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
3321981801b95b81e6d1c7a2085967406e86af0f08fcDmitry ShmidtINPUT:      hSiteMgr    -   SiteMgr handle.
3322981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
3323981801b95b81e6d1c7a2085967406e86af0f08fcDmitry ShmidtOUTPUT:     pDot11_WME_PARAM_t - pointer to the QOS_WME Param IE.
3324981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
3325981801b95b81e6d1c7a2085967406e86af0f08fcDmitry ShmidtRETURN:     TI_OK on always
3326981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
3327981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt************************************************************************/
3328981801b95b81e6d1c7a2085967406e86af0f08fcDmitry ShmidtTI_STATUS siteMgr_setWMEParamsSite(TI_HANDLE hSiteMgr,dot11_WME_PARAM_t *pDot11_WME_PARAM)
3329981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt{
3330981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    siteMgr_t   *pSiteMgr = (siteMgr_t *)hSiteMgr;
3331981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    siteEntry_t *pPrimarySite = pSiteMgr->pSitesMgmtParams->pPrimarySite;
3332981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
3333981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    if( pPrimarySite == NULL )
3334981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    {
3335981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        return TI_OK;
3336981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    }
3337981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
3338981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    if( pDot11_WME_PARAM == NULL )
3339981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    {
3340981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        pPrimarySite->WMESupported = TI_FALSE;
3341981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        return TI_OK;
3342981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    }
3343981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
3344981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    /* Update the QOS_WME params */
3345981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    os_memoryCopy(pSiteMgr->hOs,&pPrimarySite->WMEParameters,&pDot11_WME_PARAM->WME_ACParameteres,sizeof(dot11_ACParameters_t));
3346981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    pPrimarySite->lastWMEParameterCnt = (pDot11_WME_PARAM->ACInfoField & dot11_WME_ACINFO_MASK);
3347981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    TRACE1(pSiteMgr->hReport, REPORT_SEVERITY_INFORMATION, "$$$$$$ QOS_WME parameters were updates according to association response, cntSeq = %d\n",pPrimarySite->lastWMEParameterCnt);
3348981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
3349981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    return TI_OK;
3350981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt}
3351981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
3352981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
3353981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt/***********************************************************************
3354981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt *                        siteMgr_getWMEParamsSite
3355981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt ***********************************************************************
3356981801b95b81e6d1c7a2085967406e86af0f08fcDmitry ShmidtDESCRIPTION:    Get the QOS_WME params as recieved from the associated
3357981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                AP. The function is called by the Qos Mgr in order
3358981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                to set all QOS_WME parameters to the core and Hal
3359981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
3360981801b95b81e6d1c7a2085967406e86af0f08fcDmitry ShmidtINPUT:      hSiteMgr    -   SiteMgr handle.
3361981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
3362981801b95b81e6d1c7a2085967406e86af0f08fcDmitry ShmidtOUTPUT:     pWME_ACParameters_t - pointer to the QOS_WME Param.
3363981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
3364981801b95b81e6d1c7a2085967406e86af0f08fcDmitry ShmidtRETURN:     TI_OK if there are valid QOS_WME parameters , TI_NOK otherwise.
3365981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
3366981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt************************************************************************/
3367981801b95b81e6d1c7a2085967406e86af0f08fcDmitry ShmidtTI_STATUS siteMgr_getWMEParamsSite(TI_HANDLE hSiteMgr,dot11_ACParameters_t **pWME_ACParameters_t)
3368981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt{
3369981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    siteMgr_t   *pSiteMgr = (siteMgr_t *)hSiteMgr;
3370981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    siteEntry_t *pPrimarySite = pSiteMgr->pSitesMgmtParams->pPrimarySite;
3371981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
3372981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    if(pPrimarySite->WMESupported == TI_TRUE)
3373981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    {
3374981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        *pWME_ACParameters_t = &pPrimarySite->WMEParameters;
3375981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        return TI_OK;
3376981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    }
3377981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    else
3378981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    {
3379981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        *pWME_ACParameters_t = NULL;
3380981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        return TI_NOK;
3381981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    }
3382981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
3383981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt}
3384981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
3385981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt/***********************************************************************
3386981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt *                        siteMgr_setCurrentTable
3387981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt ***********************************************************************
3388981801b95b81e6d1c7a2085967406e86af0f08fcDmitry ShmidtDESCRIPTION:
3389981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
3390981801b95b81e6d1c7a2085967406e86af0f08fcDmitry ShmidtINPUT:      hSiteMgr    -   SiteMgr handle.
3391981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
3392981801b95b81e6d1c7a2085967406e86af0f08fcDmitry ShmidtOUTPUT:
3393981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
3394981801b95b81e6d1c7a2085967406e86af0f08fcDmitry ShmidtRETURN:
3395981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
3396981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt************************************************************************/
3397981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidtvoid siteMgr_setCurrentTable(TI_HANDLE hSiteMgr, ERadioBand radioBand)
3398981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt{
3399981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    siteMgr_t   *pSiteMgr = (siteMgr_t *)hSiteMgr;
3400981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
3401981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    if(radioBand == RADIO_BAND_2_4_GHZ)
3402981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        pSiteMgr->pSitesMgmtParams->pCurrentSiteTable = &pSiteMgr->pSitesMgmtParams->dot11BG_sitesTables;
3403981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    else
3404981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        pSiteMgr->pSitesMgmtParams->pCurrentSiteTable = (siteTablesParams_t *)&pSiteMgr->pSitesMgmtParams->dot11A_sitesTables;
3405981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt}
3406981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
3407981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt/***********************************************************************
3408981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt *                        siteMgr_updateRates
3409981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt ***********************************************************************
3410981801b95b81e6d1c7a2085967406e86af0f08fcDmitry ShmidtDESCRIPTION:
3411981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
3412981801b95b81e6d1c7a2085967406e86af0f08fcDmitry ShmidtINPUT:      hSiteMgr    -   SiteMgr handle.
3413981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
3414981801b95b81e6d1c7a2085967406e86af0f08fcDmitry ShmidtOUTPUT:
3415981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
3416981801b95b81e6d1c7a2085967406e86af0f08fcDmitry ShmidtRETURN:
3417981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
3418981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt************************************************************************/
3419981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
3420981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidtvoid siteMgr_updateRates(TI_HANDLE hSiteMgr, TI_BOOL dot11a, TI_BOOL updateToOS)
3421981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt{
3422981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    TI_UINT32  statusData;
3423981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    TI_UINT32  localSuppRateMask, localBasicRateMask;
3424981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
3425981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    siteMgr_t   *pSiteMgr = (siteMgr_t *)hSiteMgr;
3426981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
3427981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    localSuppRateMask = pSiteMgr->pDesiredParams->siteMgrRegstrySuppRateMask;
3428981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    localBasicRateMask = pSiteMgr->pDesiredParams->siteMgrRegstryBasicRateMask;
3429981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
3430981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
3431981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    rate_ValidateVsBand (&localSuppRateMask, &localBasicRateMask, dot11a);
3432981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
3433981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    pSiteMgr->pDesiredParams->siteMgrCurrentDesiredRateMask.basicRateMask = localBasicRateMask;
3434981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    pSiteMgr->pDesiredParams->siteMgrCurrentDesiredRateMask.supportedRateMask = localSuppRateMask;
3435981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
3436981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt     /* Initialize Mutual Rates Matching */
3437981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    pSiteMgr->pDesiredParams->siteMgrMatchedBasicRateMask = pSiteMgr->pDesiredParams->siteMgrCurrentDesiredRateMask.basicRateMask;
3438981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    pSiteMgr->pDesiredParams->siteMgrMatchedSuppRateMask = pSiteMgr->pDesiredParams->siteMgrCurrentDesiredRateMask.supportedRateMask;
3439981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
3440981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    /*If we are in dual mode and we are only scanning A band we don't have to set the siteMgrCurrentDesiredTxRate.*/
3441981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    if (updateToOS == TI_TRUE)
3442981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    {
3443981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        TI_UINT32 uSupportedRates = pSiteMgr->pDesiredParams->siteMgrCurrentDesiredRateMask.supportedRateMask;
3444981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        ERate eMaxRate = rate_GetMaxFromDrvBitmap (uSupportedRates);
3445981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
3446981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        /* Make sure that the basic rate set is included in the supported rate set */
3447981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        pSiteMgr->pDesiredParams->siteMgrCurrentDesiredRateMask.basicRateMask &= uSupportedRates;
3448981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
3449981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        /* Set desired modulation */
3450981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        pSiteMgr->pDesiredParams->siteMgrDesiredModulationType =
3451981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            (eMaxRate < DRV_RATE_22M) ? DRV_MODULATION_CCK : DRV_MODULATION_OFDM;
3452981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    }
3453981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    pSiteMgr->pDesiredParams->siteMgrDesiredRatePair.maxBasic = translateRateMaskToValue(pSiteMgr, pSiteMgr->pDesiredParams->siteMgrCurrentDesiredRateMask.basicRateMask);
3454981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    pSiteMgr->pDesiredParams->siteMgrDesiredRatePair.maxActive = translateRateMaskToValue(pSiteMgr, pSiteMgr->pDesiredParams->siteMgrCurrentDesiredRateMask.supportedRateMask);
3455981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
3456981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    if (updateToOS == TI_TRUE)
3457981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	{
3458653850f71f9caaa41af19cadbab24bb5e655daf4Dmitry Shmidt        siteEntry_t  *pPrimarySite = pSiteMgr->pSitesMgmtParams->pPrimarySite;
3459653850f71f9caaa41af19cadbab24bb5e655daf4Dmitry Shmidt        TI_UINT32 commonSupportedRateMask;
3460653850f71f9caaa41af19cadbab24bb5e655daf4Dmitry Shmidt        ERate maxRate;
3461981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
3462653850f71f9caaa41af19cadbab24bb5e655daf4Dmitry Shmidt        commonSupportedRateMask = pSiteMgr->pDesiredParams->siteMgrCurrentDesiredRateMask.supportedRateMask;
3463653850f71f9caaa41af19cadbab24bb5e655daf4Dmitry Shmidt        if (pPrimarySite)
3464653850f71f9caaa41af19cadbab24bb5e655daf4Dmitry Shmidt        {
3465653850f71f9caaa41af19cadbab24bb5e655daf4Dmitry Shmidt            commonSupportedRateMask &= pPrimarySite->rateMask.supportedRateMask;
3466653850f71f9caaa41af19cadbab24bb5e655daf4Dmitry Shmidt        }
3467653850f71f9caaa41af19cadbab24bb5e655daf4Dmitry Shmidt
3468653850f71f9caaa41af19cadbab24bb5e655daf4Dmitry Shmidt        maxRate = translateRateMaskToValue(pSiteMgr, commonSupportedRateMask);
3469653850f71f9caaa41af19cadbab24bb5e655daf4Dmitry Shmidt
3470653850f71f9caaa41af19cadbab24bb5e655daf4Dmitry Shmidt        /* report the desired rate to OS */
3471653850f71f9caaa41af19cadbab24bb5e655daf4Dmitry Shmidt        statusData = rate_DrvToNet(maxRate);
3472981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        EvHandlerSendEvent(pSiteMgr->hEvHandler, IPC_EVENT_LINK_SPEED, (TI_UINT8 *)&statusData,sizeof(TI_UINT32));
3473981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    }
3474981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt}
3475981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
3476981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
3477981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt/**
3478981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * \fn     siteMgr_SelectRateMatch
3479981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * \brief  Checks if the rates settings match those of a site
3480981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt *
3481981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * Checks if the rates settings match those of a site
3482981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt *
3483981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * \param  hSiteMgr - handle to the siteMgr object
3484981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * \param  pCurrentSite - the site to check
3485981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * \return TI_TRUE if site matches rates settings, TI FALSE if it doesn't
3486981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * \sa     sme_Select
3487981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt */
3488981801b95b81e6d1c7a2085967406e86af0f08fcDmitry ShmidtTI_BOOL siteMgr_SelectRateMatch (TI_HANDLE hSiteMgr, TSiteEntry *pCurrentSite)
3489981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt{
3490981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    siteMgr_t *pSiteMgr = (siteMgr_t *)hSiteMgr;
3491981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    TI_UINT32 MatchedBasicRateMask;
3492981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    TI_UINT32 MatchedSupportedRateMask;
3493981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	TI_UINT32 StaTotalRates;
3494981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	TI_UINT32 SiteTotalRates;
3495981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
3496981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	/* If the basic or active rate are invalid (0), return NO_MATCH. */
3497981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	if ((pCurrentSite->maxBasicRate == DRV_RATE_INVALID) || (pCurrentSite->maxActiveRate == DRV_RATE_INVALID))
3498981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	{
3499981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        TRACE2(pSiteMgr->hReport, REPORT_SEVERITY_INFORMATION, "siteMgr_SelectRateMatch: basic or active rate are invalid. maxBasic=%d,maxActive=%d \n", pCurrentSite->maxBasicRate ,pCurrentSite->maxActiveRate);
3500981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt		return TI_FALSE;
3501981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	}
3502981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
3503981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	if (DRV_RATE_MAX < pCurrentSite->maxBasicRate)
3504981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	{
3505981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        TRACE1(pSiteMgr->hReport, REPORT_SEVERITY_INFORMATION, "siteMgr_SelectRateMatch: basic rate is too high. maxBasic=%d\n", pCurrentSite->maxBasicRate);
3506981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt		return TI_FALSE;
3507981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	}
3508981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
3509981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	if(pCurrentSite->channel <= SITE_MGR_CHANNEL_B_G_MAX)
3510981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt		siteMgr_updateRates(pSiteMgr, TI_FALSE, TI_TRUE);
3511981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	else
3512981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt		siteMgr_updateRates(pSiteMgr, TI_TRUE, TI_TRUE);
3513981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
3514981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	StaTotalRates = pSiteMgr->pDesiredParams->siteMgrCurrentDesiredRateMask.basicRateMask |
3515981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt				    pSiteMgr->pDesiredParams->siteMgrCurrentDesiredRateMask.supportedRateMask;
3516981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
3517981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	SiteTotalRates = pCurrentSite->rateMask.basicRateMask | pCurrentSite->rateMask.supportedRateMask;
3518981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
3519981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	MatchedBasicRateMask = SiteTotalRates
3520981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt				& pSiteMgr->pDesiredParams->siteMgrCurrentDesiredRateMask.basicRateMask;
3521981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
3522981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    MatchedSupportedRateMask = SiteTotalRates &
3523981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt				pSiteMgr->pDesiredParams->siteMgrCurrentDesiredRateMask.supportedRateMask;
3524981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
3525981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    if ((StaTotalRates & pCurrentSite->rateMask.basicRateMask) != pCurrentSite->rateMask.basicRateMask)
3526981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    {
3527981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        TRACE0(pSiteMgr->hReport, REPORT_SEVERITY_INFORMATION, "siteMgr_SelectRateMatch: Basic or Supported Rates Doesn't Match \n");
3528981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        return TI_FALSE;
3529981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
3530981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    }
3531981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
3532981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    return TI_TRUE;
3533981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt}
3534981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
3535981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt/***********************************************************************
3536981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt *                        siteMgr_bandParamsConfig
3537981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt ***********************************************************************
3538981801b95b81e6d1c7a2085967406e86af0f08fcDmitry ShmidtDESCRIPTION:
3539981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
3540981801b95b81e6d1c7a2085967406e86af0f08fcDmitry ShmidtINPUT:      hSiteMgr    -   SiteMgr handle.
3541981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
3542981801b95b81e6d1c7a2085967406e86af0f08fcDmitry ShmidtOUTPUT:
3543981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
3544981801b95b81e6d1c7a2085967406e86af0f08fcDmitry ShmidtRETURN:
3545981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
3546981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt************************************************************************/
3547981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidtvoid siteMgr_bandParamsConfig(TI_HANDLE hSiteMgr,  TI_BOOL updateToOS)
3548981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt{
3549981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    siteMgr_t   *pSiteMgr = (siteMgr_t *)hSiteMgr;
3550981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
3551981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    /* reconfig rates */
3552981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    if(pSiteMgr->siteMgrOperationalMode == DOT11_A_MODE)
3553981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        siteMgr_updateRates(hSiteMgr, TI_TRUE, updateToOS);
3554981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    else
3555981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        siteMgr_updateRates(hSiteMgr, TI_FALSE, updateToOS);
3556981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
3557981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    /* go to B_ONLY Mode only if WiFI bit is Set*/
3558981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    if (pSiteMgr->pDesiredParams->siteMgrWiFiAdhoc == TI_TRUE)
3559981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    {   /* Configuration For AdHoc when using external configuration */
3560981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        if (pSiteMgr->pDesiredParams->siteMgrExternalConfiguration == TI_FALSE)
3561981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        {
3562981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            siteMgr_externalConfigurationParametersSet(hSiteMgr);
3563981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        }
3564981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    }
3565981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
3566981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt}
3567981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
3568981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidtvoid siteMgr_ConfigRate(TI_HANDLE hSiteMgr)
3569981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt{
3570981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    siteMgr_t   *pSiteMgr = (siteMgr_t *)hSiteMgr;
3571981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    TI_BOOL      dot11a, b11nEnable;
3572981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    EDot11Mode   OperationMode;
3573981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
3574981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    OperationMode = pSiteMgr->siteMgrOperationalMode;
3575981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
3576981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    /* reconfig rates */
3577981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    if (OperationMode == DOT11_A_MODE)
3578981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        dot11a = TI_TRUE;
3579981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    else
3580981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        dot11a = TI_FALSE;
3581981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
3582981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    /*
3583981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    ** Specific change to ch 14, that channel is only used in Japan, and is limited
3584981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    ** to rates 1,2,5.5,11
3585981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    */
3586981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    if(pSiteMgr->pDesiredParams->siteMgrDesiredChannel == SPECIAL_BG_CHANNEL)
3587981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    {
3588981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        if(pSiteMgr->pDesiredParams->siteMgrRegstryBasicRate[OperationMode] > BASIC_RATE_SET_1_2_5_5_11)
3589981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            pSiteMgr->pDesiredParams->siteMgrRegstryBasicRate[OperationMode] = BASIC_RATE_SET_1_2_5_5_11;
3590981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
3591981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
3592981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        if(pSiteMgr->pDesiredParams->siteMgrRegstrySuppRate[OperationMode] > SUPPORTED_RATE_SET_1_2_5_5_11)
3593981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            pSiteMgr->pDesiredParams->siteMgrRegstrySuppRate[OperationMode] = SUPPORTED_RATE_SET_1_2_5_5_11;
3594981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    }
3595981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
3596981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    /* use HT MCS rates */
3597981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    StaCap_IsHtEnable (pSiteMgr->hStaCap, &b11nEnable);
3598981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    if (TI_TRUE == b11nEnable)
3599981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    {
3600981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        OperationMode = DOT11_N_MODE;
3601981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    }
3602981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
3603981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    pSiteMgr->pDesiredParams->siteMgrRegstryBasicRateMask =
3604981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        rate_BasicToDrvBitmap (pSiteMgr->pDesiredParams->siteMgrRegstryBasicRate[OperationMode], dot11a);
3605981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
3606981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    pSiteMgr->pDesiredParams->siteMgrRegstrySuppRateMask =
3607981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        rate_SupportedToDrvBitmap (pSiteMgr->pDesiredParams->siteMgrRegstrySuppRate[OperationMode], dot11a);
3608981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
3609981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    siteMgr_updateRates(pSiteMgr, dot11a, TI_TRUE);
3610981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
3611981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        /* go to B_ONLY Mode only if WiFI bit is Set*/
3612981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    if (pSiteMgr->pDesiredParams->siteMgrWiFiAdhoc == TI_TRUE)
3613981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    {   /* Configuration For AdHoc when using external configuration */
3614981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        if (pSiteMgr->pDesiredParams->siteMgrExternalConfiguration == TI_FALSE)
3615981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        {
3616981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            siteMgr_externalConfigurationParametersSet(hSiteMgr);
3617981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        }
3618981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    }
3619981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt}
3620981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
3621981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidtstatic void siteMgr_externalConfigurationParametersSet(TI_HANDLE hSiteMgr)
3622981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt{
3623981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    siteMgr_t   *pSiteMgr = (siteMgr_t *)hSiteMgr;
3624981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
3625981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    /* Overwrite the parameters for AdHoc with External Configuration */
3626981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
3627981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    if( ((pSiteMgr->pDesiredParams->siteMgrDesiredDot11Mode == DOT11_A_MODE) ||
3628981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        (pSiteMgr->pDesiredParams->siteMgrDesiredDot11Mode == DOT11_DUAL_MODE)) &&
3629981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        !pSiteMgr->pDesiredParams->siteMgrWiFiAdhoc && pSiteMgr->pDesiredParams->siteMgrDesiredBSSType == BSS_INDEPENDENT)
3630981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        return;
3631981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
3632981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
3633981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    if(pSiteMgr->pDesiredParams->siteMgrDesiredBSSType == BSS_INDEPENDENT)
3634981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    {
3635981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        pSiteMgr->siteMgrOperationalMode = DOT11_B_MODE;
3636981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        pSiteMgr->pDesiredParams->siteMgrCurrentDesiredRateMask.basicRateMask = rate_BasicToDrvBitmap (BASIC_RATE_SET_1_2_5_5_11, TI_FALSE);
3637981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        pSiteMgr->pDesiredParams->siteMgrCurrentDesiredRateMask.supportedRateMask = rate_SupportedToDrvBitmap (SUPPORTED_RATE_SET_1_2_5_5_11, TI_FALSE);
3638981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        pSiteMgr->pDesiredParams->siteMgrRegstryBasicRateMask = rate_BasicToDrvBitmap (BASIC_RATE_SET_1_2_5_5_11, TI_FALSE);
3639981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        pSiteMgr->pDesiredParams->siteMgrRegstrySuppRateMask = rate_SupportedToDrvBitmap (SUPPORTED_RATE_SET_1_2_5_5_11, TI_FALSE);
3640981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        pSiteMgr->pDesiredParams->siteMgrDesiredSlotTime = PHY_SLOT_TIME_LONG;
3641981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
3642981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        TWD_SetRadioBand(pSiteMgr->hTWD, RADIO_BAND_2_4_GHZ);
3643981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        TWD_CfgSlotTime (pSiteMgr->hTWD, PHY_SLOT_TIME_LONG);
3644981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
3645981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    }
3646981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    else
3647981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    {
3648981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        if(pSiteMgr->radioBand == RADIO_BAND_2_4_GHZ)
3649981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            pSiteMgr->siteMgrOperationalMode = DOT11_G_MODE;
3650981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        else
3651981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            pSiteMgr->siteMgrOperationalMode = DOT11_A_MODE;
3652981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        pSiteMgr->pDesiredParams->siteMgrCurrentDesiredRateMask.basicRateMask = rate_BasicToDrvBitmap (BASIC_RATE_SET_1_2_5_5_11, TI_FALSE);
3653981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        pSiteMgr->pDesiredParams->siteMgrCurrentDesiredRateMask.supportedRateMask = rate_SupportedToDrvBitmap (SUPPORTED_RATE_SET_ALL, TI_FALSE);
3654981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        pSiteMgr->pDesiredParams->siteMgrRegstryBasicRateMask = rate_BasicToDrvBitmap (BASIC_RATE_SET_1_2_5_5_11, TI_FALSE);
3655981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        pSiteMgr->pDesiredParams->siteMgrRegstrySuppRateMask = rate_SupportedToDrvBitmap (SUPPORTED_RATE_SET_ALL, TI_FALSE);
3656981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
3657981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        pSiteMgr->pDesiredParams->siteMgrDesiredSlotTime = PHY_SLOT_TIME_LONG;
3658981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
3659981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        TWD_CfgSlotTime (pSiteMgr->hTWD, PHY_SLOT_TIME_LONG);
3660981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    }
3661981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt}
3662981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
3663981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
3664981801b95b81e6d1c7a2085967406e86af0f08fcDmitry ShmidtTI_STATUS siteMgr_saveProbeRespBuffer(TI_HANDLE hSiteMgr, TMacAddr  *bssid, TI_UINT8 *pProbeRespBuffer, TI_UINT32 length)
3665981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt{
3666981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    siteEntry_t *pSite;
3667981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    siteMgr_t   *pSiteMgr = (siteMgr_t *)hSiteMgr;
3668981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
3669653850f71f9caaa41af19cadbab24bb5e655daf4Dmitry Shmidt    if (pSiteMgr == NULL)
3670653850f71f9caaa41af19cadbab24bb5e655daf4Dmitry Shmidt    {
3671653850f71f9caaa41af19cadbab24bb5e655daf4Dmitry Shmidt        return TI_NOK;
3672653850f71f9caaa41af19cadbab24bb5e655daf4Dmitry Shmidt    }
3673653850f71f9caaa41af19cadbab24bb5e655daf4Dmitry Shmidt
3674981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    TRACE0(pSiteMgr->hReport, REPORT_SEVERITY_INFORMATION , "siteMgr_saveProbeRespBuffer called\n");
3675981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
3676653850f71f9caaa41af19cadbab24bb5e655daf4Dmitry Shmidt    if (pProbeRespBuffer==NULL || length>=MAX_BEACON_BODY_LENGTH)
3677981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    {
3678981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        return TI_NOK;
3679981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    }
3680981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
3681981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    pSite = findSiteEntry(pSiteMgr, bssid);
3682981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    if (pSite==NULL)
3683981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    {
3684981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        return TI_NOK;
3685981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    }
3686981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
3687981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    os_memoryCopy(pSiteMgr->hOs, pSite->probeRespBuffer, pProbeRespBuffer, length);
3688981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    pSite->probeRespLength = length;
3689981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
3690981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    TRACE17(pSiteMgr->hReport, REPORT_SEVERITY_INFORMATION, "siteMgr_saveProbeRespBuffer: BSSID=%x-%x-%x-%x-%x-%x, TSF=%x-%x-%x-%x-%x-%x-%x-%x, \n ts=%d, rssi=%d\n channel = %d \n", pSite->bssid[0], pSite->bssid[1], pSite->bssid[2], pSite->bssid[3], pSite->bssid[4], pSite->bssid[5], pSite->tsfTimeStamp[0], pSite->tsfTimeStamp[1], pSite->tsfTimeStamp[2], pSite->tsfTimeStamp[3], pSite->tsfTimeStamp[4], pSite->tsfTimeStamp[5], pSite->tsfTimeStamp[6], pSite->tsfTimeStamp[7], os_timeStampMs(pSiteMgr->hOs), pSite->rssi, pSite->channel);
3691981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
3692981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    return TI_OK;
3693981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt}
3694981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
3695981801b95b81e6d1c7a2085967406e86af0f08fcDmitry ShmidtTI_STATUS siteMgr_saveBeaconBuffer(TI_HANDLE hSiteMgr, TMacAddr *bssid, TI_UINT8 *pBeaconBuffer, TI_UINT32 length)
3696981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt{
3697981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    siteEntry_t *pSite;
3698981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    siteMgr_t   *pSiteMgr = (siteMgr_t *)hSiteMgr;
3699981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
3700653850f71f9caaa41af19cadbab24bb5e655daf4Dmitry Shmidt    if (pSiteMgr==NULL)
3701653850f71f9caaa41af19cadbab24bb5e655daf4Dmitry Shmidt    {
3702653850f71f9caaa41af19cadbab24bb5e655daf4Dmitry Shmidt        return TI_NOK;
3703653850f71f9caaa41af19cadbab24bb5e655daf4Dmitry Shmidt    }
3704653850f71f9caaa41af19cadbab24bb5e655daf4Dmitry Shmidt
3705653850f71f9caaa41af19cadbab24bb5e655daf4Dmitry Shmidt	TRACE0(pSiteMgr->hReport, REPORT_SEVERITY_INFORMATION , "siteMgr_saveBeaconBuffer called\n");
3706981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
3707653850f71f9caaa41af19cadbab24bb5e655daf4Dmitry Shmidt    if (pBeaconBuffer==NULL || length>=MAX_BEACON_BODY_LENGTH)
3708981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    {
3709981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        return TI_NOK;
3710981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    }
3711981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
3712981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    pSite = findSiteEntry(pSiteMgr, bssid);
3713981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    if (pSite==NULL)
3714981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    {
3715981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        return TI_NOK;
3716981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    }
3717981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
3718981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    os_memoryCopy(pSiteMgr->hOs, pSite->beaconBuffer, pBeaconBuffer, length);
3719981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    pSite->beaconLength = length;
3720981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
3721981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    /*if (pSiteMgr->pSitesMgmtParams->pPrimarySite!=NULL)
3722981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    {
3723981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        if (!os_memoryCompare(pSiteMgr->hOs, pSiteMgr->pSitesMgmtParams->pPrimarySite->ssid.ssidString, pSite->ssid.ssidString, pSiteMgr->pSitesMgmtParams->pPrimarySite->ssid.len))
3724981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        {
3725981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            TRACE16(pSiteMgr->hReport, REPORT_SEVERITY_INFORMATION, "siteMgr_saveBeaconBuffer: BSSID=%x-%x-%x-%x-%x-%x, TSF=%x-%x-%x-%x-%x-%x-%x-%x, \n ts=%d, rssi=%d \n", pSite->bssid[0], pSite->bssid[1], pSite->bssid[2], pSite->bssid[3], pSite->bssid[4], pSite->bssid[5], pSite->tsfTimeStamp[0], pSite->tsfTimeStamp[1], pSite->tsfTimeStamp[2], pSite->tsfTimeStamp[3], pSite->tsfTimeStamp[4], pSite->tsfTimeStamp[5], pSite->tsfTimeStamp[6], pSite->tsfTimeStamp[7], pSite->osTimeStamp, pSite->rssi);
3726981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        }
3727981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    }*/
3728981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    if ( MAX_SSID_LEN > pSite->ssid.len )
3729981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    {
3730981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        pSite->ssid.str[pSite->ssid.len] = '\0';
3731981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    }
3732981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
3733981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    /*
3734981801b95b81e6d1c7a2085967406e86af0f08fcDmitry ShmidtTRACE9(pSiteMgr->hReport, REPORT_SEVERITY_INFORMATION, "siteMgr_saveBeaconBuffer: BSSID=%x-%x-%x-%x-%x-%x, SSID=, \n ts=%d, rssi=%d\n channel = %d \n", pSite->bssid[0], pSite->bssid[1], pSite->bssid[2], pSite->bssid[3], pSite->bssid[4], pSite->bssid[5], pSite->osTimeStamp, pSite->rssi, pSite->channel);
3735981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
3736981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    */
3737981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    return TI_OK;
3738981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt}
3739981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
3740981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
3741981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidtvoid siteMgr_resetChannelList(TI_HANDLE hSiteMgr)
3742981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt{
3743981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    TI_UINT8       index;
3744981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    siteMgr_t   *pSiteMgr = (siteMgr_t*)hSiteMgr;
3745981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
3746981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    if (hSiteMgr==NULL)
3747981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    {
3748981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        return;
3749981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    }
3750981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
3751981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    for (index=0; index < pSiteMgr->pSitesMgmtParams->pCurrentSiteTable->maxNumOfSites; index++)
3752981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    {
3753981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        if (pSiteMgr->pSitesMgmtParams->pCurrentSiteTable->siteTable[index].siteType != SITE_NULL)
3754981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        {
3755981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            pSiteMgr->pSitesMgmtParams->pCurrentSiteTable->siteTable[index].prioritySite = TI_FALSE;
3756981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        }
3757981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    }
3758981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
3759981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt}
3760981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
3761981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
3762981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidtvoid siteMgr_IsERP_Needed(TI_HANDLE hSiteMgr,TI_BOOL *useProtection,TI_BOOL *NonErpPresent,TI_BOOL *barkerPreambleType)
3763981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt{
3764981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    siteMgr_t       *pSiteMgr = (siteMgr_t*)hSiteMgr;
3765981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    paramInfo_t     param;
3766981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    siteEntry_t     *pPrimarySite = pSiteMgr->pSitesMgmtParams->pPrimarySite;
3767981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
3768981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    *useProtection = TI_FALSE;
3769981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    *NonErpPresent = TI_FALSE;
3770981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    *barkerPreambleType = TI_FALSE;
3771981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
3772981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    param.paramType = CTRL_DATA_CURRENT_IBSS_PROTECTION_PARAM;
3773981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    ctrlData_getParam(pSiteMgr->hCtrlData, &param);
3774981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
3775981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    /* On WifiAdhoc (for band B) The STa should not include in the beacon an ERP IE (see WiFi B  clause 2.2, 5.8.2) */
3776981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    if (pSiteMgr->pDesiredParams->siteMgrWiFiAdhoc == TI_TRUE)
3777981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    {
3778981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        /* Return the default => ERP is not needed */
3779981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        return;
3780981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    }
3781981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
3782981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    /* check if STA is connected */
3783981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    if (pPrimarySite)
3784981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    {
3785981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        if(pSiteMgr->siteMgrOperationalMode == DOT11_G_MODE || pSiteMgr->siteMgrOperationalMode == DOT11_DUAL_MODE)
3786981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        {
3787981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            if(param.content.ctrlDataIbssProtecionType == ERP_PROTECTION_STANDARD)
3788981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            {
3789981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                if(pPrimarySite->siteType == SITE_SELF)
3790981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                {
3791981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                    if(pPrimarySite->channel <= SITE_MGR_CHANNEL_B_G_MAX) /* if channel B&G*/
3792981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                    {
3793981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                            *useProtection = TI_TRUE;
3794981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                            *NonErpPresent = TI_TRUE;
3795981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                            *barkerPreambleType = TI_TRUE;
3796981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                    }
3797981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                }
3798981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                else if(pPrimarySite->bssType == BSS_INDEPENDENT)
3799981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                {
3800981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                    if(pPrimarySite->useProtection == TI_TRUE)
3801981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                        *useProtection = TI_TRUE;
3802981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                    if(pPrimarySite->NonErpPresent == TI_TRUE)
3803981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                        *NonErpPresent = TI_TRUE;
3804981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                    if(pPrimarySite->barkerPreambleType == PREAMBLE_SHORT)
3805981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                        *barkerPreambleType = TI_TRUE;
3806981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                }
3807981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            }
3808981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        }
3809981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    }
3810981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt}
3811981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
3812981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt/**
3813981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * \fn     siteMgr_CopyToPrimarySite()
3814981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * \brief  Responsible to copy candidate AP from SME table to site Mgr table
3815981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt *
3816981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * \note
3817981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * \param  hSiteMgr - SiteMgr handle.
3818981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * \param  pCandidate - candidate AP from SME table.
3819981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * \return TI_OK on success or TI_NOK on failure
3820981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * \sa
3821981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt */
3822981801b95b81e6d1c7a2085967406e86af0f08fcDmitry ShmidtTI_STATUS siteMgr_CopyToPrimarySite (TI_HANDLE hSiteMgr, TSiteEntry *pCandidate)
3823981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt{
3824981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    siteMgr_t   *pSiteMgr = (siteMgr_t *)hSiteMgr;
3825981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    bssEntry_t  newAP;
3826981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
3827981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    MAC_COPY (newAP.BSSID, pCandidate->bssid);
3828981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    newAP.band = pCandidate->eBand;
3829981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    newAP.RSSI = pCandidate->rssi;
3830981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    newAP.rxRate = pCandidate->rxRate;
3831981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    newAP.channel = pCandidate->channel;
3832981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    os_memoryCopy(pSiteMgr->hOs, (void *)&newAP.lastRxTSF, (void *)pCandidate->tsfTimeStamp , TIME_STAMP_LEN);
3833981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    newAP.beaconInterval = pCandidate->beaconInterval;
3834981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    newAP.capabilities = pCandidate->capabilities;
3835981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
3836981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    /* get frame type */
3837981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    if (TI_TRUE == pCandidate->probeRecv)
3838981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    {
3839981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        newAP.resultType = SCAN_RFT_PROBE_RESPONSE;
3840981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        newAP.pBuffer = (TI_UINT8 *)(pCandidate->probeRespBuffer);
3841981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        /* length of all IEs of beacon (or probe response) buffer */
3842981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        newAP.bufferLength = pCandidate->probeRespLength;
3843981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    }
3844981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    else
3845981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    {
3846981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        if (TI_TRUE == pCandidate->beaconRecv)
3847981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        {
3848981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            newAP.resultType = SCAN_RFT_BEACON;
3849981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            newAP.pBuffer = (TI_UINT8 *)(pCandidate->beaconBuffer);
3850981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            /* length of all IEs of beacon (or probe response) buffer */
3851981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            newAP.bufferLength = pCandidate->beaconLength;
3852981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
3853981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        }
3854981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        else
3855981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        {
3856981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            TRACE0(pSiteMgr->hReport, REPORT_SEVERITY_ERROR, "siteMgr_CopyToPrimarySite: try to update primary site without updated prob_res\beacon\n\n");
3857981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            return TI_NOK;
3858981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        }
3859981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    }
3860981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
3861981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    if (newAP.pBuffer == NULL)
3862981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    {
3863981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        TRACE0(pSiteMgr->hReport, REPORT_SEVERITY_ERROR, "siteMgr_CopyToPrimarySite: pBufferBody is NULL !\n");
3864981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        return TI_NOK;
3865981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    }
3866981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
3867981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    return siteMgr_overwritePrimarySite (hSiteMgr, &newAP, TI_FALSE);
3868981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt}
3869981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
3870981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
3871981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt/***********************************************************************
3872981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt *                        siteMgr_disSelectSite
3873981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt ***********************************************************************
3874981801b95b81e6d1c7a2085967406e86af0f08fcDmitry ShmidtDESCRIPTION: Called by the SME SM in order to dis select the primary site.
3875981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt			The function set the primary site pointer to NULL and set its type to type regular
3876981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
3877981801b95b81e6d1c7a2085967406e86af0f08fcDmitry ShmidtINPUT:      hSiteMgr	-	site mgr handle.
3878981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
3879981801b95b81e6d1c7a2085967406e86af0f08fcDmitry ShmidtOUTPUT:
3880981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
3881981801b95b81e6d1c7a2085967406e86af0f08fcDmitry ShmidtRETURN:     TI_OK
3882981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
3883981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt************************************************************************/
3884981801b95b81e6d1c7a2085967406e86af0f08fcDmitry ShmidtTI_STATUS siteMgr_disSelectSite(TI_HANDLE	hSiteMgr)
3885981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt{
3886981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	siteMgr_t	*pSiteMgr = (siteMgr_t *)hSiteMgr;
3887981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
3888981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	/* This protection is because in the case that the BSS was LOST the primary site was removed already. */
3889981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	if (pSiteMgr->pSitesMgmtParams->pPrimarySite != NULL)
3890981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	{
3891981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        TRACE6(pSiteMgr->hReport, REPORT_SEVERITY_INFORMATION, "siteMgr_disSelectSite REMOVE Primary ssid=, bssid= 0x%x-0x%x-0x%x-0x%x-0x%x-0x%x\n\n", pSiteMgr->pSitesMgmtParams->pPrimarySite->bssid[0], pSiteMgr->pSitesMgmtParams->pPrimarySite->bssid[1], pSiteMgr->pSitesMgmtParams->pPrimarySite->bssid[2], pSiteMgr->pSitesMgmtParams->pPrimarySite->bssid[3], pSiteMgr->pSitesMgmtParams->pPrimarySite->bssid[4], pSiteMgr->pSitesMgmtParams->pPrimarySite->bssid[5] );
3892981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
3893981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        pSiteMgr->pSitesMgmtParams->pPrimarySite->siteType = SITE_REGULAR;
3894981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt		pSiteMgr->pSitesMgmtParams->pPrevPrimarySite = pSiteMgr->pSitesMgmtParams->pPrimarySite;
3895981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt		pSiteMgr->pSitesMgmtParams->pPrimarySite = NULL;
3896981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	}
3897981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
3898981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	return TI_OK;
3899981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt}
3900981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
3901981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
3902981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt/**
3903981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt*
3904981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt* siteMgr_overwritePrimarySite
3905981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt*
3906981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt* \b Description:
3907981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt*
3908981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt* This function sets new AP as a primary site and, if requested, stores previous
3909981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt* AP's info; called during roaming
3910981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt*
3911981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt* \b ARGS:
3912981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt*
3913981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt*  I   - pCurrBSS - Current BSS handle \n
3914981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt*
3915981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt* \b RETURNS:
3916981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt*
3917981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt*  TI_OK on success, TI_NOK on failure.
3918981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt*
3919981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt* \sa
3920981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt*/
3921981801b95b81e6d1c7a2085967406e86af0f08fcDmitry ShmidtTI_STATUS siteMgr_overwritePrimarySite(TI_HANDLE hSiteMgr, bssEntry_t *newAP, TI_BOOL requiredToStorePrevSite)
3922981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt{
3923981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    siteMgr_t   *pSiteMgr = (siteMgr_t *)hSiteMgr;
3924981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    siteEntry_t *newApEntry;
3925981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    mlmeIEParsingParams_t *ieListParseParams = mlmeParser_getParseIEsBuffer(pSiteMgr->hMlmeSm);
3926981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
3927981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    TRACE6(pSiteMgr->hReport, REPORT_SEVERITY_INFORMATION, "siteMgr_overwritePrimarySite: new site bssid= 0x%x-0x%x-0x%x-0x%x-0x%x-0x%x\n\n", newAP->BSSID[0], newAP->BSSID[1], newAP->BSSID[2], newAP->BSSID[3], newAP->BSSID[4], newAP->BSSID[5]);
3928981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
3929981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    /* If previous primary site present, and requested to save it - store it */
3930981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    if (requiredToStorePrevSite)
3931981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    {
3932981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        TRACE0(pSiteMgr->hReport, REPORT_SEVERITY_INFORMATION, "siteMgr_overwritePrimarySite: required to store prev prim site \n");
3933981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        /* Store latest primary site, make ite a regular site */
3934981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        pSiteMgr->pSitesMgmtParams->pPrevPrimarySite = pSiteMgr->pSitesMgmtParams->pPrimarySite;
3935981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        pSiteMgr->pSitesMgmtParams->pPrevPrimarySite->siteType = SITE_REGULAR;
3936981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    }
3937981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    else
3938981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    {
3939981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        TRACE0(pSiteMgr->hReport, REPORT_SEVERITY_INFORMATION, "siteMgr_overwritePrimarySite: not required to store prev prim site \n");
3940981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        if (pSiteMgr->pSitesMgmtParams->pPrimarySite != NULL)
3941981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        {
3942981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            TRACE6(pSiteMgr->hReport, REPORT_SEVERITY_INFORMATION, "Removing Primary ssid=, bssid= 0x%x-0x%x-0x%x-0x%x-0x%x-0x%x\n\n", pSiteMgr->pSitesMgmtParams->pPrimarySite->bssid[0], pSiteMgr->pSitesMgmtParams->pPrimarySite->bssid[1], pSiteMgr->pSitesMgmtParams->pPrimarySite->bssid[2], pSiteMgr->pSitesMgmtParams->pPrimarySite->bssid[3], pSiteMgr->pSitesMgmtParams->pPrimarySite->bssid[4], pSiteMgr->pSitesMgmtParams->pPrimarySite->bssid[5] );
3943981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
3944981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            pSiteMgr->pSitesMgmtParams->pPrimarySite->siteType  = SITE_REGULAR;
3945981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            pSiteMgr->pSitesMgmtParams->pPrimarySite->beaconRecv = TI_FALSE;
3946981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
3947981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            pSiteMgr->pSitesMgmtParams->pPrimarySite = NULL;
3948981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        }
3949981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        else
3950981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        {
3951981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            TRACE0(pSiteMgr->hReport, REPORT_SEVERITY_INFORMATION, "siteMgr_overwritePrimarySite: primary site is NULL \n");
3952981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        }
3953981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
3954981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    }
3955981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
3956981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    /* Find not occupied entry in site table, and store new AP BSSID in */
3957981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    /* If pPrimarySite is not set to NULL, store it in pPrevSite before updating */
3958981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    newApEntry = findAndInsertSiteEntry(pSiteMgr, &(newAP->BSSID), newAP->band);
3959981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
3960981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    if (newApEntry != NULL)
3961981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    {
3962981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        /* Zero frame content */
3963981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        os_memoryZero(pSiteMgr->hOs, ieListParseParams, sizeof(mlmeIEParsingParams_t));
3964981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
3965981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        /* Update parameters of new AP */
3966981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        newApEntry->rssi            = newAP->RSSI;
3967981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        newApEntry->bssType         = BSS_INFRASTRUCTURE;
3968981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        newApEntry->dtimPeriod      = 1;
3969981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        newApEntry->rxRate          = (ERate)newAP->rxRate;
3970981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        /* Mark the site as regular in order to prevent from calling Power manager during beacon parsing */
3971981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        newApEntry->siteType        = SITE_REGULAR;
3972981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
3973981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        os_memoryCopy(pSiteMgr->hOs, &newApEntry->ssid, &pSiteMgr->pDesiredParams->siteMgrDesiredSSID, sizeof(TSsid));
3974981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
3975981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        if (newAP->resultType == SCAN_RFT_PROBE_RESPONSE)
3976981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        {
3977981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            ieListParseParams->frame.subType = PROBE_RESPONSE;
3978981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            siteMgr_saveProbeRespBuffer(hSiteMgr, &(newAP->BSSID), newAP->pBuffer, newAP->bufferLength);
3979981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        }
3980981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        else
3981981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        {
3982981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            ieListParseParams->frame.subType = BEACON;
3983981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            siteMgr_saveBeaconBuffer(hSiteMgr, &(newAP->BSSID), newAP->pBuffer, newAP->bufferLength);
3984981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        }
3985981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        ieListParseParams->band = newAP->band;
3986981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        ieListParseParams->rxChannel = newAP->channel;
3987981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        ieListParseParams->myBssid = TI_FALSE;
3988981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
3989981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        ieListParseParams->frame.content.iePacket.pRsnIe = NULL;
3990981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        ieListParseParams->frame.content.iePacket.rsnIeLen = 0;
3991981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        ieListParseParams->frame.content.iePacket.barkerPreambleMode = PREAMBLE_UNSPECIFIED;
3992981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        os_memoryCopy(pSiteMgr->hOs, (void *)ieListParseParams->frame.content.iePacket.timestamp, (void *)&newAP->lastRxTSF, TIME_STAMP_LEN);
3993981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        ieListParseParams->frame.content.iePacket.beaconInerval     = newAP->beaconInterval;
3994981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        ieListParseParams->frame.content.iePacket.capabilities  = newAP->capabilities;
3995981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
3996981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        if (mlmeParser_parseIEs(pSiteMgr->hMlmeSm, newAP->pBuffer, newAP->bufferLength, ieListParseParams) != TI_OK)
3997981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        {
3998981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            /* Error in parsing Probe response packet - exit */
3999981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            return TI_NOK;
4000981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        }
4001981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
4002981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        siteMgr_updateSite(hSiteMgr, &(newAP->BSSID), &ieListParseParams->frame, newAP->channel, newAP->band, TI_FALSE);
4003981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
4004981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        /* Select the entry as primary site */
4005981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        newApEntry->siteType = SITE_PRIMARY;
4006981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        pSiteMgr->pSitesMgmtParams->pPrimarySite = newApEntry;
4007981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        return TI_OK;
4008981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    }
4009981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    else
4010981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    {
4011981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        return TI_NOK;
4012981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    }
4013981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt}
4014981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
4015981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
4016981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt/**
4017981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * \fn     siteMgr_changeBandParams
4018981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * \brief  change band params at the SithMgr and the TWD
4019981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
4020981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * \param  hSiteMgr - handle to the siteMgr object.
4021981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * \param  radioBand - the set radio band.
4022981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * \return TI_TRUE if site matches RSN settings, TI FALSE if it doesn't
4023981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt * \sa     sme_Select
4024981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt */
4025981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidtvoid siteMgr_changeBandParams (TI_HANDLE hSiteMgr, ERadioBand radioBand)
4026981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt{
4027981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	paramInfo_t	param;
4028981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    siteMgr_t   *pSiteMgr = (siteMgr_t *)hSiteMgr;
4029981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
4030981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	/* change dot11 mode */
4031981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	param.paramType = SITE_MGR_OPERATIONAL_MODE_PARAM;
4032981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	if(radioBand == RADIO_BAND_2_4_GHZ)
4033981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt		param.content.siteMgrDot11OperationalMode = DOT11_G_MODE;
4034981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	else
4035981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt		param.content.siteMgrDot11OperationalMode = DOT11_A_MODE;
4036981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
4037981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	siteMgr_setParam(hSiteMgr, &param);
4038981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
4039981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	param.paramType = SITE_MGR_RADIO_BAND_PARAM;
4040981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	param.content.siteMgrRadioBand = radioBand;
4041981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	siteMgr_setParam(hSiteMgr, &param);
4042981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
4043981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	siteMgr_setCurrentTable(hSiteMgr, radioBand);
4044981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
4045981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	/* configure hal with common core-hal parameters */
4046981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	TWD_SetRadioBand (pSiteMgr->hTWD, radioBand);
4047981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt}
4048981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
4049981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
4050981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt/***********************************************************************
4051981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                incrementTxSessionCount
4052981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt ***********************************************************************
4053981801b95b81e6d1c7a2085967406e86af0f08fcDmitry ShmidtDESCRIPTION: Increment the Tx-Session-Counter (cyclic in range 1-7), which
4054981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt               is configured to the FW in the Join command to distinguish
4055981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt			   between Tx packets of different AP-connections.
4056981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt			 Update also the TxCtrl module.
4057981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
4058981801b95b81e6d1c7a2085967406e86af0f08fcDmitry ShmidtINPUT:      pSiteMgr    -   site mgr handle.
4059981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
4060981801b95b81e6d1c7a2085967406e86af0f08fcDmitry ShmidtOUTPUT:
4061981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
4062981801b95b81e6d1c7a2085967406e86af0f08fcDmitry ShmidtRETURN:     TI_UINT16 - the new Tx-Session-Count (range is 1-7).
4063981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
4064981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt************************************************************************/
4065981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidtstatic TI_UINT16 incrementTxSessionCount(siteMgr_t *pSiteMgr)
4066981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt{
4067981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	pSiteMgr->txSessionCount++;
4068981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	if(pSiteMgr->txSessionCount > MAX_TX_SESSION_COUNT)
4069981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt		pSiteMgr->txSessionCount = MIN_TX_SESSION_COUNT;
4070981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
4071981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	txCtrlParams_updateTxSessionCount(pSiteMgr->hTxCtrl, pSiteMgr->txSessionCount);
4072981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
4073981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt	return pSiteMgr->txSessionCount;
4074981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt}
4075981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
4076981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
4077981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt/**
4078981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt*
4079981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt* siteMgr_TxPowerHighThreshold
4080981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt*
4081981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt* \b Description:
4082981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt*
4083981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt* Called by EventMBox upon TX Power Adaptation High Threshold Trigger.
4084981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt*
4085981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt* \b ARGS:
4086981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt*
4087981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt*  I   - hSiteMgr - Site Mgr handle \n
4088981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt*
4089981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt* \b RETURNS:
4090981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt*
4091981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt*  None
4092981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt*
4093981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt* \sa
4094981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt*/
4095653850f71f9caaa41af19cadbab24bb5e655daf4Dmitry Shmidtvoid siteMgr_TxPowerHighThreshold(TI_HANDLE hSiteMgr,
4096981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                                      TI_UINT8     *data,
4097981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                                      TI_UINT8     dataLength)
4098981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt{
4099981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    siteMgr_TxPowerAdaptation(hSiteMgr, RSSI_EVENT_DIR_HIGH);
4100981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt}
4101981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
4102981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt/**
4103981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt*
4104981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt* siteMgr_TxPowerLowThreshold
4105981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt*
4106981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt* \b Description:
4107981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt*
4108981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt* Called by EventMBox upon TX Power Adaptation Low Threshold Trigger.
4109981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt*
4110981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt* \b ARGS:
4111981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt*
4112981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt*  I   - hSiteMgr - Site Mgr handle \n
4113981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt*
4114981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt* \b RETURNS:
4115981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt*
4116981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt*  None
4117981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt*
4118981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt* \sa
4119981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt*/
4120653850f71f9caaa41af19cadbab24bb5e655daf4Dmitry Shmidtvoid siteMgr_TxPowerLowThreshold(TI_HANDLE hSiteMgr,
4121981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                                      TI_UINT8     *data,
4122981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt                                      TI_UINT8     dataLength)
4123981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt{
4124981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    siteMgr_TxPowerAdaptation(hSiteMgr, RSSI_EVENT_DIR_LOW);
4125981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt}
4126981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
4127981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt/**
4128981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt*
4129981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt* siteMgr_TxPowerAdaptation
4130981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt*
4131981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt* \b Description:
4132981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt*
4133981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt* TX Power Adaptation - Used for TX power adjust .
4134981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt*
4135981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt* \b ARGS:
4136981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt*
4137981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt*  I   - hSiteMgr - Site Mgr handle \n
4138981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt*      - highLowEdge - Direction of Edge event
4139981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt*
4140981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt* \b RETURNS:
4141981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt*
4142981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt*  None
4143981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt*
4144981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt* \sa
4145981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt*/
4146981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidtstatic void siteMgr_TxPowerAdaptation(TI_HANDLE hSiteMgr, RssiEventDir_e highLowEdge)
4147981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt{
4148981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    siteMgr_t    *pSiteMgr = (siteMgr_t *)hSiteMgr;
4149981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    paramInfo_t   param;
4150981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    TI_UINT8      txPowerLevel;
4151acd89e8f547322db23ab0f7c3775082654c4b13bDmitry Shmidt    TI_STATUS     status;
4152981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
4153981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    if ((pSiteMgr->pSitesMgmtParams->pPrimarySite) && (pSiteMgr->siteMgrTxPowerEnabled))
4154981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    {
4155981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        /* getting the current Tx power  */
4156981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        param.paramType = REGULATORY_DOMAIN_CURRENT_TX_ATTENUATION_PARAM;
4157acd89e8f547322db23ab0f7c3775082654c4b13bDmitry Shmidt        status = regulatoryDomain_getParam(pSiteMgr->hRegulatoryDomain,&param);
4158981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        txPowerLevel = param.content.desiredTxPower;
4159981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
4160981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        TRACE1(pSiteMgr->hReport, REPORT_SEVERITY_INFORMATION, ": Current Tx PowerLevel = %d\n", txPowerLevel);
4161981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        TRACE1(pSiteMgr->hReport, REPORT_SEVERITY_INFORMATION, ": TxPowerRecoverLevel = %d\n", pSiteMgr->pDesiredParams->TxPowerRecoverLevel);
4162981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
4163acd89e8f547322db23ab0f7c3775082654c4b13bDmitry Shmidt        if ((status != TI_OK) || ((highLowEdge == RSSI_EVENT_DIR_HIGH) && (pSiteMgr->pDesiredParams->TxPowerRecoverLevel > txPowerLevel)))
4164981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        {
4165981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt            /* Setting the power in the FW , only if the translation succeeded */
4166981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
4167acd89e8f547322db23ab0f7c3775082654c4b13bDmitry Shmidt            siteMgr_setTemporaryTxPower (pSiteMgr, pSiteMgr->pDesiredParams->TxPowerRecoverLevel) ;  /* set lowest power lvel */;
4168981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        }
4169981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        else
4170981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        {
4171981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt             if ( highLowEdge == RSSI_EVENT_DIR_LOW )
4172981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt             {
4173acd89e8f547322db23ab0f7c3775082654c4b13bDmitry Shmidt                siteMgr_setTemporaryTxPower (pSiteMgr, txPowerLevel);  /* set highest power level */;
4174981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
4175981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt             }
4176981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt        }
4177981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt    }
4178981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt}
4179981801b95b81e6d1c7a2085967406e86af0f08fcDmitry Shmidt
4180