blob: ba1efee6b08b735c3c08a3ec6e7dce9f6c14e2c1 [file] [log] [blame]
Jeff Johnson295189b2012-06-20 16:38:30 -07001/*
Manjunathappa Prakasheb5a3a32014-02-13 19:57:55 -08002 * Copyright (c) 2012-2014 The Linux Foundation. All rights reserved.
Kiet Lam842dad02014-02-18 18:44:02 -08003 *
4 * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
5 *
6 *
7 * Permission to use, copy, modify, and/or distribute this software for
8 * any purpose with or without fee is hereby granted, provided that the
9 * above copyright notice and this permission notice appear in all
10 * copies.
11 *
12 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
13 * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
14 * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
15 * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
16 * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
17 * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
18 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
19 * PERFORMANCE OF THIS SOFTWARE.
Gopichand Nakkala92f07d82013-01-08 21:16:34 -080020 */
Kiet Lam842dad02014-02-18 18:44:02 -080021
Gopichand Nakkala92f07d82013-01-08 21:16:34 -080022/*
Kiet Lam842dad02014-02-18 18:44:02 -080023 * This file was originally distributed by Qualcomm Atheros, Inc.
24 * under proprietary terms before Copyright ownership was assigned
25 * to the Linux Foundation.
26 */
27
Kalikinkar dhara085c02f2014-02-28 15:32:12 -080028
Kiet Lam842dad02014-02-18 18:44:02 -080029/*
Jeff Johnson295189b2012-06-20 16:38:30 -070030 * This file limUtils.cc contains the utility functions
31 * LIM uses.
32 * Author: Chandra Modumudi
33 * Date: 02/13/02
34 * History:-
35 * Date Modified by Modification Information
36 * --------------------------------------------------------------------
37 */
38
39#include "schApi.h"
40#include "limUtils.h"
41#include "limTypes.h"
42#include "limSecurityUtils.h"
43#include "limPropExtsUtils.h"
44#include "limSendMessages.h"
45#include "limSerDesUtils.h"
46#include "limAdmitControl.h"
47#include "limStaHashApi.h"
48#include "dot11f.h"
49#include "wmmApsd.h"
50#include "limTrace.h"
Jeff Johnson77165482013-03-07 08:15:44 -080051#ifdef FEATURE_WLAN_DIAG_SUPPORT
Jeff Johnson295189b2012-06-20 16:38:30 -070052#include "vos_diag_core_event.h"
53#endif //FEATURE_WLAN_DIAG_SUPPORT
54#include "limIbssPeerMgmt.h"
55#include "limSessionUtils.h"
56#include "limSession.h"
57#include "vos_nvitem.h"
Chet Lanctot8cecea22014-02-11 19:09:36 -080058#ifdef WLAN_FEATURE_11W
59#include "wniCfgAp.h"
60#endif
Jeff Johnson295189b2012-06-20 16:38:30 -070061
62/* Static global used to mark situations where pMac->lim.gLimTriggerBackgroundScanDuringQuietBss is SET
63 * and limTriggerBackgroundScanDuringQuietBss() returned failure. In this case, we will stop data
64 * traffic instead of going into scan. The recover function limProcessQuietBssTimeout() needs to have
65 * this information. */
66static tAniBool glimTriggerBackgroundScanDuringQuietBss_Status = eSIR_TRUE;
67
68/* 11A Channel list to decode RX BD channel information */
69static const tANI_U8 abChannel[]= {36,40,44,48,52,56,60,64,100,104,108,112,116,
Manjunathappa Prakasheb5a3a32014-02-13 19:57:55 -080070 120,124,128,132,136,140,149,153,157,161,165
71#ifdef FEATURE_WLAN_CH144
72 ,144
73#endif
74};
75#define abChannelSize (sizeof(abChannel)/ \
76 sizeof(abChannel[0]))
Jeff Johnson295189b2012-06-20 16:38:30 -070077
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -070078#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
79static const tANI_U8 aUnsortedChannelList[]= {52,56,60,64,100,104,108,112,116,
Manjunathappa Prakasheb5a3a32014-02-13 19:57:55 -080080 120,124,128,132,136,140,36,40,44,48,149,153,157,161,165
81#ifdef FEATURE_WLAN_CH144
82 ,144
83#endif
84};
85#define aUnsortedChannelListSize (sizeof(aUnsortedChannelList)/ \
86 sizeof(aUnsortedChannelList[0]))
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -070087#endif
88
Jeff Johnson295189b2012-06-20 16:38:30 -070089//#define LIM_MAX_ACTIVE_SESSIONS 3 //defined temporarily for BT-AMP SUPPORT
90#define SUCCESS 1 //defined temporarily for BT-AMP
91
Agarwal Ashish87039eb2014-01-15 14:13:15 +053092#define MAX_BA_WINDOW_SIZE_FOR_CISCO 25
Kalikinkar dhara085c02f2014-02-28 15:32:12 -080093
94static void
95limProcessChannelSwitchSuspendLink(tpAniSirGlobal pMac,
96 eHalStatus status,
97 tANI_U32 *ctx);
Jeff Johnson295189b2012-06-20 16:38:30 -070098/** -------------------------------------------------------------
99\fn limAssignDialogueToken
100\brief Assigns dialogue token.
101\param tpAniSirGlobal pMac
102\return tpDialogueToken - dialogueToken data structure.
103 -------------------------------------------------------------*/
104
105tpDialogueToken
106limAssignDialogueToken(tpAniSirGlobal pMac)
107{
Madan Mohan Koyyalamudidfd6aa82012-10-18 20:18:43 -0700108 static tANI_U8 token;
Jeff Johnson295189b2012-06-20 16:38:30 -0700109 tpDialogueToken pCurrNode;
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530110 pCurrNode = vos_mem_malloc(sizeof(tDialogueToken));
111 if ( NULL == pCurrNode )
Jeff Johnson295189b2012-06-20 16:38:30 -0700112 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530113 PELOGE(limLog(pMac, LOGE, FL("AllocateMemory failed"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700114 return NULL;
115 }
116
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530117 vos_mem_set((void *) pCurrNode, sizeof(tDialogueToken), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -0700118 //first node in the list is being added.
119 if(NULL == pMac->lim.pDialogueTokenHead)
120 {
121 pMac->lim.pDialogueTokenHead = pMac->lim.pDialogueTokenTail = pCurrNode;
122 }
123 else
124 {
125 pMac->lim.pDialogueTokenTail->next = pCurrNode;
126 pMac->lim.pDialogueTokenTail = pCurrNode;
127 }
128 //assocId and tid of the node will be filled in by caller.
129 pCurrNode->next = NULL;
130 pCurrNode->token = token++;
Praveen Kumar Sirisilla539f7422013-08-28 17:01:05 -0700131
132 /* Dialog token should be a non-zero value */
133 if (0 == pCurrNode->token)
134 pCurrNode->token = token;
135
136 PELOG4(limLog(pMac, LOG4, FL("token assigned = %d"), pCurrNode->token);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700137 return pCurrNode;
138}
139
140/** -------------------------------------------------------------
141\fn limSearchAndDeleteDialogueToken
142\brief search dialogue token in the list and deletes it if found. returns failure if not found.
143\param tpAniSirGlobal pMac
144\param tANI_U8 token
145\param tANI_U16 assocId
146\param tANI_U16 tid
147\return eSirRetStatus - status of the search
148 -------------------------------------------------------------*/
149
150
151tSirRetStatus
152limSearchAndDeleteDialogueToken(tpAniSirGlobal pMac, tANI_U8 token, tANI_U16 assocId, tANI_U16 tid)
153{
154 tpDialogueToken pCurrNode = pMac->lim.pDialogueTokenHead;
155 tpDialogueToken pPrevNode = pMac->lim.pDialogueTokenHead;
156
157 //if the list is empty
158 if(NULL == pCurrNode)
159 return eSIR_FAILURE;
160
161 // if the matching node is the first node.
162 if(pCurrNode &&
163 (assocId == pCurrNode->assocId) &&
164 (tid == pCurrNode->tid))
165 {
166 pMac->lim.pDialogueTokenHead = pCurrNode->next;
167 //there was only one node in the list. So tail pointer also needs to be adjusted.
168 if(NULL == pMac->lim.pDialogueTokenHead)
169 pMac->lim.pDialogueTokenTail = NULL;
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530170 vos_mem_free(pCurrNode);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -0800171 pMac->lim.pDialogueTokenHead = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -0700172 return eSIR_SUCCESS;
173 }
174
175 //first node did not match. so move to the next one.
176 pCurrNode = pCurrNode->next;
177 while(NULL != pCurrNode )
178 {
179 if(token == pCurrNode->token)
180 {
181 break;
182 }
183
184 pPrevNode = pCurrNode;
185 pCurrNode = pCurrNode->next;
186 }
187
188 if(pCurrNode &&
189 (assocId == pCurrNode->assocId) &&
190 (tid == pCurrNode->tid))
191 {
192 pPrevNode->next = pCurrNode->next;
193 //if the node being deleted is the last one then we also need to move the tail pointer to the prevNode.
194 if(NULL == pCurrNode->next)
195 pMac->lim.pDialogueTokenTail = pPrevNode;
Kiet Lam842c3e12013-11-16 22:40:57 +0530196 vos_mem_free(pCurrNode);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -0800197 pMac->lim.pDialogueTokenHead = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -0700198 return eSIR_SUCCESS;
199 }
200
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700201 PELOGW(limLog(pMac, LOGW, FL("LIM does not have matching dialogue token node"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700202 return eSIR_FAILURE;
203
204}
205
206
207/** -------------------------------------------------------------
208\fn limDeleteDialogueTokenList
209\brief deletes the complete lim dialogue token linked list.
210\param tpAniSirGlobal pMac
211\return None
212 -------------------------------------------------------------*/
213void
214limDeleteDialogueTokenList(tpAniSirGlobal pMac)
215{
216 tpDialogueToken pCurrNode = pMac->lim.pDialogueTokenHead;
217
218 while(NULL != pMac->lim.pDialogueTokenHead)
219 {
220 pCurrNode = pMac->lim.pDialogueTokenHead;
221 pMac->lim.pDialogueTokenHead = pMac->lim.pDialogueTokenHead->next;
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530222 vos_mem_free(pCurrNode);
Jeff Johnson295189b2012-06-20 16:38:30 -0700223 pCurrNode = NULL;
224 }
225 pMac->lim.pDialogueTokenTail = NULL;
226}
227
228void
229limGetBssidFromBD(tpAniSirGlobal pMac, tANI_U8 * pRxPacketInfo, tANI_U8 *bssId, tANI_U32 *pIgnore)
230{
231 tpSirMacDataHdr3a pMh = WDA_GET_RX_MPDUHEADER3A(pRxPacketInfo);
232 *pIgnore = 0;
233
234 if (pMh->fc.toDS == 1 && pMh->fc.fromDS == 0)
235 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530236 vos_mem_copy( bssId, pMh->addr1, 6);
Jeff Johnson295189b2012-06-20 16:38:30 -0700237 *pIgnore = 1;
238 }
239 else if (pMh->fc.toDS == 0 && pMh->fc.fromDS == 1)
240 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530241 vos_mem_copy ( bssId, pMh->addr2, 6);
Jeff Johnson295189b2012-06-20 16:38:30 -0700242 *pIgnore = 1;
243 }
244 else if (pMh->fc.toDS == 0 && pMh->fc.fromDS == 0)
245 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530246 vos_mem_copy( bssId, pMh->addr3, 6);
Jeff Johnson295189b2012-06-20 16:38:30 -0700247 *pIgnore = 0;
248 }
249 else
250 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530251 vos_mem_copy( bssId, pMh->addr1, 6);
Jeff Johnson295189b2012-06-20 16:38:30 -0700252 *pIgnore = 1;
253 }
254}
255
256char *
257limMlmStateStr(tLimMlmStates state)
258{
Jeff Johnson295189b2012-06-20 16:38:30 -0700259 switch (state)
260 {
261 case eLIM_MLM_OFFLINE_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700262 return "eLIM_MLM_OFFLINE_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700263 case eLIM_MLM_IDLE_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700264 return "eLIM_MLM_IDLE_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700265 case eLIM_MLM_WT_PROBE_RESP_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700266 return "eLIM_MLM_WT_PROBE_RESP_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700267 case eLIM_MLM_PASSIVE_SCAN_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700268 return "eLIM_MLM_PASSIVE_SCAN_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700269 case eLIM_MLM_WT_JOIN_BEACON_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700270 return "eLIM_MLM_WT_JOIN_BEACON_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700271 case eLIM_MLM_JOINED_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700272 return "eLIM_MLM_JOINED_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700273 case eLIM_MLM_BSS_STARTED_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700274 return "eLIM_MLM_BSS_STARTED_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700275 case eLIM_MLM_WT_AUTH_FRAME2_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700276 return "eLIM_MLM_WT_AUTH_FRAME2_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700277 case eLIM_MLM_WT_AUTH_FRAME3_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700278 return "eLIM_MLM_WT_AUTH_FRAME3_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700279 case eLIM_MLM_WT_AUTH_FRAME4_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700280 return "eLIM_MLM_WT_AUTH_FRAME4_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700281 case eLIM_MLM_AUTH_RSP_TIMEOUT_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700282 return "eLIM_MLM_AUTH_RSP_TIMEOUT_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700283 case eLIM_MLM_AUTHENTICATED_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700284 return "eLIM_MLM_AUTHENTICATED_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700285 case eLIM_MLM_WT_ASSOC_RSP_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700286 return "eLIM_MLM_WT_ASSOC_RSP_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700287 case eLIM_MLM_WT_REASSOC_RSP_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700288 return "eLIM_MLM_WT_REASSOC_RSP_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700289 case eLIM_MLM_WT_FT_REASSOC_RSP_STATE:
290 return "eLIM_MLM_WT_FT_REASSOC_RSP_STATE";
291 case eLIM_MLM_WT_DEL_STA_RSP_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700292 return "eLIM_MLM_WT_DEL_STA_RSP_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700293 case eLIM_MLM_WT_DEL_BSS_RSP_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700294 return "eLIM_MLM_WT_DEL_BSS_RSP_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700295 case eLIM_MLM_WT_ADD_STA_RSP_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700296 return "eLIM_MLM_WT_ADD_STA_RSP_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700297 case eLIM_MLM_WT_ADD_BSS_RSP_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700298 return "eLIM_MLM_WT_ADD_BSS_RSP_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700299 case eLIM_MLM_REASSOCIATED_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700300 return "eLIM_MLM_REASSOCIATED_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700301 case eLIM_MLM_LINK_ESTABLISHED_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700302 return "eLIM_MLM_LINK_ESTABLISHED_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700303 case eLIM_MLM_WT_ASSOC_CNF_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700304 return "eLIM_MLM_WT_ASSOC_CNF_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700305 case eLIM_MLM_WT_ADD_BSS_RSP_ASSOC_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700306 return "eLIM_MLM_WT_ADD_BSS_RSP_ASSOC_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700307 case eLIM_MLM_WT_ADD_BSS_RSP_REASSOC_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700308 return "eLIM_MLM_WT_ADD_BSS_RSP_REASSOC_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700309 case eLIM_MLM_WT_ADD_BSS_RSP_FT_REASSOC_STATE:
310 return "eLIM_MLM_WT_ADD_BSS_RSP_FT_REASSOC_STATE";
311 case eLIM_MLM_WT_ASSOC_DEL_STA_RSP_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700312 return "eLIM_MLM_WT_ASSOC_DEL_STA_RSP_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700313 case eLIM_MLM_WT_SET_BSS_KEY_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700314 return "eLIM_MLM_WT_SET_BSS_KEY_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700315 case eLIM_MLM_WT_SET_STA_KEY_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700316 return "eLIM_MLM_WT_SET_STA_KEY_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700317 default:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700318 return "INVALID MLM state";
Jeff Johnson295189b2012-06-20 16:38:30 -0700319 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700320}
321
322void
323limPrintMlmState(tpAniSirGlobal pMac, tANI_U16 logLevel, tLimMlmStates state)
324{
325 limLog(pMac, logLevel, limMlmStateStr(state));
326}
327
328char *
329limSmeStateStr(tLimSmeStates state)
330{
331#ifdef FIXME_GEN6
332 switch (state)
333 {
334 case eLIM_SME_OFFLINE_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700335 return "eLIM_SME_OFFLINE_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700336 case eLIM_SME_IDLE_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700337 return "eLIM_SME_IDLE_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700338 case eLIM_SME_SUSPEND_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700339 return "eLIM_SME_SUSPEND_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700340 case eLIM_SME_WT_SCAN_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700341 return "eLIM_SME_WT_SCAN_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700342 case eLIM_SME_WT_JOIN_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700343 return "eLIM_SME_WT_JOIN_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700344 case eLIM_SME_WT_AUTH_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700345 return "eLIM_SME_WT_AUTH_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700346 case eLIM_SME_WT_ASSOC_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700347 return "eLIM_SME_WT_ASSOC_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700348 case eLIM_SME_WT_REASSOC_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700349 return "eLIM_SME_WT_REASSOC_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700350 case eLIM_SME_WT_REASSOC_LINK_FAIL_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700351 return "eLIM_SME_WT_REASSOC_LINK_FAIL_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700352 case eLIM_SME_JOIN_FAILURE_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700353 return "eLIM_SME_JOIN_FAILURE_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700354 case eLIM_SME_ASSOCIATED_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700355 return "eLIM_SME_ASSOCIATED_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700356 case eLIM_SME_REASSOCIATED_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700357 return "eLIM_SME_REASSOCIATED_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700358 case eLIM_SME_LINK_EST_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700359 return "eLIM_SME_LINK_EST_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700360 case eLIM_SME_LINK_EST_WT_SCAN_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700361 return "eLIM_SME_LINK_EST_WT_SCAN_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700362 case eLIM_SME_WT_PRE_AUTH_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700363 return "eLIM_SME_WT_PRE_AUTH_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700364 case eLIM_SME_WT_DISASSOC_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700365 return "eLIM_SME_WT_DISASSOC_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700366 case eLIM_SME_WT_DEAUTH_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700367 return "eLIM_SME_WT_DEAUTH_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700368 case eLIM_SME_WT_START_BSS_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700369 return "eLIM_SME_WT_START_BSS_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700370 case eLIM_SME_WT_STOP_BSS_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700371 return "eLIM_SME_WT_STOP_BSS_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700372 case eLIM_SME_NORMAL_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700373 return "eLIM_SME_NORMAL_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700374 case eLIM_SME_CHANNEL_SCAN_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700375 return "eLIM_SME_CHANNEL_SCAN_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700376 case eLIM_SME_NORMAL_CHANNEL_SCAN_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700377 return "eLIM_SME_NORMAL_CHANNEL_SCAN_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700378 default:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700379 return "INVALID SME state";
Jeff Johnson295189b2012-06-20 16:38:30 -0700380 }
381#endif
382return "";
383}
384
385
386char* limDot11ModeStr(tpAniSirGlobal pMac, tANI_U8 dot11Mode)
387{
388#ifdef FIXME_GEN6
389
390 switch(dot11Mode)
391 {
392 case WNI_CFG_DOT11_MODE_ALL:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700393 return "ALL";
Jeff Johnson295189b2012-06-20 16:38:30 -0700394 case WNI_CFG_DOT11_MODE_11A:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700395 return "11A";
396 case WNI_CFG_DOT11_MODE_11B:
397 return "11B";
398 case WNI_CFG_DOT11_MODE_11G:
399 return "11G";
400 case WNI_CFG_DOT11_MODE_11N:
401 return "11N";
402 case WNI_CFG_DOT11_MODE_POLARIS:
403 return "Polaris";
404 case WNI_CFG_DOT11_MODE_TITAN:
405 return "Titan";
Jeff Johnson295189b2012-06-20 16:38:30 -0700406 case WNI_CFG_DOT11_MODE_TAURUS:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700407 return "Taurus";
Jeff Johnson295189b2012-06-20 16:38:30 -0700408 default:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700409 return "Invalid Dot11 Mode";
Jeff Johnson295189b2012-06-20 16:38:30 -0700410 }
411#endif
412return "";
413}
414
415
416char* limStaOpRateModeStr(tStaRateMode opRateMode)
417{
418#ifdef FIXME_GEN6
419
420 switch(opRateMode)
421 {
422 case eSTA_TAURUS:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700423 return "Taurus";
Jeff Johnson295189b2012-06-20 16:38:30 -0700424 case eSTA_11a:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700425 return "11A";
426 case eSTA_11b:
427 return "11B";
428 case eSTA_11bg:
429 return "11G";
430 case eSTA_11n:
431 return "11N";
432 case eSTA_POLARIS:
433 return "Polaris";
Jeff Johnson295189b2012-06-20 16:38:30 -0700434 case eSTA_TITAN:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700435 return "Titan";
Jeff Johnson295189b2012-06-20 16:38:30 -0700436 default:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700437 return "Invalid Dot11 Mode";
Jeff Johnson295189b2012-06-20 16:38:30 -0700438 }
439#endif
440return "";
441}
442
443char* limBssTypeStr(tSirBssType bssType)
444{
445 switch(bssType)
446 {
447 case eSIR_INFRASTRUCTURE_MODE:
448 return "eSIR_INFRASTRUCTURE_MODE";
449 case eSIR_IBSS_MODE:
450 return "eSIR_IBSS_MODE";
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700451 case eSIR_BTAMP_STA_MODE:
Jeff Johnson295189b2012-06-20 16:38:30 -0700452 return "eSIR_BTAMP_STA_MODE";
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700453 case eSIR_BTAMP_AP_MODE:
Jeff Johnson295189b2012-06-20 16:38:30 -0700454 return "eSIR_BTAMP_AP_MODE";
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700455 case eSIR_AUTO_MODE:
Jeff Johnson295189b2012-06-20 16:38:30 -0700456 return "eSIR_AUTO_MODE";
457 default:
458 return "Invalid BSS Type";
459 }
460}
461
462void
463limPrintSmeState(tpAniSirGlobal pMac, tANI_U16 logLevel, tLimSmeStates state)
464{
465 limLog(pMac, logLevel, limSmeStateStr(state));
466}
467
468char *limMsgStr(tANI_U32 msgType)
469{
470#ifdef FIXME_GEN6
471 switch (msgType)
472 {
473 case eWNI_SME_START_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700474 return "eWNI_SME_START_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700475 case eWNI_SME_START_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700476 return "eWNI_SME_START_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700477 case eWNI_SME_SYS_READY_IND:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700478 return "eWNI_SME_SYS_READY_IND";
Jeff Johnson295189b2012-06-20 16:38:30 -0700479 case eWNI_SME_SCAN_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700480 return "eWNI_SME_SCAN_REQ";
Jeff Johnsone7245742012-09-05 17:12:55 -0700481#ifdef FEATURE_OEM_DATA_SUPPORT
482 case eWNI_SME_OEM_DATA_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700483 return "eWNI_SME_OEM_DATA_REQ";
Jeff Johnsone7245742012-09-05 17:12:55 -0700484 case eWNI_SME_OEM_DATA_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700485 return "eWNI_SME_OEM_DATA_RSP";
Jeff Johnsone7245742012-09-05 17:12:55 -0700486#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700487 case eWNI_SME_SCAN_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700488 return "eWNI_SME_SCAN_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700489 case eWNI_SME_JOIN_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700490 return "eWNI_SME_JOIN_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700491 case eWNI_SME_JOIN_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700492 return "eWNI_SME_JOIN_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700493 case eWNI_SME_SETCONTEXT_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700494 return "eWNI_SME_SETCONTEXT_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700495 case eWNI_SME_SETCONTEXT_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700496 return "eWNI_SME_SETCONTEXT_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700497 case eWNI_SME_REASSOC_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700498 return "eWNI_SME_REASSOC_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700499 case eWNI_SME_REASSOC_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700500 return "eWNI_SME_REASSOC_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700501 case eWNI_SME_AUTH_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700502 return "eWNI_SME_AUTH_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700503 case eWNI_SME_AUTH_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700504 return "eWNI_SME_AUTH_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700505 case eWNI_SME_DISASSOC_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700506 return "eWNI_SME_DISASSOC_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700507 case eWNI_SME_DISASSOC_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700508 return "eWNI_SME_DISASSOC_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700509 case eWNI_SME_DISASSOC_IND:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700510 return "eWNI_SME_DISASSOC_IND";
Jeff Johnson295189b2012-06-20 16:38:30 -0700511 case eWNI_SME_DISASSOC_CNF:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700512 return "eWNI_SME_DISASSOC_CNF";
Jeff Johnson295189b2012-06-20 16:38:30 -0700513 case eWNI_SME_DEAUTH_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700514 return "eWNI_SME_DEAUTH_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700515 case eWNI_SME_DEAUTH_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700516 return "eWNI_SME_DEAUTH_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700517 case eWNI_SME_DEAUTH_IND:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700518 return "eWNI_SME_DEAUTH_IND";
Jeff Johnson295189b2012-06-20 16:38:30 -0700519 case eWNI_SME_WM_STATUS_CHANGE_NTF:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700520 return "eWNI_SME_WM_STATUS_CHANGE_NTF";
Jeff Johnson295189b2012-06-20 16:38:30 -0700521 case eWNI_SME_START_BSS_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700522 return "eWNI_SME_START_BSS_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700523 case eWNI_SME_START_BSS_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700524 return "eWNI_SME_START_BSS_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700525 case eWNI_SME_AUTH_IND:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700526 return "eWNI_SME_AUTH_IND";
Jeff Johnson295189b2012-06-20 16:38:30 -0700527 case eWNI_SME_ASSOC_IND:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700528 return "eWNI_SME_ASSOC_IND";
Jeff Johnson295189b2012-06-20 16:38:30 -0700529 case eWNI_SME_ASSOC_CNF:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700530 return "eWNI_SME_ASSOC_CNF";
Jeff Johnson295189b2012-06-20 16:38:30 -0700531 case eWNI_SME_REASSOC_IND:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700532 return "eWNI_SME_REASSOC_IND";
Jeff Johnson295189b2012-06-20 16:38:30 -0700533 case eWNI_SME_REASSOC_CNF:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700534 return "eWNI_SME_REASSOC_CNF";
Jeff Johnson295189b2012-06-20 16:38:30 -0700535 case eWNI_SME_SWITCH_CHL_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700536 return "eWNI_SME_SWITCH_CHL_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700537 case eWNI_SME_SWITCH_CHL_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700538 return "eWNI_SME_SWITCH_CHL_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700539 case eWNI_SME_SWITCH_CHL_CB_PRIMARY_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700540 return "eWNI_SME_SWITCH_CHL_CB_PRIMARY_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700541 case eWNI_SME_SWITCH_CHL_CB_SECONDARY_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700542 return "eWNI_SME_SWITCH_CHL_CB_SECONDARY_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700543 case eWNI_SME_STOP_BSS_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700544 return "eWNI_SME_STOP_BSS_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700545 case eWNI_SME_STOP_BSS_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700546 return "eWNI_SME_STOP_BSS_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700547 case eWNI_SME_PROMISCUOUS_MODE_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700548 return "eWNI_SME_PROMISCUOUS_MODE_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700549 case eWNI_SME_PROMISCUOUS_MODE_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700550 return "eWNI_SME_PROMISCUOUS_MODE_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700551 case eWNI_SME_NEIGHBOR_BSS_IND:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700552 return "eWNI_SME_NEIGHBOR_BSS_IND";
Jeff Johnson295189b2012-06-20 16:38:30 -0700553 case eWNI_SME_MEASUREMENT_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700554 return "eWNI_SME_MEASUREMENT_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700555 case eWNI_SME_MEASUREMENT_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700556 return "eWNI_SME_MEASUREMENT_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700557 case eWNI_SME_MEASUREMENT_IND:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700558 return "eWNI_SME_MEASUREMENT_IND";
Jeff Johnson295189b2012-06-20 16:38:30 -0700559 case eWNI_SME_SET_WDS_INFO_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700560 return "eWNI_SME_SET_WDS_INFO_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700561 case eWNI_SME_SET_WDS_INFO_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700562 return "eWNI_SME_SET_WDS_INFO_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700563 case eWNI_SME_WDS_INFO_IND:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700564 return "eWNI_SME_WDS_INFO_IND";
Jeff Johnson295189b2012-06-20 16:38:30 -0700565 case eWNI_SME_DEAUTH_CNF:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700566 return "eWNI_SME_DEAUTH_CNF";
Jeff Johnson295189b2012-06-20 16:38:30 -0700567 case eWNI_SME_MIC_FAILURE_IND:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700568 return "eWNI_SME_MIC_FAILURE_IND";
Jeff Johnson295189b2012-06-20 16:38:30 -0700569 case eWNI_SME_ADDTS_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700570 return "eWNI_SME_ADDTS_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700571 case eWNI_SME_ADDTS_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700572 return "eWNI_SME_ADDTS_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700573 case eWNI_SME_ADDTS_CNF:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700574 return "eWNI_SME_ADDTS_CNF";
Jeff Johnson295189b2012-06-20 16:38:30 -0700575 case eWNI_SME_ADDTS_IND:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700576 return "eWNI_SME_ADDTS_IND";
Jeff Johnson295189b2012-06-20 16:38:30 -0700577 case eWNI_SME_DELTS_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700578 return "eWNI_SME_DELTS_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700579 case eWNI_SME_DELTS_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700580 return "eWNI_SME_DELTS_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700581 case eWNI_SME_DELTS_IND:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700582 return "eWNI_SME_DELTS_IND";
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -0800583#if defined WLAN_FEATURE_VOWIFI_11R || defined FEATURE_WLAN_ESE || defined(FEATURE_WLAN_LFR)
Srinivas Girigowdad34cedb2013-01-25 13:33:11 -0800584 case eWNI_SME_GET_ROAM_RSSI_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700585 return "eWNI_SME_GET_ROAM_RSSI_REQ";
Srinivas Girigowdad34cedb2013-01-25 13:33:11 -0800586 case eWNI_SME_GET_ROAM_RSSI_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700587 return "eWNI_SME_GET_ROAM_RSSI_RSP";
Srinivas Girigowdad34cedb2013-01-25 13:33:11 -0800588#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700589
Jeff Johnson295189b2012-06-20 16:38:30 -0700590 case WDA_SUSPEND_ACTIVITY_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700591 return "WDA_SUSPEND_ACTIVITY_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700592 case SIR_LIM_RETRY_INTERRUPT_MSG:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700593 return "SIR_LIM_RETRY_INTERRUPT_MSG";
Jeff Johnson295189b2012-06-20 16:38:30 -0700594 case SIR_BB_XPORT_MGMT_MSG:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700595 return "SIR_BB_XPORT_MGMT_MSG";
Jeff Johnson295189b2012-06-20 16:38:30 -0700596 case SIR_LIM_INV_KEY_INTERRUPT_MSG:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700597 return "SIR_LIM_INV_KEY_INTERRUPT_MSG";
Jeff Johnson295189b2012-06-20 16:38:30 -0700598 case SIR_LIM_KEY_ID_INTERRUPT_MSG:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700599 return "SIR_LIM_KEY_ID_INTERRUPT_MSG";
Jeff Johnson295189b2012-06-20 16:38:30 -0700600 case SIR_LIM_REPLAY_THRES_INTERRUPT_MSG:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700601 return "SIR_LIM_REPLAY_THRES_INTERRUPT_MSG";
Jeff Johnson295189b2012-06-20 16:38:30 -0700602 case SIR_LIM_MIN_CHANNEL_TIMEOUT:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700603 return "SIR_LIM_MIN_CHANNEL_TIMEOUT";
Jeff Johnson295189b2012-06-20 16:38:30 -0700604 case SIR_LIM_MAX_CHANNEL_TIMEOUT:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700605 return "SIR_LIM_MAX_CHANNEL_TIMEOUT";
Jeff Johnson295189b2012-06-20 16:38:30 -0700606 case SIR_LIM_JOIN_FAIL_TIMEOUT:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700607 return "SIR_LIM_JOIN_FAIL_TIMEOUT";
Jeff Johnson295189b2012-06-20 16:38:30 -0700608 case SIR_LIM_AUTH_FAIL_TIMEOUT:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700609 return "SIR_LIM_AUTH_FAIL_TIMEOUT";
Jeff Johnson295189b2012-06-20 16:38:30 -0700610 case SIR_LIM_AUTH_RSP_TIMEOUT:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700611 return "SIR_LIM_AUTH_RSP_TIMEOUT";
Jeff Johnson295189b2012-06-20 16:38:30 -0700612 case SIR_LIM_ASSOC_FAIL_TIMEOUT:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700613 return "SIR_LIM_ASSOC_FAIL_TIMEOUT";
Jeff Johnson295189b2012-06-20 16:38:30 -0700614 case SIR_LIM_REASSOC_FAIL_TIMEOUT:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700615 return "SIR_LIM_REASSOC_FAIL_TIMEOUT";
Jeff Johnson295189b2012-06-20 16:38:30 -0700616 case SIR_LIM_HEART_BEAT_TIMEOUT:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700617 return "SIR_LIM_HEART_BEAT_TIMEOUT";
Jeff Johnson295189b2012-06-20 16:38:30 -0700618 case SIR_LIM_ADDTS_RSP_TIMEOUT:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700619 return "SIR_LIM_ADDTS_RSP_TIMEOUT";
Jeff Johnson295189b2012-06-20 16:38:30 -0700620 case SIR_LIM_CHANNEL_SCAN_TIMEOUT:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700621 return "SIR_LIM_CHANNEL_SCAN_TIMEOUT";
Jeff Johnson295189b2012-06-20 16:38:30 -0700622 case SIR_LIM_LINK_TEST_DURATION_TIMEOUT:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700623 return "SIR_LIM_LINK_TEST_DURATION_TIMEOUT";
Jeff Johnson295189b2012-06-20 16:38:30 -0700624 case SIR_LIM_HASH_MISS_THRES_TIMEOUT:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700625 return "SIR_LIM_HASH_MISS_THRES_TIMEOUT";
Jeff Johnson295189b2012-06-20 16:38:30 -0700626 case SIR_LIM_KEEPALIVE_TIMEOUT:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700627 return "SIR_LIM_KEEPALIVE_TIMEOUT";
Jeff Johnson295189b2012-06-20 16:38:30 -0700628 case SIR_LIM_UPDATE_OLBC_CACHEL_TIMEOUT:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700629 return "SIR_LIM_UPDATE_OLBC_CACHEL_TIMEOUT";
Jeff Johnson295189b2012-06-20 16:38:30 -0700630 case SIR_LIM_CNF_WAIT_TIMEOUT:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700631 return "SIR_LIM_CNF_WAIT_TIMEOUT";
Jeff Johnson295189b2012-06-20 16:38:30 -0700632 case SIR_LIM_RADAR_DETECT_IND:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700633 return "SIR_LIM_RADAR_DETECT_IND";
Jeff Johnson295189b2012-06-20 16:38:30 -0700634#ifdef WLAN_FEATURE_VOWIFI_11R
635 case SIR_LIM_FT_PREAUTH_RSP_TIMEOUT:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700636 return "SIR_LIM_FT_PREAUTH_RSP_TIMEOUT";
Jeff Johnson295189b2012-06-20 16:38:30 -0700637#endif
638
639 case SIR_HAL_APP_SETUP_NTF:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700640 return "SIR_HAL_APP_SETUP_NTF";
Jeff Johnson295189b2012-06-20 16:38:30 -0700641 case SIR_HAL_INITIAL_CAL_FAILED_NTF:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700642 return "SIR_HAL_INITIAL_CAL_FAILED_NTF";
Jeff Johnson295189b2012-06-20 16:38:30 -0700643 case SIR_HAL_NIC_OPER_NTF:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700644 return "SIR_HAL_NIC_OPER_NTF";
Jeff Johnson295189b2012-06-20 16:38:30 -0700645 case SIR_HAL_INIT_START_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700646 return "SIR_HAL_INIT_START_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700647 case SIR_HAL_SHUTDOWN_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700648 return "SIR_HAL_SHUTDOWN_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700649 case SIR_HAL_SHUTDOWN_CNF:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700650 return "SIR_HAL_SHUTDOWN_CNF";
Jeff Johnson295189b2012-06-20 16:38:30 -0700651 case SIR_HAL_RESET_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700652 return "SIR_HAL_RESET_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700653 case SIR_HAL_RESET_CNF:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700654 return "SIR_HAL_RESET_CNF";
Jeff Johnson295189b2012-06-20 16:38:30 -0700655 case SIR_WRITE_TO_TD:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700656 return "SIR_WRITE_TO_TD";
Jeff Johnson295189b2012-06-20 16:38:30 -0700657
658 case WNI_CFG_PARAM_UPDATE_IND:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700659 return "WNI_CFG_PARAM_UPDATE_IND";
Jeff Johnson295189b2012-06-20 16:38:30 -0700660 case WNI_CFG_DNLD_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700661 return "WNI_CFG_DNLD_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700662 case WNI_CFG_DNLD_CNF:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700663 return "WNI_CFG_DNLD_CNF";
Jeff Johnson295189b2012-06-20 16:38:30 -0700664 case WNI_CFG_GET_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700665 return "WNI_CFG_GET_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700666 case WNI_CFG_SET_CNF:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700667 return "WNI_CFG_SET_CNF";
Jeff Johnson295189b2012-06-20 16:38:30 -0700668 case WNI_CFG_GET_ATTRIB_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700669 return "WNI_CFG_GET_ATTRIB_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700670 case WNI_CFG_ADD_GRP_ADDR_CNF:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700671 return "WNI_CFG_ADD_GRP_ADDR_CNF";
Jeff Johnson295189b2012-06-20 16:38:30 -0700672 case WNI_CFG_DEL_GRP_ADDR_CNF:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700673 return "WNI_CFG_DEL_GRP_ADDR_CNF";
Jeff Johnson295189b2012-06-20 16:38:30 -0700674 case ANI_CFG_GET_RADIO_STAT_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700675 return "ANI_CFG_GET_RADIO_STAT_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700676 case ANI_CFG_GET_PER_STA_STAT_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700677 return "ANI_CFG_GET_PER_STA_STAT_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700678 case ANI_CFG_GET_AGG_STA_STAT_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700679 return "ANI_CFG_GET_AGG_STA_STAT_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700680 case ANI_CFG_CLEAR_STAT_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700681 return "ANI_CFG_CLEAR_STAT_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700682 case WNI_CFG_DNLD_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700683 return "WNI_CFG_DNLD_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700684 case WNI_CFG_GET_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700685 return "WNI_CFG_GET_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700686 case WNI_CFG_SET_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700687 return "WNI_CFG_SET_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700688 case WNI_CFG_SET_REQ_NO_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700689 return "WNI_CFG_SET_REQ_NO_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700690 case eWNI_PMC_ENTER_IMPS_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700691 return "eWNI_PMC_ENTER_IMPS_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700692 case eWNI_PMC_EXIT_IMPS_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700693 return "eWNI_PMC_EXIT_IMPS_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700694 case eWNI_PMC_ENTER_BMPS_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700695 return "eWNI_PMC_ENTER_BMPS_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700696 case eWNI_PMC_EXIT_BMPS_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700697 return "eWNI_PMC_EXIT_BMPS_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700698 case eWNI_PMC_EXIT_BMPS_IND:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700699 return "eWNI_PMC_EXIT_BMPS_IND";
Yathish9f22e662012-12-10 14:21:35 -0800700 case eWNI_SME_SET_BCN_FILTER_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700701 return "eWNI_SME_SET_BCN_FILTER_REQ";
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -0800702#if defined(FEATURE_WLAN_ESE) && defined(FEATURE_WLAN_ESE_UPLOAD)
Srinivas Girigowda5cecb202013-10-08 09:13:25 -0700703 case eWNI_SME_GET_TSM_STATS_REQ:
704 return "eWNI_SME_GET_TSM_STATS_REQ";
705 case eWNI_SME_GET_TSM_STATS_RSP:
706 return "eWNI_SME_GET_TSM_STATS_RSP";
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -0800707#endif /* FEATURE_WLAN_ESE && FEATURE_WLAN_ESE_UPLOAD */
Jeff Johnson295189b2012-06-20 16:38:30 -0700708 default:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700709 return "INVALID SME message";
Jeff Johnson295189b2012-06-20 16:38:30 -0700710 }
711#endif
712return "";
713}
714
715
716
717char *limResultCodeStr(tSirResultCodes resultCode)
718{
Jeff Johnson295189b2012-06-20 16:38:30 -0700719 switch (resultCode)
720 {
721 case eSIR_SME_SUCCESS:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700722 return "eSIR_SME_SUCCESS";
Jeff Johnson295189b2012-06-20 16:38:30 -0700723 case eSIR_EOF_SOF_EXCEPTION:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700724 return "eSIR_EOF_SOF_EXCEPTION";
Jeff Johnson295189b2012-06-20 16:38:30 -0700725 case eSIR_BMU_EXCEPTION:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700726 return "eSIR_BMU_EXCEPTION";
Jeff Johnson295189b2012-06-20 16:38:30 -0700727 case eSIR_LOW_PDU_EXCEPTION:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700728 return "eSIR_LOW_PDU_EXCEPTION";
Jeff Johnson295189b2012-06-20 16:38:30 -0700729 case eSIR_USER_TRIG_RESET:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700730 return"eSIR_USER_TRIG_RESET";
Jeff Johnson295189b2012-06-20 16:38:30 -0700731 case eSIR_LOGP_EXCEPTION:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700732 return "eSIR_LOGP_EXCEPTION";
Jeff Johnson295189b2012-06-20 16:38:30 -0700733 case eSIR_CP_EXCEPTION:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700734 return "eSIR_CP_EXCEPTION";
Jeff Johnson295189b2012-06-20 16:38:30 -0700735 case eSIR_STOP_BSS:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700736 return "eSIR_STOP_BSS";
Jeff Johnson295189b2012-06-20 16:38:30 -0700737 case eSIR_AHB_HANG_EXCEPTION:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700738 return "eSIR_AHB_HANG_EXCEPTION";
Jeff Johnson295189b2012-06-20 16:38:30 -0700739 case eSIR_DPU_EXCEPTION:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700740 return "eSIR_DPU_EXCEPTION";
Jeff Johnson295189b2012-06-20 16:38:30 -0700741 case eSIR_RXP_EXCEPTION:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700742 return "eSIR_RXP_EXCEPTION";
Jeff Johnson295189b2012-06-20 16:38:30 -0700743 case eSIR_MCPU_EXCEPTION:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700744 return "eSIR_MCPU_EXCEPTION";
Jeff Johnson295189b2012-06-20 16:38:30 -0700745 case eSIR_MCU_EXCEPTION:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700746 return "eSIR_MCU_EXCEPTION";
Jeff Johnson295189b2012-06-20 16:38:30 -0700747 case eSIR_MTU_EXCEPTION:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700748 return "eSIR_MTU_EXCEPTION";
Jeff Johnson295189b2012-06-20 16:38:30 -0700749 case eSIR_MIF_EXCEPTION:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700750 return "eSIR_MIF_EXCEPTION";
Jeff Johnson295189b2012-06-20 16:38:30 -0700751 case eSIR_FW_EXCEPTION:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700752 return "eSIR_FW_EXCEPTION";
Jeff Johnson295189b2012-06-20 16:38:30 -0700753 case eSIR_MAILBOX_SANITY_CHK_FAILED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700754 return "eSIR_MAILBOX_SANITY_CHK_FAILED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700755 case eSIR_RADIO_HW_SWITCH_STATUS_IS_OFF:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700756 return "eSIR_RADIO_HW_SWITCH_STATUS_IS_OFF";
Jeff Johnson295189b2012-06-20 16:38:30 -0700757 case eSIR_CFB_FLAG_STUCK_EXCEPTION:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700758 return "eSIR_CFB_FLAG_STUCK_EXCEPTION";
Jeff Johnson295189b2012-06-20 16:38:30 -0700759 case eSIR_SME_BASIC_RATES_NOT_SUPPORTED_STATUS:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700760 return "eSIR_SME_BASIC_RATES_NOT_SUPPORTED_STATUS";
Jeff Johnson295189b2012-06-20 16:38:30 -0700761 case eSIR_SME_INVALID_PARAMETERS:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700762 return "eSIR_SME_INVALID_PARAMETERS";
Jeff Johnson295189b2012-06-20 16:38:30 -0700763 case eSIR_SME_UNEXPECTED_REQ_RESULT_CODE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700764 return "eSIR_SME_UNEXPECTED_REQ_RESULT_CODE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700765 case eSIR_SME_RESOURCES_UNAVAILABLE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700766 return "eSIR_SME_RESOURCES_UNAVAILABLE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700767 case eSIR_SME_SCAN_FAILED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700768 return "eSIR_SME_SCAN_FAILED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700769 case eSIR_SME_BSS_ALREADY_STARTED_OR_JOINED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700770 return "eSIR_SME_BSS_ALREADY_STARTED_OR_JOINED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700771 case eSIR_SME_LOST_LINK_WITH_PEER_RESULT_CODE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700772 return "eSIR_SME_LOST_LINK_WITH_PEER_RESULT_CODE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700773 case eSIR_SME_REFUSED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700774 return "eSIR_SME_REFUSED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700775 case eSIR_SME_JOIN_TIMEOUT_RESULT_CODE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700776 return "eSIR_SME_JOIN_TIMEOUT_RESULT_CODE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700777 case eSIR_SME_AUTH_TIMEOUT_RESULT_CODE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700778 return "eSIR_SME_AUTH_TIMEOUT_RESULT_CODE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700779 case eSIR_SME_ASSOC_TIMEOUT_RESULT_CODE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700780 return "eSIR_SME_ASSOC_TIMEOUT_RESULT_CODE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700781 case eSIR_SME_REASSOC_TIMEOUT_RESULT_CODE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700782 return "eSIR_SME_REASSOC_TIMEOUT_RESULT_CODE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700783 case eSIR_SME_MAX_NUM_OF_PRE_AUTH_REACHED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700784 return "eSIR_SME_MAX_NUM_OF_PRE_AUTH_REACHED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700785 case eSIR_SME_AUTH_REFUSED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700786 return "eSIR_SME_AUTH_REFUSED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700787 case eSIR_SME_INVALID_WEP_DEFAULT_KEY:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700788 return "eSIR_SME_INVALID_WEP_DEFAULT_KEY";
Jeff Johnson295189b2012-06-20 16:38:30 -0700789 case eSIR_SME_ASSOC_REFUSED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700790 return "eSIR_SME_ASSOC_REFUSED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700791 case eSIR_SME_REASSOC_REFUSED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700792 return "eSIR_SME_REASSOC_REFUSED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700793 case eSIR_SME_STA_NOT_AUTHENTICATED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700794 return "eSIR_SME_STA_NOT_AUTHENTICATED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700795 case eSIR_SME_STA_NOT_ASSOCIATED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700796 return "eSIR_SME_STA_NOT_ASSOCIATED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700797 case eSIR_SME_STA_DISASSOCIATED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700798 return "eSIR_SME_STA_DISASSOCIATED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700799 case eSIR_SME_ALREADY_JOINED_A_BSS:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700800 return "eSIR_SME_ALREADY_JOINED_A_BSS";
Jeff Johnson295189b2012-06-20 16:38:30 -0700801 case eSIR_ULA_COMPLETED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700802 return "eSIR_ULA_COMPLETED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700803 case eSIR_ULA_FAILURE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700804 return "eSIR_ULA_FAILURE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700805 case eSIR_SME_LINK_ESTABLISHED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700806 return "eSIR_SME_LINK_ESTABLISHED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700807 case eSIR_SME_UNABLE_TO_PERFORM_MEASUREMENTS:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700808 return "eSIR_SME_UNABLE_TO_PERFORM_MEASUREMENTS";
Jeff Johnson295189b2012-06-20 16:38:30 -0700809 case eSIR_SME_UNABLE_TO_PERFORM_DFS:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700810 return "eSIR_SME_UNABLE_TO_PERFORM_DFS";
Jeff Johnson295189b2012-06-20 16:38:30 -0700811 case eSIR_SME_DFS_FAILED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700812 return "eSIR_SME_DFS_FAILED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700813 case eSIR_SME_TRANSFER_STA:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700814 return "eSIR_SME_TRANSFER_STA";
Jeff Johnson295189b2012-06-20 16:38:30 -0700815 case eSIR_SME_INVALID_LINK_TEST_PARAMETERS:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700816 return "eSIR_SME_INVALID_LINK_TEST_PARAMETERS";
Jeff Johnson295189b2012-06-20 16:38:30 -0700817 case eSIR_SME_LINK_TEST_MAX_EXCEEDED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700818 return "eSIR_SME_LINK_TEST_MAX_EXCEEDED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700819 case eSIR_SME_UNSUPPORTED_RATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700820 return "eSIR_SME_UNSUPPORTED_RATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700821 case eSIR_SME_LINK_TEST_TIMEOUT:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700822 return "eSIR_SME_LINK_TEST_TIMEOUT";
Jeff Johnson295189b2012-06-20 16:38:30 -0700823 case eSIR_SME_LINK_TEST_COMPLETE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700824 return "eSIR_SME_LINK_TEST_COMPLETE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700825 case eSIR_SME_LINK_TEST_INVALID_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700826 return "eSIR_SME_LINK_TEST_INVALID_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700827 case eSIR_SME_LINK_TEST_INVALID_ADDRESS:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700828 return "eSIR_SME_LINK_TEST_INVALID_ADDRESS";
Jeff Johnson295189b2012-06-20 16:38:30 -0700829 case eSIR_SME_POLARIS_RESET:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700830 return "eSIR_SME_POLARIS_RESET";
Jeff Johnson295189b2012-06-20 16:38:30 -0700831 case eSIR_SME_SETCONTEXT_FAILED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700832 return "eSIR_SME_SETCONTEXT_FAILED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700833 case eSIR_SME_BSS_RESTART:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700834 return "eSIR_SME_BSS_RESTART";
Jeff Johnson295189b2012-06-20 16:38:30 -0700835 case eSIR_SME_MORE_SCAN_RESULTS_FOLLOW:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700836 return "eSIR_SME_MORE_SCAN_RESULTS_FOLLOW";
Jeff Johnson295189b2012-06-20 16:38:30 -0700837 case eSIR_SME_INVALID_ASSOC_RSP_RXED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700838 return "eSIR_SME_INVALID_ASSOC_RSP_RXED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700839 case eSIR_SME_MIC_COUNTER_MEASURES:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700840 return "eSIR_SME_MIC_COUNTER_MEASURES";
Jeff Johnson295189b2012-06-20 16:38:30 -0700841 case eSIR_SME_ADDTS_RSP_TIMEOUT:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700842 return "eSIR_SME_ADDTS_RSP_TIMEOUT";
Jeff Johnson295189b2012-06-20 16:38:30 -0700843 case eSIR_SME_RECEIVED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700844 return "eSIR_SME_RECEIVED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700845 case eSIR_SME_CHANNEL_SWITCH_FAIL:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700846 return "eSIR_SME_CHANNEL_SWITCH_FAIL";
Jeff Johnson295189b2012-06-20 16:38:30 -0700847#ifdef GEN4_SCAN
848 case eSIR_SME_CHANNEL_SWITCH_DISABLED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700849 return "eSIR_SME_CHANNEL_SWITCH_DISABLED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700850 case eSIR_SME_HAL_SCAN_INIT_FAILED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700851 return "eSIR_SME_HAL_SCAN_INIT_FAILED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700852 case eSIR_SME_HAL_SCAN_START_FAILED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700853 return "eSIR_SME_HAL_SCAN_START_FAILED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700854 case eSIR_SME_HAL_SCAN_END_FAILED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700855 return "eSIR_SME_HAL_SCAN_END_FAILED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700856 case eSIR_SME_HAL_SCAN_FINISH_FAILED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700857 return "eSIR_SME_HAL_SCAN_FINISH_FAILED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700858 case eSIR_SME_HAL_SEND_MESSAGE_FAIL:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700859 return "eSIR_SME_HAL_SEND_MESSAGE_FAIL";
Jeff Johnson295189b2012-06-20 16:38:30 -0700860#else // GEN4_SCAN
861 case eSIR_SME_CHANNEL_SWITCH_DISABLED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700862 return "eSIR_SME_CHANNEL_SWITCH_DISABLED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700863 case eSIR_SME_HAL_SEND_MESSAGE_FAIL:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700864 return "eSIR_SME_HAL_SEND_MESSAGE_FAIL";
Jeff Johnson295189b2012-06-20 16:38:30 -0700865#endif // GEN4_SCAN
866
867 default:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700868 return "INVALID resultCode";
Jeff Johnson295189b2012-06-20 16:38:30 -0700869 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700870}
871
872void
873limPrintMsgName(tpAniSirGlobal pMac, tANI_U16 logLevel, tANI_U32 msgType)
874{
875 limLog(pMac, logLevel, limMsgStr(msgType));
876}
877
Jeff Johnson295189b2012-06-20 16:38:30 -0700878void
879limPrintMsgInfo(tpAniSirGlobal pMac, tANI_U16 logLevel, tSirMsgQ *msg)
880{
Jeff Johnson295189b2012-06-20 16:38:30 -0700881 if (logLevel <= pMac->utils.gLogDbgLevel[SIR_LIM_MODULE_ID - LOG_FIRST_MODULE_ID])
882 {
883 switch (msg->type)
884 {
885 case SIR_BB_XPORT_MGMT_MSG:
Jeff Johnson295189b2012-06-20 16:38:30 -0700886 limPrintMsgName(pMac, logLevel,msg->type);
Jeff Johnson295189b2012-06-20 16:38:30 -0700887 break;
888 default:
889 limPrintMsgName(pMac, logLevel,msg->type);
890 break;
891 }
892 }
893}
894
895/**
896 * limInitMlm()
897 *
898 *FUNCTION:
899 * This function is called by limProcessSmeMessages() to
900 * initialize MLM state machine on STA
901 *
902 *PARAMS:
903 *
904 *LOGIC:
905 *
906 *ASSUMPTIONS:
907 * NA
908 *
909 *NOTE:
910 * NA
911 *
912 * @param pMac Pointer to Global MAC structure
913 * @return None
914 */
915void
916limInitMlm(tpAniSirGlobal pMac)
917{
Madan Mohan Koyyalamudi694f8d72012-10-11 16:32:55 -0700918 tANI_U32 retVal;
919
920 pMac->lim.gLimTimersCreated = 0;
Madan Mohan Koyyalamudi1bed5982012-10-22 14:38:06 -0700921
Jeff Johnsone7245742012-09-05 17:12:55 -0700922 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, NO_SESSION, pMac->lim.gLimMlmState));
Jeff Johnson295189b2012-06-20 16:38:30 -0700923
924 /// Initialize scan result hash table
925 limReInitScanResults(pMac); //sep26th review
926
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -0700927#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
928 /// Initialize lfr scan result hash table
929 // Could there be a problem in multisession with SAP/P2P GO, when in the
930 // middle of FW bg scan, SAP started; Again that could be a problem even on
931 // infra + SAP/P2P GO too - TBD
932 limReInitLfrScanResults(pMac);
933#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700934
935 /// Initialize number of pre-auth contexts
936 pMac->lim.gLimNumPreAuthContexts = 0;
937
938 /// Initialize MAC based Authentication STA list
939 limInitPreAuthList(pMac);
940
941 //pMac->lim.gpLimMlmJoinReq = NULL;
942
943 if (pMac->lim.gLimTimersCreated)
944 return;
945
946 // Create timers used by LIM
Madan Mohan Koyyalamudi694f8d72012-10-11 16:32:55 -0700947 retVal = limCreateTimers(pMac);
948 if(retVal == TX_SUCCESS)
949 {
950 pMac->lim.gLimTimersCreated = 1;
951 }
952 else
953 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700954 limLog(pMac, LOGP, FL(" limCreateTimers Failed to create lim timers "));
Madan Mohan Koyyalamudi694f8d72012-10-11 16:32:55 -0700955 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700956} /*** end limInitMlm() ***/
957
958
959
960/**
961 * limCleanupMlm()
962 *
963 *FUNCTION:
964 * This function is called to cleanup any resources
965 * allocated by the MLM state machine.
966 *
967 *PARAMS:
968 *
969 *LOGIC:
970 *
971 *ASSUMPTIONS:
972 * NA
973 *
974 *NOTE:
975 * It is assumed that BSS is already informed that we're leaving it
976 * before this function is called.
977 *
978 * @param pMac Pointer to Global MAC structure
979 * @param None
980 * @return None
981 */
982void
983limCleanupMlm(tpAniSirGlobal pMac)
984{
985 tANI_U32 n;
986 tLimPreAuthNode *pAuthNode;
987
988 if (pMac->lim.gLimTimersCreated == 1)
989 {
990 // Deactivate and delete MIN/MAX channel timers.
991 tx_timer_deactivate(&pMac->lim.limTimers.gLimMinChannelTimer);
992 tx_timer_delete(&pMac->lim.limTimers.gLimMinChannelTimer);
993 tx_timer_deactivate(&pMac->lim.limTimers.gLimMaxChannelTimer);
994 tx_timer_delete(&pMac->lim.limTimers.gLimMaxChannelTimer);
995 tx_timer_deactivate(&pMac->lim.limTimers.gLimPeriodicProbeReqTimer);
996 tx_timer_delete(&pMac->lim.limTimers.gLimPeriodicProbeReqTimer);
997
998
999 // Deactivate and delete channel switch timer.
1000 tx_timer_deactivate(&pMac->lim.limTimers.gLimChannelSwitchTimer);
1001 tx_timer_delete(&pMac->lim.limTimers.gLimChannelSwitchTimer);
1002
1003
1004 // Deactivate and delete addts response timer.
1005 tx_timer_deactivate(&pMac->lim.limTimers.gLimAddtsRspTimer);
1006 tx_timer_delete(&pMac->lim.limTimers.gLimAddtsRspTimer);
1007
1008 // Deactivate and delete Join failure timer.
1009 tx_timer_deactivate(&pMac->lim.limTimers.gLimJoinFailureTimer);
1010 tx_timer_delete(&pMac->lim.limTimers.gLimJoinFailureTimer);
1011
Madan Mohan Koyyalamudi9aff9ff2012-11-29 11:27:25 -08001012 // Deactivate and delete Periodic Join Probe Request timer.
1013 tx_timer_deactivate(&pMac->lim.limTimers.gLimPeriodicJoinProbeReqTimer);
1014 tx_timer_delete(&pMac->lim.limTimers.gLimPeriodicJoinProbeReqTimer);
1015
Jeff Johnson295189b2012-06-20 16:38:30 -07001016 // Deactivate and delete Association failure timer.
1017 tx_timer_deactivate(&pMac->lim.limTimers.gLimAssocFailureTimer);
1018 tx_timer_delete(&pMac->lim.limTimers.gLimAssocFailureTimer);
1019
1020 // Deactivate and delete Reassociation failure timer.
1021 tx_timer_deactivate(&pMac->lim.limTimers.gLimReassocFailureTimer);
1022 tx_timer_delete(&pMac->lim.limTimers.gLimReassocFailureTimer);
1023
1024 // Deactivate and delete Authentication failure timer.
1025 tx_timer_deactivate(&pMac->lim.limTimers.gLimAuthFailureTimer);
1026 tx_timer_delete(&pMac->lim.limTimers.gLimAuthFailureTimer);
1027
1028 // Deactivate and delete Heartbeat timer.
1029 tx_timer_deactivate(&pMac->lim.limTimers.gLimHeartBeatTimer);
1030 tx_timer_delete(&pMac->lim.limTimers.gLimHeartBeatTimer);
1031
1032 // Deactivate and delete wait-for-probe-after-Heartbeat timer.
1033 tx_timer_deactivate(&pMac->lim.limTimers.gLimProbeAfterHBTimer);
1034 tx_timer_delete(&pMac->lim.limTimers.gLimProbeAfterHBTimer);
1035
1036 // Deactivate and delete Quiet timer.
1037 tx_timer_deactivate(&pMac->lim.limTimers.gLimQuietTimer);
1038 tx_timer_delete(&pMac->lim.limTimers.gLimQuietTimer);
1039
1040 // Deactivate and delete Quiet BSS timer.
1041 tx_timer_deactivate(&pMac->lim.limTimers.gLimQuietBssTimer);
1042 tx_timer_delete(&pMac->lim.limTimers.gLimQuietBssTimer);
1043
Jeff Johnson295189b2012-06-20 16:38:30 -07001044 // Deactivate and delete LIM background scan timer.
1045 tx_timer_deactivate(&pMac->lim.limTimers.gLimBackgroundScanTimer);
1046 tx_timer_delete(&pMac->lim.limTimers.gLimBackgroundScanTimer);
Jeff Johnson295189b2012-06-20 16:38:30 -07001047
1048
1049 // Deactivate and delete cnf wait timer
1050 for (n = 0; n < pMac->lim.maxStation; n++)
1051 {
1052 tx_timer_deactivate(&pMac->lim.limTimers.gpLimCnfWaitTimer[n]);
1053 tx_timer_delete(&pMac->lim.limTimers.gpLimCnfWaitTimer[n]);
1054 }
1055
1056 // Deactivate and delete keepalive timer
1057 tx_timer_deactivate(&pMac->lim.limTimers.gLimKeepaliveTimer);
1058 tx_timer_delete(&pMac->lim.limTimers.gLimKeepaliveTimer);
1059
1060 pAuthNode = pMac->lim.gLimPreAuthTimerTable.pTable;
1061
1062 //Deactivate any Authentication response timers
1063 limDeletePreAuthList(pMac);
1064
1065 for (n = 0; n < pMac->lim.gLimPreAuthTimerTable.numEntry; n++,pAuthNode++)
1066 {
1067 // Delete any Authentication response
1068 // timers, which might have been started.
1069 tx_timer_delete(&pAuthNode->timer);
1070 }
1071
Jeff Johnson295189b2012-06-20 16:38:30 -07001072
1073
1074 // Deactivate and delete Hash Miss throttle timer
1075 tx_timer_deactivate(&pMac->lim.limTimers.gLimSendDisassocFrameThresholdTimer);
1076 tx_timer_delete(&pMac->lim.limTimers.gLimSendDisassocFrameThresholdTimer);
1077
Jeff Johnson295189b2012-06-20 16:38:30 -07001078 tx_timer_deactivate(&pMac->lim.limTimers.gLimUpdateOlbcCacheTimer);
1079 tx_timer_delete(&pMac->lim.limTimers.gLimUpdateOlbcCacheTimer);
1080 tx_timer_deactivate(&pMac->lim.limTimers.gLimPreAuthClnupTimer);
1081 tx_timer_delete(&pMac->lim.limTimers.gLimPreAuthClnupTimer);
1082
1083#if 0 // The WPS PBC clean up timer is disabled
1084 if (pMac->lim.gLimSystemRole == eLIM_AP_ROLE)
1085 {
1086 if(pMac->lim.limTimers.gLimWPSOverlapTimerObj.isTimerCreated == eANI_BOOLEAN_TRUE)
1087 {
1088 tx_timer_deactivate(&pMac->lim.limTimers.gLimWPSOverlapTimerObj.gLimWPSOverlapTimer);
1089 tx_timer_delete(&pMac->lim.limTimers.gLimWPSOverlapTimerObj.gLimWPSOverlapTimer);
1090 pMac->lim.limTimers.gLimWPSOverlapTimerObj.isTimerCreated = eANI_BOOLEAN_FALSE;
1091 }
1092 }
1093#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001094#ifdef WLAN_FEATURE_VOWIFI_11R
1095 // Deactivate and delete FT Preauth response timer
1096 tx_timer_deactivate(&pMac->lim.limTimers.gLimFTPreAuthRspTimer);
1097 tx_timer_delete(&pMac->lim.limTimers.gLimFTPreAuthRspTimer);
1098#endif
1099
Jeff Johnson295189b2012-06-20 16:38:30 -07001100 // Deactivate and delete remain on channel timer
1101 tx_timer_deactivate(&pMac->lim.limTimers.gLimRemainOnChannelTimer);
1102 tx_timer_delete(&pMac->lim.limTimers.gLimRemainOnChannelTimer);
Jeff Johnson295189b2012-06-20 16:38:30 -07001103
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001104#if defined(FEATURE_WLAN_ESE) && !defined(FEATURE_WLAN_ESE_UPLOAD)
Jeff Johnson295189b2012-06-20 16:38:30 -07001105 // Deactivate and delete TSM
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001106 tx_timer_deactivate(&pMac->lim.limTimers.gLimEseTsmTimer);
1107 tx_timer_delete(&pMac->lim.limTimers.gLimEseTsmTimer);
1108#endif /* FEATURE_WLAN_ESE && !FEATURE_WLAN_ESE_UPLOAD */
Jeff Johnson295189b2012-06-20 16:38:30 -07001109
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -08001110 tx_timer_deactivate(&pMac->lim.limTimers.gLimDisassocAckTimer);
1111 tx_timer_delete(&pMac->lim.limTimers.gLimDisassocAckTimer);
1112
1113 tx_timer_deactivate(&pMac->lim.limTimers.gLimDeauthAckTimer);
1114 tx_timer_delete(&pMac->lim.limTimers.gLimDeauthAckTimer);
1115
Hoonki Leef63df0d2013-01-16 19:29:14 -08001116 tx_timer_deactivate(&pMac->lim.limTimers.gLimP2pSingleShotNoaInsertTimer);
1117 tx_timer_delete(&pMac->lim.limTimers.gLimP2pSingleShotNoaInsertTimer);
Hoonki Leef63df0d2013-01-16 19:29:14 -08001118
Gopichand Nakkala0d6e4ad2013-05-17 02:30:25 +05301119 tx_timer_deactivate(&pMac->lim.limTimers.gLimActiveToPassiveChannelTimer);
1120 tx_timer_delete(&pMac->lim.limTimers.gLimActiveToPassiveChannelTimer);
1121
Jeff Johnson295189b2012-06-20 16:38:30 -07001122 pMac->lim.gLimTimersCreated = 0;
1123 }
1124
1125 /// Cleanup cached scan list
1126 limReInitScanResults(pMac);
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07001127#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
1128 /// Cleanup cached scan list
1129 limReInitLfrScanResults(pMac);
1130#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001131
1132} /*** end limCleanupMlm() ***/
1133
1134
1135
1136/**
1137 * limCleanupLmm()
1138 *
1139 *FUNCTION:
1140 * This function is called to cleanup any resources
1141 * allocated by LMM sub-module.
1142 *
1143 *PARAMS:
1144 *
1145 *LOGIC:
1146 *
1147 *ASSUMPTIONS:
1148 * NA
1149 *
1150 *NOTE:
1151 * NA
1152 *
1153 * @param pMac Pointer to Global MAC structure
1154 * @return None
1155 */
1156
1157void
1158limCleanupLmm(tpAniSirGlobal pMac)
1159{
Jeff Johnson295189b2012-06-20 16:38:30 -07001160} /*** end limCleanupLmm() ***/
1161
1162
1163
1164/**
1165 * limIsAddrBC()
1166 *
1167 *FUNCTION:
1168 * This function is called in various places within LIM code
1169 * to determine whether passed MAC address is a broadcast or not
1170 *
1171 *LOGIC:
1172 *
1173 *ASSUMPTIONS:
1174 * NA
1175 *
1176 *NOTE:
1177 * NA
1178 *
1179 * @param macAddr Indicates MAC address that need to be determined
1180 * whether it is Broadcast address or not
1181 *
1182 * @return true if passed address is Broadcast address else false
1183 */
1184
1185tANI_U8
1186limIsAddrBC(tSirMacAddr macAddr)
1187{
1188 int i;
1189 for (i = 0; i < 6; i++)
1190 {
1191 if ((macAddr[i] & 0xFF) != 0xFF)
1192 return false;
1193 }
1194
1195 return true;
1196} /****** end limIsAddrBC() ******/
1197
1198
1199
1200/**
1201 * limIsGroupAddr()
1202 *
1203 *FUNCTION:
1204 * This function is called in various places within LIM code
1205 * to determine whether passed MAC address is a group address or not
1206 *
1207 *LOGIC:
1208 * If least significant bit of first octet of the MAC address is
1209 * set to 1, it is a Group address.
1210 *
1211 *ASSUMPTIONS:
1212 * NA
1213 *
1214 *NOTE:
1215 * NA
1216 *
1217 * @param macAddr Indicates MAC address that need to be determined
1218 * whether it is Group address or not
1219 *
1220 * @return true if passed address is Group address else false
1221 */
1222
1223tANI_U8
1224limIsGroupAddr(tSirMacAddr macAddr)
1225{
1226 if ((macAddr[0] & 0x01) == 0x01)
1227 return true;
1228 else
1229 return false;
1230} /****** end limIsGroupAddr() ******/
1231
1232/**
1233 * limPostMsgApiNoWait()
1234 *
1235 *FUNCTION:
1236 * This function is called from other thread while posting a
1237 * message to LIM message Queue gSirLimMsgQ with NO_WAIT option
1238 *
1239 *LOGIC:
1240 * NA
1241 *
1242 *ASSUMPTIONS:
1243 * NA
1244 *
1245 *NOTE:
1246 * NA
1247 *
1248 * @param pMsg - Pointer to the Global MAC structure
1249 * @param pMsg - Pointer to the message structure
1250 * @return None
1251 */
1252
1253tANI_U32
1254limPostMsgApiNoWait(tpAniSirGlobal pMac, tSirMsgQ *pMsg)
1255{
Jeff Johnson295189b2012-06-20 16:38:30 -07001256 limProcessMessages(pMac, pMsg);
1257 return TX_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -07001258} /*** end limPostMsgApiNoWait() ***/
1259
1260
1261
1262/**
1263 * limPrintMacAddr()
1264 *
1265 *FUNCTION:
1266 * This function is called to print passed MAC address
1267 * in : format.
1268 *
1269 *LOGIC:
1270 *
1271 *ASSUMPTIONS:
1272 * NA
1273 *
1274 *NOTE:
1275 * @param macAddr - MacAddr to be printed
1276 * @param logLevel - Loglevel to be used
1277 *
1278 * @return None.
1279 */
1280
1281void
1282limPrintMacAddr(tpAniSirGlobal pMac, tSirMacAddr macAddr, tANI_U8 logLevel)
1283{
1284 limLog(pMac, logLevel,
Arif Hussaina7c8e412013-11-20 11:06:42 -08001285 FL(MAC_ADDRESS_STR), MAC_ADDR_ARRAY(macAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001286} /****** end limPrintMacAddr() ******/
1287
1288
Jeff Johnson295189b2012-06-20 16:38:30 -07001289/*
1290 * limResetDeferredMsgQ()
1291 *
1292 *FUNCTION:
1293 * This function resets the deferred message queue parameters.
1294 *
1295 *PARAMS:
1296 * @param pMac - Pointer to Global MAC structure
1297 *
1298 *LOGIC:
1299 *
1300 *ASSUMPTIONS:
1301 * NA
1302 *
1303 *NOTE:
1304 * NA
1305 *
1306 *RETURNS:
1307 * None
1308 */
1309
1310void limResetDeferredMsgQ(tpAniSirGlobal pMac)
1311{
1312 pMac->lim.gLimDeferredMsgQ.size =
1313 pMac->lim.gLimDeferredMsgQ.write =
1314 pMac->lim.gLimDeferredMsgQ.read = 0;
1315
1316}
1317
1318
1319#define LIM_DEFERRED_Q_CHECK_THRESHOLD (MAX_DEFERRED_QUEUE_LEN/2)
1320#define LIM_MAX_NUM_MGMT_FRAME_DEFERRED (MAX_DEFERRED_QUEUE_LEN/2)
1321
1322/*
1323 * limWriteDeferredMsgQ()
1324 *
1325 *FUNCTION:
1326 * This function queues up a deferred message for later processing on the
1327 * STA side.
1328 *
1329 *PARAMS:
1330 * @param pMac - Pointer to Global MAC structure
1331 * @param limMsg - a LIM message
1332 *
1333 *LOGIC:
1334 *
1335 *ASSUMPTIONS:
1336 * NA
1337 *
1338 *NOTE:
1339 * NA
1340 *
1341 *RETURNS:
1342 * None
1343 */
1344
1345tANI_U8 limWriteDeferredMsgQ(tpAniSirGlobal pMac, tpSirMsgQ limMsg)
1346{
1347 PELOG1(limLog(pMac, LOG1,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001348 FL("** Queue a deferred message (size %d, write %d) - type 0x%x **"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001349 pMac->lim.gLimDeferredMsgQ.size, pMac->lim.gLimDeferredMsgQ.write,
1350 limMsg->type);)
1351
1352 /*
1353 ** check if the deferred message queue is full
1354 **/
1355 if (pMac->lim.gLimDeferredMsgQ.size >= MAX_DEFERRED_QUEUE_LEN)
1356 {
Leela Venkata Kiran Kumar Reddy Chirala2247e962013-03-22 19:21:10 -07001357 if(!(pMac->lim.deferredMsgCnt & 0xF))
1358 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001359 PELOGE(limLog(pMac, LOGE, FL("Deferred Message Queue is full. Msg:%d Messages Failed:%d"), limMsg->type, ++pMac->lim.deferredMsgCnt);)
Leela Venkata Kiran Kumar Reddy Chirala2247e962013-03-22 19:21:10 -07001360 }
1361 else
1362 {
1363 pMac->lim.deferredMsgCnt++;
1364 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001365 return TX_QUEUE_FULL;
1366 }
1367
1368 /*
1369 ** In the application, there should not be more than 1 message get
1370 ** queued up. If happens, flags a warning. In the future, this can
1371 ** happen.
1372 **/
1373 if (pMac->lim.gLimDeferredMsgQ.size > 0)
1374 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001375 PELOGW(limLog(pMac, LOGW, FL("%d Deferred messages (type 0x%x, scan %d, global sme %d, global mlme %d, addts %d)"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001376 pMac->lim.gLimDeferredMsgQ.size, limMsg->type,
1377 limIsSystemInScanState(pMac),
1378 pMac->lim.gLimSmeState, pMac->lim.gLimMlmState,
1379 pMac->lim.gLimAddtsSent);)
1380 }
1381
1382 /*
1383 ** To prevent the deferred Q is full of management frames, only give them certain space
1384 **/
1385 if( SIR_BB_XPORT_MGMT_MSG == limMsg->type )
1386 {
1387 if( LIM_DEFERRED_Q_CHECK_THRESHOLD < pMac->lim.gLimDeferredMsgQ.size )
1388 {
1389 tANI_U16 idx, count = 0;
1390 for(idx = 0; idx < pMac->lim.gLimDeferredMsgQ.size; idx++)
1391 {
1392 if( SIR_BB_XPORT_MGMT_MSG == pMac->lim.gLimDeferredMsgQ.deferredQueue[idx].type )
1393 {
1394 count++;
1395 }
1396 }
1397 if( LIM_MAX_NUM_MGMT_FRAME_DEFERRED < count )
1398 {
1399 //We reach the quota for management frames, drop this one
Madan Mohan Koyyalamudi5695b502012-09-24 14:21:12 -07001400 PELOGW(limLog(pMac, LOGW, FL("Cannot deferred. Msg: %d Too many (count=%d) already"), limMsg->type, count);)
Jeff Johnson295189b2012-06-20 16:38:30 -07001401 //Return error, caller knows what to do
1402 return TX_QUEUE_FULL;
1403 }
1404 }
1405 }
1406
1407 ++pMac->lim.gLimDeferredMsgQ.size;
1408
Leela Venkata Kiran Kumar Reddy Chirala2247e962013-03-22 19:21:10 -07001409 /* reset the count here since we are able to defer the message */
1410 if(pMac->lim.deferredMsgCnt != 0)
1411 {
1412 pMac->lim.deferredMsgCnt = 0;
1413 }
1414
Jeff Johnson295189b2012-06-20 16:38:30 -07001415 /*
1416 ** if the write pointer hits the end of the queue, rewind it
1417 **/
1418 if (pMac->lim.gLimDeferredMsgQ.write >= MAX_DEFERRED_QUEUE_LEN)
1419 pMac->lim.gLimDeferredMsgQ.write = 0;
1420
1421 /*
1422 ** save the message to the queue and advanced the write pointer
1423 **/
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301424 vos_mem_copy( (tANI_U8 *)&pMac->lim.gLimDeferredMsgQ.deferredQueue[
1425 pMac->lim.gLimDeferredMsgQ.write++],
Jeff Johnson295189b2012-06-20 16:38:30 -07001426 (tANI_U8 *)limMsg,
1427 sizeof(tSirMsgQ));
1428 return TX_SUCCESS;
1429
1430}
1431
1432/*
1433 * limReadDeferredMsgQ()
1434 *
1435 *FUNCTION:
1436 * This function dequeues a deferred message for processing on the
1437 * STA side.
1438 *
1439 *PARAMS:
1440 * @param pMac - Pointer to Global MAC structure
1441 *
1442 *LOGIC:
1443 *
1444 *ASSUMPTIONS:
1445 * NA
1446 *
1447 *NOTE:
1448 *
1449 *
1450 *RETURNS:
1451 * Returns the message at the head of the deferred message queue
1452 */
1453
1454tSirMsgQ* limReadDeferredMsgQ(tpAniSirGlobal pMac)
1455{
1456 tSirMsgQ *msg;
1457
1458 /*
1459 ** check any messages left. If no, return
1460 **/
1461 if (pMac->lim.gLimDeferredMsgQ.size <= 0)
1462 return NULL;
1463
1464 /*
1465 ** decrement the queue size
1466 **/
1467 pMac->lim.gLimDeferredMsgQ.size--;
1468
1469 /*
1470 ** retrieve the message from the head of the queue
1471 **/
1472 msg = &pMac->lim.gLimDeferredMsgQ.deferredQueue[pMac->lim.gLimDeferredMsgQ.read];
1473
1474 /*
1475 ** advance the read pointer
1476 **/
1477 pMac->lim.gLimDeferredMsgQ.read++;
1478
1479 /*
1480 ** if the read pointer hits the end of the queue, rewind it
1481 **/
1482 if (pMac->lim.gLimDeferredMsgQ.read >= MAX_DEFERRED_QUEUE_LEN)
1483 pMac->lim.gLimDeferredMsgQ.read = 0;
1484
1485 PELOG1(limLog(pMac, LOG1,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001486 FL("** DeQueue a deferred message (size %d read %d) - type 0x%x **"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001487 pMac->lim.gLimDeferredMsgQ.size, pMac->lim.gLimDeferredMsgQ.read,
1488 msg->type);)
1489
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001490 PELOG1(limLog(pMac, LOG1, FL("DQ msg -- scan %d, global sme %d, global mlme %d, addts %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001491 limIsSystemInScanState(pMac),
1492 pMac->lim.gLimSmeState, pMac->lim.gLimMlmState,
1493 pMac->lim.gLimAddtsSent);)
1494
1495 return(msg);
1496}
1497
1498tSirRetStatus
1499limSysProcessMmhMsgApi(tpAniSirGlobal pMac,
1500 tSirMsgQ *pMsg,
1501 tANI_U8 qType)
1502{
1503// FIXME
Jeff Johnson295189b2012-06-20 16:38:30 -07001504 SysProcessMmhMsg(pMac, pMsg);
1505 return eSIR_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -07001506}
1507
1508char *limFrameStr(tANI_U32 type, tANI_U32 subType)
1509{
1510#ifdef FIXME_GEN6
1511
1512 if (type == SIR_MAC_MGMT_FRAME)
1513 {
1514 switch (subType)
1515 {
1516 case SIR_MAC_MGMT_ASSOC_REQ:
1517 return "MAC_MGMT_ASSOC_REQ";
1518 case SIR_MAC_MGMT_ASSOC_RSP:
1519 return "MAC_MGMT_ASSOC_RSP";
1520 case SIR_MAC_MGMT_REASSOC_REQ:
1521 return "MAC_MGMT_REASSOC_REQ";
1522 case SIR_MAC_MGMT_REASSOC_RSP:
1523 return "MAC_MGMT_REASSOC_RSP";
1524 case SIR_MAC_MGMT_PROBE_REQ:
1525 return "MAC_MGMT_PROBE_REQ";
1526 case SIR_MAC_MGMT_PROBE_RSP:
1527 return "MAC_MGMT_PROBE_RSP";
1528 case SIR_MAC_MGMT_BEACON:
1529 return "MAC_MGMT_BEACON";
1530 case SIR_MAC_MGMT_ATIM:
1531 return "MAC_MGMT_ATIM";
1532 case SIR_MAC_MGMT_DISASSOC:
1533 return "MAC_MGMT_DISASSOC";
1534 case SIR_MAC_MGMT_AUTH:
1535 return "MAC_MGMT_AUTH";
1536 case SIR_MAC_MGMT_DEAUTH:
1537 return "MAC_MGMT_DEAUTH";
1538 case SIR_MAC_MGMT_ACTION:
1539 return "MAC_MGMT_ACTION";
1540 case SIR_MAC_MGMT_RESERVED15:
1541 return "MAC_MGMT_RESERVED15";
1542 default:
1543 return "Unknown MGMT Frame";
1544 }
1545 }
1546
1547 else if (type == SIR_MAC_CTRL_FRAME)
1548 {
1549 switch (subType)
1550 {
1551 case SIR_MAC_CTRL_RR:
1552 return "MAC_CTRL_RR";
1553 case SIR_MAC_CTRL_BAR:
1554 return "MAC_CTRL_BAR";
1555 case SIR_MAC_CTRL_BA:
1556 return "MAC_CTRL_BA";
1557 case SIR_MAC_CTRL_PS_POLL:
1558 return "MAC_CTRL_PS_POLL";
1559 case SIR_MAC_CTRL_RTS:
1560 return "MAC_CTRL_RTS";
1561 case SIR_MAC_CTRL_CTS:
1562 return "MAC_CTRL_CTS";
1563 case SIR_MAC_CTRL_ACK:
1564 return "MAC_CTRL_ACK";
1565 case SIR_MAC_CTRL_CF_END:
1566 return "MAC_CTRL_CF_END";
1567 case SIR_MAC_CTRL_CF_END_ACK:
1568 return "MAC_CTRL_CF_END_ACK";
1569 default:
1570 return "Unknown CTRL Frame";
1571 }
1572 }
1573
1574 else if (type == SIR_MAC_DATA_FRAME)
1575 {
1576 switch (subType)
1577 {
1578 case SIR_MAC_DATA_DATA:
1579 return "MAC_DATA_DATA";
1580 case SIR_MAC_DATA_DATA_ACK:
1581 return "MAC_DATA_DATA_ACK";
1582 case SIR_MAC_DATA_DATA_POLL:
1583 return "MAC_DATA_DATA_POLL";
1584 case SIR_MAC_DATA_DATA_ACK_POLL:
1585 return "MAC_DATA_DATA_ACK_POLL";
1586 case SIR_MAC_DATA_NULL:
1587 return "MAC_DATA_NULL";
1588 case SIR_MAC_DATA_NULL_ACK:
1589 return "MAC_DATA_NULL_ACK";
1590 case SIR_MAC_DATA_NULL_POLL:
1591 return "MAC_DATA_NULL_POLL";
1592 case SIR_MAC_DATA_NULL_ACK_POLL:
1593 return "MAC_DATA_NULL_ACK_POLL";
1594 case SIR_MAC_DATA_QOS_DATA:
1595 return "MAC_DATA_QOS_DATA";
1596 case SIR_MAC_DATA_QOS_DATA_ACK:
1597 return "MAC_DATA_QOS_DATA_ACK";
1598 case SIR_MAC_DATA_QOS_DATA_POLL:
1599 return "MAC_DATA_QOS_DATA_POLL";
1600 case SIR_MAC_DATA_QOS_DATA_ACK_POLL:
1601 return "MAC_DATA_QOS_DATA_ACK_POLL";
1602 case SIR_MAC_DATA_QOS_NULL:
1603 return "MAC_DATA_QOS_NULL";
1604 case SIR_MAC_DATA_QOS_NULL_ACK:
1605 return "MAC_DATA_QOS_NULL_ACK";
1606 case SIR_MAC_DATA_QOS_NULL_POLL:
1607 return "MAC_DATA_QOS_NULL_POLL";
1608 case SIR_MAC_DATA_QOS_NULL_ACK_POLL:
1609 return "MAC_DATA_QOS_NULL_ACK_POLL";
1610 default:
1611 return "Unknown Data Frame";
1612 }
1613 }
1614 else
1615 return "Unknown";
1616#endif
1617return "";
1618}
1619
Jeff Johnson295189b2012-06-20 16:38:30 -07001620void limHandleUpdateOlbcCache(tpAniSirGlobal pMac)
1621{
1622 int i;
1623 static int enable;
1624 tUpdateBeaconParams beaconParams;
1625
1626 tpPESession psessionEntry = limIsApSessionActive(pMac);
1627
1628 if (psessionEntry == NULL)
Madan Mohan Koyyalamudi788b4ee2012-09-25 10:42:09 -07001629 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001630 PELOGE(limLog(pMac, LOGE, FL(" Session not found"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001631 return;
Madan Mohan Koyyalamudi788b4ee2012-09-25 10:42:09 -07001632 }
Pratik Bhalgatb44ea3f2012-11-22 16:41:39 +05301633
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301634 vos_mem_set( ( tANI_U8* )&beaconParams, sizeof( tUpdateBeaconParams), 0);
Madan Mohan Koyyalamudib2733142012-10-31 13:59:17 -07001635 beaconParams.bssIdx = psessionEntry->bssIdx;
Jeff Johnson295189b2012-06-20 16:38:30 -07001636
1637 beaconParams.paramChangeBitmap = 0;
1638 /*
1639 ** This is doing a 2 pass check. The first pass is to invalidate
1640 ** all the cache entries. The second pass is to decide whether to
1641 ** disable protection.
1642 **/
1643 if (!enable)
1644 {
1645
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001646 PELOG2(limLog(pMac, LOG2, FL("Resetting OLBC cache"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001647 psessionEntry->gLimOlbcParams.numSta = 0;
1648 psessionEntry->gLimOverlap11gParams.numSta = 0;
1649 psessionEntry->gLimOverlapHt20Params.numSta = 0;
1650 psessionEntry->gLimNonGfParams.numSta = 0;
1651 psessionEntry->gLimLsigTxopParams.numSta = 0;
1652
1653 for (i=0; i < LIM_PROT_STA_OVERLAP_CACHE_SIZE; i++)
1654 pMac->lim.protStaOverlapCache[i].active = false;
1655
1656 enable = 1;
1657 }
1658 else
1659 {
1660
Madan Mohan Koyyalamudi788b4ee2012-09-25 10:42:09 -07001661 if (!psessionEntry->gLimOlbcParams.numSta)
Jeff Johnson295189b2012-06-20 16:38:30 -07001662 {
1663 if (psessionEntry->gLimOlbcParams.protectionEnabled)
1664 {
1665 if (!psessionEntry->gLim11bParams.protectionEnabled)
1666 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001667 PELOG1(limLog(pMac, LOG1, FL("Overlap cache all clear and no 11B STA detected"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001668 limEnable11gProtection(pMac, false, true, &beaconParams, psessionEntry);
1669 }
1670 }
1671 }
1672
1673 if (!psessionEntry->gLimOverlap11gParams.numSta)
1674 {
1675 if (psessionEntry->gLimOverlap11gParams.protectionEnabled)
1676 {
1677 if (!psessionEntry->gLim11gParams.protectionEnabled)
1678 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001679 PELOG1(limLog(pMac, LOG1, FL("Overlap cache all clear and no 11G STA detected"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001680 limEnableHtProtectionFrom11g(pMac, false, true, &beaconParams,psessionEntry);
1681 }
1682 }
1683 }
1684
1685 if (!psessionEntry->gLimOverlapHt20Params.numSta)
1686 {
1687 if (psessionEntry->gLimOverlapHt20Params.protectionEnabled)
1688 {
1689 if (!psessionEntry->gLimHt20Params.protectionEnabled)
1690 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001691 PELOG1(limLog(pMac, LOG1, FL("Overlap cache all clear and no HT20 STA detected"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001692 limEnable11gProtection(pMac, false, true, &beaconParams,psessionEntry);
1693 }
1694 }
1695 }
1696
1697 enable = 0;
1698 }
1699
1700 if(beaconParams.paramChangeBitmap)
1701 {
1702 schSetFixedBeaconFields(pMac,psessionEntry);
1703 limSendBeaconParams(pMac, &beaconParams, psessionEntry);
1704 }
1705
1706 // Start OLBC timer
1707 if (tx_timer_activate(&pMac->lim.limTimers.gLimUpdateOlbcCacheTimer) != TX_SUCCESS)
1708 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001709 limLog(pMac, LOGE, FL("tx_timer_activate failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001710 }
1711}
Jeff Johnson295189b2012-06-20 16:38:30 -07001712
1713/**
1714 * limIsNullSsid()
1715 *
1716 *FUNCTION:
1717 * This function checks if Ssid supplied is Null SSID
1718 *
1719 *
1720 *LOGIC:
1721 *
1722 *ASSUMPTIONS:
1723 * NA
1724 *
1725 *NOTE:
1726 * NA
1727 *
1728 * @param tSirMacSSid *
1729 *
1730 *
1731 * @return true if SSID is Null SSID else false
1732 */
1733
1734tANI_U8
1735limIsNullSsid( tSirMacSSid *pSsid )
1736{
1737 tANI_U8 fNullSsid = false;
1738 tANI_U32 SsidLength;
1739 tANI_U8 *pSsidStr;
1740
1741 do
1742 {
1743 if ( 0 == pSsid->length )
1744 {
1745 fNullSsid = true;
1746 break;
1747 }
1748
1749#define ASCII_SPACE_CHARACTER 0x20
1750 /* If the first charactes is space, then check if all characters in
1751 * SSID are spaces to consider it as NULL SSID*/
1752 if( ASCII_SPACE_CHARACTER == pSsid->ssId[0])
1753 {
1754 SsidLength = pSsid->length;
1755 pSsidStr = pSsid->ssId;
1756 /* check if all the charactes in SSID are spaces*/
1757 while ( SsidLength )
1758 {
1759 if( ASCII_SPACE_CHARACTER != *pSsidStr )
1760 break;
1761
1762 pSsidStr++;
1763 SsidLength--;
1764 }
1765
1766 if( 0 == SsidLength )
1767 {
1768 fNullSsid = true;
1769 break;
1770 }
1771 }
1772 else
1773 {
1774 /* check if all the charactes in SSID are NULL*/
1775 SsidLength = pSsid->length;
1776 pSsidStr = pSsid->ssId;
1777
1778 while ( SsidLength )
1779 {
1780 if( *pSsidStr )
1781 break;
1782
1783 pSsidStr++;
1784 SsidLength--;
1785 }
1786
1787 if( 0 == SsidLength )
1788 {
1789 fNullSsid = true;
1790 break;
1791 }
1792 }
1793 }
1794 while( 0 );
1795
1796 return fNullSsid;
1797} /****** end limIsNullSsid() ******/
1798
1799
1800
Jeff Johnson295189b2012-06-20 16:38:30 -07001801
1802/** -------------------------------------------------------------
1803\fn limUpdateProtStaParams
1804\brief updates protection related counters.
1805\param tpAniSirGlobal pMac
1806\param tSirMacAddr peerMacAddr
1807\param tLimProtStaCacheType protStaCacheType
1808\param tHalBitVal gfSupported
1809\param tHalBitVal lsigTxopSupported
1810\return None
1811 -------------------------------------------------------------*/
1812void
1813limUpdateProtStaParams(tpAniSirGlobal pMac,
1814tSirMacAddr peerMacAddr, tLimProtStaCacheType protStaCacheType,
1815tHalBitVal gfSupported, tHalBitVal lsigTxopSupported,
1816tpPESession psessionEntry)
1817{
1818 tANI_U32 i;
1819
1820 PELOG1(limLog(pMac,LOG1, FL("A STA is associated:"));
1821 limLog(pMac,LOG1, FL("Addr : "));
1822 limPrintMacAddr(pMac, peerMacAddr, LOG1);)
1823
1824 for (i=0; i<LIM_PROT_STA_CACHE_SIZE; i++)
1825 {
1826 if (psessionEntry->protStaCache[i].active)
1827 {
1828 PELOG1(limLog(pMac, LOG1, FL("Addr: "));)
1829 PELOG1(limPrintMacAddr(pMac, psessionEntry->protStaCache[i].addr, LOG1);)
1830
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301831 if (vos_mem_compare(
Jeff Johnson295189b2012-06-20 16:38:30 -07001832 psessionEntry->protStaCache[i].addr,
1833 peerMacAddr, sizeof(tSirMacAddr)))
1834 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001835 PELOG1(limLog(pMac, LOG1, FL("matching cache entry at %d already active."), i);)
Jeff Johnson295189b2012-06-20 16:38:30 -07001836 return;
1837 }
1838 }
1839 }
1840
1841 for (i=0; i<LIM_PROT_STA_CACHE_SIZE; i++)
1842 {
1843 if (!psessionEntry->protStaCache[i].active)
1844 break;
1845 }
1846
1847 if (i >= LIM_PROT_STA_CACHE_SIZE)
1848 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001849 PELOGE(limLog(pMac, LOGE, FL("No space in ProtStaCache"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001850 return;
1851 }
1852
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301853 vos_mem_copy( psessionEntry->protStaCache[i].addr,
Jeff Johnson295189b2012-06-20 16:38:30 -07001854 peerMacAddr,
1855 sizeof(tSirMacAddr));
1856
1857 psessionEntry->protStaCache[i].protStaCacheType = protStaCacheType;
1858 psessionEntry->protStaCache[i].active = true;
1859 if(eLIM_PROT_STA_CACHE_TYPE_llB == protStaCacheType)
1860 {
1861 psessionEntry->gLim11bParams.numSta++;
1862 limLog(pMac,LOG1, FL("11B, "));
1863 }
1864 else if(eLIM_PROT_STA_CACHE_TYPE_llG == protStaCacheType)
1865 {
1866 psessionEntry->gLim11gParams.numSta++;
1867 limLog(pMac,LOG1, FL("11G, "));
1868 }
1869 else if(eLIM_PROT_STA_CACHE_TYPE_HT20 == protStaCacheType)
1870 {
1871 psessionEntry->gLimHt20Params.numSta++;
1872 limLog(pMac,LOG1, FL("HT20, "));
1873 }
1874
1875 if(!gfSupported)
1876 {
1877 psessionEntry->gLimNonGfParams.numSta++;
1878 limLog(pMac,LOG1, FL("NonGf, "));
1879 }
1880 if(!lsigTxopSupported)
1881 {
1882 psessionEntry->gLimLsigTxopParams.numSta++;
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001883 limLog(pMac,LOG1, FL("!lsigTxopSupported"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001884 }
1885}// ---------------------------------------------------------------------
1886
1887/** -------------------------------------------------------------
1888\fn limDecideApProtection
1889\brief Decides all the protection related staiton coexistence and also sets
1890\ short preamble and short slot appropriately. This function will be called
1891\ when AP is ready to send assocRsp tp the station joining right now.
1892\param tpAniSirGlobal pMac
1893\param tSirMacAddr peerMacAddr
1894\return None
1895 -------------------------------------------------------------*/
1896void
1897limDecideApProtection(tpAniSirGlobal pMac, tSirMacAddr peerMacAddr, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry)
1898{
1899 tANI_U16 tmpAid;
1900 tpDphHashNode pStaDs;
1901 tSirRFBand rfBand = SIR_BAND_UNKNOWN;
1902 tANI_U32 phyMode;
1903 tLimProtStaCacheType protStaCacheType = eLIM_PROT_STA_CACHE_TYPE_INVALID;
1904 tHalBitVal gfSupported = eHAL_SET, lsigTxopSupported = eHAL_SET;
1905
1906 pBeaconParams->paramChangeBitmap = 0;
1907 // check whether to enable protection or not
1908 pStaDs = dphLookupHashEntry(pMac, peerMacAddr, &tmpAid, &psessionEntry->dph.dphHashTable);
1909 if(NULL == pStaDs)
1910 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001911 PELOG1(limLog(pMac, LOG1, FL("pStaDs is NULL"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001912 return;
1913 }
1914 limGetRfBand(pMac, &rfBand, psessionEntry);
1915 //if we are in 5 GHZ band
1916 if(SIR_BAND_5_GHZ == rfBand)
1917 {
1918 //We are 11N. we need to protect from 11A and Ht20. we don't need any other protection in 5 GHZ.
1919 //HT20 case is common between both the bands and handled down as common code.
Jeff Johnsone7245742012-09-05 17:12:55 -07001920 if(true == psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07001921 {
1922 //we are 11N and 11A station is joining.
1923 //protection from 11A required.
1924 if(false == pStaDs->mlmStaContext.htCapability)
1925 {
1926 limEnable11aProtection(pMac, true, false, pBeaconParams,psessionEntry);
1927 return;
1928 }
1929 }
1930 }
1931 else if(SIR_BAND_2_4_GHZ== rfBand)
1932 {
1933 limGetPhyMode(pMac, &phyMode, psessionEntry);
1934
1935 //We are 11G. Check if we need protection from 11b Stations.
1936 if ((phyMode == WNI_CFG_PHY_MODE_11G) &&
Jeff Johnsone7245742012-09-05 17:12:55 -07001937 (false == psessionEntry->htCapability))
Jeff Johnson295189b2012-06-20 16:38:30 -07001938 {
1939
1940 if (pStaDs->erpEnabled== eHAL_CLEAR)
1941 {
1942 protStaCacheType = eLIM_PROT_STA_CACHE_TYPE_llB;
1943 // enable protection
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001944 PELOG3(limLog(pMac, LOG3, FL("Enabling protection from 11B"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001945 limEnable11gProtection(pMac, true, false, pBeaconParams,psessionEntry);
1946 }
1947 }
1948
1949 //HT station.
Jeff Johnsone7245742012-09-05 17:12:55 -07001950 if (true == psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07001951 {
1952 //check if we need protection from 11b station
1953 if ((pStaDs->erpEnabled == eHAL_CLEAR) &&
1954 (!pStaDs->mlmStaContext.htCapability))
1955 {
1956 protStaCacheType = eLIM_PROT_STA_CACHE_TYPE_llB;
1957 // enable protection
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001958 PELOG3(limLog(pMac, LOG3, FL("Enabling protection from 11B"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001959 limEnable11gProtection(pMac, true, false, pBeaconParams, psessionEntry);
1960 }
1961 //station being joined is non-11b and non-ht ==> 11g device
1962 else if(!pStaDs->mlmStaContext.htCapability)
1963 {
1964 protStaCacheType = eLIM_PROT_STA_CACHE_TYPE_llG;
1965 //enable protection
1966 limEnableHtProtectionFrom11g(pMac, true, false, pBeaconParams, psessionEntry);
1967 }
1968 //ERP mode is enabled for the latest station joined
1969 //latest station joined is HT capable
1970 //This case is being handled in common code (commn between both the bands) below.
1971 }
1972 }
1973
1974 //we are HT and HT station is joining. This code is common for both the bands.
Jeff Johnsone7245742012-09-05 17:12:55 -07001975 if((true == psessionEntry->htCapability) &&
Jeff Johnson295189b2012-06-20 16:38:30 -07001976 (true == pStaDs->mlmStaContext.htCapability))
1977 {
1978 if(!pStaDs->htGreenfield)
1979 {
1980 limEnableHTNonGfProtection(pMac, true, false, pBeaconParams, psessionEntry);
1981 gfSupported = eHAL_CLEAR;
1982 }
1983 //Station joining is HT 20Mhz
1984 if(eHT_CHANNEL_WIDTH_20MHZ == pStaDs->htSupportedChannelWidthSet)
1985 {
1986 protStaCacheType = eLIM_PROT_STA_CACHE_TYPE_HT20;
1987 limEnableHT20Protection(pMac, true, false, pBeaconParams, psessionEntry);
1988 }
1989 //Station joining does not support LSIG TXOP Protection
1990 if(!pStaDs->htLsigTXOPProtection)
1991 {
1992 limEnableHTLsigTxopProtection(pMac, false, false, pBeaconParams,psessionEntry);
1993 lsigTxopSupported = eHAL_CLEAR;
1994 }
1995 }
1996
1997 limUpdateProtStaParams(pMac, peerMacAddr, protStaCacheType,
1998 gfSupported, lsigTxopSupported, psessionEntry);
1999
2000 return;
2001}
Jeff Johnson295189b2012-06-20 16:38:30 -07002002
2003
2004/** -------------------------------------------------------------
2005\fn limEnableOverlap11gProtection
2006\brief wrapper function for setting overlap 11g protection.
2007\param tpAniSirGlobal pMac
2008\param tpUpdateBeaconParams pBeaconParams
2009\param tpSirMacMgmtHdr pMh
2010\return None
2011 -------------------------------------------------------------*/
2012void
2013limEnableOverlap11gProtection(tpAniSirGlobal pMac,
2014tpUpdateBeaconParams pBeaconParams, tpSirMacMgmtHdr pMh,tpPESession psessionEntry)
2015{
2016 limUpdateOverlapStaParam(pMac, pMh->bssId, &(psessionEntry->gLimOlbcParams));
2017
2018 if (psessionEntry->gLimOlbcParams.numSta &&
2019 !psessionEntry->gLimOlbcParams.protectionEnabled)
2020 {
2021 // enable protection
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002022 PELOG1(limLog(pMac, LOG1, FL("OLBC happens!!!"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002023 limEnable11gProtection(pMac, true, true, pBeaconParams,psessionEntry);
2024 }
2025}
2026
2027
2028/** -------------------------------------------------------------
2029\fn limUpdateShortPreamble
2030\brief Updates short preamble if needed when a new station joins.
2031\param tpAniSirGlobal pMac
2032\param tSirMacAddr peerMacAddr
2033\param tpUpdateBeaconParams pBeaconParams
2034\return None
2035 -------------------------------------------------------------*/
2036void
2037limUpdateShortPreamble(tpAniSirGlobal pMac, tSirMacAddr peerMacAddr,
2038 tpUpdateBeaconParams pBeaconParams, tpPESession psessionEntry)
2039{
2040 tANI_U16 tmpAid;
2041 tpDphHashNode pStaDs;
2042 tANI_U32 phyMode;
2043 tANI_U16 i;
2044
2045 // check whether to enable protection or not
2046 pStaDs = dphLookupHashEntry(pMac, peerMacAddr, &tmpAid, &psessionEntry->dph.dphHashTable);
2047
2048 limGetPhyMode(pMac, &phyMode, psessionEntry);
2049
2050 if (pStaDs != NULL && phyMode == WNI_CFG_PHY_MODE_11G)
2051
2052 {
2053 if (pStaDs->shortPreambleEnabled == eHAL_CLEAR)
2054 {
2055 PELOG1(limLog(pMac,LOG1,FL("Short Preamble is not enabled in Assoc Req from "));
2056 limPrintMacAddr(pMac, peerMacAddr, LOG1);)
2057
2058 for (i=0; i<LIM_PROT_STA_CACHE_SIZE; i++)
2059 {
Jeff Johnson295189b2012-06-20 16:38:30 -07002060 if ((psessionEntry->limSystemRole == eLIM_AP_ROLE ) &&
2061 psessionEntry->gLimNoShortParams.staNoShortCache[i].active)
2062 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05302063 if (vos_mem_compare(
Jeff Johnson295189b2012-06-20 16:38:30 -07002064 psessionEntry->gLimNoShortParams.staNoShortCache[i].addr,
2065 peerMacAddr, sizeof(tSirMacAddr)))
2066 return;
2067 }else if(psessionEntry->limSystemRole != eLIM_AP_ROLE)
Jeff Johnson295189b2012-06-20 16:38:30 -07002068 {
2069 if (pMac->lim.gLimNoShortParams.staNoShortCache[i].active)
2070 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05302071 if (vos_mem_compare(
Jeff Johnson295189b2012-06-20 16:38:30 -07002072 pMac->lim.gLimNoShortParams.staNoShortCache[i].addr,
2073 peerMacAddr, sizeof(tSirMacAddr)))
2074 return;
2075 }
2076 }
2077 }
2078
2079
2080 for (i=0; i<LIM_PROT_STA_CACHE_SIZE; i++)
2081 {
Jeff Johnson295189b2012-06-20 16:38:30 -07002082 if ( (psessionEntry->limSystemRole == eLIM_AP_ROLE ) &&
2083 !psessionEntry->gLimNoShortParams.staNoShortCache[i].active)
2084 break;
2085 else
Jeff Johnson295189b2012-06-20 16:38:30 -07002086 {
2087 if (!pMac->lim.gLimNoShortParams.staNoShortCache[i].active)
2088 break;
2089 }
2090 }
2091
2092 if (i >= LIM_PROT_STA_CACHE_SIZE)
2093 {
Jeff Johnson295189b2012-06-20 16:38:30 -07002094 if(psessionEntry->limSystemRole == eLIM_AP_ROLE){
2095 limLog(pMac, LOGE, FL("No space in Short cache (#active %d, #sta %d) for sta "),
2096 i, psessionEntry->gLimNoShortParams.numNonShortPreambleSta);
2097 limPrintMacAddr(pMac, peerMacAddr, LOGE);
2098 return;
2099 }
2100 else
Jeff Johnson295189b2012-06-20 16:38:30 -07002101 {
2102 limLog(pMac, LOGE, FL("No space in Short cache (#active %d, #sta %d) for sta "),
2103 i, pMac->lim.gLimNoShortParams.numNonShortPreambleSta);
2104 limPrintMacAddr(pMac, peerMacAddr, LOGE);
2105 return;
2106 }
2107
2108 }
2109
2110
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05302111 if (psessionEntry->limSystemRole == eLIM_AP_ROLE){
2112 vos_mem_copy( psessionEntry->gLimNoShortParams.staNoShortCache[i].addr,
Jeff Johnson295189b2012-06-20 16:38:30 -07002113 peerMacAddr, sizeof(tSirMacAddr));
2114 psessionEntry->gLimNoShortParams.staNoShortCache[i].active = true;
2115 psessionEntry->gLimNoShortParams.numNonShortPreambleSta++;
2116 }else
Jeff Johnson295189b2012-06-20 16:38:30 -07002117 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05302118 vos_mem_copy( pMac->lim.gLimNoShortParams.staNoShortCache[i].addr,
Jeff Johnson295189b2012-06-20 16:38:30 -07002119 peerMacAddr, sizeof(tSirMacAddr));
2120 pMac->lim.gLimNoShortParams.staNoShortCache[i].active = true;
2121 pMac->lim.gLimNoShortParams.numNonShortPreambleSta++;
2122 }
2123
2124
2125 // enable long preamble
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002126 PELOG1(limLog(pMac, LOG1, FL("Disabling short preamble"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002127
Jeff Johnson295189b2012-06-20 16:38:30 -07002128 if (limEnableShortPreamble(pMac, false, pBeaconParams, psessionEntry) != eSIR_SUCCESS)
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002129 PELOGE(limLog(pMac, LOGE, FL("Cannot enable long preamble"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002130 }
2131 }
2132}
2133
2134/** -------------------------------------------------------------
2135\fn limUpdateShortSlotTime
2136\brief Updates short slot time if needed when a new station joins.
2137\param tpAniSirGlobal pMac
2138\param tSirMacAddr peerMacAddr
2139\param tpUpdateBeaconParams pBeaconParams
2140\return None
2141 -------------------------------------------------------------*/
2142
2143void
2144limUpdateShortSlotTime(tpAniSirGlobal pMac, tSirMacAddr peerMacAddr,
2145 tpUpdateBeaconParams pBeaconParams, tpPESession psessionEntry)
2146{
2147 tANI_U16 tmpAid;
2148 tpDphHashNode pStaDs;
2149 tANI_U32 phyMode;
2150 tANI_U32 val;
Jeff Johnson295189b2012-06-20 16:38:30 -07002151 tANI_U16 i;
2152
2153 // check whether to enable protection or not
2154 pStaDs = dphLookupHashEntry(pMac, peerMacAddr, &tmpAid, &psessionEntry->dph.dphHashTable);
2155 limGetPhyMode(pMac, &phyMode, psessionEntry);
2156
Jeff Johnsone7245742012-09-05 17:12:55 -07002157 /* Only in case of softap in 11g mode, slot time might change depending on the STA being added. In 11a case, it should
2158 * be always 1 and in 11b case, it should be always 0
2159 */
Jeff Johnson295189b2012-06-20 16:38:30 -07002160 if (pStaDs != NULL && phyMode == WNI_CFG_PHY_MODE_11G)
2161 {
Jeff Johnsone7245742012-09-05 17:12:55 -07002162 /* Only when the new STA has short slot time disabled, we need to change softap's overall slot time settings
2163 * else the default for softap is always short slot enabled. When the last long slot STA leaves softAP, we take care of
2164 * it in limDecideShortSlot
2165 */
Jeff Johnson295189b2012-06-20 16:38:30 -07002166 if (pStaDs->shortSlotTimeEnabled == eHAL_CLEAR)
2167 {
2168 PELOG1(limLog(pMac, LOG1, FL("Short Slot Time is not enabled in Assoc Req from "));
2169 limPrintMacAddr(pMac, peerMacAddr, LOG1);)
2170 for (i=0; i<LIM_PROT_STA_CACHE_SIZE; i++)
2171 {
Jeff Johnson295189b2012-06-20 16:38:30 -07002172 if ((psessionEntry->limSystemRole == eLIM_AP_ROLE ) &&
2173 psessionEntry->gLimNoShortSlotParams.staNoShortSlotCache[i].active)
2174 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05302175 if (vos_mem_compare(
Jeff Johnson295189b2012-06-20 16:38:30 -07002176 psessionEntry->gLimNoShortSlotParams.staNoShortSlotCache[i].addr,
2177 peerMacAddr, sizeof(tSirMacAddr)))
2178 return;
2179 }
2180 else if(psessionEntry->limSystemRole != eLIM_AP_ROLE )
Jeff Johnson295189b2012-06-20 16:38:30 -07002181 {
2182 if (pMac->lim.gLimNoShortSlotParams.staNoShortSlotCache[i].active)
2183 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05302184 if (vos_mem_compare(
Jeff Johnson295189b2012-06-20 16:38:30 -07002185 pMac->lim.gLimNoShortSlotParams.staNoShortSlotCache[i].addr,
2186 peerMacAddr, sizeof(tSirMacAddr)))
2187 return;
2188 }
2189 }
2190 }
2191
2192 for (i=0; i<LIM_PROT_STA_CACHE_SIZE; i++)
2193 {
Jeff Johnson295189b2012-06-20 16:38:30 -07002194 if ((psessionEntry->limSystemRole == eLIM_AP_ROLE ) &&
2195 !psessionEntry->gLimNoShortSlotParams.staNoShortSlotCache[i].active)
2196 break;
2197 else
Jeff Johnson295189b2012-06-20 16:38:30 -07002198 {
2199 if (!pMac->lim.gLimNoShortSlotParams.staNoShortSlotCache[i].active)
2200 break;
2201 }
2202 }
2203
2204 if (i >= LIM_PROT_STA_CACHE_SIZE)
2205 {
Jeff Johnson295189b2012-06-20 16:38:30 -07002206 if(psessionEntry->limSystemRole == eLIM_AP_ROLE){
2207 limLog(pMac, LOGE, FL("No space in ShortSlot cache (#active %d, #sta %d) for sta "),
2208 i, psessionEntry->gLimNoShortSlotParams.numNonShortSlotSta);
2209 limPrintMacAddr(pMac, peerMacAddr, LOGE);
2210 return;
2211 }else
Jeff Johnson295189b2012-06-20 16:38:30 -07002212 {
2213 limLog(pMac, LOGE, FL("No space in ShortSlot cache (#active %d, #sta %d) for sta "),
2214 i, pMac->lim.gLimNoShortSlotParams.numNonShortSlotSta);
2215 limPrintMacAddr(pMac, peerMacAddr, LOGE);
2216 return;
2217 }
2218 }
2219
2220
Jeff Johnson295189b2012-06-20 16:38:30 -07002221 if(psessionEntry->limSystemRole == eLIM_AP_ROLE){
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05302222 vos_mem_copy( psessionEntry->gLimNoShortSlotParams.staNoShortSlotCache[i].addr,
Jeff Johnson295189b2012-06-20 16:38:30 -07002223 peerMacAddr, sizeof(tSirMacAddr));
2224 psessionEntry->gLimNoShortSlotParams.staNoShortSlotCache[i].active = true;
2225 psessionEntry->gLimNoShortSlotParams.numNonShortSlotSta++;
2226 }else
Jeff Johnson295189b2012-06-20 16:38:30 -07002227 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05302228 vos_mem_copy( pMac->lim.gLimNoShortSlotParams.staNoShortSlotCache[i].addr,
Jeff Johnson295189b2012-06-20 16:38:30 -07002229 peerMacAddr, sizeof(tSirMacAddr));
2230 pMac->lim.gLimNoShortSlotParams.staNoShortSlotCache[i].active = true;
2231 pMac->lim.gLimNoShortSlotParams.numNonShortSlotSta++;
2232 }
2233 wlan_cfgGetInt(pMac, WNI_CFG_11G_SHORT_SLOT_TIME_ENABLED, &val);
2234
Jeff Johnsone7245742012-09-05 17:12:55 -07002235 /* Here we check if we are AP role and short slot enabled (both admin and oper modes) but we have atleast one STA connected with
2236 * only long slot enabled, we need to change our beacon/pb rsp to broadcast short slot disabled
2237 */
Jeff Johnson295189b2012-06-20 16:38:30 -07002238 if ( (psessionEntry->limSystemRole == eLIM_AP_ROLE) &&
Jeff Johnsone7245742012-09-05 17:12:55 -07002239 (val && psessionEntry->gLimNoShortSlotParams.numNonShortSlotSta && psessionEntry->shortSlotTimeSupported))
Jeff Johnson295189b2012-06-20 16:38:30 -07002240 {
2241 // enable long slot time
2242 pBeaconParams->fShortSlotTime = false;
2243 pBeaconParams->paramChangeBitmap |= PARAM_SHORT_SLOT_TIME_CHANGED;
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002244 PELOG1(limLog(pMac, LOG1, FL("Disable short slot time. Enable long slot time."));)
Jeff Johnsone7245742012-09-05 17:12:55 -07002245 psessionEntry->shortSlotTimeSupported = false;
Jeff Johnson295189b2012-06-20 16:38:30 -07002246 }
2247 else if ( psessionEntry->limSystemRole != eLIM_AP_ROLE)
Jeff Johnson295189b2012-06-20 16:38:30 -07002248 {
Jeff Johnsone7245742012-09-05 17:12:55 -07002249 if (val && pMac->lim.gLimNoShortSlotParams.numNonShortSlotSta && psessionEntry->shortSlotTimeSupported)
Jeff Johnson295189b2012-06-20 16:38:30 -07002250 {
2251 // enable long slot time
2252 pBeaconParams->fShortSlotTime = false;
2253 pBeaconParams->paramChangeBitmap |= PARAM_SHORT_SLOT_TIME_CHANGED;
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002254 PELOG1(limLog(pMac, LOG1, FL("Disable short slot time. Enable long slot time."));)
Jeff Johnsone7245742012-09-05 17:12:55 -07002255 psessionEntry->shortSlotTimeSupported = false;
Jeff Johnson295189b2012-06-20 16:38:30 -07002256 }
2257 }
2258 }
2259 }
2260}
2261
Jeff Johnson295189b2012-06-20 16:38:30 -07002262
2263/** -------------------------------------------------------------
2264\fn limDecideStaProtectionOnAssoc
2265\brief Decide protection related settings on Sta while association.
2266\param tpAniSirGlobal pMac
2267\param tpSchBeaconStruct pBeaconStruct
2268\return None
2269 -------------------------------------------------------------*/
2270void
2271limDecideStaProtectionOnAssoc(tpAniSirGlobal pMac,
2272 tpSchBeaconStruct pBeaconStruct, tpPESession psessionEntry)
2273{
2274 tSirRFBand rfBand = SIR_BAND_UNKNOWN;
2275 tANI_U32 phyMode = WNI_CFG_PHY_MODE_NONE;
2276
2277 limGetRfBand(pMac, &rfBand, psessionEntry);
2278 limGetPhyMode(pMac, &phyMode, psessionEntry);
2279
2280 if(SIR_BAND_5_GHZ == rfBand)
2281 {
2282 if((eSIR_HT_OP_MODE_MIXED == pBeaconStruct->HTInfo.opMode) ||
2283 (eSIR_HT_OP_MODE_OVERLAP_LEGACY == pBeaconStruct->HTInfo.opMode))
2284 {
2285 if(pMac->lim.cfgProtection.fromlla)
2286 psessionEntry->beaconParams.llaCoexist = true;
2287 }
2288 else if(eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT == pBeaconStruct->HTInfo.opMode)
2289 {
2290 if(pMac->lim.cfgProtection.ht20)
2291 psessionEntry->beaconParams.ht20Coexist = true;
2292 }
2293
2294 }
2295 else if(SIR_BAND_2_4_GHZ == rfBand)
2296 {
2297 //spec 7.3.2.13
2298 //UseProtection will be set when nonERP STA is associated.
2299 //NonERPPresent bit will be set when:
2300 //--nonERP Sta is associated OR
2301 //--nonERP Sta exists in overlapping BSS
2302 //when useProtection is not set then protection from nonERP stations is optional.
2303
2304 //CFG protection from 11b is enabled and
2305 //11B device in the BSS
2306 /* TODO, This is not sessionized */
2307 if (phyMode != WNI_CFG_PHY_MODE_11B)
2308 {
2309 if (pMac->lim.cfgProtection.fromllb &&
2310 pBeaconStruct->erpPresent &&
2311 (pBeaconStruct->erpIEInfo.useProtection ||
2312 pBeaconStruct->erpIEInfo.nonErpPresent))
2313 {
2314 psessionEntry->beaconParams.llbCoexist = true;
2315 }
2316 //AP has no 11b station associated.
2317 else
2318 {
2319 psessionEntry->beaconParams.llbCoexist = false;
2320 }
2321 }
2322 //following code block is only for HT station.
Jeff Johnsone7245742012-09-05 17:12:55 -07002323 if((psessionEntry->htCapability) &&
Jeff Johnson295189b2012-06-20 16:38:30 -07002324 (pBeaconStruct->HTInfo.present))
2325 {
2326 tDot11fIEHTInfo htInfo = pBeaconStruct->HTInfo;
2327
2328 //Obss Non HT STA present mode
2329 psessionEntry->beaconParams.gHTObssMode = (tANI_U8)htInfo.obssNonHTStaPresent;
2330
2331
2332 //CFG protection from 11G is enabled and
2333 //our AP has at least one 11G station associated.
2334 if(pMac->lim.cfgProtection.fromllg &&
2335 ((eSIR_HT_OP_MODE_MIXED == htInfo.opMode) ||
2336 (eSIR_HT_OP_MODE_OVERLAP_LEGACY == htInfo.opMode))&&
2337 (!psessionEntry->beaconParams.llbCoexist))
2338 {
2339 if(pMac->lim.cfgProtection.fromllg)
2340 psessionEntry->beaconParams.llgCoexist = true;
2341 }
2342
2343 //AP has only HT stations associated and at least one station is HT 20
2344 //disable protection from any non-HT devices.
2345 //decision for disabling protection from 11b has already been taken above.
2346 if(eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT == htInfo.opMode)
2347 {
2348 //Disable protection from 11G station.
2349 psessionEntry->beaconParams.llgCoexist = false;
2350 //CFG protection from HT 20 is enabled.
2351 if(pMac->lim.cfgProtection.ht20)
2352 psessionEntry->beaconParams.ht20Coexist = true;
2353 }
2354 //Disable protection from non-HT and HT20 devices.
2355 //decision for disabling protection from 11b has already been taken above.
2356 if(eSIR_HT_OP_MODE_PURE == htInfo.opMode)
2357 {
2358 psessionEntry->beaconParams.llgCoexist = false;
2359 psessionEntry->beaconParams.ht20Coexist = false;
2360 }
2361
2362 }
2363 }
2364
2365 //protection related factors other than HT operating mode. Applies to 2.4 GHZ as well as 5 GHZ.
Jeff Johnsone7245742012-09-05 17:12:55 -07002366 if((psessionEntry->htCapability) &&
Jeff Johnson295189b2012-06-20 16:38:30 -07002367 (pBeaconStruct->HTInfo.present))
2368 {
2369 tDot11fIEHTInfo htInfo = pBeaconStruct->HTInfo;
2370 psessionEntry->beaconParams.fRIFSMode =
2371 ( tANI_U8 ) htInfo.rifsMode;
2372 psessionEntry->beaconParams.llnNonGFCoexist =
2373 ( tANI_U8 )htInfo.nonGFDevicesPresent;
2374 psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport =
2375 ( tANI_U8 )htInfo.lsigTXOPProtectionFullSupport;
2376 }
2377}
2378
2379
2380/** -------------------------------------------------------------
2381\fn limDecideStaProtection
2382\brief Decides protection related settings on Sta while processing beacon.
2383\param tpAniSirGlobal pMac
2384\param tpUpdateBeaconParams pBeaconParams
2385\return None
2386 -------------------------------------------------------------*/
2387void
2388limDecideStaProtection(tpAniSirGlobal pMac,
2389 tpSchBeaconStruct pBeaconStruct, tpUpdateBeaconParams pBeaconParams, tpPESession psessionEntry)
2390{
2391
2392 tSirRFBand rfBand = SIR_BAND_UNKNOWN;
2393 tANI_U32 phyMode = WNI_CFG_PHY_MODE_NONE;
2394
2395 limGetRfBand(pMac, &rfBand, psessionEntry);
2396 limGetPhyMode(pMac, &phyMode, psessionEntry);
2397
2398 if(SIR_BAND_5_GHZ == rfBand)
2399 {
2400 //we are HT capable.
Jeff Johnsone7245742012-09-05 17:12:55 -07002401 if((true == psessionEntry->htCapability) &&
Jeff Johnson295189b2012-06-20 16:38:30 -07002402 (pBeaconStruct->HTInfo.present))
2403 {
2404 //we are HT capable, AP's HT OPMode is mixed / overlap legacy ==> need protection from 11A.
2405 if((eSIR_HT_OP_MODE_MIXED == pBeaconStruct->HTInfo.opMode) ||
2406 (eSIR_HT_OP_MODE_OVERLAP_LEGACY == pBeaconStruct->HTInfo.opMode))
2407 {
2408 limEnable11aProtection(pMac, true, false, pBeaconParams,psessionEntry);
2409 }
2410 //we are HT capable, AP's HT OPMode is HT20 ==> disable protection from 11A if enabled. enabled
2411 //protection from HT20 if needed.
2412 else if(eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT== pBeaconStruct->HTInfo.opMode)
2413 {
2414 limEnable11aProtection(pMac, false, false, pBeaconParams,psessionEntry);
2415 limEnableHT20Protection(pMac, true, false, pBeaconParams,psessionEntry);
2416 }
2417 else if(eSIR_HT_OP_MODE_PURE == pBeaconStruct->HTInfo.opMode)
2418 {
2419 limEnable11aProtection(pMac, false, false, pBeaconParams,psessionEntry);
2420 limEnableHT20Protection(pMac, false, false, pBeaconParams,psessionEntry);
2421 }
2422 }
2423 }
2424 else if(SIR_BAND_2_4_GHZ == rfBand)
2425 {
2426 /* spec 7.3.2.13
2427 * UseProtection will be set when nonERP STA is associated.
2428 * NonERPPresent bit will be set when:
2429 * --nonERP Sta is associated OR
2430 * --nonERP Sta exists in overlapping BSS
2431 * when useProtection is not set then protection from nonERP stations is optional.
2432 */
2433
2434 if (phyMode != WNI_CFG_PHY_MODE_11B)
2435 {
2436 if (pBeaconStruct->erpPresent &&
2437 (pBeaconStruct->erpIEInfo.useProtection ||
2438 pBeaconStruct->erpIEInfo.nonErpPresent))
2439 {
2440 limEnable11gProtection(pMac, true, false, pBeaconParams, psessionEntry);
2441 }
2442 //AP has no 11b station associated.
2443 else
2444 {
2445 //disable protection from 11b station
2446 limEnable11gProtection(pMac, false, false, pBeaconParams, psessionEntry);
2447 }
2448 }
2449
2450 //following code block is only for HT station.
Jeff Johnsone7245742012-09-05 17:12:55 -07002451 if((psessionEntry->htCapability) &&
Jeff Johnson295189b2012-06-20 16:38:30 -07002452 (pBeaconStruct->HTInfo.present))
2453 {
2454
2455 tDot11fIEHTInfo htInfo = pBeaconStruct->HTInfo;
2456 //AP has at least one 11G station associated.
2457 if(((eSIR_HT_OP_MODE_MIXED == htInfo.opMode) ||
2458 (eSIR_HT_OP_MODE_OVERLAP_LEGACY == htInfo.opMode))&&
2459 (!psessionEntry->beaconParams.llbCoexist))
2460 {
2461 limEnableHtProtectionFrom11g(pMac, true, false, pBeaconParams,psessionEntry);
2462
2463 }
2464
2465 //no HT operating mode change ==> no change in protection settings except for MIXED_MODE/Legacy Mode.
2466 //in Mixed mode/legacy Mode even if there is no change in HT operating mode, there might be change in 11bCoexist
2467 //or 11gCoexist. that is why this check is being done after mixed/legacy mode check.
2468 if ( pMac->lim.gHTOperMode != ( tSirMacHTOperatingMode )htInfo.opMode )
2469 {
2470 pMac->lim.gHTOperMode = ( tSirMacHTOperatingMode )htInfo.opMode;
2471
2472 //AP has only HT stations associated and at least one station is HT 20
2473 //disable protection from any non-HT devices.
2474 //decision for disabling protection from 11b has already been taken above.
2475 if(eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT == htInfo.opMode)
2476 {
2477 //Disable protection from 11G station.
2478 limEnableHtProtectionFrom11g(pMac, false, false, pBeaconParams,psessionEntry);
2479
2480 limEnableHT20Protection(pMac, true, false, pBeaconParams,psessionEntry);
2481 }
2482 //Disable protection from non-HT and HT20 devices.
2483 //decision for disabling protection from 11b has already been taken above.
2484 else if(eSIR_HT_OP_MODE_PURE == htInfo.opMode)
2485 {
2486 limEnableHtProtectionFrom11g(pMac, false, false, pBeaconParams,psessionEntry);
2487 limEnableHT20Protection(pMac, false, false, pBeaconParams,psessionEntry);
2488
2489 }
2490 }
2491 }
2492 }
2493
2494 //following code block is only for HT station. ( 2.4 GHZ as well as 5 GHZ)
Jeff Johnsone7245742012-09-05 17:12:55 -07002495 if((psessionEntry->htCapability) &&
Jeff Johnson295189b2012-06-20 16:38:30 -07002496 (pBeaconStruct->HTInfo.present))
2497 {
2498 tDot11fIEHTInfo htInfo = pBeaconStruct->HTInfo;
2499 //Check for changes in protection related factors other than HT operating mode.
2500 //Check for changes in RIFS mode, nonGFDevicesPresent, lsigTXOPProtectionFullSupport.
2501 if ( psessionEntry->beaconParams.fRIFSMode !=
2502 ( tANI_U8 ) htInfo.rifsMode )
2503 {
2504 pBeaconParams->fRIFSMode =
2505 psessionEntry->beaconParams.fRIFSMode =
2506 ( tANI_U8 ) htInfo.rifsMode;
2507 pBeaconParams->paramChangeBitmap |= PARAM_RIFS_MODE_CHANGED;
2508 }
2509
2510 if ( psessionEntry->beaconParams.llnNonGFCoexist !=
2511 htInfo.nonGFDevicesPresent )
2512 {
2513 pBeaconParams->llnNonGFCoexist =
2514 psessionEntry->beaconParams.llnNonGFCoexist =
2515 ( tANI_U8 )htInfo.nonGFDevicesPresent;
2516 pBeaconParams->paramChangeBitmap |=
2517 PARAM_NON_GF_DEVICES_PRESENT_CHANGED;
2518 }
2519
2520 if ( psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport !=
2521 ( tANI_U8 )htInfo.lsigTXOPProtectionFullSupport )
2522 {
2523 pBeaconParams->fLsigTXOPProtectionFullSupport =
2524 psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport =
2525 ( tANI_U8 )htInfo.lsigTXOPProtectionFullSupport;
2526 pBeaconParams->paramChangeBitmap |=
2527 PARAM_LSIG_TXOP_FULL_SUPPORT_CHANGED;
2528 }
2529
2530 // For Station just update the global lim variable, no need to send message to HAL
2531 // Station already taking care of HT OPR Mode=01, meaning AP is seeing legacy
2532 //stations in overlapping BSS.
2533 if ( psessionEntry->beaconParams.gHTObssMode != ( tANI_U8 )htInfo.obssNonHTStaPresent )
2534 psessionEntry->beaconParams.gHTObssMode = ( tANI_U8 )htInfo.obssNonHTStaPresent ;
2535
2536 }
2537}
2538
2539
2540/**
2541 * limProcessChannelSwitchTimeout()
2542 *
2543 *FUNCTION:
2544 * This function is invoked when Channel Switch Timer expires at
2545 * the STA. Now, STA must stop traffic, and then change/disable
2546 * primary or secondary channel.
2547 *
2548 *
2549 *NOTE:
2550 * @param pMac - Pointer to Global MAC structure
2551 * @return None
2552 */
2553void limProcessChannelSwitchTimeout(tpAniSirGlobal pMac)
2554{
2555 tpPESession psessionEntry = NULL;
Jeff Johnsone7245742012-09-05 17:12:55 -07002556 tANI_U8 channel; // This is received and stored from channelSwitch Action frame
Jeff Johnson295189b2012-06-20 16:38:30 -07002557
2558 if((psessionEntry = peFindSessionBySessionId(pMac, pMac->lim.limTimers.gLimChannelSwitchTimer.sessionId))== NULL)
2559 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002560 limLog(pMac, LOGP,FL("Session Does not exist for given sessionID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002561 return;
2562 }
2563
2564 if (psessionEntry->limSystemRole != eLIM_STA_ROLE)
2565 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002566 PELOGW(limLog(pMac, LOGW, "Channel switch can be done only in STA role, Current Role = %d", psessionEntry->limSystemRole);)
Jeff Johnson295189b2012-06-20 16:38:30 -07002567 return;
2568 }
Jeff Johnsone7245742012-09-05 17:12:55 -07002569 channel = psessionEntry->gLimChannelSwitch.primaryChannel;
Jeff Johnson295189b2012-06-20 16:38:30 -07002570 /*
2571 * This potentially can create issues if the function tries to set
2572 * channel while device is in power-save, hence putting an extra check
2573 * to verify if the device is in power-save or not
2574 */
2575 if(!limIsSystemInActiveState(pMac))
2576 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002577 PELOGW(limLog(pMac, LOGW, FL("Device is not in active state, cannot switch channel"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002578 return;
2579 }
2580
2581 // Restore Channel Switch parameters to default
Jeff Johnsone7245742012-09-05 17:12:55 -07002582 psessionEntry->gLimChannelSwitch.switchTimeoutValue = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07002583
2584 /* Channel-switch timeout has occurred. reset the state */
Jeff Johnsone7245742012-09-05 17:12:55 -07002585 psessionEntry->gLimSpecMgmt.dot11hChanSwState = eLIM_11H_CHANSW_END;
Jeff Johnson295189b2012-06-20 16:38:30 -07002586
2587 /* Check if the AP is switching to a channel that we support.
2588 * Else, just don't bother to switch. Indicate HDD to look for a
2589 * better AP to associate
2590 */
2591 if(!limIsChannelValidForChannelSwitch(pMac, channel))
2592 {
2593 /* We need to restore pre-channelSwitch state on the STA */
2594 if(limRestorePreChannelSwitchState(pMac, psessionEntry) != eSIR_SUCCESS)
2595 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002596 limLog(pMac, LOGP, FL("Could not restore pre-channelSwitch (11h) state, resetting the system"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002597 return;
2598 }
2599
2600 /* If the channel-list that AP is asking us to switch is invalid,
2601 * then we cannot switch the channel. Just disassociate from AP.
2602 * We will find a better AP !!!
2603 */
2604 limTearDownLinkWithAp(pMac,
2605 pMac->lim.limTimers.gLimChannelSwitchTimer.sessionId,
2606 eSIR_MAC_UNSPEC_FAILURE_REASON);
2607 return;
2608 }
Kiran Kumar Lokereb8bb6842013-08-12 16:40:24 -07002609 limCovertChannelScanType(pMac, psessionEntry->currentOperChannel, false);
2610 pMac->lim.dfschannelList.timeStamp[psessionEntry->currentOperChannel] = 0;
Jeff Johnsone7245742012-09-05 17:12:55 -07002611 switch(psessionEntry->gLimChannelSwitch.state)
Jeff Johnson295189b2012-06-20 16:38:30 -07002612 {
2613 case eLIM_CHANNEL_SWITCH_PRIMARY_ONLY:
Kalikinkar dhara085c02f2014-02-28 15:32:12 -08002614 case eLIM_CHANNEL_SWITCH_PRIMARY_AND_SECONDARY:
2615 if ( isLimSessionOffChannel(pMac,
2616 pMac->lim.limTimers.gLimChannelSwitchTimer.sessionId) )
2617 {
2618 limSuspendLink(pMac,
2619 eSIR_DONT_CHECK_LINK_TRAFFIC_BEFORE_SCAN,
2620 limProcessChannelSwitchSuspendLink,
2621 (tANI_U32*)psessionEntry );
2622 }
2623 else
2624 {
2625 limProcessChannelSwitchSuspendLink(pMac,
2626 eHAL_STATUS_SUCCESS,
2627 (tANI_U32*)psessionEntry);
2628 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002629 break;
2630
2631 case eLIM_CHANNEL_SWITCH_SECONDARY_ONLY:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002632 PELOGW(limLog(pMac, LOGW, FL("CHANNEL_SWITCH_SECONDARY_ONLY "));)
Jeff Johnsone7245742012-09-05 17:12:55 -07002633 limSwitchPrimarySecondaryChannel(pMac, psessionEntry,
Jeff Johnson295189b2012-06-20 16:38:30 -07002634 psessionEntry->currentOperChannel,
Jeff Johnsone7245742012-09-05 17:12:55 -07002635 psessionEntry->gLimChannelSwitch.secondarySubBand);
2636 psessionEntry->gLimChannelSwitch.state = eLIM_CHANNEL_SWITCH_IDLE;
Jeff Johnson295189b2012-06-20 16:38:30 -07002637 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07002638 case eLIM_CHANNEL_SWITCH_IDLE:
2639 default:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002640 PELOGE(limLog(pMac, LOGE, FL("incorrect state "));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002641 if(limRestorePreChannelSwitchState(pMac, psessionEntry) != eSIR_SUCCESS)
2642 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002643 limLog(pMac, LOGP, FL("Could not restore pre-channelSwitch (11h) state, resetting the system"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002644 }
2645 return; /* Please note, this is 'return' and not 'break' */
2646 }
Jeff Johnsone7245742012-09-05 17:12:55 -07002647}
Jeff Johnson295189b2012-06-20 16:38:30 -07002648
2649/**
2650 * limUpdateChannelSwitch()
2651 *
2652 *FUNCTION:
2653 * This function is invoked whenever Station receives
2654 * either 802.11h channel switch IE or airgo proprietary
2655 * channel switch IE.
2656 *
2657 *NOTE:
2658 * @param pMac - Pointer to Global MAC structure
2659 * @return tpSirProbeRespBeacon - Pointer to Beacon/Probe Rsp
2660 * @param psessionentry
2661 */
2662void
2663limUpdateChannelSwitch(struct sAniSirGlobal *pMac, tpSirProbeRespBeacon pBeacon, tpPESession psessionEntry)
2664{
2665
2666 tANI_U16 beaconPeriod;
Jeff Johnson295189b2012-06-20 16:38:30 -07002667 tChannelSwitchPropIEStruct *pPropChnlSwitch;
2668 tDot11fIEChanSwitchAnn *pChnlSwitch;
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -07002669#ifdef WLAN_FEATURE_11AC
2670 tDot11fIEWiderBWChanSwitchAnn *pWiderChnlSwitch;
2671#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002672
Jeff Johnsone7245742012-09-05 17:12:55 -07002673 beaconPeriod = psessionEntry->beaconParams.beaconInterval;
Jeff Johnson295189b2012-06-20 16:38:30 -07002674
2675 /* STA either received proprietary channel switch IE or 802.11h
2676 * standard channel switch IE.
2677 */
2678 if (pBeacon->propIEinfo.propChannelSwitchPresent)
2679 {
2680 pPropChnlSwitch = &(pBeacon->propIEinfo.channelSwitch);
2681
2682 /* Add logic to determine which change this is: */
2683 /* primary, secondary, both. For now assume both. */
Jeff Johnsone7245742012-09-05 17:12:55 -07002684 psessionEntry->gLimChannelSwitch.state = eLIM_CHANNEL_SWITCH_PRIMARY_AND_SECONDARY;
2685 psessionEntry->gLimChannelSwitch.primaryChannel = pPropChnlSwitch->primaryChannel;
2686 psessionEntry->gLimChannelSwitch.secondarySubBand = (ePhyChanBondState)pPropChnlSwitch->subBand;
2687 psessionEntry->gLimChannelSwitch.switchCount = pPropChnlSwitch->channelSwitchCount;
2688 psessionEntry->gLimChannelSwitch.switchTimeoutValue =
Jeff Johnson295189b2012-06-20 16:38:30 -07002689 SYS_MS_TO_TICKS(beaconPeriod)* (pPropChnlSwitch->channelSwitchCount);
Jeff Johnsone7245742012-09-05 17:12:55 -07002690 psessionEntry->gLimChannelSwitch.switchMode = pPropChnlSwitch->mode;
Jeff Johnson295189b2012-06-20 16:38:30 -07002691 }
2692 else
2693 {
2694 pChnlSwitch = &(pBeacon->channelSwitchIE);
Jeff Johnsone7245742012-09-05 17:12:55 -07002695 psessionEntry->gLimChannelSwitch.primaryChannel = pChnlSwitch->newChannel;
2696 psessionEntry->gLimChannelSwitch.switchCount = pChnlSwitch->switchCount;
2697 psessionEntry->gLimChannelSwitch.switchTimeoutValue =
Jeff Johnson295189b2012-06-20 16:38:30 -07002698 SYS_MS_TO_TICKS(beaconPeriod)* (pChnlSwitch->switchCount);
Jeff Johnsone7245742012-09-05 17:12:55 -07002699 psessionEntry->gLimChannelSwitch.switchMode = pChnlSwitch->switchMode;
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -07002700#ifdef WLAN_FEATURE_11AC
2701 pWiderChnlSwitch = &(pBeacon->WiderBWChanSwitchAnn);
2702 if(pBeacon->WiderBWChanSwitchAnnPresent)
2703 {
2704 psessionEntry->gLimWiderBWChannelSwitch.newChanWidth = pWiderChnlSwitch->newChanWidth;
2705 psessionEntry->gLimWiderBWChannelSwitch.newCenterChanFreq0 = pWiderChnlSwitch->newCenterChanFreq0;
2706 psessionEntry->gLimWiderBWChannelSwitch.newCenterChanFreq1 = pWiderChnlSwitch->newCenterChanFreq1;
2707 }
2708#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002709
2710 /* Only primary channel switch element is present */
Jeff Johnsone7245742012-09-05 17:12:55 -07002711 psessionEntry->gLimChannelSwitch.state = eLIM_CHANNEL_SWITCH_PRIMARY_ONLY;
2712 psessionEntry->gLimChannelSwitch.secondarySubBand = PHY_SINGLE_CHANNEL_CENTERED;
Jeff Johnson295189b2012-06-20 16:38:30 -07002713
2714 /* Do not bother to look and operate on extended channel switch element
2715 * if our own channel-bonding state is not enabled
2716 */
Jeff Johnsone7245742012-09-05 17:12:55 -07002717 if (psessionEntry->htSupportedChannelWidthSet)
Jeff Johnson295189b2012-06-20 16:38:30 -07002718 {
2719 if (pBeacon->extChannelSwitchPresent)
2720 {
Jeff Johnsone7245742012-09-05 17:12:55 -07002721 if ((pBeacon->extChannelSwitchIE.secondaryChannelOffset == PHY_DOUBLE_CHANNEL_LOW_PRIMARY) ||
2722 (pBeacon->extChannelSwitchIE.secondaryChannelOffset == PHY_DOUBLE_CHANNEL_HIGH_PRIMARY))
Jeff Johnson295189b2012-06-20 16:38:30 -07002723 {
Jeff Johnsone7245742012-09-05 17:12:55 -07002724 psessionEntry->gLimChannelSwitch.state = eLIM_CHANNEL_SWITCH_PRIMARY_AND_SECONDARY;
2725 psessionEntry->gLimChannelSwitch.secondarySubBand = pBeacon->extChannelSwitchIE.secondaryChannelOffset;
Jeff Johnson295189b2012-06-20 16:38:30 -07002726 }
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -07002727#ifdef WLAN_FEATURE_11AC
2728 if(psessionEntry->vhtCapability && pBeacon->WiderBWChanSwitchAnnPresent)
2729 {
2730 if (pWiderChnlSwitch->newChanWidth == WNI_CFG_VHT_CHANNEL_WIDTH_80MHZ)
2731 {
2732 if(pBeacon->extChannelSwitchPresent)
2733 {
2734 if ((pBeacon->extChannelSwitchIE.secondaryChannelOffset == PHY_DOUBLE_CHANNEL_LOW_PRIMARY) ||
2735 (pBeacon->extChannelSwitchIE.secondaryChannelOffset == PHY_DOUBLE_CHANNEL_HIGH_PRIMARY))
2736 {
2737 psessionEntry->gLimChannelSwitch.state = eLIM_CHANNEL_SWITCH_PRIMARY_AND_SECONDARY;
2738 psessionEntry->gLimChannelSwitch.secondarySubBand = limGet11ACPhyCBState(pMac,
2739 psessionEntry->gLimChannelSwitch.primaryChannel,
2740 pBeacon->extChannelSwitchIE.secondaryChannelOffset,
2741 pWiderChnlSwitch->newCenterChanFreq0,
2742 psessionEntry);
2743 }
2744 }
2745 }
2746 }
2747#endif
Jeff Johnsone7245742012-09-05 17:12:55 -07002748 }
2749 }
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -07002750 }
Kalikinkar dhara085c02f2014-02-28 15:32:12 -08002751
2752
Jeff Johnson295189b2012-06-20 16:38:30 -07002753 if (eSIR_SUCCESS != limStartChannelSwitch(pMac, psessionEntry))
2754 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002755 PELOGW(limLog(pMac, LOGW, FL("Could not start Channel Switch"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002756 }
2757
2758 limLog(pMac, LOGW,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002759 FL("session %d primary chl %d, subband %d, count %d (%d ticks) "),
Jeff Johnsone7245742012-09-05 17:12:55 -07002760 psessionEntry->peSessionId,
2761 psessionEntry->gLimChannelSwitch.primaryChannel,
2762 psessionEntry->gLimChannelSwitch.secondarySubBand,
2763 psessionEntry->gLimChannelSwitch.switchCount,
2764 psessionEntry->gLimChannelSwitch.switchTimeoutValue);
Jeff Johnson295189b2012-06-20 16:38:30 -07002765 return;
2766}
2767
2768/**
2769 * limCancelDot11hChannelSwitch
2770 *
2771 *FUNCTION:
2772 * This function is called when STA does not send updated channel-swith IE
2773 * after indicating channel-switch start. This will cancel the channel-swith
2774 * timer which is already running.
2775 *
2776 *LOGIC:
2777 *
2778 *ASSUMPTIONS:
2779 *
2780 *NOTE:
2781 *
2782 * @param pMac - Pointer to Global MAC structure
2783 *
2784 * @return None
2785 */
2786void limCancelDot11hChannelSwitch(tpAniSirGlobal pMac, tpPESession psessionEntry)
2787{
Jeff Johnson295189b2012-06-20 16:38:30 -07002788 if (psessionEntry->limSystemRole != eLIM_STA_ROLE)
2789 return;
2790
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002791 PELOGW(limLog(pMac, LOGW, FL("Received a beacon without channel switch IE"));)
Jeff Johnsone7245742012-09-05 17:12:55 -07002792 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_DEACTIVATE, psessionEntry->peSessionId, eLIM_CHANNEL_SWITCH_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -07002793
2794 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimChannelSwitchTimer) != eSIR_SUCCESS)
2795 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002796 PELOGE(limLog(pMac, LOGE, FL("tx_timer_deactivate failed!"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002797 }
2798
2799 /* We need to restore pre-channelSwitch state on the STA */
2800 if (limRestorePreChannelSwitchState(pMac, psessionEntry) != eSIR_SUCCESS)
2801 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002802 PELOGE(limLog(pMac, LOGE, FL("LIM: Could not restore pre-channelSwitch (11h) state, resetting the system"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002803
2804 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002805}
2806
2807/**----------------------------------------------
2808\fn limCancelDot11hQuiet
2809\brief Cancel the quieting on Station if latest
2810 beacon doesn't contain quiet IE in it.
2811
2812\param pMac
2813\return NONE
2814-----------------------------------------------*/
2815void limCancelDot11hQuiet(tpAniSirGlobal pMac, tpPESession psessionEntry)
2816{
Jeff Johnson295189b2012-06-20 16:38:30 -07002817 if (psessionEntry->limSystemRole != eLIM_STA_ROLE)
2818 return;
2819
Jeff Johnsone7245742012-09-05 17:12:55 -07002820 if (psessionEntry->gLimSpecMgmt.quietState == eLIM_QUIET_BEGIN)
Jeff Johnson295189b2012-06-20 16:38:30 -07002821 {
Jeff Johnsone7245742012-09-05 17:12:55 -07002822 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_DEACTIVATE, psessionEntry->peSessionId, eLIM_QUIET_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -07002823 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimQuietTimer) != TX_SUCCESS)
2824 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002825 PELOGE(limLog(pMac, LOGE, FL("tx_timer_deactivate failed"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002826 }
2827 }
Jeff Johnsone7245742012-09-05 17:12:55 -07002828 else if (psessionEntry->gLimSpecMgmt.quietState == eLIM_QUIET_RUNNING)
Jeff Johnson295189b2012-06-20 16:38:30 -07002829 {
Jeff Johnsone7245742012-09-05 17:12:55 -07002830 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_DEACTIVATE, psessionEntry->peSessionId, eLIM_QUIET_BSS_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -07002831 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimQuietBssTimer) != TX_SUCCESS)
2832 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002833 PELOGE(limLog(pMac, LOGE, FL("tx_timer_deactivate failed"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002834 }
2835 /**
2836 * If the channel switch is already running in silent mode, dont resume the
2837 * transmission. Channel switch timer when timeout, transmission will be resumed.
2838 */
Jeff Johnsone7245742012-09-05 17:12:55 -07002839 if(!((psessionEntry->gLimSpecMgmt.dot11hChanSwState == eLIM_11H_CHANSW_RUNNING) &&
2840 (psessionEntry->gLimChannelSwitch.switchMode == eSIR_CHANSW_MODE_SILENT)))
Jeff Johnson295189b2012-06-20 16:38:30 -07002841 {
2842 limFrameTransmissionControl(pMac, eLIM_TX_ALL, eLIM_RESUME_TX);
Jeff Johnsone7245742012-09-05 17:12:55 -07002843 limRestorePreQuietState(pMac, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07002844 }
2845 }
Jeff Johnsone7245742012-09-05 17:12:55 -07002846 psessionEntry->gLimSpecMgmt.quietState = eLIM_QUIET_INIT;
Jeff Johnson295189b2012-06-20 16:38:30 -07002847}
2848
2849/**
2850 * limProcessQuietTimeout
2851 *
2852 * FUNCTION:
2853 * This function is active only on the STA.
2854 * Handles SIR_LIM_QUIET_TIMEOUT
2855 *
2856 * LOGIC:
2857 * This timeout can occur under only one circumstance:
2858 *
2859 * 1) When gLimQuietState = eLIM_QUIET_BEGIN
2860 * This indicates that the timeout "interval" has
2861 * expired. This is a trigger for the STA to now
2862 * shut-off Tx/Rx for the specified gLimQuietDuration
2863 * -> The TIMER object gLimQuietBssTimer is
2864 * activated
2865 * -> With timeout = gLimQuietDuration
2866 * -> gLimQuietState is set to eLIM_QUIET_RUNNING
2867 *
2868 * ASSUMPTIONS:
2869 * Using two TIMER objects -
2870 * gLimQuietTimer & gLimQuietBssTimer
2871 *
2872 * NOTE:
2873 *
2874 * @param pMac - Pointer to Global MAC structure
2875 *
2876 * @return None
2877 */
2878void limProcessQuietTimeout(tpAniSirGlobal pMac)
2879{
Jeff Johnson295189b2012-06-20 16:38:30 -07002880 //fetch the sessionEntry based on the sessionId
2881 //priority - MEDIUM
Jeff Johnsone7245742012-09-05 17:12:55 -07002882 tpPESession psessionEntry;
Jeff Johnson295189b2012-06-20 16:38:30 -07002883
Jeff Johnsone7245742012-09-05 17:12:55 -07002884 if((psessionEntry = peFindSessionBySessionId(pMac, pMac->lim.limTimers.gLimQuietTimer.sessionId))== NULL)
Jeff Johnson295189b2012-06-20 16:38:30 -07002885 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002886 limLog(pMac, LOGE,FL("Session Does not exist for given sessionID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002887 return;
2888 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002889
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002890 PELOG1(limLog(pMac, LOG1, FL("quietState = %d"), psessionEntry->gLimSpecMgmt.quietState);)
Jeff Johnsone7245742012-09-05 17:12:55 -07002891 switch( psessionEntry->gLimSpecMgmt.quietState )
Jeff Johnson295189b2012-06-20 16:38:30 -07002892 {
2893 case eLIM_QUIET_BEGIN:
2894 // Time to Stop data traffic for quietDuration
Jeff Johnsone7245742012-09-05 17:12:55 -07002895 //limDeactivateAndChangeTimer(pMac, eLIM_QUIET_BSS_TIMER);
2896 if (TX_SUCCESS !=
2897 tx_timer_deactivate(&pMac->lim.limTimers.gLimQuietBssTimer))
2898 {
2899 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002900 FL("Unable to de-activate gLimQuietBssTimer! Will attempt to activate anyway..."));
Jeff Johnsone7245742012-09-05 17:12:55 -07002901 }
2902
2903 // gLimQuietDuration appears to be in units of ticks
2904 // Use it as is
2905 if (TX_SUCCESS !=
2906 tx_timer_change( &pMac->lim.limTimers.gLimQuietBssTimer,
2907 psessionEntry->gLimSpecMgmt.quietDuration,
2908 0))
2909 {
2910 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002911 FL("Unable to change gLimQuietBssTimer! Will still attempt to activate anyway..."));
Jeff Johnsone7245742012-09-05 17:12:55 -07002912 }
Leela V Kiran Kumar Reddy Chiralac3b9d382013-01-31 20:49:53 -08002913 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, pMac->lim.limTimers.gLimQuietTimer.sessionId, eLIM_QUIET_BSS_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -07002914#ifdef GEN6_TODO
2915 /* revisit this piece of code to assign the appropriate sessionId below
2916 * priority - HIGH
2917 */
2918 pMac->lim.limTimers.gLimQuietBssTimer.sessionId = sessionId;
2919#endif
2920 if( TX_SUCCESS !=
2921 tx_timer_activate( &pMac->lim.limTimers.gLimQuietBssTimer ))
2922 {
2923 limLog( pMac, LOGW,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002924 FL("Unable to activate gLimQuietBssTimer! The STA will be unable to honor Quiet BSS..."));
Jeff Johnson295189b2012-06-20 16:38:30 -07002925 }
2926 else
2927 {
2928 // Transition to eLIM_QUIET_RUNNING
Jeff Johnsone7245742012-09-05 17:12:55 -07002929 psessionEntry->gLimSpecMgmt.quietState = eLIM_QUIET_RUNNING;
Jeff Johnson295189b2012-06-20 16:38:30 -07002930
2931 /* If we have sta bk scan triggered and trigger bk scan actually started successfully, */
2932 /* print message, otherwise, stop data traffic and stay quiet */
2933 if( pMac->lim.gLimTriggerBackgroundScanDuringQuietBss &&
2934 (eSIR_TRUE == (glimTriggerBackgroundScanDuringQuietBss_Status = limTriggerBackgroundScanDuringQuietBss( pMac ))) )
2935 {
2936 limLog( pMac, LOG2,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002937 FL("Attempting to trigger a background scan..."));
Jeff Johnson295189b2012-06-20 16:38:30 -07002938 }
2939 else
2940 {
2941 // Shut-off Tx/Rx for gLimSpecMgmt.quietDuration
2942 /* freeze the transmission */
2943 limFrameTransmissionControl(pMac, eLIM_TX_ALL, eLIM_STOP_TX);
2944
2945 limLog( pMac, LOG2,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002946 FL("Quiet BSS: STA shutting down for %d ticks"),
Jeff Johnsone7245742012-09-05 17:12:55 -07002947 psessionEntry->gLimSpecMgmt.quietDuration );
Jeff Johnson295189b2012-06-20 16:38:30 -07002948 }
2949 }
2950 break;
2951
2952 case eLIM_QUIET_RUNNING:
2953 case eLIM_QUIET_INIT:
2954 case eLIM_QUIET_END:
2955 default:
2956 //
2957 // As of now, nothing to be done
2958 //
2959 break;
2960 }
2961}
2962
2963/**
2964 * limProcessQuietBssTimeout
2965 *
2966 * FUNCTION:
2967 * This function is active on the AP and STA.
2968 * Handles SIR_LIM_QUIET_BSS_TIMEOUT
2969 *
2970 * LOGIC:
2971 * On the AP -
2972 * When the SIR_LIM_QUIET_BSS_TIMEOUT is triggered, it is
2973 * an indication for the AP to START sending out the
2974 * Quiet BSS IE.
2975 * If 802.11H is enabled, the Quiet BSS IE is sent as per
2976 * the 11H spec
2977 * If 802.11H is not enabled, the Quiet BSS IE is sent as
2978 * a Proprietary IE. This will be understood by all the
2979 * TITAN STA's
2980 * Transitioning gLimQuietState to eLIM_QUIET_BEGIN will
2981 * initiate the SCH to include the Quiet BSS IE in all
2982 * its subsequent Beacons/PR's.
2983 * The Quiet BSS IE will be included in all the Beacons
2984 * & PR's until the next DTIM period
2985 *
2986 * On the STA -
2987 * When gLimQuietState = eLIM_QUIET_RUNNING
2988 * This indicates that the STA was successfully shut-off
2989 * for the specified gLimQuietDuration. This is a trigger
2990 * for the STA to now resume data traffic.
2991 * -> gLimQuietState is set to eLIM_QUIET_INIT
2992 *
2993 * ASSUMPTIONS:
2994 *
2995 * NOTE:
2996 *
2997 * @param pMac - Pointer to Global MAC structure
2998 *
2999 * @return None
3000 */
3001void limProcessQuietBssTimeout( tpAniSirGlobal pMac )
3002{
Jeff Johnsone7245742012-09-05 17:12:55 -07003003 tpPESession psessionEntry;
Jeff Johnson295189b2012-06-20 16:38:30 -07003004
Jeff Johnsone7245742012-09-05 17:12:55 -07003005 if((psessionEntry = peFindSessionBySessionId(pMac, pMac->lim.limTimers.gLimQuietBssTimer.sessionId))== NULL)
Jeff Johnson295189b2012-06-20 16:38:30 -07003006 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003007 limLog(pMac, LOGP,FL("Session Does not exist for given sessionID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003008 return;
3009 }
3010
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003011 PELOG1(limLog(pMac, LOG1, FL("quietState = %d"), psessionEntry->gLimSpecMgmt.quietState);)
Jeff Johnsone7245742012-09-05 17:12:55 -07003012 if (eLIM_AP_ROLE == psessionEntry->limSystemRole)
Jeff Johnson295189b2012-06-20 16:38:30 -07003013 {
Jeff Johnson295189b2012-06-20 16:38:30 -07003014 }
3015 else
3016 {
3017 // eLIM_STA_ROLE
Jeff Johnsone7245742012-09-05 17:12:55 -07003018 switch( psessionEntry->gLimSpecMgmt.quietState )
Jeff Johnson295189b2012-06-20 16:38:30 -07003019 {
3020 case eLIM_QUIET_RUNNING:
3021 // Transition to eLIM_QUIET_INIT
Jeff Johnsone7245742012-09-05 17:12:55 -07003022 psessionEntry->gLimSpecMgmt.quietState = eLIM_QUIET_INIT;
Jeff Johnson295189b2012-06-20 16:38:30 -07003023
3024 if( !pMac->lim.gLimTriggerBackgroundScanDuringQuietBss || (glimTriggerBackgroundScanDuringQuietBss_Status == eSIR_FALSE) )
3025 {
3026 // Resume data traffic only if channel switch is not running in silent mode.
Jeff Johnsone7245742012-09-05 17:12:55 -07003027 if (!((psessionEntry->gLimSpecMgmt.dot11hChanSwState == eLIM_11H_CHANSW_RUNNING) &&
3028 (psessionEntry->gLimChannelSwitch.switchMode == eSIR_CHANSW_MODE_SILENT)))
Jeff Johnson295189b2012-06-20 16:38:30 -07003029 {
3030 limFrameTransmissionControl(pMac, eLIM_TX_ALL, eLIM_RESUME_TX);
Jeff Johnsone7245742012-09-05 17:12:55 -07003031 limRestorePreQuietState(pMac, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07003032 }
3033
3034 /* Reset status flag */
3035 if(glimTriggerBackgroundScanDuringQuietBss_Status == eSIR_FALSE)
3036 glimTriggerBackgroundScanDuringQuietBss_Status = eSIR_TRUE;
3037
3038 limLog( pMac, LOG2,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003039 FL("Quiet BSS: Resuming traffic..."));
Jeff Johnson295189b2012-06-20 16:38:30 -07003040 }
3041 else
3042 {
3043 //
3044 // Nothing specific to be done in this case
3045 // A background scan that was triggered during
3046 // SIR_LIM_QUIET_TIMEOUT will complete on its own
3047 //
3048 limLog( pMac, LOG2,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003049 FL("Background scan should be complete now..."));
Jeff Johnson295189b2012-06-20 16:38:30 -07003050 }
3051 break;
3052
3053 case eLIM_QUIET_INIT:
3054 case eLIM_QUIET_BEGIN:
3055 case eLIM_QUIET_END:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003056 PELOG2(limLog(pMac, LOG2, FL("Quiet state not in RUNNING"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003057 /* If the quiet period has ended, then resume the frame transmission */
3058 limFrameTransmissionControl(pMac, eLIM_TX_ALL, eLIM_RESUME_TX);
Jeff Johnsone7245742012-09-05 17:12:55 -07003059 limRestorePreQuietState(pMac, psessionEntry);
3060 psessionEntry->gLimSpecMgmt.quietState = eLIM_QUIET_INIT;
Jeff Johnson295189b2012-06-20 16:38:30 -07003061 break;
3062
3063 default:
3064 //
3065 // As of now, nothing to be done
3066 //
3067 break;
3068 }
3069 }
3070}
Jeff Johnson295189b2012-06-20 16:38:30 -07003071/**
3072 * limProcessWPSOverlapTimeout
3073 *
3074 * FUNCTION: This function call limWPSPBCTimeout() to clean WPS PBC probe request entries
3075 *
3076 * LOGIC:
3077 *
3078 * ASSUMPTIONS:
3079 *
3080 * NOTE:
3081 *
3082 * @param pMac - Pointer to Global MAC structure
3083 *
3084 * @return None
3085 */
3086#if 0
3087void limProcessWPSOverlapTimeout(tpAniSirGlobal pMac)
3088{
3089
3090 tpPESession psessionEntry;
3091 tANI_U32 sessionId;
3092
3093 if (tx_timer_activate(&pMac->lim.limTimers.gLimWPSOverlapTimerObj.gLimWPSOverlapTimer) != TX_SUCCESS)
3094 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003095 limLog(pMac, LOGP, FL("tx_timer_activate failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003096 }
3097
3098 sessionId = pMac->lim.limTimers.gLimWPSOverlapTimerObj.sessionId;
3099
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003100 PELOGE(limLog(pMac, LOGE, FL("WPS overlap timeout, sessionId=%d"), sessionId);)
Jeff Johnson295189b2012-06-20 16:38:30 -07003101
3102 if((psessionEntry = peFindSessionBySessionId(pMac, sessionId)) == NULL)
3103 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003104 PELOGE(limLog(pMac, LOGP,FL("Session Does not exist for given sessionID"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003105 return;
3106 }
3107
3108 limWPSPBCTimeout(pMac, psessionEntry);
3109}
3110#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07003111
Jeff Johnson295189b2012-06-20 16:38:30 -07003112/**----------------------------------------------
3113\fn limStartQuietTimer
3114\brief Starts the quiet timer.
3115
3116\param pMac
3117\return NONE
3118-----------------------------------------------*/
3119void limStartQuietTimer(tpAniSirGlobal pMac, tANI_U8 sessionId)
3120{
3121 tpPESession psessionEntry;
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05303122 psessionEntry = peFindSessionBySessionId(pMac, sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07003123
3124 if(psessionEntry == NULL) {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003125 limLog(pMac, LOGP,FL("Session Does not exist for given sessionID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003126 return;
3127 }
3128
Jeff Johnson295189b2012-06-20 16:38:30 -07003129
3130 if (psessionEntry->limSystemRole != eLIM_STA_ROLE)
3131 return;
3132 // First, de-activate Timer, if its already active
3133 limCancelDot11hQuiet(pMac, psessionEntry);
3134
Jeff Johnsone7245742012-09-05 17:12:55 -07003135 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, sessionId, eLIM_QUIET_TIMER));
3136 if( TX_SUCCESS != tx_timer_deactivate(&pMac->lim.limTimers.gLimQuietTimer))
3137 {
3138 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003139 FL( "Unable to deactivate gLimQuietTimer! Will still attempt to re-activate anyway..." ));
Jeff Johnsone7245742012-09-05 17:12:55 -07003140 }
3141
3142 // Set the NEW timeout value, in ticks
3143 if( TX_SUCCESS != tx_timer_change( &pMac->lim.limTimers.gLimQuietTimer,
3144 SYS_MS_TO_TICKS(psessionEntry->gLimSpecMgmt.quietTimeoutValue), 0))
3145 {
3146 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003147 FL( "Unable to change gLimQuietTimer! Will still attempt to re-activate anyway..." ));
Jeff Johnsone7245742012-09-05 17:12:55 -07003148 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003149
3150 pMac->lim.limTimers.gLimQuietTimer.sessionId = sessionId;
3151 if( TX_SUCCESS != tx_timer_activate(&pMac->lim.limTimers.gLimQuietTimer))
3152 {
3153 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003154 FL("Unable to activate gLimQuietTimer! STA cannot honor Quiet BSS!"));
Jeff Johnsone7245742012-09-05 17:12:55 -07003155 limRestorePreQuietState(pMac, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07003156
Jeff Johnsone7245742012-09-05 17:12:55 -07003157 psessionEntry->gLimSpecMgmt.quietState = eLIM_QUIET_INIT;
Jeff Johnson295189b2012-06-20 16:38:30 -07003158 return;
3159 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003160}
3161
Jeff Johnson295189b2012-06-20 16:38:30 -07003162
3163/** ------------------------------------------------------------------------ **/
3164/**
3165 * keep track of the number of ANI peers associated in the BSS
3166 * For the first and last ANI peer, we have to update EDCA params as needed
3167 *
3168 * When the first ANI peer joins the BSS, we notify SCH
3169 * When the last ANI peer leaves the BSS, we notfiy SCH
3170 */
3171void
3172limUtilCountStaAdd(
3173 tpAniSirGlobal pMac,
3174 tpDphHashNode pSta,
3175 tpPESession psessionEntry)
3176{
3177
3178 if ((! pSta) || (! pSta->valid) || (! pSta->aniPeer) || (pSta->fAniCount))
3179 return;
3180
3181 pSta->fAniCount = 1;
3182
3183 if (pMac->lim.gLimNumOfAniSTAs++ != 0)
3184 return;
3185
3186 // get here only if this is the first ANI peer in the BSS
3187 schEdcaProfileUpdate(pMac, psessionEntry);
3188}
3189
3190void
3191limUtilCountStaDel(
3192 tpAniSirGlobal pMac,
3193 tpDphHashNode pSta,
3194 tpPESession psessionEntry)
3195{
3196
3197 if ((pSta == NULL) || (pSta->aniPeer == eHAL_CLEAR) || (! pSta->fAniCount))
3198 return;
3199
3200 /* Only if sta is invalid and the validInDummyState bit is set to 1,
3201 * then go ahead and update the count and profiles. This ensures
3202 * that the "number of ani station" count is properly incremented/decremented.
3203 */
3204 if (pSta->valid == 1)
3205 return;
3206
3207 pSta->fAniCount = 0;
3208
3209 if (pMac->lim.gLimNumOfAniSTAs <= 0)
3210 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003211 limLog(pMac, LOGE, FL("CountStaDel: ignoring Delete Req when AniPeer count is %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07003212 pMac->lim.gLimNumOfAniSTAs);
3213 return;
3214 }
3215
3216 pMac->lim.gLimNumOfAniSTAs--;
3217
3218 if (pMac->lim.gLimNumOfAniSTAs != 0)
3219 return;
3220
3221 // get here only if this is the last ANI peer in the BSS
3222 schEdcaProfileUpdate(pMac, psessionEntry);
3223}
3224
Jeff Johnson295189b2012-06-20 16:38:30 -07003225/**
3226 * limSwitchChannelCback()
3227 *
3228 *FUNCTION:
3229 * This is the callback function registered while requesting to switch channel
3230 * after AP indicates a channel switch for spectrum management (11h).
3231 *
3232 *NOTE:
3233 * @param pMac Pointer to Global MAC structure
3234 * @param status Status of channel switch request
3235 * @param data User data
3236 * @param psessionEntry Session information
3237 * @return NONE
3238 */
3239void limSwitchChannelCback(tpAniSirGlobal pMac, eHalStatus status,
3240 tANI_U32 *data, tpPESession psessionEntry)
3241{
3242 tSirMsgQ mmhMsg = {0};
3243 tSirSmeSwitchChannelInd *pSirSmeSwitchChInd;
3244
Jeff Johnson295189b2012-06-20 16:38:30 -07003245 psessionEntry->currentOperChannel = psessionEntry->currentReqChannel;
3246
3247 /* We need to restore pre-channelSwitch state on the STA */
3248 if (limRestorePreChannelSwitchState(pMac, psessionEntry) != eSIR_SUCCESS)
3249 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003250 limLog(pMac, LOGP, FL("Could not restore pre-channelSwitch (11h) state, resetting the system"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003251 return;
3252 }
3253
3254 mmhMsg.type = eWNI_SME_SWITCH_CHL_REQ;
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05303255 pSirSmeSwitchChInd = vos_mem_malloc(sizeof(tSirSmeSwitchChannelInd));
3256 if ( NULL == pSirSmeSwitchChInd )
Jeff Johnson295189b2012-06-20 16:38:30 -07003257 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003258 limLog(pMac, LOGP, FL("Failed to allocate buffer for buffer descriptor"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003259 return;
3260 }
3261
3262 pSirSmeSwitchChInd->messageType = eWNI_SME_SWITCH_CHL_REQ;
3263 pSirSmeSwitchChInd->length = sizeof(tSirSmeSwitchChannelInd);
Jeff Johnsone7245742012-09-05 17:12:55 -07003264 pSirSmeSwitchChInd->newChannelId = psessionEntry->gLimChannelSwitch.primaryChannel;
Jeff Johnson295189b2012-06-20 16:38:30 -07003265 pSirSmeSwitchChInd->sessionId = psessionEntry->smeSessionId;
3266 //BSS ID
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05303267 vos_mem_copy( pSirSmeSwitchChInd->bssId, psessionEntry->bssId, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07003268 mmhMsg.bodyptr = pSirSmeSwitchChInd;
3269 mmhMsg.bodyval = 0;
3270
Jeff Johnsone7245742012-09-05 17:12:55 -07003271 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07003272
Jeff Johnson295189b2012-06-20 16:38:30 -07003273 SysProcessMmhMsg(pMac, &mmhMsg);
Jeff Johnson295189b2012-06-20 16:38:30 -07003274}
3275
3276/**
3277 * limSwitchPrimaryChannel()
3278 *
3279 *FUNCTION:
3280 * This function changes the current operating channel
3281 * and sets the new new channel ID in WNI_CFG_CURRENT_CHANNEL.
3282 *
3283 *NOTE:
3284 * @param pMac Pointer to Global MAC structure
3285 * @param newChannel new chnannel ID
3286 * @return NONE
3287 */
3288void limSwitchPrimaryChannel(tpAniSirGlobal pMac, tANI_U8 newChannel,tpPESession psessionEntry)
3289{
3290#if !defined WLAN_FEATURE_VOWIFI
3291 tANI_U32 localPwrConstraint;
3292#endif
3293
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003294 PELOG3(limLog(pMac, LOG3, FL("limSwitchPrimaryChannel: old chnl %d --> new chnl %d "),
Jeff Johnson295189b2012-06-20 16:38:30 -07003295 psessionEntry->currentOperChannel, newChannel);)
3296 psessionEntry->currentReqChannel = newChannel;
3297 psessionEntry->limRFBand = limGetRFBand(newChannel);
3298
3299 psessionEntry->channelChangeReasonCode=LIM_SWITCH_CHANNEL_OPERATION;
3300
3301 pMac->lim.gpchangeChannelCallback = limSwitchChannelCback;
3302 pMac->lim.gpchangeChannelData = NULL;
3303
3304#if defined WLAN_FEATURE_VOWIFI
Jeff Johnsone7245742012-09-05 17:12:55 -07003305 limSendSwitchChnlParams(pMac, newChannel, PHY_SINGLE_CHANNEL_CENTERED,
Jeff Johnson295189b2012-06-20 16:38:30 -07003306 psessionEntry->maxTxPower, psessionEntry->peSessionId);
3307#else
3308 if(wlan_cfgGetInt(pMac, WNI_CFG_LOCAL_POWER_CONSTRAINT, &localPwrConstraint) != eSIR_SUCCESS)
3309 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003310 limLog( pMac, LOGP, FL( "Unable to read Local Power Constraint from cfg" ));
Jeff Johnson295189b2012-06-20 16:38:30 -07003311 return;
3312 }
Jeff Johnsone7245742012-09-05 17:12:55 -07003313 limSendSwitchChnlParams(pMac, newChannel, PHY_SINGLE_CHANNEL_CENTERED,
Jeff Johnson295189b2012-06-20 16:38:30 -07003314 (tPowerdBm)localPwrConstraint, psessionEntry->peSessionId);
3315#endif
3316 return;
3317}
3318
3319/**
3320 * limSwitchPrimarySecondaryChannel()
3321 *
3322 *FUNCTION:
3323 * This function changes the primary and secondary channel.
3324 * If 11h is enabled and user provides a "new channel ID"
3325 * that is different from the current operating channel,
3326 * then we must set this new channel in WNI_CFG_CURRENT_CHANNEL,
3327 * assign notify LIM of such change.
3328 *
3329 *NOTE:
3330 * @param pMac Pointer to Global MAC structure
3331 * @param newChannel New chnannel ID (or current channel ID)
3332 * @param subband CB secondary info:
3333 * - eANI_CB_SECONDARY_NONE
3334 * - eANI_CB_SECONDARY_UP
3335 * - eANI_CB_SECONDARY_DOWN
3336 * @return NONE
3337 */
Jeff Johnsone7245742012-09-05 17:12:55 -07003338void limSwitchPrimarySecondaryChannel(tpAniSirGlobal pMac, tpPESession psessionEntry, tANI_U8 newChannel, ePhyChanBondState subband)
Jeff Johnson295189b2012-06-20 16:38:30 -07003339{
3340#if !defined WLAN_FEATURE_VOWIFI
3341 tANI_U32 localPwrConstraint;
3342#endif
3343
Jeff Johnson295189b2012-06-20 16:38:30 -07003344#if !defined WLAN_FEATURE_VOWIFI
3345 if(wlan_cfgGetInt(pMac, WNI_CFG_LOCAL_POWER_CONSTRAINT, &localPwrConstraint) != eSIR_SUCCESS) {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003346 limLog( pMac, LOGP, FL( "Unable to get Local Power Constraint from cfg" ));
Jeff Johnson295189b2012-06-20 16:38:30 -07003347 return;
3348 }
3349#endif
3350
Jeff Johnson295189b2012-06-20 16:38:30 -07003351#if defined WLAN_FEATURE_VOWIFI
Jeff Johnsone7245742012-09-05 17:12:55 -07003352 limSendSwitchChnlParams(pMac, newChannel, subband, psessionEntry->maxTxPower, psessionEntry->peSessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07003353#else
Jeff Johnsone7245742012-09-05 17:12:55 -07003354 limSendSwitchChnlParams(pMac, newChannel, subband, (tPowerdBm)localPwrConstraint, psessionEntry->peSessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07003355#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07003356
Jeff Johnsone7245742012-09-05 17:12:55 -07003357 // Store the new primary and secondary channel in session entries if different
3358 if (psessionEntry->currentOperChannel != newChannel)
Jeff Johnson295189b2012-06-20 16:38:30 -07003359 {
3360 limLog(pMac, LOGW,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003361 FL("switch old chnl %d --> new chnl %d "),
Jeff Johnson295189b2012-06-20 16:38:30 -07003362 psessionEntry->currentOperChannel, newChannel);
Jeff Johnson295189b2012-06-20 16:38:30 -07003363 psessionEntry->currentOperChannel = newChannel;
3364 }
Jeff Johnsone7245742012-09-05 17:12:55 -07003365 if (psessionEntry->htSecondaryChannelOffset != subband)
3366 {
3367 limLog(pMac, LOGW,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003368 FL("switch old sec chnl %d --> new sec chnl %d "),
Jeff Johnsone7245742012-09-05 17:12:55 -07003369 psessionEntry->htSecondaryChannelOffset, subband);
3370 psessionEntry->htSecondaryChannelOffset = subband;
3371 if (psessionEntry->htSecondaryChannelOffset == PHY_SINGLE_CHANNEL_CENTERED)
3372 {
3373 psessionEntry->htSupportedChannelWidthSet = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE;
3374 }
3375 else
3376 {
3377 psessionEntry->htSupportedChannelWidthSet = WNI_CFG_CHANNEL_BONDING_MODE_ENABLE;
3378 }
3379 psessionEntry->htRecommendedTxWidthSet = psessionEntry->htSupportedChannelWidthSet;
3380 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003381
3382 return;
3383}
3384
3385
3386/**
3387 * limActiveScanAllowed()
3388 *
3389 *FUNCTION:
3390 * Checks if active scans are permitted on the given channel
3391 *
3392 *LOGIC:
3393 * The config variable SCAN_CONTROL_LIST contains pairs of (channelNum, activeScanAllowed)
3394 * Need to check if the channelNum matches, then depending on the corresponding
3395 * scan flag, return true (for activeScanAllowed==1) or false (otherwise).
3396 *
3397 *ASSUMPTIONS:
3398 *
3399 *NOTE:
3400 *
3401 * @param pMac Pointer to Global MAC structure
3402 * @param channelNum channel number
3403 * @return None
3404 */
3405
3406tANI_U8 limActiveScanAllowed(
3407 tpAniSirGlobal pMac,
3408 tANI_U8 channelNum)
3409{
3410 tANI_U32 i;
3411 tANI_U8 channelPair[WNI_CFG_SCAN_CONTROL_LIST_LEN];
3412 tANI_U32 len = WNI_CFG_SCAN_CONTROL_LIST_LEN;
3413 if (wlan_cfgGetStr(pMac, WNI_CFG_SCAN_CONTROL_LIST, channelPair, &len)
3414 != eSIR_SUCCESS)
3415 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003416 PELOGE(limLog(pMac, LOGE, FL("Unable to get scan control list"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003417 return false;
3418 }
3419
3420 if (len > WNI_CFG_SCAN_CONTROL_LIST_LEN)
3421 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003422 limLog(pMac, LOGE, FL("Invalid scan control list length:%d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07003423 len);
3424 return false;
3425 }
3426
3427 for (i=0; (i+1) < len; i+=2)
3428 {
3429 if (channelPair[i] == channelNum)
3430 return ((channelPair[i+1] == eSIR_ACTIVE_SCAN) ? true : false);
3431 }
3432 return false;
3433}
3434
3435/**
3436 * limTriggerBackgroundScanDuringQuietBss()
3437 *
3438 *FUNCTION:
3439 * This function is applicable to the STA only.
3440 * This function is called by limProcessQuietTimeout(),
3441 * when it is time to honor the Quiet BSS IE from the AP.
3442 *
3443 *LOGIC:
3444 * If 11H is enabled:
3445 * We cannot trigger a background scan. The STA needs to
3446 * shut-off Tx/Rx.
3447 * If 11 is not enabled:
3448 * Determine if the next channel that we are going to
3449 * scan is NOT the same channel (or not) on which the
3450 * Quiet BSS was requested.
3451 * If yes, then we cannot trigger a background scan on
3452 * this channel. Return with a false.
3453 * If no, then trigger a background scan. Return with
3454 * a true.
3455 *
3456 *ASSUMPTIONS:
3457 *
3458 *NOTE:
3459 * This API is redundant if the existing API,
3460 * limTriggerBackgroundScan(), were to return a valid
3461 * response instead of returning void.
3462 * If possible, try to revisit this API
3463 *
3464 * @param pMac Pointer to Global MAC structure
3465 * @return eSIR_TRUE, if a background scan was attempted
3466 * eSIR_FALSE, if not
3467 */
3468tAniBool limTriggerBackgroundScanDuringQuietBss( tpAniSirGlobal pMac )
3469{
3470 tAniBool bScanTriggered = eSIR_FALSE;
Jeff Johnson295189b2012-06-20 16:38:30 -07003471
3472
3473
3474 //TBD-RAJESH HOW TO GET sessionEntry?????
3475 tpPESession psessionEntry = &pMac->lim.gpSession[0];
3476
3477 if (psessionEntry->limSystemRole != eLIM_STA_ROLE)
3478 return bScanTriggered;
3479
Jeff Johnsone7245742012-09-05 17:12:55 -07003480 if( !psessionEntry->lim11hEnable )
Jeff Johnson295189b2012-06-20 16:38:30 -07003481 {
3482 tSirMacChanNum bgScanChannelList[WNI_CFG_BG_SCAN_CHANNEL_LIST_LEN];
3483 tANI_U32 len = WNI_CFG_BG_SCAN_CHANNEL_LIST_LEN;
3484
3485 // Determine the next scan channel
3486
3487 // Get background scan channel list from CFG
3488 if( eSIR_SUCCESS == wlan_cfgGetStr( pMac,
3489 WNI_CFG_BG_SCAN_CHANNEL_LIST,
3490 (tANI_U8 *) bgScanChannelList,
3491 (tANI_U32 *) &len ))
3492 {
3493 // Ensure that we do not go off scanning on the same
3494 // channel on which the Quiet BSS was requested
3495 if( psessionEntry->currentOperChannel!=
3496 bgScanChannelList[pMac->lim.gLimBackgroundScanChannelId] )
3497 {
3498 // For now, try and attempt a background scan. It will
3499 // be ideal if this API actually returns a success or
3500 // failure instead of having a void return type
3501 limTriggerBackgroundScan( pMac );
3502
3503 bScanTriggered = eSIR_TRUE;
3504 }
3505 else
3506 {
3507 limLog( pMac, LOGW,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003508 FL("The next SCAN channel is the current operating channel on which a Quiet BSS is requested.! A background scan will not be triggered during this Quiet BSS period..."));
Jeff Johnson295189b2012-06-20 16:38:30 -07003509 }
3510 }
3511 else
3512 {
3513 limLog( pMac, LOGW,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003514 FL("Unable to retrieve WNI_CFG_VALID_CHANNEL_LIST from CFG! A background scan will not be triggered during this Quiet BSS period..."));
Jeff Johnson295189b2012-06-20 16:38:30 -07003515 }
3516 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003517 return bScanTriggered;
3518}
3519
3520
3521/**
3522 * limGetHTCapability()
3523 *
3524 *FUNCTION:
3525 * A utility function that returns the "current HT capability state" for the HT
3526 * capability of interest (as requested in the API)
3527 *
3528 *LOGIC:
3529 * This routine will return with the "current" setting of a requested HT
3530 * capability. This state info could be retrieved from -
3531 * a) CFG (for static entries)
3532 * b) Run time info
3533 * - Dynamic state maintained by LIM
3534 * - Configured at radio init time by SME
3535 *
3536 *
3537 *ASSUMPTIONS:
3538 * NA
3539 *
3540 *NOTE:
3541 *
3542 * @param pMac Pointer to Global MAC structure
3543 * @param htCap The HT capability being queried
3544 * @return tANI_U8 The current state of the requested HT capability is returned in a
3545 * tANI_U8 variable
3546 */
3547
Jeff Johnson295189b2012-06-20 16:38:30 -07003548tANI_U8 limGetHTCapability( tpAniSirGlobal pMac,
3549 tANI_U32 htCap, tpPESession psessionEntry)
Jeff Johnson295189b2012-06-20 16:38:30 -07003550{
3551tANI_U8 retVal = 0;
3552tANI_U8 *ptr;
3553tANI_U32 cfgValue;
3554tSirMacHTCapabilityInfo macHTCapabilityInfo = {0};
3555tSirMacExtendedHTCapabilityInfo macExtHTCapabilityInfo = {0};
3556tSirMacTxBFCapabilityInfo macTxBFCapabilityInfo = {0};
3557tSirMacASCapabilityInfo macASCapabilityInfo = {0};
3558
3559 //
3560 // Determine which CFG to read from. Not ALL of the HT
3561 // related CFG's need to be read each time this API is
3562 // accessed
3563 //
3564 if( htCap >= eHT_ANTENNA_SELECTION &&
3565 htCap < eHT_SI_GRANULARITY )
3566 {
3567 // Get Antenna Seletion HT Capabilities
3568 if( eSIR_SUCCESS != wlan_cfgGetInt( pMac, WNI_CFG_AS_CAP, &cfgValue ))
3569 cfgValue = 0;
3570 ptr = (tANI_U8 *) &macASCapabilityInfo;
3571 *((tANI_U8 *)ptr) = (tANI_U8) (cfgValue & 0xff);
3572 }
3573 else
3574 {
3575 if( htCap >= eHT_TX_BEAMFORMING &&
3576 htCap < eHT_ANTENNA_SELECTION )
3577 {
3578 // Get Transmit Beam Forming HT Capabilities
3579 if( eSIR_SUCCESS != wlan_cfgGetInt( pMac, WNI_CFG_TX_BF_CAP, &cfgValue ))
3580 cfgValue = 0;
3581 ptr = (tANI_U8 *) &macTxBFCapabilityInfo;
3582 *((tANI_U32 *)ptr) = (tANI_U32) (cfgValue);
3583 }
3584 else
3585 {
3586 if( htCap >= eHT_PCO &&
3587 htCap < eHT_TX_BEAMFORMING )
3588 {
3589 // Get Extended HT Capabilities
3590 if( eSIR_SUCCESS != wlan_cfgGetInt( pMac, WNI_CFG_EXT_HT_CAP_INFO, &cfgValue ))
3591 cfgValue = 0;
3592 ptr = (tANI_U8 *) &macExtHTCapabilityInfo;
3593 *((tANI_U16 *)ptr) = (tANI_U16) (cfgValue & 0xffff);
3594 }
3595 else
3596 {
3597 if( htCap < eHT_MAX_RX_AMPDU_FACTOR )
3598 {
3599 // Get HT Capabilities
3600 if( eSIR_SUCCESS != wlan_cfgGetInt( pMac, WNI_CFG_HT_CAP_INFO, &cfgValue ))
3601 cfgValue = 0;
3602 ptr = (tANI_U8 *) &macHTCapabilityInfo;
3603 // CR 265282 MDM SoftAP 2.4PL: SoftAP boot up crash in 2.4 PL builds while same WLAN SU is working on 2.1 PL
3604 *ptr++ = cfgValue & 0xff;
3605 *ptr = (cfgValue >> 8) & 0xff;
3606 }
3607 }
3608 }
3609 }
3610
3611 switch( htCap )
3612 {
3613 case eHT_LSIG_TXOP_PROTECTION:
3614 retVal = pMac->lim.gHTLsigTXOPProtection;
3615 break;
3616
3617 case eHT_STBC_CONTROL_FRAME:
3618 retVal = (tANI_U8) macHTCapabilityInfo.stbcControlFrame;
3619 break;
3620
3621 case eHT_PSMP:
3622 retVal = pMac->lim.gHTPSMPSupport;
3623 break;
3624
3625 case eHT_DSSS_CCK_MODE_40MHZ:
3626 retVal = pMac->lim.gHTDsssCckRate40MHzSupport;
3627 break;
3628
3629 case eHT_MAX_AMSDU_LENGTH:
3630 retVal = (tANI_U8) macHTCapabilityInfo.maximalAMSDUsize;
3631 break;
3632
3633 case eHT_DELAYED_BA:
3634 retVal = (tANI_U8) macHTCapabilityInfo.delayedBA;
3635 break;
3636
3637 case eHT_RX_STBC:
3638 retVal = (tANI_U8) macHTCapabilityInfo.rxSTBC;
3639 break;
3640
3641 case eHT_TX_STBC:
3642 retVal = (tANI_U8) macHTCapabilityInfo.txSTBC;
3643 break;
3644
3645 case eHT_SHORT_GI_40MHZ:
3646 retVal = (tANI_U8) macHTCapabilityInfo.shortGI40MHz;
3647 break;
3648
3649 case eHT_SHORT_GI_20MHZ:
3650 retVal = (tANI_U8) macHTCapabilityInfo.shortGI20MHz;
3651 break;
3652
3653 case eHT_GREENFIELD:
3654 retVal = (tANI_U8) macHTCapabilityInfo.greenField;
3655 break;
3656
3657 case eHT_MIMO_POWER_SAVE:
3658 retVal = (tANI_U8) pMac->lim.gHTMIMOPSState;
3659 break;
3660
3661 case eHT_SUPPORTED_CHANNEL_WIDTH_SET:
Jeff Johnsone7245742012-09-05 17:12:55 -07003662 retVal = (tANI_U8) psessionEntry->htSupportedChannelWidthSet;
Jeff Johnson295189b2012-06-20 16:38:30 -07003663 break;
3664
3665 case eHT_ADVANCED_CODING:
3666 retVal = (tANI_U8) macHTCapabilityInfo.advCodingCap;
3667 break;
3668
3669 case eHT_MAX_RX_AMPDU_FACTOR:
3670 retVal = pMac->lim.gHTMaxRxAMpduFactor;
3671 break;
3672
3673 case eHT_MPDU_DENSITY:
3674 retVal = pMac->lim.gHTAMpduDensity;
3675 break;
3676
3677 case eHT_PCO:
3678 retVal = (tANI_U8) macExtHTCapabilityInfo.pco;
3679 break;
3680
3681 case eHT_TRANSITION_TIME:
3682 retVal = (tANI_U8) macExtHTCapabilityInfo.transitionTime;
3683 break;
3684
3685 case eHT_MCS_FEEDBACK:
3686 retVal = (tANI_U8) macExtHTCapabilityInfo.mcsFeedback;
3687 break;
3688
3689 case eHT_TX_BEAMFORMING:
3690 retVal = (tANI_U8) macTxBFCapabilityInfo.txBF;
3691 break;
3692
3693 case eHT_ANTENNA_SELECTION:
3694 retVal = (tANI_U8) macASCapabilityInfo.antennaSelection;
3695 break;
3696
3697 case eHT_SI_GRANULARITY:
3698 retVal = pMac->lim.gHTServiceIntervalGranularity;
3699 break;
3700
3701 case eHT_CONTROLLED_ACCESS:
3702 retVal = pMac->lim.gHTControlledAccessOnly;
3703 break;
3704
3705 case eHT_RIFS_MODE:
3706 retVal = psessionEntry->beaconParams.fRIFSMode;
3707 break;
3708
3709 case eHT_RECOMMENDED_TX_WIDTH_SET:
Jeff Johnsone7245742012-09-05 17:12:55 -07003710 retVal = psessionEntry->htRecommendedTxWidthSet;
Jeff Johnson295189b2012-06-20 16:38:30 -07003711 break;
3712
3713 case eHT_EXTENSION_CHANNEL_OFFSET:
Jeff Johnsone7245742012-09-05 17:12:55 -07003714 retVal = psessionEntry->htSecondaryChannelOffset;
Jeff Johnson295189b2012-06-20 16:38:30 -07003715 break;
3716
3717 case eHT_OP_MODE:
Jeff Johnson295189b2012-06-20 16:38:30 -07003718 if(psessionEntry->limSystemRole == eLIM_AP_ROLE )
3719 retVal = psessionEntry->htOperMode;
3720 else
Jeff Johnson295189b2012-06-20 16:38:30 -07003721 retVal = pMac->lim.gHTOperMode;
3722 break;
3723
3724 case eHT_BASIC_STBC_MCS:
3725 retVal = pMac->lim.gHTSTBCBasicMCS;
3726 break;
3727
3728 case eHT_DUAL_CTS_PROTECTION:
3729 retVal = pMac->lim.gHTDualCTSProtection;
3730 break;
3731
3732 case eHT_LSIG_TXOP_PROTECTION_FULL_SUPPORT:
3733 retVal = psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport;
3734 break;
3735
3736 case eHT_PCO_ACTIVE:
3737 retVal = pMac->lim.gHTPCOActive;
3738 break;
3739
3740 case eHT_PCO_PHASE:
3741 retVal = pMac->lim.gHTPCOPhase;
3742 break;
3743
3744 default:
3745 break;
3746 }
3747
3748 return retVal;
3749}
3750
Jeff Johnson295189b2012-06-20 16:38:30 -07003751void limGetMyMacAddr(tpAniSirGlobal pMac, tANI_U8 *mac)
3752{
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05303753 vos_mem_copy( mac, pMac->lim.gLimMyMacAddr, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07003754 return;
3755}
3756
3757
3758
3759
3760/** -------------------------------------------------------------
3761\fn limEnable11aProtection
3762\brief based on config setting enables\disables 11a protection.
3763\param tANI_U8 enable : 1=> enable protection, 0=> disable protection.
3764\param tANI_U8 overlap: 1=> called from overlap context, 0 => called from assoc context.
3765\param tpUpdateBeaconParams pBeaconParams
3766\return None
3767 -------------------------------------------------------------*/
3768tSirRetStatus
3769limEnable11aProtection(tpAniSirGlobal pMac, tANI_U8 enable,
3770 tANI_U8 overlap, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry)
3771{
Madan Mohan Koyyalamudi33ef6a22012-10-30 17:44:43 -07003772 if(NULL == psessionEntry)
3773 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003774 PELOG3(limLog(pMac, LOG3, FL("psessionEntry is NULL"));)
Madan Mohan Koyyalamudi33ef6a22012-10-30 17:44:43 -07003775 return eSIR_FAILURE;
3776 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003777 //overlapping protection configuration check.
3778 if(overlap)
3779 {
Jeff Johnson295189b2012-06-20 16:38:30 -07003780 }
3781 else
3782 {
3783 //normal protection config check
Madan Mohan Koyyalamudi33ef6a22012-10-30 17:44:43 -07003784 if ((psessionEntry->limSystemRole == eLIM_AP_ROLE) &&
Jeff Johnsone7245742012-09-05 17:12:55 -07003785 (!psessionEntry->cfgProtection.fromlla))
Jeff Johnson295189b2012-06-20 16:38:30 -07003786 {
3787 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003788 PELOG3(limLog(pMac, LOG3, FL("protection from 11a is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003789 return eSIR_SUCCESS;
3790 }
3791 }
3792
3793 if (enable)
3794 {
3795 //If we are AP and HT capable, we need to set the HT OP mode
3796 //appropriately.
3797 if(((eLIM_AP_ROLE == psessionEntry->limSystemRole)||(eLIM_BT_AMP_AP_ROLE == psessionEntry->limSystemRole))&&
Jeff Johnsone7245742012-09-05 17:12:55 -07003798 (true == psessionEntry->htCapability))
Jeff Johnson295189b2012-06-20 16:38:30 -07003799 {
3800 if(overlap)
3801 {
3802 pMac->lim.gLimOverlap11aParams.protectionEnabled = true;
3803 if((eSIR_HT_OP_MODE_OVERLAP_LEGACY != pMac->lim.gHTOperMode) &&
3804 (eSIR_HT_OP_MODE_MIXED != pMac->lim.gHTOperMode))
3805 {
3806 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
3807 psessionEntry->htOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
3808 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
3809 limEnableHtOBSSProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
3810 }
3811 }
3812 else
3813 {
3814 psessionEntry->gLim11aParams.protectionEnabled = true;
3815 if(eSIR_HT_OP_MODE_MIXED != pMac->lim.gHTOperMode)
3816 {
3817 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_MIXED;
Jeff Johnsone7245742012-09-05 17:12:55 -07003818 psessionEntry->htOperMode = eSIR_HT_OP_MODE_MIXED;
Jeff Johnson295189b2012-06-20 16:38:30 -07003819 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
3820 limEnableHtOBSSProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
3821
3822 }
3823 }
3824 }
3825
3826 //This part is common for staiton as well.
3827 if(false == psessionEntry->beaconParams.llaCoexist)
3828 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003829 PELOG1(limLog(pMac, LOG1, FL(" => protection from 11A Enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003830 pBeaconParams->llaCoexist = psessionEntry->beaconParams.llaCoexist = true;
3831 pBeaconParams->paramChangeBitmap |= PARAM_llACOEXIST_CHANGED;
3832 }
3833 }
3834 else if (true == psessionEntry->beaconParams.llaCoexist)
3835 {
3836 //for AP role.
3837 //we need to take care of HT OP mode change if needed.
3838 //We need to take care of Overlap cases.
3839 if(eLIM_AP_ROLE == psessionEntry->limSystemRole)
3840 {
3841 if(overlap)
3842 {
3843 //Overlap Legacy protection disabled.
3844 pMac->lim.gLimOverlap11aParams.protectionEnabled = false;
3845
3846 //We need to take care of HT OP mode iff we are HT AP.
Jeff Johnsone7245742012-09-05 17:12:55 -07003847 if(psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07003848 {
3849 // no HT op mode change if any of the overlap protection enabled.
3850 if(!(pMac->lim.gLimOverlap11aParams.protectionEnabled ||
3851 pMac->lim.gLimOverlapHt20Params.protectionEnabled ||
3852 pMac->lim.gLimOverlapNonGfParams.protectionEnabled))
3853
3854 {
3855 //Check if there is a need to change HT OP mode.
3856 if(eSIR_HT_OP_MODE_OVERLAP_LEGACY == pMac->lim.gHTOperMode)
3857 {
3858 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
3859 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
3860
3861 if(psessionEntry->gLimHt20Params.protectionEnabled)
3862 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
3863 else
3864 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_PURE;
3865 }
3866 }
3867 }
3868 }
3869 else
3870 {
3871 //Disable protection from 11A stations.
3872 psessionEntry->gLim11aParams.protectionEnabled = false;
3873 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
3874
3875 //Check if any other non-HT protection enabled.
3876 //Right now we are in HT OP Mixed mode.
3877 //Change HT op mode appropriately.
3878
3879 //Change HT OP mode to 01 if any overlap protection enabled
3880 if(pMac->lim.gLimOverlap11aParams.protectionEnabled ||
3881 pMac->lim.gLimOverlapHt20Params.protectionEnabled ||
3882 pMac->lim.gLimOverlapNonGfParams.protectionEnabled)
3883
3884 {
3885 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
Jeff Johnsone7245742012-09-05 17:12:55 -07003886 psessionEntry->htOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
Jeff Johnson295189b2012-06-20 16:38:30 -07003887 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
3888 }
3889 else if(psessionEntry->gLimHt20Params.protectionEnabled)
3890 {
3891 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
Jeff Johnsone7245742012-09-05 17:12:55 -07003892 psessionEntry->htOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
Jeff Johnson295189b2012-06-20 16:38:30 -07003893 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
3894 }
3895 else
3896 {
3897 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_PURE;
Jeff Johnsone7245742012-09-05 17:12:55 -07003898 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
Jeff Johnson295189b2012-06-20 16:38:30 -07003899 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
3900 }
3901 }
3902 if(!pMac->lim.gLimOverlap11aParams.protectionEnabled &&
3903 !psessionEntry->gLim11aParams.protectionEnabled)
3904 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003905 PELOG1(limLog(pMac, LOG1, FL("===> Protection from 11A Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003906 pBeaconParams->llaCoexist = psessionEntry->beaconParams.llaCoexist = false;
3907 pBeaconParams->paramChangeBitmap |= PARAM_llACOEXIST_CHANGED;
3908 }
3909 }
3910 //for station role
3911 else
3912 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003913 PELOG1(limLog(pMac, LOG1, FL("===> Protection from 11A Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003914 pBeaconParams->llaCoexist = psessionEntry->beaconParams.llaCoexist = false;
3915 pBeaconParams->paramChangeBitmap |= PARAM_llACOEXIST_CHANGED;
3916 }
3917 }
3918
3919 return eSIR_SUCCESS;
3920}
3921
3922/** -------------------------------------------------------------
3923\fn limEnable11gProtection
3924\brief based on config setting enables\disables 11g protection.
3925\param tANI_U8 enable : 1=> enable protection, 0=> disable protection.
3926\param tANI_U8 overlap: 1=> called from overlap context, 0 => called from assoc context.
3927\param tpUpdateBeaconParams pBeaconParams
3928\return None
3929 -------------------------------------------------------------*/
3930
3931tSirRetStatus
3932limEnable11gProtection(tpAniSirGlobal pMac, tANI_U8 enable,
3933 tANI_U8 overlap, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry)
3934{
3935
3936 //overlapping protection configuration check.
3937 if(overlap)
3938 {
Jeff Johnson295189b2012-06-20 16:38:30 -07003939 }
3940 else
3941 {
3942 //normal protection config check
Jeff Johnson295189b2012-06-20 16:38:30 -07003943 if((psessionEntry->limSystemRole == eLIM_AP_ROLE ) &&
3944 !psessionEntry->cfgProtection.fromllb)
3945 {
3946 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003947 PELOG1(limLog(pMac, LOG1, FL("protection from 11b is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003948 return eSIR_SUCCESS;
3949 }else if(psessionEntry->limSystemRole != eLIM_AP_ROLE)
Jeff Johnson295189b2012-06-20 16:38:30 -07003950 {
3951 if(!pMac->lim.cfgProtection.fromllb)
3952 {
3953 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003954 PELOG1(limLog(pMac, LOG1, FL("protection from 11b is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003955 return eSIR_SUCCESS;
3956 }
3957 }
3958 }
3959
3960 if (enable)
3961 {
3962 //If we are AP and HT capable, we need to set the HT OP mode
3963 //appropriately.
Jeff Johnson295189b2012-06-20 16:38:30 -07003964 if(eLIM_AP_ROLE == psessionEntry->limSystemRole)
3965 {
3966 if(overlap)
3967 {
3968 psessionEntry->gLimOlbcParams.protectionEnabled = true;
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003969 PELOGE(limLog(pMac, LOGE, FL("protection from olbc is enabled"));)
Jeff Johnsone7245742012-09-05 17:12:55 -07003970 if(true == psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07003971 {
3972 if((eSIR_HT_OP_MODE_OVERLAP_LEGACY != psessionEntry->htOperMode) &&
3973 (eSIR_HT_OP_MODE_MIXED != psessionEntry->htOperMode))
3974 {
3975 psessionEntry->htOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
3976 }
3977 //CR-263021: OBSS bit is not switching back to 0 after disabling the overlapping legacy BSS
3978 // This fixes issue of OBSS bit not set after 11b, 11g station leaves
3979 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
3980 //Not processing OBSS bit from other APs, as we are already taking care
3981 //of Protection from overlapping BSS based on erp IE or useProtection bit
3982 limEnableHtOBSSProtection(pMac, true, overlap, pBeaconParams, psessionEntry);
3983 }
3984 }
3985 else
3986 {
3987 psessionEntry->gLim11bParams.protectionEnabled = true;
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003988 PELOGE(limLog(pMac, LOGE, FL("protection from 11b is enabled"));)
Jeff Johnsone7245742012-09-05 17:12:55 -07003989 if(true == psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07003990 {
3991 if(eSIR_HT_OP_MODE_MIXED != psessionEntry->htOperMode)
3992 {
3993 psessionEntry->htOperMode = eSIR_HT_OP_MODE_MIXED;
3994 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
3995 limEnableHtOBSSProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
3996 }
3997 }
3998 }
3999 }else if ((eLIM_BT_AMP_AP_ROLE == psessionEntry->limSystemRole) &&
Jeff Johnsone7245742012-09-05 17:12:55 -07004000 (true == psessionEntry->htCapability))
Jeff Johnson295189b2012-06-20 16:38:30 -07004001 {
4002 if(overlap)
4003 {
4004 psessionEntry->gLimOlbcParams.protectionEnabled = true;
4005 if((eSIR_HT_OP_MODE_OVERLAP_LEGACY != pMac->lim.gHTOperMode) &&
4006 (eSIR_HT_OP_MODE_MIXED != pMac->lim.gHTOperMode))
4007 {
4008 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
4009 }
4010 //CR-263021: OBSS bit is not switching back to 0 after disabling the overlapping legacy BSS
4011 // This fixes issue of OBSS bit not set after 11b, 11g station leaves
4012 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4013 //Not processing OBSS bit from other APs, as we are already taking care
4014 //of Protection from overlapping BSS based on erp IE or useProtection bit
4015 limEnableHtOBSSProtection(pMac, true, overlap, pBeaconParams, psessionEntry);
4016 }
4017 else
4018 {
4019 psessionEntry->gLim11bParams.protectionEnabled = true;
4020 if(eSIR_HT_OP_MODE_MIXED != pMac->lim.gHTOperMode)
4021 {
4022 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_MIXED;
4023 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4024 limEnableHtOBSSProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4025 }
4026 }
4027 }
4028
4029 //This part is common for staiton as well.
4030 if(false == psessionEntry->beaconParams.llbCoexist)
4031 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004032 PELOG1(limLog(pMac, LOG1, FL("=> 11G Protection Enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004033 pBeaconParams->llbCoexist = psessionEntry->beaconParams.llbCoexist = true;
4034 pBeaconParams->paramChangeBitmap |= PARAM_llBCOEXIST_CHANGED;
4035 }
4036 }
4037 else if (true == psessionEntry->beaconParams.llbCoexist)
4038 {
4039 //for AP role.
4040 //we need to take care of HT OP mode change if needed.
4041 //We need to take care of Overlap cases.
Jeff Johnson295189b2012-06-20 16:38:30 -07004042 if(eLIM_AP_ROLE == psessionEntry->limSystemRole)
4043 {
4044 if(overlap)
4045 {
4046 //Overlap Legacy protection disabled.
4047 psessionEntry->gLimOlbcParams.protectionEnabled = false;
4048
4049 //We need to take care of HT OP mode if we are HT AP.
Jeff Johnsone7245742012-09-05 17:12:55 -07004050 if(psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07004051 {
4052 // no HT op mode change if any of the overlap protection enabled.
4053 if(!(psessionEntry->gLimOverlap11gParams.protectionEnabled ||
4054 psessionEntry->gLimOverlapHt20Params.protectionEnabled ||
4055 psessionEntry->gLimOverlapNonGfParams.protectionEnabled))
4056 {
4057 //Check if there is a need to change HT OP mode.
Jeff Johnson04dd8a82012-06-29 20:41:40 -07004058 if(eSIR_HT_OP_MODE_OVERLAP_LEGACY == psessionEntry->htOperMode)
Jeff Johnson295189b2012-06-20 16:38:30 -07004059 {
4060 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4061 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4062 if(psessionEntry->gLimHt20Params.protectionEnabled){
4063 //Commenting out beacuse of CR 258588 WFA cert
4064 //psessionEntry->htOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4065 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
4066 }
4067 else
4068 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
4069 }
4070 }
4071 }
4072 }
4073 else
4074 {
4075 //Disable protection from 11B stations.
4076 psessionEntry->gLim11bParams.protectionEnabled = false;
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004077 PELOGE(limLog(pMac, LOGE, FL("===> 11B Protection Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004078 //Check if any other non-HT protection enabled.
4079 if(!psessionEntry->gLim11gParams.protectionEnabled)
4080 {
4081 //Right now we are in HT OP Mixed mode.
4082 //Change HT op mode appropriately.
4083 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4084
4085 //Change HT OP mode to 01 if any overlap protection enabled
4086 if(psessionEntry->gLimOlbcParams.protectionEnabled ||
4087 psessionEntry->gLimOverlap11gParams.protectionEnabled ||
4088 psessionEntry->gLimOverlapHt20Params.protectionEnabled ||
4089 psessionEntry->gLimOverlapNonGfParams.protectionEnabled)
4090 {
4091 psessionEntry->htOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004092 PELOGE(limLog(pMac, LOGE, FL("===> 11G Protection Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004093 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4094 }
4095 else if(psessionEntry->gLimHt20Params.protectionEnabled)
4096 {
4097 //Commenting because of CR 258588 WFA cert
4098 //psessionEntry->htOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4099 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004100 PELOGE(limLog(pMac, LOGE, FL("===> 11G Protection Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004101 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4102 }
4103 else
4104 {
4105 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
4106 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4107 }
4108 }
4109 }
4110 if(!psessionEntry->gLimOlbcParams.protectionEnabled &&
4111 !psessionEntry->gLim11bParams.protectionEnabled)
4112 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004113 PELOGE(limLog(pMac, LOGE, FL("===> 11G Protection Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004114 pBeaconParams->llbCoexist = psessionEntry->beaconParams.llbCoexist = false;
4115 pBeaconParams->paramChangeBitmap |= PARAM_llBCOEXIST_CHANGED;
4116 }
4117 }else if(eLIM_BT_AMP_AP_ROLE == psessionEntry->limSystemRole)
Jeff Johnson295189b2012-06-20 16:38:30 -07004118 {
4119 if(overlap)
4120 {
4121 //Overlap Legacy protection disabled.
4122 psessionEntry->gLimOlbcParams.protectionEnabled = false;
4123
4124 //We need to take care of HT OP mode iff we are HT AP.
Jeff Johnsone7245742012-09-05 17:12:55 -07004125 if(psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07004126 {
4127 // no HT op mode change if any of the overlap protection enabled.
4128 if(!(pMac->lim.gLimOverlap11gParams.protectionEnabled ||
4129 pMac->lim.gLimOverlapHt20Params.protectionEnabled ||
4130 pMac->lim.gLimOverlapNonGfParams.protectionEnabled))
4131
4132 {
4133 //Check if there is a need to change HT OP mode.
4134 if(eSIR_HT_OP_MODE_OVERLAP_LEGACY == pMac->lim.gHTOperMode)
4135 {
4136 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4137 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4138 if(psessionEntry->gLimHt20Params.protectionEnabled)
4139 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4140 else
4141 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_PURE;
4142 }
4143 }
4144 }
4145 }
4146 else
4147 {
4148 //Disable protection from 11B stations.
4149 psessionEntry->gLim11bParams.protectionEnabled = false;
4150 //Check if any other non-HT protection enabled.
4151 if(!psessionEntry->gLim11gParams.protectionEnabled)
4152 {
4153 //Right now we are in HT OP Mixed mode.
4154 //Change HT op mode appropriately.
4155 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4156
4157 //Change HT OP mode to 01 if any overlap protection enabled
4158 if(psessionEntry->gLimOlbcParams.protectionEnabled ||
4159 pMac->lim.gLimOverlap11gParams.protectionEnabled ||
4160 pMac->lim.gLimOverlapHt20Params.protectionEnabled ||
4161 pMac->lim.gLimOverlapNonGfParams.protectionEnabled)
4162
4163 {
4164 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
4165 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4166 }
4167 else if(psessionEntry->gLimHt20Params.protectionEnabled)
4168 {
4169 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4170 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4171 }
4172 else
4173 {
4174 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_PURE;
4175 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4176 }
4177 }
4178 }
4179 if(!psessionEntry->gLimOlbcParams.protectionEnabled &&
4180 !psessionEntry->gLim11bParams.protectionEnabled)
4181 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004182 PELOG1(limLog(pMac, LOG1, FL("===> 11G Protection Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004183 pBeaconParams->llbCoexist = psessionEntry->beaconParams.llbCoexist = false;
4184 pBeaconParams->paramChangeBitmap |= PARAM_llBCOEXIST_CHANGED;
4185 }
4186 }
4187 //for station role
4188 else
4189 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004190 PELOG1(limLog(pMac, LOG1, FL("===> 11G Protection Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004191 pBeaconParams->llbCoexist = psessionEntry->beaconParams.llbCoexist = false;
4192 pBeaconParams->paramChangeBitmap |= PARAM_llBCOEXIST_CHANGED;
4193 }
4194 }
4195 return eSIR_SUCCESS;
4196}
4197
4198/** -------------------------------------------------------------
4199\fn limEnableHtProtectionFrom11g
4200\brief based on cofig enables\disables protection from 11g.
4201\param tANI_U8 enable : 1=> enable protection, 0=> disable protection.
4202\param tANI_U8 overlap: 1=> called from overlap context, 0 => called from assoc context.
4203\param tpUpdateBeaconParams pBeaconParams
4204\return None
4205 -------------------------------------------------------------*/
4206tSirRetStatus
4207limEnableHtProtectionFrom11g(tpAniSirGlobal pMac, tANI_U8 enable,
4208 tANI_U8 overlap, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry)
4209{
Jeff Johnsone7245742012-09-05 17:12:55 -07004210 if(!psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07004211 return eSIR_SUCCESS; // protection from 11g is only for HT stations.
4212
4213 //overlapping protection configuration check.
4214 if(overlap)
4215 {
Jeff Johnson295189b2012-06-20 16:38:30 -07004216 if((psessionEntry->limSystemRole == eLIM_AP_ROLE ) && (!psessionEntry->cfgProtection.overlapFromllg))
4217 {
4218 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004219 PELOG3(limLog(pMac, LOG3, FL("overlap protection from 11g is disabled")););
Jeff Johnson295189b2012-06-20 16:38:30 -07004220 return eSIR_SUCCESS;
4221 }else if ((psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE) && (!pMac->lim.cfgProtection.overlapFromllg))
Jeff Johnson295189b2012-06-20 16:38:30 -07004222 {
4223 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004224 PELOG3(limLog(pMac, LOG3, FL("overlap protection from 11g is disabled")););
Jeff Johnson295189b2012-06-20 16:38:30 -07004225 return eSIR_SUCCESS;
4226 }
4227 }
4228 else
4229 {
4230 //normal protection config check
Jeff Johnson295189b2012-06-20 16:38:30 -07004231 if((psessionEntry->limSystemRole == eLIM_AP_ROLE ) &&
4232 !psessionEntry->cfgProtection.fromllg){
4233 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004234 PELOG3(limLog(pMac, LOG3, FL("protection from 11g is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004235 return eSIR_SUCCESS;
4236 }else if(psessionEntry->limSystemRole != eLIM_AP_ROLE )
Jeff Johnson295189b2012-06-20 16:38:30 -07004237 {
4238 if(!pMac->lim.cfgProtection.fromllg)
4239 {
4240 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004241 PELOG3(limLog(pMac, LOG3, FL("protection from 11g is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004242 return eSIR_SUCCESS;
4243 }
4244 }
4245 }
4246 if (enable)
4247 {
4248 //If we are AP and HT capable, we need to set the HT OP mode
4249 //appropriately.
4250
Jeff Johnson295189b2012-06-20 16:38:30 -07004251 if(eLIM_AP_ROLE == psessionEntry->limSystemRole)
4252 {
4253 if(overlap)
4254 {
4255 psessionEntry->gLimOverlap11gParams.protectionEnabled = true;
4256 //11g exists in overlap BSS.
4257 //need not to change the operating mode to overlap_legacy
4258 //if higher or same protection operating mode is enabled right now.
4259 if((eSIR_HT_OP_MODE_OVERLAP_LEGACY != psessionEntry->htOperMode) &&
4260 (eSIR_HT_OP_MODE_MIXED != psessionEntry->htOperMode))
4261 {
4262 psessionEntry->htOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
4263 }
4264 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05304265 limEnableHtOBSSProtection(pMac, true, overlap, pBeaconParams, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07004266 }
4267 else
4268 {
4269 //11g is associated to an AP operating in 11n mode.
4270 //Change the HT operating mode to 'mixed mode'.
4271 psessionEntry->gLim11gParams.protectionEnabled = true;
4272 if(eSIR_HT_OP_MODE_MIXED != psessionEntry->htOperMode)
4273 {
4274 psessionEntry->htOperMode = eSIR_HT_OP_MODE_MIXED;
4275 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05304276 limEnableHtOBSSProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07004277 }
4278 }
4279 }else if(eLIM_BT_AMP_AP_ROLE == psessionEntry->limSystemRole)
Jeff Johnson295189b2012-06-20 16:38:30 -07004280 {
4281 if(overlap)
4282 {
4283 pMac->lim.gLimOverlap11gParams.protectionEnabled = true;
4284 //11g exists in overlap BSS.
4285 //need not to change the operating mode to overlap_legacy
4286 //if higher or same protection operating mode is enabled right now.
4287 if((eSIR_HT_OP_MODE_OVERLAP_LEGACY != pMac->lim.gHTOperMode) &&
4288 (eSIR_HT_OP_MODE_MIXED != pMac->lim.gHTOperMode))
4289 {
4290 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
4291 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4292 }
4293 }
4294 else
4295 {
4296 //11g is associated to an AP operating in 11n mode.
4297 //Change the HT operating mode to 'mixed mode'.
4298 psessionEntry->gLim11gParams.protectionEnabled = true;
4299 if(eSIR_HT_OP_MODE_MIXED != pMac->lim.gHTOperMode)
4300 {
4301 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_MIXED;
4302 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05304303 limEnableHtOBSSProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07004304 }
4305 }
4306 }
4307
4308 //This part is common for staiton as well.
4309 if(false == psessionEntry->beaconParams.llgCoexist)
4310 {
4311 pBeaconParams->llgCoexist = psessionEntry->beaconParams.llgCoexist = true;
4312 pBeaconParams->paramChangeBitmap |= PARAM_llGCOEXIST_CHANGED;
4313 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004314 else if (true == psessionEntry->gLimOverlap11gParams.protectionEnabled)
4315 {
4316 // As operating mode changed after G station assoc some way to update beacon
4317 // This addresses the issue of mode not changing to - 11 in beacon when OBSS overlap is enabled
4318 //pMac->sch.schObject.fBeaconChanged = 1;
4319 pBeaconParams->paramChangeBitmap |= PARAM_llGCOEXIST_CHANGED;
4320 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004321 }
4322 else if (true == psessionEntry->beaconParams.llgCoexist)
4323 {
4324 //for AP role.
4325 //we need to take care of HT OP mode change if needed.
4326 //We need to take care of Overlap cases.
4327
Jeff Johnson295189b2012-06-20 16:38:30 -07004328 if(eLIM_AP_ROLE == psessionEntry->limSystemRole)
4329 {
4330 if(overlap)
4331 {
4332 //Overlap Legacy protection disabled.
4333 if (psessionEntry->gLim11gParams.numSta == 0)
4334 psessionEntry->gLimOverlap11gParams.protectionEnabled = false;
4335
4336 // no HT op mode change if any of the overlap protection enabled.
4337 if(!(psessionEntry->gLimOlbcParams.protectionEnabled ||
4338 psessionEntry->gLimOverlapHt20Params.protectionEnabled ||
4339 psessionEntry->gLimOverlapNonGfParams.protectionEnabled))
4340 {
4341 //Check if there is a need to change HT OP mode.
4342 if(eSIR_HT_OP_MODE_OVERLAP_LEGACY == psessionEntry->htOperMode)
4343 {
4344 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4345 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4346
4347 if(psessionEntry->gLimHt20Params.protectionEnabled){
4348 //Commenting because of CR 258588 WFA cert
4349 //psessionEntry->htOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4350 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
4351 }
4352 else
4353 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
4354 }
4355 }
4356 }
4357 else
4358 {
4359 //Disable protection from 11G stations.
4360 psessionEntry->gLim11gParams.protectionEnabled = false;
4361 //Check if any other non-HT protection enabled.
4362 if(!psessionEntry->gLim11bParams.protectionEnabled)
4363 {
4364
4365 //Right now we are in HT OP Mixed mode.
4366 //Change HT op mode appropriately.
4367 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4368
4369 //Change HT OP mode to 01 if any overlap protection enabled
4370 if(psessionEntry->gLimOlbcParams.protectionEnabled ||
4371 psessionEntry->gLimOverlap11gParams.protectionEnabled ||
4372 psessionEntry->gLimOverlapHt20Params.protectionEnabled ||
4373 psessionEntry->gLimOverlapNonGfParams.protectionEnabled)
4374
4375 {
4376 psessionEntry->htOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
4377 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4378 }
4379 else if(psessionEntry->gLimHt20Params.protectionEnabled)
4380 {
4381 //Commenting because of CR 258588 WFA cert
4382 //psessionEntry->htOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4383 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
4384 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4385 }
4386 else
4387 {
4388 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
4389 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4390 }
4391 }
4392 }
4393 if(!psessionEntry->gLimOverlap11gParams.protectionEnabled &&
4394 !psessionEntry->gLim11gParams.protectionEnabled)
4395 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004396 PELOG1(limLog(pMac, LOG1, FL("===> Protection from 11G Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004397 pBeaconParams->llgCoexist = psessionEntry->beaconParams.llgCoexist = false;
4398 pBeaconParams->paramChangeBitmap |= PARAM_llGCOEXIST_CHANGED;
4399 }
4400 }else if(eLIM_BT_AMP_AP_ROLE == psessionEntry->limSystemRole)
Jeff Johnson295189b2012-06-20 16:38:30 -07004401 {
4402 if(overlap)
4403 {
4404 //Overlap Legacy protection disabled.
4405 pMac->lim.gLimOverlap11gParams.protectionEnabled = false;
4406
4407 // no HT op mode change if any of the overlap protection enabled.
4408 if(!(psessionEntry->gLimOlbcParams.protectionEnabled ||
4409 psessionEntry->gLimOverlapHt20Params.protectionEnabled ||
4410 psessionEntry->gLimOverlapNonGfParams.protectionEnabled))
4411 {
4412 //Check if there is a need to change HT OP mode.
4413 if(eSIR_HT_OP_MODE_OVERLAP_LEGACY == pMac->lim.gHTOperMode)
4414 {
4415 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4416 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4417
4418 if(psessionEntry->gLimHt20Params.protectionEnabled)
4419 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4420 else
4421 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_PURE;
4422 }
4423 }
4424 }
4425 else
4426 {
4427 //Disable protection from 11G stations.
4428 psessionEntry->gLim11gParams.protectionEnabled = false;
4429 //Check if any other non-HT protection enabled.
4430 if(!psessionEntry->gLim11bParams.protectionEnabled)
4431 {
4432
4433 //Right now we are in HT OP Mixed mode.
4434 //Change HT op mode appropriately.
4435 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4436
4437 //Change HT OP mode to 01 if any overlap protection enabled
4438 if(psessionEntry->gLimOlbcParams.protectionEnabled ||
4439 pMac->lim.gLimOverlap11gParams.protectionEnabled ||
4440 pMac->lim.gLimOverlapHt20Params.protectionEnabled ||
4441 pMac->lim.gLimOverlapNonGfParams.protectionEnabled)
4442
4443 {
4444 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
4445 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4446 }
4447 else if(psessionEntry->gLimHt20Params.protectionEnabled)
4448 {
4449 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4450 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4451 }
4452 else
4453 {
4454 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_PURE;
4455 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4456 }
4457 }
4458 }
4459 if(!pMac->lim.gLimOverlap11gParams.protectionEnabled &&
4460 !psessionEntry->gLim11gParams.protectionEnabled)
4461 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004462 PELOG1(limLog(pMac, LOG1, FL("===> Protection from 11G Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004463 pBeaconParams->llgCoexist = psessionEntry->beaconParams.llgCoexist = false;
4464 pBeaconParams->paramChangeBitmap |= PARAM_llGCOEXIST_CHANGED;
4465 }
4466 }
4467 //for station role
4468 else
4469 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004470 PELOG1(limLog(pMac, LOG1, FL("===> Protection from 11G Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004471 pBeaconParams->llgCoexist = psessionEntry->beaconParams.llgCoexist = false;
4472 pBeaconParams->paramChangeBitmap |= PARAM_llGCOEXIST_CHANGED;
4473 }
4474 }
4475 return eSIR_SUCCESS;
4476}
4477//FIXME_PROTECTION : need to check for no APSD whenever we want to enable this protection.
4478//This check will be done at the caller.
4479
4480/** -------------------------------------------------------------
4481\fn limEnableHtObssProtection
4482\brief based on cofig enables\disables obss protection.
4483\param tANI_U8 enable : 1=> enable protection, 0=> disable protection.
4484\param tANI_U8 overlap: 1=> called from overlap context, 0 => called from assoc context.
4485\param tpUpdateBeaconParams pBeaconParams
4486\return None
4487 -------------------------------------------------------------*/
4488tSirRetStatus
4489limEnableHtOBSSProtection(tpAniSirGlobal pMac, tANI_U8 enable,
4490 tANI_U8 overlap, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry)
4491{
4492
4493
Jeff Johnsone7245742012-09-05 17:12:55 -07004494 if(!psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07004495 return eSIR_SUCCESS; // this protection is only for HT stations.
4496
4497 //overlapping protection configuration check.
4498 if(overlap)
4499 {
4500 //overlapping protection configuration check.
Jeff Johnson295189b2012-06-20 16:38:30 -07004501 }
4502 else
4503 {
4504 //normal protection config check
Jeff Johnson295189b2012-06-20 16:38:30 -07004505 if((psessionEntry->limSystemRole == eLIM_AP_ROLE) && !psessionEntry->cfgProtection.obss)
4506 { //ToDo Update this field
4507 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004508 PELOG1(limLog(pMac, LOG1, FL("protection from Obss is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004509 return eSIR_SUCCESS;
4510 }else if(psessionEntry->limSystemRole != eLIM_AP_ROLE)
Jeff Johnson295189b2012-06-20 16:38:30 -07004511 {
4512 if(!pMac->lim.cfgProtection.obss)
4513 { //ToDo Update this field
4514 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004515 PELOG1(limLog(pMac, LOG1, FL("protection from Obss is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004516 return eSIR_SUCCESS;
4517 }
4518 }
4519 }
4520
4521
Jeff Johnson295189b2012-06-20 16:38:30 -07004522 if (eLIM_AP_ROLE == psessionEntry->limSystemRole){
4523 if ((enable) && (false == psessionEntry->beaconParams.gHTObssMode) )
4524 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004525 PELOG1(limLog(pMac, LOG1, FL("=>obss protection enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004526 psessionEntry->beaconParams.gHTObssMode = true;
4527 pBeaconParams->paramChangeBitmap |= PARAM_OBSS_MODE_CHANGED; // UPDATE AN ENUM FOR OBSS MODE <todo>
4528
4529 }
4530 else if (!enable && (true == psessionEntry->beaconParams.gHTObssMode))
4531 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004532 PELOG1(limLog(pMac, LOG1, FL("===> obss Protection disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004533 psessionEntry->beaconParams.gHTObssMode = false;
4534 pBeaconParams->paramChangeBitmap |= PARAM_OBSS_MODE_CHANGED;
4535
4536 }
4537//CR-263021: OBSS bit is not switching back to 0 after disabling the overlapping legacy BSS
4538 if (!enable && !overlap)
4539 {
4540 psessionEntry->gLimOverlap11gParams.protectionEnabled = false;
4541 }
4542 } else
Jeff Johnson295189b2012-06-20 16:38:30 -07004543 {
4544 if ((enable) && (false == psessionEntry->beaconParams.gHTObssMode) )
4545 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004546 PELOG1(limLog(pMac, LOG1, FL("=>obss protection enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004547 psessionEntry->beaconParams.gHTObssMode = true;
4548 pBeaconParams->paramChangeBitmap |= PARAM_OBSS_MODE_CHANGED; // UPDATE AN ENUM FOR OBSS MODE <todo>
4549
4550 }
4551 else if (!enable && (true == psessionEntry->beaconParams.gHTObssMode))
4552 {
4553
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004554 PELOG1(limLog(pMac, LOG1, FL("===> obss Protection disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004555 psessionEntry->beaconParams.gHTObssMode = false;
4556 pBeaconParams->paramChangeBitmap |= PARAM_OBSS_MODE_CHANGED;
4557
4558 }
4559 }
4560 return eSIR_SUCCESS;
4561}
4562/** -------------------------------------------------------------
4563\fn limEnableHT20Protection
4564\brief based on cofig enables\disables protection from Ht20.
4565\param tANI_U8 enable : 1=> enable protection, 0=> disable protection.
4566\param tANI_U8 overlap: 1=> called from overlap context, 0 => called from assoc context.
4567\param tpUpdateBeaconParams pBeaconParams
4568\return None
4569 -------------------------------------------------------------*/
4570tSirRetStatus
4571limEnableHT20Protection(tpAniSirGlobal pMac, tANI_U8 enable,
4572 tANI_U8 overlap, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry)
4573{
Jeff Johnsone7245742012-09-05 17:12:55 -07004574 if(!psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07004575 return eSIR_SUCCESS; // this protection is only for HT stations.
4576
4577 //overlapping protection configuration check.
4578 if(overlap)
4579 {
Jeff Johnson295189b2012-06-20 16:38:30 -07004580 }
4581 else
4582 {
4583 //normal protection config check
Jeff Johnson295189b2012-06-20 16:38:30 -07004584 if((psessionEntry->limSystemRole == eLIM_AP_ROLE ) &&
4585 !psessionEntry->cfgProtection.ht20)
4586 {
4587 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004588 PELOG3(limLog(pMac, LOG3, FL("protection from HT20 is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004589 return eSIR_SUCCESS;
4590 }else if(psessionEntry->limSystemRole != eLIM_AP_ROLE )
Jeff Johnson295189b2012-06-20 16:38:30 -07004591 {
4592 if(!pMac->lim.cfgProtection.ht20)
4593 {
4594 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004595 PELOG3(limLog(pMac, LOG3, FL("protection from HT20 is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004596 return eSIR_SUCCESS;
4597 }
4598 }
4599 }
4600
4601 if (enable)
4602 {
4603 //If we are AP and HT capable, we need to set the HT OP mode
4604 //appropriately.
4605
Jeff Johnson295189b2012-06-20 16:38:30 -07004606 if(eLIM_AP_ROLE == psessionEntry->limSystemRole){
4607 if(overlap)
4608 {
4609 psessionEntry->gLimOverlapHt20Params.protectionEnabled = true;
4610 if((eSIR_HT_OP_MODE_OVERLAP_LEGACY != psessionEntry->htOperMode) &&
4611 (eSIR_HT_OP_MODE_MIXED != psessionEntry->htOperMode))
4612 {
4613 psessionEntry->htOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
4614 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4615 }
4616 }
4617 else
4618 {
4619 psessionEntry->gLimHt20Params.protectionEnabled = true;
4620 if(eSIR_HT_OP_MODE_PURE == psessionEntry->htOperMode)
4621 {
4622 //Commenting because of CR 258588 WFA cert
4623 //psessionEntry->htOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4624 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
4625 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4626 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4627 }
4628 }
4629 }else if(eLIM_BT_AMP_AP_ROLE == psessionEntry->limSystemRole)
Jeff Johnson295189b2012-06-20 16:38:30 -07004630 {
4631 if(overlap)
4632 {
4633 pMac->lim.gLimOverlapHt20Params.protectionEnabled = true;
4634 if((eSIR_HT_OP_MODE_OVERLAP_LEGACY != pMac->lim.gHTOperMode) &&
4635 (eSIR_HT_OP_MODE_MIXED != pMac->lim.gHTOperMode))
4636 {
4637 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
4638 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4639 }
4640 }
4641 else
4642 {
4643 psessionEntry->gLimHt20Params.protectionEnabled = true;
4644 if(eSIR_HT_OP_MODE_PURE == pMac->lim.gHTOperMode)
4645 {
4646 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4647 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4648 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4649 }
4650 }
4651 }
4652
4653 //This part is common for staiton as well.
4654 if(false == psessionEntry->beaconParams.ht20Coexist)
4655 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004656 PELOG1(limLog(pMac, LOG1, FL("=> Prtection from HT20 Enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004657 pBeaconParams->ht20MhzCoexist = psessionEntry->beaconParams.ht20Coexist = true;
4658 pBeaconParams->paramChangeBitmap |= PARAM_HT20MHZCOEXIST_CHANGED;
4659 }
4660 }
4661 else if (true == psessionEntry->beaconParams.ht20Coexist)
4662 {
4663 //for AP role.
4664 //we need to take care of HT OP mode change if needed.
4665 //We need to take care of Overlap cases.
Jeff Johnson295189b2012-06-20 16:38:30 -07004666 if(eLIM_AP_ROLE == psessionEntry->limSystemRole){
4667 if(overlap)
4668 {
4669 //Overlap Legacy protection disabled.
4670 psessionEntry->gLimOverlapHt20Params.protectionEnabled = false;
4671
4672 // no HT op mode change if any of the overlap protection enabled.
4673 if(!(psessionEntry->gLimOlbcParams.protectionEnabled ||
4674 psessionEntry->gLimOverlap11gParams.protectionEnabled ||
4675 psessionEntry->gLimOverlapHt20Params.protectionEnabled ||
4676 psessionEntry->gLimOverlapNonGfParams.protectionEnabled))
4677 {
4678
4679 //Check if there is a need to change HT OP mode.
4680 if(eSIR_HT_OP_MODE_OVERLAP_LEGACY == psessionEntry->htOperMode)
4681 {
4682 if(psessionEntry->gLimHt20Params.protectionEnabled)
4683 {
4684 //Commented beacuse of CR 258588 for WFA Cert
4685 //psessionEntry->htOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4686 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
4687 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4688 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4689 }
4690 else
4691 {
4692 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
4693 }
4694 }
4695 }
4696 }
4697 else
4698 {
4699 //Disable protection from 11G stations.
4700 psessionEntry->gLimHt20Params.protectionEnabled = false;
4701
4702 //Change HT op mode appropriately.
4703 if(eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT == psessionEntry->htOperMode)
4704 {
4705 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
4706 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4707 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4708 }
4709 }
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004710 PELOG1(limLog(pMac, LOG1, FL("===> Protection from HT 20 Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004711 pBeaconParams->ht20MhzCoexist = psessionEntry->beaconParams.ht20Coexist = false;
4712 pBeaconParams->paramChangeBitmap |= PARAM_HT20MHZCOEXIST_CHANGED;
4713 }else if(eLIM_BT_AMP_AP_ROLE == psessionEntry->limSystemRole)
Jeff Johnson295189b2012-06-20 16:38:30 -07004714 {
4715 if(overlap)
4716 {
4717 //Overlap Legacy protection disabled.
4718 pMac->lim.gLimOverlapHt20Params.protectionEnabled = false;
4719
4720 // no HT op mode change if any of the overlap protection enabled.
4721 if(!(psessionEntry->gLimOlbcParams.protectionEnabled ||
4722 pMac->lim.gLimOverlap11gParams.protectionEnabled ||
4723 pMac->lim.gLimOverlapHt20Params.protectionEnabled ||
4724 pMac->lim.gLimOverlapNonGfParams.protectionEnabled))
4725 {
4726
4727 //Check if there is a need to change HT OP mode.
4728 if(eSIR_HT_OP_MODE_OVERLAP_LEGACY == pMac->lim.gHTOperMode)
4729 {
4730 if(psessionEntry->gLimHt20Params.protectionEnabled)
4731 {
4732 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4733 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4734 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4735 }
4736 else
4737 {
4738 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_PURE;
4739 }
4740 }
4741 }
4742 }
4743 else
4744 {
4745 //Disable protection from 11G stations.
4746 psessionEntry->gLimHt20Params.protectionEnabled = false;
4747
4748 //Change HT op mode appropriately.
4749 if(eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT == pMac->lim.gHTOperMode)
4750 {
4751 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_PURE;
4752 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4753 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4754 }
4755 }
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004756 PELOG1(limLog(pMac, LOG1, FL("===> Protection from HT 20 Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004757 pBeaconParams->ht20MhzCoexist = psessionEntry->beaconParams.ht20Coexist = false;
4758 pBeaconParams->paramChangeBitmap |= PARAM_HT20MHZCOEXIST_CHANGED;
4759 }
4760 //for station role
4761 else
4762 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004763 PELOG1(limLog(pMac, LOG1, FL("===> Protection from HT20 Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004764 pBeaconParams->ht20MhzCoexist = psessionEntry->beaconParams.ht20Coexist = false;
4765 pBeaconParams->paramChangeBitmap |= PARAM_HT20MHZCOEXIST_CHANGED;
4766 }
4767 }
4768
4769 return eSIR_SUCCESS;
4770}
4771
4772/** -------------------------------------------------------------
4773\fn limEnableHTNonGfProtection
4774\brief based on cofig enables\disables protection from NonGf.
4775\param tANI_U8 enable : 1=> enable protection, 0=> disable protection.
4776\param tANI_U8 overlap: 1=> called from overlap context, 0 => called from assoc context.
4777\param tpUpdateBeaconParams pBeaconParams
4778\return None
4779 -------------------------------------------------------------*/
4780tSirRetStatus
4781limEnableHTNonGfProtection(tpAniSirGlobal pMac, tANI_U8 enable,
4782 tANI_U8 overlap, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry)
4783{
Jeff Johnsone7245742012-09-05 17:12:55 -07004784 if(!psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07004785 return eSIR_SUCCESS; // this protection is only for HT stations.
4786
4787 //overlapping protection configuration check.
4788 if(overlap)
4789 {
Jeff Johnson295189b2012-06-20 16:38:30 -07004790 }
4791 else
4792 {
Jeff Johnson295189b2012-06-20 16:38:30 -07004793 //normal protection config check
4794 if((psessionEntry->limSystemRole == eLIM_AP_ROLE ) &&
4795 !psessionEntry->cfgProtection.nonGf)
4796 {
4797 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004798 PELOG3(limLog(pMac, LOG3, FL("protection from NonGf is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004799 return eSIR_SUCCESS;
4800 }else if(psessionEntry->limSystemRole != eLIM_AP_ROLE)
Jeff Johnson295189b2012-06-20 16:38:30 -07004801 {
4802 //normal protection config check
4803 if(!pMac->lim.cfgProtection.nonGf)
4804 {
4805 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004806 PELOG3(limLog(pMac, LOG3, FL("protection from NonGf is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004807 return eSIR_SUCCESS;
4808 }
4809 }
4810 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004811 if(psessionEntry->limSystemRole == eLIM_AP_ROLE){
4812 if ((enable) && (false == psessionEntry->beaconParams.llnNonGFCoexist))
4813 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004814 PELOG1(limLog(pMac, LOG1, FL(" => Prtection from non GF Enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004815 pBeaconParams->llnNonGFCoexist = psessionEntry->beaconParams.llnNonGFCoexist = true;
4816 pBeaconParams->paramChangeBitmap |= PARAM_NON_GF_DEVICES_PRESENT_CHANGED;
4817 }
4818 else if (!enable && (true == psessionEntry->beaconParams.llnNonGFCoexist))
4819 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004820 PELOG1(limLog(pMac, LOG1, FL("===> Protection from Non GF Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004821 pBeaconParams->llnNonGFCoexist = psessionEntry->beaconParams.llnNonGFCoexist = false;
4822 pBeaconParams->paramChangeBitmap |= PARAM_NON_GF_DEVICES_PRESENT_CHANGED;
4823 }
4824 }else
Jeff Johnson295189b2012-06-20 16:38:30 -07004825 {
4826 if ((enable) && (false == psessionEntry->beaconParams.llnNonGFCoexist))
4827 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004828 PELOG1(limLog(pMac, LOG1, FL(" => Prtection from non GF Enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004829 pBeaconParams->llnNonGFCoexist = psessionEntry->beaconParams.llnNonGFCoexist = true;
4830 pBeaconParams->paramChangeBitmap |= PARAM_NON_GF_DEVICES_PRESENT_CHANGED;
4831 }
4832 else if (!enable && (true == psessionEntry->beaconParams.llnNonGFCoexist))
4833 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004834 PELOG1(limLog(pMac, LOG1, FL("===> Protection from Non GF Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004835 pBeaconParams->llnNonGFCoexist = psessionEntry->beaconParams.llnNonGFCoexist = false;
4836 pBeaconParams->paramChangeBitmap |= PARAM_NON_GF_DEVICES_PRESENT_CHANGED;
4837 }
4838 }
4839
4840 return eSIR_SUCCESS;
4841}
4842
4843/** -------------------------------------------------------------
4844\fn limEnableHTLsigTxopProtection
4845\brief based on cofig enables\disables LsigTxop protection.
4846\param tANI_U8 enable : 1=> enable protection, 0=> disable protection.
4847\param tANI_U8 overlap: 1=> called from overlap context, 0 => called from assoc context.
4848\param tpUpdateBeaconParams pBeaconParams
4849\return None
4850 -------------------------------------------------------------*/
4851tSirRetStatus
4852limEnableHTLsigTxopProtection(tpAniSirGlobal pMac, tANI_U8 enable,
4853 tANI_U8 overlap, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry)
4854{
Jeff Johnsone7245742012-09-05 17:12:55 -07004855 if(!psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07004856 return eSIR_SUCCESS; // this protection is only for HT stations.
4857
4858 //overlapping protection configuration check.
4859 if(overlap)
4860 {
Jeff Johnson295189b2012-06-20 16:38:30 -07004861 }
4862 else
4863 {
Jeff Johnson295189b2012-06-20 16:38:30 -07004864 //normal protection config check
4865 if((psessionEntry->limSystemRole == eLIM_AP_ROLE ) &&
4866 !psessionEntry->cfgProtection.lsigTxop)
4867 {
4868 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004869 PELOG3(limLog(pMac, LOG3, FL(" protection from LsigTxop not supported is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004870 return eSIR_SUCCESS;
4871 }else if(psessionEntry->limSystemRole != eLIM_AP_ROLE)
Jeff Johnson295189b2012-06-20 16:38:30 -07004872 {
4873 //normal protection config check
4874 if(!pMac->lim.cfgProtection.lsigTxop)
4875 {
4876 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004877 PELOG3(limLog(pMac, LOG3, FL(" protection from LsigTxop not supported is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004878 return eSIR_SUCCESS;
4879 }
4880 }
4881 }
4882
4883
Jeff Johnson295189b2012-06-20 16:38:30 -07004884 if(psessionEntry->limSystemRole == eLIM_AP_ROLE){
4885 if ((enable) && (false == psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport))
4886 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004887 PELOG1(limLog(pMac, LOG1, FL(" => Prtection from LsigTxop Enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004888 pBeaconParams->fLsigTXOPProtectionFullSupport = psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport = true;
4889 pBeaconParams->paramChangeBitmap |= PARAM_LSIG_TXOP_FULL_SUPPORT_CHANGED;
4890 }
4891 else if (!enable && (true == psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport))
4892 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004893 PELOG1(limLog(pMac, LOG1, FL("===> Protection from LsigTxop Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004894 pBeaconParams->fLsigTXOPProtectionFullSupport= psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport = false;
4895 pBeaconParams->paramChangeBitmap |= PARAM_LSIG_TXOP_FULL_SUPPORT_CHANGED;
4896 }
4897 }else
Jeff Johnson295189b2012-06-20 16:38:30 -07004898 {
4899 if ((enable) && (false == psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport))
4900 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004901 PELOG1(limLog(pMac, LOG1, FL(" => Prtection from LsigTxop Enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004902 pBeaconParams->fLsigTXOPProtectionFullSupport = psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport = true;
4903 pBeaconParams->paramChangeBitmap |= PARAM_LSIG_TXOP_FULL_SUPPORT_CHANGED;
4904 }
4905 else if (!enable && (true == psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport))
4906 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004907 PELOG1(limLog(pMac, LOG1, FL("===> Protection from LsigTxop Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004908 pBeaconParams->fLsigTXOPProtectionFullSupport= psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport = false;
4909 pBeaconParams->paramChangeBitmap |= PARAM_LSIG_TXOP_FULL_SUPPORT_CHANGED;
4910 }
4911 }
4912 return eSIR_SUCCESS;
4913}
4914//FIXME_PROTECTION : need to check for no APSD whenever we want to enable this protection.
4915//This check will be done at the caller.
4916/** -------------------------------------------------------------
4917\fn limEnableHtRifsProtection
4918\brief based on cofig enables\disables Rifs protection.
4919\param tANI_U8 enable : 1=> enable protection, 0=> disable protection.
4920\param tANI_U8 overlap: 1=> called from overlap context, 0 => called from assoc context.
4921\param tpUpdateBeaconParams pBeaconParams
4922\return None
4923 -------------------------------------------------------------*/
4924tSirRetStatus
4925limEnableHtRifsProtection(tpAniSirGlobal pMac, tANI_U8 enable,
4926 tANI_U8 overlap, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry)
4927{
Jeff Johnsone7245742012-09-05 17:12:55 -07004928 if(!psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07004929 return eSIR_SUCCESS; // this protection is only for HT stations.
4930
4931
4932 //overlapping protection configuration check.
4933 if(overlap)
4934 {
Jeff Johnson295189b2012-06-20 16:38:30 -07004935 }
4936 else
4937 {
Jeff Johnson295189b2012-06-20 16:38:30 -07004938 //normal protection config check
4939 if((psessionEntry->limSystemRole == eLIM_AP_ROLE) &&
4940 !psessionEntry->cfgProtection.rifs)
4941 {
4942 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004943 PELOG3(limLog(pMac, LOG3, FL(" protection from Rifs is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004944 return eSIR_SUCCESS;
4945 }else if(psessionEntry->limSystemRole != eLIM_AP_ROLE )
Jeff Johnson295189b2012-06-20 16:38:30 -07004946 {
4947 //normal protection config check
4948 if(!pMac->lim.cfgProtection.rifs)
4949 {
4950 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004951 PELOG3(limLog(pMac, LOG3, FL(" protection from Rifs is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004952 return eSIR_SUCCESS;
4953 }
4954 }
4955 }
4956
Jeff Johnson295189b2012-06-20 16:38:30 -07004957 if(psessionEntry->limSystemRole == eLIM_AP_ROLE){
4958 // Disabling the RIFS Protection means Enable the RIFS mode of operation in the BSS
4959 if ((!enable) && (false == psessionEntry->beaconParams.fRIFSMode))
4960 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004961 PELOG1(limLog(pMac, LOG1, FL(" => Rifs protection Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004962 pBeaconParams->fRIFSMode = psessionEntry->beaconParams.fRIFSMode = true;
4963 pBeaconParams->paramChangeBitmap |= PARAM_RIFS_MODE_CHANGED;
4964 }
4965 // Enabling the RIFS Protection means Disable the RIFS mode of operation in the BSS
4966 else if (enable && (true == psessionEntry->beaconParams.fRIFSMode))
4967 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004968 PELOG1(limLog(pMac, LOG1, FL("===> Rifs Protection Enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004969 pBeaconParams->fRIFSMode = psessionEntry->beaconParams.fRIFSMode = false;
4970 pBeaconParams->paramChangeBitmap |= PARAM_RIFS_MODE_CHANGED;
4971 }
4972 }else
Jeff Johnson295189b2012-06-20 16:38:30 -07004973 {
4974 // Disabling the RIFS Protection means Enable the RIFS mode of operation in the BSS
4975 if ((!enable) && (false == psessionEntry->beaconParams.fRIFSMode))
4976 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004977 PELOG1(limLog(pMac, LOG1, FL(" => Rifs protection Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004978 pBeaconParams->fRIFSMode = psessionEntry->beaconParams.fRIFSMode = true;
4979 pBeaconParams->paramChangeBitmap |= PARAM_RIFS_MODE_CHANGED;
4980 }
4981 // Enabling the RIFS Protection means Disable the RIFS mode of operation in the BSS
4982 else if (enable && (true == psessionEntry->beaconParams.fRIFSMode))
4983 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004984 PELOG1(limLog(pMac, LOG1, FL("===> Rifs Protection Enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004985 pBeaconParams->fRIFSMode = psessionEntry->beaconParams.fRIFSMode = false;
4986 pBeaconParams->paramChangeBitmap |= PARAM_RIFS_MODE_CHANGED;
4987 }
4988 }
4989 return eSIR_SUCCESS;
4990}
4991
4992// ---------------------------------------------------------------------
4993/**
4994 * limEnableShortPreamble
4995 *
4996 * FUNCTION:
4997 * Enable/Disable short preamble
4998 *
4999 * LOGIC:
5000 *
5001 * ASSUMPTIONS:
5002 *
5003 * NOTE:
5004 *
5005 * @param enable Flag to enable/disable short preamble
5006 * @return None
5007 */
5008
5009tSirRetStatus
5010limEnableShortPreamble(tpAniSirGlobal pMac, tANI_U8 enable, tpUpdateBeaconParams pBeaconParams, tpPESession psessionEntry)
5011{
5012 tANI_U32 val;
5013
5014 if (wlan_cfgGetInt(pMac, WNI_CFG_SHORT_PREAMBLE, &val) != eSIR_SUCCESS)
5015 {
5016 /* Could not get short preamble enabled flag from CFG. Log error. */
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005017 limLog(pMac, LOGP, FL("could not retrieve short preamble flag"));
Jeff Johnson295189b2012-06-20 16:38:30 -07005018 return eSIR_FAILURE;
5019 }
5020
5021 if (!val)
5022 return eSIR_SUCCESS;
5023
5024 if (wlan_cfgGetInt(pMac, WNI_CFG_11G_SHORT_PREAMBLE_ENABLED, &val) != eSIR_SUCCESS)
5025 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005026 limLog(pMac, LOGP, FL("could not retrieve 11G short preamble switching enabled flag"));
Jeff Johnson295189b2012-06-20 16:38:30 -07005027 return eSIR_FAILURE;
5028 }
5029
5030 if (!val) // 11G short preamble switching is disabled.
5031 return eSIR_SUCCESS;
5032
5033 if ( psessionEntry->limSystemRole == eLIM_AP_ROLE )
5034 {
5035 if (enable && (psessionEntry->beaconParams.fShortPreamble == 0))
5036 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005037 PELOG1(limLog(pMac, LOG1, FL("===> Short Preamble Enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005038 psessionEntry->beaconParams.fShortPreamble = true;
5039 pBeaconParams->fShortPreamble = (tANI_U8) psessionEntry->beaconParams.fShortPreamble;
5040 pBeaconParams->paramChangeBitmap |= PARAM_SHORT_PREAMBLE_CHANGED;
5041 }
5042 else if (!enable && (psessionEntry->beaconParams.fShortPreamble == 1))
5043 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005044 PELOG1(limLog(pMac, LOG1, FL("===> Short Preamble Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005045 psessionEntry->beaconParams.fShortPreamble = false;
5046 pBeaconParams->fShortPreamble = (tANI_U8) psessionEntry->beaconParams.fShortPreamble;
5047 pBeaconParams->paramChangeBitmap |= PARAM_SHORT_PREAMBLE_CHANGED;
5048 }
5049 }
5050
5051 return eSIR_SUCCESS;
5052 }
5053
5054/**
5055 * limTxComplete
5056 *
5057 * Function:
5058 * This is LIM's very own "TX MGMT frame complete" completion routine.
5059 *
5060 * Logic:
5061 * LIM wants to send a MGMT frame (broadcast or unicast)
5062 * LIM allocates memory using palPktAlloc( ..., **pData, **pPacket )
5063 * LIM transmits the MGMT frame using the API:
5064 * halTxFrame( ... pPacket, ..., (void *) limTxComplete, pData )
5065 * HDD, via halTxFrame/DXE, "transfers" the packet over to BMU
5066 * HDD, if it determines that a TX completion routine (in this case
5067 * limTxComplete) has been provided, will invoke this callback
5068 * LIM will try to free the TX MGMT packet that was earlier allocated, in order
5069 * to send this MGMT frame, using the PAL API palPktFree( ... pData, pPacket )
5070 *
5071 * Assumptions:
5072 * Presently, this is ONLY being used for MGMT frames/packets
5073 * TODO:
5074 * Would it do good for LIM to have some sort of "signature" validation to
5075 * ensure that the pData argument passed in was a buffer that was actually
5076 * allocated by LIM and/or is not corrupted?
5077 *
5078 * Note: FIXME and TODO
5079 * Looks like palPktFree() is interested in pPacket. But, when this completion
5080 * routine is called, only pData is made available to LIM!!
5081 *
5082 * @param void A pointer to pData. Shouldn't it be pPacket?!
5083 *
5084 * @return none
5085 */
5086void limTxComplete( tHalHandle hHal, void *pData )
5087{
5088 tpAniSirGlobal pMac;
5089 pMac = (tpAniSirGlobal)hHal;
5090
5091#ifdef FIXME_PRIMA
5092 /* the trace logic needs to be fixed for Prima. Refer to CR 306075 */
5093#ifdef TRACE_RECORD
5094 {
5095 tpSirMacMgmtHdr mHdr;
5096 v_U8_t *pRxBd;
5097 vos_pkt_t *pVosPkt;
5098 VOS_STATUS vosStatus;
5099
5100
5101
5102 pVosPkt = (vos_pkt_t *)pData;
5103 vosStatus = vos_pkt_peek_data( pVosPkt, 0, (v_PVOID_t *)&pRxBd, WLANHAL_RX_BD_HEADER_SIZE);
5104
5105 if(VOS_IS_STATUS_SUCCESS(vosStatus))
5106 {
5107 mHdr = WDA_GET_RX_MAC_HEADER(pRxBd);
Jeff Johnson295189b2012-06-20 16:38:30 -07005108
5109 }
5110 }
5111#endif
5112#endif
5113
5114 palPktFree( pMac->hHdd,
5115 HAL_TXRX_FRM_802_11_MGMT,
5116 (void *) NULL, // this is ignored and will likely be removed from this API
5117 (void *) pData ); // lim passed in pPacket in the pData pointer that is given in this completion routine
5118}
5119
5120/**
5121 * \brief This function updates lim global structure, if CB parameters in the BSS
5122 * have changed, and sends an indication to HAL also with the
5123 * updated HT Parameters.
5124 * This function does not detect the change in the primary channel, that is done as part
5125 * of channel Swtich IE processing.
5126 * If STA is configured with '20Mhz only' mode, then this function does not do anything
5127 * This function changes the CB mode, only if the self capability is set to '20 as well as 40Mhz'
5128 *
5129 *
5130 * \param pMac Pointer to global MAC structure
5131 *
5132 * \param pRcvdHTInfo Pointer to HT Info IE obtained from a Beacon or
5133 * Probe Response
5134 *
5135 * \param bssIdx BSS Index of the Bss to which Station is associated.
5136 *
5137 *
5138 */
5139
5140void limUpdateStaRunTimeHTSwitchChnlParams( tpAniSirGlobal pMac,
5141 tDot11fIEHTInfo *pHTInfo,
5142 tANI_U8 bssIdx,
5143 tpPESession psessionEntry)
5144{
Jeff Johnsone7245742012-09-05 17:12:55 -07005145 ePhyChanBondState secondaryChnlOffset = PHY_SINGLE_CHANNEL_CENTERED;
Jeff Johnson295189b2012-06-20 16:38:30 -07005146#if !defined WLAN_FEATURE_VOWIFI
5147 tANI_U32 localPwrConstraint;
5148#endif
5149
5150 //If self capability is set to '20Mhz only', then do not change the CB mode.
Jeff Johnson295189b2012-06-20 16:38:30 -07005151 if( !limGetHTCapability( pMac, eHT_SUPPORTED_CHANNEL_WIDTH_SET, psessionEntry ))
Jeff Johnson295189b2012-06-20 16:38:30 -07005152 return;
5153
5154#if !defined WLAN_FEATURE_VOWIFI
5155 if(wlan_cfgGetInt(pMac, WNI_CFG_LOCAL_POWER_CONSTRAINT, &localPwrConstraint) != eSIR_SUCCESS) {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005156 limLog( pMac, LOGP, FL( "Unable to get Local Power Constraint from cfg" ));
Jeff Johnson295189b2012-06-20 16:38:30 -07005157 return;
5158 }
5159#endif
5160
Jeff Johnsone7245742012-09-05 17:12:55 -07005161 if ( psessionEntry->htSecondaryChannelOffset != ( tANI_U8 ) pHTInfo->secondaryChannelOffset ||
5162 psessionEntry->htRecommendedTxWidthSet != ( tANI_U8 ) pHTInfo->recommendedTxWidthSet )
Jeff Johnson295189b2012-06-20 16:38:30 -07005163 {
Jeff Johnsone7245742012-09-05 17:12:55 -07005164 psessionEntry->htSecondaryChannelOffset = ( ePhyChanBondState ) pHTInfo->secondaryChannelOffset;
5165 psessionEntry->htRecommendedTxWidthSet = ( tANI_U8 ) pHTInfo->recommendedTxWidthSet;
5166 if ( eHT_CHANNEL_WIDTH_40MHZ == psessionEntry->htRecommendedTxWidthSet )
5167 secondaryChnlOffset = (ePhyChanBondState)pHTInfo->secondaryChannelOffset;
Jeff Johnson295189b2012-06-20 16:38:30 -07005168
5169 // Notify HAL
5170 limLog( pMac, LOGW, FL( "Channel Information in HT IE change"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005171 "d; sending notification to HAL." ) );
Jeff Johnson295189b2012-06-20 16:38:30 -07005172 limLog( pMac, LOGW, FL( "Primary Channel: %d, Secondary Chan"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005173 "nel Offset: %d, Channel Width: %d" ),
Jeff Johnson295189b2012-06-20 16:38:30 -07005174 pHTInfo->primaryChannel, secondaryChnlOffset,
Jeff Johnsone7245742012-09-05 17:12:55 -07005175 psessionEntry->htRecommendedTxWidthSet );
Madan Mohan Koyyalamudifd322a02012-10-05 12:01:26 -07005176 psessionEntry->channelChangeReasonCode=LIM_SWITCH_CHANNEL_OPERATION;
5177 pMac->lim.gpchangeChannelCallback = NULL;
5178 pMac->lim.gpchangeChannelData = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07005179
5180#if defined WLAN_FEATURE_VOWIFI
5181 limSendSwitchChnlParams( pMac, ( tANI_U8 ) pHTInfo->primaryChannel,
5182 secondaryChnlOffset, psessionEntry->maxTxPower, psessionEntry->peSessionId);
5183#else
5184 limSendSwitchChnlParams( pMac, ( tANI_U8 ) pHTInfo->primaryChannel,
5185 secondaryChnlOffset, (tPowerdBm)localPwrConstraint, psessionEntry->peSessionId);
5186#endif
5187
5188 //In case of IBSS, if STA should update HT Info IE in its beacons.
5189 if (eLIM_STA_IN_IBSS_ROLE == psessionEntry->limSystemRole)
5190 {
5191 schSetFixedBeaconFields(pMac,psessionEntry);
5192 }
5193
5194 }
5195} // End limUpdateStaRunTimeHTParams.
5196
5197/**
5198 * \brief This function updates the lim global structure, if any of the
5199 * HT Capabilities have changed.
5200 *
5201 *
5202 * \param pMac Pointer to Global MAC structure
5203 *
5204 * \param pHTCapability Pointer to HT Capability Information Element
5205 * obtained from a Beacon or Probe Response
5206 *
5207 *
5208 *
5209 */
5210
5211void limUpdateStaRunTimeHTCapability( tpAniSirGlobal pMac,
5212 tDot11fIEHTCaps *pHTCaps )
5213{
5214
5215 if ( pMac->lim.gHTLsigTXOPProtection != ( tANI_U8 ) pHTCaps->lsigTXOPProtection )
5216 {
5217 pMac->lim.gHTLsigTXOPProtection = ( tANI_U8 ) pHTCaps->lsigTXOPProtection;
5218 // Send change notification to HAL
5219 }
5220
5221 if ( pMac->lim.gHTAMpduDensity != ( tANI_U8 ) pHTCaps->mpduDensity )
5222 {
5223 pMac->lim.gHTAMpduDensity = ( tANI_U8 ) pHTCaps->mpduDensity;
5224 // Send change notification to HAL
5225 }
5226
5227 if ( pMac->lim.gHTMaxRxAMpduFactor != ( tANI_U8 ) pHTCaps->maxRxAMPDUFactor )
5228 {
5229 pMac->lim.gHTMaxRxAMpduFactor = ( tANI_U8 ) pHTCaps->maxRxAMPDUFactor;
5230 // Send change notification to HAL
5231 }
5232
5233
5234} // End limUpdateStaRunTimeHTCapability.
5235
5236/**
5237 * \brief This function updates lim global structure, if any of the HT
5238 * Info Parameters have changed.
5239 *
5240 *
5241 * \param pMac Pointer to the global MAC structure
5242 *
5243 * \param pHTInfo Pointer to the HT Info IE obtained from a Beacon or
5244 * Probe Response
5245 *
5246 *
5247 */
5248
5249void limUpdateStaRunTimeHTInfo( tpAniSirGlobal pMac,
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305250 tDot11fIEHTInfo *pHTInfo, tpPESession psessionEntry)
Jeff Johnson295189b2012-06-20 16:38:30 -07005251{
Jeff Johnsone7245742012-09-05 17:12:55 -07005252 if ( psessionEntry->htRecommendedTxWidthSet != ( tANI_U8 )pHTInfo->recommendedTxWidthSet )
Jeff Johnson295189b2012-06-20 16:38:30 -07005253 {
Jeff Johnsone7245742012-09-05 17:12:55 -07005254 psessionEntry->htRecommendedTxWidthSet = ( tANI_U8 )pHTInfo->recommendedTxWidthSet;
Jeff Johnson295189b2012-06-20 16:38:30 -07005255 // Send change notification to HAL
5256 }
5257
5258 if ( psessionEntry->beaconParams.fRIFSMode != ( tANI_U8 )pHTInfo->rifsMode )
5259 {
5260 psessionEntry->beaconParams.fRIFSMode = ( tANI_U8 )pHTInfo->rifsMode;
5261 // Send change notification to HAL
5262 }
5263
5264 if ( pMac->lim.gHTServiceIntervalGranularity != ( tANI_U8 )pHTInfo->serviceIntervalGranularity )
5265 {
5266 pMac->lim.gHTServiceIntervalGranularity = ( tANI_U8 )pHTInfo->serviceIntervalGranularity;
5267 // Send change notification to HAL
5268 }
5269
5270 if ( pMac->lim.gHTOperMode != ( tSirMacHTOperatingMode )pHTInfo->opMode )
5271 {
5272 pMac->lim.gHTOperMode = ( tSirMacHTOperatingMode )pHTInfo->opMode;
5273 // Send change notification to HAL
5274 }
5275
5276 if ( psessionEntry->beaconParams.llnNonGFCoexist != pHTInfo->nonGFDevicesPresent )
5277 {
5278 psessionEntry->beaconParams.llnNonGFCoexist = ( tANI_U8 )pHTInfo->nonGFDevicesPresent;
5279 }
5280
5281 if ( pMac->lim.gHTSTBCBasicMCS != ( tANI_U8 )pHTInfo->basicSTBCMCS )
5282 {
5283 pMac->lim.gHTSTBCBasicMCS = ( tANI_U8 )pHTInfo->basicSTBCMCS;
5284 // Send change notification to HAL
5285 }
5286
5287 if ( pMac->lim.gHTDualCTSProtection != ( tANI_U8 )pHTInfo->dualCTSProtection )
5288 {
5289 pMac->lim.gHTDualCTSProtection = ( tANI_U8 )pHTInfo->dualCTSProtection;
5290 // Send change notification to HAL
5291 }
5292
5293 if ( pMac->lim.gHTSecondaryBeacon != ( tANI_U8 )pHTInfo->secondaryBeacon )
5294 {
5295 pMac->lim.gHTSecondaryBeacon = ( tANI_U8 )pHTInfo->secondaryBeacon;
5296 // Send change notification to HAL
5297 }
5298
5299 if ( psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport != ( tANI_U8 )pHTInfo->lsigTXOPProtectionFullSupport )
5300 {
5301 psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport = ( tANI_U8 )pHTInfo->lsigTXOPProtectionFullSupport;
5302 // Send change notification to HAL
5303 }
5304
5305 if ( pMac->lim.gHTPCOActive != ( tANI_U8 )pHTInfo->pcoActive )
5306 {
5307 pMac->lim.gHTPCOActive = ( tANI_U8 )pHTInfo->pcoActive;
5308 // Send change notification to HAL
5309 }
5310
5311 if ( pMac->lim.gHTPCOPhase != ( tANI_U8 )pHTInfo->pcoPhase )
5312 {
5313 pMac->lim.gHTPCOPhase = ( tANI_U8 )pHTInfo->pcoPhase;
5314 // Send change notification to HAL
5315 }
5316
5317} // End limUpdateStaRunTimeHTInfo.
5318
5319
5320/** -------------------------------------------------------------
5321\fn limProcessHalIndMessages
5322\brief callback function for HAL indication
5323\param tpAniSirGlobal pMac
5324\param tANI_U32 mesgId
5325\param void *mesgParam
5326\return tSirRetStatu - status
5327 -------------------------------------------------------------*/
5328
5329tSirRetStatus limProcessHalIndMessages(tpAniSirGlobal pMac, tANI_U32 msgId, void *msgParam )
5330{
5331 //its PE's responsibility to free msgparam when its done extracting the message parameters.
5332 tSirMsgQ msg;
5333
5334 switch(msgId)
5335 {
5336 case SIR_LIM_DEL_TS_IND:
5337 case SIR_LIM_ADD_BA_IND:
5338 case SIR_LIM_DEL_BA_ALL_IND:
5339 case SIR_LIM_DELETE_STA_CONTEXT_IND:
5340 case SIR_LIM_BEACON_GEN_IND:
5341 msg.type = (tANI_U16) msgId;
5342 msg.bodyptr = msgParam;
5343 msg.bodyval = 0;
5344 break;
5345
5346 default:
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305347 vos_mem_free(msgParam);
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005348 limLog(pMac, LOGP, FL("invalid message id = %d received"), msgId);
Jeff Johnson295189b2012-06-20 16:38:30 -07005349 return eSIR_FAILURE;
5350 }
5351
5352 if (limPostMsgApi(pMac, &msg) != eSIR_SUCCESS)
5353 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305354 vos_mem_free(msgParam);
Jeff Johnson295189b2012-06-20 16:38:30 -07005355 limLog(pMac, LOGP, FL("limPostMsgApi failed for msgid = %d"), msg.type);
5356 return eSIR_FAILURE;
5357 }
5358 return eSIR_SUCCESS;
5359}
5360
5361/** -------------------------------------------------------------
5362\fn limValidateDeltsReq
5363\brief Validates DelTs req originated by SME or by HAL and also sends halMsg_DelTs to HAL
5364\param tpAniSirGlobal pMac
5365\param tpSirDeltsReq pDeltsReq
5366\param tSirMacAddr peerMacAddr
5367\return eSirRetStatus - status
5368 -------------------------------------------------------------*/
5369
5370tSirRetStatus
5371limValidateDeltsReq(tpAniSirGlobal pMac, tpSirDeltsReq pDeltsReq, tSirMacAddr peerMacAddr,tpPESession psessionEntry)
5372{
5373 tpDphHashNode pSta;
5374 tANI_U8 tsStatus;
5375 tSirMacTSInfo *tsinfo;
5376 tANI_U32 i;
5377 tANI_U8 tspecIdx;
5378 /* if sta
5379 * - verify assoc state
5380 * - del tspec locally
5381 * if ap,
5382 * - verify sta is in assoc state
5383 * - del sta tspec locally
5384 */
5385 if(pDeltsReq == NULL)
5386 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005387 PELOGE(limLog(pMac, LOGE, FL("Delete TS request pointer is NULL"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005388 return eSIR_FAILURE;
5389 }
5390
5391 if ((psessionEntry->limSystemRole == eLIM_STA_ROLE)||(psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE))
5392 {
5393 tANI_U32 val;
5394
5395 // station always talks to the AP
5396 pSta = dphGetHashEntry(pMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable);
5397
5398 val = sizeof(tSirMacAddr);
5399 #if 0
5400 if (wlan_cfgGetStr(pMac, WNI_CFG_BSSID, peerMacAddr, &val) != eSIR_SUCCESS)
5401 {
5402 /// Could not get BSSID from CFG. Log error.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005403 limLog(pMac, LOGP, FL("could not retrieve BSSID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07005404 return eSIR_FAILURE;
5405 }
5406 #endif// TO SUPPORT BT-AMP
5407 sirCopyMacAddr(peerMacAddr,psessionEntry->bssId);
5408
5409 }
5410 else
5411 {
5412 tANI_U16 assocId;
5413 tANI_U8 *macaddr = (tANI_U8 *) peerMacAddr;
5414
5415 assocId = pDeltsReq->aid;
5416 if (assocId != 0)
5417 pSta = dphGetHashEntry(pMac, assocId, &psessionEntry->dph.dphHashTable);
5418 else
5419 pSta = dphLookupHashEntry(pMac, pDeltsReq->macAddr, &assocId, &psessionEntry->dph.dphHashTable);
5420
5421 if (pSta != NULL)
5422 // TBD: check sta assoc state as well
5423 for (i =0; i < sizeof(tSirMacAddr); i++)
5424 macaddr[i] = pSta->staAddr[i];
5425 }
5426
5427 if (pSta == NULL)
5428 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005429 PELOGE(limLog(pMac, LOGE, "Cannot find station context for delts req");)
Jeff Johnson295189b2012-06-20 16:38:30 -07005430 return eSIR_FAILURE;
5431 }
5432
5433 if ((! pSta->valid) ||
5434 (pSta->mlmStaContext.mlmState != eLIM_MLM_LINK_ESTABLISHED_STATE))
5435 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005436 PELOGE(limLog(pMac, LOGE, "Invalid Sta (or state) for DelTsReq");)
Jeff Johnson295189b2012-06-20 16:38:30 -07005437 return eSIR_FAILURE;
5438 }
5439
5440 pDeltsReq->req.wsmTspecPresent = 0;
5441 pDeltsReq->req.wmeTspecPresent = 0;
5442 pDeltsReq->req.lleTspecPresent = 0;
5443
5444 if ((pSta->wsmEnabled) &&
5445 (pDeltsReq->req.tspec.tsinfo.traffic.accessPolicy != SIR_MAC_ACCESSPOLICY_EDCA))
5446 pDeltsReq->req.wsmTspecPresent = 1;
5447 else if (pSta->wmeEnabled)
5448 pDeltsReq->req.wmeTspecPresent = 1;
5449 else if (pSta->lleEnabled)
5450 pDeltsReq->req.lleTspecPresent = 1;
5451 else
5452 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005453 PELOGW(limLog(pMac, LOGW, FL("DELTS_REQ ignore - qos is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005454 return eSIR_FAILURE;
5455 }
5456
5457 tsinfo = pDeltsReq->req.wmeTspecPresent ? &pDeltsReq->req.tspec.tsinfo
5458 : &pDeltsReq->req.tsinfo;
5459 PELOG1(limLog(pMac, LOG1,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005460 FL("received DELTS_REQ message (wmeTspecPresent = %d, lleTspecPresent = %d, wsmTspecPresent = %d, tsid %d, up %d, direction = %d)"),
Jeff Johnson295189b2012-06-20 16:38:30 -07005461 pDeltsReq->req.wmeTspecPresent, pDeltsReq->req.lleTspecPresent, pDeltsReq->req.wsmTspecPresent,
5462 tsinfo->traffic.tsid, tsinfo->traffic.userPrio, tsinfo->traffic.direction);)
5463
5464 // if no Access Control, ignore the request
Jeff Johnson295189b2012-06-20 16:38:30 -07005465
5466 if (limAdmitControlDeleteTS(pMac, pSta->assocId, tsinfo, &tsStatus, &tspecIdx)
5467 != eSIR_SUCCESS)
5468 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005469 PELOGE(limLog(pMac, LOGE, "ERROR DELTS request for sta assocId %d (tsid %d, up %d)",
Jeff Johnson295189b2012-06-20 16:38:30 -07005470 pSta->assocId, tsinfo->traffic.tsid, tsinfo->traffic.userPrio);)
5471 return eSIR_FAILURE;
5472 }
5473 else if ((tsinfo->traffic.accessPolicy == SIR_MAC_ACCESSPOLICY_HCCA) ||
5474 (tsinfo->traffic.accessPolicy == SIR_MAC_ACCESSPOLICY_BOTH))
5475 {
5476 //edca only now.
5477 }
5478 else
5479 {
5480 if((tsinfo->traffic.accessPolicy == SIR_MAC_ACCESSPOLICY_EDCA) &&
5481 psessionEntry->gLimEdcaParams[upToAc(tsinfo->traffic.userPrio)].aci.acm)
5482 {
5483 //send message to HAL to delete TS
Madan Mohan Koyyalamudic0a75a42013-10-07 04:20:49 +05305484 if(eSIR_SUCCESS != limSendHalMsgDelTs(pMac,
5485 pSta->staIndex,
5486 tspecIdx,
5487 pDeltsReq->req,
5488 psessionEntry->peSessionId,
5489 psessionEntry->bssId))
Jeff Johnson295189b2012-06-20 16:38:30 -07005490 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005491 limLog(pMac, LOGW, FL("DelTs with UP %d failed in limSendHalMsgDelTs - ignoring request"),
Jeff Johnson295189b2012-06-20 16:38:30 -07005492 tsinfo->traffic.userPrio);
5493 return eSIR_FAILURE;
5494 }
5495 }
5496 }
5497 return eSIR_SUCCESS;
5498}
5499
5500/** -------------------------------------------------------------
5501\fn limRegisterHalIndCallBack
5502\brief registers callback function to HAL for any indication.
5503\param tpAniSirGlobal pMac
5504\return none.
5505 -------------------------------------------------------------*/
5506void
5507limRegisterHalIndCallBack(tpAniSirGlobal pMac)
5508{
5509 tSirMsgQ msg;
5510 tpHalIndCB pHalCB;
5511
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305512 pHalCB = vos_mem_malloc(sizeof(tHalIndCB));
5513 if ( NULL == pHalCB )
Jeff Johnson295189b2012-06-20 16:38:30 -07005514 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305515 limLog(pMac, LOGP, FL("AllocateMemory() failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07005516 return;
5517 }
5518
5519 pHalCB->pHalIndCB = limProcessHalIndMessages;
5520
5521 msg.type = WDA_REGISTER_PE_CALLBACK;
5522 msg.bodyptr = pHalCB;
5523 msg.bodyval = 0;
5524
Jeff Johnsone7245742012-09-05 17:12:55 -07005525 MTRACE(macTraceMsgTx(pMac, NO_SESSION, msg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07005526 if(eSIR_SUCCESS != wdaPostCtrlMsg(pMac, &msg))
5527 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305528 vos_mem_free(pHalCB);
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005529 limLog(pMac, LOGP, FL("wdaPostCtrlMsg() failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07005530 }
5531
5532 return;
5533}
5534
5535
5536/** -------------------------------------------------------------
5537\fn limProcessAddBaInd
5538
5539\brief handles the BA activity check timeout indication coming from HAL.
5540 Validates the request, posts request for sending addBaReq message for every candidate in the list.
5541\param tpAniSirGlobal pMac
5542\param tSirMsgQ limMsg
5543\return None
5544-------------------------------------------------------------*/
5545void
5546limProcessAddBaInd(tpAniSirGlobal pMac, tpSirMsgQ limMsg)
5547{
5548 tANI_U8 i;
5549 tANI_U8 tid;
5550 tANI_U16 assocId;
5551 tpDphHashNode pSta;
5552 tpAddBaCandidate pBaCandidate;
5553 tANI_U32 baCandidateCnt;
5554 tpBaActivityInd pBaActivityInd;
5555 tpPESession psessionEntry;
5556 tANI_U8 sessionId;
Gopichand Nakkala681989c2013-03-06 22:27:48 -08005557#ifdef FEATURE_WLAN_TDLS
5558 boolean htCapable = FALSE;
5559#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07005560
5561
Gopichand Nakkala681989c2013-03-06 22:27:48 -08005562 if (limMsg->bodyptr == NULL)
Jeff Johnson295189b2012-06-20 16:38:30 -07005563 return;
5564
5565 pBaActivityInd = (tpBaActivityInd)limMsg->bodyptr;
5566 baCandidateCnt = pBaActivityInd->baCandidateCnt;
5567
Gopichand Nakkala681989c2013-03-06 22:27:48 -08005568 if ((psessionEntry = peFindSessionByBssid(pMac,pBaActivityInd->bssId,&sessionId))== NULL)
Jeff Johnson295189b2012-06-20 16:38:30 -07005569 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005570 limLog(pMac, LOGE,FL("session does not exist for given BSSId"));
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305571 vos_mem_free(limMsg->bodyptr);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08005572 limMsg->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07005573 return;
5574 }
5575
5576 //if we are not HT capable we don't need to handle BA timeout indication from HAL.
Gopichand Nakkala681989c2013-03-06 22:27:48 -08005577#ifdef FEATURE_WLAN_TDLS
5578 if ((baCandidateCnt > pMac->lim.maxStation))
5579#else
5580 if ((baCandidateCnt > pMac->lim.maxStation) || !psessionEntry->htCapability )
5581#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07005582 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305583 vos_mem_free(limMsg->bodyptr);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08005584 limMsg->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07005585 return;
5586 }
Gopichand Nakkala681989c2013-03-06 22:27:48 -08005587
5588#ifdef FEATURE_WLAN_TDLS
5589 //if we have TDLS peers, we should look at peers HT capability, which can be different than
5590 //AP capability
5591 pBaCandidate = (tpAddBaCandidate) (((tANI_U8*)pBaActivityInd) + sizeof(tBaActivityInd));
5592
5593 for (i=0; i<baCandidateCnt; i++, pBaCandidate++)
5594 {
5595 pSta = dphLookupHashEntry(pMac, pBaCandidate->staAddr, &assocId, &psessionEntry->dph.dphHashTable);
5596 if ((NULL == pSta) || (!pSta->valid))
5597 continue;
5598
5599 if (STA_ENTRY_TDLS_PEER == pSta->staType)
5600 htCapable = pSta->mlmStaContext.htCapability;
5601 else
5602 htCapable = psessionEntry->htCapability;
5603
5604 if (htCapable)
5605 break;
5606 }
5607 if (!htCapable)
5608 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305609 vos_mem_free(limMsg->bodyptr);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08005610 limMsg->bodyptr = NULL;
Gopichand Nakkala681989c2013-03-06 22:27:48 -08005611 return;
5612 }
5613#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07005614
5615 //delete the complete dialoguetoken linked list
5616 limDeleteDialogueTokenList(pMac);
5617 pBaCandidate = (tpAddBaCandidate) (((tANI_U8*)pBaActivityInd) + sizeof(tBaActivityInd));
5618
Gopichand Nakkala681989c2013-03-06 22:27:48 -08005619 for (i=0; i<baCandidateCnt; i++, pBaCandidate++)
Jeff Johnson295189b2012-06-20 16:38:30 -07005620 {
5621 pSta = dphLookupHashEntry(pMac, pBaCandidate->staAddr, &assocId, &psessionEntry->dph.dphHashTable);
Gopichand Nakkala681989c2013-03-06 22:27:48 -08005622 if ((NULL == pSta) || (!pSta->valid))
5623 continue;
Jeff Johnson295189b2012-06-20 16:38:30 -07005624
5625 for (tid=0; tid<STACFG_MAX_TC; tid++)
5626 {
Gopichand Nakkala681989c2013-03-06 22:27:48 -08005627 if((eBA_DISABLE == pSta->tcCfg[tid].fUseBATx) &&
Jeff Johnson295189b2012-06-20 16:38:30 -07005628 (pBaCandidate->baInfo[tid].fBaEnable))
5629 {
Hoonki Lee9af07cf2013-04-24 01:21:58 -07005630 limLog(pMac, LOGE, FL("BA setup for staId = %d, TID: %d, SSN: %d"),
5631 pSta->staIndex, tid, pBaCandidate->baInfo[tid].startingSeqNum);
Jeff Johnson295189b2012-06-20 16:38:30 -07005632 limPostMlmAddBAReq(pMac, pSta, tid, pBaCandidate->baInfo[tid].startingSeqNum,psessionEntry);
5633 }
5634 }
5635 }
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305636 vos_mem_free(limMsg->bodyptr);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08005637 limMsg->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07005638 return;
5639}
5640
5641
5642/** -------------------------------------------------------------
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005643\fn limDeleteBASessions
5644\brief Deletes all the exisitng BA sessions for given session
5645 and BA direction.
Jeff Johnson295189b2012-06-20 16:38:30 -07005646\param tpAniSirGlobal pMac
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005647\param tpPESession pSessionEntry
5648\param tANI_U32 baDirection
5649\return None
Jeff Johnson295189b2012-06-20 16:38:30 -07005650-------------------------------------------------------------*/
5651
5652void
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005653limDeleteBASessions(tpAniSirGlobal pMac, tpPESession pSessionEntry,
5654 tANI_U32 baDirection)
Jeff Johnson295189b2012-06-20 16:38:30 -07005655{
5656 tANI_U32 i;
5657 tANI_U8 tid;
5658 tpDphHashNode pSta;
5659
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005660 if (NULL == pSessionEntry)
Jeff Johnson295189b2012-06-20 16:38:30 -07005661 {
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005662 limLog(pMac, LOGE, FL("Session does not exist"));
5663 }
5664 else
5665 {
5666 for(tid = 0; tid < STACFG_MAX_TC; tid++)
Jeff Johnson295189b2012-06-20 16:38:30 -07005667 {
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005668 if ((eLIM_AP_ROLE == pSessionEntry->limSystemRole) ||
5669 (pSessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE) ||
5670 (eLIM_STA_IN_IBSS_ROLE == pSessionEntry->limSystemRole) ||
5671 (pSessionEntry->limSystemRole == eLIM_P2P_DEVICE_GO))
Jeff Johnson295189b2012-06-20 16:38:30 -07005672 {
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005673 for (i = 0; i < pMac->lim.maxStation; i++)
Jeff Johnson295189b2012-06-20 16:38:30 -07005674 {
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005675 pSta = pSessionEntry->dph.dphHashTable.pDphNodeArray + i;
5676 if (pSta && pSta->added)
Kiran Kumar Lokerec1641f52013-05-29 14:29:43 -07005677 {
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005678 if ((eBA_ENABLE == pSta->tcCfg[tid].fUseBATx) &&
5679 (baDirection & BA_INITIATOR))
5680 {
5681 limPostMlmDelBAReq(pMac, pSta, eBA_INITIATOR, tid,
5682 eSIR_MAC_UNSPEC_FAILURE_REASON,
5683 pSessionEntry);
5684 }
5685 if ((eBA_ENABLE == pSta->tcCfg[tid].fUseBARx) &&
5686 (baDirection & BA_RECIPIENT))
5687 {
5688 limPostMlmDelBAReq(pMac, pSta, eBA_RECIPIENT, tid,
5689 eSIR_MAC_UNSPEC_FAILURE_REASON,
5690 pSessionEntry);
5691 }
Kiran Kumar Lokerec1641f52013-05-29 14:29:43 -07005692 }
Jeff Johnson295189b2012-06-20 16:38:30 -07005693 }
5694 }
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005695 else if ((eLIM_STA_ROLE == pSessionEntry->limSystemRole) ||
5696 (eLIM_BT_AMP_STA_ROLE == pSessionEntry->limSystemRole) ||
5697 (eLIM_P2P_DEVICE_ROLE == pSessionEntry->limSystemRole))
Gopichand Nakkala6a36e142013-06-07 21:23:15 -07005698 {
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005699 pSta = dphGetHashEntry(pMac, DPH_STA_HASH_INDEX_PEER,
5700 &pSessionEntry->dph.dphHashTable);
5701 if (pSta && pSta->added)
Gopichand Nakkala6a36e142013-06-07 21:23:15 -07005702 {
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005703 if ((eBA_ENABLE == pSta->tcCfg[tid].fUseBATx) &&
5704 (baDirection & BA_INITIATOR))
5705 {
5706 limPostMlmDelBAReq(pMac, pSta, eBA_INITIATOR, tid,
5707 eSIR_MAC_UNSPEC_FAILURE_REASON,
5708 pSessionEntry);
5709 }
5710 if ((eBA_ENABLE == pSta->tcCfg[tid].fUseBARx) &&
5711 (baDirection & BA_RECIPIENT))
5712 {
5713 limPostMlmDelBAReq(pMac, pSta, eBA_RECIPIENT, tid,
5714 eSIR_MAC_UNSPEC_FAILURE_REASON,
5715 pSessionEntry);
5716 }
Gopichand Nakkala6a36e142013-06-07 21:23:15 -07005717 }
5718 }
5719 }
Jeff Johnson295189b2012-06-20 16:38:30 -07005720 }
5721}
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005722
5723/** -------------------------------------------------------------
5724\fn limDelAllBASessions
5725\brief Deletes all the exisitng BA sessions.
5726\param tpAniSirGlobal pMac
5727\return None
5728-------------------------------------------------------------*/
5729
5730void limDelAllBASessions(tpAniSirGlobal pMac)
5731{
5732 tANI_U32 i;
5733 tpPESession pSessionEntry;
5734
5735 for (i = 0; i < pMac->lim.maxBssId; i++)
5736 {
5737 pSessionEntry = peFindSessionBySessionId(pMac, i);
5738 if (pSessionEntry)
5739 {
5740 limDeleteBASessions(pMac, pSessionEntry, BA_BOTH_DIRECTIONS);
5741 }
5742 }
5743}
5744
5745/** -------------------------------------------------------------
5746\fn limDelAllBASessionsBtc
5747\brief Deletes all the exisitng BA receipent sessions in 2.4GHz
5748 band.
5749\param tpAniSirGlobal pMac
5750\return None
5751-------------------------------------------------------------*/
5752
Leela Venkata Kiran Kumar Reddy Chiralab8dadc22013-11-05 12:34:32 -08005753void limDelPerBssBASessionsBtc(tpAniSirGlobal pMac)
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005754{
Leela Venkata Kiran Kumar Reddy Chiralab8dadc22013-11-05 12:34:32 -08005755 tANI_U8 sessionId;
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005756 tpPESession pSessionEntry;
Leela Venkata Kiran Kumar Reddy Chiralab8dadc22013-11-05 12:34:32 -08005757 pSessionEntry = peFindSessionByBssid(pMac,pMac->btc.btcBssfordisableaggr,
5758 &sessionId);
5759 if (pSessionEntry)
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005760 {
Leela Venkata Kiran Kumar Reddy Chiralab8dadc22013-11-05 12:34:32 -08005761 PELOGW(limLog(pMac, LOGW,
5762 "Deleting the BA for session %d as host got BTC event", sessionId);)
5763 limDeleteBASessions(pMac, pSessionEntry, BA_RECIPIENT);
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005764 }
5765}
5766
Jeff Johnson295189b2012-06-20 16:38:30 -07005767/** -------------------------------------------------------------
5768\fn limProcessDelTsInd
5769\brief handles the DeleteTS indication coming from HAL or generated by PE itself in some error cases.
5770 Validates the request, sends the DelTs action frame to the Peer and sends DelTs indicatoin to HDD.
5771\param tpAniSirGlobal pMac
5772\param tSirMsgQ limMsg
5773\return None
5774-------------------------------------------------------------*/
5775void
5776limProcessDelTsInd(tpAniSirGlobal pMac, tpSirMsgQ limMsg)
5777{
5778 tpDphHashNode pSta;
5779 tpDelTsParams pDelTsParam = (tpDelTsParams) (limMsg->bodyptr);
5780 tpSirDeltsReq pDelTsReq = NULL;
5781 tSirMacAddr peerMacAddr;
5782 tpSirDeltsReqInfo pDelTsReqInfo;
5783 tpLimTspecInfo pTspecInfo;
5784 tpPESession psessionEntry;
5785 tANI_U8 sessionId;
5786
5787if((psessionEntry = peFindSessionByBssid(pMac,pDelTsParam->bssId,&sessionId))== NULL)
5788 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005789 limLog(pMac, LOGE,FL("session does not exist for given BssId"));
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305790 vos_mem_free(limMsg->bodyptr);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08005791 limMsg->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07005792 return;
5793 }
5794
5795 pTspecInfo = &(pMac->lim.tspecInfo[pDelTsParam->tspecIdx]);
5796 if(pTspecInfo->inuse == false)
5797 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005798 PELOGE(limLog(pMac, LOGE, FL("tspec entry with index %d is not in use"), pDelTsParam->tspecIdx);)
Jeff Johnson295189b2012-06-20 16:38:30 -07005799 goto error1;
5800 }
5801
5802 pSta = dphGetHashEntry(pMac, pTspecInfo->assocId, &psessionEntry->dph.dphHashTable);
5803 if(pSta == NULL)
5804 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005805 limLog(pMac, LOGE, FL("Could not find entry in DPH table for assocId = %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07005806 pTspecInfo->assocId);
5807 goto error1;
5808 }
5809
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305810 pDelTsReq = vos_mem_malloc(sizeof(tSirDeltsReq));
5811 if ( NULL == pDelTsReq )
Jeff Johnson295189b2012-06-20 16:38:30 -07005812 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305813 PELOGE(limLog(pMac, LOGE, FL("AllocateMemory() failed"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005814 goto error1;
5815 }
5816
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305817 vos_mem_set( (tANI_U8 *)pDelTsReq, sizeof(tSirDeltsReq), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07005818
5819 if(pSta->wmeEnabled)
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305820 vos_mem_copy( &(pDelTsReq->req.tspec), &(pTspecInfo->tspec), sizeof(tSirMacTspecIE));
Jeff Johnson295189b2012-06-20 16:38:30 -07005821 else
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305822 vos_mem_copy( &(pDelTsReq->req.tsinfo), &(pTspecInfo->tspec.tsinfo), sizeof(tSirMacTSInfo));
Jeff Johnson295189b2012-06-20 16:38:30 -07005823
5824
5825 //validate the req
5826 if (eSIR_SUCCESS != limValidateDeltsReq(pMac, pDelTsReq, peerMacAddr,psessionEntry))
5827 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005828 PELOGE(limLog(pMac, LOGE, FL("limValidateDeltsReq failed"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005829 goto error2;
5830 }
Arif Hussaina7c8e412013-11-20 11:06:42 -08005831 PELOG1(limLog(pMac, LOG1, "Sent DELTS request to station with "
5832 "assocId = %d MacAddr = "MAC_ADDRESS_STR,
5833 pDelTsReq->aid, MAC_ADDR_ARRAY(peerMacAddr));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005834
5835 limSendDeltsReqActionFrame(pMac, peerMacAddr, pDelTsReq->req.wmeTspecPresent, &pDelTsReq->req.tsinfo, &pDelTsReq->req.tspec,
5836 psessionEntry);
5837
5838 // prepare and send an sme indication to HDD
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305839 pDelTsReqInfo = vos_mem_malloc(sizeof(tSirDeltsReqInfo));
5840 if ( NULL == pDelTsReqInfo )
Jeff Johnson295189b2012-06-20 16:38:30 -07005841 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305842 PELOGE(limLog(pMac, LOGE, FL("AllocateMemory() failed"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005843 goto error3;
5844 }
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305845 vos_mem_set( (tANI_U8 *)pDelTsReqInfo, sizeof(tSirDeltsReqInfo), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07005846
5847 if(pSta->wmeEnabled)
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305848 vos_mem_copy( &(pDelTsReqInfo->tspec), &(pTspecInfo->tspec), sizeof(tSirMacTspecIE));
Jeff Johnson295189b2012-06-20 16:38:30 -07005849 else
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305850 vos_mem_copy( &(pDelTsReqInfo->tsinfo), &(pTspecInfo->tspec.tsinfo), sizeof(tSirMacTSInfo));
Jeff Johnson295189b2012-06-20 16:38:30 -07005851
5852 limSendSmeDeltsInd(pMac, pDelTsReqInfo, pDelTsReq->aid,psessionEntry);
5853
5854error3:
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305855 vos_mem_free(pDelTsReqInfo);
Jeff Johnson295189b2012-06-20 16:38:30 -07005856error2:
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305857 vos_mem_free(pDelTsReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07005858error1:
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305859 vos_mem_free(limMsg->bodyptr);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08005860 limMsg->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07005861 return;
5862}
5863
5864/**
5865 * \brief Setup an A-MPDU/BA session
5866 *
5867 * \sa limPostMlmAddBAReq
5868 *
5869 * \param pMac The global tpAniSirGlobal object
5870 *
5871 * \param pStaDs DPH Hash Node object of peer STA
5872 *
5873 * \param tid TID for which a BA is being setup.
5874 * If this is set to 0xFFFF, then we retrieve
5875 * the default TID from the CFG
5876 *
5877 * \return eSIR_SUCCESS if setup completes successfully
5878 * eSIR_FAILURE is some problem is encountered
5879 */
5880tSirRetStatus limPostMlmAddBAReq( tpAniSirGlobal pMac,
5881 tpDphHashNode pStaDs,
5882 tANI_U8 tid, tANI_U16 startingSeqNum,tpPESession psessionEntry)
5883{
5884 tSirRetStatus status = eSIR_SUCCESS;
Jeff Johnson09fb4cd2013-04-03 15:27:59 -07005885 tpLimMlmAddBAReq pMlmAddBAReq = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07005886 tpDialogueToken dialogueTokenNode;
5887 tANI_U32 val = 0;
Jeff Johnson09fb4cd2013-04-03 15:27:59 -07005888
Jeff Johnson295189b2012-06-20 16:38:30 -07005889 // Check if the peer is a 11n capable STA
5890 // FIXME - Need a 11n peer indication in DPH.
5891 // For now, using the taurusPeer attribute
5892 //if( 0 == pStaDs->taurusPeer == )
5893 //return eSIR_SUCCESS;
5894
5895 // Allocate for LIM_MLM_ADDBA_REQ
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305896 pMlmAddBAReq = vos_mem_malloc(sizeof( tLimMlmAddBAReq ));
5897 if ( NULL == pMlmAddBAReq )
Jeff Johnson295189b2012-06-20 16:38:30 -07005898 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305899 limLog( pMac, LOGP, FL("AllocateMemory failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07005900 status = eSIR_MEM_ALLOC_FAILED;
5901 goto returnFailure;
5902 }
5903
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305904 vos_mem_set( (void *) pMlmAddBAReq, sizeof( tLimMlmAddBAReq ), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07005905
5906 // Copy the peer MAC
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305907 vos_mem_copy(
Jeff Johnson295189b2012-06-20 16:38:30 -07005908 pMlmAddBAReq->peerMacAddr,
5909 pStaDs->staAddr,
5910 sizeof( tSirMacAddr ));
5911
5912 // Update the TID
5913 pMlmAddBAReq->baTID = tid;
5914
5915 // Determine the supported BA policy of local STA
5916 // for the TID of interest
5917 pMlmAddBAReq->baPolicy = (pStaDs->baPolicyFlag >> tid) & 0x1;
5918
5919 // BA Buffer Size
5920 // Requesting the ADDBA recipient to populate the size.
5921 // If ADDBA is accepted, a non-zero buffer size should
5922 // be returned in the ADDBA Rsp
Agarwal Ashish87039eb2014-01-15 14:13:15 +05305923 if ((TRUE == psessionEntry->isCiscoVendorAP) &&
5924 (eHT_CHANNEL_WIDTH_80MHZ != pStaDs->htSupportedChannelWidthSet))
5925 {
5926 /* Cisco AP has issues in receiving more than 25 "mpdu in ampdu"
5927 causing very low throughput in HT40 case */
5928 limLog( pMac, LOGW,
5929 FL( "Requesting ADDBA with Cisco 1225 AP, window size 25"));
5930 pMlmAddBAReq->baBufferSize = MAX_BA_WINDOW_SIZE_FOR_CISCO;
5931 }
5932 else
5933 pMlmAddBAReq->baBufferSize = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07005934
5935 limLog( pMac, LOGW,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005936 FL( "Requesting an ADDBA to setup a %s BA session with STA %d for TID %d" ),
Jeff Johnson295189b2012-06-20 16:38:30 -07005937 (pMlmAddBAReq->baPolicy ? "Immediate": "Delayed"),
5938 pStaDs->staIndex,
5939 tid );
5940
5941 // BA Timeout
Jeff Johnson09fb4cd2013-04-03 15:27:59 -07005942 if (wlan_cfgGetInt(pMac, WNI_CFG_BA_TIMEOUT, &val) != eSIR_SUCCESS)
Jeff Johnson295189b2012-06-20 16:38:30 -07005943 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005944 limLog(pMac, LOGE, FL("could not retrieve BA TIME OUT Param CFG"));
Jeff Johnson295189b2012-06-20 16:38:30 -07005945 status = eSIR_FAILURE;
5946 goto returnFailure;
5947 }
5948 pMlmAddBAReq->baTimeout = val; // In TU's
5949
5950 // ADDBA Failure Timeout
Jeff Johnson09fb4cd2013-04-03 15:27:59 -07005951 // FIXME_AMPDU - Need to retrieve this from CFG.
Jeff Johnson295189b2012-06-20 16:38:30 -07005952 //right now we are not checking for response timeout. so this field is dummy just to be compliant with the spec.
5953 pMlmAddBAReq->addBAFailureTimeout = 2000; // In TU's
5954
5955 // BA Starting Sequence Number
5956 pMlmAddBAReq->baSSN = startingSeqNum;
5957
5958 /* Update PE session Id*/
5959 pMlmAddBAReq->sessionId = psessionEntry->peSessionId;
5960
5961 LIM_SET_STA_BA_STATE(pStaDs, tid, eLIM_BA_STATE_WT_ADD_RSP);
5962
Jeff Johnson09fb4cd2013-04-03 15:27:59 -07005963 dialogueTokenNode = limAssignDialogueToken(pMac);
5964 if (NULL == dialogueTokenNode)
5965 {
5966 limLog(pMac, LOGE, FL("could not assign dialogue token"));
5967 status = eSIR_FAILURE;
5968 goto returnFailure;
5969 }
5970
Jeff Johnson295189b2012-06-20 16:38:30 -07005971 pMlmAddBAReq->baDialogToken = dialogueTokenNode->token;
Jeff Johnson09fb4cd2013-04-03 15:27:59 -07005972 //set assocId and tid information in the lim linked list
Jeff Johnson295189b2012-06-20 16:38:30 -07005973 dialogueTokenNode->assocId = pStaDs->assocId;
5974 dialogueTokenNode->tid = tid;
5975 // Send ADDBA Req to MLME
5976 limPostMlmMessage( pMac,
5977 LIM_MLM_ADDBA_REQ,
5978 (tANI_U32 *) pMlmAddBAReq );
Jeff Johnson09fb4cd2013-04-03 15:27:59 -07005979 return eSIR_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -07005980
5981returnFailure:
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305982 vos_mem_free(pMlmAddBAReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07005983 return status;
5984}
5985
5986/**
5987 * \brief Post LIM_MLM_ADDBA_RSP to MLME. MLME
5988 * will then send an ADDBA Rsp to peer MAC entity
5989 * with the appropriate ADDBA status code
5990 *
5991 * \sa limPostMlmAddBARsp
5992 *
5993 * \param pMac The global tpAniSirGlobal object
5994 *
5995 * \param peerMacAddr MAC address of peer entity that will
5996 * be the recipient of this ADDBA Rsp
5997 *
5998 * \param baStatusCode ADDBA Rsp status code
5999 *
6000 * \param baDialogToken ADDBA Rsp dialog token
6001 *
6002 * \param baTID TID of interest
6003 *
6004 * \param baPolicy The BA policy
6005 *
6006 * \param baBufferSize The BA buffer size
6007 *
6008 * \param baTimeout BA timeout in TU's
6009 *
6010 * \return eSIR_SUCCESS if setup completes successfully
6011 * eSIR_FAILURE is some problem is encountered
6012 */
6013tSirRetStatus limPostMlmAddBARsp( tpAniSirGlobal pMac,
6014 tSirMacAddr peerMacAddr,
6015 tSirMacStatusCodes baStatusCode,
6016 tANI_U8 baDialogToken,
6017 tANI_U8 baTID,
6018 tANI_U8 baPolicy,
6019 tANI_U16 baBufferSize,
6020 tANI_U16 baTimeout,
6021 tpPESession psessionEntry)
6022{
6023tSirRetStatus status = eSIR_SUCCESS;
6024tpLimMlmAddBARsp pMlmAddBARsp;
6025
6026 // Allocate for LIM_MLM_ADDBA_RSP
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306027 pMlmAddBARsp = vos_mem_malloc(sizeof( tLimMlmAddBARsp ));
6028 if ( NULL == pMlmAddBARsp )
Jeff Johnson295189b2012-06-20 16:38:30 -07006029 {
6030 limLog( pMac, LOGE,
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306031 FL("AllocateMemory failed with error code %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07006032 status );
6033
6034 status = eSIR_MEM_ALLOC_FAILED;
6035 goto returnFailure;
6036 }
6037
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306038 vos_mem_set( (void *) pMlmAddBARsp, sizeof( tLimMlmAddBARsp ), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07006039
6040 // Copy the peer MAC
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306041 vos_mem_copy(
Jeff Johnson295189b2012-06-20 16:38:30 -07006042 pMlmAddBARsp->peerMacAddr,
6043 peerMacAddr,
6044 sizeof( tSirMacAddr ));
6045
6046 pMlmAddBARsp->baDialogToken = baDialogToken;
6047 pMlmAddBARsp->addBAResultCode = baStatusCode;
6048 pMlmAddBARsp->baTID = baTID;
6049 pMlmAddBARsp->baPolicy = baPolicy;
6050 pMlmAddBARsp->baBufferSize = baBufferSize;
6051 pMlmAddBARsp->baTimeout = baTimeout;
6052
6053 /* UPdate PE session ID*/
6054 pMlmAddBARsp->sessionId = psessionEntry->peSessionId;
6055
6056 // Send ADDBA Rsp to MLME
6057 limPostMlmMessage( pMac,
6058 LIM_MLM_ADDBA_RSP,
6059 (tANI_U32 *) pMlmAddBARsp );
6060
6061returnFailure:
6062
6063 return status;
6064}
6065
6066/**
6067 * \brief Post LIM_MLM_DELBA_REQ to MLME. MLME
6068 * will then send an DELBA Ind to peer MAC entity
6069 * with the appropriate DELBA status code
6070 *
6071 * \sa limPostMlmDelBAReq
6072 *
6073 * \param pMac The global tpAniSirGlobal object
6074 *
6075 * \param pSta DPH Hash Node object of peer MAC entity
6076 * for which the BA session is being deleted
6077 *
6078 * \param baDirection DELBA direction
6079 *
6080 * \param baTID TID for which the BA session is being deleted
6081 *
6082 * \param baReasonCode DELBA Req reason code
6083 *
6084 * \return eSIR_SUCCESS if setup completes successfully
6085 * eSIR_FAILURE is some problem is encountered
6086 */
6087tSirRetStatus limPostMlmDelBAReq( tpAniSirGlobal pMac,
6088 tpDphHashNode pSta,
6089 tANI_U8 baDirection,
6090 tANI_U8 baTID,
6091 tSirMacReasonCodes baReasonCode,
6092 tpPESession psessionEntry)
6093{
6094tSirRetStatus status = eSIR_SUCCESS;
6095tpLimMlmDelBAReq pMlmDelBAReq;
6096tLimBAState curBaState;
6097
6098if(NULL == pSta)
6099 return eSIR_FAILURE;
6100
6101LIM_GET_STA_BA_STATE(pSta, baTID, &curBaState);
6102
6103 // Need to validate the current BA State.
6104 if( eLIM_BA_STATE_IDLE != curBaState)
6105 {
6106 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006107 FL( "Received unexpected DELBA REQ when STA BA state for tid = %d is %d" ),
Jeff Johnson295189b2012-06-20 16:38:30 -07006108 baTID,
6109 curBaState);
6110
6111 status = eSIR_FAILURE;
6112 goto returnFailure;
6113 }
6114
6115 // Allocate for LIM_MLM_DELBA_REQ
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306116 pMlmDelBAReq = vos_mem_malloc(sizeof( tLimMlmDelBAReq ));
6117 if ( NULL == pMlmDelBAReq )
Jeff Johnson295189b2012-06-20 16:38:30 -07006118 {
6119 limLog( pMac, LOGE,
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306120 FL("AllocateMemory failed with error code %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07006121 status );
6122
6123 status = eSIR_MEM_ALLOC_FAILED;
6124 goto returnFailure;
6125 }
6126
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306127 vos_mem_set( (void *) pMlmDelBAReq, sizeof( tLimMlmDelBAReq ), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07006128
6129 // Copy the peer MAC
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306130 vos_mem_copy(
Jeff Johnson295189b2012-06-20 16:38:30 -07006131 pMlmDelBAReq->peerMacAddr,
6132 pSta->staAddr,
6133 sizeof( tSirMacAddr ));
6134
6135 pMlmDelBAReq->baDirection = baDirection;
6136 pMlmDelBAReq->baTID = baTID;
6137 pMlmDelBAReq->delBAReasonCode = baReasonCode;
6138
6139 /* Update PE session ID*/
6140 pMlmDelBAReq->sessionId = psessionEntry->peSessionId;
6141
6142 //we don't have valid BA session for the given direction.
6143 // HDD wants to get the BA session deleted on PEER in this case.
6144 // in this case we just need to send DelBA to the peer.
6145 if(((eBA_RECIPIENT == baDirection) && (eBA_DISABLE == pSta->tcCfg[baTID].fUseBARx)) ||
6146 ((eBA_INITIATOR == baDirection) && (eBA_DISABLE == pSta->tcCfg[baTID].fUseBATx)))
6147 {
6148 // Send DELBA Ind over the air
6149 if( eSIR_SUCCESS !=
6150 (status = limSendDelBAInd( pMac, pMlmDelBAReq,psessionEntry)))
6151 status = eSIR_FAILURE;
6152
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306153 vos_mem_free(pMlmDelBAReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07006154 return status;
6155 }
6156
6157
6158 // Update the BA state in STA
6159 LIM_SET_STA_BA_STATE(pSta, pMlmDelBAReq->baTID, eLIM_BA_STATE_WT_DEL_RSP);
6160
6161 // Send DELBA Req to MLME
6162 limPostMlmMessage( pMac,
6163 LIM_MLM_DELBA_REQ,
6164 (tANI_U32 *) pMlmDelBAReq );
6165
6166returnFailure:
6167
6168 return status;
6169}
6170
6171/**
6172 * \brief Send WDA_ADDBA_REQ to HAL, in order
6173 * to setup a new BA session with a peer
6174 *
6175 * \sa limPostMsgAddBAReq
6176 *
6177 * \param pMac The global tpAniSirGlobal object
6178 *
6179 * \param pSta Runtime, STA-related configuration cached
6180 * in the HashNode object
6181 *
6182 * \param baDialogToken The Action Frame dialog token
6183 *
6184 * \param baTID TID for which the BA session is being setup
6185 *
6186 * \param baPolicy BA Policy
6187 *
6188 * \param baBufferSize The requested BA buffer size
6189 *
6190 * \param baTimeout BA Timeout. 0 indicates no BA timeout enforced
6191 *
6192 * \param baSSN Starting Sequence Number for this BA session
6193 *
6194 * \param baDirection BA Direction: 1 - Initiator, 0 - Recipient
6195 *
6196 * \return none
6197 *
6198 */
6199tSirRetStatus limPostMsgAddBAReq( tpAniSirGlobal pMac,
6200 tpDphHashNode pSta,
6201 tANI_U8 baDialogToken,
6202 tANI_U8 baTID,
6203 tANI_U8 baPolicy,
6204 tANI_U16 baBufferSize,
6205 tANI_U16 baTimeout,
6206 tANI_U16 baSSN,
6207 tANI_U8 baDirection,
6208 tpPESession psessionEntry)
6209{
6210tpAddBAParams pAddBAParams = NULL;
6211tSirRetStatus retCode = eSIR_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -07006212tSirMsgQ msgQ;
6213
6214#ifdef WLAN_SOFTAP_VSTA_FEATURE
6215 // we can only do BA on "hard" STAs
6216 if (!(IS_HWSTA_IDX(pSta->staIndex)))
6217 {
6218 retCode = eHAL_STATUS_FAILURE;
6219 goto returnFailure;
6220 }
6221#endif //WLAN_SOFTAP_VSTA_FEATURE
6222
6223 // Allocate for WDA_ADDBA_REQ
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306224 pAddBAParams = vos_mem_malloc(sizeof( tAddBAParams ));
6225 if ( NULL == pAddBAParams )
Jeff Johnson295189b2012-06-20 16:38:30 -07006226 {
6227 limLog( pMac, LOGE,
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306228 FL("AllocateMemory failed")
6229 );
Jeff Johnson295189b2012-06-20 16:38:30 -07006230
6231 retCode = eSIR_MEM_ALLOC_FAILED;
6232 goto returnFailure;
6233 }
6234
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306235 vos_mem_set( (void *) pAddBAParams, sizeof( tAddBAParams ), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07006236
6237 // Copy the peer MAC address
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306238 vos_mem_copy(
Jeff Johnson295189b2012-06-20 16:38:30 -07006239 (void *) pAddBAParams->peerMacAddr,
6240 (void *) pSta->staAddr,
6241 sizeof( tSirMacAddr ));
6242
6243 // Populate the REQ parameters
6244 pAddBAParams->staIdx = pSta->staIndex;
6245 pAddBAParams->baDialogToken = baDialogToken;
6246 pAddBAParams->baTID = baTID;
6247 pAddBAParams->baPolicy = baPolicy;
6248 pAddBAParams->baBufferSize = baBufferSize;
6249 pAddBAParams->baTimeout = baTimeout;
6250 pAddBAParams->baSSN = baSSN;
6251 pAddBAParams->baDirection = baDirection;
6252 pAddBAParams->respReqd = 1;
6253
6254 /* UPdate PE session ID */
6255 pAddBAParams->sessionId = psessionEntry->peSessionId;
6256
6257 // Post WDA_ADDBA_REQ to HAL.
6258 msgQ.type = WDA_ADDBA_REQ;
6259 //
6260 // FIXME_AMPDU
6261 // A global counter (dialog token) is required to keep track of
6262 // all PE <-> HAL communication(s)
6263 //
6264 msgQ.reserved = 0;
6265 msgQ.bodyptr = pAddBAParams;
6266 msgQ.bodyval = 0;
6267
6268 limLog( pMac, LOGW,
6269 FL( "Sending WDA_ADDBA_REQ..." ));
6270
6271 //defer any other message until we get response back.
6272 SET_LIM_PROCESS_DEFD_MESGS(pMac, false);
6273
Jeff Johnsone7245742012-09-05 17:12:55 -07006274 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07006275#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
6276 limDiagEventReport(pMac, WLAN_PE_DIAG_HAL_ADDBA_REQ_EVENT, psessionEntry, 0, 0);
6277#endif //FEATURE_WLAN_DIAG_SUPPORT
6278
6279 if( eSIR_SUCCESS != (retCode = wdaPostCtrlMsg( pMac, &msgQ )))
6280 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006281 FL("Posting WDA_ADDBA_REQ to HAL failed! Reason = %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07006282 retCode );
6283 else
6284 return retCode;
6285
6286returnFailure:
6287
6288 // Clean-up...
6289 if( NULL != pAddBAParams )
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306290 vos_mem_free( pAddBAParams );
Jeff Johnson295189b2012-06-20 16:38:30 -07006291
6292 return retCode;
6293
6294}
6295
6296/**
6297 * \brief Send WDA_DELBA_IND to HAL, in order
6298 * to delete an existing BA session with peer
6299 *
6300 * \sa limPostMsgDelBAInd
6301 *
6302 * \param pMac The global tpAniSirGlobal object
6303 *
6304 * \param pSta Runtime, STA-related configuration cached
6305 * in the HashNode object
6306 *
6307 * \param baTID TID for which the BA session is being setup
6308 *
6309 * \param baDirection Identifies whether the DELBA Ind was
6310 * sent by the BA initiator or recipient
6311 *
6312 * \return none
6313 *
6314 */
6315tSirRetStatus limPostMsgDelBAInd( tpAniSirGlobal pMac,
6316 tpDphHashNode pSta,
6317 tANI_U8 baTID,
6318 tANI_U8 baDirection,
6319 tpPESession psessionEntry)
6320{
6321tpDelBAParams pDelBAParams = NULL;
6322tSirRetStatus retCode = eSIR_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -07006323tSirMsgQ msgQ;
6324
6325 // Allocate for SIR_HAL_DELBA_IND
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306326 pDelBAParams = vos_mem_malloc(sizeof( tDelBAParams ));
6327 if ( NULL == pDelBAParams )
Jeff Johnson295189b2012-06-20 16:38:30 -07006328 {
6329 limLog( pMac, LOGE,
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306330 FL("AllocateMemory failed")
6331 );
Jeff Johnson295189b2012-06-20 16:38:30 -07006332
6333 retCode = eSIR_MEM_ALLOC_FAILED;
6334 goto returnFailure;
6335 }
6336
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306337 vos_mem_set( (void *) pDelBAParams, sizeof( tDelBAParams ), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07006338
6339 // Populate the REQ parameters
6340 pDelBAParams->staIdx = pSta->staIndex;
6341 pDelBAParams->baTID = baTID;
6342 pDelBAParams->baDirection = baDirection;
6343
6344 /* Update PE session ID */
6345
6346
6347 //TBD-RAJESH Updating of the session ID is requird for SIR_HAL_DELBA_IND?????
6348 //pDelBAParams->sessionId = psessionEntry->peSessionId;
6349
6350 // Post WDA_DELBA_IND to HAL.
6351 msgQ.type = WDA_DELBA_IND;
6352 //
6353 // FIXME:
6354 // A global counter (dialog token) is required to keep track of
6355 // all PE <-> HAL communication(s)
6356 //
6357 msgQ.reserved = 0;
6358 msgQ.bodyptr = pDelBAParams;
6359 msgQ.bodyval = 0;
6360
6361 limLog( pMac, LOGW,
6362 FL( "Sending SIR_HAL_DELBA_IND..." ));
6363
Jeff Johnsone7245742012-09-05 17:12:55 -07006364 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07006365#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
6366 limDiagEventReport(pMac, WLAN_PE_DIAG_HAL_DELBA_IND_EVENT, psessionEntry, 0, 0);
6367#endif //FEATURE_WLAN_DIAG_SUPPORT
6368
6369 if( eSIR_SUCCESS != (retCode = wdaPostCtrlMsg( pMac, &msgQ )))
6370 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006371 FL("Posting WDA_DELBA_IND to HAL failed! Reason = %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07006372 retCode );
6373 else
6374 {
6375 // Update LIM's internal cache...
6376 if( eBA_INITIATOR == baDirection)
6377 {
6378 pSta->tcCfg[baTID].fUseBATx = 0;
6379 pSta->tcCfg[baTID].txBufSize = 0;
6380 }
6381 else
6382 {
6383 pSta->tcCfg[baTID].fUseBARx = 0;
6384 pSta->tcCfg[baTID].rxBufSize = 0;
6385 }
6386
6387 return retCode;
6388 }
6389
6390returnFailure:
6391
6392 // Clean-up...
6393 if( NULL != pDelBAParams )
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306394 vos_mem_free( pDelBAParams );
Jeff Johnson295189b2012-06-20 16:38:30 -07006395
6396 return retCode;
6397
6398}
6399
6400/**
6401 * @function : limPostSMStateUpdate()
6402 *
6403 * @brief : This function Updates the HAL and Softmac about the change in the STA's SMPS state.
6404 *
6405 * LOGIC:
6406 *
6407 * ASSUMPTIONS:
6408 * NA
6409 *
6410 * NOTE:
6411 * NA
6412 *
6413 * @param pMac - Pointer to Global MAC structure
6414 * @param limMsg - Lim Message structure object with the MimoPSparam in body
6415 * @return None
6416 */
6417tSirRetStatus
6418limPostSMStateUpdate(tpAniSirGlobal pMac,
6419 tANI_U16 staIdx, tSirMacHTMIMOPowerSaveState state)
6420{
6421 tSirRetStatus retCode = eSIR_SUCCESS;
6422 tSirMsgQ msgQ;
Jeff Johnson295189b2012-06-20 16:38:30 -07006423 tpSetMIMOPS pMIMO_PSParams;
6424
6425 msgQ.reserved = 0;
6426 msgQ.type = WDA_SET_MIMOPS_REQ;
6427
6428 // Allocate for WDA_SET_MIMOPS_REQ
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306429 pMIMO_PSParams = vos_mem_malloc(sizeof(tSetMIMOPS));
6430 if ( NULL == pMIMO_PSParams )
6431 {
6432 limLog( pMac, LOGP,FL(" AllocateMemory failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07006433 return eSIR_MEM_ALLOC_FAILED;
6434 }
6435
6436 pMIMO_PSParams->htMIMOPSState = state;
6437 pMIMO_PSParams->staIdx = staIdx;
6438 pMIMO_PSParams->fsendRsp = true;
6439 msgQ.bodyptr = pMIMO_PSParams;
6440 msgQ.bodyval = 0;
6441
6442 limLog( pMac, LOG2, FL( "Sending WDA_SET_MIMOPS_REQ..." ));
6443
Jeff Johnsone7245742012-09-05 17:12:55 -07006444 MTRACE(macTraceMsgTx(pMac, NO_SESSION, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07006445 retCode = wdaPostCtrlMsg( pMac, &msgQ );
6446 if (eSIR_SUCCESS != retCode)
6447 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006448 limLog( pMac, LOGP, FL("Posting WDA_SET_MIMOPS_REQ to HAL failed! Reason = %d"), retCode );
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306449 vos_mem_free(pMIMO_PSParams);
Jeff Johnson295189b2012-06-20 16:38:30 -07006450 return retCode;
6451 }
6452
6453 return retCode;
6454}
6455
6456void limPktFree (
6457 tpAniSirGlobal pMac,
6458 eFrameType frmType,
6459 tANI_U8 *pRxPacketInfo,
6460 void *pBody)
6461{
6462 (void) pMac; (void) frmType; (void) pRxPacketInfo; (void) pBody;
Jeff Johnson295189b2012-06-20 16:38:30 -07006463}
6464
6465/**
6466 * limGetBDfromRxPacket()
6467 *
6468 *FUNCTION:
6469 * This function is called to get pointer to Polaris
6470 * Buffer Descriptor containing MAC header & other control
6471 * info from the body of the message posted to LIM.
6472 *
6473 *LOGIC:
6474 * NA
6475 *
6476 *ASSUMPTIONS:
6477 * NA
6478 *
6479 *NOTE:
6480 * NA
6481 *
6482 * @param body - Received message body
6483 * @param pRxPacketInfo - Pointer to received BD
6484 * @return None
6485 */
6486
6487void
6488limGetBDfromRxPacket(tpAniSirGlobal pMac, void *body, tANI_U32 **pRxPacketInfo)
6489{
Jeff Johnson295189b2012-06-20 16:38:30 -07006490 *pRxPacketInfo = (tANI_U32 *) body;
Jeff Johnson295189b2012-06-20 16:38:30 -07006491} /*** end limGetBDfromRxPacket() ***/
6492
6493
6494
6495
6496
6497void limRessetScanChannelInfo(tpAniSirGlobal pMac)
6498{
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306499 vos_mem_set(&pMac->lim.scanChnInfo, sizeof(tLimScanChnInfo), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07006500}
6501
6502
6503void limAddScanChannelInfo(tpAniSirGlobal pMac, tANI_U8 channelId)
6504{
6505 tANI_U8 i;
6506 tANI_BOOLEAN fFound = eANI_BOOLEAN_FALSE;
6507
6508 for(i = 0; i < pMac->lim.scanChnInfo.numChnInfo; i++)
6509 {
6510 if(pMac->lim.scanChnInfo.scanChn[i].channelId == channelId)
6511 {
6512 pMac->lim.scanChnInfo.scanChn[i].numTimeScan++;
6513 fFound = eANI_BOOLEAN_TRUE;
6514 break;
6515 }
6516 }
6517 if(eANI_BOOLEAN_FALSE == fFound)
6518 {
6519 if(pMac->lim.scanChnInfo.numChnInfo < SIR_MAX_SUPPORTED_CHANNEL_LIST)
6520 {
6521 pMac->lim.scanChnInfo.scanChn[pMac->lim.scanChnInfo.numChnInfo].channelId = channelId;
6522 pMac->lim.scanChnInfo.scanChn[pMac->lim.scanChnInfo.numChnInfo++].numTimeScan = 1;
6523 }
6524 else
6525 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006526 PELOGW(limLog(pMac, LOGW, FL(" -- number of channels exceed mac"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07006527 }
6528 }
6529}
6530
6531
6532/**
6533 * @function : limIsChannelValidForChannelSwitch()
6534 *
6535 * @brief : This function checks if the channel to which AP
6536 * is expecting us to switch, is a valid channel for us.
6537 * LOGIC:
6538 *
6539 * ASSUMPTIONS:
6540 * NA
6541 *
6542 * NOTE:
6543 * NA
6544 *
6545 * @param pMac - Pointer to Global MAC structure
6546 * @param channel - New channel to which we are expected to move
6547 * @return None
6548 */
6549tAniBool
6550limIsChannelValidForChannelSwitch(tpAniSirGlobal pMac, tANI_U8 channel)
6551{
6552 tANI_U8 index;
6553 tANI_U32 validChannelListLen = WNI_CFG_VALID_CHANNEL_LIST_LEN;
6554 tSirMacChanNum validChannelList[WNI_CFG_VALID_CHANNEL_LIST_LEN];
6555
6556 if (wlan_cfgGetStr(pMac, WNI_CFG_VALID_CHANNEL_LIST,
6557 (tANI_U8 *)validChannelList,
6558 (tANI_U32 *)&validChannelListLen) != eSIR_SUCCESS)
6559 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006560 PELOGE(limLog(pMac, LOGE, FL("could not retrieve valid channel list"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07006561 return (eSIR_FALSE);
6562 }
6563
6564 for(index = 0; index < validChannelListLen; index++)
6565 {
6566 if(validChannelList[index] == channel)
6567 return (eSIR_TRUE);
6568 }
6569
6570 /* channel does not belong to list of valid channels */
6571 return (eSIR_FALSE);
6572}
6573
6574/**------------------------------------------------------
6575\fn __limFillTxControlParams
6576\brief Fill the message for stopping/resuming tx.
6577
6578\param pMac
6579\param pTxCtrlMsg - Pointer to tx control message.
6580\param type - Which way we want to stop/ resume tx.
6581\param mode - To stop/resume.
6582 -------------------------------------------------------*/
6583static eHalStatus
6584__limFillTxControlParams(tpAniSirGlobal pMac, tpTxControlParams pTxCtrlMsg,
6585 tLimQuietTxMode type, tLimControlTx mode)
6586{
6587
6588 //TBD-RAJESH HOW TO GET sessionEntry?????
6589 tpPESession psessionEntry = &pMac->lim.gpSession[0];
6590
6591 if (mode == eLIM_STOP_TX)
6592 pTxCtrlMsg->stopTx = eANI_BOOLEAN_TRUE;
6593 else
6594 pTxCtrlMsg->stopTx = eANI_BOOLEAN_FALSE;
6595
6596 switch (type)
6597 {
6598 case eLIM_TX_ALL:
6599 /** Stops/resumes transmission completely */
6600 pTxCtrlMsg->fCtrlGlobal = 1;
6601 break;
6602
6603 case eLIM_TX_BSS_BUT_BEACON:
6604 /** Stops/resumes transmission on a particular BSS. Stopping BSS, doesnt
6605 * stop beacon transmission.
6606 */
6607 pTxCtrlMsg->ctrlBss = 1;
6608 pTxCtrlMsg->bssBitmap |= (1 << psessionEntry->bssIdx);
6609 break;
6610
6611 case eLIM_TX_STA:
6612 /** Memory for station bitmap is allocated dynamically in caller of this
6613 * so decode properly here and fill the bitmap. Now not implemented,
6614 * fall through.
6615 */
6616 case eLIM_TX_BSS:
6617 //Fall thru...
6618 default:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006619 PELOGW(limLog(pMac, LOGW, FL("Invalid case: Not Handled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07006620 return eHAL_STATUS_FAILURE;
6621 }
6622
6623 return eHAL_STATUS_SUCCESS;
6624}
6625
6626/**
6627 * @function : limFrameTransmissionControl()
6628 *
6629 * @brief : This API is called by the user to halt/resume any frame
6630 * transmission from the device. If stopped, all frames will be
6631 * queued starting from hardware. Then back-pressure
6632 * is built till the driver.
6633 * LOGIC:
6634 *
6635 * ASSUMPTIONS:
6636 * NA
6637 *
6638 * NOTE:
6639 * NA
6640 *
6641 * @param pMac - Pointer to Global MAC structure
6642 * @return None
6643 */
6644void limFrameTransmissionControl(tpAniSirGlobal pMac, tLimQuietTxMode type, tLimControlTx mode)
6645{
6646
6647 eHalStatus status = eHAL_STATUS_FAILURE;
6648 tpTxControlParams pTxCtrlMsg;
6649 tSirMsgQ msgQ;
6650 tANI_U8 nBytes = 0; // No of bytes required for station bitmap.
6651
6652 /** Allocate only required number of bytes for station bitmap
6653 * Make it to align to 4 byte boundary */
6654 nBytes = (tANI_U8)HALMSG_NUMBYTES_STATION_BITMAP(pMac->lim.maxStation);
6655
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306656 pTxCtrlMsg = vos_mem_malloc(sizeof(*pTxCtrlMsg) + nBytes);
6657 if ( NULL == pTxCtrlMsg )
Jeff Johnson295189b2012-06-20 16:38:30 -07006658 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306659 limLog(pMac, LOGP, FL("AllocateMemory() failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07006660 return;
6661 }
6662
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306663 vos_mem_set((void *) pTxCtrlMsg,
6664 (sizeof(*pTxCtrlMsg) + nBytes), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07006665 status = __limFillTxControlParams(pMac, pTxCtrlMsg, type, mode);
6666 if (status != eHAL_STATUS_SUCCESS)
6667 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306668 vos_mem_free(pTxCtrlMsg);
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006669 limLog(pMac, LOGP, FL("__limFillTxControlParams failed, status = %d"), status);
Jeff Johnson295189b2012-06-20 16:38:30 -07006670 return;
6671 }
6672
6673 msgQ.bodyptr = (void *) pTxCtrlMsg;
6674 msgQ.bodyval = 0;
6675 msgQ.reserved = 0;
6676 msgQ.type = WDA_TRANSMISSION_CONTROL_IND;
6677
Jeff Johnsone7245742012-09-05 17:12:55 -07006678 MTRACE(macTraceMsgTx(pMac, NO_SESSION, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07006679 if(wdaPostCtrlMsg( pMac, &msgQ) != eSIR_SUCCESS)
6680 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306681 vos_mem_free(pTxCtrlMsg);
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006682 limLog( pMac, LOGP, FL("Posting Message to HAL failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07006683 return;
6684 }
6685
6686 if (mode == eLIM_STOP_TX)
6687 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006688 PELOG1(limLog(pMac, LOG1, FL("Stopping the transmission of all packets, indicated softmac"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07006689 }
6690 else
6691 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006692 PELOG1(limLog(pMac, LOG1, FL("Resuming the transmission of all packets, indicated softmac"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07006693 }
6694 return;
6695}
6696
6697
6698/**
6699 * @function : limRestorePreChannelSwitchState()
6700 *
6701 * @brief : This API is called by the user to undo any
6702 * specific changes done on the device during
6703 * channel switch.
6704 * LOGIC:
6705 *
6706 * ASSUMPTIONS:
6707 * NA
6708 *
6709 * NOTE:
6710 * NA
6711 *
6712 * @param pMac - Pointer to Global MAC structure
6713 * @return None
6714 */
6715
6716tSirRetStatus
6717limRestorePreChannelSwitchState(tpAniSirGlobal pMac, tpPESession psessionEntry)
6718{
6719
6720 tSirRetStatus retCode = eSIR_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -07006721 tANI_U32 val = 0;
6722
6723 if (psessionEntry->limSystemRole != eLIM_STA_ROLE)
6724 return retCode;
6725
6726 /* Channel switch should be ready for the next time */
Jeff Johnsone7245742012-09-05 17:12:55 -07006727 psessionEntry->gLimSpecMgmt.dot11hChanSwState = eLIM_11H_CHANSW_INIT;
Jeff Johnson295189b2012-06-20 16:38:30 -07006728
6729 /* Restore the frame transmission, all the time. */
6730 limFrameTransmissionControl(pMac, eLIM_TX_ALL, eLIM_RESUME_TX);
6731
6732 /* Free to enter BMPS */
6733 limSendSmePostChannelSwitchInd(pMac);
6734
6735 //Background scan is now enabled by SME
6736 if(pMac->lim.gLimBackgroundScanTerminate == FALSE)
6737 {
6738 /* Enable background scan if already enabled, else don't bother */
6739 if ((retCode = wlan_cfgGetInt(pMac, WNI_CFG_BACKGROUND_SCAN_PERIOD,
6740 &val)) != eSIR_SUCCESS)
6741
6742 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006743 limLog(pMac, LOGP, FL("could not retrieve Background scan period value"));
Jeff Johnson295189b2012-06-20 16:38:30 -07006744 return (retCode);
6745 }
6746
6747 if (val > 0 && TX_TIMER_VALID(pMac->lim.limTimers.gLimBackgroundScanTimer))
6748 {
Ravi Joshid2ca7c42013-07-23 08:37:49 -07006749 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE,
6750 psessionEntry->peSessionId, eLIM_BACKGROUND_SCAN_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -07006751 if(tx_timer_activate(&pMac->lim.limTimers.gLimBackgroundScanTimer) != TX_SUCCESS)
6752 {
6753 limLog(pMac, LOGP, FL("Could not restart background scan timer, doing LOGP"));
6754 return (eSIR_FAILURE);
6755 }
6756
6757 }
6758 }
6759
6760 /* Enable heartbeat timer */
6761 if (TX_TIMER_VALID(pMac->lim.limTimers.gLimHeartBeatTimer))
6762 {
Ravi Joshid2ca7c42013-07-23 08:37:49 -07006763 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE,
6764 psessionEntry->peSessionId, eLIM_HEART_BEAT_TIMER));
6765 if((limActivateHearBeatTimer(pMac, psessionEntry) != TX_SUCCESS) &&
6766 (!IS_ACTIVEMODE_OFFLOAD_FEATURE_ENABLE))
Jeff Johnson295189b2012-06-20 16:38:30 -07006767 {
6768 limLog(pMac, LOGP, FL("Could not restart heartbeat timer, doing LOGP"));
6769 return (eSIR_FAILURE);
6770 }
6771 }
Jeff Johnson295189b2012-06-20 16:38:30 -07006772 return (retCode);
6773}
6774
6775
6776/**--------------------------------------------
6777\fn limRestorePreQuietState
6778\brief Restore the pre quiet state
6779
6780\param pMac
6781\return NONE
6782---------------------------------------------*/
Jeff Johnsone7245742012-09-05 17:12:55 -07006783tSirRetStatus limRestorePreQuietState(tpAniSirGlobal pMac, tpPESession psessionEntry)
Jeff Johnson295189b2012-06-20 16:38:30 -07006784{
6785
6786 tSirRetStatus retCode = eSIR_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -07006787 tANI_U32 val = 0;
6788
6789 if (pMac->lim.gLimSystemRole != eLIM_STA_ROLE)
6790 return retCode;
6791
6792 /* Quiet should be ready for the next time */
Jeff Johnsone7245742012-09-05 17:12:55 -07006793 psessionEntry->gLimSpecMgmt.quietState = eLIM_QUIET_INIT;
Jeff Johnson295189b2012-06-20 16:38:30 -07006794
6795 /* Restore the frame transmission, all the time. */
Jeff Johnsone7245742012-09-05 17:12:55 -07006796 if (psessionEntry->gLimSpecMgmt.quietState == eLIM_QUIET_RUNNING)
Jeff Johnson295189b2012-06-20 16:38:30 -07006797 limFrameTransmissionControl(pMac, eLIM_TX_ALL, eLIM_RESUME_TX);
6798
6799
6800 //Background scan is now enabled by SME
6801 if(pMac->lim.gLimBackgroundScanTerminate == FALSE)
6802 {
6803 /* Enable background scan if already enabled, else don't bother */
6804 if ((retCode = wlan_cfgGetInt(pMac, WNI_CFG_BACKGROUND_SCAN_PERIOD,
6805 &val)) != eSIR_SUCCESS)
6806
6807 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006808 limLog(pMac, LOGP, FL("could not retrieve Background scan period value"));
Jeff Johnson295189b2012-06-20 16:38:30 -07006809 return (retCode);
6810 }
6811
6812 if (val > 0 && TX_TIMER_VALID(pMac->lim.limTimers.gLimBackgroundScanTimer))
6813 {
Leela V Kiran Kumar Reddy Chiralac3b9d382013-01-31 20:49:53 -08006814 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, psessionEntry->peSessionId, eLIM_BACKGROUND_SCAN_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -07006815 if(tx_timer_activate(&pMac->lim.limTimers.gLimBackgroundScanTimer) != TX_SUCCESS)
6816 {
6817 limLog(pMac, LOGP, FL("Could not restart background scan timer, doing LOGP"));
6818 return (eSIR_FAILURE);
6819 }
6820
6821 }
6822 }
6823
6824 /* Enable heartbeat timer */
6825 if (TX_TIMER_VALID(pMac->lim.limTimers.gLimHeartBeatTimer))
6826 {
Leela V Kiran Kumar Reddy Chiralac3b9d382013-01-31 20:49:53 -08006827 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, psessionEntry->peSessionId, eLIM_HEART_BEAT_TIMER));
Ravi Joshid2ca7c42013-07-23 08:37:49 -07006828 if(limActivateHearBeatTimer(pMac, psessionEntry) != TX_SUCCESS)
Jeff Johnson295189b2012-06-20 16:38:30 -07006829 {
6830 limLog(pMac, LOGP, FL("Could not restart heartbeat timer, doing LOGP"));
6831 return (eSIR_FAILURE);
6832 }
6833 }
Jeff Johnson295189b2012-06-20 16:38:30 -07006834 return (retCode);
6835}
6836
6837
6838/**
6839 * @function: limPrepareFor11hChannelSwitch()
6840 *
6841 * @brief : This API is called by the user to prepare for
6842 * 11h channel switch. As of now, the API does
6843 * very minimal work. User can add more into the
6844 * same API if needed.
6845 * LOGIC:
6846 *
6847 * ASSUMPTIONS:
6848 * NA
6849 *
6850 * NOTE:
6851 * NA
6852 *
6853 * @param pMac - Pointer to Global MAC structure
6854 * @param psessionEntry
6855 * @return None
6856 */
6857void
6858limPrepareFor11hChannelSwitch(tpAniSirGlobal pMac, tpPESession psessionEntry)
6859{
Jeff Johnson295189b2012-06-20 16:38:30 -07006860 if (psessionEntry->limSystemRole != eLIM_STA_ROLE)
6861 return;
6862
6863 /* Flag to indicate 11h channel switch in progress */
Jeff Johnsone7245742012-09-05 17:12:55 -07006864 psessionEntry->gLimSpecMgmt.dot11hChanSwState = eLIM_11H_CHANSW_RUNNING;
Jeff Johnson295189b2012-06-20 16:38:30 -07006865
6866 /* Disable, Stop background scan if enabled and running */
6867 limDeactivateAndChangeTimer(pMac, eLIM_BACKGROUND_SCAN_TIMER);
6868
6869 /* Stop heart-beat timer to stop heartbeat disassociation */
6870 limHeartBeatDeactivateAndChangeTimer(pMac, psessionEntry);
6871
6872 if(pMac->lim.gLimSmeState == eLIM_SME_LINK_EST_WT_SCAN_STATE ||
6873 pMac->lim.gLimSmeState == eLIM_SME_CHANNEL_SCAN_STATE)
6874 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006875 PELOGE(limLog(pMac, LOGE, FL("Posting finish scan as we are in scan state"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07006876 /* Stop ongoing scanning if any */
6877 if (GET_LIM_PROCESS_DEFD_MESGS(pMac))
6878 {
6879 //Set the resume channel to Any valid channel (invalid).
6880 //This will instruct HAL to set it to any previous valid channel.
6881 peSetResumeChannel(pMac, 0, 0);
6882 limSendHalFinishScanReq(pMac, eLIM_HAL_FINISH_SCAN_WAIT_STATE);
6883 }
6884 else
6885 {
6886 limRestorePreChannelSwitchState(pMac, psessionEntry);
6887 }
6888 return;
6889 }
6890 else
6891 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006892 PELOGE(limLog(pMac, LOGE, FL("Not in scan state, start channel switch timer"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07006893 /** We are safe to switch channel at this point */
6894 limStopTxAndSwitchChannel(pMac, psessionEntry->peSessionId);
6895 }
Jeff Johnson295189b2012-06-20 16:38:30 -07006896}
6897
6898
6899
6900/**----------------------------------------------------
6901\fn limGetNwType
6902
6903\brief Get type of the network from data packet or beacon
6904\param pMac
6905\param channelNum - Channel number
6906\param type - Type of packet.
6907\param pBeacon - Pointer to beacon or probe response
6908
6909\return Network type a/b/g.
6910-----------------------------------------------------*/
6911tSirNwType limGetNwType(tpAniSirGlobal pMac, tANI_U8 channelNum, tANI_U32 type, tpSchBeaconStruct pBeacon)
6912{
6913 tSirNwType nwType = eSIR_11B_NW_TYPE;
6914
6915 if (type == SIR_MAC_DATA_FRAME)
6916 {
6917 if ((channelNum > 0) && (channelNum < 15))
6918 {
6919 nwType = eSIR_11G_NW_TYPE;
6920 }
6921 else
6922 {
6923 nwType = eSIR_11A_NW_TYPE;
6924 }
6925 }
6926 else
6927 {
6928 if ((channelNum > 0) && (channelNum < 15))
6929 {
6930 int i;
6931 // 11b or 11g packet
6932 // 11g iff extended Rate IE is present or
6933 // if there is an A rate in suppRate IE
6934 for (i = 0; i < pBeacon->supportedRates.numRates; i++)
6935 {
6936 if (sirIsArate(pBeacon->supportedRates.rate[i] & 0x7f))
6937 {
6938 nwType = eSIR_11G_NW_TYPE;
6939 break;
6940 }
6941 }
6942 if (pBeacon->extendedRatesPresent)
6943 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006944 PELOG3(limLog(pMac, LOG3, FL("Beacon, nwtype=G"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07006945 nwType = eSIR_11G_NW_TYPE;
6946 }
6947 }
6948 else
6949 {
6950 // 11a packet
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006951 PELOG3(limLog(pMac, LOG3,FL("Beacon, nwtype=A"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07006952 nwType = eSIR_11A_NW_TYPE;
6953 }
6954 }
6955 return nwType;
6956}
6957
6958
6959/**---------------------------------------------------------
6960\fn limGetChannelFromBeacon
6961\brief To extract channel number from beacon
6962
6963\param pMac
6964\param pBeacon - Pointer to beacon or probe rsp
6965\return channel number
6966-----------------------------------------------------------*/
6967tANI_U8 limGetChannelFromBeacon(tpAniSirGlobal pMac, tpSchBeaconStruct pBeacon)
6968{
6969 tANI_U8 channelNum = 0;
6970
6971 if (pBeacon->dsParamsPresent)
6972 channelNum = pBeacon->channelNumber;
6973 else if(pBeacon->HTInfo.present)
6974 channelNum = pBeacon->HTInfo.primaryChannel;
6975 else
6976 channelNum = pBeacon->channelNumber;
6977
6978 return channelNum;
6979}
6980
6981
6982/** ---------------------------------------------------------
6983\fn limSetTspecUapsdMask
6984\brief This function sets the PE global variable:
6985\ 1) gUapsdPerAcTriggerEnableMask and
6986\ 2) gUapsdPerAcDeliveryEnableMask
6987\ based on the user priority field and direction field
6988\ in the TS Info Fields.
6989\
6990\ An AC is a trigger-enabled AC if the PSB subfield
6991\ is set to 1 in the uplink direction.
6992\ An AC is a delivery-enabled AC if the PSB subfield
6993\ is set to 1 in the down-link direction.
6994\
6995\param tpAniSirGlobal pMac
6996\param tSirMacTSInfo pTsInfo
6997\param tANI_U32 action
6998\return None
6999 ------------------------------------------------------------*/
7000void limSetTspecUapsdMask(tpAniSirGlobal pMac, tSirMacTSInfo *pTsInfo, tANI_U32 action)
7001{
7002 tANI_U8 userPrio = (tANI_U8)pTsInfo->traffic.userPrio;
7003 tANI_U16 direction = pTsInfo->traffic.direction;
7004 tANI_U8 ac = upToAc(userPrio);
7005
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007006 PELOG1(limLog(pMac, LOG1, FL(" Set UAPSD mask for AC %d, direction %d, action=%d (1=set,0=clear) "),ac, direction, action );)
Jeff Johnson295189b2012-06-20 16:38:30 -07007007
7008 /* Converting AC to appropriate Uapsd Bit Mask
7009 * AC_BE(0) --> UAPSD_BITOFFSET_ACVO(3)
7010 * AC_BK(1) --> UAPSD_BITOFFSET_ACVO(2)
7011 * AC_VI(2) --> UAPSD_BITOFFSET_ACVO(1)
7012 * AC_VO(3) --> UAPSD_BITOFFSET_ACVO(0)
7013 */
7014 ac = ((~ac) & 0x3);
7015
7016 if (action == CLEAR_UAPSD_MASK)
7017 {
7018 if (direction == SIR_MAC_DIRECTION_UPLINK)
7019 pMac->lim.gUapsdPerAcTriggerEnableMask &= ~(1 << ac);
7020 else if (direction == SIR_MAC_DIRECTION_DNLINK)
7021 pMac->lim.gUapsdPerAcDeliveryEnableMask &= ~(1 << ac);
7022 else if (direction == SIR_MAC_DIRECTION_BIDIR)
7023 {
7024 pMac->lim.gUapsdPerAcTriggerEnableMask &= ~(1 << ac);
7025 pMac->lim.gUapsdPerAcDeliveryEnableMask &= ~(1 << ac);
7026 }
7027 }
7028 else if (action == SET_UAPSD_MASK)
7029 {
7030 if (direction == SIR_MAC_DIRECTION_UPLINK)
7031 pMac->lim.gUapsdPerAcTriggerEnableMask |= (1 << ac);
7032 else if (direction == SIR_MAC_DIRECTION_DNLINK)
7033 pMac->lim.gUapsdPerAcDeliveryEnableMask |= (1 << ac);
7034 else if (direction == SIR_MAC_DIRECTION_BIDIR)
7035 {
7036 pMac->lim.gUapsdPerAcTriggerEnableMask |= (1 << ac);
7037 pMac->lim.gUapsdPerAcDeliveryEnableMask |= (1 << ac);
7038 }
7039 }
7040
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007041 limLog(pMac, LOGE, FL("New pMac->lim.gUapsdPerAcTriggerEnableMask = 0x%x "), pMac->lim.gUapsdPerAcTriggerEnableMask );
7042 limLog(pMac, LOGE, FL("New pMac->lim.gUapsdPerAcDeliveryEnableMask = 0x%x "), pMac->lim.gUapsdPerAcDeliveryEnableMask );
Jeff Johnson295189b2012-06-20 16:38:30 -07007043
7044 return;
7045}
7046
7047
7048
7049void limHandleHeartBeatTimeout(tpAniSirGlobal pMac )
7050{
7051
7052 tANI_U8 i;
7053 for(i =0;i < pMac->lim.maxBssId;i++)
7054 {
7055 if(pMac->lim.gpSession[i].valid == TRUE )
7056 {
7057 if(pMac->lim.gpSession[i].bssType == eSIR_IBSS_MODE)
7058 {
7059 limIbssHeartBeatHandle(pMac,&pMac->lim.gpSession[i]);
7060 break;
7061 }
7062
7063 if((pMac->lim.gpSession[i].bssType == eSIR_INFRASTRUCTURE_MODE) &&
7064 (pMac->lim.gpSession[i].limSystemRole == eLIM_STA_ROLE))
7065 {
7066 limHandleHeartBeatFailure(pMac,&pMac->lim.gpSession[i]);
7067 }
7068 }
7069 }
7070 for(i=0; i< pMac->lim.maxBssId; i++)
7071 {
7072 if(pMac->lim.gpSession[i].valid == TRUE )
7073 {
7074 if((pMac->lim.gpSession[i].bssType == eSIR_INFRASTRUCTURE_MODE) &&
7075 (pMac->lim.gpSession[i].limSystemRole == eLIM_STA_ROLE))
7076 {
7077 if(pMac->lim.gpSession[i].LimHBFailureStatus == eANI_BOOLEAN_TRUE)
7078 {
7079 /* Activate Probe After HeartBeat Timer incase HB Failure detected */
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007080 PELOGW(limLog(pMac, LOGW,FL("Sending Probe for Session: %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07007081 i);)
7082 limDeactivateAndChangeTimer(pMac, eLIM_PROBE_AFTER_HB_TIMER);
7083 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, 0, eLIM_PROBE_AFTER_HB_TIMER));
7084 if (tx_timer_activate(&pMac->lim.limTimers.gLimProbeAfterHBTimer) != TX_SUCCESS)
7085 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007086 limLog(pMac, LOGP, FL("Fail to re-activate Probe-after-heartbeat timer"));
Jeff Johnson295189b2012-06-20 16:38:30 -07007087 limReactivateHeartBeatTimer(pMac, &pMac->lim.gpSession[i]);
7088 }
7089 break;
7090 }
7091 }
7092 }
7093 }
7094}
7095
Leela Venkata Kiran Kumar Reddy Chirala3ca17902013-02-27 19:50:05 -08007096void limHandleHeartBeatTimeoutForSession(tpAniSirGlobal pMac, tpPESession psessionEntry)
7097{
7098 if(psessionEntry->valid == TRUE )
7099 {
7100 if(psessionEntry->bssType == eSIR_IBSS_MODE)
7101 {
7102 limIbssHeartBeatHandle(pMac,psessionEntry);
7103 }
7104 if((psessionEntry->bssType == eSIR_INFRASTRUCTURE_MODE) &&
7105 (psessionEntry->limSystemRole == eLIM_STA_ROLE))
7106 {
7107 limHandleHeartBeatFailure(pMac,psessionEntry);
7108 }
7109 }
7110 /* In the function limHandleHeartBeatFailure things can change so check for the session entry valid
7111 and the other things again */
7112 if(psessionEntry->valid == TRUE )
7113 {
7114 if((psessionEntry->bssType == eSIR_INFRASTRUCTURE_MODE) &&
7115 (psessionEntry->limSystemRole == eLIM_STA_ROLE))
7116 {
7117 if(psessionEntry->LimHBFailureStatus == eANI_BOOLEAN_TRUE)
7118 {
7119 /* Activate Probe After HeartBeat Timer incase HB Failure detected */
7120 PELOGW(limLog(pMac, LOGW,FL("Sending Probe for Session: %d"),
7121 psessionEntry->bssIdx);)
7122 limDeactivateAndChangeTimer(pMac, eLIM_PROBE_AFTER_HB_TIMER);
7123 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, 0, eLIM_PROBE_AFTER_HB_TIMER));
7124 if (tx_timer_activate(&pMac->lim.limTimers.gLimProbeAfterHBTimer) != TX_SUCCESS)
7125 {
7126 limLog(pMac, LOGP, FL("Fail to re-activate Probe-after-heartbeat timer"));
7127 limReactivateHeartBeatTimer(pMac, psessionEntry);
7128 }
7129 }
7130 }
7131 }
7132}
7133
7134
Jeff Johnson295189b2012-06-20 16:38:30 -07007135tANI_U8 limGetCurrentOperatingChannel(tpAniSirGlobal pMac)
7136{
7137 tANI_U8 i;
7138 for(i =0;i < pMac->lim.maxBssId;i++)
7139 {
7140 if(pMac->lim.gpSession[i].valid == TRUE )
7141 {
7142 if((pMac->lim.gpSession[i].bssType == eSIR_INFRASTRUCTURE_MODE) &&
7143 (pMac->lim.gpSession[i].limSystemRole == eLIM_STA_ROLE))
7144 {
7145 return pMac->lim.gpSession[i].currentOperChannel;
7146 }
7147 }
7148 }
7149 return 0;
7150}
7151
7152void limProcessAddStaRsp(tpAniSirGlobal pMac,tpSirMsgQ limMsgQ)
7153{
7154
7155 tpPESession psessionEntry;
7156// tANI_U8 sessionId;
7157 tpAddStaParams pAddStaParams;
7158
7159 pAddStaParams = (tpAddStaParams)limMsgQ->bodyptr;
7160
7161 if((psessionEntry = peFindSessionBySessionId(pMac,pAddStaParams->sessionId))==NULL)
7162 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007163 limLog(pMac, LOGP,FL("Session Does not exist for given sessionID"));
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307164 vos_mem_free(pAddStaParams);
Jeff Johnson295189b2012-06-20 16:38:30 -07007165 return;
7166 }
7167 if (psessionEntry->limSystemRole == eLIM_STA_IN_IBSS_ROLE)
7168 (void) limIbssAddStaRsp(pMac, limMsgQ->bodyptr,psessionEntry);
Mohit Khanna698ba2a2012-12-04 15:08:18 -08007169#ifdef FEATURE_WLAN_TDLS
7170 else if(pMac->lim.gLimAddStaTdls)
7171 {
7172 limProcessTdlsAddStaRsp(pMac, limMsgQ->bodyptr, psessionEntry) ;
7173 pMac->lim.gLimAddStaTdls = FALSE ;
7174 }
7175#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07007176 else
7177 limProcessMlmAddStaRsp(pMac, limMsgQ,psessionEntry);
7178
7179}
7180
7181
7182void limUpdateBeacon(tpAniSirGlobal pMac)
7183{
7184 tANI_U8 i;
7185
7186 for(i =0;i < pMac->lim.maxBssId;i++)
7187 {
7188 if(pMac->lim.gpSession[i].valid == TRUE )
7189 {
7190 if( ( (pMac->lim.gpSession[i].limSystemRole == eLIM_AP_ROLE) ||
7191 (pMac->lim.gpSession[i].limSystemRole == eLIM_STA_IN_IBSS_ROLE) )
7192 && (eLIM_SME_NORMAL_STATE == pMac->lim.gpSession[i].limSmeState)
7193 )
7194 {
7195 schSetFixedBeaconFields(pMac,&pMac->lim.gpSession[i]);
7196 limSendBeaconInd(pMac, &pMac->lim.gpSession[i]);
7197 }
7198 else
7199 {
7200 if( (pMac->lim.gpSession[i].limSystemRole == eLIM_BT_AMP_AP_ROLE)||
7201 (pMac->lim.gpSession[i].limSystemRole == eLIM_BT_AMP_STA_ROLE))
7202 {
7203
7204 if(pMac->lim.gpSession[i].statypeForBss == STA_ENTRY_SELF)
7205 {
7206 schSetFixedBeaconFields(pMac,&pMac->lim.gpSession[i]);
7207 }
7208 }
7209 }
7210 }
7211 }
7212}
7213
7214void limHandleHeartBeatFailureTimeout(tpAniSirGlobal pMac)
7215{
7216 tANI_U8 i;
7217 tpPESession psessionEntry;
7218 /* Probe response is not received after HB failure. This is handled by LMM sub module. */
7219 for(i =0; i < pMac->lim.maxBssId; i++)
7220 {
7221 if(pMac->lim.gpSession[i].valid == TRUE)
7222 {
7223 psessionEntry = &pMac->lim.gpSession[i];
7224 if(psessionEntry->LimHBFailureStatus == eANI_BOOLEAN_TRUE)
7225 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007226 limLog(pMac, LOGE, FL("Probe_hb_failure: SME %d, MLME %d, HB-Count %d"),psessionEntry->limSmeState,
Jeff Johnson295189b2012-06-20 16:38:30 -07007227 psessionEntry->limMlmState, psessionEntry->LimRxedBeaconCntDuringHB);
Leela Venkata Kiran Kumar Reddy Chirala2365ee62013-05-09 17:30:12 -07007228#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
7229 limDiagEventReport(pMac, WLAN_PE_DIAG_HB_FAILURE_TIMEOUT, psessionEntry, 0, 0);
7230#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07007231 if (psessionEntry->limMlmState == eLIM_MLM_LINK_ESTABLISHED_STATE)
7232 {
Leela Venkata Kiran Kumar Reddy Chiralaab842fb2013-04-30 12:27:35 -07007233 if ((!LIM_IS_CONNECTION_ACTIVE(psessionEntry))&&
7234 (psessionEntry->limSmeState != eLIM_SME_WT_DISASSOC_STATE))
Jeff Johnson295189b2012-06-20 16:38:30 -07007235 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007236 limLog(pMac, LOGE, FL("Probe_hb_failure: for session:%d " ),psessionEntry->peSessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07007237 /* AP did not respond to Probe Request. Tear down link with it.*/
7238 limTearDownLinkWithAp(pMac,
7239 psessionEntry->peSessionId,
7240 eSIR_BEACON_MISSED);
7241 pMac->lim.gLimProbeFailureAfterHBfailedCnt++ ;
7242 }
7243 else // restart heartbeat timer
7244 {
7245 limReactivateHeartBeatTimer(pMac, psessionEntry);
7246 }
7247 }
7248 else
7249 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007250 limLog(pMac, LOGE, FL("Unexpected wt-probe-timeout in state "));
Jeff Johnson295189b2012-06-20 16:38:30 -07007251 limPrintMlmState(pMac, LOGE, psessionEntry->limMlmState);
7252 limReactivateHeartBeatTimer(pMac, psessionEntry);
7253 }
7254
7255 }
7256 }
7257 }
7258 /* Deactivate Timer ProbeAfterHB Timer -> As its a oneshot timer, need not deactivate the timer */
7259 // tx_timer_deactivate(&pMac->lim.limTimers.gLimProbeAfterHBTimer);
7260}
7261
7262
7263/*
7264* This function assumes there will not be more than one IBSS session active at any time.
7265*/
7266tpPESession limIsIBSSSessionActive(tpAniSirGlobal pMac)
7267{
7268 tANI_U8 i;
7269
7270 for(i =0;i < pMac->lim.maxBssId;i++)
7271 {
7272 if( (pMac->lim.gpSession[i].valid) &&
7273 (pMac->lim.gpSession[i].limSystemRole == eLIM_STA_IN_IBSS_ROLE))
7274 return (&pMac->lim.gpSession[i]);
7275 }
7276
7277 return NULL;
7278}
7279
7280tpPESession limIsApSessionActive(tpAniSirGlobal pMac)
7281{
7282 tANI_U8 i;
7283
7284 for(i =0;i < pMac->lim.maxBssId;i++)
7285 {
7286 if( (pMac->lim.gpSession[i].valid) &&
7287 ( (pMac->lim.gpSession[i].limSystemRole == eLIM_AP_ROLE) ||
7288 (pMac->lim.gpSession[i].limSystemRole == eLIM_BT_AMP_AP_ROLE)))
7289 return (&pMac->lim.gpSession[i]);
7290 }
7291
7292 return NULL;
7293}
7294
7295/**---------------------------------------------------------
7296\fn limHandleDeferMsgError
7297\brief handles error scenario, when the msg can not be deferred.
7298\param pMac
7299\param pLimMsg LIM msg, which could not be deferred.
7300\return void
7301-----------------------------------------------------------*/
7302
7303void limHandleDeferMsgError(tpAniSirGlobal pMac, tpSirMsgQ pLimMsg)
7304{
7305 if(SIR_BB_XPORT_MGMT_MSG == pLimMsg->type)
7306 {
7307 vos_pkt_return_packet((vos_pkt_t*)pLimMsg->bodyptr);
7308 }
7309 else if(pLimMsg->bodyptr != NULL)
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08007310 {
7311 vos_mem_free( pLimMsg->bodyptr);
7312 pLimMsg->bodyptr = NULL;
7313 }
Jeff Johnson295189b2012-06-20 16:38:30 -07007314}
7315
7316
7317#ifdef FEATURE_WLAN_DIAG_SUPPORT
7318/**---------------------------------------------------------
7319\fn limDiagEventReport
7320\brief This function reports Diag event
7321\param pMac
7322\param eventType
7323\param bssid
7324\param status
7325\param reasonCode
7326\return void
7327-----------------------------------------------------------*/
7328void limDiagEventReport(tpAniSirGlobal pMac, tANI_U16 eventType, tpPESession pSessionEntry, tANI_U16 status, tANI_U16 reasonCode)
7329{
7330 tSirMacAddr nullBssid = { 0, 0, 0, 0, 0, 0 };
7331 WLAN_VOS_DIAG_EVENT_DEF(peEvent, vos_event_wlan_pe_payload_type);
7332
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307333 vos_mem_set(&peEvent, sizeof(vos_event_wlan_pe_payload_type), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07007334
7335 if (NULL == pSessionEntry)
7336 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307337 vos_mem_copy( peEvent.bssid, nullBssid, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07007338 peEvent.sme_state = (tANI_U16)pMac->lim.gLimSmeState;
7339 peEvent.mlm_state = (tANI_U16)pMac->lim.gLimMlmState;
7340
7341 }
7342 else
7343 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307344 vos_mem_copy(peEvent.bssid, pSessionEntry->bssId, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07007345 peEvent.sme_state = (tANI_U16)pSessionEntry->limSmeState;
7346 peEvent.mlm_state = (tANI_U16)pSessionEntry->limMlmState;
7347 }
7348 peEvent.event_type = eventType;
7349 peEvent.status = status;
7350 peEvent.reason_code = reasonCode;
7351
7352 WLAN_VOS_DIAG_EVENT_REPORT(&peEvent, EVENT_WLAN_PE);
7353 return;
7354}
7355
7356#endif /* FEATURE_WLAN_DIAG_SUPPORT */
7357
7358void limProcessAddStaSelfRsp(tpAniSirGlobal pMac,tpSirMsgQ limMsgQ)
7359{
7360
7361 tpAddStaSelfParams pAddStaSelfParams;
7362 tSirMsgQ mmhMsg;
7363 tpSirSmeAddStaSelfRsp pRsp;
7364
7365
7366 pAddStaSelfParams = (tpAddStaSelfParams)limMsgQ->bodyptr;
7367
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307368 pRsp = vos_mem_malloc(sizeof(tSirSmeAddStaSelfRsp));
7369 if ( NULL == pRsp )
Jeff Johnson295189b2012-06-20 16:38:30 -07007370 {
7371 /// Buffer not available. Log error
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307372 limLog(pMac, LOGP, FL("call to AllocateMemory failed for Add Sta self RSP"));
7373 vos_mem_free(pAddStaSelfParams);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08007374 limMsgQ->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07007375 return;
7376 }
7377
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307378 vos_mem_set((tANI_U8*)pRsp, sizeof(tSirSmeAddStaSelfRsp), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07007379
7380 pRsp->mesgType = eWNI_SME_ADD_STA_SELF_RSP;
7381 pRsp->mesgLen = (tANI_U16) sizeof(tSirSmeAddStaSelfRsp);
7382 pRsp->status = pAddStaSelfParams->status;
7383
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307384 vos_mem_copy( pRsp->selfMacAddr, pAddStaSelfParams->selfMacAddr, sizeof(tSirMacAddr) );
Jeff Johnson295189b2012-06-20 16:38:30 -07007385
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307386 vos_mem_free(pAddStaSelfParams);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08007387 limMsgQ->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07007388
7389 mmhMsg.type = eWNI_SME_ADD_STA_SELF_RSP;
7390 mmhMsg.bodyptr = pRsp;
7391 mmhMsg.bodyval = 0;
Jeff Johnsone7245742012-09-05 17:12:55 -07007392 MTRACE(macTraceMsgTx(pMac, NO_SESSION, mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07007393 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
7394
7395}
7396
7397void limProcessDelStaSelfRsp(tpAniSirGlobal pMac,tpSirMsgQ limMsgQ)
7398{
7399
7400 tpDelStaSelfParams pDelStaSelfParams;
7401 tSirMsgQ mmhMsg;
7402 tpSirSmeDelStaSelfRsp pRsp;
7403
7404
7405 pDelStaSelfParams = (tpDelStaSelfParams)limMsgQ->bodyptr;
7406
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307407 pRsp = vos_mem_malloc(sizeof(tSirSmeDelStaSelfRsp));
7408 if ( NULL == pRsp )
Jeff Johnson295189b2012-06-20 16:38:30 -07007409 {
7410 /// Buffer not available. Log error
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307411 limLog(pMac, LOGP, FL("call to AllocateMemory failed for Add Sta self RSP"));
7412 vos_mem_free(pDelStaSelfParams);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08007413 limMsgQ->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07007414 return;
7415 }
7416
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307417 vos_mem_set((tANI_U8*)pRsp, sizeof(tSirSmeDelStaSelfRsp), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07007418
7419 pRsp->mesgType = eWNI_SME_DEL_STA_SELF_RSP;
7420 pRsp->mesgLen = (tANI_U16) sizeof(tSirSmeDelStaSelfRsp);
7421 pRsp->status = pDelStaSelfParams->status;
7422
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307423 vos_mem_copy( pRsp->selfMacAddr, pDelStaSelfParams->selfMacAddr, sizeof(tSirMacAddr) );
Jeff Johnson295189b2012-06-20 16:38:30 -07007424
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307425 vos_mem_free(pDelStaSelfParams);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08007426 limMsgQ->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07007427
7428 mmhMsg.type = eWNI_SME_DEL_STA_SELF_RSP;
7429 mmhMsg.bodyptr = pRsp;
7430 mmhMsg.bodyval = 0;
Jeff Johnsone7245742012-09-05 17:12:55 -07007431 MTRACE(macTraceMsgTx(pMac, NO_SESSION, mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07007432 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
7433
7434}
7435
7436/***************************************************************
7437* tANI_U8 limUnmapChannel(tANI_U8 mapChannel)
7438* To unmap the channel to reverse the effect of mapping
7439* a band channel in hal .Mapping was done hal to overcome the
7440* limitation of the rxbd which use only 4 bit for channel number.
7441*****************************************************************/
7442tANI_U8 limUnmapChannel(tANI_U8 mapChannel)
7443{
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07007444#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
Manjunathappa Prakashb8ac0232014-03-06 17:58:20 -08007445 if( mapChannel > 0 && mapChannel <= aUnsortedChannelListSize )
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07007446 if (IS_ROAM_SCAN_OFFLOAD_FEATURE_ENABLE)
7447 return aUnsortedChannelList[mapChannel -1];
7448 else
Manjunathappa Prakasheb5a3a32014-02-13 19:57:55 -08007449#else
Manjunathappa Prakashb8ac0232014-03-06 17:58:20 -08007450 if( mapChannel > 0 && mapChannel <= abChannelSize )
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07007451#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07007452 return abChannel[mapChannel -1];
7453 else
7454 return 0;
7455}
7456
7457
7458v_U8_t* limGetIEPtr(tpAniSirGlobal pMac, v_U8_t *pIes, int length, v_U8_t eid,eSizeOfLenField size_of_len_field)
7459{
7460 int left = length;
7461 v_U8_t *ptr = pIes;
7462 v_U8_t elem_id;
7463 v_U16_t elem_len;
7464
7465 while(left >= (size_of_len_field+1))
7466 {
7467 elem_id = ptr[0];
7468 if (size_of_len_field == TWO_BYTE)
7469 {
7470 elem_len = ((v_U16_t) ptr[1]) | (ptr[2]<<8);
7471 }
7472 else
7473 {
7474 elem_len = ptr[1];
7475 }
7476
7477
7478 left -= (size_of_len_field+1);
7479 if(elem_len > left)
7480 {
7481 limLog(pMac, LOGE,
Madan Mohan Koyyalamudi8bdd3112012-09-24 13:55:14 -07007482 FL("****Invalid IEs eid = %d elem_len=%d left=%d*****"),
Jeff Johnson295189b2012-06-20 16:38:30 -07007483 eid,elem_len,left);
7484 return NULL;
7485 }
7486 if (elem_id == eid)
7487 {
7488 return ptr;
7489 }
7490
7491 left -= elem_len;
7492 ptr += (elem_len + (size_of_len_field+1));
7493 }
7494 return NULL;
7495}
7496
7497/* return NULL if oui is not found in ie
7498 return !NULL pointer to vendor IE (starting from 0xDD) if oui is found
7499 */
7500v_U8_t* limGetVendorIEOuiPtr(tpAniSirGlobal pMac, tANI_U8 *oui, tANI_U8 oui_size, tANI_U8 *ie, tANI_U16 ie_len)
7501{
7502 int left = ie_len;
7503 v_U8_t *ptr = ie;
7504 v_U8_t elem_id, elem_len;
7505
7506 while(left >= 2)
7507 {
7508 elem_id = ptr[0];
7509 elem_len = ptr[1];
7510 left -= 2;
7511 if(elem_len > left)
7512 {
7513 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007514 FL("****Invalid IEs eid = %d elem_len=%d left=%d*****"),
Jeff Johnson295189b2012-06-20 16:38:30 -07007515 elem_id,elem_len,left);
7516 return NULL;
7517 }
7518 if (SIR_MAC_EID_VENDOR == elem_id)
7519 {
7520 if(memcmp(&ptr[2], oui, oui_size)==0)
7521 return ptr;
7522 }
7523
7524 left -= elem_len;
7525 ptr += (elem_len + 2);
7526 }
7527 return NULL;
7528}
7529
Jeff Johnson295189b2012-06-20 16:38:30 -07007530//Returns length of P2P stream and Pointer ie passed to this function is filled with noa stream
7531
7532v_U8_t limBuildP2pIe(tpAniSirGlobal pMac, tANI_U8 *ie, tANI_U8 *data, tANI_U8 ie_len)
7533{
7534 int length = 0;
7535 tANI_U8 *ptr = ie;
7536
7537 ptr[length++] = SIR_MAC_EID_VENDOR;
7538 ptr[length++] = ie_len + SIR_MAC_P2P_OUI_SIZE;
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307539 vos_mem_copy(&ptr[length], SIR_MAC_P2P_OUI, SIR_MAC_P2P_OUI_SIZE);
7540 vos_mem_copy(&ptr[length + SIR_MAC_P2P_OUI_SIZE], data, ie_len);
Jeff Johnson295189b2012-06-20 16:38:30 -07007541 return (ie_len + SIR_P2P_IE_HEADER_LEN);
7542}
7543
7544//Returns length of NoA stream and Pointer pNoaStream passed to this function is filled with noa stream
7545
7546v_U8_t limGetNoaAttrStreamInMultP2pIes(tpAniSirGlobal pMac,v_U8_t* noaStream,v_U8_t noaLen,v_U8_t overFlowLen)
7547{
7548 v_U8_t overFlowP2pStream[SIR_MAX_NOA_ATTR_LEN];
Krunal Sonic768a932013-05-15 19:26:30 -07007549
7550 if ((noaLen <= (SIR_MAX_NOA_ATTR_LEN+SIR_P2P_IE_HEADER_LEN)) &&
7551 (noaLen >= overFlowLen) && (overFlowLen <= SIR_MAX_NOA_ATTR_LEN))
7552 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307553 vos_mem_copy(overFlowP2pStream,
Krunal Sonic768a932013-05-15 19:26:30 -07007554 noaStream + noaLen - overFlowLen, overFlowLen);
7555 noaStream[noaLen - overFlowLen] = SIR_MAC_EID_VENDOR;
7556 noaStream[noaLen - overFlowLen + 1] = overFlowLen + SIR_MAC_P2P_OUI_SIZE;
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307557 vos_mem_copy(noaStream+noaLen-overFlowLen + 2,
Krunal Sonic768a932013-05-15 19:26:30 -07007558 SIR_MAC_P2P_OUI, SIR_MAC_P2P_OUI_SIZE);
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307559 vos_mem_copy(noaStream+noaLen + 2 + SIR_MAC_P2P_OUI_SIZE - overFlowLen,
7560 overFlowP2pStream, overFlowLen);
Krunal Sonic768a932013-05-15 19:26:30 -07007561 }
7562
Jeff Johnson295189b2012-06-20 16:38:30 -07007563 return (noaLen + SIR_P2P_IE_HEADER_LEN);
7564
7565}
7566
7567//Returns length of NoA stream and Pointer pNoaStream passed to this function is filled with noa stream
7568v_U8_t limGetNoaAttrStream(tpAniSirGlobal pMac, v_U8_t*pNoaStream,tpPESession psessionEntry)
7569{
7570 v_U8_t len=0;
7571
7572 v_U8_t *pBody = pNoaStream;
7573
7574
7575 if ( (psessionEntry != NULL) && (psessionEntry->valid) &&
7576 (psessionEntry->pePersona == VOS_P2P_GO_MODE))
7577 {
7578 if ((!(psessionEntry->p2pGoPsUpdate.uNoa1Duration)) && (!(psessionEntry->p2pGoPsUpdate.uNoa2Duration))
7579 && (!psessionEntry->p2pGoPsUpdate.oppPsFlag)
7580 )
7581 return 0; //No NoA Descriptor then return 0
7582
7583
7584 pBody[0] = SIR_P2P_NOA_ATTR;
7585
7586 pBody[3] = psessionEntry->p2pGoPsUpdate.index;
7587 pBody[4] = psessionEntry->p2pGoPsUpdate.ctWin | (psessionEntry->p2pGoPsUpdate.oppPsFlag<<7);
7588 len = 5;
7589 pBody += len;
7590
7591
7592 if (psessionEntry->p2pGoPsUpdate.uNoa1Duration)
7593 {
7594 *pBody = psessionEntry->p2pGoPsUpdate.uNoa1IntervalCnt;
7595 pBody += 1;
7596 len +=1;
7597
7598 *((tANI_U32 *)(pBody)) = sirSwapU32ifNeeded(psessionEntry->p2pGoPsUpdate.uNoa1Duration);
7599 pBody += sizeof(tANI_U32);
7600 len +=4;
7601
7602 *((tANI_U32 *)(pBody)) = sirSwapU32ifNeeded(psessionEntry->p2pGoPsUpdate.uNoa1Interval);
7603 pBody += sizeof(tANI_U32);
7604 len +=4;
7605
7606 *((tANI_U32 *)(pBody)) = sirSwapU32ifNeeded(psessionEntry->p2pGoPsUpdate.uNoa1StartTime);
7607 pBody += sizeof(tANI_U32);
7608 len +=4;
7609
7610 }
7611
7612 if (psessionEntry->p2pGoPsUpdate.uNoa2Duration)
7613 {
7614 *pBody = psessionEntry->p2pGoPsUpdate.uNoa2IntervalCnt;
7615 pBody += 1;
7616 len +=1;
7617
7618 *((tANI_U32 *)(pBody)) = sirSwapU32ifNeeded(psessionEntry->p2pGoPsUpdate.uNoa2Duration);
7619 pBody += sizeof(tANI_U32);
7620 len +=4;
7621
7622 *((tANI_U32 *)(pBody)) = sirSwapU32ifNeeded(psessionEntry->p2pGoPsUpdate.uNoa2Interval);
7623 pBody += sizeof(tANI_U32);
7624 len +=4;
7625
7626 *((tANI_U32 *)(pBody)) = sirSwapU32ifNeeded(psessionEntry->p2pGoPsUpdate.uNoa2StartTime);
7627 pBody += sizeof(tANI_U32);
7628 len +=4;
7629
7630 }
7631
7632
7633 pBody = pNoaStream + 1;
7634 *((tANI_U16 *)(pBody)) = sirSwapU16ifNeeded(len-3);/*one byte for Attr and 2 bytes for length*/
7635
7636 return (len);
7637
7638 }
7639 return 0;
7640
7641}
Jeff Johnsone7245742012-09-05 17:12:55 -07007642
7643void peSetResumeChannel(tpAniSirGlobal pMac, tANI_U16 channel, ePhyChanBondState phyCbState)
Jeff Johnson295189b2012-06-20 16:38:30 -07007644{
7645
7646 pMac->lim.gResumeChannel = channel;
Jeff Johnsone7245742012-09-05 17:12:55 -07007647 pMac->lim.gResumePhyCbState = phyCbState;
Jeff Johnson295189b2012-06-20 16:38:30 -07007648}
Jeff Johnsone7245742012-09-05 17:12:55 -07007649
Jeff Johnson295189b2012-06-20 16:38:30 -07007650/*--------------------------------------------------------------------------
7651
7652 \brief peGetResumeChannel() - Returns the channel number for scanning, from a valid session.
7653
Jeff Johnsone7245742012-09-05 17:12:55 -07007654 This function returns the channel to resume to during link resume. channel id of 0 means HAL will
7655 resume to previous channel before link suspend
Jeff Johnson295189b2012-06-20 16:38:30 -07007656
7657 \param pMac - pointer to global adapter context
7658 \return - channel to scan from valid session else zero.
7659
7660 \sa
7661
7662 --------------------------------------------------------------------------*/
Jeff Johnsone7245742012-09-05 17:12:55 -07007663void peGetResumeChannel(tpAniSirGlobal pMac, tANI_U8* resumeChannel, ePhyChanBondState* resumePhyCbState)
Jeff Johnson295189b2012-06-20 16:38:30 -07007664{
7665
7666 //Rationale - this could be the suspend/resume for assoc and it is essential that
7667 //the new BSS is active for some time. Other BSS was anyway suspended.
7668 //TODO: Comeup with a better alternative. Sending NULL with PM=0 on other BSS means
7669 //there will be trouble. But since it is sent on current channel, it will be missed by peer
Jeff Johnsone7245742012-09-05 17:12:55 -07007670 //and hence should be ok. Need to discuss this further
7671 if( !limIsInMCC(pMac) )
Jeff Johnson295189b2012-06-20 16:38:30 -07007672 {
7673 //Get current active session channel
Jeff Johnsone7245742012-09-05 17:12:55 -07007674 peGetActiveSessionChannel(pMac, resumeChannel, resumePhyCbState);
Jeff Johnson295189b2012-06-20 16:38:30 -07007675 }
7676 else
7677 {
Jeff Johnsone7245742012-09-05 17:12:55 -07007678 *resumeChannel = pMac->lim.gResumeChannel;
7679 *resumePhyCbState = pMac->lim.gResumePhyCbState;
Jeff Johnson295189b2012-06-20 16:38:30 -07007680 }
Jeff Johnsone7245742012-09-05 17:12:55 -07007681 return;
Jeff Johnson295189b2012-06-20 16:38:30 -07007682}
7683
Viral Modid86bde22012-12-10 13:09:21 -08007684tANI_BOOLEAN limIsNOAInsertReqd(tpAniSirGlobal pMac)
7685{
7686 tANI_U8 i;
7687 for(i =0; i < pMac->lim.maxBssId; i++)
7688 {
7689 if(pMac->lim.gpSession[i].valid == TRUE)
7690 {
7691 if( (eLIM_AP_ROLE == pMac->lim.gpSession[i].limSystemRole )
7692 && ( VOS_P2P_GO_MODE == pMac->lim.gpSession[i].pePersona )
7693 )
7694 {
7695 return TRUE;
7696 }
7697 }
7698 }
7699 return FALSE;
7700}
Jeff Johnsone7245742012-09-05 17:12:55 -07007701
Jeff Johnson295189b2012-06-20 16:38:30 -07007702
7703tANI_BOOLEAN limIsconnectedOnDFSChannel(tANI_U8 currentChannel)
7704{
7705 if(NV_CHANNEL_DFS == vos_nv_getChannelEnabledState(currentChannel))
7706 {
7707 return eANI_BOOLEAN_TRUE;
7708 }
7709 else
7710 {
7711 return eANI_BOOLEAN_FALSE;
7712 }
7713}
Madan Mohan Koyyalamudi1bed5982012-10-22 14:38:06 -07007714
Sandeep Puligilla60342762014-01-30 21:05:37 +05307715/**
7716 * \brief verify the changes in channel bonding
7717 *
7718 * \param pMac Pointer to the global MAC structure
7719 *
7720 * \param psessionEntry session entry
7721 * beaconSecChanWidth Secondary channel width
7722 * advertized in beacon
7723 * currentSecChanWidth Current configured width
7724 * staId Station Id
7725 * \return eSIR_SUCCESS on success, eSIR_FAILURE else
7726 */
7727tANI_BOOLEAN limCheckHTChanBondModeChange(tpAniSirGlobal pMac,
7728 tpPESession psessionEntry,
7729 tANI_U8 beaconSecChanWidth,
7730 tANI_U8 currentSecChanWidth,
7731 tANI_U8 staId)
7732{
7733 tUpdateVHTOpMode tempParam;
7734 tANI_BOOLEAN fCbMode24G = FALSE;
7735 tANI_BOOLEAN status = eANI_BOOLEAN_FALSE;
7736
7737 /* Moving from HT40 to HT20 operation*/
7738 if (((PHY_DOUBLE_CHANNEL_LOW_PRIMARY == currentSecChanWidth) ||
7739 (PHY_DOUBLE_CHANNEL_HIGH_PRIMARY == currentSecChanWidth))
7740 && (PHY_SINGLE_CHANNEL_CENTERED == beaconSecChanWidth))
7741 {
7742 tempParam.opMode = eHT_CHANNEL_WIDTH_20MHZ;
7743 tempParam.staId = staId;
7744 fCbMode24G = TRUE;
7745 }
7746
7747 /* Moving from HT20 to HT40 operation*/
7748 if ((( PHY_DOUBLE_CHANNEL_LOW_PRIMARY == beaconSecChanWidth) ||
7749 ( PHY_DOUBLE_CHANNEL_HIGH_PRIMARY == beaconSecChanWidth ))
7750 && (PHY_SINGLE_CHANNEL_CENTERED == currentSecChanWidth))
7751 {
7752 tempParam.opMode = eHT_CHANNEL_WIDTH_40MHZ;
7753 tempParam.staId = staId;
7754 fCbMode24G = TRUE;
7755 }
7756
7757 if (TRUE == fCbMode24G)
7758 {
7759 VOS_TRACE( VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,
7760 "Changing CBMODE to = %d staId = %d",
7761 tempParam.opMode, tempParam.staId );
7762 if( eSIR_SUCCESS == limSendModeUpdate(pMac, &tempParam, psessionEntry))
7763 status = eANI_BOOLEAN_TRUE;
7764 }
7765 return status;
7766}
7767
Mohit Khanna4a70d262012-09-11 16:30:12 -07007768#ifdef WLAN_FEATURE_11AC
7769tANI_BOOLEAN limCheckVHTOpModeChange( tpAniSirGlobal pMac, tpPESession psessionEntry, tANI_U8 chanWidth, tANI_U8 staId)
7770{
7771 tUpdateVHTOpMode tempParam;
7772
7773 tempParam.opMode = chanWidth;
7774 tempParam.staId = staId;
7775
7776 limSendModeUpdate( pMac, &tempParam, psessionEntry );
7777
7778 return eANI_BOOLEAN_TRUE;
7779}
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -07007780#endif
7781
7782tANI_U8 limGetShortSlotFromPhyMode(tpAniSirGlobal pMac, tpPESession psessionEntry, tANI_U32 phyMode)
7783{
7784 tANI_U8 val=0;
7785
7786 if (phyMode == WNI_CFG_PHY_MODE_11A)
7787 {
7788 // 11a mode always uses short slot
7789 // Check this since some APs in 11a mode broadcast long slot in their beacons. As per standard, always use what PHY mandates.
7790 val = true;
7791 }
7792 else if (phyMode == WNI_CFG_PHY_MODE_11G)
7793 {
7794 if ((psessionEntry->pePersona == VOS_STA_SAP_MODE) ||
Ravi Joshi27216f12013-10-19 17:04:39 -07007795 (psessionEntry->pePersona == VOS_IBSS_MODE) ||
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -07007796 (psessionEntry->pePersona == VOS_P2P_GO_MODE))
7797 {
7798 val = true;
7799 }
7800
7801 // Program Polaris based on AP capability
7802
7803 if (psessionEntry->limMlmState == eLIM_MLM_WT_JOIN_BEACON_STATE)
7804 // Joining BSS.
7805 val = SIR_MAC_GET_SHORT_SLOT_TIME( psessionEntry->limCurrentBssCaps);
7806 else if (psessionEntry->limMlmState == eLIM_MLM_WT_REASSOC_RSP_STATE)
7807 // Reassociating with AP.
7808 val = SIR_MAC_GET_SHORT_SLOT_TIME( psessionEntry->limReassocBssCaps);
7809 }
7810 else // if (phyMode == WNI_CFG_PHY_MODE_11B) - use this if another phymode is added later ON
7811 {
7812 // Will reach here in 11b case
7813 val = false;
7814 }
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007815 limLog(pMac, LOG1, FL("phyMode = %u shortslotsupported = %u"), phyMode, val);
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -07007816 return val;
7817}
Sandeep Puligilla11d49a62014-01-30 12:05:16 +05307818
7819/**--------------------------------------------
7820\fn limUpdateOBSSScanParams
7821\brief Updates OBSS SCAN IE parameters to session
7822
7823\param psessionEntry - Session Entry
7824\return NONE
7825---------------------------------------------*/
7826void limUpdateOBSSScanParams(tpPESession psessionEntry ,
7827 tDot11fIEOBSSScanParameters *pOBSSScanParameters)
7828{
7829 /*If the recieved value is not in the range specified by the Specification
7830 then it will be the default value configured through cfg */
7831 if (( pOBSSScanParameters->obssScanActiveDwell >
7832 WNI_CFG_OBSS_HT40_SCAN_ACTIVE_DWELL_TIME_STAMIN ) &&
7833 ( pOBSSScanParameters->obssScanActiveDwell <
7834 WNI_CFG_OBSS_HT40_SCAN_ACTIVE_DWELL_TIME_STAMAX))
7835 {
7836 psessionEntry->obssHT40ScanParam.OBSSScanActiveDwellTime=
7837 pOBSSScanParameters->obssScanActiveDwell;
7838 }
7839 if((pOBSSScanParameters->obssScanPassiveDwell >
7840 WNI_CFG_OBSS_HT40_SCAN_PASSIVE_DWELL_TIME_STAMIN ) &&
7841 (pOBSSScanParameters->obssScanPassiveDwell <
7842 WNI_CFG_OBSS_HT40_SCAN_PASSIVE_DWELL_TIME_STAMAX))
7843 {
7844 psessionEntry->obssHT40ScanParam.OBSSScanPassiveDwellTime =
7845 pOBSSScanParameters->obssScanPassiveDwell;
7846 }
7847 if((pOBSSScanParameters->bssWidthChannelTransitionDelayFactor >
7848 WNI_CFG_OBSS_HT40_WIDTH_CHANNEL_TRANSITION_DELAY_FACTOR_STAMIN) &&
7849 (pOBSSScanParameters->bssWidthChannelTransitionDelayFactor <
7850 WNI_CFG_OBSS_HT40_WIDTH_CHANNEL_TRANSITION_DELAY_FACTOR_STAMAX))
7851 {
7852 psessionEntry->obssHT40ScanParam.BSSWidthChannelTransitionDelayFactor =
7853 pOBSSScanParameters->bssWidthChannelTransitionDelayFactor;
7854 }
7855 if((pOBSSScanParameters->obssScanActiveTotalPerChannel >
7856 WNI_CFG_OBSS_HT40_SCAN_ACTIVE_TOTAL_PER_CHANNEL_STAMIN) &&
7857 (pOBSSScanParameters->obssScanActiveTotalPerChannel <
7858 WNI_CFG_OBSS_HT40_SCAN_ACTIVE_TOTAL_PER_CHANNEL_STAMAX))
7859 {
7860 psessionEntry->obssHT40ScanParam.OBSSScanActiveTotalPerChannel =
7861 pOBSSScanParameters->obssScanActiveTotalPerChannel;
7862 }
7863 if((pOBSSScanParameters->obssScanPassiveTotalPerChannel >
7864 WNI_CFG_OBSS_HT40_SCAN_PASSIVE_TOTAL_PER_CHANNEL_STAMIN) &&
7865 (pOBSSScanParameters->obssScanPassiveTotalPerChannel <
7866 WNI_CFG_OBSS_HT40_SCAN_PASSIVE_TOTAL_PER_CHANNEL_STAMAX))
7867 {
7868 psessionEntry->obssHT40ScanParam.OBSSScanPassiveTotalPerChannel =
7869 pOBSSScanParameters->obssScanPassiveTotalPerChannel;
7870 }
7871 if((pOBSSScanParameters->bssChannelWidthTriggerScanInterval >
7872 WNI_CFG_OBSS_HT40_SCAN_WIDTH_TRIGGER_INTERVAL_STAMIN) &&
7873 (pOBSSScanParameters->bssChannelWidthTriggerScanInterval <
7874 WNI_CFG_OBSS_HT40_SCAN_WIDTH_TRIGGER_INTERVAL_STAMAX))
7875 {
7876 psessionEntry->obssHT40ScanParam.BSSChannelWidthTriggerScanInterval =
7877 pOBSSScanParameters->bssChannelWidthTriggerScanInterval;
7878 }
7879 if((pOBSSScanParameters->obssScanActivityThreshold >
7880 WNI_CFG_OBSS_HT40_SCAN_ACTIVITY_THRESHOLD_STAMIN )&&
7881 (pOBSSScanParameters->obssScanActivityThreshold <
7882 WNI_CFG_OBSS_HT40_SCAN_ACTIVITY_THRESHOLD_STAMAX))
7883 {
7884 psessionEntry->obssHT40ScanParam.OBSSScanActivityThreshold =
7885 pOBSSScanParameters->obssScanActivityThreshold;
7886 }
7887}
Chet Lanctot8cecea22014-02-11 19:09:36 -08007888
7889#ifdef WLAN_FEATURE_11W
7890void limPmfSaQueryTimerHandler(void *pMacGlobal, tANI_U32 param)
7891{
7892 tpAniSirGlobal pMac = (tpAniSirGlobal)pMacGlobal;
7893 tPmfSaQueryTimerId timerId;
7894 tpPESession psessionEntry;
7895 tpDphHashNode pSta;
7896 tANI_U32 maxRetries;
7897
7898 limLog(pMac, LOG1, FL("SA Query timer fires"));
7899 timerId.value = param;
7900
7901 // Check that SA Query is in progress
7902 if ((psessionEntry = peFindSessionBySessionId(
7903 pMac, timerId.fields.sessionId)) == NULL)
7904 {
7905 limLog(pMac, LOGE, FL("Session does not exist for given session ID %d"),
7906 timerId.fields.sessionId);
7907 pSta->pmfSaQueryState = DPH_SA_QUERY_NOT_IN_PROGRESS;
7908 return;
7909 }
7910 if ((pSta = dphGetHashEntry(pMac, timerId.fields.peerIdx,
7911 &psessionEntry->dph.dphHashTable)) == NULL)
7912 {
7913 limLog(pMac, LOGE, FL("Entry does not exist for given peer index %d"),
7914 timerId.fields.peerIdx);
7915 pSta->pmfSaQueryState = DPH_SA_QUERY_NOT_IN_PROGRESS;
7916 return;
7917 }
7918 if (DPH_SA_QUERY_IN_PROGRESS != pSta->pmfSaQueryState)
7919 return;
7920
7921 // Increment the retry count, check if reached maximum
7922 if (wlan_cfgGetInt(pMac, WNI_CFG_PMF_SA_QUERY_MAX_RETRIES,
7923 &maxRetries) != eSIR_SUCCESS)
7924 {
7925 limLog(pMac, LOGE, FL("Could not retrieve PMF SA Query maximum retries value"));
7926 pSta->pmfSaQueryState = DPH_SA_QUERY_NOT_IN_PROGRESS;
7927 return;
7928 }
7929 pSta->pmfSaQueryRetryCount++;
7930 if (pSta->pmfSaQueryRetryCount >= maxRetries)
7931 {
7932 limLog(pMac, LOG1, FL("SA Query timed out"));
7933 /* remove before submission */
7934 limLog(pMac, LOGE, FL("SA Query timed out"));
7935 pSta->pmfSaQueryState = DPH_SA_QUERY_TIMED_OUT;
7936 return;
7937 }
7938
7939 // Retry SA Query
7940 limSendSaQueryRequestFrame(pMac, (tANI_U8 *)&(pSta->pmfSaQueryCurrentTransId),
7941 pSta->staAddr, psessionEntry);
7942 pSta->pmfSaQueryCurrentTransId++;
7943 /* remove before submission */
7944 limLog(pMac, LOGE, FL("Starting SA Query retry %d"), pSta->pmfSaQueryRetryCount);
7945 if (tx_timer_activate(&pSta->pmfSaQueryTimer) != TX_SUCCESS)
7946 {
7947 limLog(pMac, LOGE, FL("PMF SA Query timer activation failed!"));
7948 pSta->pmfSaQueryState = DPH_SA_QUERY_NOT_IN_PROGRESS;
7949 }
7950}
7951#endif
7952
Kalikinkar dhara085c02f2014-02-28 15:32:12 -08007953/** ---------------------------------------------------------
7954\fn limProcessChannelSwitchSuspendLink
7955\brief This function call channel switch functions based on
7956 the gLimChannelSwitch.state. After function return it
7957 reset the state to eLIM_CHANNEL_SWITCH_IDLE.
7958 If gLimChannelSwitch.state is non-identified then
7959 print error log as well as restore back the
7960 pre-channelSwitch.
7961\param tpAniSirGlobal pMac
7962\param eHalStatus status
7963\param tANI_U32 *ctx
7964\return None
7965 ------------------------------------------------------------*/
7966static void
7967limProcessChannelSwitchSuspendLink(tpAniSirGlobal pMac,
7968 eHalStatus status,
7969 tANI_U32 *ctx)
7970{
7971 tpPESession pSessionEntry = (tpPESession)ctx;
7972
7973 if ( eHAL_STATUS_SUCCESS != status )
7974 {
7975 limLog(pMac, LOGE,
7976 FL("Suspend link failed. still proceeding "));
7977 }
7978 if (NULL == pSessionEntry )
7979 {
7980 limLog(pMac, LOGE, FL("pSessionEntry is null pointer "));
7981 return;
7982 }
7983
7984 switch(pSessionEntry->gLimChannelSwitch.state)
7985 {
7986 case eLIM_CHANNEL_SWITCH_PRIMARY_ONLY:
7987 PELOGW(limLog(pMac, LOGW,
7988 FL("CHANNEL_SWITCH_PRIMARY_ONLY "));)
7989 limSwitchPrimaryChannel(pMac,
7990 pSessionEntry->gLimChannelSwitch.primaryChannel,
7991 pSessionEntry);
7992 pSessionEntry->gLimChannelSwitch.state =
7993 eLIM_CHANNEL_SWITCH_IDLE;
7994 break;
7995
7996 case eLIM_CHANNEL_SWITCH_PRIMARY_AND_SECONDARY:
7997 PELOGW(limLog(pMac, LOGW,
7998 FL("CHANNEL_SWITCH_PRIMARY_AND_SECONDARY"));)
7999 limSwitchPrimarySecondaryChannel(pMac, pSessionEntry,
8000 pSessionEntry->gLimChannelSwitch.primaryChannel,
8001 pSessionEntry->gLimChannelSwitch.secondarySubBand);
8002 pSessionEntry->gLimChannelSwitch.state =
8003 eLIM_CHANNEL_SWITCH_IDLE;
8004 break;
8005
8006 default:
8007 PELOGE(limLog(pMac, LOGW, FL("incorrect state %d"),
8008 pSessionEntry->gLimChannelSwitch.state);)
8009 if (limRestorePreChannelSwitchState(pMac,
8010 pSessionEntry) != eSIR_SUCCESS)
8011 {
8012 limLog(pMac, LOGE,
8013 FL("Could not restore pre-channelSwitch "
8014 "(11h) state, resetting the system"));
8015 }
8016 }
8017}