blob: dc51ba2c5e4533db2b520f166e51fc366898baeb [file] [log] [blame]
Jeff Johnson295189b2012-06-20 16:38:30 -07001/*
Gopichand Nakkala92f07d82013-01-08 21:16:34 -08002 * Copyright (c) 2012-2013, The Linux Foundation. All rights reserved.
3 *
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.
20 */
21/*
Jeff Johnson32d95a32012-09-10 13:15:23 -070022 * Copyright (c) 2012, The Linux Foundation. All rights reserved.
Jeff Johnson295189b2012-06-20 16:38:30 -070023 *
24 * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
25 *
26 *
27 * Permission to use, copy, modify, and/or distribute this software for
28 * any purpose with or without fee is hereby granted, provided that the
29 * above copyright notice and this permission notice appear in all
30 * copies.
31 *
32 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
33 * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
34 * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
35 * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
36 * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
37 * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
38 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
39 * PERFORMANCE OF THIS SOFTWARE.
40 */
41
42/*
43 * Airgo Networks, Inc proprietary. All rights reserved.
44 * This file limUtils.cc contains the utility functions
45 * LIM uses.
46 * Author: Chandra Modumudi
47 * Date: 02/13/02
48 * History:-
49 * Date Modified by Modification Information
50 * --------------------------------------------------------------------
51 */
52
53#include "schApi.h"
54#include "limUtils.h"
55#include "limTypes.h"
56#include "limSecurityUtils.h"
57#include "limPropExtsUtils.h"
58#include "limSendMessages.h"
59#include "limSerDesUtils.h"
60#include "limAdmitControl.h"
61#include "limStaHashApi.h"
62#include "dot11f.h"
63#include "wmmApsd.h"
64#include "limTrace.h"
Jeff Johnson77165482013-03-07 08:15:44 -080065#ifdef FEATURE_WLAN_DIAG_SUPPORT
Jeff Johnson295189b2012-06-20 16:38:30 -070066#include "vos_diag_core_event.h"
67#endif //FEATURE_WLAN_DIAG_SUPPORT
68#include "limIbssPeerMgmt.h"
69#include "limSessionUtils.h"
70#include "limSession.h"
71#include "vos_nvitem.h"
72
73/* Static global used to mark situations where pMac->lim.gLimTriggerBackgroundScanDuringQuietBss is SET
74 * and limTriggerBackgroundScanDuringQuietBss() returned failure. In this case, we will stop data
75 * traffic instead of going into scan. The recover function limProcessQuietBssTimeout() needs to have
76 * this information. */
77static tAniBool glimTriggerBackgroundScanDuringQuietBss_Status = eSIR_TRUE;
78
79/* 11A Channel list to decode RX BD channel information */
80static const tANI_U8 abChannel[]= {36,40,44,48,52,56,60,64,100,104,108,112,116,
81 120,124,128,132,136,140,149,153,157,161,165};
82
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -070083#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
84static const tANI_U8 aUnsortedChannelList[]= {52,56,60,64,100,104,108,112,116,
85 120,124,128,132,136,140,36,40,44,48,149,153,157,161,165};
86#endif
87
Jeff Johnson295189b2012-06-20 16:38:30 -070088//#define LIM_MAX_ACTIVE_SESSIONS 3 //defined temporarily for BT-AMP SUPPORT
89#define SUCCESS 1 //defined temporarily for BT-AMP
90
Agarwal Ashish87039eb2014-01-15 14:13:15 +053091#define MAX_BA_WINDOW_SIZE_FOR_CISCO 25
Jeff Johnson295189b2012-06-20 16:38:30 -070092/** -------------------------------------------------------------
93\fn limAssignDialogueToken
94\brief Assigns dialogue token.
95\param tpAniSirGlobal pMac
96\return tpDialogueToken - dialogueToken data structure.
97 -------------------------------------------------------------*/
98
99tpDialogueToken
100limAssignDialogueToken(tpAniSirGlobal pMac)
101{
Madan Mohan Koyyalamudidfd6aa82012-10-18 20:18:43 -0700102 static tANI_U8 token;
Jeff Johnson295189b2012-06-20 16:38:30 -0700103 tpDialogueToken pCurrNode;
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530104 pCurrNode = vos_mem_malloc(sizeof(tDialogueToken));
105 if ( NULL == pCurrNode )
Jeff Johnson295189b2012-06-20 16:38:30 -0700106 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530107 PELOGE(limLog(pMac, LOGE, FL("AllocateMemory failed"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700108 return NULL;
109 }
110
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530111 vos_mem_set((void *) pCurrNode, sizeof(tDialogueToken), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -0700112 //first node in the list is being added.
113 if(NULL == pMac->lim.pDialogueTokenHead)
114 {
115 pMac->lim.pDialogueTokenHead = pMac->lim.pDialogueTokenTail = pCurrNode;
116 }
117 else
118 {
119 pMac->lim.pDialogueTokenTail->next = pCurrNode;
120 pMac->lim.pDialogueTokenTail = pCurrNode;
121 }
122 //assocId and tid of the node will be filled in by caller.
123 pCurrNode->next = NULL;
124 pCurrNode->token = token++;
Praveen Kumar Sirisilla539f7422013-08-28 17:01:05 -0700125
126 /* Dialog token should be a non-zero value */
127 if (0 == pCurrNode->token)
128 pCurrNode->token = token;
129
130 PELOG4(limLog(pMac, LOG4, FL("token assigned = %d"), pCurrNode->token);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700131 return pCurrNode;
132}
133
134/** -------------------------------------------------------------
135\fn limSearchAndDeleteDialogueToken
136\brief search dialogue token in the list and deletes it if found. returns failure if not found.
137\param tpAniSirGlobal pMac
138\param tANI_U8 token
139\param tANI_U16 assocId
140\param tANI_U16 tid
141\return eSirRetStatus - status of the search
142 -------------------------------------------------------------*/
143
144
145tSirRetStatus
146limSearchAndDeleteDialogueToken(tpAniSirGlobal pMac, tANI_U8 token, tANI_U16 assocId, tANI_U16 tid)
147{
148 tpDialogueToken pCurrNode = pMac->lim.pDialogueTokenHead;
149 tpDialogueToken pPrevNode = pMac->lim.pDialogueTokenHead;
150
151 //if the list is empty
152 if(NULL == pCurrNode)
153 return eSIR_FAILURE;
154
155 // if the matching node is the first node.
156 if(pCurrNode &&
157 (assocId == pCurrNode->assocId) &&
158 (tid == pCurrNode->tid))
159 {
160 pMac->lim.pDialogueTokenHead = pCurrNode->next;
161 //there was only one node in the list. So tail pointer also needs to be adjusted.
162 if(NULL == pMac->lim.pDialogueTokenHead)
163 pMac->lim.pDialogueTokenTail = NULL;
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530164 vos_mem_free(pCurrNode);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -0800165 pMac->lim.pDialogueTokenHead = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -0700166 return eSIR_SUCCESS;
167 }
168
169 //first node did not match. so move to the next one.
170 pCurrNode = pCurrNode->next;
171 while(NULL != pCurrNode )
172 {
173 if(token == pCurrNode->token)
174 {
175 break;
176 }
177
178 pPrevNode = pCurrNode;
179 pCurrNode = pCurrNode->next;
180 }
181
182 if(pCurrNode &&
183 (assocId == pCurrNode->assocId) &&
184 (tid == pCurrNode->tid))
185 {
186 pPrevNode->next = pCurrNode->next;
187 //if the node being deleted is the last one then we also need to move the tail pointer to the prevNode.
188 if(NULL == pCurrNode->next)
189 pMac->lim.pDialogueTokenTail = pPrevNode;
Kiet Lam842c3e12013-11-16 22:40:57 +0530190 vos_mem_free(pCurrNode);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -0800191 pMac->lim.pDialogueTokenHead = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -0700192 return eSIR_SUCCESS;
193 }
194
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700195 PELOGW(limLog(pMac, LOGW, FL("LIM does not have matching dialogue token node"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700196 return eSIR_FAILURE;
197
198}
199
200
201/** -------------------------------------------------------------
202\fn limDeleteDialogueTokenList
203\brief deletes the complete lim dialogue token linked list.
204\param tpAniSirGlobal pMac
205\return None
206 -------------------------------------------------------------*/
207void
208limDeleteDialogueTokenList(tpAniSirGlobal pMac)
209{
210 tpDialogueToken pCurrNode = pMac->lim.pDialogueTokenHead;
211
212 while(NULL != pMac->lim.pDialogueTokenHead)
213 {
214 pCurrNode = pMac->lim.pDialogueTokenHead;
215 pMac->lim.pDialogueTokenHead = pMac->lim.pDialogueTokenHead->next;
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530216 vos_mem_free(pCurrNode);
Jeff Johnson295189b2012-06-20 16:38:30 -0700217 pCurrNode = NULL;
218 }
219 pMac->lim.pDialogueTokenTail = NULL;
220}
221
222void
223limGetBssidFromBD(tpAniSirGlobal pMac, tANI_U8 * pRxPacketInfo, tANI_U8 *bssId, tANI_U32 *pIgnore)
224{
225 tpSirMacDataHdr3a pMh = WDA_GET_RX_MPDUHEADER3A(pRxPacketInfo);
226 *pIgnore = 0;
227
228 if (pMh->fc.toDS == 1 && pMh->fc.fromDS == 0)
229 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530230 vos_mem_copy( bssId, pMh->addr1, 6);
Jeff Johnson295189b2012-06-20 16:38:30 -0700231 *pIgnore = 1;
232 }
233 else if (pMh->fc.toDS == 0 && pMh->fc.fromDS == 1)
234 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530235 vos_mem_copy ( bssId, pMh->addr2, 6);
Jeff Johnson295189b2012-06-20 16:38:30 -0700236 *pIgnore = 1;
237 }
238 else if (pMh->fc.toDS == 0 && pMh->fc.fromDS == 0)
239 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530240 vos_mem_copy( bssId, pMh->addr3, 6);
Jeff Johnson295189b2012-06-20 16:38:30 -0700241 *pIgnore = 0;
242 }
243 else
244 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530245 vos_mem_copy( bssId, pMh->addr1, 6);
Jeff Johnson295189b2012-06-20 16:38:30 -0700246 *pIgnore = 1;
247 }
248}
249
250char *
251limMlmStateStr(tLimMlmStates state)
252{
Jeff Johnson295189b2012-06-20 16:38:30 -0700253 switch (state)
254 {
255 case eLIM_MLM_OFFLINE_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700256 return "eLIM_MLM_OFFLINE_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700257 case eLIM_MLM_IDLE_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700258 return "eLIM_MLM_IDLE_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700259 case eLIM_MLM_WT_PROBE_RESP_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700260 return "eLIM_MLM_WT_PROBE_RESP_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700261 case eLIM_MLM_PASSIVE_SCAN_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700262 return "eLIM_MLM_PASSIVE_SCAN_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700263 case eLIM_MLM_WT_JOIN_BEACON_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700264 return "eLIM_MLM_WT_JOIN_BEACON_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700265 case eLIM_MLM_JOINED_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700266 return "eLIM_MLM_JOINED_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700267 case eLIM_MLM_BSS_STARTED_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700268 return "eLIM_MLM_BSS_STARTED_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700269 case eLIM_MLM_WT_AUTH_FRAME2_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700270 return "eLIM_MLM_WT_AUTH_FRAME2_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700271 case eLIM_MLM_WT_AUTH_FRAME3_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700272 return "eLIM_MLM_WT_AUTH_FRAME3_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700273 case eLIM_MLM_WT_AUTH_FRAME4_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700274 return "eLIM_MLM_WT_AUTH_FRAME4_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700275 case eLIM_MLM_AUTH_RSP_TIMEOUT_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700276 return "eLIM_MLM_AUTH_RSP_TIMEOUT_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700277 case eLIM_MLM_AUTHENTICATED_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700278 return "eLIM_MLM_AUTHENTICATED_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700279 case eLIM_MLM_WT_ASSOC_RSP_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700280 return "eLIM_MLM_WT_ASSOC_RSP_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700281 case eLIM_MLM_WT_REASSOC_RSP_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700282 return "eLIM_MLM_WT_REASSOC_RSP_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700283 case eLIM_MLM_WT_FT_REASSOC_RSP_STATE:
284 return "eLIM_MLM_WT_FT_REASSOC_RSP_STATE";
285 case eLIM_MLM_WT_DEL_STA_RSP_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700286 return "eLIM_MLM_WT_DEL_STA_RSP_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700287 case eLIM_MLM_WT_DEL_BSS_RSP_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700288 return "eLIM_MLM_WT_DEL_BSS_RSP_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700289 case eLIM_MLM_WT_ADD_STA_RSP_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700290 return "eLIM_MLM_WT_ADD_STA_RSP_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700291 case eLIM_MLM_WT_ADD_BSS_RSP_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700292 return "eLIM_MLM_WT_ADD_BSS_RSP_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700293 case eLIM_MLM_REASSOCIATED_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700294 return "eLIM_MLM_REASSOCIATED_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700295 case eLIM_MLM_LINK_ESTABLISHED_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700296 return "eLIM_MLM_LINK_ESTABLISHED_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700297 case eLIM_MLM_WT_ASSOC_CNF_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700298 return "eLIM_MLM_WT_ASSOC_CNF_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700299 case eLIM_MLM_WT_ADD_BSS_RSP_ASSOC_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700300 return "eLIM_MLM_WT_ADD_BSS_RSP_ASSOC_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700301 case eLIM_MLM_WT_ADD_BSS_RSP_REASSOC_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700302 return "eLIM_MLM_WT_ADD_BSS_RSP_REASSOC_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700303 case eLIM_MLM_WT_ADD_BSS_RSP_FT_REASSOC_STATE:
304 return "eLIM_MLM_WT_ADD_BSS_RSP_FT_REASSOC_STATE";
305 case eLIM_MLM_WT_ASSOC_DEL_STA_RSP_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700306 return "eLIM_MLM_WT_ASSOC_DEL_STA_RSP_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700307 case eLIM_MLM_WT_SET_BSS_KEY_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700308 return "eLIM_MLM_WT_SET_BSS_KEY_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700309 case eLIM_MLM_WT_SET_STA_KEY_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700310 return "eLIM_MLM_WT_SET_STA_KEY_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700311 default:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700312 return "INVALID MLM state";
Jeff Johnson295189b2012-06-20 16:38:30 -0700313 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700314}
315
316void
317limPrintMlmState(tpAniSirGlobal pMac, tANI_U16 logLevel, tLimMlmStates state)
318{
319 limLog(pMac, logLevel, limMlmStateStr(state));
320}
321
322char *
323limSmeStateStr(tLimSmeStates state)
324{
325#ifdef FIXME_GEN6
326 switch (state)
327 {
328 case eLIM_SME_OFFLINE_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700329 return "eLIM_SME_OFFLINE_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700330 case eLIM_SME_IDLE_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700331 return "eLIM_SME_IDLE_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700332 case eLIM_SME_SUSPEND_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700333 return "eLIM_SME_SUSPEND_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700334 case eLIM_SME_WT_SCAN_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700335 return "eLIM_SME_WT_SCAN_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700336 case eLIM_SME_WT_JOIN_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700337 return "eLIM_SME_WT_JOIN_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700338 case eLIM_SME_WT_AUTH_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700339 return "eLIM_SME_WT_AUTH_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700340 case eLIM_SME_WT_ASSOC_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700341 return "eLIM_SME_WT_ASSOC_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700342 case eLIM_SME_WT_REASSOC_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700343 return "eLIM_SME_WT_REASSOC_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700344 case eLIM_SME_WT_REASSOC_LINK_FAIL_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700345 return "eLIM_SME_WT_REASSOC_LINK_FAIL_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700346 case eLIM_SME_JOIN_FAILURE_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700347 return "eLIM_SME_JOIN_FAILURE_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700348 case eLIM_SME_ASSOCIATED_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700349 return "eLIM_SME_ASSOCIATED_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700350 case eLIM_SME_REASSOCIATED_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700351 return "eLIM_SME_REASSOCIATED_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700352 case eLIM_SME_LINK_EST_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700353 return "eLIM_SME_LINK_EST_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700354 case eLIM_SME_LINK_EST_WT_SCAN_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700355 return "eLIM_SME_LINK_EST_WT_SCAN_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700356 case eLIM_SME_WT_PRE_AUTH_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700357 return "eLIM_SME_WT_PRE_AUTH_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700358 case eLIM_SME_WT_DISASSOC_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700359 return "eLIM_SME_WT_DISASSOC_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700360 case eLIM_SME_WT_DEAUTH_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700361 return "eLIM_SME_WT_DEAUTH_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700362 case eLIM_SME_WT_START_BSS_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700363 return "eLIM_SME_WT_START_BSS_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700364 case eLIM_SME_WT_STOP_BSS_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700365 return "eLIM_SME_WT_STOP_BSS_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700366 case eLIM_SME_NORMAL_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700367 return "eLIM_SME_NORMAL_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700368 case eLIM_SME_CHANNEL_SCAN_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700369 return "eLIM_SME_CHANNEL_SCAN_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700370 case eLIM_SME_NORMAL_CHANNEL_SCAN_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700371 return "eLIM_SME_NORMAL_CHANNEL_SCAN_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700372 default:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700373 return "INVALID SME state";
Jeff Johnson295189b2012-06-20 16:38:30 -0700374 }
375#endif
376return "";
377}
378
379
380char* limDot11ModeStr(tpAniSirGlobal pMac, tANI_U8 dot11Mode)
381{
382#ifdef FIXME_GEN6
383
384 switch(dot11Mode)
385 {
386 case WNI_CFG_DOT11_MODE_ALL:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700387 return "ALL";
Jeff Johnson295189b2012-06-20 16:38:30 -0700388 case WNI_CFG_DOT11_MODE_11A:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700389 return "11A";
390 case WNI_CFG_DOT11_MODE_11B:
391 return "11B";
392 case WNI_CFG_DOT11_MODE_11G:
393 return "11G";
394 case WNI_CFG_DOT11_MODE_11N:
395 return "11N";
396 case WNI_CFG_DOT11_MODE_POLARIS:
397 return "Polaris";
398 case WNI_CFG_DOT11_MODE_TITAN:
399 return "Titan";
Jeff Johnson295189b2012-06-20 16:38:30 -0700400 case WNI_CFG_DOT11_MODE_TAURUS:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700401 return "Taurus";
Jeff Johnson295189b2012-06-20 16:38:30 -0700402 default:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700403 return "Invalid Dot11 Mode";
Jeff Johnson295189b2012-06-20 16:38:30 -0700404 }
405#endif
406return "";
407}
408
409
410char* limStaOpRateModeStr(tStaRateMode opRateMode)
411{
412#ifdef FIXME_GEN6
413
414 switch(opRateMode)
415 {
416 case eSTA_TAURUS:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700417 return "Taurus";
Jeff Johnson295189b2012-06-20 16:38:30 -0700418 case eSTA_11a:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700419 return "11A";
420 case eSTA_11b:
421 return "11B";
422 case eSTA_11bg:
423 return "11G";
424 case eSTA_11n:
425 return "11N";
426 case eSTA_POLARIS:
427 return "Polaris";
Jeff Johnson295189b2012-06-20 16:38:30 -0700428 case eSTA_TITAN:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700429 return "Titan";
Jeff Johnson295189b2012-06-20 16:38:30 -0700430 default:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700431 return "Invalid Dot11 Mode";
Jeff Johnson295189b2012-06-20 16:38:30 -0700432 }
433#endif
434return "";
435}
436
437char* limBssTypeStr(tSirBssType bssType)
438{
439 switch(bssType)
440 {
441 case eSIR_INFRASTRUCTURE_MODE:
442 return "eSIR_INFRASTRUCTURE_MODE";
443 case eSIR_IBSS_MODE:
444 return "eSIR_IBSS_MODE";
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700445 case eSIR_BTAMP_STA_MODE:
Jeff Johnson295189b2012-06-20 16:38:30 -0700446 return "eSIR_BTAMP_STA_MODE";
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700447 case eSIR_BTAMP_AP_MODE:
Jeff Johnson295189b2012-06-20 16:38:30 -0700448 return "eSIR_BTAMP_AP_MODE";
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700449 case eSIR_AUTO_MODE:
Jeff Johnson295189b2012-06-20 16:38:30 -0700450 return "eSIR_AUTO_MODE";
451 default:
452 return "Invalid BSS Type";
453 }
454}
455
456void
457limPrintSmeState(tpAniSirGlobal pMac, tANI_U16 logLevel, tLimSmeStates state)
458{
459 limLog(pMac, logLevel, limSmeStateStr(state));
460}
461
462char *limMsgStr(tANI_U32 msgType)
463{
464#ifdef FIXME_GEN6
465 switch (msgType)
466 {
467 case eWNI_SME_START_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700468 return "eWNI_SME_START_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700469 case eWNI_SME_START_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700470 return "eWNI_SME_START_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700471 case eWNI_SME_SYS_READY_IND:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700472 return "eWNI_SME_SYS_READY_IND";
Jeff Johnson295189b2012-06-20 16:38:30 -0700473 case eWNI_SME_SCAN_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700474 return "eWNI_SME_SCAN_REQ";
Jeff Johnsone7245742012-09-05 17:12:55 -0700475#ifdef FEATURE_OEM_DATA_SUPPORT
476 case eWNI_SME_OEM_DATA_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700477 return "eWNI_SME_OEM_DATA_REQ";
Jeff Johnsone7245742012-09-05 17:12:55 -0700478 case eWNI_SME_OEM_DATA_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700479 return "eWNI_SME_OEM_DATA_RSP";
Jeff Johnsone7245742012-09-05 17:12:55 -0700480#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700481 case eWNI_SME_SCAN_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700482 return "eWNI_SME_SCAN_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700483 case eWNI_SME_JOIN_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700484 return "eWNI_SME_JOIN_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700485 case eWNI_SME_JOIN_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700486 return "eWNI_SME_JOIN_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700487 case eWNI_SME_SETCONTEXT_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700488 return "eWNI_SME_SETCONTEXT_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700489 case eWNI_SME_SETCONTEXT_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700490 return "eWNI_SME_SETCONTEXT_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700491 case eWNI_SME_REASSOC_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700492 return "eWNI_SME_REASSOC_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700493 case eWNI_SME_REASSOC_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700494 return "eWNI_SME_REASSOC_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700495 case eWNI_SME_AUTH_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700496 return "eWNI_SME_AUTH_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700497 case eWNI_SME_AUTH_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700498 return "eWNI_SME_AUTH_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700499 case eWNI_SME_DISASSOC_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700500 return "eWNI_SME_DISASSOC_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700501 case eWNI_SME_DISASSOC_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700502 return "eWNI_SME_DISASSOC_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700503 case eWNI_SME_DISASSOC_IND:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700504 return "eWNI_SME_DISASSOC_IND";
Jeff Johnson295189b2012-06-20 16:38:30 -0700505 case eWNI_SME_DISASSOC_CNF:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700506 return "eWNI_SME_DISASSOC_CNF";
Jeff Johnson295189b2012-06-20 16:38:30 -0700507 case eWNI_SME_DEAUTH_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700508 return "eWNI_SME_DEAUTH_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700509 case eWNI_SME_DEAUTH_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700510 return "eWNI_SME_DEAUTH_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700511 case eWNI_SME_DEAUTH_IND:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700512 return "eWNI_SME_DEAUTH_IND";
Jeff Johnson295189b2012-06-20 16:38:30 -0700513 case eWNI_SME_WM_STATUS_CHANGE_NTF:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700514 return "eWNI_SME_WM_STATUS_CHANGE_NTF";
Jeff Johnson295189b2012-06-20 16:38:30 -0700515 case eWNI_SME_START_BSS_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700516 return "eWNI_SME_START_BSS_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700517 case eWNI_SME_START_BSS_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700518 return "eWNI_SME_START_BSS_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700519 case eWNI_SME_AUTH_IND:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700520 return "eWNI_SME_AUTH_IND";
Jeff Johnson295189b2012-06-20 16:38:30 -0700521 case eWNI_SME_ASSOC_IND:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700522 return "eWNI_SME_ASSOC_IND";
Jeff Johnson295189b2012-06-20 16:38:30 -0700523 case eWNI_SME_ASSOC_CNF:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700524 return "eWNI_SME_ASSOC_CNF";
Jeff Johnson295189b2012-06-20 16:38:30 -0700525 case eWNI_SME_REASSOC_IND:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700526 return "eWNI_SME_REASSOC_IND";
Jeff Johnson295189b2012-06-20 16:38:30 -0700527 case eWNI_SME_REASSOC_CNF:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700528 return "eWNI_SME_REASSOC_CNF";
Jeff Johnson295189b2012-06-20 16:38:30 -0700529 case eWNI_SME_SWITCH_CHL_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700530 return "eWNI_SME_SWITCH_CHL_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700531 case eWNI_SME_SWITCH_CHL_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700532 return "eWNI_SME_SWITCH_CHL_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700533 case eWNI_SME_SWITCH_CHL_CB_PRIMARY_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700534 return "eWNI_SME_SWITCH_CHL_CB_PRIMARY_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700535 case eWNI_SME_SWITCH_CHL_CB_SECONDARY_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700536 return "eWNI_SME_SWITCH_CHL_CB_SECONDARY_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700537 case eWNI_SME_STOP_BSS_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700538 return "eWNI_SME_STOP_BSS_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700539 case eWNI_SME_STOP_BSS_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700540 return "eWNI_SME_STOP_BSS_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700541 case eWNI_SME_PROMISCUOUS_MODE_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700542 return "eWNI_SME_PROMISCUOUS_MODE_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700543 case eWNI_SME_PROMISCUOUS_MODE_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700544 return "eWNI_SME_PROMISCUOUS_MODE_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700545 case eWNI_SME_NEIGHBOR_BSS_IND:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700546 return "eWNI_SME_NEIGHBOR_BSS_IND";
Jeff Johnson295189b2012-06-20 16:38:30 -0700547 case eWNI_SME_MEASUREMENT_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700548 return "eWNI_SME_MEASUREMENT_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700549 case eWNI_SME_MEASUREMENT_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700550 return "eWNI_SME_MEASUREMENT_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700551 case eWNI_SME_MEASUREMENT_IND:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700552 return "eWNI_SME_MEASUREMENT_IND";
Jeff Johnson295189b2012-06-20 16:38:30 -0700553 case eWNI_SME_SET_WDS_INFO_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700554 return "eWNI_SME_SET_WDS_INFO_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700555 case eWNI_SME_SET_WDS_INFO_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700556 return "eWNI_SME_SET_WDS_INFO_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700557 case eWNI_SME_WDS_INFO_IND:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700558 return "eWNI_SME_WDS_INFO_IND";
Jeff Johnson295189b2012-06-20 16:38:30 -0700559 case eWNI_SME_DEAUTH_CNF:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700560 return "eWNI_SME_DEAUTH_CNF";
Jeff Johnson295189b2012-06-20 16:38:30 -0700561 case eWNI_SME_MIC_FAILURE_IND:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700562 return "eWNI_SME_MIC_FAILURE_IND";
Jeff Johnson295189b2012-06-20 16:38:30 -0700563 case eWNI_SME_ADDTS_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700564 return "eWNI_SME_ADDTS_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700565 case eWNI_SME_ADDTS_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700566 return "eWNI_SME_ADDTS_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700567 case eWNI_SME_ADDTS_CNF:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700568 return "eWNI_SME_ADDTS_CNF";
Jeff Johnson295189b2012-06-20 16:38:30 -0700569 case eWNI_SME_ADDTS_IND:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700570 return "eWNI_SME_ADDTS_IND";
Jeff Johnson295189b2012-06-20 16:38:30 -0700571 case eWNI_SME_DELTS_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700572 return "eWNI_SME_DELTS_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700573 case eWNI_SME_DELTS_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700574 return "eWNI_SME_DELTS_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700575 case eWNI_SME_DELTS_IND:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700576 return "eWNI_SME_DELTS_IND";
Srinivas Girigowdad34cedb2013-01-25 13:33:11 -0800577#if defined WLAN_FEATURE_VOWIFI_11R || defined FEATURE_WLAN_CCX || defined(FEATURE_WLAN_LFR)
578 case eWNI_SME_GET_ROAM_RSSI_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700579 return "eWNI_SME_GET_ROAM_RSSI_REQ";
Srinivas Girigowdad34cedb2013-01-25 13:33:11 -0800580 case eWNI_SME_GET_ROAM_RSSI_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700581 return "eWNI_SME_GET_ROAM_RSSI_RSP";
Srinivas Girigowdad34cedb2013-01-25 13:33:11 -0800582#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700583
Jeff Johnson295189b2012-06-20 16:38:30 -0700584 case WDA_SUSPEND_ACTIVITY_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700585 return "WDA_SUSPEND_ACTIVITY_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700586 case SIR_LIM_RETRY_INTERRUPT_MSG:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700587 return "SIR_LIM_RETRY_INTERRUPT_MSG";
Jeff Johnson295189b2012-06-20 16:38:30 -0700588 case SIR_BB_XPORT_MGMT_MSG:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700589 return "SIR_BB_XPORT_MGMT_MSG";
Jeff Johnson295189b2012-06-20 16:38:30 -0700590 case SIR_LIM_INV_KEY_INTERRUPT_MSG:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700591 return "SIR_LIM_INV_KEY_INTERRUPT_MSG";
Jeff Johnson295189b2012-06-20 16:38:30 -0700592 case SIR_LIM_KEY_ID_INTERRUPT_MSG:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700593 return "SIR_LIM_KEY_ID_INTERRUPT_MSG";
Jeff Johnson295189b2012-06-20 16:38:30 -0700594 case SIR_LIM_REPLAY_THRES_INTERRUPT_MSG:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700595 return "SIR_LIM_REPLAY_THRES_INTERRUPT_MSG";
Jeff Johnson295189b2012-06-20 16:38:30 -0700596 case SIR_LIM_MIN_CHANNEL_TIMEOUT:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700597 return "SIR_LIM_MIN_CHANNEL_TIMEOUT";
Jeff Johnson295189b2012-06-20 16:38:30 -0700598 case SIR_LIM_MAX_CHANNEL_TIMEOUT:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700599 return "SIR_LIM_MAX_CHANNEL_TIMEOUT";
Jeff Johnson295189b2012-06-20 16:38:30 -0700600 case SIR_LIM_JOIN_FAIL_TIMEOUT:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700601 return "SIR_LIM_JOIN_FAIL_TIMEOUT";
Jeff Johnson295189b2012-06-20 16:38:30 -0700602 case SIR_LIM_AUTH_FAIL_TIMEOUT:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700603 return "SIR_LIM_AUTH_FAIL_TIMEOUT";
Jeff Johnson295189b2012-06-20 16:38:30 -0700604 case SIR_LIM_AUTH_RSP_TIMEOUT:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700605 return "SIR_LIM_AUTH_RSP_TIMEOUT";
Jeff Johnson295189b2012-06-20 16:38:30 -0700606 case SIR_LIM_ASSOC_FAIL_TIMEOUT:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700607 return "SIR_LIM_ASSOC_FAIL_TIMEOUT";
Jeff Johnson295189b2012-06-20 16:38:30 -0700608 case SIR_LIM_REASSOC_FAIL_TIMEOUT:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700609 return "SIR_LIM_REASSOC_FAIL_TIMEOUT";
Jeff Johnson295189b2012-06-20 16:38:30 -0700610 case SIR_LIM_HEART_BEAT_TIMEOUT:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700611 return "SIR_LIM_HEART_BEAT_TIMEOUT";
Jeff Johnson295189b2012-06-20 16:38:30 -0700612 case SIR_LIM_ADDTS_RSP_TIMEOUT:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700613 return "SIR_LIM_ADDTS_RSP_TIMEOUT";
Jeff Johnson295189b2012-06-20 16:38:30 -0700614 case SIR_LIM_CHANNEL_SCAN_TIMEOUT:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700615 return "SIR_LIM_CHANNEL_SCAN_TIMEOUT";
Jeff Johnson295189b2012-06-20 16:38:30 -0700616 case SIR_LIM_LINK_TEST_DURATION_TIMEOUT:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700617 return "SIR_LIM_LINK_TEST_DURATION_TIMEOUT";
Jeff Johnson295189b2012-06-20 16:38:30 -0700618 case SIR_LIM_HASH_MISS_THRES_TIMEOUT:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700619 return "SIR_LIM_HASH_MISS_THRES_TIMEOUT";
Jeff Johnson295189b2012-06-20 16:38:30 -0700620 case SIR_LIM_KEEPALIVE_TIMEOUT:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700621 return "SIR_LIM_KEEPALIVE_TIMEOUT";
Jeff Johnson295189b2012-06-20 16:38:30 -0700622 case SIR_LIM_UPDATE_OLBC_CACHEL_TIMEOUT:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700623 return "SIR_LIM_UPDATE_OLBC_CACHEL_TIMEOUT";
Jeff Johnson295189b2012-06-20 16:38:30 -0700624 case SIR_LIM_CNF_WAIT_TIMEOUT:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700625 return "SIR_LIM_CNF_WAIT_TIMEOUT";
Jeff Johnson295189b2012-06-20 16:38:30 -0700626 case SIR_LIM_RADAR_DETECT_IND:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700627 return "SIR_LIM_RADAR_DETECT_IND";
Jeff Johnson295189b2012-06-20 16:38:30 -0700628#ifdef WLAN_FEATURE_VOWIFI_11R
629 case SIR_LIM_FT_PREAUTH_RSP_TIMEOUT:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700630 return "SIR_LIM_FT_PREAUTH_RSP_TIMEOUT";
Jeff Johnson295189b2012-06-20 16:38:30 -0700631#endif
632
633 case SIR_HAL_APP_SETUP_NTF:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700634 return "SIR_HAL_APP_SETUP_NTF";
Jeff Johnson295189b2012-06-20 16:38:30 -0700635 case SIR_HAL_INITIAL_CAL_FAILED_NTF:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700636 return "SIR_HAL_INITIAL_CAL_FAILED_NTF";
Jeff Johnson295189b2012-06-20 16:38:30 -0700637 case SIR_HAL_NIC_OPER_NTF:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700638 return "SIR_HAL_NIC_OPER_NTF";
Jeff Johnson295189b2012-06-20 16:38:30 -0700639 case SIR_HAL_INIT_START_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700640 return "SIR_HAL_INIT_START_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700641 case SIR_HAL_SHUTDOWN_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700642 return "SIR_HAL_SHUTDOWN_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700643 case SIR_HAL_SHUTDOWN_CNF:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700644 return "SIR_HAL_SHUTDOWN_CNF";
Jeff Johnson295189b2012-06-20 16:38:30 -0700645 case SIR_HAL_RESET_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700646 return "SIR_HAL_RESET_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700647 case SIR_HAL_RESET_CNF:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700648 return "SIR_HAL_RESET_CNF";
Jeff Johnson295189b2012-06-20 16:38:30 -0700649 case SIR_WRITE_TO_TD:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700650 return "SIR_WRITE_TO_TD";
Jeff Johnson295189b2012-06-20 16:38:30 -0700651
652 case WNI_CFG_PARAM_UPDATE_IND:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700653 return "WNI_CFG_PARAM_UPDATE_IND";
Jeff Johnson295189b2012-06-20 16:38:30 -0700654 case WNI_CFG_DNLD_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700655 return "WNI_CFG_DNLD_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700656 case WNI_CFG_DNLD_CNF:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700657 return "WNI_CFG_DNLD_CNF";
Jeff Johnson295189b2012-06-20 16:38:30 -0700658 case WNI_CFG_GET_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700659 return "WNI_CFG_GET_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700660 case WNI_CFG_SET_CNF:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700661 return "WNI_CFG_SET_CNF";
Jeff Johnson295189b2012-06-20 16:38:30 -0700662 case WNI_CFG_GET_ATTRIB_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700663 return "WNI_CFG_GET_ATTRIB_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700664 case WNI_CFG_ADD_GRP_ADDR_CNF:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700665 return "WNI_CFG_ADD_GRP_ADDR_CNF";
Jeff Johnson295189b2012-06-20 16:38:30 -0700666 case WNI_CFG_DEL_GRP_ADDR_CNF:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700667 return "WNI_CFG_DEL_GRP_ADDR_CNF";
Jeff Johnson295189b2012-06-20 16:38:30 -0700668 case ANI_CFG_GET_RADIO_STAT_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700669 return "ANI_CFG_GET_RADIO_STAT_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700670 case ANI_CFG_GET_PER_STA_STAT_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700671 return "ANI_CFG_GET_PER_STA_STAT_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700672 case ANI_CFG_GET_AGG_STA_STAT_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700673 return "ANI_CFG_GET_AGG_STA_STAT_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700674 case ANI_CFG_CLEAR_STAT_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700675 return "ANI_CFG_CLEAR_STAT_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700676 case WNI_CFG_DNLD_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700677 return "WNI_CFG_DNLD_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700678 case WNI_CFG_GET_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700679 return "WNI_CFG_GET_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700680 case WNI_CFG_SET_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700681 return "WNI_CFG_SET_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700682 case WNI_CFG_SET_REQ_NO_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700683 return "WNI_CFG_SET_REQ_NO_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700684 case eWNI_PMC_ENTER_IMPS_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700685 return "eWNI_PMC_ENTER_IMPS_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700686 case eWNI_PMC_EXIT_IMPS_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700687 return "eWNI_PMC_EXIT_IMPS_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700688 case eWNI_PMC_ENTER_BMPS_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700689 return "eWNI_PMC_ENTER_BMPS_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700690 case eWNI_PMC_EXIT_BMPS_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700691 return "eWNI_PMC_EXIT_BMPS_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700692 case eWNI_PMC_EXIT_BMPS_IND:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700693 return "eWNI_PMC_EXIT_BMPS_IND";
Yathish9f22e662012-12-10 14:21:35 -0800694 case eWNI_SME_SET_BCN_FILTER_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700695 return "eWNI_SME_SET_BCN_FILTER_REQ";
Srinivas Girigowda5cecb202013-10-08 09:13:25 -0700696#if defined(FEATURE_WLAN_CCX) && defined(FEATURE_WLAN_CCX_UPLOAD)
697 case eWNI_SME_GET_TSM_STATS_REQ:
698 return "eWNI_SME_GET_TSM_STATS_REQ";
699 case eWNI_SME_GET_TSM_STATS_RSP:
700 return "eWNI_SME_GET_TSM_STATS_RSP";
701#endif /* FEATURE_WLAN_CCX && FEATURE_WLAN_CCX_UPLOAD */
Jeff Johnson295189b2012-06-20 16:38:30 -0700702 default:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700703 return "INVALID SME message";
Jeff Johnson295189b2012-06-20 16:38:30 -0700704 }
705#endif
706return "";
707}
708
709
710
711char *limResultCodeStr(tSirResultCodes resultCode)
712{
Jeff Johnson295189b2012-06-20 16:38:30 -0700713 switch (resultCode)
714 {
715 case eSIR_SME_SUCCESS:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700716 return "eSIR_SME_SUCCESS";
Jeff Johnson295189b2012-06-20 16:38:30 -0700717 case eSIR_EOF_SOF_EXCEPTION:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700718 return "eSIR_EOF_SOF_EXCEPTION";
Jeff Johnson295189b2012-06-20 16:38:30 -0700719 case eSIR_BMU_EXCEPTION:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700720 return "eSIR_BMU_EXCEPTION";
Jeff Johnson295189b2012-06-20 16:38:30 -0700721 case eSIR_LOW_PDU_EXCEPTION:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700722 return "eSIR_LOW_PDU_EXCEPTION";
Jeff Johnson295189b2012-06-20 16:38:30 -0700723 case eSIR_USER_TRIG_RESET:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700724 return"eSIR_USER_TRIG_RESET";
Jeff Johnson295189b2012-06-20 16:38:30 -0700725 case eSIR_LOGP_EXCEPTION:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700726 return "eSIR_LOGP_EXCEPTION";
Jeff Johnson295189b2012-06-20 16:38:30 -0700727 case eSIR_CP_EXCEPTION:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700728 return "eSIR_CP_EXCEPTION";
Jeff Johnson295189b2012-06-20 16:38:30 -0700729 case eSIR_STOP_BSS:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700730 return "eSIR_STOP_BSS";
Jeff Johnson295189b2012-06-20 16:38:30 -0700731 case eSIR_AHB_HANG_EXCEPTION:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700732 return "eSIR_AHB_HANG_EXCEPTION";
Jeff Johnson295189b2012-06-20 16:38:30 -0700733 case eSIR_DPU_EXCEPTION:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700734 return "eSIR_DPU_EXCEPTION";
Jeff Johnson295189b2012-06-20 16:38:30 -0700735 case eSIR_RXP_EXCEPTION:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700736 return "eSIR_RXP_EXCEPTION";
Jeff Johnson295189b2012-06-20 16:38:30 -0700737 case eSIR_MCPU_EXCEPTION:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700738 return "eSIR_MCPU_EXCEPTION";
Jeff Johnson295189b2012-06-20 16:38:30 -0700739 case eSIR_MCU_EXCEPTION:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700740 return "eSIR_MCU_EXCEPTION";
Jeff Johnson295189b2012-06-20 16:38:30 -0700741 case eSIR_MTU_EXCEPTION:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700742 return "eSIR_MTU_EXCEPTION";
Jeff Johnson295189b2012-06-20 16:38:30 -0700743 case eSIR_MIF_EXCEPTION:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700744 return "eSIR_MIF_EXCEPTION";
Jeff Johnson295189b2012-06-20 16:38:30 -0700745 case eSIR_FW_EXCEPTION:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700746 return "eSIR_FW_EXCEPTION";
Jeff Johnson295189b2012-06-20 16:38:30 -0700747 case eSIR_MAILBOX_SANITY_CHK_FAILED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700748 return "eSIR_MAILBOX_SANITY_CHK_FAILED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700749 case eSIR_RADIO_HW_SWITCH_STATUS_IS_OFF:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700750 return "eSIR_RADIO_HW_SWITCH_STATUS_IS_OFF";
Jeff Johnson295189b2012-06-20 16:38:30 -0700751 case eSIR_CFB_FLAG_STUCK_EXCEPTION:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700752 return "eSIR_CFB_FLAG_STUCK_EXCEPTION";
Jeff Johnson295189b2012-06-20 16:38:30 -0700753 case eSIR_SME_BASIC_RATES_NOT_SUPPORTED_STATUS:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700754 return "eSIR_SME_BASIC_RATES_NOT_SUPPORTED_STATUS";
Jeff Johnson295189b2012-06-20 16:38:30 -0700755 case eSIR_SME_INVALID_PARAMETERS:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700756 return "eSIR_SME_INVALID_PARAMETERS";
Jeff Johnson295189b2012-06-20 16:38:30 -0700757 case eSIR_SME_UNEXPECTED_REQ_RESULT_CODE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700758 return "eSIR_SME_UNEXPECTED_REQ_RESULT_CODE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700759 case eSIR_SME_RESOURCES_UNAVAILABLE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700760 return "eSIR_SME_RESOURCES_UNAVAILABLE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700761 case eSIR_SME_SCAN_FAILED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700762 return "eSIR_SME_SCAN_FAILED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700763 case eSIR_SME_BSS_ALREADY_STARTED_OR_JOINED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700764 return "eSIR_SME_BSS_ALREADY_STARTED_OR_JOINED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700765 case eSIR_SME_LOST_LINK_WITH_PEER_RESULT_CODE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700766 return "eSIR_SME_LOST_LINK_WITH_PEER_RESULT_CODE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700767 case eSIR_SME_REFUSED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700768 return "eSIR_SME_REFUSED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700769 case eSIR_SME_JOIN_TIMEOUT_RESULT_CODE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700770 return "eSIR_SME_JOIN_TIMEOUT_RESULT_CODE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700771 case eSIR_SME_AUTH_TIMEOUT_RESULT_CODE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700772 return "eSIR_SME_AUTH_TIMEOUT_RESULT_CODE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700773 case eSIR_SME_ASSOC_TIMEOUT_RESULT_CODE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700774 return "eSIR_SME_ASSOC_TIMEOUT_RESULT_CODE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700775 case eSIR_SME_REASSOC_TIMEOUT_RESULT_CODE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700776 return "eSIR_SME_REASSOC_TIMEOUT_RESULT_CODE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700777 case eSIR_SME_MAX_NUM_OF_PRE_AUTH_REACHED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700778 return "eSIR_SME_MAX_NUM_OF_PRE_AUTH_REACHED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700779 case eSIR_SME_AUTH_REFUSED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700780 return "eSIR_SME_AUTH_REFUSED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700781 case eSIR_SME_INVALID_WEP_DEFAULT_KEY:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700782 return "eSIR_SME_INVALID_WEP_DEFAULT_KEY";
Jeff Johnson295189b2012-06-20 16:38:30 -0700783 case eSIR_SME_ASSOC_REFUSED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700784 return "eSIR_SME_ASSOC_REFUSED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700785 case eSIR_SME_REASSOC_REFUSED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700786 return "eSIR_SME_REASSOC_REFUSED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700787 case eSIR_SME_STA_NOT_AUTHENTICATED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700788 return "eSIR_SME_STA_NOT_AUTHENTICATED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700789 case eSIR_SME_STA_NOT_ASSOCIATED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700790 return "eSIR_SME_STA_NOT_ASSOCIATED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700791 case eSIR_SME_STA_DISASSOCIATED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700792 return "eSIR_SME_STA_DISASSOCIATED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700793 case eSIR_SME_ALREADY_JOINED_A_BSS:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700794 return "eSIR_SME_ALREADY_JOINED_A_BSS";
Jeff Johnson295189b2012-06-20 16:38:30 -0700795 case eSIR_ULA_COMPLETED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700796 return "eSIR_ULA_COMPLETED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700797 case eSIR_ULA_FAILURE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700798 return "eSIR_ULA_FAILURE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700799 case eSIR_SME_LINK_ESTABLISHED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700800 return "eSIR_SME_LINK_ESTABLISHED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700801 case eSIR_SME_UNABLE_TO_PERFORM_MEASUREMENTS:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700802 return "eSIR_SME_UNABLE_TO_PERFORM_MEASUREMENTS";
Jeff Johnson295189b2012-06-20 16:38:30 -0700803 case eSIR_SME_UNABLE_TO_PERFORM_DFS:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700804 return "eSIR_SME_UNABLE_TO_PERFORM_DFS";
Jeff Johnson295189b2012-06-20 16:38:30 -0700805 case eSIR_SME_DFS_FAILED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700806 return "eSIR_SME_DFS_FAILED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700807 case eSIR_SME_TRANSFER_STA:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700808 return "eSIR_SME_TRANSFER_STA";
Jeff Johnson295189b2012-06-20 16:38:30 -0700809 case eSIR_SME_INVALID_LINK_TEST_PARAMETERS:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700810 return "eSIR_SME_INVALID_LINK_TEST_PARAMETERS";
Jeff Johnson295189b2012-06-20 16:38:30 -0700811 case eSIR_SME_LINK_TEST_MAX_EXCEEDED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700812 return "eSIR_SME_LINK_TEST_MAX_EXCEEDED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700813 case eSIR_SME_UNSUPPORTED_RATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700814 return "eSIR_SME_UNSUPPORTED_RATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700815 case eSIR_SME_LINK_TEST_TIMEOUT:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700816 return "eSIR_SME_LINK_TEST_TIMEOUT";
Jeff Johnson295189b2012-06-20 16:38:30 -0700817 case eSIR_SME_LINK_TEST_COMPLETE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700818 return "eSIR_SME_LINK_TEST_COMPLETE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700819 case eSIR_SME_LINK_TEST_INVALID_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700820 return "eSIR_SME_LINK_TEST_INVALID_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700821 case eSIR_SME_LINK_TEST_INVALID_ADDRESS:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700822 return "eSIR_SME_LINK_TEST_INVALID_ADDRESS";
Jeff Johnson295189b2012-06-20 16:38:30 -0700823 case eSIR_SME_POLARIS_RESET:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700824 return "eSIR_SME_POLARIS_RESET";
Jeff Johnson295189b2012-06-20 16:38:30 -0700825 case eSIR_SME_SETCONTEXT_FAILED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700826 return "eSIR_SME_SETCONTEXT_FAILED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700827 case eSIR_SME_BSS_RESTART:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700828 return "eSIR_SME_BSS_RESTART";
Jeff Johnson295189b2012-06-20 16:38:30 -0700829 case eSIR_SME_MORE_SCAN_RESULTS_FOLLOW:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700830 return "eSIR_SME_MORE_SCAN_RESULTS_FOLLOW";
Jeff Johnson295189b2012-06-20 16:38:30 -0700831 case eSIR_SME_INVALID_ASSOC_RSP_RXED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700832 return "eSIR_SME_INVALID_ASSOC_RSP_RXED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700833 case eSIR_SME_MIC_COUNTER_MEASURES:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700834 return "eSIR_SME_MIC_COUNTER_MEASURES";
Jeff Johnson295189b2012-06-20 16:38:30 -0700835 case eSIR_SME_ADDTS_RSP_TIMEOUT:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700836 return "eSIR_SME_ADDTS_RSP_TIMEOUT";
Jeff Johnson295189b2012-06-20 16:38:30 -0700837 case eSIR_SME_RECEIVED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700838 return "eSIR_SME_RECEIVED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700839 case eSIR_SME_CHANNEL_SWITCH_FAIL:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700840 return "eSIR_SME_CHANNEL_SWITCH_FAIL";
Jeff Johnson295189b2012-06-20 16:38:30 -0700841#ifdef GEN4_SCAN
842 case eSIR_SME_CHANNEL_SWITCH_DISABLED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700843 return "eSIR_SME_CHANNEL_SWITCH_DISABLED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700844 case eSIR_SME_HAL_SCAN_INIT_FAILED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700845 return "eSIR_SME_HAL_SCAN_INIT_FAILED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700846 case eSIR_SME_HAL_SCAN_START_FAILED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700847 return "eSIR_SME_HAL_SCAN_START_FAILED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700848 case eSIR_SME_HAL_SCAN_END_FAILED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700849 return "eSIR_SME_HAL_SCAN_END_FAILED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700850 case eSIR_SME_HAL_SCAN_FINISH_FAILED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700851 return "eSIR_SME_HAL_SCAN_FINISH_FAILED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700852 case eSIR_SME_HAL_SEND_MESSAGE_FAIL:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700853 return "eSIR_SME_HAL_SEND_MESSAGE_FAIL";
Jeff Johnson295189b2012-06-20 16:38:30 -0700854#else // GEN4_SCAN
855 case eSIR_SME_CHANNEL_SWITCH_DISABLED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700856 return "eSIR_SME_CHANNEL_SWITCH_DISABLED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700857 case eSIR_SME_HAL_SEND_MESSAGE_FAIL:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700858 return "eSIR_SME_HAL_SEND_MESSAGE_FAIL";
Jeff Johnson295189b2012-06-20 16:38:30 -0700859#endif // GEN4_SCAN
860
861 default:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700862 return "INVALID resultCode";
Jeff Johnson295189b2012-06-20 16:38:30 -0700863 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700864}
865
866void
867limPrintMsgName(tpAniSirGlobal pMac, tANI_U16 logLevel, tANI_U32 msgType)
868{
869 limLog(pMac, logLevel, limMsgStr(msgType));
870}
871
Jeff Johnson295189b2012-06-20 16:38:30 -0700872void
873limPrintMsgInfo(tpAniSirGlobal pMac, tANI_U16 logLevel, tSirMsgQ *msg)
874{
Jeff Johnson295189b2012-06-20 16:38:30 -0700875 if (logLevel <= pMac->utils.gLogDbgLevel[SIR_LIM_MODULE_ID - LOG_FIRST_MODULE_ID])
876 {
877 switch (msg->type)
878 {
879 case SIR_BB_XPORT_MGMT_MSG:
Jeff Johnson295189b2012-06-20 16:38:30 -0700880 limPrintMsgName(pMac, logLevel,msg->type);
Jeff Johnson295189b2012-06-20 16:38:30 -0700881 break;
882 default:
883 limPrintMsgName(pMac, logLevel,msg->type);
884 break;
885 }
886 }
887}
888
889/**
890 * limInitMlm()
891 *
892 *FUNCTION:
893 * This function is called by limProcessSmeMessages() to
894 * initialize MLM state machine on STA
895 *
896 *PARAMS:
897 *
898 *LOGIC:
899 *
900 *ASSUMPTIONS:
901 * NA
902 *
903 *NOTE:
904 * NA
905 *
906 * @param pMac Pointer to Global MAC structure
907 * @return None
908 */
909void
910limInitMlm(tpAniSirGlobal pMac)
911{
Madan Mohan Koyyalamudi694f8d72012-10-11 16:32:55 -0700912 tANI_U32 retVal;
913
914 pMac->lim.gLimTimersCreated = 0;
Madan Mohan Koyyalamudi1bed5982012-10-22 14:38:06 -0700915
Jeff Johnsone7245742012-09-05 17:12:55 -0700916 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, NO_SESSION, pMac->lim.gLimMlmState));
Jeff Johnson295189b2012-06-20 16:38:30 -0700917
918 /// Initialize scan result hash table
919 limReInitScanResults(pMac); //sep26th review
920
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -0700921#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
922 /// Initialize lfr scan result hash table
923 // Could there be a problem in multisession with SAP/P2P GO, when in the
924 // middle of FW bg scan, SAP started; Again that could be a problem even on
925 // infra + SAP/P2P GO too - TBD
926 limReInitLfrScanResults(pMac);
927#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700928
929 /// Initialize number of pre-auth contexts
930 pMac->lim.gLimNumPreAuthContexts = 0;
931
932 /// Initialize MAC based Authentication STA list
933 limInitPreAuthList(pMac);
934
935 //pMac->lim.gpLimMlmJoinReq = NULL;
936
937 if (pMac->lim.gLimTimersCreated)
938 return;
939
940 // Create timers used by LIM
Madan Mohan Koyyalamudi694f8d72012-10-11 16:32:55 -0700941 retVal = limCreateTimers(pMac);
942 if(retVal == TX_SUCCESS)
943 {
944 pMac->lim.gLimTimersCreated = 1;
945 }
946 else
947 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700948 limLog(pMac, LOGP, FL(" limCreateTimers Failed to create lim timers "));
Madan Mohan Koyyalamudi694f8d72012-10-11 16:32:55 -0700949 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700950} /*** end limInitMlm() ***/
951
952
953
954/**
955 * limCleanupMlm()
956 *
957 *FUNCTION:
958 * This function is called to cleanup any resources
959 * allocated by the MLM state machine.
960 *
961 *PARAMS:
962 *
963 *LOGIC:
964 *
965 *ASSUMPTIONS:
966 * NA
967 *
968 *NOTE:
969 * It is assumed that BSS is already informed that we're leaving it
970 * before this function is called.
971 *
972 * @param pMac Pointer to Global MAC structure
973 * @param None
974 * @return None
975 */
976void
977limCleanupMlm(tpAniSirGlobal pMac)
978{
979 tANI_U32 n;
980 tLimPreAuthNode *pAuthNode;
981
982 if (pMac->lim.gLimTimersCreated == 1)
983 {
984 // Deactivate and delete MIN/MAX channel timers.
985 tx_timer_deactivate(&pMac->lim.limTimers.gLimMinChannelTimer);
986 tx_timer_delete(&pMac->lim.limTimers.gLimMinChannelTimer);
987 tx_timer_deactivate(&pMac->lim.limTimers.gLimMaxChannelTimer);
988 tx_timer_delete(&pMac->lim.limTimers.gLimMaxChannelTimer);
989 tx_timer_deactivate(&pMac->lim.limTimers.gLimPeriodicProbeReqTimer);
990 tx_timer_delete(&pMac->lim.limTimers.gLimPeriodicProbeReqTimer);
991
992
993 // Deactivate and delete channel switch timer.
994 tx_timer_deactivate(&pMac->lim.limTimers.gLimChannelSwitchTimer);
995 tx_timer_delete(&pMac->lim.limTimers.gLimChannelSwitchTimer);
996
997
998 // Deactivate and delete addts response timer.
999 tx_timer_deactivate(&pMac->lim.limTimers.gLimAddtsRspTimer);
1000 tx_timer_delete(&pMac->lim.limTimers.gLimAddtsRspTimer);
1001
1002 // Deactivate and delete Join failure timer.
1003 tx_timer_deactivate(&pMac->lim.limTimers.gLimJoinFailureTimer);
1004 tx_timer_delete(&pMac->lim.limTimers.gLimJoinFailureTimer);
1005
Madan Mohan Koyyalamudi9aff9ff2012-11-29 11:27:25 -08001006 // Deactivate and delete Periodic Join Probe Request timer.
1007 tx_timer_deactivate(&pMac->lim.limTimers.gLimPeriodicJoinProbeReqTimer);
1008 tx_timer_delete(&pMac->lim.limTimers.gLimPeriodicJoinProbeReqTimer);
1009
Jeff Johnson295189b2012-06-20 16:38:30 -07001010 // Deactivate and delete Association failure timer.
1011 tx_timer_deactivate(&pMac->lim.limTimers.gLimAssocFailureTimer);
1012 tx_timer_delete(&pMac->lim.limTimers.gLimAssocFailureTimer);
1013
1014 // Deactivate and delete Reassociation failure timer.
1015 tx_timer_deactivate(&pMac->lim.limTimers.gLimReassocFailureTimer);
1016 tx_timer_delete(&pMac->lim.limTimers.gLimReassocFailureTimer);
1017
1018 // Deactivate and delete Authentication failure timer.
1019 tx_timer_deactivate(&pMac->lim.limTimers.gLimAuthFailureTimer);
1020 tx_timer_delete(&pMac->lim.limTimers.gLimAuthFailureTimer);
1021
1022 // Deactivate and delete Heartbeat timer.
1023 tx_timer_deactivate(&pMac->lim.limTimers.gLimHeartBeatTimer);
1024 tx_timer_delete(&pMac->lim.limTimers.gLimHeartBeatTimer);
1025
1026 // Deactivate and delete wait-for-probe-after-Heartbeat timer.
1027 tx_timer_deactivate(&pMac->lim.limTimers.gLimProbeAfterHBTimer);
1028 tx_timer_delete(&pMac->lim.limTimers.gLimProbeAfterHBTimer);
1029
1030 // Deactivate and delete Quiet timer.
1031 tx_timer_deactivate(&pMac->lim.limTimers.gLimQuietTimer);
1032 tx_timer_delete(&pMac->lim.limTimers.gLimQuietTimer);
1033
1034 // Deactivate and delete Quiet BSS timer.
1035 tx_timer_deactivate(&pMac->lim.limTimers.gLimQuietBssTimer);
1036 tx_timer_delete(&pMac->lim.limTimers.gLimQuietBssTimer);
1037
Jeff Johnson295189b2012-06-20 16:38:30 -07001038 // Deactivate and delete LIM background scan timer.
1039 tx_timer_deactivate(&pMac->lim.limTimers.gLimBackgroundScanTimer);
1040 tx_timer_delete(&pMac->lim.limTimers.gLimBackgroundScanTimer);
Jeff Johnson295189b2012-06-20 16:38:30 -07001041
1042
1043 // Deactivate and delete cnf wait timer
1044 for (n = 0; n < pMac->lim.maxStation; n++)
1045 {
1046 tx_timer_deactivate(&pMac->lim.limTimers.gpLimCnfWaitTimer[n]);
1047 tx_timer_delete(&pMac->lim.limTimers.gpLimCnfWaitTimer[n]);
1048 }
1049
1050 // Deactivate and delete keepalive timer
1051 tx_timer_deactivate(&pMac->lim.limTimers.gLimKeepaliveTimer);
1052 tx_timer_delete(&pMac->lim.limTimers.gLimKeepaliveTimer);
1053
1054 pAuthNode = pMac->lim.gLimPreAuthTimerTable.pTable;
1055
1056 //Deactivate any Authentication response timers
1057 limDeletePreAuthList(pMac);
1058
1059 for (n = 0; n < pMac->lim.gLimPreAuthTimerTable.numEntry; n++,pAuthNode++)
1060 {
1061 // Delete any Authentication response
1062 // timers, which might have been started.
1063 tx_timer_delete(&pAuthNode->timer);
1064 }
1065
Jeff Johnson295189b2012-06-20 16:38:30 -07001066
1067
1068 // Deactivate and delete Hash Miss throttle timer
1069 tx_timer_deactivate(&pMac->lim.limTimers.gLimSendDisassocFrameThresholdTimer);
1070 tx_timer_delete(&pMac->lim.limTimers.gLimSendDisassocFrameThresholdTimer);
1071
Jeff Johnson295189b2012-06-20 16:38:30 -07001072 tx_timer_deactivate(&pMac->lim.limTimers.gLimUpdateOlbcCacheTimer);
1073 tx_timer_delete(&pMac->lim.limTimers.gLimUpdateOlbcCacheTimer);
1074 tx_timer_deactivate(&pMac->lim.limTimers.gLimPreAuthClnupTimer);
1075 tx_timer_delete(&pMac->lim.limTimers.gLimPreAuthClnupTimer);
1076
1077#if 0 // The WPS PBC clean up timer is disabled
1078 if (pMac->lim.gLimSystemRole == eLIM_AP_ROLE)
1079 {
1080 if(pMac->lim.limTimers.gLimWPSOverlapTimerObj.isTimerCreated == eANI_BOOLEAN_TRUE)
1081 {
1082 tx_timer_deactivate(&pMac->lim.limTimers.gLimWPSOverlapTimerObj.gLimWPSOverlapTimer);
1083 tx_timer_delete(&pMac->lim.limTimers.gLimWPSOverlapTimerObj.gLimWPSOverlapTimer);
1084 pMac->lim.limTimers.gLimWPSOverlapTimerObj.isTimerCreated = eANI_BOOLEAN_FALSE;
1085 }
1086 }
1087#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001088#ifdef WLAN_FEATURE_VOWIFI_11R
1089 // Deactivate and delete FT Preauth response timer
1090 tx_timer_deactivate(&pMac->lim.limTimers.gLimFTPreAuthRspTimer);
1091 tx_timer_delete(&pMac->lim.limTimers.gLimFTPreAuthRspTimer);
1092#endif
1093
Jeff Johnson295189b2012-06-20 16:38:30 -07001094 // Deactivate and delete remain on channel timer
1095 tx_timer_deactivate(&pMac->lim.limTimers.gLimRemainOnChannelTimer);
1096 tx_timer_delete(&pMac->lim.limTimers.gLimRemainOnChannelTimer);
Jeff Johnson295189b2012-06-20 16:38:30 -07001097
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07001098#if defined(FEATURE_WLAN_CCX) && !defined(FEATURE_WLAN_CCX_UPLOAD)
Jeff Johnson295189b2012-06-20 16:38:30 -07001099 // Deactivate and delete TSM
1100 tx_timer_deactivate(&pMac->lim.limTimers.gLimCcxTsmTimer);
1101 tx_timer_delete(&pMac->lim.limTimers.gLimCcxTsmTimer);
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07001102#endif /* FEATURE_WLAN_CCX && !FEATURE_WLAN_CCX_UPLOAD */
Jeff Johnson295189b2012-06-20 16:38:30 -07001103
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -08001104 tx_timer_deactivate(&pMac->lim.limTimers.gLimDisassocAckTimer);
1105 tx_timer_delete(&pMac->lim.limTimers.gLimDisassocAckTimer);
1106
1107 tx_timer_deactivate(&pMac->lim.limTimers.gLimDeauthAckTimer);
1108 tx_timer_delete(&pMac->lim.limTimers.gLimDeauthAckTimer);
1109
Hoonki Leef63df0d2013-01-16 19:29:14 -08001110 tx_timer_deactivate(&pMac->lim.limTimers.gLimP2pSingleShotNoaInsertTimer);
1111 tx_timer_delete(&pMac->lim.limTimers.gLimP2pSingleShotNoaInsertTimer);
Hoonki Leef63df0d2013-01-16 19:29:14 -08001112
Gopichand Nakkala0d6e4ad2013-05-17 02:30:25 +05301113 tx_timer_deactivate(&pMac->lim.limTimers.gLimActiveToPassiveChannelTimer);
1114 tx_timer_delete(&pMac->lim.limTimers.gLimActiveToPassiveChannelTimer);
1115
Jeff Johnson295189b2012-06-20 16:38:30 -07001116 pMac->lim.gLimTimersCreated = 0;
1117 }
1118
1119 /// Cleanup cached scan list
1120 limReInitScanResults(pMac);
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07001121#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
1122 /// Cleanup cached scan list
1123 limReInitLfrScanResults(pMac);
1124#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001125
1126} /*** end limCleanupMlm() ***/
1127
1128
1129
1130/**
1131 * limCleanupLmm()
1132 *
1133 *FUNCTION:
1134 * This function is called to cleanup any resources
1135 * allocated by LMM sub-module.
1136 *
1137 *PARAMS:
1138 *
1139 *LOGIC:
1140 *
1141 *ASSUMPTIONS:
1142 * NA
1143 *
1144 *NOTE:
1145 * NA
1146 *
1147 * @param pMac Pointer to Global MAC structure
1148 * @return None
1149 */
1150
1151void
1152limCleanupLmm(tpAniSirGlobal pMac)
1153{
Jeff Johnson295189b2012-06-20 16:38:30 -07001154} /*** end limCleanupLmm() ***/
1155
1156
1157
1158/**
1159 * limIsAddrBC()
1160 *
1161 *FUNCTION:
1162 * This function is called in various places within LIM code
1163 * to determine whether passed MAC address is a broadcast or not
1164 *
1165 *LOGIC:
1166 *
1167 *ASSUMPTIONS:
1168 * NA
1169 *
1170 *NOTE:
1171 * NA
1172 *
1173 * @param macAddr Indicates MAC address that need to be determined
1174 * whether it is Broadcast address or not
1175 *
1176 * @return true if passed address is Broadcast address else false
1177 */
1178
1179tANI_U8
1180limIsAddrBC(tSirMacAddr macAddr)
1181{
1182 int i;
1183 for (i = 0; i < 6; i++)
1184 {
1185 if ((macAddr[i] & 0xFF) != 0xFF)
1186 return false;
1187 }
1188
1189 return true;
1190} /****** end limIsAddrBC() ******/
1191
1192
1193
1194/**
1195 * limIsGroupAddr()
1196 *
1197 *FUNCTION:
1198 * This function is called in various places within LIM code
1199 * to determine whether passed MAC address is a group address or not
1200 *
1201 *LOGIC:
1202 * If least significant bit of first octet of the MAC address is
1203 * set to 1, it is a Group address.
1204 *
1205 *ASSUMPTIONS:
1206 * NA
1207 *
1208 *NOTE:
1209 * NA
1210 *
1211 * @param macAddr Indicates MAC address that need to be determined
1212 * whether it is Group address or not
1213 *
1214 * @return true if passed address is Group address else false
1215 */
1216
1217tANI_U8
1218limIsGroupAddr(tSirMacAddr macAddr)
1219{
1220 if ((macAddr[0] & 0x01) == 0x01)
1221 return true;
1222 else
1223 return false;
1224} /****** end limIsGroupAddr() ******/
1225
1226/**
1227 * limPostMsgApiNoWait()
1228 *
1229 *FUNCTION:
1230 * This function is called from other thread while posting a
1231 * message to LIM message Queue gSirLimMsgQ with NO_WAIT option
1232 *
1233 *LOGIC:
1234 * NA
1235 *
1236 *ASSUMPTIONS:
1237 * NA
1238 *
1239 *NOTE:
1240 * NA
1241 *
1242 * @param pMsg - Pointer to the Global MAC structure
1243 * @param pMsg - Pointer to the message structure
1244 * @return None
1245 */
1246
1247tANI_U32
1248limPostMsgApiNoWait(tpAniSirGlobal pMac, tSirMsgQ *pMsg)
1249{
Jeff Johnson295189b2012-06-20 16:38:30 -07001250 limProcessMessages(pMac, pMsg);
1251 return TX_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -07001252} /*** end limPostMsgApiNoWait() ***/
1253
1254
1255
1256/**
1257 * limPrintMacAddr()
1258 *
1259 *FUNCTION:
1260 * This function is called to print passed MAC address
1261 * in : format.
1262 *
1263 *LOGIC:
1264 *
1265 *ASSUMPTIONS:
1266 * NA
1267 *
1268 *NOTE:
1269 * @param macAddr - MacAddr to be printed
1270 * @param logLevel - Loglevel to be used
1271 *
1272 * @return None.
1273 */
1274
1275void
1276limPrintMacAddr(tpAniSirGlobal pMac, tSirMacAddr macAddr, tANI_U8 logLevel)
1277{
1278 limLog(pMac, logLevel,
Arif Hussaina7c8e412013-11-20 11:06:42 -08001279 FL(MAC_ADDRESS_STR), MAC_ADDR_ARRAY(macAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001280} /****** end limPrintMacAddr() ******/
1281
1282
Jeff Johnson295189b2012-06-20 16:38:30 -07001283/*
1284 * limResetDeferredMsgQ()
1285 *
1286 *FUNCTION:
1287 * This function resets the deferred message queue parameters.
1288 *
1289 *PARAMS:
1290 * @param pMac - Pointer to Global MAC structure
1291 *
1292 *LOGIC:
1293 *
1294 *ASSUMPTIONS:
1295 * NA
1296 *
1297 *NOTE:
1298 * NA
1299 *
1300 *RETURNS:
1301 * None
1302 */
1303
1304void limResetDeferredMsgQ(tpAniSirGlobal pMac)
1305{
1306 pMac->lim.gLimDeferredMsgQ.size =
1307 pMac->lim.gLimDeferredMsgQ.write =
1308 pMac->lim.gLimDeferredMsgQ.read = 0;
1309
1310}
1311
1312
1313#define LIM_DEFERRED_Q_CHECK_THRESHOLD (MAX_DEFERRED_QUEUE_LEN/2)
1314#define LIM_MAX_NUM_MGMT_FRAME_DEFERRED (MAX_DEFERRED_QUEUE_LEN/2)
1315
1316/*
1317 * limWriteDeferredMsgQ()
1318 *
1319 *FUNCTION:
1320 * This function queues up a deferred message for later processing on the
1321 * STA side.
1322 *
1323 *PARAMS:
1324 * @param pMac - Pointer to Global MAC structure
1325 * @param limMsg - a LIM message
1326 *
1327 *LOGIC:
1328 *
1329 *ASSUMPTIONS:
1330 * NA
1331 *
1332 *NOTE:
1333 * NA
1334 *
1335 *RETURNS:
1336 * None
1337 */
1338
1339tANI_U8 limWriteDeferredMsgQ(tpAniSirGlobal pMac, tpSirMsgQ limMsg)
1340{
1341 PELOG1(limLog(pMac, LOG1,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001342 FL("** Queue a deferred message (size %d, write %d) - type 0x%x **"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001343 pMac->lim.gLimDeferredMsgQ.size, pMac->lim.gLimDeferredMsgQ.write,
1344 limMsg->type);)
1345
1346 /*
1347 ** check if the deferred message queue is full
1348 **/
1349 if (pMac->lim.gLimDeferredMsgQ.size >= MAX_DEFERRED_QUEUE_LEN)
1350 {
Leela Venkata Kiran Kumar Reddy Chirala2247e962013-03-22 19:21:10 -07001351 if(!(pMac->lim.deferredMsgCnt & 0xF))
1352 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001353 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 -07001354 }
1355 else
1356 {
1357 pMac->lim.deferredMsgCnt++;
1358 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001359 return TX_QUEUE_FULL;
1360 }
1361
1362 /*
1363 ** In the application, there should not be more than 1 message get
1364 ** queued up. If happens, flags a warning. In the future, this can
1365 ** happen.
1366 **/
1367 if (pMac->lim.gLimDeferredMsgQ.size > 0)
1368 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001369 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 -07001370 pMac->lim.gLimDeferredMsgQ.size, limMsg->type,
1371 limIsSystemInScanState(pMac),
1372 pMac->lim.gLimSmeState, pMac->lim.gLimMlmState,
1373 pMac->lim.gLimAddtsSent);)
1374 }
1375
1376 /*
1377 ** To prevent the deferred Q is full of management frames, only give them certain space
1378 **/
1379 if( SIR_BB_XPORT_MGMT_MSG == limMsg->type )
1380 {
1381 if( LIM_DEFERRED_Q_CHECK_THRESHOLD < pMac->lim.gLimDeferredMsgQ.size )
1382 {
1383 tANI_U16 idx, count = 0;
1384 for(idx = 0; idx < pMac->lim.gLimDeferredMsgQ.size; idx++)
1385 {
1386 if( SIR_BB_XPORT_MGMT_MSG == pMac->lim.gLimDeferredMsgQ.deferredQueue[idx].type )
1387 {
1388 count++;
1389 }
1390 }
1391 if( LIM_MAX_NUM_MGMT_FRAME_DEFERRED < count )
1392 {
1393 //We reach the quota for management frames, drop this one
Madan Mohan Koyyalamudi5695b502012-09-24 14:21:12 -07001394 PELOGW(limLog(pMac, LOGW, FL("Cannot deferred. Msg: %d Too many (count=%d) already"), limMsg->type, count);)
Jeff Johnson295189b2012-06-20 16:38:30 -07001395 //Return error, caller knows what to do
1396 return TX_QUEUE_FULL;
1397 }
1398 }
1399 }
1400
1401 ++pMac->lim.gLimDeferredMsgQ.size;
1402
Leela Venkata Kiran Kumar Reddy Chirala2247e962013-03-22 19:21:10 -07001403 /* reset the count here since we are able to defer the message */
1404 if(pMac->lim.deferredMsgCnt != 0)
1405 {
1406 pMac->lim.deferredMsgCnt = 0;
1407 }
1408
Jeff Johnson295189b2012-06-20 16:38:30 -07001409 /*
1410 ** if the write pointer hits the end of the queue, rewind it
1411 **/
1412 if (pMac->lim.gLimDeferredMsgQ.write >= MAX_DEFERRED_QUEUE_LEN)
1413 pMac->lim.gLimDeferredMsgQ.write = 0;
1414
1415 /*
1416 ** save the message to the queue and advanced the write pointer
1417 **/
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301418 vos_mem_copy( (tANI_U8 *)&pMac->lim.gLimDeferredMsgQ.deferredQueue[
1419 pMac->lim.gLimDeferredMsgQ.write++],
Jeff Johnson295189b2012-06-20 16:38:30 -07001420 (tANI_U8 *)limMsg,
1421 sizeof(tSirMsgQ));
1422 return TX_SUCCESS;
1423
1424}
1425
1426/*
1427 * limReadDeferredMsgQ()
1428 *
1429 *FUNCTION:
1430 * This function dequeues a deferred message for processing on the
1431 * STA side.
1432 *
1433 *PARAMS:
1434 * @param pMac - Pointer to Global MAC structure
1435 *
1436 *LOGIC:
1437 *
1438 *ASSUMPTIONS:
1439 * NA
1440 *
1441 *NOTE:
1442 *
1443 *
1444 *RETURNS:
1445 * Returns the message at the head of the deferred message queue
1446 */
1447
1448tSirMsgQ* limReadDeferredMsgQ(tpAniSirGlobal pMac)
1449{
1450 tSirMsgQ *msg;
1451
1452 /*
1453 ** check any messages left. If no, return
1454 **/
1455 if (pMac->lim.gLimDeferredMsgQ.size <= 0)
1456 return NULL;
1457
1458 /*
1459 ** decrement the queue size
1460 **/
1461 pMac->lim.gLimDeferredMsgQ.size--;
1462
1463 /*
1464 ** retrieve the message from the head of the queue
1465 **/
1466 msg = &pMac->lim.gLimDeferredMsgQ.deferredQueue[pMac->lim.gLimDeferredMsgQ.read];
1467
1468 /*
1469 ** advance the read pointer
1470 **/
1471 pMac->lim.gLimDeferredMsgQ.read++;
1472
1473 /*
1474 ** if the read pointer hits the end of the queue, rewind it
1475 **/
1476 if (pMac->lim.gLimDeferredMsgQ.read >= MAX_DEFERRED_QUEUE_LEN)
1477 pMac->lim.gLimDeferredMsgQ.read = 0;
1478
1479 PELOG1(limLog(pMac, LOG1,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001480 FL("** DeQueue a deferred message (size %d read %d) - type 0x%x **"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001481 pMac->lim.gLimDeferredMsgQ.size, pMac->lim.gLimDeferredMsgQ.read,
1482 msg->type);)
1483
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001484 PELOG1(limLog(pMac, LOG1, FL("DQ msg -- scan %d, global sme %d, global mlme %d, addts %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001485 limIsSystemInScanState(pMac),
1486 pMac->lim.gLimSmeState, pMac->lim.gLimMlmState,
1487 pMac->lim.gLimAddtsSent);)
1488
1489 return(msg);
1490}
1491
1492tSirRetStatus
1493limSysProcessMmhMsgApi(tpAniSirGlobal pMac,
1494 tSirMsgQ *pMsg,
1495 tANI_U8 qType)
1496{
1497// FIXME
Jeff Johnson295189b2012-06-20 16:38:30 -07001498 SysProcessMmhMsg(pMac, pMsg);
1499 return eSIR_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -07001500}
1501
1502char *limFrameStr(tANI_U32 type, tANI_U32 subType)
1503{
1504#ifdef FIXME_GEN6
1505
1506 if (type == SIR_MAC_MGMT_FRAME)
1507 {
1508 switch (subType)
1509 {
1510 case SIR_MAC_MGMT_ASSOC_REQ:
1511 return "MAC_MGMT_ASSOC_REQ";
1512 case SIR_MAC_MGMT_ASSOC_RSP:
1513 return "MAC_MGMT_ASSOC_RSP";
1514 case SIR_MAC_MGMT_REASSOC_REQ:
1515 return "MAC_MGMT_REASSOC_REQ";
1516 case SIR_MAC_MGMT_REASSOC_RSP:
1517 return "MAC_MGMT_REASSOC_RSP";
1518 case SIR_MAC_MGMT_PROBE_REQ:
1519 return "MAC_MGMT_PROBE_REQ";
1520 case SIR_MAC_MGMT_PROBE_RSP:
1521 return "MAC_MGMT_PROBE_RSP";
1522 case SIR_MAC_MGMT_BEACON:
1523 return "MAC_MGMT_BEACON";
1524 case SIR_MAC_MGMT_ATIM:
1525 return "MAC_MGMT_ATIM";
1526 case SIR_MAC_MGMT_DISASSOC:
1527 return "MAC_MGMT_DISASSOC";
1528 case SIR_MAC_MGMT_AUTH:
1529 return "MAC_MGMT_AUTH";
1530 case SIR_MAC_MGMT_DEAUTH:
1531 return "MAC_MGMT_DEAUTH";
1532 case SIR_MAC_MGMT_ACTION:
1533 return "MAC_MGMT_ACTION";
1534 case SIR_MAC_MGMT_RESERVED15:
1535 return "MAC_MGMT_RESERVED15";
1536 default:
1537 return "Unknown MGMT Frame";
1538 }
1539 }
1540
1541 else if (type == SIR_MAC_CTRL_FRAME)
1542 {
1543 switch (subType)
1544 {
1545 case SIR_MAC_CTRL_RR:
1546 return "MAC_CTRL_RR";
1547 case SIR_MAC_CTRL_BAR:
1548 return "MAC_CTRL_BAR";
1549 case SIR_MAC_CTRL_BA:
1550 return "MAC_CTRL_BA";
1551 case SIR_MAC_CTRL_PS_POLL:
1552 return "MAC_CTRL_PS_POLL";
1553 case SIR_MAC_CTRL_RTS:
1554 return "MAC_CTRL_RTS";
1555 case SIR_MAC_CTRL_CTS:
1556 return "MAC_CTRL_CTS";
1557 case SIR_MAC_CTRL_ACK:
1558 return "MAC_CTRL_ACK";
1559 case SIR_MAC_CTRL_CF_END:
1560 return "MAC_CTRL_CF_END";
1561 case SIR_MAC_CTRL_CF_END_ACK:
1562 return "MAC_CTRL_CF_END_ACK";
1563 default:
1564 return "Unknown CTRL Frame";
1565 }
1566 }
1567
1568 else if (type == SIR_MAC_DATA_FRAME)
1569 {
1570 switch (subType)
1571 {
1572 case SIR_MAC_DATA_DATA:
1573 return "MAC_DATA_DATA";
1574 case SIR_MAC_DATA_DATA_ACK:
1575 return "MAC_DATA_DATA_ACK";
1576 case SIR_MAC_DATA_DATA_POLL:
1577 return "MAC_DATA_DATA_POLL";
1578 case SIR_MAC_DATA_DATA_ACK_POLL:
1579 return "MAC_DATA_DATA_ACK_POLL";
1580 case SIR_MAC_DATA_NULL:
1581 return "MAC_DATA_NULL";
1582 case SIR_MAC_DATA_NULL_ACK:
1583 return "MAC_DATA_NULL_ACK";
1584 case SIR_MAC_DATA_NULL_POLL:
1585 return "MAC_DATA_NULL_POLL";
1586 case SIR_MAC_DATA_NULL_ACK_POLL:
1587 return "MAC_DATA_NULL_ACK_POLL";
1588 case SIR_MAC_DATA_QOS_DATA:
1589 return "MAC_DATA_QOS_DATA";
1590 case SIR_MAC_DATA_QOS_DATA_ACK:
1591 return "MAC_DATA_QOS_DATA_ACK";
1592 case SIR_MAC_DATA_QOS_DATA_POLL:
1593 return "MAC_DATA_QOS_DATA_POLL";
1594 case SIR_MAC_DATA_QOS_DATA_ACK_POLL:
1595 return "MAC_DATA_QOS_DATA_ACK_POLL";
1596 case SIR_MAC_DATA_QOS_NULL:
1597 return "MAC_DATA_QOS_NULL";
1598 case SIR_MAC_DATA_QOS_NULL_ACK:
1599 return "MAC_DATA_QOS_NULL_ACK";
1600 case SIR_MAC_DATA_QOS_NULL_POLL:
1601 return "MAC_DATA_QOS_NULL_POLL";
1602 case SIR_MAC_DATA_QOS_NULL_ACK_POLL:
1603 return "MAC_DATA_QOS_NULL_ACK_POLL";
1604 default:
1605 return "Unknown Data Frame";
1606 }
1607 }
1608 else
1609 return "Unknown";
1610#endif
1611return "";
1612}
1613
Jeff Johnson295189b2012-06-20 16:38:30 -07001614void limHandleUpdateOlbcCache(tpAniSirGlobal pMac)
1615{
1616 int i;
1617 static int enable;
1618 tUpdateBeaconParams beaconParams;
1619
1620 tpPESession psessionEntry = limIsApSessionActive(pMac);
1621
1622 if (psessionEntry == NULL)
Madan Mohan Koyyalamudi788b4ee2012-09-25 10:42:09 -07001623 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001624 PELOGE(limLog(pMac, LOGE, FL(" Session not found"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001625 return;
Madan Mohan Koyyalamudi788b4ee2012-09-25 10:42:09 -07001626 }
Pratik Bhalgatb44ea3f2012-11-22 16:41:39 +05301627
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301628 vos_mem_set( ( tANI_U8* )&beaconParams, sizeof( tUpdateBeaconParams), 0);
Madan Mohan Koyyalamudib2733142012-10-31 13:59:17 -07001629 beaconParams.bssIdx = psessionEntry->bssIdx;
Jeff Johnson295189b2012-06-20 16:38:30 -07001630
1631 beaconParams.paramChangeBitmap = 0;
1632 /*
1633 ** This is doing a 2 pass check. The first pass is to invalidate
1634 ** all the cache entries. The second pass is to decide whether to
1635 ** disable protection.
1636 **/
1637 if (!enable)
1638 {
1639
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001640 PELOG2(limLog(pMac, LOG2, FL("Resetting OLBC cache"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001641 psessionEntry->gLimOlbcParams.numSta = 0;
1642 psessionEntry->gLimOverlap11gParams.numSta = 0;
1643 psessionEntry->gLimOverlapHt20Params.numSta = 0;
1644 psessionEntry->gLimNonGfParams.numSta = 0;
1645 psessionEntry->gLimLsigTxopParams.numSta = 0;
1646
1647 for (i=0; i < LIM_PROT_STA_OVERLAP_CACHE_SIZE; i++)
1648 pMac->lim.protStaOverlapCache[i].active = false;
1649
1650 enable = 1;
1651 }
1652 else
1653 {
1654
Madan Mohan Koyyalamudi788b4ee2012-09-25 10:42:09 -07001655 if (!psessionEntry->gLimOlbcParams.numSta)
Jeff Johnson295189b2012-06-20 16:38:30 -07001656 {
1657 if (psessionEntry->gLimOlbcParams.protectionEnabled)
1658 {
1659 if (!psessionEntry->gLim11bParams.protectionEnabled)
1660 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001661 PELOG1(limLog(pMac, LOG1, FL("Overlap cache all clear and no 11B STA detected"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001662 limEnable11gProtection(pMac, false, true, &beaconParams, psessionEntry);
1663 }
1664 }
1665 }
1666
1667 if (!psessionEntry->gLimOverlap11gParams.numSta)
1668 {
1669 if (psessionEntry->gLimOverlap11gParams.protectionEnabled)
1670 {
1671 if (!psessionEntry->gLim11gParams.protectionEnabled)
1672 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001673 PELOG1(limLog(pMac, LOG1, FL("Overlap cache all clear and no 11G STA detected"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001674 limEnableHtProtectionFrom11g(pMac, false, true, &beaconParams,psessionEntry);
1675 }
1676 }
1677 }
1678
1679 if (!psessionEntry->gLimOverlapHt20Params.numSta)
1680 {
1681 if (psessionEntry->gLimOverlapHt20Params.protectionEnabled)
1682 {
1683 if (!psessionEntry->gLimHt20Params.protectionEnabled)
1684 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001685 PELOG1(limLog(pMac, LOG1, FL("Overlap cache all clear and no HT20 STA detected"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001686 limEnable11gProtection(pMac, false, true, &beaconParams,psessionEntry);
1687 }
1688 }
1689 }
1690
1691 enable = 0;
1692 }
1693
1694 if(beaconParams.paramChangeBitmap)
1695 {
1696 schSetFixedBeaconFields(pMac,psessionEntry);
1697 limSendBeaconParams(pMac, &beaconParams, psessionEntry);
1698 }
1699
1700 // Start OLBC timer
1701 if (tx_timer_activate(&pMac->lim.limTimers.gLimUpdateOlbcCacheTimer) != TX_SUCCESS)
1702 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001703 limLog(pMac, LOGE, FL("tx_timer_activate failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001704 }
1705}
Jeff Johnson295189b2012-06-20 16:38:30 -07001706
1707/**
1708 * limIsNullSsid()
1709 *
1710 *FUNCTION:
1711 * This function checks if Ssid supplied is Null SSID
1712 *
1713 *
1714 *LOGIC:
1715 *
1716 *ASSUMPTIONS:
1717 * NA
1718 *
1719 *NOTE:
1720 * NA
1721 *
1722 * @param tSirMacSSid *
1723 *
1724 *
1725 * @return true if SSID is Null SSID else false
1726 */
1727
1728tANI_U8
1729limIsNullSsid( tSirMacSSid *pSsid )
1730{
1731 tANI_U8 fNullSsid = false;
1732 tANI_U32 SsidLength;
1733 tANI_U8 *pSsidStr;
1734
1735 do
1736 {
1737 if ( 0 == pSsid->length )
1738 {
1739 fNullSsid = true;
1740 break;
1741 }
1742
1743#define ASCII_SPACE_CHARACTER 0x20
1744 /* If the first charactes is space, then check if all characters in
1745 * SSID are spaces to consider it as NULL SSID*/
1746 if( ASCII_SPACE_CHARACTER == pSsid->ssId[0])
1747 {
1748 SsidLength = pSsid->length;
1749 pSsidStr = pSsid->ssId;
1750 /* check if all the charactes in SSID are spaces*/
1751 while ( SsidLength )
1752 {
1753 if( ASCII_SPACE_CHARACTER != *pSsidStr )
1754 break;
1755
1756 pSsidStr++;
1757 SsidLength--;
1758 }
1759
1760 if( 0 == SsidLength )
1761 {
1762 fNullSsid = true;
1763 break;
1764 }
1765 }
1766 else
1767 {
1768 /* check if all the charactes in SSID are NULL*/
1769 SsidLength = pSsid->length;
1770 pSsidStr = pSsid->ssId;
1771
1772 while ( SsidLength )
1773 {
1774 if( *pSsidStr )
1775 break;
1776
1777 pSsidStr++;
1778 SsidLength--;
1779 }
1780
1781 if( 0 == SsidLength )
1782 {
1783 fNullSsid = true;
1784 break;
1785 }
1786 }
1787 }
1788 while( 0 );
1789
1790 return fNullSsid;
1791} /****** end limIsNullSsid() ******/
1792
1793
1794
Jeff Johnson295189b2012-06-20 16:38:30 -07001795
1796/** -------------------------------------------------------------
1797\fn limUpdateProtStaParams
1798\brief updates protection related counters.
1799\param tpAniSirGlobal pMac
1800\param tSirMacAddr peerMacAddr
1801\param tLimProtStaCacheType protStaCacheType
1802\param tHalBitVal gfSupported
1803\param tHalBitVal lsigTxopSupported
1804\return None
1805 -------------------------------------------------------------*/
1806void
1807limUpdateProtStaParams(tpAniSirGlobal pMac,
1808tSirMacAddr peerMacAddr, tLimProtStaCacheType protStaCacheType,
1809tHalBitVal gfSupported, tHalBitVal lsigTxopSupported,
1810tpPESession psessionEntry)
1811{
1812 tANI_U32 i;
1813
1814 PELOG1(limLog(pMac,LOG1, FL("A STA is associated:"));
1815 limLog(pMac,LOG1, FL("Addr : "));
1816 limPrintMacAddr(pMac, peerMacAddr, LOG1);)
1817
1818 for (i=0; i<LIM_PROT_STA_CACHE_SIZE; i++)
1819 {
1820 if (psessionEntry->protStaCache[i].active)
1821 {
1822 PELOG1(limLog(pMac, LOG1, FL("Addr: "));)
1823 PELOG1(limPrintMacAddr(pMac, psessionEntry->protStaCache[i].addr, LOG1);)
1824
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301825 if (vos_mem_compare(
Jeff Johnson295189b2012-06-20 16:38:30 -07001826 psessionEntry->protStaCache[i].addr,
1827 peerMacAddr, sizeof(tSirMacAddr)))
1828 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001829 PELOG1(limLog(pMac, LOG1, FL("matching cache entry at %d already active."), i);)
Jeff Johnson295189b2012-06-20 16:38:30 -07001830 return;
1831 }
1832 }
1833 }
1834
1835 for (i=0; i<LIM_PROT_STA_CACHE_SIZE; i++)
1836 {
1837 if (!psessionEntry->protStaCache[i].active)
1838 break;
1839 }
1840
1841 if (i >= LIM_PROT_STA_CACHE_SIZE)
1842 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001843 PELOGE(limLog(pMac, LOGE, FL("No space in ProtStaCache"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001844 return;
1845 }
1846
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301847 vos_mem_copy( psessionEntry->protStaCache[i].addr,
Jeff Johnson295189b2012-06-20 16:38:30 -07001848 peerMacAddr,
1849 sizeof(tSirMacAddr));
1850
1851 psessionEntry->protStaCache[i].protStaCacheType = protStaCacheType;
1852 psessionEntry->protStaCache[i].active = true;
1853 if(eLIM_PROT_STA_CACHE_TYPE_llB == protStaCacheType)
1854 {
1855 psessionEntry->gLim11bParams.numSta++;
1856 limLog(pMac,LOG1, FL("11B, "));
1857 }
1858 else if(eLIM_PROT_STA_CACHE_TYPE_llG == protStaCacheType)
1859 {
1860 psessionEntry->gLim11gParams.numSta++;
1861 limLog(pMac,LOG1, FL("11G, "));
1862 }
1863 else if(eLIM_PROT_STA_CACHE_TYPE_HT20 == protStaCacheType)
1864 {
1865 psessionEntry->gLimHt20Params.numSta++;
1866 limLog(pMac,LOG1, FL("HT20, "));
1867 }
1868
1869 if(!gfSupported)
1870 {
1871 psessionEntry->gLimNonGfParams.numSta++;
1872 limLog(pMac,LOG1, FL("NonGf, "));
1873 }
1874 if(!lsigTxopSupported)
1875 {
1876 psessionEntry->gLimLsigTxopParams.numSta++;
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001877 limLog(pMac,LOG1, FL("!lsigTxopSupported"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001878 }
1879}// ---------------------------------------------------------------------
1880
1881/** -------------------------------------------------------------
1882\fn limDecideApProtection
1883\brief Decides all the protection related staiton coexistence and also sets
1884\ short preamble and short slot appropriately. This function will be called
1885\ when AP is ready to send assocRsp tp the station joining right now.
1886\param tpAniSirGlobal pMac
1887\param tSirMacAddr peerMacAddr
1888\return None
1889 -------------------------------------------------------------*/
1890void
1891limDecideApProtection(tpAniSirGlobal pMac, tSirMacAddr peerMacAddr, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry)
1892{
1893 tANI_U16 tmpAid;
1894 tpDphHashNode pStaDs;
1895 tSirRFBand rfBand = SIR_BAND_UNKNOWN;
1896 tANI_U32 phyMode;
1897 tLimProtStaCacheType protStaCacheType = eLIM_PROT_STA_CACHE_TYPE_INVALID;
1898 tHalBitVal gfSupported = eHAL_SET, lsigTxopSupported = eHAL_SET;
1899
1900 pBeaconParams->paramChangeBitmap = 0;
1901 // check whether to enable protection or not
1902 pStaDs = dphLookupHashEntry(pMac, peerMacAddr, &tmpAid, &psessionEntry->dph.dphHashTable);
1903 if(NULL == pStaDs)
1904 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001905 PELOG1(limLog(pMac, LOG1, FL("pStaDs is NULL"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001906 return;
1907 }
1908 limGetRfBand(pMac, &rfBand, psessionEntry);
1909 //if we are in 5 GHZ band
1910 if(SIR_BAND_5_GHZ == rfBand)
1911 {
1912 //We are 11N. we need to protect from 11A and Ht20. we don't need any other protection in 5 GHZ.
1913 //HT20 case is common between both the bands and handled down as common code.
Jeff Johnsone7245742012-09-05 17:12:55 -07001914 if(true == psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07001915 {
1916 //we are 11N and 11A station is joining.
1917 //protection from 11A required.
1918 if(false == pStaDs->mlmStaContext.htCapability)
1919 {
1920 limEnable11aProtection(pMac, true, false, pBeaconParams,psessionEntry);
1921 return;
1922 }
1923 }
1924 }
1925 else if(SIR_BAND_2_4_GHZ== rfBand)
1926 {
1927 limGetPhyMode(pMac, &phyMode, psessionEntry);
1928
1929 //We are 11G. Check if we need protection from 11b Stations.
1930 if ((phyMode == WNI_CFG_PHY_MODE_11G) &&
Jeff Johnsone7245742012-09-05 17:12:55 -07001931 (false == psessionEntry->htCapability))
Jeff Johnson295189b2012-06-20 16:38:30 -07001932 {
1933
1934 if (pStaDs->erpEnabled== eHAL_CLEAR)
1935 {
1936 protStaCacheType = eLIM_PROT_STA_CACHE_TYPE_llB;
1937 // enable protection
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001938 PELOG3(limLog(pMac, LOG3, FL("Enabling protection from 11B"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001939 limEnable11gProtection(pMac, true, false, pBeaconParams,psessionEntry);
1940 }
1941 }
1942
1943 //HT station.
Jeff Johnsone7245742012-09-05 17:12:55 -07001944 if (true == psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07001945 {
1946 //check if we need protection from 11b station
1947 if ((pStaDs->erpEnabled == eHAL_CLEAR) &&
1948 (!pStaDs->mlmStaContext.htCapability))
1949 {
1950 protStaCacheType = eLIM_PROT_STA_CACHE_TYPE_llB;
1951 // enable protection
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001952 PELOG3(limLog(pMac, LOG3, FL("Enabling protection from 11B"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001953 limEnable11gProtection(pMac, true, false, pBeaconParams, psessionEntry);
1954 }
1955 //station being joined is non-11b and non-ht ==> 11g device
1956 else if(!pStaDs->mlmStaContext.htCapability)
1957 {
1958 protStaCacheType = eLIM_PROT_STA_CACHE_TYPE_llG;
1959 //enable protection
1960 limEnableHtProtectionFrom11g(pMac, true, false, pBeaconParams, psessionEntry);
1961 }
1962 //ERP mode is enabled for the latest station joined
1963 //latest station joined is HT capable
1964 //This case is being handled in common code (commn between both the bands) below.
1965 }
1966 }
1967
1968 //we are HT and HT station is joining. This code is common for both the bands.
Jeff Johnsone7245742012-09-05 17:12:55 -07001969 if((true == psessionEntry->htCapability) &&
Jeff Johnson295189b2012-06-20 16:38:30 -07001970 (true == pStaDs->mlmStaContext.htCapability))
1971 {
1972 if(!pStaDs->htGreenfield)
1973 {
1974 limEnableHTNonGfProtection(pMac, true, false, pBeaconParams, psessionEntry);
1975 gfSupported = eHAL_CLEAR;
1976 }
1977 //Station joining is HT 20Mhz
1978 if(eHT_CHANNEL_WIDTH_20MHZ == pStaDs->htSupportedChannelWidthSet)
1979 {
1980 protStaCacheType = eLIM_PROT_STA_CACHE_TYPE_HT20;
1981 limEnableHT20Protection(pMac, true, false, pBeaconParams, psessionEntry);
1982 }
1983 //Station joining does not support LSIG TXOP Protection
1984 if(!pStaDs->htLsigTXOPProtection)
1985 {
1986 limEnableHTLsigTxopProtection(pMac, false, false, pBeaconParams,psessionEntry);
1987 lsigTxopSupported = eHAL_CLEAR;
1988 }
1989 }
1990
1991 limUpdateProtStaParams(pMac, peerMacAddr, protStaCacheType,
1992 gfSupported, lsigTxopSupported, psessionEntry);
1993
1994 return;
1995}
Jeff Johnson295189b2012-06-20 16:38:30 -07001996
1997
1998/** -------------------------------------------------------------
1999\fn limEnableOverlap11gProtection
2000\brief wrapper function for setting overlap 11g protection.
2001\param tpAniSirGlobal pMac
2002\param tpUpdateBeaconParams pBeaconParams
2003\param tpSirMacMgmtHdr pMh
2004\return None
2005 -------------------------------------------------------------*/
2006void
2007limEnableOverlap11gProtection(tpAniSirGlobal pMac,
2008tpUpdateBeaconParams pBeaconParams, tpSirMacMgmtHdr pMh,tpPESession psessionEntry)
2009{
2010 limUpdateOverlapStaParam(pMac, pMh->bssId, &(psessionEntry->gLimOlbcParams));
2011
2012 if (psessionEntry->gLimOlbcParams.numSta &&
2013 !psessionEntry->gLimOlbcParams.protectionEnabled)
2014 {
2015 // enable protection
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002016 PELOG1(limLog(pMac, LOG1, FL("OLBC happens!!!"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002017 limEnable11gProtection(pMac, true, true, pBeaconParams,psessionEntry);
2018 }
2019}
2020
2021
2022/** -------------------------------------------------------------
2023\fn limUpdateShortPreamble
2024\brief Updates short preamble if needed when a new station joins.
2025\param tpAniSirGlobal pMac
2026\param tSirMacAddr peerMacAddr
2027\param tpUpdateBeaconParams pBeaconParams
2028\return None
2029 -------------------------------------------------------------*/
2030void
2031limUpdateShortPreamble(tpAniSirGlobal pMac, tSirMacAddr peerMacAddr,
2032 tpUpdateBeaconParams pBeaconParams, tpPESession psessionEntry)
2033{
2034 tANI_U16 tmpAid;
2035 tpDphHashNode pStaDs;
2036 tANI_U32 phyMode;
2037 tANI_U16 i;
2038
2039 // check whether to enable protection or not
2040 pStaDs = dphLookupHashEntry(pMac, peerMacAddr, &tmpAid, &psessionEntry->dph.dphHashTable);
2041
2042 limGetPhyMode(pMac, &phyMode, psessionEntry);
2043
2044 if (pStaDs != NULL && phyMode == WNI_CFG_PHY_MODE_11G)
2045
2046 {
2047 if (pStaDs->shortPreambleEnabled == eHAL_CLEAR)
2048 {
2049 PELOG1(limLog(pMac,LOG1,FL("Short Preamble is not enabled in Assoc Req from "));
2050 limPrintMacAddr(pMac, peerMacAddr, LOG1);)
2051
2052 for (i=0; i<LIM_PROT_STA_CACHE_SIZE; i++)
2053 {
Jeff Johnson295189b2012-06-20 16:38:30 -07002054 if ((psessionEntry->limSystemRole == eLIM_AP_ROLE ) &&
2055 psessionEntry->gLimNoShortParams.staNoShortCache[i].active)
2056 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05302057 if (vos_mem_compare(
Jeff Johnson295189b2012-06-20 16:38:30 -07002058 psessionEntry->gLimNoShortParams.staNoShortCache[i].addr,
2059 peerMacAddr, sizeof(tSirMacAddr)))
2060 return;
2061 }else if(psessionEntry->limSystemRole != eLIM_AP_ROLE)
Jeff Johnson295189b2012-06-20 16:38:30 -07002062 {
2063 if (pMac->lim.gLimNoShortParams.staNoShortCache[i].active)
2064 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05302065 if (vos_mem_compare(
Jeff Johnson295189b2012-06-20 16:38:30 -07002066 pMac->lim.gLimNoShortParams.staNoShortCache[i].addr,
2067 peerMacAddr, sizeof(tSirMacAddr)))
2068 return;
2069 }
2070 }
2071 }
2072
2073
2074 for (i=0; i<LIM_PROT_STA_CACHE_SIZE; i++)
2075 {
Jeff Johnson295189b2012-06-20 16:38:30 -07002076 if ( (psessionEntry->limSystemRole == eLIM_AP_ROLE ) &&
2077 !psessionEntry->gLimNoShortParams.staNoShortCache[i].active)
2078 break;
2079 else
Jeff Johnson295189b2012-06-20 16:38:30 -07002080 {
2081 if (!pMac->lim.gLimNoShortParams.staNoShortCache[i].active)
2082 break;
2083 }
2084 }
2085
2086 if (i >= LIM_PROT_STA_CACHE_SIZE)
2087 {
Jeff Johnson295189b2012-06-20 16:38:30 -07002088 if(psessionEntry->limSystemRole == eLIM_AP_ROLE){
2089 limLog(pMac, LOGE, FL("No space in Short cache (#active %d, #sta %d) for sta "),
2090 i, psessionEntry->gLimNoShortParams.numNonShortPreambleSta);
2091 limPrintMacAddr(pMac, peerMacAddr, LOGE);
2092 return;
2093 }
2094 else
Jeff Johnson295189b2012-06-20 16:38:30 -07002095 {
2096 limLog(pMac, LOGE, FL("No space in Short cache (#active %d, #sta %d) for sta "),
2097 i, pMac->lim.gLimNoShortParams.numNonShortPreambleSta);
2098 limPrintMacAddr(pMac, peerMacAddr, LOGE);
2099 return;
2100 }
2101
2102 }
2103
2104
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05302105 if (psessionEntry->limSystemRole == eLIM_AP_ROLE){
2106 vos_mem_copy( psessionEntry->gLimNoShortParams.staNoShortCache[i].addr,
Jeff Johnson295189b2012-06-20 16:38:30 -07002107 peerMacAddr, sizeof(tSirMacAddr));
2108 psessionEntry->gLimNoShortParams.staNoShortCache[i].active = true;
2109 psessionEntry->gLimNoShortParams.numNonShortPreambleSta++;
2110 }else
Jeff Johnson295189b2012-06-20 16:38:30 -07002111 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05302112 vos_mem_copy( pMac->lim.gLimNoShortParams.staNoShortCache[i].addr,
Jeff Johnson295189b2012-06-20 16:38:30 -07002113 peerMacAddr, sizeof(tSirMacAddr));
2114 pMac->lim.gLimNoShortParams.staNoShortCache[i].active = true;
2115 pMac->lim.gLimNoShortParams.numNonShortPreambleSta++;
2116 }
2117
2118
2119 // enable long preamble
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002120 PELOG1(limLog(pMac, LOG1, FL("Disabling short preamble"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002121
Jeff Johnson295189b2012-06-20 16:38:30 -07002122 if (limEnableShortPreamble(pMac, false, pBeaconParams, psessionEntry) != eSIR_SUCCESS)
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002123 PELOGE(limLog(pMac, LOGE, FL("Cannot enable long preamble"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002124 }
2125 }
2126}
2127
2128/** -------------------------------------------------------------
2129\fn limUpdateShortSlotTime
2130\brief Updates short slot time if needed when a new station joins.
2131\param tpAniSirGlobal pMac
2132\param tSirMacAddr peerMacAddr
2133\param tpUpdateBeaconParams pBeaconParams
2134\return None
2135 -------------------------------------------------------------*/
2136
2137void
2138limUpdateShortSlotTime(tpAniSirGlobal pMac, tSirMacAddr peerMacAddr,
2139 tpUpdateBeaconParams pBeaconParams, tpPESession psessionEntry)
2140{
2141 tANI_U16 tmpAid;
2142 tpDphHashNode pStaDs;
2143 tANI_U32 phyMode;
2144 tANI_U32 val;
Jeff Johnson295189b2012-06-20 16:38:30 -07002145 tANI_U16 i;
2146
2147 // check whether to enable protection or not
2148 pStaDs = dphLookupHashEntry(pMac, peerMacAddr, &tmpAid, &psessionEntry->dph.dphHashTable);
2149 limGetPhyMode(pMac, &phyMode, psessionEntry);
2150
Jeff Johnsone7245742012-09-05 17:12:55 -07002151 /* Only in case of softap in 11g mode, slot time might change depending on the STA being added. In 11a case, it should
2152 * be always 1 and in 11b case, it should be always 0
2153 */
Jeff Johnson295189b2012-06-20 16:38:30 -07002154 if (pStaDs != NULL && phyMode == WNI_CFG_PHY_MODE_11G)
2155 {
Jeff Johnsone7245742012-09-05 17:12:55 -07002156 /* Only when the new STA has short slot time disabled, we need to change softap's overall slot time settings
2157 * else the default for softap is always short slot enabled. When the last long slot STA leaves softAP, we take care of
2158 * it in limDecideShortSlot
2159 */
Jeff Johnson295189b2012-06-20 16:38:30 -07002160 if (pStaDs->shortSlotTimeEnabled == eHAL_CLEAR)
2161 {
2162 PELOG1(limLog(pMac, LOG1, FL("Short Slot Time is not enabled in Assoc Req from "));
2163 limPrintMacAddr(pMac, peerMacAddr, LOG1);)
2164 for (i=0; i<LIM_PROT_STA_CACHE_SIZE; i++)
2165 {
Jeff Johnson295189b2012-06-20 16:38:30 -07002166 if ((psessionEntry->limSystemRole == eLIM_AP_ROLE ) &&
2167 psessionEntry->gLimNoShortSlotParams.staNoShortSlotCache[i].active)
2168 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05302169 if (vos_mem_compare(
Jeff Johnson295189b2012-06-20 16:38:30 -07002170 psessionEntry->gLimNoShortSlotParams.staNoShortSlotCache[i].addr,
2171 peerMacAddr, sizeof(tSirMacAddr)))
2172 return;
2173 }
2174 else if(psessionEntry->limSystemRole != eLIM_AP_ROLE )
Jeff Johnson295189b2012-06-20 16:38:30 -07002175 {
2176 if (pMac->lim.gLimNoShortSlotParams.staNoShortSlotCache[i].active)
2177 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05302178 if (vos_mem_compare(
Jeff Johnson295189b2012-06-20 16:38:30 -07002179 pMac->lim.gLimNoShortSlotParams.staNoShortSlotCache[i].addr,
2180 peerMacAddr, sizeof(tSirMacAddr)))
2181 return;
2182 }
2183 }
2184 }
2185
2186 for (i=0; i<LIM_PROT_STA_CACHE_SIZE; i++)
2187 {
Jeff Johnson295189b2012-06-20 16:38:30 -07002188 if ((psessionEntry->limSystemRole == eLIM_AP_ROLE ) &&
2189 !psessionEntry->gLimNoShortSlotParams.staNoShortSlotCache[i].active)
2190 break;
2191 else
Jeff Johnson295189b2012-06-20 16:38:30 -07002192 {
2193 if (!pMac->lim.gLimNoShortSlotParams.staNoShortSlotCache[i].active)
2194 break;
2195 }
2196 }
2197
2198 if (i >= LIM_PROT_STA_CACHE_SIZE)
2199 {
Jeff Johnson295189b2012-06-20 16:38:30 -07002200 if(psessionEntry->limSystemRole == eLIM_AP_ROLE){
2201 limLog(pMac, LOGE, FL("No space in ShortSlot cache (#active %d, #sta %d) for sta "),
2202 i, psessionEntry->gLimNoShortSlotParams.numNonShortSlotSta);
2203 limPrintMacAddr(pMac, peerMacAddr, LOGE);
2204 return;
2205 }else
Jeff Johnson295189b2012-06-20 16:38:30 -07002206 {
2207 limLog(pMac, LOGE, FL("No space in ShortSlot cache (#active %d, #sta %d) for sta "),
2208 i, pMac->lim.gLimNoShortSlotParams.numNonShortSlotSta);
2209 limPrintMacAddr(pMac, peerMacAddr, LOGE);
2210 return;
2211 }
2212 }
2213
2214
Jeff Johnson295189b2012-06-20 16:38:30 -07002215 if(psessionEntry->limSystemRole == eLIM_AP_ROLE){
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05302216 vos_mem_copy( psessionEntry->gLimNoShortSlotParams.staNoShortSlotCache[i].addr,
Jeff Johnson295189b2012-06-20 16:38:30 -07002217 peerMacAddr, sizeof(tSirMacAddr));
2218 psessionEntry->gLimNoShortSlotParams.staNoShortSlotCache[i].active = true;
2219 psessionEntry->gLimNoShortSlotParams.numNonShortSlotSta++;
2220 }else
Jeff Johnson295189b2012-06-20 16:38:30 -07002221 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05302222 vos_mem_copy( pMac->lim.gLimNoShortSlotParams.staNoShortSlotCache[i].addr,
Jeff Johnson295189b2012-06-20 16:38:30 -07002223 peerMacAddr, sizeof(tSirMacAddr));
2224 pMac->lim.gLimNoShortSlotParams.staNoShortSlotCache[i].active = true;
2225 pMac->lim.gLimNoShortSlotParams.numNonShortSlotSta++;
2226 }
2227 wlan_cfgGetInt(pMac, WNI_CFG_11G_SHORT_SLOT_TIME_ENABLED, &val);
2228
Jeff Johnsone7245742012-09-05 17:12:55 -07002229 /* 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
2230 * only long slot enabled, we need to change our beacon/pb rsp to broadcast short slot disabled
2231 */
Jeff Johnson295189b2012-06-20 16:38:30 -07002232 if ( (psessionEntry->limSystemRole == eLIM_AP_ROLE) &&
Jeff Johnsone7245742012-09-05 17:12:55 -07002233 (val && psessionEntry->gLimNoShortSlotParams.numNonShortSlotSta && psessionEntry->shortSlotTimeSupported))
Jeff Johnson295189b2012-06-20 16:38:30 -07002234 {
2235 // enable long slot time
2236 pBeaconParams->fShortSlotTime = false;
2237 pBeaconParams->paramChangeBitmap |= PARAM_SHORT_SLOT_TIME_CHANGED;
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002238 PELOG1(limLog(pMac, LOG1, FL("Disable short slot time. Enable long slot time."));)
Jeff Johnsone7245742012-09-05 17:12:55 -07002239 psessionEntry->shortSlotTimeSupported = false;
Jeff Johnson295189b2012-06-20 16:38:30 -07002240 }
2241 else if ( psessionEntry->limSystemRole != eLIM_AP_ROLE)
Jeff Johnson295189b2012-06-20 16:38:30 -07002242 {
Jeff Johnsone7245742012-09-05 17:12:55 -07002243 if (val && pMac->lim.gLimNoShortSlotParams.numNonShortSlotSta && psessionEntry->shortSlotTimeSupported)
Jeff Johnson295189b2012-06-20 16:38:30 -07002244 {
2245 // enable long slot time
2246 pBeaconParams->fShortSlotTime = false;
2247 pBeaconParams->paramChangeBitmap |= PARAM_SHORT_SLOT_TIME_CHANGED;
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002248 PELOG1(limLog(pMac, LOG1, FL("Disable short slot time. Enable long slot time."));)
Jeff Johnsone7245742012-09-05 17:12:55 -07002249 psessionEntry->shortSlotTimeSupported = false;
Jeff Johnson295189b2012-06-20 16:38:30 -07002250 }
2251 }
2252 }
2253 }
2254}
2255
Jeff Johnson295189b2012-06-20 16:38:30 -07002256
2257/** -------------------------------------------------------------
2258\fn limDecideStaProtectionOnAssoc
2259\brief Decide protection related settings on Sta while association.
2260\param tpAniSirGlobal pMac
2261\param tpSchBeaconStruct pBeaconStruct
2262\return None
2263 -------------------------------------------------------------*/
2264void
2265limDecideStaProtectionOnAssoc(tpAniSirGlobal pMac,
2266 tpSchBeaconStruct pBeaconStruct, tpPESession psessionEntry)
2267{
2268 tSirRFBand rfBand = SIR_BAND_UNKNOWN;
2269 tANI_U32 phyMode = WNI_CFG_PHY_MODE_NONE;
2270
2271 limGetRfBand(pMac, &rfBand, psessionEntry);
2272 limGetPhyMode(pMac, &phyMode, psessionEntry);
2273
2274 if(SIR_BAND_5_GHZ == rfBand)
2275 {
2276 if((eSIR_HT_OP_MODE_MIXED == pBeaconStruct->HTInfo.opMode) ||
2277 (eSIR_HT_OP_MODE_OVERLAP_LEGACY == pBeaconStruct->HTInfo.opMode))
2278 {
2279 if(pMac->lim.cfgProtection.fromlla)
2280 psessionEntry->beaconParams.llaCoexist = true;
2281 }
2282 else if(eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT == pBeaconStruct->HTInfo.opMode)
2283 {
2284 if(pMac->lim.cfgProtection.ht20)
2285 psessionEntry->beaconParams.ht20Coexist = true;
2286 }
2287
2288 }
2289 else if(SIR_BAND_2_4_GHZ == rfBand)
2290 {
2291 //spec 7.3.2.13
2292 //UseProtection will be set when nonERP STA is associated.
2293 //NonERPPresent bit will be set when:
2294 //--nonERP Sta is associated OR
2295 //--nonERP Sta exists in overlapping BSS
2296 //when useProtection is not set then protection from nonERP stations is optional.
2297
2298 //CFG protection from 11b is enabled and
2299 //11B device in the BSS
2300 /* TODO, This is not sessionized */
2301 if (phyMode != WNI_CFG_PHY_MODE_11B)
2302 {
2303 if (pMac->lim.cfgProtection.fromllb &&
2304 pBeaconStruct->erpPresent &&
2305 (pBeaconStruct->erpIEInfo.useProtection ||
2306 pBeaconStruct->erpIEInfo.nonErpPresent))
2307 {
2308 psessionEntry->beaconParams.llbCoexist = true;
2309 }
2310 //AP has no 11b station associated.
2311 else
2312 {
2313 psessionEntry->beaconParams.llbCoexist = false;
2314 }
2315 }
2316 //following code block is only for HT station.
Jeff Johnsone7245742012-09-05 17:12:55 -07002317 if((psessionEntry->htCapability) &&
Jeff Johnson295189b2012-06-20 16:38:30 -07002318 (pBeaconStruct->HTInfo.present))
2319 {
2320 tDot11fIEHTInfo htInfo = pBeaconStruct->HTInfo;
2321
2322 //Obss Non HT STA present mode
2323 psessionEntry->beaconParams.gHTObssMode = (tANI_U8)htInfo.obssNonHTStaPresent;
2324
2325
2326 //CFG protection from 11G is enabled and
2327 //our AP has at least one 11G station associated.
2328 if(pMac->lim.cfgProtection.fromllg &&
2329 ((eSIR_HT_OP_MODE_MIXED == htInfo.opMode) ||
2330 (eSIR_HT_OP_MODE_OVERLAP_LEGACY == htInfo.opMode))&&
2331 (!psessionEntry->beaconParams.llbCoexist))
2332 {
2333 if(pMac->lim.cfgProtection.fromllg)
2334 psessionEntry->beaconParams.llgCoexist = true;
2335 }
2336
2337 //AP has only HT stations associated and at least one station is HT 20
2338 //disable protection from any non-HT devices.
2339 //decision for disabling protection from 11b has already been taken above.
2340 if(eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT == htInfo.opMode)
2341 {
2342 //Disable protection from 11G station.
2343 psessionEntry->beaconParams.llgCoexist = false;
2344 //CFG protection from HT 20 is enabled.
2345 if(pMac->lim.cfgProtection.ht20)
2346 psessionEntry->beaconParams.ht20Coexist = true;
2347 }
2348 //Disable protection from non-HT and HT20 devices.
2349 //decision for disabling protection from 11b has already been taken above.
2350 if(eSIR_HT_OP_MODE_PURE == htInfo.opMode)
2351 {
2352 psessionEntry->beaconParams.llgCoexist = false;
2353 psessionEntry->beaconParams.ht20Coexist = false;
2354 }
2355
2356 }
2357 }
2358
2359 //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 -07002360 if((psessionEntry->htCapability) &&
Jeff Johnson295189b2012-06-20 16:38:30 -07002361 (pBeaconStruct->HTInfo.present))
2362 {
2363 tDot11fIEHTInfo htInfo = pBeaconStruct->HTInfo;
2364 psessionEntry->beaconParams.fRIFSMode =
2365 ( tANI_U8 ) htInfo.rifsMode;
2366 psessionEntry->beaconParams.llnNonGFCoexist =
2367 ( tANI_U8 )htInfo.nonGFDevicesPresent;
2368 psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport =
2369 ( tANI_U8 )htInfo.lsigTXOPProtectionFullSupport;
2370 }
2371}
2372
2373
2374/** -------------------------------------------------------------
2375\fn limDecideStaProtection
2376\brief Decides protection related settings on Sta while processing beacon.
2377\param tpAniSirGlobal pMac
2378\param tpUpdateBeaconParams pBeaconParams
2379\return None
2380 -------------------------------------------------------------*/
2381void
2382limDecideStaProtection(tpAniSirGlobal pMac,
2383 tpSchBeaconStruct pBeaconStruct, tpUpdateBeaconParams pBeaconParams, tpPESession psessionEntry)
2384{
2385
2386 tSirRFBand rfBand = SIR_BAND_UNKNOWN;
2387 tANI_U32 phyMode = WNI_CFG_PHY_MODE_NONE;
2388
2389 limGetRfBand(pMac, &rfBand, psessionEntry);
2390 limGetPhyMode(pMac, &phyMode, psessionEntry);
2391
2392 if(SIR_BAND_5_GHZ == rfBand)
2393 {
2394 //we are HT capable.
Jeff Johnsone7245742012-09-05 17:12:55 -07002395 if((true == psessionEntry->htCapability) &&
Jeff Johnson295189b2012-06-20 16:38:30 -07002396 (pBeaconStruct->HTInfo.present))
2397 {
2398 //we are HT capable, AP's HT OPMode is mixed / overlap legacy ==> need protection from 11A.
2399 if((eSIR_HT_OP_MODE_MIXED == pBeaconStruct->HTInfo.opMode) ||
2400 (eSIR_HT_OP_MODE_OVERLAP_LEGACY == pBeaconStruct->HTInfo.opMode))
2401 {
2402 limEnable11aProtection(pMac, true, false, pBeaconParams,psessionEntry);
2403 }
2404 //we are HT capable, AP's HT OPMode is HT20 ==> disable protection from 11A if enabled. enabled
2405 //protection from HT20 if needed.
2406 else if(eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT== pBeaconStruct->HTInfo.opMode)
2407 {
2408 limEnable11aProtection(pMac, false, false, pBeaconParams,psessionEntry);
2409 limEnableHT20Protection(pMac, true, false, pBeaconParams,psessionEntry);
2410 }
2411 else if(eSIR_HT_OP_MODE_PURE == pBeaconStruct->HTInfo.opMode)
2412 {
2413 limEnable11aProtection(pMac, false, false, pBeaconParams,psessionEntry);
2414 limEnableHT20Protection(pMac, false, false, pBeaconParams,psessionEntry);
2415 }
2416 }
2417 }
2418 else if(SIR_BAND_2_4_GHZ == rfBand)
2419 {
2420 /* spec 7.3.2.13
2421 * UseProtection will be set when nonERP STA is associated.
2422 * NonERPPresent bit will be set when:
2423 * --nonERP Sta is associated OR
2424 * --nonERP Sta exists in overlapping BSS
2425 * when useProtection is not set then protection from nonERP stations is optional.
2426 */
2427
2428 if (phyMode != WNI_CFG_PHY_MODE_11B)
2429 {
2430 if (pBeaconStruct->erpPresent &&
2431 (pBeaconStruct->erpIEInfo.useProtection ||
2432 pBeaconStruct->erpIEInfo.nonErpPresent))
2433 {
2434 limEnable11gProtection(pMac, true, false, pBeaconParams, psessionEntry);
2435 }
2436 //AP has no 11b station associated.
2437 else
2438 {
2439 //disable protection from 11b station
2440 limEnable11gProtection(pMac, false, false, pBeaconParams, psessionEntry);
2441 }
2442 }
2443
2444 //following code block is only for HT station.
Jeff Johnsone7245742012-09-05 17:12:55 -07002445 if((psessionEntry->htCapability) &&
Jeff Johnson295189b2012-06-20 16:38:30 -07002446 (pBeaconStruct->HTInfo.present))
2447 {
2448
2449 tDot11fIEHTInfo htInfo = pBeaconStruct->HTInfo;
2450 //AP has at least one 11G station associated.
2451 if(((eSIR_HT_OP_MODE_MIXED == htInfo.opMode) ||
2452 (eSIR_HT_OP_MODE_OVERLAP_LEGACY == htInfo.opMode))&&
2453 (!psessionEntry->beaconParams.llbCoexist))
2454 {
2455 limEnableHtProtectionFrom11g(pMac, true, false, pBeaconParams,psessionEntry);
2456
2457 }
2458
2459 //no HT operating mode change ==> no change in protection settings except for MIXED_MODE/Legacy Mode.
2460 //in Mixed mode/legacy Mode even if there is no change in HT operating mode, there might be change in 11bCoexist
2461 //or 11gCoexist. that is why this check is being done after mixed/legacy mode check.
2462 if ( pMac->lim.gHTOperMode != ( tSirMacHTOperatingMode )htInfo.opMode )
2463 {
2464 pMac->lim.gHTOperMode = ( tSirMacHTOperatingMode )htInfo.opMode;
2465
2466 //AP has only HT stations associated and at least one station is HT 20
2467 //disable protection from any non-HT devices.
2468 //decision for disabling protection from 11b has already been taken above.
2469 if(eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT == htInfo.opMode)
2470 {
2471 //Disable protection from 11G station.
2472 limEnableHtProtectionFrom11g(pMac, false, false, pBeaconParams,psessionEntry);
2473
2474 limEnableHT20Protection(pMac, true, false, pBeaconParams,psessionEntry);
2475 }
2476 //Disable protection from non-HT and HT20 devices.
2477 //decision for disabling protection from 11b has already been taken above.
2478 else if(eSIR_HT_OP_MODE_PURE == htInfo.opMode)
2479 {
2480 limEnableHtProtectionFrom11g(pMac, false, false, pBeaconParams,psessionEntry);
2481 limEnableHT20Protection(pMac, false, false, pBeaconParams,psessionEntry);
2482
2483 }
2484 }
2485 }
2486 }
2487
2488 //following code block is only for HT station. ( 2.4 GHZ as well as 5 GHZ)
Jeff Johnsone7245742012-09-05 17:12:55 -07002489 if((psessionEntry->htCapability) &&
Jeff Johnson295189b2012-06-20 16:38:30 -07002490 (pBeaconStruct->HTInfo.present))
2491 {
2492 tDot11fIEHTInfo htInfo = pBeaconStruct->HTInfo;
2493 //Check for changes in protection related factors other than HT operating mode.
2494 //Check for changes in RIFS mode, nonGFDevicesPresent, lsigTXOPProtectionFullSupport.
2495 if ( psessionEntry->beaconParams.fRIFSMode !=
2496 ( tANI_U8 ) htInfo.rifsMode )
2497 {
2498 pBeaconParams->fRIFSMode =
2499 psessionEntry->beaconParams.fRIFSMode =
2500 ( tANI_U8 ) htInfo.rifsMode;
2501 pBeaconParams->paramChangeBitmap |= PARAM_RIFS_MODE_CHANGED;
2502 }
2503
2504 if ( psessionEntry->beaconParams.llnNonGFCoexist !=
2505 htInfo.nonGFDevicesPresent )
2506 {
2507 pBeaconParams->llnNonGFCoexist =
2508 psessionEntry->beaconParams.llnNonGFCoexist =
2509 ( tANI_U8 )htInfo.nonGFDevicesPresent;
2510 pBeaconParams->paramChangeBitmap |=
2511 PARAM_NON_GF_DEVICES_PRESENT_CHANGED;
2512 }
2513
2514 if ( psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport !=
2515 ( tANI_U8 )htInfo.lsigTXOPProtectionFullSupport )
2516 {
2517 pBeaconParams->fLsigTXOPProtectionFullSupport =
2518 psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport =
2519 ( tANI_U8 )htInfo.lsigTXOPProtectionFullSupport;
2520 pBeaconParams->paramChangeBitmap |=
2521 PARAM_LSIG_TXOP_FULL_SUPPORT_CHANGED;
2522 }
2523
2524 // For Station just update the global lim variable, no need to send message to HAL
2525 // Station already taking care of HT OPR Mode=01, meaning AP is seeing legacy
2526 //stations in overlapping BSS.
2527 if ( psessionEntry->beaconParams.gHTObssMode != ( tANI_U8 )htInfo.obssNonHTStaPresent )
2528 psessionEntry->beaconParams.gHTObssMode = ( tANI_U8 )htInfo.obssNonHTStaPresent ;
2529
2530 }
2531}
2532
2533
2534/**
2535 * limProcessChannelSwitchTimeout()
2536 *
2537 *FUNCTION:
2538 * This function is invoked when Channel Switch Timer expires at
2539 * the STA. Now, STA must stop traffic, and then change/disable
2540 * primary or secondary channel.
2541 *
2542 *
2543 *NOTE:
2544 * @param pMac - Pointer to Global MAC structure
2545 * @return None
2546 */
2547void limProcessChannelSwitchTimeout(tpAniSirGlobal pMac)
2548{
2549 tpPESession psessionEntry = NULL;
Jeff Johnsone7245742012-09-05 17:12:55 -07002550 tANI_U8 channel; // This is received and stored from channelSwitch Action frame
Jeff Johnson295189b2012-06-20 16:38:30 -07002551
2552 if((psessionEntry = peFindSessionBySessionId(pMac, pMac->lim.limTimers.gLimChannelSwitchTimer.sessionId))== NULL)
2553 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002554 limLog(pMac, LOGP,FL("Session Does not exist for given sessionID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002555 return;
2556 }
2557
2558 if (psessionEntry->limSystemRole != eLIM_STA_ROLE)
2559 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002560 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 -07002561 return;
2562 }
Jeff Johnsone7245742012-09-05 17:12:55 -07002563 channel = psessionEntry->gLimChannelSwitch.primaryChannel;
Jeff Johnson295189b2012-06-20 16:38:30 -07002564 /*
2565 * This potentially can create issues if the function tries to set
2566 * channel while device is in power-save, hence putting an extra check
2567 * to verify if the device is in power-save or not
2568 */
2569 if(!limIsSystemInActiveState(pMac))
2570 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002571 PELOGW(limLog(pMac, LOGW, FL("Device is not in active state, cannot switch channel"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002572 return;
2573 }
2574
2575 // Restore Channel Switch parameters to default
Jeff Johnsone7245742012-09-05 17:12:55 -07002576 psessionEntry->gLimChannelSwitch.switchTimeoutValue = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07002577
2578 /* Channel-switch timeout has occurred. reset the state */
Jeff Johnsone7245742012-09-05 17:12:55 -07002579 psessionEntry->gLimSpecMgmt.dot11hChanSwState = eLIM_11H_CHANSW_END;
Jeff Johnson295189b2012-06-20 16:38:30 -07002580
2581 /* Check if the AP is switching to a channel that we support.
2582 * Else, just don't bother to switch. Indicate HDD to look for a
2583 * better AP to associate
2584 */
2585 if(!limIsChannelValidForChannelSwitch(pMac, channel))
2586 {
2587 /* We need to restore pre-channelSwitch state on the STA */
2588 if(limRestorePreChannelSwitchState(pMac, psessionEntry) != eSIR_SUCCESS)
2589 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002590 limLog(pMac, LOGP, FL("Could not restore pre-channelSwitch (11h) state, resetting the system"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002591 return;
2592 }
2593
2594 /* If the channel-list that AP is asking us to switch is invalid,
2595 * then we cannot switch the channel. Just disassociate from AP.
2596 * We will find a better AP !!!
2597 */
2598 limTearDownLinkWithAp(pMac,
2599 pMac->lim.limTimers.gLimChannelSwitchTimer.sessionId,
2600 eSIR_MAC_UNSPEC_FAILURE_REASON);
2601 return;
2602 }
Kiran Kumar Lokereb8bb6842013-08-12 16:40:24 -07002603 limCovertChannelScanType(pMac, psessionEntry->currentOperChannel, false);
2604 pMac->lim.dfschannelList.timeStamp[psessionEntry->currentOperChannel] = 0;
Jeff Johnsone7245742012-09-05 17:12:55 -07002605 switch(psessionEntry->gLimChannelSwitch.state)
Jeff Johnson295189b2012-06-20 16:38:30 -07002606 {
2607 case eLIM_CHANNEL_SWITCH_PRIMARY_ONLY:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002608 PELOGW(limLog(pMac, LOGW, FL("CHANNEL_SWITCH_PRIMARY_ONLY "));)
Jeff Johnsone7245742012-09-05 17:12:55 -07002609 limSwitchPrimaryChannel(pMac, psessionEntry->gLimChannelSwitch.primaryChannel,psessionEntry);
2610 psessionEntry->gLimChannelSwitch.state = eLIM_CHANNEL_SWITCH_IDLE;
Jeff Johnson295189b2012-06-20 16:38:30 -07002611 break;
2612
2613 case eLIM_CHANNEL_SWITCH_SECONDARY_ONLY:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002614 PELOGW(limLog(pMac, LOGW, FL("CHANNEL_SWITCH_SECONDARY_ONLY "));)
Jeff Johnsone7245742012-09-05 17:12:55 -07002615 limSwitchPrimarySecondaryChannel(pMac, psessionEntry,
Jeff Johnson295189b2012-06-20 16:38:30 -07002616 psessionEntry->currentOperChannel,
Jeff Johnsone7245742012-09-05 17:12:55 -07002617 psessionEntry->gLimChannelSwitch.secondarySubBand);
2618 psessionEntry->gLimChannelSwitch.state = eLIM_CHANNEL_SWITCH_IDLE;
Jeff Johnson295189b2012-06-20 16:38:30 -07002619 break;
2620
2621 case eLIM_CHANNEL_SWITCH_PRIMARY_AND_SECONDARY:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002622 PELOGW(limLog(pMac, LOGW, FL("CHANNEL_SWITCH_PRIMARY_AND_SECONDARY"));)
Jeff Johnsone7245742012-09-05 17:12:55 -07002623 limSwitchPrimarySecondaryChannel(pMac, psessionEntry,
2624 psessionEntry->gLimChannelSwitch.primaryChannel,
2625 psessionEntry->gLimChannelSwitch.secondarySubBand);
2626 psessionEntry->gLimChannelSwitch.state = eLIM_CHANNEL_SWITCH_IDLE;
Jeff Johnson295189b2012-06-20 16:38:30 -07002627 break;
2628
2629 case eLIM_CHANNEL_SWITCH_IDLE:
2630 default:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002631 PELOGE(limLog(pMac, LOGE, FL("incorrect state "));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002632 if(limRestorePreChannelSwitchState(pMac, psessionEntry) != eSIR_SUCCESS)
2633 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002634 limLog(pMac, LOGP, FL("Could not restore pre-channelSwitch (11h) state, resetting the system"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002635 }
2636 return; /* Please note, this is 'return' and not 'break' */
2637 }
Jeff Johnsone7245742012-09-05 17:12:55 -07002638}
Jeff Johnson295189b2012-06-20 16:38:30 -07002639
2640/**
2641 * limUpdateChannelSwitch()
2642 *
2643 *FUNCTION:
2644 * This function is invoked whenever Station receives
2645 * either 802.11h channel switch IE or airgo proprietary
2646 * channel switch IE.
2647 *
2648 *NOTE:
2649 * @param pMac - Pointer to Global MAC structure
2650 * @return tpSirProbeRespBeacon - Pointer to Beacon/Probe Rsp
2651 * @param psessionentry
2652 */
2653void
2654limUpdateChannelSwitch(struct sAniSirGlobal *pMac, tpSirProbeRespBeacon pBeacon, tpPESession psessionEntry)
2655{
2656
2657 tANI_U16 beaconPeriod;
Jeff Johnson295189b2012-06-20 16:38:30 -07002658 tChannelSwitchPropIEStruct *pPropChnlSwitch;
2659 tDot11fIEChanSwitchAnn *pChnlSwitch;
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -07002660#ifdef WLAN_FEATURE_11AC
2661 tDot11fIEWiderBWChanSwitchAnn *pWiderChnlSwitch;
2662#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002663
Jeff Johnsone7245742012-09-05 17:12:55 -07002664 beaconPeriod = psessionEntry->beaconParams.beaconInterval;
Jeff Johnson295189b2012-06-20 16:38:30 -07002665
2666 /* STA either received proprietary channel switch IE or 802.11h
2667 * standard channel switch IE.
2668 */
2669 if (pBeacon->propIEinfo.propChannelSwitchPresent)
2670 {
2671 pPropChnlSwitch = &(pBeacon->propIEinfo.channelSwitch);
2672
2673 /* Add logic to determine which change this is: */
2674 /* primary, secondary, both. For now assume both. */
Jeff Johnsone7245742012-09-05 17:12:55 -07002675 psessionEntry->gLimChannelSwitch.state = eLIM_CHANNEL_SWITCH_PRIMARY_AND_SECONDARY;
2676 psessionEntry->gLimChannelSwitch.primaryChannel = pPropChnlSwitch->primaryChannel;
2677 psessionEntry->gLimChannelSwitch.secondarySubBand = (ePhyChanBondState)pPropChnlSwitch->subBand;
2678 psessionEntry->gLimChannelSwitch.switchCount = pPropChnlSwitch->channelSwitchCount;
2679 psessionEntry->gLimChannelSwitch.switchTimeoutValue =
Jeff Johnson295189b2012-06-20 16:38:30 -07002680 SYS_MS_TO_TICKS(beaconPeriod)* (pPropChnlSwitch->channelSwitchCount);
Jeff Johnsone7245742012-09-05 17:12:55 -07002681 psessionEntry->gLimChannelSwitch.switchMode = pPropChnlSwitch->mode;
Jeff Johnson295189b2012-06-20 16:38:30 -07002682 }
2683 else
2684 {
2685 pChnlSwitch = &(pBeacon->channelSwitchIE);
Jeff Johnsone7245742012-09-05 17:12:55 -07002686 psessionEntry->gLimChannelSwitch.primaryChannel = pChnlSwitch->newChannel;
2687 psessionEntry->gLimChannelSwitch.switchCount = pChnlSwitch->switchCount;
2688 psessionEntry->gLimChannelSwitch.switchTimeoutValue =
Jeff Johnson295189b2012-06-20 16:38:30 -07002689 SYS_MS_TO_TICKS(beaconPeriod)* (pChnlSwitch->switchCount);
Jeff Johnsone7245742012-09-05 17:12:55 -07002690 psessionEntry->gLimChannelSwitch.switchMode = pChnlSwitch->switchMode;
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -07002691#ifdef WLAN_FEATURE_11AC
2692 pWiderChnlSwitch = &(pBeacon->WiderBWChanSwitchAnn);
2693 if(pBeacon->WiderBWChanSwitchAnnPresent)
2694 {
2695 psessionEntry->gLimWiderBWChannelSwitch.newChanWidth = pWiderChnlSwitch->newChanWidth;
2696 psessionEntry->gLimWiderBWChannelSwitch.newCenterChanFreq0 = pWiderChnlSwitch->newCenterChanFreq0;
2697 psessionEntry->gLimWiderBWChannelSwitch.newCenterChanFreq1 = pWiderChnlSwitch->newCenterChanFreq1;
2698 }
2699#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002700
2701 /* Only primary channel switch element is present */
Jeff Johnsone7245742012-09-05 17:12:55 -07002702 psessionEntry->gLimChannelSwitch.state = eLIM_CHANNEL_SWITCH_PRIMARY_ONLY;
2703 psessionEntry->gLimChannelSwitch.secondarySubBand = PHY_SINGLE_CHANNEL_CENTERED;
Jeff Johnson295189b2012-06-20 16:38:30 -07002704
2705 /* Do not bother to look and operate on extended channel switch element
2706 * if our own channel-bonding state is not enabled
2707 */
Jeff Johnsone7245742012-09-05 17:12:55 -07002708 if (psessionEntry->htSupportedChannelWidthSet)
Jeff Johnson295189b2012-06-20 16:38:30 -07002709 {
2710 if (pBeacon->extChannelSwitchPresent)
2711 {
Jeff Johnsone7245742012-09-05 17:12:55 -07002712 if ((pBeacon->extChannelSwitchIE.secondaryChannelOffset == PHY_DOUBLE_CHANNEL_LOW_PRIMARY) ||
2713 (pBeacon->extChannelSwitchIE.secondaryChannelOffset == PHY_DOUBLE_CHANNEL_HIGH_PRIMARY))
Jeff Johnson295189b2012-06-20 16:38:30 -07002714 {
Jeff Johnsone7245742012-09-05 17:12:55 -07002715 psessionEntry->gLimChannelSwitch.state = eLIM_CHANNEL_SWITCH_PRIMARY_AND_SECONDARY;
2716 psessionEntry->gLimChannelSwitch.secondarySubBand = pBeacon->extChannelSwitchIE.secondaryChannelOffset;
Jeff Johnson295189b2012-06-20 16:38:30 -07002717 }
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -07002718#ifdef WLAN_FEATURE_11AC
2719 if(psessionEntry->vhtCapability && pBeacon->WiderBWChanSwitchAnnPresent)
2720 {
2721 if (pWiderChnlSwitch->newChanWidth == WNI_CFG_VHT_CHANNEL_WIDTH_80MHZ)
2722 {
2723 if(pBeacon->extChannelSwitchPresent)
2724 {
2725 if ((pBeacon->extChannelSwitchIE.secondaryChannelOffset == PHY_DOUBLE_CHANNEL_LOW_PRIMARY) ||
2726 (pBeacon->extChannelSwitchIE.secondaryChannelOffset == PHY_DOUBLE_CHANNEL_HIGH_PRIMARY))
2727 {
2728 psessionEntry->gLimChannelSwitch.state = eLIM_CHANNEL_SWITCH_PRIMARY_AND_SECONDARY;
2729 psessionEntry->gLimChannelSwitch.secondarySubBand = limGet11ACPhyCBState(pMac,
2730 psessionEntry->gLimChannelSwitch.primaryChannel,
2731 pBeacon->extChannelSwitchIE.secondaryChannelOffset,
2732 pWiderChnlSwitch->newCenterChanFreq0,
2733 psessionEntry);
2734 }
2735 }
2736 }
2737 }
2738#endif
Jeff Johnsone7245742012-09-05 17:12:55 -07002739 }
2740 }
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -07002741 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002742 if (eSIR_SUCCESS != limStartChannelSwitch(pMac, psessionEntry))
2743 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002744 PELOGW(limLog(pMac, LOGW, FL("Could not start Channel Switch"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002745 }
2746
2747 limLog(pMac, LOGW,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002748 FL("session %d primary chl %d, subband %d, count %d (%d ticks) "),
Jeff Johnsone7245742012-09-05 17:12:55 -07002749 psessionEntry->peSessionId,
2750 psessionEntry->gLimChannelSwitch.primaryChannel,
2751 psessionEntry->gLimChannelSwitch.secondarySubBand,
2752 psessionEntry->gLimChannelSwitch.switchCount,
2753 psessionEntry->gLimChannelSwitch.switchTimeoutValue);
Jeff Johnson295189b2012-06-20 16:38:30 -07002754 return;
2755}
2756
2757/**
2758 * limCancelDot11hChannelSwitch
2759 *
2760 *FUNCTION:
2761 * This function is called when STA does not send updated channel-swith IE
2762 * after indicating channel-switch start. This will cancel the channel-swith
2763 * timer which is already running.
2764 *
2765 *LOGIC:
2766 *
2767 *ASSUMPTIONS:
2768 *
2769 *NOTE:
2770 *
2771 * @param pMac - Pointer to Global MAC structure
2772 *
2773 * @return None
2774 */
2775void limCancelDot11hChannelSwitch(tpAniSirGlobal pMac, tpPESession psessionEntry)
2776{
Jeff Johnson295189b2012-06-20 16:38:30 -07002777 if (psessionEntry->limSystemRole != eLIM_STA_ROLE)
2778 return;
2779
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002780 PELOGW(limLog(pMac, LOGW, FL("Received a beacon without channel switch IE"));)
Jeff Johnsone7245742012-09-05 17:12:55 -07002781 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_DEACTIVATE, psessionEntry->peSessionId, eLIM_CHANNEL_SWITCH_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -07002782
2783 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimChannelSwitchTimer) != eSIR_SUCCESS)
2784 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002785 PELOGE(limLog(pMac, LOGE, FL("tx_timer_deactivate failed!"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002786 }
2787
2788 /* We need to restore pre-channelSwitch state on the STA */
2789 if (limRestorePreChannelSwitchState(pMac, psessionEntry) != eSIR_SUCCESS)
2790 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002791 PELOGE(limLog(pMac, LOGE, FL("LIM: Could not restore pre-channelSwitch (11h) state, resetting the system"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002792
2793 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002794}
2795
2796/**----------------------------------------------
2797\fn limCancelDot11hQuiet
2798\brief Cancel the quieting on Station if latest
2799 beacon doesn't contain quiet IE in it.
2800
2801\param pMac
2802\return NONE
2803-----------------------------------------------*/
2804void limCancelDot11hQuiet(tpAniSirGlobal pMac, tpPESession psessionEntry)
2805{
Jeff Johnson295189b2012-06-20 16:38:30 -07002806 if (psessionEntry->limSystemRole != eLIM_STA_ROLE)
2807 return;
2808
Jeff Johnsone7245742012-09-05 17:12:55 -07002809 if (psessionEntry->gLimSpecMgmt.quietState == eLIM_QUIET_BEGIN)
Jeff Johnson295189b2012-06-20 16:38:30 -07002810 {
Jeff Johnsone7245742012-09-05 17:12:55 -07002811 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_DEACTIVATE, psessionEntry->peSessionId, eLIM_QUIET_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -07002812 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimQuietTimer) != TX_SUCCESS)
2813 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002814 PELOGE(limLog(pMac, LOGE, FL("tx_timer_deactivate failed"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002815 }
2816 }
Jeff Johnsone7245742012-09-05 17:12:55 -07002817 else if (psessionEntry->gLimSpecMgmt.quietState == eLIM_QUIET_RUNNING)
Jeff Johnson295189b2012-06-20 16:38:30 -07002818 {
Jeff Johnsone7245742012-09-05 17:12:55 -07002819 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_DEACTIVATE, psessionEntry->peSessionId, eLIM_QUIET_BSS_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -07002820 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimQuietBssTimer) != TX_SUCCESS)
2821 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002822 PELOGE(limLog(pMac, LOGE, FL("tx_timer_deactivate failed"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002823 }
2824 /**
2825 * If the channel switch is already running in silent mode, dont resume the
2826 * transmission. Channel switch timer when timeout, transmission will be resumed.
2827 */
Jeff Johnsone7245742012-09-05 17:12:55 -07002828 if(!((psessionEntry->gLimSpecMgmt.dot11hChanSwState == eLIM_11H_CHANSW_RUNNING) &&
2829 (psessionEntry->gLimChannelSwitch.switchMode == eSIR_CHANSW_MODE_SILENT)))
Jeff Johnson295189b2012-06-20 16:38:30 -07002830 {
2831 limFrameTransmissionControl(pMac, eLIM_TX_ALL, eLIM_RESUME_TX);
Jeff Johnsone7245742012-09-05 17:12:55 -07002832 limRestorePreQuietState(pMac, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07002833 }
2834 }
Jeff Johnsone7245742012-09-05 17:12:55 -07002835 psessionEntry->gLimSpecMgmt.quietState = eLIM_QUIET_INIT;
Jeff Johnson295189b2012-06-20 16:38:30 -07002836}
2837
2838/**
2839 * limProcessQuietTimeout
2840 *
2841 * FUNCTION:
2842 * This function is active only on the STA.
2843 * Handles SIR_LIM_QUIET_TIMEOUT
2844 *
2845 * LOGIC:
2846 * This timeout can occur under only one circumstance:
2847 *
2848 * 1) When gLimQuietState = eLIM_QUIET_BEGIN
2849 * This indicates that the timeout "interval" has
2850 * expired. This is a trigger for the STA to now
2851 * shut-off Tx/Rx for the specified gLimQuietDuration
2852 * -> The TIMER object gLimQuietBssTimer is
2853 * activated
2854 * -> With timeout = gLimQuietDuration
2855 * -> gLimQuietState is set to eLIM_QUIET_RUNNING
2856 *
2857 * ASSUMPTIONS:
2858 * Using two TIMER objects -
2859 * gLimQuietTimer & gLimQuietBssTimer
2860 *
2861 * NOTE:
2862 *
2863 * @param pMac - Pointer to Global MAC structure
2864 *
2865 * @return None
2866 */
2867void limProcessQuietTimeout(tpAniSirGlobal pMac)
2868{
Jeff Johnson295189b2012-06-20 16:38:30 -07002869 //fetch the sessionEntry based on the sessionId
2870 //priority - MEDIUM
Jeff Johnsone7245742012-09-05 17:12:55 -07002871 tpPESession psessionEntry;
Jeff Johnson295189b2012-06-20 16:38:30 -07002872
Jeff Johnsone7245742012-09-05 17:12:55 -07002873 if((psessionEntry = peFindSessionBySessionId(pMac, pMac->lim.limTimers.gLimQuietTimer.sessionId))== NULL)
Jeff Johnson295189b2012-06-20 16:38:30 -07002874 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002875 limLog(pMac, LOGE,FL("Session Does not exist for given sessionID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002876 return;
2877 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002878
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002879 PELOG1(limLog(pMac, LOG1, FL("quietState = %d"), psessionEntry->gLimSpecMgmt.quietState);)
Jeff Johnsone7245742012-09-05 17:12:55 -07002880 switch( psessionEntry->gLimSpecMgmt.quietState )
Jeff Johnson295189b2012-06-20 16:38:30 -07002881 {
2882 case eLIM_QUIET_BEGIN:
2883 // Time to Stop data traffic for quietDuration
Jeff Johnsone7245742012-09-05 17:12:55 -07002884 //limDeactivateAndChangeTimer(pMac, eLIM_QUIET_BSS_TIMER);
2885 if (TX_SUCCESS !=
2886 tx_timer_deactivate(&pMac->lim.limTimers.gLimQuietBssTimer))
2887 {
2888 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002889 FL("Unable to de-activate gLimQuietBssTimer! Will attempt to activate anyway..."));
Jeff Johnsone7245742012-09-05 17:12:55 -07002890 }
2891
2892 // gLimQuietDuration appears to be in units of ticks
2893 // Use it as is
2894 if (TX_SUCCESS !=
2895 tx_timer_change( &pMac->lim.limTimers.gLimQuietBssTimer,
2896 psessionEntry->gLimSpecMgmt.quietDuration,
2897 0))
2898 {
2899 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002900 FL("Unable to change gLimQuietBssTimer! Will still attempt to activate anyway..."));
Jeff Johnsone7245742012-09-05 17:12:55 -07002901 }
Leela V Kiran Kumar Reddy Chiralac3b9d382013-01-31 20:49:53 -08002902 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, pMac->lim.limTimers.gLimQuietTimer.sessionId, eLIM_QUIET_BSS_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -07002903#ifdef GEN6_TODO
2904 /* revisit this piece of code to assign the appropriate sessionId below
2905 * priority - HIGH
2906 */
2907 pMac->lim.limTimers.gLimQuietBssTimer.sessionId = sessionId;
2908#endif
2909 if( TX_SUCCESS !=
2910 tx_timer_activate( &pMac->lim.limTimers.gLimQuietBssTimer ))
2911 {
2912 limLog( pMac, LOGW,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002913 FL("Unable to activate gLimQuietBssTimer! The STA will be unable to honor Quiet BSS..."));
Jeff Johnson295189b2012-06-20 16:38:30 -07002914 }
2915 else
2916 {
2917 // Transition to eLIM_QUIET_RUNNING
Jeff Johnsone7245742012-09-05 17:12:55 -07002918 psessionEntry->gLimSpecMgmt.quietState = eLIM_QUIET_RUNNING;
Jeff Johnson295189b2012-06-20 16:38:30 -07002919
2920 /* If we have sta bk scan triggered and trigger bk scan actually started successfully, */
2921 /* print message, otherwise, stop data traffic and stay quiet */
2922 if( pMac->lim.gLimTriggerBackgroundScanDuringQuietBss &&
2923 (eSIR_TRUE == (glimTriggerBackgroundScanDuringQuietBss_Status = limTriggerBackgroundScanDuringQuietBss( pMac ))) )
2924 {
2925 limLog( pMac, LOG2,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002926 FL("Attempting to trigger a background scan..."));
Jeff Johnson295189b2012-06-20 16:38:30 -07002927 }
2928 else
2929 {
2930 // Shut-off Tx/Rx for gLimSpecMgmt.quietDuration
2931 /* freeze the transmission */
2932 limFrameTransmissionControl(pMac, eLIM_TX_ALL, eLIM_STOP_TX);
2933
2934 limLog( pMac, LOG2,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002935 FL("Quiet BSS: STA shutting down for %d ticks"),
Jeff Johnsone7245742012-09-05 17:12:55 -07002936 psessionEntry->gLimSpecMgmt.quietDuration );
Jeff Johnson295189b2012-06-20 16:38:30 -07002937 }
2938 }
2939 break;
2940
2941 case eLIM_QUIET_RUNNING:
2942 case eLIM_QUIET_INIT:
2943 case eLIM_QUIET_END:
2944 default:
2945 //
2946 // As of now, nothing to be done
2947 //
2948 break;
2949 }
2950}
2951
2952/**
2953 * limProcessQuietBssTimeout
2954 *
2955 * FUNCTION:
2956 * This function is active on the AP and STA.
2957 * Handles SIR_LIM_QUIET_BSS_TIMEOUT
2958 *
2959 * LOGIC:
2960 * On the AP -
2961 * When the SIR_LIM_QUIET_BSS_TIMEOUT is triggered, it is
2962 * an indication for the AP to START sending out the
2963 * Quiet BSS IE.
2964 * If 802.11H is enabled, the Quiet BSS IE is sent as per
2965 * the 11H spec
2966 * If 802.11H is not enabled, the Quiet BSS IE is sent as
2967 * a Proprietary IE. This will be understood by all the
2968 * TITAN STA's
2969 * Transitioning gLimQuietState to eLIM_QUIET_BEGIN will
2970 * initiate the SCH to include the Quiet BSS IE in all
2971 * its subsequent Beacons/PR's.
2972 * The Quiet BSS IE will be included in all the Beacons
2973 * & PR's until the next DTIM period
2974 *
2975 * On the STA -
2976 * When gLimQuietState = eLIM_QUIET_RUNNING
2977 * This indicates that the STA was successfully shut-off
2978 * for the specified gLimQuietDuration. This is a trigger
2979 * for the STA to now resume data traffic.
2980 * -> gLimQuietState is set to eLIM_QUIET_INIT
2981 *
2982 * ASSUMPTIONS:
2983 *
2984 * NOTE:
2985 *
2986 * @param pMac - Pointer to Global MAC structure
2987 *
2988 * @return None
2989 */
2990void limProcessQuietBssTimeout( tpAniSirGlobal pMac )
2991{
Jeff Johnsone7245742012-09-05 17:12:55 -07002992 tpPESession psessionEntry;
Jeff Johnson295189b2012-06-20 16:38:30 -07002993
Jeff Johnsone7245742012-09-05 17:12:55 -07002994 if((psessionEntry = peFindSessionBySessionId(pMac, pMac->lim.limTimers.gLimQuietBssTimer.sessionId))== NULL)
Jeff Johnson295189b2012-06-20 16:38:30 -07002995 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002996 limLog(pMac, LOGP,FL("Session Does not exist for given sessionID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002997 return;
2998 }
2999
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003000 PELOG1(limLog(pMac, LOG1, FL("quietState = %d"), psessionEntry->gLimSpecMgmt.quietState);)
Jeff Johnsone7245742012-09-05 17:12:55 -07003001 if (eLIM_AP_ROLE == psessionEntry->limSystemRole)
Jeff Johnson295189b2012-06-20 16:38:30 -07003002 {
Jeff Johnson295189b2012-06-20 16:38:30 -07003003 }
3004 else
3005 {
3006 // eLIM_STA_ROLE
Jeff Johnsone7245742012-09-05 17:12:55 -07003007 switch( psessionEntry->gLimSpecMgmt.quietState )
Jeff Johnson295189b2012-06-20 16:38:30 -07003008 {
3009 case eLIM_QUIET_RUNNING:
3010 // Transition to eLIM_QUIET_INIT
Jeff Johnsone7245742012-09-05 17:12:55 -07003011 psessionEntry->gLimSpecMgmt.quietState = eLIM_QUIET_INIT;
Jeff Johnson295189b2012-06-20 16:38:30 -07003012
3013 if( !pMac->lim.gLimTriggerBackgroundScanDuringQuietBss || (glimTriggerBackgroundScanDuringQuietBss_Status == eSIR_FALSE) )
3014 {
3015 // Resume data traffic only if channel switch is not running in silent mode.
Jeff Johnsone7245742012-09-05 17:12:55 -07003016 if (!((psessionEntry->gLimSpecMgmt.dot11hChanSwState == eLIM_11H_CHANSW_RUNNING) &&
3017 (psessionEntry->gLimChannelSwitch.switchMode == eSIR_CHANSW_MODE_SILENT)))
Jeff Johnson295189b2012-06-20 16:38:30 -07003018 {
3019 limFrameTransmissionControl(pMac, eLIM_TX_ALL, eLIM_RESUME_TX);
Jeff Johnsone7245742012-09-05 17:12:55 -07003020 limRestorePreQuietState(pMac, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07003021 }
3022
3023 /* Reset status flag */
3024 if(glimTriggerBackgroundScanDuringQuietBss_Status == eSIR_FALSE)
3025 glimTriggerBackgroundScanDuringQuietBss_Status = eSIR_TRUE;
3026
3027 limLog( pMac, LOG2,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003028 FL("Quiet BSS: Resuming traffic..."));
Jeff Johnson295189b2012-06-20 16:38:30 -07003029 }
3030 else
3031 {
3032 //
3033 // Nothing specific to be done in this case
3034 // A background scan that was triggered during
3035 // SIR_LIM_QUIET_TIMEOUT will complete on its own
3036 //
3037 limLog( pMac, LOG2,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003038 FL("Background scan should be complete now..."));
Jeff Johnson295189b2012-06-20 16:38:30 -07003039 }
3040 break;
3041
3042 case eLIM_QUIET_INIT:
3043 case eLIM_QUIET_BEGIN:
3044 case eLIM_QUIET_END:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003045 PELOG2(limLog(pMac, LOG2, FL("Quiet state not in RUNNING"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003046 /* If the quiet period has ended, then resume the frame transmission */
3047 limFrameTransmissionControl(pMac, eLIM_TX_ALL, eLIM_RESUME_TX);
Jeff Johnsone7245742012-09-05 17:12:55 -07003048 limRestorePreQuietState(pMac, psessionEntry);
3049 psessionEntry->gLimSpecMgmt.quietState = eLIM_QUIET_INIT;
Jeff Johnson295189b2012-06-20 16:38:30 -07003050 break;
3051
3052 default:
3053 //
3054 // As of now, nothing to be done
3055 //
3056 break;
3057 }
3058 }
3059}
Jeff Johnson295189b2012-06-20 16:38:30 -07003060/**
3061 * limProcessWPSOverlapTimeout
3062 *
3063 * FUNCTION: This function call limWPSPBCTimeout() to clean WPS PBC probe request entries
3064 *
3065 * LOGIC:
3066 *
3067 * ASSUMPTIONS:
3068 *
3069 * NOTE:
3070 *
3071 * @param pMac - Pointer to Global MAC structure
3072 *
3073 * @return None
3074 */
3075#if 0
3076void limProcessWPSOverlapTimeout(tpAniSirGlobal pMac)
3077{
3078
3079 tpPESession psessionEntry;
3080 tANI_U32 sessionId;
3081
3082 if (tx_timer_activate(&pMac->lim.limTimers.gLimWPSOverlapTimerObj.gLimWPSOverlapTimer) != TX_SUCCESS)
3083 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003084 limLog(pMac, LOGP, FL("tx_timer_activate failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003085 }
3086
3087 sessionId = pMac->lim.limTimers.gLimWPSOverlapTimerObj.sessionId;
3088
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003089 PELOGE(limLog(pMac, LOGE, FL("WPS overlap timeout, sessionId=%d"), sessionId);)
Jeff Johnson295189b2012-06-20 16:38:30 -07003090
3091 if((psessionEntry = peFindSessionBySessionId(pMac, sessionId)) == NULL)
3092 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003093 PELOGE(limLog(pMac, LOGP,FL("Session Does not exist for given sessionID"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003094 return;
3095 }
3096
3097 limWPSPBCTimeout(pMac, psessionEntry);
3098}
3099#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07003100
Jeff Johnson295189b2012-06-20 16:38:30 -07003101/**----------------------------------------------
3102\fn limStartQuietTimer
3103\brief Starts the quiet timer.
3104
3105\param pMac
3106\return NONE
3107-----------------------------------------------*/
3108void limStartQuietTimer(tpAniSirGlobal pMac, tANI_U8 sessionId)
3109{
3110 tpPESession psessionEntry;
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05303111 psessionEntry = peFindSessionBySessionId(pMac, sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07003112
3113 if(psessionEntry == NULL) {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003114 limLog(pMac, LOGP,FL("Session Does not exist for given sessionID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003115 return;
3116 }
3117
Jeff Johnson295189b2012-06-20 16:38:30 -07003118
3119 if (psessionEntry->limSystemRole != eLIM_STA_ROLE)
3120 return;
3121 // First, de-activate Timer, if its already active
3122 limCancelDot11hQuiet(pMac, psessionEntry);
3123
Jeff Johnsone7245742012-09-05 17:12:55 -07003124 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, sessionId, eLIM_QUIET_TIMER));
3125 if( TX_SUCCESS != tx_timer_deactivate(&pMac->lim.limTimers.gLimQuietTimer))
3126 {
3127 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003128 FL( "Unable to deactivate gLimQuietTimer! Will still attempt to re-activate anyway..." ));
Jeff Johnsone7245742012-09-05 17:12:55 -07003129 }
3130
3131 // Set the NEW timeout value, in ticks
3132 if( TX_SUCCESS != tx_timer_change( &pMac->lim.limTimers.gLimQuietTimer,
3133 SYS_MS_TO_TICKS(psessionEntry->gLimSpecMgmt.quietTimeoutValue), 0))
3134 {
3135 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003136 FL( "Unable to change gLimQuietTimer! Will still attempt to re-activate anyway..." ));
Jeff Johnsone7245742012-09-05 17:12:55 -07003137 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003138
3139 pMac->lim.limTimers.gLimQuietTimer.sessionId = sessionId;
3140 if( TX_SUCCESS != tx_timer_activate(&pMac->lim.limTimers.gLimQuietTimer))
3141 {
3142 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003143 FL("Unable to activate gLimQuietTimer! STA cannot honor Quiet BSS!"));
Jeff Johnsone7245742012-09-05 17:12:55 -07003144 limRestorePreQuietState(pMac, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07003145
Jeff Johnsone7245742012-09-05 17:12:55 -07003146 psessionEntry->gLimSpecMgmt.quietState = eLIM_QUIET_INIT;
Jeff Johnson295189b2012-06-20 16:38:30 -07003147 return;
3148 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003149}
3150
Jeff Johnson295189b2012-06-20 16:38:30 -07003151
3152/** ------------------------------------------------------------------------ **/
3153/**
3154 * keep track of the number of ANI peers associated in the BSS
3155 * For the first and last ANI peer, we have to update EDCA params as needed
3156 *
3157 * When the first ANI peer joins the BSS, we notify SCH
3158 * When the last ANI peer leaves the BSS, we notfiy SCH
3159 */
3160void
3161limUtilCountStaAdd(
3162 tpAniSirGlobal pMac,
3163 tpDphHashNode pSta,
3164 tpPESession psessionEntry)
3165{
3166
3167 if ((! pSta) || (! pSta->valid) || (! pSta->aniPeer) || (pSta->fAniCount))
3168 return;
3169
3170 pSta->fAniCount = 1;
3171
3172 if (pMac->lim.gLimNumOfAniSTAs++ != 0)
3173 return;
3174
3175 // get here only if this is the first ANI peer in the BSS
3176 schEdcaProfileUpdate(pMac, psessionEntry);
3177}
3178
3179void
3180limUtilCountStaDel(
3181 tpAniSirGlobal pMac,
3182 tpDphHashNode pSta,
3183 tpPESession psessionEntry)
3184{
3185
3186 if ((pSta == NULL) || (pSta->aniPeer == eHAL_CLEAR) || (! pSta->fAniCount))
3187 return;
3188
3189 /* Only if sta is invalid and the validInDummyState bit is set to 1,
3190 * then go ahead and update the count and profiles. This ensures
3191 * that the "number of ani station" count is properly incremented/decremented.
3192 */
3193 if (pSta->valid == 1)
3194 return;
3195
3196 pSta->fAniCount = 0;
3197
3198 if (pMac->lim.gLimNumOfAniSTAs <= 0)
3199 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003200 limLog(pMac, LOGE, FL("CountStaDel: ignoring Delete Req when AniPeer count is %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07003201 pMac->lim.gLimNumOfAniSTAs);
3202 return;
3203 }
3204
3205 pMac->lim.gLimNumOfAniSTAs--;
3206
3207 if (pMac->lim.gLimNumOfAniSTAs != 0)
3208 return;
3209
3210 // get here only if this is the last ANI peer in the BSS
3211 schEdcaProfileUpdate(pMac, psessionEntry);
3212}
3213
Jeff Johnson295189b2012-06-20 16:38:30 -07003214/**
3215 * limSwitchChannelCback()
3216 *
3217 *FUNCTION:
3218 * This is the callback function registered while requesting to switch channel
3219 * after AP indicates a channel switch for spectrum management (11h).
3220 *
3221 *NOTE:
3222 * @param pMac Pointer to Global MAC structure
3223 * @param status Status of channel switch request
3224 * @param data User data
3225 * @param psessionEntry Session information
3226 * @return NONE
3227 */
3228void limSwitchChannelCback(tpAniSirGlobal pMac, eHalStatus status,
3229 tANI_U32 *data, tpPESession psessionEntry)
3230{
3231 tSirMsgQ mmhMsg = {0};
3232 tSirSmeSwitchChannelInd *pSirSmeSwitchChInd;
3233
Jeff Johnson295189b2012-06-20 16:38:30 -07003234 psessionEntry->currentOperChannel = psessionEntry->currentReqChannel;
3235
3236 /* We need to restore pre-channelSwitch state on the STA */
3237 if (limRestorePreChannelSwitchState(pMac, psessionEntry) != eSIR_SUCCESS)
3238 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003239 limLog(pMac, LOGP, FL("Could not restore pre-channelSwitch (11h) state, resetting the system"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003240 return;
3241 }
3242
3243 mmhMsg.type = eWNI_SME_SWITCH_CHL_REQ;
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05303244 pSirSmeSwitchChInd = vos_mem_malloc(sizeof(tSirSmeSwitchChannelInd));
3245 if ( NULL == pSirSmeSwitchChInd )
Jeff Johnson295189b2012-06-20 16:38:30 -07003246 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003247 limLog(pMac, LOGP, FL("Failed to allocate buffer for buffer descriptor"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003248 return;
3249 }
3250
3251 pSirSmeSwitchChInd->messageType = eWNI_SME_SWITCH_CHL_REQ;
3252 pSirSmeSwitchChInd->length = sizeof(tSirSmeSwitchChannelInd);
Jeff Johnsone7245742012-09-05 17:12:55 -07003253 pSirSmeSwitchChInd->newChannelId = psessionEntry->gLimChannelSwitch.primaryChannel;
Jeff Johnson295189b2012-06-20 16:38:30 -07003254 pSirSmeSwitchChInd->sessionId = psessionEntry->smeSessionId;
3255 //BSS ID
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05303256 vos_mem_copy( pSirSmeSwitchChInd->bssId, psessionEntry->bssId, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07003257 mmhMsg.bodyptr = pSirSmeSwitchChInd;
3258 mmhMsg.bodyval = 0;
3259
Jeff Johnsone7245742012-09-05 17:12:55 -07003260 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07003261
Jeff Johnson295189b2012-06-20 16:38:30 -07003262 SysProcessMmhMsg(pMac, &mmhMsg);
Jeff Johnson295189b2012-06-20 16:38:30 -07003263}
3264
3265/**
3266 * limSwitchPrimaryChannel()
3267 *
3268 *FUNCTION:
3269 * This function changes the current operating channel
3270 * and sets the new new channel ID in WNI_CFG_CURRENT_CHANNEL.
3271 *
3272 *NOTE:
3273 * @param pMac Pointer to Global MAC structure
3274 * @param newChannel new chnannel ID
3275 * @return NONE
3276 */
3277void limSwitchPrimaryChannel(tpAniSirGlobal pMac, tANI_U8 newChannel,tpPESession psessionEntry)
3278{
3279#if !defined WLAN_FEATURE_VOWIFI
3280 tANI_U32 localPwrConstraint;
3281#endif
3282
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003283 PELOG3(limLog(pMac, LOG3, FL("limSwitchPrimaryChannel: old chnl %d --> new chnl %d "),
Jeff Johnson295189b2012-06-20 16:38:30 -07003284 psessionEntry->currentOperChannel, newChannel);)
3285 psessionEntry->currentReqChannel = newChannel;
3286 psessionEntry->limRFBand = limGetRFBand(newChannel);
3287
3288 psessionEntry->channelChangeReasonCode=LIM_SWITCH_CHANNEL_OPERATION;
3289
3290 pMac->lim.gpchangeChannelCallback = limSwitchChannelCback;
3291 pMac->lim.gpchangeChannelData = NULL;
3292
3293#if defined WLAN_FEATURE_VOWIFI
Jeff Johnsone7245742012-09-05 17:12:55 -07003294 limSendSwitchChnlParams(pMac, newChannel, PHY_SINGLE_CHANNEL_CENTERED,
Jeff Johnson295189b2012-06-20 16:38:30 -07003295 psessionEntry->maxTxPower, psessionEntry->peSessionId);
3296#else
3297 if(wlan_cfgGetInt(pMac, WNI_CFG_LOCAL_POWER_CONSTRAINT, &localPwrConstraint) != eSIR_SUCCESS)
3298 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003299 limLog( pMac, LOGP, FL( "Unable to read Local Power Constraint from cfg" ));
Jeff Johnson295189b2012-06-20 16:38:30 -07003300 return;
3301 }
Jeff Johnsone7245742012-09-05 17:12:55 -07003302 limSendSwitchChnlParams(pMac, newChannel, PHY_SINGLE_CHANNEL_CENTERED,
Jeff Johnson295189b2012-06-20 16:38:30 -07003303 (tPowerdBm)localPwrConstraint, psessionEntry->peSessionId);
3304#endif
3305 return;
3306}
3307
3308/**
3309 * limSwitchPrimarySecondaryChannel()
3310 *
3311 *FUNCTION:
3312 * This function changes the primary and secondary channel.
3313 * If 11h is enabled and user provides a "new channel ID"
3314 * that is different from the current operating channel,
3315 * then we must set this new channel in WNI_CFG_CURRENT_CHANNEL,
3316 * assign notify LIM of such change.
3317 *
3318 *NOTE:
3319 * @param pMac Pointer to Global MAC structure
3320 * @param newChannel New chnannel ID (or current channel ID)
3321 * @param subband CB secondary info:
3322 * - eANI_CB_SECONDARY_NONE
3323 * - eANI_CB_SECONDARY_UP
3324 * - eANI_CB_SECONDARY_DOWN
3325 * @return NONE
3326 */
Jeff Johnsone7245742012-09-05 17:12:55 -07003327void limSwitchPrimarySecondaryChannel(tpAniSirGlobal pMac, tpPESession psessionEntry, tANI_U8 newChannel, ePhyChanBondState subband)
Jeff Johnson295189b2012-06-20 16:38:30 -07003328{
3329#if !defined WLAN_FEATURE_VOWIFI
3330 tANI_U32 localPwrConstraint;
3331#endif
3332
Jeff Johnson295189b2012-06-20 16:38:30 -07003333#if !defined WLAN_FEATURE_VOWIFI
3334 if(wlan_cfgGetInt(pMac, WNI_CFG_LOCAL_POWER_CONSTRAINT, &localPwrConstraint) != eSIR_SUCCESS) {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003335 limLog( pMac, LOGP, FL( "Unable to get Local Power Constraint from cfg" ));
Jeff Johnson295189b2012-06-20 16:38:30 -07003336 return;
3337 }
3338#endif
3339
Jeff Johnson295189b2012-06-20 16:38:30 -07003340#if defined WLAN_FEATURE_VOWIFI
Jeff Johnsone7245742012-09-05 17:12:55 -07003341 limSendSwitchChnlParams(pMac, newChannel, subband, psessionEntry->maxTxPower, psessionEntry->peSessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07003342#else
Jeff Johnsone7245742012-09-05 17:12:55 -07003343 limSendSwitchChnlParams(pMac, newChannel, subband, (tPowerdBm)localPwrConstraint, psessionEntry->peSessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07003344#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07003345
Jeff Johnsone7245742012-09-05 17:12:55 -07003346 // Store the new primary and secondary channel in session entries if different
3347 if (psessionEntry->currentOperChannel != newChannel)
Jeff Johnson295189b2012-06-20 16:38:30 -07003348 {
3349 limLog(pMac, LOGW,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003350 FL("switch old chnl %d --> new chnl %d "),
Jeff Johnson295189b2012-06-20 16:38:30 -07003351 psessionEntry->currentOperChannel, newChannel);
Jeff Johnson295189b2012-06-20 16:38:30 -07003352 psessionEntry->currentOperChannel = newChannel;
3353 }
Jeff Johnsone7245742012-09-05 17:12:55 -07003354 if (psessionEntry->htSecondaryChannelOffset != subband)
3355 {
3356 limLog(pMac, LOGW,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003357 FL("switch old sec chnl %d --> new sec chnl %d "),
Jeff Johnsone7245742012-09-05 17:12:55 -07003358 psessionEntry->htSecondaryChannelOffset, subband);
3359 psessionEntry->htSecondaryChannelOffset = subband;
3360 if (psessionEntry->htSecondaryChannelOffset == PHY_SINGLE_CHANNEL_CENTERED)
3361 {
3362 psessionEntry->htSupportedChannelWidthSet = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE;
3363 }
3364 else
3365 {
3366 psessionEntry->htSupportedChannelWidthSet = WNI_CFG_CHANNEL_BONDING_MODE_ENABLE;
3367 }
3368 psessionEntry->htRecommendedTxWidthSet = psessionEntry->htSupportedChannelWidthSet;
3369 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003370
3371 return;
3372}
3373
3374
3375/**
3376 * limActiveScanAllowed()
3377 *
3378 *FUNCTION:
3379 * Checks if active scans are permitted on the given channel
3380 *
3381 *LOGIC:
3382 * The config variable SCAN_CONTROL_LIST contains pairs of (channelNum, activeScanAllowed)
3383 * Need to check if the channelNum matches, then depending on the corresponding
3384 * scan flag, return true (for activeScanAllowed==1) or false (otherwise).
3385 *
3386 *ASSUMPTIONS:
3387 *
3388 *NOTE:
3389 *
3390 * @param pMac Pointer to Global MAC structure
3391 * @param channelNum channel number
3392 * @return None
3393 */
3394
3395tANI_U8 limActiveScanAllowed(
3396 tpAniSirGlobal pMac,
3397 tANI_U8 channelNum)
3398{
3399 tANI_U32 i;
3400 tANI_U8 channelPair[WNI_CFG_SCAN_CONTROL_LIST_LEN];
3401 tANI_U32 len = WNI_CFG_SCAN_CONTROL_LIST_LEN;
3402 if (wlan_cfgGetStr(pMac, WNI_CFG_SCAN_CONTROL_LIST, channelPair, &len)
3403 != eSIR_SUCCESS)
3404 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003405 PELOGE(limLog(pMac, LOGE, FL("Unable to get scan control list"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003406 return false;
3407 }
3408
3409 if (len > WNI_CFG_SCAN_CONTROL_LIST_LEN)
3410 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003411 limLog(pMac, LOGE, FL("Invalid scan control list length:%d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07003412 len);
3413 return false;
3414 }
3415
3416 for (i=0; (i+1) < len; i+=2)
3417 {
3418 if (channelPair[i] == channelNum)
3419 return ((channelPair[i+1] == eSIR_ACTIVE_SCAN) ? true : false);
3420 }
3421 return false;
3422}
3423
3424/**
3425 * limTriggerBackgroundScanDuringQuietBss()
3426 *
3427 *FUNCTION:
3428 * This function is applicable to the STA only.
3429 * This function is called by limProcessQuietTimeout(),
3430 * when it is time to honor the Quiet BSS IE from the AP.
3431 *
3432 *LOGIC:
3433 * If 11H is enabled:
3434 * We cannot trigger a background scan. The STA needs to
3435 * shut-off Tx/Rx.
3436 * If 11 is not enabled:
3437 * Determine if the next channel that we are going to
3438 * scan is NOT the same channel (or not) on which the
3439 * Quiet BSS was requested.
3440 * If yes, then we cannot trigger a background scan on
3441 * this channel. Return with a false.
3442 * If no, then trigger a background scan. Return with
3443 * a true.
3444 *
3445 *ASSUMPTIONS:
3446 *
3447 *NOTE:
3448 * This API is redundant if the existing API,
3449 * limTriggerBackgroundScan(), were to return a valid
3450 * response instead of returning void.
3451 * If possible, try to revisit this API
3452 *
3453 * @param pMac Pointer to Global MAC structure
3454 * @return eSIR_TRUE, if a background scan was attempted
3455 * eSIR_FALSE, if not
3456 */
3457tAniBool limTriggerBackgroundScanDuringQuietBss( tpAniSirGlobal pMac )
3458{
3459 tAniBool bScanTriggered = eSIR_FALSE;
Jeff Johnson295189b2012-06-20 16:38:30 -07003460
3461
3462
3463 //TBD-RAJESH HOW TO GET sessionEntry?????
3464 tpPESession psessionEntry = &pMac->lim.gpSession[0];
3465
3466 if (psessionEntry->limSystemRole != eLIM_STA_ROLE)
3467 return bScanTriggered;
3468
Jeff Johnsone7245742012-09-05 17:12:55 -07003469 if( !psessionEntry->lim11hEnable )
Jeff Johnson295189b2012-06-20 16:38:30 -07003470 {
3471 tSirMacChanNum bgScanChannelList[WNI_CFG_BG_SCAN_CHANNEL_LIST_LEN];
3472 tANI_U32 len = WNI_CFG_BG_SCAN_CHANNEL_LIST_LEN;
3473
3474 // Determine the next scan channel
3475
3476 // Get background scan channel list from CFG
3477 if( eSIR_SUCCESS == wlan_cfgGetStr( pMac,
3478 WNI_CFG_BG_SCAN_CHANNEL_LIST,
3479 (tANI_U8 *) bgScanChannelList,
3480 (tANI_U32 *) &len ))
3481 {
3482 // Ensure that we do not go off scanning on the same
3483 // channel on which the Quiet BSS was requested
3484 if( psessionEntry->currentOperChannel!=
3485 bgScanChannelList[pMac->lim.gLimBackgroundScanChannelId] )
3486 {
3487 // For now, try and attempt a background scan. It will
3488 // be ideal if this API actually returns a success or
3489 // failure instead of having a void return type
3490 limTriggerBackgroundScan( pMac );
3491
3492 bScanTriggered = eSIR_TRUE;
3493 }
3494 else
3495 {
3496 limLog( pMac, LOGW,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003497 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 -07003498 }
3499 }
3500 else
3501 {
3502 limLog( pMac, LOGW,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003503 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 -07003504 }
3505 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003506 return bScanTriggered;
3507}
3508
3509
3510/**
3511 * limGetHTCapability()
3512 *
3513 *FUNCTION:
3514 * A utility function that returns the "current HT capability state" for the HT
3515 * capability of interest (as requested in the API)
3516 *
3517 *LOGIC:
3518 * This routine will return with the "current" setting of a requested HT
3519 * capability. This state info could be retrieved from -
3520 * a) CFG (for static entries)
3521 * b) Run time info
3522 * - Dynamic state maintained by LIM
3523 * - Configured at radio init time by SME
3524 *
3525 *
3526 *ASSUMPTIONS:
3527 * NA
3528 *
3529 *NOTE:
3530 *
3531 * @param pMac Pointer to Global MAC structure
3532 * @param htCap The HT capability being queried
3533 * @return tANI_U8 The current state of the requested HT capability is returned in a
3534 * tANI_U8 variable
3535 */
3536
Jeff Johnson295189b2012-06-20 16:38:30 -07003537tANI_U8 limGetHTCapability( tpAniSirGlobal pMac,
3538 tANI_U32 htCap, tpPESession psessionEntry)
Jeff Johnson295189b2012-06-20 16:38:30 -07003539{
3540tANI_U8 retVal = 0;
3541tANI_U8 *ptr;
3542tANI_U32 cfgValue;
3543tSirMacHTCapabilityInfo macHTCapabilityInfo = {0};
3544tSirMacExtendedHTCapabilityInfo macExtHTCapabilityInfo = {0};
3545tSirMacTxBFCapabilityInfo macTxBFCapabilityInfo = {0};
3546tSirMacASCapabilityInfo macASCapabilityInfo = {0};
3547
3548 //
3549 // Determine which CFG to read from. Not ALL of the HT
3550 // related CFG's need to be read each time this API is
3551 // accessed
3552 //
3553 if( htCap >= eHT_ANTENNA_SELECTION &&
3554 htCap < eHT_SI_GRANULARITY )
3555 {
3556 // Get Antenna Seletion HT Capabilities
3557 if( eSIR_SUCCESS != wlan_cfgGetInt( pMac, WNI_CFG_AS_CAP, &cfgValue ))
3558 cfgValue = 0;
3559 ptr = (tANI_U8 *) &macASCapabilityInfo;
3560 *((tANI_U8 *)ptr) = (tANI_U8) (cfgValue & 0xff);
3561 }
3562 else
3563 {
3564 if( htCap >= eHT_TX_BEAMFORMING &&
3565 htCap < eHT_ANTENNA_SELECTION )
3566 {
3567 // Get Transmit Beam Forming HT Capabilities
3568 if( eSIR_SUCCESS != wlan_cfgGetInt( pMac, WNI_CFG_TX_BF_CAP, &cfgValue ))
3569 cfgValue = 0;
3570 ptr = (tANI_U8 *) &macTxBFCapabilityInfo;
3571 *((tANI_U32 *)ptr) = (tANI_U32) (cfgValue);
3572 }
3573 else
3574 {
3575 if( htCap >= eHT_PCO &&
3576 htCap < eHT_TX_BEAMFORMING )
3577 {
3578 // Get Extended HT Capabilities
3579 if( eSIR_SUCCESS != wlan_cfgGetInt( pMac, WNI_CFG_EXT_HT_CAP_INFO, &cfgValue ))
3580 cfgValue = 0;
3581 ptr = (tANI_U8 *) &macExtHTCapabilityInfo;
3582 *((tANI_U16 *)ptr) = (tANI_U16) (cfgValue & 0xffff);
3583 }
3584 else
3585 {
3586 if( htCap < eHT_MAX_RX_AMPDU_FACTOR )
3587 {
3588 // Get HT Capabilities
3589 if( eSIR_SUCCESS != wlan_cfgGetInt( pMac, WNI_CFG_HT_CAP_INFO, &cfgValue ))
3590 cfgValue = 0;
3591 ptr = (tANI_U8 *) &macHTCapabilityInfo;
3592 // 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
3593 *ptr++ = cfgValue & 0xff;
3594 *ptr = (cfgValue >> 8) & 0xff;
3595 }
3596 }
3597 }
3598 }
3599
3600 switch( htCap )
3601 {
3602 case eHT_LSIG_TXOP_PROTECTION:
3603 retVal = pMac->lim.gHTLsigTXOPProtection;
3604 break;
3605
3606 case eHT_STBC_CONTROL_FRAME:
3607 retVal = (tANI_U8) macHTCapabilityInfo.stbcControlFrame;
3608 break;
3609
3610 case eHT_PSMP:
3611 retVal = pMac->lim.gHTPSMPSupport;
3612 break;
3613
3614 case eHT_DSSS_CCK_MODE_40MHZ:
3615 retVal = pMac->lim.gHTDsssCckRate40MHzSupport;
3616 break;
3617
3618 case eHT_MAX_AMSDU_LENGTH:
3619 retVal = (tANI_U8) macHTCapabilityInfo.maximalAMSDUsize;
3620 break;
3621
3622 case eHT_DELAYED_BA:
3623 retVal = (tANI_U8) macHTCapabilityInfo.delayedBA;
3624 break;
3625
3626 case eHT_RX_STBC:
3627 retVal = (tANI_U8) macHTCapabilityInfo.rxSTBC;
3628 break;
3629
3630 case eHT_TX_STBC:
3631 retVal = (tANI_U8) macHTCapabilityInfo.txSTBC;
3632 break;
3633
3634 case eHT_SHORT_GI_40MHZ:
3635 retVal = (tANI_U8) macHTCapabilityInfo.shortGI40MHz;
3636 break;
3637
3638 case eHT_SHORT_GI_20MHZ:
3639 retVal = (tANI_U8) macHTCapabilityInfo.shortGI20MHz;
3640 break;
3641
3642 case eHT_GREENFIELD:
3643 retVal = (tANI_U8) macHTCapabilityInfo.greenField;
3644 break;
3645
3646 case eHT_MIMO_POWER_SAVE:
3647 retVal = (tANI_U8) pMac->lim.gHTMIMOPSState;
3648 break;
3649
3650 case eHT_SUPPORTED_CHANNEL_WIDTH_SET:
Jeff Johnsone7245742012-09-05 17:12:55 -07003651 retVal = (tANI_U8) psessionEntry->htSupportedChannelWidthSet;
Jeff Johnson295189b2012-06-20 16:38:30 -07003652 break;
3653
3654 case eHT_ADVANCED_CODING:
3655 retVal = (tANI_U8) macHTCapabilityInfo.advCodingCap;
3656 break;
3657
3658 case eHT_MAX_RX_AMPDU_FACTOR:
3659 retVal = pMac->lim.gHTMaxRxAMpduFactor;
3660 break;
3661
3662 case eHT_MPDU_DENSITY:
3663 retVal = pMac->lim.gHTAMpduDensity;
3664 break;
3665
3666 case eHT_PCO:
3667 retVal = (tANI_U8) macExtHTCapabilityInfo.pco;
3668 break;
3669
3670 case eHT_TRANSITION_TIME:
3671 retVal = (tANI_U8) macExtHTCapabilityInfo.transitionTime;
3672 break;
3673
3674 case eHT_MCS_FEEDBACK:
3675 retVal = (tANI_U8) macExtHTCapabilityInfo.mcsFeedback;
3676 break;
3677
3678 case eHT_TX_BEAMFORMING:
3679 retVal = (tANI_U8) macTxBFCapabilityInfo.txBF;
3680 break;
3681
3682 case eHT_ANTENNA_SELECTION:
3683 retVal = (tANI_U8) macASCapabilityInfo.antennaSelection;
3684 break;
3685
3686 case eHT_SI_GRANULARITY:
3687 retVal = pMac->lim.gHTServiceIntervalGranularity;
3688 break;
3689
3690 case eHT_CONTROLLED_ACCESS:
3691 retVal = pMac->lim.gHTControlledAccessOnly;
3692 break;
3693
3694 case eHT_RIFS_MODE:
3695 retVal = psessionEntry->beaconParams.fRIFSMode;
3696 break;
3697
3698 case eHT_RECOMMENDED_TX_WIDTH_SET:
Jeff Johnsone7245742012-09-05 17:12:55 -07003699 retVal = psessionEntry->htRecommendedTxWidthSet;
Jeff Johnson295189b2012-06-20 16:38:30 -07003700 break;
3701
3702 case eHT_EXTENSION_CHANNEL_OFFSET:
Jeff Johnsone7245742012-09-05 17:12:55 -07003703 retVal = psessionEntry->htSecondaryChannelOffset;
Jeff Johnson295189b2012-06-20 16:38:30 -07003704 break;
3705
3706 case eHT_OP_MODE:
Jeff Johnson295189b2012-06-20 16:38:30 -07003707 if(psessionEntry->limSystemRole == eLIM_AP_ROLE )
3708 retVal = psessionEntry->htOperMode;
3709 else
Jeff Johnson295189b2012-06-20 16:38:30 -07003710 retVal = pMac->lim.gHTOperMode;
3711 break;
3712
3713 case eHT_BASIC_STBC_MCS:
3714 retVal = pMac->lim.gHTSTBCBasicMCS;
3715 break;
3716
3717 case eHT_DUAL_CTS_PROTECTION:
3718 retVal = pMac->lim.gHTDualCTSProtection;
3719 break;
3720
3721 case eHT_LSIG_TXOP_PROTECTION_FULL_SUPPORT:
3722 retVal = psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport;
3723 break;
3724
3725 case eHT_PCO_ACTIVE:
3726 retVal = pMac->lim.gHTPCOActive;
3727 break;
3728
3729 case eHT_PCO_PHASE:
3730 retVal = pMac->lim.gHTPCOPhase;
3731 break;
3732
3733 default:
3734 break;
3735 }
3736
3737 return retVal;
3738}
3739
Jeff Johnson295189b2012-06-20 16:38:30 -07003740void limGetMyMacAddr(tpAniSirGlobal pMac, tANI_U8 *mac)
3741{
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05303742 vos_mem_copy( mac, pMac->lim.gLimMyMacAddr, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07003743 return;
3744}
3745
3746
3747
3748
3749/** -------------------------------------------------------------
3750\fn limEnable11aProtection
3751\brief based on config setting enables\disables 11a protection.
3752\param tANI_U8 enable : 1=> enable protection, 0=> disable protection.
3753\param tANI_U8 overlap: 1=> called from overlap context, 0 => called from assoc context.
3754\param tpUpdateBeaconParams pBeaconParams
3755\return None
3756 -------------------------------------------------------------*/
3757tSirRetStatus
3758limEnable11aProtection(tpAniSirGlobal pMac, tANI_U8 enable,
3759 tANI_U8 overlap, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry)
3760{
Madan Mohan Koyyalamudi33ef6a22012-10-30 17:44:43 -07003761 if(NULL == psessionEntry)
3762 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003763 PELOG3(limLog(pMac, LOG3, FL("psessionEntry is NULL"));)
Madan Mohan Koyyalamudi33ef6a22012-10-30 17:44:43 -07003764 return eSIR_FAILURE;
3765 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003766 //overlapping protection configuration check.
3767 if(overlap)
3768 {
Jeff Johnson295189b2012-06-20 16:38:30 -07003769 }
3770 else
3771 {
3772 //normal protection config check
Madan Mohan Koyyalamudi33ef6a22012-10-30 17:44:43 -07003773 if ((psessionEntry->limSystemRole == eLIM_AP_ROLE) &&
Jeff Johnsone7245742012-09-05 17:12:55 -07003774 (!psessionEntry->cfgProtection.fromlla))
Jeff Johnson295189b2012-06-20 16:38:30 -07003775 {
3776 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003777 PELOG3(limLog(pMac, LOG3, FL("protection from 11a is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003778 return eSIR_SUCCESS;
3779 }
3780 }
3781
3782 if (enable)
3783 {
3784 //If we are AP and HT capable, we need to set the HT OP mode
3785 //appropriately.
3786 if(((eLIM_AP_ROLE == psessionEntry->limSystemRole)||(eLIM_BT_AMP_AP_ROLE == psessionEntry->limSystemRole))&&
Jeff Johnsone7245742012-09-05 17:12:55 -07003787 (true == psessionEntry->htCapability))
Jeff Johnson295189b2012-06-20 16:38:30 -07003788 {
3789 if(overlap)
3790 {
3791 pMac->lim.gLimOverlap11aParams.protectionEnabled = true;
3792 if((eSIR_HT_OP_MODE_OVERLAP_LEGACY != pMac->lim.gHTOperMode) &&
3793 (eSIR_HT_OP_MODE_MIXED != pMac->lim.gHTOperMode))
3794 {
3795 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
3796 psessionEntry->htOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
3797 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
3798 limEnableHtOBSSProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
3799 }
3800 }
3801 else
3802 {
3803 psessionEntry->gLim11aParams.protectionEnabled = true;
3804 if(eSIR_HT_OP_MODE_MIXED != pMac->lim.gHTOperMode)
3805 {
3806 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_MIXED;
Jeff Johnsone7245742012-09-05 17:12:55 -07003807 psessionEntry->htOperMode = eSIR_HT_OP_MODE_MIXED;
Jeff Johnson295189b2012-06-20 16:38:30 -07003808 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
3809 limEnableHtOBSSProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
3810
3811 }
3812 }
3813 }
3814
3815 //This part is common for staiton as well.
3816 if(false == psessionEntry->beaconParams.llaCoexist)
3817 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003818 PELOG1(limLog(pMac, LOG1, FL(" => protection from 11A Enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003819 pBeaconParams->llaCoexist = psessionEntry->beaconParams.llaCoexist = true;
3820 pBeaconParams->paramChangeBitmap |= PARAM_llACOEXIST_CHANGED;
3821 }
3822 }
3823 else if (true == psessionEntry->beaconParams.llaCoexist)
3824 {
3825 //for AP role.
3826 //we need to take care of HT OP mode change if needed.
3827 //We need to take care of Overlap cases.
3828 if(eLIM_AP_ROLE == psessionEntry->limSystemRole)
3829 {
3830 if(overlap)
3831 {
3832 //Overlap Legacy protection disabled.
3833 pMac->lim.gLimOverlap11aParams.protectionEnabled = false;
3834
3835 //We need to take care of HT OP mode iff we are HT AP.
Jeff Johnsone7245742012-09-05 17:12:55 -07003836 if(psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07003837 {
3838 // no HT op mode change if any of the overlap protection enabled.
3839 if(!(pMac->lim.gLimOverlap11aParams.protectionEnabled ||
3840 pMac->lim.gLimOverlapHt20Params.protectionEnabled ||
3841 pMac->lim.gLimOverlapNonGfParams.protectionEnabled))
3842
3843 {
3844 //Check if there is a need to change HT OP mode.
3845 if(eSIR_HT_OP_MODE_OVERLAP_LEGACY == pMac->lim.gHTOperMode)
3846 {
3847 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
3848 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
3849
3850 if(psessionEntry->gLimHt20Params.protectionEnabled)
3851 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
3852 else
3853 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_PURE;
3854 }
3855 }
3856 }
3857 }
3858 else
3859 {
3860 //Disable protection from 11A stations.
3861 psessionEntry->gLim11aParams.protectionEnabled = false;
3862 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
3863
3864 //Check if any other non-HT protection enabled.
3865 //Right now we are in HT OP Mixed mode.
3866 //Change HT op mode appropriately.
3867
3868 //Change HT OP mode to 01 if any overlap protection enabled
3869 if(pMac->lim.gLimOverlap11aParams.protectionEnabled ||
3870 pMac->lim.gLimOverlapHt20Params.protectionEnabled ||
3871 pMac->lim.gLimOverlapNonGfParams.protectionEnabled)
3872
3873 {
3874 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
Jeff Johnsone7245742012-09-05 17:12:55 -07003875 psessionEntry->htOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
Jeff Johnson295189b2012-06-20 16:38:30 -07003876 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
3877 }
3878 else if(psessionEntry->gLimHt20Params.protectionEnabled)
3879 {
3880 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
Jeff Johnsone7245742012-09-05 17:12:55 -07003881 psessionEntry->htOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
Jeff Johnson295189b2012-06-20 16:38:30 -07003882 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
3883 }
3884 else
3885 {
3886 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_PURE;
Jeff Johnsone7245742012-09-05 17:12:55 -07003887 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
Jeff Johnson295189b2012-06-20 16:38:30 -07003888 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
3889 }
3890 }
3891 if(!pMac->lim.gLimOverlap11aParams.protectionEnabled &&
3892 !psessionEntry->gLim11aParams.protectionEnabled)
3893 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003894 PELOG1(limLog(pMac, LOG1, FL("===> Protection from 11A Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003895 pBeaconParams->llaCoexist = psessionEntry->beaconParams.llaCoexist = false;
3896 pBeaconParams->paramChangeBitmap |= PARAM_llACOEXIST_CHANGED;
3897 }
3898 }
3899 //for station role
3900 else
3901 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003902 PELOG1(limLog(pMac, LOG1, FL("===> Protection from 11A Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003903 pBeaconParams->llaCoexist = psessionEntry->beaconParams.llaCoexist = false;
3904 pBeaconParams->paramChangeBitmap |= PARAM_llACOEXIST_CHANGED;
3905 }
3906 }
3907
3908 return eSIR_SUCCESS;
3909}
3910
3911/** -------------------------------------------------------------
3912\fn limEnable11gProtection
3913\brief based on config setting enables\disables 11g protection.
3914\param tANI_U8 enable : 1=> enable protection, 0=> disable protection.
3915\param tANI_U8 overlap: 1=> called from overlap context, 0 => called from assoc context.
3916\param tpUpdateBeaconParams pBeaconParams
3917\return None
3918 -------------------------------------------------------------*/
3919
3920tSirRetStatus
3921limEnable11gProtection(tpAniSirGlobal pMac, tANI_U8 enable,
3922 tANI_U8 overlap, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry)
3923{
3924
3925 //overlapping protection configuration check.
3926 if(overlap)
3927 {
Jeff Johnson295189b2012-06-20 16:38:30 -07003928 }
3929 else
3930 {
3931 //normal protection config check
Jeff Johnson295189b2012-06-20 16:38:30 -07003932 if((psessionEntry->limSystemRole == eLIM_AP_ROLE ) &&
3933 !psessionEntry->cfgProtection.fromllb)
3934 {
3935 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003936 PELOG1(limLog(pMac, LOG1, FL("protection from 11b is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003937 return eSIR_SUCCESS;
3938 }else if(psessionEntry->limSystemRole != eLIM_AP_ROLE)
Jeff Johnson295189b2012-06-20 16:38:30 -07003939 {
3940 if(!pMac->lim.cfgProtection.fromllb)
3941 {
3942 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003943 PELOG1(limLog(pMac, LOG1, FL("protection from 11b is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003944 return eSIR_SUCCESS;
3945 }
3946 }
3947 }
3948
3949 if (enable)
3950 {
3951 //If we are AP and HT capable, we need to set the HT OP mode
3952 //appropriately.
Jeff Johnson295189b2012-06-20 16:38:30 -07003953 if(eLIM_AP_ROLE == psessionEntry->limSystemRole)
3954 {
3955 if(overlap)
3956 {
3957 psessionEntry->gLimOlbcParams.protectionEnabled = true;
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003958 PELOGE(limLog(pMac, LOGE, FL("protection from olbc is enabled"));)
Jeff Johnsone7245742012-09-05 17:12:55 -07003959 if(true == psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07003960 {
3961 if((eSIR_HT_OP_MODE_OVERLAP_LEGACY != psessionEntry->htOperMode) &&
3962 (eSIR_HT_OP_MODE_MIXED != psessionEntry->htOperMode))
3963 {
3964 psessionEntry->htOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
3965 }
3966 //CR-263021: OBSS bit is not switching back to 0 after disabling the overlapping legacy BSS
3967 // This fixes issue of OBSS bit not set after 11b, 11g station leaves
3968 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
3969 //Not processing OBSS bit from other APs, as we are already taking care
3970 //of Protection from overlapping BSS based on erp IE or useProtection bit
3971 limEnableHtOBSSProtection(pMac, true, overlap, pBeaconParams, psessionEntry);
3972 }
3973 }
3974 else
3975 {
3976 psessionEntry->gLim11bParams.protectionEnabled = true;
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003977 PELOGE(limLog(pMac, LOGE, FL("protection from 11b is enabled"));)
Jeff Johnsone7245742012-09-05 17:12:55 -07003978 if(true == psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07003979 {
3980 if(eSIR_HT_OP_MODE_MIXED != psessionEntry->htOperMode)
3981 {
3982 psessionEntry->htOperMode = eSIR_HT_OP_MODE_MIXED;
3983 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
3984 limEnableHtOBSSProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
3985 }
3986 }
3987 }
3988 }else if ((eLIM_BT_AMP_AP_ROLE == psessionEntry->limSystemRole) &&
Jeff Johnsone7245742012-09-05 17:12:55 -07003989 (true == psessionEntry->htCapability))
Jeff Johnson295189b2012-06-20 16:38:30 -07003990 {
3991 if(overlap)
3992 {
3993 psessionEntry->gLimOlbcParams.protectionEnabled = true;
3994 if((eSIR_HT_OP_MODE_OVERLAP_LEGACY != pMac->lim.gHTOperMode) &&
3995 (eSIR_HT_OP_MODE_MIXED != pMac->lim.gHTOperMode))
3996 {
3997 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
3998 }
3999 //CR-263021: OBSS bit is not switching back to 0 after disabling the overlapping legacy BSS
4000 // This fixes issue of OBSS bit not set after 11b, 11g station leaves
4001 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4002 //Not processing OBSS bit from other APs, as we are already taking care
4003 //of Protection from overlapping BSS based on erp IE or useProtection bit
4004 limEnableHtOBSSProtection(pMac, true, overlap, pBeaconParams, psessionEntry);
4005 }
4006 else
4007 {
4008 psessionEntry->gLim11bParams.protectionEnabled = true;
4009 if(eSIR_HT_OP_MODE_MIXED != pMac->lim.gHTOperMode)
4010 {
4011 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_MIXED;
4012 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4013 limEnableHtOBSSProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4014 }
4015 }
4016 }
4017
4018 //This part is common for staiton as well.
4019 if(false == psessionEntry->beaconParams.llbCoexist)
4020 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004021 PELOG1(limLog(pMac, LOG1, FL("=> 11G Protection Enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004022 pBeaconParams->llbCoexist = psessionEntry->beaconParams.llbCoexist = true;
4023 pBeaconParams->paramChangeBitmap |= PARAM_llBCOEXIST_CHANGED;
4024 }
4025 }
4026 else if (true == psessionEntry->beaconParams.llbCoexist)
4027 {
4028 //for AP role.
4029 //we need to take care of HT OP mode change if needed.
4030 //We need to take care of Overlap cases.
Jeff Johnson295189b2012-06-20 16:38:30 -07004031 if(eLIM_AP_ROLE == psessionEntry->limSystemRole)
4032 {
4033 if(overlap)
4034 {
4035 //Overlap Legacy protection disabled.
4036 psessionEntry->gLimOlbcParams.protectionEnabled = false;
4037
4038 //We need to take care of HT OP mode if we are HT AP.
Jeff Johnsone7245742012-09-05 17:12:55 -07004039 if(psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07004040 {
4041 // no HT op mode change if any of the overlap protection enabled.
4042 if(!(psessionEntry->gLimOverlap11gParams.protectionEnabled ||
4043 psessionEntry->gLimOverlapHt20Params.protectionEnabled ||
4044 psessionEntry->gLimOverlapNonGfParams.protectionEnabled))
4045 {
4046 //Check if there is a need to change HT OP mode.
Jeff Johnson04dd8a82012-06-29 20:41:40 -07004047 if(eSIR_HT_OP_MODE_OVERLAP_LEGACY == psessionEntry->htOperMode)
Jeff Johnson295189b2012-06-20 16:38:30 -07004048 {
4049 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4050 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4051 if(psessionEntry->gLimHt20Params.protectionEnabled){
4052 //Commenting out beacuse of CR 258588 WFA cert
4053 //psessionEntry->htOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4054 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
4055 }
4056 else
4057 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
4058 }
4059 }
4060 }
4061 }
4062 else
4063 {
4064 //Disable protection from 11B stations.
4065 psessionEntry->gLim11bParams.protectionEnabled = false;
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004066 PELOGE(limLog(pMac, LOGE, FL("===> 11B Protection Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004067 //Check if any other non-HT protection enabled.
4068 if(!psessionEntry->gLim11gParams.protectionEnabled)
4069 {
4070 //Right now we are in HT OP Mixed mode.
4071 //Change HT op mode appropriately.
4072 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4073
4074 //Change HT OP mode to 01 if any overlap protection enabled
4075 if(psessionEntry->gLimOlbcParams.protectionEnabled ||
4076 psessionEntry->gLimOverlap11gParams.protectionEnabled ||
4077 psessionEntry->gLimOverlapHt20Params.protectionEnabled ||
4078 psessionEntry->gLimOverlapNonGfParams.protectionEnabled)
4079 {
4080 psessionEntry->htOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004081 PELOGE(limLog(pMac, LOGE, FL("===> 11G Protection Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004082 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4083 }
4084 else if(psessionEntry->gLimHt20Params.protectionEnabled)
4085 {
4086 //Commenting because of CR 258588 WFA cert
4087 //psessionEntry->htOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4088 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004089 PELOGE(limLog(pMac, LOGE, FL("===> 11G Protection Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004090 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4091 }
4092 else
4093 {
4094 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
4095 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4096 }
4097 }
4098 }
4099 if(!psessionEntry->gLimOlbcParams.protectionEnabled &&
4100 !psessionEntry->gLim11bParams.protectionEnabled)
4101 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004102 PELOGE(limLog(pMac, LOGE, FL("===> 11G Protection Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004103 pBeaconParams->llbCoexist = psessionEntry->beaconParams.llbCoexist = false;
4104 pBeaconParams->paramChangeBitmap |= PARAM_llBCOEXIST_CHANGED;
4105 }
4106 }else if(eLIM_BT_AMP_AP_ROLE == psessionEntry->limSystemRole)
Jeff Johnson295189b2012-06-20 16:38:30 -07004107 {
4108 if(overlap)
4109 {
4110 //Overlap Legacy protection disabled.
4111 psessionEntry->gLimOlbcParams.protectionEnabled = false;
4112
4113 //We need to take care of HT OP mode iff we are HT AP.
Jeff Johnsone7245742012-09-05 17:12:55 -07004114 if(psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07004115 {
4116 // no HT op mode change if any of the overlap protection enabled.
4117 if(!(pMac->lim.gLimOverlap11gParams.protectionEnabled ||
4118 pMac->lim.gLimOverlapHt20Params.protectionEnabled ||
4119 pMac->lim.gLimOverlapNonGfParams.protectionEnabled))
4120
4121 {
4122 //Check if there is a need to change HT OP mode.
4123 if(eSIR_HT_OP_MODE_OVERLAP_LEGACY == pMac->lim.gHTOperMode)
4124 {
4125 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4126 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4127 if(psessionEntry->gLimHt20Params.protectionEnabled)
4128 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4129 else
4130 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_PURE;
4131 }
4132 }
4133 }
4134 }
4135 else
4136 {
4137 //Disable protection from 11B stations.
4138 psessionEntry->gLim11bParams.protectionEnabled = false;
4139 //Check if any other non-HT protection enabled.
4140 if(!psessionEntry->gLim11gParams.protectionEnabled)
4141 {
4142 //Right now we are in HT OP Mixed mode.
4143 //Change HT op mode appropriately.
4144 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4145
4146 //Change HT OP mode to 01 if any overlap protection enabled
4147 if(psessionEntry->gLimOlbcParams.protectionEnabled ||
4148 pMac->lim.gLimOverlap11gParams.protectionEnabled ||
4149 pMac->lim.gLimOverlapHt20Params.protectionEnabled ||
4150 pMac->lim.gLimOverlapNonGfParams.protectionEnabled)
4151
4152 {
4153 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
4154 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4155 }
4156 else if(psessionEntry->gLimHt20Params.protectionEnabled)
4157 {
4158 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4159 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4160 }
4161 else
4162 {
4163 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_PURE;
4164 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4165 }
4166 }
4167 }
4168 if(!psessionEntry->gLimOlbcParams.protectionEnabled &&
4169 !psessionEntry->gLim11bParams.protectionEnabled)
4170 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004171 PELOG1(limLog(pMac, LOG1, FL("===> 11G Protection Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004172 pBeaconParams->llbCoexist = psessionEntry->beaconParams.llbCoexist = false;
4173 pBeaconParams->paramChangeBitmap |= PARAM_llBCOEXIST_CHANGED;
4174 }
4175 }
4176 //for station role
4177 else
4178 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004179 PELOG1(limLog(pMac, LOG1, FL("===> 11G Protection Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004180 pBeaconParams->llbCoexist = psessionEntry->beaconParams.llbCoexist = false;
4181 pBeaconParams->paramChangeBitmap |= PARAM_llBCOEXIST_CHANGED;
4182 }
4183 }
4184 return eSIR_SUCCESS;
4185}
4186
4187/** -------------------------------------------------------------
4188\fn limEnableHtProtectionFrom11g
4189\brief based on cofig enables\disables protection from 11g.
4190\param tANI_U8 enable : 1=> enable protection, 0=> disable protection.
4191\param tANI_U8 overlap: 1=> called from overlap context, 0 => called from assoc context.
4192\param tpUpdateBeaconParams pBeaconParams
4193\return None
4194 -------------------------------------------------------------*/
4195tSirRetStatus
4196limEnableHtProtectionFrom11g(tpAniSirGlobal pMac, tANI_U8 enable,
4197 tANI_U8 overlap, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry)
4198{
Jeff Johnsone7245742012-09-05 17:12:55 -07004199 if(!psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07004200 return eSIR_SUCCESS; // protection from 11g is only for HT stations.
4201
4202 //overlapping protection configuration check.
4203 if(overlap)
4204 {
Jeff Johnson295189b2012-06-20 16:38:30 -07004205 if((psessionEntry->limSystemRole == eLIM_AP_ROLE ) && (!psessionEntry->cfgProtection.overlapFromllg))
4206 {
4207 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004208 PELOG3(limLog(pMac, LOG3, FL("overlap protection from 11g is disabled")););
Jeff Johnson295189b2012-06-20 16:38:30 -07004209 return eSIR_SUCCESS;
4210 }else if ((psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE) && (!pMac->lim.cfgProtection.overlapFromllg))
Jeff Johnson295189b2012-06-20 16:38:30 -07004211 {
4212 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004213 PELOG3(limLog(pMac, LOG3, FL("overlap protection from 11g is disabled")););
Jeff Johnson295189b2012-06-20 16:38:30 -07004214 return eSIR_SUCCESS;
4215 }
4216 }
4217 else
4218 {
4219 //normal protection config check
Jeff Johnson295189b2012-06-20 16:38:30 -07004220 if((psessionEntry->limSystemRole == eLIM_AP_ROLE ) &&
4221 !psessionEntry->cfgProtection.fromllg){
4222 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004223 PELOG3(limLog(pMac, LOG3, FL("protection from 11g is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004224 return eSIR_SUCCESS;
4225 }else if(psessionEntry->limSystemRole != eLIM_AP_ROLE )
Jeff Johnson295189b2012-06-20 16:38:30 -07004226 {
4227 if(!pMac->lim.cfgProtection.fromllg)
4228 {
4229 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004230 PELOG3(limLog(pMac, LOG3, FL("protection from 11g is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004231 return eSIR_SUCCESS;
4232 }
4233 }
4234 }
4235 if (enable)
4236 {
4237 //If we are AP and HT capable, we need to set the HT OP mode
4238 //appropriately.
4239
Jeff Johnson295189b2012-06-20 16:38:30 -07004240 if(eLIM_AP_ROLE == psessionEntry->limSystemRole)
4241 {
4242 if(overlap)
4243 {
4244 psessionEntry->gLimOverlap11gParams.protectionEnabled = true;
4245 //11g exists in overlap BSS.
4246 //need not to change the operating mode to overlap_legacy
4247 //if higher or same protection operating mode is enabled right now.
4248 if((eSIR_HT_OP_MODE_OVERLAP_LEGACY != psessionEntry->htOperMode) &&
4249 (eSIR_HT_OP_MODE_MIXED != psessionEntry->htOperMode))
4250 {
4251 psessionEntry->htOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
4252 }
4253 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05304254 limEnableHtOBSSProtection(pMac, true, overlap, pBeaconParams, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07004255 }
4256 else
4257 {
4258 //11g is associated to an AP operating in 11n mode.
4259 //Change the HT operating mode to 'mixed mode'.
4260 psessionEntry->gLim11gParams.protectionEnabled = true;
4261 if(eSIR_HT_OP_MODE_MIXED != psessionEntry->htOperMode)
4262 {
4263 psessionEntry->htOperMode = eSIR_HT_OP_MODE_MIXED;
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 }
4268 }else if(eLIM_BT_AMP_AP_ROLE == psessionEntry->limSystemRole)
Jeff Johnson295189b2012-06-20 16:38:30 -07004269 {
4270 if(overlap)
4271 {
4272 pMac->lim.gLimOverlap11gParams.protectionEnabled = true;
4273 //11g exists in overlap BSS.
4274 //need not to change the operating mode to overlap_legacy
4275 //if higher or same protection operating mode is enabled right now.
4276 if((eSIR_HT_OP_MODE_OVERLAP_LEGACY != pMac->lim.gHTOperMode) &&
4277 (eSIR_HT_OP_MODE_MIXED != pMac->lim.gHTOperMode))
4278 {
4279 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
4280 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4281 }
4282 }
4283 else
4284 {
4285 //11g is associated to an AP operating in 11n mode.
4286 //Change the HT operating mode to 'mixed mode'.
4287 psessionEntry->gLim11gParams.protectionEnabled = true;
4288 if(eSIR_HT_OP_MODE_MIXED != pMac->lim.gHTOperMode)
4289 {
4290 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_MIXED;
4291 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05304292 limEnableHtOBSSProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07004293 }
4294 }
4295 }
4296
4297 //This part is common for staiton as well.
4298 if(false == psessionEntry->beaconParams.llgCoexist)
4299 {
4300 pBeaconParams->llgCoexist = psessionEntry->beaconParams.llgCoexist = true;
4301 pBeaconParams->paramChangeBitmap |= PARAM_llGCOEXIST_CHANGED;
4302 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004303 else if (true == psessionEntry->gLimOverlap11gParams.protectionEnabled)
4304 {
4305 // As operating mode changed after G station assoc some way to update beacon
4306 // This addresses the issue of mode not changing to - 11 in beacon when OBSS overlap is enabled
4307 //pMac->sch.schObject.fBeaconChanged = 1;
4308 pBeaconParams->paramChangeBitmap |= PARAM_llGCOEXIST_CHANGED;
4309 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004310 }
4311 else if (true == psessionEntry->beaconParams.llgCoexist)
4312 {
4313 //for AP role.
4314 //we need to take care of HT OP mode change if needed.
4315 //We need to take care of Overlap cases.
4316
Jeff Johnson295189b2012-06-20 16:38:30 -07004317 if(eLIM_AP_ROLE == psessionEntry->limSystemRole)
4318 {
4319 if(overlap)
4320 {
4321 //Overlap Legacy protection disabled.
4322 if (psessionEntry->gLim11gParams.numSta == 0)
4323 psessionEntry->gLimOverlap11gParams.protectionEnabled = false;
4324
4325 // no HT op mode change if any of the overlap protection enabled.
4326 if(!(psessionEntry->gLimOlbcParams.protectionEnabled ||
4327 psessionEntry->gLimOverlapHt20Params.protectionEnabled ||
4328 psessionEntry->gLimOverlapNonGfParams.protectionEnabled))
4329 {
4330 //Check if there is a need to change HT OP mode.
4331 if(eSIR_HT_OP_MODE_OVERLAP_LEGACY == psessionEntry->htOperMode)
4332 {
4333 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4334 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4335
4336 if(psessionEntry->gLimHt20Params.protectionEnabled){
4337 //Commenting because of CR 258588 WFA cert
4338 //psessionEntry->htOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4339 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
4340 }
4341 else
4342 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
4343 }
4344 }
4345 }
4346 else
4347 {
4348 //Disable protection from 11G stations.
4349 psessionEntry->gLim11gParams.protectionEnabled = false;
4350 //Check if any other non-HT protection enabled.
4351 if(!psessionEntry->gLim11bParams.protectionEnabled)
4352 {
4353
4354 //Right now we are in HT OP Mixed mode.
4355 //Change HT op mode appropriately.
4356 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4357
4358 //Change HT OP mode to 01 if any overlap protection enabled
4359 if(psessionEntry->gLimOlbcParams.protectionEnabled ||
4360 psessionEntry->gLimOverlap11gParams.protectionEnabled ||
4361 psessionEntry->gLimOverlapHt20Params.protectionEnabled ||
4362 psessionEntry->gLimOverlapNonGfParams.protectionEnabled)
4363
4364 {
4365 psessionEntry->htOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
4366 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4367 }
4368 else if(psessionEntry->gLimHt20Params.protectionEnabled)
4369 {
4370 //Commenting because of CR 258588 WFA cert
4371 //psessionEntry->htOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4372 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
4373 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4374 }
4375 else
4376 {
4377 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
4378 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4379 }
4380 }
4381 }
4382 if(!psessionEntry->gLimOverlap11gParams.protectionEnabled &&
4383 !psessionEntry->gLim11gParams.protectionEnabled)
4384 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004385 PELOG1(limLog(pMac, LOG1, FL("===> Protection from 11G Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004386 pBeaconParams->llgCoexist = psessionEntry->beaconParams.llgCoexist = false;
4387 pBeaconParams->paramChangeBitmap |= PARAM_llGCOEXIST_CHANGED;
4388 }
4389 }else if(eLIM_BT_AMP_AP_ROLE == psessionEntry->limSystemRole)
Jeff Johnson295189b2012-06-20 16:38:30 -07004390 {
4391 if(overlap)
4392 {
4393 //Overlap Legacy protection disabled.
4394 pMac->lim.gLimOverlap11gParams.protectionEnabled = false;
4395
4396 // no HT op mode change if any of the overlap protection enabled.
4397 if(!(psessionEntry->gLimOlbcParams.protectionEnabled ||
4398 psessionEntry->gLimOverlapHt20Params.protectionEnabled ||
4399 psessionEntry->gLimOverlapNonGfParams.protectionEnabled))
4400 {
4401 //Check if there is a need to change HT OP mode.
4402 if(eSIR_HT_OP_MODE_OVERLAP_LEGACY == pMac->lim.gHTOperMode)
4403 {
4404 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4405 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4406
4407 if(psessionEntry->gLimHt20Params.protectionEnabled)
4408 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4409 else
4410 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_PURE;
4411 }
4412 }
4413 }
4414 else
4415 {
4416 //Disable protection from 11G stations.
4417 psessionEntry->gLim11gParams.protectionEnabled = false;
4418 //Check if any other non-HT protection enabled.
4419 if(!psessionEntry->gLim11bParams.protectionEnabled)
4420 {
4421
4422 //Right now we are in HT OP Mixed mode.
4423 //Change HT op mode appropriately.
4424 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4425
4426 //Change HT OP mode to 01 if any overlap protection enabled
4427 if(psessionEntry->gLimOlbcParams.protectionEnabled ||
4428 pMac->lim.gLimOverlap11gParams.protectionEnabled ||
4429 pMac->lim.gLimOverlapHt20Params.protectionEnabled ||
4430 pMac->lim.gLimOverlapNonGfParams.protectionEnabled)
4431
4432 {
4433 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
4434 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4435 }
4436 else if(psessionEntry->gLimHt20Params.protectionEnabled)
4437 {
4438 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4439 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4440 }
4441 else
4442 {
4443 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_PURE;
4444 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4445 }
4446 }
4447 }
4448 if(!pMac->lim.gLimOverlap11gParams.protectionEnabled &&
4449 !psessionEntry->gLim11gParams.protectionEnabled)
4450 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004451 PELOG1(limLog(pMac, LOG1, FL("===> Protection from 11G Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004452 pBeaconParams->llgCoexist = psessionEntry->beaconParams.llgCoexist = false;
4453 pBeaconParams->paramChangeBitmap |= PARAM_llGCOEXIST_CHANGED;
4454 }
4455 }
4456 //for station role
4457 else
4458 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004459 PELOG1(limLog(pMac, LOG1, FL("===> Protection from 11G Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004460 pBeaconParams->llgCoexist = psessionEntry->beaconParams.llgCoexist = false;
4461 pBeaconParams->paramChangeBitmap |= PARAM_llGCOEXIST_CHANGED;
4462 }
4463 }
4464 return eSIR_SUCCESS;
4465}
4466//FIXME_PROTECTION : need to check for no APSD whenever we want to enable this protection.
4467//This check will be done at the caller.
4468
4469/** -------------------------------------------------------------
4470\fn limEnableHtObssProtection
4471\brief based on cofig enables\disables obss protection.
4472\param tANI_U8 enable : 1=> enable protection, 0=> disable protection.
4473\param tANI_U8 overlap: 1=> called from overlap context, 0 => called from assoc context.
4474\param tpUpdateBeaconParams pBeaconParams
4475\return None
4476 -------------------------------------------------------------*/
4477tSirRetStatus
4478limEnableHtOBSSProtection(tpAniSirGlobal pMac, tANI_U8 enable,
4479 tANI_U8 overlap, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry)
4480{
4481
4482
Jeff Johnsone7245742012-09-05 17:12:55 -07004483 if(!psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07004484 return eSIR_SUCCESS; // this protection is only for HT stations.
4485
4486 //overlapping protection configuration check.
4487 if(overlap)
4488 {
4489 //overlapping protection configuration check.
Jeff Johnson295189b2012-06-20 16:38:30 -07004490 }
4491 else
4492 {
4493 //normal protection config check
Jeff Johnson295189b2012-06-20 16:38:30 -07004494 if((psessionEntry->limSystemRole == eLIM_AP_ROLE) && !psessionEntry->cfgProtection.obss)
4495 { //ToDo Update this field
4496 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004497 PELOG1(limLog(pMac, LOG1, FL("protection from Obss is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004498 return eSIR_SUCCESS;
4499 }else if(psessionEntry->limSystemRole != eLIM_AP_ROLE)
Jeff Johnson295189b2012-06-20 16:38:30 -07004500 {
4501 if(!pMac->lim.cfgProtection.obss)
4502 { //ToDo Update this field
4503 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004504 PELOG1(limLog(pMac, LOG1, FL("protection from Obss is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004505 return eSIR_SUCCESS;
4506 }
4507 }
4508 }
4509
4510
Jeff Johnson295189b2012-06-20 16:38:30 -07004511 if (eLIM_AP_ROLE == psessionEntry->limSystemRole){
4512 if ((enable) && (false == psessionEntry->beaconParams.gHTObssMode) )
4513 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004514 PELOG1(limLog(pMac, LOG1, FL("=>obss protection enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004515 psessionEntry->beaconParams.gHTObssMode = true;
4516 pBeaconParams->paramChangeBitmap |= PARAM_OBSS_MODE_CHANGED; // UPDATE AN ENUM FOR OBSS MODE <todo>
4517
4518 }
4519 else if (!enable && (true == psessionEntry->beaconParams.gHTObssMode))
4520 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004521 PELOG1(limLog(pMac, LOG1, FL("===> obss Protection disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004522 psessionEntry->beaconParams.gHTObssMode = false;
4523 pBeaconParams->paramChangeBitmap |= PARAM_OBSS_MODE_CHANGED;
4524
4525 }
4526//CR-263021: OBSS bit is not switching back to 0 after disabling the overlapping legacy BSS
4527 if (!enable && !overlap)
4528 {
4529 psessionEntry->gLimOverlap11gParams.protectionEnabled = false;
4530 }
4531 } else
Jeff Johnson295189b2012-06-20 16:38:30 -07004532 {
4533 if ((enable) && (false == psessionEntry->beaconParams.gHTObssMode) )
4534 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004535 PELOG1(limLog(pMac, LOG1, FL("=>obss protection enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004536 psessionEntry->beaconParams.gHTObssMode = true;
4537 pBeaconParams->paramChangeBitmap |= PARAM_OBSS_MODE_CHANGED; // UPDATE AN ENUM FOR OBSS MODE <todo>
4538
4539 }
4540 else if (!enable && (true == psessionEntry->beaconParams.gHTObssMode))
4541 {
4542
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004543 PELOG1(limLog(pMac, LOG1, FL("===> obss Protection disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004544 psessionEntry->beaconParams.gHTObssMode = false;
4545 pBeaconParams->paramChangeBitmap |= PARAM_OBSS_MODE_CHANGED;
4546
4547 }
4548 }
4549 return eSIR_SUCCESS;
4550}
4551/** -------------------------------------------------------------
4552\fn limEnableHT20Protection
4553\brief based on cofig enables\disables protection from Ht20.
4554\param tANI_U8 enable : 1=> enable protection, 0=> disable protection.
4555\param tANI_U8 overlap: 1=> called from overlap context, 0 => called from assoc context.
4556\param tpUpdateBeaconParams pBeaconParams
4557\return None
4558 -------------------------------------------------------------*/
4559tSirRetStatus
4560limEnableHT20Protection(tpAniSirGlobal pMac, tANI_U8 enable,
4561 tANI_U8 overlap, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry)
4562{
Jeff Johnsone7245742012-09-05 17:12:55 -07004563 if(!psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07004564 return eSIR_SUCCESS; // this protection is only for HT stations.
4565
4566 //overlapping protection configuration check.
4567 if(overlap)
4568 {
Jeff Johnson295189b2012-06-20 16:38:30 -07004569 }
4570 else
4571 {
4572 //normal protection config check
Jeff Johnson295189b2012-06-20 16:38:30 -07004573 if((psessionEntry->limSystemRole == eLIM_AP_ROLE ) &&
4574 !psessionEntry->cfgProtection.ht20)
4575 {
4576 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004577 PELOG3(limLog(pMac, LOG3, FL("protection from HT20 is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004578 return eSIR_SUCCESS;
4579 }else if(psessionEntry->limSystemRole != eLIM_AP_ROLE )
Jeff Johnson295189b2012-06-20 16:38:30 -07004580 {
4581 if(!pMac->lim.cfgProtection.ht20)
4582 {
4583 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004584 PELOG3(limLog(pMac, LOG3, FL("protection from HT20 is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004585 return eSIR_SUCCESS;
4586 }
4587 }
4588 }
4589
4590 if (enable)
4591 {
4592 //If we are AP and HT capable, we need to set the HT OP mode
4593 //appropriately.
4594
Jeff Johnson295189b2012-06-20 16:38:30 -07004595 if(eLIM_AP_ROLE == psessionEntry->limSystemRole){
4596 if(overlap)
4597 {
4598 psessionEntry->gLimOverlapHt20Params.protectionEnabled = true;
4599 if((eSIR_HT_OP_MODE_OVERLAP_LEGACY != psessionEntry->htOperMode) &&
4600 (eSIR_HT_OP_MODE_MIXED != psessionEntry->htOperMode))
4601 {
4602 psessionEntry->htOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
4603 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4604 }
4605 }
4606 else
4607 {
4608 psessionEntry->gLimHt20Params.protectionEnabled = true;
4609 if(eSIR_HT_OP_MODE_PURE == psessionEntry->htOperMode)
4610 {
4611 //Commenting because of CR 258588 WFA cert
4612 //psessionEntry->htOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4613 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
4614 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4615 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4616 }
4617 }
4618 }else if(eLIM_BT_AMP_AP_ROLE == psessionEntry->limSystemRole)
Jeff Johnson295189b2012-06-20 16:38:30 -07004619 {
4620 if(overlap)
4621 {
4622 pMac->lim.gLimOverlapHt20Params.protectionEnabled = true;
4623 if((eSIR_HT_OP_MODE_OVERLAP_LEGACY != pMac->lim.gHTOperMode) &&
4624 (eSIR_HT_OP_MODE_MIXED != pMac->lim.gHTOperMode))
4625 {
4626 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
4627 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4628 }
4629 }
4630 else
4631 {
4632 psessionEntry->gLimHt20Params.protectionEnabled = true;
4633 if(eSIR_HT_OP_MODE_PURE == pMac->lim.gHTOperMode)
4634 {
4635 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4636 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4637 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4638 }
4639 }
4640 }
4641
4642 //This part is common for staiton as well.
4643 if(false == psessionEntry->beaconParams.ht20Coexist)
4644 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004645 PELOG1(limLog(pMac, LOG1, FL("=> Prtection from HT20 Enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004646 pBeaconParams->ht20MhzCoexist = psessionEntry->beaconParams.ht20Coexist = true;
4647 pBeaconParams->paramChangeBitmap |= PARAM_HT20MHZCOEXIST_CHANGED;
4648 }
4649 }
4650 else if (true == psessionEntry->beaconParams.ht20Coexist)
4651 {
4652 //for AP role.
4653 //we need to take care of HT OP mode change if needed.
4654 //We need to take care of Overlap cases.
Jeff Johnson295189b2012-06-20 16:38:30 -07004655 if(eLIM_AP_ROLE == psessionEntry->limSystemRole){
4656 if(overlap)
4657 {
4658 //Overlap Legacy protection disabled.
4659 psessionEntry->gLimOverlapHt20Params.protectionEnabled = false;
4660
4661 // no HT op mode change if any of the overlap protection enabled.
4662 if(!(psessionEntry->gLimOlbcParams.protectionEnabled ||
4663 psessionEntry->gLimOverlap11gParams.protectionEnabled ||
4664 psessionEntry->gLimOverlapHt20Params.protectionEnabled ||
4665 psessionEntry->gLimOverlapNonGfParams.protectionEnabled))
4666 {
4667
4668 //Check if there is a need to change HT OP mode.
4669 if(eSIR_HT_OP_MODE_OVERLAP_LEGACY == psessionEntry->htOperMode)
4670 {
4671 if(psessionEntry->gLimHt20Params.protectionEnabled)
4672 {
4673 //Commented beacuse of CR 258588 for WFA Cert
4674 //psessionEntry->htOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4675 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
4676 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4677 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4678 }
4679 else
4680 {
4681 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
4682 }
4683 }
4684 }
4685 }
4686 else
4687 {
4688 //Disable protection from 11G stations.
4689 psessionEntry->gLimHt20Params.protectionEnabled = false;
4690
4691 //Change HT op mode appropriately.
4692 if(eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT == psessionEntry->htOperMode)
4693 {
4694 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
4695 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4696 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4697 }
4698 }
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004699 PELOG1(limLog(pMac, LOG1, FL("===> Protection from HT 20 Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004700 pBeaconParams->ht20MhzCoexist = psessionEntry->beaconParams.ht20Coexist = false;
4701 pBeaconParams->paramChangeBitmap |= PARAM_HT20MHZCOEXIST_CHANGED;
4702 }else if(eLIM_BT_AMP_AP_ROLE == psessionEntry->limSystemRole)
Jeff Johnson295189b2012-06-20 16:38:30 -07004703 {
4704 if(overlap)
4705 {
4706 //Overlap Legacy protection disabled.
4707 pMac->lim.gLimOverlapHt20Params.protectionEnabled = false;
4708
4709 // no HT op mode change if any of the overlap protection enabled.
4710 if(!(psessionEntry->gLimOlbcParams.protectionEnabled ||
4711 pMac->lim.gLimOverlap11gParams.protectionEnabled ||
4712 pMac->lim.gLimOverlapHt20Params.protectionEnabled ||
4713 pMac->lim.gLimOverlapNonGfParams.protectionEnabled))
4714 {
4715
4716 //Check if there is a need to change HT OP mode.
4717 if(eSIR_HT_OP_MODE_OVERLAP_LEGACY == pMac->lim.gHTOperMode)
4718 {
4719 if(psessionEntry->gLimHt20Params.protectionEnabled)
4720 {
4721 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4722 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4723 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4724 }
4725 else
4726 {
4727 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_PURE;
4728 }
4729 }
4730 }
4731 }
4732 else
4733 {
4734 //Disable protection from 11G stations.
4735 psessionEntry->gLimHt20Params.protectionEnabled = false;
4736
4737 //Change HT op mode appropriately.
4738 if(eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT == pMac->lim.gHTOperMode)
4739 {
4740 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_PURE;
4741 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4742 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4743 }
4744 }
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004745 PELOG1(limLog(pMac, LOG1, FL("===> Protection from HT 20 Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004746 pBeaconParams->ht20MhzCoexist = psessionEntry->beaconParams.ht20Coexist = false;
4747 pBeaconParams->paramChangeBitmap |= PARAM_HT20MHZCOEXIST_CHANGED;
4748 }
4749 //for station role
4750 else
4751 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004752 PELOG1(limLog(pMac, LOG1, FL("===> Protection from HT20 Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004753 pBeaconParams->ht20MhzCoexist = psessionEntry->beaconParams.ht20Coexist = false;
4754 pBeaconParams->paramChangeBitmap |= PARAM_HT20MHZCOEXIST_CHANGED;
4755 }
4756 }
4757
4758 return eSIR_SUCCESS;
4759}
4760
4761/** -------------------------------------------------------------
4762\fn limEnableHTNonGfProtection
4763\brief based on cofig enables\disables protection from NonGf.
4764\param tANI_U8 enable : 1=> enable protection, 0=> disable protection.
4765\param tANI_U8 overlap: 1=> called from overlap context, 0 => called from assoc context.
4766\param tpUpdateBeaconParams pBeaconParams
4767\return None
4768 -------------------------------------------------------------*/
4769tSirRetStatus
4770limEnableHTNonGfProtection(tpAniSirGlobal pMac, tANI_U8 enable,
4771 tANI_U8 overlap, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry)
4772{
Jeff Johnsone7245742012-09-05 17:12:55 -07004773 if(!psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07004774 return eSIR_SUCCESS; // this protection is only for HT stations.
4775
4776 //overlapping protection configuration check.
4777 if(overlap)
4778 {
Jeff Johnson295189b2012-06-20 16:38:30 -07004779 }
4780 else
4781 {
Jeff Johnson295189b2012-06-20 16:38:30 -07004782 //normal protection config check
4783 if((psessionEntry->limSystemRole == eLIM_AP_ROLE ) &&
4784 !psessionEntry->cfgProtection.nonGf)
4785 {
4786 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004787 PELOG3(limLog(pMac, LOG3, FL("protection from NonGf is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004788 return eSIR_SUCCESS;
4789 }else if(psessionEntry->limSystemRole != eLIM_AP_ROLE)
Jeff Johnson295189b2012-06-20 16:38:30 -07004790 {
4791 //normal protection config check
4792 if(!pMac->lim.cfgProtection.nonGf)
4793 {
4794 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004795 PELOG3(limLog(pMac, LOG3, FL("protection from NonGf is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004796 return eSIR_SUCCESS;
4797 }
4798 }
4799 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004800 if(psessionEntry->limSystemRole == eLIM_AP_ROLE){
4801 if ((enable) && (false == psessionEntry->beaconParams.llnNonGFCoexist))
4802 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004803 PELOG1(limLog(pMac, LOG1, FL(" => Prtection from non GF Enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004804 pBeaconParams->llnNonGFCoexist = psessionEntry->beaconParams.llnNonGFCoexist = true;
4805 pBeaconParams->paramChangeBitmap |= PARAM_NON_GF_DEVICES_PRESENT_CHANGED;
4806 }
4807 else if (!enable && (true == psessionEntry->beaconParams.llnNonGFCoexist))
4808 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004809 PELOG1(limLog(pMac, LOG1, FL("===> Protection from Non GF Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004810 pBeaconParams->llnNonGFCoexist = psessionEntry->beaconParams.llnNonGFCoexist = false;
4811 pBeaconParams->paramChangeBitmap |= PARAM_NON_GF_DEVICES_PRESENT_CHANGED;
4812 }
4813 }else
Jeff Johnson295189b2012-06-20 16:38:30 -07004814 {
4815 if ((enable) && (false == psessionEntry->beaconParams.llnNonGFCoexist))
4816 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004817 PELOG1(limLog(pMac, LOG1, FL(" => Prtection from non GF Enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004818 pBeaconParams->llnNonGFCoexist = psessionEntry->beaconParams.llnNonGFCoexist = true;
4819 pBeaconParams->paramChangeBitmap |= PARAM_NON_GF_DEVICES_PRESENT_CHANGED;
4820 }
4821 else if (!enable && (true == psessionEntry->beaconParams.llnNonGFCoexist))
4822 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004823 PELOG1(limLog(pMac, LOG1, FL("===> Protection from Non GF Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004824 pBeaconParams->llnNonGFCoexist = psessionEntry->beaconParams.llnNonGFCoexist = false;
4825 pBeaconParams->paramChangeBitmap |= PARAM_NON_GF_DEVICES_PRESENT_CHANGED;
4826 }
4827 }
4828
4829 return eSIR_SUCCESS;
4830}
4831
4832/** -------------------------------------------------------------
4833\fn limEnableHTLsigTxopProtection
4834\brief based on cofig enables\disables LsigTxop protection.
4835\param tANI_U8 enable : 1=> enable protection, 0=> disable protection.
4836\param tANI_U8 overlap: 1=> called from overlap context, 0 => called from assoc context.
4837\param tpUpdateBeaconParams pBeaconParams
4838\return None
4839 -------------------------------------------------------------*/
4840tSirRetStatus
4841limEnableHTLsigTxopProtection(tpAniSirGlobal pMac, tANI_U8 enable,
4842 tANI_U8 overlap, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry)
4843{
Jeff Johnsone7245742012-09-05 17:12:55 -07004844 if(!psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07004845 return eSIR_SUCCESS; // this protection is only for HT stations.
4846
4847 //overlapping protection configuration check.
4848 if(overlap)
4849 {
Jeff Johnson295189b2012-06-20 16:38:30 -07004850 }
4851 else
4852 {
Jeff Johnson295189b2012-06-20 16:38:30 -07004853 //normal protection config check
4854 if((psessionEntry->limSystemRole == eLIM_AP_ROLE ) &&
4855 !psessionEntry->cfgProtection.lsigTxop)
4856 {
4857 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004858 PELOG3(limLog(pMac, LOG3, FL(" protection from LsigTxop not supported is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004859 return eSIR_SUCCESS;
4860 }else if(psessionEntry->limSystemRole != eLIM_AP_ROLE)
Jeff Johnson295189b2012-06-20 16:38:30 -07004861 {
4862 //normal protection config check
4863 if(!pMac->lim.cfgProtection.lsigTxop)
4864 {
4865 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004866 PELOG3(limLog(pMac, LOG3, FL(" protection from LsigTxop not supported is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004867 return eSIR_SUCCESS;
4868 }
4869 }
4870 }
4871
4872
Jeff Johnson295189b2012-06-20 16:38:30 -07004873 if(psessionEntry->limSystemRole == eLIM_AP_ROLE){
4874 if ((enable) && (false == psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport))
4875 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004876 PELOG1(limLog(pMac, LOG1, FL(" => Prtection from LsigTxop Enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004877 pBeaconParams->fLsigTXOPProtectionFullSupport = psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport = true;
4878 pBeaconParams->paramChangeBitmap |= PARAM_LSIG_TXOP_FULL_SUPPORT_CHANGED;
4879 }
4880 else if (!enable && (true == psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport))
4881 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004882 PELOG1(limLog(pMac, LOG1, FL("===> Protection from LsigTxop Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004883 pBeaconParams->fLsigTXOPProtectionFullSupport= psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport = false;
4884 pBeaconParams->paramChangeBitmap |= PARAM_LSIG_TXOP_FULL_SUPPORT_CHANGED;
4885 }
4886 }else
Jeff Johnson295189b2012-06-20 16:38:30 -07004887 {
4888 if ((enable) && (false == psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport))
4889 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004890 PELOG1(limLog(pMac, LOG1, FL(" => Prtection from LsigTxop Enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004891 pBeaconParams->fLsigTXOPProtectionFullSupport = psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport = true;
4892 pBeaconParams->paramChangeBitmap |= PARAM_LSIG_TXOP_FULL_SUPPORT_CHANGED;
4893 }
4894 else if (!enable && (true == psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport))
4895 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004896 PELOG1(limLog(pMac, LOG1, FL("===> Protection from LsigTxop Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004897 pBeaconParams->fLsigTXOPProtectionFullSupport= psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport = false;
4898 pBeaconParams->paramChangeBitmap |= PARAM_LSIG_TXOP_FULL_SUPPORT_CHANGED;
4899 }
4900 }
4901 return eSIR_SUCCESS;
4902}
4903//FIXME_PROTECTION : need to check for no APSD whenever we want to enable this protection.
4904//This check will be done at the caller.
4905/** -------------------------------------------------------------
4906\fn limEnableHtRifsProtection
4907\brief based on cofig enables\disables Rifs protection.
4908\param tANI_U8 enable : 1=> enable protection, 0=> disable protection.
4909\param tANI_U8 overlap: 1=> called from overlap context, 0 => called from assoc context.
4910\param tpUpdateBeaconParams pBeaconParams
4911\return None
4912 -------------------------------------------------------------*/
4913tSirRetStatus
4914limEnableHtRifsProtection(tpAniSirGlobal pMac, tANI_U8 enable,
4915 tANI_U8 overlap, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry)
4916{
Jeff Johnsone7245742012-09-05 17:12:55 -07004917 if(!psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07004918 return eSIR_SUCCESS; // this protection is only for HT stations.
4919
4920
4921 //overlapping protection configuration check.
4922 if(overlap)
4923 {
Jeff Johnson295189b2012-06-20 16:38:30 -07004924 }
4925 else
4926 {
Jeff Johnson295189b2012-06-20 16:38:30 -07004927 //normal protection config check
4928 if((psessionEntry->limSystemRole == eLIM_AP_ROLE) &&
4929 !psessionEntry->cfgProtection.rifs)
4930 {
4931 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004932 PELOG3(limLog(pMac, LOG3, FL(" protection from Rifs is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004933 return eSIR_SUCCESS;
4934 }else if(psessionEntry->limSystemRole != eLIM_AP_ROLE )
Jeff Johnson295189b2012-06-20 16:38:30 -07004935 {
4936 //normal protection config check
4937 if(!pMac->lim.cfgProtection.rifs)
4938 {
4939 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004940 PELOG3(limLog(pMac, LOG3, FL(" protection from Rifs is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004941 return eSIR_SUCCESS;
4942 }
4943 }
4944 }
4945
Jeff Johnson295189b2012-06-20 16:38:30 -07004946 if(psessionEntry->limSystemRole == eLIM_AP_ROLE){
4947 // Disabling the RIFS Protection means Enable the RIFS mode of operation in the BSS
4948 if ((!enable) && (false == psessionEntry->beaconParams.fRIFSMode))
4949 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004950 PELOG1(limLog(pMac, LOG1, FL(" => Rifs protection Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004951 pBeaconParams->fRIFSMode = psessionEntry->beaconParams.fRIFSMode = true;
4952 pBeaconParams->paramChangeBitmap |= PARAM_RIFS_MODE_CHANGED;
4953 }
4954 // Enabling the RIFS Protection means Disable the RIFS mode of operation in the BSS
4955 else if (enable && (true == psessionEntry->beaconParams.fRIFSMode))
4956 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004957 PELOG1(limLog(pMac, LOG1, FL("===> Rifs Protection Enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004958 pBeaconParams->fRIFSMode = psessionEntry->beaconParams.fRIFSMode = false;
4959 pBeaconParams->paramChangeBitmap |= PARAM_RIFS_MODE_CHANGED;
4960 }
4961 }else
Jeff Johnson295189b2012-06-20 16:38:30 -07004962 {
4963 // Disabling the RIFS Protection means Enable the RIFS mode of operation in the BSS
4964 if ((!enable) && (false == psessionEntry->beaconParams.fRIFSMode))
4965 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004966 PELOG1(limLog(pMac, LOG1, FL(" => Rifs protection Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004967 pBeaconParams->fRIFSMode = psessionEntry->beaconParams.fRIFSMode = true;
4968 pBeaconParams->paramChangeBitmap |= PARAM_RIFS_MODE_CHANGED;
4969 }
4970 // Enabling the RIFS Protection means Disable the RIFS mode of operation in the BSS
4971 else if (enable && (true == psessionEntry->beaconParams.fRIFSMode))
4972 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004973 PELOG1(limLog(pMac, LOG1, FL("===> Rifs Protection Enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004974 pBeaconParams->fRIFSMode = psessionEntry->beaconParams.fRIFSMode = false;
4975 pBeaconParams->paramChangeBitmap |= PARAM_RIFS_MODE_CHANGED;
4976 }
4977 }
4978 return eSIR_SUCCESS;
4979}
4980
4981// ---------------------------------------------------------------------
4982/**
4983 * limEnableShortPreamble
4984 *
4985 * FUNCTION:
4986 * Enable/Disable short preamble
4987 *
4988 * LOGIC:
4989 *
4990 * ASSUMPTIONS:
4991 *
4992 * NOTE:
4993 *
4994 * @param enable Flag to enable/disable short preamble
4995 * @return None
4996 */
4997
4998tSirRetStatus
4999limEnableShortPreamble(tpAniSirGlobal pMac, tANI_U8 enable, tpUpdateBeaconParams pBeaconParams, tpPESession psessionEntry)
5000{
5001 tANI_U32 val;
5002
5003 if (wlan_cfgGetInt(pMac, WNI_CFG_SHORT_PREAMBLE, &val) != eSIR_SUCCESS)
5004 {
5005 /* Could not get short preamble enabled flag from CFG. Log error. */
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005006 limLog(pMac, LOGP, FL("could not retrieve short preamble flag"));
Jeff Johnson295189b2012-06-20 16:38:30 -07005007 return eSIR_FAILURE;
5008 }
5009
5010 if (!val)
5011 return eSIR_SUCCESS;
5012
5013 if (wlan_cfgGetInt(pMac, WNI_CFG_11G_SHORT_PREAMBLE_ENABLED, &val) != eSIR_SUCCESS)
5014 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005015 limLog(pMac, LOGP, FL("could not retrieve 11G short preamble switching enabled flag"));
Jeff Johnson295189b2012-06-20 16:38:30 -07005016 return eSIR_FAILURE;
5017 }
5018
5019 if (!val) // 11G short preamble switching is disabled.
5020 return eSIR_SUCCESS;
5021
5022 if ( psessionEntry->limSystemRole == eLIM_AP_ROLE )
5023 {
5024 if (enable && (psessionEntry->beaconParams.fShortPreamble == 0))
5025 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005026 PELOG1(limLog(pMac, LOG1, FL("===> Short Preamble Enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005027 psessionEntry->beaconParams.fShortPreamble = true;
5028 pBeaconParams->fShortPreamble = (tANI_U8) psessionEntry->beaconParams.fShortPreamble;
5029 pBeaconParams->paramChangeBitmap |= PARAM_SHORT_PREAMBLE_CHANGED;
5030 }
5031 else if (!enable && (psessionEntry->beaconParams.fShortPreamble == 1))
5032 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005033 PELOG1(limLog(pMac, LOG1, FL("===> Short Preamble Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005034 psessionEntry->beaconParams.fShortPreamble = false;
5035 pBeaconParams->fShortPreamble = (tANI_U8) psessionEntry->beaconParams.fShortPreamble;
5036 pBeaconParams->paramChangeBitmap |= PARAM_SHORT_PREAMBLE_CHANGED;
5037 }
5038 }
5039
5040 return eSIR_SUCCESS;
5041 }
5042
5043/**
5044 * limTxComplete
5045 *
5046 * Function:
5047 * This is LIM's very own "TX MGMT frame complete" completion routine.
5048 *
5049 * Logic:
5050 * LIM wants to send a MGMT frame (broadcast or unicast)
5051 * LIM allocates memory using palPktAlloc( ..., **pData, **pPacket )
5052 * LIM transmits the MGMT frame using the API:
5053 * halTxFrame( ... pPacket, ..., (void *) limTxComplete, pData )
5054 * HDD, via halTxFrame/DXE, "transfers" the packet over to BMU
5055 * HDD, if it determines that a TX completion routine (in this case
5056 * limTxComplete) has been provided, will invoke this callback
5057 * LIM will try to free the TX MGMT packet that was earlier allocated, in order
5058 * to send this MGMT frame, using the PAL API palPktFree( ... pData, pPacket )
5059 *
5060 * Assumptions:
5061 * Presently, this is ONLY being used for MGMT frames/packets
5062 * TODO:
5063 * Would it do good for LIM to have some sort of "signature" validation to
5064 * ensure that the pData argument passed in was a buffer that was actually
5065 * allocated by LIM and/or is not corrupted?
5066 *
5067 * Note: FIXME and TODO
5068 * Looks like palPktFree() is interested in pPacket. But, when this completion
5069 * routine is called, only pData is made available to LIM!!
5070 *
5071 * @param void A pointer to pData. Shouldn't it be pPacket?!
5072 *
5073 * @return none
5074 */
5075void limTxComplete( tHalHandle hHal, void *pData )
5076{
5077 tpAniSirGlobal pMac;
5078 pMac = (tpAniSirGlobal)hHal;
5079
5080#ifdef FIXME_PRIMA
5081 /* the trace logic needs to be fixed for Prima. Refer to CR 306075 */
5082#ifdef TRACE_RECORD
5083 {
5084 tpSirMacMgmtHdr mHdr;
5085 v_U8_t *pRxBd;
5086 vos_pkt_t *pVosPkt;
5087 VOS_STATUS vosStatus;
5088
5089
5090
5091 pVosPkt = (vos_pkt_t *)pData;
5092 vosStatus = vos_pkt_peek_data( pVosPkt, 0, (v_PVOID_t *)&pRxBd, WLANHAL_RX_BD_HEADER_SIZE);
5093
5094 if(VOS_IS_STATUS_SUCCESS(vosStatus))
5095 {
5096 mHdr = WDA_GET_RX_MAC_HEADER(pRxBd);
Jeff Johnsone7245742012-09-05 17:12:55 -07005097 MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE, NO_SESSION, mHdr->fc.subType);)
Jeff Johnson295189b2012-06-20 16:38:30 -07005098
5099 }
5100 }
5101#endif
5102#endif
5103
5104 palPktFree( pMac->hHdd,
5105 HAL_TXRX_FRM_802_11_MGMT,
5106 (void *) NULL, // this is ignored and will likely be removed from this API
5107 (void *) pData ); // lim passed in pPacket in the pData pointer that is given in this completion routine
5108}
5109
5110/**
5111 * \brief This function updates lim global structure, if CB parameters in the BSS
5112 * have changed, and sends an indication to HAL also with the
5113 * updated HT Parameters.
5114 * This function does not detect the change in the primary channel, that is done as part
5115 * of channel Swtich IE processing.
5116 * If STA is configured with '20Mhz only' mode, then this function does not do anything
5117 * This function changes the CB mode, only if the self capability is set to '20 as well as 40Mhz'
5118 *
5119 *
5120 * \param pMac Pointer to global MAC structure
5121 *
5122 * \param pRcvdHTInfo Pointer to HT Info IE obtained from a Beacon or
5123 * Probe Response
5124 *
5125 * \param bssIdx BSS Index of the Bss to which Station is associated.
5126 *
5127 *
5128 */
5129
5130void limUpdateStaRunTimeHTSwitchChnlParams( tpAniSirGlobal pMac,
5131 tDot11fIEHTInfo *pHTInfo,
5132 tANI_U8 bssIdx,
5133 tpPESession psessionEntry)
5134{
Jeff Johnsone7245742012-09-05 17:12:55 -07005135 ePhyChanBondState secondaryChnlOffset = PHY_SINGLE_CHANNEL_CENTERED;
Jeff Johnson295189b2012-06-20 16:38:30 -07005136#if !defined WLAN_FEATURE_VOWIFI
5137 tANI_U32 localPwrConstraint;
5138#endif
5139
5140 //If self capability is set to '20Mhz only', then do not change the CB mode.
Jeff Johnson295189b2012-06-20 16:38:30 -07005141 if( !limGetHTCapability( pMac, eHT_SUPPORTED_CHANNEL_WIDTH_SET, psessionEntry ))
Jeff Johnson295189b2012-06-20 16:38:30 -07005142 return;
5143
5144#if !defined WLAN_FEATURE_VOWIFI
5145 if(wlan_cfgGetInt(pMac, WNI_CFG_LOCAL_POWER_CONSTRAINT, &localPwrConstraint) != eSIR_SUCCESS) {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005146 limLog( pMac, LOGP, FL( "Unable to get Local Power Constraint from cfg" ));
Jeff Johnson295189b2012-06-20 16:38:30 -07005147 return;
5148 }
5149#endif
5150
Jeff Johnsone7245742012-09-05 17:12:55 -07005151 if ( psessionEntry->htSecondaryChannelOffset != ( tANI_U8 ) pHTInfo->secondaryChannelOffset ||
5152 psessionEntry->htRecommendedTxWidthSet != ( tANI_U8 ) pHTInfo->recommendedTxWidthSet )
Jeff Johnson295189b2012-06-20 16:38:30 -07005153 {
Jeff Johnsone7245742012-09-05 17:12:55 -07005154 psessionEntry->htSecondaryChannelOffset = ( ePhyChanBondState ) pHTInfo->secondaryChannelOffset;
5155 psessionEntry->htRecommendedTxWidthSet = ( tANI_U8 ) pHTInfo->recommendedTxWidthSet;
5156 if ( eHT_CHANNEL_WIDTH_40MHZ == psessionEntry->htRecommendedTxWidthSet )
5157 secondaryChnlOffset = (ePhyChanBondState)pHTInfo->secondaryChannelOffset;
Jeff Johnson295189b2012-06-20 16:38:30 -07005158
5159 // Notify HAL
5160 limLog( pMac, LOGW, FL( "Channel Information in HT IE change"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005161 "d; sending notification to HAL." ) );
Jeff Johnson295189b2012-06-20 16:38:30 -07005162 limLog( pMac, LOGW, FL( "Primary Channel: %d, Secondary Chan"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005163 "nel Offset: %d, Channel Width: %d" ),
Jeff Johnson295189b2012-06-20 16:38:30 -07005164 pHTInfo->primaryChannel, secondaryChnlOffset,
Jeff Johnsone7245742012-09-05 17:12:55 -07005165 psessionEntry->htRecommendedTxWidthSet );
Madan Mohan Koyyalamudifd322a02012-10-05 12:01:26 -07005166 psessionEntry->channelChangeReasonCode=LIM_SWITCH_CHANNEL_OPERATION;
5167 pMac->lim.gpchangeChannelCallback = NULL;
5168 pMac->lim.gpchangeChannelData = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07005169
5170#if defined WLAN_FEATURE_VOWIFI
5171 limSendSwitchChnlParams( pMac, ( tANI_U8 ) pHTInfo->primaryChannel,
5172 secondaryChnlOffset, psessionEntry->maxTxPower, psessionEntry->peSessionId);
5173#else
5174 limSendSwitchChnlParams( pMac, ( tANI_U8 ) pHTInfo->primaryChannel,
5175 secondaryChnlOffset, (tPowerdBm)localPwrConstraint, psessionEntry->peSessionId);
5176#endif
5177
5178 //In case of IBSS, if STA should update HT Info IE in its beacons.
5179 if (eLIM_STA_IN_IBSS_ROLE == psessionEntry->limSystemRole)
5180 {
5181 schSetFixedBeaconFields(pMac,psessionEntry);
5182 }
5183
5184 }
5185} // End limUpdateStaRunTimeHTParams.
5186
5187/**
5188 * \brief This function updates the lim global structure, if any of the
5189 * HT Capabilities have changed.
5190 *
5191 *
5192 * \param pMac Pointer to Global MAC structure
5193 *
5194 * \param pHTCapability Pointer to HT Capability Information Element
5195 * obtained from a Beacon or Probe Response
5196 *
5197 *
5198 *
5199 */
5200
5201void limUpdateStaRunTimeHTCapability( tpAniSirGlobal pMac,
5202 tDot11fIEHTCaps *pHTCaps )
5203{
5204
5205 if ( pMac->lim.gHTLsigTXOPProtection != ( tANI_U8 ) pHTCaps->lsigTXOPProtection )
5206 {
5207 pMac->lim.gHTLsigTXOPProtection = ( tANI_U8 ) pHTCaps->lsigTXOPProtection;
5208 // Send change notification to HAL
5209 }
5210
5211 if ( pMac->lim.gHTAMpduDensity != ( tANI_U8 ) pHTCaps->mpduDensity )
5212 {
5213 pMac->lim.gHTAMpduDensity = ( tANI_U8 ) pHTCaps->mpduDensity;
5214 // Send change notification to HAL
5215 }
5216
5217 if ( pMac->lim.gHTMaxRxAMpduFactor != ( tANI_U8 ) pHTCaps->maxRxAMPDUFactor )
5218 {
5219 pMac->lim.gHTMaxRxAMpduFactor = ( tANI_U8 ) pHTCaps->maxRxAMPDUFactor;
5220 // Send change notification to HAL
5221 }
5222
5223
5224} // End limUpdateStaRunTimeHTCapability.
5225
5226/**
5227 * \brief This function updates lim global structure, if any of the HT
5228 * Info Parameters have changed.
5229 *
5230 *
5231 * \param pMac Pointer to the global MAC structure
5232 *
5233 * \param pHTInfo Pointer to the HT Info IE obtained from a Beacon or
5234 * Probe Response
5235 *
5236 *
5237 */
5238
5239void limUpdateStaRunTimeHTInfo( tpAniSirGlobal pMac,
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305240 tDot11fIEHTInfo *pHTInfo, tpPESession psessionEntry)
Jeff Johnson295189b2012-06-20 16:38:30 -07005241{
Jeff Johnsone7245742012-09-05 17:12:55 -07005242 if ( psessionEntry->htRecommendedTxWidthSet != ( tANI_U8 )pHTInfo->recommendedTxWidthSet )
Jeff Johnson295189b2012-06-20 16:38:30 -07005243 {
Jeff Johnsone7245742012-09-05 17:12:55 -07005244 psessionEntry->htRecommendedTxWidthSet = ( tANI_U8 )pHTInfo->recommendedTxWidthSet;
Jeff Johnson295189b2012-06-20 16:38:30 -07005245 // Send change notification to HAL
5246 }
5247
5248 if ( psessionEntry->beaconParams.fRIFSMode != ( tANI_U8 )pHTInfo->rifsMode )
5249 {
5250 psessionEntry->beaconParams.fRIFSMode = ( tANI_U8 )pHTInfo->rifsMode;
5251 // Send change notification to HAL
5252 }
5253
5254 if ( pMac->lim.gHTServiceIntervalGranularity != ( tANI_U8 )pHTInfo->serviceIntervalGranularity )
5255 {
5256 pMac->lim.gHTServiceIntervalGranularity = ( tANI_U8 )pHTInfo->serviceIntervalGranularity;
5257 // Send change notification to HAL
5258 }
5259
5260 if ( pMac->lim.gHTOperMode != ( tSirMacHTOperatingMode )pHTInfo->opMode )
5261 {
5262 pMac->lim.gHTOperMode = ( tSirMacHTOperatingMode )pHTInfo->opMode;
5263 // Send change notification to HAL
5264 }
5265
5266 if ( psessionEntry->beaconParams.llnNonGFCoexist != pHTInfo->nonGFDevicesPresent )
5267 {
5268 psessionEntry->beaconParams.llnNonGFCoexist = ( tANI_U8 )pHTInfo->nonGFDevicesPresent;
5269 }
5270
5271 if ( pMac->lim.gHTSTBCBasicMCS != ( tANI_U8 )pHTInfo->basicSTBCMCS )
5272 {
5273 pMac->lim.gHTSTBCBasicMCS = ( tANI_U8 )pHTInfo->basicSTBCMCS;
5274 // Send change notification to HAL
5275 }
5276
5277 if ( pMac->lim.gHTDualCTSProtection != ( tANI_U8 )pHTInfo->dualCTSProtection )
5278 {
5279 pMac->lim.gHTDualCTSProtection = ( tANI_U8 )pHTInfo->dualCTSProtection;
5280 // Send change notification to HAL
5281 }
5282
5283 if ( pMac->lim.gHTSecondaryBeacon != ( tANI_U8 )pHTInfo->secondaryBeacon )
5284 {
5285 pMac->lim.gHTSecondaryBeacon = ( tANI_U8 )pHTInfo->secondaryBeacon;
5286 // Send change notification to HAL
5287 }
5288
5289 if ( psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport != ( tANI_U8 )pHTInfo->lsigTXOPProtectionFullSupport )
5290 {
5291 psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport = ( tANI_U8 )pHTInfo->lsigTXOPProtectionFullSupport;
5292 // Send change notification to HAL
5293 }
5294
5295 if ( pMac->lim.gHTPCOActive != ( tANI_U8 )pHTInfo->pcoActive )
5296 {
5297 pMac->lim.gHTPCOActive = ( tANI_U8 )pHTInfo->pcoActive;
5298 // Send change notification to HAL
5299 }
5300
5301 if ( pMac->lim.gHTPCOPhase != ( tANI_U8 )pHTInfo->pcoPhase )
5302 {
5303 pMac->lim.gHTPCOPhase = ( tANI_U8 )pHTInfo->pcoPhase;
5304 // Send change notification to HAL
5305 }
5306
5307} // End limUpdateStaRunTimeHTInfo.
5308
5309
5310/** -------------------------------------------------------------
5311\fn limProcessHalIndMessages
5312\brief callback function for HAL indication
5313\param tpAniSirGlobal pMac
5314\param tANI_U32 mesgId
5315\param void *mesgParam
5316\return tSirRetStatu - status
5317 -------------------------------------------------------------*/
5318
5319tSirRetStatus limProcessHalIndMessages(tpAniSirGlobal pMac, tANI_U32 msgId, void *msgParam )
5320{
5321 //its PE's responsibility to free msgparam when its done extracting the message parameters.
5322 tSirMsgQ msg;
5323
5324 switch(msgId)
5325 {
5326 case SIR_LIM_DEL_TS_IND:
5327 case SIR_LIM_ADD_BA_IND:
5328 case SIR_LIM_DEL_BA_ALL_IND:
5329 case SIR_LIM_DELETE_STA_CONTEXT_IND:
5330 case SIR_LIM_BEACON_GEN_IND:
5331 msg.type = (tANI_U16) msgId;
5332 msg.bodyptr = msgParam;
5333 msg.bodyval = 0;
5334 break;
5335
5336 default:
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305337 vos_mem_free(msgParam);
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005338 limLog(pMac, LOGP, FL("invalid message id = %d received"), msgId);
Jeff Johnson295189b2012-06-20 16:38:30 -07005339 return eSIR_FAILURE;
5340 }
5341
5342 if (limPostMsgApi(pMac, &msg) != eSIR_SUCCESS)
5343 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305344 vos_mem_free(msgParam);
Jeff Johnson295189b2012-06-20 16:38:30 -07005345 limLog(pMac, LOGP, FL("limPostMsgApi failed for msgid = %d"), msg.type);
5346 return eSIR_FAILURE;
5347 }
5348 return eSIR_SUCCESS;
5349}
5350
5351/** -------------------------------------------------------------
5352\fn limValidateDeltsReq
5353\brief Validates DelTs req originated by SME or by HAL and also sends halMsg_DelTs to HAL
5354\param tpAniSirGlobal pMac
5355\param tpSirDeltsReq pDeltsReq
5356\param tSirMacAddr peerMacAddr
5357\return eSirRetStatus - status
5358 -------------------------------------------------------------*/
5359
5360tSirRetStatus
5361limValidateDeltsReq(tpAniSirGlobal pMac, tpSirDeltsReq pDeltsReq, tSirMacAddr peerMacAddr,tpPESession psessionEntry)
5362{
5363 tpDphHashNode pSta;
5364 tANI_U8 tsStatus;
5365 tSirMacTSInfo *tsinfo;
5366 tANI_U32 i;
5367 tANI_U8 tspecIdx;
5368 /* if sta
5369 * - verify assoc state
5370 * - del tspec locally
5371 * if ap,
5372 * - verify sta is in assoc state
5373 * - del sta tspec locally
5374 */
5375 if(pDeltsReq == NULL)
5376 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005377 PELOGE(limLog(pMac, LOGE, FL("Delete TS request pointer is NULL"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005378 return eSIR_FAILURE;
5379 }
5380
5381 if ((psessionEntry->limSystemRole == eLIM_STA_ROLE)||(psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE))
5382 {
5383 tANI_U32 val;
5384
5385 // station always talks to the AP
5386 pSta = dphGetHashEntry(pMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable);
5387
5388 val = sizeof(tSirMacAddr);
5389 #if 0
5390 if (wlan_cfgGetStr(pMac, WNI_CFG_BSSID, peerMacAddr, &val) != eSIR_SUCCESS)
5391 {
5392 /// Could not get BSSID from CFG. Log error.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005393 limLog(pMac, LOGP, FL("could not retrieve BSSID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07005394 return eSIR_FAILURE;
5395 }
5396 #endif// TO SUPPORT BT-AMP
5397 sirCopyMacAddr(peerMacAddr,psessionEntry->bssId);
5398
5399 }
5400 else
5401 {
5402 tANI_U16 assocId;
5403 tANI_U8 *macaddr = (tANI_U8 *) peerMacAddr;
5404
5405 assocId = pDeltsReq->aid;
5406 if (assocId != 0)
5407 pSta = dphGetHashEntry(pMac, assocId, &psessionEntry->dph.dphHashTable);
5408 else
5409 pSta = dphLookupHashEntry(pMac, pDeltsReq->macAddr, &assocId, &psessionEntry->dph.dphHashTable);
5410
5411 if (pSta != NULL)
5412 // TBD: check sta assoc state as well
5413 for (i =0; i < sizeof(tSirMacAddr); i++)
5414 macaddr[i] = pSta->staAddr[i];
5415 }
5416
5417 if (pSta == NULL)
5418 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005419 PELOGE(limLog(pMac, LOGE, "Cannot find station context for delts req");)
Jeff Johnson295189b2012-06-20 16:38:30 -07005420 return eSIR_FAILURE;
5421 }
5422
5423 if ((! pSta->valid) ||
5424 (pSta->mlmStaContext.mlmState != eLIM_MLM_LINK_ESTABLISHED_STATE))
5425 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005426 PELOGE(limLog(pMac, LOGE, "Invalid Sta (or state) for DelTsReq");)
Jeff Johnson295189b2012-06-20 16:38:30 -07005427 return eSIR_FAILURE;
5428 }
5429
5430 pDeltsReq->req.wsmTspecPresent = 0;
5431 pDeltsReq->req.wmeTspecPresent = 0;
5432 pDeltsReq->req.lleTspecPresent = 0;
5433
5434 if ((pSta->wsmEnabled) &&
5435 (pDeltsReq->req.tspec.tsinfo.traffic.accessPolicy != SIR_MAC_ACCESSPOLICY_EDCA))
5436 pDeltsReq->req.wsmTspecPresent = 1;
5437 else if (pSta->wmeEnabled)
5438 pDeltsReq->req.wmeTspecPresent = 1;
5439 else if (pSta->lleEnabled)
5440 pDeltsReq->req.lleTspecPresent = 1;
5441 else
5442 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005443 PELOGW(limLog(pMac, LOGW, FL("DELTS_REQ ignore - qos is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005444 return eSIR_FAILURE;
5445 }
5446
5447 tsinfo = pDeltsReq->req.wmeTspecPresent ? &pDeltsReq->req.tspec.tsinfo
5448 : &pDeltsReq->req.tsinfo;
5449 PELOG1(limLog(pMac, LOG1,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005450 FL("received DELTS_REQ message (wmeTspecPresent = %d, lleTspecPresent = %d, wsmTspecPresent = %d, tsid %d, up %d, direction = %d)"),
Jeff Johnson295189b2012-06-20 16:38:30 -07005451 pDeltsReq->req.wmeTspecPresent, pDeltsReq->req.lleTspecPresent, pDeltsReq->req.wsmTspecPresent,
5452 tsinfo->traffic.tsid, tsinfo->traffic.userPrio, tsinfo->traffic.direction);)
5453
5454 // if no Access Control, ignore the request
Jeff Johnson295189b2012-06-20 16:38:30 -07005455
5456 if (limAdmitControlDeleteTS(pMac, pSta->assocId, tsinfo, &tsStatus, &tspecIdx)
5457 != eSIR_SUCCESS)
5458 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005459 PELOGE(limLog(pMac, LOGE, "ERROR DELTS request for sta assocId %d (tsid %d, up %d)",
Jeff Johnson295189b2012-06-20 16:38:30 -07005460 pSta->assocId, tsinfo->traffic.tsid, tsinfo->traffic.userPrio);)
5461 return eSIR_FAILURE;
5462 }
5463 else if ((tsinfo->traffic.accessPolicy == SIR_MAC_ACCESSPOLICY_HCCA) ||
5464 (tsinfo->traffic.accessPolicy == SIR_MAC_ACCESSPOLICY_BOTH))
5465 {
5466 //edca only now.
5467 }
5468 else
5469 {
5470 if((tsinfo->traffic.accessPolicy == SIR_MAC_ACCESSPOLICY_EDCA) &&
5471 psessionEntry->gLimEdcaParams[upToAc(tsinfo->traffic.userPrio)].aci.acm)
5472 {
5473 //send message to HAL to delete TS
Madan Mohan Koyyalamudic0a75a42013-10-07 04:20:49 +05305474 if(eSIR_SUCCESS != limSendHalMsgDelTs(pMac,
5475 pSta->staIndex,
5476 tspecIdx,
5477 pDeltsReq->req,
5478 psessionEntry->peSessionId,
5479 psessionEntry->bssId))
Jeff Johnson295189b2012-06-20 16:38:30 -07005480 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005481 limLog(pMac, LOGW, FL("DelTs with UP %d failed in limSendHalMsgDelTs - ignoring request"),
Jeff Johnson295189b2012-06-20 16:38:30 -07005482 tsinfo->traffic.userPrio);
5483 return eSIR_FAILURE;
5484 }
5485 }
5486 }
5487 return eSIR_SUCCESS;
5488}
5489
5490/** -------------------------------------------------------------
5491\fn limRegisterHalIndCallBack
5492\brief registers callback function to HAL for any indication.
5493\param tpAniSirGlobal pMac
5494\return none.
5495 -------------------------------------------------------------*/
5496void
5497limRegisterHalIndCallBack(tpAniSirGlobal pMac)
5498{
5499 tSirMsgQ msg;
5500 tpHalIndCB pHalCB;
5501
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305502 pHalCB = vos_mem_malloc(sizeof(tHalIndCB));
5503 if ( NULL == pHalCB )
Jeff Johnson295189b2012-06-20 16:38:30 -07005504 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305505 limLog(pMac, LOGP, FL("AllocateMemory() failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07005506 return;
5507 }
5508
5509 pHalCB->pHalIndCB = limProcessHalIndMessages;
5510
5511 msg.type = WDA_REGISTER_PE_CALLBACK;
5512 msg.bodyptr = pHalCB;
5513 msg.bodyval = 0;
5514
Jeff Johnsone7245742012-09-05 17:12:55 -07005515 MTRACE(macTraceMsgTx(pMac, NO_SESSION, msg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07005516 if(eSIR_SUCCESS != wdaPostCtrlMsg(pMac, &msg))
5517 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305518 vos_mem_free(pHalCB);
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005519 limLog(pMac, LOGP, FL("wdaPostCtrlMsg() failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07005520 }
5521
5522 return;
5523}
5524
5525
5526/** -------------------------------------------------------------
5527\fn limProcessAddBaInd
5528
5529\brief handles the BA activity check timeout indication coming from HAL.
5530 Validates the request, posts request for sending addBaReq message for every candidate in the list.
5531\param tpAniSirGlobal pMac
5532\param tSirMsgQ limMsg
5533\return None
5534-------------------------------------------------------------*/
5535void
5536limProcessAddBaInd(tpAniSirGlobal pMac, tpSirMsgQ limMsg)
5537{
5538 tANI_U8 i;
5539 tANI_U8 tid;
5540 tANI_U16 assocId;
5541 tpDphHashNode pSta;
5542 tpAddBaCandidate pBaCandidate;
5543 tANI_U32 baCandidateCnt;
5544 tpBaActivityInd pBaActivityInd;
5545 tpPESession psessionEntry;
5546 tANI_U8 sessionId;
Gopichand Nakkala681989c2013-03-06 22:27:48 -08005547#ifdef FEATURE_WLAN_TDLS
5548 boolean htCapable = FALSE;
5549#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07005550
5551
Gopichand Nakkala681989c2013-03-06 22:27:48 -08005552 if (limMsg->bodyptr == NULL)
Jeff Johnson295189b2012-06-20 16:38:30 -07005553 return;
5554
5555 pBaActivityInd = (tpBaActivityInd)limMsg->bodyptr;
5556 baCandidateCnt = pBaActivityInd->baCandidateCnt;
5557
Gopichand Nakkala681989c2013-03-06 22:27:48 -08005558 if ((psessionEntry = peFindSessionByBssid(pMac,pBaActivityInd->bssId,&sessionId))== NULL)
Jeff Johnson295189b2012-06-20 16:38:30 -07005559 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005560 limLog(pMac, LOGE,FL("session does not exist for given BSSId"));
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305561 vos_mem_free(limMsg->bodyptr);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08005562 limMsg->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07005563 return;
5564 }
5565
5566 //if we are not HT capable we don't need to handle BA timeout indication from HAL.
Gopichand Nakkala681989c2013-03-06 22:27:48 -08005567#ifdef FEATURE_WLAN_TDLS
5568 if ((baCandidateCnt > pMac->lim.maxStation))
5569#else
5570 if ((baCandidateCnt > pMac->lim.maxStation) || !psessionEntry->htCapability )
5571#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07005572 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305573 vos_mem_free(limMsg->bodyptr);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08005574 limMsg->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07005575 return;
5576 }
Gopichand Nakkala681989c2013-03-06 22:27:48 -08005577
5578#ifdef FEATURE_WLAN_TDLS
5579 //if we have TDLS peers, we should look at peers HT capability, which can be different than
5580 //AP capability
5581 pBaCandidate = (tpAddBaCandidate) (((tANI_U8*)pBaActivityInd) + sizeof(tBaActivityInd));
5582
5583 for (i=0; i<baCandidateCnt; i++, pBaCandidate++)
5584 {
5585 pSta = dphLookupHashEntry(pMac, pBaCandidate->staAddr, &assocId, &psessionEntry->dph.dphHashTable);
5586 if ((NULL == pSta) || (!pSta->valid))
5587 continue;
5588
5589 if (STA_ENTRY_TDLS_PEER == pSta->staType)
5590 htCapable = pSta->mlmStaContext.htCapability;
5591 else
5592 htCapable = psessionEntry->htCapability;
5593
5594 if (htCapable)
5595 break;
5596 }
5597 if (!htCapable)
5598 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305599 vos_mem_free(limMsg->bodyptr);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08005600 limMsg->bodyptr = NULL;
Gopichand Nakkala681989c2013-03-06 22:27:48 -08005601 return;
5602 }
5603#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07005604
5605 //delete the complete dialoguetoken linked list
5606 limDeleteDialogueTokenList(pMac);
5607 pBaCandidate = (tpAddBaCandidate) (((tANI_U8*)pBaActivityInd) + sizeof(tBaActivityInd));
5608
Gopichand Nakkala681989c2013-03-06 22:27:48 -08005609 for (i=0; i<baCandidateCnt; i++, pBaCandidate++)
Jeff Johnson295189b2012-06-20 16:38:30 -07005610 {
5611 pSta = dphLookupHashEntry(pMac, pBaCandidate->staAddr, &assocId, &psessionEntry->dph.dphHashTable);
Gopichand Nakkala681989c2013-03-06 22:27:48 -08005612 if ((NULL == pSta) || (!pSta->valid))
5613 continue;
Jeff Johnson295189b2012-06-20 16:38:30 -07005614
5615 for (tid=0; tid<STACFG_MAX_TC; tid++)
5616 {
Gopichand Nakkala681989c2013-03-06 22:27:48 -08005617 if((eBA_DISABLE == pSta->tcCfg[tid].fUseBATx) &&
Jeff Johnson295189b2012-06-20 16:38:30 -07005618 (pBaCandidate->baInfo[tid].fBaEnable))
5619 {
Hoonki Lee9af07cf2013-04-24 01:21:58 -07005620 limLog(pMac, LOGE, FL("BA setup for staId = %d, TID: %d, SSN: %d"),
5621 pSta->staIndex, tid, pBaCandidate->baInfo[tid].startingSeqNum);
Jeff Johnson295189b2012-06-20 16:38:30 -07005622 limPostMlmAddBAReq(pMac, pSta, tid, pBaCandidate->baInfo[tid].startingSeqNum,psessionEntry);
5623 }
5624 }
5625 }
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305626 vos_mem_free(limMsg->bodyptr);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08005627 limMsg->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07005628 return;
5629}
5630
5631
5632/** -------------------------------------------------------------
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005633\fn limDeleteBASessions
5634\brief Deletes all the exisitng BA sessions for given session
5635 and BA direction.
Jeff Johnson295189b2012-06-20 16:38:30 -07005636\param tpAniSirGlobal pMac
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005637\param tpPESession pSessionEntry
5638\param tANI_U32 baDirection
5639\return None
Jeff Johnson295189b2012-06-20 16:38:30 -07005640-------------------------------------------------------------*/
5641
5642void
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005643limDeleteBASessions(tpAniSirGlobal pMac, tpPESession pSessionEntry,
5644 tANI_U32 baDirection)
Jeff Johnson295189b2012-06-20 16:38:30 -07005645{
5646 tANI_U32 i;
5647 tANI_U8 tid;
5648 tpDphHashNode pSta;
5649
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005650 if (NULL == pSessionEntry)
Jeff Johnson295189b2012-06-20 16:38:30 -07005651 {
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005652 limLog(pMac, LOGE, FL("Session does not exist"));
5653 }
5654 else
5655 {
5656 for(tid = 0; tid < STACFG_MAX_TC; tid++)
Jeff Johnson295189b2012-06-20 16:38:30 -07005657 {
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005658 if ((eLIM_AP_ROLE == pSessionEntry->limSystemRole) ||
5659 (pSessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE) ||
5660 (eLIM_STA_IN_IBSS_ROLE == pSessionEntry->limSystemRole) ||
5661 (pSessionEntry->limSystemRole == eLIM_P2P_DEVICE_GO))
Jeff Johnson295189b2012-06-20 16:38:30 -07005662 {
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005663 for (i = 0; i < pMac->lim.maxStation; i++)
Jeff Johnson295189b2012-06-20 16:38:30 -07005664 {
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005665 pSta = pSessionEntry->dph.dphHashTable.pDphNodeArray + i;
5666 if (pSta && pSta->added)
Kiran Kumar Lokerec1641f52013-05-29 14:29:43 -07005667 {
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005668 if ((eBA_ENABLE == pSta->tcCfg[tid].fUseBATx) &&
5669 (baDirection & BA_INITIATOR))
5670 {
5671 limPostMlmDelBAReq(pMac, pSta, eBA_INITIATOR, tid,
5672 eSIR_MAC_UNSPEC_FAILURE_REASON,
5673 pSessionEntry);
5674 }
5675 if ((eBA_ENABLE == pSta->tcCfg[tid].fUseBARx) &&
5676 (baDirection & BA_RECIPIENT))
5677 {
5678 limPostMlmDelBAReq(pMac, pSta, eBA_RECIPIENT, tid,
5679 eSIR_MAC_UNSPEC_FAILURE_REASON,
5680 pSessionEntry);
5681 }
Kiran Kumar Lokerec1641f52013-05-29 14:29:43 -07005682 }
Jeff Johnson295189b2012-06-20 16:38:30 -07005683 }
5684 }
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005685 else if ((eLIM_STA_ROLE == pSessionEntry->limSystemRole) ||
5686 (eLIM_BT_AMP_STA_ROLE == pSessionEntry->limSystemRole) ||
5687 (eLIM_P2P_DEVICE_ROLE == pSessionEntry->limSystemRole))
Gopichand Nakkala6a36e142013-06-07 21:23:15 -07005688 {
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005689 pSta = dphGetHashEntry(pMac, DPH_STA_HASH_INDEX_PEER,
5690 &pSessionEntry->dph.dphHashTable);
5691 if (pSta && pSta->added)
Gopichand Nakkala6a36e142013-06-07 21:23:15 -07005692 {
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005693 if ((eBA_ENABLE == pSta->tcCfg[tid].fUseBATx) &&
5694 (baDirection & BA_INITIATOR))
5695 {
5696 limPostMlmDelBAReq(pMac, pSta, eBA_INITIATOR, tid,
5697 eSIR_MAC_UNSPEC_FAILURE_REASON,
5698 pSessionEntry);
5699 }
5700 if ((eBA_ENABLE == pSta->tcCfg[tid].fUseBARx) &&
5701 (baDirection & BA_RECIPIENT))
5702 {
5703 limPostMlmDelBAReq(pMac, pSta, eBA_RECIPIENT, tid,
5704 eSIR_MAC_UNSPEC_FAILURE_REASON,
5705 pSessionEntry);
5706 }
Gopichand Nakkala6a36e142013-06-07 21:23:15 -07005707 }
5708 }
5709 }
Jeff Johnson295189b2012-06-20 16:38:30 -07005710 }
5711}
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005712
5713/** -------------------------------------------------------------
5714\fn limDelAllBASessions
5715\brief Deletes all the exisitng BA sessions.
5716\param tpAniSirGlobal pMac
5717\return None
5718-------------------------------------------------------------*/
5719
5720void limDelAllBASessions(tpAniSirGlobal pMac)
5721{
5722 tANI_U32 i;
5723 tpPESession pSessionEntry;
5724
5725 for (i = 0; i < pMac->lim.maxBssId; i++)
5726 {
5727 pSessionEntry = peFindSessionBySessionId(pMac, i);
5728 if (pSessionEntry)
5729 {
5730 limDeleteBASessions(pMac, pSessionEntry, BA_BOTH_DIRECTIONS);
5731 }
5732 }
5733}
5734
5735/** -------------------------------------------------------------
5736\fn limDelAllBASessionsBtc
5737\brief Deletes all the exisitng BA receipent sessions in 2.4GHz
5738 band.
5739\param tpAniSirGlobal pMac
5740\return None
5741-------------------------------------------------------------*/
5742
Leela Venkata Kiran Kumar Reddy Chiralab8dadc22013-11-05 12:34:32 -08005743void limDelPerBssBASessionsBtc(tpAniSirGlobal pMac)
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005744{
Leela Venkata Kiran Kumar Reddy Chiralab8dadc22013-11-05 12:34:32 -08005745 tANI_U8 sessionId;
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005746 tpPESession pSessionEntry;
Leela Venkata Kiran Kumar Reddy Chiralab8dadc22013-11-05 12:34:32 -08005747 pSessionEntry = peFindSessionByBssid(pMac,pMac->btc.btcBssfordisableaggr,
5748 &sessionId);
5749 if (pSessionEntry)
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005750 {
Leela Venkata Kiran Kumar Reddy Chiralab8dadc22013-11-05 12:34:32 -08005751 PELOGW(limLog(pMac, LOGW,
5752 "Deleting the BA for session %d as host got BTC event", sessionId);)
5753 limDeleteBASessions(pMac, pSessionEntry, BA_RECIPIENT);
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005754 }
5755}
5756
Jeff Johnson295189b2012-06-20 16:38:30 -07005757/** -------------------------------------------------------------
5758\fn limProcessDelTsInd
5759\brief handles the DeleteTS indication coming from HAL or generated by PE itself in some error cases.
5760 Validates the request, sends the DelTs action frame to the Peer and sends DelTs indicatoin to HDD.
5761\param tpAniSirGlobal pMac
5762\param tSirMsgQ limMsg
5763\return None
5764-------------------------------------------------------------*/
5765void
5766limProcessDelTsInd(tpAniSirGlobal pMac, tpSirMsgQ limMsg)
5767{
5768 tpDphHashNode pSta;
5769 tpDelTsParams pDelTsParam = (tpDelTsParams) (limMsg->bodyptr);
5770 tpSirDeltsReq pDelTsReq = NULL;
5771 tSirMacAddr peerMacAddr;
5772 tpSirDeltsReqInfo pDelTsReqInfo;
5773 tpLimTspecInfo pTspecInfo;
5774 tpPESession psessionEntry;
5775 tANI_U8 sessionId;
5776
5777if((psessionEntry = peFindSessionByBssid(pMac,pDelTsParam->bssId,&sessionId))== NULL)
5778 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005779 limLog(pMac, LOGE,FL("session does not exist for given BssId"));
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305780 vos_mem_free(limMsg->bodyptr);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08005781 limMsg->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07005782 return;
5783 }
5784
5785 pTspecInfo = &(pMac->lim.tspecInfo[pDelTsParam->tspecIdx]);
5786 if(pTspecInfo->inuse == false)
5787 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005788 PELOGE(limLog(pMac, LOGE, FL("tspec entry with index %d is not in use"), pDelTsParam->tspecIdx);)
Jeff Johnson295189b2012-06-20 16:38:30 -07005789 goto error1;
5790 }
5791
5792 pSta = dphGetHashEntry(pMac, pTspecInfo->assocId, &psessionEntry->dph.dphHashTable);
5793 if(pSta == NULL)
5794 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005795 limLog(pMac, LOGE, FL("Could not find entry in DPH table for assocId = %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07005796 pTspecInfo->assocId);
5797 goto error1;
5798 }
5799
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305800 pDelTsReq = vos_mem_malloc(sizeof(tSirDeltsReq));
5801 if ( NULL == pDelTsReq )
Jeff Johnson295189b2012-06-20 16:38:30 -07005802 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305803 PELOGE(limLog(pMac, LOGE, FL("AllocateMemory() failed"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005804 goto error1;
5805 }
5806
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305807 vos_mem_set( (tANI_U8 *)pDelTsReq, sizeof(tSirDeltsReq), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07005808
5809 if(pSta->wmeEnabled)
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305810 vos_mem_copy( &(pDelTsReq->req.tspec), &(pTspecInfo->tspec), sizeof(tSirMacTspecIE));
Jeff Johnson295189b2012-06-20 16:38:30 -07005811 else
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305812 vos_mem_copy( &(pDelTsReq->req.tsinfo), &(pTspecInfo->tspec.tsinfo), sizeof(tSirMacTSInfo));
Jeff Johnson295189b2012-06-20 16:38:30 -07005813
5814
5815 //validate the req
5816 if (eSIR_SUCCESS != limValidateDeltsReq(pMac, pDelTsReq, peerMacAddr,psessionEntry))
5817 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005818 PELOGE(limLog(pMac, LOGE, FL("limValidateDeltsReq failed"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005819 goto error2;
5820 }
Arif Hussaina7c8e412013-11-20 11:06:42 -08005821 PELOG1(limLog(pMac, LOG1, "Sent DELTS request to station with "
5822 "assocId = %d MacAddr = "MAC_ADDRESS_STR,
5823 pDelTsReq->aid, MAC_ADDR_ARRAY(peerMacAddr));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005824
5825 limSendDeltsReqActionFrame(pMac, peerMacAddr, pDelTsReq->req.wmeTspecPresent, &pDelTsReq->req.tsinfo, &pDelTsReq->req.tspec,
5826 psessionEntry);
5827
5828 // prepare and send an sme indication to HDD
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305829 pDelTsReqInfo = vos_mem_malloc(sizeof(tSirDeltsReqInfo));
5830 if ( NULL == pDelTsReqInfo )
Jeff Johnson295189b2012-06-20 16:38:30 -07005831 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305832 PELOGE(limLog(pMac, LOGE, FL("AllocateMemory() failed"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005833 goto error3;
5834 }
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305835 vos_mem_set( (tANI_U8 *)pDelTsReqInfo, sizeof(tSirDeltsReqInfo), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07005836
5837 if(pSta->wmeEnabled)
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305838 vos_mem_copy( &(pDelTsReqInfo->tspec), &(pTspecInfo->tspec), sizeof(tSirMacTspecIE));
Jeff Johnson295189b2012-06-20 16:38:30 -07005839 else
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305840 vos_mem_copy( &(pDelTsReqInfo->tsinfo), &(pTspecInfo->tspec.tsinfo), sizeof(tSirMacTSInfo));
Jeff Johnson295189b2012-06-20 16:38:30 -07005841
5842 limSendSmeDeltsInd(pMac, pDelTsReqInfo, pDelTsReq->aid,psessionEntry);
5843
5844error3:
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305845 vos_mem_free(pDelTsReqInfo);
Jeff Johnson295189b2012-06-20 16:38:30 -07005846error2:
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305847 vos_mem_free(pDelTsReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07005848error1:
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305849 vos_mem_free(limMsg->bodyptr);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08005850 limMsg->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07005851 return;
5852}
5853
5854/**
5855 * \brief Setup an A-MPDU/BA session
5856 *
5857 * \sa limPostMlmAddBAReq
5858 *
5859 * \param pMac The global tpAniSirGlobal object
5860 *
5861 * \param pStaDs DPH Hash Node object of peer STA
5862 *
5863 * \param tid TID for which a BA is being setup.
5864 * If this is set to 0xFFFF, then we retrieve
5865 * the default TID from the CFG
5866 *
5867 * \return eSIR_SUCCESS if setup completes successfully
5868 * eSIR_FAILURE is some problem is encountered
5869 */
5870tSirRetStatus limPostMlmAddBAReq( tpAniSirGlobal pMac,
5871 tpDphHashNode pStaDs,
5872 tANI_U8 tid, tANI_U16 startingSeqNum,tpPESession psessionEntry)
5873{
5874 tSirRetStatus status = eSIR_SUCCESS;
Jeff Johnson09fb4cd2013-04-03 15:27:59 -07005875 tpLimMlmAddBAReq pMlmAddBAReq = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07005876 tpDialogueToken dialogueTokenNode;
5877 tANI_U32 val = 0;
Jeff Johnson09fb4cd2013-04-03 15:27:59 -07005878
Jeff Johnson295189b2012-06-20 16:38:30 -07005879 // Check if the peer is a 11n capable STA
5880 // FIXME - Need a 11n peer indication in DPH.
5881 // For now, using the taurusPeer attribute
5882 //if( 0 == pStaDs->taurusPeer == )
5883 //return eSIR_SUCCESS;
5884
5885 // Allocate for LIM_MLM_ADDBA_REQ
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305886 pMlmAddBAReq = vos_mem_malloc(sizeof( tLimMlmAddBAReq ));
5887 if ( NULL == pMlmAddBAReq )
Jeff Johnson295189b2012-06-20 16:38:30 -07005888 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305889 limLog( pMac, LOGP, FL("AllocateMemory failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07005890 status = eSIR_MEM_ALLOC_FAILED;
5891 goto returnFailure;
5892 }
5893
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305894 vos_mem_set( (void *) pMlmAddBAReq, sizeof( tLimMlmAddBAReq ), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07005895
5896 // Copy the peer MAC
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305897 vos_mem_copy(
Jeff Johnson295189b2012-06-20 16:38:30 -07005898 pMlmAddBAReq->peerMacAddr,
5899 pStaDs->staAddr,
5900 sizeof( tSirMacAddr ));
5901
5902 // Update the TID
5903 pMlmAddBAReq->baTID = tid;
5904
5905 // Determine the supported BA policy of local STA
5906 // for the TID of interest
5907 pMlmAddBAReq->baPolicy = (pStaDs->baPolicyFlag >> tid) & 0x1;
5908
5909 // BA Buffer Size
5910 // Requesting the ADDBA recipient to populate the size.
5911 // If ADDBA is accepted, a non-zero buffer size should
5912 // be returned in the ADDBA Rsp
Agarwal Ashish87039eb2014-01-15 14:13:15 +05305913 if ((TRUE == psessionEntry->isCiscoVendorAP) &&
5914 (eHT_CHANNEL_WIDTH_80MHZ != pStaDs->htSupportedChannelWidthSet))
5915 {
5916 /* Cisco AP has issues in receiving more than 25 "mpdu in ampdu"
5917 causing very low throughput in HT40 case */
5918 limLog( pMac, LOGW,
5919 FL( "Requesting ADDBA with Cisco 1225 AP, window size 25"));
5920 pMlmAddBAReq->baBufferSize = MAX_BA_WINDOW_SIZE_FOR_CISCO;
5921 }
5922 else
5923 pMlmAddBAReq->baBufferSize = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07005924
5925 limLog( pMac, LOGW,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005926 FL( "Requesting an ADDBA to setup a %s BA session with STA %d for TID %d" ),
Jeff Johnson295189b2012-06-20 16:38:30 -07005927 (pMlmAddBAReq->baPolicy ? "Immediate": "Delayed"),
5928 pStaDs->staIndex,
5929 tid );
5930
5931 // BA Timeout
Jeff Johnson09fb4cd2013-04-03 15:27:59 -07005932 if (wlan_cfgGetInt(pMac, WNI_CFG_BA_TIMEOUT, &val) != eSIR_SUCCESS)
Jeff Johnson295189b2012-06-20 16:38:30 -07005933 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005934 limLog(pMac, LOGE, FL("could not retrieve BA TIME OUT Param CFG"));
Jeff Johnson295189b2012-06-20 16:38:30 -07005935 status = eSIR_FAILURE;
5936 goto returnFailure;
5937 }
5938 pMlmAddBAReq->baTimeout = val; // In TU's
5939
5940 // ADDBA Failure Timeout
Jeff Johnson09fb4cd2013-04-03 15:27:59 -07005941 // FIXME_AMPDU - Need to retrieve this from CFG.
Jeff Johnson295189b2012-06-20 16:38:30 -07005942 //right now we are not checking for response timeout. so this field is dummy just to be compliant with the spec.
5943 pMlmAddBAReq->addBAFailureTimeout = 2000; // In TU's
5944
5945 // BA Starting Sequence Number
5946 pMlmAddBAReq->baSSN = startingSeqNum;
5947
5948 /* Update PE session Id*/
5949 pMlmAddBAReq->sessionId = psessionEntry->peSessionId;
5950
5951 LIM_SET_STA_BA_STATE(pStaDs, tid, eLIM_BA_STATE_WT_ADD_RSP);
5952
Jeff Johnson09fb4cd2013-04-03 15:27:59 -07005953 dialogueTokenNode = limAssignDialogueToken(pMac);
5954 if (NULL == dialogueTokenNode)
5955 {
5956 limLog(pMac, LOGE, FL("could not assign dialogue token"));
5957 status = eSIR_FAILURE;
5958 goto returnFailure;
5959 }
5960
Jeff Johnson295189b2012-06-20 16:38:30 -07005961 pMlmAddBAReq->baDialogToken = dialogueTokenNode->token;
Jeff Johnson09fb4cd2013-04-03 15:27:59 -07005962 //set assocId and tid information in the lim linked list
Jeff Johnson295189b2012-06-20 16:38:30 -07005963 dialogueTokenNode->assocId = pStaDs->assocId;
5964 dialogueTokenNode->tid = tid;
5965 // Send ADDBA Req to MLME
5966 limPostMlmMessage( pMac,
5967 LIM_MLM_ADDBA_REQ,
5968 (tANI_U32 *) pMlmAddBAReq );
Jeff Johnson09fb4cd2013-04-03 15:27:59 -07005969 return eSIR_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -07005970
5971returnFailure:
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305972 vos_mem_free(pMlmAddBAReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07005973 return status;
5974}
5975
5976/**
5977 * \brief Post LIM_MLM_ADDBA_RSP to MLME. MLME
5978 * will then send an ADDBA Rsp to peer MAC entity
5979 * with the appropriate ADDBA status code
5980 *
5981 * \sa limPostMlmAddBARsp
5982 *
5983 * \param pMac The global tpAniSirGlobal object
5984 *
5985 * \param peerMacAddr MAC address of peer entity that will
5986 * be the recipient of this ADDBA Rsp
5987 *
5988 * \param baStatusCode ADDBA Rsp status code
5989 *
5990 * \param baDialogToken ADDBA Rsp dialog token
5991 *
5992 * \param baTID TID of interest
5993 *
5994 * \param baPolicy The BA policy
5995 *
5996 * \param baBufferSize The BA buffer size
5997 *
5998 * \param baTimeout BA timeout in TU's
5999 *
6000 * \return eSIR_SUCCESS if setup completes successfully
6001 * eSIR_FAILURE is some problem is encountered
6002 */
6003tSirRetStatus limPostMlmAddBARsp( tpAniSirGlobal pMac,
6004 tSirMacAddr peerMacAddr,
6005 tSirMacStatusCodes baStatusCode,
6006 tANI_U8 baDialogToken,
6007 tANI_U8 baTID,
6008 tANI_U8 baPolicy,
6009 tANI_U16 baBufferSize,
6010 tANI_U16 baTimeout,
6011 tpPESession psessionEntry)
6012{
6013tSirRetStatus status = eSIR_SUCCESS;
6014tpLimMlmAddBARsp pMlmAddBARsp;
6015
6016 // Allocate for LIM_MLM_ADDBA_RSP
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306017 pMlmAddBARsp = vos_mem_malloc(sizeof( tLimMlmAddBARsp ));
6018 if ( NULL == pMlmAddBARsp )
Jeff Johnson295189b2012-06-20 16:38:30 -07006019 {
6020 limLog( pMac, LOGE,
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306021 FL("AllocateMemory failed with error code %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07006022 status );
6023
6024 status = eSIR_MEM_ALLOC_FAILED;
6025 goto returnFailure;
6026 }
6027
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306028 vos_mem_set( (void *) pMlmAddBARsp, sizeof( tLimMlmAddBARsp ), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07006029
6030 // Copy the peer MAC
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306031 vos_mem_copy(
Jeff Johnson295189b2012-06-20 16:38:30 -07006032 pMlmAddBARsp->peerMacAddr,
6033 peerMacAddr,
6034 sizeof( tSirMacAddr ));
6035
6036 pMlmAddBARsp->baDialogToken = baDialogToken;
6037 pMlmAddBARsp->addBAResultCode = baStatusCode;
6038 pMlmAddBARsp->baTID = baTID;
6039 pMlmAddBARsp->baPolicy = baPolicy;
6040 pMlmAddBARsp->baBufferSize = baBufferSize;
6041 pMlmAddBARsp->baTimeout = baTimeout;
6042
6043 /* UPdate PE session ID*/
6044 pMlmAddBARsp->sessionId = psessionEntry->peSessionId;
6045
6046 // Send ADDBA Rsp to MLME
6047 limPostMlmMessage( pMac,
6048 LIM_MLM_ADDBA_RSP,
6049 (tANI_U32 *) pMlmAddBARsp );
6050
6051returnFailure:
6052
6053 return status;
6054}
6055
6056/**
6057 * \brief Post LIM_MLM_DELBA_REQ to MLME. MLME
6058 * will then send an DELBA Ind to peer MAC entity
6059 * with the appropriate DELBA status code
6060 *
6061 * \sa limPostMlmDelBAReq
6062 *
6063 * \param pMac The global tpAniSirGlobal object
6064 *
6065 * \param pSta DPH Hash Node object of peer MAC entity
6066 * for which the BA session is being deleted
6067 *
6068 * \param baDirection DELBA direction
6069 *
6070 * \param baTID TID for which the BA session is being deleted
6071 *
6072 * \param baReasonCode DELBA Req reason code
6073 *
6074 * \return eSIR_SUCCESS if setup completes successfully
6075 * eSIR_FAILURE is some problem is encountered
6076 */
6077tSirRetStatus limPostMlmDelBAReq( tpAniSirGlobal pMac,
6078 tpDphHashNode pSta,
6079 tANI_U8 baDirection,
6080 tANI_U8 baTID,
6081 tSirMacReasonCodes baReasonCode,
6082 tpPESession psessionEntry)
6083{
6084tSirRetStatus status = eSIR_SUCCESS;
6085tpLimMlmDelBAReq pMlmDelBAReq;
6086tLimBAState curBaState;
6087
6088if(NULL == pSta)
6089 return eSIR_FAILURE;
6090
6091LIM_GET_STA_BA_STATE(pSta, baTID, &curBaState);
6092
6093 // Need to validate the current BA State.
6094 if( eLIM_BA_STATE_IDLE != curBaState)
6095 {
6096 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006097 FL( "Received unexpected DELBA REQ when STA BA state for tid = %d is %d" ),
Jeff Johnson295189b2012-06-20 16:38:30 -07006098 baTID,
6099 curBaState);
6100
6101 status = eSIR_FAILURE;
6102 goto returnFailure;
6103 }
6104
6105 // Allocate for LIM_MLM_DELBA_REQ
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306106 pMlmDelBAReq = vos_mem_malloc(sizeof( tLimMlmDelBAReq ));
6107 if ( NULL == pMlmDelBAReq )
Jeff Johnson295189b2012-06-20 16:38:30 -07006108 {
6109 limLog( pMac, LOGE,
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306110 FL("AllocateMemory failed with error code %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07006111 status );
6112
6113 status = eSIR_MEM_ALLOC_FAILED;
6114 goto returnFailure;
6115 }
6116
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306117 vos_mem_set( (void *) pMlmDelBAReq, sizeof( tLimMlmDelBAReq ), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07006118
6119 // Copy the peer MAC
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306120 vos_mem_copy(
Jeff Johnson295189b2012-06-20 16:38:30 -07006121 pMlmDelBAReq->peerMacAddr,
6122 pSta->staAddr,
6123 sizeof( tSirMacAddr ));
6124
6125 pMlmDelBAReq->baDirection = baDirection;
6126 pMlmDelBAReq->baTID = baTID;
6127 pMlmDelBAReq->delBAReasonCode = baReasonCode;
6128
6129 /* Update PE session ID*/
6130 pMlmDelBAReq->sessionId = psessionEntry->peSessionId;
6131
6132 //we don't have valid BA session for the given direction.
6133 // HDD wants to get the BA session deleted on PEER in this case.
6134 // in this case we just need to send DelBA to the peer.
6135 if(((eBA_RECIPIENT == baDirection) && (eBA_DISABLE == pSta->tcCfg[baTID].fUseBARx)) ||
6136 ((eBA_INITIATOR == baDirection) && (eBA_DISABLE == pSta->tcCfg[baTID].fUseBATx)))
6137 {
6138 // Send DELBA Ind over the air
6139 if( eSIR_SUCCESS !=
6140 (status = limSendDelBAInd( pMac, pMlmDelBAReq,psessionEntry)))
6141 status = eSIR_FAILURE;
6142
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306143 vos_mem_free(pMlmDelBAReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07006144 return status;
6145 }
6146
6147
6148 // Update the BA state in STA
6149 LIM_SET_STA_BA_STATE(pSta, pMlmDelBAReq->baTID, eLIM_BA_STATE_WT_DEL_RSP);
6150
6151 // Send DELBA Req to MLME
6152 limPostMlmMessage( pMac,
6153 LIM_MLM_DELBA_REQ,
6154 (tANI_U32 *) pMlmDelBAReq );
6155
6156returnFailure:
6157
6158 return status;
6159}
6160
6161/**
6162 * \brief Send WDA_ADDBA_REQ to HAL, in order
6163 * to setup a new BA session with a peer
6164 *
6165 * \sa limPostMsgAddBAReq
6166 *
6167 * \param pMac The global tpAniSirGlobal object
6168 *
6169 * \param pSta Runtime, STA-related configuration cached
6170 * in the HashNode object
6171 *
6172 * \param baDialogToken The Action Frame dialog token
6173 *
6174 * \param baTID TID for which the BA session is being setup
6175 *
6176 * \param baPolicy BA Policy
6177 *
6178 * \param baBufferSize The requested BA buffer size
6179 *
6180 * \param baTimeout BA Timeout. 0 indicates no BA timeout enforced
6181 *
6182 * \param baSSN Starting Sequence Number for this BA session
6183 *
6184 * \param baDirection BA Direction: 1 - Initiator, 0 - Recipient
6185 *
6186 * \return none
6187 *
6188 */
6189tSirRetStatus limPostMsgAddBAReq( tpAniSirGlobal pMac,
6190 tpDphHashNode pSta,
6191 tANI_U8 baDialogToken,
6192 tANI_U8 baTID,
6193 tANI_U8 baPolicy,
6194 tANI_U16 baBufferSize,
6195 tANI_U16 baTimeout,
6196 tANI_U16 baSSN,
6197 tANI_U8 baDirection,
6198 tpPESession psessionEntry)
6199{
6200tpAddBAParams pAddBAParams = NULL;
6201tSirRetStatus retCode = eSIR_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -07006202tSirMsgQ msgQ;
6203
6204#ifdef WLAN_SOFTAP_VSTA_FEATURE
6205 // we can only do BA on "hard" STAs
6206 if (!(IS_HWSTA_IDX(pSta->staIndex)))
6207 {
6208 retCode = eHAL_STATUS_FAILURE;
6209 goto returnFailure;
6210 }
6211#endif //WLAN_SOFTAP_VSTA_FEATURE
6212
6213 // Allocate for WDA_ADDBA_REQ
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306214 pAddBAParams = vos_mem_malloc(sizeof( tAddBAParams ));
6215 if ( NULL == pAddBAParams )
Jeff Johnson295189b2012-06-20 16:38:30 -07006216 {
6217 limLog( pMac, LOGE,
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306218 FL("AllocateMemory failed")
6219 );
Jeff Johnson295189b2012-06-20 16:38:30 -07006220
6221 retCode = eSIR_MEM_ALLOC_FAILED;
6222 goto returnFailure;
6223 }
6224
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306225 vos_mem_set( (void *) pAddBAParams, sizeof( tAddBAParams ), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07006226
6227 // Copy the peer MAC address
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306228 vos_mem_copy(
Jeff Johnson295189b2012-06-20 16:38:30 -07006229 (void *) pAddBAParams->peerMacAddr,
6230 (void *) pSta->staAddr,
6231 sizeof( tSirMacAddr ));
6232
6233 // Populate the REQ parameters
6234 pAddBAParams->staIdx = pSta->staIndex;
6235 pAddBAParams->baDialogToken = baDialogToken;
6236 pAddBAParams->baTID = baTID;
6237 pAddBAParams->baPolicy = baPolicy;
6238 pAddBAParams->baBufferSize = baBufferSize;
6239 pAddBAParams->baTimeout = baTimeout;
6240 pAddBAParams->baSSN = baSSN;
6241 pAddBAParams->baDirection = baDirection;
6242 pAddBAParams->respReqd = 1;
6243
6244 /* UPdate PE session ID */
6245 pAddBAParams->sessionId = psessionEntry->peSessionId;
6246
6247 // Post WDA_ADDBA_REQ to HAL.
6248 msgQ.type = WDA_ADDBA_REQ;
6249 //
6250 // FIXME_AMPDU
6251 // A global counter (dialog token) is required to keep track of
6252 // all PE <-> HAL communication(s)
6253 //
6254 msgQ.reserved = 0;
6255 msgQ.bodyptr = pAddBAParams;
6256 msgQ.bodyval = 0;
6257
6258 limLog( pMac, LOGW,
6259 FL( "Sending WDA_ADDBA_REQ..." ));
6260
6261 //defer any other message until we get response back.
6262 SET_LIM_PROCESS_DEFD_MESGS(pMac, false);
6263
Jeff Johnsone7245742012-09-05 17:12:55 -07006264 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07006265#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
6266 limDiagEventReport(pMac, WLAN_PE_DIAG_HAL_ADDBA_REQ_EVENT, psessionEntry, 0, 0);
6267#endif //FEATURE_WLAN_DIAG_SUPPORT
6268
6269 if( eSIR_SUCCESS != (retCode = wdaPostCtrlMsg( pMac, &msgQ )))
6270 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006271 FL("Posting WDA_ADDBA_REQ to HAL failed! Reason = %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07006272 retCode );
6273 else
6274 return retCode;
6275
6276returnFailure:
6277
6278 // Clean-up...
6279 if( NULL != pAddBAParams )
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306280 vos_mem_free( pAddBAParams );
Jeff Johnson295189b2012-06-20 16:38:30 -07006281
6282 return retCode;
6283
6284}
6285
6286/**
6287 * \brief Send WDA_DELBA_IND to HAL, in order
6288 * to delete an existing BA session with peer
6289 *
6290 * \sa limPostMsgDelBAInd
6291 *
6292 * \param pMac The global tpAniSirGlobal object
6293 *
6294 * \param pSta Runtime, STA-related configuration cached
6295 * in the HashNode object
6296 *
6297 * \param baTID TID for which the BA session is being setup
6298 *
6299 * \param baDirection Identifies whether the DELBA Ind was
6300 * sent by the BA initiator or recipient
6301 *
6302 * \return none
6303 *
6304 */
6305tSirRetStatus limPostMsgDelBAInd( tpAniSirGlobal pMac,
6306 tpDphHashNode pSta,
6307 tANI_U8 baTID,
6308 tANI_U8 baDirection,
6309 tpPESession psessionEntry)
6310{
6311tpDelBAParams pDelBAParams = NULL;
6312tSirRetStatus retCode = eSIR_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -07006313tSirMsgQ msgQ;
6314
6315 // Allocate for SIR_HAL_DELBA_IND
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306316 pDelBAParams = vos_mem_malloc(sizeof( tDelBAParams ));
6317 if ( NULL == pDelBAParams )
Jeff Johnson295189b2012-06-20 16:38:30 -07006318 {
6319 limLog( pMac, LOGE,
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306320 FL("AllocateMemory failed")
6321 );
Jeff Johnson295189b2012-06-20 16:38:30 -07006322
6323 retCode = eSIR_MEM_ALLOC_FAILED;
6324 goto returnFailure;
6325 }
6326
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306327 vos_mem_set( (void *) pDelBAParams, sizeof( tDelBAParams ), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07006328
6329 // Populate the REQ parameters
6330 pDelBAParams->staIdx = pSta->staIndex;
6331 pDelBAParams->baTID = baTID;
6332 pDelBAParams->baDirection = baDirection;
6333
6334 /* Update PE session ID */
6335
6336
6337 //TBD-RAJESH Updating of the session ID is requird for SIR_HAL_DELBA_IND?????
6338 //pDelBAParams->sessionId = psessionEntry->peSessionId;
6339
6340 // Post WDA_DELBA_IND to HAL.
6341 msgQ.type = WDA_DELBA_IND;
6342 //
6343 // FIXME:
6344 // A global counter (dialog token) is required to keep track of
6345 // all PE <-> HAL communication(s)
6346 //
6347 msgQ.reserved = 0;
6348 msgQ.bodyptr = pDelBAParams;
6349 msgQ.bodyval = 0;
6350
6351 limLog( pMac, LOGW,
6352 FL( "Sending SIR_HAL_DELBA_IND..." ));
6353
Jeff Johnsone7245742012-09-05 17:12:55 -07006354 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07006355#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
6356 limDiagEventReport(pMac, WLAN_PE_DIAG_HAL_DELBA_IND_EVENT, psessionEntry, 0, 0);
6357#endif //FEATURE_WLAN_DIAG_SUPPORT
6358
6359 if( eSIR_SUCCESS != (retCode = wdaPostCtrlMsg( pMac, &msgQ )))
6360 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006361 FL("Posting WDA_DELBA_IND to HAL failed! Reason = %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07006362 retCode );
6363 else
6364 {
6365 // Update LIM's internal cache...
6366 if( eBA_INITIATOR == baDirection)
6367 {
6368 pSta->tcCfg[baTID].fUseBATx = 0;
6369 pSta->tcCfg[baTID].txBufSize = 0;
6370 }
6371 else
6372 {
6373 pSta->tcCfg[baTID].fUseBARx = 0;
6374 pSta->tcCfg[baTID].rxBufSize = 0;
6375 }
6376
6377 return retCode;
6378 }
6379
6380returnFailure:
6381
6382 // Clean-up...
6383 if( NULL != pDelBAParams )
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306384 vos_mem_free( pDelBAParams );
Jeff Johnson295189b2012-06-20 16:38:30 -07006385
6386 return retCode;
6387
6388}
6389
6390/**
6391 * @function : limPostSMStateUpdate()
6392 *
6393 * @brief : This function Updates the HAL and Softmac about the change in the STA's SMPS state.
6394 *
6395 * LOGIC:
6396 *
6397 * ASSUMPTIONS:
6398 * NA
6399 *
6400 * NOTE:
6401 * NA
6402 *
6403 * @param pMac - Pointer to Global MAC structure
6404 * @param limMsg - Lim Message structure object with the MimoPSparam in body
6405 * @return None
6406 */
6407tSirRetStatus
6408limPostSMStateUpdate(tpAniSirGlobal pMac,
6409 tANI_U16 staIdx, tSirMacHTMIMOPowerSaveState state)
6410{
6411 tSirRetStatus retCode = eSIR_SUCCESS;
6412 tSirMsgQ msgQ;
Jeff Johnson295189b2012-06-20 16:38:30 -07006413 tpSetMIMOPS pMIMO_PSParams;
6414
6415 msgQ.reserved = 0;
6416 msgQ.type = WDA_SET_MIMOPS_REQ;
6417
6418 // Allocate for WDA_SET_MIMOPS_REQ
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306419 pMIMO_PSParams = vos_mem_malloc(sizeof(tSetMIMOPS));
6420 if ( NULL == pMIMO_PSParams )
6421 {
6422 limLog( pMac, LOGP,FL(" AllocateMemory failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07006423 return eSIR_MEM_ALLOC_FAILED;
6424 }
6425
6426 pMIMO_PSParams->htMIMOPSState = state;
6427 pMIMO_PSParams->staIdx = staIdx;
6428 pMIMO_PSParams->fsendRsp = true;
6429 msgQ.bodyptr = pMIMO_PSParams;
6430 msgQ.bodyval = 0;
6431
6432 limLog( pMac, LOG2, FL( "Sending WDA_SET_MIMOPS_REQ..." ));
6433
Jeff Johnsone7245742012-09-05 17:12:55 -07006434 MTRACE(macTraceMsgTx(pMac, NO_SESSION, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07006435 retCode = wdaPostCtrlMsg( pMac, &msgQ );
6436 if (eSIR_SUCCESS != retCode)
6437 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006438 limLog( pMac, LOGP, FL("Posting WDA_SET_MIMOPS_REQ to HAL failed! Reason = %d"), retCode );
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306439 vos_mem_free(pMIMO_PSParams);
Jeff Johnson295189b2012-06-20 16:38:30 -07006440 return retCode;
6441 }
6442
6443 return retCode;
6444}
6445
6446void limPktFree (
6447 tpAniSirGlobal pMac,
6448 eFrameType frmType,
6449 tANI_U8 *pRxPacketInfo,
6450 void *pBody)
6451{
6452 (void) pMac; (void) frmType; (void) pRxPacketInfo; (void) pBody;
Jeff Johnson295189b2012-06-20 16:38:30 -07006453}
6454
6455/**
6456 * limGetBDfromRxPacket()
6457 *
6458 *FUNCTION:
6459 * This function is called to get pointer to Polaris
6460 * Buffer Descriptor containing MAC header & other control
6461 * info from the body of the message posted to LIM.
6462 *
6463 *LOGIC:
6464 * NA
6465 *
6466 *ASSUMPTIONS:
6467 * NA
6468 *
6469 *NOTE:
6470 * NA
6471 *
6472 * @param body - Received message body
6473 * @param pRxPacketInfo - Pointer to received BD
6474 * @return None
6475 */
6476
6477void
6478limGetBDfromRxPacket(tpAniSirGlobal pMac, void *body, tANI_U32 **pRxPacketInfo)
6479{
Jeff Johnson295189b2012-06-20 16:38:30 -07006480 *pRxPacketInfo = (tANI_U32 *) body;
Jeff Johnson295189b2012-06-20 16:38:30 -07006481} /*** end limGetBDfromRxPacket() ***/
6482
6483
6484
6485
6486
6487void limRessetScanChannelInfo(tpAniSirGlobal pMac)
6488{
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306489 vos_mem_set(&pMac->lim.scanChnInfo, sizeof(tLimScanChnInfo), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07006490}
6491
6492
6493void limAddScanChannelInfo(tpAniSirGlobal pMac, tANI_U8 channelId)
6494{
6495 tANI_U8 i;
6496 tANI_BOOLEAN fFound = eANI_BOOLEAN_FALSE;
6497
6498 for(i = 0; i < pMac->lim.scanChnInfo.numChnInfo; i++)
6499 {
6500 if(pMac->lim.scanChnInfo.scanChn[i].channelId == channelId)
6501 {
6502 pMac->lim.scanChnInfo.scanChn[i].numTimeScan++;
6503 fFound = eANI_BOOLEAN_TRUE;
6504 break;
6505 }
6506 }
6507 if(eANI_BOOLEAN_FALSE == fFound)
6508 {
6509 if(pMac->lim.scanChnInfo.numChnInfo < SIR_MAX_SUPPORTED_CHANNEL_LIST)
6510 {
6511 pMac->lim.scanChnInfo.scanChn[pMac->lim.scanChnInfo.numChnInfo].channelId = channelId;
6512 pMac->lim.scanChnInfo.scanChn[pMac->lim.scanChnInfo.numChnInfo++].numTimeScan = 1;
6513 }
6514 else
6515 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006516 PELOGW(limLog(pMac, LOGW, FL(" -- number of channels exceed mac"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07006517 }
6518 }
6519}
6520
6521
6522/**
6523 * @function : limIsChannelValidForChannelSwitch()
6524 *
6525 * @brief : This function checks if the channel to which AP
6526 * is expecting us to switch, is a valid channel for us.
6527 * LOGIC:
6528 *
6529 * ASSUMPTIONS:
6530 * NA
6531 *
6532 * NOTE:
6533 * NA
6534 *
6535 * @param pMac - Pointer to Global MAC structure
6536 * @param channel - New channel to which we are expected to move
6537 * @return None
6538 */
6539tAniBool
6540limIsChannelValidForChannelSwitch(tpAniSirGlobal pMac, tANI_U8 channel)
6541{
6542 tANI_U8 index;
6543 tANI_U32 validChannelListLen = WNI_CFG_VALID_CHANNEL_LIST_LEN;
6544 tSirMacChanNum validChannelList[WNI_CFG_VALID_CHANNEL_LIST_LEN];
6545
6546 if (wlan_cfgGetStr(pMac, WNI_CFG_VALID_CHANNEL_LIST,
6547 (tANI_U8 *)validChannelList,
6548 (tANI_U32 *)&validChannelListLen) != eSIR_SUCCESS)
6549 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006550 PELOGE(limLog(pMac, LOGE, FL("could not retrieve valid channel list"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07006551 return (eSIR_FALSE);
6552 }
6553
6554 for(index = 0; index < validChannelListLen; index++)
6555 {
6556 if(validChannelList[index] == channel)
6557 return (eSIR_TRUE);
6558 }
6559
6560 /* channel does not belong to list of valid channels */
6561 return (eSIR_FALSE);
6562}
6563
6564/**------------------------------------------------------
6565\fn __limFillTxControlParams
6566\brief Fill the message for stopping/resuming tx.
6567
6568\param pMac
6569\param pTxCtrlMsg - Pointer to tx control message.
6570\param type - Which way we want to stop/ resume tx.
6571\param mode - To stop/resume.
6572 -------------------------------------------------------*/
6573static eHalStatus
6574__limFillTxControlParams(tpAniSirGlobal pMac, tpTxControlParams pTxCtrlMsg,
6575 tLimQuietTxMode type, tLimControlTx mode)
6576{
6577
6578 //TBD-RAJESH HOW TO GET sessionEntry?????
6579 tpPESession psessionEntry = &pMac->lim.gpSession[0];
6580
6581 if (mode == eLIM_STOP_TX)
6582 pTxCtrlMsg->stopTx = eANI_BOOLEAN_TRUE;
6583 else
6584 pTxCtrlMsg->stopTx = eANI_BOOLEAN_FALSE;
6585
6586 switch (type)
6587 {
6588 case eLIM_TX_ALL:
6589 /** Stops/resumes transmission completely */
6590 pTxCtrlMsg->fCtrlGlobal = 1;
6591 break;
6592
6593 case eLIM_TX_BSS_BUT_BEACON:
6594 /** Stops/resumes transmission on a particular BSS. Stopping BSS, doesnt
6595 * stop beacon transmission.
6596 */
6597 pTxCtrlMsg->ctrlBss = 1;
6598 pTxCtrlMsg->bssBitmap |= (1 << psessionEntry->bssIdx);
6599 break;
6600
6601 case eLIM_TX_STA:
6602 /** Memory for station bitmap is allocated dynamically in caller of this
6603 * so decode properly here and fill the bitmap. Now not implemented,
6604 * fall through.
6605 */
6606 case eLIM_TX_BSS:
6607 //Fall thru...
6608 default:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006609 PELOGW(limLog(pMac, LOGW, FL("Invalid case: Not Handled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07006610 return eHAL_STATUS_FAILURE;
6611 }
6612
6613 return eHAL_STATUS_SUCCESS;
6614}
6615
6616/**
6617 * @function : limFrameTransmissionControl()
6618 *
6619 * @brief : This API is called by the user to halt/resume any frame
6620 * transmission from the device. If stopped, all frames will be
6621 * queued starting from hardware. Then back-pressure
6622 * is built till the driver.
6623 * LOGIC:
6624 *
6625 * ASSUMPTIONS:
6626 * NA
6627 *
6628 * NOTE:
6629 * NA
6630 *
6631 * @param pMac - Pointer to Global MAC structure
6632 * @return None
6633 */
6634void limFrameTransmissionControl(tpAniSirGlobal pMac, tLimQuietTxMode type, tLimControlTx mode)
6635{
6636
6637 eHalStatus status = eHAL_STATUS_FAILURE;
6638 tpTxControlParams pTxCtrlMsg;
6639 tSirMsgQ msgQ;
6640 tANI_U8 nBytes = 0; // No of bytes required for station bitmap.
6641
6642 /** Allocate only required number of bytes for station bitmap
6643 * Make it to align to 4 byte boundary */
6644 nBytes = (tANI_U8)HALMSG_NUMBYTES_STATION_BITMAP(pMac->lim.maxStation);
6645
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306646 pTxCtrlMsg = vos_mem_malloc(sizeof(*pTxCtrlMsg) + nBytes);
6647 if ( NULL == pTxCtrlMsg )
Jeff Johnson295189b2012-06-20 16:38:30 -07006648 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306649 limLog(pMac, LOGP, FL("AllocateMemory() failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07006650 return;
6651 }
6652
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306653 vos_mem_set((void *) pTxCtrlMsg,
6654 (sizeof(*pTxCtrlMsg) + nBytes), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07006655 status = __limFillTxControlParams(pMac, pTxCtrlMsg, type, mode);
6656 if (status != eHAL_STATUS_SUCCESS)
6657 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306658 vos_mem_free(pTxCtrlMsg);
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006659 limLog(pMac, LOGP, FL("__limFillTxControlParams failed, status = %d"), status);
Jeff Johnson295189b2012-06-20 16:38:30 -07006660 return;
6661 }
6662
6663 msgQ.bodyptr = (void *) pTxCtrlMsg;
6664 msgQ.bodyval = 0;
6665 msgQ.reserved = 0;
6666 msgQ.type = WDA_TRANSMISSION_CONTROL_IND;
6667
Jeff Johnsone7245742012-09-05 17:12:55 -07006668 MTRACE(macTraceMsgTx(pMac, NO_SESSION, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07006669 if(wdaPostCtrlMsg( pMac, &msgQ) != eSIR_SUCCESS)
6670 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306671 vos_mem_free(pTxCtrlMsg);
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006672 limLog( pMac, LOGP, FL("Posting Message to HAL failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07006673 return;
6674 }
6675
6676 if (mode == eLIM_STOP_TX)
6677 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006678 PELOG1(limLog(pMac, LOG1, FL("Stopping the transmission of all packets, indicated softmac"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07006679 }
6680 else
6681 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006682 PELOG1(limLog(pMac, LOG1, FL("Resuming the transmission of all packets, indicated softmac"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07006683 }
6684 return;
6685}
6686
6687
6688/**
6689 * @function : limRestorePreChannelSwitchState()
6690 *
6691 * @brief : This API is called by the user to undo any
6692 * specific changes done on the device during
6693 * channel switch.
6694 * LOGIC:
6695 *
6696 * ASSUMPTIONS:
6697 * NA
6698 *
6699 * NOTE:
6700 * NA
6701 *
6702 * @param pMac - Pointer to Global MAC structure
6703 * @return None
6704 */
6705
6706tSirRetStatus
6707limRestorePreChannelSwitchState(tpAniSirGlobal pMac, tpPESession psessionEntry)
6708{
6709
6710 tSirRetStatus retCode = eSIR_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -07006711 tANI_U32 val = 0;
6712
6713 if (psessionEntry->limSystemRole != eLIM_STA_ROLE)
6714 return retCode;
6715
6716 /* Channel switch should be ready for the next time */
Jeff Johnsone7245742012-09-05 17:12:55 -07006717 psessionEntry->gLimSpecMgmt.dot11hChanSwState = eLIM_11H_CHANSW_INIT;
Jeff Johnson295189b2012-06-20 16:38:30 -07006718
6719 /* Restore the frame transmission, all the time. */
6720 limFrameTransmissionControl(pMac, eLIM_TX_ALL, eLIM_RESUME_TX);
6721
6722 /* Free to enter BMPS */
6723 limSendSmePostChannelSwitchInd(pMac);
6724
6725 //Background scan is now enabled by SME
6726 if(pMac->lim.gLimBackgroundScanTerminate == FALSE)
6727 {
6728 /* Enable background scan if already enabled, else don't bother */
6729 if ((retCode = wlan_cfgGetInt(pMac, WNI_CFG_BACKGROUND_SCAN_PERIOD,
6730 &val)) != eSIR_SUCCESS)
6731
6732 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006733 limLog(pMac, LOGP, FL("could not retrieve Background scan period value"));
Jeff Johnson295189b2012-06-20 16:38:30 -07006734 return (retCode);
6735 }
6736
6737 if (val > 0 && TX_TIMER_VALID(pMac->lim.limTimers.gLimBackgroundScanTimer))
6738 {
Ravi Joshid2ca7c42013-07-23 08:37:49 -07006739 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE,
6740 psessionEntry->peSessionId, eLIM_BACKGROUND_SCAN_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -07006741 if(tx_timer_activate(&pMac->lim.limTimers.gLimBackgroundScanTimer) != TX_SUCCESS)
6742 {
6743 limLog(pMac, LOGP, FL("Could not restart background scan timer, doing LOGP"));
6744 return (eSIR_FAILURE);
6745 }
6746
6747 }
6748 }
6749
6750 /* Enable heartbeat timer */
6751 if (TX_TIMER_VALID(pMac->lim.limTimers.gLimHeartBeatTimer))
6752 {
Ravi Joshid2ca7c42013-07-23 08:37:49 -07006753 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE,
6754 psessionEntry->peSessionId, eLIM_HEART_BEAT_TIMER));
6755 if((limActivateHearBeatTimer(pMac, psessionEntry) != TX_SUCCESS) &&
6756 (!IS_ACTIVEMODE_OFFLOAD_FEATURE_ENABLE))
Jeff Johnson295189b2012-06-20 16:38:30 -07006757 {
6758 limLog(pMac, LOGP, FL("Could not restart heartbeat timer, doing LOGP"));
6759 return (eSIR_FAILURE);
6760 }
6761 }
Jeff Johnson295189b2012-06-20 16:38:30 -07006762 return (retCode);
6763}
6764
6765
6766/**--------------------------------------------
6767\fn limRestorePreQuietState
6768\brief Restore the pre quiet state
6769
6770\param pMac
6771\return NONE
6772---------------------------------------------*/
Jeff Johnsone7245742012-09-05 17:12:55 -07006773tSirRetStatus limRestorePreQuietState(tpAniSirGlobal pMac, tpPESession psessionEntry)
Jeff Johnson295189b2012-06-20 16:38:30 -07006774{
6775
6776 tSirRetStatus retCode = eSIR_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -07006777 tANI_U32 val = 0;
6778
6779 if (pMac->lim.gLimSystemRole != eLIM_STA_ROLE)
6780 return retCode;
6781
6782 /* Quiet should be ready for the next time */
Jeff Johnsone7245742012-09-05 17:12:55 -07006783 psessionEntry->gLimSpecMgmt.quietState = eLIM_QUIET_INIT;
Jeff Johnson295189b2012-06-20 16:38:30 -07006784
6785 /* Restore the frame transmission, all the time. */
Jeff Johnsone7245742012-09-05 17:12:55 -07006786 if (psessionEntry->gLimSpecMgmt.quietState == eLIM_QUIET_RUNNING)
Jeff Johnson295189b2012-06-20 16:38:30 -07006787 limFrameTransmissionControl(pMac, eLIM_TX_ALL, eLIM_RESUME_TX);
6788
6789
6790 //Background scan is now enabled by SME
6791 if(pMac->lim.gLimBackgroundScanTerminate == FALSE)
6792 {
6793 /* Enable background scan if already enabled, else don't bother */
6794 if ((retCode = wlan_cfgGetInt(pMac, WNI_CFG_BACKGROUND_SCAN_PERIOD,
6795 &val)) != eSIR_SUCCESS)
6796
6797 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006798 limLog(pMac, LOGP, FL("could not retrieve Background scan period value"));
Jeff Johnson295189b2012-06-20 16:38:30 -07006799 return (retCode);
6800 }
6801
6802 if (val > 0 && TX_TIMER_VALID(pMac->lim.limTimers.gLimBackgroundScanTimer))
6803 {
Leela V Kiran Kumar Reddy Chiralac3b9d382013-01-31 20:49:53 -08006804 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, psessionEntry->peSessionId, eLIM_BACKGROUND_SCAN_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -07006805 if(tx_timer_activate(&pMac->lim.limTimers.gLimBackgroundScanTimer) != TX_SUCCESS)
6806 {
6807 limLog(pMac, LOGP, FL("Could not restart background scan timer, doing LOGP"));
6808 return (eSIR_FAILURE);
6809 }
6810
6811 }
6812 }
6813
6814 /* Enable heartbeat timer */
6815 if (TX_TIMER_VALID(pMac->lim.limTimers.gLimHeartBeatTimer))
6816 {
Leela V Kiran Kumar Reddy Chiralac3b9d382013-01-31 20:49:53 -08006817 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, psessionEntry->peSessionId, eLIM_HEART_BEAT_TIMER));
Ravi Joshid2ca7c42013-07-23 08:37:49 -07006818 if(limActivateHearBeatTimer(pMac, psessionEntry) != TX_SUCCESS)
Jeff Johnson295189b2012-06-20 16:38:30 -07006819 {
6820 limLog(pMac, LOGP, FL("Could not restart heartbeat timer, doing LOGP"));
6821 return (eSIR_FAILURE);
6822 }
6823 }
Jeff Johnson295189b2012-06-20 16:38:30 -07006824 return (retCode);
6825}
6826
6827
6828/**
6829 * @function: limPrepareFor11hChannelSwitch()
6830 *
6831 * @brief : This API is called by the user to prepare for
6832 * 11h channel switch. As of now, the API does
6833 * very minimal work. User can add more into the
6834 * same API if needed.
6835 * LOGIC:
6836 *
6837 * ASSUMPTIONS:
6838 * NA
6839 *
6840 * NOTE:
6841 * NA
6842 *
6843 * @param pMac - Pointer to Global MAC structure
6844 * @param psessionEntry
6845 * @return None
6846 */
6847void
6848limPrepareFor11hChannelSwitch(tpAniSirGlobal pMac, tpPESession psessionEntry)
6849{
Jeff Johnson295189b2012-06-20 16:38:30 -07006850 if (psessionEntry->limSystemRole != eLIM_STA_ROLE)
6851 return;
6852
6853 /* Flag to indicate 11h channel switch in progress */
Jeff Johnsone7245742012-09-05 17:12:55 -07006854 psessionEntry->gLimSpecMgmt.dot11hChanSwState = eLIM_11H_CHANSW_RUNNING;
Jeff Johnson295189b2012-06-20 16:38:30 -07006855
6856 /* Disable, Stop background scan if enabled and running */
6857 limDeactivateAndChangeTimer(pMac, eLIM_BACKGROUND_SCAN_TIMER);
6858
6859 /* Stop heart-beat timer to stop heartbeat disassociation */
6860 limHeartBeatDeactivateAndChangeTimer(pMac, psessionEntry);
6861
6862 if(pMac->lim.gLimSmeState == eLIM_SME_LINK_EST_WT_SCAN_STATE ||
6863 pMac->lim.gLimSmeState == eLIM_SME_CHANNEL_SCAN_STATE)
6864 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006865 PELOGE(limLog(pMac, LOGE, FL("Posting finish scan as we are in scan state"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07006866 /* Stop ongoing scanning if any */
6867 if (GET_LIM_PROCESS_DEFD_MESGS(pMac))
6868 {
6869 //Set the resume channel to Any valid channel (invalid).
6870 //This will instruct HAL to set it to any previous valid channel.
6871 peSetResumeChannel(pMac, 0, 0);
6872 limSendHalFinishScanReq(pMac, eLIM_HAL_FINISH_SCAN_WAIT_STATE);
6873 }
6874 else
6875 {
6876 limRestorePreChannelSwitchState(pMac, psessionEntry);
6877 }
6878 return;
6879 }
6880 else
6881 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006882 PELOGE(limLog(pMac, LOGE, FL("Not in scan state, start channel switch timer"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07006883 /** We are safe to switch channel at this point */
6884 limStopTxAndSwitchChannel(pMac, psessionEntry->peSessionId);
6885 }
Jeff Johnson295189b2012-06-20 16:38:30 -07006886}
6887
6888
6889
6890/**----------------------------------------------------
6891\fn limGetNwType
6892
6893\brief Get type of the network from data packet or beacon
6894\param pMac
6895\param channelNum - Channel number
6896\param type - Type of packet.
6897\param pBeacon - Pointer to beacon or probe response
6898
6899\return Network type a/b/g.
6900-----------------------------------------------------*/
6901tSirNwType limGetNwType(tpAniSirGlobal pMac, tANI_U8 channelNum, tANI_U32 type, tpSchBeaconStruct pBeacon)
6902{
6903 tSirNwType nwType = eSIR_11B_NW_TYPE;
6904
6905 if (type == SIR_MAC_DATA_FRAME)
6906 {
6907 if ((channelNum > 0) && (channelNum < 15))
6908 {
6909 nwType = eSIR_11G_NW_TYPE;
6910 }
6911 else
6912 {
6913 nwType = eSIR_11A_NW_TYPE;
6914 }
6915 }
6916 else
6917 {
6918 if ((channelNum > 0) && (channelNum < 15))
6919 {
6920 int i;
6921 // 11b or 11g packet
6922 // 11g iff extended Rate IE is present or
6923 // if there is an A rate in suppRate IE
6924 for (i = 0; i < pBeacon->supportedRates.numRates; i++)
6925 {
6926 if (sirIsArate(pBeacon->supportedRates.rate[i] & 0x7f))
6927 {
6928 nwType = eSIR_11G_NW_TYPE;
6929 break;
6930 }
6931 }
6932 if (pBeacon->extendedRatesPresent)
6933 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006934 PELOG3(limLog(pMac, LOG3, FL("Beacon, nwtype=G"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07006935 nwType = eSIR_11G_NW_TYPE;
6936 }
6937 }
6938 else
6939 {
6940 // 11a packet
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006941 PELOG3(limLog(pMac, LOG3,FL("Beacon, nwtype=A"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07006942 nwType = eSIR_11A_NW_TYPE;
6943 }
6944 }
6945 return nwType;
6946}
6947
6948
6949/**---------------------------------------------------------
6950\fn limGetChannelFromBeacon
6951\brief To extract channel number from beacon
6952
6953\param pMac
6954\param pBeacon - Pointer to beacon or probe rsp
6955\return channel number
6956-----------------------------------------------------------*/
6957tANI_U8 limGetChannelFromBeacon(tpAniSirGlobal pMac, tpSchBeaconStruct pBeacon)
6958{
6959 tANI_U8 channelNum = 0;
6960
6961 if (pBeacon->dsParamsPresent)
6962 channelNum = pBeacon->channelNumber;
6963 else if(pBeacon->HTInfo.present)
6964 channelNum = pBeacon->HTInfo.primaryChannel;
6965 else
6966 channelNum = pBeacon->channelNumber;
6967
6968 return channelNum;
6969}
6970
6971
6972/** ---------------------------------------------------------
6973\fn limSetTspecUapsdMask
6974\brief This function sets the PE global variable:
6975\ 1) gUapsdPerAcTriggerEnableMask and
6976\ 2) gUapsdPerAcDeliveryEnableMask
6977\ based on the user priority field and direction field
6978\ in the TS Info Fields.
6979\
6980\ An AC is a trigger-enabled AC if the PSB subfield
6981\ is set to 1 in the uplink direction.
6982\ An AC is a delivery-enabled AC if the PSB subfield
6983\ is set to 1 in the down-link direction.
6984\
6985\param tpAniSirGlobal pMac
6986\param tSirMacTSInfo pTsInfo
6987\param tANI_U32 action
6988\return None
6989 ------------------------------------------------------------*/
6990void limSetTspecUapsdMask(tpAniSirGlobal pMac, tSirMacTSInfo *pTsInfo, tANI_U32 action)
6991{
6992 tANI_U8 userPrio = (tANI_U8)pTsInfo->traffic.userPrio;
6993 tANI_U16 direction = pTsInfo->traffic.direction;
6994 tANI_U8 ac = upToAc(userPrio);
6995
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006996 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 -07006997
6998 /* Converting AC to appropriate Uapsd Bit Mask
6999 * AC_BE(0) --> UAPSD_BITOFFSET_ACVO(3)
7000 * AC_BK(1) --> UAPSD_BITOFFSET_ACVO(2)
7001 * AC_VI(2) --> UAPSD_BITOFFSET_ACVO(1)
7002 * AC_VO(3) --> UAPSD_BITOFFSET_ACVO(0)
7003 */
7004 ac = ((~ac) & 0x3);
7005
7006 if (action == CLEAR_UAPSD_MASK)
7007 {
7008 if (direction == SIR_MAC_DIRECTION_UPLINK)
7009 pMac->lim.gUapsdPerAcTriggerEnableMask &= ~(1 << ac);
7010 else if (direction == SIR_MAC_DIRECTION_DNLINK)
7011 pMac->lim.gUapsdPerAcDeliveryEnableMask &= ~(1 << ac);
7012 else if (direction == SIR_MAC_DIRECTION_BIDIR)
7013 {
7014 pMac->lim.gUapsdPerAcTriggerEnableMask &= ~(1 << ac);
7015 pMac->lim.gUapsdPerAcDeliveryEnableMask &= ~(1 << ac);
7016 }
7017 }
7018 else if (action == SET_UAPSD_MASK)
7019 {
7020 if (direction == SIR_MAC_DIRECTION_UPLINK)
7021 pMac->lim.gUapsdPerAcTriggerEnableMask |= (1 << ac);
7022 else if (direction == SIR_MAC_DIRECTION_DNLINK)
7023 pMac->lim.gUapsdPerAcDeliveryEnableMask |= (1 << ac);
7024 else if (direction == SIR_MAC_DIRECTION_BIDIR)
7025 {
7026 pMac->lim.gUapsdPerAcTriggerEnableMask |= (1 << ac);
7027 pMac->lim.gUapsdPerAcDeliveryEnableMask |= (1 << ac);
7028 }
7029 }
7030
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007031 limLog(pMac, LOGE, FL("New pMac->lim.gUapsdPerAcTriggerEnableMask = 0x%x "), pMac->lim.gUapsdPerAcTriggerEnableMask );
7032 limLog(pMac, LOGE, FL("New pMac->lim.gUapsdPerAcDeliveryEnableMask = 0x%x "), pMac->lim.gUapsdPerAcDeliveryEnableMask );
Jeff Johnson295189b2012-06-20 16:38:30 -07007033
7034 return;
7035}
7036
7037
7038
7039void limHandleHeartBeatTimeout(tpAniSirGlobal pMac )
7040{
7041
7042 tANI_U8 i;
7043 for(i =0;i < pMac->lim.maxBssId;i++)
7044 {
7045 if(pMac->lim.gpSession[i].valid == TRUE )
7046 {
7047 if(pMac->lim.gpSession[i].bssType == eSIR_IBSS_MODE)
7048 {
7049 limIbssHeartBeatHandle(pMac,&pMac->lim.gpSession[i]);
7050 break;
7051 }
7052
7053 if((pMac->lim.gpSession[i].bssType == eSIR_INFRASTRUCTURE_MODE) &&
7054 (pMac->lim.gpSession[i].limSystemRole == eLIM_STA_ROLE))
7055 {
7056 limHandleHeartBeatFailure(pMac,&pMac->lim.gpSession[i]);
7057 }
7058 }
7059 }
7060 for(i=0; i< pMac->lim.maxBssId; i++)
7061 {
7062 if(pMac->lim.gpSession[i].valid == TRUE )
7063 {
7064 if((pMac->lim.gpSession[i].bssType == eSIR_INFRASTRUCTURE_MODE) &&
7065 (pMac->lim.gpSession[i].limSystemRole == eLIM_STA_ROLE))
7066 {
7067 if(pMac->lim.gpSession[i].LimHBFailureStatus == eANI_BOOLEAN_TRUE)
7068 {
7069 /* Activate Probe After HeartBeat Timer incase HB Failure detected */
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007070 PELOGW(limLog(pMac, LOGW,FL("Sending Probe for Session: %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07007071 i);)
7072 limDeactivateAndChangeTimer(pMac, eLIM_PROBE_AFTER_HB_TIMER);
7073 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, 0, eLIM_PROBE_AFTER_HB_TIMER));
7074 if (tx_timer_activate(&pMac->lim.limTimers.gLimProbeAfterHBTimer) != TX_SUCCESS)
7075 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007076 limLog(pMac, LOGP, FL("Fail to re-activate Probe-after-heartbeat timer"));
Jeff Johnson295189b2012-06-20 16:38:30 -07007077 limReactivateHeartBeatTimer(pMac, &pMac->lim.gpSession[i]);
7078 }
7079 break;
7080 }
7081 }
7082 }
7083 }
7084}
7085
Leela Venkata Kiran Kumar Reddy Chirala3ca17902013-02-27 19:50:05 -08007086void limHandleHeartBeatTimeoutForSession(tpAniSirGlobal pMac, tpPESession psessionEntry)
7087{
7088 if(psessionEntry->valid == TRUE )
7089 {
7090 if(psessionEntry->bssType == eSIR_IBSS_MODE)
7091 {
7092 limIbssHeartBeatHandle(pMac,psessionEntry);
7093 }
7094 if((psessionEntry->bssType == eSIR_INFRASTRUCTURE_MODE) &&
7095 (psessionEntry->limSystemRole == eLIM_STA_ROLE))
7096 {
7097 limHandleHeartBeatFailure(pMac,psessionEntry);
7098 }
7099 }
7100 /* In the function limHandleHeartBeatFailure things can change so check for the session entry valid
7101 and the other things again */
7102 if(psessionEntry->valid == TRUE )
7103 {
7104 if((psessionEntry->bssType == eSIR_INFRASTRUCTURE_MODE) &&
7105 (psessionEntry->limSystemRole == eLIM_STA_ROLE))
7106 {
7107 if(psessionEntry->LimHBFailureStatus == eANI_BOOLEAN_TRUE)
7108 {
7109 /* Activate Probe After HeartBeat Timer incase HB Failure detected */
7110 PELOGW(limLog(pMac, LOGW,FL("Sending Probe for Session: %d"),
7111 psessionEntry->bssIdx);)
7112 limDeactivateAndChangeTimer(pMac, eLIM_PROBE_AFTER_HB_TIMER);
7113 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, 0, eLIM_PROBE_AFTER_HB_TIMER));
7114 if (tx_timer_activate(&pMac->lim.limTimers.gLimProbeAfterHBTimer) != TX_SUCCESS)
7115 {
7116 limLog(pMac, LOGP, FL("Fail to re-activate Probe-after-heartbeat timer"));
7117 limReactivateHeartBeatTimer(pMac, psessionEntry);
7118 }
7119 }
7120 }
7121 }
7122}
7123
7124
Jeff Johnson295189b2012-06-20 16:38:30 -07007125tANI_U8 limGetCurrentOperatingChannel(tpAniSirGlobal pMac)
7126{
7127 tANI_U8 i;
7128 for(i =0;i < pMac->lim.maxBssId;i++)
7129 {
7130 if(pMac->lim.gpSession[i].valid == TRUE )
7131 {
7132 if((pMac->lim.gpSession[i].bssType == eSIR_INFRASTRUCTURE_MODE) &&
7133 (pMac->lim.gpSession[i].limSystemRole == eLIM_STA_ROLE))
7134 {
7135 return pMac->lim.gpSession[i].currentOperChannel;
7136 }
7137 }
7138 }
7139 return 0;
7140}
7141
7142void limProcessAddStaRsp(tpAniSirGlobal pMac,tpSirMsgQ limMsgQ)
7143{
7144
7145 tpPESession psessionEntry;
7146// tANI_U8 sessionId;
7147 tpAddStaParams pAddStaParams;
7148
7149 pAddStaParams = (tpAddStaParams)limMsgQ->bodyptr;
7150
7151 if((psessionEntry = peFindSessionBySessionId(pMac,pAddStaParams->sessionId))==NULL)
7152 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007153 limLog(pMac, LOGP,FL("Session Does not exist for given sessionID"));
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307154 vos_mem_free(pAddStaParams);
Jeff Johnson295189b2012-06-20 16:38:30 -07007155 return;
7156 }
7157 if (psessionEntry->limSystemRole == eLIM_STA_IN_IBSS_ROLE)
7158 (void) limIbssAddStaRsp(pMac, limMsgQ->bodyptr,psessionEntry);
Mohit Khanna698ba2a2012-12-04 15:08:18 -08007159#ifdef FEATURE_WLAN_TDLS
7160 else if(pMac->lim.gLimAddStaTdls)
7161 {
7162 limProcessTdlsAddStaRsp(pMac, limMsgQ->bodyptr, psessionEntry) ;
7163 pMac->lim.gLimAddStaTdls = FALSE ;
7164 }
7165#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07007166 else
7167 limProcessMlmAddStaRsp(pMac, limMsgQ,psessionEntry);
7168
7169}
7170
7171
7172void limUpdateBeacon(tpAniSirGlobal pMac)
7173{
7174 tANI_U8 i;
7175
7176 for(i =0;i < pMac->lim.maxBssId;i++)
7177 {
7178 if(pMac->lim.gpSession[i].valid == TRUE )
7179 {
7180 if( ( (pMac->lim.gpSession[i].limSystemRole == eLIM_AP_ROLE) ||
7181 (pMac->lim.gpSession[i].limSystemRole == eLIM_STA_IN_IBSS_ROLE) )
7182 && (eLIM_SME_NORMAL_STATE == pMac->lim.gpSession[i].limSmeState)
7183 )
7184 {
7185 schSetFixedBeaconFields(pMac,&pMac->lim.gpSession[i]);
7186 limSendBeaconInd(pMac, &pMac->lim.gpSession[i]);
7187 }
7188 else
7189 {
7190 if( (pMac->lim.gpSession[i].limSystemRole == eLIM_BT_AMP_AP_ROLE)||
7191 (pMac->lim.gpSession[i].limSystemRole == eLIM_BT_AMP_STA_ROLE))
7192 {
7193
7194 if(pMac->lim.gpSession[i].statypeForBss == STA_ENTRY_SELF)
7195 {
7196 schSetFixedBeaconFields(pMac,&pMac->lim.gpSession[i]);
7197 }
7198 }
7199 }
7200 }
7201 }
7202}
7203
7204void limHandleHeartBeatFailureTimeout(tpAniSirGlobal pMac)
7205{
7206 tANI_U8 i;
7207 tpPESession psessionEntry;
7208 /* Probe response is not received after HB failure. This is handled by LMM sub module. */
7209 for(i =0; i < pMac->lim.maxBssId; i++)
7210 {
7211 if(pMac->lim.gpSession[i].valid == TRUE)
7212 {
7213 psessionEntry = &pMac->lim.gpSession[i];
7214 if(psessionEntry->LimHBFailureStatus == eANI_BOOLEAN_TRUE)
7215 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007216 limLog(pMac, LOGE, FL("Probe_hb_failure: SME %d, MLME %d, HB-Count %d"),psessionEntry->limSmeState,
Jeff Johnson295189b2012-06-20 16:38:30 -07007217 psessionEntry->limMlmState, psessionEntry->LimRxedBeaconCntDuringHB);
Leela Venkata Kiran Kumar Reddy Chirala2365ee62013-05-09 17:30:12 -07007218#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
7219 limDiagEventReport(pMac, WLAN_PE_DIAG_HB_FAILURE_TIMEOUT, psessionEntry, 0, 0);
7220#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07007221 if (psessionEntry->limMlmState == eLIM_MLM_LINK_ESTABLISHED_STATE)
7222 {
Leela Venkata Kiran Kumar Reddy Chiralaab842fb2013-04-30 12:27:35 -07007223 if ((!LIM_IS_CONNECTION_ACTIVE(psessionEntry))&&
7224 (psessionEntry->limSmeState != eLIM_SME_WT_DISASSOC_STATE))
Jeff Johnson295189b2012-06-20 16:38:30 -07007225 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007226 limLog(pMac, LOGE, FL("Probe_hb_failure: for session:%d " ),psessionEntry->peSessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07007227 /* AP did not respond to Probe Request. Tear down link with it.*/
7228 limTearDownLinkWithAp(pMac,
7229 psessionEntry->peSessionId,
7230 eSIR_BEACON_MISSED);
7231 pMac->lim.gLimProbeFailureAfterHBfailedCnt++ ;
7232 }
7233 else // restart heartbeat timer
7234 {
7235 limReactivateHeartBeatTimer(pMac, psessionEntry);
7236 }
7237 }
7238 else
7239 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007240 limLog(pMac, LOGE, FL("Unexpected wt-probe-timeout in state "));
Jeff Johnson295189b2012-06-20 16:38:30 -07007241 limPrintMlmState(pMac, LOGE, psessionEntry->limMlmState);
7242 limReactivateHeartBeatTimer(pMac, psessionEntry);
7243 }
7244
7245 }
7246 }
7247 }
7248 /* Deactivate Timer ProbeAfterHB Timer -> As its a oneshot timer, need not deactivate the timer */
7249 // tx_timer_deactivate(&pMac->lim.limTimers.gLimProbeAfterHBTimer);
7250}
7251
7252
7253/*
7254* This function assumes there will not be more than one IBSS session active at any time.
7255*/
7256tpPESession limIsIBSSSessionActive(tpAniSirGlobal pMac)
7257{
7258 tANI_U8 i;
7259
7260 for(i =0;i < pMac->lim.maxBssId;i++)
7261 {
7262 if( (pMac->lim.gpSession[i].valid) &&
7263 (pMac->lim.gpSession[i].limSystemRole == eLIM_STA_IN_IBSS_ROLE))
7264 return (&pMac->lim.gpSession[i]);
7265 }
7266
7267 return NULL;
7268}
7269
7270tpPESession limIsApSessionActive(tpAniSirGlobal pMac)
7271{
7272 tANI_U8 i;
7273
7274 for(i =0;i < pMac->lim.maxBssId;i++)
7275 {
7276 if( (pMac->lim.gpSession[i].valid) &&
7277 ( (pMac->lim.gpSession[i].limSystemRole == eLIM_AP_ROLE) ||
7278 (pMac->lim.gpSession[i].limSystemRole == eLIM_BT_AMP_AP_ROLE)))
7279 return (&pMac->lim.gpSession[i]);
7280 }
7281
7282 return NULL;
7283}
7284
7285/**---------------------------------------------------------
7286\fn limHandleDeferMsgError
7287\brief handles error scenario, when the msg can not be deferred.
7288\param pMac
7289\param pLimMsg LIM msg, which could not be deferred.
7290\return void
7291-----------------------------------------------------------*/
7292
7293void limHandleDeferMsgError(tpAniSirGlobal pMac, tpSirMsgQ pLimMsg)
7294{
7295 if(SIR_BB_XPORT_MGMT_MSG == pLimMsg->type)
7296 {
7297 vos_pkt_return_packet((vos_pkt_t*)pLimMsg->bodyptr);
7298 }
7299 else if(pLimMsg->bodyptr != NULL)
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08007300 {
7301 vos_mem_free( pLimMsg->bodyptr);
7302 pLimMsg->bodyptr = NULL;
7303 }
Jeff Johnson295189b2012-06-20 16:38:30 -07007304}
7305
7306
7307#ifdef FEATURE_WLAN_DIAG_SUPPORT
7308/**---------------------------------------------------------
7309\fn limDiagEventReport
7310\brief This function reports Diag event
7311\param pMac
7312\param eventType
7313\param bssid
7314\param status
7315\param reasonCode
7316\return void
7317-----------------------------------------------------------*/
7318void limDiagEventReport(tpAniSirGlobal pMac, tANI_U16 eventType, tpPESession pSessionEntry, tANI_U16 status, tANI_U16 reasonCode)
7319{
7320 tSirMacAddr nullBssid = { 0, 0, 0, 0, 0, 0 };
7321 WLAN_VOS_DIAG_EVENT_DEF(peEvent, vos_event_wlan_pe_payload_type);
7322
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307323 vos_mem_set(&peEvent, sizeof(vos_event_wlan_pe_payload_type), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07007324
7325 if (NULL == pSessionEntry)
7326 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307327 vos_mem_copy( peEvent.bssid, nullBssid, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07007328 peEvent.sme_state = (tANI_U16)pMac->lim.gLimSmeState;
7329 peEvent.mlm_state = (tANI_U16)pMac->lim.gLimMlmState;
7330
7331 }
7332 else
7333 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307334 vos_mem_copy(peEvent.bssid, pSessionEntry->bssId, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07007335 peEvent.sme_state = (tANI_U16)pSessionEntry->limSmeState;
7336 peEvent.mlm_state = (tANI_U16)pSessionEntry->limMlmState;
7337 }
7338 peEvent.event_type = eventType;
7339 peEvent.status = status;
7340 peEvent.reason_code = reasonCode;
7341
7342 WLAN_VOS_DIAG_EVENT_REPORT(&peEvent, EVENT_WLAN_PE);
7343 return;
7344}
7345
7346#endif /* FEATURE_WLAN_DIAG_SUPPORT */
7347
7348void limProcessAddStaSelfRsp(tpAniSirGlobal pMac,tpSirMsgQ limMsgQ)
7349{
7350
7351 tpAddStaSelfParams pAddStaSelfParams;
7352 tSirMsgQ mmhMsg;
7353 tpSirSmeAddStaSelfRsp pRsp;
7354
7355
7356 pAddStaSelfParams = (tpAddStaSelfParams)limMsgQ->bodyptr;
7357
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307358 pRsp = vos_mem_malloc(sizeof(tSirSmeAddStaSelfRsp));
7359 if ( NULL == pRsp )
Jeff Johnson295189b2012-06-20 16:38:30 -07007360 {
7361 /// Buffer not available. Log error
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307362 limLog(pMac, LOGP, FL("call to AllocateMemory failed for Add Sta self RSP"));
7363 vos_mem_free(pAddStaSelfParams);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08007364 limMsgQ->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07007365 return;
7366 }
7367
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307368 vos_mem_set((tANI_U8*)pRsp, sizeof(tSirSmeAddStaSelfRsp), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07007369
7370 pRsp->mesgType = eWNI_SME_ADD_STA_SELF_RSP;
7371 pRsp->mesgLen = (tANI_U16) sizeof(tSirSmeAddStaSelfRsp);
7372 pRsp->status = pAddStaSelfParams->status;
7373
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307374 vos_mem_copy( pRsp->selfMacAddr, pAddStaSelfParams->selfMacAddr, sizeof(tSirMacAddr) );
Jeff Johnson295189b2012-06-20 16:38:30 -07007375
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307376 vos_mem_free(pAddStaSelfParams);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08007377 limMsgQ->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07007378
7379 mmhMsg.type = eWNI_SME_ADD_STA_SELF_RSP;
7380 mmhMsg.bodyptr = pRsp;
7381 mmhMsg.bodyval = 0;
Jeff Johnsone7245742012-09-05 17:12:55 -07007382 MTRACE(macTraceMsgTx(pMac, NO_SESSION, mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07007383 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
7384
7385}
7386
7387void limProcessDelStaSelfRsp(tpAniSirGlobal pMac,tpSirMsgQ limMsgQ)
7388{
7389
7390 tpDelStaSelfParams pDelStaSelfParams;
7391 tSirMsgQ mmhMsg;
7392 tpSirSmeDelStaSelfRsp pRsp;
7393
7394
7395 pDelStaSelfParams = (tpDelStaSelfParams)limMsgQ->bodyptr;
7396
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307397 pRsp = vos_mem_malloc(sizeof(tSirSmeDelStaSelfRsp));
7398 if ( NULL == pRsp )
Jeff Johnson295189b2012-06-20 16:38:30 -07007399 {
7400 /// Buffer not available. Log error
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307401 limLog(pMac, LOGP, FL("call to AllocateMemory failed for Add Sta self RSP"));
7402 vos_mem_free(pDelStaSelfParams);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08007403 limMsgQ->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07007404 return;
7405 }
7406
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307407 vos_mem_set((tANI_U8*)pRsp, sizeof(tSirSmeDelStaSelfRsp), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07007408
7409 pRsp->mesgType = eWNI_SME_DEL_STA_SELF_RSP;
7410 pRsp->mesgLen = (tANI_U16) sizeof(tSirSmeDelStaSelfRsp);
7411 pRsp->status = pDelStaSelfParams->status;
7412
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307413 vos_mem_copy( pRsp->selfMacAddr, pDelStaSelfParams->selfMacAddr, sizeof(tSirMacAddr) );
Jeff Johnson295189b2012-06-20 16:38:30 -07007414
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307415 vos_mem_free(pDelStaSelfParams);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08007416 limMsgQ->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07007417
7418 mmhMsg.type = eWNI_SME_DEL_STA_SELF_RSP;
7419 mmhMsg.bodyptr = pRsp;
7420 mmhMsg.bodyval = 0;
Jeff Johnsone7245742012-09-05 17:12:55 -07007421 MTRACE(macTraceMsgTx(pMac, NO_SESSION, mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07007422 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
7423
7424}
7425
7426/***************************************************************
7427* tANI_U8 limUnmapChannel(tANI_U8 mapChannel)
7428* To unmap the channel to reverse the effect of mapping
7429* a band channel in hal .Mapping was done hal to overcome the
7430* limitation of the rxbd which use only 4 bit for channel number.
7431*****************************************************************/
7432tANI_U8 limUnmapChannel(tANI_U8 mapChannel)
7433{
7434 if( mapChannel > 0 && mapChannel < 25 )
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07007435#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
7436 if (IS_ROAM_SCAN_OFFLOAD_FEATURE_ENABLE)
7437 return aUnsortedChannelList[mapChannel -1];
7438 else
7439#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07007440 return abChannel[mapChannel -1];
7441 else
7442 return 0;
7443}
7444
7445
7446v_U8_t* limGetIEPtr(tpAniSirGlobal pMac, v_U8_t *pIes, int length, v_U8_t eid,eSizeOfLenField size_of_len_field)
7447{
7448 int left = length;
7449 v_U8_t *ptr = pIes;
7450 v_U8_t elem_id;
7451 v_U16_t elem_len;
7452
7453 while(left >= (size_of_len_field+1))
7454 {
7455 elem_id = ptr[0];
7456 if (size_of_len_field == TWO_BYTE)
7457 {
7458 elem_len = ((v_U16_t) ptr[1]) | (ptr[2]<<8);
7459 }
7460 else
7461 {
7462 elem_len = ptr[1];
7463 }
7464
7465
7466 left -= (size_of_len_field+1);
7467 if(elem_len > left)
7468 {
7469 limLog(pMac, LOGE,
Madan Mohan Koyyalamudi8bdd3112012-09-24 13:55:14 -07007470 FL("****Invalid IEs eid = %d elem_len=%d left=%d*****"),
Jeff Johnson295189b2012-06-20 16:38:30 -07007471 eid,elem_len,left);
7472 return NULL;
7473 }
7474 if (elem_id == eid)
7475 {
7476 return ptr;
7477 }
7478
7479 left -= elem_len;
7480 ptr += (elem_len + (size_of_len_field+1));
7481 }
7482 return NULL;
7483}
7484
7485/* return NULL if oui is not found in ie
7486 return !NULL pointer to vendor IE (starting from 0xDD) if oui is found
7487 */
7488v_U8_t* limGetVendorIEOuiPtr(tpAniSirGlobal pMac, tANI_U8 *oui, tANI_U8 oui_size, tANI_U8 *ie, tANI_U16 ie_len)
7489{
7490 int left = ie_len;
7491 v_U8_t *ptr = ie;
7492 v_U8_t elem_id, elem_len;
7493
7494 while(left >= 2)
7495 {
7496 elem_id = ptr[0];
7497 elem_len = ptr[1];
7498 left -= 2;
7499 if(elem_len > left)
7500 {
7501 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007502 FL("****Invalid IEs eid = %d elem_len=%d left=%d*****"),
Jeff Johnson295189b2012-06-20 16:38:30 -07007503 elem_id,elem_len,left);
7504 return NULL;
7505 }
7506 if (SIR_MAC_EID_VENDOR == elem_id)
7507 {
7508 if(memcmp(&ptr[2], oui, oui_size)==0)
7509 return ptr;
7510 }
7511
7512 left -= elem_len;
7513 ptr += (elem_len + 2);
7514 }
7515 return NULL;
7516}
7517
Jeff Johnson295189b2012-06-20 16:38:30 -07007518//Returns length of P2P stream and Pointer ie passed to this function is filled with noa stream
7519
7520v_U8_t limBuildP2pIe(tpAniSirGlobal pMac, tANI_U8 *ie, tANI_U8 *data, tANI_U8 ie_len)
7521{
7522 int length = 0;
7523 tANI_U8 *ptr = ie;
7524
7525 ptr[length++] = SIR_MAC_EID_VENDOR;
7526 ptr[length++] = ie_len + SIR_MAC_P2P_OUI_SIZE;
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307527 vos_mem_copy(&ptr[length], SIR_MAC_P2P_OUI, SIR_MAC_P2P_OUI_SIZE);
7528 vos_mem_copy(&ptr[length + SIR_MAC_P2P_OUI_SIZE], data, ie_len);
Jeff Johnson295189b2012-06-20 16:38:30 -07007529 return (ie_len + SIR_P2P_IE_HEADER_LEN);
7530}
7531
7532//Returns length of NoA stream and Pointer pNoaStream passed to this function is filled with noa stream
7533
7534v_U8_t limGetNoaAttrStreamInMultP2pIes(tpAniSirGlobal pMac,v_U8_t* noaStream,v_U8_t noaLen,v_U8_t overFlowLen)
7535{
7536 v_U8_t overFlowP2pStream[SIR_MAX_NOA_ATTR_LEN];
Krunal Sonic768a932013-05-15 19:26:30 -07007537
7538 if ((noaLen <= (SIR_MAX_NOA_ATTR_LEN+SIR_P2P_IE_HEADER_LEN)) &&
7539 (noaLen >= overFlowLen) && (overFlowLen <= SIR_MAX_NOA_ATTR_LEN))
7540 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307541 vos_mem_copy(overFlowP2pStream,
Krunal Sonic768a932013-05-15 19:26:30 -07007542 noaStream + noaLen - overFlowLen, overFlowLen);
7543 noaStream[noaLen - overFlowLen] = SIR_MAC_EID_VENDOR;
7544 noaStream[noaLen - overFlowLen + 1] = overFlowLen + SIR_MAC_P2P_OUI_SIZE;
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307545 vos_mem_copy(noaStream+noaLen-overFlowLen + 2,
Krunal Sonic768a932013-05-15 19:26:30 -07007546 SIR_MAC_P2P_OUI, SIR_MAC_P2P_OUI_SIZE);
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307547 vos_mem_copy(noaStream+noaLen + 2 + SIR_MAC_P2P_OUI_SIZE - overFlowLen,
7548 overFlowP2pStream, overFlowLen);
Krunal Sonic768a932013-05-15 19:26:30 -07007549 }
7550
Jeff Johnson295189b2012-06-20 16:38:30 -07007551 return (noaLen + SIR_P2P_IE_HEADER_LEN);
7552
7553}
7554
7555//Returns length of NoA stream and Pointer pNoaStream passed to this function is filled with noa stream
7556v_U8_t limGetNoaAttrStream(tpAniSirGlobal pMac, v_U8_t*pNoaStream,tpPESession psessionEntry)
7557{
7558 v_U8_t len=0;
7559
7560 v_U8_t *pBody = pNoaStream;
7561
7562
7563 if ( (psessionEntry != NULL) && (psessionEntry->valid) &&
7564 (psessionEntry->pePersona == VOS_P2P_GO_MODE))
7565 {
7566 if ((!(psessionEntry->p2pGoPsUpdate.uNoa1Duration)) && (!(psessionEntry->p2pGoPsUpdate.uNoa2Duration))
7567 && (!psessionEntry->p2pGoPsUpdate.oppPsFlag)
7568 )
7569 return 0; //No NoA Descriptor then return 0
7570
7571
7572 pBody[0] = SIR_P2P_NOA_ATTR;
7573
7574 pBody[3] = psessionEntry->p2pGoPsUpdate.index;
7575 pBody[4] = psessionEntry->p2pGoPsUpdate.ctWin | (psessionEntry->p2pGoPsUpdate.oppPsFlag<<7);
7576 len = 5;
7577 pBody += len;
7578
7579
7580 if (psessionEntry->p2pGoPsUpdate.uNoa1Duration)
7581 {
7582 *pBody = psessionEntry->p2pGoPsUpdate.uNoa1IntervalCnt;
7583 pBody += 1;
7584 len +=1;
7585
7586 *((tANI_U32 *)(pBody)) = sirSwapU32ifNeeded(psessionEntry->p2pGoPsUpdate.uNoa1Duration);
7587 pBody += sizeof(tANI_U32);
7588 len +=4;
7589
7590 *((tANI_U32 *)(pBody)) = sirSwapU32ifNeeded(psessionEntry->p2pGoPsUpdate.uNoa1Interval);
7591 pBody += sizeof(tANI_U32);
7592 len +=4;
7593
7594 *((tANI_U32 *)(pBody)) = sirSwapU32ifNeeded(psessionEntry->p2pGoPsUpdate.uNoa1StartTime);
7595 pBody += sizeof(tANI_U32);
7596 len +=4;
7597
7598 }
7599
7600 if (psessionEntry->p2pGoPsUpdate.uNoa2Duration)
7601 {
7602 *pBody = psessionEntry->p2pGoPsUpdate.uNoa2IntervalCnt;
7603 pBody += 1;
7604 len +=1;
7605
7606 *((tANI_U32 *)(pBody)) = sirSwapU32ifNeeded(psessionEntry->p2pGoPsUpdate.uNoa2Duration);
7607 pBody += sizeof(tANI_U32);
7608 len +=4;
7609
7610 *((tANI_U32 *)(pBody)) = sirSwapU32ifNeeded(psessionEntry->p2pGoPsUpdate.uNoa2Interval);
7611 pBody += sizeof(tANI_U32);
7612 len +=4;
7613
7614 *((tANI_U32 *)(pBody)) = sirSwapU32ifNeeded(psessionEntry->p2pGoPsUpdate.uNoa2StartTime);
7615 pBody += sizeof(tANI_U32);
7616 len +=4;
7617
7618 }
7619
7620
7621 pBody = pNoaStream + 1;
7622 *((tANI_U16 *)(pBody)) = sirSwapU16ifNeeded(len-3);/*one byte for Attr and 2 bytes for length*/
7623
7624 return (len);
7625
7626 }
7627 return 0;
7628
7629}
Jeff Johnsone7245742012-09-05 17:12:55 -07007630
7631void peSetResumeChannel(tpAniSirGlobal pMac, tANI_U16 channel, ePhyChanBondState phyCbState)
Jeff Johnson295189b2012-06-20 16:38:30 -07007632{
7633
7634 pMac->lim.gResumeChannel = channel;
Jeff Johnsone7245742012-09-05 17:12:55 -07007635 pMac->lim.gResumePhyCbState = phyCbState;
Jeff Johnson295189b2012-06-20 16:38:30 -07007636}
Jeff Johnsone7245742012-09-05 17:12:55 -07007637
Jeff Johnson295189b2012-06-20 16:38:30 -07007638/*--------------------------------------------------------------------------
7639
7640 \brief peGetResumeChannel() - Returns the channel number for scanning, from a valid session.
7641
Jeff Johnsone7245742012-09-05 17:12:55 -07007642 This function returns the channel to resume to during link resume. channel id of 0 means HAL will
7643 resume to previous channel before link suspend
Jeff Johnson295189b2012-06-20 16:38:30 -07007644
7645 \param pMac - pointer to global adapter context
7646 \return - channel to scan from valid session else zero.
7647
7648 \sa
7649
7650 --------------------------------------------------------------------------*/
Jeff Johnsone7245742012-09-05 17:12:55 -07007651void peGetResumeChannel(tpAniSirGlobal pMac, tANI_U8* resumeChannel, ePhyChanBondState* resumePhyCbState)
Jeff Johnson295189b2012-06-20 16:38:30 -07007652{
7653
7654 //Rationale - this could be the suspend/resume for assoc and it is essential that
7655 //the new BSS is active for some time. Other BSS was anyway suspended.
7656 //TODO: Comeup with a better alternative. Sending NULL with PM=0 on other BSS means
7657 //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 -07007658 //and hence should be ok. Need to discuss this further
7659 if( !limIsInMCC(pMac) )
Jeff Johnson295189b2012-06-20 16:38:30 -07007660 {
7661 //Get current active session channel
Jeff Johnsone7245742012-09-05 17:12:55 -07007662 peGetActiveSessionChannel(pMac, resumeChannel, resumePhyCbState);
Jeff Johnson295189b2012-06-20 16:38:30 -07007663 }
7664 else
7665 {
Jeff Johnsone7245742012-09-05 17:12:55 -07007666 *resumeChannel = pMac->lim.gResumeChannel;
7667 *resumePhyCbState = pMac->lim.gResumePhyCbState;
Jeff Johnson295189b2012-06-20 16:38:30 -07007668 }
Jeff Johnsone7245742012-09-05 17:12:55 -07007669 return;
Jeff Johnson295189b2012-06-20 16:38:30 -07007670}
7671
Viral Modid86bde22012-12-10 13:09:21 -08007672tANI_BOOLEAN limIsNOAInsertReqd(tpAniSirGlobal pMac)
7673{
7674 tANI_U8 i;
7675 for(i =0; i < pMac->lim.maxBssId; i++)
7676 {
7677 if(pMac->lim.gpSession[i].valid == TRUE)
7678 {
7679 if( (eLIM_AP_ROLE == pMac->lim.gpSession[i].limSystemRole )
7680 && ( VOS_P2P_GO_MODE == pMac->lim.gpSession[i].pePersona )
7681 )
7682 {
7683 return TRUE;
7684 }
7685 }
7686 }
7687 return FALSE;
7688}
Jeff Johnsone7245742012-09-05 17:12:55 -07007689
Jeff Johnson295189b2012-06-20 16:38:30 -07007690
7691tANI_BOOLEAN limIsconnectedOnDFSChannel(tANI_U8 currentChannel)
7692{
7693 if(NV_CHANNEL_DFS == vos_nv_getChannelEnabledState(currentChannel))
7694 {
7695 return eANI_BOOLEAN_TRUE;
7696 }
7697 else
7698 {
7699 return eANI_BOOLEAN_FALSE;
7700 }
7701}
Madan Mohan Koyyalamudi1bed5982012-10-22 14:38:06 -07007702
Sandeep Puligilla60342762014-01-30 21:05:37 +05307703/**
7704 * \brief verify the changes in channel bonding
7705 *
7706 * \param pMac Pointer to the global MAC structure
7707 *
7708 * \param psessionEntry session entry
7709 * beaconSecChanWidth Secondary channel width
7710 * advertized in beacon
7711 * currentSecChanWidth Current configured width
7712 * staId Station Id
7713 * \return eSIR_SUCCESS on success, eSIR_FAILURE else
7714 */
7715tANI_BOOLEAN limCheckHTChanBondModeChange(tpAniSirGlobal pMac,
7716 tpPESession psessionEntry,
7717 tANI_U8 beaconSecChanWidth,
7718 tANI_U8 currentSecChanWidth,
7719 tANI_U8 staId)
7720{
7721 tUpdateVHTOpMode tempParam;
7722 tANI_BOOLEAN fCbMode24G = FALSE;
7723 tANI_BOOLEAN status = eANI_BOOLEAN_FALSE;
7724
7725 /* Moving from HT40 to HT20 operation*/
7726 if (((PHY_DOUBLE_CHANNEL_LOW_PRIMARY == currentSecChanWidth) ||
7727 (PHY_DOUBLE_CHANNEL_HIGH_PRIMARY == currentSecChanWidth))
7728 && (PHY_SINGLE_CHANNEL_CENTERED == beaconSecChanWidth))
7729 {
7730 tempParam.opMode = eHT_CHANNEL_WIDTH_20MHZ;
7731 tempParam.staId = staId;
7732 fCbMode24G = TRUE;
7733 }
7734
7735 /* Moving from HT20 to HT40 operation*/
7736 if ((( PHY_DOUBLE_CHANNEL_LOW_PRIMARY == beaconSecChanWidth) ||
7737 ( PHY_DOUBLE_CHANNEL_HIGH_PRIMARY == beaconSecChanWidth ))
7738 && (PHY_SINGLE_CHANNEL_CENTERED == currentSecChanWidth))
7739 {
7740 tempParam.opMode = eHT_CHANNEL_WIDTH_40MHZ;
7741 tempParam.staId = staId;
7742 fCbMode24G = TRUE;
7743 }
7744
7745 if (TRUE == fCbMode24G)
7746 {
7747 VOS_TRACE( VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,
7748 "Changing CBMODE to = %d staId = %d",
7749 tempParam.opMode, tempParam.staId );
7750 if( eSIR_SUCCESS == limSendModeUpdate(pMac, &tempParam, psessionEntry))
7751 status = eANI_BOOLEAN_TRUE;
7752 }
7753 return status;
7754}
7755
Mohit Khanna4a70d262012-09-11 16:30:12 -07007756#ifdef WLAN_FEATURE_11AC
7757tANI_BOOLEAN limCheckVHTOpModeChange( tpAniSirGlobal pMac, tpPESession psessionEntry, tANI_U8 chanWidth, tANI_U8 staId)
7758{
7759 tUpdateVHTOpMode tempParam;
7760
7761 tempParam.opMode = chanWidth;
7762 tempParam.staId = staId;
7763
7764 limSendModeUpdate( pMac, &tempParam, psessionEntry );
7765
7766 return eANI_BOOLEAN_TRUE;
7767}
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -07007768#endif
7769
7770tANI_U8 limGetShortSlotFromPhyMode(tpAniSirGlobal pMac, tpPESession psessionEntry, tANI_U32 phyMode)
7771{
7772 tANI_U8 val=0;
7773
7774 if (phyMode == WNI_CFG_PHY_MODE_11A)
7775 {
7776 // 11a mode always uses short slot
7777 // Check this since some APs in 11a mode broadcast long slot in their beacons. As per standard, always use what PHY mandates.
7778 val = true;
7779 }
7780 else if (phyMode == WNI_CFG_PHY_MODE_11G)
7781 {
7782 if ((psessionEntry->pePersona == VOS_STA_SAP_MODE) ||
Ravi Joshi27216f12013-10-19 17:04:39 -07007783 (psessionEntry->pePersona == VOS_IBSS_MODE) ||
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -07007784 (psessionEntry->pePersona == VOS_P2P_GO_MODE))
7785 {
7786 val = true;
7787 }
7788
7789 // Program Polaris based on AP capability
7790
7791 if (psessionEntry->limMlmState == eLIM_MLM_WT_JOIN_BEACON_STATE)
7792 // Joining BSS.
7793 val = SIR_MAC_GET_SHORT_SLOT_TIME( psessionEntry->limCurrentBssCaps);
7794 else if (psessionEntry->limMlmState == eLIM_MLM_WT_REASSOC_RSP_STATE)
7795 // Reassociating with AP.
7796 val = SIR_MAC_GET_SHORT_SLOT_TIME( psessionEntry->limReassocBssCaps);
7797 }
7798 else // if (phyMode == WNI_CFG_PHY_MODE_11B) - use this if another phymode is added later ON
7799 {
7800 // Will reach here in 11b case
7801 val = false;
7802 }
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007803 limLog(pMac, LOG1, FL("phyMode = %u shortslotsupported = %u"), phyMode, val);
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -07007804 return val;
7805}
Sandeep Puligilla11d49a62014-01-30 12:05:16 +05307806
7807/**--------------------------------------------
7808\fn limUpdateOBSSScanParams
7809\brief Updates OBSS SCAN IE parameters to session
7810
7811\param psessionEntry - Session Entry
7812\return NONE
7813---------------------------------------------*/
7814void limUpdateOBSSScanParams(tpPESession psessionEntry ,
7815 tDot11fIEOBSSScanParameters *pOBSSScanParameters)
7816{
7817 /*If the recieved value is not in the range specified by the Specification
7818 then it will be the default value configured through cfg */
7819 if (( pOBSSScanParameters->obssScanActiveDwell >
7820 WNI_CFG_OBSS_HT40_SCAN_ACTIVE_DWELL_TIME_STAMIN ) &&
7821 ( pOBSSScanParameters->obssScanActiveDwell <
7822 WNI_CFG_OBSS_HT40_SCAN_ACTIVE_DWELL_TIME_STAMAX))
7823 {
7824 psessionEntry->obssHT40ScanParam.OBSSScanActiveDwellTime=
7825 pOBSSScanParameters->obssScanActiveDwell;
7826 }
7827 if((pOBSSScanParameters->obssScanPassiveDwell >
7828 WNI_CFG_OBSS_HT40_SCAN_PASSIVE_DWELL_TIME_STAMIN ) &&
7829 (pOBSSScanParameters->obssScanPassiveDwell <
7830 WNI_CFG_OBSS_HT40_SCAN_PASSIVE_DWELL_TIME_STAMAX))
7831 {
7832 psessionEntry->obssHT40ScanParam.OBSSScanPassiveDwellTime =
7833 pOBSSScanParameters->obssScanPassiveDwell;
7834 }
7835 if((pOBSSScanParameters->bssWidthChannelTransitionDelayFactor >
7836 WNI_CFG_OBSS_HT40_WIDTH_CHANNEL_TRANSITION_DELAY_FACTOR_STAMIN) &&
7837 (pOBSSScanParameters->bssWidthChannelTransitionDelayFactor <
7838 WNI_CFG_OBSS_HT40_WIDTH_CHANNEL_TRANSITION_DELAY_FACTOR_STAMAX))
7839 {
7840 psessionEntry->obssHT40ScanParam.BSSWidthChannelTransitionDelayFactor =
7841 pOBSSScanParameters->bssWidthChannelTransitionDelayFactor;
7842 }
7843 if((pOBSSScanParameters->obssScanActiveTotalPerChannel >
7844 WNI_CFG_OBSS_HT40_SCAN_ACTIVE_TOTAL_PER_CHANNEL_STAMIN) &&
7845 (pOBSSScanParameters->obssScanActiveTotalPerChannel <
7846 WNI_CFG_OBSS_HT40_SCAN_ACTIVE_TOTAL_PER_CHANNEL_STAMAX))
7847 {
7848 psessionEntry->obssHT40ScanParam.OBSSScanActiveTotalPerChannel =
7849 pOBSSScanParameters->obssScanActiveTotalPerChannel;
7850 }
7851 if((pOBSSScanParameters->obssScanPassiveTotalPerChannel >
7852 WNI_CFG_OBSS_HT40_SCAN_PASSIVE_TOTAL_PER_CHANNEL_STAMIN) &&
7853 (pOBSSScanParameters->obssScanPassiveTotalPerChannel <
7854 WNI_CFG_OBSS_HT40_SCAN_PASSIVE_TOTAL_PER_CHANNEL_STAMAX))
7855 {
7856 psessionEntry->obssHT40ScanParam.OBSSScanPassiveTotalPerChannel =
7857 pOBSSScanParameters->obssScanPassiveTotalPerChannel;
7858 }
7859 if((pOBSSScanParameters->bssChannelWidthTriggerScanInterval >
7860 WNI_CFG_OBSS_HT40_SCAN_WIDTH_TRIGGER_INTERVAL_STAMIN) &&
7861 (pOBSSScanParameters->bssChannelWidthTriggerScanInterval <
7862 WNI_CFG_OBSS_HT40_SCAN_WIDTH_TRIGGER_INTERVAL_STAMAX))
7863 {
7864 psessionEntry->obssHT40ScanParam.BSSChannelWidthTriggerScanInterval =
7865 pOBSSScanParameters->bssChannelWidthTriggerScanInterval;
7866 }
7867 if((pOBSSScanParameters->obssScanActivityThreshold >
7868 WNI_CFG_OBSS_HT40_SCAN_ACTIVITY_THRESHOLD_STAMIN )&&
7869 (pOBSSScanParameters->obssScanActivityThreshold <
7870 WNI_CFG_OBSS_HT40_SCAN_ACTIVITY_THRESHOLD_STAMAX))
7871 {
7872 psessionEntry->obssHT40ScanParam.OBSSScanActivityThreshold =
7873 pOBSSScanParameters->obssScanActivityThreshold;
7874 }
7875}