blob: 879e3c9fb1d0e8052f07db33b1b6a920eebc1b6a [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
91/** -------------------------------------------------------------
92\fn limAssignDialogueToken
93\brief Assigns dialogue token.
94\param tpAniSirGlobal pMac
95\return tpDialogueToken - dialogueToken data structure.
96 -------------------------------------------------------------*/
97
98tpDialogueToken
99limAssignDialogueToken(tpAniSirGlobal pMac)
100{
Madan Mohan Koyyalamudidfd6aa82012-10-18 20:18:43 -0700101 static tANI_U8 token;
Jeff Johnson295189b2012-06-20 16:38:30 -0700102 tpDialogueToken pCurrNode;
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530103 pCurrNode = vos_mem_malloc(sizeof(tDialogueToken));
104 if ( NULL == pCurrNode )
Jeff Johnson295189b2012-06-20 16:38:30 -0700105 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530106 PELOGE(limLog(pMac, LOGE, FL("AllocateMemory failed"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700107 return NULL;
108 }
109
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530110 vos_mem_set((void *) pCurrNode, sizeof(tDialogueToken), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -0700111 //first node in the list is being added.
112 if(NULL == pMac->lim.pDialogueTokenHead)
113 {
114 pMac->lim.pDialogueTokenHead = pMac->lim.pDialogueTokenTail = pCurrNode;
115 }
116 else
117 {
118 pMac->lim.pDialogueTokenTail->next = pCurrNode;
119 pMac->lim.pDialogueTokenTail = pCurrNode;
120 }
121 //assocId and tid of the node will be filled in by caller.
122 pCurrNode->next = NULL;
123 pCurrNode->token = token++;
Praveen Kumar Sirisilla539f7422013-08-28 17:01:05 -0700124
125 /* Dialog token should be a non-zero value */
126 if (0 == pCurrNode->token)
127 pCurrNode->token = token;
128
129 PELOG4(limLog(pMac, LOG4, FL("token assigned = %d"), pCurrNode->token);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700130 return pCurrNode;
131}
132
133/** -------------------------------------------------------------
134\fn limSearchAndDeleteDialogueToken
135\brief search dialogue token in the list and deletes it if found. returns failure if not found.
136\param tpAniSirGlobal pMac
137\param tANI_U8 token
138\param tANI_U16 assocId
139\param tANI_U16 tid
140\return eSirRetStatus - status of the search
141 -------------------------------------------------------------*/
142
143
144tSirRetStatus
145limSearchAndDeleteDialogueToken(tpAniSirGlobal pMac, tANI_U8 token, tANI_U16 assocId, tANI_U16 tid)
146{
147 tpDialogueToken pCurrNode = pMac->lim.pDialogueTokenHead;
148 tpDialogueToken pPrevNode = pMac->lim.pDialogueTokenHead;
149
150 //if the list is empty
151 if(NULL == pCurrNode)
152 return eSIR_FAILURE;
153
154 // if the matching node is the first node.
155 if(pCurrNode &&
156 (assocId == pCurrNode->assocId) &&
157 (tid == pCurrNode->tid))
158 {
159 pMac->lim.pDialogueTokenHead = pCurrNode->next;
160 //there was only one node in the list. So tail pointer also needs to be adjusted.
161 if(NULL == pMac->lim.pDialogueTokenHead)
162 pMac->lim.pDialogueTokenTail = NULL;
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530163 vos_mem_free(pCurrNode);
Jeff Johnson295189b2012-06-20 16:38:30 -0700164 return eSIR_SUCCESS;
165 }
166
167 //first node did not match. so move to the next one.
168 pCurrNode = pCurrNode->next;
169 while(NULL != pCurrNode )
170 {
171 if(token == pCurrNode->token)
172 {
173 break;
174 }
175
176 pPrevNode = pCurrNode;
177 pCurrNode = pCurrNode->next;
178 }
179
180 if(pCurrNode &&
181 (assocId == pCurrNode->assocId) &&
182 (tid == pCurrNode->tid))
183 {
184 pPrevNode->next = pCurrNode->next;
185 //if the node being deleted is the last one then we also need to move the tail pointer to the prevNode.
186 if(NULL == pCurrNode->next)
187 pMac->lim.pDialogueTokenTail = pPrevNode;
Bansidhar Gopalacharia03b13c2013-08-01 18:09:28 +0530188 palFreeMemory(pMac->hHdd, (void *) pCurrNode);
Jeff Johnson295189b2012-06-20 16:38:30 -0700189 return eSIR_SUCCESS;
190 }
191
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700192 PELOGW(limLog(pMac, LOGW, FL("LIM does not have matching dialogue token node"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700193 return eSIR_FAILURE;
194
195}
196
197
198/** -------------------------------------------------------------
199\fn limDeleteDialogueTokenList
200\brief deletes the complete lim dialogue token linked list.
201\param tpAniSirGlobal pMac
202\return None
203 -------------------------------------------------------------*/
204void
205limDeleteDialogueTokenList(tpAniSirGlobal pMac)
206{
207 tpDialogueToken pCurrNode = pMac->lim.pDialogueTokenHead;
208
209 while(NULL != pMac->lim.pDialogueTokenHead)
210 {
211 pCurrNode = pMac->lim.pDialogueTokenHead;
212 pMac->lim.pDialogueTokenHead = pMac->lim.pDialogueTokenHead->next;
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530213 vos_mem_free(pCurrNode);
Jeff Johnson295189b2012-06-20 16:38:30 -0700214 pCurrNode = NULL;
215 }
216 pMac->lim.pDialogueTokenTail = NULL;
217}
218
219void
220limGetBssidFromBD(tpAniSirGlobal pMac, tANI_U8 * pRxPacketInfo, tANI_U8 *bssId, tANI_U32 *pIgnore)
221{
222 tpSirMacDataHdr3a pMh = WDA_GET_RX_MPDUHEADER3A(pRxPacketInfo);
223 *pIgnore = 0;
224
225 if (pMh->fc.toDS == 1 && pMh->fc.fromDS == 0)
226 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530227 vos_mem_copy( bssId, pMh->addr1, 6);
Jeff Johnson295189b2012-06-20 16:38:30 -0700228 *pIgnore = 1;
229 }
230 else if (pMh->fc.toDS == 0 && pMh->fc.fromDS == 1)
231 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530232 vos_mem_copy ( bssId, pMh->addr2, 6);
Jeff Johnson295189b2012-06-20 16:38:30 -0700233 *pIgnore = 1;
234 }
235 else if (pMh->fc.toDS == 0 && pMh->fc.fromDS == 0)
236 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530237 vos_mem_copy( bssId, pMh->addr3, 6);
Jeff Johnson295189b2012-06-20 16:38:30 -0700238 *pIgnore = 0;
239 }
240 else
241 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530242 vos_mem_copy( bssId, pMh->addr1, 6);
Jeff Johnson295189b2012-06-20 16:38:30 -0700243 *pIgnore = 1;
244 }
245}
246
247char *
248limMlmStateStr(tLimMlmStates state)
249{
Jeff Johnson295189b2012-06-20 16:38:30 -0700250 switch (state)
251 {
252 case eLIM_MLM_OFFLINE_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700253 return "eLIM_MLM_OFFLINE_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700254 case eLIM_MLM_IDLE_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700255 return "eLIM_MLM_IDLE_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700256 case eLIM_MLM_WT_PROBE_RESP_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700257 return "eLIM_MLM_WT_PROBE_RESP_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700258 case eLIM_MLM_PASSIVE_SCAN_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700259 return "eLIM_MLM_PASSIVE_SCAN_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700260 case eLIM_MLM_WT_JOIN_BEACON_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700261 return "eLIM_MLM_WT_JOIN_BEACON_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700262 case eLIM_MLM_JOINED_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700263 return "eLIM_MLM_JOINED_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700264 case eLIM_MLM_BSS_STARTED_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700265 return "eLIM_MLM_BSS_STARTED_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700266 case eLIM_MLM_WT_AUTH_FRAME2_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700267 return "eLIM_MLM_WT_AUTH_FRAME2_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700268 case eLIM_MLM_WT_AUTH_FRAME3_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700269 return "eLIM_MLM_WT_AUTH_FRAME3_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700270 case eLIM_MLM_WT_AUTH_FRAME4_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700271 return "eLIM_MLM_WT_AUTH_FRAME4_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700272 case eLIM_MLM_AUTH_RSP_TIMEOUT_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700273 return "eLIM_MLM_AUTH_RSP_TIMEOUT_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700274 case eLIM_MLM_AUTHENTICATED_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700275 return "eLIM_MLM_AUTHENTICATED_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700276 case eLIM_MLM_WT_ASSOC_RSP_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700277 return "eLIM_MLM_WT_ASSOC_RSP_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700278 case eLIM_MLM_WT_REASSOC_RSP_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700279 return "eLIM_MLM_WT_REASSOC_RSP_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700280 case eLIM_MLM_WT_FT_REASSOC_RSP_STATE:
281 return "eLIM_MLM_WT_FT_REASSOC_RSP_STATE";
282 case eLIM_MLM_WT_DEL_STA_RSP_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700283 return "eLIM_MLM_WT_DEL_STA_RSP_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700284 case eLIM_MLM_WT_DEL_BSS_RSP_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700285 return "eLIM_MLM_WT_DEL_BSS_RSP_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700286 case eLIM_MLM_WT_ADD_STA_RSP_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700287 return "eLIM_MLM_WT_ADD_STA_RSP_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700288 case eLIM_MLM_WT_ADD_BSS_RSP_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700289 return "eLIM_MLM_WT_ADD_BSS_RSP_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700290 case eLIM_MLM_REASSOCIATED_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700291 return "eLIM_MLM_REASSOCIATED_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700292 case eLIM_MLM_LINK_ESTABLISHED_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700293 return "eLIM_MLM_LINK_ESTABLISHED_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700294 case eLIM_MLM_WT_ASSOC_CNF_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700295 return "eLIM_MLM_WT_ASSOC_CNF_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700296 case eLIM_MLM_WT_ADD_BSS_RSP_ASSOC_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700297 return "eLIM_MLM_WT_ADD_BSS_RSP_ASSOC_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700298 case eLIM_MLM_WT_ADD_BSS_RSP_REASSOC_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700299 return "eLIM_MLM_WT_ADD_BSS_RSP_REASSOC_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700300 case eLIM_MLM_WT_ADD_BSS_RSP_FT_REASSOC_STATE:
301 return "eLIM_MLM_WT_ADD_BSS_RSP_FT_REASSOC_STATE";
302 case eLIM_MLM_WT_ASSOC_DEL_STA_RSP_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700303 return "eLIM_MLM_WT_ASSOC_DEL_STA_RSP_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700304 case eLIM_MLM_WT_SET_BSS_KEY_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700305 return "eLIM_MLM_WT_SET_BSS_KEY_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700306 case eLIM_MLM_WT_SET_STA_KEY_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700307 return "eLIM_MLM_WT_SET_STA_KEY_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700308 default:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700309 return "INVALID MLM state";
Jeff Johnson295189b2012-06-20 16:38:30 -0700310 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700311}
312
313void
314limPrintMlmState(tpAniSirGlobal pMac, tANI_U16 logLevel, tLimMlmStates state)
315{
316 limLog(pMac, logLevel, limMlmStateStr(state));
317}
318
319char *
320limSmeStateStr(tLimSmeStates state)
321{
322#ifdef FIXME_GEN6
323 switch (state)
324 {
325 case eLIM_SME_OFFLINE_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700326 return "eLIM_SME_OFFLINE_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700327 case eLIM_SME_IDLE_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700328 return "eLIM_SME_IDLE_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700329 case eLIM_SME_SUSPEND_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700330 return "eLIM_SME_SUSPEND_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700331 case eLIM_SME_WT_SCAN_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700332 return "eLIM_SME_WT_SCAN_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700333 case eLIM_SME_WT_JOIN_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700334 return "eLIM_SME_WT_JOIN_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700335 case eLIM_SME_WT_AUTH_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700336 return "eLIM_SME_WT_AUTH_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700337 case eLIM_SME_WT_ASSOC_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700338 return "eLIM_SME_WT_ASSOC_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700339 case eLIM_SME_WT_REASSOC_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700340 return "eLIM_SME_WT_REASSOC_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700341 case eLIM_SME_WT_REASSOC_LINK_FAIL_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700342 return "eLIM_SME_WT_REASSOC_LINK_FAIL_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700343 case eLIM_SME_JOIN_FAILURE_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700344 return "eLIM_SME_JOIN_FAILURE_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700345 case eLIM_SME_ASSOCIATED_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700346 return "eLIM_SME_ASSOCIATED_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700347 case eLIM_SME_REASSOCIATED_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700348 return "eLIM_SME_REASSOCIATED_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700349 case eLIM_SME_LINK_EST_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700350 return "eLIM_SME_LINK_EST_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700351 case eLIM_SME_LINK_EST_WT_SCAN_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700352 return "eLIM_SME_LINK_EST_WT_SCAN_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700353 case eLIM_SME_WT_PRE_AUTH_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700354 return "eLIM_SME_WT_PRE_AUTH_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700355 case eLIM_SME_WT_DISASSOC_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700356 return "eLIM_SME_WT_DISASSOC_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700357 case eLIM_SME_WT_DEAUTH_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700358 return "eLIM_SME_WT_DEAUTH_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700359 case eLIM_SME_WT_START_BSS_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700360 return "eLIM_SME_WT_START_BSS_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700361 case eLIM_SME_WT_STOP_BSS_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700362 return "eLIM_SME_WT_STOP_BSS_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700363 case eLIM_SME_NORMAL_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700364 return "eLIM_SME_NORMAL_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700365 case eLIM_SME_CHANNEL_SCAN_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700366 return "eLIM_SME_CHANNEL_SCAN_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700367 case eLIM_SME_NORMAL_CHANNEL_SCAN_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700368 return "eLIM_SME_NORMAL_CHANNEL_SCAN_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700369 default:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700370 return "INVALID SME state";
Jeff Johnson295189b2012-06-20 16:38:30 -0700371 }
372#endif
373return "";
374}
375
376
377char* limDot11ModeStr(tpAniSirGlobal pMac, tANI_U8 dot11Mode)
378{
379#ifdef FIXME_GEN6
380
381 switch(dot11Mode)
382 {
383 case WNI_CFG_DOT11_MODE_ALL:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700384 return "ALL";
Jeff Johnson295189b2012-06-20 16:38:30 -0700385 case WNI_CFG_DOT11_MODE_11A:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700386 return "11A";
387 case WNI_CFG_DOT11_MODE_11B:
388 return "11B";
389 case WNI_CFG_DOT11_MODE_11G:
390 return "11G";
391 case WNI_CFG_DOT11_MODE_11N:
392 return "11N";
393 case WNI_CFG_DOT11_MODE_POLARIS:
394 return "Polaris";
395 case WNI_CFG_DOT11_MODE_TITAN:
396 return "Titan";
Jeff Johnson295189b2012-06-20 16:38:30 -0700397 case WNI_CFG_DOT11_MODE_TAURUS:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700398 return "Taurus";
Jeff Johnson295189b2012-06-20 16:38:30 -0700399 default:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700400 return "Invalid Dot11 Mode";
Jeff Johnson295189b2012-06-20 16:38:30 -0700401 }
402#endif
403return "";
404}
405
406
407char* limStaOpRateModeStr(tStaRateMode opRateMode)
408{
409#ifdef FIXME_GEN6
410
411 switch(opRateMode)
412 {
413 case eSTA_TAURUS:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700414 return "Taurus";
Jeff Johnson295189b2012-06-20 16:38:30 -0700415 case eSTA_11a:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700416 return "11A";
417 case eSTA_11b:
418 return "11B";
419 case eSTA_11bg:
420 return "11G";
421 case eSTA_11n:
422 return "11N";
423 case eSTA_POLARIS:
424 return "Polaris";
Jeff Johnson295189b2012-06-20 16:38:30 -0700425 case eSTA_TITAN:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700426 return "Titan";
Jeff Johnson295189b2012-06-20 16:38:30 -0700427 default:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700428 return "Invalid Dot11 Mode";
Jeff Johnson295189b2012-06-20 16:38:30 -0700429 }
430#endif
431return "";
432}
433
434char* limBssTypeStr(tSirBssType bssType)
435{
436 switch(bssType)
437 {
438 case eSIR_INFRASTRUCTURE_MODE:
439 return "eSIR_INFRASTRUCTURE_MODE";
440 case eSIR_IBSS_MODE:
441 return "eSIR_IBSS_MODE";
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700442 case eSIR_BTAMP_STA_MODE:
Jeff Johnson295189b2012-06-20 16:38:30 -0700443 return "eSIR_BTAMP_STA_MODE";
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700444 case eSIR_BTAMP_AP_MODE:
Jeff Johnson295189b2012-06-20 16:38:30 -0700445 return "eSIR_BTAMP_AP_MODE";
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700446 case eSIR_AUTO_MODE:
Jeff Johnson295189b2012-06-20 16:38:30 -0700447 return "eSIR_AUTO_MODE";
448 default:
449 return "Invalid BSS Type";
450 }
451}
452
453void
454limPrintSmeState(tpAniSirGlobal pMac, tANI_U16 logLevel, tLimSmeStates state)
455{
456 limLog(pMac, logLevel, limSmeStateStr(state));
457}
458
459char *limMsgStr(tANI_U32 msgType)
460{
461#ifdef FIXME_GEN6
462 switch (msgType)
463 {
464 case eWNI_SME_START_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700465 return "eWNI_SME_START_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700466 case eWNI_SME_START_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700467 return "eWNI_SME_START_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700468 case eWNI_SME_SYS_READY_IND:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700469 return "eWNI_SME_SYS_READY_IND";
Jeff Johnson295189b2012-06-20 16:38:30 -0700470 case eWNI_SME_SCAN_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700471 return "eWNI_SME_SCAN_REQ";
Jeff Johnsone7245742012-09-05 17:12:55 -0700472#ifdef FEATURE_OEM_DATA_SUPPORT
473 case eWNI_SME_OEM_DATA_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700474 return "eWNI_SME_OEM_DATA_REQ";
Jeff Johnsone7245742012-09-05 17:12:55 -0700475 case eWNI_SME_OEM_DATA_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700476 return "eWNI_SME_OEM_DATA_RSP";
Jeff Johnsone7245742012-09-05 17:12:55 -0700477#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700478 case eWNI_SME_SCAN_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700479 return "eWNI_SME_SCAN_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700480 case eWNI_SME_JOIN_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700481 return "eWNI_SME_JOIN_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700482 case eWNI_SME_JOIN_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700483 return "eWNI_SME_JOIN_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700484 case eWNI_SME_SETCONTEXT_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700485 return "eWNI_SME_SETCONTEXT_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700486 case eWNI_SME_SETCONTEXT_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700487 return "eWNI_SME_SETCONTEXT_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700488 case eWNI_SME_REASSOC_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700489 return "eWNI_SME_REASSOC_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700490 case eWNI_SME_REASSOC_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700491 return "eWNI_SME_REASSOC_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700492 case eWNI_SME_AUTH_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700493 return "eWNI_SME_AUTH_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700494 case eWNI_SME_AUTH_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700495 return "eWNI_SME_AUTH_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700496 case eWNI_SME_DISASSOC_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700497 return "eWNI_SME_DISASSOC_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700498 case eWNI_SME_DISASSOC_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700499 return "eWNI_SME_DISASSOC_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700500 case eWNI_SME_DISASSOC_IND:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700501 return "eWNI_SME_DISASSOC_IND";
Jeff Johnson295189b2012-06-20 16:38:30 -0700502 case eWNI_SME_DISASSOC_CNF:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700503 return "eWNI_SME_DISASSOC_CNF";
Jeff Johnson295189b2012-06-20 16:38:30 -0700504 case eWNI_SME_DEAUTH_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700505 return "eWNI_SME_DEAUTH_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700506 case eWNI_SME_DEAUTH_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700507 return "eWNI_SME_DEAUTH_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700508 case eWNI_SME_DEAUTH_IND:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700509 return "eWNI_SME_DEAUTH_IND";
Jeff Johnson295189b2012-06-20 16:38:30 -0700510 case eWNI_SME_WM_STATUS_CHANGE_NTF:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700511 return "eWNI_SME_WM_STATUS_CHANGE_NTF";
Jeff Johnson295189b2012-06-20 16:38:30 -0700512 case eWNI_SME_START_BSS_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700513 return "eWNI_SME_START_BSS_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700514 case eWNI_SME_START_BSS_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700515 return "eWNI_SME_START_BSS_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700516 case eWNI_SME_AUTH_IND:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700517 return "eWNI_SME_AUTH_IND";
Jeff Johnson295189b2012-06-20 16:38:30 -0700518 case eWNI_SME_ASSOC_IND:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700519 return "eWNI_SME_ASSOC_IND";
Jeff Johnson295189b2012-06-20 16:38:30 -0700520 case eWNI_SME_ASSOC_CNF:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700521 return "eWNI_SME_ASSOC_CNF";
Jeff Johnson295189b2012-06-20 16:38:30 -0700522 case eWNI_SME_REASSOC_IND:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700523 return "eWNI_SME_REASSOC_IND";
Jeff Johnson295189b2012-06-20 16:38:30 -0700524 case eWNI_SME_REASSOC_CNF:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700525 return "eWNI_SME_REASSOC_CNF";
Jeff Johnson295189b2012-06-20 16:38:30 -0700526 case eWNI_SME_SWITCH_CHL_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700527 return "eWNI_SME_SWITCH_CHL_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700528 case eWNI_SME_SWITCH_CHL_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700529 return "eWNI_SME_SWITCH_CHL_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700530 case eWNI_SME_SWITCH_CHL_CB_PRIMARY_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700531 return "eWNI_SME_SWITCH_CHL_CB_PRIMARY_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700532 case eWNI_SME_SWITCH_CHL_CB_SECONDARY_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700533 return "eWNI_SME_SWITCH_CHL_CB_SECONDARY_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700534 case eWNI_SME_STOP_BSS_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700535 return "eWNI_SME_STOP_BSS_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700536 case eWNI_SME_STOP_BSS_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700537 return "eWNI_SME_STOP_BSS_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700538 case eWNI_SME_PROMISCUOUS_MODE_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700539 return "eWNI_SME_PROMISCUOUS_MODE_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700540 case eWNI_SME_PROMISCUOUS_MODE_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700541 return "eWNI_SME_PROMISCUOUS_MODE_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700542 case eWNI_SME_NEIGHBOR_BSS_IND:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700543 return "eWNI_SME_NEIGHBOR_BSS_IND";
Jeff Johnson295189b2012-06-20 16:38:30 -0700544 case eWNI_SME_MEASUREMENT_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700545 return "eWNI_SME_MEASUREMENT_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700546 case eWNI_SME_MEASUREMENT_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700547 return "eWNI_SME_MEASUREMENT_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700548 case eWNI_SME_MEASUREMENT_IND:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700549 return "eWNI_SME_MEASUREMENT_IND";
Jeff Johnson295189b2012-06-20 16:38:30 -0700550 case eWNI_SME_SET_WDS_INFO_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700551 return "eWNI_SME_SET_WDS_INFO_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700552 case eWNI_SME_SET_WDS_INFO_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700553 return "eWNI_SME_SET_WDS_INFO_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700554 case eWNI_SME_WDS_INFO_IND:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700555 return "eWNI_SME_WDS_INFO_IND";
Jeff Johnson295189b2012-06-20 16:38:30 -0700556 case eWNI_SME_DEAUTH_CNF:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700557 return "eWNI_SME_DEAUTH_CNF";
Jeff Johnson295189b2012-06-20 16:38:30 -0700558 case eWNI_SME_MIC_FAILURE_IND:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700559 return "eWNI_SME_MIC_FAILURE_IND";
Jeff Johnson295189b2012-06-20 16:38:30 -0700560 case eWNI_SME_ADDTS_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700561 return "eWNI_SME_ADDTS_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700562 case eWNI_SME_ADDTS_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700563 return "eWNI_SME_ADDTS_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700564 case eWNI_SME_ADDTS_CNF:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700565 return "eWNI_SME_ADDTS_CNF";
Jeff Johnson295189b2012-06-20 16:38:30 -0700566 case eWNI_SME_ADDTS_IND:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700567 return "eWNI_SME_ADDTS_IND";
Jeff Johnson295189b2012-06-20 16:38:30 -0700568 case eWNI_SME_DELTS_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700569 return "eWNI_SME_DELTS_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700570 case eWNI_SME_DELTS_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700571 return "eWNI_SME_DELTS_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700572 case eWNI_SME_DELTS_IND:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700573 return "eWNI_SME_DELTS_IND";
Srinivas Girigowdad34cedb2013-01-25 13:33:11 -0800574#if defined WLAN_FEATURE_VOWIFI_11R || defined FEATURE_WLAN_CCX || defined(FEATURE_WLAN_LFR)
575 case eWNI_SME_GET_ROAM_RSSI_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700576 return "eWNI_SME_GET_ROAM_RSSI_REQ";
Srinivas Girigowdad34cedb2013-01-25 13:33:11 -0800577 case eWNI_SME_GET_ROAM_RSSI_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700578 return "eWNI_SME_GET_ROAM_RSSI_RSP";
Srinivas Girigowdad34cedb2013-01-25 13:33:11 -0800579#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700580
Jeff Johnson295189b2012-06-20 16:38:30 -0700581 case WDA_SUSPEND_ACTIVITY_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700582 return "WDA_SUSPEND_ACTIVITY_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700583 case SIR_LIM_RETRY_INTERRUPT_MSG:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700584 return "SIR_LIM_RETRY_INTERRUPT_MSG";
Jeff Johnson295189b2012-06-20 16:38:30 -0700585 case SIR_BB_XPORT_MGMT_MSG:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700586 return "SIR_BB_XPORT_MGMT_MSG";
Jeff Johnson295189b2012-06-20 16:38:30 -0700587 case SIR_LIM_INV_KEY_INTERRUPT_MSG:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700588 return "SIR_LIM_INV_KEY_INTERRUPT_MSG";
Jeff Johnson295189b2012-06-20 16:38:30 -0700589 case SIR_LIM_KEY_ID_INTERRUPT_MSG:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700590 return "SIR_LIM_KEY_ID_INTERRUPT_MSG";
Jeff Johnson295189b2012-06-20 16:38:30 -0700591 case SIR_LIM_REPLAY_THRES_INTERRUPT_MSG:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700592 return "SIR_LIM_REPLAY_THRES_INTERRUPT_MSG";
Jeff Johnson295189b2012-06-20 16:38:30 -0700593 case SIR_LIM_MIN_CHANNEL_TIMEOUT:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700594 return "SIR_LIM_MIN_CHANNEL_TIMEOUT";
Jeff Johnson295189b2012-06-20 16:38:30 -0700595 case SIR_LIM_MAX_CHANNEL_TIMEOUT:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700596 return "SIR_LIM_MAX_CHANNEL_TIMEOUT";
Jeff Johnson295189b2012-06-20 16:38:30 -0700597 case SIR_LIM_JOIN_FAIL_TIMEOUT:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700598 return "SIR_LIM_JOIN_FAIL_TIMEOUT";
Jeff Johnson295189b2012-06-20 16:38:30 -0700599 case SIR_LIM_AUTH_FAIL_TIMEOUT:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700600 return "SIR_LIM_AUTH_FAIL_TIMEOUT";
Jeff Johnson295189b2012-06-20 16:38:30 -0700601 case SIR_LIM_AUTH_RSP_TIMEOUT:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700602 return "SIR_LIM_AUTH_RSP_TIMEOUT";
Jeff Johnson295189b2012-06-20 16:38:30 -0700603 case SIR_LIM_ASSOC_FAIL_TIMEOUT:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700604 return "SIR_LIM_ASSOC_FAIL_TIMEOUT";
Jeff Johnson295189b2012-06-20 16:38:30 -0700605 case SIR_LIM_REASSOC_FAIL_TIMEOUT:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700606 return "SIR_LIM_REASSOC_FAIL_TIMEOUT";
Jeff Johnson295189b2012-06-20 16:38:30 -0700607 case SIR_LIM_HEART_BEAT_TIMEOUT:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700608 return "SIR_LIM_HEART_BEAT_TIMEOUT";
Jeff Johnson295189b2012-06-20 16:38:30 -0700609 case SIR_LIM_ADDTS_RSP_TIMEOUT:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700610 return "SIR_LIM_ADDTS_RSP_TIMEOUT";
Jeff Johnson295189b2012-06-20 16:38:30 -0700611 case SIR_LIM_CHANNEL_SCAN_TIMEOUT:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700612 return "SIR_LIM_CHANNEL_SCAN_TIMEOUT";
Jeff Johnson295189b2012-06-20 16:38:30 -0700613 case SIR_LIM_LINK_TEST_DURATION_TIMEOUT:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700614 return "SIR_LIM_LINK_TEST_DURATION_TIMEOUT";
Jeff Johnson295189b2012-06-20 16:38:30 -0700615 case SIR_LIM_HASH_MISS_THRES_TIMEOUT:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700616 return "SIR_LIM_HASH_MISS_THRES_TIMEOUT";
Jeff Johnson295189b2012-06-20 16:38:30 -0700617 case SIR_LIM_KEEPALIVE_TIMEOUT:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700618 return "SIR_LIM_KEEPALIVE_TIMEOUT";
Jeff Johnson295189b2012-06-20 16:38:30 -0700619 case SIR_LIM_UPDATE_OLBC_CACHEL_TIMEOUT:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700620 return "SIR_LIM_UPDATE_OLBC_CACHEL_TIMEOUT";
Jeff Johnson295189b2012-06-20 16:38:30 -0700621 case SIR_LIM_CNF_WAIT_TIMEOUT:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700622 return "SIR_LIM_CNF_WAIT_TIMEOUT";
Jeff Johnson295189b2012-06-20 16:38:30 -0700623 case SIR_LIM_RADAR_DETECT_IND:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700624 return "SIR_LIM_RADAR_DETECT_IND";
Jeff Johnson295189b2012-06-20 16:38:30 -0700625#ifdef WLAN_FEATURE_VOWIFI_11R
626 case SIR_LIM_FT_PREAUTH_RSP_TIMEOUT:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700627 return "SIR_LIM_FT_PREAUTH_RSP_TIMEOUT";
Jeff Johnson295189b2012-06-20 16:38:30 -0700628#endif
629
630 case SIR_HAL_APP_SETUP_NTF:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700631 return "SIR_HAL_APP_SETUP_NTF";
Jeff Johnson295189b2012-06-20 16:38:30 -0700632 case SIR_HAL_INITIAL_CAL_FAILED_NTF:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700633 return "SIR_HAL_INITIAL_CAL_FAILED_NTF";
Jeff Johnson295189b2012-06-20 16:38:30 -0700634 case SIR_HAL_NIC_OPER_NTF:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700635 return "SIR_HAL_NIC_OPER_NTF";
Jeff Johnson295189b2012-06-20 16:38:30 -0700636 case SIR_HAL_INIT_START_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700637 return "SIR_HAL_INIT_START_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700638 case SIR_HAL_SHUTDOWN_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700639 return "SIR_HAL_SHUTDOWN_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700640 case SIR_HAL_SHUTDOWN_CNF:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700641 return "SIR_HAL_SHUTDOWN_CNF";
Jeff Johnson295189b2012-06-20 16:38:30 -0700642 case SIR_HAL_RESET_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700643 return "SIR_HAL_RESET_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700644 case SIR_HAL_RESET_CNF:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700645 return "SIR_HAL_RESET_CNF";
Jeff Johnson295189b2012-06-20 16:38:30 -0700646 case SIR_WRITE_TO_TD:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700647 return "SIR_WRITE_TO_TD";
Jeff Johnson295189b2012-06-20 16:38:30 -0700648
649 case WNI_CFG_PARAM_UPDATE_IND:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700650 return "WNI_CFG_PARAM_UPDATE_IND";
Jeff Johnson295189b2012-06-20 16:38:30 -0700651 case WNI_CFG_DNLD_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700652 return "WNI_CFG_DNLD_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700653 case WNI_CFG_DNLD_CNF:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700654 return "WNI_CFG_DNLD_CNF";
Jeff Johnson295189b2012-06-20 16:38:30 -0700655 case WNI_CFG_GET_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700656 return "WNI_CFG_GET_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700657 case WNI_CFG_SET_CNF:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700658 return "WNI_CFG_SET_CNF";
Jeff Johnson295189b2012-06-20 16:38:30 -0700659 case WNI_CFG_GET_ATTRIB_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700660 return "WNI_CFG_GET_ATTRIB_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700661 case WNI_CFG_ADD_GRP_ADDR_CNF:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700662 return "WNI_CFG_ADD_GRP_ADDR_CNF";
Jeff Johnson295189b2012-06-20 16:38:30 -0700663 case WNI_CFG_DEL_GRP_ADDR_CNF:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700664 return "WNI_CFG_DEL_GRP_ADDR_CNF";
Jeff Johnson295189b2012-06-20 16:38:30 -0700665 case ANI_CFG_GET_RADIO_STAT_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700666 return "ANI_CFG_GET_RADIO_STAT_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700667 case ANI_CFG_GET_PER_STA_STAT_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700668 return "ANI_CFG_GET_PER_STA_STAT_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700669 case ANI_CFG_GET_AGG_STA_STAT_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700670 return "ANI_CFG_GET_AGG_STA_STAT_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700671 case ANI_CFG_CLEAR_STAT_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700672 return "ANI_CFG_CLEAR_STAT_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700673 case WNI_CFG_DNLD_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700674 return "WNI_CFG_DNLD_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700675 case WNI_CFG_GET_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700676 return "WNI_CFG_GET_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700677 case WNI_CFG_SET_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700678 return "WNI_CFG_SET_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700679 case WNI_CFG_SET_REQ_NO_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700680 return "WNI_CFG_SET_REQ_NO_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700681 case eWNI_PMC_ENTER_IMPS_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700682 return "eWNI_PMC_ENTER_IMPS_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700683 case eWNI_PMC_EXIT_IMPS_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700684 return "eWNI_PMC_EXIT_IMPS_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700685 case eWNI_PMC_ENTER_BMPS_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700686 return "eWNI_PMC_ENTER_BMPS_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700687 case eWNI_PMC_EXIT_BMPS_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700688 return "eWNI_PMC_EXIT_BMPS_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700689 case eWNI_PMC_EXIT_BMPS_IND:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700690 return "eWNI_PMC_EXIT_BMPS_IND";
Yathish9f22e662012-12-10 14:21:35 -0800691 case eWNI_SME_SET_BCN_FILTER_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700692 return "eWNI_SME_SET_BCN_FILTER_REQ";
Srinivas Girigowda5cecb202013-10-08 09:13:25 -0700693#if defined(FEATURE_WLAN_CCX) && defined(FEATURE_WLAN_CCX_UPLOAD)
694 case eWNI_SME_GET_TSM_STATS_REQ:
695 return "eWNI_SME_GET_TSM_STATS_REQ";
696 case eWNI_SME_GET_TSM_STATS_RSP:
697 return "eWNI_SME_GET_TSM_STATS_RSP";
698#endif /* FEATURE_WLAN_CCX && FEATURE_WLAN_CCX_UPLOAD */
Jeff Johnson295189b2012-06-20 16:38:30 -0700699 default:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700700 return "INVALID SME message";
Jeff Johnson295189b2012-06-20 16:38:30 -0700701 }
702#endif
703return "";
704}
705
706
707
708char *limResultCodeStr(tSirResultCodes resultCode)
709{
Jeff Johnson295189b2012-06-20 16:38:30 -0700710 switch (resultCode)
711 {
712 case eSIR_SME_SUCCESS:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700713 return "eSIR_SME_SUCCESS";
Jeff Johnson295189b2012-06-20 16:38:30 -0700714 case eSIR_EOF_SOF_EXCEPTION:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700715 return "eSIR_EOF_SOF_EXCEPTION";
Jeff Johnson295189b2012-06-20 16:38:30 -0700716 case eSIR_BMU_EXCEPTION:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700717 return "eSIR_BMU_EXCEPTION";
Jeff Johnson295189b2012-06-20 16:38:30 -0700718 case eSIR_LOW_PDU_EXCEPTION:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700719 return "eSIR_LOW_PDU_EXCEPTION";
Jeff Johnson295189b2012-06-20 16:38:30 -0700720 case eSIR_USER_TRIG_RESET:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700721 return"eSIR_USER_TRIG_RESET";
Jeff Johnson295189b2012-06-20 16:38:30 -0700722 case eSIR_LOGP_EXCEPTION:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700723 return "eSIR_LOGP_EXCEPTION";
Jeff Johnson295189b2012-06-20 16:38:30 -0700724 case eSIR_CP_EXCEPTION:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700725 return "eSIR_CP_EXCEPTION";
Jeff Johnson295189b2012-06-20 16:38:30 -0700726 case eSIR_STOP_BSS:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700727 return "eSIR_STOP_BSS";
Jeff Johnson295189b2012-06-20 16:38:30 -0700728 case eSIR_AHB_HANG_EXCEPTION:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700729 return "eSIR_AHB_HANG_EXCEPTION";
Jeff Johnson295189b2012-06-20 16:38:30 -0700730 case eSIR_DPU_EXCEPTION:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700731 return "eSIR_DPU_EXCEPTION";
Jeff Johnson295189b2012-06-20 16:38:30 -0700732 case eSIR_RXP_EXCEPTION:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700733 return "eSIR_RXP_EXCEPTION";
Jeff Johnson295189b2012-06-20 16:38:30 -0700734 case eSIR_MCPU_EXCEPTION:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700735 return "eSIR_MCPU_EXCEPTION";
Jeff Johnson295189b2012-06-20 16:38:30 -0700736 case eSIR_MCU_EXCEPTION:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700737 return "eSIR_MCU_EXCEPTION";
Jeff Johnson295189b2012-06-20 16:38:30 -0700738 case eSIR_MTU_EXCEPTION:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700739 return "eSIR_MTU_EXCEPTION";
Jeff Johnson295189b2012-06-20 16:38:30 -0700740 case eSIR_MIF_EXCEPTION:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700741 return "eSIR_MIF_EXCEPTION";
Jeff Johnson295189b2012-06-20 16:38:30 -0700742 case eSIR_FW_EXCEPTION:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700743 return "eSIR_FW_EXCEPTION";
Jeff Johnson295189b2012-06-20 16:38:30 -0700744 case eSIR_MAILBOX_SANITY_CHK_FAILED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700745 return "eSIR_MAILBOX_SANITY_CHK_FAILED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700746 case eSIR_RADIO_HW_SWITCH_STATUS_IS_OFF:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700747 return "eSIR_RADIO_HW_SWITCH_STATUS_IS_OFF";
Jeff Johnson295189b2012-06-20 16:38:30 -0700748 case eSIR_CFB_FLAG_STUCK_EXCEPTION:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700749 return "eSIR_CFB_FLAG_STUCK_EXCEPTION";
Jeff Johnson295189b2012-06-20 16:38:30 -0700750 case eSIR_SME_BASIC_RATES_NOT_SUPPORTED_STATUS:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700751 return "eSIR_SME_BASIC_RATES_NOT_SUPPORTED_STATUS";
Jeff Johnson295189b2012-06-20 16:38:30 -0700752 case eSIR_SME_INVALID_PARAMETERS:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700753 return "eSIR_SME_INVALID_PARAMETERS";
Jeff Johnson295189b2012-06-20 16:38:30 -0700754 case eSIR_SME_UNEXPECTED_REQ_RESULT_CODE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700755 return "eSIR_SME_UNEXPECTED_REQ_RESULT_CODE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700756 case eSIR_SME_RESOURCES_UNAVAILABLE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700757 return "eSIR_SME_RESOURCES_UNAVAILABLE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700758 case eSIR_SME_SCAN_FAILED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700759 return "eSIR_SME_SCAN_FAILED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700760 case eSIR_SME_BSS_ALREADY_STARTED_OR_JOINED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700761 return "eSIR_SME_BSS_ALREADY_STARTED_OR_JOINED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700762 case eSIR_SME_LOST_LINK_WITH_PEER_RESULT_CODE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700763 return "eSIR_SME_LOST_LINK_WITH_PEER_RESULT_CODE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700764 case eSIR_SME_REFUSED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700765 return "eSIR_SME_REFUSED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700766 case eSIR_SME_JOIN_TIMEOUT_RESULT_CODE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700767 return "eSIR_SME_JOIN_TIMEOUT_RESULT_CODE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700768 case eSIR_SME_AUTH_TIMEOUT_RESULT_CODE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700769 return "eSIR_SME_AUTH_TIMEOUT_RESULT_CODE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700770 case eSIR_SME_ASSOC_TIMEOUT_RESULT_CODE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700771 return "eSIR_SME_ASSOC_TIMEOUT_RESULT_CODE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700772 case eSIR_SME_REASSOC_TIMEOUT_RESULT_CODE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700773 return "eSIR_SME_REASSOC_TIMEOUT_RESULT_CODE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700774 case eSIR_SME_MAX_NUM_OF_PRE_AUTH_REACHED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700775 return "eSIR_SME_MAX_NUM_OF_PRE_AUTH_REACHED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700776 case eSIR_SME_AUTH_REFUSED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700777 return "eSIR_SME_AUTH_REFUSED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700778 case eSIR_SME_INVALID_WEP_DEFAULT_KEY:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700779 return "eSIR_SME_INVALID_WEP_DEFAULT_KEY";
Jeff Johnson295189b2012-06-20 16:38:30 -0700780 case eSIR_SME_ASSOC_REFUSED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700781 return "eSIR_SME_ASSOC_REFUSED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700782 case eSIR_SME_REASSOC_REFUSED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700783 return "eSIR_SME_REASSOC_REFUSED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700784 case eSIR_SME_STA_NOT_AUTHENTICATED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700785 return "eSIR_SME_STA_NOT_AUTHENTICATED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700786 case eSIR_SME_STA_NOT_ASSOCIATED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700787 return "eSIR_SME_STA_NOT_ASSOCIATED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700788 case eSIR_SME_STA_DISASSOCIATED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700789 return "eSIR_SME_STA_DISASSOCIATED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700790 case eSIR_SME_ALREADY_JOINED_A_BSS:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700791 return "eSIR_SME_ALREADY_JOINED_A_BSS";
Jeff Johnson295189b2012-06-20 16:38:30 -0700792 case eSIR_ULA_COMPLETED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700793 return "eSIR_ULA_COMPLETED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700794 case eSIR_ULA_FAILURE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700795 return "eSIR_ULA_FAILURE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700796 case eSIR_SME_LINK_ESTABLISHED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700797 return "eSIR_SME_LINK_ESTABLISHED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700798 case eSIR_SME_UNABLE_TO_PERFORM_MEASUREMENTS:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700799 return "eSIR_SME_UNABLE_TO_PERFORM_MEASUREMENTS";
Jeff Johnson295189b2012-06-20 16:38:30 -0700800 case eSIR_SME_UNABLE_TO_PERFORM_DFS:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700801 return "eSIR_SME_UNABLE_TO_PERFORM_DFS";
Jeff Johnson295189b2012-06-20 16:38:30 -0700802 case eSIR_SME_DFS_FAILED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700803 return "eSIR_SME_DFS_FAILED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700804 case eSIR_SME_TRANSFER_STA:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700805 return "eSIR_SME_TRANSFER_STA";
Jeff Johnson295189b2012-06-20 16:38:30 -0700806 case eSIR_SME_INVALID_LINK_TEST_PARAMETERS:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700807 return "eSIR_SME_INVALID_LINK_TEST_PARAMETERS";
Jeff Johnson295189b2012-06-20 16:38:30 -0700808 case eSIR_SME_LINK_TEST_MAX_EXCEEDED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700809 return "eSIR_SME_LINK_TEST_MAX_EXCEEDED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700810 case eSIR_SME_UNSUPPORTED_RATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700811 return "eSIR_SME_UNSUPPORTED_RATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700812 case eSIR_SME_LINK_TEST_TIMEOUT:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700813 return "eSIR_SME_LINK_TEST_TIMEOUT";
Jeff Johnson295189b2012-06-20 16:38:30 -0700814 case eSIR_SME_LINK_TEST_COMPLETE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700815 return "eSIR_SME_LINK_TEST_COMPLETE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700816 case eSIR_SME_LINK_TEST_INVALID_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700817 return "eSIR_SME_LINK_TEST_INVALID_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700818 case eSIR_SME_LINK_TEST_INVALID_ADDRESS:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700819 return "eSIR_SME_LINK_TEST_INVALID_ADDRESS";
Jeff Johnson295189b2012-06-20 16:38:30 -0700820 case eSIR_SME_POLARIS_RESET:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700821 return "eSIR_SME_POLARIS_RESET";
Jeff Johnson295189b2012-06-20 16:38:30 -0700822 case eSIR_SME_SETCONTEXT_FAILED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700823 return "eSIR_SME_SETCONTEXT_FAILED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700824 case eSIR_SME_BSS_RESTART:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700825 return "eSIR_SME_BSS_RESTART";
Jeff Johnson295189b2012-06-20 16:38:30 -0700826 case eSIR_SME_MORE_SCAN_RESULTS_FOLLOW:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700827 return "eSIR_SME_MORE_SCAN_RESULTS_FOLLOW";
Jeff Johnson295189b2012-06-20 16:38:30 -0700828 case eSIR_SME_INVALID_ASSOC_RSP_RXED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700829 return "eSIR_SME_INVALID_ASSOC_RSP_RXED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700830 case eSIR_SME_MIC_COUNTER_MEASURES:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700831 return "eSIR_SME_MIC_COUNTER_MEASURES";
Jeff Johnson295189b2012-06-20 16:38:30 -0700832 case eSIR_SME_ADDTS_RSP_TIMEOUT:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700833 return "eSIR_SME_ADDTS_RSP_TIMEOUT";
Jeff Johnson295189b2012-06-20 16:38:30 -0700834 case eSIR_SME_RECEIVED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700835 return "eSIR_SME_RECEIVED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700836 case eSIR_SME_CHANNEL_SWITCH_FAIL:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700837 return "eSIR_SME_CHANNEL_SWITCH_FAIL";
Jeff Johnson295189b2012-06-20 16:38:30 -0700838#ifdef GEN4_SCAN
839 case eSIR_SME_CHANNEL_SWITCH_DISABLED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700840 return "eSIR_SME_CHANNEL_SWITCH_DISABLED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700841 case eSIR_SME_HAL_SCAN_INIT_FAILED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700842 return "eSIR_SME_HAL_SCAN_INIT_FAILED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700843 case eSIR_SME_HAL_SCAN_START_FAILED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700844 return "eSIR_SME_HAL_SCAN_START_FAILED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700845 case eSIR_SME_HAL_SCAN_END_FAILED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700846 return "eSIR_SME_HAL_SCAN_END_FAILED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700847 case eSIR_SME_HAL_SCAN_FINISH_FAILED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700848 return "eSIR_SME_HAL_SCAN_FINISH_FAILED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700849 case eSIR_SME_HAL_SEND_MESSAGE_FAIL:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700850 return "eSIR_SME_HAL_SEND_MESSAGE_FAIL";
Jeff Johnson295189b2012-06-20 16:38:30 -0700851#else // GEN4_SCAN
852 case eSIR_SME_CHANNEL_SWITCH_DISABLED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700853 return "eSIR_SME_CHANNEL_SWITCH_DISABLED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700854 case eSIR_SME_HAL_SEND_MESSAGE_FAIL:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700855 return "eSIR_SME_HAL_SEND_MESSAGE_FAIL";
Jeff Johnson295189b2012-06-20 16:38:30 -0700856#endif // GEN4_SCAN
857
858 default:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700859 return "INVALID resultCode";
Jeff Johnson295189b2012-06-20 16:38:30 -0700860 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700861}
862
863void
864limPrintMsgName(tpAniSirGlobal pMac, tANI_U16 logLevel, tANI_U32 msgType)
865{
866 limLog(pMac, logLevel, limMsgStr(msgType));
867}
868
Jeff Johnson295189b2012-06-20 16:38:30 -0700869void
870limPrintMsgInfo(tpAniSirGlobal pMac, tANI_U16 logLevel, tSirMsgQ *msg)
871{
Jeff Johnson295189b2012-06-20 16:38:30 -0700872 if (logLevel <= pMac->utils.gLogDbgLevel[SIR_LIM_MODULE_ID - LOG_FIRST_MODULE_ID])
873 {
874 switch (msg->type)
875 {
876 case SIR_BB_XPORT_MGMT_MSG:
Jeff Johnson295189b2012-06-20 16:38:30 -0700877 limPrintMsgName(pMac, logLevel,msg->type);
Jeff Johnson295189b2012-06-20 16:38:30 -0700878 break;
879 default:
880 limPrintMsgName(pMac, logLevel,msg->type);
881 break;
882 }
883 }
884}
885
886/**
887 * limInitMlm()
888 *
889 *FUNCTION:
890 * This function is called by limProcessSmeMessages() to
891 * initialize MLM state machine on STA
892 *
893 *PARAMS:
894 *
895 *LOGIC:
896 *
897 *ASSUMPTIONS:
898 * NA
899 *
900 *NOTE:
901 * NA
902 *
903 * @param pMac Pointer to Global MAC structure
904 * @return None
905 */
906void
907limInitMlm(tpAniSirGlobal pMac)
908{
Madan Mohan Koyyalamudi694f8d72012-10-11 16:32:55 -0700909 tANI_U32 retVal;
910
911 pMac->lim.gLimTimersCreated = 0;
Madan Mohan Koyyalamudi1bed5982012-10-22 14:38:06 -0700912
Jeff Johnsone7245742012-09-05 17:12:55 -0700913 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, NO_SESSION, pMac->lim.gLimMlmState));
Jeff Johnson295189b2012-06-20 16:38:30 -0700914
915 /// Initialize scan result hash table
916 limReInitScanResults(pMac); //sep26th review
917
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -0700918#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
919 /// Initialize lfr scan result hash table
920 // Could there be a problem in multisession with SAP/P2P GO, when in the
921 // middle of FW bg scan, SAP started; Again that could be a problem even on
922 // infra + SAP/P2P GO too - TBD
923 limReInitLfrScanResults(pMac);
924#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700925
926 /// Initialize number of pre-auth contexts
927 pMac->lim.gLimNumPreAuthContexts = 0;
928
929 /// Initialize MAC based Authentication STA list
930 limInitPreAuthList(pMac);
931
932 //pMac->lim.gpLimMlmJoinReq = NULL;
933
934 if (pMac->lim.gLimTimersCreated)
935 return;
936
937 // Create timers used by LIM
Madan Mohan Koyyalamudi694f8d72012-10-11 16:32:55 -0700938 retVal = limCreateTimers(pMac);
939 if(retVal == TX_SUCCESS)
940 {
941 pMac->lim.gLimTimersCreated = 1;
942 }
943 else
944 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700945 limLog(pMac, LOGP, FL(" limCreateTimers Failed to create lim timers "));
Madan Mohan Koyyalamudi694f8d72012-10-11 16:32:55 -0700946 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700947} /*** end limInitMlm() ***/
948
949
950
951/**
952 * limCleanupMlm()
953 *
954 *FUNCTION:
955 * This function is called to cleanup any resources
956 * allocated by the MLM state machine.
957 *
958 *PARAMS:
959 *
960 *LOGIC:
961 *
962 *ASSUMPTIONS:
963 * NA
964 *
965 *NOTE:
966 * It is assumed that BSS is already informed that we're leaving it
967 * before this function is called.
968 *
969 * @param pMac Pointer to Global MAC structure
970 * @param None
971 * @return None
972 */
973void
974limCleanupMlm(tpAniSirGlobal pMac)
975{
976 tANI_U32 n;
977 tLimPreAuthNode *pAuthNode;
978
979 if (pMac->lim.gLimTimersCreated == 1)
980 {
981 // Deactivate and delete MIN/MAX channel timers.
982 tx_timer_deactivate(&pMac->lim.limTimers.gLimMinChannelTimer);
983 tx_timer_delete(&pMac->lim.limTimers.gLimMinChannelTimer);
984 tx_timer_deactivate(&pMac->lim.limTimers.gLimMaxChannelTimer);
985 tx_timer_delete(&pMac->lim.limTimers.gLimMaxChannelTimer);
986 tx_timer_deactivate(&pMac->lim.limTimers.gLimPeriodicProbeReqTimer);
987 tx_timer_delete(&pMac->lim.limTimers.gLimPeriodicProbeReqTimer);
988
989
990 // Deactivate and delete channel switch timer.
991 tx_timer_deactivate(&pMac->lim.limTimers.gLimChannelSwitchTimer);
992 tx_timer_delete(&pMac->lim.limTimers.gLimChannelSwitchTimer);
993
994
995 // Deactivate and delete addts response timer.
996 tx_timer_deactivate(&pMac->lim.limTimers.gLimAddtsRspTimer);
997 tx_timer_delete(&pMac->lim.limTimers.gLimAddtsRspTimer);
998
999 // Deactivate and delete Join failure timer.
1000 tx_timer_deactivate(&pMac->lim.limTimers.gLimJoinFailureTimer);
1001 tx_timer_delete(&pMac->lim.limTimers.gLimJoinFailureTimer);
1002
Madan Mohan Koyyalamudi9aff9ff2012-11-29 11:27:25 -08001003 // Deactivate and delete Periodic Join Probe Request timer.
1004 tx_timer_deactivate(&pMac->lim.limTimers.gLimPeriodicJoinProbeReqTimer);
1005 tx_timer_delete(&pMac->lim.limTimers.gLimPeriodicJoinProbeReqTimer);
1006
Jeff Johnson295189b2012-06-20 16:38:30 -07001007 // Deactivate and delete Association failure timer.
1008 tx_timer_deactivate(&pMac->lim.limTimers.gLimAssocFailureTimer);
1009 tx_timer_delete(&pMac->lim.limTimers.gLimAssocFailureTimer);
1010
1011 // Deactivate and delete Reassociation failure timer.
1012 tx_timer_deactivate(&pMac->lim.limTimers.gLimReassocFailureTimer);
1013 tx_timer_delete(&pMac->lim.limTimers.gLimReassocFailureTimer);
1014
1015 // Deactivate and delete Authentication failure timer.
1016 tx_timer_deactivate(&pMac->lim.limTimers.gLimAuthFailureTimer);
1017 tx_timer_delete(&pMac->lim.limTimers.gLimAuthFailureTimer);
1018
1019 // Deactivate and delete Heartbeat timer.
1020 tx_timer_deactivate(&pMac->lim.limTimers.gLimHeartBeatTimer);
1021 tx_timer_delete(&pMac->lim.limTimers.gLimHeartBeatTimer);
1022
1023 // Deactivate and delete wait-for-probe-after-Heartbeat timer.
1024 tx_timer_deactivate(&pMac->lim.limTimers.gLimProbeAfterHBTimer);
1025 tx_timer_delete(&pMac->lim.limTimers.gLimProbeAfterHBTimer);
1026
1027 // Deactivate and delete Quiet timer.
1028 tx_timer_deactivate(&pMac->lim.limTimers.gLimQuietTimer);
1029 tx_timer_delete(&pMac->lim.limTimers.gLimQuietTimer);
1030
1031 // Deactivate and delete Quiet BSS timer.
1032 tx_timer_deactivate(&pMac->lim.limTimers.gLimQuietBssTimer);
1033 tx_timer_delete(&pMac->lim.limTimers.gLimQuietBssTimer);
1034
Jeff Johnson295189b2012-06-20 16:38:30 -07001035 // Deactivate and delete LIM background scan timer.
1036 tx_timer_deactivate(&pMac->lim.limTimers.gLimBackgroundScanTimer);
1037 tx_timer_delete(&pMac->lim.limTimers.gLimBackgroundScanTimer);
Jeff Johnson295189b2012-06-20 16:38:30 -07001038
1039
1040 // Deactivate and delete cnf wait timer
1041 for (n = 0; n < pMac->lim.maxStation; n++)
1042 {
1043 tx_timer_deactivate(&pMac->lim.limTimers.gpLimCnfWaitTimer[n]);
1044 tx_timer_delete(&pMac->lim.limTimers.gpLimCnfWaitTimer[n]);
1045 }
1046
1047 // Deactivate and delete keepalive timer
1048 tx_timer_deactivate(&pMac->lim.limTimers.gLimKeepaliveTimer);
1049 tx_timer_delete(&pMac->lim.limTimers.gLimKeepaliveTimer);
1050
1051 pAuthNode = pMac->lim.gLimPreAuthTimerTable.pTable;
1052
1053 //Deactivate any Authentication response timers
1054 limDeletePreAuthList(pMac);
1055
1056 for (n = 0; n < pMac->lim.gLimPreAuthTimerTable.numEntry; n++,pAuthNode++)
1057 {
1058 // Delete any Authentication response
1059 // timers, which might have been started.
1060 tx_timer_delete(&pAuthNode->timer);
1061 }
1062
Jeff Johnson295189b2012-06-20 16:38:30 -07001063
1064
1065 // Deactivate and delete Hash Miss throttle timer
1066 tx_timer_deactivate(&pMac->lim.limTimers.gLimSendDisassocFrameThresholdTimer);
1067 tx_timer_delete(&pMac->lim.limTimers.gLimSendDisassocFrameThresholdTimer);
1068
Jeff Johnson295189b2012-06-20 16:38:30 -07001069 tx_timer_deactivate(&pMac->lim.limTimers.gLimUpdateOlbcCacheTimer);
1070 tx_timer_delete(&pMac->lim.limTimers.gLimUpdateOlbcCacheTimer);
1071 tx_timer_deactivate(&pMac->lim.limTimers.gLimPreAuthClnupTimer);
1072 tx_timer_delete(&pMac->lim.limTimers.gLimPreAuthClnupTimer);
1073
1074#if 0 // The WPS PBC clean up timer is disabled
1075 if (pMac->lim.gLimSystemRole == eLIM_AP_ROLE)
1076 {
1077 if(pMac->lim.limTimers.gLimWPSOverlapTimerObj.isTimerCreated == eANI_BOOLEAN_TRUE)
1078 {
1079 tx_timer_deactivate(&pMac->lim.limTimers.gLimWPSOverlapTimerObj.gLimWPSOverlapTimer);
1080 tx_timer_delete(&pMac->lim.limTimers.gLimWPSOverlapTimerObj.gLimWPSOverlapTimer);
1081 pMac->lim.limTimers.gLimWPSOverlapTimerObj.isTimerCreated = eANI_BOOLEAN_FALSE;
1082 }
1083 }
1084#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001085#ifdef WLAN_FEATURE_VOWIFI_11R
1086 // Deactivate and delete FT Preauth response timer
1087 tx_timer_deactivate(&pMac->lim.limTimers.gLimFTPreAuthRspTimer);
1088 tx_timer_delete(&pMac->lim.limTimers.gLimFTPreAuthRspTimer);
1089#endif
1090
Jeff Johnson295189b2012-06-20 16:38:30 -07001091 // Deactivate and delete remain on channel timer
1092 tx_timer_deactivate(&pMac->lim.limTimers.gLimRemainOnChannelTimer);
1093 tx_timer_delete(&pMac->lim.limTimers.gLimRemainOnChannelTimer);
Jeff Johnson295189b2012-06-20 16:38:30 -07001094
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07001095#if defined(FEATURE_WLAN_CCX) && !defined(FEATURE_WLAN_CCX_UPLOAD)
Jeff Johnson295189b2012-06-20 16:38:30 -07001096 // Deactivate and delete TSM
1097 tx_timer_deactivate(&pMac->lim.limTimers.gLimCcxTsmTimer);
1098 tx_timer_delete(&pMac->lim.limTimers.gLimCcxTsmTimer);
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07001099#endif /* FEATURE_WLAN_CCX && !FEATURE_WLAN_CCX_UPLOAD */
Jeff Johnson295189b2012-06-20 16:38:30 -07001100
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -08001101 tx_timer_deactivate(&pMac->lim.limTimers.gLimDisassocAckTimer);
1102 tx_timer_delete(&pMac->lim.limTimers.gLimDisassocAckTimer);
1103
1104 tx_timer_deactivate(&pMac->lim.limTimers.gLimDeauthAckTimer);
1105 tx_timer_delete(&pMac->lim.limTimers.gLimDeauthAckTimer);
1106
Hoonki Leef63df0d2013-01-16 19:29:14 -08001107 tx_timer_deactivate(&pMac->lim.limTimers.gLimP2pSingleShotNoaInsertTimer);
1108 tx_timer_delete(&pMac->lim.limTimers.gLimP2pSingleShotNoaInsertTimer);
Hoonki Leef63df0d2013-01-16 19:29:14 -08001109
Gopichand Nakkala0d6e4ad2013-05-17 02:30:25 +05301110 tx_timer_deactivate(&pMac->lim.limTimers.gLimActiveToPassiveChannelTimer);
1111 tx_timer_delete(&pMac->lim.limTimers.gLimActiveToPassiveChannelTimer);
1112
Jeff Johnson295189b2012-06-20 16:38:30 -07001113 pMac->lim.gLimTimersCreated = 0;
1114 }
1115
1116 /// Cleanup cached scan list
1117 limReInitScanResults(pMac);
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07001118#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
1119 /// Cleanup cached scan list
1120 limReInitLfrScanResults(pMac);
1121#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001122
1123} /*** end limCleanupMlm() ***/
1124
1125
1126
1127/**
1128 * limCleanupLmm()
1129 *
1130 *FUNCTION:
1131 * This function is called to cleanup any resources
1132 * allocated by LMM sub-module.
1133 *
1134 *PARAMS:
1135 *
1136 *LOGIC:
1137 *
1138 *ASSUMPTIONS:
1139 * NA
1140 *
1141 *NOTE:
1142 * NA
1143 *
1144 * @param pMac Pointer to Global MAC structure
1145 * @return None
1146 */
1147
1148void
1149limCleanupLmm(tpAniSirGlobal pMac)
1150{
Jeff Johnson295189b2012-06-20 16:38:30 -07001151} /*** end limCleanupLmm() ***/
1152
1153
1154
1155/**
1156 * limIsAddrBC()
1157 *
1158 *FUNCTION:
1159 * This function is called in various places within LIM code
1160 * to determine whether passed MAC address is a broadcast or not
1161 *
1162 *LOGIC:
1163 *
1164 *ASSUMPTIONS:
1165 * NA
1166 *
1167 *NOTE:
1168 * NA
1169 *
1170 * @param macAddr Indicates MAC address that need to be determined
1171 * whether it is Broadcast address or not
1172 *
1173 * @return true if passed address is Broadcast address else false
1174 */
1175
1176tANI_U8
1177limIsAddrBC(tSirMacAddr macAddr)
1178{
1179 int i;
1180 for (i = 0; i < 6; i++)
1181 {
1182 if ((macAddr[i] & 0xFF) != 0xFF)
1183 return false;
1184 }
1185
1186 return true;
1187} /****** end limIsAddrBC() ******/
1188
1189
1190
1191/**
1192 * limIsGroupAddr()
1193 *
1194 *FUNCTION:
1195 * This function is called in various places within LIM code
1196 * to determine whether passed MAC address is a group address or not
1197 *
1198 *LOGIC:
1199 * If least significant bit of first octet of the MAC address is
1200 * set to 1, it is a Group address.
1201 *
1202 *ASSUMPTIONS:
1203 * NA
1204 *
1205 *NOTE:
1206 * NA
1207 *
1208 * @param macAddr Indicates MAC address that need to be determined
1209 * whether it is Group address or not
1210 *
1211 * @return true if passed address is Group address else false
1212 */
1213
1214tANI_U8
1215limIsGroupAddr(tSirMacAddr macAddr)
1216{
1217 if ((macAddr[0] & 0x01) == 0x01)
1218 return true;
1219 else
1220 return false;
1221} /****** end limIsGroupAddr() ******/
1222
1223/**
1224 * limPostMsgApiNoWait()
1225 *
1226 *FUNCTION:
1227 * This function is called from other thread while posting a
1228 * message to LIM message Queue gSirLimMsgQ with NO_WAIT option
1229 *
1230 *LOGIC:
1231 * NA
1232 *
1233 *ASSUMPTIONS:
1234 * NA
1235 *
1236 *NOTE:
1237 * NA
1238 *
1239 * @param pMsg - Pointer to the Global MAC structure
1240 * @param pMsg - Pointer to the message structure
1241 * @return None
1242 */
1243
1244tANI_U32
1245limPostMsgApiNoWait(tpAniSirGlobal pMac, tSirMsgQ *pMsg)
1246{
Jeff Johnson295189b2012-06-20 16:38:30 -07001247 limProcessMessages(pMac, pMsg);
1248 return TX_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -07001249} /*** end limPostMsgApiNoWait() ***/
1250
1251
1252
1253/**
1254 * limPrintMacAddr()
1255 *
1256 *FUNCTION:
1257 * This function is called to print passed MAC address
1258 * in : format.
1259 *
1260 *LOGIC:
1261 *
1262 *ASSUMPTIONS:
1263 * NA
1264 *
1265 *NOTE:
1266 * @param macAddr - MacAddr to be printed
1267 * @param logLevel - Loglevel to be used
1268 *
1269 * @return None.
1270 */
1271
1272void
1273limPrintMacAddr(tpAniSirGlobal pMac, tSirMacAddr macAddr, tANI_U8 logLevel)
1274{
1275 limLog(pMac, logLevel,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001276 FL("%X:%X:%X:%X:%X:%X"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001277 macAddr[0], macAddr[1], macAddr[2], macAddr[3], macAddr[4],
1278 macAddr[5]);
1279} /****** end limPrintMacAddr() ******/
1280
1281
1282
1283
1284
1285
1286/*
1287 * limResetDeferredMsgQ()
1288 *
1289 *FUNCTION:
1290 * This function resets the deferred message queue parameters.
1291 *
1292 *PARAMS:
1293 * @param pMac - Pointer to Global MAC structure
1294 *
1295 *LOGIC:
1296 *
1297 *ASSUMPTIONS:
1298 * NA
1299 *
1300 *NOTE:
1301 * NA
1302 *
1303 *RETURNS:
1304 * None
1305 */
1306
1307void limResetDeferredMsgQ(tpAniSirGlobal pMac)
1308{
1309 pMac->lim.gLimDeferredMsgQ.size =
1310 pMac->lim.gLimDeferredMsgQ.write =
1311 pMac->lim.gLimDeferredMsgQ.read = 0;
1312
1313}
1314
1315
1316#define LIM_DEFERRED_Q_CHECK_THRESHOLD (MAX_DEFERRED_QUEUE_LEN/2)
1317#define LIM_MAX_NUM_MGMT_FRAME_DEFERRED (MAX_DEFERRED_QUEUE_LEN/2)
1318
1319/*
1320 * limWriteDeferredMsgQ()
1321 *
1322 *FUNCTION:
1323 * This function queues up a deferred message for later processing on the
1324 * STA side.
1325 *
1326 *PARAMS:
1327 * @param pMac - Pointer to Global MAC structure
1328 * @param limMsg - a LIM message
1329 *
1330 *LOGIC:
1331 *
1332 *ASSUMPTIONS:
1333 * NA
1334 *
1335 *NOTE:
1336 * NA
1337 *
1338 *RETURNS:
1339 * None
1340 */
1341
1342tANI_U8 limWriteDeferredMsgQ(tpAniSirGlobal pMac, tpSirMsgQ limMsg)
1343{
1344 PELOG1(limLog(pMac, LOG1,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001345 FL("** Queue a deferred message (size %d, write %d) - type 0x%x **"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001346 pMac->lim.gLimDeferredMsgQ.size, pMac->lim.gLimDeferredMsgQ.write,
1347 limMsg->type);)
1348
1349 /*
1350 ** check if the deferred message queue is full
1351 **/
1352 if (pMac->lim.gLimDeferredMsgQ.size >= MAX_DEFERRED_QUEUE_LEN)
1353 {
Leela Venkata Kiran Kumar Reddy Chirala2247e962013-03-22 19:21:10 -07001354 if(!(pMac->lim.deferredMsgCnt & 0xF))
1355 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001356 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 -07001357 }
1358 else
1359 {
1360 pMac->lim.deferredMsgCnt++;
1361 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001362 return TX_QUEUE_FULL;
1363 }
1364
1365 /*
1366 ** In the application, there should not be more than 1 message get
1367 ** queued up. If happens, flags a warning. In the future, this can
1368 ** happen.
1369 **/
1370 if (pMac->lim.gLimDeferredMsgQ.size > 0)
1371 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001372 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 -07001373 pMac->lim.gLimDeferredMsgQ.size, limMsg->type,
1374 limIsSystemInScanState(pMac),
1375 pMac->lim.gLimSmeState, pMac->lim.gLimMlmState,
1376 pMac->lim.gLimAddtsSent);)
1377 }
1378
1379 /*
1380 ** To prevent the deferred Q is full of management frames, only give them certain space
1381 **/
1382 if( SIR_BB_XPORT_MGMT_MSG == limMsg->type )
1383 {
1384 if( LIM_DEFERRED_Q_CHECK_THRESHOLD < pMac->lim.gLimDeferredMsgQ.size )
1385 {
1386 tANI_U16 idx, count = 0;
1387 for(idx = 0; idx < pMac->lim.gLimDeferredMsgQ.size; idx++)
1388 {
1389 if( SIR_BB_XPORT_MGMT_MSG == pMac->lim.gLimDeferredMsgQ.deferredQueue[idx].type )
1390 {
1391 count++;
1392 }
1393 }
1394 if( LIM_MAX_NUM_MGMT_FRAME_DEFERRED < count )
1395 {
1396 //We reach the quota for management frames, drop this one
Madan Mohan Koyyalamudi5695b502012-09-24 14:21:12 -07001397 PELOGW(limLog(pMac, LOGW, FL("Cannot deferred. Msg: %d Too many (count=%d) already"), limMsg->type, count);)
Jeff Johnson295189b2012-06-20 16:38:30 -07001398 //Return error, caller knows what to do
1399 return TX_QUEUE_FULL;
1400 }
1401 }
1402 }
1403
1404 ++pMac->lim.gLimDeferredMsgQ.size;
1405
Leela Venkata Kiran Kumar Reddy Chirala2247e962013-03-22 19:21:10 -07001406 /* reset the count here since we are able to defer the message */
1407 if(pMac->lim.deferredMsgCnt != 0)
1408 {
1409 pMac->lim.deferredMsgCnt = 0;
1410 }
1411
Jeff Johnson295189b2012-06-20 16:38:30 -07001412 /*
1413 ** if the write pointer hits the end of the queue, rewind it
1414 **/
1415 if (pMac->lim.gLimDeferredMsgQ.write >= MAX_DEFERRED_QUEUE_LEN)
1416 pMac->lim.gLimDeferredMsgQ.write = 0;
1417
1418 /*
1419 ** save the message to the queue and advanced the write pointer
1420 **/
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301421 vos_mem_copy( (tANI_U8 *)&pMac->lim.gLimDeferredMsgQ.deferredQueue[
1422 pMac->lim.gLimDeferredMsgQ.write++],
Jeff Johnson295189b2012-06-20 16:38:30 -07001423 (tANI_U8 *)limMsg,
1424 sizeof(tSirMsgQ));
1425 return TX_SUCCESS;
1426
1427}
1428
1429/*
1430 * limReadDeferredMsgQ()
1431 *
1432 *FUNCTION:
1433 * This function dequeues a deferred message for processing on the
1434 * STA side.
1435 *
1436 *PARAMS:
1437 * @param pMac - Pointer to Global MAC structure
1438 *
1439 *LOGIC:
1440 *
1441 *ASSUMPTIONS:
1442 * NA
1443 *
1444 *NOTE:
1445 *
1446 *
1447 *RETURNS:
1448 * Returns the message at the head of the deferred message queue
1449 */
1450
1451tSirMsgQ* limReadDeferredMsgQ(tpAniSirGlobal pMac)
1452{
1453 tSirMsgQ *msg;
1454
1455 /*
1456 ** check any messages left. If no, return
1457 **/
1458 if (pMac->lim.gLimDeferredMsgQ.size <= 0)
1459 return NULL;
1460
1461 /*
1462 ** decrement the queue size
1463 **/
1464 pMac->lim.gLimDeferredMsgQ.size--;
1465
1466 /*
1467 ** retrieve the message from the head of the queue
1468 **/
1469 msg = &pMac->lim.gLimDeferredMsgQ.deferredQueue[pMac->lim.gLimDeferredMsgQ.read];
1470
1471 /*
1472 ** advance the read pointer
1473 **/
1474 pMac->lim.gLimDeferredMsgQ.read++;
1475
1476 /*
1477 ** if the read pointer hits the end of the queue, rewind it
1478 **/
1479 if (pMac->lim.gLimDeferredMsgQ.read >= MAX_DEFERRED_QUEUE_LEN)
1480 pMac->lim.gLimDeferredMsgQ.read = 0;
1481
1482 PELOG1(limLog(pMac, LOG1,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001483 FL("** DeQueue a deferred message (size %d read %d) - type 0x%x **"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001484 pMac->lim.gLimDeferredMsgQ.size, pMac->lim.gLimDeferredMsgQ.read,
1485 msg->type);)
1486
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001487 PELOG1(limLog(pMac, LOG1, FL("DQ msg -- scan %d, global sme %d, global mlme %d, addts %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001488 limIsSystemInScanState(pMac),
1489 pMac->lim.gLimSmeState, pMac->lim.gLimMlmState,
1490 pMac->lim.gLimAddtsSent);)
1491
1492 return(msg);
1493}
1494
1495tSirRetStatus
1496limSysProcessMmhMsgApi(tpAniSirGlobal pMac,
1497 tSirMsgQ *pMsg,
1498 tANI_U8 qType)
1499{
1500// FIXME
Jeff Johnson295189b2012-06-20 16:38:30 -07001501 SysProcessMmhMsg(pMac, pMsg);
1502 return eSIR_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -07001503}
1504
1505char *limFrameStr(tANI_U32 type, tANI_U32 subType)
1506{
1507#ifdef FIXME_GEN6
1508
1509 if (type == SIR_MAC_MGMT_FRAME)
1510 {
1511 switch (subType)
1512 {
1513 case SIR_MAC_MGMT_ASSOC_REQ:
1514 return "MAC_MGMT_ASSOC_REQ";
1515 case SIR_MAC_MGMT_ASSOC_RSP:
1516 return "MAC_MGMT_ASSOC_RSP";
1517 case SIR_MAC_MGMT_REASSOC_REQ:
1518 return "MAC_MGMT_REASSOC_REQ";
1519 case SIR_MAC_MGMT_REASSOC_RSP:
1520 return "MAC_MGMT_REASSOC_RSP";
1521 case SIR_MAC_MGMT_PROBE_REQ:
1522 return "MAC_MGMT_PROBE_REQ";
1523 case SIR_MAC_MGMT_PROBE_RSP:
1524 return "MAC_MGMT_PROBE_RSP";
1525 case SIR_MAC_MGMT_BEACON:
1526 return "MAC_MGMT_BEACON";
1527 case SIR_MAC_MGMT_ATIM:
1528 return "MAC_MGMT_ATIM";
1529 case SIR_MAC_MGMT_DISASSOC:
1530 return "MAC_MGMT_DISASSOC";
1531 case SIR_MAC_MGMT_AUTH:
1532 return "MAC_MGMT_AUTH";
1533 case SIR_MAC_MGMT_DEAUTH:
1534 return "MAC_MGMT_DEAUTH";
1535 case SIR_MAC_MGMT_ACTION:
1536 return "MAC_MGMT_ACTION";
1537 case SIR_MAC_MGMT_RESERVED15:
1538 return "MAC_MGMT_RESERVED15";
1539 default:
1540 return "Unknown MGMT Frame";
1541 }
1542 }
1543
1544 else if (type == SIR_MAC_CTRL_FRAME)
1545 {
1546 switch (subType)
1547 {
1548 case SIR_MAC_CTRL_RR:
1549 return "MAC_CTRL_RR";
1550 case SIR_MAC_CTRL_BAR:
1551 return "MAC_CTRL_BAR";
1552 case SIR_MAC_CTRL_BA:
1553 return "MAC_CTRL_BA";
1554 case SIR_MAC_CTRL_PS_POLL:
1555 return "MAC_CTRL_PS_POLL";
1556 case SIR_MAC_CTRL_RTS:
1557 return "MAC_CTRL_RTS";
1558 case SIR_MAC_CTRL_CTS:
1559 return "MAC_CTRL_CTS";
1560 case SIR_MAC_CTRL_ACK:
1561 return "MAC_CTRL_ACK";
1562 case SIR_MAC_CTRL_CF_END:
1563 return "MAC_CTRL_CF_END";
1564 case SIR_MAC_CTRL_CF_END_ACK:
1565 return "MAC_CTRL_CF_END_ACK";
1566 default:
1567 return "Unknown CTRL Frame";
1568 }
1569 }
1570
1571 else if (type == SIR_MAC_DATA_FRAME)
1572 {
1573 switch (subType)
1574 {
1575 case SIR_MAC_DATA_DATA:
1576 return "MAC_DATA_DATA";
1577 case SIR_MAC_DATA_DATA_ACK:
1578 return "MAC_DATA_DATA_ACK";
1579 case SIR_MAC_DATA_DATA_POLL:
1580 return "MAC_DATA_DATA_POLL";
1581 case SIR_MAC_DATA_DATA_ACK_POLL:
1582 return "MAC_DATA_DATA_ACK_POLL";
1583 case SIR_MAC_DATA_NULL:
1584 return "MAC_DATA_NULL";
1585 case SIR_MAC_DATA_NULL_ACK:
1586 return "MAC_DATA_NULL_ACK";
1587 case SIR_MAC_DATA_NULL_POLL:
1588 return "MAC_DATA_NULL_POLL";
1589 case SIR_MAC_DATA_NULL_ACK_POLL:
1590 return "MAC_DATA_NULL_ACK_POLL";
1591 case SIR_MAC_DATA_QOS_DATA:
1592 return "MAC_DATA_QOS_DATA";
1593 case SIR_MAC_DATA_QOS_DATA_ACK:
1594 return "MAC_DATA_QOS_DATA_ACK";
1595 case SIR_MAC_DATA_QOS_DATA_POLL:
1596 return "MAC_DATA_QOS_DATA_POLL";
1597 case SIR_MAC_DATA_QOS_DATA_ACK_POLL:
1598 return "MAC_DATA_QOS_DATA_ACK_POLL";
1599 case SIR_MAC_DATA_QOS_NULL:
1600 return "MAC_DATA_QOS_NULL";
1601 case SIR_MAC_DATA_QOS_NULL_ACK:
1602 return "MAC_DATA_QOS_NULL_ACK";
1603 case SIR_MAC_DATA_QOS_NULL_POLL:
1604 return "MAC_DATA_QOS_NULL_POLL";
1605 case SIR_MAC_DATA_QOS_NULL_ACK_POLL:
1606 return "MAC_DATA_QOS_NULL_ACK_POLL";
1607 default:
1608 return "Unknown Data Frame";
1609 }
1610 }
1611 else
1612 return "Unknown";
1613#endif
1614return "";
1615}
1616
Jeff Johnson295189b2012-06-20 16:38:30 -07001617void limHandleUpdateOlbcCache(tpAniSirGlobal pMac)
1618{
1619 int i;
1620 static int enable;
1621 tUpdateBeaconParams beaconParams;
1622
1623 tpPESession psessionEntry = limIsApSessionActive(pMac);
1624
1625 if (psessionEntry == NULL)
Madan Mohan Koyyalamudi788b4ee2012-09-25 10:42:09 -07001626 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001627 PELOGE(limLog(pMac, LOGE, FL(" Session not found"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001628 return;
Madan Mohan Koyyalamudi788b4ee2012-09-25 10:42:09 -07001629 }
Pratik Bhalgatb44ea3f2012-11-22 16:41:39 +05301630
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301631 vos_mem_set( ( tANI_U8* )&beaconParams, sizeof( tUpdateBeaconParams), 0);
Madan Mohan Koyyalamudib2733142012-10-31 13:59:17 -07001632 beaconParams.bssIdx = psessionEntry->bssIdx;
Jeff Johnson295189b2012-06-20 16:38:30 -07001633
1634 beaconParams.paramChangeBitmap = 0;
1635 /*
1636 ** This is doing a 2 pass check. The first pass is to invalidate
1637 ** all the cache entries. The second pass is to decide whether to
1638 ** disable protection.
1639 **/
1640 if (!enable)
1641 {
1642
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001643 PELOG2(limLog(pMac, LOG2, FL("Resetting OLBC cache"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001644 psessionEntry->gLimOlbcParams.numSta = 0;
1645 psessionEntry->gLimOverlap11gParams.numSta = 0;
1646 psessionEntry->gLimOverlapHt20Params.numSta = 0;
1647 psessionEntry->gLimNonGfParams.numSta = 0;
1648 psessionEntry->gLimLsigTxopParams.numSta = 0;
1649
1650 for (i=0; i < LIM_PROT_STA_OVERLAP_CACHE_SIZE; i++)
1651 pMac->lim.protStaOverlapCache[i].active = false;
1652
1653 enable = 1;
1654 }
1655 else
1656 {
1657
Madan Mohan Koyyalamudi788b4ee2012-09-25 10:42:09 -07001658 if (!psessionEntry->gLimOlbcParams.numSta)
Jeff Johnson295189b2012-06-20 16:38:30 -07001659 {
1660 if (psessionEntry->gLimOlbcParams.protectionEnabled)
1661 {
1662 if (!psessionEntry->gLim11bParams.protectionEnabled)
1663 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001664 PELOG1(limLog(pMac, LOG1, FL("Overlap cache all clear and no 11B STA detected"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001665 limEnable11gProtection(pMac, false, true, &beaconParams, psessionEntry);
1666 }
1667 }
1668 }
1669
1670 if (!psessionEntry->gLimOverlap11gParams.numSta)
1671 {
1672 if (psessionEntry->gLimOverlap11gParams.protectionEnabled)
1673 {
1674 if (!psessionEntry->gLim11gParams.protectionEnabled)
1675 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001676 PELOG1(limLog(pMac, LOG1, FL("Overlap cache all clear and no 11G STA detected"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001677 limEnableHtProtectionFrom11g(pMac, false, true, &beaconParams,psessionEntry);
1678 }
1679 }
1680 }
1681
1682 if (!psessionEntry->gLimOverlapHt20Params.numSta)
1683 {
1684 if (psessionEntry->gLimOverlapHt20Params.protectionEnabled)
1685 {
1686 if (!psessionEntry->gLimHt20Params.protectionEnabled)
1687 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001688 PELOG1(limLog(pMac, LOG1, FL("Overlap cache all clear and no HT20 STA detected"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001689 limEnable11gProtection(pMac, false, true, &beaconParams,psessionEntry);
1690 }
1691 }
1692 }
1693
1694 enable = 0;
1695 }
1696
1697 if(beaconParams.paramChangeBitmap)
1698 {
1699 schSetFixedBeaconFields(pMac,psessionEntry);
1700 limSendBeaconParams(pMac, &beaconParams, psessionEntry);
1701 }
1702
1703 // Start OLBC timer
1704 if (tx_timer_activate(&pMac->lim.limTimers.gLimUpdateOlbcCacheTimer) != TX_SUCCESS)
1705 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001706 limLog(pMac, LOGE, FL("tx_timer_activate failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001707 }
1708}
Jeff Johnson295189b2012-06-20 16:38:30 -07001709
1710/**
1711 * limIsNullSsid()
1712 *
1713 *FUNCTION:
1714 * This function checks if Ssid supplied is Null SSID
1715 *
1716 *
1717 *LOGIC:
1718 *
1719 *ASSUMPTIONS:
1720 * NA
1721 *
1722 *NOTE:
1723 * NA
1724 *
1725 * @param tSirMacSSid *
1726 *
1727 *
1728 * @return true if SSID is Null SSID else false
1729 */
1730
1731tANI_U8
1732limIsNullSsid( tSirMacSSid *pSsid )
1733{
1734 tANI_U8 fNullSsid = false;
1735 tANI_U32 SsidLength;
1736 tANI_U8 *pSsidStr;
1737
1738 do
1739 {
1740 if ( 0 == pSsid->length )
1741 {
1742 fNullSsid = true;
1743 break;
1744 }
1745
1746#define ASCII_SPACE_CHARACTER 0x20
1747 /* If the first charactes is space, then check if all characters in
1748 * SSID are spaces to consider it as NULL SSID*/
1749 if( ASCII_SPACE_CHARACTER == pSsid->ssId[0])
1750 {
1751 SsidLength = pSsid->length;
1752 pSsidStr = pSsid->ssId;
1753 /* check if all the charactes in SSID are spaces*/
1754 while ( SsidLength )
1755 {
1756 if( ASCII_SPACE_CHARACTER != *pSsidStr )
1757 break;
1758
1759 pSsidStr++;
1760 SsidLength--;
1761 }
1762
1763 if( 0 == SsidLength )
1764 {
1765 fNullSsid = true;
1766 break;
1767 }
1768 }
1769 else
1770 {
1771 /* check if all the charactes in SSID are NULL*/
1772 SsidLength = pSsid->length;
1773 pSsidStr = pSsid->ssId;
1774
1775 while ( SsidLength )
1776 {
1777 if( *pSsidStr )
1778 break;
1779
1780 pSsidStr++;
1781 SsidLength--;
1782 }
1783
1784 if( 0 == SsidLength )
1785 {
1786 fNullSsid = true;
1787 break;
1788 }
1789 }
1790 }
1791 while( 0 );
1792
1793 return fNullSsid;
1794} /****** end limIsNullSsid() ******/
1795
1796
1797
Jeff Johnson295189b2012-06-20 16:38:30 -07001798
1799/** -------------------------------------------------------------
1800\fn limUpdateProtStaParams
1801\brief updates protection related counters.
1802\param tpAniSirGlobal pMac
1803\param tSirMacAddr peerMacAddr
1804\param tLimProtStaCacheType protStaCacheType
1805\param tHalBitVal gfSupported
1806\param tHalBitVal lsigTxopSupported
1807\return None
1808 -------------------------------------------------------------*/
1809void
1810limUpdateProtStaParams(tpAniSirGlobal pMac,
1811tSirMacAddr peerMacAddr, tLimProtStaCacheType protStaCacheType,
1812tHalBitVal gfSupported, tHalBitVal lsigTxopSupported,
1813tpPESession psessionEntry)
1814{
1815 tANI_U32 i;
1816
1817 PELOG1(limLog(pMac,LOG1, FL("A STA is associated:"));
1818 limLog(pMac,LOG1, FL("Addr : "));
1819 limPrintMacAddr(pMac, peerMacAddr, LOG1);)
1820
1821 for (i=0; i<LIM_PROT_STA_CACHE_SIZE; i++)
1822 {
1823 if (psessionEntry->protStaCache[i].active)
1824 {
1825 PELOG1(limLog(pMac, LOG1, FL("Addr: "));)
1826 PELOG1(limPrintMacAddr(pMac, psessionEntry->protStaCache[i].addr, LOG1);)
1827
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301828 if (vos_mem_compare(
Jeff Johnson295189b2012-06-20 16:38:30 -07001829 psessionEntry->protStaCache[i].addr,
1830 peerMacAddr, sizeof(tSirMacAddr)))
1831 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001832 PELOG1(limLog(pMac, LOG1, FL("matching cache entry at %d already active."), i);)
Jeff Johnson295189b2012-06-20 16:38:30 -07001833 return;
1834 }
1835 }
1836 }
1837
1838 for (i=0; i<LIM_PROT_STA_CACHE_SIZE; i++)
1839 {
1840 if (!psessionEntry->protStaCache[i].active)
1841 break;
1842 }
1843
1844 if (i >= LIM_PROT_STA_CACHE_SIZE)
1845 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001846 PELOGE(limLog(pMac, LOGE, FL("No space in ProtStaCache"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001847 return;
1848 }
1849
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301850 vos_mem_copy( psessionEntry->protStaCache[i].addr,
Jeff Johnson295189b2012-06-20 16:38:30 -07001851 peerMacAddr,
1852 sizeof(tSirMacAddr));
1853
1854 psessionEntry->protStaCache[i].protStaCacheType = protStaCacheType;
1855 psessionEntry->protStaCache[i].active = true;
1856 if(eLIM_PROT_STA_CACHE_TYPE_llB == protStaCacheType)
1857 {
1858 psessionEntry->gLim11bParams.numSta++;
1859 limLog(pMac,LOG1, FL("11B, "));
1860 }
1861 else if(eLIM_PROT_STA_CACHE_TYPE_llG == protStaCacheType)
1862 {
1863 psessionEntry->gLim11gParams.numSta++;
1864 limLog(pMac,LOG1, FL("11G, "));
1865 }
1866 else if(eLIM_PROT_STA_CACHE_TYPE_HT20 == protStaCacheType)
1867 {
1868 psessionEntry->gLimHt20Params.numSta++;
1869 limLog(pMac,LOG1, FL("HT20, "));
1870 }
1871
1872 if(!gfSupported)
1873 {
1874 psessionEntry->gLimNonGfParams.numSta++;
1875 limLog(pMac,LOG1, FL("NonGf, "));
1876 }
1877 if(!lsigTxopSupported)
1878 {
1879 psessionEntry->gLimLsigTxopParams.numSta++;
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001880 limLog(pMac,LOG1, FL("!lsigTxopSupported"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001881 }
1882}// ---------------------------------------------------------------------
1883
1884/** -------------------------------------------------------------
1885\fn limDecideApProtection
1886\brief Decides all the protection related staiton coexistence and also sets
1887\ short preamble and short slot appropriately. This function will be called
1888\ when AP is ready to send assocRsp tp the station joining right now.
1889\param tpAniSirGlobal pMac
1890\param tSirMacAddr peerMacAddr
1891\return None
1892 -------------------------------------------------------------*/
1893void
1894limDecideApProtection(tpAniSirGlobal pMac, tSirMacAddr peerMacAddr, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry)
1895{
1896 tANI_U16 tmpAid;
1897 tpDphHashNode pStaDs;
1898 tSirRFBand rfBand = SIR_BAND_UNKNOWN;
1899 tANI_U32 phyMode;
1900 tLimProtStaCacheType protStaCacheType = eLIM_PROT_STA_CACHE_TYPE_INVALID;
1901 tHalBitVal gfSupported = eHAL_SET, lsigTxopSupported = eHAL_SET;
1902
1903 pBeaconParams->paramChangeBitmap = 0;
1904 // check whether to enable protection or not
1905 pStaDs = dphLookupHashEntry(pMac, peerMacAddr, &tmpAid, &psessionEntry->dph.dphHashTable);
1906 if(NULL == pStaDs)
1907 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001908 PELOG1(limLog(pMac, LOG1, FL("pStaDs is NULL"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001909 return;
1910 }
1911 limGetRfBand(pMac, &rfBand, psessionEntry);
1912 //if we are in 5 GHZ band
1913 if(SIR_BAND_5_GHZ == rfBand)
1914 {
1915 //We are 11N. we need to protect from 11A and Ht20. we don't need any other protection in 5 GHZ.
1916 //HT20 case is common between both the bands and handled down as common code.
Jeff Johnsone7245742012-09-05 17:12:55 -07001917 if(true == psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07001918 {
1919 //we are 11N and 11A station is joining.
1920 //protection from 11A required.
1921 if(false == pStaDs->mlmStaContext.htCapability)
1922 {
1923 limEnable11aProtection(pMac, true, false, pBeaconParams,psessionEntry);
1924 return;
1925 }
1926 }
1927 }
1928 else if(SIR_BAND_2_4_GHZ== rfBand)
1929 {
1930 limGetPhyMode(pMac, &phyMode, psessionEntry);
1931
1932 //We are 11G. Check if we need protection from 11b Stations.
1933 if ((phyMode == WNI_CFG_PHY_MODE_11G) &&
Jeff Johnsone7245742012-09-05 17:12:55 -07001934 (false == psessionEntry->htCapability))
Jeff Johnson295189b2012-06-20 16:38:30 -07001935 {
1936
1937 if (pStaDs->erpEnabled== eHAL_CLEAR)
1938 {
1939 protStaCacheType = eLIM_PROT_STA_CACHE_TYPE_llB;
1940 // enable protection
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001941 PELOG3(limLog(pMac, LOG3, FL("Enabling protection from 11B"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001942 limEnable11gProtection(pMac, true, false, pBeaconParams,psessionEntry);
1943 }
1944 }
1945
1946 //HT station.
Jeff Johnsone7245742012-09-05 17:12:55 -07001947 if (true == psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07001948 {
1949 //check if we need protection from 11b station
1950 if ((pStaDs->erpEnabled == eHAL_CLEAR) &&
1951 (!pStaDs->mlmStaContext.htCapability))
1952 {
1953 protStaCacheType = eLIM_PROT_STA_CACHE_TYPE_llB;
1954 // enable protection
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001955 PELOG3(limLog(pMac, LOG3, FL("Enabling protection from 11B"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001956 limEnable11gProtection(pMac, true, false, pBeaconParams, psessionEntry);
1957 }
1958 //station being joined is non-11b and non-ht ==> 11g device
1959 else if(!pStaDs->mlmStaContext.htCapability)
1960 {
1961 protStaCacheType = eLIM_PROT_STA_CACHE_TYPE_llG;
1962 //enable protection
1963 limEnableHtProtectionFrom11g(pMac, true, false, pBeaconParams, psessionEntry);
1964 }
1965 //ERP mode is enabled for the latest station joined
1966 //latest station joined is HT capable
1967 //This case is being handled in common code (commn between both the bands) below.
1968 }
1969 }
1970
1971 //we are HT and HT station is joining. This code is common for both the bands.
Jeff Johnsone7245742012-09-05 17:12:55 -07001972 if((true == psessionEntry->htCapability) &&
Jeff Johnson295189b2012-06-20 16:38:30 -07001973 (true == pStaDs->mlmStaContext.htCapability))
1974 {
1975 if(!pStaDs->htGreenfield)
1976 {
1977 limEnableHTNonGfProtection(pMac, true, false, pBeaconParams, psessionEntry);
1978 gfSupported = eHAL_CLEAR;
1979 }
1980 //Station joining is HT 20Mhz
1981 if(eHT_CHANNEL_WIDTH_20MHZ == pStaDs->htSupportedChannelWidthSet)
1982 {
1983 protStaCacheType = eLIM_PROT_STA_CACHE_TYPE_HT20;
1984 limEnableHT20Protection(pMac, true, false, pBeaconParams, psessionEntry);
1985 }
1986 //Station joining does not support LSIG TXOP Protection
1987 if(!pStaDs->htLsigTXOPProtection)
1988 {
1989 limEnableHTLsigTxopProtection(pMac, false, false, pBeaconParams,psessionEntry);
1990 lsigTxopSupported = eHAL_CLEAR;
1991 }
1992 }
1993
1994 limUpdateProtStaParams(pMac, peerMacAddr, protStaCacheType,
1995 gfSupported, lsigTxopSupported, psessionEntry);
1996
1997 return;
1998}
Jeff Johnson295189b2012-06-20 16:38:30 -07001999
2000
2001/** -------------------------------------------------------------
2002\fn limEnableOverlap11gProtection
2003\brief wrapper function for setting overlap 11g protection.
2004\param tpAniSirGlobal pMac
2005\param tpUpdateBeaconParams pBeaconParams
2006\param tpSirMacMgmtHdr pMh
2007\return None
2008 -------------------------------------------------------------*/
2009void
2010limEnableOverlap11gProtection(tpAniSirGlobal pMac,
2011tpUpdateBeaconParams pBeaconParams, tpSirMacMgmtHdr pMh,tpPESession psessionEntry)
2012{
2013 limUpdateOverlapStaParam(pMac, pMh->bssId, &(psessionEntry->gLimOlbcParams));
2014
2015 if (psessionEntry->gLimOlbcParams.numSta &&
2016 !psessionEntry->gLimOlbcParams.protectionEnabled)
2017 {
2018 // enable protection
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002019 PELOG1(limLog(pMac, LOG1, FL("OLBC happens!!!"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002020 limEnable11gProtection(pMac, true, true, pBeaconParams,psessionEntry);
2021 }
2022}
2023
2024
2025/** -------------------------------------------------------------
2026\fn limUpdateShortPreamble
2027\brief Updates short preamble if needed when a new station joins.
2028\param tpAniSirGlobal pMac
2029\param tSirMacAddr peerMacAddr
2030\param tpUpdateBeaconParams pBeaconParams
2031\return None
2032 -------------------------------------------------------------*/
2033void
2034limUpdateShortPreamble(tpAniSirGlobal pMac, tSirMacAddr peerMacAddr,
2035 tpUpdateBeaconParams pBeaconParams, tpPESession psessionEntry)
2036{
2037 tANI_U16 tmpAid;
2038 tpDphHashNode pStaDs;
2039 tANI_U32 phyMode;
2040 tANI_U16 i;
2041
2042 // check whether to enable protection or not
2043 pStaDs = dphLookupHashEntry(pMac, peerMacAddr, &tmpAid, &psessionEntry->dph.dphHashTable);
2044
2045 limGetPhyMode(pMac, &phyMode, psessionEntry);
2046
2047 if (pStaDs != NULL && phyMode == WNI_CFG_PHY_MODE_11G)
2048
2049 {
2050 if (pStaDs->shortPreambleEnabled == eHAL_CLEAR)
2051 {
2052 PELOG1(limLog(pMac,LOG1,FL("Short Preamble is not enabled in Assoc Req from "));
2053 limPrintMacAddr(pMac, peerMacAddr, LOG1);)
2054
2055 for (i=0; i<LIM_PROT_STA_CACHE_SIZE; i++)
2056 {
Jeff Johnson295189b2012-06-20 16:38:30 -07002057 if ((psessionEntry->limSystemRole == eLIM_AP_ROLE ) &&
2058 psessionEntry->gLimNoShortParams.staNoShortCache[i].active)
2059 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05302060 if (vos_mem_compare(
Jeff Johnson295189b2012-06-20 16:38:30 -07002061 psessionEntry->gLimNoShortParams.staNoShortCache[i].addr,
2062 peerMacAddr, sizeof(tSirMacAddr)))
2063 return;
2064 }else if(psessionEntry->limSystemRole != eLIM_AP_ROLE)
Jeff Johnson295189b2012-06-20 16:38:30 -07002065 {
2066 if (pMac->lim.gLimNoShortParams.staNoShortCache[i].active)
2067 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05302068 if (vos_mem_compare(
Jeff Johnson295189b2012-06-20 16:38:30 -07002069 pMac->lim.gLimNoShortParams.staNoShortCache[i].addr,
2070 peerMacAddr, sizeof(tSirMacAddr)))
2071 return;
2072 }
2073 }
2074 }
2075
2076
2077 for (i=0; i<LIM_PROT_STA_CACHE_SIZE; i++)
2078 {
Jeff Johnson295189b2012-06-20 16:38:30 -07002079 if ( (psessionEntry->limSystemRole == eLIM_AP_ROLE ) &&
2080 !psessionEntry->gLimNoShortParams.staNoShortCache[i].active)
2081 break;
2082 else
Jeff Johnson295189b2012-06-20 16:38:30 -07002083 {
2084 if (!pMac->lim.gLimNoShortParams.staNoShortCache[i].active)
2085 break;
2086 }
2087 }
2088
2089 if (i >= LIM_PROT_STA_CACHE_SIZE)
2090 {
Jeff Johnson295189b2012-06-20 16:38:30 -07002091 if(psessionEntry->limSystemRole == eLIM_AP_ROLE){
2092 limLog(pMac, LOGE, FL("No space in Short cache (#active %d, #sta %d) for sta "),
2093 i, psessionEntry->gLimNoShortParams.numNonShortPreambleSta);
2094 limPrintMacAddr(pMac, peerMacAddr, LOGE);
2095 return;
2096 }
2097 else
Jeff Johnson295189b2012-06-20 16:38:30 -07002098 {
2099 limLog(pMac, LOGE, FL("No space in Short cache (#active %d, #sta %d) for sta "),
2100 i, pMac->lim.gLimNoShortParams.numNonShortPreambleSta);
2101 limPrintMacAddr(pMac, peerMacAddr, LOGE);
2102 return;
2103 }
2104
2105 }
2106
2107
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05302108 if (psessionEntry->limSystemRole == eLIM_AP_ROLE){
2109 vos_mem_copy( psessionEntry->gLimNoShortParams.staNoShortCache[i].addr,
Jeff Johnson295189b2012-06-20 16:38:30 -07002110 peerMacAddr, sizeof(tSirMacAddr));
2111 psessionEntry->gLimNoShortParams.staNoShortCache[i].active = true;
2112 psessionEntry->gLimNoShortParams.numNonShortPreambleSta++;
2113 }else
Jeff Johnson295189b2012-06-20 16:38:30 -07002114 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05302115 vos_mem_copy( pMac->lim.gLimNoShortParams.staNoShortCache[i].addr,
Jeff Johnson295189b2012-06-20 16:38:30 -07002116 peerMacAddr, sizeof(tSirMacAddr));
2117 pMac->lim.gLimNoShortParams.staNoShortCache[i].active = true;
2118 pMac->lim.gLimNoShortParams.numNonShortPreambleSta++;
2119 }
2120
2121
2122 // enable long preamble
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002123 PELOG1(limLog(pMac, LOG1, FL("Disabling short preamble"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002124
Jeff Johnson295189b2012-06-20 16:38:30 -07002125 if (limEnableShortPreamble(pMac, false, pBeaconParams, psessionEntry) != eSIR_SUCCESS)
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002126 PELOGE(limLog(pMac, LOGE, FL("Cannot enable long preamble"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002127 }
2128 }
2129}
2130
2131/** -------------------------------------------------------------
2132\fn limUpdateShortSlotTime
2133\brief Updates short slot time if needed when a new station joins.
2134\param tpAniSirGlobal pMac
2135\param tSirMacAddr peerMacAddr
2136\param tpUpdateBeaconParams pBeaconParams
2137\return None
2138 -------------------------------------------------------------*/
2139
2140void
2141limUpdateShortSlotTime(tpAniSirGlobal pMac, tSirMacAddr peerMacAddr,
2142 tpUpdateBeaconParams pBeaconParams, tpPESession psessionEntry)
2143{
2144 tANI_U16 tmpAid;
2145 tpDphHashNode pStaDs;
2146 tANI_U32 phyMode;
2147 tANI_U32 val;
Jeff Johnson295189b2012-06-20 16:38:30 -07002148 tANI_U16 i;
2149
2150 // check whether to enable protection or not
2151 pStaDs = dphLookupHashEntry(pMac, peerMacAddr, &tmpAid, &psessionEntry->dph.dphHashTable);
2152 limGetPhyMode(pMac, &phyMode, psessionEntry);
2153
Jeff Johnsone7245742012-09-05 17:12:55 -07002154 /* Only in case of softap in 11g mode, slot time might change depending on the STA being added. In 11a case, it should
2155 * be always 1 and in 11b case, it should be always 0
2156 */
Jeff Johnson295189b2012-06-20 16:38:30 -07002157 if (pStaDs != NULL && phyMode == WNI_CFG_PHY_MODE_11G)
2158 {
Jeff Johnsone7245742012-09-05 17:12:55 -07002159 /* Only when the new STA has short slot time disabled, we need to change softap's overall slot time settings
2160 * else the default for softap is always short slot enabled. When the last long slot STA leaves softAP, we take care of
2161 * it in limDecideShortSlot
2162 */
Jeff Johnson295189b2012-06-20 16:38:30 -07002163 if (pStaDs->shortSlotTimeEnabled == eHAL_CLEAR)
2164 {
2165 PELOG1(limLog(pMac, LOG1, FL("Short Slot Time is not enabled in Assoc Req from "));
2166 limPrintMacAddr(pMac, peerMacAddr, LOG1);)
2167 for (i=0; i<LIM_PROT_STA_CACHE_SIZE; i++)
2168 {
Jeff Johnson295189b2012-06-20 16:38:30 -07002169 if ((psessionEntry->limSystemRole == eLIM_AP_ROLE ) &&
2170 psessionEntry->gLimNoShortSlotParams.staNoShortSlotCache[i].active)
2171 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05302172 if (vos_mem_compare(
Jeff Johnson295189b2012-06-20 16:38:30 -07002173 psessionEntry->gLimNoShortSlotParams.staNoShortSlotCache[i].addr,
2174 peerMacAddr, sizeof(tSirMacAddr)))
2175 return;
2176 }
2177 else if(psessionEntry->limSystemRole != eLIM_AP_ROLE )
Jeff Johnson295189b2012-06-20 16:38:30 -07002178 {
2179 if (pMac->lim.gLimNoShortSlotParams.staNoShortSlotCache[i].active)
2180 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05302181 if (vos_mem_compare(
Jeff Johnson295189b2012-06-20 16:38:30 -07002182 pMac->lim.gLimNoShortSlotParams.staNoShortSlotCache[i].addr,
2183 peerMacAddr, sizeof(tSirMacAddr)))
2184 return;
2185 }
2186 }
2187 }
2188
2189 for (i=0; i<LIM_PROT_STA_CACHE_SIZE; i++)
2190 {
Jeff Johnson295189b2012-06-20 16:38:30 -07002191 if ((psessionEntry->limSystemRole == eLIM_AP_ROLE ) &&
2192 !psessionEntry->gLimNoShortSlotParams.staNoShortSlotCache[i].active)
2193 break;
2194 else
Jeff Johnson295189b2012-06-20 16:38:30 -07002195 {
2196 if (!pMac->lim.gLimNoShortSlotParams.staNoShortSlotCache[i].active)
2197 break;
2198 }
2199 }
2200
2201 if (i >= LIM_PROT_STA_CACHE_SIZE)
2202 {
Jeff Johnson295189b2012-06-20 16:38:30 -07002203 if(psessionEntry->limSystemRole == eLIM_AP_ROLE){
2204 limLog(pMac, LOGE, FL("No space in ShortSlot cache (#active %d, #sta %d) for sta "),
2205 i, psessionEntry->gLimNoShortSlotParams.numNonShortSlotSta);
2206 limPrintMacAddr(pMac, peerMacAddr, LOGE);
2207 return;
2208 }else
Jeff Johnson295189b2012-06-20 16:38:30 -07002209 {
2210 limLog(pMac, LOGE, FL("No space in ShortSlot cache (#active %d, #sta %d) for sta "),
2211 i, pMac->lim.gLimNoShortSlotParams.numNonShortSlotSta);
2212 limPrintMacAddr(pMac, peerMacAddr, LOGE);
2213 return;
2214 }
2215 }
2216
2217
Jeff Johnson295189b2012-06-20 16:38:30 -07002218 if(psessionEntry->limSystemRole == eLIM_AP_ROLE){
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05302219 vos_mem_copy( psessionEntry->gLimNoShortSlotParams.staNoShortSlotCache[i].addr,
Jeff Johnson295189b2012-06-20 16:38:30 -07002220 peerMacAddr, sizeof(tSirMacAddr));
2221 psessionEntry->gLimNoShortSlotParams.staNoShortSlotCache[i].active = true;
2222 psessionEntry->gLimNoShortSlotParams.numNonShortSlotSta++;
2223 }else
Jeff Johnson295189b2012-06-20 16:38:30 -07002224 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05302225 vos_mem_copy( pMac->lim.gLimNoShortSlotParams.staNoShortSlotCache[i].addr,
Jeff Johnson295189b2012-06-20 16:38:30 -07002226 peerMacAddr, sizeof(tSirMacAddr));
2227 pMac->lim.gLimNoShortSlotParams.staNoShortSlotCache[i].active = true;
2228 pMac->lim.gLimNoShortSlotParams.numNonShortSlotSta++;
2229 }
2230 wlan_cfgGetInt(pMac, WNI_CFG_11G_SHORT_SLOT_TIME_ENABLED, &val);
2231
Jeff Johnsone7245742012-09-05 17:12:55 -07002232 /* 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
2233 * only long slot enabled, we need to change our beacon/pb rsp to broadcast short slot disabled
2234 */
Jeff Johnson295189b2012-06-20 16:38:30 -07002235 if ( (psessionEntry->limSystemRole == eLIM_AP_ROLE) &&
Jeff Johnsone7245742012-09-05 17:12:55 -07002236 (val && psessionEntry->gLimNoShortSlotParams.numNonShortSlotSta && psessionEntry->shortSlotTimeSupported))
Jeff Johnson295189b2012-06-20 16:38:30 -07002237 {
2238 // enable long slot time
2239 pBeaconParams->fShortSlotTime = false;
2240 pBeaconParams->paramChangeBitmap |= PARAM_SHORT_SLOT_TIME_CHANGED;
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002241 PELOG1(limLog(pMac, LOG1, FL("Disable short slot time. Enable long slot time."));)
Jeff Johnsone7245742012-09-05 17:12:55 -07002242 psessionEntry->shortSlotTimeSupported = false;
Jeff Johnson295189b2012-06-20 16:38:30 -07002243 }
2244 else if ( psessionEntry->limSystemRole != eLIM_AP_ROLE)
Jeff Johnson295189b2012-06-20 16:38:30 -07002245 {
Jeff Johnsone7245742012-09-05 17:12:55 -07002246 if (val && pMac->lim.gLimNoShortSlotParams.numNonShortSlotSta && psessionEntry->shortSlotTimeSupported)
Jeff Johnson295189b2012-06-20 16:38:30 -07002247 {
2248 // enable long slot time
2249 pBeaconParams->fShortSlotTime = false;
2250 pBeaconParams->paramChangeBitmap |= PARAM_SHORT_SLOT_TIME_CHANGED;
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002251 PELOG1(limLog(pMac, LOG1, FL("Disable short slot time. Enable long slot time."));)
Jeff Johnsone7245742012-09-05 17:12:55 -07002252 psessionEntry->shortSlotTimeSupported = false;
Jeff Johnson295189b2012-06-20 16:38:30 -07002253 }
2254 }
2255 }
2256 }
2257}
2258
Jeff Johnson295189b2012-06-20 16:38:30 -07002259
2260/** -------------------------------------------------------------
2261\fn limDecideStaProtectionOnAssoc
2262\brief Decide protection related settings on Sta while association.
2263\param tpAniSirGlobal pMac
2264\param tpSchBeaconStruct pBeaconStruct
2265\return None
2266 -------------------------------------------------------------*/
2267void
2268limDecideStaProtectionOnAssoc(tpAniSirGlobal pMac,
2269 tpSchBeaconStruct pBeaconStruct, tpPESession psessionEntry)
2270{
2271 tSirRFBand rfBand = SIR_BAND_UNKNOWN;
2272 tANI_U32 phyMode = WNI_CFG_PHY_MODE_NONE;
2273
2274 limGetRfBand(pMac, &rfBand, psessionEntry);
2275 limGetPhyMode(pMac, &phyMode, psessionEntry);
2276
2277 if(SIR_BAND_5_GHZ == rfBand)
2278 {
2279 if((eSIR_HT_OP_MODE_MIXED == pBeaconStruct->HTInfo.opMode) ||
2280 (eSIR_HT_OP_MODE_OVERLAP_LEGACY == pBeaconStruct->HTInfo.opMode))
2281 {
2282 if(pMac->lim.cfgProtection.fromlla)
2283 psessionEntry->beaconParams.llaCoexist = true;
2284 }
2285 else if(eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT == pBeaconStruct->HTInfo.opMode)
2286 {
2287 if(pMac->lim.cfgProtection.ht20)
2288 psessionEntry->beaconParams.ht20Coexist = true;
2289 }
2290
2291 }
2292 else if(SIR_BAND_2_4_GHZ == rfBand)
2293 {
2294 //spec 7.3.2.13
2295 //UseProtection will be set when nonERP STA is associated.
2296 //NonERPPresent bit will be set when:
2297 //--nonERP Sta is associated OR
2298 //--nonERP Sta exists in overlapping BSS
2299 //when useProtection is not set then protection from nonERP stations is optional.
2300
2301 //CFG protection from 11b is enabled and
2302 //11B device in the BSS
2303 /* TODO, This is not sessionized */
2304 if (phyMode != WNI_CFG_PHY_MODE_11B)
2305 {
2306 if (pMac->lim.cfgProtection.fromllb &&
2307 pBeaconStruct->erpPresent &&
2308 (pBeaconStruct->erpIEInfo.useProtection ||
2309 pBeaconStruct->erpIEInfo.nonErpPresent))
2310 {
2311 psessionEntry->beaconParams.llbCoexist = true;
2312 }
2313 //AP has no 11b station associated.
2314 else
2315 {
2316 psessionEntry->beaconParams.llbCoexist = false;
2317 }
2318 }
2319 //following code block is only for HT station.
Jeff Johnsone7245742012-09-05 17:12:55 -07002320 if((psessionEntry->htCapability) &&
Jeff Johnson295189b2012-06-20 16:38:30 -07002321 (pBeaconStruct->HTInfo.present))
2322 {
2323 tDot11fIEHTInfo htInfo = pBeaconStruct->HTInfo;
2324
2325 //Obss Non HT STA present mode
2326 psessionEntry->beaconParams.gHTObssMode = (tANI_U8)htInfo.obssNonHTStaPresent;
2327
2328
2329 //CFG protection from 11G is enabled and
2330 //our AP has at least one 11G station associated.
2331 if(pMac->lim.cfgProtection.fromllg &&
2332 ((eSIR_HT_OP_MODE_MIXED == htInfo.opMode) ||
2333 (eSIR_HT_OP_MODE_OVERLAP_LEGACY == htInfo.opMode))&&
2334 (!psessionEntry->beaconParams.llbCoexist))
2335 {
2336 if(pMac->lim.cfgProtection.fromllg)
2337 psessionEntry->beaconParams.llgCoexist = true;
2338 }
2339
2340 //AP has only HT stations associated and at least one station is HT 20
2341 //disable protection from any non-HT devices.
2342 //decision for disabling protection from 11b has already been taken above.
2343 if(eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT == htInfo.opMode)
2344 {
2345 //Disable protection from 11G station.
2346 psessionEntry->beaconParams.llgCoexist = false;
2347 //CFG protection from HT 20 is enabled.
2348 if(pMac->lim.cfgProtection.ht20)
2349 psessionEntry->beaconParams.ht20Coexist = true;
2350 }
2351 //Disable protection from non-HT and HT20 devices.
2352 //decision for disabling protection from 11b has already been taken above.
2353 if(eSIR_HT_OP_MODE_PURE == htInfo.opMode)
2354 {
2355 psessionEntry->beaconParams.llgCoexist = false;
2356 psessionEntry->beaconParams.ht20Coexist = false;
2357 }
2358
2359 }
2360 }
2361
2362 //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 -07002363 if((psessionEntry->htCapability) &&
Jeff Johnson295189b2012-06-20 16:38:30 -07002364 (pBeaconStruct->HTInfo.present))
2365 {
2366 tDot11fIEHTInfo htInfo = pBeaconStruct->HTInfo;
2367 psessionEntry->beaconParams.fRIFSMode =
2368 ( tANI_U8 ) htInfo.rifsMode;
2369 psessionEntry->beaconParams.llnNonGFCoexist =
2370 ( tANI_U8 )htInfo.nonGFDevicesPresent;
2371 psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport =
2372 ( tANI_U8 )htInfo.lsigTXOPProtectionFullSupport;
2373 }
2374}
2375
2376
2377/** -------------------------------------------------------------
2378\fn limDecideStaProtection
2379\brief Decides protection related settings on Sta while processing beacon.
2380\param tpAniSirGlobal pMac
2381\param tpUpdateBeaconParams pBeaconParams
2382\return None
2383 -------------------------------------------------------------*/
2384void
2385limDecideStaProtection(tpAniSirGlobal pMac,
2386 tpSchBeaconStruct pBeaconStruct, tpUpdateBeaconParams pBeaconParams, tpPESession psessionEntry)
2387{
2388
2389 tSirRFBand rfBand = SIR_BAND_UNKNOWN;
2390 tANI_U32 phyMode = WNI_CFG_PHY_MODE_NONE;
2391
2392 limGetRfBand(pMac, &rfBand, psessionEntry);
2393 limGetPhyMode(pMac, &phyMode, psessionEntry);
2394
2395 if(SIR_BAND_5_GHZ == rfBand)
2396 {
2397 //we are HT capable.
Jeff Johnsone7245742012-09-05 17:12:55 -07002398 if((true == psessionEntry->htCapability) &&
Jeff Johnson295189b2012-06-20 16:38:30 -07002399 (pBeaconStruct->HTInfo.present))
2400 {
2401 //we are HT capable, AP's HT OPMode is mixed / overlap legacy ==> need protection from 11A.
2402 if((eSIR_HT_OP_MODE_MIXED == pBeaconStruct->HTInfo.opMode) ||
2403 (eSIR_HT_OP_MODE_OVERLAP_LEGACY == pBeaconStruct->HTInfo.opMode))
2404 {
2405 limEnable11aProtection(pMac, true, false, pBeaconParams,psessionEntry);
2406 }
2407 //we are HT capable, AP's HT OPMode is HT20 ==> disable protection from 11A if enabled. enabled
2408 //protection from HT20 if needed.
2409 else if(eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT== pBeaconStruct->HTInfo.opMode)
2410 {
2411 limEnable11aProtection(pMac, false, false, pBeaconParams,psessionEntry);
2412 limEnableHT20Protection(pMac, true, false, pBeaconParams,psessionEntry);
2413 }
2414 else if(eSIR_HT_OP_MODE_PURE == pBeaconStruct->HTInfo.opMode)
2415 {
2416 limEnable11aProtection(pMac, false, false, pBeaconParams,psessionEntry);
2417 limEnableHT20Protection(pMac, false, false, pBeaconParams,psessionEntry);
2418 }
2419 }
2420 }
2421 else if(SIR_BAND_2_4_GHZ == rfBand)
2422 {
2423 /* spec 7.3.2.13
2424 * UseProtection will be set when nonERP STA is associated.
2425 * NonERPPresent bit will be set when:
2426 * --nonERP Sta is associated OR
2427 * --nonERP Sta exists in overlapping BSS
2428 * when useProtection is not set then protection from nonERP stations is optional.
2429 */
2430
2431 if (phyMode != WNI_CFG_PHY_MODE_11B)
2432 {
2433 if (pBeaconStruct->erpPresent &&
2434 (pBeaconStruct->erpIEInfo.useProtection ||
2435 pBeaconStruct->erpIEInfo.nonErpPresent))
2436 {
2437 limEnable11gProtection(pMac, true, false, pBeaconParams, psessionEntry);
2438 }
2439 //AP has no 11b station associated.
2440 else
2441 {
2442 //disable protection from 11b station
2443 limEnable11gProtection(pMac, false, false, pBeaconParams, psessionEntry);
2444 }
2445 }
2446
2447 //following code block is only for HT station.
Jeff Johnsone7245742012-09-05 17:12:55 -07002448 if((psessionEntry->htCapability) &&
Jeff Johnson295189b2012-06-20 16:38:30 -07002449 (pBeaconStruct->HTInfo.present))
2450 {
2451
2452 tDot11fIEHTInfo htInfo = pBeaconStruct->HTInfo;
2453 //AP has at least one 11G station associated.
2454 if(((eSIR_HT_OP_MODE_MIXED == htInfo.opMode) ||
2455 (eSIR_HT_OP_MODE_OVERLAP_LEGACY == htInfo.opMode))&&
2456 (!psessionEntry->beaconParams.llbCoexist))
2457 {
2458 limEnableHtProtectionFrom11g(pMac, true, false, pBeaconParams,psessionEntry);
2459
2460 }
2461
2462 //no HT operating mode change ==> no change in protection settings except for MIXED_MODE/Legacy Mode.
2463 //in Mixed mode/legacy Mode even if there is no change in HT operating mode, there might be change in 11bCoexist
2464 //or 11gCoexist. that is why this check is being done after mixed/legacy mode check.
2465 if ( pMac->lim.gHTOperMode != ( tSirMacHTOperatingMode )htInfo.opMode )
2466 {
2467 pMac->lim.gHTOperMode = ( tSirMacHTOperatingMode )htInfo.opMode;
2468
2469 //AP has only HT stations associated and at least one station is HT 20
2470 //disable protection from any non-HT devices.
2471 //decision for disabling protection from 11b has already been taken above.
2472 if(eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT == htInfo.opMode)
2473 {
2474 //Disable protection from 11G station.
2475 limEnableHtProtectionFrom11g(pMac, false, false, pBeaconParams,psessionEntry);
2476
2477 limEnableHT20Protection(pMac, true, false, pBeaconParams,psessionEntry);
2478 }
2479 //Disable protection from non-HT and HT20 devices.
2480 //decision for disabling protection from 11b has already been taken above.
2481 else if(eSIR_HT_OP_MODE_PURE == htInfo.opMode)
2482 {
2483 limEnableHtProtectionFrom11g(pMac, false, false, pBeaconParams,psessionEntry);
2484 limEnableHT20Protection(pMac, false, false, pBeaconParams,psessionEntry);
2485
2486 }
2487 }
2488 }
2489 }
2490
2491 //following code block is only for HT station. ( 2.4 GHZ as well as 5 GHZ)
Jeff Johnsone7245742012-09-05 17:12:55 -07002492 if((psessionEntry->htCapability) &&
Jeff Johnson295189b2012-06-20 16:38:30 -07002493 (pBeaconStruct->HTInfo.present))
2494 {
2495 tDot11fIEHTInfo htInfo = pBeaconStruct->HTInfo;
2496 //Check for changes in protection related factors other than HT operating mode.
2497 //Check for changes in RIFS mode, nonGFDevicesPresent, lsigTXOPProtectionFullSupport.
2498 if ( psessionEntry->beaconParams.fRIFSMode !=
2499 ( tANI_U8 ) htInfo.rifsMode )
2500 {
2501 pBeaconParams->fRIFSMode =
2502 psessionEntry->beaconParams.fRIFSMode =
2503 ( tANI_U8 ) htInfo.rifsMode;
2504 pBeaconParams->paramChangeBitmap |= PARAM_RIFS_MODE_CHANGED;
2505 }
2506
2507 if ( psessionEntry->beaconParams.llnNonGFCoexist !=
2508 htInfo.nonGFDevicesPresent )
2509 {
2510 pBeaconParams->llnNonGFCoexist =
2511 psessionEntry->beaconParams.llnNonGFCoexist =
2512 ( tANI_U8 )htInfo.nonGFDevicesPresent;
2513 pBeaconParams->paramChangeBitmap |=
2514 PARAM_NON_GF_DEVICES_PRESENT_CHANGED;
2515 }
2516
2517 if ( psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport !=
2518 ( tANI_U8 )htInfo.lsigTXOPProtectionFullSupport )
2519 {
2520 pBeaconParams->fLsigTXOPProtectionFullSupport =
2521 psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport =
2522 ( tANI_U8 )htInfo.lsigTXOPProtectionFullSupport;
2523 pBeaconParams->paramChangeBitmap |=
2524 PARAM_LSIG_TXOP_FULL_SUPPORT_CHANGED;
2525 }
2526
2527 // For Station just update the global lim variable, no need to send message to HAL
2528 // Station already taking care of HT OPR Mode=01, meaning AP is seeing legacy
2529 //stations in overlapping BSS.
2530 if ( psessionEntry->beaconParams.gHTObssMode != ( tANI_U8 )htInfo.obssNonHTStaPresent )
2531 psessionEntry->beaconParams.gHTObssMode = ( tANI_U8 )htInfo.obssNonHTStaPresent ;
2532
2533 }
2534}
2535
2536
2537/**
2538 * limProcessChannelSwitchTimeout()
2539 *
2540 *FUNCTION:
2541 * This function is invoked when Channel Switch Timer expires at
2542 * the STA. Now, STA must stop traffic, and then change/disable
2543 * primary or secondary channel.
2544 *
2545 *
2546 *NOTE:
2547 * @param pMac - Pointer to Global MAC structure
2548 * @return None
2549 */
2550void limProcessChannelSwitchTimeout(tpAniSirGlobal pMac)
2551{
2552 tpPESession psessionEntry = NULL;
Jeff Johnsone7245742012-09-05 17:12:55 -07002553 tANI_U8 channel; // This is received and stored from channelSwitch Action frame
Jeff Johnson295189b2012-06-20 16:38:30 -07002554
2555 if((psessionEntry = peFindSessionBySessionId(pMac, pMac->lim.limTimers.gLimChannelSwitchTimer.sessionId))== NULL)
2556 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002557 limLog(pMac, LOGP,FL("Session Does not exist for given sessionID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002558 return;
2559 }
2560
2561 if (psessionEntry->limSystemRole != eLIM_STA_ROLE)
2562 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002563 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 -07002564 return;
2565 }
Jeff Johnsone7245742012-09-05 17:12:55 -07002566 channel = psessionEntry->gLimChannelSwitch.primaryChannel;
Jeff Johnson295189b2012-06-20 16:38:30 -07002567 /*
2568 * This potentially can create issues if the function tries to set
2569 * channel while device is in power-save, hence putting an extra check
2570 * to verify if the device is in power-save or not
2571 */
2572 if(!limIsSystemInActiveState(pMac))
2573 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002574 PELOGW(limLog(pMac, LOGW, FL("Device is not in active state, cannot switch channel"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002575 return;
2576 }
2577
2578 // Restore Channel Switch parameters to default
Jeff Johnsone7245742012-09-05 17:12:55 -07002579 psessionEntry->gLimChannelSwitch.switchTimeoutValue = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07002580
2581 /* Channel-switch timeout has occurred. reset the state */
Jeff Johnsone7245742012-09-05 17:12:55 -07002582 psessionEntry->gLimSpecMgmt.dot11hChanSwState = eLIM_11H_CHANSW_END;
Jeff Johnson295189b2012-06-20 16:38:30 -07002583
2584 /* Check if the AP is switching to a channel that we support.
2585 * Else, just don't bother to switch. Indicate HDD to look for a
2586 * better AP to associate
2587 */
2588 if(!limIsChannelValidForChannelSwitch(pMac, channel))
2589 {
2590 /* We need to restore pre-channelSwitch state on the STA */
2591 if(limRestorePreChannelSwitchState(pMac, psessionEntry) != eSIR_SUCCESS)
2592 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002593 limLog(pMac, LOGP, FL("Could not restore pre-channelSwitch (11h) state, resetting the system"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002594 return;
2595 }
2596
2597 /* If the channel-list that AP is asking us to switch is invalid,
2598 * then we cannot switch the channel. Just disassociate from AP.
2599 * We will find a better AP !!!
2600 */
2601 limTearDownLinkWithAp(pMac,
2602 pMac->lim.limTimers.gLimChannelSwitchTimer.sessionId,
2603 eSIR_MAC_UNSPEC_FAILURE_REASON);
2604 return;
2605 }
Kiran Kumar Lokereb8bb6842013-08-12 16:40:24 -07002606 limCovertChannelScanType(pMac, psessionEntry->currentOperChannel, false);
2607 pMac->lim.dfschannelList.timeStamp[psessionEntry->currentOperChannel] = 0;
Jeff Johnsone7245742012-09-05 17:12:55 -07002608 switch(psessionEntry->gLimChannelSwitch.state)
Jeff Johnson295189b2012-06-20 16:38:30 -07002609 {
2610 case eLIM_CHANNEL_SWITCH_PRIMARY_ONLY:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002611 PELOGW(limLog(pMac, LOGW, FL("CHANNEL_SWITCH_PRIMARY_ONLY "));)
Jeff Johnsone7245742012-09-05 17:12:55 -07002612 limSwitchPrimaryChannel(pMac, psessionEntry->gLimChannelSwitch.primaryChannel,psessionEntry);
2613 psessionEntry->gLimChannelSwitch.state = eLIM_CHANNEL_SWITCH_IDLE;
Jeff Johnson295189b2012-06-20 16:38:30 -07002614 break;
2615
2616 case eLIM_CHANNEL_SWITCH_SECONDARY_ONLY:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002617 PELOGW(limLog(pMac, LOGW, FL("CHANNEL_SWITCH_SECONDARY_ONLY "));)
Jeff Johnsone7245742012-09-05 17:12:55 -07002618 limSwitchPrimarySecondaryChannel(pMac, psessionEntry,
Jeff Johnson295189b2012-06-20 16:38:30 -07002619 psessionEntry->currentOperChannel,
Jeff Johnsone7245742012-09-05 17:12:55 -07002620 psessionEntry->gLimChannelSwitch.secondarySubBand);
2621 psessionEntry->gLimChannelSwitch.state = eLIM_CHANNEL_SWITCH_IDLE;
Jeff Johnson295189b2012-06-20 16:38:30 -07002622 break;
2623
2624 case eLIM_CHANNEL_SWITCH_PRIMARY_AND_SECONDARY:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002625 PELOGW(limLog(pMac, LOGW, FL("CHANNEL_SWITCH_PRIMARY_AND_SECONDARY"));)
Jeff Johnsone7245742012-09-05 17:12:55 -07002626 limSwitchPrimarySecondaryChannel(pMac, psessionEntry,
2627 psessionEntry->gLimChannelSwitch.primaryChannel,
2628 psessionEntry->gLimChannelSwitch.secondarySubBand);
2629 psessionEntry->gLimChannelSwitch.state = eLIM_CHANNEL_SWITCH_IDLE;
Jeff Johnson295189b2012-06-20 16:38:30 -07002630 break;
2631
2632 case eLIM_CHANNEL_SWITCH_IDLE:
2633 default:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002634 PELOGE(limLog(pMac, LOGE, FL("incorrect state "));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002635 if(limRestorePreChannelSwitchState(pMac, psessionEntry) != eSIR_SUCCESS)
2636 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002637 limLog(pMac, LOGP, FL("Could not restore pre-channelSwitch (11h) state, resetting the system"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002638 }
2639 return; /* Please note, this is 'return' and not 'break' */
2640 }
Jeff Johnsone7245742012-09-05 17:12:55 -07002641}
Jeff Johnson295189b2012-06-20 16:38:30 -07002642
2643/**
2644 * limUpdateChannelSwitch()
2645 *
2646 *FUNCTION:
2647 * This function is invoked whenever Station receives
2648 * either 802.11h channel switch IE or airgo proprietary
2649 * channel switch IE.
2650 *
2651 *NOTE:
2652 * @param pMac - Pointer to Global MAC structure
2653 * @return tpSirProbeRespBeacon - Pointer to Beacon/Probe Rsp
2654 * @param psessionentry
2655 */
2656void
2657limUpdateChannelSwitch(struct sAniSirGlobal *pMac, tpSirProbeRespBeacon pBeacon, tpPESession psessionEntry)
2658{
2659
2660 tANI_U16 beaconPeriod;
Jeff Johnson295189b2012-06-20 16:38:30 -07002661 tChannelSwitchPropIEStruct *pPropChnlSwitch;
2662 tDot11fIEChanSwitchAnn *pChnlSwitch;
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -07002663#ifdef WLAN_FEATURE_11AC
2664 tDot11fIEWiderBWChanSwitchAnn *pWiderChnlSwitch;
2665#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002666
Jeff Johnsone7245742012-09-05 17:12:55 -07002667 beaconPeriod = psessionEntry->beaconParams.beaconInterval;
Jeff Johnson295189b2012-06-20 16:38:30 -07002668
2669 /* STA either received proprietary channel switch IE or 802.11h
2670 * standard channel switch IE.
2671 */
2672 if (pBeacon->propIEinfo.propChannelSwitchPresent)
2673 {
2674 pPropChnlSwitch = &(pBeacon->propIEinfo.channelSwitch);
2675
2676 /* Add logic to determine which change this is: */
2677 /* primary, secondary, both. For now assume both. */
Jeff Johnsone7245742012-09-05 17:12:55 -07002678 psessionEntry->gLimChannelSwitch.state = eLIM_CHANNEL_SWITCH_PRIMARY_AND_SECONDARY;
2679 psessionEntry->gLimChannelSwitch.primaryChannel = pPropChnlSwitch->primaryChannel;
2680 psessionEntry->gLimChannelSwitch.secondarySubBand = (ePhyChanBondState)pPropChnlSwitch->subBand;
2681 psessionEntry->gLimChannelSwitch.switchCount = pPropChnlSwitch->channelSwitchCount;
2682 psessionEntry->gLimChannelSwitch.switchTimeoutValue =
Jeff Johnson295189b2012-06-20 16:38:30 -07002683 SYS_MS_TO_TICKS(beaconPeriod)* (pPropChnlSwitch->channelSwitchCount);
Jeff Johnsone7245742012-09-05 17:12:55 -07002684 psessionEntry->gLimChannelSwitch.switchMode = pPropChnlSwitch->mode;
Jeff Johnson295189b2012-06-20 16:38:30 -07002685 }
2686 else
2687 {
2688 pChnlSwitch = &(pBeacon->channelSwitchIE);
Jeff Johnsone7245742012-09-05 17:12:55 -07002689 psessionEntry->gLimChannelSwitch.primaryChannel = pChnlSwitch->newChannel;
2690 psessionEntry->gLimChannelSwitch.switchCount = pChnlSwitch->switchCount;
2691 psessionEntry->gLimChannelSwitch.switchTimeoutValue =
Jeff Johnson295189b2012-06-20 16:38:30 -07002692 SYS_MS_TO_TICKS(beaconPeriod)* (pChnlSwitch->switchCount);
Jeff Johnsone7245742012-09-05 17:12:55 -07002693 psessionEntry->gLimChannelSwitch.switchMode = pChnlSwitch->switchMode;
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -07002694#ifdef WLAN_FEATURE_11AC
2695 pWiderChnlSwitch = &(pBeacon->WiderBWChanSwitchAnn);
2696 if(pBeacon->WiderBWChanSwitchAnnPresent)
2697 {
2698 psessionEntry->gLimWiderBWChannelSwitch.newChanWidth = pWiderChnlSwitch->newChanWidth;
2699 psessionEntry->gLimWiderBWChannelSwitch.newCenterChanFreq0 = pWiderChnlSwitch->newCenterChanFreq0;
2700 psessionEntry->gLimWiderBWChannelSwitch.newCenterChanFreq1 = pWiderChnlSwitch->newCenterChanFreq1;
2701 }
2702#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002703
2704 /* Only primary channel switch element is present */
Jeff Johnsone7245742012-09-05 17:12:55 -07002705 psessionEntry->gLimChannelSwitch.state = eLIM_CHANNEL_SWITCH_PRIMARY_ONLY;
2706 psessionEntry->gLimChannelSwitch.secondarySubBand = PHY_SINGLE_CHANNEL_CENTERED;
Jeff Johnson295189b2012-06-20 16:38:30 -07002707
2708 /* Do not bother to look and operate on extended channel switch element
2709 * if our own channel-bonding state is not enabled
2710 */
Jeff Johnsone7245742012-09-05 17:12:55 -07002711 if (psessionEntry->htSupportedChannelWidthSet)
Jeff Johnson295189b2012-06-20 16:38:30 -07002712 {
2713 if (pBeacon->extChannelSwitchPresent)
2714 {
Jeff Johnsone7245742012-09-05 17:12:55 -07002715 if ((pBeacon->extChannelSwitchIE.secondaryChannelOffset == PHY_DOUBLE_CHANNEL_LOW_PRIMARY) ||
2716 (pBeacon->extChannelSwitchIE.secondaryChannelOffset == PHY_DOUBLE_CHANNEL_HIGH_PRIMARY))
Jeff Johnson295189b2012-06-20 16:38:30 -07002717 {
Jeff Johnsone7245742012-09-05 17:12:55 -07002718 psessionEntry->gLimChannelSwitch.state = eLIM_CHANNEL_SWITCH_PRIMARY_AND_SECONDARY;
2719 psessionEntry->gLimChannelSwitch.secondarySubBand = pBeacon->extChannelSwitchIE.secondaryChannelOffset;
Jeff Johnson295189b2012-06-20 16:38:30 -07002720 }
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -07002721#ifdef WLAN_FEATURE_11AC
2722 if(psessionEntry->vhtCapability && pBeacon->WiderBWChanSwitchAnnPresent)
2723 {
2724 if (pWiderChnlSwitch->newChanWidth == WNI_CFG_VHT_CHANNEL_WIDTH_80MHZ)
2725 {
2726 if(pBeacon->extChannelSwitchPresent)
2727 {
2728 if ((pBeacon->extChannelSwitchIE.secondaryChannelOffset == PHY_DOUBLE_CHANNEL_LOW_PRIMARY) ||
2729 (pBeacon->extChannelSwitchIE.secondaryChannelOffset == PHY_DOUBLE_CHANNEL_HIGH_PRIMARY))
2730 {
2731 psessionEntry->gLimChannelSwitch.state = eLIM_CHANNEL_SWITCH_PRIMARY_AND_SECONDARY;
2732 psessionEntry->gLimChannelSwitch.secondarySubBand = limGet11ACPhyCBState(pMac,
2733 psessionEntry->gLimChannelSwitch.primaryChannel,
2734 pBeacon->extChannelSwitchIE.secondaryChannelOffset,
2735 pWiderChnlSwitch->newCenterChanFreq0,
2736 psessionEntry);
2737 }
2738 }
2739 }
2740 }
2741#endif
Jeff Johnsone7245742012-09-05 17:12:55 -07002742 }
2743 }
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -07002744 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002745 if (eSIR_SUCCESS != limStartChannelSwitch(pMac, psessionEntry))
2746 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002747 PELOGW(limLog(pMac, LOGW, FL("Could not start Channel Switch"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002748 }
2749
2750 limLog(pMac, LOGW,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002751 FL("session %d primary chl %d, subband %d, count %d (%d ticks) "),
Jeff Johnsone7245742012-09-05 17:12:55 -07002752 psessionEntry->peSessionId,
2753 psessionEntry->gLimChannelSwitch.primaryChannel,
2754 psessionEntry->gLimChannelSwitch.secondarySubBand,
2755 psessionEntry->gLimChannelSwitch.switchCount,
2756 psessionEntry->gLimChannelSwitch.switchTimeoutValue);
Jeff Johnson295189b2012-06-20 16:38:30 -07002757 return;
2758}
2759
2760/**
2761 * limCancelDot11hChannelSwitch
2762 *
2763 *FUNCTION:
2764 * This function is called when STA does not send updated channel-swith IE
2765 * after indicating channel-switch start. This will cancel the channel-swith
2766 * timer which is already running.
2767 *
2768 *LOGIC:
2769 *
2770 *ASSUMPTIONS:
2771 *
2772 *NOTE:
2773 *
2774 * @param pMac - Pointer to Global MAC structure
2775 *
2776 * @return None
2777 */
2778void limCancelDot11hChannelSwitch(tpAniSirGlobal pMac, tpPESession psessionEntry)
2779{
Jeff Johnson295189b2012-06-20 16:38:30 -07002780 if (psessionEntry->limSystemRole != eLIM_STA_ROLE)
2781 return;
2782
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002783 PELOGW(limLog(pMac, LOGW, FL("Received a beacon without channel switch IE"));)
Jeff Johnsone7245742012-09-05 17:12:55 -07002784 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_DEACTIVATE, psessionEntry->peSessionId, eLIM_CHANNEL_SWITCH_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -07002785
2786 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimChannelSwitchTimer) != eSIR_SUCCESS)
2787 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002788 PELOGE(limLog(pMac, LOGE, FL("tx_timer_deactivate failed!"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002789 }
2790
2791 /* We need to restore pre-channelSwitch state on the STA */
2792 if (limRestorePreChannelSwitchState(pMac, psessionEntry) != eSIR_SUCCESS)
2793 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002794 PELOGE(limLog(pMac, LOGE, FL("LIM: Could not restore pre-channelSwitch (11h) state, resetting the system"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002795
2796 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002797}
2798
2799/**----------------------------------------------
2800\fn limCancelDot11hQuiet
2801\brief Cancel the quieting on Station if latest
2802 beacon doesn't contain quiet IE in it.
2803
2804\param pMac
2805\return NONE
2806-----------------------------------------------*/
2807void limCancelDot11hQuiet(tpAniSirGlobal pMac, tpPESession psessionEntry)
2808{
Jeff Johnson295189b2012-06-20 16:38:30 -07002809 if (psessionEntry->limSystemRole != eLIM_STA_ROLE)
2810 return;
2811
Jeff Johnsone7245742012-09-05 17:12:55 -07002812 if (psessionEntry->gLimSpecMgmt.quietState == eLIM_QUIET_BEGIN)
Jeff Johnson295189b2012-06-20 16:38:30 -07002813 {
Jeff Johnsone7245742012-09-05 17:12:55 -07002814 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_DEACTIVATE, psessionEntry->peSessionId, eLIM_QUIET_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -07002815 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimQuietTimer) != TX_SUCCESS)
2816 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002817 PELOGE(limLog(pMac, LOGE, FL("tx_timer_deactivate failed"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002818 }
2819 }
Jeff Johnsone7245742012-09-05 17:12:55 -07002820 else if (psessionEntry->gLimSpecMgmt.quietState == eLIM_QUIET_RUNNING)
Jeff Johnson295189b2012-06-20 16:38:30 -07002821 {
Jeff Johnsone7245742012-09-05 17:12:55 -07002822 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_DEACTIVATE, psessionEntry->peSessionId, eLIM_QUIET_BSS_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -07002823 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimQuietBssTimer) != TX_SUCCESS)
2824 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002825 PELOGE(limLog(pMac, LOGE, FL("tx_timer_deactivate failed"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002826 }
2827 /**
2828 * If the channel switch is already running in silent mode, dont resume the
2829 * transmission. Channel switch timer when timeout, transmission will be resumed.
2830 */
Jeff Johnsone7245742012-09-05 17:12:55 -07002831 if(!((psessionEntry->gLimSpecMgmt.dot11hChanSwState == eLIM_11H_CHANSW_RUNNING) &&
2832 (psessionEntry->gLimChannelSwitch.switchMode == eSIR_CHANSW_MODE_SILENT)))
Jeff Johnson295189b2012-06-20 16:38:30 -07002833 {
2834 limFrameTransmissionControl(pMac, eLIM_TX_ALL, eLIM_RESUME_TX);
Jeff Johnsone7245742012-09-05 17:12:55 -07002835 limRestorePreQuietState(pMac, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07002836 }
2837 }
Jeff Johnsone7245742012-09-05 17:12:55 -07002838 psessionEntry->gLimSpecMgmt.quietState = eLIM_QUIET_INIT;
Jeff Johnson295189b2012-06-20 16:38:30 -07002839}
2840
2841/**
2842 * limProcessQuietTimeout
2843 *
2844 * FUNCTION:
2845 * This function is active only on the STA.
2846 * Handles SIR_LIM_QUIET_TIMEOUT
2847 *
2848 * LOGIC:
2849 * This timeout can occur under only one circumstance:
2850 *
2851 * 1) When gLimQuietState = eLIM_QUIET_BEGIN
2852 * This indicates that the timeout "interval" has
2853 * expired. This is a trigger for the STA to now
2854 * shut-off Tx/Rx for the specified gLimQuietDuration
2855 * -> The TIMER object gLimQuietBssTimer is
2856 * activated
2857 * -> With timeout = gLimQuietDuration
2858 * -> gLimQuietState is set to eLIM_QUIET_RUNNING
2859 *
2860 * ASSUMPTIONS:
2861 * Using two TIMER objects -
2862 * gLimQuietTimer & gLimQuietBssTimer
2863 *
2864 * NOTE:
2865 *
2866 * @param pMac - Pointer to Global MAC structure
2867 *
2868 * @return None
2869 */
2870void limProcessQuietTimeout(tpAniSirGlobal pMac)
2871{
Jeff Johnson295189b2012-06-20 16:38:30 -07002872 //fetch the sessionEntry based on the sessionId
2873 //priority - MEDIUM
Jeff Johnsone7245742012-09-05 17:12:55 -07002874 tpPESession psessionEntry;
Jeff Johnson295189b2012-06-20 16:38:30 -07002875
Jeff Johnsone7245742012-09-05 17:12:55 -07002876 if((psessionEntry = peFindSessionBySessionId(pMac, pMac->lim.limTimers.gLimQuietTimer.sessionId))== NULL)
Jeff Johnson295189b2012-06-20 16:38:30 -07002877 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002878 limLog(pMac, LOGE,FL("Session Does not exist for given sessionID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002879 return;
2880 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002881
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002882 PELOG1(limLog(pMac, LOG1, FL("quietState = %d"), psessionEntry->gLimSpecMgmt.quietState);)
Jeff Johnsone7245742012-09-05 17:12:55 -07002883 switch( psessionEntry->gLimSpecMgmt.quietState )
Jeff Johnson295189b2012-06-20 16:38:30 -07002884 {
2885 case eLIM_QUIET_BEGIN:
2886 // Time to Stop data traffic for quietDuration
Jeff Johnsone7245742012-09-05 17:12:55 -07002887 //limDeactivateAndChangeTimer(pMac, eLIM_QUIET_BSS_TIMER);
2888 if (TX_SUCCESS !=
2889 tx_timer_deactivate(&pMac->lim.limTimers.gLimQuietBssTimer))
2890 {
2891 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002892 FL("Unable to de-activate gLimQuietBssTimer! Will attempt to activate anyway..."));
Jeff Johnsone7245742012-09-05 17:12:55 -07002893 }
2894
2895 // gLimQuietDuration appears to be in units of ticks
2896 // Use it as is
2897 if (TX_SUCCESS !=
2898 tx_timer_change( &pMac->lim.limTimers.gLimQuietBssTimer,
2899 psessionEntry->gLimSpecMgmt.quietDuration,
2900 0))
2901 {
2902 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002903 FL("Unable to change gLimQuietBssTimer! Will still attempt to activate anyway..."));
Jeff Johnsone7245742012-09-05 17:12:55 -07002904 }
Leela V Kiran Kumar Reddy Chiralac3b9d382013-01-31 20:49:53 -08002905 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, pMac->lim.limTimers.gLimQuietTimer.sessionId, eLIM_QUIET_BSS_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -07002906#ifdef GEN6_TODO
2907 /* revisit this piece of code to assign the appropriate sessionId below
2908 * priority - HIGH
2909 */
2910 pMac->lim.limTimers.gLimQuietBssTimer.sessionId = sessionId;
2911#endif
2912 if( TX_SUCCESS !=
2913 tx_timer_activate( &pMac->lim.limTimers.gLimQuietBssTimer ))
2914 {
2915 limLog( pMac, LOGW,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002916 FL("Unable to activate gLimQuietBssTimer! The STA will be unable to honor Quiet BSS..."));
Jeff Johnson295189b2012-06-20 16:38:30 -07002917 }
2918 else
2919 {
2920 // Transition to eLIM_QUIET_RUNNING
Jeff Johnsone7245742012-09-05 17:12:55 -07002921 psessionEntry->gLimSpecMgmt.quietState = eLIM_QUIET_RUNNING;
Jeff Johnson295189b2012-06-20 16:38:30 -07002922
2923 /* If we have sta bk scan triggered and trigger bk scan actually started successfully, */
2924 /* print message, otherwise, stop data traffic and stay quiet */
2925 if( pMac->lim.gLimTriggerBackgroundScanDuringQuietBss &&
2926 (eSIR_TRUE == (glimTriggerBackgroundScanDuringQuietBss_Status = limTriggerBackgroundScanDuringQuietBss( pMac ))) )
2927 {
2928 limLog( pMac, LOG2,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002929 FL("Attempting to trigger a background scan..."));
Jeff Johnson295189b2012-06-20 16:38:30 -07002930 }
2931 else
2932 {
2933 // Shut-off Tx/Rx for gLimSpecMgmt.quietDuration
2934 /* freeze the transmission */
2935 limFrameTransmissionControl(pMac, eLIM_TX_ALL, eLIM_STOP_TX);
2936
2937 limLog( pMac, LOG2,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002938 FL("Quiet BSS: STA shutting down for %d ticks"),
Jeff Johnsone7245742012-09-05 17:12:55 -07002939 psessionEntry->gLimSpecMgmt.quietDuration );
Jeff Johnson295189b2012-06-20 16:38:30 -07002940 }
2941 }
2942 break;
2943
2944 case eLIM_QUIET_RUNNING:
2945 case eLIM_QUIET_INIT:
2946 case eLIM_QUIET_END:
2947 default:
2948 //
2949 // As of now, nothing to be done
2950 //
2951 break;
2952 }
2953}
2954
2955/**
2956 * limProcessQuietBssTimeout
2957 *
2958 * FUNCTION:
2959 * This function is active on the AP and STA.
2960 * Handles SIR_LIM_QUIET_BSS_TIMEOUT
2961 *
2962 * LOGIC:
2963 * On the AP -
2964 * When the SIR_LIM_QUIET_BSS_TIMEOUT is triggered, it is
2965 * an indication for the AP to START sending out the
2966 * Quiet BSS IE.
2967 * If 802.11H is enabled, the Quiet BSS IE is sent as per
2968 * the 11H spec
2969 * If 802.11H is not enabled, the Quiet BSS IE is sent as
2970 * a Proprietary IE. This will be understood by all the
2971 * TITAN STA's
2972 * Transitioning gLimQuietState to eLIM_QUIET_BEGIN will
2973 * initiate the SCH to include the Quiet BSS IE in all
2974 * its subsequent Beacons/PR's.
2975 * The Quiet BSS IE will be included in all the Beacons
2976 * & PR's until the next DTIM period
2977 *
2978 * On the STA -
2979 * When gLimQuietState = eLIM_QUIET_RUNNING
2980 * This indicates that the STA was successfully shut-off
2981 * for the specified gLimQuietDuration. This is a trigger
2982 * for the STA to now resume data traffic.
2983 * -> gLimQuietState is set to eLIM_QUIET_INIT
2984 *
2985 * ASSUMPTIONS:
2986 *
2987 * NOTE:
2988 *
2989 * @param pMac - Pointer to Global MAC structure
2990 *
2991 * @return None
2992 */
2993void limProcessQuietBssTimeout( tpAniSirGlobal pMac )
2994{
Jeff Johnsone7245742012-09-05 17:12:55 -07002995 tpPESession psessionEntry;
Jeff Johnson295189b2012-06-20 16:38:30 -07002996
Jeff Johnsone7245742012-09-05 17:12:55 -07002997 if((psessionEntry = peFindSessionBySessionId(pMac, pMac->lim.limTimers.gLimQuietBssTimer.sessionId))== NULL)
Jeff Johnson295189b2012-06-20 16:38:30 -07002998 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002999 limLog(pMac, LOGP,FL("Session Does not exist for given sessionID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003000 return;
3001 }
3002
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003003 PELOG1(limLog(pMac, LOG1, FL("quietState = %d"), psessionEntry->gLimSpecMgmt.quietState);)
Jeff Johnsone7245742012-09-05 17:12:55 -07003004 if (eLIM_AP_ROLE == psessionEntry->limSystemRole)
Jeff Johnson295189b2012-06-20 16:38:30 -07003005 {
Jeff Johnson295189b2012-06-20 16:38:30 -07003006 }
3007 else
3008 {
3009 // eLIM_STA_ROLE
Jeff Johnsone7245742012-09-05 17:12:55 -07003010 switch( psessionEntry->gLimSpecMgmt.quietState )
Jeff Johnson295189b2012-06-20 16:38:30 -07003011 {
3012 case eLIM_QUIET_RUNNING:
3013 // Transition to eLIM_QUIET_INIT
Jeff Johnsone7245742012-09-05 17:12:55 -07003014 psessionEntry->gLimSpecMgmt.quietState = eLIM_QUIET_INIT;
Jeff Johnson295189b2012-06-20 16:38:30 -07003015
3016 if( !pMac->lim.gLimTriggerBackgroundScanDuringQuietBss || (glimTriggerBackgroundScanDuringQuietBss_Status == eSIR_FALSE) )
3017 {
3018 // Resume data traffic only if channel switch is not running in silent mode.
Jeff Johnsone7245742012-09-05 17:12:55 -07003019 if (!((psessionEntry->gLimSpecMgmt.dot11hChanSwState == eLIM_11H_CHANSW_RUNNING) &&
3020 (psessionEntry->gLimChannelSwitch.switchMode == eSIR_CHANSW_MODE_SILENT)))
Jeff Johnson295189b2012-06-20 16:38:30 -07003021 {
3022 limFrameTransmissionControl(pMac, eLIM_TX_ALL, eLIM_RESUME_TX);
Jeff Johnsone7245742012-09-05 17:12:55 -07003023 limRestorePreQuietState(pMac, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07003024 }
3025
3026 /* Reset status flag */
3027 if(glimTriggerBackgroundScanDuringQuietBss_Status == eSIR_FALSE)
3028 glimTriggerBackgroundScanDuringQuietBss_Status = eSIR_TRUE;
3029
3030 limLog( pMac, LOG2,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003031 FL("Quiet BSS: Resuming traffic..."));
Jeff Johnson295189b2012-06-20 16:38:30 -07003032 }
3033 else
3034 {
3035 //
3036 // Nothing specific to be done in this case
3037 // A background scan that was triggered during
3038 // SIR_LIM_QUIET_TIMEOUT will complete on its own
3039 //
3040 limLog( pMac, LOG2,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003041 FL("Background scan should be complete now..."));
Jeff Johnson295189b2012-06-20 16:38:30 -07003042 }
3043 break;
3044
3045 case eLIM_QUIET_INIT:
3046 case eLIM_QUIET_BEGIN:
3047 case eLIM_QUIET_END:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003048 PELOG2(limLog(pMac, LOG2, FL("Quiet state not in RUNNING"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003049 /* If the quiet period has ended, then resume the frame transmission */
3050 limFrameTransmissionControl(pMac, eLIM_TX_ALL, eLIM_RESUME_TX);
Jeff Johnsone7245742012-09-05 17:12:55 -07003051 limRestorePreQuietState(pMac, psessionEntry);
3052 psessionEntry->gLimSpecMgmt.quietState = eLIM_QUIET_INIT;
Jeff Johnson295189b2012-06-20 16:38:30 -07003053 break;
3054
3055 default:
3056 //
3057 // As of now, nothing to be done
3058 //
3059 break;
3060 }
3061 }
3062}
Jeff Johnson295189b2012-06-20 16:38:30 -07003063/**
3064 * limProcessWPSOverlapTimeout
3065 *
3066 * FUNCTION: This function call limWPSPBCTimeout() to clean WPS PBC probe request entries
3067 *
3068 * LOGIC:
3069 *
3070 * ASSUMPTIONS:
3071 *
3072 * NOTE:
3073 *
3074 * @param pMac - Pointer to Global MAC structure
3075 *
3076 * @return None
3077 */
3078#if 0
3079void limProcessWPSOverlapTimeout(tpAniSirGlobal pMac)
3080{
3081
3082 tpPESession psessionEntry;
3083 tANI_U32 sessionId;
3084
3085 if (tx_timer_activate(&pMac->lim.limTimers.gLimWPSOverlapTimerObj.gLimWPSOverlapTimer) != TX_SUCCESS)
3086 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003087 limLog(pMac, LOGP, FL("tx_timer_activate failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003088 }
3089
3090 sessionId = pMac->lim.limTimers.gLimWPSOverlapTimerObj.sessionId;
3091
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003092 PELOGE(limLog(pMac, LOGE, FL("WPS overlap timeout, sessionId=%d"), sessionId);)
Jeff Johnson295189b2012-06-20 16:38:30 -07003093
3094 if((psessionEntry = peFindSessionBySessionId(pMac, sessionId)) == NULL)
3095 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003096 PELOGE(limLog(pMac, LOGP,FL("Session Does not exist for given sessionID"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003097 return;
3098 }
3099
3100 limWPSPBCTimeout(pMac, psessionEntry);
3101}
3102#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07003103
Jeff Johnson295189b2012-06-20 16:38:30 -07003104/**----------------------------------------------
3105\fn limStartQuietTimer
3106\brief Starts the quiet timer.
3107
3108\param pMac
3109\return NONE
3110-----------------------------------------------*/
3111void limStartQuietTimer(tpAniSirGlobal pMac, tANI_U8 sessionId)
3112{
3113 tpPESession psessionEntry;
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05303114 psessionEntry = peFindSessionBySessionId(pMac, sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07003115
3116 if(psessionEntry == NULL) {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003117 limLog(pMac, LOGP,FL("Session Does not exist for given sessionID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003118 return;
3119 }
3120
Jeff Johnson295189b2012-06-20 16:38:30 -07003121
3122 if (psessionEntry->limSystemRole != eLIM_STA_ROLE)
3123 return;
3124 // First, de-activate Timer, if its already active
3125 limCancelDot11hQuiet(pMac, psessionEntry);
3126
Jeff Johnsone7245742012-09-05 17:12:55 -07003127 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, sessionId, eLIM_QUIET_TIMER));
3128 if( TX_SUCCESS != tx_timer_deactivate(&pMac->lim.limTimers.gLimQuietTimer))
3129 {
3130 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003131 FL( "Unable to deactivate gLimQuietTimer! Will still attempt to re-activate anyway..." ));
Jeff Johnsone7245742012-09-05 17:12:55 -07003132 }
3133
3134 // Set the NEW timeout value, in ticks
3135 if( TX_SUCCESS != tx_timer_change( &pMac->lim.limTimers.gLimQuietTimer,
3136 SYS_MS_TO_TICKS(psessionEntry->gLimSpecMgmt.quietTimeoutValue), 0))
3137 {
3138 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003139 FL( "Unable to change gLimQuietTimer! Will still attempt to re-activate anyway..." ));
Jeff Johnsone7245742012-09-05 17:12:55 -07003140 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003141
3142 pMac->lim.limTimers.gLimQuietTimer.sessionId = sessionId;
3143 if( TX_SUCCESS != tx_timer_activate(&pMac->lim.limTimers.gLimQuietTimer))
3144 {
3145 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003146 FL("Unable to activate gLimQuietTimer! STA cannot honor Quiet BSS!"));
Jeff Johnsone7245742012-09-05 17:12:55 -07003147 limRestorePreQuietState(pMac, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07003148
Jeff Johnsone7245742012-09-05 17:12:55 -07003149 psessionEntry->gLimSpecMgmt.quietState = eLIM_QUIET_INIT;
Jeff Johnson295189b2012-06-20 16:38:30 -07003150 return;
3151 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003152}
3153
Jeff Johnson295189b2012-06-20 16:38:30 -07003154
3155/** ------------------------------------------------------------------------ **/
3156/**
3157 * keep track of the number of ANI peers associated in the BSS
3158 * For the first and last ANI peer, we have to update EDCA params as needed
3159 *
3160 * When the first ANI peer joins the BSS, we notify SCH
3161 * When the last ANI peer leaves the BSS, we notfiy SCH
3162 */
3163void
3164limUtilCountStaAdd(
3165 tpAniSirGlobal pMac,
3166 tpDphHashNode pSta,
3167 tpPESession psessionEntry)
3168{
3169
3170 if ((! pSta) || (! pSta->valid) || (! pSta->aniPeer) || (pSta->fAniCount))
3171 return;
3172
3173 pSta->fAniCount = 1;
3174
3175 if (pMac->lim.gLimNumOfAniSTAs++ != 0)
3176 return;
3177
3178 // get here only if this is the first ANI peer in the BSS
3179 schEdcaProfileUpdate(pMac, psessionEntry);
3180}
3181
3182void
3183limUtilCountStaDel(
3184 tpAniSirGlobal pMac,
3185 tpDphHashNode pSta,
3186 tpPESession psessionEntry)
3187{
3188
3189 if ((pSta == NULL) || (pSta->aniPeer == eHAL_CLEAR) || (! pSta->fAniCount))
3190 return;
3191
3192 /* Only if sta is invalid and the validInDummyState bit is set to 1,
3193 * then go ahead and update the count and profiles. This ensures
3194 * that the "number of ani station" count is properly incremented/decremented.
3195 */
3196 if (pSta->valid == 1)
3197 return;
3198
3199 pSta->fAniCount = 0;
3200
3201 if (pMac->lim.gLimNumOfAniSTAs <= 0)
3202 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003203 limLog(pMac, LOGE, FL("CountStaDel: ignoring Delete Req when AniPeer count is %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07003204 pMac->lim.gLimNumOfAniSTAs);
3205 return;
3206 }
3207
3208 pMac->lim.gLimNumOfAniSTAs--;
3209
3210 if (pMac->lim.gLimNumOfAniSTAs != 0)
3211 return;
3212
3213 // get here only if this is the last ANI peer in the BSS
3214 schEdcaProfileUpdate(pMac, psessionEntry);
3215}
3216
Jeff Johnson295189b2012-06-20 16:38:30 -07003217/**
3218 * limSwitchChannelCback()
3219 *
3220 *FUNCTION:
3221 * This is the callback function registered while requesting to switch channel
3222 * after AP indicates a channel switch for spectrum management (11h).
3223 *
3224 *NOTE:
3225 * @param pMac Pointer to Global MAC structure
3226 * @param status Status of channel switch request
3227 * @param data User data
3228 * @param psessionEntry Session information
3229 * @return NONE
3230 */
3231void limSwitchChannelCback(tpAniSirGlobal pMac, eHalStatus status,
3232 tANI_U32 *data, tpPESession psessionEntry)
3233{
3234 tSirMsgQ mmhMsg = {0};
3235 tSirSmeSwitchChannelInd *pSirSmeSwitchChInd;
3236
Jeff Johnson295189b2012-06-20 16:38:30 -07003237 psessionEntry->currentOperChannel = psessionEntry->currentReqChannel;
3238
3239 /* We need to restore pre-channelSwitch state on the STA */
3240 if (limRestorePreChannelSwitchState(pMac, psessionEntry) != eSIR_SUCCESS)
3241 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003242 limLog(pMac, LOGP, FL("Could not restore pre-channelSwitch (11h) state, resetting the system"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003243 return;
3244 }
3245
3246 mmhMsg.type = eWNI_SME_SWITCH_CHL_REQ;
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05303247 pSirSmeSwitchChInd = vos_mem_malloc(sizeof(tSirSmeSwitchChannelInd));
3248 if ( NULL == pSirSmeSwitchChInd )
Jeff Johnson295189b2012-06-20 16:38:30 -07003249 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003250 limLog(pMac, LOGP, FL("Failed to allocate buffer for buffer descriptor"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003251 return;
3252 }
3253
3254 pSirSmeSwitchChInd->messageType = eWNI_SME_SWITCH_CHL_REQ;
3255 pSirSmeSwitchChInd->length = sizeof(tSirSmeSwitchChannelInd);
Jeff Johnsone7245742012-09-05 17:12:55 -07003256 pSirSmeSwitchChInd->newChannelId = psessionEntry->gLimChannelSwitch.primaryChannel;
Jeff Johnson295189b2012-06-20 16:38:30 -07003257 pSirSmeSwitchChInd->sessionId = psessionEntry->smeSessionId;
3258 //BSS ID
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05303259 vos_mem_copy( pSirSmeSwitchChInd->bssId, psessionEntry->bssId, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07003260 mmhMsg.bodyptr = pSirSmeSwitchChInd;
3261 mmhMsg.bodyval = 0;
3262
Jeff Johnsone7245742012-09-05 17:12:55 -07003263 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07003264
Jeff Johnson295189b2012-06-20 16:38:30 -07003265 SysProcessMmhMsg(pMac, &mmhMsg);
Jeff Johnson295189b2012-06-20 16:38:30 -07003266}
3267
3268/**
3269 * limSwitchPrimaryChannel()
3270 *
3271 *FUNCTION:
3272 * This function changes the current operating channel
3273 * and sets the new new channel ID in WNI_CFG_CURRENT_CHANNEL.
3274 *
3275 *NOTE:
3276 * @param pMac Pointer to Global MAC structure
3277 * @param newChannel new chnannel ID
3278 * @return NONE
3279 */
3280void limSwitchPrimaryChannel(tpAniSirGlobal pMac, tANI_U8 newChannel,tpPESession psessionEntry)
3281{
3282#if !defined WLAN_FEATURE_VOWIFI
3283 tANI_U32 localPwrConstraint;
3284#endif
3285
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003286 PELOG3(limLog(pMac, LOG3, FL("limSwitchPrimaryChannel: old chnl %d --> new chnl %d "),
Jeff Johnson295189b2012-06-20 16:38:30 -07003287 psessionEntry->currentOperChannel, newChannel);)
3288 psessionEntry->currentReqChannel = newChannel;
3289 psessionEntry->limRFBand = limGetRFBand(newChannel);
3290
3291 psessionEntry->channelChangeReasonCode=LIM_SWITCH_CHANNEL_OPERATION;
3292
3293 pMac->lim.gpchangeChannelCallback = limSwitchChannelCback;
3294 pMac->lim.gpchangeChannelData = NULL;
3295
3296#if defined WLAN_FEATURE_VOWIFI
Jeff Johnsone7245742012-09-05 17:12:55 -07003297 limSendSwitchChnlParams(pMac, newChannel, PHY_SINGLE_CHANNEL_CENTERED,
Jeff Johnson295189b2012-06-20 16:38:30 -07003298 psessionEntry->maxTxPower, psessionEntry->peSessionId);
3299#else
3300 if(wlan_cfgGetInt(pMac, WNI_CFG_LOCAL_POWER_CONSTRAINT, &localPwrConstraint) != eSIR_SUCCESS)
3301 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003302 limLog( pMac, LOGP, FL( "Unable to read Local Power Constraint from cfg" ));
Jeff Johnson295189b2012-06-20 16:38:30 -07003303 return;
3304 }
Jeff Johnsone7245742012-09-05 17:12:55 -07003305 limSendSwitchChnlParams(pMac, newChannel, PHY_SINGLE_CHANNEL_CENTERED,
Jeff Johnson295189b2012-06-20 16:38:30 -07003306 (tPowerdBm)localPwrConstraint, psessionEntry->peSessionId);
3307#endif
3308 return;
3309}
3310
3311/**
3312 * limSwitchPrimarySecondaryChannel()
3313 *
3314 *FUNCTION:
3315 * This function changes the primary and secondary channel.
3316 * If 11h is enabled and user provides a "new channel ID"
3317 * that is different from the current operating channel,
3318 * then we must set this new channel in WNI_CFG_CURRENT_CHANNEL,
3319 * assign notify LIM of such change.
3320 *
3321 *NOTE:
3322 * @param pMac Pointer to Global MAC structure
3323 * @param newChannel New chnannel ID (or current channel ID)
3324 * @param subband CB secondary info:
3325 * - eANI_CB_SECONDARY_NONE
3326 * - eANI_CB_SECONDARY_UP
3327 * - eANI_CB_SECONDARY_DOWN
3328 * @return NONE
3329 */
Jeff Johnsone7245742012-09-05 17:12:55 -07003330void limSwitchPrimarySecondaryChannel(tpAniSirGlobal pMac, tpPESession psessionEntry, tANI_U8 newChannel, ePhyChanBondState subband)
Jeff Johnson295189b2012-06-20 16:38:30 -07003331{
3332#if !defined WLAN_FEATURE_VOWIFI
3333 tANI_U32 localPwrConstraint;
3334#endif
3335
Jeff Johnson295189b2012-06-20 16:38:30 -07003336#if !defined WLAN_FEATURE_VOWIFI
3337 if(wlan_cfgGetInt(pMac, WNI_CFG_LOCAL_POWER_CONSTRAINT, &localPwrConstraint) != eSIR_SUCCESS) {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003338 limLog( pMac, LOGP, FL( "Unable to get Local Power Constraint from cfg" ));
Jeff Johnson295189b2012-06-20 16:38:30 -07003339 return;
3340 }
3341#endif
3342
Jeff Johnson295189b2012-06-20 16:38:30 -07003343#if defined WLAN_FEATURE_VOWIFI
Jeff Johnsone7245742012-09-05 17:12:55 -07003344 limSendSwitchChnlParams(pMac, newChannel, subband, psessionEntry->maxTxPower, psessionEntry->peSessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07003345#else
Jeff Johnsone7245742012-09-05 17:12:55 -07003346 limSendSwitchChnlParams(pMac, newChannel, subband, (tPowerdBm)localPwrConstraint, psessionEntry->peSessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07003347#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07003348
Jeff Johnsone7245742012-09-05 17:12:55 -07003349 // Store the new primary and secondary channel in session entries if different
3350 if (psessionEntry->currentOperChannel != newChannel)
Jeff Johnson295189b2012-06-20 16:38:30 -07003351 {
3352 limLog(pMac, LOGW,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003353 FL("switch old chnl %d --> new chnl %d "),
Jeff Johnson295189b2012-06-20 16:38:30 -07003354 psessionEntry->currentOperChannel, newChannel);
Jeff Johnson295189b2012-06-20 16:38:30 -07003355 psessionEntry->currentOperChannel = newChannel;
3356 }
Jeff Johnsone7245742012-09-05 17:12:55 -07003357 if (psessionEntry->htSecondaryChannelOffset != subband)
3358 {
3359 limLog(pMac, LOGW,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003360 FL("switch old sec chnl %d --> new sec chnl %d "),
Jeff Johnsone7245742012-09-05 17:12:55 -07003361 psessionEntry->htSecondaryChannelOffset, subband);
3362 psessionEntry->htSecondaryChannelOffset = subband;
3363 if (psessionEntry->htSecondaryChannelOffset == PHY_SINGLE_CHANNEL_CENTERED)
3364 {
3365 psessionEntry->htSupportedChannelWidthSet = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE;
3366 }
3367 else
3368 {
3369 psessionEntry->htSupportedChannelWidthSet = WNI_CFG_CHANNEL_BONDING_MODE_ENABLE;
3370 }
3371 psessionEntry->htRecommendedTxWidthSet = psessionEntry->htSupportedChannelWidthSet;
3372 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003373
3374 return;
3375}
3376
3377
3378/**
3379 * limActiveScanAllowed()
3380 *
3381 *FUNCTION:
3382 * Checks if active scans are permitted on the given channel
3383 *
3384 *LOGIC:
3385 * The config variable SCAN_CONTROL_LIST contains pairs of (channelNum, activeScanAllowed)
3386 * Need to check if the channelNum matches, then depending on the corresponding
3387 * scan flag, return true (for activeScanAllowed==1) or false (otherwise).
3388 *
3389 *ASSUMPTIONS:
3390 *
3391 *NOTE:
3392 *
3393 * @param pMac Pointer to Global MAC structure
3394 * @param channelNum channel number
3395 * @return None
3396 */
3397
3398tANI_U8 limActiveScanAllowed(
3399 tpAniSirGlobal pMac,
3400 tANI_U8 channelNum)
3401{
3402 tANI_U32 i;
3403 tANI_U8 channelPair[WNI_CFG_SCAN_CONTROL_LIST_LEN];
3404 tANI_U32 len = WNI_CFG_SCAN_CONTROL_LIST_LEN;
3405 if (wlan_cfgGetStr(pMac, WNI_CFG_SCAN_CONTROL_LIST, channelPair, &len)
3406 != eSIR_SUCCESS)
3407 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003408 PELOGE(limLog(pMac, LOGE, FL("Unable to get scan control list"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003409 return false;
3410 }
3411
3412 if (len > WNI_CFG_SCAN_CONTROL_LIST_LEN)
3413 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003414 limLog(pMac, LOGE, FL("Invalid scan control list length:%d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07003415 len);
3416 return false;
3417 }
3418
3419 for (i=0; (i+1) < len; i+=2)
3420 {
3421 if (channelPair[i] == channelNum)
3422 return ((channelPair[i+1] == eSIR_ACTIVE_SCAN) ? true : false);
3423 }
3424 return false;
3425}
3426
3427/**
3428 * limTriggerBackgroundScanDuringQuietBss()
3429 *
3430 *FUNCTION:
3431 * This function is applicable to the STA only.
3432 * This function is called by limProcessQuietTimeout(),
3433 * when it is time to honor the Quiet BSS IE from the AP.
3434 *
3435 *LOGIC:
3436 * If 11H is enabled:
3437 * We cannot trigger a background scan. The STA needs to
3438 * shut-off Tx/Rx.
3439 * If 11 is not enabled:
3440 * Determine if the next channel that we are going to
3441 * scan is NOT the same channel (or not) on which the
3442 * Quiet BSS was requested.
3443 * If yes, then we cannot trigger a background scan on
3444 * this channel. Return with a false.
3445 * If no, then trigger a background scan. Return with
3446 * a true.
3447 *
3448 *ASSUMPTIONS:
3449 *
3450 *NOTE:
3451 * This API is redundant if the existing API,
3452 * limTriggerBackgroundScan(), were to return a valid
3453 * response instead of returning void.
3454 * If possible, try to revisit this API
3455 *
3456 * @param pMac Pointer to Global MAC structure
3457 * @return eSIR_TRUE, if a background scan was attempted
3458 * eSIR_FALSE, if not
3459 */
3460tAniBool limTriggerBackgroundScanDuringQuietBss( tpAniSirGlobal pMac )
3461{
3462 tAniBool bScanTriggered = eSIR_FALSE;
Jeff Johnson295189b2012-06-20 16:38:30 -07003463
3464
3465
3466 //TBD-RAJESH HOW TO GET sessionEntry?????
3467 tpPESession psessionEntry = &pMac->lim.gpSession[0];
3468
3469 if (psessionEntry->limSystemRole != eLIM_STA_ROLE)
3470 return bScanTriggered;
3471
Jeff Johnsone7245742012-09-05 17:12:55 -07003472 if( !psessionEntry->lim11hEnable )
Jeff Johnson295189b2012-06-20 16:38:30 -07003473 {
3474 tSirMacChanNum bgScanChannelList[WNI_CFG_BG_SCAN_CHANNEL_LIST_LEN];
3475 tANI_U32 len = WNI_CFG_BG_SCAN_CHANNEL_LIST_LEN;
3476
3477 // Determine the next scan channel
3478
3479 // Get background scan channel list from CFG
3480 if( eSIR_SUCCESS == wlan_cfgGetStr( pMac,
3481 WNI_CFG_BG_SCAN_CHANNEL_LIST,
3482 (tANI_U8 *) bgScanChannelList,
3483 (tANI_U32 *) &len ))
3484 {
3485 // Ensure that we do not go off scanning on the same
3486 // channel on which the Quiet BSS was requested
3487 if( psessionEntry->currentOperChannel!=
3488 bgScanChannelList[pMac->lim.gLimBackgroundScanChannelId] )
3489 {
3490 // For now, try and attempt a background scan. It will
3491 // be ideal if this API actually returns a success or
3492 // failure instead of having a void return type
3493 limTriggerBackgroundScan( pMac );
3494
3495 bScanTriggered = eSIR_TRUE;
3496 }
3497 else
3498 {
3499 limLog( pMac, LOGW,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003500 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 -07003501 }
3502 }
3503 else
3504 {
3505 limLog( pMac, LOGW,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003506 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 -07003507 }
3508 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003509 return bScanTriggered;
3510}
3511
3512
3513/**
3514 * limGetHTCapability()
3515 *
3516 *FUNCTION:
3517 * A utility function that returns the "current HT capability state" for the HT
3518 * capability of interest (as requested in the API)
3519 *
3520 *LOGIC:
3521 * This routine will return with the "current" setting of a requested HT
3522 * capability. This state info could be retrieved from -
3523 * a) CFG (for static entries)
3524 * b) Run time info
3525 * - Dynamic state maintained by LIM
3526 * - Configured at radio init time by SME
3527 *
3528 *
3529 *ASSUMPTIONS:
3530 * NA
3531 *
3532 *NOTE:
3533 *
3534 * @param pMac Pointer to Global MAC structure
3535 * @param htCap The HT capability being queried
3536 * @return tANI_U8 The current state of the requested HT capability is returned in a
3537 * tANI_U8 variable
3538 */
3539
Jeff Johnson295189b2012-06-20 16:38:30 -07003540tANI_U8 limGetHTCapability( tpAniSirGlobal pMac,
3541 tANI_U32 htCap, tpPESession psessionEntry)
Jeff Johnson295189b2012-06-20 16:38:30 -07003542{
3543tANI_U8 retVal = 0;
3544tANI_U8 *ptr;
3545tANI_U32 cfgValue;
3546tSirMacHTCapabilityInfo macHTCapabilityInfo = {0};
3547tSirMacExtendedHTCapabilityInfo macExtHTCapabilityInfo = {0};
3548tSirMacTxBFCapabilityInfo macTxBFCapabilityInfo = {0};
3549tSirMacASCapabilityInfo macASCapabilityInfo = {0};
3550
3551 //
3552 // Determine which CFG to read from. Not ALL of the HT
3553 // related CFG's need to be read each time this API is
3554 // accessed
3555 //
3556 if( htCap >= eHT_ANTENNA_SELECTION &&
3557 htCap < eHT_SI_GRANULARITY )
3558 {
3559 // Get Antenna Seletion HT Capabilities
3560 if( eSIR_SUCCESS != wlan_cfgGetInt( pMac, WNI_CFG_AS_CAP, &cfgValue ))
3561 cfgValue = 0;
3562 ptr = (tANI_U8 *) &macASCapabilityInfo;
3563 *((tANI_U8 *)ptr) = (tANI_U8) (cfgValue & 0xff);
3564 }
3565 else
3566 {
3567 if( htCap >= eHT_TX_BEAMFORMING &&
3568 htCap < eHT_ANTENNA_SELECTION )
3569 {
3570 // Get Transmit Beam Forming HT Capabilities
3571 if( eSIR_SUCCESS != wlan_cfgGetInt( pMac, WNI_CFG_TX_BF_CAP, &cfgValue ))
3572 cfgValue = 0;
3573 ptr = (tANI_U8 *) &macTxBFCapabilityInfo;
3574 *((tANI_U32 *)ptr) = (tANI_U32) (cfgValue);
3575 }
3576 else
3577 {
3578 if( htCap >= eHT_PCO &&
3579 htCap < eHT_TX_BEAMFORMING )
3580 {
3581 // Get Extended HT Capabilities
3582 if( eSIR_SUCCESS != wlan_cfgGetInt( pMac, WNI_CFG_EXT_HT_CAP_INFO, &cfgValue ))
3583 cfgValue = 0;
3584 ptr = (tANI_U8 *) &macExtHTCapabilityInfo;
3585 *((tANI_U16 *)ptr) = (tANI_U16) (cfgValue & 0xffff);
3586 }
3587 else
3588 {
3589 if( htCap < eHT_MAX_RX_AMPDU_FACTOR )
3590 {
3591 // Get HT Capabilities
3592 if( eSIR_SUCCESS != wlan_cfgGetInt( pMac, WNI_CFG_HT_CAP_INFO, &cfgValue ))
3593 cfgValue = 0;
3594 ptr = (tANI_U8 *) &macHTCapabilityInfo;
3595 // 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
3596 *ptr++ = cfgValue & 0xff;
3597 *ptr = (cfgValue >> 8) & 0xff;
3598 }
3599 }
3600 }
3601 }
3602
3603 switch( htCap )
3604 {
3605 case eHT_LSIG_TXOP_PROTECTION:
3606 retVal = pMac->lim.gHTLsigTXOPProtection;
3607 break;
3608
3609 case eHT_STBC_CONTROL_FRAME:
3610 retVal = (tANI_U8) macHTCapabilityInfo.stbcControlFrame;
3611 break;
3612
3613 case eHT_PSMP:
3614 retVal = pMac->lim.gHTPSMPSupport;
3615 break;
3616
3617 case eHT_DSSS_CCK_MODE_40MHZ:
3618 retVal = pMac->lim.gHTDsssCckRate40MHzSupport;
3619 break;
3620
3621 case eHT_MAX_AMSDU_LENGTH:
3622 retVal = (tANI_U8) macHTCapabilityInfo.maximalAMSDUsize;
3623 break;
3624
3625 case eHT_DELAYED_BA:
3626 retVal = (tANI_U8) macHTCapabilityInfo.delayedBA;
3627 break;
3628
3629 case eHT_RX_STBC:
3630 retVal = (tANI_U8) macHTCapabilityInfo.rxSTBC;
3631 break;
3632
3633 case eHT_TX_STBC:
3634 retVal = (tANI_U8) macHTCapabilityInfo.txSTBC;
3635 break;
3636
3637 case eHT_SHORT_GI_40MHZ:
3638 retVal = (tANI_U8) macHTCapabilityInfo.shortGI40MHz;
3639 break;
3640
3641 case eHT_SHORT_GI_20MHZ:
3642 retVal = (tANI_U8) macHTCapabilityInfo.shortGI20MHz;
3643 break;
3644
3645 case eHT_GREENFIELD:
3646 retVal = (tANI_U8) macHTCapabilityInfo.greenField;
3647 break;
3648
3649 case eHT_MIMO_POWER_SAVE:
3650 retVal = (tANI_U8) pMac->lim.gHTMIMOPSState;
3651 break;
3652
3653 case eHT_SUPPORTED_CHANNEL_WIDTH_SET:
Jeff Johnsone7245742012-09-05 17:12:55 -07003654 retVal = (tANI_U8) psessionEntry->htSupportedChannelWidthSet;
Jeff Johnson295189b2012-06-20 16:38:30 -07003655 break;
3656
3657 case eHT_ADVANCED_CODING:
3658 retVal = (tANI_U8) macHTCapabilityInfo.advCodingCap;
3659 break;
3660
3661 case eHT_MAX_RX_AMPDU_FACTOR:
3662 retVal = pMac->lim.gHTMaxRxAMpduFactor;
3663 break;
3664
3665 case eHT_MPDU_DENSITY:
3666 retVal = pMac->lim.gHTAMpduDensity;
3667 break;
3668
3669 case eHT_PCO:
3670 retVal = (tANI_U8) macExtHTCapabilityInfo.pco;
3671 break;
3672
3673 case eHT_TRANSITION_TIME:
3674 retVal = (tANI_U8) macExtHTCapabilityInfo.transitionTime;
3675 break;
3676
3677 case eHT_MCS_FEEDBACK:
3678 retVal = (tANI_U8) macExtHTCapabilityInfo.mcsFeedback;
3679 break;
3680
3681 case eHT_TX_BEAMFORMING:
3682 retVal = (tANI_U8) macTxBFCapabilityInfo.txBF;
3683 break;
3684
3685 case eHT_ANTENNA_SELECTION:
3686 retVal = (tANI_U8) macASCapabilityInfo.antennaSelection;
3687 break;
3688
3689 case eHT_SI_GRANULARITY:
3690 retVal = pMac->lim.gHTServiceIntervalGranularity;
3691 break;
3692
3693 case eHT_CONTROLLED_ACCESS:
3694 retVal = pMac->lim.gHTControlledAccessOnly;
3695 break;
3696
3697 case eHT_RIFS_MODE:
3698 retVal = psessionEntry->beaconParams.fRIFSMode;
3699 break;
3700
3701 case eHT_RECOMMENDED_TX_WIDTH_SET:
Jeff Johnsone7245742012-09-05 17:12:55 -07003702 retVal = psessionEntry->htRecommendedTxWidthSet;
Jeff Johnson295189b2012-06-20 16:38:30 -07003703 break;
3704
3705 case eHT_EXTENSION_CHANNEL_OFFSET:
Jeff Johnsone7245742012-09-05 17:12:55 -07003706 retVal = psessionEntry->htSecondaryChannelOffset;
Jeff Johnson295189b2012-06-20 16:38:30 -07003707 break;
3708
3709 case eHT_OP_MODE:
Jeff Johnson295189b2012-06-20 16:38:30 -07003710 if(psessionEntry->limSystemRole == eLIM_AP_ROLE )
3711 retVal = psessionEntry->htOperMode;
3712 else
Jeff Johnson295189b2012-06-20 16:38:30 -07003713 retVal = pMac->lim.gHTOperMode;
3714 break;
3715
3716 case eHT_BASIC_STBC_MCS:
3717 retVal = pMac->lim.gHTSTBCBasicMCS;
3718 break;
3719
3720 case eHT_DUAL_CTS_PROTECTION:
3721 retVal = pMac->lim.gHTDualCTSProtection;
3722 break;
3723
3724 case eHT_LSIG_TXOP_PROTECTION_FULL_SUPPORT:
3725 retVal = psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport;
3726 break;
3727
3728 case eHT_PCO_ACTIVE:
3729 retVal = pMac->lim.gHTPCOActive;
3730 break;
3731
3732 case eHT_PCO_PHASE:
3733 retVal = pMac->lim.gHTPCOPhase;
3734 break;
3735
3736 default:
3737 break;
3738 }
3739
3740 return retVal;
3741}
3742
Jeff Johnson295189b2012-06-20 16:38:30 -07003743void limGetMyMacAddr(tpAniSirGlobal pMac, tANI_U8 *mac)
3744{
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05303745 vos_mem_copy( mac, pMac->lim.gLimMyMacAddr, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07003746 return;
3747}
3748
3749
3750
3751
3752/** -------------------------------------------------------------
3753\fn limEnable11aProtection
3754\brief based on config setting enables\disables 11a protection.
3755\param tANI_U8 enable : 1=> enable protection, 0=> disable protection.
3756\param tANI_U8 overlap: 1=> called from overlap context, 0 => called from assoc context.
3757\param tpUpdateBeaconParams pBeaconParams
3758\return None
3759 -------------------------------------------------------------*/
3760tSirRetStatus
3761limEnable11aProtection(tpAniSirGlobal pMac, tANI_U8 enable,
3762 tANI_U8 overlap, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry)
3763{
Madan Mohan Koyyalamudi33ef6a22012-10-30 17:44:43 -07003764 if(NULL == psessionEntry)
3765 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003766 PELOG3(limLog(pMac, LOG3, FL("psessionEntry is NULL"));)
Madan Mohan Koyyalamudi33ef6a22012-10-30 17:44:43 -07003767 return eSIR_FAILURE;
3768 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003769 //overlapping protection configuration check.
3770 if(overlap)
3771 {
Jeff Johnson295189b2012-06-20 16:38:30 -07003772 }
3773 else
3774 {
3775 //normal protection config check
Madan Mohan Koyyalamudi33ef6a22012-10-30 17:44:43 -07003776 if ((psessionEntry->limSystemRole == eLIM_AP_ROLE) &&
Jeff Johnsone7245742012-09-05 17:12:55 -07003777 (!psessionEntry->cfgProtection.fromlla))
Jeff Johnson295189b2012-06-20 16:38:30 -07003778 {
3779 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003780 PELOG3(limLog(pMac, LOG3, FL("protection from 11a is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003781 return eSIR_SUCCESS;
3782 }
3783 }
3784
3785 if (enable)
3786 {
3787 //If we are AP and HT capable, we need to set the HT OP mode
3788 //appropriately.
3789 if(((eLIM_AP_ROLE == psessionEntry->limSystemRole)||(eLIM_BT_AMP_AP_ROLE == psessionEntry->limSystemRole))&&
Jeff Johnsone7245742012-09-05 17:12:55 -07003790 (true == psessionEntry->htCapability))
Jeff Johnson295189b2012-06-20 16:38:30 -07003791 {
3792 if(overlap)
3793 {
3794 pMac->lim.gLimOverlap11aParams.protectionEnabled = true;
3795 if((eSIR_HT_OP_MODE_OVERLAP_LEGACY != pMac->lim.gHTOperMode) &&
3796 (eSIR_HT_OP_MODE_MIXED != pMac->lim.gHTOperMode))
3797 {
3798 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
3799 psessionEntry->htOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
3800 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
3801 limEnableHtOBSSProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
3802 }
3803 }
3804 else
3805 {
3806 psessionEntry->gLim11aParams.protectionEnabled = true;
3807 if(eSIR_HT_OP_MODE_MIXED != pMac->lim.gHTOperMode)
3808 {
3809 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_MIXED;
Jeff Johnsone7245742012-09-05 17:12:55 -07003810 psessionEntry->htOperMode = eSIR_HT_OP_MODE_MIXED;
Jeff Johnson295189b2012-06-20 16:38:30 -07003811 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
3812 limEnableHtOBSSProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
3813
3814 }
3815 }
3816 }
3817
3818 //This part is common for staiton as well.
3819 if(false == psessionEntry->beaconParams.llaCoexist)
3820 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003821 PELOG1(limLog(pMac, LOG1, FL(" => protection from 11A Enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003822 pBeaconParams->llaCoexist = psessionEntry->beaconParams.llaCoexist = true;
3823 pBeaconParams->paramChangeBitmap |= PARAM_llACOEXIST_CHANGED;
3824 }
3825 }
3826 else if (true == psessionEntry->beaconParams.llaCoexist)
3827 {
3828 //for AP role.
3829 //we need to take care of HT OP mode change if needed.
3830 //We need to take care of Overlap cases.
3831 if(eLIM_AP_ROLE == psessionEntry->limSystemRole)
3832 {
3833 if(overlap)
3834 {
3835 //Overlap Legacy protection disabled.
3836 pMac->lim.gLimOverlap11aParams.protectionEnabled = false;
3837
3838 //We need to take care of HT OP mode iff we are HT AP.
Jeff Johnsone7245742012-09-05 17:12:55 -07003839 if(psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07003840 {
3841 // no HT op mode change if any of the overlap protection enabled.
3842 if(!(pMac->lim.gLimOverlap11aParams.protectionEnabled ||
3843 pMac->lim.gLimOverlapHt20Params.protectionEnabled ||
3844 pMac->lim.gLimOverlapNonGfParams.protectionEnabled))
3845
3846 {
3847 //Check if there is a need to change HT OP mode.
3848 if(eSIR_HT_OP_MODE_OVERLAP_LEGACY == pMac->lim.gHTOperMode)
3849 {
3850 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
3851 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
3852
3853 if(psessionEntry->gLimHt20Params.protectionEnabled)
3854 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
3855 else
3856 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_PURE;
3857 }
3858 }
3859 }
3860 }
3861 else
3862 {
3863 //Disable protection from 11A stations.
3864 psessionEntry->gLim11aParams.protectionEnabled = false;
3865 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
3866
3867 //Check if any other non-HT protection enabled.
3868 //Right now we are in HT OP Mixed mode.
3869 //Change HT op mode appropriately.
3870
3871 //Change HT OP mode to 01 if any overlap protection enabled
3872 if(pMac->lim.gLimOverlap11aParams.protectionEnabled ||
3873 pMac->lim.gLimOverlapHt20Params.protectionEnabled ||
3874 pMac->lim.gLimOverlapNonGfParams.protectionEnabled)
3875
3876 {
3877 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
Jeff Johnsone7245742012-09-05 17:12:55 -07003878 psessionEntry->htOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
Jeff Johnson295189b2012-06-20 16:38:30 -07003879 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
3880 }
3881 else if(psessionEntry->gLimHt20Params.protectionEnabled)
3882 {
3883 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
Jeff Johnsone7245742012-09-05 17:12:55 -07003884 psessionEntry->htOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
Jeff Johnson295189b2012-06-20 16:38:30 -07003885 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
3886 }
3887 else
3888 {
3889 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_PURE;
Jeff Johnsone7245742012-09-05 17:12:55 -07003890 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
Jeff Johnson295189b2012-06-20 16:38:30 -07003891 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
3892 }
3893 }
3894 if(!pMac->lim.gLimOverlap11aParams.protectionEnabled &&
3895 !psessionEntry->gLim11aParams.protectionEnabled)
3896 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003897 PELOG1(limLog(pMac, LOG1, FL("===> Protection from 11A Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003898 pBeaconParams->llaCoexist = psessionEntry->beaconParams.llaCoexist = false;
3899 pBeaconParams->paramChangeBitmap |= PARAM_llACOEXIST_CHANGED;
3900 }
3901 }
3902 //for station role
3903 else
3904 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003905 PELOG1(limLog(pMac, LOG1, FL("===> Protection from 11A Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003906 pBeaconParams->llaCoexist = psessionEntry->beaconParams.llaCoexist = false;
3907 pBeaconParams->paramChangeBitmap |= PARAM_llACOEXIST_CHANGED;
3908 }
3909 }
3910
3911 return eSIR_SUCCESS;
3912}
3913
3914/** -------------------------------------------------------------
3915\fn limEnable11gProtection
3916\brief based on config setting enables\disables 11g protection.
3917\param tANI_U8 enable : 1=> enable protection, 0=> disable protection.
3918\param tANI_U8 overlap: 1=> called from overlap context, 0 => called from assoc context.
3919\param tpUpdateBeaconParams pBeaconParams
3920\return None
3921 -------------------------------------------------------------*/
3922
3923tSirRetStatus
3924limEnable11gProtection(tpAniSirGlobal pMac, tANI_U8 enable,
3925 tANI_U8 overlap, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry)
3926{
3927
3928 //overlapping protection configuration check.
3929 if(overlap)
3930 {
Jeff Johnson295189b2012-06-20 16:38:30 -07003931 }
3932 else
3933 {
3934 //normal protection config check
Jeff Johnson295189b2012-06-20 16:38:30 -07003935 if((psessionEntry->limSystemRole == eLIM_AP_ROLE ) &&
3936 !psessionEntry->cfgProtection.fromllb)
3937 {
3938 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003939 PELOG1(limLog(pMac, LOG1, FL("protection from 11b is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003940 return eSIR_SUCCESS;
3941 }else if(psessionEntry->limSystemRole != eLIM_AP_ROLE)
Jeff Johnson295189b2012-06-20 16:38:30 -07003942 {
3943 if(!pMac->lim.cfgProtection.fromllb)
3944 {
3945 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003946 PELOG1(limLog(pMac, LOG1, FL("protection from 11b is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003947 return eSIR_SUCCESS;
3948 }
3949 }
3950 }
3951
3952 if (enable)
3953 {
3954 //If we are AP and HT capable, we need to set the HT OP mode
3955 //appropriately.
Jeff Johnson295189b2012-06-20 16:38:30 -07003956 if(eLIM_AP_ROLE == psessionEntry->limSystemRole)
3957 {
3958 if(overlap)
3959 {
3960 psessionEntry->gLimOlbcParams.protectionEnabled = true;
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003961 PELOGE(limLog(pMac, LOGE, FL("protection from olbc is enabled"));)
Jeff Johnsone7245742012-09-05 17:12:55 -07003962 if(true == psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07003963 {
3964 if((eSIR_HT_OP_MODE_OVERLAP_LEGACY != psessionEntry->htOperMode) &&
3965 (eSIR_HT_OP_MODE_MIXED != psessionEntry->htOperMode))
3966 {
3967 psessionEntry->htOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
3968 }
3969 //CR-263021: OBSS bit is not switching back to 0 after disabling the overlapping legacy BSS
3970 // This fixes issue of OBSS bit not set after 11b, 11g station leaves
3971 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
3972 //Not processing OBSS bit from other APs, as we are already taking care
3973 //of Protection from overlapping BSS based on erp IE or useProtection bit
3974 limEnableHtOBSSProtection(pMac, true, overlap, pBeaconParams, psessionEntry);
3975 }
3976 }
3977 else
3978 {
3979 psessionEntry->gLim11bParams.protectionEnabled = true;
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003980 PELOGE(limLog(pMac, LOGE, FL("protection from 11b is enabled"));)
Jeff Johnsone7245742012-09-05 17:12:55 -07003981 if(true == psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07003982 {
3983 if(eSIR_HT_OP_MODE_MIXED != psessionEntry->htOperMode)
3984 {
3985 psessionEntry->htOperMode = eSIR_HT_OP_MODE_MIXED;
3986 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
3987 limEnableHtOBSSProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
3988 }
3989 }
3990 }
3991 }else if ((eLIM_BT_AMP_AP_ROLE == psessionEntry->limSystemRole) &&
Jeff Johnsone7245742012-09-05 17:12:55 -07003992 (true == psessionEntry->htCapability))
Jeff Johnson295189b2012-06-20 16:38:30 -07003993 {
3994 if(overlap)
3995 {
3996 psessionEntry->gLimOlbcParams.protectionEnabled = true;
3997 if((eSIR_HT_OP_MODE_OVERLAP_LEGACY != pMac->lim.gHTOperMode) &&
3998 (eSIR_HT_OP_MODE_MIXED != pMac->lim.gHTOperMode))
3999 {
4000 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
4001 }
4002 //CR-263021: OBSS bit is not switching back to 0 after disabling the overlapping legacy BSS
4003 // This fixes issue of OBSS bit not set after 11b, 11g station leaves
4004 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4005 //Not processing OBSS bit from other APs, as we are already taking care
4006 //of Protection from overlapping BSS based on erp IE or useProtection bit
4007 limEnableHtOBSSProtection(pMac, true, overlap, pBeaconParams, psessionEntry);
4008 }
4009 else
4010 {
4011 psessionEntry->gLim11bParams.protectionEnabled = true;
4012 if(eSIR_HT_OP_MODE_MIXED != pMac->lim.gHTOperMode)
4013 {
4014 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_MIXED;
4015 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4016 limEnableHtOBSSProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4017 }
4018 }
4019 }
4020
4021 //This part is common for staiton as well.
4022 if(false == psessionEntry->beaconParams.llbCoexist)
4023 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004024 PELOG1(limLog(pMac, LOG1, FL("=> 11G Protection Enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004025 pBeaconParams->llbCoexist = psessionEntry->beaconParams.llbCoexist = true;
4026 pBeaconParams->paramChangeBitmap |= PARAM_llBCOEXIST_CHANGED;
4027 }
4028 }
4029 else if (true == psessionEntry->beaconParams.llbCoexist)
4030 {
4031 //for AP role.
4032 //we need to take care of HT OP mode change if needed.
4033 //We need to take care of Overlap cases.
Jeff Johnson295189b2012-06-20 16:38:30 -07004034 if(eLIM_AP_ROLE == psessionEntry->limSystemRole)
4035 {
4036 if(overlap)
4037 {
4038 //Overlap Legacy protection disabled.
4039 psessionEntry->gLimOlbcParams.protectionEnabled = false;
4040
4041 //We need to take care of HT OP mode if we are HT AP.
Jeff Johnsone7245742012-09-05 17:12:55 -07004042 if(psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07004043 {
4044 // no HT op mode change if any of the overlap protection enabled.
4045 if(!(psessionEntry->gLimOverlap11gParams.protectionEnabled ||
4046 psessionEntry->gLimOverlapHt20Params.protectionEnabled ||
4047 psessionEntry->gLimOverlapNonGfParams.protectionEnabled))
4048 {
4049 //Check if there is a need to change HT OP mode.
Jeff Johnson04dd8a82012-06-29 20:41:40 -07004050 if(eSIR_HT_OP_MODE_OVERLAP_LEGACY == psessionEntry->htOperMode)
Jeff Johnson295189b2012-06-20 16:38:30 -07004051 {
4052 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4053 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4054 if(psessionEntry->gLimHt20Params.protectionEnabled){
4055 //Commenting out beacuse of CR 258588 WFA cert
4056 //psessionEntry->htOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4057 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
4058 }
4059 else
4060 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
4061 }
4062 }
4063 }
4064 }
4065 else
4066 {
4067 //Disable protection from 11B stations.
4068 psessionEntry->gLim11bParams.protectionEnabled = false;
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004069 PELOGE(limLog(pMac, LOGE, FL("===> 11B Protection Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004070 //Check if any other non-HT protection enabled.
4071 if(!psessionEntry->gLim11gParams.protectionEnabled)
4072 {
4073 //Right now we are in HT OP Mixed mode.
4074 //Change HT op mode appropriately.
4075 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4076
4077 //Change HT OP mode to 01 if any overlap protection enabled
4078 if(psessionEntry->gLimOlbcParams.protectionEnabled ||
4079 psessionEntry->gLimOverlap11gParams.protectionEnabled ||
4080 psessionEntry->gLimOverlapHt20Params.protectionEnabled ||
4081 psessionEntry->gLimOverlapNonGfParams.protectionEnabled)
4082 {
4083 psessionEntry->htOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004084 PELOGE(limLog(pMac, LOGE, FL("===> 11G Protection Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004085 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4086 }
4087 else if(psessionEntry->gLimHt20Params.protectionEnabled)
4088 {
4089 //Commenting because of CR 258588 WFA cert
4090 //psessionEntry->htOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4091 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004092 PELOGE(limLog(pMac, LOGE, FL("===> 11G Protection Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004093 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4094 }
4095 else
4096 {
4097 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
4098 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4099 }
4100 }
4101 }
4102 if(!psessionEntry->gLimOlbcParams.protectionEnabled &&
4103 !psessionEntry->gLim11bParams.protectionEnabled)
4104 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004105 PELOGE(limLog(pMac, LOGE, FL("===> 11G Protection Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004106 pBeaconParams->llbCoexist = psessionEntry->beaconParams.llbCoexist = false;
4107 pBeaconParams->paramChangeBitmap |= PARAM_llBCOEXIST_CHANGED;
4108 }
4109 }else if(eLIM_BT_AMP_AP_ROLE == psessionEntry->limSystemRole)
Jeff Johnson295189b2012-06-20 16:38:30 -07004110 {
4111 if(overlap)
4112 {
4113 //Overlap Legacy protection disabled.
4114 psessionEntry->gLimOlbcParams.protectionEnabled = false;
4115
4116 //We need to take care of HT OP mode iff we are HT AP.
Jeff Johnsone7245742012-09-05 17:12:55 -07004117 if(psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07004118 {
4119 // no HT op mode change if any of the overlap protection enabled.
4120 if(!(pMac->lim.gLimOverlap11gParams.protectionEnabled ||
4121 pMac->lim.gLimOverlapHt20Params.protectionEnabled ||
4122 pMac->lim.gLimOverlapNonGfParams.protectionEnabled))
4123
4124 {
4125 //Check if there is a need to change HT OP mode.
4126 if(eSIR_HT_OP_MODE_OVERLAP_LEGACY == pMac->lim.gHTOperMode)
4127 {
4128 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4129 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4130 if(psessionEntry->gLimHt20Params.protectionEnabled)
4131 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4132 else
4133 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_PURE;
4134 }
4135 }
4136 }
4137 }
4138 else
4139 {
4140 //Disable protection from 11B stations.
4141 psessionEntry->gLim11bParams.protectionEnabled = false;
4142 //Check if any other non-HT protection enabled.
4143 if(!psessionEntry->gLim11gParams.protectionEnabled)
4144 {
4145 //Right now we are in HT OP Mixed mode.
4146 //Change HT op mode appropriately.
4147 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4148
4149 //Change HT OP mode to 01 if any overlap protection enabled
4150 if(psessionEntry->gLimOlbcParams.protectionEnabled ||
4151 pMac->lim.gLimOverlap11gParams.protectionEnabled ||
4152 pMac->lim.gLimOverlapHt20Params.protectionEnabled ||
4153 pMac->lim.gLimOverlapNonGfParams.protectionEnabled)
4154
4155 {
4156 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
4157 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4158 }
4159 else if(psessionEntry->gLimHt20Params.protectionEnabled)
4160 {
4161 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4162 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4163 }
4164 else
4165 {
4166 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_PURE;
4167 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4168 }
4169 }
4170 }
4171 if(!psessionEntry->gLimOlbcParams.protectionEnabled &&
4172 !psessionEntry->gLim11bParams.protectionEnabled)
4173 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004174 PELOG1(limLog(pMac, LOG1, FL("===> 11G Protection Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004175 pBeaconParams->llbCoexist = psessionEntry->beaconParams.llbCoexist = false;
4176 pBeaconParams->paramChangeBitmap |= PARAM_llBCOEXIST_CHANGED;
4177 }
4178 }
4179 //for station role
4180 else
4181 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004182 PELOG1(limLog(pMac, LOG1, FL("===> 11G Protection Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004183 pBeaconParams->llbCoexist = psessionEntry->beaconParams.llbCoexist = false;
4184 pBeaconParams->paramChangeBitmap |= PARAM_llBCOEXIST_CHANGED;
4185 }
4186 }
4187 return eSIR_SUCCESS;
4188}
4189
4190/** -------------------------------------------------------------
4191\fn limEnableHtProtectionFrom11g
4192\brief based on cofig enables\disables protection from 11g.
4193\param tANI_U8 enable : 1=> enable protection, 0=> disable protection.
4194\param tANI_U8 overlap: 1=> called from overlap context, 0 => called from assoc context.
4195\param tpUpdateBeaconParams pBeaconParams
4196\return None
4197 -------------------------------------------------------------*/
4198tSirRetStatus
4199limEnableHtProtectionFrom11g(tpAniSirGlobal pMac, tANI_U8 enable,
4200 tANI_U8 overlap, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry)
4201{
Jeff Johnsone7245742012-09-05 17:12:55 -07004202 if(!psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07004203 return eSIR_SUCCESS; // protection from 11g is only for HT stations.
4204
4205 //overlapping protection configuration check.
4206 if(overlap)
4207 {
Jeff Johnson295189b2012-06-20 16:38:30 -07004208 if((psessionEntry->limSystemRole == eLIM_AP_ROLE ) && (!psessionEntry->cfgProtection.overlapFromllg))
4209 {
4210 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004211 PELOG3(limLog(pMac, LOG3, FL("overlap protection from 11g is disabled")););
Jeff Johnson295189b2012-06-20 16:38:30 -07004212 return eSIR_SUCCESS;
4213 }else if ((psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE) && (!pMac->lim.cfgProtection.overlapFromllg))
Jeff Johnson295189b2012-06-20 16:38:30 -07004214 {
4215 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004216 PELOG3(limLog(pMac, LOG3, FL("overlap protection from 11g is disabled")););
Jeff Johnson295189b2012-06-20 16:38:30 -07004217 return eSIR_SUCCESS;
4218 }
4219 }
4220 else
4221 {
4222 //normal protection config check
Jeff Johnson295189b2012-06-20 16:38:30 -07004223 if((psessionEntry->limSystemRole == eLIM_AP_ROLE ) &&
4224 !psessionEntry->cfgProtection.fromllg){
4225 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004226 PELOG3(limLog(pMac, LOG3, FL("protection from 11g is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004227 return eSIR_SUCCESS;
4228 }else if(psessionEntry->limSystemRole != eLIM_AP_ROLE )
Jeff Johnson295189b2012-06-20 16:38:30 -07004229 {
4230 if(!pMac->lim.cfgProtection.fromllg)
4231 {
4232 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004233 PELOG3(limLog(pMac, LOG3, FL("protection from 11g is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004234 return eSIR_SUCCESS;
4235 }
4236 }
4237 }
4238 if (enable)
4239 {
4240 //If we are AP and HT capable, we need to set the HT OP mode
4241 //appropriately.
4242
Jeff Johnson295189b2012-06-20 16:38:30 -07004243 if(eLIM_AP_ROLE == psessionEntry->limSystemRole)
4244 {
4245 if(overlap)
4246 {
4247 psessionEntry->gLimOverlap11gParams.protectionEnabled = true;
4248 //11g exists in overlap BSS.
4249 //need not to change the operating mode to overlap_legacy
4250 //if higher or same protection operating mode is enabled right now.
4251 if((eSIR_HT_OP_MODE_OVERLAP_LEGACY != psessionEntry->htOperMode) &&
4252 (eSIR_HT_OP_MODE_MIXED != psessionEntry->htOperMode))
4253 {
4254 psessionEntry->htOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
4255 }
4256 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05304257 limEnableHtOBSSProtection(pMac, true, overlap, pBeaconParams, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07004258 }
4259 else
4260 {
4261 //11g is associated to an AP operating in 11n mode.
4262 //Change the HT operating mode to 'mixed mode'.
4263 psessionEntry->gLim11gParams.protectionEnabled = true;
4264 if(eSIR_HT_OP_MODE_MIXED != psessionEntry->htOperMode)
4265 {
4266 psessionEntry->htOperMode = eSIR_HT_OP_MODE_MIXED;
4267 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05304268 limEnableHtOBSSProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07004269 }
4270 }
4271 }else if(eLIM_BT_AMP_AP_ROLE == psessionEntry->limSystemRole)
Jeff Johnson295189b2012-06-20 16:38:30 -07004272 {
4273 if(overlap)
4274 {
4275 pMac->lim.gLimOverlap11gParams.protectionEnabled = true;
4276 //11g exists in overlap BSS.
4277 //need not to change the operating mode to overlap_legacy
4278 //if higher or same protection operating mode is enabled right now.
4279 if((eSIR_HT_OP_MODE_OVERLAP_LEGACY != pMac->lim.gHTOperMode) &&
4280 (eSIR_HT_OP_MODE_MIXED != pMac->lim.gHTOperMode))
4281 {
4282 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
4283 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4284 }
4285 }
4286 else
4287 {
4288 //11g is associated to an AP operating in 11n mode.
4289 //Change the HT operating mode to 'mixed mode'.
4290 psessionEntry->gLim11gParams.protectionEnabled = true;
4291 if(eSIR_HT_OP_MODE_MIXED != pMac->lim.gHTOperMode)
4292 {
4293 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_MIXED;
4294 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05304295 limEnableHtOBSSProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07004296 }
4297 }
4298 }
4299
4300 //This part is common for staiton as well.
4301 if(false == psessionEntry->beaconParams.llgCoexist)
4302 {
4303 pBeaconParams->llgCoexist = psessionEntry->beaconParams.llgCoexist = true;
4304 pBeaconParams->paramChangeBitmap |= PARAM_llGCOEXIST_CHANGED;
4305 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004306 else if (true == psessionEntry->gLimOverlap11gParams.protectionEnabled)
4307 {
4308 // As operating mode changed after G station assoc some way to update beacon
4309 // This addresses the issue of mode not changing to - 11 in beacon when OBSS overlap is enabled
4310 //pMac->sch.schObject.fBeaconChanged = 1;
4311 pBeaconParams->paramChangeBitmap |= PARAM_llGCOEXIST_CHANGED;
4312 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004313 }
4314 else if (true == psessionEntry->beaconParams.llgCoexist)
4315 {
4316 //for AP role.
4317 //we need to take care of HT OP mode change if needed.
4318 //We need to take care of Overlap cases.
4319
Jeff Johnson295189b2012-06-20 16:38:30 -07004320 if(eLIM_AP_ROLE == psessionEntry->limSystemRole)
4321 {
4322 if(overlap)
4323 {
4324 //Overlap Legacy protection disabled.
4325 if (psessionEntry->gLim11gParams.numSta == 0)
4326 psessionEntry->gLimOverlap11gParams.protectionEnabled = false;
4327
4328 // no HT op mode change if any of the overlap protection enabled.
4329 if(!(psessionEntry->gLimOlbcParams.protectionEnabled ||
4330 psessionEntry->gLimOverlapHt20Params.protectionEnabled ||
4331 psessionEntry->gLimOverlapNonGfParams.protectionEnabled))
4332 {
4333 //Check if there is a need to change HT OP mode.
4334 if(eSIR_HT_OP_MODE_OVERLAP_LEGACY == psessionEntry->htOperMode)
4335 {
4336 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4337 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4338
4339 if(psessionEntry->gLimHt20Params.protectionEnabled){
4340 //Commenting because of CR 258588 WFA cert
4341 //psessionEntry->htOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4342 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
4343 }
4344 else
4345 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
4346 }
4347 }
4348 }
4349 else
4350 {
4351 //Disable protection from 11G stations.
4352 psessionEntry->gLim11gParams.protectionEnabled = false;
4353 //Check if any other non-HT protection enabled.
4354 if(!psessionEntry->gLim11bParams.protectionEnabled)
4355 {
4356
4357 //Right now we are in HT OP Mixed mode.
4358 //Change HT op mode appropriately.
4359 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4360
4361 //Change HT OP mode to 01 if any overlap protection enabled
4362 if(psessionEntry->gLimOlbcParams.protectionEnabled ||
4363 psessionEntry->gLimOverlap11gParams.protectionEnabled ||
4364 psessionEntry->gLimOverlapHt20Params.protectionEnabled ||
4365 psessionEntry->gLimOverlapNonGfParams.protectionEnabled)
4366
4367 {
4368 psessionEntry->htOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
4369 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4370 }
4371 else if(psessionEntry->gLimHt20Params.protectionEnabled)
4372 {
4373 //Commenting because of CR 258588 WFA cert
4374 //psessionEntry->htOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4375 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
4376 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4377 }
4378 else
4379 {
4380 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
4381 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4382 }
4383 }
4384 }
4385 if(!psessionEntry->gLimOverlap11gParams.protectionEnabled &&
4386 !psessionEntry->gLim11gParams.protectionEnabled)
4387 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004388 PELOG1(limLog(pMac, LOG1, FL("===> Protection from 11G Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004389 pBeaconParams->llgCoexist = psessionEntry->beaconParams.llgCoexist = false;
4390 pBeaconParams->paramChangeBitmap |= PARAM_llGCOEXIST_CHANGED;
4391 }
4392 }else if(eLIM_BT_AMP_AP_ROLE == psessionEntry->limSystemRole)
Jeff Johnson295189b2012-06-20 16:38:30 -07004393 {
4394 if(overlap)
4395 {
4396 //Overlap Legacy protection disabled.
4397 pMac->lim.gLimOverlap11gParams.protectionEnabled = false;
4398
4399 // no HT op mode change if any of the overlap protection enabled.
4400 if(!(psessionEntry->gLimOlbcParams.protectionEnabled ||
4401 psessionEntry->gLimOverlapHt20Params.protectionEnabled ||
4402 psessionEntry->gLimOverlapNonGfParams.protectionEnabled))
4403 {
4404 //Check if there is a need to change HT OP mode.
4405 if(eSIR_HT_OP_MODE_OVERLAP_LEGACY == pMac->lim.gHTOperMode)
4406 {
4407 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4408 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4409
4410 if(psessionEntry->gLimHt20Params.protectionEnabled)
4411 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4412 else
4413 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_PURE;
4414 }
4415 }
4416 }
4417 else
4418 {
4419 //Disable protection from 11G stations.
4420 psessionEntry->gLim11gParams.protectionEnabled = false;
4421 //Check if any other non-HT protection enabled.
4422 if(!psessionEntry->gLim11bParams.protectionEnabled)
4423 {
4424
4425 //Right now we are in HT OP Mixed mode.
4426 //Change HT op mode appropriately.
4427 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4428
4429 //Change HT OP mode to 01 if any overlap protection enabled
4430 if(psessionEntry->gLimOlbcParams.protectionEnabled ||
4431 pMac->lim.gLimOverlap11gParams.protectionEnabled ||
4432 pMac->lim.gLimOverlapHt20Params.protectionEnabled ||
4433 pMac->lim.gLimOverlapNonGfParams.protectionEnabled)
4434
4435 {
4436 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
4437 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4438 }
4439 else if(psessionEntry->gLimHt20Params.protectionEnabled)
4440 {
4441 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4442 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4443 }
4444 else
4445 {
4446 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_PURE;
4447 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4448 }
4449 }
4450 }
4451 if(!pMac->lim.gLimOverlap11gParams.protectionEnabled &&
4452 !psessionEntry->gLim11gParams.protectionEnabled)
4453 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004454 PELOG1(limLog(pMac, LOG1, FL("===> Protection from 11G Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004455 pBeaconParams->llgCoexist = psessionEntry->beaconParams.llgCoexist = false;
4456 pBeaconParams->paramChangeBitmap |= PARAM_llGCOEXIST_CHANGED;
4457 }
4458 }
4459 //for station role
4460 else
4461 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004462 PELOG1(limLog(pMac, LOG1, FL("===> Protection from 11G Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004463 pBeaconParams->llgCoexist = psessionEntry->beaconParams.llgCoexist = false;
4464 pBeaconParams->paramChangeBitmap |= PARAM_llGCOEXIST_CHANGED;
4465 }
4466 }
4467 return eSIR_SUCCESS;
4468}
4469//FIXME_PROTECTION : need to check for no APSD whenever we want to enable this protection.
4470//This check will be done at the caller.
4471
4472/** -------------------------------------------------------------
4473\fn limEnableHtObssProtection
4474\brief based on cofig enables\disables obss protection.
4475\param tANI_U8 enable : 1=> enable protection, 0=> disable protection.
4476\param tANI_U8 overlap: 1=> called from overlap context, 0 => called from assoc context.
4477\param tpUpdateBeaconParams pBeaconParams
4478\return None
4479 -------------------------------------------------------------*/
4480tSirRetStatus
4481limEnableHtOBSSProtection(tpAniSirGlobal pMac, tANI_U8 enable,
4482 tANI_U8 overlap, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry)
4483{
4484
4485
Jeff Johnsone7245742012-09-05 17:12:55 -07004486 if(!psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07004487 return eSIR_SUCCESS; // this protection is only for HT stations.
4488
4489 //overlapping protection configuration check.
4490 if(overlap)
4491 {
4492 //overlapping protection configuration check.
Jeff Johnson295189b2012-06-20 16:38:30 -07004493 }
4494 else
4495 {
4496 //normal protection config check
Jeff Johnson295189b2012-06-20 16:38:30 -07004497 if((psessionEntry->limSystemRole == eLIM_AP_ROLE) && !psessionEntry->cfgProtection.obss)
4498 { //ToDo Update this field
4499 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004500 PELOG1(limLog(pMac, LOG1, FL("protection from Obss is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004501 return eSIR_SUCCESS;
4502 }else if(psessionEntry->limSystemRole != eLIM_AP_ROLE)
Jeff Johnson295189b2012-06-20 16:38:30 -07004503 {
4504 if(!pMac->lim.cfgProtection.obss)
4505 { //ToDo Update this field
4506 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004507 PELOG1(limLog(pMac, LOG1, FL("protection from Obss is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004508 return eSIR_SUCCESS;
4509 }
4510 }
4511 }
4512
4513
Jeff Johnson295189b2012-06-20 16:38:30 -07004514 if (eLIM_AP_ROLE == psessionEntry->limSystemRole){
4515 if ((enable) && (false == psessionEntry->beaconParams.gHTObssMode) )
4516 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004517 PELOG1(limLog(pMac, LOG1, FL("=>obss protection enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004518 psessionEntry->beaconParams.gHTObssMode = true;
4519 pBeaconParams->paramChangeBitmap |= PARAM_OBSS_MODE_CHANGED; // UPDATE AN ENUM FOR OBSS MODE <todo>
4520
4521 }
4522 else if (!enable && (true == psessionEntry->beaconParams.gHTObssMode))
4523 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004524 PELOG1(limLog(pMac, LOG1, FL("===> obss Protection disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004525 psessionEntry->beaconParams.gHTObssMode = false;
4526 pBeaconParams->paramChangeBitmap |= PARAM_OBSS_MODE_CHANGED;
4527
4528 }
4529//CR-263021: OBSS bit is not switching back to 0 after disabling the overlapping legacy BSS
4530 if (!enable && !overlap)
4531 {
4532 psessionEntry->gLimOverlap11gParams.protectionEnabled = false;
4533 }
4534 } else
Jeff Johnson295189b2012-06-20 16:38:30 -07004535 {
4536 if ((enable) && (false == psessionEntry->beaconParams.gHTObssMode) )
4537 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004538 PELOG1(limLog(pMac, LOG1, FL("=>obss protection enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004539 psessionEntry->beaconParams.gHTObssMode = true;
4540 pBeaconParams->paramChangeBitmap |= PARAM_OBSS_MODE_CHANGED; // UPDATE AN ENUM FOR OBSS MODE <todo>
4541
4542 }
4543 else if (!enable && (true == psessionEntry->beaconParams.gHTObssMode))
4544 {
4545
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004546 PELOG1(limLog(pMac, LOG1, FL("===> obss Protection disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004547 psessionEntry->beaconParams.gHTObssMode = false;
4548 pBeaconParams->paramChangeBitmap |= PARAM_OBSS_MODE_CHANGED;
4549
4550 }
4551 }
4552 return eSIR_SUCCESS;
4553}
4554/** -------------------------------------------------------------
4555\fn limEnableHT20Protection
4556\brief based on cofig enables\disables protection from Ht20.
4557\param tANI_U8 enable : 1=> enable protection, 0=> disable protection.
4558\param tANI_U8 overlap: 1=> called from overlap context, 0 => called from assoc context.
4559\param tpUpdateBeaconParams pBeaconParams
4560\return None
4561 -------------------------------------------------------------*/
4562tSirRetStatus
4563limEnableHT20Protection(tpAniSirGlobal pMac, tANI_U8 enable,
4564 tANI_U8 overlap, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry)
4565{
Jeff Johnsone7245742012-09-05 17:12:55 -07004566 if(!psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07004567 return eSIR_SUCCESS; // this protection is only for HT stations.
4568
4569 //overlapping protection configuration check.
4570 if(overlap)
4571 {
Jeff Johnson295189b2012-06-20 16:38:30 -07004572 }
4573 else
4574 {
4575 //normal protection config check
Jeff Johnson295189b2012-06-20 16:38:30 -07004576 if((psessionEntry->limSystemRole == eLIM_AP_ROLE ) &&
4577 !psessionEntry->cfgProtection.ht20)
4578 {
4579 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004580 PELOG3(limLog(pMac, LOG3, FL("protection from HT20 is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004581 return eSIR_SUCCESS;
4582 }else if(psessionEntry->limSystemRole != eLIM_AP_ROLE )
Jeff Johnson295189b2012-06-20 16:38:30 -07004583 {
4584 if(!pMac->lim.cfgProtection.ht20)
4585 {
4586 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004587 PELOG3(limLog(pMac, LOG3, FL("protection from HT20 is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004588 return eSIR_SUCCESS;
4589 }
4590 }
4591 }
4592
4593 if (enable)
4594 {
4595 //If we are AP and HT capable, we need to set the HT OP mode
4596 //appropriately.
4597
Jeff Johnson295189b2012-06-20 16:38:30 -07004598 if(eLIM_AP_ROLE == psessionEntry->limSystemRole){
4599 if(overlap)
4600 {
4601 psessionEntry->gLimOverlapHt20Params.protectionEnabled = true;
4602 if((eSIR_HT_OP_MODE_OVERLAP_LEGACY != psessionEntry->htOperMode) &&
4603 (eSIR_HT_OP_MODE_MIXED != psessionEntry->htOperMode))
4604 {
4605 psessionEntry->htOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
4606 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4607 }
4608 }
4609 else
4610 {
4611 psessionEntry->gLimHt20Params.protectionEnabled = true;
4612 if(eSIR_HT_OP_MODE_PURE == psessionEntry->htOperMode)
4613 {
4614 //Commenting because of CR 258588 WFA cert
4615 //psessionEntry->htOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4616 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
4617 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4618 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4619 }
4620 }
4621 }else if(eLIM_BT_AMP_AP_ROLE == psessionEntry->limSystemRole)
Jeff Johnson295189b2012-06-20 16:38:30 -07004622 {
4623 if(overlap)
4624 {
4625 pMac->lim.gLimOverlapHt20Params.protectionEnabled = true;
4626 if((eSIR_HT_OP_MODE_OVERLAP_LEGACY != pMac->lim.gHTOperMode) &&
4627 (eSIR_HT_OP_MODE_MIXED != pMac->lim.gHTOperMode))
4628 {
4629 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
4630 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4631 }
4632 }
4633 else
4634 {
4635 psessionEntry->gLimHt20Params.protectionEnabled = true;
4636 if(eSIR_HT_OP_MODE_PURE == pMac->lim.gHTOperMode)
4637 {
4638 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4639 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4640 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4641 }
4642 }
4643 }
4644
4645 //This part is common for staiton as well.
4646 if(false == psessionEntry->beaconParams.ht20Coexist)
4647 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004648 PELOG1(limLog(pMac, LOG1, FL("=> Prtection from HT20 Enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004649 pBeaconParams->ht20MhzCoexist = psessionEntry->beaconParams.ht20Coexist = true;
4650 pBeaconParams->paramChangeBitmap |= PARAM_HT20MHZCOEXIST_CHANGED;
4651 }
4652 }
4653 else if (true == psessionEntry->beaconParams.ht20Coexist)
4654 {
4655 //for AP role.
4656 //we need to take care of HT OP mode change if needed.
4657 //We need to take care of Overlap cases.
Jeff Johnson295189b2012-06-20 16:38:30 -07004658 if(eLIM_AP_ROLE == psessionEntry->limSystemRole){
4659 if(overlap)
4660 {
4661 //Overlap Legacy protection disabled.
4662 psessionEntry->gLimOverlapHt20Params.protectionEnabled = false;
4663
4664 // no HT op mode change if any of the overlap protection enabled.
4665 if(!(psessionEntry->gLimOlbcParams.protectionEnabled ||
4666 psessionEntry->gLimOverlap11gParams.protectionEnabled ||
4667 psessionEntry->gLimOverlapHt20Params.protectionEnabled ||
4668 psessionEntry->gLimOverlapNonGfParams.protectionEnabled))
4669 {
4670
4671 //Check if there is a need to change HT OP mode.
4672 if(eSIR_HT_OP_MODE_OVERLAP_LEGACY == psessionEntry->htOperMode)
4673 {
4674 if(psessionEntry->gLimHt20Params.protectionEnabled)
4675 {
4676 //Commented beacuse of CR 258588 for WFA Cert
4677 //psessionEntry->htOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4678 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
4679 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4680 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4681 }
4682 else
4683 {
4684 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
4685 }
4686 }
4687 }
4688 }
4689 else
4690 {
4691 //Disable protection from 11G stations.
4692 psessionEntry->gLimHt20Params.protectionEnabled = false;
4693
4694 //Change HT op mode appropriately.
4695 if(eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT == psessionEntry->htOperMode)
4696 {
4697 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
4698 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4699 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4700 }
4701 }
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004702 PELOG1(limLog(pMac, LOG1, FL("===> Protection from HT 20 Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004703 pBeaconParams->ht20MhzCoexist = psessionEntry->beaconParams.ht20Coexist = false;
4704 pBeaconParams->paramChangeBitmap |= PARAM_HT20MHZCOEXIST_CHANGED;
4705 }else if(eLIM_BT_AMP_AP_ROLE == psessionEntry->limSystemRole)
Jeff Johnson295189b2012-06-20 16:38:30 -07004706 {
4707 if(overlap)
4708 {
4709 //Overlap Legacy protection disabled.
4710 pMac->lim.gLimOverlapHt20Params.protectionEnabled = false;
4711
4712 // no HT op mode change if any of the overlap protection enabled.
4713 if(!(psessionEntry->gLimOlbcParams.protectionEnabled ||
4714 pMac->lim.gLimOverlap11gParams.protectionEnabled ||
4715 pMac->lim.gLimOverlapHt20Params.protectionEnabled ||
4716 pMac->lim.gLimOverlapNonGfParams.protectionEnabled))
4717 {
4718
4719 //Check if there is a need to change HT OP mode.
4720 if(eSIR_HT_OP_MODE_OVERLAP_LEGACY == pMac->lim.gHTOperMode)
4721 {
4722 if(psessionEntry->gLimHt20Params.protectionEnabled)
4723 {
4724 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4725 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4726 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4727 }
4728 else
4729 {
4730 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_PURE;
4731 }
4732 }
4733 }
4734 }
4735 else
4736 {
4737 //Disable protection from 11G stations.
4738 psessionEntry->gLimHt20Params.protectionEnabled = false;
4739
4740 //Change HT op mode appropriately.
4741 if(eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT == pMac->lim.gHTOperMode)
4742 {
4743 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_PURE;
4744 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4745 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4746 }
4747 }
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004748 PELOG1(limLog(pMac, LOG1, FL("===> Protection from HT 20 Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004749 pBeaconParams->ht20MhzCoexist = psessionEntry->beaconParams.ht20Coexist = false;
4750 pBeaconParams->paramChangeBitmap |= PARAM_HT20MHZCOEXIST_CHANGED;
4751 }
4752 //for station role
4753 else
4754 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004755 PELOG1(limLog(pMac, LOG1, FL("===> Protection from HT20 Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004756 pBeaconParams->ht20MhzCoexist = psessionEntry->beaconParams.ht20Coexist = false;
4757 pBeaconParams->paramChangeBitmap |= PARAM_HT20MHZCOEXIST_CHANGED;
4758 }
4759 }
4760
4761 return eSIR_SUCCESS;
4762}
4763
4764/** -------------------------------------------------------------
4765\fn limEnableHTNonGfProtection
4766\brief based on cofig enables\disables protection from NonGf.
4767\param tANI_U8 enable : 1=> enable protection, 0=> disable protection.
4768\param tANI_U8 overlap: 1=> called from overlap context, 0 => called from assoc context.
4769\param tpUpdateBeaconParams pBeaconParams
4770\return None
4771 -------------------------------------------------------------*/
4772tSirRetStatus
4773limEnableHTNonGfProtection(tpAniSirGlobal pMac, tANI_U8 enable,
4774 tANI_U8 overlap, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry)
4775{
Jeff Johnsone7245742012-09-05 17:12:55 -07004776 if(!psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07004777 return eSIR_SUCCESS; // this protection is only for HT stations.
4778
4779 //overlapping protection configuration check.
4780 if(overlap)
4781 {
Jeff Johnson295189b2012-06-20 16:38:30 -07004782 }
4783 else
4784 {
Jeff Johnson295189b2012-06-20 16:38:30 -07004785 //normal protection config check
4786 if((psessionEntry->limSystemRole == eLIM_AP_ROLE ) &&
4787 !psessionEntry->cfgProtection.nonGf)
4788 {
4789 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004790 PELOG3(limLog(pMac, LOG3, FL("protection from NonGf is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004791 return eSIR_SUCCESS;
4792 }else if(psessionEntry->limSystemRole != eLIM_AP_ROLE)
Jeff Johnson295189b2012-06-20 16:38:30 -07004793 {
4794 //normal protection config check
4795 if(!pMac->lim.cfgProtection.nonGf)
4796 {
4797 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004798 PELOG3(limLog(pMac, LOG3, FL("protection from NonGf is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004799 return eSIR_SUCCESS;
4800 }
4801 }
4802 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004803 if(psessionEntry->limSystemRole == eLIM_AP_ROLE){
4804 if ((enable) && (false == psessionEntry->beaconParams.llnNonGFCoexist))
4805 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004806 PELOG1(limLog(pMac, LOG1, FL(" => Prtection from non GF Enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004807 pBeaconParams->llnNonGFCoexist = psessionEntry->beaconParams.llnNonGFCoexist = true;
4808 pBeaconParams->paramChangeBitmap |= PARAM_NON_GF_DEVICES_PRESENT_CHANGED;
4809 }
4810 else if (!enable && (true == psessionEntry->beaconParams.llnNonGFCoexist))
4811 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004812 PELOG1(limLog(pMac, LOG1, FL("===> Protection from Non GF Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004813 pBeaconParams->llnNonGFCoexist = psessionEntry->beaconParams.llnNonGFCoexist = false;
4814 pBeaconParams->paramChangeBitmap |= PARAM_NON_GF_DEVICES_PRESENT_CHANGED;
4815 }
4816 }else
Jeff Johnson295189b2012-06-20 16:38:30 -07004817 {
4818 if ((enable) && (false == psessionEntry->beaconParams.llnNonGFCoexist))
4819 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004820 PELOG1(limLog(pMac, LOG1, FL(" => Prtection from non GF Enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004821 pBeaconParams->llnNonGFCoexist = psessionEntry->beaconParams.llnNonGFCoexist = true;
4822 pBeaconParams->paramChangeBitmap |= PARAM_NON_GF_DEVICES_PRESENT_CHANGED;
4823 }
4824 else if (!enable && (true == psessionEntry->beaconParams.llnNonGFCoexist))
4825 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004826 PELOG1(limLog(pMac, LOG1, FL("===> Protection from Non GF Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004827 pBeaconParams->llnNonGFCoexist = psessionEntry->beaconParams.llnNonGFCoexist = false;
4828 pBeaconParams->paramChangeBitmap |= PARAM_NON_GF_DEVICES_PRESENT_CHANGED;
4829 }
4830 }
4831
4832 return eSIR_SUCCESS;
4833}
4834
4835/** -------------------------------------------------------------
4836\fn limEnableHTLsigTxopProtection
4837\brief based on cofig enables\disables LsigTxop protection.
4838\param tANI_U8 enable : 1=> enable protection, 0=> disable protection.
4839\param tANI_U8 overlap: 1=> called from overlap context, 0 => called from assoc context.
4840\param tpUpdateBeaconParams pBeaconParams
4841\return None
4842 -------------------------------------------------------------*/
4843tSirRetStatus
4844limEnableHTLsigTxopProtection(tpAniSirGlobal pMac, tANI_U8 enable,
4845 tANI_U8 overlap, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry)
4846{
Jeff Johnsone7245742012-09-05 17:12:55 -07004847 if(!psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07004848 return eSIR_SUCCESS; // this protection is only for HT stations.
4849
4850 //overlapping protection configuration check.
4851 if(overlap)
4852 {
Jeff Johnson295189b2012-06-20 16:38:30 -07004853 }
4854 else
4855 {
Jeff Johnson295189b2012-06-20 16:38:30 -07004856 //normal protection config check
4857 if((psessionEntry->limSystemRole == eLIM_AP_ROLE ) &&
4858 !psessionEntry->cfgProtection.lsigTxop)
4859 {
4860 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004861 PELOG3(limLog(pMac, LOG3, FL(" protection from LsigTxop not supported is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004862 return eSIR_SUCCESS;
4863 }else if(psessionEntry->limSystemRole != eLIM_AP_ROLE)
Jeff Johnson295189b2012-06-20 16:38:30 -07004864 {
4865 //normal protection config check
4866 if(!pMac->lim.cfgProtection.lsigTxop)
4867 {
4868 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004869 PELOG3(limLog(pMac, LOG3, FL(" protection from LsigTxop not supported is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004870 return eSIR_SUCCESS;
4871 }
4872 }
4873 }
4874
4875
Jeff Johnson295189b2012-06-20 16:38:30 -07004876 if(psessionEntry->limSystemRole == eLIM_AP_ROLE){
4877 if ((enable) && (false == psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport))
4878 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004879 PELOG1(limLog(pMac, LOG1, FL(" => Prtection from LsigTxop Enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004880 pBeaconParams->fLsigTXOPProtectionFullSupport = psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport = true;
4881 pBeaconParams->paramChangeBitmap |= PARAM_LSIG_TXOP_FULL_SUPPORT_CHANGED;
4882 }
4883 else if (!enable && (true == psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport))
4884 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004885 PELOG1(limLog(pMac, LOG1, FL("===> Protection from LsigTxop Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004886 pBeaconParams->fLsigTXOPProtectionFullSupport= psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport = false;
4887 pBeaconParams->paramChangeBitmap |= PARAM_LSIG_TXOP_FULL_SUPPORT_CHANGED;
4888 }
4889 }else
Jeff Johnson295189b2012-06-20 16:38:30 -07004890 {
4891 if ((enable) && (false == psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport))
4892 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004893 PELOG1(limLog(pMac, LOG1, FL(" => Prtection from LsigTxop Enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004894 pBeaconParams->fLsigTXOPProtectionFullSupport = psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport = true;
4895 pBeaconParams->paramChangeBitmap |= PARAM_LSIG_TXOP_FULL_SUPPORT_CHANGED;
4896 }
4897 else if (!enable && (true == psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport))
4898 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004899 PELOG1(limLog(pMac, LOG1, FL("===> Protection from LsigTxop Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004900 pBeaconParams->fLsigTXOPProtectionFullSupport= psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport = false;
4901 pBeaconParams->paramChangeBitmap |= PARAM_LSIG_TXOP_FULL_SUPPORT_CHANGED;
4902 }
4903 }
4904 return eSIR_SUCCESS;
4905}
4906//FIXME_PROTECTION : need to check for no APSD whenever we want to enable this protection.
4907//This check will be done at the caller.
4908/** -------------------------------------------------------------
4909\fn limEnableHtRifsProtection
4910\brief based on cofig enables\disables Rifs protection.
4911\param tANI_U8 enable : 1=> enable protection, 0=> disable protection.
4912\param tANI_U8 overlap: 1=> called from overlap context, 0 => called from assoc context.
4913\param tpUpdateBeaconParams pBeaconParams
4914\return None
4915 -------------------------------------------------------------*/
4916tSirRetStatus
4917limEnableHtRifsProtection(tpAniSirGlobal pMac, tANI_U8 enable,
4918 tANI_U8 overlap, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry)
4919{
Jeff Johnsone7245742012-09-05 17:12:55 -07004920 if(!psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07004921 return eSIR_SUCCESS; // this protection is only for HT stations.
4922
4923
4924 //overlapping protection configuration check.
4925 if(overlap)
4926 {
Jeff Johnson295189b2012-06-20 16:38:30 -07004927 }
4928 else
4929 {
Jeff Johnson295189b2012-06-20 16:38:30 -07004930 //normal protection config check
4931 if((psessionEntry->limSystemRole == eLIM_AP_ROLE) &&
4932 !psessionEntry->cfgProtection.rifs)
4933 {
4934 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004935 PELOG3(limLog(pMac, LOG3, FL(" protection from Rifs is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004936 return eSIR_SUCCESS;
4937 }else if(psessionEntry->limSystemRole != eLIM_AP_ROLE )
Jeff Johnson295189b2012-06-20 16:38:30 -07004938 {
4939 //normal protection config check
4940 if(!pMac->lim.cfgProtection.rifs)
4941 {
4942 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004943 PELOG3(limLog(pMac, LOG3, FL(" protection from Rifs is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004944 return eSIR_SUCCESS;
4945 }
4946 }
4947 }
4948
Jeff Johnson295189b2012-06-20 16:38:30 -07004949 if(psessionEntry->limSystemRole == eLIM_AP_ROLE){
4950 // Disabling the RIFS Protection means Enable the RIFS mode of operation in the BSS
4951 if ((!enable) && (false == psessionEntry->beaconParams.fRIFSMode))
4952 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004953 PELOG1(limLog(pMac, LOG1, FL(" => Rifs protection Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004954 pBeaconParams->fRIFSMode = psessionEntry->beaconParams.fRIFSMode = true;
4955 pBeaconParams->paramChangeBitmap |= PARAM_RIFS_MODE_CHANGED;
4956 }
4957 // Enabling the RIFS Protection means Disable the RIFS mode of operation in the BSS
4958 else if (enable && (true == psessionEntry->beaconParams.fRIFSMode))
4959 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004960 PELOG1(limLog(pMac, LOG1, FL("===> Rifs Protection Enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004961 pBeaconParams->fRIFSMode = psessionEntry->beaconParams.fRIFSMode = false;
4962 pBeaconParams->paramChangeBitmap |= PARAM_RIFS_MODE_CHANGED;
4963 }
4964 }else
Jeff Johnson295189b2012-06-20 16:38:30 -07004965 {
4966 // Disabling the RIFS Protection means Enable the RIFS mode of operation in the BSS
4967 if ((!enable) && (false == psessionEntry->beaconParams.fRIFSMode))
4968 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004969 PELOG1(limLog(pMac, LOG1, FL(" => Rifs protection Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004970 pBeaconParams->fRIFSMode = psessionEntry->beaconParams.fRIFSMode = true;
4971 pBeaconParams->paramChangeBitmap |= PARAM_RIFS_MODE_CHANGED;
4972 }
4973 // Enabling the RIFS Protection means Disable the RIFS mode of operation in the BSS
4974 else if (enable && (true == psessionEntry->beaconParams.fRIFSMode))
4975 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004976 PELOG1(limLog(pMac, LOG1, FL("===> Rifs Protection Enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004977 pBeaconParams->fRIFSMode = psessionEntry->beaconParams.fRIFSMode = false;
4978 pBeaconParams->paramChangeBitmap |= PARAM_RIFS_MODE_CHANGED;
4979 }
4980 }
4981 return eSIR_SUCCESS;
4982}
4983
4984// ---------------------------------------------------------------------
4985/**
4986 * limEnableShortPreamble
4987 *
4988 * FUNCTION:
4989 * Enable/Disable short preamble
4990 *
4991 * LOGIC:
4992 *
4993 * ASSUMPTIONS:
4994 *
4995 * NOTE:
4996 *
4997 * @param enable Flag to enable/disable short preamble
4998 * @return None
4999 */
5000
5001tSirRetStatus
5002limEnableShortPreamble(tpAniSirGlobal pMac, tANI_U8 enable, tpUpdateBeaconParams pBeaconParams, tpPESession psessionEntry)
5003{
5004 tANI_U32 val;
5005
5006 if (wlan_cfgGetInt(pMac, WNI_CFG_SHORT_PREAMBLE, &val) != eSIR_SUCCESS)
5007 {
5008 /* Could not get short preamble enabled flag from CFG. Log error. */
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005009 limLog(pMac, LOGP, FL("could not retrieve short preamble flag"));
Jeff Johnson295189b2012-06-20 16:38:30 -07005010 return eSIR_FAILURE;
5011 }
5012
5013 if (!val)
5014 return eSIR_SUCCESS;
5015
5016 if (wlan_cfgGetInt(pMac, WNI_CFG_11G_SHORT_PREAMBLE_ENABLED, &val) != eSIR_SUCCESS)
5017 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005018 limLog(pMac, LOGP, FL("could not retrieve 11G short preamble switching enabled flag"));
Jeff Johnson295189b2012-06-20 16:38:30 -07005019 return eSIR_FAILURE;
5020 }
5021
5022 if (!val) // 11G short preamble switching is disabled.
5023 return eSIR_SUCCESS;
5024
5025 if ( psessionEntry->limSystemRole == eLIM_AP_ROLE )
5026 {
5027 if (enable && (psessionEntry->beaconParams.fShortPreamble == 0))
5028 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005029 PELOG1(limLog(pMac, LOG1, FL("===> Short Preamble Enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005030 psessionEntry->beaconParams.fShortPreamble = true;
5031 pBeaconParams->fShortPreamble = (tANI_U8) psessionEntry->beaconParams.fShortPreamble;
5032 pBeaconParams->paramChangeBitmap |= PARAM_SHORT_PREAMBLE_CHANGED;
5033 }
5034 else if (!enable && (psessionEntry->beaconParams.fShortPreamble == 1))
5035 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005036 PELOG1(limLog(pMac, LOG1, FL("===> Short Preamble Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005037 psessionEntry->beaconParams.fShortPreamble = false;
5038 pBeaconParams->fShortPreamble = (tANI_U8) psessionEntry->beaconParams.fShortPreamble;
5039 pBeaconParams->paramChangeBitmap |= PARAM_SHORT_PREAMBLE_CHANGED;
5040 }
5041 }
5042
5043 return eSIR_SUCCESS;
5044 }
5045
5046/**
5047 * limTxComplete
5048 *
5049 * Function:
5050 * This is LIM's very own "TX MGMT frame complete" completion routine.
5051 *
5052 * Logic:
5053 * LIM wants to send a MGMT frame (broadcast or unicast)
5054 * LIM allocates memory using palPktAlloc( ..., **pData, **pPacket )
5055 * LIM transmits the MGMT frame using the API:
5056 * halTxFrame( ... pPacket, ..., (void *) limTxComplete, pData )
5057 * HDD, via halTxFrame/DXE, "transfers" the packet over to BMU
5058 * HDD, if it determines that a TX completion routine (in this case
5059 * limTxComplete) has been provided, will invoke this callback
5060 * LIM will try to free the TX MGMT packet that was earlier allocated, in order
5061 * to send this MGMT frame, using the PAL API palPktFree( ... pData, pPacket )
5062 *
5063 * Assumptions:
5064 * Presently, this is ONLY being used for MGMT frames/packets
5065 * TODO:
5066 * Would it do good for LIM to have some sort of "signature" validation to
5067 * ensure that the pData argument passed in was a buffer that was actually
5068 * allocated by LIM and/or is not corrupted?
5069 *
5070 * Note: FIXME and TODO
5071 * Looks like palPktFree() is interested in pPacket. But, when this completion
5072 * routine is called, only pData is made available to LIM!!
5073 *
5074 * @param void A pointer to pData. Shouldn't it be pPacket?!
5075 *
5076 * @return none
5077 */
5078void limTxComplete( tHalHandle hHal, void *pData )
5079{
5080 tpAniSirGlobal pMac;
5081 pMac = (tpAniSirGlobal)hHal;
5082
5083#ifdef FIXME_PRIMA
5084 /* the trace logic needs to be fixed for Prima. Refer to CR 306075 */
5085#ifdef TRACE_RECORD
5086 {
5087 tpSirMacMgmtHdr mHdr;
5088 v_U8_t *pRxBd;
5089 vos_pkt_t *pVosPkt;
5090 VOS_STATUS vosStatus;
5091
5092
5093
5094 pVosPkt = (vos_pkt_t *)pData;
5095 vosStatus = vos_pkt_peek_data( pVosPkt, 0, (v_PVOID_t *)&pRxBd, WLANHAL_RX_BD_HEADER_SIZE);
5096
5097 if(VOS_IS_STATUS_SUCCESS(vosStatus))
5098 {
5099 mHdr = WDA_GET_RX_MAC_HEADER(pRxBd);
Jeff Johnsone7245742012-09-05 17:12:55 -07005100 MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE, NO_SESSION, mHdr->fc.subType);)
Jeff Johnson295189b2012-06-20 16:38:30 -07005101
5102 }
5103 }
5104#endif
5105#endif
5106
5107 palPktFree( pMac->hHdd,
5108 HAL_TXRX_FRM_802_11_MGMT,
5109 (void *) NULL, // this is ignored and will likely be removed from this API
5110 (void *) pData ); // lim passed in pPacket in the pData pointer that is given in this completion routine
5111}
5112
5113/**
5114 * \brief This function updates lim global structure, if CB parameters in the BSS
5115 * have changed, and sends an indication to HAL also with the
5116 * updated HT Parameters.
5117 * This function does not detect the change in the primary channel, that is done as part
5118 * of channel Swtich IE processing.
5119 * If STA is configured with '20Mhz only' mode, then this function does not do anything
5120 * This function changes the CB mode, only if the self capability is set to '20 as well as 40Mhz'
5121 *
5122 *
5123 * \param pMac Pointer to global MAC structure
5124 *
5125 * \param pRcvdHTInfo Pointer to HT Info IE obtained from a Beacon or
5126 * Probe Response
5127 *
5128 * \param bssIdx BSS Index of the Bss to which Station is associated.
5129 *
5130 *
5131 */
5132
5133void limUpdateStaRunTimeHTSwitchChnlParams( tpAniSirGlobal pMac,
5134 tDot11fIEHTInfo *pHTInfo,
5135 tANI_U8 bssIdx,
5136 tpPESession psessionEntry)
5137{
Jeff Johnsone7245742012-09-05 17:12:55 -07005138 ePhyChanBondState secondaryChnlOffset = PHY_SINGLE_CHANNEL_CENTERED;
Jeff Johnson295189b2012-06-20 16:38:30 -07005139#if !defined WLAN_FEATURE_VOWIFI
5140 tANI_U32 localPwrConstraint;
5141#endif
5142
5143 //If self capability is set to '20Mhz only', then do not change the CB mode.
Jeff Johnson295189b2012-06-20 16:38:30 -07005144 if( !limGetHTCapability( pMac, eHT_SUPPORTED_CHANNEL_WIDTH_SET, psessionEntry ))
Jeff Johnson295189b2012-06-20 16:38:30 -07005145 return;
5146
5147#if !defined WLAN_FEATURE_VOWIFI
5148 if(wlan_cfgGetInt(pMac, WNI_CFG_LOCAL_POWER_CONSTRAINT, &localPwrConstraint) != eSIR_SUCCESS) {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005149 limLog( pMac, LOGP, FL( "Unable to get Local Power Constraint from cfg" ));
Jeff Johnson295189b2012-06-20 16:38:30 -07005150 return;
5151 }
5152#endif
5153
Jeff Johnsone7245742012-09-05 17:12:55 -07005154 if ( psessionEntry->htSecondaryChannelOffset != ( tANI_U8 ) pHTInfo->secondaryChannelOffset ||
5155 psessionEntry->htRecommendedTxWidthSet != ( tANI_U8 ) pHTInfo->recommendedTxWidthSet )
Jeff Johnson295189b2012-06-20 16:38:30 -07005156 {
Jeff Johnsone7245742012-09-05 17:12:55 -07005157 psessionEntry->htSecondaryChannelOffset = ( ePhyChanBondState ) pHTInfo->secondaryChannelOffset;
5158 psessionEntry->htRecommendedTxWidthSet = ( tANI_U8 ) pHTInfo->recommendedTxWidthSet;
5159 if ( eHT_CHANNEL_WIDTH_40MHZ == psessionEntry->htRecommendedTxWidthSet )
5160 secondaryChnlOffset = (ePhyChanBondState)pHTInfo->secondaryChannelOffset;
Jeff Johnson295189b2012-06-20 16:38:30 -07005161
5162 // Notify HAL
5163 limLog( pMac, LOGW, FL( "Channel Information in HT IE change"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005164 "d; sending notification to HAL." ) );
Jeff Johnson295189b2012-06-20 16:38:30 -07005165 limLog( pMac, LOGW, FL( "Primary Channel: %d, Secondary Chan"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005166 "nel Offset: %d, Channel Width: %d" ),
Jeff Johnson295189b2012-06-20 16:38:30 -07005167 pHTInfo->primaryChannel, secondaryChnlOffset,
Jeff Johnsone7245742012-09-05 17:12:55 -07005168 psessionEntry->htRecommendedTxWidthSet );
Madan Mohan Koyyalamudifd322a02012-10-05 12:01:26 -07005169 psessionEntry->channelChangeReasonCode=LIM_SWITCH_CHANNEL_OPERATION;
5170 pMac->lim.gpchangeChannelCallback = NULL;
5171 pMac->lim.gpchangeChannelData = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07005172
5173#if defined WLAN_FEATURE_VOWIFI
5174 limSendSwitchChnlParams( pMac, ( tANI_U8 ) pHTInfo->primaryChannel,
5175 secondaryChnlOffset, psessionEntry->maxTxPower, psessionEntry->peSessionId);
5176#else
5177 limSendSwitchChnlParams( pMac, ( tANI_U8 ) pHTInfo->primaryChannel,
5178 secondaryChnlOffset, (tPowerdBm)localPwrConstraint, psessionEntry->peSessionId);
5179#endif
5180
5181 //In case of IBSS, if STA should update HT Info IE in its beacons.
5182 if (eLIM_STA_IN_IBSS_ROLE == psessionEntry->limSystemRole)
5183 {
5184 schSetFixedBeaconFields(pMac,psessionEntry);
5185 }
5186
5187 }
5188} // End limUpdateStaRunTimeHTParams.
5189
5190/**
5191 * \brief This function updates the lim global structure, if any of the
5192 * HT Capabilities have changed.
5193 *
5194 *
5195 * \param pMac Pointer to Global MAC structure
5196 *
5197 * \param pHTCapability Pointer to HT Capability Information Element
5198 * obtained from a Beacon or Probe Response
5199 *
5200 *
5201 *
5202 */
5203
5204void limUpdateStaRunTimeHTCapability( tpAniSirGlobal pMac,
5205 tDot11fIEHTCaps *pHTCaps )
5206{
5207
5208 if ( pMac->lim.gHTLsigTXOPProtection != ( tANI_U8 ) pHTCaps->lsigTXOPProtection )
5209 {
5210 pMac->lim.gHTLsigTXOPProtection = ( tANI_U8 ) pHTCaps->lsigTXOPProtection;
5211 // Send change notification to HAL
5212 }
5213
5214 if ( pMac->lim.gHTAMpduDensity != ( tANI_U8 ) pHTCaps->mpduDensity )
5215 {
5216 pMac->lim.gHTAMpduDensity = ( tANI_U8 ) pHTCaps->mpduDensity;
5217 // Send change notification to HAL
5218 }
5219
5220 if ( pMac->lim.gHTMaxRxAMpduFactor != ( tANI_U8 ) pHTCaps->maxRxAMPDUFactor )
5221 {
5222 pMac->lim.gHTMaxRxAMpduFactor = ( tANI_U8 ) pHTCaps->maxRxAMPDUFactor;
5223 // Send change notification to HAL
5224 }
5225
5226
5227} // End limUpdateStaRunTimeHTCapability.
5228
5229/**
5230 * \brief This function updates lim global structure, if any of the HT
5231 * Info Parameters have changed.
5232 *
5233 *
5234 * \param pMac Pointer to the global MAC structure
5235 *
5236 * \param pHTInfo Pointer to the HT Info IE obtained from a Beacon or
5237 * Probe Response
5238 *
5239 *
5240 */
5241
5242void limUpdateStaRunTimeHTInfo( tpAniSirGlobal pMac,
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305243 tDot11fIEHTInfo *pHTInfo, tpPESession psessionEntry)
Jeff Johnson295189b2012-06-20 16:38:30 -07005244{
Jeff Johnsone7245742012-09-05 17:12:55 -07005245 if ( psessionEntry->htRecommendedTxWidthSet != ( tANI_U8 )pHTInfo->recommendedTxWidthSet )
Jeff Johnson295189b2012-06-20 16:38:30 -07005246 {
Jeff Johnsone7245742012-09-05 17:12:55 -07005247 psessionEntry->htRecommendedTxWidthSet = ( tANI_U8 )pHTInfo->recommendedTxWidthSet;
Jeff Johnson295189b2012-06-20 16:38:30 -07005248 // Send change notification to HAL
5249 }
5250
5251 if ( psessionEntry->beaconParams.fRIFSMode != ( tANI_U8 )pHTInfo->rifsMode )
5252 {
5253 psessionEntry->beaconParams.fRIFSMode = ( tANI_U8 )pHTInfo->rifsMode;
5254 // Send change notification to HAL
5255 }
5256
5257 if ( pMac->lim.gHTServiceIntervalGranularity != ( tANI_U8 )pHTInfo->serviceIntervalGranularity )
5258 {
5259 pMac->lim.gHTServiceIntervalGranularity = ( tANI_U8 )pHTInfo->serviceIntervalGranularity;
5260 // Send change notification to HAL
5261 }
5262
5263 if ( pMac->lim.gHTOperMode != ( tSirMacHTOperatingMode )pHTInfo->opMode )
5264 {
5265 pMac->lim.gHTOperMode = ( tSirMacHTOperatingMode )pHTInfo->opMode;
5266 // Send change notification to HAL
5267 }
5268
5269 if ( psessionEntry->beaconParams.llnNonGFCoexist != pHTInfo->nonGFDevicesPresent )
5270 {
5271 psessionEntry->beaconParams.llnNonGFCoexist = ( tANI_U8 )pHTInfo->nonGFDevicesPresent;
5272 }
5273
5274 if ( pMac->lim.gHTSTBCBasicMCS != ( tANI_U8 )pHTInfo->basicSTBCMCS )
5275 {
5276 pMac->lim.gHTSTBCBasicMCS = ( tANI_U8 )pHTInfo->basicSTBCMCS;
5277 // Send change notification to HAL
5278 }
5279
5280 if ( pMac->lim.gHTDualCTSProtection != ( tANI_U8 )pHTInfo->dualCTSProtection )
5281 {
5282 pMac->lim.gHTDualCTSProtection = ( tANI_U8 )pHTInfo->dualCTSProtection;
5283 // Send change notification to HAL
5284 }
5285
5286 if ( pMac->lim.gHTSecondaryBeacon != ( tANI_U8 )pHTInfo->secondaryBeacon )
5287 {
5288 pMac->lim.gHTSecondaryBeacon = ( tANI_U8 )pHTInfo->secondaryBeacon;
5289 // Send change notification to HAL
5290 }
5291
5292 if ( psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport != ( tANI_U8 )pHTInfo->lsigTXOPProtectionFullSupport )
5293 {
5294 psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport = ( tANI_U8 )pHTInfo->lsigTXOPProtectionFullSupport;
5295 // Send change notification to HAL
5296 }
5297
5298 if ( pMac->lim.gHTPCOActive != ( tANI_U8 )pHTInfo->pcoActive )
5299 {
5300 pMac->lim.gHTPCOActive = ( tANI_U8 )pHTInfo->pcoActive;
5301 // Send change notification to HAL
5302 }
5303
5304 if ( pMac->lim.gHTPCOPhase != ( tANI_U8 )pHTInfo->pcoPhase )
5305 {
5306 pMac->lim.gHTPCOPhase = ( tANI_U8 )pHTInfo->pcoPhase;
5307 // Send change notification to HAL
5308 }
5309
5310} // End limUpdateStaRunTimeHTInfo.
5311
5312
5313/** -------------------------------------------------------------
5314\fn limProcessHalIndMessages
5315\brief callback function for HAL indication
5316\param tpAniSirGlobal pMac
5317\param tANI_U32 mesgId
5318\param void *mesgParam
5319\return tSirRetStatu - status
5320 -------------------------------------------------------------*/
5321
5322tSirRetStatus limProcessHalIndMessages(tpAniSirGlobal pMac, tANI_U32 msgId, void *msgParam )
5323{
5324 //its PE's responsibility to free msgparam when its done extracting the message parameters.
5325 tSirMsgQ msg;
5326
5327 switch(msgId)
5328 {
5329 case SIR_LIM_DEL_TS_IND:
5330 case SIR_LIM_ADD_BA_IND:
5331 case SIR_LIM_DEL_BA_ALL_IND:
5332 case SIR_LIM_DELETE_STA_CONTEXT_IND:
5333 case SIR_LIM_BEACON_GEN_IND:
5334 msg.type = (tANI_U16) msgId;
5335 msg.bodyptr = msgParam;
5336 msg.bodyval = 0;
5337 break;
5338
5339 default:
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305340 vos_mem_free(msgParam);
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005341 limLog(pMac, LOGP, FL("invalid message id = %d received"), msgId);
Jeff Johnson295189b2012-06-20 16:38:30 -07005342 return eSIR_FAILURE;
5343 }
5344
5345 if (limPostMsgApi(pMac, &msg) != eSIR_SUCCESS)
5346 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305347 vos_mem_free(msgParam);
Jeff Johnson295189b2012-06-20 16:38:30 -07005348 limLog(pMac, LOGP, FL("limPostMsgApi failed for msgid = %d"), msg.type);
5349 return eSIR_FAILURE;
5350 }
5351 return eSIR_SUCCESS;
5352}
5353
5354/** -------------------------------------------------------------
5355\fn limValidateDeltsReq
5356\brief Validates DelTs req originated by SME or by HAL and also sends halMsg_DelTs to HAL
5357\param tpAniSirGlobal pMac
5358\param tpSirDeltsReq pDeltsReq
5359\param tSirMacAddr peerMacAddr
5360\return eSirRetStatus - status
5361 -------------------------------------------------------------*/
5362
5363tSirRetStatus
5364limValidateDeltsReq(tpAniSirGlobal pMac, tpSirDeltsReq pDeltsReq, tSirMacAddr peerMacAddr,tpPESession psessionEntry)
5365{
5366 tpDphHashNode pSta;
5367 tANI_U8 tsStatus;
5368 tSirMacTSInfo *tsinfo;
5369 tANI_U32 i;
5370 tANI_U8 tspecIdx;
5371 /* if sta
5372 * - verify assoc state
5373 * - del tspec locally
5374 * if ap,
5375 * - verify sta is in assoc state
5376 * - del sta tspec locally
5377 */
5378 if(pDeltsReq == NULL)
5379 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005380 PELOGE(limLog(pMac, LOGE, FL("Delete TS request pointer is NULL"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005381 return eSIR_FAILURE;
5382 }
5383
5384 if ((psessionEntry->limSystemRole == eLIM_STA_ROLE)||(psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE))
5385 {
5386 tANI_U32 val;
5387
5388 // station always talks to the AP
5389 pSta = dphGetHashEntry(pMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable);
5390
5391 val = sizeof(tSirMacAddr);
5392 #if 0
5393 if (wlan_cfgGetStr(pMac, WNI_CFG_BSSID, peerMacAddr, &val) != eSIR_SUCCESS)
5394 {
5395 /// Could not get BSSID from CFG. Log error.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005396 limLog(pMac, LOGP, FL("could not retrieve BSSID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07005397 return eSIR_FAILURE;
5398 }
5399 #endif// TO SUPPORT BT-AMP
5400 sirCopyMacAddr(peerMacAddr,psessionEntry->bssId);
5401
5402 }
5403 else
5404 {
5405 tANI_U16 assocId;
5406 tANI_U8 *macaddr = (tANI_U8 *) peerMacAddr;
5407
5408 assocId = pDeltsReq->aid;
5409 if (assocId != 0)
5410 pSta = dphGetHashEntry(pMac, assocId, &psessionEntry->dph.dphHashTable);
5411 else
5412 pSta = dphLookupHashEntry(pMac, pDeltsReq->macAddr, &assocId, &psessionEntry->dph.dphHashTable);
5413
5414 if (pSta != NULL)
5415 // TBD: check sta assoc state as well
5416 for (i =0; i < sizeof(tSirMacAddr); i++)
5417 macaddr[i] = pSta->staAddr[i];
5418 }
5419
5420 if (pSta == NULL)
5421 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005422 PELOGE(limLog(pMac, LOGE, "Cannot find station context for delts req");)
Jeff Johnson295189b2012-06-20 16:38:30 -07005423 return eSIR_FAILURE;
5424 }
5425
5426 if ((! pSta->valid) ||
5427 (pSta->mlmStaContext.mlmState != eLIM_MLM_LINK_ESTABLISHED_STATE))
5428 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005429 PELOGE(limLog(pMac, LOGE, "Invalid Sta (or state) for DelTsReq");)
Jeff Johnson295189b2012-06-20 16:38:30 -07005430 return eSIR_FAILURE;
5431 }
5432
5433 pDeltsReq->req.wsmTspecPresent = 0;
5434 pDeltsReq->req.wmeTspecPresent = 0;
5435 pDeltsReq->req.lleTspecPresent = 0;
5436
5437 if ((pSta->wsmEnabled) &&
5438 (pDeltsReq->req.tspec.tsinfo.traffic.accessPolicy != SIR_MAC_ACCESSPOLICY_EDCA))
5439 pDeltsReq->req.wsmTspecPresent = 1;
5440 else if (pSta->wmeEnabled)
5441 pDeltsReq->req.wmeTspecPresent = 1;
5442 else if (pSta->lleEnabled)
5443 pDeltsReq->req.lleTspecPresent = 1;
5444 else
5445 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005446 PELOGW(limLog(pMac, LOGW, FL("DELTS_REQ ignore - qos is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005447 return eSIR_FAILURE;
5448 }
5449
5450 tsinfo = pDeltsReq->req.wmeTspecPresent ? &pDeltsReq->req.tspec.tsinfo
5451 : &pDeltsReq->req.tsinfo;
5452 PELOG1(limLog(pMac, LOG1,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005453 FL("received DELTS_REQ message (wmeTspecPresent = %d, lleTspecPresent = %d, wsmTspecPresent = %d, tsid %d, up %d, direction = %d)"),
Jeff Johnson295189b2012-06-20 16:38:30 -07005454 pDeltsReq->req.wmeTspecPresent, pDeltsReq->req.lleTspecPresent, pDeltsReq->req.wsmTspecPresent,
5455 tsinfo->traffic.tsid, tsinfo->traffic.userPrio, tsinfo->traffic.direction);)
5456
5457 // if no Access Control, ignore the request
Jeff Johnson295189b2012-06-20 16:38:30 -07005458
5459 if (limAdmitControlDeleteTS(pMac, pSta->assocId, tsinfo, &tsStatus, &tspecIdx)
5460 != eSIR_SUCCESS)
5461 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005462 PELOGE(limLog(pMac, LOGE, "ERROR DELTS request for sta assocId %d (tsid %d, up %d)",
Jeff Johnson295189b2012-06-20 16:38:30 -07005463 pSta->assocId, tsinfo->traffic.tsid, tsinfo->traffic.userPrio);)
5464 return eSIR_FAILURE;
5465 }
5466 else if ((tsinfo->traffic.accessPolicy == SIR_MAC_ACCESSPOLICY_HCCA) ||
5467 (tsinfo->traffic.accessPolicy == SIR_MAC_ACCESSPOLICY_BOTH))
5468 {
5469 //edca only now.
5470 }
5471 else
5472 {
5473 if((tsinfo->traffic.accessPolicy == SIR_MAC_ACCESSPOLICY_EDCA) &&
5474 psessionEntry->gLimEdcaParams[upToAc(tsinfo->traffic.userPrio)].aci.acm)
5475 {
5476 //send message to HAL to delete TS
Madan Mohan Koyyalamudic0a75a42013-10-07 04:20:49 +05305477 if(eSIR_SUCCESS != limSendHalMsgDelTs(pMac,
5478 pSta->staIndex,
5479 tspecIdx,
5480 pDeltsReq->req,
5481 psessionEntry->peSessionId,
5482 psessionEntry->bssId))
Jeff Johnson295189b2012-06-20 16:38:30 -07005483 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005484 limLog(pMac, LOGW, FL("DelTs with UP %d failed in limSendHalMsgDelTs - ignoring request"),
Jeff Johnson295189b2012-06-20 16:38:30 -07005485 tsinfo->traffic.userPrio);
5486 return eSIR_FAILURE;
5487 }
5488 }
5489 }
5490 return eSIR_SUCCESS;
5491}
5492
5493/** -------------------------------------------------------------
5494\fn limRegisterHalIndCallBack
5495\brief registers callback function to HAL for any indication.
5496\param tpAniSirGlobal pMac
5497\return none.
5498 -------------------------------------------------------------*/
5499void
5500limRegisterHalIndCallBack(tpAniSirGlobal pMac)
5501{
5502 tSirMsgQ msg;
5503 tpHalIndCB pHalCB;
5504
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305505 pHalCB = vos_mem_malloc(sizeof(tHalIndCB));
5506 if ( NULL == pHalCB )
Jeff Johnson295189b2012-06-20 16:38:30 -07005507 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305508 limLog(pMac, LOGP, FL("AllocateMemory() failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07005509 return;
5510 }
5511
5512 pHalCB->pHalIndCB = limProcessHalIndMessages;
5513
5514 msg.type = WDA_REGISTER_PE_CALLBACK;
5515 msg.bodyptr = pHalCB;
5516 msg.bodyval = 0;
5517
Jeff Johnsone7245742012-09-05 17:12:55 -07005518 MTRACE(macTraceMsgTx(pMac, NO_SESSION, msg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07005519 if(eSIR_SUCCESS != wdaPostCtrlMsg(pMac, &msg))
5520 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305521 vos_mem_free(pHalCB);
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005522 limLog(pMac, LOGP, FL("wdaPostCtrlMsg() failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07005523 }
5524
5525 return;
5526}
5527
5528
5529/** -------------------------------------------------------------
5530\fn limProcessAddBaInd
5531
5532\brief handles the BA activity check timeout indication coming from HAL.
5533 Validates the request, posts request for sending addBaReq message for every candidate in the list.
5534\param tpAniSirGlobal pMac
5535\param tSirMsgQ limMsg
5536\return None
5537-------------------------------------------------------------*/
5538void
5539limProcessAddBaInd(tpAniSirGlobal pMac, tpSirMsgQ limMsg)
5540{
5541 tANI_U8 i;
5542 tANI_U8 tid;
5543 tANI_U16 assocId;
5544 tpDphHashNode pSta;
5545 tpAddBaCandidate pBaCandidate;
5546 tANI_U32 baCandidateCnt;
5547 tpBaActivityInd pBaActivityInd;
5548 tpPESession psessionEntry;
5549 tANI_U8 sessionId;
Gopichand Nakkala681989c2013-03-06 22:27:48 -08005550#ifdef FEATURE_WLAN_TDLS
5551 boolean htCapable = FALSE;
5552#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07005553
5554
Gopichand Nakkala681989c2013-03-06 22:27:48 -08005555 if (limMsg->bodyptr == NULL)
Jeff Johnson295189b2012-06-20 16:38:30 -07005556 return;
5557
5558 pBaActivityInd = (tpBaActivityInd)limMsg->bodyptr;
5559 baCandidateCnt = pBaActivityInd->baCandidateCnt;
5560
Gopichand Nakkala681989c2013-03-06 22:27:48 -08005561 if ((psessionEntry = peFindSessionByBssid(pMac,pBaActivityInd->bssId,&sessionId))== NULL)
Jeff Johnson295189b2012-06-20 16:38:30 -07005562 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005563 limLog(pMac, LOGE,FL("session does not exist for given BSSId"));
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305564 vos_mem_free(limMsg->bodyptr);
Jeff Johnson295189b2012-06-20 16:38:30 -07005565 return;
5566 }
5567
5568 //if we are not HT capable we don't need to handle BA timeout indication from HAL.
Gopichand Nakkala681989c2013-03-06 22:27:48 -08005569#ifdef FEATURE_WLAN_TDLS
5570 if ((baCandidateCnt > pMac->lim.maxStation))
5571#else
5572 if ((baCandidateCnt > pMac->lim.maxStation) || !psessionEntry->htCapability )
5573#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07005574 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305575 vos_mem_free(limMsg->bodyptr);
Jeff Johnson295189b2012-06-20 16:38:30 -07005576 return;
5577 }
Gopichand Nakkala681989c2013-03-06 22:27:48 -08005578
5579#ifdef FEATURE_WLAN_TDLS
5580 //if we have TDLS peers, we should look at peers HT capability, which can be different than
5581 //AP capability
5582 pBaCandidate = (tpAddBaCandidate) (((tANI_U8*)pBaActivityInd) + sizeof(tBaActivityInd));
5583
5584 for (i=0; i<baCandidateCnt; i++, pBaCandidate++)
5585 {
5586 pSta = dphLookupHashEntry(pMac, pBaCandidate->staAddr, &assocId, &psessionEntry->dph.dphHashTable);
5587 if ((NULL == pSta) || (!pSta->valid))
5588 continue;
5589
5590 if (STA_ENTRY_TDLS_PEER == pSta->staType)
5591 htCapable = pSta->mlmStaContext.htCapability;
5592 else
5593 htCapable = psessionEntry->htCapability;
5594
5595 if (htCapable)
5596 break;
5597 }
5598 if (!htCapable)
5599 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305600 vos_mem_free(limMsg->bodyptr);
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);
Jeff Johnson295189b2012-06-20 16:38:30 -07005627 return;
5628}
5629
5630
5631/** -------------------------------------------------------------
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005632\fn limDeleteBASessions
5633\brief Deletes all the exisitng BA sessions for given session
5634 and BA direction.
Jeff Johnson295189b2012-06-20 16:38:30 -07005635\param tpAniSirGlobal pMac
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005636\param tpPESession pSessionEntry
5637\param tANI_U32 baDirection
5638\return None
Jeff Johnson295189b2012-06-20 16:38:30 -07005639-------------------------------------------------------------*/
5640
5641void
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005642limDeleteBASessions(tpAniSirGlobal pMac, tpPESession pSessionEntry,
5643 tANI_U32 baDirection)
Jeff Johnson295189b2012-06-20 16:38:30 -07005644{
5645 tANI_U32 i;
5646 tANI_U8 tid;
5647 tpDphHashNode pSta;
5648
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005649 if (NULL == pSessionEntry)
Jeff Johnson295189b2012-06-20 16:38:30 -07005650 {
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005651 limLog(pMac, LOGE, FL("Session does not exist"));
5652 }
5653 else
5654 {
5655 for(tid = 0; tid < STACFG_MAX_TC; tid++)
Jeff Johnson295189b2012-06-20 16:38:30 -07005656 {
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005657 if ((eLIM_AP_ROLE == pSessionEntry->limSystemRole) ||
5658 (pSessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE) ||
5659 (eLIM_STA_IN_IBSS_ROLE == pSessionEntry->limSystemRole) ||
5660 (pSessionEntry->limSystemRole == eLIM_P2P_DEVICE_GO))
Jeff Johnson295189b2012-06-20 16:38:30 -07005661 {
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005662 for (i = 0; i < pMac->lim.maxStation; i++)
Jeff Johnson295189b2012-06-20 16:38:30 -07005663 {
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005664 pSta = pSessionEntry->dph.dphHashTable.pDphNodeArray + i;
5665 if (pSta && pSta->added)
Kiran Kumar Lokerec1641f52013-05-29 14:29:43 -07005666 {
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005667 if ((eBA_ENABLE == pSta->tcCfg[tid].fUseBATx) &&
5668 (baDirection & BA_INITIATOR))
5669 {
5670 limPostMlmDelBAReq(pMac, pSta, eBA_INITIATOR, tid,
5671 eSIR_MAC_UNSPEC_FAILURE_REASON,
5672 pSessionEntry);
5673 }
5674 if ((eBA_ENABLE == pSta->tcCfg[tid].fUseBARx) &&
5675 (baDirection & BA_RECIPIENT))
5676 {
5677 limPostMlmDelBAReq(pMac, pSta, eBA_RECIPIENT, tid,
5678 eSIR_MAC_UNSPEC_FAILURE_REASON,
5679 pSessionEntry);
5680 }
Kiran Kumar Lokerec1641f52013-05-29 14:29:43 -07005681 }
Jeff Johnson295189b2012-06-20 16:38:30 -07005682 }
5683 }
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005684 else if ((eLIM_STA_ROLE == pSessionEntry->limSystemRole) ||
5685 (eLIM_BT_AMP_STA_ROLE == pSessionEntry->limSystemRole) ||
5686 (eLIM_P2P_DEVICE_ROLE == pSessionEntry->limSystemRole))
Gopichand Nakkala6a36e142013-06-07 21:23:15 -07005687 {
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005688 pSta = dphGetHashEntry(pMac, DPH_STA_HASH_INDEX_PEER,
5689 &pSessionEntry->dph.dphHashTable);
5690 if (pSta && pSta->added)
Gopichand Nakkala6a36e142013-06-07 21:23:15 -07005691 {
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005692 if ((eBA_ENABLE == pSta->tcCfg[tid].fUseBATx) &&
5693 (baDirection & BA_INITIATOR))
5694 {
5695 limPostMlmDelBAReq(pMac, pSta, eBA_INITIATOR, tid,
5696 eSIR_MAC_UNSPEC_FAILURE_REASON,
5697 pSessionEntry);
5698 }
5699 if ((eBA_ENABLE == pSta->tcCfg[tid].fUseBARx) &&
5700 (baDirection & BA_RECIPIENT))
5701 {
5702 limPostMlmDelBAReq(pMac, pSta, eBA_RECIPIENT, tid,
5703 eSIR_MAC_UNSPEC_FAILURE_REASON,
5704 pSessionEntry);
5705 }
Gopichand Nakkala6a36e142013-06-07 21:23:15 -07005706 }
5707 }
5708 }
Jeff Johnson295189b2012-06-20 16:38:30 -07005709 }
5710}
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005711
5712/** -------------------------------------------------------------
5713\fn limDelAllBASessions
5714\brief Deletes all the exisitng BA sessions.
5715\param tpAniSirGlobal pMac
5716\return None
5717-------------------------------------------------------------*/
5718
5719void limDelAllBASessions(tpAniSirGlobal pMac)
5720{
5721 tANI_U32 i;
5722 tpPESession pSessionEntry;
5723
5724 for (i = 0; i < pMac->lim.maxBssId; i++)
5725 {
5726 pSessionEntry = peFindSessionBySessionId(pMac, i);
5727 if (pSessionEntry)
5728 {
5729 limDeleteBASessions(pMac, pSessionEntry, BA_BOTH_DIRECTIONS);
5730 }
5731 }
5732}
5733
5734/** -------------------------------------------------------------
5735\fn limDelAllBASessionsBtc
5736\brief Deletes all the exisitng BA receipent sessions in 2.4GHz
5737 band.
5738\param tpAniSirGlobal pMac
5739\return None
5740-------------------------------------------------------------*/
5741
Leela Venkata Kiran Kumar Reddy Chiralab8dadc22013-11-05 12:34:32 -08005742void limDelPerBssBASessionsBtc(tpAniSirGlobal pMac)
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005743{
Leela Venkata Kiran Kumar Reddy Chiralab8dadc22013-11-05 12:34:32 -08005744 tANI_U8 sessionId;
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005745 tpPESession pSessionEntry;
Leela Venkata Kiran Kumar Reddy Chiralab8dadc22013-11-05 12:34:32 -08005746 pSessionEntry = peFindSessionByBssid(pMac,pMac->btc.btcBssfordisableaggr,
5747 &sessionId);
5748 if (pSessionEntry)
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005749 {
Leela Venkata Kiran Kumar Reddy Chiralab8dadc22013-11-05 12:34:32 -08005750 PELOGW(limLog(pMac, LOGW,
5751 "Deleting the BA for session %d as host got BTC event", sessionId);)
5752 limDeleteBASessions(pMac, pSessionEntry, BA_RECIPIENT);
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005753 }
5754}
5755
Jeff Johnson295189b2012-06-20 16:38:30 -07005756/** -------------------------------------------------------------
5757\fn limProcessDelTsInd
5758\brief handles the DeleteTS indication coming from HAL or generated by PE itself in some error cases.
5759 Validates the request, sends the DelTs action frame to the Peer and sends DelTs indicatoin to HDD.
5760\param tpAniSirGlobal pMac
5761\param tSirMsgQ limMsg
5762\return None
5763-------------------------------------------------------------*/
5764void
5765limProcessDelTsInd(tpAniSirGlobal pMac, tpSirMsgQ limMsg)
5766{
5767 tpDphHashNode pSta;
5768 tpDelTsParams pDelTsParam = (tpDelTsParams) (limMsg->bodyptr);
5769 tpSirDeltsReq pDelTsReq = NULL;
5770 tSirMacAddr peerMacAddr;
5771 tpSirDeltsReqInfo pDelTsReqInfo;
5772 tpLimTspecInfo pTspecInfo;
5773 tpPESession psessionEntry;
5774 tANI_U8 sessionId;
5775
5776if((psessionEntry = peFindSessionByBssid(pMac,pDelTsParam->bssId,&sessionId))== NULL)
5777 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005778 limLog(pMac, LOGE,FL("session does not exist for given BssId"));
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305779 vos_mem_free(limMsg->bodyptr);
Jeff Johnson295189b2012-06-20 16:38:30 -07005780 return;
5781 }
5782
5783 pTspecInfo = &(pMac->lim.tspecInfo[pDelTsParam->tspecIdx]);
5784 if(pTspecInfo->inuse == false)
5785 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005786 PELOGE(limLog(pMac, LOGE, FL("tspec entry with index %d is not in use"), pDelTsParam->tspecIdx);)
Jeff Johnson295189b2012-06-20 16:38:30 -07005787 goto error1;
5788 }
5789
5790 pSta = dphGetHashEntry(pMac, pTspecInfo->assocId, &psessionEntry->dph.dphHashTable);
5791 if(pSta == NULL)
5792 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005793 limLog(pMac, LOGE, FL("Could not find entry in DPH table for assocId = %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07005794 pTspecInfo->assocId);
5795 goto error1;
5796 }
5797
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305798 pDelTsReq = vos_mem_malloc(sizeof(tSirDeltsReq));
5799 if ( NULL == pDelTsReq )
Jeff Johnson295189b2012-06-20 16:38:30 -07005800 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305801 PELOGE(limLog(pMac, LOGE, FL("AllocateMemory() failed"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005802 goto error1;
5803 }
5804
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305805 vos_mem_set( (tANI_U8 *)pDelTsReq, sizeof(tSirDeltsReq), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07005806
5807 if(pSta->wmeEnabled)
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305808 vos_mem_copy( &(pDelTsReq->req.tspec), &(pTspecInfo->tspec), sizeof(tSirMacTspecIE));
Jeff Johnson295189b2012-06-20 16:38:30 -07005809 else
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305810 vos_mem_copy( &(pDelTsReq->req.tsinfo), &(pTspecInfo->tspec.tsinfo), sizeof(tSirMacTSInfo));
Jeff Johnson295189b2012-06-20 16:38:30 -07005811
5812
5813 //validate the req
5814 if (eSIR_SUCCESS != limValidateDeltsReq(pMac, pDelTsReq, peerMacAddr,psessionEntry))
5815 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005816 PELOGE(limLog(pMac, LOGE, FL("limValidateDeltsReq failed"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005817 goto error2;
5818 }
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005819 PELOG1(limLog(pMac, LOG1, "Sent DELTS request to station with assocId = %d MacAddr = %x:%x:%x:%x:%x:%x",
Jeff Johnson295189b2012-06-20 16:38:30 -07005820 pDelTsReq->aid, peerMacAddr[0], peerMacAddr[1], peerMacAddr[2],
5821 peerMacAddr[3], peerMacAddr[4], peerMacAddr[5]);)
5822
5823 limSendDeltsReqActionFrame(pMac, peerMacAddr, pDelTsReq->req.wmeTspecPresent, &pDelTsReq->req.tsinfo, &pDelTsReq->req.tspec,
5824 psessionEntry);
5825
5826 // prepare and send an sme indication to HDD
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305827 pDelTsReqInfo = vos_mem_malloc(sizeof(tSirDeltsReqInfo));
5828 if ( NULL == pDelTsReqInfo )
Jeff Johnson295189b2012-06-20 16:38:30 -07005829 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305830 PELOGE(limLog(pMac, LOGE, FL("AllocateMemory() failed"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005831 goto error3;
5832 }
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305833 vos_mem_set( (tANI_U8 *)pDelTsReqInfo, sizeof(tSirDeltsReqInfo), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07005834
5835 if(pSta->wmeEnabled)
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305836 vos_mem_copy( &(pDelTsReqInfo->tspec), &(pTspecInfo->tspec), sizeof(tSirMacTspecIE));
Jeff Johnson295189b2012-06-20 16:38:30 -07005837 else
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305838 vos_mem_copy( &(pDelTsReqInfo->tsinfo), &(pTspecInfo->tspec.tsinfo), sizeof(tSirMacTSInfo));
Jeff Johnson295189b2012-06-20 16:38:30 -07005839
5840 limSendSmeDeltsInd(pMac, pDelTsReqInfo, pDelTsReq->aid,psessionEntry);
5841
5842error3:
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305843 vos_mem_free(pDelTsReqInfo);
Jeff Johnson295189b2012-06-20 16:38:30 -07005844error2:
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305845 vos_mem_free(pDelTsReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07005846error1:
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305847 vos_mem_free(limMsg->bodyptr);
Jeff Johnson295189b2012-06-20 16:38:30 -07005848 return;
5849}
5850
5851/**
5852 * \brief Setup an A-MPDU/BA session
5853 *
5854 * \sa limPostMlmAddBAReq
5855 *
5856 * \param pMac The global tpAniSirGlobal object
5857 *
5858 * \param pStaDs DPH Hash Node object of peer STA
5859 *
5860 * \param tid TID for which a BA is being setup.
5861 * If this is set to 0xFFFF, then we retrieve
5862 * the default TID from the CFG
5863 *
5864 * \return eSIR_SUCCESS if setup completes successfully
5865 * eSIR_FAILURE is some problem is encountered
5866 */
5867tSirRetStatus limPostMlmAddBAReq( tpAniSirGlobal pMac,
5868 tpDphHashNode pStaDs,
5869 tANI_U8 tid, tANI_U16 startingSeqNum,tpPESession psessionEntry)
5870{
5871 tSirRetStatus status = eSIR_SUCCESS;
Jeff Johnson09fb4cd2013-04-03 15:27:59 -07005872 tpLimMlmAddBAReq pMlmAddBAReq = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07005873 tpDialogueToken dialogueTokenNode;
5874 tANI_U32 val = 0;
Jeff Johnson09fb4cd2013-04-03 15:27:59 -07005875
Jeff Johnson295189b2012-06-20 16:38:30 -07005876 // Check if the peer is a 11n capable STA
5877 // FIXME - Need a 11n peer indication in DPH.
5878 // For now, using the taurusPeer attribute
5879 //if( 0 == pStaDs->taurusPeer == )
5880 //return eSIR_SUCCESS;
5881
5882 // Allocate for LIM_MLM_ADDBA_REQ
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305883 pMlmAddBAReq = vos_mem_malloc(sizeof( tLimMlmAddBAReq ));
5884 if ( NULL == pMlmAddBAReq )
Jeff Johnson295189b2012-06-20 16:38:30 -07005885 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305886 limLog( pMac, LOGP, FL("AllocateMemory failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07005887 status = eSIR_MEM_ALLOC_FAILED;
5888 goto returnFailure;
5889 }
5890
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305891 vos_mem_set( (void *) pMlmAddBAReq, sizeof( tLimMlmAddBAReq ), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07005892
5893 // Copy the peer MAC
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305894 vos_mem_copy(
Jeff Johnson295189b2012-06-20 16:38:30 -07005895 pMlmAddBAReq->peerMacAddr,
5896 pStaDs->staAddr,
5897 sizeof( tSirMacAddr ));
5898
5899 // Update the TID
5900 pMlmAddBAReq->baTID = tid;
5901
5902 // Determine the supported BA policy of local STA
5903 // for the TID of interest
5904 pMlmAddBAReq->baPolicy = (pStaDs->baPolicyFlag >> tid) & 0x1;
5905
5906 // BA Buffer Size
5907 // Requesting the ADDBA recipient to populate the size.
5908 // If ADDBA is accepted, a non-zero buffer size should
5909 // be returned in the ADDBA Rsp
5910 pMlmAddBAReq->baBufferSize = 0;
5911
5912 limLog( pMac, LOGW,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005913 FL( "Requesting an ADDBA to setup a %s BA session with STA %d for TID %d" ),
Jeff Johnson295189b2012-06-20 16:38:30 -07005914 (pMlmAddBAReq->baPolicy ? "Immediate": "Delayed"),
5915 pStaDs->staIndex,
5916 tid );
5917
5918 // BA Timeout
Jeff Johnson09fb4cd2013-04-03 15:27:59 -07005919 if (wlan_cfgGetInt(pMac, WNI_CFG_BA_TIMEOUT, &val) != eSIR_SUCCESS)
Jeff Johnson295189b2012-06-20 16:38:30 -07005920 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005921 limLog(pMac, LOGE, FL("could not retrieve BA TIME OUT Param CFG"));
Jeff Johnson295189b2012-06-20 16:38:30 -07005922 status = eSIR_FAILURE;
5923 goto returnFailure;
5924 }
5925 pMlmAddBAReq->baTimeout = val; // In TU's
5926
5927 // ADDBA Failure Timeout
Jeff Johnson09fb4cd2013-04-03 15:27:59 -07005928 // FIXME_AMPDU - Need to retrieve this from CFG.
Jeff Johnson295189b2012-06-20 16:38:30 -07005929 //right now we are not checking for response timeout. so this field is dummy just to be compliant with the spec.
5930 pMlmAddBAReq->addBAFailureTimeout = 2000; // In TU's
5931
5932 // BA Starting Sequence Number
5933 pMlmAddBAReq->baSSN = startingSeqNum;
5934
5935 /* Update PE session Id*/
5936 pMlmAddBAReq->sessionId = psessionEntry->peSessionId;
5937
5938 LIM_SET_STA_BA_STATE(pStaDs, tid, eLIM_BA_STATE_WT_ADD_RSP);
5939
Jeff Johnson09fb4cd2013-04-03 15:27:59 -07005940 dialogueTokenNode = limAssignDialogueToken(pMac);
5941 if (NULL == dialogueTokenNode)
5942 {
5943 limLog(pMac, LOGE, FL("could not assign dialogue token"));
5944 status = eSIR_FAILURE;
5945 goto returnFailure;
5946 }
5947
Jeff Johnson295189b2012-06-20 16:38:30 -07005948 pMlmAddBAReq->baDialogToken = dialogueTokenNode->token;
Jeff Johnson09fb4cd2013-04-03 15:27:59 -07005949 //set assocId and tid information in the lim linked list
Jeff Johnson295189b2012-06-20 16:38:30 -07005950 dialogueTokenNode->assocId = pStaDs->assocId;
5951 dialogueTokenNode->tid = tid;
5952 // Send ADDBA Req to MLME
5953 limPostMlmMessage( pMac,
5954 LIM_MLM_ADDBA_REQ,
5955 (tANI_U32 *) pMlmAddBAReq );
Jeff Johnson09fb4cd2013-04-03 15:27:59 -07005956 return eSIR_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -07005957
5958returnFailure:
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305959 vos_mem_free(pMlmAddBAReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07005960 return status;
5961}
5962
5963/**
5964 * \brief Post LIM_MLM_ADDBA_RSP to MLME. MLME
5965 * will then send an ADDBA Rsp to peer MAC entity
5966 * with the appropriate ADDBA status code
5967 *
5968 * \sa limPostMlmAddBARsp
5969 *
5970 * \param pMac The global tpAniSirGlobal object
5971 *
5972 * \param peerMacAddr MAC address of peer entity that will
5973 * be the recipient of this ADDBA Rsp
5974 *
5975 * \param baStatusCode ADDBA Rsp status code
5976 *
5977 * \param baDialogToken ADDBA Rsp dialog token
5978 *
5979 * \param baTID TID of interest
5980 *
5981 * \param baPolicy The BA policy
5982 *
5983 * \param baBufferSize The BA buffer size
5984 *
5985 * \param baTimeout BA timeout in TU's
5986 *
5987 * \return eSIR_SUCCESS if setup completes successfully
5988 * eSIR_FAILURE is some problem is encountered
5989 */
5990tSirRetStatus limPostMlmAddBARsp( tpAniSirGlobal pMac,
5991 tSirMacAddr peerMacAddr,
5992 tSirMacStatusCodes baStatusCode,
5993 tANI_U8 baDialogToken,
5994 tANI_U8 baTID,
5995 tANI_U8 baPolicy,
5996 tANI_U16 baBufferSize,
5997 tANI_U16 baTimeout,
5998 tpPESession psessionEntry)
5999{
6000tSirRetStatus status = eSIR_SUCCESS;
6001tpLimMlmAddBARsp pMlmAddBARsp;
6002
6003 // Allocate for LIM_MLM_ADDBA_RSP
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306004 pMlmAddBARsp = vos_mem_malloc(sizeof( tLimMlmAddBARsp ));
6005 if ( NULL == pMlmAddBARsp )
Jeff Johnson295189b2012-06-20 16:38:30 -07006006 {
6007 limLog( pMac, LOGE,
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306008 FL("AllocateMemory failed with error code %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07006009 status );
6010
6011 status = eSIR_MEM_ALLOC_FAILED;
6012 goto returnFailure;
6013 }
6014
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306015 vos_mem_set( (void *) pMlmAddBARsp, sizeof( tLimMlmAddBARsp ), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07006016
6017 // Copy the peer MAC
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306018 vos_mem_copy(
Jeff Johnson295189b2012-06-20 16:38:30 -07006019 pMlmAddBARsp->peerMacAddr,
6020 peerMacAddr,
6021 sizeof( tSirMacAddr ));
6022
6023 pMlmAddBARsp->baDialogToken = baDialogToken;
6024 pMlmAddBARsp->addBAResultCode = baStatusCode;
6025 pMlmAddBARsp->baTID = baTID;
6026 pMlmAddBARsp->baPolicy = baPolicy;
6027 pMlmAddBARsp->baBufferSize = baBufferSize;
6028 pMlmAddBARsp->baTimeout = baTimeout;
6029
6030 /* UPdate PE session ID*/
6031 pMlmAddBARsp->sessionId = psessionEntry->peSessionId;
6032
6033 // Send ADDBA Rsp to MLME
6034 limPostMlmMessage( pMac,
6035 LIM_MLM_ADDBA_RSP,
6036 (tANI_U32 *) pMlmAddBARsp );
6037
6038returnFailure:
6039
6040 return status;
6041}
6042
6043/**
6044 * \brief Post LIM_MLM_DELBA_REQ to MLME. MLME
6045 * will then send an DELBA Ind to peer MAC entity
6046 * with the appropriate DELBA status code
6047 *
6048 * \sa limPostMlmDelBAReq
6049 *
6050 * \param pMac The global tpAniSirGlobal object
6051 *
6052 * \param pSta DPH Hash Node object of peer MAC entity
6053 * for which the BA session is being deleted
6054 *
6055 * \param baDirection DELBA direction
6056 *
6057 * \param baTID TID for which the BA session is being deleted
6058 *
6059 * \param baReasonCode DELBA Req reason code
6060 *
6061 * \return eSIR_SUCCESS if setup completes successfully
6062 * eSIR_FAILURE is some problem is encountered
6063 */
6064tSirRetStatus limPostMlmDelBAReq( tpAniSirGlobal pMac,
6065 tpDphHashNode pSta,
6066 tANI_U8 baDirection,
6067 tANI_U8 baTID,
6068 tSirMacReasonCodes baReasonCode,
6069 tpPESession psessionEntry)
6070{
6071tSirRetStatus status = eSIR_SUCCESS;
6072tpLimMlmDelBAReq pMlmDelBAReq;
6073tLimBAState curBaState;
6074
6075if(NULL == pSta)
6076 return eSIR_FAILURE;
6077
6078LIM_GET_STA_BA_STATE(pSta, baTID, &curBaState);
6079
6080 // Need to validate the current BA State.
6081 if( eLIM_BA_STATE_IDLE != curBaState)
6082 {
6083 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006084 FL( "Received unexpected DELBA REQ when STA BA state for tid = %d is %d" ),
Jeff Johnson295189b2012-06-20 16:38:30 -07006085 baTID,
6086 curBaState);
6087
6088 status = eSIR_FAILURE;
6089 goto returnFailure;
6090 }
6091
6092 // Allocate for LIM_MLM_DELBA_REQ
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306093 pMlmDelBAReq = vos_mem_malloc(sizeof( tLimMlmDelBAReq ));
6094 if ( NULL == pMlmDelBAReq )
Jeff Johnson295189b2012-06-20 16:38:30 -07006095 {
6096 limLog( pMac, LOGE,
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306097 FL("AllocateMemory failed with error code %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07006098 status );
6099
6100 status = eSIR_MEM_ALLOC_FAILED;
6101 goto returnFailure;
6102 }
6103
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306104 vos_mem_set( (void *) pMlmDelBAReq, sizeof( tLimMlmDelBAReq ), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07006105
6106 // Copy the peer MAC
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306107 vos_mem_copy(
Jeff Johnson295189b2012-06-20 16:38:30 -07006108 pMlmDelBAReq->peerMacAddr,
6109 pSta->staAddr,
6110 sizeof( tSirMacAddr ));
6111
6112 pMlmDelBAReq->baDirection = baDirection;
6113 pMlmDelBAReq->baTID = baTID;
6114 pMlmDelBAReq->delBAReasonCode = baReasonCode;
6115
6116 /* Update PE session ID*/
6117 pMlmDelBAReq->sessionId = psessionEntry->peSessionId;
6118
6119 //we don't have valid BA session for the given direction.
6120 // HDD wants to get the BA session deleted on PEER in this case.
6121 // in this case we just need to send DelBA to the peer.
6122 if(((eBA_RECIPIENT == baDirection) && (eBA_DISABLE == pSta->tcCfg[baTID].fUseBARx)) ||
6123 ((eBA_INITIATOR == baDirection) && (eBA_DISABLE == pSta->tcCfg[baTID].fUseBATx)))
6124 {
6125 // Send DELBA Ind over the air
6126 if( eSIR_SUCCESS !=
6127 (status = limSendDelBAInd( pMac, pMlmDelBAReq,psessionEntry)))
6128 status = eSIR_FAILURE;
6129
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306130 vos_mem_free(pMlmDelBAReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07006131 return status;
6132 }
6133
6134
6135 // Update the BA state in STA
6136 LIM_SET_STA_BA_STATE(pSta, pMlmDelBAReq->baTID, eLIM_BA_STATE_WT_DEL_RSP);
6137
6138 // Send DELBA Req to MLME
6139 limPostMlmMessage( pMac,
6140 LIM_MLM_DELBA_REQ,
6141 (tANI_U32 *) pMlmDelBAReq );
6142
6143returnFailure:
6144
6145 return status;
6146}
6147
6148/**
6149 * \brief Send WDA_ADDBA_REQ to HAL, in order
6150 * to setup a new BA session with a peer
6151 *
6152 * \sa limPostMsgAddBAReq
6153 *
6154 * \param pMac The global tpAniSirGlobal object
6155 *
6156 * \param pSta Runtime, STA-related configuration cached
6157 * in the HashNode object
6158 *
6159 * \param baDialogToken The Action Frame dialog token
6160 *
6161 * \param baTID TID for which the BA session is being setup
6162 *
6163 * \param baPolicy BA Policy
6164 *
6165 * \param baBufferSize The requested BA buffer size
6166 *
6167 * \param baTimeout BA Timeout. 0 indicates no BA timeout enforced
6168 *
6169 * \param baSSN Starting Sequence Number for this BA session
6170 *
6171 * \param baDirection BA Direction: 1 - Initiator, 0 - Recipient
6172 *
6173 * \return none
6174 *
6175 */
6176tSirRetStatus limPostMsgAddBAReq( tpAniSirGlobal pMac,
6177 tpDphHashNode pSta,
6178 tANI_U8 baDialogToken,
6179 tANI_U8 baTID,
6180 tANI_U8 baPolicy,
6181 tANI_U16 baBufferSize,
6182 tANI_U16 baTimeout,
6183 tANI_U16 baSSN,
6184 tANI_U8 baDirection,
6185 tpPESession psessionEntry)
6186{
6187tpAddBAParams pAddBAParams = NULL;
6188tSirRetStatus retCode = eSIR_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -07006189tSirMsgQ msgQ;
6190
6191#ifdef WLAN_SOFTAP_VSTA_FEATURE
6192 // we can only do BA on "hard" STAs
6193 if (!(IS_HWSTA_IDX(pSta->staIndex)))
6194 {
6195 retCode = eHAL_STATUS_FAILURE;
6196 goto returnFailure;
6197 }
6198#endif //WLAN_SOFTAP_VSTA_FEATURE
6199
6200 // Allocate for WDA_ADDBA_REQ
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306201 pAddBAParams = vos_mem_malloc(sizeof( tAddBAParams ));
6202 if ( NULL == pAddBAParams )
Jeff Johnson295189b2012-06-20 16:38:30 -07006203 {
6204 limLog( pMac, LOGE,
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306205 FL("AllocateMemory failed")
6206 );
Jeff Johnson295189b2012-06-20 16:38:30 -07006207
6208 retCode = eSIR_MEM_ALLOC_FAILED;
6209 goto returnFailure;
6210 }
6211
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306212 vos_mem_set( (void *) pAddBAParams, sizeof( tAddBAParams ), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07006213
6214 // Copy the peer MAC address
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306215 vos_mem_copy(
Jeff Johnson295189b2012-06-20 16:38:30 -07006216 (void *) pAddBAParams->peerMacAddr,
6217 (void *) pSta->staAddr,
6218 sizeof( tSirMacAddr ));
6219
6220 // Populate the REQ parameters
6221 pAddBAParams->staIdx = pSta->staIndex;
6222 pAddBAParams->baDialogToken = baDialogToken;
6223 pAddBAParams->baTID = baTID;
6224 pAddBAParams->baPolicy = baPolicy;
6225 pAddBAParams->baBufferSize = baBufferSize;
6226 pAddBAParams->baTimeout = baTimeout;
6227 pAddBAParams->baSSN = baSSN;
6228 pAddBAParams->baDirection = baDirection;
6229 pAddBAParams->respReqd = 1;
6230
6231 /* UPdate PE session ID */
6232 pAddBAParams->sessionId = psessionEntry->peSessionId;
6233
6234 // Post WDA_ADDBA_REQ to HAL.
6235 msgQ.type = WDA_ADDBA_REQ;
6236 //
6237 // FIXME_AMPDU
6238 // A global counter (dialog token) is required to keep track of
6239 // all PE <-> HAL communication(s)
6240 //
6241 msgQ.reserved = 0;
6242 msgQ.bodyptr = pAddBAParams;
6243 msgQ.bodyval = 0;
6244
6245 limLog( pMac, LOGW,
6246 FL( "Sending WDA_ADDBA_REQ..." ));
6247
6248 //defer any other message until we get response back.
6249 SET_LIM_PROCESS_DEFD_MESGS(pMac, false);
6250
Jeff Johnsone7245742012-09-05 17:12:55 -07006251 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07006252#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
6253 limDiagEventReport(pMac, WLAN_PE_DIAG_HAL_ADDBA_REQ_EVENT, psessionEntry, 0, 0);
6254#endif //FEATURE_WLAN_DIAG_SUPPORT
6255
6256 if( eSIR_SUCCESS != (retCode = wdaPostCtrlMsg( pMac, &msgQ )))
6257 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006258 FL("Posting WDA_ADDBA_REQ to HAL failed! Reason = %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07006259 retCode );
6260 else
6261 return retCode;
6262
6263returnFailure:
6264
6265 // Clean-up...
6266 if( NULL != pAddBAParams )
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306267 vos_mem_free( pAddBAParams );
Jeff Johnson295189b2012-06-20 16:38:30 -07006268
6269 return retCode;
6270
6271}
6272
6273/**
6274 * \brief Send WDA_DELBA_IND to HAL, in order
6275 * to delete an existing BA session with peer
6276 *
6277 * \sa limPostMsgDelBAInd
6278 *
6279 * \param pMac The global tpAniSirGlobal object
6280 *
6281 * \param pSta Runtime, STA-related configuration cached
6282 * in the HashNode object
6283 *
6284 * \param baTID TID for which the BA session is being setup
6285 *
6286 * \param baDirection Identifies whether the DELBA Ind was
6287 * sent by the BA initiator or recipient
6288 *
6289 * \return none
6290 *
6291 */
6292tSirRetStatus limPostMsgDelBAInd( tpAniSirGlobal pMac,
6293 tpDphHashNode pSta,
6294 tANI_U8 baTID,
6295 tANI_U8 baDirection,
6296 tpPESession psessionEntry)
6297{
6298tpDelBAParams pDelBAParams = NULL;
6299tSirRetStatus retCode = eSIR_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -07006300tSirMsgQ msgQ;
6301
6302 // Allocate for SIR_HAL_DELBA_IND
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306303 pDelBAParams = vos_mem_malloc(sizeof( tDelBAParams ));
6304 if ( NULL == pDelBAParams )
Jeff Johnson295189b2012-06-20 16:38:30 -07006305 {
6306 limLog( pMac, LOGE,
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306307 FL("AllocateMemory failed")
6308 );
Jeff Johnson295189b2012-06-20 16:38:30 -07006309
6310 retCode = eSIR_MEM_ALLOC_FAILED;
6311 goto returnFailure;
6312 }
6313
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306314 vos_mem_set( (void *) pDelBAParams, sizeof( tDelBAParams ), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07006315
6316 // Populate the REQ parameters
6317 pDelBAParams->staIdx = pSta->staIndex;
6318 pDelBAParams->baTID = baTID;
6319 pDelBAParams->baDirection = baDirection;
6320
6321 /* Update PE session ID */
6322
6323
6324 //TBD-RAJESH Updating of the session ID is requird for SIR_HAL_DELBA_IND?????
6325 //pDelBAParams->sessionId = psessionEntry->peSessionId;
6326
6327 // Post WDA_DELBA_IND to HAL.
6328 msgQ.type = WDA_DELBA_IND;
6329 //
6330 // FIXME:
6331 // A global counter (dialog token) is required to keep track of
6332 // all PE <-> HAL communication(s)
6333 //
6334 msgQ.reserved = 0;
6335 msgQ.bodyptr = pDelBAParams;
6336 msgQ.bodyval = 0;
6337
6338 limLog( pMac, LOGW,
6339 FL( "Sending SIR_HAL_DELBA_IND..." ));
6340
Jeff Johnsone7245742012-09-05 17:12:55 -07006341 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07006342#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
6343 limDiagEventReport(pMac, WLAN_PE_DIAG_HAL_DELBA_IND_EVENT, psessionEntry, 0, 0);
6344#endif //FEATURE_WLAN_DIAG_SUPPORT
6345
6346 if( eSIR_SUCCESS != (retCode = wdaPostCtrlMsg( pMac, &msgQ )))
6347 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006348 FL("Posting WDA_DELBA_IND to HAL failed! Reason = %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07006349 retCode );
6350 else
6351 {
6352 // Update LIM's internal cache...
6353 if( eBA_INITIATOR == baDirection)
6354 {
6355 pSta->tcCfg[baTID].fUseBATx = 0;
6356 pSta->tcCfg[baTID].txBufSize = 0;
6357 }
6358 else
6359 {
6360 pSta->tcCfg[baTID].fUseBARx = 0;
6361 pSta->tcCfg[baTID].rxBufSize = 0;
6362 }
6363
6364 return retCode;
6365 }
6366
6367returnFailure:
6368
6369 // Clean-up...
6370 if( NULL != pDelBAParams )
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306371 vos_mem_free( pDelBAParams );
Jeff Johnson295189b2012-06-20 16:38:30 -07006372
6373 return retCode;
6374
6375}
6376
6377/**
6378 * @function : limPostSMStateUpdate()
6379 *
6380 * @brief : This function Updates the HAL and Softmac about the change in the STA's SMPS state.
6381 *
6382 * LOGIC:
6383 *
6384 * ASSUMPTIONS:
6385 * NA
6386 *
6387 * NOTE:
6388 * NA
6389 *
6390 * @param pMac - Pointer to Global MAC structure
6391 * @param limMsg - Lim Message structure object with the MimoPSparam in body
6392 * @return None
6393 */
6394tSirRetStatus
6395limPostSMStateUpdate(tpAniSirGlobal pMac,
6396 tANI_U16 staIdx, tSirMacHTMIMOPowerSaveState state)
6397{
6398 tSirRetStatus retCode = eSIR_SUCCESS;
6399 tSirMsgQ msgQ;
Jeff Johnson295189b2012-06-20 16:38:30 -07006400 tpSetMIMOPS pMIMO_PSParams;
6401
6402 msgQ.reserved = 0;
6403 msgQ.type = WDA_SET_MIMOPS_REQ;
6404
6405 // Allocate for WDA_SET_MIMOPS_REQ
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306406 pMIMO_PSParams = vos_mem_malloc(sizeof(tSetMIMOPS));
6407 if ( NULL == pMIMO_PSParams )
6408 {
6409 limLog( pMac, LOGP,FL(" AllocateMemory failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07006410 return eSIR_MEM_ALLOC_FAILED;
6411 }
6412
6413 pMIMO_PSParams->htMIMOPSState = state;
6414 pMIMO_PSParams->staIdx = staIdx;
6415 pMIMO_PSParams->fsendRsp = true;
6416 msgQ.bodyptr = pMIMO_PSParams;
6417 msgQ.bodyval = 0;
6418
6419 limLog( pMac, LOG2, FL( "Sending WDA_SET_MIMOPS_REQ..." ));
6420
Jeff Johnsone7245742012-09-05 17:12:55 -07006421 MTRACE(macTraceMsgTx(pMac, NO_SESSION, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07006422 retCode = wdaPostCtrlMsg( pMac, &msgQ );
6423 if (eSIR_SUCCESS != retCode)
6424 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006425 limLog( pMac, LOGP, FL("Posting WDA_SET_MIMOPS_REQ to HAL failed! Reason = %d"), retCode );
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306426 vos_mem_free(pMIMO_PSParams);
Jeff Johnson295189b2012-06-20 16:38:30 -07006427 return retCode;
6428 }
6429
6430 return retCode;
6431}
6432
6433void limPktFree (
6434 tpAniSirGlobal pMac,
6435 eFrameType frmType,
6436 tANI_U8 *pRxPacketInfo,
6437 void *pBody)
6438{
6439 (void) pMac; (void) frmType; (void) pRxPacketInfo; (void) pBody;
Jeff Johnson295189b2012-06-20 16:38:30 -07006440}
6441
6442/**
6443 * limGetBDfromRxPacket()
6444 *
6445 *FUNCTION:
6446 * This function is called to get pointer to Polaris
6447 * Buffer Descriptor containing MAC header & other control
6448 * info from the body of the message posted to LIM.
6449 *
6450 *LOGIC:
6451 * NA
6452 *
6453 *ASSUMPTIONS:
6454 * NA
6455 *
6456 *NOTE:
6457 * NA
6458 *
6459 * @param body - Received message body
6460 * @param pRxPacketInfo - Pointer to received BD
6461 * @return None
6462 */
6463
6464void
6465limGetBDfromRxPacket(tpAniSirGlobal pMac, void *body, tANI_U32 **pRxPacketInfo)
6466{
Jeff Johnson295189b2012-06-20 16:38:30 -07006467 *pRxPacketInfo = (tANI_U32 *) body;
Jeff Johnson295189b2012-06-20 16:38:30 -07006468} /*** end limGetBDfromRxPacket() ***/
6469
6470
6471
6472
6473
6474void limRessetScanChannelInfo(tpAniSirGlobal pMac)
6475{
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306476 vos_mem_set(&pMac->lim.scanChnInfo, sizeof(tLimScanChnInfo), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07006477}
6478
6479
6480void limAddScanChannelInfo(tpAniSirGlobal pMac, tANI_U8 channelId)
6481{
6482 tANI_U8 i;
6483 tANI_BOOLEAN fFound = eANI_BOOLEAN_FALSE;
6484
6485 for(i = 0; i < pMac->lim.scanChnInfo.numChnInfo; i++)
6486 {
6487 if(pMac->lim.scanChnInfo.scanChn[i].channelId == channelId)
6488 {
6489 pMac->lim.scanChnInfo.scanChn[i].numTimeScan++;
6490 fFound = eANI_BOOLEAN_TRUE;
6491 break;
6492 }
6493 }
6494 if(eANI_BOOLEAN_FALSE == fFound)
6495 {
6496 if(pMac->lim.scanChnInfo.numChnInfo < SIR_MAX_SUPPORTED_CHANNEL_LIST)
6497 {
6498 pMac->lim.scanChnInfo.scanChn[pMac->lim.scanChnInfo.numChnInfo].channelId = channelId;
6499 pMac->lim.scanChnInfo.scanChn[pMac->lim.scanChnInfo.numChnInfo++].numTimeScan = 1;
6500 }
6501 else
6502 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006503 PELOGW(limLog(pMac, LOGW, FL(" -- number of channels exceed mac"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07006504 }
6505 }
6506}
6507
6508
6509/**
6510 * @function : limIsChannelValidForChannelSwitch()
6511 *
6512 * @brief : This function checks if the channel to which AP
6513 * is expecting us to switch, is a valid channel for us.
6514 * LOGIC:
6515 *
6516 * ASSUMPTIONS:
6517 * NA
6518 *
6519 * NOTE:
6520 * NA
6521 *
6522 * @param pMac - Pointer to Global MAC structure
6523 * @param channel - New channel to which we are expected to move
6524 * @return None
6525 */
6526tAniBool
6527limIsChannelValidForChannelSwitch(tpAniSirGlobal pMac, tANI_U8 channel)
6528{
6529 tANI_U8 index;
6530 tANI_U32 validChannelListLen = WNI_CFG_VALID_CHANNEL_LIST_LEN;
6531 tSirMacChanNum validChannelList[WNI_CFG_VALID_CHANNEL_LIST_LEN];
6532
6533 if (wlan_cfgGetStr(pMac, WNI_CFG_VALID_CHANNEL_LIST,
6534 (tANI_U8 *)validChannelList,
6535 (tANI_U32 *)&validChannelListLen) != eSIR_SUCCESS)
6536 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006537 PELOGE(limLog(pMac, LOGE, FL("could not retrieve valid channel list"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07006538 return (eSIR_FALSE);
6539 }
6540
6541 for(index = 0; index < validChannelListLen; index++)
6542 {
6543 if(validChannelList[index] == channel)
6544 return (eSIR_TRUE);
6545 }
6546
6547 /* channel does not belong to list of valid channels */
6548 return (eSIR_FALSE);
6549}
6550
6551/**------------------------------------------------------
6552\fn __limFillTxControlParams
6553\brief Fill the message for stopping/resuming tx.
6554
6555\param pMac
6556\param pTxCtrlMsg - Pointer to tx control message.
6557\param type - Which way we want to stop/ resume tx.
6558\param mode - To stop/resume.
6559 -------------------------------------------------------*/
6560static eHalStatus
6561__limFillTxControlParams(tpAniSirGlobal pMac, tpTxControlParams pTxCtrlMsg,
6562 tLimQuietTxMode type, tLimControlTx mode)
6563{
6564
6565 //TBD-RAJESH HOW TO GET sessionEntry?????
6566 tpPESession psessionEntry = &pMac->lim.gpSession[0];
6567
6568 if (mode == eLIM_STOP_TX)
6569 pTxCtrlMsg->stopTx = eANI_BOOLEAN_TRUE;
6570 else
6571 pTxCtrlMsg->stopTx = eANI_BOOLEAN_FALSE;
6572
6573 switch (type)
6574 {
6575 case eLIM_TX_ALL:
6576 /** Stops/resumes transmission completely */
6577 pTxCtrlMsg->fCtrlGlobal = 1;
6578 break;
6579
6580 case eLIM_TX_BSS_BUT_BEACON:
6581 /** Stops/resumes transmission on a particular BSS. Stopping BSS, doesnt
6582 * stop beacon transmission.
6583 */
6584 pTxCtrlMsg->ctrlBss = 1;
6585 pTxCtrlMsg->bssBitmap |= (1 << psessionEntry->bssIdx);
6586 break;
6587
6588 case eLIM_TX_STA:
6589 /** Memory for station bitmap is allocated dynamically in caller of this
6590 * so decode properly here and fill the bitmap. Now not implemented,
6591 * fall through.
6592 */
6593 case eLIM_TX_BSS:
6594 //Fall thru...
6595 default:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006596 PELOGW(limLog(pMac, LOGW, FL("Invalid case: Not Handled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07006597 return eHAL_STATUS_FAILURE;
6598 }
6599
6600 return eHAL_STATUS_SUCCESS;
6601}
6602
6603/**
6604 * @function : limFrameTransmissionControl()
6605 *
6606 * @brief : This API is called by the user to halt/resume any frame
6607 * transmission from the device. If stopped, all frames will be
6608 * queued starting from hardware. Then back-pressure
6609 * is built till the driver.
6610 * LOGIC:
6611 *
6612 * ASSUMPTIONS:
6613 * NA
6614 *
6615 * NOTE:
6616 * NA
6617 *
6618 * @param pMac - Pointer to Global MAC structure
6619 * @return None
6620 */
6621void limFrameTransmissionControl(tpAniSirGlobal pMac, tLimQuietTxMode type, tLimControlTx mode)
6622{
6623
6624 eHalStatus status = eHAL_STATUS_FAILURE;
6625 tpTxControlParams pTxCtrlMsg;
6626 tSirMsgQ msgQ;
6627 tANI_U8 nBytes = 0; // No of bytes required for station bitmap.
6628
6629 /** Allocate only required number of bytes for station bitmap
6630 * Make it to align to 4 byte boundary */
6631 nBytes = (tANI_U8)HALMSG_NUMBYTES_STATION_BITMAP(pMac->lim.maxStation);
6632
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306633 pTxCtrlMsg = vos_mem_malloc(sizeof(*pTxCtrlMsg) + nBytes);
6634 if ( NULL == pTxCtrlMsg )
Jeff Johnson295189b2012-06-20 16:38:30 -07006635 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306636 limLog(pMac, LOGP, FL("AllocateMemory() failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07006637 return;
6638 }
6639
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306640 vos_mem_set((void *) pTxCtrlMsg,
6641 (sizeof(*pTxCtrlMsg) + nBytes), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07006642 status = __limFillTxControlParams(pMac, pTxCtrlMsg, type, mode);
6643 if (status != eHAL_STATUS_SUCCESS)
6644 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306645 vos_mem_free(pTxCtrlMsg);
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006646 limLog(pMac, LOGP, FL("__limFillTxControlParams failed, status = %d"), status);
Jeff Johnson295189b2012-06-20 16:38:30 -07006647 return;
6648 }
6649
6650 msgQ.bodyptr = (void *) pTxCtrlMsg;
6651 msgQ.bodyval = 0;
6652 msgQ.reserved = 0;
6653 msgQ.type = WDA_TRANSMISSION_CONTROL_IND;
6654
Jeff Johnsone7245742012-09-05 17:12:55 -07006655 MTRACE(macTraceMsgTx(pMac, NO_SESSION, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07006656 if(wdaPostCtrlMsg( pMac, &msgQ) != eSIR_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("Posting Message to HAL failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07006660 return;
6661 }
6662
6663 if (mode == eLIM_STOP_TX)
6664 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006665 PELOG1(limLog(pMac, LOG1, FL("Stopping the transmission of all packets, indicated softmac"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07006666 }
6667 else
6668 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006669 PELOG1(limLog(pMac, LOG1, FL("Resuming the transmission of all packets, indicated softmac"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07006670 }
6671 return;
6672}
6673
6674
6675/**
6676 * @function : limRestorePreChannelSwitchState()
6677 *
6678 * @brief : This API is called by the user to undo any
6679 * specific changes done on the device during
6680 * channel switch.
6681 * LOGIC:
6682 *
6683 * ASSUMPTIONS:
6684 * NA
6685 *
6686 * NOTE:
6687 * NA
6688 *
6689 * @param pMac - Pointer to Global MAC structure
6690 * @return None
6691 */
6692
6693tSirRetStatus
6694limRestorePreChannelSwitchState(tpAniSirGlobal pMac, tpPESession psessionEntry)
6695{
6696
6697 tSirRetStatus retCode = eSIR_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -07006698 tANI_U32 val = 0;
6699
6700 if (psessionEntry->limSystemRole != eLIM_STA_ROLE)
6701 return retCode;
6702
6703 /* Channel switch should be ready for the next time */
Jeff Johnsone7245742012-09-05 17:12:55 -07006704 psessionEntry->gLimSpecMgmt.dot11hChanSwState = eLIM_11H_CHANSW_INIT;
Jeff Johnson295189b2012-06-20 16:38:30 -07006705
6706 /* Restore the frame transmission, all the time. */
6707 limFrameTransmissionControl(pMac, eLIM_TX_ALL, eLIM_RESUME_TX);
6708
6709 /* Free to enter BMPS */
6710 limSendSmePostChannelSwitchInd(pMac);
6711
6712 //Background scan is now enabled by SME
6713 if(pMac->lim.gLimBackgroundScanTerminate == FALSE)
6714 {
6715 /* Enable background scan if already enabled, else don't bother */
6716 if ((retCode = wlan_cfgGetInt(pMac, WNI_CFG_BACKGROUND_SCAN_PERIOD,
6717 &val)) != eSIR_SUCCESS)
6718
6719 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006720 limLog(pMac, LOGP, FL("could not retrieve Background scan period value"));
Jeff Johnson295189b2012-06-20 16:38:30 -07006721 return (retCode);
6722 }
6723
6724 if (val > 0 && TX_TIMER_VALID(pMac->lim.limTimers.gLimBackgroundScanTimer))
6725 {
Ravi Joshid2ca7c42013-07-23 08:37:49 -07006726 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE,
6727 psessionEntry->peSessionId, eLIM_BACKGROUND_SCAN_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -07006728 if(tx_timer_activate(&pMac->lim.limTimers.gLimBackgroundScanTimer) != TX_SUCCESS)
6729 {
6730 limLog(pMac, LOGP, FL("Could not restart background scan timer, doing LOGP"));
6731 return (eSIR_FAILURE);
6732 }
6733
6734 }
6735 }
6736
6737 /* Enable heartbeat timer */
6738 if (TX_TIMER_VALID(pMac->lim.limTimers.gLimHeartBeatTimer))
6739 {
Ravi Joshid2ca7c42013-07-23 08:37:49 -07006740 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE,
6741 psessionEntry->peSessionId, eLIM_HEART_BEAT_TIMER));
6742 if((limActivateHearBeatTimer(pMac, psessionEntry) != TX_SUCCESS) &&
6743 (!IS_ACTIVEMODE_OFFLOAD_FEATURE_ENABLE))
Jeff Johnson295189b2012-06-20 16:38:30 -07006744 {
6745 limLog(pMac, LOGP, FL("Could not restart heartbeat timer, doing LOGP"));
6746 return (eSIR_FAILURE);
6747 }
6748 }
Jeff Johnson295189b2012-06-20 16:38:30 -07006749 return (retCode);
6750}
6751
6752
6753/**--------------------------------------------
6754\fn limRestorePreQuietState
6755\brief Restore the pre quiet state
6756
6757\param pMac
6758\return NONE
6759---------------------------------------------*/
Jeff Johnsone7245742012-09-05 17:12:55 -07006760tSirRetStatus limRestorePreQuietState(tpAniSirGlobal pMac, tpPESession psessionEntry)
Jeff Johnson295189b2012-06-20 16:38:30 -07006761{
6762
6763 tSirRetStatus retCode = eSIR_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -07006764 tANI_U32 val = 0;
6765
6766 if (pMac->lim.gLimSystemRole != eLIM_STA_ROLE)
6767 return retCode;
6768
6769 /* Quiet should be ready for the next time */
Jeff Johnsone7245742012-09-05 17:12:55 -07006770 psessionEntry->gLimSpecMgmt.quietState = eLIM_QUIET_INIT;
Jeff Johnson295189b2012-06-20 16:38:30 -07006771
6772 /* Restore the frame transmission, all the time. */
Jeff Johnsone7245742012-09-05 17:12:55 -07006773 if (psessionEntry->gLimSpecMgmt.quietState == eLIM_QUIET_RUNNING)
Jeff Johnson295189b2012-06-20 16:38:30 -07006774 limFrameTransmissionControl(pMac, eLIM_TX_ALL, eLIM_RESUME_TX);
6775
6776
6777 //Background scan is now enabled by SME
6778 if(pMac->lim.gLimBackgroundScanTerminate == FALSE)
6779 {
6780 /* Enable background scan if already enabled, else don't bother */
6781 if ((retCode = wlan_cfgGetInt(pMac, WNI_CFG_BACKGROUND_SCAN_PERIOD,
6782 &val)) != eSIR_SUCCESS)
6783
6784 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006785 limLog(pMac, LOGP, FL("could not retrieve Background scan period value"));
Jeff Johnson295189b2012-06-20 16:38:30 -07006786 return (retCode);
6787 }
6788
6789 if (val > 0 && TX_TIMER_VALID(pMac->lim.limTimers.gLimBackgroundScanTimer))
6790 {
Leela V Kiran Kumar Reddy Chiralac3b9d382013-01-31 20:49:53 -08006791 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, psessionEntry->peSessionId, eLIM_BACKGROUND_SCAN_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -07006792 if(tx_timer_activate(&pMac->lim.limTimers.gLimBackgroundScanTimer) != TX_SUCCESS)
6793 {
6794 limLog(pMac, LOGP, FL("Could not restart background scan timer, doing LOGP"));
6795 return (eSIR_FAILURE);
6796 }
6797
6798 }
6799 }
6800
6801 /* Enable heartbeat timer */
6802 if (TX_TIMER_VALID(pMac->lim.limTimers.gLimHeartBeatTimer))
6803 {
Leela V Kiran Kumar Reddy Chiralac3b9d382013-01-31 20:49:53 -08006804 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, psessionEntry->peSessionId, eLIM_HEART_BEAT_TIMER));
Ravi Joshid2ca7c42013-07-23 08:37:49 -07006805 if(limActivateHearBeatTimer(pMac, psessionEntry) != TX_SUCCESS)
Jeff Johnson295189b2012-06-20 16:38:30 -07006806 {
6807 limLog(pMac, LOGP, FL("Could not restart heartbeat timer, doing LOGP"));
6808 return (eSIR_FAILURE);
6809 }
6810 }
Jeff Johnson295189b2012-06-20 16:38:30 -07006811 return (retCode);
6812}
6813
6814
6815/**
6816 * @function: limPrepareFor11hChannelSwitch()
6817 *
6818 * @brief : This API is called by the user to prepare for
6819 * 11h channel switch. As of now, the API does
6820 * very minimal work. User can add more into the
6821 * same API if needed.
6822 * LOGIC:
6823 *
6824 * ASSUMPTIONS:
6825 * NA
6826 *
6827 * NOTE:
6828 * NA
6829 *
6830 * @param pMac - Pointer to Global MAC structure
6831 * @param psessionEntry
6832 * @return None
6833 */
6834void
6835limPrepareFor11hChannelSwitch(tpAniSirGlobal pMac, tpPESession psessionEntry)
6836{
Jeff Johnson295189b2012-06-20 16:38:30 -07006837 if (psessionEntry->limSystemRole != eLIM_STA_ROLE)
6838 return;
6839
6840 /* Flag to indicate 11h channel switch in progress */
Jeff Johnsone7245742012-09-05 17:12:55 -07006841 psessionEntry->gLimSpecMgmt.dot11hChanSwState = eLIM_11H_CHANSW_RUNNING;
Jeff Johnson295189b2012-06-20 16:38:30 -07006842
6843 /* Disable, Stop background scan if enabled and running */
6844 limDeactivateAndChangeTimer(pMac, eLIM_BACKGROUND_SCAN_TIMER);
6845
6846 /* Stop heart-beat timer to stop heartbeat disassociation */
6847 limHeartBeatDeactivateAndChangeTimer(pMac, psessionEntry);
6848
6849 if(pMac->lim.gLimSmeState == eLIM_SME_LINK_EST_WT_SCAN_STATE ||
6850 pMac->lim.gLimSmeState == eLIM_SME_CHANNEL_SCAN_STATE)
6851 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006852 PELOGE(limLog(pMac, LOGE, FL("Posting finish scan as we are in scan state"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07006853 /* Stop ongoing scanning if any */
6854 if (GET_LIM_PROCESS_DEFD_MESGS(pMac))
6855 {
6856 //Set the resume channel to Any valid channel (invalid).
6857 //This will instruct HAL to set it to any previous valid channel.
6858 peSetResumeChannel(pMac, 0, 0);
6859 limSendHalFinishScanReq(pMac, eLIM_HAL_FINISH_SCAN_WAIT_STATE);
6860 }
6861 else
6862 {
6863 limRestorePreChannelSwitchState(pMac, psessionEntry);
6864 }
6865 return;
6866 }
6867 else
6868 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006869 PELOGE(limLog(pMac, LOGE, FL("Not in scan state, start channel switch timer"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07006870 /** We are safe to switch channel at this point */
6871 limStopTxAndSwitchChannel(pMac, psessionEntry->peSessionId);
6872 }
Jeff Johnson295189b2012-06-20 16:38:30 -07006873}
6874
6875
6876
6877/**----------------------------------------------------
6878\fn limGetNwType
6879
6880\brief Get type of the network from data packet or beacon
6881\param pMac
6882\param channelNum - Channel number
6883\param type - Type of packet.
6884\param pBeacon - Pointer to beacon or probe response
6885
6886\return Network type a/b/g.
6887-----------------------------------------------------*/
6888tSirNwType limGetNwType(tpAniSirGlobal pMac, tANI_U8 channelNum, tANI_U32 type, tpSchBeaconStruct pBeacon)
6889{
6890 tSirNwType nwType = eSIR_11B_NW_TYPE;
6891
6892 if (type == SIR_MAC_DATA_FRAME)
6893 {
6894 if ((channelNum > 0) && (channelNum < 15))
6895 {
6896 nwType = eSIR_11G_NW_TYPE;
6897 }
6898 else
6899 {
6900 nwType = eSIR_11A_NW_TYPE;
6901 }
6902 }
6903 else
6904 {
6905 if ((channelNum > 0) && (channelNum < 15))
6906 {
6907 int i;
6908 // 11b or 11g packet
6909 // 11g iff extended Rate IE is present or
6910 // if there is an A rate in suppRate IE
6911 for (i = 0; i < pBeacon->supportedRates.numRates; i++)
6912 {
6913 if (sirIsArate(pBeacon->supportedRates.rate[i] & 0x7f))
6914 {
6915 nwType = eSIR_11G_NW_TYPE;
6916 break;
6917 }
6918 }
6919 if (pBeacon->extendedRatesPresent)
6920 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006921 PELOG3(limLog(pMac, LOG3, FL("Beacon, nwtype=G"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07006922 nwType = eSIR_11G_NW_TYPE;
6923 }
6924 }
6925 else
6926 {
6927 // 11a packet
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006928 PELOG3(limLog(pMac, LOG3,FL("Beacon, nwtype=A"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07006929 nwType = eSIR_11A_NW_TYPE;
6930 }
6931 }
6932 return nwType;
6933}
6934
6935
6936/**---------------------------------------------------------
6937\fn limGetChannelFromBeacon
6938\brief To extract channel number from beacon
6939
6940\param pMac
6941\param pBeacon - Pointer to beacon or probe rsp
6942\return channel number
6943-----------------------------------------------------------*/
6944tANI_U8 limGetChannelFromBeacon(tpAniSirGlobal pMac, tpSchBeaconStruct pBeacon)
6945{
6946 tANI_U8 channelNum = 0;
6947
6948 if (pBeacon->dsParamsPresent)
6949 channelNum = pBeacon->channelNumber;
6950 else if(pBeacon->HTInfo.present)
6951 channelNum = pBeacon->HTInfo.primaryChannel;
6952 else
6953 channelNum = pBeacon->channelNumber;
6954
6955 return channelNum;
6956}
6957
6958
6959/** ---------------------------------------------------------
6960\fn limSetTspecUapsdMask
6961\brief This function sets the PE global variable:
6962\ 1) gUapsdPerAcTriggerEnableMask and
6963\ 2) gUapsdPerAcDeliveryEnableMask
6964\ based on the user priority field and direction field
6965\ in the TS Info Fields.
6966\
6967\ An AC is a trigger-enabled AC if the PSB subfield
6968\ is set to 1 in the uplink direction.
6969\ An AC is a delivery-enabled AC if the PSB subfield
6970\ is set to 1 in the down-link direction.
6971\
6972\param tpAniSirGlobal pMac
6973\param tSirMacTSInfo pTsInfo
6974\param tANI_U32 action
6975\return None
6976 ------------------------------------------------------------*/
6977void limSetTspecUapsdMask(tpAniSirGlobal pMac, tSirMacTSInfo *pTsInfo, tANI_U32 action)
6978{
6979 tANI_U8 userPrio = (tANI_U8)pTsInfo->traffic.userPrio;
6980 tANI_U16 direction = pTsInfo->traffic.direction;
6981 tANI_U8 ac = upToAc(userPrio);
6982
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006983 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 -07006984
6985 /* Converting AC to appropriate Uapsd Bit Mask
6986 * AC_BE(0) --> UAPSD_BITOFFSET_ACVO(3)
6987 * AC_BK(1) --> UAPSD_BITOFFSET_ACVO(2)
6988 * AC_VI(2) --> UAPSD_BITOFFSET_ACVO(1)
6989 * AC_VO(3) --> UAPSD_BITOFFSET_ACVO(0)
6990 */
6991 ac = ((~ac) & 0x3);
6992
6993 if (action == CLEAR_UAPSD_MASK)
6994 {
6995 if (direction == SIR_MAC_DIRECTION_UPLINK)
6996 pMac->lim.gUapsdPerAcTriggerEnableMask &= ~(1 << ac);
6997 else if (direction == SIR_MAC_DIRECTION_DNLINK)
6998 pMac->lim.gUapsdPerAcDeliveryEnableMask &= ~(1 << ac);
6999 else if (direction == SIR_MAC_DIRECTION_BIDIR)
7000 {
7001 pMac->lim.gUapsdPerAcTriggerEnableMask &= ~(1 << ac);
7002 pMac->lim.gUapsdPerAcDeliveryEnableMask &= ~(1 << ac);
7003 }
7004 }
7005 else if (action == SET_UAPSD_MASK)
7006 {
7007 if (direction == SIR_MAC_DIRECTION_UPLINK)
7008 pMac->lim.gUapsdPerAcTriggerEnableMask |= (1 << ac);
7009 else if (direction == SIR_MAC_DIRECTION_DNLINK)
7010 pMac->lim.gUapsdPerAcDeliveryEnableMask |= (1 << ac);
7011 else if (direction == SIR_MAC_DIRECTION_BIDIR)
7012 {
7013 pMac->lim.gUapsdPerAcTriggerEnableMask |= (1 << ac);
7014 pMac->lim.gUapsdPerAcDeliveryEnableMask |= (1 << ac);
7015 }
7016 }
7017
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007018 limLog(pMac, LOGE, FL("New pMac->lim.gUapsdPerAcTriggerEnableMask = 0x%x "), pMac->lim.gUapsdPerAcTriggerEnableMask );
7019 limLog(pMac, LOGE, FL("New pMac->lim.gUapsdPerAcDeliveryEnableMask = 0x%x "), pMac->lim.gUapsdPerAcDeliveryEnableMask );
Jeff Johnson295189b2012-06-20 16:38:30 -07007020
7021 return;
7022}
7023
7024
7025
7026void limHandleHeartBeatTimeout(tpAniSirGlobal pMac )
7027{
7028
7029 tANI_U8 i;
7030 for(i =0;i < pMac->lim.maxBssId;i++)
7031 {
7032 if(pMac->lim.gpSession[i].valid == TRUE )
7033 {
7034 if(pMac->lim.gpSession[i].bssType == eSIR_IBSS_MODE)
7035 {
7036 limIbssHeartBeatHandle(pMac,&pMac->lim.gpSession[i]);
7037 break;
7038 }
7039
7040 if((pMac->lim.gpSession[i].bssType == eSIR_INFRASTRUCTURE_MODE) &&
7041 (pMac->lim.gpSession[i].limSystemRole == eLIM_STA_ROLE))
7042 {
7043 limHandleHeartBeatFailure(pMac,&pMac->lim.gpSession[i]);
7044 }
7045 }
7046 }
7047 for(i=0; i< pMac->lim.maxBssId; i++)
7048 {
7049 if(pMac->lim.gpSession[i].valid == TRUE )
7050 {
7051 if((pMac->lim.gpSession[i].bssType == eSIR_INFRASTRUCTURE_MODE) &&
7052 (pMac->lim.gpSession[i].limSystemRole == eLIM_STA_ROLE))
7053 {
7054 if(pMac->lim.gpSession[i].LimHBFailureStatus == eANI_BOOLEAN_TRUE)
7055 {
7056 /* Activate Probe After HeartBeat Timer incase HB Failure detected */
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007057 PELOGW(limLog(pMac, LOGW,FL("Sending Probe for Session: %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07007058 i);)
7059 limDeactivateAndChangeTimer(pMac, eLIM_PROBE_AFTER_HB_TIMER);
7060 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, 0, eLIM_PROBE_AFTER_HB_TIMER));
7061 if (tx_timer_activate(&pMac->lim.limTimers.gLimProbeAfterHBTimer) != TX_SUCCESS)
7062 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007063 limLog(pMac, LOGP, FL("Fail to re-activate Probe-after-heartbeat timer"));
Jeff Johnson295189b2012-06-20 16:38:30 -07007064 limReactivateHeartBeatTimer(pMac, &pMac->lim.gpSession[i]);
7065 }
7066 break;
7067 }
7068 }
7069 }
7070 }
7071}
7072
Leela Venkata Kiran Kumar Reddy Chirala3ca17902013-02-27 19:50:05 -08007073void limHandleHeartBeatTimeoutForSession(tpAniSirGlobal pMac, tpPESession psessionEntry)
7074{
7075 if(psessionEntry->valid == TRUE )
7076 {
7077 if(psessionEntry->bssType == eSIR_IBSS_MODE)
7078 {
7079 limIbssHeartBeatHandle(pMac,psessionEntry);
7080 }
7081 if((psessionEntry->bssType == eSIR_INFRASTRUCTURE_MODE) &&
7082 (psessionEntry->limSystemRole == eLIM_STA_ROLE))
7083 {
7084 limHandleHeartBeatFailure(pMac,psessionEntry);
7085 }
7086 }
7087 /* In the function limHandleHeartBeatFailure things can change so check for the session entry valid
7088 and the other things again */
7089 if(psessionEntry->valid == TRUE )
7090 {
7091 if((psessionEntry->bssType == eSIR_INFRASTRUCTURE_MODE) &&
7092 (psessionEntry->limSystemRole == eLIM_STA_ROLE))
7093 {
7094 if(psessionEntry->LimHBFailureStatus == eANI_BOOLEAN_TRUE)
7095 {
7096 /* Activate Probe After HeartBeat Timer incase HB Failure detected */
7097 PELOGW(limLog(pMac, LOGW,FL("Sending Probe for Session: %d"),
7098 psessionEntry->bssIdx);)
7099 limDeactivateAndChangeTimer(pMac, eLIM_PROBE_AFTER_HB_TIMER);
7100 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, 0, eLIM_PROBE_AFTER_HB_TIMER));
7101 if (tx_timer_activate(&pMac->lim.limTimers.gLimProbeAfterHBTimer) != TX_SUCCESS)
7102 {
7103 limLog(pMac, LOGP, FL("Fail to re-activate Probe-after-heartbeat timer"));
7104 limReactivateHeartBeatTimer(pMac, psessionEntry);
7105 }
7106 }
7107 }
7108 }
7109}
7110
7111
Jeff Johnson295189b2012-06-20 16:38:30 -07007112tANI_U8 limGetCurrentOperatingChannel(tpAniSirGlobal pMac)
7113{
7114 tANI_U8 i;
7115 for(i =0;i < pMac->lim.maxBssId;i++)
7116 {
7117 if(pMac->lim.gpSession[i].valid == TRUE )
7118 {
7119 if((pMac->lim.gpSession[i].bssType == eSIR_INFRASTRUCTURE_MODE) &&
7120 (pMac->lim.gpSession[i].limSystemRole == eLIM_STA_ROLE))
7121 {
7122 return pMac->lim.gpSession[i].currentOperChannel;
7123 }
7124 }
7125 }
7126 return 0;
7127}
7128
7129void limProcessAddStaRsp(tpAniSirGlobal pMac,tpSirMsgQ limMsgQ)
7130{
7131
7132 tpPESession psessionEntry;
7133// tANI_U8 sessionId;
7134 tpAddStaParams pAddStaParams;
7135
7136 pAddStaParams = (tpAddStaParams)limMsgQ->bodyptr;
7137
7138 if((psessionEntry = peFindSessionBySessionId(pMac,pAddStaParams->sessionId))==NULL)
7139 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007140 limLog(pMac, LOGP,FL("Session Does not exist for given sessionID"));
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307141 vos_mem_free(pAddStaParams);
Jeff Johnson295189b2012-06-20 16:38:30 -07007142 return;
7143 }
7144 if (psessionEntry->limSystemRole == eLIM_STA_IN_IBSS_ROLE)
7145 (void) limIbssAddStaRsp(pMac, limMsgQ->bodyptr,psessionEntry);
Mohit Khanna698ba2a2012-12-04 15:08:18 -08007146#ifdef FEATURE_WLAN_TDLS
7147 else if(pMac->lim.gLimAddStaTdls)
7148 {
7149 limProcessTdlsAddStaRsp(pMac, limMsgQ->bodyptr, psessionEntry) ;
7150 pMac->lim.gLimAddStaTdls = FALSE ;
7151 }
7152#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07007153 else
7154 limProcessMlmAddStaRsp(pMac, limMsgQ,psessionEntry);
7155
7156}
7157
7158
7159void limUpdateBeacon(tpAniSirGlobal pMac)
7160{
7161 tANI_U8 i;
7162
7163 for(i =0;i < pMac->lim.maxBssId;i++)
7164 {
7165 if(pMac->lim.gpSession[i].valid == TRUE )
7166 {
7167 if( ( (pMac->lim.gpSession[i].limSystemRole == eLIM_AP_ROLE) ||
7168 (pMac->lim.gpSession[i].limSystemRole == eLIM_STA_IN_IBSS_ROLE) )
7169 && (eLIM_SME_NORMAL_STATE == pMac->lim.gpSession[i].limSmeState)
7170 )
7171 {
7172 schSetFixedBeaconFields(pMac,&pMac->lim.gpSession[i]);
7173 limSendBeaconInd(pMac, &pMac->lim.gpSession[i]);
7174 }
7175 else
7176 {
7177 if( (pMac->lim.gpSession[i].limSystemRole == eLIM_BT_AMP_AP_ROLE)||
7178 (pMac->lim.gpSession[i].limSystemRole == eLIM_BT_AMP_STA_ROLE))
7179 {
7180
7181 if(pMac->lim.gpSession[i].statypeForBss == STA_ENTRY_SELF)
7182 {
7183 schSetFixedBeaconFields(pMac,&pMac->lim.gpSession[i]);
7184 }
7185 }
7186 }
7187 }
7188 }
7189}
7190
7191void limHandleHeartBeatFailureTimeout(tpAniSirGlobal pMac)
7192{
7193 tANI_U8 i;
7194 tpPESession psessionEntry;
7195 /* Probe response is not received after HB failure. This is handled by LMM sub module. */
7196 for(i =0; i < pMac->lim.maxBssId; i++)
7197 {
7198 if(pMac->lim.gpSession[i].valid == TRUE)
7199 {
7200 psessionEntry = &pMac->lim.gpSession[i];
7201 if(psessionEntry->LimHBFailureStatus == eANI_BOOLEAN_TRUE)
7202 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007203 limLog(pMac, LOGE, FL("Probe_hb_failure: SME %d, MLME %d, HB-Count %d"),psessionEntry->limSmeState,
Jeff Johnson295189b2012-06-20 16:38:30 -07007204 psessionEntry->limMlmState, psessionEntry->LimRxedBeaconCntDuringHB);
Leela Venkata Kiran Kumar Reddy Chirala2365ee62013-05-09 17:30:12 -07007205#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
7206 limDiagEventReport(pMac, WLAN_PE_DIAG_HB_FAILURE_TIMEOUT, psessionEntry, 0, 0);
7207#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07007208 if (psessionEntry->limMlmState == eLIM_MLM_LINK_ESTABLISHED_STATE)
7209 {
Leela Venkata Kiran Kumar Reddy Chiralaab842fb2013-04-30 12:27:35 -07007210 if ((!LIM_IS_CONNECTION_ACTIVE(psessionEntry))&&
7211 (psessionEntry->limSmeState != eLIM_SME_WT_DISASSOC_STATE))
Jeff Johnson295189b2012-06-20 16:38:30 -07007212 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007213 limLog(pMac, LOGE, FL("Probe_hb_failure: for session:%d " ),psessionEntry->peSessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07007214 /* AP did not respond to Probe Request. Tear down link with it.*/
7215 limTearDownLinkWithAp(pMac,
7216 psessionEntry->peSessionId,
7217 eSIR_BEACON_MISSED);
7218 pMac->lim.gLimProbeFailureAfterHBfailedCnt++ ;
7219 }
7220 else // restart heartbeat timer
7221 {
7222 limReactivateHeartBeatTimer(pMac, psessionEntry);
7223 }
7224 }
7225 else
7226 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007227 limLog(pMac, LOGE, FL("Unexpected wt-probe-timeout in state "));
Jeff Johnson295189b2012-06-20 16:38:30 -07007228 limPrintMlmState(pMac, LOGE, psessionEntry->limMlmState);
7229 limReactivateHeartBeatTimer(pMac, psessionEntry);
7230 }
7231
7232 }
7233 }
7234 }
7235 /* Deactivate Timer ProbeAfterHB Timer -> As its a oneshot timer, need not deactivate the timer */
7236 // tx_timer_deactivate(&pMac->lim.limTimers.gLimProbeAfterHBTimer);
7237}
7238
7239
7240/*
7241* This function assumes there will not be more than one IBSS session active at any time.
7242*/
7243tpPESession limIsIBSSSessionActive(tpAniSirGlobal pMac)
7244{
7245 tANI_U8 i;
7246
7247 for(i =0;i < pMac->lim.maxBssId;i++)
7248 {
7249 if( (pMac->lim.gpSession[i].valid) &&
7250 (pMac->lim.gpSession[i].limSystemRole == eLIM_STA_IN_IBSS_ROLE))
7251 return (&pMac->lim.gpSession[i]);
7252 }
7253
7254 return NULL;
7255}
7256
7257tpPESession limIsApSessionActive(tpAniSirGlobal pMac)
7258{
7259 tANI_U8 i;
7260
7261 for(i =0;i < pMac->lim.maxBssId;i++)
7262 {
7263 if( (pMac->lim.gpSession[i].valid) &&
7264 ( (pMac->lim.gpSession[i].limSystemRole == eLIM_AP_ROLE) ||
7265 (pMac->lim.gpSession[i].limSystemRole == eLIM_BT_AMP_AP_ROLE)))
7266 return (&pMac->lim.gpSession[i]);
7267 }
7268
7269 return NULL;
7270}
7271
7272/**---------------------------------------------------------
7273\fn limHandleDeferMsgError
7274\brief handles error scenario, when the msg can not be deferred.
7275\param pMac
7276\param pLimMsg LIM msg, which could not be deferred.
7277\return void
7278-----------------------------------------------------------*/
7279
7280void limHandleDeferMsgError(tpAniSirGlobal pMac, tpSirMsgQ pLimMsg)
7281{
7282 if(SIR_BB_XPORT_MGMT_MSG == pLimMsg->type)
7283 {
7284 vos_pkt_return_packet((vos_pkt_t*)pLimMsg->bodyptr);
7285 }
7286 else if(pLimMsg->bodyptr != NULL)
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307287 vos_mem_free( pLimMsg->bodyptr);
Jeff Johnson295189b2012-06-20 16:38:30 -07007288
7289}
7290
7291
7292#ifdef FEATURE_WLAN_DIAG_SUPPORT
7293/**---------------------------------------------------------
7294\fn limDiagEventReport
7295\brief This function reports Diag event
7296\param pMac
7297\param eventType
7298\param bssid
7299\param status
7300\param reasonCode
7301\return void
7302-----------------------------------------------------------*/
7303void limDiagEventReport(tpAniSirGlobal pMac, tANI_U16 eventType, tpPESession pSessionEntry, tANI_U16 status, tANI_U16 reasonCode)
7304{
7305 tSirMacAddr nullBssid = { 0, 0, 0, 0, 0, 0 };
7306 WLAN_VOS_DIAG_EVENT_DEF(peEvent, vos_event_wlan_pe_payload_type);
7307
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307308 vos_mem_set(&peEvent, sizeof(vos_event_wlan_pe_payload_type), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07007309
7310 if (NULL == pSessionEntry)
7311 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307312 vos_mem_copy( peEvent.bssid, nullBssid, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07007313 peEvent.sme_state = (tANI_U16)pMac->lim.gLimSmeState;
7314 peEvent.mlm_state = (tANI_U16)pMac->lim.gLimMlmState;
7315
7316 }
7317 else
7318 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307319 vos_mem_copy(peEvent.bssid, pSessionEntry->bssId, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07007320 peEvent.sme_state = (tANI_U16)pSessionEntry->limSmeState;
7321 peEvent.mlm_state = (tANI_U16)pSessionEntry->limMlmState;
7322 }
7323 peEvent.event_type = eventType;
7324 peEvent.status = status;
7325 peEvent.reason_code = reasonCode;
7326
7327 WLAN_VOS_DIAG_EVENT_REPORT(&peEvent, EVENT_WLAN_PE);
7328 return;
7329}
7330
7331#endif /* FEATURE_WLAN_DIAG_SUPPORT */
7332
7333void limProcessAddStaSelfRsp(tpAniSirGlobal pMac,tpSirMsgQ limMsgQ)
7334{
7335
7336 tpAddStaSelfParams pAddStaSelfParams;
7337 tSirMsgQ mmhMsg;
7338 tpSirSmeAddStaSelfRsp pRsp;
7339
7340
7341 pAddStaSelfParams = (tpAddStaSelfParams)limMsgQ->bodyptr;
7342
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307343 pRsp = vos_mem_malloc(sizeof(tSirSmeAddStaSelfRsp));
7344 if ( NULL == pRsp )
Jeff Johnson295189b2012-06-20 16:38:30 -07007345 {
7346 /// Buffer not available. Log error
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307347 limLog(pMac, LOGP, FL("call to AllocateMemory failed for Add Sta self RSP"));
7348 vos_mem_free(pAddStaSelfParams);
Jeff Johnson295189b2012-06-20 16:38:30 -07007349 return;
7350 }
7351
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307352 vos_mem_set((tANI_U8*)pRsp, sizeof(tSirSmeAddStaSelfRsp), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07007353
7354 pRsp->mesgType = eWNI_SME_ADD_STA_SELF_RSP;
7355 pRsp->mesgLen = (tANI_U16) sizeof(tSirSmeAddStaSelfRsp);
7356 pRsp->status = pAddStaSelfParams->status;
7357
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307358 vos_mem_copy( pRsp->selfMacAddr, pAddStaSelfParams->selfMacAddr, sizeof(tSirMacAddr) );
Jeff Johnson295189b2012-06-20 16:38:30 -07007359
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307360 vos_mem_free(pAddStaSelfParams);
Jeff Johnson295189b2012-06-20 16:38:30 -07007361
7362 mmhMsg.type = eWNI_SME_ADD_STA_SELF_RSP;
7363 mmhMsg.bodyptr = pRsp;
7364 mmhMsg.bodyval = 0;
Jeff Johnsone7245742012-09-05 17:12:55 -07007365 MTRACE(macTraceMsgTx(pMac, NO_SESSION, mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07007366 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
7367
7368}
7369
7370void limProcessDelStaSelfRsp(tpAniSirGlobal pMac,tpSirMsgQ limMsgQ)
7371{
7372
7373 tpDelStaSelfParams pDelStaSelfParams;
7374 tSirMsgQ mmhMsg;
7375 tpSirSmeDelStaSelfRsp pRsp;
7376
7377
7378 pDelStaSelfParams = (tpDelStaSelfParams)limMsgQ->bodyptr;
7379
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307380 pRsp = vos_mem_malloc(sizeof(tSirSmeDelStaSelfRsp));
7381 if ( NULL == pRsp )
Jeff Johnson295189b2012-06-20 16:38:30 -07007382 {
7383 /// Buffer not available. Log error
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307384 limLog(pMac, LOGP, FL("call to AllocateMemory failed for Add Sta self RSP"));
7385 vos_mem_free(pDelStaSelfParams);
Jeff Johnson295189b2012-06-20 16:38:30 -07007386 return;
7387 }
7388
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307389 vos_mem_set((tANI_U8*)pRsp, sizeof(tSirSmeDelStaSelfRsp), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07007390
7391 pRsp->mesgType = eWNI_SME_DEL_STA_SELF_RSP;
7392 pRsp->mesgLen = (tANI_U16) sizeof(tSirSmeDelStaSelfRsp);
7393 pRsp->status = pDelStaSelfParams->status;
7394
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307395 vos_mem_copy( pRsp->selfMacAddr, pDelStaSelfParams->selfMacAddr, sizeof(tSirMacAddr) );
Jeff Johnson295189b2012-06-20 16:38:30 -07007396
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307397 vos_mem_free(pDelStaSelfParams);
Jeff Johnson295189b2012-06-20 16:38:30 -07007398
7399 mmhMsg.type = eWNI_SME_DEL_STA_SELF_RSP;
7400 mmhMsg.bodyptr = pRsp;
7401 mmhMsg.bodyval = 0;
Jeff Johnsone7245742012-09-05 17:12:55 -07007402 MTRACE(macTraceMsgTx(pMac, NO_SESSION, mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07007403 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
7404
7405}
7406
7407/***************************************************************
7408* tANI_U8 limUnmapChannel(tANI_U8 mapChannel)
7409* To unmap the channel to reverse the effect of mapping
7410* a band channel in hal .Mapping was done hal to overcome the
7411* limitation of the rxbd which use only 4 bit for channel number.
7412*****************************************************************/
7413tANI_U8 limUnmapChannel(tANI_U8 mapChannel)
7414{
7415 if( mapChannel > 0 && mapChannel < 25 )
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07007416#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
7417 if (IS_ROAM_SCAN_OFFLOAD_FEATURE_ENABLE)
7418 return aUnsortedChannelList[mapChannel -1];
7419 else
7420#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07007421 return abChannel[mapChannel -1];
7422 else
7423 return 0;
7424}
7425
7426
7427v_U8_t* limGetIEPtr(tpAniSirGlobal pMac, v_U8_t *pIes, int length, v_U8_t eid,eSizeOfLenField size_of_len_field)
7428{
7429 int left = length;
7430 v_U8_t *ptr = pIes;
7431 v_U8_t elem_id;
7432 v_U16_t elem_len;
7433
7434 while(left >= (size_of_len_field+1))
7435 {
7436 elem_id = ptr[0];
7437 if (size_of_len_field == TWO_BYTE)
7438 {
7439 elem_len = ((v_U16_t) ptr[1]) | (ptr[2]<<8);
7440 }
7441 else
7442 {
7443 elem_len = ptr[1];
7444 }
7445
7446
7447 left -= (size_of_len_field+1);
7448 if(elem_len > left)
7449 {
7450 limLog(pMac, LOGE,
Madan Mohan Koyyalamudi8bdd3112012-09-24 13:55:14 -07007451 FL("****Invalid IEs eid = %d elem_len=%d left=%d*****"),
Jeff Johnson295189b2012-06-20 16:38:30 -07007452 eid,elem_len,left);
7453 return NULL;
7454 }
7455 if (elem_id == eid)
7456 {
7457 return ptr;
7458 }
7459
7460 left -= elem_len;
7461 ptr += (elem_len + (size_of_len_field+1));
7462 }
7463 return NULL;
7464}
7465
7466/* return NULL if oui is not found in ie
7467 return !NULL pointer to vendor IE (starting from 0xDD) if oui is found
7468 */
7469v_U8_t* limGetVendorIEOuiPtr(tpAniSirGlobal pMac, tANI_U8 *oui, tANI_U8 oui_size, tANI_U8 *ie, tANI_U16 ie_len)
7470{
7471 int left = ie_len;
7472 v_U8_t *ptr = ie;
7473 v_U8_t elem_id, elem_len;
7474
7475 while(left >= 2)
7476 {
7477 elem_id = ptr[0];
7478 elem_len = ptr[1];
7479 left -= 2;
7480 if(elem_len > left)
7481 {
7482 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007483 FL("****Invalid IEs eid = %d elem_len=%d left=%d*****"),
Jeff Johnson295189b2012-06-20 16:38:30 -07007484 elem_id,elem_len,left);
7485 return NULL;
7486 }
7487 if (SIR_MAC_EID_VENDOR == elem_id)
7488 {
7489 if(memcmp(&ptr[2], oui, oui_size)==0)
7490 return ptr;
7491 }
7492
7493 left -= elem_len;
7494 ptr += (elem_len + 2);
7495 }
7496 return NULL;
7497}
7498
Jeff Johnson295189b2012-06-20 16:38:30 -07007499//Returns length of P2P stream and Pointer ie passed to this function is filled with noa stream
7500
7501v_U8_t limBuildP2pIe(tpAniSirGlobal pMac, tANI_U8 *ie, tANI_U8 *data, tANI_U8 ie_len)
7502{
7503 int length = 0;
7504 tANI_U8 *ptr = ie;
7505
7506 ptr[length++] = SIR_MAC_EID_VENDOR;
7507 ptr[length++] = ie_len + SIR_MAC_P2P_OUI_SIZE;
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307508 vos_mem_copy(&ptr[length], SIR_MAC_P2P_OUI, SIR_MAC_P2P_OUI_SIZE);
7509 vos_mem_copy(&ptr[length + SIR_MAC_P2P_OUI_SIZE], data, ie_len);
Jeff Johnson295189b2012-06-20 16:38:30 -07007510 return (ie_len + SIR_P2P_IE_HEADER_LEN);
7511}
7512
7513//Returns length of NoA stream and Pointer pNoaStream passed to this function is filled with noa stream
7514
7515v_U8_t limGetNoaAttrStreamInMultP2pIes(tpAniSirGlobal pMac,v_U8_t* noaStream,v_U8_t noaLen,v_U8_t overFlowLen)
7516{
7517 v_U8_t overFlowP2pStream[SIR_MAX_NOA_ATTR_LEN];
Krunal Sonic768a932013-05-15 19:26:30 -07007518
7519 if ((noaLen <= (SIR_MAX_NOA_ATTR_LEN+SIR_P2P_IE_HEADER_LEN)) &&
7520 (noaLen >= overFlowLen) && (overFlowLen <= SIR_MAX_NOA_ATTR_LEN))
7521 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307522 vos_mem_copy(overFlowP2pStream,
Krunal Sonic768a932013-05-15 19:26:30 -07007523 noaStream + noaLen - overFlowLen, overFlowLen);
7524 noaStream[noaLen - overFlowLen] = SIR_MAC_EID_VENDOR;
7525 noaStream[noaLen - overFlowLen + 1] = overFlowLen + SIR_MAC_P2P_OUI_SIZE;
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307526 vos_mem_copy(noaStream+noaLen-overFlowLen + 2,
Krunal Sonic768a932013-05-15 19:26:30 -07007527 SIR_MAC_P2P_OUI, SIR_MAC_P2P_OUI_SIZE);
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307528 vos_mem_copy(noaStream+noaLen + 2 + SIR_MAC_P2P_OUI_SIZE - overFlowLen,
7529 overFlowP2pStream, overFlowLen);
Krunal Sonic768a932013-05-15 19:26:30 -07007530 }
7531
Jeff Johnson295189b2012-06-20 16:38:30 -07007532 return (noaLen + SIR_P2P_IE_HEADER_LEN);
7533
7534}
7535
7536//Returns length of NoA stream and Pointer pNoaStream passed to this function is filled with noa stream
7537v_U8_t limGetNoaAttrStream(tpAniSirGlobal pMac, v_U8_t*pNoaStream,tpPESession psessionEntry)
7538{
7539 v_U8_t len=0;
7540
7541 v_U8_t *pBody = pNoaStream;
7542
7543
7544 if ( (psessionEntry != NULL) && (psessionEntry->valid) &&
7545 (psessionEntry->pePersona == VOS_P2P_GO_MODE))
7546 {
7547 if ((!(psessionEntry->p2pGoPsUpdate.uNoa1Duration)) && (!(psessionEntry->p2pGoPsUpdate.uNoa2Duration))
7548 && (!psessionEntry->p2pGoPsUpdate.oppPsFlag)
7549 )
7550 return 0; //No NoA Descriptor then return 0
7551
7552
7553 pBody[0] = SIR_P2P_NOA_ATTR;
7554
7555 pBody[3] = psessionEntry->p2pGoPsUpdate.index;
7556 pBody[4] = psessionEntry->p2pGoPsUpdate.ctWin | (psessionEntry->p2pGoPsUpdate.oppPsFlag<<7);
7557 len = 5;
7558 pBody += len;
7559
7560
7561 if (psessionEntry->p2pGoPsUpdate.uNoa1Duration)
7562 {
7563 *pBody = psessionEntry->p2pGoPsUpdate.uNoa1IntervalCnt;
7564 pBody += 1;
7565 len +=1;
7566
7567 *((tANI_U32 *)(pBody)) = sirSwapU32ifNeeded(psessionEntry->p2pGoPsUpdate.uNoa1Duration);
7568 pBody += sizeof(tANI_U32);
7569 len +=4;
7570
7571 *((tANI_U32 *)(pBody)) = sirSwapU32ifNeeded(psessionEntry->p2pGoPsUpdate.uNoa1Interval);
7572 pBody += sizeof(tANI_U32);
7573 len +=4;
7574
7575 *((tANI_U32 *)(pBody)) = sirSwapU32ifNeeded(psessionEntry->p2pGoPsUpdate.uNoa1StartTime);
7576 pBody += sizeof(tANI_U32);
7577 len +=4;
7578
7579 }
7580
7581 if (psessionEntry->p2pGoPsUpdate.uNoa2Duration)
7582 {
7583 *pBody = psessionEntry->p2pGoPsUpdate.uNoa2IntervalCnt;
7584 pBody += 1;
7585 len +=1;
7586
7587 *((tANI_U32 *)(pBody)) = sirSwapU32ifNeeded(psessionEntry->p2pGoPsUpdate.uNoa2Duration);
7588 pBody += sizeof(tANI_U32);
7589 len +=4;
7590
7591 *((tANI_U32 *)(pBody)) = sirSwapU32ifNeeded(psessionEntry->p2pGoPsUpdate.uNoa2Interval);
7592 pBody += sizeof(tANI_U32);
7593 len +=4;
7594
7595 *((tANI_U32 *)(pBody)) = sirSwapU32ifNeeded(psessionEntry->p2pGoPsUpdate.uNoa2StartTime);
7596 pBody += sizeof(tANI_U32);
7597 len +=4;
7598
7599 }
7600
7601
7602 pBody = pNoaStream + 1;
7603 *((tANI_U16 *)(pBody)) = sirSwapU16ifNeeded(len-3);/*one byte for Attr and 2 bytes for length*/
7604
7605 return (len);
7606
7607 }
7608 return 0;
7609
7610}
Jeff Johnsone7245742012-09-05 17:12:55 -07007611
7612void peSetResumeChannel(tpAniSirGlobal pMac, tANI_U16 channel, ePhyChanBondState phyCbState)
Jeff Johnson295189b2012-06-20 16:38:30 -07007613{
7614
7615 pMac->lim.gResumeChannel = channel;
Jeff Johnsone7245742012-09-05 17:12:55 -07007616 pMac->lim.gResumePhyCbState = phyCbState;
Jeff Johnson295189b2012-06-20 16:38:30 -07007617}
Jeff Johnsone7245742012-09-05 17:12:55 -07007618
Jeff Johnson295189b2012-06-20 16:38:30 -07007619/*--------------------------------------------------------------------------
7620
7621 \brief peGetResumeChannel() - Returns the channel number for scanning, from a valid session.
7622
Jeff Johnsone7245742012-09-05 17:12:55 -07007623 This function returns the channel to resume to during link resume. channel id of 0 means HAL will
7624 resume to previous channel before link suspend
Jeff Johnson295189b2012-06-20 16:38:30 -07007625
7626 \param pMac - pointer to global adapter context
7627 \return - channel to scan from valid session else zero.
7628
7629 \sa
7630
7631 --------------------------------------------------------------------------*/
Jeff Johnsone7245742012-09-05 17:12:55 -07007632void peGetResumeChannel(tpAniSirGlobal pMac, tANI_U8* resumeChannel, ePhyChanBondState* resumePhyCbState)
Jeff Johnson295189b2012-06-20 16:38:30 -07007633{
7634
7635 //Rationale - this could be the suspend/resume for assoc and it is essential that
7636 //the new BSS is active for some time. Other BSS was anyway suspended.
7637 //TODO: Comeup with a better alternative. Sending NULL with PM=0 on other BSS means
7638 //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 -07007639 //and hence should be ok. Need to discuss this further
7640 if( !limIsInMCC(pMac) )
Jeff Johnson295189b2012-06-20 16:38:30 -07007641 {
7642 //Get current active session channel
Jeff Johnsone7245742012-09-05 17:12:55 -07007643 peGetActiveSessionChannel(pMac, resumeChannel, resumePhyCbState);
Jeff Johnson295189b2012-06-20 16:38:30 -07007644 }
7645 else
7646 {
Jeff Johnsone7245742012-09-05 17:12:55 -07007647 *resumeChannel = pMac->lim.gResumeChannel;
7648 *resumePhyCbState = pMac->lim.gResumePhyCbState;
Jeff Johnson295189b2012-06-20 16:38:30 -07007649 }
Jeff Johnsone7245742012-09-05 17:12:55 -07007650 return;
Jeff Johnson295189b2012-06-20 16:38:30 -07007651}
7652
Viral Modid86bde22012-12-10 13:09:21 -08007653tANI_BOOLEAN limIsNOAInsertReqd(tpAniSirGlobal pMac)
7654{
7655 tANI_U8 i;
7656 for(i =0; i < pMac->lim.maxBssId; i++)
7657 {
7658 if(pMac->lim.gpSession[i].valid == TRUE)
7659 {
7660 if( (eLIM_AP_ROLE == pMac->lim.gpSession[i].limSystemRole )
7661 && ( VOS_P2P_GO_MODE == pMac->lim.gpSession[i].pePersona )
7662 )
7663 {
7664 return TRUE;
7665 }
7666 }
7667 }
7668 return FALSE;
7669}
Jeff Johnsone7245742012-09-05 17:12:55 -07007670
Jeff Johnson295189b2012-06-20 16:38:30 -07007671
7672tANI_BOOLEAN limIsconnectedOnDFSChannel(tANI_U8 currentChannel)
7673{
7674 if(NV_CHANNEL_DFS == vos_nv_getChannelEnabledState(currentChannel))
7675 {
7676 return eANI_BOOLEAN_TRUE;
7677 }
7678 else
7679 {
7680 return eANI_BOOLEAN_FALSE;
7681 }
7682}
Madan Mohan Koyyalamudi1bed5982012-10-22 14:38:06 -07007683
Mohit Khanna4a70d262012-09-11 16:30:12 -07007684#ifdef WLAN_FEATURE_11AC
7685tANI_BOOLEAN limCheckVHTOpModeChange( tpAniSirGlobal pMac, tpPESession psessionEntry, tANI_U8 chanWidth, tANI_U8 staId)
7686{
7687 tUpdateVHTOpMode tempParam;
7688
7689 tempParam.opMode = chanWidth;
7690 tempParam.staId = staId;
7691
7692 limSendModeUpdate( pMac, &tempParam, psessionEntry );
7693
7694 return eANI_BOOLEAN_TRUE;
7695}
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -07007696#endif
7697
7698tANI_U8 limGetShortSlotFromPhyMode(tpAniSirGlobal pMac, tpPESession psessionEntry, tANI_U32 phyMode)
7699{
7700 tANI_U8 val=0;
7701
7702 if (phyMode == WNI_CFG_PHY_MODE_11A)
7703 {
7704 // 11a mode always uses short slot
7705 // Check this since some APs in 11a mode broadcast long slot in their beacons. As per standard, always use what PHY mandates.
7706 val = true;
7707 }
7708 else if (phyMode == WNI_CFG_PHY_MODE_11G)
7709 {
7710 if ((psessionEntry->pePersona == VOS_STA_SAP_MODE) ||
7711 (psessionEntry->pePersona == VOS_P2P_GO_MODE))
7712 {
7713 val = true;
7714 }
7715
7716 // Program Polaris based on AP capability
7717
7718 if (psessionEntry->limMlmState == eLIM_MLM_WT_JOIN_BEACON_STATE)
7719 // Joining BSS.
7720 val = SIR_MAC_GET_SHORT_SLOT_TIME( psessionEntry->limCurrentBssCaps);
7721 else if (psessionEntry->limMlmState == eLIM_MLM_WT_REASSOC_RSP_STATE)
7722 // Reassociating with AP.
7723 val = SIR_MAC_GET_SHORT_SLOT_TIME( psessionEntry->limReassocBssCaps);
7724 }
7725 else // if (phyMode == WNI_CFG_PHY_MODE_11B) - use this if another phymode is added later ON
7726 {
7727 // Will reach here in 11b case
7728 val = false;
7729 }
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007730 limLog(pMac, LOG1, FL("phyMode = %u shortslotsupported = %u"), phyMode, val);
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -07007731 return val;
7732}