blob: 49d0ff89ae4920e6e5524dd169a0c834b48a4894 [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";
Jeff Johnson295189b2012-06-20 16:38:30 -0700693 default:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700694 return "INVALID SME message";
Jeff Johnson295189b2012-06-20 16:38:30 -0700695 }
696#endif
697return "";
698}
699
700
701
702char *limResultCodeStr(tSirResultCodes resultCode)
703{
Jeff Johnson295189b2012-06-20 16:38:30 -0700704 switch (resultCode)
705 {
706 case eSIR_SME_SUCCESS:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700707 return "eSIR_SME_SUCCESS";
Jeff Johnson295189b2012-06-20 16:38:30 -0700708 case eSIR_EOF_SOF_EXCEPTION:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700709 return "eSIR_EOF_SOF_EXCEPTION";
Jeff Johnson295189b2012-06-20 16:38:30 -0700710 case eSIR_BMU_EXCEPTION:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700711 return "eSIR_BMU_EXCEPTION";
Jeff Johnson295189b2012-06-20 16:38:30 -0700712 case eSIR_LOW_PDU_EXCEPTION:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700713 return "eSIR_LOW_PDU_EXCEPTION";
Jeff Johnson295189b2012-06-20 16:38:30 -0700714 case eSIR_USER_TRIG_RESET:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700715 return"eSIR_USER_TRIG_RESET";
Jeff Johnson295189b2012-06-20 16:38:30 -0700716 case eSIR_LOGP_EXCEPTION:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700717 return "eSIR_LOGP_EXCEPTION";
Jeff Johnson295189b2012-06-20 16:38:30 -0700718 case eSIR_CP_EXCEPTION:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700719 return "eSIR_CP_EXCEPTION";
Jeff Johnson295189b2012-06-20 16:38:30 -0700720 case eSIR_STOP_BSS:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700721 return "eSIR_STOP_BSS";
Jeff Johnson295189b2012-06-20 16:38:30 -0700722 case eSIR_AHB_HANG_EXCEPTION:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700723 return "eSIR_AHB_HANG_EXCEPTION";
Jeff Johnson295189b2012-06-20 16:38:30 -0700724 case eSIR_DPU_EXCEPTION:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700725 return "eSIR_DPU_EXCEPTION";
Jeff Johnson295189b2012-06-20 16:38:30 -0700726 case eSIR_RXP_EXCEPTION:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700727 return "eSIR_RXP_EXCEPTION";
Jeff Johnson295189b2012-06-20 16:38:30 -0700728 case eSIR_MCPU_EXCEPTION:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700729 return "eSIR_MCPU_EXCEPTION";
Jeff Johnson295189b2012-06-20 16:38:30 -0700730 case eSIR_MCU_EXCEPTION:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700731 return "eSIR_MCU_EXCEPTION";
Jeff Johnson295189b2012-06-20 16:38:30 -0700732 case eSIR_MTU_EXCEPTION:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700733 return "eSIR_MTU_EXCEPTION";
Jeff Johnson295189b2012-06-20 16:38:30 -0700734 case eSIR_MIF_EXCEPTION:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700735 return "eSIR_MIF_EXCEPTION";
Jeff Johnson295189b2012-06-20 16:38:30 -0700736 case eSIR_FW_EXCEPTION:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700737 return "eSIR_FW_EXCEPTION";
Jeff Johnson295189b2012-06-20 16:38:30 -0700738 case eSIR_MAILBOX_SANITY_CHK_FAILED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700739 return "eSIR_MAILBOX_SANITY_CHK_FAILED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700740 case eSIR_RADIO_HW_SWITCH_STATUS_IS_OFF:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700741 return "eSIR_RADIO_HW_SWITCH_STATUS_IS_OFF";
Jeff Johnson295189b2012-06-20 16:38:30 -0700742 case eSIR_CFB_FLAG_STUCK_EXCEPTION:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700743 return "eSIR_CFB_FLAG_STUCK_EXCEPTION";
Jeff Johnson295189b2012-06-20 16:38:30 -0700744 case eSIR_SME_BASIC_RATES_NOT_SUPPORTED_STATUS:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700745 return "eSIR_SME_BASIC_RATES_NOT_SUPPORTED_STATUS";
Jeff Johnson295189b2012-06-20 16:38:30 -0700746 case eSIR_SME_INVALID_PARAMETERS:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700747 return "eSIR_SME_INVALID_PARAMETERS";
Jeff Johnson295189b2012-06-20 16:38:30 -0700748 case eSIR_SME_UNEXPECTED_REQ_RESULT_CODE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700749 return "eSIR_SME_UNEXPECTED_REQ_RESULT_CODE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700750 case eSIR_SME_RESOURCES_UNAVAILABLE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700751 return "eSIR_SME_RESOURCES_UNAVAILABLE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700752 case eSIR_SME_SCAN_FAILED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700753 return "eSIR_SME_SCAN_FAILED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700754 case eSIR_SME_BSS_ALREADY_STARTED_OR_JOINED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700755 return "eSIR_SME_BSS_ALREADY_STARTED_OR_JOINED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700756 case eSIR_SME_LOST_LINK_WITH_PEER_RESULT_CODE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700757 return "eSIR_SME_LOST_LINK_WITH_PEER_RESULT_CODE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700758 case eSIR_SME_REFUSED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700759 return "eSIR_SME_REFUSED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700760 case eSIR_SME_JOIN_TIMEOUT_RESULT_CODE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700761 return "eSIR_SME_JOIN_TIMEOUT_RESULT_CODE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700762 case eSIR_SME_AUTH_TIMEOUT_RESULT_CODE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700763 return "eSIR_SME_AUTH_TIMEOUT_RESULT_CODE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700764 case eSIR_SME_ASSOC_TIMEOUT_RESULT_CODE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700765 return "eSIR_SME_ASSOC_TIMEOUT_RESULT_CODE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700766 case eSIR_SME_REASSOC_TIMEOUT_RESULT_CODE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700767 return "eSIR_SME_REASSOC_TIMEOUT_RESULT_CODE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700768 case eSIR_SME_MAX_NUM_OF_PRE_AUTH_REACHED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700769 return "eSIR_SME_MAX_NUM_OF_PRE_AUTH_REACHED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700770 case eSIR_SME_AUTH_REFUSED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700771 return "eSIR_SME_AUTH_REFUSED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700772 case eSIR_SME_INVALID_WEP_DEFAULT_KEY:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700773 return "eSIR_SME_INVALID_WEP_DEFAULT_KEY";
Jeff Johnson295189b2012-06-20 16:38:30 -0700774 case eSIR_SME_ASSOC_REFUSED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700775 return "eSIR_SME_ASSOC_REFUSED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700776 case eSIR_SME_REASSOC_REFUSED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700777 return "eSIR_SME_REASSOC_REFUSED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700778 case eSIR_SME_STA_NOT_AUTHENTICATED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700779 return "eSIR_SME_STA_NOT_AUTHENTICATED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700780 case eSIR_SME_STA_NOT_ASSOCIATED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700781 return "eSIR_SME_STA_NOT_ASSOCIATED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700782 case eSIR_SME_STA_DISASSOCIATED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700783 return "eSIR_SME_STA_DISASSOCIATED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700784 case eSIR_SME_ALREADY_JOINED_A_BSS:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700785 return "eSIR_SME_ALREADY_JOINED_A_BSS";
Jeff Johnson295189b2012-06-20 16:38:30 -0700786 case eSIR_ULA_COMPLETED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700787 return "eSIR_ULA_COMPLETED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700788 case eSIR_ULA_FAILURE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700789 return "eSIR_ULA_FAILURE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700790 case eSIR_SME_LINK_ESTABLISHED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700791 return "eSIR_SME_LINK_ESTABLISHED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700792 case eSIR_SME_UNABLE_TO_PERFORM_MEASUREMENTS:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700793 return "eSIR_SME_UNABLE_TO_PERFORM_MEASUREMENTS";
Jeff Johnson295189b2012-06-20 16:38:30 -0700794 case eSIR_SME_UNABLE_TO_PERFORM_DFS:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700795 return "eSIR_SME_UNABLE_TO_PERFORM_DFS";
Jeff Johnson295189b2012-06-20 16:38:30 -0700796 case eSIR_SME_DFS_FAILED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700797 return "eSIR_SME_DFS_FAILED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700798 case eSIR_SME_TRANSFER_STA:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700799 return "eSIR_SME_TRANSFER_STA";
Jeff Johnson295189b2012-06-20 16:38:30 -0700800 case eSIR_SME_INVALID_LINK_TEST_PARAMETERS:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700801 return "eSIR_SME_INVALID_LINK_TEST_PARAMETERS";
Jeff Johnson295189b2012-06-20 16:38:30 -0700802 case eSIR_SME_LINK_TEST_MAX_EXCEEDED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700803 return "eSIR_SME_LINK_TEST_MAX_EXCEEDED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700804 case eSIR_SME_UNSUPPORTED_RATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700805 return "eSIR_SME_UNSUPPORTED_RATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700806 case eSIR_SME_LINK_TEST_TIMEOUT:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700807 return "eSIR_SME_LINK_TEST_TIMEOUT";
Jeff Johnson295189b2012-06-20 16:38:30 -0700808 case eSIR_SME_LINK_TEST_COMPLETE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700809 return "eSIR_SME_LINK_TEST_COMPLETE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700810 case eSIR_SME_LINK_TEST_INVALID_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700811 return "eSIR_SME_LINK_TEST_INVALID_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700812 case eSIR_SME_LINK_TEST_INVALID_ADDRESS:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700813 return "eSIR_SME_LINK_TEST_INVALID_ADDRESS";
Jeff Johnson295189b2012-06-20 16:38:30 -0700814 case eSIR_SME_POLARIS_RESET:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700815 return "eSIR_SME_POLARIS_RESET";
Jeff Johnson295189b2012-06-20 16:38:30 -0700816 case eSIR_SME_SETCONTEXT_FAILED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700817 return "eSIR_SME_SETCONTEXT_FAILED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700818 case eSIR_SME_BSS_RESTART:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700819 return "eSIR_SME_BSS_RESTART";
Jeff Johnson295189b2012-06-20 16:38:30 -0700820 case eSIR_SME_MORE_SCAN_RESULTS_FOLLOW:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700821 return "eSIR_SME_MORE_SCAN_RESULTS_FOLLOW";
Jeff Johnson295189b2012-06-20 16:38:30 -0700822 case eSIR_SME_INVALID_ASSOC_RSP_RXED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700823 return "eSIR_SME_INVALID_ASSOC_RSP_RXED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700824 case eSIR_SME_MIC_COUNTER_MEASURES:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700825 return "eSIR_SME_MIC_COUNTER_MEASURES";
Jeff Johnson295189b2012-06-20 16:38:30 -0700826 case eSIR_SME_ADDTS_RSP_TIMEOUT:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700827 return "eSIR_SME_ADDTS_RSP_TIMEOUT";
Jeff Johnson295189b2012-06-20 16:38:30 -0700828 case eSIR_SME_RECEIVED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700829 return "eSIR_SME_RECEIVED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700830 case eSIR_SME_CHANNEL_SWITCH_FAIL:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700831 return "eSIR_SME_CHANNEL_SWITCH_FAIL";
Jeff Johnson295189b2012-06-20 16:38:30 -0700832#ifdef GEN4_SCAN
833 case eSIR_SME_CHANNEL_SWITCH_DISABLED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700834 return "eSIR_SME_CHANNEL_SWITCH_DISABLED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700835 case eSIR_SME_HAL_SCAN_INIT_FAILED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700836 return "eSIR_SME_HAL_SCAN_INIT_FAILED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700837 case eSIR_SME_HAL_SCAN_START_FAILED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700838 return "eSIR_SME_HAL_SCAN_START_FAILED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700839 case eSIR_SME_HAL_SCAN_END_FAILED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700840 return "eSIR_SME_HAL_SCAN_END_FAILED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700841 case eSIR_SME_HAL_SCAN_FINISH_FAILED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700842 return "eSIR_SME_HAL_SCAN_FINISH_FAILED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700843 case eSIR_SME_HAL_SEND_MESSAGE_FAIL:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700844 return "eSIR_SME_HAL_SEND_MESSAGE_FAIL";
Jeff Johnson295189b2012-06-20 16:38:30 -0700845#else // GEN4_SCAN
846 case eSIR_SME_CHANNEL_SWITCH_DISABLED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700847 return "eSIR_SME_CHANNEL_SWITCH_DISABLED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700848 case eSIR_SME_HAL_SEND_MESSAGE_FAIL:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700849 return "eSIR_SME_HAL_SEND_MESSAGE_FAIL";
Jeff Johnson295189b2012-06-20 16:38:30 -0700850#endif // GEN4_SCAN
851
852 default:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700853 return "INVALID resultCode";
Jeff Johnson295189b2012-06-20 16:38:30 -0700854 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700855}
856
857void
858limPrintMsgName(tpAniSirGlobal pMac, tANI_U16 logLevel, tANI_U32 msgType)
859{
860 limLog(pMac, logLevel, limMsgStr(msgType));
861}
862
Jeff Johnson295189b2012-06-20 16:38:30 -0700863void
864limPrintMsgInfo(tpAniSirGlobal pMac, tANI_U16 logLevel, tSirMsgQ *msg)
865{
Jeff Johnson295189b2012-06-20 16:38:30 -0700866 if (logLevel <= pMac->utils.gLogDbgLevel[SIR_LIM_MODULE_ID - LOG_FIRST_MODULE_ID])
867 {
868 switch (msg->type)
869 {
870 case SIR_BB_XPORT_MGMT_MSG:
Jeff Johnson295189b2012-06-20 16:38:30 -0700871 limPrintMsgName(pMac, logLevel,msg->type);
Jeff Johnson295189b2012-06-20 16:38:30 -0700872 break;
873 default:
874 limPrintMsgName(pMac, logLevel,msg->type);
875 break;
876 }
877 }
878}
879
880/**
881 * limInitMlm()
882 *
883 *FUNCTION:
884 * This function is called by limProcessSmeMessages() to
885 * initialize MLM state machine on STA
886 *
887 *PARAMS:
888 *
889 *LOGIC:
890 *
891 *ASSUMPTIONS:
892 * NA
893 *
894 *NOTE:
895 * NA
896 *
897 * @param pMac Pointer to Global MAC structure
898 * @return None
899 */
900void
901limInitMlm(tpAniSirGlobal pMac)
902{
Madan Mohan Koyyalamudi694f8d72012-10-11 16:32:55 -0700903 tANI_U32 retVal;
904
905 pMac->lim.gLimTimersCreated = 0;
Madan Mohan Koyyalamudi1bed5982012-10-22 14:38:06 -0700906
Jeff Johnsone7245742012-09-05 17:12:55 -0700907 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, NO_SESSION, pMac->lim.gLimMlmState));
Jeff Johnson295189b2012-06-20 16:38:30 -0700908
909 /// Initialize scan result hash table
910 limReInitScanResults(pMac); //sep26th review
911
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -0700912#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
913 /// Initialize lfr scan result hash table
914 // Could there be a problem in multisession with SAP/P2P GO, when in the
915 // middle of FW bg scan, SAP started; Again that could be a problem even on
916 // infra + SAP/P2P GO too - TBD
917 limReInitLfrScanResults(pMac);
918#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700919
920 /// Initialize number of pre-auth contexts
921 pMac->lim.gLimNumPreAuthContexts = 0;
922
923 /// Initialize MAC based Authentication STA list
924 limInitPreAuthList(pMac);
925
926 //pMac->lim.gpLimMlmJoinReq = NULL;
927
928 if (pMac->lim.gLimTimersCreated)
929 return;
930
931 // Create timers used by LIM
Madan Mohan Koyyalamudi694f8d72012-10-11 16:32:55 -0700932 retVal = limCreateTimers(pMac);
933 if(retVal == TX_SUCCESS)
934 {
935 pMac->lim.gLimTimersCreated = 1;
936 }
937 else
938 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700939 limLog(pMac, LOGP, FL(" limCreateTimers Failed to create lim timers "));
Madan Mohan Koyyalamudi694f8d72012-10-11 16:32:55 -0700940 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700941} /*** end limInitMlm() ***/
942
943
944
945/**
946 * limCleanupMlm()
947 *
948 *FUNCTION:
949 * This function is called to cleanup any resources
950 * allocated by the MLM state machine.
951 *
952 *PARAMS:
953 *
954 *LOGIC:
955 *
956 *ASSUMPTIONS:
957 * NA
958 *
959 *NOTE:
960 * It is assumed that BSS is already informed that we're leaving it
961 * before this function is called.
962 *
963 * @param pMac Pointer to Global MAC structure
964 * @param None
965 * @return None
966 */
967void
968limCleanupMlm(tpAniSirGlobal pMac)
969{
970 tANI_U32 n;
971 tLimPreAuthNode *pAuthNode;
972
973 if (pMac->lim.gLimTimersCreated == 1)
974 {
975 // Deactivate and delete MIN/MAX channel timers.
976 tx_timer_deactivate(&pMac->lim.limTimers.gLimMinChannelTimer);
977 tx_timer_delete(&pMac->lim.limTimers.gLimMinChannelTimer);
978 tx_timer_deactivate(&pMac->lim.limTimers.gLimMaxChannelTimer);
979 tx_timer_delete(&pMac->lim.limTimers.gLimMaxChannelTimer);
980 tx_timer_deactivate(&pMac->lim.limTimers.gLimPeriodicProbeReqTimer);
981 tx_timer_delete(&pMac->lim.limTimers.gLimPeriodicProbeReqTimer);
982
983
984 // Deactivate and delete channel switch timer.
985 tx_timer_deactivate(&pMac->lim.limTimers.gLimChannelSwitchTimer);
986 tx_timer_delete(&pMac->lim.limTimers.gLimChannelSwitchTimer);
987
988
989 // Deactivate and delete addts response timer.
990 tx_timer_deactivate(&pMac->lim.limTimers.gLimAddtsRspTimer);
991 tx_timer_delete(&pMac->lim.limTimers.gLimAddtsRspTimer);
992
993 // Deactivate and delete Join failure timer.
994 tx_timer_deactivate(&pMac->lim.limTimers.gLimJoinFailureTimer);
995 tx_timer_delete(&pMac->lim.limTimers.gLimJoinFailureTimer);
996
Madan Mohan Koyyalamudi9aff9ff2012-11-29 11:27:25 -0800997 // Deactivate and delete Periodic Join Probe Request timer.
998 tx_timer_deactivate(&pMac->lim.limTimers.gLimPeriodicJoinProbeReqTimer);
999 tx_timer_delete(&pMac->lim.limTimers.gLimPeriodicJoinProbeReqTimer);
1000
Jeff Johnson295189b2012-06-20 16:38:30 -07001001 // Deactivate and delete Association failure timer.
1002 tx_timer_deactivate(&pMac->lim.limTimers.gLimAssocFailureTimer);
1003 tx_timer_delete(&pMac->lim.limTimers.gLimAssocFailureTimer);
1004
1005 // Deactivate and delete Reassociation failure timer.
1006 tx_timer_deactivate(&pMac->lim.limTimers.gLimReassocFailureTimer);
1007 tx_timer_delete(&pMac->lim.limTimers.gLimReassocFailureTimer);
1008
1009 // Deactivate and delete Authentication failure timer.
1010 tx_timer_deactivate(&pMac->lim.limTimers.gLimAuthFailureTimer);
1011 tx_timer_delete(&pMac->lim.limTimers.gLimAuthFailureTimer);
1012
1013 // Deactivate and delete Heartbeat timer.
1014 tx_timer_deactivate(&pMac->lim.limTimers.gLimHeartBeatTimer);
1015 tx_timer_delete(&pMac->lim.limTimers.gLimHeartBeatTimer);
1016
1017 // Deactivate and delete wait-for-probe-after-Heartbeat timer.
1018 tx_timer_deactivate(&pMac->lim.limTimers.gLimProbeAfterHBTimer);
1019 tx_timer_delete(&pMac->lim.limTimers.gLimProbeAfterHBTimer);
1020
1021 // Deactivate and delete Quiet timer.
1022 tx_timer_deactivate(&pMac->lim.limTimers.gLimQuietTimer);
1023 tx_timer_delete(&pMac->lim.limTimers.gLimQuietTimer);
1024
1025 // Deactivate and delete Quiet BSS timer.
1026 tx_timer_deactivate(&pMac->lim.limTimers.gLimQuietBssTimer);
1027 tx_timer_delete(&pMac->lim.limTimers.gLimQuietBssTimer);
1028
Jeff Johnson295189b2012-06-20 16:38:30 -07001029 // Deactivate and delete LIM background scan timer.
1030 tx_timer_deactivate(&pMac->lim.limTimers.gLimBackgroundScanTimer);
1031 tx_timer_delete(&pMac->lim.limTimers.gLimBackgroundScanTimer);
Jeff Johnson295189b2012-06-20 16:38:30 -07001032
1033
1034 // Deactivate and delete cnf wait timer
1035 for (n = 0; n < pMac->lim.maxStation; n++)
1036 {
1037 tx_timer_deactivate(&pMac->lim.limTimers.gpLimCnfWaitTimer[n]);
1038 tx_timer_delete(&pMac->lim.limTimers.gpLimCnfWaitTimer[n]);
1039 }
1040
1041 // Deactivate and delete keepalive timer
1042 tx_timer_deactivate(&pMac->lim.limTimers.gLimKeepaliveTimer);
1043 tx_timer_delete(&pMac->lim.limTimers.gLimKeepaliveTimer);
1044
1045 pAuthNode = pMac->lim.gLimPreAuthTimerTable.pTable;
1046
1047 //Deactivate any Authentication response timers
1048 limDeletePreAuthList(pMac);
1049
1050 for (n = 0; n < pMac->lim.gLimPreAuthTimerTable.numEntry; n++,pAuthNode++)
1051 {
1052 // Delete any Authentication response
1053 // timers, which might have been started.
1054 tx_timer_delete(&pAuthNode->timer);
1055 }
1056
Jeff Johnson295189b2012-06-20 16:38:30 -07001057
1058
1059 // Deactivate and delete Hash Miss throttle timer
1060 tx_timer_deactivate(&pMac->lim.limTimers.gLimSendDisassocFrameThresholdTimer);
1061 tx_timer_delete(&pMac->lim.limTimers.gLimSendDisassocFrameThresholdTimer);
1062
Jeff Johnson295189b2012-06-20 16:38:30 -07001063 tx_timer_deactivate(&pMac->lim.limTimers.gLimUpdateOlbcCacheTimer);
1064 tx_timer_delete(&pMac->lim.limTimers.gLimUpdateOlbcCacheTimer);
1065 tx_timer_deactivate(&pMac->lim.limTimers.gLimPreAuthClnupTimer);
1066 tx_timer_delete(&pMac->lim.limTimers.gLimPreAuthClnupTimer);
1067
1068#if 0 // The WPS PBC clean up timer is disabled
1069 if (pMac->lim.gLimSystemRole == eLIM_AP_ROLE)
1070 {
1071 if(pMac->lim.limTimers.gLimWPSOverlapTimerObj.isTimerCreated == eANI_BOOLEAN_TRUE)
1072 {
1073 tx_timer_deactivate(&pMac->lim.limTimers.gLimWPSOverlapTimerObj.gLimWPSOverlapTimer);
1074 tx_timer_delete(&pMac->lim.limTimers.gLimWPSOverlapTimerObj.gLimWPSOverlapTimer);
1075 pMac->lim.limTimers.gLimWPSOverlapTimerObj.isTimerCreated = eANI_BOOLEAN_FALSE;
1076 }
1077 }
1078#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001079#ifdef WLAN_FEATURE_VOWIFI_11R
1080 // Deactivate and delete FT Preauth response timer
1081 tx_timer_deactivate(&pMac->lim.limTimers.gLimFTPreAuthRspTimer);
1082 tx_timer_delete(&pMac->lim.limTimers.gLimFTPreAuthRspTimer);
1083#endif
1084
Jeff Johnson295189b2012-06-20 16:38:30 -07001085 // Deactivate and delete remain on channel timer
1086 tx_timer_deactivate(&pMac->lim.limTimers.gLimRemainOnChannelTimer);
1087 tx_timer_delete(&pMac->lim.limTimers.gLimRemainOnChannelTimer);
Jeff Johnson295189b2012-06-20 16:38:30 -07001088
1089#ifdef FEATURE_WLAN_CCX
1090 // Deactivate and delete TSM
1091 tx_timer_deactivate(&pMac->lim.limTimers.gLimCcxTsmTimer);
1092 tx_timer_delete(&pMac->lim.limTimers.gLimCcxTsmTimer);
1093#endif
1094
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -08001095 tx_timer_deactivate(&pMac->lim.limTimers.gLimDisassocAckTimer);
1096 tx_timer_delete(&pMac->lim.limTimers.gLimDisassocAckTimer);
1097
1098 tx_timer_deactivate(&pMac->lim.limTimers.gLimDeauthAckTimer);
1099 tx_timer_delete(&pMac->lim.limTimers.gLimDeauthAckTimer);
1100
Hoonki Leef63df0d2013-01-16 19:29:14 -08001101 tx_timer_deactivate(&pMac->lim.limTimers.gLimP2pSingleShotNoaInsertTimer);
1102 tx_timer_delete(&pMac->lim.limTimers.gLimP2pSingleShotNoaInsertTimer);
Hoonki Leef63df0d2013-01-16 19:29:14 -08001103
Gopichand Nakkala0d6e4ad2013-05-17 02:30:25 +05301104 tx_timer_deactivate(&pMac->lim.limTimers.gLimActiveToPassiveChannelTimer);
1105 tx_timer_delete(&pMac->lim.limTimers.gLimActiveToPassiveChannelTimer);
1106
Jeff Johnson295189b2012-06-20 16:38:30 -07001107 pMac->lim.gLimTimersCreated = 0;
1108 }
1109
1110 /// Cleanup cached scan list
1111 limReInitScanResults(pMac);
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07001112#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
1113 /// Cleanup cached scan list
1114 limReInitLfrScanResults(pMac);
1115#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001116
1117} /*** end limCleanupMlm() ***/
1118
1119
1120
1121/**
1122 * limCleanupLmm()
1123 *
1124 *FUNCTION:
1125 * This function is called to cleanup any resources
1126 * allocated by LMM sub-module.
1127 *
1128 *PARAMS:
1129 *
1130 *LOGIC:
1131 *
1132 *ASSUMPTIONS:
1133 * NA
1134 *
1135 *NOTE:
1136 * NA
1137 *
1138 * @param pMac Pointer to Global MAC structure
1139 * @return None
1140 */
1141
1142void
1143limCleanupLmm(tpAniSirGlobal pMac)
1144{
Jeff Johnson295189b2012-06-20 16:38:30 -07001145} /*** end limCleanupLmm() ***/
1146
1147
1148
1149/**
1150 * limIsAddrBC()
1151 *
1152 *FUNCTION:
1153 * This function is called in various places within LIM code
1154 * to determine whether passed MAC address is a broadcast or not
1155 *
1156 *LOGIC:
1157 *
1158 *ASSUMPTIONS:
1159 * NA
1160 *
1161 *NOTE:
1162 * NA
1163 *
1164 * @param macAddr Indicates MAC address that need to be determined
1165 * whether it is Broadcast address or not
1166 *
1167 * @return true if passed address is Broadcast address else false
1168 */
1169
1170tANI_U8
1171limIsAddrBC(tSirMacAddr macAddr)
1172{
1173 int i;
1174 for (i = 0; i < 6; i++)
1175 {
1176 if ((macAddr[i] & 0xFF) != 0xFF)
1177 return false;
1178 }
1179
1180 return true;
1181} /****** end limIsAddrBC() ******/
1182
1183
1184
1185/**
1186 * limIsGroupAddr()
1187 *
1188 *FUNCTION:
1189 * This function is called in various places within LIM code
1190 * to determine whether passed MAC address is a group address or not
1191 *
1192 *LOGIC:
1193 * If least significant bit of first octet of the MAC address is
1194 * set to 1, it is a Group address.
1195 *
1196 *ASSUMPTIONS:
1197 * NA
1198 *
1199 *NOTE:
1200 * NA
1201 *
1202 * @param macAddr Indicates MAC address that need to be determined
1203 * whether it is Group address or not
1204 *
1205 * @return true if passed address is Group address else false
1206 */
1207
1208tANI_U8
1209limIsGroupAddr(tSirMacAddr macAddr)
1210{
1211 if ((macAddr[0] & 0x01) == 0x01)
1212 return true;
1213 else
1214 return false;
1215} /****** end limIsGroupAddr() ******/
1216
1217/**
1218 * limPostMsgApiNoWait()
1219 *
1220 *FUNCTION:
1221 * This function is called from other thread while posting a
1222 * message to LIM message Queue gSirLimMsgQ with NO_WAIT option
1223 *
1224 *LOGIC:
1225 * NA
1226 *
1227 *ASSUMPTIONS:
1228 * NA
1229 *
1230 *NOTE:
1231 * NA
1232 *
1233 * @param pMsg - Pointer to the Global MAC structure
1234 * @param pMsg - Pointer to the message structure
1235 * @return None
1236 */
1237
1238tANI_U32
1239limPostMsgApiNoWait(tpAniSirGlobal pMac, tSirMsgQ *pMsg)
1240{
Jeff Johnson295189b2012-06-20 16:38:30 -07001241 limProcessMessages(pMac, pMsg);
1242 return TX_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -07001243} /*** end limPostMsgApiNoWait() ***/
1244
1245
1246
1247/**
1248 * limPrintMacAddr()
1249 *
1250 *FUNCTION:
1251 * This function is called to print passed MAC address
1252 * in : format.
1253 *
1254 *LOGIC:
1255 *
1256 *ASSUMPTIONS:
1257 * NA
1258 *
1259 *NOTE:
1260 * @param macAddr - MacAddr to be printed
1261 * @param logLevel - Loglevel to be used
1262 *
1263 * @return None.
1264 */
1265
1266void
1267limPrintMacAddr(tpAniSirGlobal pMac, tSirMacAddr macAddr, tANI_U8 logLevel)
1268{
1269 limLog(pMac, logLevel,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001270 FL("%X:%X:%X:%X:%X:%X"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001271 macAddr[0], macAddr[1], macAddr[2], macAddr[3], macAddr[4],
1272 macAddr[5]);
1273} /****** end limPrintMacAddr() ******/
1274
1275
1276
1277
1278
1279
1280/*
1281 * limResetDeferredMsgQ()
1282 *
1283 *FUNCTION:
1284 * This function resets the deferred message queue parameters.
1285 *
1286 *PARAMS:
1287 * @param pMac - Pointer to Global MAC structure
1288 *
1289 *LOGIC:
1290 *
1291 *ASSUMPTIONS:
1292 * NA
1293 *
1294 *NOTE:
1295 * NA
1296 *
1297 *RETURNS:
1298 * None
1299 */
1300
1301void limResetDeferredMsgQ(tpAniSirGlobal pMac)
1302{
1303 pMac->lim.gLimDeferredMsgQ.size =
1304 pMac->lim.gLimDeferredMsgQ.write =
1305 pMac->lim.gLimDeferredMsgQ.read = 0;
1306
1307}
1308
1309
1310#define LIM_DEFERRED_Q_CHECK_THRESHOLD (MAX_DEFERRED_QUEUE_LEN/2)
1311#define LIM_MAX_NUM_MGMT_FRAME_DEFERRED (MAX_DEFERRED_QUEUE_LEN/2)
1312
1313/*
1314 * limWriteDeferredMsgQ()
1315 *
1316 *FUNCTION:
1317 * This function queues up a deferred message for later processing on the
1318 * STA side.
1319 *
1320 *PARAMS:
1321 * @param pMac - Pointer to Global MAC structure
1322 * @param limMsg - a LIM message
1323 *
1324 *LOGIC:
1325 *
1326 *ASSUMPTIONS:
1327 * NA
1328 *
1329 *NOTE:
1330 * NA
1331 *
1332 *RETURNS:
1333 * None
1334 */
1335
1336tANI_U8 limWriteDeferredMsgQ(tpAniSirGlobal pMac, tpSirMsgQ limMsg)
1337{
1338 PELOG1(limLog(pMac, LOG1,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001339 FL("** Queue a deferred message (size %d, write %d) - type 0x%x **"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001340 pMac->lim.gLimDeferredMsgQ.size, pMac->lim.gLimDeferredMsgQ.write,
1341 limMsg->type);)
1342
1343 /*
1344 ** check if the deferred message queue is full
1345 **/
1346 if (pMac->lim.gLimDeferredMsgQ.size >= MAX_DEFERRED_QUEUE_LEN)
1347 {
Leela Venkata Kiran Kumar Reddy Chirala2247e962013-03-22 19:21:10 -07001348 if(!(pMac->lim.deferredMsgCnt & 0xF))
1349 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001350 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 -07001351 }
1352 else
1353 {
1354 pMac->lim.deferredMsgCnt++;
1355 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001356 return TX_QUEUE_FULL;
1357 }
1358
1359 /*
1360 ** In the application, there should not be more than 1 message get
1361 ** queued up. If happens, flags a warning. In the future, this can
1362 ** happen.
1363 **/
1364 if (pMac->lim.gLimDeferredMsgQ.size > 0)
1365 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001366 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 -07001367 pMac->lim.gLimDeferredMsgQ.size, limMsg->type,
1368 limIsSystemInScanState(pMac),
1369 pMac->lim.gLimSmeState, pMac->lim.gLimMlmState,
1370 pMac->lim.gLimAddtsSent);)
1371 }
1372
1373 /*
1374 ** To prevent the deferred Q is full of management frames, only give them certain space
1375 **/
1376 if( SIR_BB_XPORT_MGMT_MSG == limMsg->type )
1377 {
1378 if( LIM_DEFERRED_Q_CHECK_THRESHOLD < pMac->lim.gLimDeferredMsgQ.size )
1379 {
1380 tANI_U16 idx, count = 0;
1381 for(idx = 0; idx < pMac->lim.gLimDeferredMsgQ.size; idx++)
1382 {
1383 if( SIR_BB_XPORT_MGMT_MSG == pMac->lim.gLimDeferredMsgQ.deferredQueue[idx].type )
1384 {
1385 count++;
1386 }
1387 }
1388 if( LIM_MAX_NUM_MGMT_FRAME_DEFERRED < count )
1389 {
1390 //We reach the quota for management frames, drop this one
Madan Mohan Koyyalamudi5695b502012-09-24 14:21:12 -07001391 PELOGW(limLog(pMac, LOGW, FL("Cannot deferred. Msg: %d Too many (count=%d) already"), limMsg->type, count);)
Jeff Johnson295189b2012-06-20 16:38:30 -07001392 //Return error, caller knows what to do
1393 return TX_QUEUE_FULL;
1394 }
1395 }
1396 }
1397
1398 ++pMac->lim.gLimDeferredMsgQ.size;
1399
Leela Venkata Kiran Kumar Reddy Chirala2247e962013-03-22 19:21:10 -07001400 /* reset the count here since we are able to defer the message */
1401 if(pMac->lim.deferredMsgCnt != 0)
1402 {
1403 pMac->lim.deferredMsgCnt = 0;
1404 }
1405
Jeff Johnson295189b2012-06-20 16:38:30 -07001406 /*
1407 ** if the write pointer hits the end of the queue, rewind it
1408 **/
1409 if (pMac->lim.gLimDeferredMsgQ.write >= MAX_DEFERRED_QUEUE_LEN)
1410 pMac->lim.gLimDeferredMsgQ.write = 0;
1411
1412 /*
1413 ** save the message to the queue and advanced the write pointer
1414 **/
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301415 vos_mem_copy( (tANI_U8 *)&pMac->lim.gLimDeferredMsgQ.deferredQueue[
1416 pMac->lim.gLimDeferredMsgQ.write++],
Jeff Johnson295189b2012-06-20 16:38:30 -07001417 (tANI_U8 *)limMsg,
1418 sizeof(tSirMsgQ));
1419 return TX_SUCCESS;
1420
1421}
1422
1423/*
1424 * limReadDeferredMsgQ()
1425 *
1426 *FUNCTION:
1427 * This function dequeues a deferred message for processing on the
1428 * STA side.
1429 *
1430 *PARAMS:
1431 * @param pMac - Pointer to Global MAC structure
1432 *
1433 *LOGIC:
1434 *
1435 *ASSUMPTIONS:
1436 * NA
1437 *
1438 *NOTE:
1439 *
1440 *
1441 *RETURNS:
1442 * Returns the message at the head of the deferred message queue
1443 */
1444
1445tSirMsgQ* limReadDeferredMsgQ(tpAniSirGlobal pMac)
1446{
1447 tSirMsgQ *msg;
1448
1449 /*
1450 ** check any messages left. If no, return
1451 **/
1452 if (pMac->lim.gLimDeferredMsgQ.size <= 0)
1453 return NULL;
1454
1455 /*
1456 ** decrement the queue size
1457 **/
1458 pMac->lim.gLimDeferredMsgQ.size--;
1459
1460 /*
1461 ** retrieve the message from the head of the queue
1462 **/
1463 msg = &pMac->lim.gLimDeferredMsgQ.deferredQueue[pMac->lim.gLimDeferredMsgQ.read];
1464
1465 /*
1466 ** advance the read pointer
1467 **/
1468 pMac->lim.gLimDeferredMsgQ.read++;
1469
1470 /*
1471 ** if the read pointer hits the end of the queue, rewind it
1472 **/
1473 if (pMac->lim.gLimDeferredMsgQ.read >= MAX_DEFERRED_QUEUE_LEN)
1474 pMac->lim.gLimDeferredMsgQ.read = 0;
1475
1476 PELOG1(limLog(pMac, LOG1,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001477 FL("** DeQueue a deferred message (size %d read %d) - type 0x%x **"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001478 pMac->lim.gLimDeferredMsgQ.size, pMac->lim.gLimDeferredMsgQ.read,
1479 msg->type);)
1480
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001481 PELOG1(limLog(pMac, LOG1, FL("DQ msg -- scan %d, global sme %d, global mlme %d, addts %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001482 limIsSystemInScanState(pMac),
1483 pMac->lim.gLimSmeState, pMac->lim.gLimMlmState,
1484 pMac->lim.gLimAddtsSent);)
1485
1486 return(msg);
1487}
1488
1489tSirRetStatus
1490limSysProcessMmhMsgApi(tpAniSirGlobal pMac,
1491 tSirMsgQ *pMsg,
1492 tANI_U8 qType)
1493{
1494// FIXME
Jeff Johnson295189b2012-06-20 16:38:30 -07001495 SysProcessMmhMsg(pMac, pMsg);
1496 return eSIR_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -07001497}
1498
1499char *limFrameStr(tANI_U32 type, tANI_U32 subType)
1500{
1501#ifdef FIXME_GEN6
1502
1503 if (type == SIR_MAC_MGMT_FRAME)
1504 {
1505 switch (subType)
1506 {
1507 case SIR_MAC_MGMT_ASSOC_REQ:
1508 return "MAC_MGMT_ASSOC_REQ";
1509 case SIR_MAC_MGMT_ASSOC_RSP:
1510 return "MAC_MGMT_ASSOC_RSP";
1511 case SIR_MAC_MGMT_REASSOC_REQ:
1512 return "MAC_MGMT_REASSOC_REQ";
1513 case SIR_MAC_MGMT_REASSOC_RSP:
1514 return "MAC_MGMT_REASSOC_RSP";
1515 case SIR_MAC_MGMT_PROBE_REQ:
1516 return "MAC_MGMT_PROBE_REQ";
1517 case SIR_MAC_MGMT_PROBE_RSP:
1518 return "MAC_MGMT_PROBE_RSP";
1519 case SIR_MAC_MGMT_BEACON:
1520 return "MAC_MGMT_BEACON";
1521 case SIR_MAC_MGMT_ATIM:
1522 return "MAC_MGMT_ATIM";
1523 case SIR_MAC_MGMT_DISASSOC:
1524 return "MAC_MGMT_DISASSOC";
1525 case SIR_MAC_MGMT_AUTH:
1526 return "MAC_MGMT_AUTH";
1527 case SIR_MAC_MGMT_DEAUTH:
1528 return "MAC_MGMT_DEAUTH";
1529 case SIR_MAC_MGMT_ACTION:
1530 return "MAC_MGMT_ACTION";
1531 case SIR_MAC_MGMT_RESERVED15:
1532 return "MAC_MGMT_RESERVED15";
1533 default:
1534 return "Unknown MGMT Frame";
1535 }
1536 }
1537
1538 else if (type == SIR_MAC_CTRL_FRAME)
1539 {
1540 switch (subType)
1541 {
1542 case SIR_MAC_CTRL_RR:
1543 return "MAC_CTRL_RR";
1544 case SIR_MAC_CTRL_BAR:
1545 return "MAC_CTRL_BAR";
1546 case SIR_MAC_CTRL_BA:
1547 return "MAC_CTRL_BA";
1548 case SIR_MAC_CTRL_PS_POLL:
1549 return "MAC_CTRL_PS_POLL";
1550 case SIR_MAC_CTRL_RTS:
1551 return "MAC_CTRL_RTS";
1552 case SIR_MAC_CTRL_CTS:
1553 return "MAC_CTRL_CTS";
1554 case SIR_MAC_CTRL_ACK:
1555 return "MAC_CTRL_ACK";
1556 case SIR_MAC_CTRL_CF_END:
1557 return "MAC_CTRL_CF_END";
1558 case SIR_MAC_CTRL_CF_END_ACK:
1559 return "MAC_CTRL_CF_END_ACK";
1560 default:
1561 return "Unknown CTRL Frame";
1562 }
1563 }
1564
1565 else if (type == SIR_MAC_DATA_FRAME)
1566 {
1567 switch (subType)
1568 {
1569 case SIR_MAC_DATA_DATA:
1570 return "MAC_DATA_DATA";
1571 case SIR_MAC_DATA_DATA_ACK:
1572 return "MAC_DATA_DATA_ACK";
1573 case SIR_MAC_DATA_DATA_POLL:
1574 return "MAC_DATA_DATA_POLL";
1575 case SIR_MAC_DATA_DATA_ACK_POLL:
1576 return "MAC_DATA_DATA_ACK_POLL";
1577 case SIR_MAC_DATA_NULL:
1578 return "MAC_DATA_NULL";
1579 case SIR_MAC_DATA_NULL_ACK:
1580 return "MAC_DATA_NULL_ACK";
1581 case SIR_MAC_DATA_NULL_POLL:
1582 return "MAC_DATA_NULL_POLL";
1583 case SIR_MAC_DATA_NULL_ACK_POLL:
1584 return "MAC_DATA_NULL_ACK_POLL";
1585 case SIR_MAC_DATA_QOS_DATA:
1586 return "MAC_DATA_QOS_DATA";
1587 case SIR_MAC_DATA_QOS_DATA_ACK:
1588 return "MAC_DATA_QOS_DATA_ACK";
1589 case SIR_MAC_DATA_QOS_DATA_POLL:
1590 return "MAC_DATA_QOS_DATA_POLL";
1591 case SIR_MAC_DATA_QOS_DATA_ACK_POLL:
1592 return "MAC_DATA_QOS_DATA_ACK_POLL";
1593 case SIR_MAC_DATA_QOS_NULL:
1594 return "MAC_DATA_QOS_NULL";
1595 case SIR_MAC_DATA_QOS_NULL_ACK:
1596 return "MAC_DATA_QOS_NULL_ACK";
1597 case SIR_MAC_DATA_QOS_NULL_POLL:
1598 return "MAC_DATA_QOS_NULL_POLL";
1599 case SIR_MAC_DATA_QOS_NULL_ACK_POLL:
1600 return "MAC_DATA_QOS_NULL_ACK_POLL";
1601 default:
1602 return "Unknown Data Frame";
1603 }
1604 }
1605 else
1606 return "Unknown";
1607#endif
1608return "";
1609}
1610
Jeff Johnson295189b2012-06-20 16:38:30 -07001611void limHandleUpdateOlbcCache(tpAniSirGlobal pMac)
1612{
1613 int i;
1614 static int enable;
1615 tUpdateBeaconParams beaconParams;
1616
1617 tpPESession psessionEntry = limIsApSessionActive(pMac);
1618
1619 if (psessionEntry == NULL)
Madan Mohan Koyyalamudi788b4ee2012-09-25 10:42:09 -07001620 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001621 PELOGE(limLog(pMac, LOGE, FL(" Session not found"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001622 return;
Madan Mohan Koyyalamudi788b4ee2012-09-25 10:42:09 -07001623 }
Pratik Bhalgatb44ea3f2012-11-22 16:41:39 +05301624
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301625 vos_mem_set( ( tANI_U8* )&beaconParams, sizeof( tUpdateBeaconParams), 0);
Madan Mohan Koyyalamudib2733142012-10-31 13:59:17 -07001626 beaconParams.bssIdx = psessionEntry->bssIdx;
Jeff Johnson295189b2012-06-20 16:38:30 -07001627
1628 beaconParams.paramChangeBitmap = 0;
1629 /*
1630 ** This is doing a 2 pass check. The first pass is to invalidate
1631 ** all the cache entries. The second pass is to decide whether to
1632 ** disable protection.
1633 **/
1634 if (!enable)
1635 {
1636
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001637 PELOG2(limLog(pMac, LOG2, FL("Resetting OLBC cache"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001638 psessionEntry->gLimOlbcParams.numSta = 0;
1639 psessionEntry->gLimOverlap11gParams.numSta = 0;
1640 psessionEntry->gLimOverlapHt20Params.numSta = 0;
1641 psessionEntry->gLimNonGfParams.numSta = 0;
1642 psessionEntry->gLimLsigTxopParams.numSta = 0;
1643
1644 for (i=0; i < LIM_PROT_STA_OVERLAP_CACHE_SIZE; i++)
1645 pMac->lim.protStaOverlapCache[i].active = false;
1646
1647 enable = 1;
1648 }
1649 else
1650 {
1651
Madan Mohan Koyyalamudi788b4ee2012-09-25 10:42:09 -07001652 if (!psessionEntry->gLimOlbcParams.numSta)
Jeff Johnson295189b2012-06-20 16:38:30 -07001653 {
1654 if (psessionEntry->gLimOlbcParams.protectionEnabled)
1655 {
1656 if (!psessionEntry->gLim11bParams.protectionEnabled)
1657 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001658 PELOG1(limLog(pMac, LOG1, FL("Overlap cache all clear and no 11B STA detected"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001659 limEnable11gProtection(pMac, false, true, &beaconParams, psessionEntry);
1660 }
1661 }
1662 }
1663
1664 if (!psessionEntry->gLimOverlap11gParams.numSta)
1665 {
1666 if (psessionEntry->gLimOverlap11gParams.protectionEnabled)
1667 {
1668 if (!psessionEntry->gLim11gParams.protectionEnabled)
1669 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001670 PELOG1(limLog(pMac, LOG1, FL("Overlap cache all clear and no 11G STA detected"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001671 limEnableHtProtectionFrom11g(pMac, false, true, &beaconParams,psessionEntry);
1672 }
1673 }
1674 }
1675
1676 if (!psessionEntry->gLimOverlapHt20Params.numSta)
1677 {
1678 if (psessionEntry->gLimOverlapHt20Params.protectionEnabled)
1679 {
1680 if (!psessionEntry->gLimHt20Params.protectionEnabled)
1681 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001682 PELOG1(limLog(pMac, LOG1, FL("Overlap cache all clear and no HT20 STA detected"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001683 limEnable11gProtection(pMac, false, true, &beaconParams,psessionEntry);
1684 }
1685 }
1686 }
1687
1688 enable = 0;
1689 }
1690
1691 if(beaconParams.paramChangeBitmap)
1692 {
1693 schSetFixedBeaconFields(pMac,psessionEntry);
1694 limSendBeaconParams(pMac, &beaconParams, psessionEntry);
1695 }
1696
1697 // Start OLBC timer
1698 if (tx_timer_activate(&pMac->lim.limTimers.gLimUpdateOlbcCacheTimer) != TX_SUCCESS)
1699 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001700 limLog(pMac, LOGE, FL("tx_timer_activate failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001701 }
1702}
Jeff Johnson295189b2012-06-20 16:38:30 -07001703
1704/**
1705 * limIsNullSsid()
1706 *
1707 *FUNCTION:
1708 * This function checks if Ssid supplied is Null SSID
1709 *
1710 *
1711 *LOGIC:
1712 *
1713 *ASSUMPTIONS:
1714 * NA
1715 *
1716 *NOTE:
1717 * NA
1718 *
1719 * @param tSirMacSSid *
1720 *
1721 *
1722 * @return true if SSID is Null SSID else false
1723 */
1724
1725tANI_U8
1726limIsNullSsid( tSirMacSSid *pSsid )
1727{
1728 tANI_U8 fNullSsid = false;
1729 tANI_U32 SsidLength;
1730 tANI_U8 *pSsidStr;
1731
1732 do
1733 {
1734 if ( 0 == pSsid->length )
1735 {
1736 fNullSsid = true;
1737 break;
1738 }
1739
1740#define ASCII_SPACE_CHARACTER 0x20
1741 /* If the first charactes is space, then check if all characters in
1742 * SSID are spaces to consider it as NULL SSID*/
1743 if( ASCII_SPACE_CHARACTER == pSsid->ssId[0])
1744 {
1745 SsidLength = pSsid->length;
1746 pSsidStr = pSsid->ssId;
1747 /* check if all the charactes in SSID are spaces*/
1748 while ( SsidLength )
1749 {
1750 if( ASCII_SPACE_CHARACTER != *pSsidStr )
1751 break;
1752
1753 pSsidStr++;
1754 SsidLength--;
1755 }
1756
1757 if( 0 == SsidLength )
1758 {
1759 fNullSsid = true;
1760 break;
1761 }
1762 }
1763 else
1764 {
1765 /* check if all the charactes in SSID are NULL*/
1766 SsidLength = pSsid->length;
1767 pSsidStr = pSsid->ssId;
1768
1769 while ( SsidLength )
1770 {
1771 if( *pSsidStr )
1772 break;
1773
1774 pSsidStr++;
1775 SsidLength--;
1776 }
1777
1778 if( 0 == SsidLength )
1779 {
1780 fNullSsid = true;
1781 break;
1782 }
1783 }
1784 }
1785 while( 0 );
1786
1787 return fNullSsid;
1788} /****** end limIsNullSsid() ******/
1789
1790
1791
Jeff Johnson295189b2012-06-20 16:38:30 -07001792
1793/** -------------------------------------------------------------
1794\fn limUpdateProtStaParams
1795\brief updates protection related counters.
1796\param tpAniSirGlobal pMac
1797\param tSirMacAddr peerMacAddr
1798\param tLimProtStaCacheType protStaCacheType
1799\param tHalBitVal gfSupported
1800\param tHalBitVal lsigTxopSupported
1801\return None
1802 -------------------------------------------------------------*/
1803void
1804limUpdateProtStaParams(tpAniSirGlobal pMac,
1805tSirMacAddr peerMacAddr, tLimProtStaCacheType protStaCacheType,
1806tHalBitVal gfSupported, tHalBitVal lsigTxopSupported,
1807tpPESession psessionEntry)
1808{
1809 tANI_U32 i;
1810
1811 PELOG1(limLog(pMac,LOG1, FL("A STA is associated:"));
1812 limLog(pMac,LOG1, FL("Addr : "));
1813 limPrintMacAddr(pMac, peerMacAddr, LOG1);)
1814
1815 for (i=0; i<LIM_PROT_STA_CACHE_SIZE; i++)
1816 {
1817 if (psessionEntry->protStaCache[i].active)
1818 {
1819 PELOG1(limLog(pMac, LOG1, FL("Addr: "));)
1820 PELOG1(limPrintMacAddr(pMac, psessionEntry->protStaCache[i].addr, LOG1);)
1821
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301822 if (vos_mem_compare(
Jeff Johnson295189b2012-06-20 16:38:30 -07001823 psessionEntry->protStaCache[i].addr,
1824 peerMacAddr, sizeof(tSirMacAddr)))
1825 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001826 PELOG1(limLog(pMac, LOG1, FL("matching cache entry at %d already active."), i);)
Jeff Johnson295189b2012-06-20 16:38:30 -07001827 return;
1828 }
1829 }
1830 }
1831
1832 for (i=0; i<LIM_PROT_STA_CACHE_SIZE; i++)
1833 {
1834 if (!psessionEntry->protStaCache[i].active)
1835 break;
1836 }
1837
1838 if (i >= LIM_PROT_STA_CACHE_SIZE)
1839 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001840 PELOGE(limLog(pMac, LOGE, FL("No space in ProtStaCache"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001841 return;
1842 }
1843
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301844 vos_mem_copy( psessionEntry->protStaCache[i].addr,
Jeff Johnson295189b2012-06-20 16:38:30 -07001845 peerMacAddr,
1846 sizeof(tSirMacAddr));
1847
1848 psessionEntry->protStaCache[i].protStaCacheType = protStaCacheType;
1849 psessionEntry->protStaCache[i].active = true;
1850 if(eLIM_PROT_STA_CACHE_TYPE_llB == protStaCacheType)
1851 {
1852 psessionEntry->gLim11bParams.numSta++;
1853 limLog(pMac,LOG1, FL("11B, "));
1854 }
1855 else if(eLIM_PROT_STA_CACHE_TYPE_llG == protStaCacheType)
1856 {
1857 psessionEntry->gLim11gParams.numSta++;
1858 limLog(pMac,LOG1, FL("11G, "));
1859 }
1860 else if(eLIM_PROT_STA_CACHE_TYPE_HT20 == protStaCacheType)
1861 {
1862 psessionEntry->gLimHt20Params.numSta++;
1863 limLog(pMac,LOG1, FL("HT20, "));
1864 }
1865
1866 if(!gfSupported)
1867 {
1868 psessionEntry->gLimNonGfParams.numSta++;
1869 limLog(pMac,LOG1, FL("NonGf, "));
1870 }
1871 if(!lsigTxopSupported)
1872 {
1873 psessionEntry->gLimLsigTxopParams.numSta++;
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001874 limLog(pMac,LOG1, FL("!lsigTxopSupported"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001875 }
1876}// ---------------------------------------------------------------------
1877
1878/** -------------------------------------------------------------
1879\fn limDecideApProtection
1880\brief Decides all the protection related staiton coexistence and also sets
1881\ short preamble and short slot appropriately. This function will be called
1882\ when AP is ready to send assocRsp tp the station joining right now.
1883\param tpAniSirGlobal pMac
1884\param tSirMacAddr peerMacAddr
1885\return None
1886 -------------------------------------------------------------*/
1887void
1888limDecideApProtection(tpAniSirGlobal pMac, tSirMacAddr peerMacAddr, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry)
1889{
1890 tANI_U16 tmpAid;
1891 tpDphHashNode pStaDs;
1892 tSirRFBand rfBand = SIR_BAND_UNKNOWN;
1893 tANI_U32 phyMode;
1894 tLimProtStaCacheType protStaCacheType = eLIM_PROT_STA_CACHE_TYPE_INVALID;
1895 tHalBitVal gfSupported = eHAL_SET, lsigTxopSupported = eHAL_SET;
1896
1897 pBeaconParams->paramChangeBitmap = 0;
1898 // check whether to enable protection or not
1899 pStaDs = dphLookupHashEntry(pMac, peerMacAddr, &tmpAid, &psessionEntry->dph.dphHashTable);
1900 if(NULL == pStaDs)
1901 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001902 PELOG1(limLog(pMac, LOG1, FL("pStaDs is NULL"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001903 return;
1904 }
1905 limGetRfBand(pMac, &rfBand, psessionEntry);
1906 //if we are in 5 GHZ band
1907 if(SIR_BAND_5_GHZ == rfBand)
1908 {
1909 //We are 11N. we need to protect from 11A and Ht20. we don't need any other protection in 5 GHZ.
1910 //HT20 case is common between both the bands and handled down as common code.
Jeff Johnsone7245742012-09-05 17:12:55 -07001911 if(true == psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07001912 {
1913 //we are 11N and 11A station is joining.
1914 //protection from 11A required.
1915 if(false == pStaDs->mlmStaContext.htCapability)
1916 {
1917 limEnable11aProtection(pMac, true, false, pBeaconParams,psessionEntry);
1918 return;
1919 }
1920 }
1921 }
1922 else if(SIR_BAND_2_4_GHZ== rfBand)
1923 {
1924 limGetPhyMode(pMac, &phyMode, psessionEntry);
1925
1926 //We are 11G. Check if we need protection from 11b Stations.
1927 if ((phyMode == WNI_CFG_PHY_MODE_11G) &&
Jeff Johnsone7245742012-09-05 17:12:55 -07001928 (false == psessionEntry->htCapability))
Jeff Johnson295189b2012-06-20 16:38:30 -07001929 {
1930
1931 if (pStaDs->erpEnabled== eHAL_CLEAR)
1932 {
1933 protStaCacheType = eLIM_PROT_STA_CACHE_TYPE_llB;
1934 // enable protection
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001935 PELOG3(limLog(pMac, LOG3, FL("Enabling protection from 11B"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001936 limEnable11gProtection(pMac, true, false, pBeaconParams,psessionEntry);
1937 }
1938 }
1939
1940 //HT station.
Jeff Johnsone7245742012-09-05 17:12:55 -07001941 if (true == psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07001942 {
1943 //check if we need protection from 11b station
1944 if ((pStaDs->erpEnabled == eHAL_CLEAR) &&
1945 (!pStaDs->mlmStaContext.htCapability))
1946 {
1947 protStaCacheType = eLIM_PROT_STA_CACHE_TYPE_llB;
1948 // enable protection
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001949 PELOG3(limLog(pMac, LOG3, FL("Enabling protection from 11B"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001950 limEnable11gProtection(pMac, true, false, pBeaconParams, psessionEntry);
1951 }
1952 //station being joined is non-11b and non-ht ==> 11g device
1953 else if(!pStaDs->mlmStaContext.htCapability)
1954 {
1955 protStaCacheType = eLIM_PROT_STA_CACHE_TYPE_llG;
1956 //enable protection
1957 limEnableHtProtectionFrom11g(pMac, true, false, pBeaconParams, psessionEntry);
1958 }
1959 //ERP mode is enabled for the latest station joined
1960 //latest station joined is HT capable
1961 //This case is being handled in common code (commn between both the bands) below.
1962 }
1963 }
1964
1965 //we are HT and HT station is joining. This code is common for both the bands.
Jeff Johnsone7245742012-09-05 17:12:55 -07001966 if((true == psessionEntry->htCapability) &&
Jeff Johnson295189b2012-06-20 16:38:30 -07001967 (true == pStaDs->mlmStaContext.htCapability))
1968 {
1969 if(!pStaDs->htGreenfield)
1970 {
1971 limEnableHTNonGfProtection(pMac, true, false, pBeaconParams, psessionEntry);
1972 gfSupported = eHAL_CLEAR;
1973 }
1974 //Station joining is HT 20Mhz
1975 if(eHT_CHANNEL_WIDTH_20MHZ == pStaDs->htSupportedChannelWidthSet)
1976 {
1977 protStaCacheType = eLIM_PROT_STA_CACHE_TYPE_HT20;
1978 limEnableHT20Protection(pMac, true, false, pBeaconParams, psessionEntry);
1979 }
1980 //Station joining does not support LSIG TXOP Protection
1981 if(!pStaDs->htLsigTXOPProtection)
1982 {
1983 limEnableHTLsigTxopProtection(pMac, false, false, pBeaconParams,psessionEntry);
1984 lsigTxopSupported = eHAL_CLEAR;
1985 }
1986 }
1987
1988 limUpdateProtStaParams(pMac, peerMacAddr, protStaCacheType,
1989 gfSupported, lsigTxopSupported, psessionEntry);
1990
1991 return;
1992}
Jeff Johnson295189b2012-06-20 16:38:30 -07001993
1994
1995/** -------------------------------------------------------------
1996\fn limEnableOverlap11gProtection
1997\brief wrapper function for setting overlap 11g protection.
1998\param tpAniSirGlobal pMac
1999\param tpUpdateBeaconParams pBeaconParams
2000\param tpSirMacMgmtHdr pMh
2001\return None
2002 -------------------------------------------------------------*/
2003void
2004limEnableOverlap11gProtection(tpAniSirGlobal pMac,
2005tpUpdateBeaconParams pBeaconParams, tpSirMacMgmtHdr pMh,tpPESession psessionEntry)
2006{
2007 limUpdateOverlapStaParam(pMac, pMh->bssId, &(psessionEntry->gLimOlbcParams));
2008
2009 if (psessionEntry->gLimOlbcParams.numSta &&
2010 !psessionEntry->gLimOlbcParams.protectionEnabled)
2011 {
2012 // enable protection
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002013 PELOG1(limLog(pMac, LOG1, FL("OLBC happens!!!"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002014 limEnable11gProtection(pMac, true, true, pBeaconParams,psessionEntry);
2015 }
2016}
2017
2018
2019/** -------------------------------------------------------------
2020\fn limUpdateShortPreamble
2021\brief Updates short preamble if needed when a new station joins.
2022\param tpAniSirGlobal pMac
2023\param tSirMacAddr peerMacAddr
2024\param tpUpdateBeaconParams pBeaconParams
2025\return None
2026 -------------------------------------------------------------*/
2027void
2028limUpdateShortPreamble(tpAniSirGlobal pMac, tSirMacAddr peerMacAddr,
2029 tpUpdateBeaconParams pBeaconParams, tpPESession psessionEntry)
2030{
2031 tANI_U16 tmpAid;
2032 tpDphHashNode pStaDs;
2033 tANI_U32 phyMode;
2034 tANI_U16 i;
2035
2036 // check whether to enable protection or not
2037 pStaDs = dphLookupHashEntry(pMac, peerMacAddr, &tmpAid, &psessionEntry->dph.dphHashTable);
2038
2039 limGetPhyMode(pMac, &phyMode, psessionEntry);
2040
2041 if (pStaDs != NULL && phyMode == WNI_CFG_PHY_MODE_11G)
2042
2043 {
2044 if (pStaDs->shortPreambleEnabled == eHAL_CLEAR)
2045 {
2046 PELOG1(limLog(pMac,LOG1,FL("Short Preamble is not enabled in Assoc Req from "));
2047 limPrintMacAddr(pMac, peerMacAddr, LOG1);)
2048
2049 for (i=0; i<LIM_PROT_STA_CACHE_SIZE; i++)
2050 {
Jeff Johnson295189b2012-06-20 16:38:30 -07002051 if ((psessionEntry->limSystemRole == eLIM_AP_ROLE ) &&
2052 psessionEntry->gLimNoShortParams.staNoShortCache[i].active)
2053 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05302054 if (vos_mem_compare(
Jeff Johnson295189b2012-06-20 16:38:30 -07002055 psessionEntry->gLimNoShortParams.staNoShortCache[i].addr,
2056 peerMacAddr, sizeof(tSirMacAddr)))
2057 return;
2058 }else if(psessionEntry->limSystemRole != eLIM_AP_ROLE)
Jeff Johnson295189b2012-06-20 16:38:30 -07002059 {
2060 if (pMac->lim.gLimNoShortParams.staNoShortCache[i].active)
2061 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05302062 if (vos_mem_compare(
Jeff Johnson295189b2012-06-20 16:38:30 -07002063 pMac->lim.gLimNoShortParams.staNoShortCache[i].addr,
2064 peerMacAddr, sizeof(tSirMacAddr)))
2065 return;
2066 }
2067 }
2068 }
2069
2070
2071 for (i=0; i<LIM_PROT_STA_CACHE_SIZE; i++)
2072 {
Jeff Johnson295189b2012-06-20 16:38:30 -07002073 if ( (psessionEntry->limSystemRole == eLIM_AP_ROLE ) &&
2074 !psessionEntry->gLimNoShortParams.staNoShortCache[i].active)
2075 break;
2076 else
Jeff Johnson295189b2012-06-20 16:38:30 -07002077 {
2078 if (!pMac->lim.gLimNoShortParams.staNoShortCache[i].active)
2079 break;
2080 }
2081 }
2082
2083 if (i >= LIM_PROT_STA_CACHE_SIZE)
2084 {
Jeff Johnson295189b2012-06-20 16:38:30 -07002085 if(psessionEntry->limSystemRole == eLIM_AP_ROLE){
2086 limLog(pMac, LOGE, FL("No space in Short cache (#active %d, #sta %d) for sta "),
2087 i, psessionEntry->gLimNoShortParams.numNonShortPreambleSta);
2088 limPrintMacAddr(pMac, peerMacAddr, LOGE);
2089 return;
2090 }
2091 else
Jeff Johnson295189b2012-06-20 16:38:30 -07002092 {
2093 limLog(pMac, LOGE, FL("No space in Short cache (#active %d, #sta %d) for sta "),
2094 i, pMac->lim.gLimNoShortParams.numNonShortPreambleSta);
2095 limPrintMacAddr(pMac, peerMacAddr, LOGE);
2096 return;
2097 }
2098
2099 }
2100
2101
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05302102 if (psessionEntry->limSystemRole == eLIM_AP_ROLE){
2103 vos_mem_copy( psessionEntry->gLimNoShortParams.staNoShortCache[i].addr,
Jeff Johnson295189b2012-06-20 16:38:30 -07002104 peerMacAddr, sizeof(tSirMacAddr));
2105 psessionEntry->gLimNoShortParams.staNoShortCache[i].active = true;
2106 psessionEntry->gLimNoShortParams.numNonShortPreambleSta++;
2107 }else
Jeff Johnson295189b2012-06-20 16:38:30 -07002108 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05302109 vos_mem_copy( pMac->lim.gLimNoShortParams.staNoShortCache[i].addr,
Jeff Johnson295189b2012-06-20 16:38:30 -07002110 peerMacAddr, sizeof(tSirMacAddr));
2111 pMac->lim.gLimNoShortParams.staNoShortCache[i].active = true;
2112 pMac->lim.gLimNoShortParams.numNonShortPreambleSta++;
2113 }
2114
2115
2116 // enable long preamble
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002117 PELOG1(limLog(pMac, LOG1, FL("Disabling short preamble"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002118
Jeff Johnson295189b2012-06-20 16:38:30 -07002119 if (limEnableShortPreamble(pMac, false, pBeaconParams, psessionEntry) != eSIR_SUCCESS)
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002120 PELOGE(limLog(pMac, LOGE, FL("Cannot enable long preamble"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002121 }
2122 }
2123}
2124
2125/** -------------------------------------------------------------
2126\fn limUpdateShortSlotTime
2127\brief Updates short slot time if needed when a new station joins.
2128\param tpAniSirGlobal pMac
2129\param tSirMacAddr peerMacAddr
2130\param tpUpdateBeaconParams pBeaconParams
2131\return None
2132 -------------------------------------------------------------*/
2133
2134void
2135limUpdateShortSlotTime(tpAniSirGlobal pMac, tSirMacAddr peerMacAddr,
2136 tpUpdateBeaconParams pBeaconParams, tpPESession psessionEntry)
2137{
2138 tANI_U16 tmpAid;
2139 tpDphHashNode pStaDs;
2140 tANI_U32 phyMode;
2141 tANI_U32 val;
Jeff Johnson295189b2012-06-20 16:38:30 -07002142 tANI_U16 i;
2143
2144 // check whether to enable protection or not
2145 pStaDs = dphLookupHashEntry(pMac, peerMacAddr, &tmpAid, &psessionEntry->dph.dphHashTable);
2146 limGetPhyMode(pMac, &phyMode, psessionEntry);
2147
Jeff Johnsone7245742012-09-05 17:12:55 -07002148 /* Only in case of softap in 11g mode, slot time might change depending on the STA being added. In 11a case, it should
2149 * be always 1 and in 11b case, it should be always 0
2150 */
Jeff Johnson295189b2012-06-20 16:38:30 -07002151 if (pStaDs != NULL && phyMode == WNI_CFG_PHY_MODE_11G)
2152 {
Jeff Johnsone7245742012-09-05 17:12:55 -07002153 /* Only when the new STA has short slot time disabled, we need to change softap's overall slot time settings
2154 * else the default for softap is always short slot enabled. When the last long slot STA leaves softAP, we take care of
2155 * it in limDecideShortSlot
2156 */
Jeff Johnson295189b2012-06-20 16:38:30 -07002157 if (pStaDs->shortSlotTimeEnabled == eHAL_CLEAR)
2158 {
2159 PELOG1(limLog(pMac, LOG1, FL("Short Slot Time is not enabled in Assoc Req from "));
2160 limPrintMacAddr(pMac, peerMacAddr, LOG1);)
2161 for (i=0; i<LIM_PROT_STA_CACHE_SIZE; i++)
2162 {
Jeff Johnson295189b2012-06-20 16:38:30 -07002163 if ((psessionEntry->limSystemRole == eLIM_AP_ROLE ) &&
2164 psessionEntry->gLimNoShortSlotParams.staNoShortSlotCache[i].active)
2165 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05302166 if (vos_mem_compare(
Jeff Johnson295189b2012-06-20 16:38:30 -07002167 psessionEntry->gLimNoShortSlotParams.staNoShortSlotCache[i].addr,
2168 peerMacAddr, sizeof(tSirMacAddr)))
2169 return;
2170 }
2171 else if(psessionEntry->limSystemRole != eLIM_AP_ROLE )
Jeff Johnson295189b2012-06-20 16:38:30 -07002172 {
2173 if (pMac->lim.gLimNoShortSlotParams.staNoShortSlotCache[i].active)
2174 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05302175 if (vos_mem_compare(
Jeff Johnson295189b2012-06-20 16:38:30 -07002176 pMac->lim.gLimNoShortSlotParams.staNoShortSlotCache[i].addr,
2177 peerMacAddr, sizeof(tSirMacAddr)))
2178 return;
2179 }
2180 }
2181 }
2182
2183 for (i=0; i<LIM_PROT_STA_CACHE_SIZE; i++)
2184 {
Jeff Johnson295189b2012-06-20 16:38:30 -07002185 if ((psessionEntry->limSystemRole == eLIM_AP_ROLE ) &&
2186 !psessionEntry->gLimNoShortSlotParams.staNoShortSlotCache[i].active)
2187 break;
2188 else
Jeff Johnson295189b2012-06-20 16:38:30 -07002189 {
2190 if (!pMac->lim.gLimNoShortSlotParams.staNoShortSlotCache[i].active)
2191 break;
2192 }
2193 }
2194
2195 if (i >= LIM_PROT_STA_CACHE_SIZE)
2196 {
Jeff Johnson295189b2012-06-20 16:38:30 -07002197 if(psessionEntry->limSystemRole == eLIM_AP_ROLE){
2198 limLog(pMac, LOGE, FL("No space in ShortSlot cache (#active %d, #sta %d) for sta "),
2199 i, psessionEntry->gLimNoShortSlotParams.numNonShortSlotSta);
2200 limPrintMacAddr(pMac, peerMacAddr, LOGE);
2201 return;
2202 }else
Jeff Johnson295189b2012-06-20 16:38:30 -07002203 {
2204 limLog(pMac, LOGE, FL("No space in ShortSlot cache (#active %d, #sta %d) for sta "),
2205 i, pMac->lim.gLimNoShortSlotParams.numNonShortSlotSta);
2206 limPrintMacAddr(pMac, peerMacAddr, LOGE);
2207 return;
2208 }
2209 }
2210
2211
Jeff Johnson295189b2012-06-20 16:38:30 -07002212 if(psessionEntry->limSystemRole == eLIM_AP_ROLE){
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05302213 vos_mem_copy( psessionEntry->gLimNoShortSlotParams.staNoShortSlotCache[i].addr,
Jeff Johnson295189b2012-06-20 16:38:30 -07002214 peerMacAddr, sizeof(tSirMacAddr));
2215 psessionEntry->gLimNoShortSlotParams.staNoShortSlotCache[i].active = true;
2216 psessionEntry->gLimNoShortSlotParams.numNonShortSlotSta++;
2217 }else
Jeff Johnson295189b2012-06-20 16:38:30 -07002218 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05302219 vos_mem_copy( pMac->lim.gLimNoShortSlotParams.staNoShortSlotCache[i].addr,
Jeff Johnson295189b2012-06-20 16:38:30 -07002220 peerMacAddr, sizeof(tSirMacAddr));
2221 pMac->lim.gLimNoShortSlotParams.staNoShortSlotCache[i].active = true;
2222 pMac->lim.gLimNoShortSlotParams.numNonShortSlotSta++;
2223 }
2224 wlan_cfgGetInt(pMac, WNI_CFG_11G_SHORT_SLOT_TIME_ENABLED, &val);
2225
Jeff Johnsone7245742012-09-05 17:12:55 -07002226 /* 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
2227 * only long slot enabled, we need to change our beacon/pb rsp to broadcast short slot disabled
2228 */
Jeff Johnson295189b2012-06-20 16:38:30 -07002229 if ( (psessionEntry->limSystemRole == eLIM_AP_ROLE) &&
Jeff Johnsone7245742012-09-05 17:12:55 -07002230 (val && psessionEntry->gLimNoShortSlotParams.numNonShortSlotSta && psessionEntry->shortSlotTimeSupported))
Jeff Johnson295189b2012-06-20 16:38:30 -07002231 {
2232 // enable long slot time
2233 pBeaconParams->fShortSlotTime = false;
2234 pBeaconParams->paramChangeBitmap |= PARAM_SHORT_SLOT_TIME_CHANGED;
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002235 PELOG1(limLog(pMac, LOG1, FL("Disable short slot time. Enable long slot time."));)
Jeff Johnsone7245742012-09-05 17:12:55 -07002236 psessionEntry->shortSlotTimeSupported = false;
Jeff Johnson295189b2012-06-20 16:38:30 -07002237 }
2238 else if ( psessionEntry->limSystemRole != eLIM_AP_ROLE)
Jeff Johnson295189b2012-06-20 16:38:30 -07002239 {
Jeff Johnsone7245742012-09-05 17:12:55 -07002240 if (val && pMac->lim.gLimNoShortSlotParams.numNonShortSlotSta && psessionEntry->shortSlotTimeSupported)
Jeff Johnson295189b2012-06-20 16:38:30 -07002241 {
2242 // enable long slot time
2243 pBeaconParams->fShortSlotTime = false;
2244 pBeaconParams->paramChangeBitmap |= PARAM_SHORT_SLOT_TIME_CHANGED;
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002245 PELOG1(limLog(pMac, LOG1, FL("Disable short slot time. Enable long slot time."));)
Jeff Johnsone7245742012-09-05 17:12:55 -07002246 psessionEntry->shortSlotTimeSupported = false;
Jeff Johnson295189b2012-06-20 16:38:30 -07002247 }
2248 }
2249 }
2250 }
2251}
2252
Jeff Johnson295189b2012-06-20 16:38:30 -07002253
2254/** -------------------------------------------------------------
2255\fn limDecideStaProtectionOnAssoc
2256\brief Decide protection related settings on Sta while association.
2257\param tpAniSirGlobal pMac
2258\param tpSchBeaconStruct pBeaconStruct
2259\return None
2260 -------------------------------------------------------------*/
2261void
2262limDecideStaProtectionOnAssoc(tpAniSirGlobal pMac,
2263 tpSchBeaconStruct pBeaconStruct, tpPESession psessionEntry)
2264{
2265 tSirRFBand rfBand = SIR_BAND_UNKNOWN;
2266 tANI_U32 phyMode = WNI_CFG_PHY_MODE_NONE;
2267
2268 limGetRfBand(pMac, &rfBand, psessionEntry);
2269 limGetPhyMode(pMac, &phyMode, psessionEntry);
2270
2271 if(SIR_BAND_5_GHZ == rfBand)
2272 {
2273 if((eSIR_HT_OP_MODE_MIXED == pBeaconStruct->HTInfo.opMode) ||
2274 (eSIR_HT_OP_MODE_OVERLAP_LEGACY == pBeaconStruct->HTInfo.opMode))
2275 {
2276 if(pMac->lim.cfgProtection.fromlla)
2277 psessionEntry->beaconParams.llaCoexist = true;
2278 }
2279 else if(eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT == pBeaconStruct->HTInfo.opMode)
2280 {
2281 if(pMac->lim.cfgProtection.ht20)
2282 psessionEntry->beaconParams.ht20Coexist = true;
2283 }
2284
2285 }
2286 else if(SIR_BAND_2_4_GHZ == rfBand)
2287 {
2288 //spec 7.3.2.13
2289 //UseProtection will be set when nonERP STA is associated.
2290 //NonERPPresent bit will be set when:
2291 //--nonERP Sta is associated OR
2292 //--nonERP Sta exists in overlapping BSS
2293 //when useProtection is not set then protection from nonERP stations is optional.
2294
2295 //CFG protection from 11b is enabled and
2296 //11B device in the BSS
2297 /* TODO, This is not sessionized */
2298 if (phyMode != WNI_CFG_PHY_MODE_11B)
2299 {
2300 if (pMac->lim.cfgProtection.fromllb &&
2301 pBeaconStruct->erpPresent &&
2302 (pBeaconStruct->erpIEInfo.useProtection ||
2303 pBeaconStruct->erpIEInfo.nonErpPresent))
2304 {
2305 psessionEntry->beaconParams.llbCoexist = true;
2306 }
2307 //AP has no 11b station associated.
2308 else
2309 {
2310 psessionEntry->beaconParams.llbCoexist = false;
2311 }
2312 }
2313 //following code block is only for HT station.
Jeff Johnsone7245742012-09-05 17:12:55 -07002314 if((psessionEntry->htCapability) &&
Jeff Johnson295189b2012-06-20 16:38:30 -07002315 (pBeaconStruct->HTInfo.present))
2316 {
2317 tDot11fIEHTInfo htInfo = pBeaconStruct->HTInfo;
2318
2319 //Obss Non HT STA present mode
2320 psessionEntry->beaconParams.gHTObssMode = (tANI_U8)htInfo.obssNonHTStaPresent;
2321
2322
2323 //CFG protection from 11G is enabled and
2324 //our AP has at least one 11G station associated.
2325 if(pMac->lim.cfgProtection.fromllg &&
2326 ((eSIR_HT_OP_MODE_MIXED == htInfo.opMode) ||
2327 (eSIR_HT_OP_MODE_OVERLAP_LEGACY == htInfo.opMode))&&
2328 (!psessionEntry->beaconParams.llbCoexist))
2329 {
2330 if(pMac->lim.cfgProtection.fromllg)
2331 psessionEntry->beaconParams.llgCoexist = true;
2332 }
2333
2334 //AP has only HT stations associated and at least one station is HT 20
2335 //disable protection from any non-HT devices.
2336 //decision for disabling protection from 11b has already been taken above.
2337 if(eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT == htInfo.opMode)
2338 {
2339 //Disable protection from 11G station.
2340 psessionEntry->beaconParams.llgCoexist = false;
2341 //CFG protection from HT 20 is enabled.
2342 if(pMac->lim.cfgProtection.ht20)
2343 psessionEntry->beaconParams.ht20Coexist = true;
2344 }
2345 //Disable protection from non-HT and HT20 devices.
2346 //decision for disabling protection from 11b has already been taken above.
2347 if(eSIR_HT_OP_MODE_PURE == htInfo.opMode)
2348 {
2349 psessionEntry->beaconParams.llgCoexist = false;
2350 psessionEntry->beaconParams.ht20Coexist = false;
2351 }
2352
2353 }
2354 }
2355
2356 //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 -07002357 if((psessionEntry->htCapability) &&
Jeff Johnson295189b2012-06-20 16:38:30 -07002358 (pBeaconStruct->HTInfo.present))
2359 {
2360 tDot11fIEHTInfo htInfo = pBeaconStruct->HTInfo;
2361 psessionEntry->beaconParams.fRIFSMode =
2362 ( tANI_U8 ) htInfo.rifsMode;
2363 psessionEntry->beaconParams.llnNonGFCoexist =
2364 ( tANI_U8 )htInfo.nonGFDevicesPresent;
2365 psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport =
2366 ( tANI_U8 )htInfo.lsigTXOPProtectionFullSupport;
2367 }
2368}
2369
2370
2371/** -------------------------------------------------------------
2372\fn limDecideStaProtection
2373\brief Decides protection related settings on Sta while processing beacon.
2374\param tpAniSirGlobal pMac
2375\param tpUpdateBeaconParams pBeaconParams
2376\return None
2377 -------------------------------------------------------------*/
2378void
2379limDecideStaProtection(tpAniSirGlobal pMac,
2380 tpSchBeaconStruct pBeaconStruct, tpUpdateBeaconParams pBeaconParams, tpPESession psessionEntry)
2381{
2382
2383 tSirRFBand rfBand = SIR_BAND_UNKNOWN;
2384 tANI_U32 phyMode = WNI_CFG_PHY_MODE_NONE;
2385
2386 limGetRfBand(pMac, &rfBand, psessionEntry);
2387 limGetPhyMode(pMac, &phyMode, psessionEntry);
2388
2389 if(SIR_BAND_5_GHZ == rfBand)
2390 {
2391 //we are HT capable.
Jeff Johnsone7245742012-09-05 17:12:55 -07002392 if((true == psessionEntry->htCapability) &&
Jeff Johnson295189b2012-06-20 16:38:30 -07002393 (pBeaconStruct->HTInfo.present))
2394 {
2395 //we are HT capable, AP's HT OPMode is mixed / overlap legacy ==> need protection from 11A.
2396 if((eSIR_HT_OP_MODE_MIXED == pBeaconStruct->HTInfo.opMode) ||
2397 (eSIR_HT_OP_MODE_OVERLAP_LEGACY == pBeaconStruct->HTInfo.opMode))
2398 {
2399 limEnable11aProtection(pMac, true, false, pBeaconParams,psessionEntry);
2400 }
2401 //we are HT capable, AP's HT OPMode is HT20 ==> disable protection from 11A if enabled. enabled
2402 //protection from HT20 if needed.
2403 else if(eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT== pBeaconStruct->HTInfo.opMode)
2404 {
2405 limEnable11aProtection(pMac, false, false, pBeaconParams,psessionEntry);
2406 limEnableHT20Protection(pMac, true, false, pBeaconParams,psessionEntry);
2407 }
2408 else if(eSIR_HT_OP_MODE_PURE == pBeaconStruct->HTInfo.opMode)
2409 {
2410 limEnable11aProtection(pMac, false, false, pBeaconParams,psessionEntry);
2411 limEnableHT20Protection(pMac, false, false, pBeaconParams,psessionEntry);
2412 }
2413 }
2414 }
2415 else if(SIR_BAND_2_4_GHZ == rfBand)
2416 {
2417 /* spec 7.3.2.13
2418 * UseProtection will be set when nonERP STA is associated.
2419 * NonERPPresent bit will be set when:
2420 * --nonERP Sta is associated OR
2421 * --nonERP Sta exists in overlapping BSS
2422 * when useProtection is not set then protection from nonERP stations is optional.
2423 */
2424
2425 if (phyMode != WNI_CFG_PHY_MODE_11B)
2426 {
2427 if (pBeaconStruct->erpPresent &&
2428 (pBeaconStruct->erpIEInfo.useProtection ||
2429 pBeaconStruct->erpIEInfo.nonErpPresent))
2430 {
2431 limEnable11gProtection(pMac, true, false, pBeaconParams, psessionEntry);
2432 }
2433 //AP has no 11b station associated.
2434 else
2435 {
2436 //disable protection from 11b station
2437 limEnable11gProtection(pMac, false, false, pBeaconParams, psessionEntry);
2438 }
2439 }
2440
2441 //following code block is only for HT station.
Jeff Johnsone7245742012-09-05 17:12:55 -07002442 if((psessionEntry->htCapability) &&
Jeff Johnson295189b2012-06-20 16:38:30 -07002443 (pBeaconStruct->HTInfo.present))
2444 {
2445
2446 tDot11fIEHTInfo htInfo = pBeaconStruct->HTInfo;
2447 //AP has at least one 11G station associated.
2448 if(((eSIR_HT_OP_MODE_MIXED == htInfo.opMode) ||
2449 (eSIR_HT_OP_MODE_OVERLAP_LEGACY == htInfo.opMode))&&
2450 (!psessionEntry->beaconParams.llbCoexist))
2451 {
2452 limEnableHtProtectionFrom11g(pMac, true, false, pBeaconParams,psessionEntry);
2453
2454 }
2455
2456 //no HT operating mode change ==> no change in protection settings except for MIXED_MODE/Legacy Mode.
2457 //in Mixed mode/legacy Mode even if there is no change in HT operating mode, there might be change in 11bCoexist
2458 //or 11gCoexist. that is why this check is being done after mixed/legacy mode check.
2459 if ( pMac->lim.gHTOperMode != ( tSirMacHTOperatingMode )htInfo.opMode )
2460 {
2461 pMac->lim.gHTOperMode = ( tSirMacHTOperatingMode )htInfo.opMode;
2462
2463 //AP has only HT stations associated and at least one station is HT 20
2464 //disable protection from any non-HT devices.
2465 //decision for disabling protection from 11b has already been taken above.
2466 if(eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT == htInfo.opMode)
2467 {
2468 //Disable protection from 11G station.
2469 limEnableHtProtectionFrom11g(pMac, false, false, pBeaconParams,psessionEntry);
2470
2471 limEnableHT20Protection(pMac, true, false, pBeaconParams,psessionEntry);
2472 }
2473 //Disable protection from non-HT and HT20 devices.
2474 //decision for disabling protection from 11b has already been taken above.
2475 else if(eSIR_HT_OP_MODE_PURE == htInfo.opMode)
2476 {
2477 limEnableHtProtectionFrom11g(pMac, false, false, pBeaconParams,psessionEntry);
2478 limEnableHT20Protection(pMac, false, false, pBeaconParams,psessionEntry);
2479
2480 }
2481 }
2482 }
2483 }
2484
2485 //following code block is only for HT station. ( 2.4 GHZ as well as 5 GHZ)
Jeff Johnsone7245742012-09-05 17:12:55 -07002486 if((psessionEntry->htCapability) &&
Jeff Johnson295189b2012-06-20 16:38:30 -07002487 (pBeaconStruct->HTInfo.present))
2488 {
2489 tDot11fIEHTInfo htInfo = pBeaconStruct->HTInfo;
2490 //Check for changes in protection related factors other than HT operating mode.
2491 //Check for changes in RIFS mode, nonGFDevicesPresent, lsigTXOPProtectionFullSupport.
2492 if ( psessionEntry->beaconParams.fRIFSMode !=
2493 ( tANI_U8 ) htInfo.rifsMode )
2494 {
2495 pBeaconParams->fRIFSMode =
2496 psessionEntry->beaconParams.fRIFSMode =
2497 ( tANI_U8 ) htInfo.rifsMode;
2498 pBeaconParams->paramChangeBitmap |= PARAM_RIFS_MODE_CHANGED;
2499 }
2500
2501 if ( psessionEntry->beaconParams.llnNonGFCoexist !=
2502 htInfo.nonGFDevicesPresent )
2503 {
2504 pBeaconParams->llnNonGFCoexist =
2505 psessionEntry->beaconParams.llnNonGFCoexist =
2506 ( tANI_U8 )htInfo.nonGFDevicesPresent;
2507 pBeaconParams->paramChangeBitmap |=
2508 PARAM_NON_GF_DEVICES_PRESENT_CHANGED;
2509 }
2510
2511 if ( psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport !=
2512 ( tANI_U8 )htInfo.lsigTXOPProtectionFullSupport )
2513 {
2514 pBeaconParams->fLsigTXOPProtectionFullSupport =
2515 psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport =
2516 ( tANI_U8 )htInfo.lsigTXOPProtectionFullSupport;
2517 pBeaconParams->paramChangeBitmap |=
2518 PARAM_LSIG_TXOP_FULL_SUPPORT_CHANGED;
2519 }
2520
2521 // For Station just update the global lim variable, no need to send message to HAL
2522 // Station already taking care of HT OPR Mode=01, meaning AP is seeing legacy
2523 //stations in overlapping BSS.
2524 if ( psessionEntry->beaconParams.gHTObssMode != ( tANI_U8 )htInfo.obssNonHTStaPresent )
2525 psessionEntry->beaconParams.gHTObssMode = ( tANI_U8 )htInfo.obssNonHTStaPresent ;
2526
2527 }
2528}
2529
2530
2531/**
2532 * limProcessChannelSwitchTimeout()
2533 *
2534 *FUNCTION:
2535 * This function is invoked when Channel Switch Timer expires at
2536 * the STA. Now, STA must stop traffic, and then change/disable
2537 * primary or secondary channel.
2538 *
2539 *
2540 *NOTE:
2541 * @param pMac - Pointer to Global MAC structure
2542 * @return None
2543 */
2544void limProcessChannelSwitchTimeout(tpAniSirGlobal pMac)
2545{
2546 tpPESession psessionEntry = NULL;
Jeff Johnsone7245742012-09-05 17:12:55 -07002547 tANI_U8 channel; // This is received and stored from channelSwitch Action frame
Jeff Johnson295189b2012-06-20 16:38:30 -07002548
2549 if((psessionEntry = peFindSessionBySessionId(pMac, pMac->lim.limTimers.gLimChannelSwitchTimer.sessionId))== NULL)
2550 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002551 limLog(pMac, LOGP,FL("Session Does not exist for given sessionID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002552 return;
2553 }
2554
2555 if (psessionEntry->limSystemRole != eLIM_STA_ROLE)
2556 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002557 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 -07002558 return;
2559 }
Jeff Johnsone7245742012-09-05 17:12:55 -07002560 channel = psessionEntry->gLimChannelSwitch.primaryChannel;
Jeff Johnson295189b2012-06-20 16:38:30 -07002561 /*
2562 * This potentially can create issues if the function tries to set
2563 * channel while device is in power-save, hence putting an extra check
2564 * to verify if the device is in power-save or not
2565 */
2566 if(!limIsSystemInActiveState(pMac))
2567 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002568 PELOGW(limLog(pMac, LOGW, FL("Device is not in active state, cannot switch channel"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002569 return;
2570 }
2571
2572 // Restore Channel Switch parameters to default
Jeff Johnsone7245742012-09-05 17:12:55 -07002573 psessionEntry->gLimChannelSwitch.switchTimeoutValue = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07002574
2575 /* Channel-switch timeout has occurred. reset the state */
Jeff Johnsone7245742012-09-05 17:12:55 -07002576 psessionEntry->gLimSpecMgmt.dot11hChanSwState = eLIM_11H_CHANSW_END;
Jeff Johnson295189b2012-06-20 16:38:30 -07002577
2578 /* Check if the AP is switching to a channel that we support.
2579 * Else, just don't bother to switch. Indicate HDD to look for a
2580 * better AP to associate
2581 */
2582 if(!limIsChannelValidForChannelSwitch(pMac, channel))
2583 {
2584 /* We need to restore pre-channelSwitch state on the STA */
2585 if(limRestorePreChannelSwitchState(pMac, psessionEntry) != eSIR_SUCCESS)
2586 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002587 limLog(pMac, LOGP, FL("Could not restore pre-channelSwitch (11h) state, resetting the system"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002588 return;
2589 }
2590
2591 /* If the channel-list that AP is asking us to switch is invalid,
2592 * then we cannot switch the channel. Just disassociate from AP.
2593 * We will find a better AP !!!
2594 */
2595 limTearDownLinkWithAp(pMac,
2596 pMac->lim.limTimers.gLimChannelSwitchTimer.sessionId,
2597 eSIR_MAC_UNSPEC_FAILURE_REASON);
2598 return;
2599 }
Kiran Kumar Lokereb8bb6842013-08-12 16:40:24 -07002600 limCovertChannelScanType(pMac, psessionEntry->currentOperChannel, false);
2601 pMac->lim.dfschannelList.timeStamp[psessionEntry->currentOperChannel] = 0;
Jeff Johnsone7245742012-09-05 17:12:55 -07002602 switch(psessionEntry->gLimChannelSwitch.state)
Jeff Johnson295189b2012-06-20 16:38:30 -07002603 {
2604 case eLIM_CHANNEL_SWITCH_PRIMARY_ONLY:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002605 PELOGW(limLog(pMac, LOGW, FL("CHANNEL_SWITCH_PRIMARY_ONLY "));)
Jeff Johnsone7245742012-09-05 17:12:55 -07002606 limSwitchPrimaryChannel(pMac, psessionEntry->gLimChannelSwitch.primaryChannel,psessionEntry);
2607 psessionEntry->gLimChannelSwitch.state = eLIM_CHANNEL_SWITCH_IDLE;
Jeff Johnson295189b2012-06-20 16:38:30 -07002608 break;
2609
2610 case eLIM_CHANNEL_SWITCH_SECONDARY_ONLY:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002611 PELOGW(limLog(pMac, LOGW, FL("CHANNEL_SWITCH_SECONDARY_ONLY "));)
Jeff Johnsone7245742012-09-05 17:12:55 -07002612 limSwitchPrimarySecondaryChannel(pMac, psessionEntry,
Jeff Johnson295189b2012-06-20 16:38:30 -07002613 psessionEntry->currentOperChannel,
Jeff Johnsone7245742012-09-05 17:12:55 -07002614 psessionEntry->gLimChannelSwitch.secondarySubBand);
2615 psessionEntry->gLimChannelSwitch.state = eLIM_CHANNEL_SWITCH_IDLE;
Jeff Johnson295189b2012-06-20 16:38:30 -07002616 break;
2617
2618 case eLIM_CHANNEL_SWITCH_PRIMARY_AND_SECONDARY:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002619 PELOGW(limLog(pMac, LOGW, FL("CHANNEL_SWITCH_PRIMARY_AND_SECONDARY"));)
Jeff Johnsone7245742012-09-05 17:12:55 -07002620 limSwitchPrimarySecondaryChannel(pMac, psessionEntry,
2621 psessionEntry->gLimChannelSwitch.primaryChannel,
2622 psessionEntry->gLimChannelSwitch.secondarySubBand);
2623 psessionEntry->gLimChannelSwitch.state = eLIM_CHANNEL_SWITCH_IDLE;
Jeff Johnson295189b2012-06-20 16:38:30 -07002624 break;
2625
2626 case eLIM_CHANNEL_SWITCH_IDLE:
2627 default:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002628 PELOGE(limLog(pMac, LOGE, FL("incorrect state "));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002629 if(limRestorePreChannelSwitchState(pMac, psessionEntry) != eSIR_SUCCESS)
2630 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002631 limLog(pMac, LOGP, FL("Could not restore pre-channelSwitch (11h) state, resetting the system"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002632 }
2633 return; /* Please note, this is 'return' and not 'break' */
2634 }
Jeff Johnsone7245742012-09-05 17:12:55 -07002635}
Jeff Johnson295189b2012-06-20 16:38:30 -07002636
2637/**
2638 * limUpdateChannelSwitch()
2639 *
2640 *FUNCTION:
2641 * This function is invoked whenever Station receives
2642 * either 802.11h channel switch IE or airgo proprietary
2643 * channel switch IE.
2644 *
2645 *NOTE:
2646 * @param pMac - Pointer to Global MAC structure
2647 * @return tpSirProbeRespBeacon - Pointer to Beacon/Probe Rsp
2648 * @param psessionentry
2649 */
2650void
2651limUpdateChannelSwitch(struct sAniSirGlobal *pMac, tpSirProbeRespBeacon pBeacon, tpPESession psessionEntry)
2652{
2653
2654 tANI_U16 beaconPeriod;
Jeff Johnson295189b2012-06-20 16:38:30 -07002655 tChannelSwitchPropIEStruct *pPropChnlSwitch;
2656 tDot11fIEChanSwitchAnn *pChnlSwitch;
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -07002657#ifdef WLAN_FEATURE_11AC
2658 tDot11fIEWiderBWChanSwitchAnn *pWiderChnlSwitch;
2659#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002660
Jeff Johnsone7245742012-09-05 17:12:55 -07002661 beaconPeriod = psessionEntry->beaconParams.beaconInterval;
Jeff Johnson295189b2012-06-20 16:38:30 -07002662
2663 /* STA either received proprietary channel switch IE or 802.11h
2664 * standard channel switch IE.
2665 */
2666 if (pBeacon->propIEinfo.propChannelSwitchPresent)
2667 {
2668 pPropChnlSwitch = &(pBeacon->propIEinfo.channelSwitch);
2669
2670 /* Add logic to determine which change this is: */
2671 /* primary, secondary, both. For now assume both. */
Jeff Johnsone7245742012-09-05 17:12:55 -07002672 psessionEntry->gLimChannelSwitch.state = eLIM_CHANNEL_SWITCH_PRIMARY_AND_SECONDARY;
2673 psessionEntry->gLimChannelSwitch.primaryChannel = pPropChnlSwitch->primaryChannel;
2674 psessionEntry->gLimChannelSwitch.secondarySubBand = (ePhyChanBondState)pPropChnlSwitch->subBand;
2675 psessionEntry->gLimChannelSwitch.switchCount = pPropChnlSwitch->channelSwitchCount;
2676 psessionEntry->gLimChannelSwitch.switchTimeoutValue =
Jeff Johnson295189b2012-06-20 16:38:30 -07002677 SYS_MS_TO_TICKS(beaconPeriod)* (pPropChnlSwitch->channelSwitchCount);
Jeff Johnsone7245742012-09-05 17:12:55 -07002678 psessionEntry->gLimChannelSwitch.switchMode = pPropChnlSwitch->mode;
Jeff Johnson295189b2012-06-20 16:38:30 -07002679 }
2680 else
2681 {
2682 pChnlSwitch = &(pBeacon->channelSwitchIE);
Jeff Johnsone7245742012-09-05 17:12:55 -07002683 psessionEntry->gLimChannelSwitch.primaryChannel = pChnlSwitch->newChannel;
2684 psessionEntry->gLimChannelSwitch.switchCount = pChnlSwitch->switchCount;
2685 psessionEntry->gLimChannelSwitch.switchTimeoutValue =
Jeff Johnson295189b2012-06-20 16:38:30 -07002686 SYS_MS_TO_TICKS(beaconPeriod)* (pChnlSwitch->switchCount);
Jeff Johnsone7245742012-09-05 17:12:55 -07002687 psessionEntry->gLimChannelSwitch.switchMode = pChnlSwitch->switchMode;
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -07002688#ifdef WLAN_FEATURE_11AC
2689 pWiderChnlSwitch = &(pBeacon->WiderBWChanSwitchAnn);
2690 if(pBeacon->WiderBWChanSwitchAnnPresent)
2691 {
2692 psessionEntry->gLimWiderBWChannelSwitch.newChanWidth = pWiderChnlSwitch->newChanWidth;
2693 psessionEntry->gLimWiderBWChannelSwitch.newCenterChanFreq0 = pWiderChnlSwitch->newCenterChanFreq0;
2694 psessionEntry->gLimWiderBWChannelSwitch.newCenterChanFreq1 = pWiderChnlSwitch->newCenterChanFreq1;
2695 }
2696#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002697
2698 /* Only primary channel switch element is present */
Jeff Johnsone7245742012-09-05 17:12:55 -07002699 psessionEntry->gLimChannelSwitch.state = eLIM_CHANNEL_SWITCH_PRIMARY_ONLY;
2700 psessionEntry->gLimChannelSwitch.secondarySubBand = PHY_SINGLE_CHANNEL_CENTERED;
Jeff Johnson295189b2012-06-20 16:38:30 -07002701
2702 /* Do not bother to look and operate on extended channel switch element
2703 * if our own channel-bonding state is not enabled
2704 */
Jeff Johnsone7245742012-09-05 17:12:55 -07002705 if (psessionEntry->htSupportedChannelWidthSet)
Jeff Johnson295189b2012-06-20 16:38:30 -07002706 {
2707 if (pBeacon->extChannelSwitchPresent)
2708 {
Jeff Johnsone7245742012-09-05 17:12:55 -07002709 if ((pBeacon->extChannelSwitchIE.secondaryChannelOffset == PHY_DOUBLE_CHANNEL_LOW_PRIMARY) ||
2710 (pBeacon->extChannelSwitchIE.secondaryChannelOffset == PHY_DOUBLE_CHANNEL_HIGH_PRIMARY))
Jeff Johnson295189b2012-06-20 16:38:30 -07002711 {
Jeff Johnsone7245742012-09-05 17:12:55 -07002712 psessionEntry->gLimChannelSwitch.state = eLIM_CHANNEL_SWITCH_PRIMARY_AND_SECONDARY;
2713 psessionEntry->gLimChannelSwitch.secondarySubBand = pBeacon->extChannelSwitchIE.secondaryChannelOffset;
Jeff Johnson295189b2012-06-20 16:38:30 -07002714 }
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -07002715#ifdef WLAN_FEATURE_11AC
2716 if(psessionEntry->vhtCapability && pBeacon->WiderBWChanSwitchAnnPresent)
2717 {
2718 if (pWiderChnlSwitch->newChanWidth == WNI_CFG_VHT_CHANNEL_WIDTH_80MHZ)
2719 {
2720 if(pBeacon->extChannelSwitchPresent)
2721 {
2722 if ((pBeacon->extChannelSwitchIE.secondaryChannelOffset == PHY_DOUBLE_CHANNEL_LOW_PRIMARY) ||
2723 (pBeacon->extChannelSwitchIE.secondaryChannelOffset == PHY_DOUBLE_CHANNEL_HIGH_PRIMARY))
2724 {
2725 psessionEntry->gLimChannelSwitch.state = eLIM_CHANNEL_SWITCH_PRIMARY_AND_SECONDARY;
2726 psessionEntry->gLimChannelSwitch.secondarySubBand = limGet11ACPhyCBState(pMac,
2727 psessionEntry->gLimChannelSwitch.primaryChannel,
2728 pBeacon->extChannelSwitchIE.secondaryChannelOffset,
2729 pWiderChnlSwitch->newCenterChanFreq0,
2730 psessionEntry);
2731 }
2732 }
2733 }
2734 }
2735#endif
Jeff Johnsone7245742012-09-05 17:12:55 -07002736 }
2737 }
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -07002738 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002739 if (eSIR_SUCCESS != limStartChannelSwitch(pMac, psessionEntry))
2740 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002741 PELOGW(limLog(pMac, LOGW, FL("Could not start Channel Switch"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002742 }
2743
2744 limLog(pMac, LOGW,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002745 FL("session %d primary chl %d, subband %d, count %d (%d ticks) "),
Jeff Johnsone7245742012-09-05 17:12:55 -07002746 psessionEntry->peSessionId,
2747 psessionEntry->gLimChannelSwitch.primaryChannel,
2748 psessionEntry->gLimChannelSwitch.secondarySubBand,
2749 psessionEntry->gLimChannelSwitch.switchCount,
2750 psessionEntry->gLimChannelSwitch.switchTimeoutValue);
Jeff Johnson295189b2012-06-20 16:38:30 -07002751 return;
2752}
2753
2754/**
2755 * limCancelDot11hChannelSwitch
2756 *
2757 *FUNCTION:
2758 * This function is called when STA does not send updated channel-swith IE
2759 * after indicating channel-switch start. This will cancel the channel-swith
2760 * timer which is already running.
2761 *
2762 *LOGIC:
2763 *
2764 *ASSUMPTIONS:
2765 *
2766 *NOTE:
2767 *
2768 * @param pMac - Pointer to Global MAC structure
2769 *
2770 * @return None
2771 */
2772void limCancelDot11hChannelSwitch(tpAniSirGlobal pMac, tpPESession psessionEntry)
2773{
Jeff Johnson295189b2012-06-20 16:38:30 -07002774 if (psessionEntry->limSystemRole != eLIM_STA_ROLE)
2775 return;
2776
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002777 PELOGW(limLog(pMac, LOGW, FL("Received a beacon without channel switch IE"));)
Jeff Johnsone7245742012-09-05 17:12:55 -07002778 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_DEACTIVATE, psessionEntry->peSessionId, eLIM_CHANNEL_SWITCH_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -07002779
2780 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimChannelSwitchTimer) != eSIR_SUCCESS)
2781 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002782 PELOGE(limLog(pMac, LOGE, FL("tx_timer_deactivate failed!"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002783 }
2784
2785 /* We need to restore pre-channelSwitch state on the STA */
2786 if (limRestorePreChannelSwitchState(pMac, psessionEntry) != eSIR_SUCCESS)
2787 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002788 PELOGE(limLog(pMac, LOGE, FL("LIM: Could not restore pre-channelSwitch (11h) state, resetting the system"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002789
2790 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002791}
2792
2793/**----------------------------------------------
2794\fn limCancelDot11hQuiet
2795\brief Cancel the quieting on Station if latest
2796 beacon doesn't contain quiet IE in it.
2797
2798\param pMac
2799\return NONE
2800-----------------------------------------------*/
2801void limCancelDot11hQuiet(tpAniSirGlobal pMac, tpPESession psessionEntry)
2802{
Jeff Johnson295189b2012-06-20 16:38:30 -07002803 if (psessionEntry->limSystemRole != eLIM_STA_ROLE)
2804 return;
2805
Jeff Johnsone7245742012-09-05 17:12:55 -07002806 if (psessionEntry->gLimSpecMgmt.quietState == eLIM_QUIET_BEGIN)
Jeff Johnson295189b2012-06-20 16:38:30 -07002807 {
Jeff Johnsone7245742012-09-05 17:12:55 -07002808 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_DEACTIVATE, psessionEntry->peSessionId, eLIM_QUIET_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -07002809 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimQuietTimer) != TX_SUCCESS)
2810 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002811 PELOGE(limLog(pMac, LOGE, FL("tx_timer_deactivate failed"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002812 }
2813 }
Jeff Johnsone7245742012-09-05 17:12:55 -07002814 else if (psessionEntry->gLimSpecMgmt.quietState == eLIM_QUIET_RUNNING)
Jeff Johnson295189b2012-06-20 16:38:30 -07002815 {
Jeff Johnsone7245742012-09-05 17:12:55 -07002816 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_DEACTIVATE, psessionEntry->peSessionId, eLIM_QUIET_BSS_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -07002817 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimQuietBssTimer) != TX_SUCCESS)
2818 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002819 PELOGE(limLog(pMac, LOGE, FL("tx_timer_deactivate failed"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002820 }
2821 /**
2822 * If the channel switch is already running in silent mode, dont resume the
2823 * transmission. Channel switch timer when timeout, transmission will be resumed.
2824 */
Jeff Johnsone7245742012-09-05 17:12:55 -07002825 if(!((psessionEntry->gLimSpecMgmt.dot11hChanSwState == eLIM_11H_CHANSW_RUNNING) &&
2826 (psessionEntry->gLimChannelSwitch.switchMode == eSIR_CHANSW_MODE_SILENT)))
Jeff Johnson295189b2012-06-20 16:38:30 -07002827 {
2828 limFrameTransmissionControl(pMac, eLIM_TX_ALL, eLIM_RESUME_TX);
Jeff Johnsone7245742012-09-05 17:12:55 -07002829 limRestorePreQuietState(pMac, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07002830 }
2831 }
Jeff Johnsone7245742012-09-05 17:12:55 -07002832 psessionEntry->gLimSpecMgmt.quietState = eLIM_QUIET_INIT;
Jeff Johnson295189b2012-06-20 16:38:30 -07002833}
2834
2835/**
2836 * limProcessQuietTimeout
2837 *
2838 * FUNCTION:
2839 * This function is active only on the STA.
2840 * Handles SIR_LIM_QUIET_TIMEOUT
2841 *
2842 * LOGIC:
2843 * This timeout can occur under only one circumstance:
2844 *
2845 * 1) When gLimQuietState = eLIM_QUIET_BEGIN
2846 * This indicates that the timeout "interval" has
2847 * expired. This is a trigger for the STA to now
2848 * shut-off Tx/Rx for the specified gLimQuietDuration
2849 * -> The TIMER object gLimQuietBssTimer is
2850 * activated
2851 * -> With timeout = gLimQuietDuration
2852 * -> gLimQuietState is set to eLIM_QUIET_RUNNING
2853 *
2854 * ASSUMPTIONS:
2855 * Using two TIMER objects -
2856 * gLimQuietTimer & gLimQuietBssTimer
2857 *
2858 * NOTE:
2859 *
2860 * @param pMac - Pointer to Global MAC structure
2861 *
2862 * @return None
2863 */
2864void limProcessQuietTimeout(tpAniSirGlobal pMac)
2865{
Jeff Johnson295189b2012-06-20 16:38:30 -07002866 //fetch the sessionEntry based on the sessionId
2867 //priority - MEDIUM
Jeff Johnsone7245742012-09-05 17:12:55 -07002868 tpPESession psessionEntry;
Jeff Johnson295189b2012-06-20 16:38:30 -07002869
Jeff Johnsone7245742012-09-05 17:12:55 -07002870 if((psessionEntry = peFindSessionBySessionId(pMac, pMac->lim.limTimers.gLimQuietTimer.sessionId))== NULL)
Jeff Johnson295189b2012-06-20 16:38:30 -07002871 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002872 limLog(pMac, LOGE,FL("Session Does not exist for given sessionID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002873 return;
2874 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002875
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002876 PELOG1(limLog(pMac, LOG1, FL("quietState = %d"), psessionEntry->gLimSpecMgmt.quietState);)
Jeff Johnsone7245742012-09-05 17:12:55 -07002877 switch( psessionEntry->gLimSpecMgmt.quietState )
Jeff Johnson295189b2012-06-20 16:38:30 -07002878 {
2879 case eLIM_QUIET_BEGIN:
2880 // Time to Stop data traffic for quietDuration
Jeff Johnsone7245742012-09-05 17:12:55 -07002881 //limDeactivateAndChangeTimer(pMac, eLIM_QUIET_BSS_TIMER);
2882 if (TX_SUCCESS !=
2883 tx_timer_deactivate(&pMac->lim.limTimers.gLimQuietBssTimer))
2884 {
2885 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002886 FL("Unable to de-activate gLimQuietBssTimer! Will attempt to activate anyway..."));
Jeff Johnsone7245742012-09-05 17:12:55 -07002887 }
2888
2889 // gLimQuietDuration appears to be in units of ticks
2890 // Use it as is
2891 if (TX_SUCCESS !=
2892 tx_timer_change( &pMac->lim.limTimers.gLimQuietBssTimer,
2893 psessionEntry->gLimSpecMgmt.quietDuration,
2894 0))
2895 {
2896 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002897 FL("Unable to change gLimQuietBssTimer! Will still attempt to activate anyway..."));
Jeff Johnsone7245742012-09-05 17:12:55 -07002898 }
Leela V Kiran Kumar Reddy Chiralac3b9d382013-01-31 20:49:53 -08002899 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, pMac->lim.limTimers.gLimQuietTimer.sessionId, eLIM_QUIET_BSS_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -07002900#ifdef GEN6_TODO
2901 /* revisit this piece of code to assign the appropriate sessionId below
2902 * priority - HIGH
2903 */
2904 pMac->lim.limTimers.gLimQuietBssTimer.sessionId = sessionId;
2905#endif
2906 if( TX_SUCCESS !=
2907 tx_timer_activate( &pMac->lim.limTimers.gLimQuietBssTimer ))
2908 {
2909 limLog( pMac, LOGW,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002910 FL("Unable to activate gLimQuietBssTimer! The STA will be unable to honor Quiet BSS..."));
Jeff Johnson295189b2012-06-20 16:38:30 -07002911 }
2912 else
2913 {
2914 // Transition to eLIM_QUIET_RUNNING
Jeff Johnsone7245742012-09-05 17:12:55 -07002915 psessionEntry->gLimSpecMgmt.quietState = eLIM_QUIET_RUNNING;
Jeff Johnson295189b2012-06-20 16:38:30 -07002916
2917 /* If we have sta bk scan triggered and trigger bk scan actually started successfully, */
2918 /* print message, otherwise, stop data traffic and stay quiet */
2919 if( pMac->lim.gLimTriggerBackgroundScanDuringQuietBss &&
2920 (eSIR_TRUE == (glimTriggerBackgroundScanDuringQuietBss_Status = limTriggerBackgroundScanDuringQuietBss( pMac ))) )
2921 {
2922 limLog( pMac, LOG2,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002923 FL("Attempting to trigger a background scan..."));
Jeff Johnson295189b2012-06-20 16:38:30 -07002924 }
2925 else
2926 {
2927 // Shut-off Tx/Rx for gLimSpecMgmt.quietDuration
2928 /* freeze the transmission */
2929 limFrameTransmissionControl(pMac, eLIM_TX_ALL, eLIM_STOP_TX);
2930
2931 limLog( pMac, LOG2,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002932 FL("Quiet BSS: STA shutting down for %d ticks"),
Jeff Johnsone7245742012-09-05 17:12:55 -07002933 psessionEntry->gLimSpecMgmt.quietDuration );
Jeff Johnson295189b2012-06-20 16:38:30 -07002934 }
2935 }
2936 break;
2937
2938 case eLIM_QUIET_RUNNING:
2939 case eLIM_QUIET_INIT:
2940 case eLIM_QUIET_END:
2941 default:
2942 //
2943 // As of now, nothing to be done
2944 //
2945 break;
2946 }
2947}
2948
2949/**
2950 * limProcessQuietBssTimeout
2951 *
2952 * FUNCTION:
2953 * This function is active on the AP and STA.
2954 * Handles SIR_LIM_QUIET_BSS_TIMEOUT
2955 *
2956 * LOGIC:
2957 * On the AP -
2958 * When the SIR_LIM_QUIET_BSS_TIMEOUT is triggered, it is
2959 * an indication for the AP to START sending out the
2960 * Quiet BSS IE.
2961 * If 802.11H is enabled, the Quiet BSS IE is sent as per
2962 * the 11H spec
2963 * If 802.11H is not enabled, the Quiet BSS IE is sent as
2964 * a Proprietary IE. This will be understood by all the
2965 * TITAN STA's
2966 * Transitioning gLimQuietState to eLIM_QUIET_BEGIN will
2967 * initiate the SCH to include the Quiet BSS IE in all
2968 * its subsequent Beacons/PR's.
2969 * The Quiet BSS IE will be included in all the Beacons
2970 * & PR's until the next DTIM period
2971 *
2972 * On the STA -
2973 * When gLimQuietState = eLIM_QUIET_RUNNING
2974 * This indicates that the STA was successfully shut-off
2975 * for the specified gLimQuietDuration. This is a trigger
2976 * for the STA to now resume data traffic.
2977 * -> gLimQuietState is set to eLIM_QUIET_INIT
2978 *
2979 * ASSUMPTIONS:
2980 *
2981 * NOTE:
2982 *
2983 * @param pMac - Pointer to Global MAC structure
2984 *
2985 * @return None
2986 */
2987void limProcessQuietBssTimeout( tpAniSirGlobal pMac )
2988{
Jeff Johnsone7245742012-09-05 17:12:55 -07002989 tpPESession psessionEntry;
Jeff Johnson295189b2012-06-20 16:38:30 -07002990
Jeff Johnsone7245742012-09-05 17:12:55 -07002991 if((psessionEntry = peFindSessionBySessionId(pMac, pMac->lim.limTimers.gLimQuietBssTimer.sessionId))== NULL)
Jeff Johnson295189b2012-06-20 16:38:30 -07002992 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002993 limLog(pMac, LOGP,FL("Session Does not exist for given sessionID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002994 return;
2995 }
2996
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002997 PELOG1(limLog(pMac, LOG1, FL("quietState = %d"), psessionEntry->gLimSpecMgmt.quietState);)
Jeff Johnsone7245742012-09-05 17:12:55 -07002998 if (eLIM_AP_ROLE == psessionEntry->limSystemRole)
Jeff Johnson295189b2012-06-20 16:38:30 -07002999 {
Jeff Johnson295189b2012-06-20 16:38:30 -07003000 }
3001 else
3002 {
3003 // eLIM_STA_ROLE
Jeff Johnsone7245742012-09-05 17:12:55 -07003004 switch( psessionEntry->gLimSpecMgmt.quietState )
Jeff Johnson295189b2012-06-20 16:38:30 -07003005 {
3006 case eLIM_QUIET_RUNNING:
3007 // Transition to eLIM_QUIET_INIT
Jeff Johnsone7245742012-09-05 17:12:55 -07003008 psessionEntry->gLimSpecMgmt.quietState = eLIM_QUIET_INIT;
Jeff Johnson295189b2012-06-20 16:38:30 -07003009
3010 if( !pMac->lim.gLimTriggerBackgroundScanDuringQuietBss || (glimTriggerBackgroundScanDuringQuietBss_Status == eSIR_FALSE) )
3011 {
3012 // Resume data traffic only if channel switch is not running in silent mode.
Jeff Johnsone7245742012-09-05 17:12:55 -07003013 if (!((psessionEntry->gLimSpecMgmt.dot11hChanSwState == eLIM_11H_CHANSW_RUNNING) &&
3014 (psessionEntry->gLimChannelSwitch.switchMode == eSIR_CHANSW_MODE_SILENT)))
Jeff Johnson295189b2012-06-20 16:38:30 -07003015 {
3016 limFrameTransmissionControl(pMac, eLIM_TX_ALL, eLIM_RESUME_TX);
Jeff Johnsone7245742012-09-05 17:12:55 -07003017 limRestorePreQuietState(pMac, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07003018 }
3019
3020 /* Reset status flag */
3021 if(glimTriggerBackgroundScanDuringQuietBss_Status == eSIR_FALSE)
3022 glimTriggerBackgroundScanDuringQuietBss_Status = eSIR_TRUE;
3023
3024 limLog( pMac, LOG2,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003025 FL("Quiet BSS: Resuming traffic..."));
Jeff Johnson295189b2012-06-20 16:38:30 -07003026 }
3027 else
3028 {
3029 //
3030 // Nothing specific to be done in this case
3031 // A background scan that was triggered during
3032 // SIR_LIM_QUIET_TIMEOUT will complete on its own
3033 //
3034 limLog( pMac, LOG2,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003035 FL("Background scan should be complete now..."));
Jeff Johnson295189b2012-06-20 16:38:30 -07003036 }
3037 break;
3038
3039 case eLIM_QUIET_INIT:
3040 case eLIM_QUIET_BEGIN:
3041 case eLIM_QUIET_END:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003042 PELOG2(limLog(pMac, LOG2, FL("Quiet state not in RUNNING"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003043 /* If the quiet period has ended, then resume the frame transmission */
3044 limFrameTransmissionControl(pMac, eLIM_TX_ALL, eLIM_RESUME_TX);
Jeff Johnsone7245742012-09-05 17:12:55 -07003045 limRestorePreQuietState(pMac, psessionEntry);
3046 psessionEntry->gLimSpecMgmt.quietState = eLIM_QUIET_INIT;
Jeff Johnson295189b2012-06-20 16:38:30 -07003047 break;
3048
3049 default:
3050 //
3051 // As of now, nothing to be done
3052 //
3053 break;
3054 }
3055 }
3056}
Jeff Johnson295189b2012-06-20 16:38:30 -07003057/**
3058 * limProcessWPSOverlapTimeout
3059 *
3060 * FUNCTION: This function call limWPSPBCTimeout() to clean WPS PBC probe request entries
3061 *
3062 * LOGIC:
3063 *
3064 * ASSUMPTIONS:
3065 *
3066 * NOTE:
3067 *
3068 * @param pMac - Pointer to Global MAC structure
3069 *
3070 * @return None
3071 */
3072#if 0
3073void limProcessWPSOverlapTimeout(tpAniSirGlobal pMac)
3074{
3075
3076 tpPESession psessionEntry;
3077 tANI_U32 sessionId;
3078
3079 if (tx_timer_activate(&pMac->lim.limTimers.gLimWPSOverlapTimerObj.gLimWPSOverlapTimer) != TX_SUCCESS)
3080 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003081 limLog(pMac, LOGP, FL("tx_timer_activate failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003082 }
3083
3084 sessionId = pMac->lim.limTimers.gLimWPSOverlapTimerObj.sessionId;
3085
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003086 PELOGE(limLog(pMac, LOGE, FL("WPS overlap timeout, sessionId=%d"), sessionId);)
Jeff Johnson295189b2012-06-20 16:38:30 -07003087
3088 if((psessionEntry = peFindSessionBySessionId(pMac, sessionId)) == NULL)
3089 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003090 PELOGE(limLog(pMac, LOGP,FL("Session Does not exist for given sessionID"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003091 return;
3092 }
3093
3094 limWPSPBCTimeout(pMac, psessionEntry);
3095}
3096#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07003097
Jeff Johnson295189b2012-06-20 16:38:30 -07003098/**----------------------------------------------
3099\fn limStartQuietTimer
3100\brief Starts the quiet timer.
3101
3102\param pMac
3103\return NONE
3104-----------------------------------------------*/
3105void limStartQuietTimer(tpAniSirGlobal pMac, tANI_U8 sessionId)
3106{
3107 tpPESession psessionEntry;
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05303108 psessionEntry = peFindSessionBySessionId(pMac, sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07003109
3110 if(psessionEntry == NULL) {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003111 limLog(pMac, LOGP,FL("Session Does not exist for given sessionID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003112 return;
3113 }
3114
Jeff Johnson295189b2012-06-20 16:38:30 -07003115
3116 if (psessionEntry->limSystemRole != eLIM_STA_ROLE)
3117 return;
3118 // First, de-activate Timer, if its already active
3119 limCancelDot11hQuiet(pMac, psessionEntry);
3120
Jeff Johnsone7245742012-09-05 17:12:55 -07003121 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, sessionId, eLIM_QUIET_TIMER));
3122 if( TX_SUCCESS != tx_timer_deactivate(&pMac->lim.limTimers.gLimQuietTimer))
3123 {
3124 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003125 FL( "Unable to deactivate gLimQuietTimer! Will still attempt to re-activate anyway..." ));
Jeff Johnsone7245742012-09-05 17:12:55 -07003126 }
3127
3128 // Set the NEW timeout value, in ticks
3129 if( TX_SUCCESS != tx_timer_change( &pMac->lim.limTimers.gLimQuietTimer,
3130 SYS_MS_TO_TICKS(psessionEntry->gLimSpecMgmt.quietTimeoutValue), 0))
3131 {
3132 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003133 FL( "Unable to change gLimQuietTimer! Will still attempt to re-activate anyway..." ));
Jeff Johnsone7245742012-09-05 17:12:55 -07003134 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003135
3136 pMac->lim.limTimers.gLimQuietTimer.sessionId = sessionId;
3137 if( TX_SUCCESS != tx_timer_activate(&pMac->lim.limTimers.gLimQuietTimer))
3138 {
3139 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003140 FL("Unable to activate gLimQuietTimer! STA cannot honor Quiet BSS!"));
Jeff Johnsone7245742012-09-05 17:12:55 -07003141 limRestorePreQuietState(pMac, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07003142
Jeff Johnsone7245742012-09-05 17:12:55 -07003143 psessionEntry->gLimSpecMgmt.quietState = eLIM_QUIET_INIT;
Jeff Johnson295189b2012-06-20 16:38:30 -07003144 return;
3145 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003146}
3147
Jeff Johnson295189b2012-06-20 16:38:30 -07003148
3149/** ------------------------------------------------------------------------ **/
3150/**
3151 * keep track of the number of ANI peers associated in the BSS
3152 * For the first and last ANI peer, we have to update EDCA params as needed
3153 *
3154 * When the first ANI peer joins the BSS, we notify SCH
3155 * When the last ANI peer leaves the BSS, we notfiy SCH
3156 */
3157void
3158limUtilCountStaAdd(
3159 tpAniSirGlobal pMac,
3160 tpDphHashNode pSta,
3161 tpPESession psessionEntry)
3162{
3163
3164 if ((! pSta) || (! pSta->valid) || (! pSta->aniPeer) || (pSta->fAniCount))
3165 return;
3166
3167 pSta->fAniCount = 1;
3168
3169 if (pMac->lim.gLimNumOfAniSTAs++ != 0)
3170 return;
3171
3172 // get here only if this is the first ANI peer in the BSS
3173 schEdcaProfileUpdate(pMac, psessionEntry);
3174}
3175
3176void
3177limUtilCountStaDel(
3178 tpAniSirGlobal pMac,
3179 tpDphHashNode pSta,
3180 tpPESession psessionEntry)
3181{
3182
3183 if ((pSta == NULL) || (pSta->aniPeer == eHAL_CLEAR) || (! pSta->fAniCount))
3184 return;
3185
3186 /* Only if sta is invalid and the validInDummyState bit is set to 1,
3187 * then go ahead and update the count and profiles. This ensures
3188 * that the "number of ani station" count is properly incremented/decremented.
3189 */
3190 if (pSta->valid == 1)
3191 return;
3192
3193 pSta->fAniCount = 0;
3194
3195 if (pMac->lim.gLimNumOfAniSTAs <= 0)
3196 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003197 limLog(pMac, LOGE, FL("CountStaDel: ignoring Delete Req when AniPeer count is %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07003198 pMac->lim.gLimNumOfAniSTAs);
3199 return;
3200 }
3201
3202 pMac->lim.gLimNumOfAniSTAs--;
3203
3204 if (pMac->lim.gLimNumOfAniSTAs != 0)
3205 return;
3206
3207 // get here only if this is the last ANI peer in the BSS
3208 schEdcaProfileUpdate(pMac, psessionEntry);
3209}
3210
Jeff Johnson295189b2012-06-20 16:38:30 -07003211/**
3212 * limSwitchChannelCback()
3213 *
3214 *FUNCTION:
3215 * This is the callback function registered while requesting to switch channel
3216 * after AP indicates a channel switch for spectrum management (11h).
3217 *
3218 *NOTE:
3219 * @param pMac Pointer to Global MAC structure
3220 * @param status Status of channel switch request
3221 * @param data User data
3222 * @param psessionEntry Session information
3223 * @return NONE
3224 */
3225void limSwitchChannelCback(tpAniSirGlobal pMac, eHalStatus status,
3226 tANI_U32 *data, tpPESession psessionEntry)
3227{
3228 tSirMsgQ mmhMsg = {0};
3229 tSirSmeSwitchChannelInd *pSirSmeSwitchChInd;
3230
Jeff Johnson295189b2012-06-20 16:38:30 -07003231 psessionEntry->currentOperChannel = psessionEntry->currentReqChannel;
3232
3233 /* We need to restore pre-channelSwitch state on the STA */
3234 if (limRestorePreChannelSwitchState(pMac, psessionEntry) != eSIR_SUCCESS)
3235 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003236 limLog(pMac, LOGP, FL("Could not restore pre-channelSwitch (11h) state, resetting the system"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003237 return;
3238 }
3239
3240 mmhMsg.type = eWNI_SME_SWITCH_CHL_REQ;
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05303241 pSirSmeSwitchChInd = vos_mem_malloc(sizeof(tSirSmeSwitchChannelInd));
3242 if ( NULL == pSirSmeSwitchChInd )
Jeff Johnson295189b2012-06-20 16:38:30 -07003243 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003244 limLog(pMac, LOGP, FL("Failed to allocate buffer for buffer descriptor"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003245 return;
3246 }
3247
3248 pSirSmeSwitchChInd->messageType = eWNI_SME_SWITCH_CHL_REQ;
3249 pSirSmeSwitchChInd->length = sizeof(tSirSmeSwitchChannelInd);
Jeff Johnsone7245742012-09-05 17:12:55 -07003250 pSirSmeSwitchChInd->newChannelId = psessionEntry->gLimChannelSwitch.primaryChannel;
Jeff Johnson295189b2012-06-20 16:38:30 -07003251 pSirSmeSwitchChInd->sessionId = psessionEntry->smeSessionId;
3252 //BSS ID
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05303253 vos_mem_copy( pSirSmeSwitchChInd->bssId, psessionEntry->bssId, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07003254 mmhMsg.bodyptr = pSirSmeSwitchChInd;
3255 mmhMsg.bodyval = 0;
3256
Jeff Johnsone7245742012-09-05 17:12:55 -07003257 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07003258
Jeff Johnson295189b2012-06-20 16:38:30 -07003259 SysProcessMmhMsg(pMac, &mmhMsg);
Jeff Johnson295189b2012-06-20 16:38:30 -07003260}
3261
3262/**
3263 * limSwitchPrimaryChannel()
3264 *
3265 *FUNCTION:
3266 * This function changes the current operating channel
3267 * and sets the new new channel ID in WNI_CFG_CURRENT_CHANNEL.
3268 *
3269 *NOTE:
3270 * @param pMac Pointer to Global MAC structure
3271 * @param newChannel new chnannel ID
3272 * @return NONE
3273 */
3274void limSwitchPrimaryChannel(tpAniSirGlobal pMac, tANI_U8 newChannel,tpPESession psessionEntry)
3275{
3276#if !defined WLAN_FEATURE_VOWIFI
3277 tANI_U32 localPwrConstraint;
3278#endif
3279
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003280 PELOG3(limLog(pMac, LOG3, FL("limSwitchPrimaryChannel: old chnl %d --> new chnl %d "),
Jeff Johnson295189b2012-06-20 16:38:30 -07003281 psessionEntry->currentOperChannel, newChannel);)
3282 psessionEntry->currentReqChannel = newChannel;
3283 psessionEntry->limRFBand = limGetRFBand(newChannel);
3284
3285 psessionEntry->channelChangeReasonCode=LIM_SWITCH_CHANNEL_OPERATION;
3286
3287 pMac->lim.gpchangeChannelCallback = limSwitchChannelCback;
3288 pMac->lim.gpchangeChannelData = NULL;
3289
3290#if defined WLAN_FEATURE_VOWIFI
Jeff Johnsone7245742012-09-05 17:12:55 -07003291 limSendSwitchChnlParams(pMac, newChannel, PHY_SINGLE_CHANNEL_CENTERED,
Jeff Johnson295189b2012-06-20 16:38:30 -07003292 psessionEntry->maxTxPower, psessionEntry->peSessionId);
3293#else
3294 if(wlan_cfgGetInt(pMac, WNI_CFG_LOCAL_POWER_CONSTRAINT, &localPwrConstraint) != eSIR_SUCCESS)
3295 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003296 limLog( pMac, LOGP, FL( "Unable to read Local Power Constraint from cfg" ));
Jeff Johnson295189b2012-06-20 16:38:30 -07003297 return;
3298 }
Jeff Johnsone7245742012-09-05 17:12:55 -07003299 limSendSwitchChnlParams(pMac, newChannel, PHY_SINGLE_CHANNEL_CENTERED,
Jeff Johnson295189b2012-06-20 16:38:30 -07003300 (tPowerdBm)localPwrConstraint, psessionEntry->peSessionId);
3301#endif
3302 return;
3303}
3304
3305/**
3306 * limSwitchPrimarySecondaryChannel()
3307 *
3308 *FUNCTION:
3309 * This function changes the primary and secondary channel.
3310 * If 11h is enabled and user provides a "new channel ID"
3311 * that is different from the current operating channel,
3312 * then we must set this new channel in WNI_CFG_CURRENT_CHANNEL,
3313 * assign notify LIM of such change.
3314 *
3315 *NOTE:
3316 * @param pMac Pointer to Global MAC structure
3317 * @param newChannel New chnannel ID (or current channel ID)
3318 * @param subband CB secondary info:
3319 * - eANI_CB_SECONDARY_NONE
3320 * - eANI_CB_SECONDARY_UP
3321 * - eANI_CB_SECONDARY_DOWN
3322 * @return NONE
3323 */
Jeff Johnsone7245742012-09-05 17:12:55 -07003324void limSwitchPrimarySecondaryChannel(tpAniSirGlobal pMac, tpPESession psessionEntry, tANI_U8 newChannel, ePhyChanBondState subband)
Jeff Johnson295189b2012-06-20 16:38:30 -07003325{
3326#if !defined WLAN_FEATURE_VOWIFI
3327 tANI_U32 localPwrConstraint;
3328#endif
3329
Jeff Johnson295189b2012-06-20 16:38:30 -07003330#if !defined WLAN_FEATURE_VOWIFI
3331 if(wlan_cfgGetInt(pMac, WNI_CFG_LOCAL_POWER_CONSTRAINT, &localPwrConstraint) != eSIR_SUCCESS) {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003332 limLog( pMac, LOGP, FL( "Unable to get Local Power Constraint from cfg" ));
Jeff Johnson295189b2012-06-20 16:38:30 -07003333 return;
3334 }
3335#endif
3336
Jeff Johnson295189b2012-06-20 16:38:30 -07003337#if defined WLAN_FEATURE_VOWIFI
Jeff Johnsone7245742012-09-05 17:12:55 -07003338 limSendSwitchChnlParams(pMac, newChannel, subband, psessionEntry->maxTxPower, psessionEntry->peSessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07003339#else
Jeff Johnsone7245742012-09-05 17:12:55 -07003340 limSendSwitchChnlParams(pMac, newChannel, subband, (tPowerdBm)localPwrConstraint, psessionEntry->peSessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07003341#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07003342
Jeff Johnsone7245742012-09-05 17:12:55 -07003343 // Store the new primary and secondary channel in session entries if different
3344 if (psessionEntry->currentOperChannel != newChannel)
Jeff Johnson295189b2012-06-20 16:38:30 -07003345 {
3346 limLog(pMac, LOGW,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003347 FL("switch old chnl %d --> new chnl %d "),
Jeff Johnson295189b2012-06-20 16:38:30 -07003348 psessionEntry->currentOperChannel, newChannel);
Jeff Johnson295189b2012-06-20 16:38:30 -07003349 psessionEntry->currentOperChannel = newChannel;
3350 }
Jeff Johnsone7245742012-09-05 17:12:55 -07003351 if (psessionEntry->htSecondaryChannelOffset != subband)
3352 {
3353 limLog(pMac, LOGW,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003354 FL("switch old sec chnl %d --> new sec chnl %d "),
Jeff Johnsone7245742012-09-05 17:12:55 -07003355 psessionEntry->htSecondaryChannelOffset, subband);
3356 psessionEntry->htSecondaryChannelOffset = subband;
3357 if (psessionEntry->htSecondaryChannelOffset == PHY_SINGLE_CHANNEL_CENTERED)
3358 {
3359 psessionEntry->htSupportedChannelWidthSet = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE;
3360 }
3361 else
3362 {
3363 psessionEntry->htSupportedChannelWidthSet = WNI_CFG_CHANNEL_BONDING_MODE_ENABLE;
3364 }
3365 psessionEntry->htRecommendedTxWidthSet = psessionEntry->htSupportedChannelWidthSet;
3366 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003367
3368 return;
3369}
3370
3371
3372/**
3373 * limActiveScanAllowed()
3374 *
3375 *FUNCTION:
3376 * Checks if active scans are permitted on the given channel
3377 *
3378 *LOGIC:
3379 * The config variable SCAN_CONTROL_LIST contains pairs of (channelNum, activeScanAllowed)
3380 * Need to check if the channelNum matches, then depending on the corresponding
3381 * scan flag, return true (for activeScanAllowed==1) or false (otherwise).
3382 *
3383 *ASSUMPTIONS:
3384 *
3385 *NOTE:
3386 *
3387 * @param pMac Pointer to Global MAC structure
3388 * @param channelNum channel number
3389 * @return None
3390 */
3391
3392tANI_U8 limActiveScanAllowed(
3393 tpAniSirGlobal pMac,
3394 tANI_U8 channelNum)
3395{
3396 tANI_U32 i;
3397 tANI_U8 channelPair[WNI_CFG_SCAN_CONTROL_LIST_LEN];
3398 tANI_U32 len = WNI_CFG_SCAN_CONTROL_LIST_LEN;
3399 if (wlan_cfgGetStr(pMac, WNI_CFG_SCAN_CONTROL_LIST, channelPair, &len)
3400 != eSIR_SUCCESS)
3401 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003402 PELOGE(limLog(pMac, LOGE, FL("Unable to get scan control list"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003403 return false;
3404 }
3405
3406 if (len > WNI_CFG_SCAN_CONTROL_LIST_LEN)
3407 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003408 limLog(pMac, LOGE, FL("Invalid scan control list length:%d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07003409 len);
3410 return false;
3411 }
3412
3413 for (i=0; (i+1) < len; i+=2)
3414 {
3415 if (channelPair[i] == channelNum)
3416 return ((channelPair[i+1] == eSIR_ACTIVE_SCAN) ? true : false);
3417 }
3418 return false;
3419}
3420
3421/**
3422 * limTriggerBackgroundScanDuringQuietBss()
3423 *
3424 *FUNCTION:
3425 * This function is applicable to the STA only.
3426 * This function is called by limProcessQuietTimeout(),
3427 * when it is time to honor the Quiet BSS IE from the AP.
3428 *
3429 *LOGIC:
3430 * If 11H is enabled:
3431 * We cannot trigger a background scan. The STA needs to
3432 * shut-off Tx/Rx.
3433 * If 11 is not enabled:
3434 * Determine if the next channel that we are going to
3435 * scan is NOT the same channel (or not) on which the
3436 * Quiet BSS was requested.
3437 * If yes, then we cannot trigger a background scan on
3438 * this channel. Return with a false.
3439 * If no, then trigger a background scan. Return with
3440 * a true.
3441 *
3442 *ASSUMPTIONS:
3443 *
3444 *NOTE:
3445 * This API is redundant if the existing API,
3446 * limTriggerBackgroundScan(), were to return a valid
3447 * response instead of returning void.
3448 * If possible, try to revisit this API
3449 *
3450 * @param pMac Pointer to Global MAC structure
3451 * @return eSIR_TRUE, if a background scan was attempted
3452 * eSIR_FALSE, if not
3453 */
3454tAniBool limTriggerBackgroundScanDuringQuietBss( tpAniSirGlobal pMac )
3455{
3456 tAniBool bScanTriggered = eSIR_FALSE;
Jeff Johnson295189b2012-06-20 16:38:30 -07003457
3458
3459
3460 //TBD-RAJESH HOW TO GET sessionEntry?????
3461 tpPESession psessionEntry = &pMac->lim.gpSession[0];
3462
3463 if (psessionEntry->limSystemRole != eLIM_STA_ROLE)
3464 return bScanTriggered;
3465
Jeff Johnsone7245742012-09-05 17:12:55 -07003466 if( !psessionEntry->lim11hEnable )
Jeff Johnson295189b2012-06-20 16:38:30 -07003467 {
3468 tSirMacChanNum bgScanChannelList[WNI_CFG_BG_SCAN_CHANNEL_LIST_LEN];
3469 tANI_U32 len = WNI_CFG_BG_SCAN_CHANNEL_LIST_LEN;
3470
3471 // Determine the next scan channel
3472
3473 // Get background scan channel list from CFG
3474 if( eSIR_SUCCESS == wlan_cfgGetStr( pMac,
3475 WNI_CFG_BG_SCAN_CHANNEL_LIST,
3476 (tANI_U8 *) bgScanChannelList,
3477 (tANI_U32 *) &len ))
3478 {
3479 // Ensure that we do not go off scanning on the same
3480 // channel on which the Quiet BSS was requested
3481 if( psessionEntry->currentOperChannel!=
3482 bgScanChannelList[pMac->lim.gLimBackgroundScanChannelId] )
3483 {
3484 // For now, try and attempt a background scan. It will
3485 // be ideal if this API actually returns a success or
3486 // failure instead of having a void return type
3487 limTriggerBackgroundScan( pMac );
3488
3489 bScanTriggered = eSIR_TRUE;
3490 }
3491 else
3492 {
3493 limLog( pMac, LOGW,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003494 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 -07003495 }
3496 }
3497 else
3498 {
3499 limLog( pMac, LOGW,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003500 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 -07003501 }
3502 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003503 return bScanTriggered;
3504}
3505
3506
3507/**
3508 * limGetHTCapability()
3509 *
3510 *FUNCTION:
3511 * A utility function that returns the "current HT capability state" for the HT
3512 * capability of interest (as requested in the API)
3513 *
3514 *LOGIC:
3515 * This routine will return with the "current" setting of a requested HT
3516 * capability. This state info could be retrieved from -
3517 * a) CFG (for static entries)
3518 * b) Run time info
3519 * - Dynamic state maintained by LIM
3520 * - Configured at radio init time by SME
3521 *
3522 *
3523 *ASSUMPTIONS:
3524 * NA
3525 *
3526 *NOTE:
3527 *
3528 * @param pMac Pointer to Global MAC structure
3529 * @param htCap The HT capability being queried
3530 * @return tANI_U8 The current state of the requested HT capability is returned in a
3531 * tANI_U8 variable
3532 */
3533
Jeff Johnson295189b2012-06-20 16:38:30 -07003534tANI_U8 limGetHTCapability( tpAniSirGlobal pMac,
3535 tANI_U32 htCap, tpPESession psessionEntry)
Jeff Johnson295189b2012-06-20 16:38:30 -07003536{
3537tANI_U8 retVal = 0;
3538tANI_U8 *ptr;
3539tANI_U32 cfgValue;
3540tSirMacHTCapabilityInfo macHTCapabilityInfo = {0};
3541tSirMacExtendedHTCapabilityInfo macExtHTCapabilityInfo = {0};
3542tSirMacTxBFCapabilityInfo macTxBFCapabilityInfo = {0};
3543tSirMacASCapabilityInfo macASCapabilityInfo = {0};
3544
3545 //
3546 // Determine which CFG to read from. Not ALL of the HT
3547 // related CFG's need to be read each time this API is
3548 // accessed
3549 //
3550 if( htCap >= eHT_ANTENNA_SELECTION &&
3551 htCap < eHT_SI_GRANULARITY )
3552 {
3553 // Get Antenna Seletion HT Capabilities
3554 if( eSIR_SUCCESS != wlan_cfgGetInt( pMac, WNI_CFG_AS_CAP, &cfgValue ))
3555 cfgValue = 0;
3556 ptr = (tANI_U8 *) &macASCapabilityInfo;
3557 *((tANI_U8 *)ptr) = (tANI_U8) (cfgValue & 0xff);
3558 }
3559 else
3560 {
3561 if( htCap >= eHT_TX_BEAMFORMING &&
3562 htCap < eHT_ANTENNA_SELECTION )
3563 {
3564 // Get Transmit Beam Forming HT Capabilities
3565 if( eSIR_SUCCESS != wlan_cfgGetInt( pMac, WNI_CFG_TX_BF_CAP, &cfgValue ))
3566 cfgValue = 0;
3567 ptr = (tANI_U8 *) &macTxBFCapabilityInfo;
3568 *((tANI_U32 *)ptr) = (tANI_U32) (cfgValue);
3569 }
3570 else
3571 {
3572 if( htCap >= eHT_PCO &&
3573 htCap < eHT_TX_BEAMFORMING )
3574 {
3575 // Get Extended HT Capabilities
3576 if( eSIR_SUCCESS != wlan_cfgGetInt( pMac, WNI_CFG_EXT_HT_CAP_INFO, &cfgValue ))
3577 cfgValue = 0;
3578 ptr = (tANI_U8 *) &macExtHTCapabilityInfo;
3579 *((tANI_U16 *)ptr) = (tANI_U16) (cfgValue & 0xffff);
3580 }
3581 else
3582 {
3583 if( htCap < eHT_MAX_RX_AMPDU_FACTOR )
3584 {
3585 // Get HT Capabilities
3586 if( eSIR_SUCCESS != wlan_cfgGetInt( pMac, WNI_CFG_HT_CAP_INFO, &cfgValue ))
3587 cfgValue = 0;
3588 ptr = (tANI_U8 *) &macHTCapabilityInfo;
3589 // 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
3590 *ptr++ = cfgValue & 0xff;
3591 *ptr = (cfgValue >> 8) & 0xff;
3592 }
3593 }
3594 }
3595 }
3596
3597 switch( htCap )
3598 {
3599 case eHT_LSIG_TXOP_PROTECTION:
3600 retVal = pMac->lim.gHTLsigTXOPProtection;
3601 break;
3602
3603 case eHT_STBC_CONTROL_FRAME:
3604 retVal = (tANI_U8) macHTCapabilityInfo.stbcControlFrame;
3605 break;
3606
3607 case eHT_PSMP:
3608 retVal = pMac->lim.gHTPSMPSupport;
3609 break;
3610
3611 case eHT_DSSS_CCK_MODE_40MHZ:
3612 retVal = pMac->lim.gHTDsssCckRate40MHzSupport;
3613 break;
3614
3615 case eHT_MAX_AMSDU_LENGTH:
3616 retVal = (tANI_U8) macHTCapabilityInfo.maximalAMSDUsize;
3617 break;
3618
3619 case eHT_DELAYED_BA:
3620 retVal = (tANI_U8) macHTCapabilityInfo.delayedBA;
3621 break;
3622
3623 case eHT_RX_STBC:
3624 retVal = (tANI_U8) macHTCapabilityInfo.rxSTBC;
3625 break;
3626
3627 case eHT_TX_STBC:
3628 retVal = (tANI_U8) macHTCapabilityInfo.txSTBC;
3629 break;
3630
3631 case eHT_SHORT_GI_40MHZ:
3632 retVal = (tANI_U8) macHTCapabilityInfo.shortGI40MHz;
3633 break;
3634
3635 case eHT_SHORT_GI_20MHZ:
3636 retVal = (tANI_U8) macHTCapabilityInfo.shortGI20MHz;
3637 break;
3638
3639 case eHT_GREENFIELD:
3640 retVal = (tANI_U8) macHTCapabilityInfo.greenField;
3641 break;
3642
3643 case eHT_MIMO_POWER_SAVE:
3644 retVal = (tANI_U8) pMac->lim.gHTMIMOPSState;
3645 break;
3646
3647 case eHT_SUPPORTED_CHANNEL_WIDTH_SET:
Jeff Johnsone7245742012-09-05 17:12:55 -07003648 retVal = (tANI_U8) psessionEntry->htSupportedChannelWidthSet;
Jeff Johnson295189b2012-06-20 16:38:30 -07003649 break;
3650
3651 case eHT_ADVANCED_CODING:
3652 retVal = (tANI_U8) macHTCapabilityInfo.advCodingCap;
3653 break;
3654
3655 case eHT_MAX_RX_AMPDU_FACTOR:
3656 retVal = pMac->lim.gHTMaxRxAMpduFactor;
3657 break;
3658
3659 case eHT_MPDU_DENSITY:
3660 retVal = pMac->lim.gHTAMpduDensity;
3661 break;
3662
3663 case eHT_PCO:
3664 retVal = (tANI_U8) macExtHTCapabilityInfo.pco;
3665 break;
3666
3667 case eHT_TRANSITION_TIME:
3668 retVal = (tANI_U8) macExtHTCapabilityInfo.transitionTime;
3669 break;
3670
3671 case eHT_MCS_FEEDBACK:
3672 retVal = (tANI_U8) macExtHTCapabilityInfo.mcsFeedback;
3673 break;
3674
3675 case eHT_TX_BEAMFORMING:
3676 retVal = (tANI_U8) macTxBFCapabilityInfo.txBF;
3677 break;
3678
3679 case eHT_ANTENNA_SELECTION:
3680 retVal = (tANI_U8) macASCapabilityInfo.antennaSelection;
3681 break;
3682
3683 case eHT_SI_GRANULARITY:
3684 retVal = pMac->lim.gHTServiceIntervalGranularity;
3685 break;
3686
3687 case eHT_CONTROLLED_ACCESS:
3688 retVal = pMac->lim.gHTControlledAccessOnly;
3689 break;
3690
3691 case eHT_RIFS_MODE:
3692 retVal = psessionEntry->beaconParams.fRIFSMode;
3693 break;
3694
3695 case eHT_RECOMMENDED_TX_WIDTH_SET:
Jeff Johnsone7245742012-09-05 17:12:55 -07003696 retVal = psessionEntry->htRecommendedTxWidthSet;
Jeff Johnson295189b2012-06-20 16:38:30 -07003697 break;
3698
3699 case eHT_EXTENSION_CHANNEL_OFFSET:
Jeff Johnsone7245742012-09-05 17:12:55 -07003700 retVal = psessionEntry->htSecondaryChannelOffset;
Jeff Johnson295189b2012-06-20 16:38:30 -07003701 break;
3702
3703 case eHT_OP_MODE:
Jeff Johnson295189b2012-06-20 16:38:30 -07003704 if(psessionEntry->limSystemRole == eLIM_AP_ROLE )
3705 retVal = psessionEntry->htOperMode;
3706 else
Jeff Johnson295189b2012-06-20 16:38:30 -07003707 retVal = pMac->lim.gHTOperMode;
3708 break;
3709
3710 case eHT_BASIC_STBC_MCS:
3711 retVal = pMac->lim.gHTSTBCBasicMCS;
3712 break;
3713
3714 case eHT_DUAL_CTS_PROTECTION:
3715 retVal = pMac->lim.gHTDualCTSProtection;
3716 break;
3717
3718 case eHT_LSIG_TXOP_PROTECTION_FULL_SUPPORT:
3719 retVal = psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport;
3720 break;
3721
3722 case eHT_PCO_ACTIVE:
3723 retVal = pMac->lim.gHTPCOActive;
3724 break;
3725
3726 case eHT_PCO_PHASE:
3727 retVal = pMac->lim.gHTPCOPhase;
3728 break;
3729
3730 default:
3731 break;
3732 }
3733
3734 return retVal;
3735}
3736
Jeff Johnson295189b2012-06-20 16:38:30 -07003737void limGetMyMacAddr(tpAniSirGlobal pMac, tANI_U8 *mac)
3738{
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05303739 vos_mem_copy( mac, pMac->lim.gLimMyMacAddr, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07003740 return;
3741}
3742
3743
3744
3745
3746/** -------------------------------------------------------------
3747\fn limEnable11aProtection
3748\brief based on config setting enables\disables 11a protection.
3749\param tANI_U8 enable : 1=> enable protection, 0=> disable protection.
3750\param tANI_U8 overlap: 1=> called from overlap context, 0 => called from assoc context.
3751\param tpUpdateBeaconParams pBeaconParams
3752\return None
3753 -------------------------------------------------------------*/
3754tSirRetStatus
3755limEnable11aProtection(tpAniSirGlobal pMac, tANI_U8 enable,
3756 tANI_U8 overlap, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry)
3757{
Madan Mohan Koyyalamudi33ef6a22012-10-30 17:44:43 -07003758 if(NULL == psessionEntry)
3759 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003760 PELOG3(limLog(pMac, LOG3, FL("psessionEntry is NULL"));)
Madan Mohan Koyyalamudi33ef6a22012-10-30 17:44:43 -07003761 return eSIR_FAILURE;
3762 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003763 //overlapping protection configuration check.
3764 if(overlap)
3765 {
Jeff Johnson295189b2012-06-20 16:38:30 -07003766 }
3767 else
3768 {
3769 //normal protection config check
Madan Mohan Koyyalamudi33ef6a22012-10-30 17:44:43 -07003770 if ((psessionEntry->limSystemRole == eLIM_AP_ROLE) &&
Jeff Johnsone7245742012-09-05 17:12:55 -07003771 (!psessionEntry->cfgProtection.fromlla))
Jeff Johnson295189b2012-06-20 16:38:30 -07003772 {
3773 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003774 PELOG3(limLog(pMac, LOG3, FL("protection from 11a is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003775 return eSIR_SUCCESS;
3776 }
3777 }
3778
3779 if (enable)
3780 {
3781 //If we are AP and HT capable, we need to set the HT OP mode
3782 //appropriately.
3783 if(((eLIM_AP_ROLE == psessionEntry->limSystemRole)||(eLIM_BT_AMP_AP_ROLE == psessionEntry->limSystemRole))&&
Jeff Johnsone7245742012-09-05 17:12:55 -07003784 (true == psessionEntry->htCapability))
Jeff Johnson295189b2012-06-20 16:38:30 -07003785 {
3786 if(overlap)
3787 {
3788 pMac->lim.gLimOverlap11aParams.protectionEnabled = true;
3789 if((eSIR_HT_OP_MODE_OVERLAP_LEGACY != pMac->lim.gHTOperMode) &&
3790 (eSIR_HT_OP_MODE_MIXED != pMac->lim.gHTOperMode))
3791 {
3792 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
3793 psessionEntry->htOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
3794 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
3795 limEnableHtOBSSProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
3796 }
3797 }
3798 else
3799 {
3800 psessionEntry->gLim11aParams.protectionEnabled = true;
3801 if(eSIR_HT_OP_MODE_MIXED != pMac->lim.gHTOperMode)
3802 {
3803 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_MIXED;
Jeff Johnsone7245742012-09-05 17:12:55 -07003804 psessionEntry->htOperMode = eSIR_HT_OP_MODE_MIXED;
Jeff Johnson295189b2012-06-20 16:38:30 -07003805 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
3806 limEnableHtOBSSProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
3807
3808 }
3809 }
3810 }
3811
3812 //This part is common for staiton as well.
3813 if(false == psessionEntry->beaconParams.llaCoexist)
3814 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003815 PELOG1(limLog(pMac, LOG1, FL(" => protection from 11A Enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003816 pBeaconParams->llaCoexist = psessionEntry->beaconParams.llaCoexist = true;
3817 pBeaconParams->paramChangeBitmap |= PARAM_llACOEXIST_CHANGED;
3818 }
3819 }
3820 else if (true == psessionEntry->beaconParams.llaCoexist)
3821 {
3822 //for AP role.
3823 //we need to take care of HT OP mode change if needed.
3824 //We need to take care of Overlap cases.
3825 if(eLIM_AP_ROLE == psessionEntry->limSystemRole)
3826 {
3827 if(overlap)
3828 {
3829 //Overlap Legacy protection disabled.
3830 pMac->lim.gLimOverlap11aParams.protectionEnabled = false;
3831
3832 //We need to take care of HT OP mode iff we are HT AP.
Jeff Johnsone7245742012-09-05 17:12:55 -07003833 if(psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07003834 {
3835 // no HT op mode change if any of the overlap protection enabled.
3836 if(!(pMac->lim.gLimOverlap11aParams.protectionEnabled ||
3837 pMac->lim.gLimOverlapHt20Params.protectionEnabled ||
3838 pMac->lim.gLimOverlapNonGfParams.protectionEnabled))
3839
3840 {
3841 //Check if there is a need to change HT OP mode.
3842 if(eSIR_HT_OP_MODE_OVERLAP_LEGACY == pMac->lim.gHTOperMode)
3843 {
3844 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
3845 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
3846
3847 if(psessionEntry->gLimHt20Params.protectionEnabled)
3848 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
3849 else
3850 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_PURE;
3851 }
3852 }
3853 }
3854 }
3855 else
3856 {
3857 //Disable protection from 11A stations.
3858 psessionEntry->gLim11aParams.protectionEnabled = false;
3859 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
3860
3861 //Check if any other non-HT protection enabled.
3862 //Right now we are in HT OP Mixed mode.
3863 //Change HT op mode appropriately.
3864
3865 //Change HT OP mode to 01 if any overlap protection enabled
3866 if(pMac->lim.gLimOverlap11aParams.protectionEnabled ||
3867 pMac->lim.gLimOverlapHt20Params.protectionEnabled ||
3868 pMac->lim.gLimOverlapNonGfParams.protectionEnabled)
3869
3870 {
3871 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
Jeff Johnsone7245742012-09-05 17:12:55 -07003872 psessionEntry->htOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
Jeff Johnson295189b2012-06-20 16:38:30 -07003873 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
3874 }
3875 else if(psessionEntry->gLimHt20Params.protectionEnabled)
3876 {
3877 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
Jeff Johnsone7245742012-09-05 17:12:55 -07003878 psessionEntry->htOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
Jeff Johnson295189b2012-06-20 16:38:30 -07003879 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
3880 }
3881 else
3882 {
3883 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_PURE;
Jeff Johnsone7245742012-09-05 17:12:55 -07003884 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
Jeff Johnson295189b2012-06-20 16:38:30 -07003885 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
3886 }
3887 }
3888 if(!pMac->lim.gLimOverlap11aParams.protectionEnabled &&
3889 !psessionEntry->gLim11aParams.protectionEnabled)
3890 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003891 PELOG1(limLog(pMac, LOG1, FL("===> Protection from 11A Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003892 pBeaconParams->llaCoexist = psessionEntry->beaconParams.llaCoexist = false;
3893 pBeaconParams->paramChangeBitmap |= PARAM_llACOEXIST_CHANGED;
3894 }
3895 }
3896 //for station role
3897 else
3898 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003899 PELOG1(limLog(pMac, LOG1, FL("===> Protection from 11A Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003900 pBeaconParams->llaCoexist = psessionEntry->beaconParams.llaCoexist = false;
3901 pBeaconParams->paramChangeBitmap |= PARAM_llACOEXIST_CHANGED;
3902 }
3903 }
3904
3905 return eSIR_SUCCESS;
3906}
3907
3908/** -------------------------------------------------------------
3909\fn limEnable11gProtection
3910\brief based on config setting enables\disables 11g protection.
3911\param tANI_U8 enable : 1=> enable protection, 0=> disable protection.
3912\param tANI_U8 overlap: 1=> called from overlap context, 0 => called from assoc context.
3913\param tpUpdateBeaconParams pBeaconParams
3914\return None
3915 -------------------------------------------------------------*/
3916
3917tSirRetStatus
3918limEnable11gProtection(tpAniSirGlobal pMac, tANI_U8 enable,
3919 tANI_U8 overlap, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry)
3920{
3921
3922 //overlapping protection configuration check.
3923 if(overlap)
3924 {
Jeff Johnson295189b2012-06-20 16:38:30 -07003925 }
3926 else
3927 {
3928 //normal protection config check
Jeff Johnson295189b2012-06-20 16:38:30 -07003929 if((psessionEntry->limSystemRole == eLIM_AP_ROLE ) &&
3930 !psessionEntry->cfgProtection.fromllb)
3931 {
3932 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003933 PELOG1(limLog(pMac, LOG1, FL("protection from 11b is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003934 return eSIR_SUCCESS;
3935 }else if(psessionEntry->limSystemRole != eLIM_AP_ROLE)
Jeff Johnson295189b2012-06-20 16:38:30 -07003936 {
3937 if(!pMac->lim.cfgProtection.fromllb)
3938 {
3939 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003940 PELOG1(limLog(pMac, LOG1, FL("protection from 11b is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003941 return eSIR_SUCCESS;
3942 }
3943 }
3944 }
3945
3946 if (enable)
3947 {
3948 //If we are AP and HT capable, we need to set the HT OP mode
3949 //appropriately.
Jeff Johnson295189b2012-06-20 16:38:30 -07003950 if(eLIM_AP_ROLE == psessionEntry->limSystemRole)
3951 {
3952 if(overlap)
3953 {
3954 psessionEntry->gLimOlbcParams.protectionEnabled = true;
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003955 PELOGE(limLog(pMac, LOGE, FL("protection from olbc is enabled"));)
Jeff Johnsone7245742012-09-05 17:12:55 -07003956 if(true == psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07003957 {
3958 if((eSIR_HT_OP_MODE_OVERLAP_LEGACY != psessionEntry->htOperMode) &&
3959 (eSIR_HT_OP_MODE_MIXED != psessionEntry->htOperMode))
3960 {
3961 psessionEntry->htOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
3962 }
3963 //CR-263021: OBSS bit is not switching back to 0 after disabling the overlapping legacy BSS
3964 // This fixes issue of OBSS bit not set after 11b, 11g station leaves
3965 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
3966 //Not processing OBSS bit from other APs, as we are already taking care
3967 //of Protection from overlapping BSS based on erp IE or useProtection bit
3968 limEnableHtOBSSProtection(pMac, true, overlap, pBeaconParams, psessionEntry);
3969 }
3970 }
3971 else
3972 {
3973 psessionEntry->gLim11bParams.protectionEnabled = true;
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003974 PELOGE(limLog(pMac, LOGE, FL("protection from 11b is enabled"));)
Jeff Johnsone7245742012-09-05 17:12:55 -07003975 if(true == psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07003976 {
3977 if(eSIR_HT_OP_MODE_MIXED != psessionEntry->htOperMode)
3978 {
3979 psessionEntry->htOperMode = eSIR_HT_OP_MODE_MIXED;
3980 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
3981 limEnableHtOBSSProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
3982 }
3983 }
3984 }
3985 }else if ((eLIM_BT_AMP_AP_ROLE == psessionEntry->limSystemRole) &&
Jeff Johnsone7245742012-09-05 17:12:55 -07003986 (true == psessionEntry->htCapability))
Jeff Johnson295189b2012-06-20 16:38:30 -07003987 {
3988 if(overlap)
3989 {
3990 psessionEntry->gLimOlbcParams.protectionEnabled = true;
3991 if((eSIR_HT_OP_MODE_OVERLAP_LEGACY != pMac->lim.gHTOperMode) &&
3992 (eSIR_HT_OP_MODE_MIXED != pMac->lim.gHTOperMode))
3993 {
3994 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
3995 }
3996 //CR-263021: OBSS bit is not switching back to 0 after disabling the overlapping legacy BSS
3997 // This fixes issue of OBSS bit not set after 11b, 11g station leaves
3998 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
3999 //Not processing OBSS bit from other APs, as we are already taking care
4000 //of Protection from overlapping BSS based on erp IE or useProtection bit
4001 limEnableHtOBSSProtection(pMac, true, overlap, pBeaconParams, psessionEntry);
4002 }
4003 else
4004 {
4005 psessionEntry->gLim11bParams.protectionEnabled = true;
4006 if(eSIR_HT_OP_MODE_MIXED != pMac->lim.gHTOperMode)
4007 {
4008 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_MIXED;
4009 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4010 limEnableHtOBSSProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4011 }
4012 }
4013 }
4014
4015 //This part is common for staiton as well.
4016 if(false == psessionEntry->beaconParams.llbCoexist)
4017 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004018 PELOG1(limLog(pMac, LOG1, FL("=> 11G Protection Enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004019 pBeaconParams->llbCoexist = psessionEntry->beaconParams.llbCoexist = true;
4020 pBeaconParams->paramChangeBitmap |= PARAM_llBCOEXIST_CHANGED;
4021 }
4022 }
4023 else if (true == psessionEntry->beaconParams.llbCoexist)
4024 {
4025 //for AP role.
4026 //we need to take care of HT OP mode change if needed.
4027 //We need to take care of Overlap cases.
Jeff Johnson295189b2012-06-20 16:38:30 -07004028 if(eLIM_AP_ROLE == psessionEntry->limSystemRole)
4029 {
4030 if(overlap)
4031 {
4032 //Overlap Legacy protection disabled.
4033 psessionEntry->gLimOlbcParams.protectionEnabled = false;
4034
4035 //We need to take care of HT OP mode if we are HT AP.
Jeff Johnsone7245742012-09-05 17:12:55 -07004036 if(psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07004037 {
4038 // no HT op mode change if any of the overlap protection enabled.
4039 if(!(psessionEntry->gLimOverlap11gParams.protectionEnabled ||
4040 psessionEntry->gLimOverlapHt20Params.protectionEnabled ||
4041 psessionEntry->gLimOverlapNonGfParams.protectionEnabled))
4042 {
4043 //Check if there is a need to change HT OP mode.
Jeff Johnson04dd8a82012-06-29 20:41:40 -07004044 if(eSIR_HT_OP_MODE_OVERLAP_LEGACY == psessionEntry->htOperMode)
Jeff Johnson295189b2012-06-20 16:38:30 -07004045 {
4046 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4047 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4048 if(psessionEntry->gLimHt20Params.protectionEnabled){
4049 //Commenting out beacuse of CR 258588 WFA cert
4050 //psessionEntry->htOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4051 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
4052 }
4053 else
4054 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
4055 }
4056 }
4057 }
4058 }
4059 else
4060 {
4061 //Disable protection from 11B stations.
4062 psessionEntry->gLim11bParams.protectionEnabled = false;
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004063 PELOGE(limLog(pMac, LOGE, FL("===> 11B Protection Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004064 //Check if any other non-HT protection enabled.
4065 if(!psessionEntry->gLim11gParams.protectionEnabled)
4066 {
4067 //Right now we are in HT OP Mixed mode.
4068 //Change HT op mode appropriately.
4069 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4070
4071 //Change HT OP mode to 01 if any overlap protection enabled
4072 if(psessionEntry->gLimOlbcParams.protectionEnabled ||
4073 psessionEntry->gLimOverlap11gParams.protectionEnabled ||
4074 psessionEntry->gLimOverlapHt20Params.protectionEnabled ||
4075 psessionEntry->gLimOverlapNonGfParams.protectionEnabled)
4076 {
4077 psessionEntry->htOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004078 PELOGE(limLog(pMac, LOGE, FL("===> 11G Protection Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004079 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4080 }
4081 else if(psessionEntry->gLimHt20Params.protectionEnabled)
4082 {
4083 //Commenting because of CR 258588 WFA cert
4084 //psessionEntry->htOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4085 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004086 PELOGE(limLog(pMac, LOGE, FL("===> 11G Protection Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004087 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4088 }
4089 else
4090 {
4091 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
4092 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4093 }
4094 }
4095 }
4096 if(!psessionEntry->gLimOlbcParams.protectionEnabled &&
4097 !psessionEntry->gLim11bParams.protectionEnabled)
4098 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004099 PELOGE(limLog(pMac, LOGE, FL("===> 11G Protection Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004100 pBeaconParams->llbCoexist = psessionEntry->beaconParams.llbCoexist = false;
4101 pBeaconParams->paramChangeBitmap |= PARAM_llBCOEXIST_CHANGED;
4102 }
4103 }else if(eLIM_BT_AMP_AP_ROLE == psessionEntry->limSystemRole)
Jeff Johnson295189b2012-06-20 16:38:30 -07004104 {
4105 if(overlap)
4106 {
4107 //Overlap Legacy protection disabled.
4108 psessionEntry->gLimOlbcParams.protectionEnabled = false;
4109
4110 //We need to take care of HT OP mode iff we are HT AP.
Jeff Johnsone7245742012-09-05 17:12:55 -07004111 if(psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07004112 {
4113 // no HT op mode change if any of the overlap protection enabled.
4114 if(!(pMac->lim.gLimOverlap11gParams.protectionEnabled ||
4115 pMac->lim.gLimOverlapHt20Params.protectionEnabled ||
4116 pMac->lim.gLimOverlapNonGfParams.protectionEnabled))
4117
4118 {
4119 //Check if there is a need to change HT OP mode.
4120 if(eSIR_HT_OP_MODE_OVERLAP_LEGACY == pMac->lim.gHTOperMode)
4121 {
4122 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4123 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4124 if(psessionEntry->gLimHt20Params.protectionEnabled)
4125 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4126 else
4127 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_PURE;
4128 }
4129 }
4130 }
4131 }
4132 else
4133 {
4134 //Disable protection from 11B stations.
4135 psessionEntry->gLim11bParams.protectionEnabled = false;
4136 //Check if any other non-HT protection enabled.
4137 if(!psessionEntry->gLim11gParams.protectionEnabled)
4138 {
4139 //Right now we are in HT OP Mixed mode.
4140 //Change HT op mode appropriately.
4141 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4142
4143 //Change HT OP mode to 01 if any overlap protection enabled
4144 if(psessionEntry->gLimOlbcParams.protectionEnabled ||
4145 pMac->lim.gLimOverlap11gParams.protectionEnabled ||
4146 pMac->lim.gLimOverlapHt20Params.protectionEnabled ||
4147 pMac->lim.gLimOverlapNonGfParams.protectionEnabled)
4148
4149 {
4150 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
4151 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4152 }
4153 else if(psessionEntry->gLimHt20Params.protectionEnabled)
4154 {
4155 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4156 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4157 }
4158 else
4159 {
4160 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_PURE;
4161 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4162 }
4163 }
4164 }
4165 if(!psessionEntry->gLimOlbcParams.protectionEnabled &&
4166 !psessionEntry->gLim11bParams.protectionEnabled)
4167 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004168 PELOG1(limLog(pMac, LOG1, FL("===> 11G Protection Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004169 pBeaconParams->llbCoexist = psessionEntry->beaconParams.llbCoexist = false;
4170 pBeaconParams->paramChangeBitmap |= PARAM_llBCOEXIST_CHANGED;
4171 }
4172 }
4173 //for station role
4174 else
4175 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004176 PELOG1(limLog(pMac, LOG1, FL("===> 11G Protection Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004177 pBeaconParams->llbCoexist = psessionEntry->beaconParams.llbCoexist = false;
4178 pBeaconParams->paramChangeBitmap |= PARAM_llBCOEXIST_CHANGED;
4179 }
4180 }
4181 return eSIR_SUCCESS;
4182}
4183
4184/** -------------------------------------------------------------
4185\fn limEnableHtProtectionFrom11g
4186\brief based on cofig enables\disables protection from 11g.
4187\param tANI_U8 enable : 1=> enable protection, 0=> disable protection.
4188\param tANI_U8 overlap: 1=> called from overlap context, 0 => called from assoc context.
4189\param tpUpdateBeaconParams pBeaconParams
4190\return None
4191 -------------------------------------------------------------*/
4192tSirRetStatus
4193limEnableHtProtectionFrom11g(tpAniSirGlobal pMac, tANI_U8 enable,
4194 tANI_U8 overlap, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry)
4195{
Jeff Johnsone7245742012-09-05 17:12:55 -07004196 if(!psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07004197 return eSIR_SUCCESS; // protection from 11g is only for HT stations.
4198
4199 //overlapping protection configuration check.
4200 if(overlap)
4201 {
Jeff Johnson295189b2012-06-20 16:38:30 -07004202 if((psessionEntry->limSystemRole == eLIM_AP_ROLE ) && (!psessionEntry->cfgProtection.overlapFromllg))
4203 {
4204 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004205 PELOG3(limLog(pMac, LOG3, FL("overlap protection from 11g is disabled")););
Jeff Johnson295189b2012-06-20 16:38:30 -07004206 return eSIR_SUCCESS;
4207 }else if ((psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE) && (!pMac->lim.cfgProtection.overlapFromllg))
Jeff Johnson295189b2012-06-20 16:38:30 -07004208 {
4209 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004210 PELOG3(limLog(pMac, LOG3, FL("overlap protection from 11g is disabled")););
Jeff Johnson295189b2012-06-20 16:38:30 -07004211 return eSIR_SUCCESS;
4212 }
4213 }
4214 else
4215 {
4216 //normal protection config check
Jeff Johnson295189b2012-06-20 16:38:30 -07004217 if((psessionEntry->limSystemRole == eLIM_AP_ROLE ) &&
4218 !psessionEntry->cfgProtection.fromllg){
4219 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004220 PELOG3(limLog(pMac, LOG3, FL("protection from 11g is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004221 return eSIR_SUCCESS;
4222 }else if(psessionEntry->limSystemRole != eLIM_AP_ROLE )
Jeff Johnson295189b2012-06-20 16:38:30 -07004223 {
4224 if(!pMac->lim.cfgProtection.fromllg)
4225 {
4226 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004227 PELOG3(limLog(pMac, LOG3, FL("protection from 11g is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004228 return eSIR_SUCCESS;
4229 }
4230 }
4231 }
4232 if (enable)
4233 {
4234 //If we are AP and HT capable, we need to set the HT OP mode
4235 //appropriately.
4236
Jeff Johnson295189b2012-06-20 16:38:30 -07004237 if(eLIM_AP_ROLE == psessionEntry->limSystemRole)
4238 {
4239 if(overlap)
4240 {
4241 psessionEntry->gLimOverlap11gParams.protectionEnabled = true;
4242 //11g exists in overlap BSS.
4243 //need not to change the operating mode to overlap_legacy
4244 //if higher or same protection operating mode is enabled right now.
4245 if((eSIR_HT_OP_MODE_OVERLAP_LEGACY != psessionEntry->htOperMode) &&
4246 (eSIR_HT_OP_MODE_MIXED != psessionEntry->htOperMode))
4247 {
4248 psessionEntry->htOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
4249 }
4250 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05304251 limEnableHtOBSSProtection(pMac, true, overlap, pBeaconParams, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07004252 }
4253 else
4254 {
4255 //11g is associated to an AP operating in 11n mode.
4256 //Change the HT operating mode to 'mixed mode'.
4257 psessionEntry->gLim11gParams.protectionEnabled = true;
4258 if(eSIR_HT_OP_MODE_MIXED != psessionEntry->htOperMode)
4259 {
4260 psessionEntry->htOperMode = eSIR_HT_OP_MODE_MIXED;
4261 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05304262 limEnableHtOBSSProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07004263 }
4264 }
4265 }else if(eLIM_BT_AMP_AP_ROLE == psessionEntry->limSystemRole)
Jeff Johnson295189b2012-06-20 16:38:30 -07004266 {
4267 if(overlap)
4268 {
4269 pMac->lim.gLimOverlap11gParams.protectionEnabled = true;
4270 //11g exists in overlap BSS.
4271 //need not to change the operating mode to overlap_legacy
4272 //if higher or same protection operating mode is enabled right now.
4273 if((eSIR_HT_OP_MODE_OVERLAP_LEGACY != pMac->lim.gHTOperMode) &&
4274 (eSIR_HT_OP_MODE_MIXED != pMac->lim.gHTOperMode))
4275 {
4276 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
4277 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4278 }
4279 }
4280 else
4281 {
4282 //11g is associated to an AP operating in 11n mode.
4283 //Change the HT operating mode to 'mixed mode'.
4284 psessionEntry->gLim11gParams.protectionEnabled = true;
4285 if(eSIR_HT_OP_MODE_MIXED != pMac->lim.gHTOperMode)
4286 {
4287 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_MIXED;
4288 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05304289 limEnableHtOBSSProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07004290 }
4291 }
4292 }
4293
4294 //This part is common for staiton as well.
4295 if(false == psessionEntry->beaconParams.llgCoexist)
4296 {
4297 pBeaconParams->llgCoexist = psessionEntry->beaconParams.llgCoexist = true;
4298 pBeaconParams->paramChangeBitmap |= PARAM_llGCOEXIST_CHANGED;
4299 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004300 else if (true == psessionEntry->gLimOverlap11gParams.protectionEnabled)
4301 {
4302 // As operating mode changed after G station assoc some way to update beacon
4303 // This addresses the issue of mode not changing to - 11 in beacon when OBSS overlap is enabled
4304 //pMac->sch.schObject.fBeaconChanged = 1;
4305 pBeaconParams->paramChangeBitmap |= PARAM_llGCOEXIST_CHANGED;
4306 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004307 }
4308 else if (true == psessionEntry->beaconParams.llgCoexist)
4309 {
4310 //for AP role.
4311 //we need to take care of HT OP mode change if needed.
4312 //We need to take care of Overlap cases.
4313
Jeff Johnson295189b2012-06-20 16:38:30 -07004314 if(eLIM_AP_ROLE == psessionEntry->limSystemRole)
4315 {
4316 if(overlap)
4317 {
4318 //Overlap Legacy protection disabled.
4319 if (psessionEntry->gLim11gParams.numSta == 0)
4320 psessionEntry->gLimOverlap11gParams.protectionEnabled = false;
4321
4322 // no HT op mode change if any of the overlap protection enabled.
4323 if(!(psessionEntry->gLimOlbcParams.protectionEnabled ||
4324 psessionEntry->gLimOverlapHt20Params.protectionEnabled ||
4325 psessionEntry->gLimOverlapNonGfParams.protectionEnabled))
4326 {
4327 //Check if there is a need to change HT OP mode.
4328 if(eSIR_HT_OP_MODE_OVERLAP_LEGACY == psessionEntry->htOperMode)
4329 {
4330 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4331 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4332
4333 if(psessionEntry->gLimHt20Params.protectionEnabled){
4334 //Commenting because of CR 258588 WFA cert
4335 //psessionEntry->htOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4336 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
4337 }
4338 else
4339 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
4340 }
4341 }
4342 }
4343 else
4344 {
4345 //Disable protection from 11G stations.
4346 psessionEntry->gLim11gParams.protectionEnabled = false;
4347 //Check if any other non-HT protection enabled.
4348 if(!psessionEntry->gLim11bParams.protectionEnabled)
4349 {
4350
4351 //Right now we are in HT OP Mixed mode.
4352 //Change HT op mode appropriately.
4353 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4354
4355 //Change HT OP mode to 01 if any overlap protection enabled
4356 if(psessionEntry->gLimOlbcParams.protectionEnabled ||
4357 psessionEntry->gLimOverlap11gParams.protectionEnabled ||
4358 psessionEntry->gLimOverlapHt20Params.protectionEnabled ||
4359 psessionEntry->gLimOverlapNonGfParams.protectionEnabled)
4360
4361 {
4362 psessionEntry->htOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
4363 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4364 }
4365 else if(psessionEntry->gLimHt20Params.protectionEnabled)
4366 {
4367 //Commenting because of CR 258588 WFA cert
4368 //psessionEntry->htOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4369 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
4370 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4371 }
4372 else
4373 {
4374 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
4375 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4376 }
4377 }
4378 }
4379 if(!psessionEntry->gLimOverlap11gParams.protectionEnabled &&
4380 !psessionEntry->gLim11gParams.protectionEnabled)
4381 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004382 PELOG1(limLog(pMac, LOG1, FL("===> Protection from 11G Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004383 pBeaconParams->llgCoexist = psessionEntry->beaconParams.llgCoexist = false;
4384 pBeaconParams->paramChangeBitmap |= PARAM_llGCOEXIST_CHANGED;
4385 }
4386 }else if(eLIM_BT_AMP_AP_ROLE == psessionEntry->limSystemRole)
Jeff Johnson295189b2012-06-20 16:38:30 -07004387 {
4388 if(overlap)
4389 {
4390 //Overlap Legacy protection disabled.
4391 pMac->lim.gLimOverlap11gParams.protectionEnabled = false;
4392
4393 // no HT op mode change if any of the overlap protection enabled.
4394 if(!(psessionEntry->gLimOlbcParams.protectionEnabled ||
4395 psessionEntry->gLimOverlapHt20Params.protectionEnabled ||
4396 psessionEntry->gLimOverlapNonGfParams.protectionEnabled))
4397 {
4398 //Check if there is a need to change HT OP mode.
4399 if(eSIR_HT_OP_MODE_OVERLAP_LEGACY == pMac->lim.gHTOperMode)
4400 {
4401 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4402 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4403
4404 if(psessionEntry->gLimHt20Params.protectionEnabled)
4405 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4406 else
4407 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_PURE;
4408 }
4409 }
4410 }
4411 else
4412 {
4413 //Disable protection from 11G stations.
4414 psessionEntry->gLim11gParams.protectionEnabled = false;
4415 //Check if any other non-HT protection enabled.
4416 if(!psessionEntry->gLim11bParams.protectionEnabled)
4417 {
4418
4419 //Right now we are in HT OP Mixed mode.
4420 //Change HT op mode appropriately.
4421 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4422
4423 //Change HT OP mode to 01 if any overlap protection enabled
4424 if(psessionEntry->gLimOlbcParams.protectionEnabled ||
4425 pMac->lim.gLimOverlap11gParams.protectionEnabled ||
4426 pMac->lim.gLimOverlapHt20Params.protectionEnabled ||
4427 pMac->lim.gLimOverlapNonGfParams.protectionEnabled)
4428
4429 {
4430 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
4431 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4432 }
4433 else if(psessionEntry->gLimHt20Params.protectionEnabled)
4434 {
4435 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4436 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4437 }
4438 else
4439 {
4440 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_PURE;
4441 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4442 }
4443 }
4444 }
4445 if(!pMac->lim.gLimOverlap11gParams.protectionEnabled &&
4446 !psessionEntry->gLim11gParams.protectionEnabled)
4447 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004448 PELOG1(limLog(pMac, LOG1, FL("===> Protection from 11G Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004449 pBeaconParams->llgCoexist = psessionEntry->beaconParams.llgCoexist = false;
4450 pBeaconParams->paramChangeBitmap |= PARAM_llGCOEXIST_CHANGED;
4451 }
4452 }
4453 //for station role
4454 else
4455 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004456 PELOG1(limLog(pMac, LOG1, FL("===> Protection from 11G Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004457 pBeaconParams->llgCoexist = psessionEntry->beaconParams.llgCoexist = false;
4458 pBeaconParams->paramChangeBitmap |= PARAM_llGCOEXIST_CHANGED;
4459 }
4460 }
4461 return eSIR_SUCCESS;
4462}
4463//FIXME_PROTECTION : need to check for no APSD whenever we want to enable this protection.
4464//This check will be done at the caller.
4465
4466/** -------------------------------------------------------------
4467\fn limEnableHtObssProtection
4468\brief based on cofig enables\disables obss protection.
4469\param tANI_U8 enable : 1=> enable protection, 0=> disable protection.
4470\param tANI_U8 overlap: 1=> called from overlap context, 0 => called from assoc context.
4471\param tpUpdateBeaconParams pBeaconParams
4472\return None
4473 -------------------------------------------------------------*/
4474tSirRetStatus
4475limEnableHtOBSSProtection(tpAniSirGlobal pMac, tANI_U8 enable,
4476 tANI_U8 overlap, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry)
4477{
4478
4479
Jeff Johnsone7245742012-09-05 17:12:55 -07004480 if(!psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07004481 return eSIR_SUCCESS; // this protection is only for HT stations.
4482
4483 //overlapping protection configuration check.
4484 if(overlap)
4485 {
4486 //overlapping protection configuration check.
Jeff Johnson295189b2012-06-20 16:38:30 -07004487 }
4488 else
4489 {
4490 //normal protection config check
Jeff Johnson295189b2012-06-20 16:38:30 -07004491 if((psessionEntry->limSystemRole == eLIM_AP_ROLE) && !psessionEntry->cfgProtection.obss)
4492 { //ToDo Update this field
4493 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004494 PELOG1(limLog(pMac, LOG1, FL("protection from Obss is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004495 return eSIR_SUCCESS;
4496 }else if(psessionEntry->limSystemRole != eLIM_AP_ROLE)
Jeff Johnson295189b2012-06-20 16:38:30 -07004497 {
4498 if(!pMac->lim.cfgProtection.obss)
4499 { //ToDo Update this field
4500 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004501 PELOG1(limLog(pMac, LOG1, FL("protection from Obss is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004502 return eSIR_SUCCESS;
4503 }
4504 }
4505 }
4506
4507
Jeff Johnson295189b2012-06-20 16:38:30 -07004508 if (eLIM_AP_ROLE == psessionEntry->limSystemRole){
4509 if ((enable) && (false == psessionEntry->beaconParams.gHTObssMode) )
4510 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004511 PELOG1(limLog(pMac, LOG1, FL("=>obss protection enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004512 psessionEntry->beaconParams.gHTObssMode = true;
4513 pBeaconParams->paramChangeBitmap |= PARAM_OBSS_MODE_CHANGED; // UPDATE AN ENUM FOR OBSS MODE <todo>
4514
4515 }
4516 else if (!enable && (true == psessionEntry->beaconParams.gHTObssMode))
4517 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004518 PELOG1(limLog(pMac, LOG1, FL("===> obss Protection disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004519 psessionEntry->beaconParams.gHTObssMode = false;
4520 pBeaconParams->paramChangeBitmap |= PARAM_OBSS_MODE_CHANGED;
4521
4522 }
4523//CR-263021: OBSS bit is not switching back to 0 after disabling the overlapping legacy BSS
4524 if (!enable && !overlap)
4525 {
4526 psessionEntry->gLimOverlap11gParams.protectionEnabled = false;
4527 }
4528 } else
Jeff Johnson295189b2012-06-20 16:38:30 -07004529 {
4530 if ((enable) && (false == psessionEntry->beaconParams.gHTObssMode) )
4531 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004532 PELOG1(limLog(pMac, LOG1, FL("=>obss protection enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004533 psessionEntry->beaconParams.gHTObssMode = true;
4534 pBeaconParams->paramChangeBitmap |= PARAM_OBSS_MODE_CHANGED; // UPDATE AN ENUM FOR OBSS MODE <todo>
4535
4536 }
4537 else if (!enable && (true == psessionEntry->beaconParams.gHTObssMode))
4538 {
4539
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004540 PELOG1(limLog(pMac, LOG1, FL("===> obss Protection disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004541 psessionEntry->beaconParams.gHTObssMode = false;
4542 pBeaconParams->paramChangeBitmap |= PARAM_OBSS_MODE_CHANGED;
4543
4544 }
4545 }
4546 return eSIR_SUCCESS;
4547}
4548/** -------------------------------------------------------------
4549\fn limEnableHT20Protection
4550\brief based on cofig enables\disables protection from Ht20.
4551\param tANI_U8 enable : 1=> enable protection, 0=> disable protection.
4552\param tANI_U8 overlap: 1=> called from overlap context, 0 => called from assoc context.
4553\param tpUpdateBeaconParams pBeaconParams
4554\return None
4555 -------------------------------------------------------------*/
4556tSirRetStatus
4557limEnableHT20Protection(tpAniSirGlobal pMac, tANI_U8 enable,
4558 tANI_U8 overlap, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry)
4559{
Jeff Johnsone7245742012-09-05 17:12:55 -07004560 if(!psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07004561 return eSIR_SUCCESS; // this protection is only for HT stations.
4562
4563 //overlapping protection configuration check.
4564 if(overlap)
4565 {
Jeff Johnson295189b2012-06-20 16:38:30 -07004566 }
4567 else
4568 {
4569 //normal protection config check
Jeff Johnson295189b2012-06-20 16:38:30 -07004570 if((psessionEntry->limSystemRole == eLIM_AP_ROLE ) &&
4571 !psessionEntry->cfgProtection.ht20)
4572 {
4573 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004574 PELOG3(limLog(pMac, LOG3, FL("protection from HT20 is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004575 return eSIR_SUCCESS;
4576 }else if(psessionEntry->limSystemRole != eLIM_AP_ROLE )
Jeff Johnson295189b2012-06-20 16:38:30 -07004577 {
4578 if(!pMac->lim.cfgProtection.ht20)
4579 {
4580 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004581 PELOG3(limLog(pMac, LOG3, FL("protection from HT20 is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004582 return eSIR_SUCCESS;
4583 }
4584 }
4585 }
4586
4587 if (enable)
4588 {
4589 //If we are AP and HT capable, we need to set the HT OP mode
4590 //appropriately.
4591
Jeff Johnson295189b2012-06-20 16:38:30 -07004592 if(eLIM_AP_ROLE == psessionEntry->limSystemRole){
4593 if(overlap)
4594 {
4595 psessionEntry->gLimOverlapHt20Params.protectionEnabled = true;
4596 if((eSIR_HT_OP_MODE_OVERLAP_LEGACY != psessionEntry->htOperMode) &&
4597 (eSIR_HT_OP_MODE_MIXED != psessionEntry->htOperMode))
4598 {
4599 psessionEntry->htOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
4600 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4601 }
4602 }
4603 else
4604 {
4605 psessionEntry->gLimHt20Params.protectionEnabled = true;
4606 if(eSIR_HT_OP_MODE_PURE == psessionEntry->htOperMode)
4607 {
4608 //Commenting because of CR 258588 WFA cert
4609 //psessionEntry->htOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4610 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
4611 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4612 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4613 }
4614 }
4615 }else if(eLIM_BT_AMP_AP_ROLE == psessionEntry->limSystemRole)
Jeff Johnson295189b2012-06-20 16:38:30 -07004616 {
4617 if(overlap)
4618 {
4619 pMac->lim.gLimOverlapHt20Params.protectionEnabled = true;
4620 if((eSIR_HT_OP_MODE_OVERLAP_LEGACY != pMac->lim.gHTOperMode) &&
4621 (eSIR_HT_OP_MODE_MIXED != pMac->lim.gHTOperMode))
4622 {
4623 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
4624 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4625 }
4626 }
4627 else
4628 {
4629 psessionEntry->gLimHt20Params.protectionEnabled = true;
4630 if(eSIR_HT_OP_MODE_PURE == pMac->lim.gHTOperMode)
4631 {
4632 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4633 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4634 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4635 }
4636 }
4637 }
4638
4639 //This part is common for staiton as well.
4640 if(false == psessionEntry->beaconParams.ht20Coexist)
4641 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004642 PELOG1(limLog(pMac, LOG1, FL("=> Prtection from HT20 Enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004643 pBeaconParams->ht20MhzCoexist = psessionEntry->beaconParams.ht20Coexist = true;
4644 pBeaconParams->paramChangeBitmap |= PARAM_HT20MHZCOEXIST_CHANGED;
4645 }
4646 }
4647 else if (true == psessionEntry->beaconParams.ht20Coexist)
4648 {
4649 //for AP role.
4650 //we need to take care of HT OP mode change if needed.
4651 //We need to take care of Overlap cases.
Jeff Johnson295189b2012-06-20 16:38:30 -07004652 if(eLIM_AP_ROLE == psessionEntry->limSystemRole){
4653 if(overlap)
4654 {
4655 //Overlap Legacy protection disabled.
4656 psessionEntry->gLimOverlapHt20Params.protectionEnabled = false;
4657
4658 // no HT op mode change if any of the overlap protection enabled.
4659 if(!(psessionEntry->gLimOlbcParams.protectionEnabled ||
4660 psessionEntry->gLimOverlap11gParams.protectionEnabled ||
4661 psessionEntry->gLimOverlapHt20Params.protectionEnabled ||
4662 psessionEntry->gLimOverlapNonGfParams.protectionEnabled))
4663 {
4664
4665 //Check if there is a need to change HT OP mode.
4666 if(eSIR_HT_OP_MODE_OVERLAP_LEGACY == psessionEntry->htOperMode)
4667 {
4668 if(psessionEntry->gLimHt20Params.protectionEnabled)
4669 {
4670 //Commented beacuse of CR 258588 for WFA Cert
4671 //psessionEntry->htOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4672 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
4673 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4674 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4675 }
4676 else
4677 {
4678 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
4679 }
4680 }
4681 }
4682 }
4683 else
4684 {
4685 //Disable protection from 11G stations.
4686 psessionEntry->gLimHt20Params.protectionEnabled = false;
4687
4688 //Change HT op mode appropriately.
4689 if(eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT == psessionEntry->htOperMode)
4690 {
4691 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
4692 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4693 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4694 }
4695 }
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004696 PELOG1(limLog(pMac, LOG1, FL("===> Protection from HT 20 Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004697 pBeaconParams->ht20MhzCoexist = psessionEntry->beaconParams.ht20Coexist = false;
4698 pBeaconParams->paramChangeBitmap |= PARAM_HT20MHZCOEXIST_CHANGED;
4699 }else if(eLIM_BT_AMP_AP_ROLE == psessionEntry->limSystemRole)
Jeff Johnson295189b2012-06-20 16:38:30 -07004700 {
4701 if(overlap)
4702 {
4703 //Overlap Legacy protection disabled.
4704 pMac->lim.gLimOverlapHt20Params.protectionEnabled = false;
4705
4706 // no HT op mode change if any of the overlap protection enabled.
4707 if(!(psessionEntry->gLimOlbcParams.protectionEnabled ||
4708 pMac->lim.gLimOverlap11gParams.protectionEnabled ||
4709 pMac->lim.gLimOverlapHt20Params.protectionEnabled ||
4710 pMac->lim.gLimOverlapNonGfParams.protectionEnabled))
4711 {
4712
4713 //Check if there is a need to change HT OP mode.
4714 if(eSIR_HT_OP_MODE_OVERLAP_LEGACY == pMac->lim.gHTOperMode)
4715 {
4716 if(psessionEntry->gLimHt20Params.protectionEnabled)
4717 {
4718 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4719 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4720 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4721 }
4722 else
4723 {
4724 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_PURE;
4725 }
4726 }
4727 }
4728 }
4729 else
4730 {
4731 //Disable protection from 11G stations.
4732 psessionEntry->gLimHt20Params.protectionEnabled = false;
4733
4734 //Change HT op mode appropriately.
4735 if(eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT == pMac->lim.gHTOperMode)
4736 {
4737 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_PURE;
4738 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4739 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4740 }
4741 }
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004742 PELOG1(limLog(pMac, LOG1, FL("===> Protection from HT 20 Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004743 pBeaconParams->ht20MhzCoexist = psessionEntry->beaconParams.ht20Coexist = false;
4744 pBeaconParams->paramChangeBitmap |= PARAM_HT20MHZCOEXIST_CHANGED;
4745 }
4746 //for station role
4747 else
4748 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004749 PELOG1(limLog(pMac, LOG1, FL("===> Protection from HT20 Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004750 pBeaconParams->ht20MhzCoexist = psessionEntry->beaconParams.ht20Coexist = false;
4751 pBeaconParams->paramChangeBitmap |= PARAM_HT20MHZCOEXIST_CHANGED;
4752 }
4753 }
4754
4755 return eSIR_SUCCESS;
4756}
4757
4758/** -------------------------------------------------------------
4759\fn limEnableHTNonGfProtection
4760\brief based on cofig enables\disables protection from NonGf.
4761\param tANI_U8 enable : 1=> enable protection, 0=> disable protection.
4762\param tANI_U8 overlap: 1=> called from overlap context, 0 => called from assoc context.
4763\param tpUpdateBeaconParams pBeaconParams
4764\return None
4765 -------------------------------------------------------------*/
4766tSirRetStatus
4767limEnableHTNonGfProtection(tpAniSirGlobal pMac, tANI_U8 enable,
4768 tANI_U8 overlap, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry)
4769{
Jeff Johnsone7245742012-09-05 17:12:55 -07004770 if(!psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07004771 return eSIR_SUCCESS; // this protection is only for HT stations.
4772
4773 //overlapping protection configuration check.
4774 if(overlap)
4775 {
Jeff Johnson295189b2012-06-20 16:38:30 -07004776 }
4777 else
4778 {
Jeff Johnson295189b2012-06-20 16:38:30 -07004779 //normal protection config check
4780 if((psessionEntry->limSystemRole == eLIM_AP_ROLE ) &&
4781 !psessionEntry->cfgProtection.nonGf)
4782 {
4783 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004784 PELOG3(limLog(pMac, LOG3, FL("protection from NonGf is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004785 return eSIR_SUCCESS;
4786 }else if(psessionEntry->limSystemRole != eLIM_AP_ROLE)
Jeff Johnson295189b2012-06-20 16:38:30 -07004787 {
4788 //normal protection config check
4789 if(!pMac->lim.cfgProtection.nonGf)
4790 {
4791 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004792 PELOG3(limLog(pMac, LOG3, FL("protection from NonGf is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004793 return eSIR_SUCCESS;
4794 }
4795 }
4796 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004797 if(psessionEntry->limSystemRole == eLIM_AP_ROLE){
4798 if ((enable) && (false == psessionEntry->beaconParams.llnNonGFCoexist))
4799 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004800 PELOG1(limLog(pMac, LOG1, FL(" => Prtection from non GF Enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004801 pBeaconParams->llnNonGFCoexist = psessionEntry->beaconParams.llnNonGFCoexist = true;
4802 pBeaconParams->paramChangeBitmap |= PARAM_NON_GF_DEVICES_PRESENT_CHANGED;
4803 }
4804 else if (!enable && (true == psessionEntry->beaconParams.llnNonGFCoexist))
4805 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004806 PELOG1(limLog(pMac, LOG1, FL("===> Protection from Non GF Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004807 pBeaconParams->llnNonGFCoexist = psessionEntry->beaconParams.llnNonGFCoexist = false;
4808 pBeaconParams->paramChangeBitmap |= PARAM_NON_GF_DEVICES_PRESENT_CHANGED;
4809 }
4810 }else
Jeff Johnson295189b2012-06-20 16:38:30 -07004811 {
4812 if ((enable) && (false == psessionEntry->beaconParams.llnNonGFCoexist))
4813 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004814 PELOG1(limLog(pMac, LOG1, FL(" => Prtection from non GF Enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004815 pBeaconParams->llnNonGFCoexist = psessionEntry->beaconParams.llnNonGFCoexist = true;
4816 pBeaconParams->paramChangeBitmap |= PARAM_NON_GF_DEVICES_PRESENT_CHANGED;
4817 }
4818 else if (!enable && (true == psessionEntry->beaconParams.llnNonGFCoexist))
4819 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004820 PELOG1(limLog(pMac, LOG1, FL("===> Protection from Non GF Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004821 pBeaconParams->llnNonGFCoexist = psessionEntry->beaconParams.llnNonGFCoexist = false;
4822 pBeaconParams->paramChangeBitmap |= PARAM_NON_GF_DEVICES_PRESENT_CHANGED;
4823 }
4824 }
4825
4826 return eSIR_SUCCESS;
4827}
4828
4829/** -------------------------------------------------------------
4830\fn limEnableHTLsigTxopProtection
4831\brief based on cofig enables\disables LsigTxop protection.
4832\param tANI_U8 enable : 1=> enable protection, 0=> disable protection.
4833\param tANI_U8 overlap: 1=> called from overlap context, 0 => called from assoc context.
4834\param tpUpdateBeaconParams pBeaconParams
4835\return None
4836 -------------------------------------------------------------*/
4837tSirRetStatus
4838limEnableHTLsigTxopProtection(tpAniSirGlobal pMac, tANI_U8 enable,
4839 tANI_U8 overlap, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry)
4840{
Jeff Johnsone7245742012-09-05 17:12:55 -07004841 if(!psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07004842 return eSIR_SUCCESS; // this protection is only for HT stations.
4843
4844 //overlapping protection configuration check.
4845 if(overlap)
4846 {
Jeff Johnson295189b2012-06-20 16:38:30 -07004847 }
4848 else
4849 {
Jeff Johnson295189b2012-06-20 16:38:30 -07004850 //normal protection config check
4851 if((psessionEntry->limSystemRole == eLIM_AP_ROLE ) &&
4852 !psessionEntry->cfgProtection.lsigTxop)
4853 {
4854 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004855 PELOG3(limLog(pMac, LOG3, FL(" protection from LsigTxop not supported is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004856 return eSIR_SUCCESS;
4857 }else if(psessionEntry->limSystemRole != eLIM_AP_ROLE)
Jeff Johnson295189b2012-06-20 16:38:30 -07004858 {
4859 //normal protection config check
4860 if(!pMac->lim.cfgProtection.lsigTxop)
4861 {
4862 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004863 PELOG3(limLog(pMac, LOG3, FL(" protection from LsigTxop not supported is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004864 return eSIR_SUCCESS;
4865 }
4866 }
4867 }
4868
4869
Jeff Johnson295189b2012-06-20 16:38:30 -07004870 if(psessionEntry->limSystemRole == eLIM_AP_ROLE){
4871 if ((enable) && (false == psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport))
4872 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004873 PELOG1(limLog(pMac, LOG1, FL(" => Prtection from LsigTxop Enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004874 pBeaconParams->fLsigTXOPProtectionFullSupport = psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport = true;
4875 pBeaconParams->paramChangeBitmap |= PARAM_LSIG_TXOP_FULL_SUPPORT_CHANGED;
4876 }
4877 else if (!enable && (true == psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport))
4878 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004879 PELOG1(limLog(pMac, LOG1, FL("===> Protection from LsigTxop Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004880 pBeaconParams->fLsigTXOPProtectionFullSupport= psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport = false;
4881 pBeaconParams->paramChangeBitmap |= PARAM_LSIG_TXOP_FULL_SUPPORT_CHANGED;
4882 }
4883 }else
Jeff Johnson295189b2012-06-20 16:38:30 -07004884 {
4885 if ((enable) && (false == psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport))
4886 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004887 PELOG1(limLog(pMac, LOG1, FL(" => Prtection from LsigTxop Enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004888 pBeaconParams->fLsigTXOPProtectionFullSupport = psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport = true;
4889 pBeaconParams->paramChangeBitmap |= PARAM_LSIG_TXOP_FULL_SUPPORT_CHANGED;
4890 }
4891 else if (!enable && (true == psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport))
4892 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004893 PELOG1(limLog(pMac, LOG1, FL("===> Protection from LsigTxop Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004894 pBeaconParams->fLsigTXOPProtectionFullSupport= psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport = false;
4895 pBeaconParams->paramChangeBitmap |= PARAM_LSIG_TXOP_FULL_SUPPORT_CHANGED;
4896 }
4897 }
4898 return eSIR_SUCCESS;
4899}
4900//FIXME_PROTECTION : need to check for no APSD whenever we want to enable this protection.
4901//This check will be done at the caller.
4902/** -------------------------------------------------------------
4903\fn limEnableHtRifsProtection
4904\brief based on cofig enables\disables Rifs protection.
4905\param tANI_U8 enable : 1=> enable protection, 0=> disable protection.
4906\param tANI_U8 overlap: 1=> called from overlap context, 0 => called from assoc context.
4907\param tpUpdateBeaconParams pBeaconParams
4908\return None
4909 -------------------------------------------------------------*/
4910tSirRetStatus
4911limEnableHtRifsProtection(tpAniSirGlobal pMac, tANI_U8 enable,
4912 tANI_U8 overlap, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry)
4913{
Jeff Johnsone7245742012-09-05 17:12:55 -07004914 if(!psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07004915 return eSIR_SUCCESS; // this protection is only for HT stations.
4916
4917
4918 //overlapping protection configuration check.
4919 if(overlap)
4920 {
Jeff Johnson295189b2012-06-20 16:38:30 -07004921 }
4922 else
4923 {
Jeff Johnson295189b2012-06-20 16:38:30 -07004924 //normal protection config check
4925 if((psessionEntry->limSystemRole == eLIM_AP_ROLE) &&
4926 !psessionEntry->cfgProtection.rifs)
4927 {
4928 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004929 PELOG3(limLog(pMac, LOG3, FL(" protection from Rifs is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004930 return eSIR_SUCCESS;
4931 }else if(psessionEntry->limSystemRole != eLIM_AP_ROLE )
Jeff Johnson295189b2012-06-20 16:38:30 -07004932 {
4933 //normal protection config check
4934 if(!pMac->lim.cfgProtection.rifs)
4935 {
4936 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004937 PELOG3(limLog(pMac, LOG3, FL(" protection from Rifs is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004938 return eSIR_SUCCESS;
4939 }
4940 }
4941 }
4942
Jeff Johnson295189b2012-06-20 16:38:30 -07004943 if(psessionEntry->limSystemRole == eLIM_AP_ROLE){
4944 // Disabling the RIFS Protection means Enable the RIFS mode of operation in the BSS
4945 if ((!enable) && (false == psessionEntry->beaconParams.fRIFSMode))
4946 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004947 PELOG1(limLog(pMac, LOG1, FL(" => Rifs protection Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004948 pBeaconParams->fRIFSMode = psessionEntry->beaconParams.fRIFSMode = true;
4949 pBeaconParams->paramChangeBitmap |= PARAM_RIFS_MODE_CHANGED;
4950 }
4951 // Enabling the RIFS Protection means Disable the RIFS mode of operation in the BSS
4952 else if (enable && (true == psessionEntry->beaconParams.fRIFSMode))
4953 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004954 PELOG1(limLog(pMac, LOG1, FL("===> Rifs Protection Enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004955 pBeaconParams->fRIFSMode = psessionEntry->beaconParams.fRIFSMode = false;
4956 pBeaconParams->paramChangeBitmap |= PARAM_RIFS_MODE_CHANGED;
4957 }
4958 }else
Jeff Johnson295189b2012-06-20 16:38:30 -07004959 {
4960 // Disabling the RIFS Protection means Enable the RIFS mode of operation in the BSS
4961 if ((!enable) && (false == psessionEntry->beaconParams.fRIFSMode))
4962 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004963 PELOG1(limLog(pMac, LOG1, FL(" => Rifs protection Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004964 pBeaconParams->fRIFSMode = psessionEntry->beaconParams.fRIFSMode = true;
4965 pBeaconParams->paramChangeBitmap |= PARAM_RIFS_MODE_CHANGED;
4966 }
4967 // Enabling the RIFS Protection means Disable the RIFS mode of operation in the BSS
4968 else if (enable && (true == psessionEntry->beaconParams.fRIFSMode))
4969 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004970 PELOG1(limLog(pMac, LOG1, FL("===> Rifs Protection Enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004971 pBeaconParams->fRIFSMode = psessionEntry->beaconParams.fRIFSMode = false;
4972 pBeaconParams->paramChangeBitmap |= PARAM_RIFS_MODE_CHANGED;
4973 }
4974 }
4975 return eSIR_SUCCESS;
4976}
4977
4978// ---------------------------------------------------------------------
4979/**
4980 * limEnableShortPreamble
4981 *
4982 * FUNCTION:
4983 * Enable/Disable short preamble
4984 *
4985 * LOGIC:
4986 *
4987 * ASSUMPTIONS:
4988 *
4989 * NOTE:
4990 *
4991 * @param enable Flag to enable/disable short preamble
4992 * @return None
4993 */
4994
4995tSirRetStatus
4996limEnableShortPreamble(tpAniSirGlobal pMac, tANI_U8 enable, tpUpdateBeaconParams pBeaconParams, tpPESession psessionEntry)
4997{
4998 tANI_U32 val;
4999
5000 if (wlan_cfgGetInt(pMac, WNI_CFG_SHORT_PREAMBLE, &val) != eSIR_SUCCESS)
5001 {
5002 /* Could not get short preamble enabled flag from CFG. Log error. */
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005003 limLog(pMac, LOGP, FL("could not retrieve short preamble flag"));
Jeff Johnson295189b2012-06-20 16:38:30 -07005004 return eSIR_FAILURE;
5005 }
5006
5007 if (!val)
5008 return eSIR_SUCCESS;
5009
5010 if (wlan_cfgGetInt(pMac, WNI_CFG_11G_SHORT_PREAMBLE_ENABLED, &val) != eSIR_SUCCESS)
5011 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005012 limLog(pMac, LOGP, FL("could not retrieve 11G short preamble switching enabled flag"));
Jeff Johnson295189b2012-06-20 16:38:30 -07005013 return eSIR_FAILURE;
5014 }
5015
5016 if (!val) // 11G short preamble switching is disabled.
5017 return eSIR_SUCCESS;
5018
5019 if ( psessionEntry->limSystemRole == eLIM_AP_ROLE )
5020 {
5021 if (enable && (psessionEntry->beaconParams.fShortPreamble == 0))
5022 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005023 PELOG1(limLog(pMac, LOG1, FL("===> Short Preamble Enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005024 psessionEntry->beaconParams.fShortPreamble = true;
5025 pBeaconParams->fShortPreamble = (tANI_U8) psessionEntry->beaconParams.fShortPreamble;
5026 pBeaconParams->paramChangeBitmap |= PARAM_SHORT_PREAMBLE_CHANGED;
5027 }
5028 else if (!enable && (psessionEntry->beaconParams.fShortPreamble == 1))
5029 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005030 PELOG1(limLog(pMac, LOG1, FL("===> Short Preamble Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005031 psessionEntry->beaconParams.fShortPreamble = false;
5032 pBeaconParams->fShortPreamble = (tANI_U8) psessionEntry->beaconParams.fShortPreamble;
5033 pBeaconParams->paramChangeBitmap |= PARAM_SHORT_PREAMBLE_CHANGED;
5034 }
5035 }
5036
5037 return eSIR_SUCCESS;
5038 }
5039
5040/**
5041 * limTxComplete
5042 *
5043 * Function:
5044 * This is LIM's very own "TX MGMT frame complete" completion routine.
5045 *
5046 * Logic:
5047 * LIM wants to send a MGMT frame (broadcast or unicast)
5048 * LIM allocates memory using palPktAlloc( ..., **pData, **pPacket )
5049 * LIM transmits the MGMT frame using the API:
5050 * halTxFrame( ... pPacket, ..., (void *) limTxComplete, pData )
5051 * HDD, via halTxFrame/DXE, "transfers" the packet over to BMU
5052 * HDD, if it determines that a TX completion routine (in this case
5053 * limTxComplete) has been provided, will invoke this callback
5054 * LIM will try to free the TX MGMT packet that was earlier allocated, in order
5055 * to send this MGMT frame, using the PAL API palPktFree( ... pData, pPacket )
5056 *
5057 * Assumptions:
5058 * Presently, this is ONLY being used for MGMT frames/packets
5059 * TODO:
5060 * Would it do good for LIM to have some sort of "signature" validation to
5061 * ensure that the pData argument passed in was a buffer that was actually
5062 * allocated by LIM and/or is not corrupted?
5063 *
5064 * Note: FIXME and TODO
5065 * Looks like palPktFree() is interested in pPacket. But, when this completion
5066 * routine is called, only pData is made available to LIM!!
5067 *
5068 * @param void A pointer to pData. Shouldn't it be pPacket?!
5069 *
5070 * @return none
5071 */
5072void limTxComplete( tHalHandle hHal, void *pData )
5073{
5074 tpAniSirGlobal pMac;
5075 pMac = (tpAniSirGlobal)hHal;
5076
5077#ifdef FIXME_PRIMA
5078 /* the trace logic needs to be fixed for Prima. Refer to CR 306075 */
5079#ifdef TRACE_RECORD
5080 {
5081 tpSirMacMgmtHdr mHdr;
5082 v_U8_t *pRxBd;
5083 vos_pkt_t *pVosPkt;
5084 VOS_STATUS vosStatus;
5085
5086
5087
5088 pVosPkt = (vos_pkt_t *)pData;
5089 vosStatus = vos_pkt_peek_data( pVosPkt, 0, (v_PVOID_t *)&pRxBd, WLANHAL_RX_BD_HEADER_SIZE);
5090
5091 if(VOS_IS_STATUS_SUCCESS(vosStatus))
5092 {
5093 mHdr = WDA_GET_RX_MAC_HEADER(pRxBd);
Jeff Johnsone7245742012-09-05 17:12:55 -07005094 MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE, NO_SESSION, mHdr->fc.subType);)
Jeff Johnson295189b2012-06-20 16:38:30 -07005095
5096 }
5097 }
5098#endif
5099#endif
5100
5101 palPktFree( pMac->hHdd,
5102 HAL_TXRX_FRM_802_11_MGMT,
5103 (void *) NULL, // this is ignored and will likely be removed from this API
5104 (void *) pData ); // lim passed in pPacket in the pData pointer that is given in this completion routine
5105}
5106
5107/**
5108 * \brief This function updates lim global structure, if CB parameters in the BSS
5109 * have changed, and sends an indication to HAL also with the
5110 * updated HT Parameters.
5111 * This function does not detect the change in the primary channel, that is done as part
5112 * of channel Swtich IE processing.
5113 * If STA is configured with '20Mhz only' mode, then this function does not do anything
5114 * This function changes the CB mode, only if the self capability is set to '20 as well as 40Mhz'
5115 *
5116 *
5117 * \param pMac Pointer to global MAC structure
5118 *
5119 * \param pRcvdHTInfo Pointer to HT Info IE obtained from a Beacon or
5120 * Probe Response
5121 *
5122 * \param bssIdx BSS Index of the Bss to which Station is associated.
5123 *
5124 *
5125 */
5126
5127void limUpdateStaRunTimeHTSwitchChnlParams( tpAniSirGlobal pMac,
5128 tDot11fIEHTInfo *pHTInfo,
5129 tANI_U8 bssIdx,
5130 tpPESession psessionEntry)
5131{
Jeff Johnsone7245742012-09-05 17:12:55 -07005132 ePhyChanBondState secondaryChnlOffset = PHY_SINGLE_CHANNEL_CENTERED;
Jeff Johnson295189b2012-06-20 16:38:30 -07005133#if !defined WLAN_FEATURE_VOWIFI
5134 tANI_U32 localPwrConstraint;
5135#endif
5136
5137 //If self capability is set to '20Mhz only', then do not change the CB mode.
Jeff Johnson295189b2012-06-20 16:38:30 -07005138 if( !limGetHTCapability( pMac, eHT_SUPPORTED_CHANNEL_WIDTH_SET, psessionEntry ))
Jeff Johnson295189b2012-06-20 16:38:30 -07005139 return;
5140
5141#if !defined WLAN_FEATURE_VOWIFI
5142 if(wlan_cfgGetInt(pMac, WNI_CFG_LOCAL_POWER_CONSTRAINT, &localPwrConstraint) != eSIR_SUCCESS) {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005143 limLog( pMac, LOGP, FL( "Unable to get Local Power Constraint from cfg" ));
Jeff Johnson295189b2012-06-20 16:38:30 -07005144 return;
5145 }
5146#endif
5147
Jeff Johnsone7245742012-09-05 17:12:55 -07005148 if ( psessionEntry->htSecondaryChannelOffset != ( tANI_U8 ) pHTInfo->secondaryChannelOffset ||
5149 psessionEntry->htRecommendedTxWidthSet != ( tANI_U8 ) pHTInfo->recommendedTxWidthSet )
Jeff Johnson295189b2012-06-20 16:38:30 -07005150 {
Jeff Johnsone7245742012-09-05 17:12:55 -07005151 psessionEntry->htSecondaryChannelOffset = ( ePhyChanBondState ) pHTInfo->secondaryChannelOffset;
5152 psessionEntry->htRecommendedTxWidthSet = ( tANI_U8 ) pHTInfo->recommendedTxWidthSet;
5153 if ( eHT_CHANNEL_WIDTH_40MHZ == psessionEntry->htRecommendedTxWidthSet )
5154 secondaryChnlOffset = (ePhyChanBondState)pHTInfo->secondaryChannelOffset;
Jeff Johnson295189b2012-06-20 16:38:30 -07005155
5156 // Notify HAL
5157 limLog( pMac, LOGW, FL( "Channel Information in HT IE change"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005158 "d; sending notification to HAL." ) );
Jeff Johnson295189b2012-06-20 16:38:30 -07005159 limLog( pMac, LOGW, FL( "Primary Channel: %d, Secondary Chan"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005160 "nel Offset: %d, Channel Width: %d" ),
Jeff Johnson295189b2012-06-20 16:38:30 -07005161 pHTInfo->primaryChannel, secondaryChnlOffset,
Jeff Johnsone7245742012-09-05 17:12:55 -07005162 psessionEntry->htRecommendedTxWidthSet );
Madan Mohan Koyyalamudifd322a02012-10-05 12:01:26 -07005163 psessionEntry->channelChangeReasonCode=LIM_SWITCH_CHANNEL_OPERATION;
5164 pMac->lim.gpchangeChannelCallback = NULL;
5165 pMac->lim.gpchangeChannelData = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07005166
5167#if defined WLAN_FEATURE_VOWIFI
5168 limSendSwitchChnlParams( pMac, ( tANI_U8 ) pHTInfo->primaryChannel,
5169 secondaryChnlOffset, psessionEntry->maxTxPower, psessionEntry->peSessionId);
5170#else
5171 limSendSwitchChnlParams( pMac, ( tANI_U8 ) pHTInfo->primaryChannel,
5172 secondaryChnlOffset, (tPowerdBm)localPwrConstraint, psessionEntry->peSessionId);
5173#endif
5174
5175 //In case of IBSS, if STA should update HT Info IE in its beacons.
5176 if (eLIM_STA_IN_IBSS_ROLE == psessionEntry->limSystemRole)
5177 {
5178 schSetFixedBeaconFields(pMac,psessionEntry);
5179 }
5180
5181 }
5182} // End limUpdateStaRunTimeHTParams.
5183
5184/**
5185 * \brief This function updates the lim global structure, if any of the
5186 * HT Capabilities have changed.
5187 *
5188 *
5189 * \param pMac Pointer to Global MAC structure
5190 *
5191 * \param pHTCapability Pointer to HT Capability Information Element
5192 * obtained from a Beacon or Probe Response
5193 *
5194 *
5195 *
5196 */
5197
5198void limUpdateStaRunTimeHTCapability( tpAniSirGlobal pMac,
5199 tDot11fIEHTCaps *pHTCaps )
5200{
5201
5202 if ( pMac->lim.gHTLsigTXOPProtection != ( tANI_U8 ) pHTCaps->lsigTXOPProtection )
5203 {
5204 pMac->lim.gHTLsigTXOPProtection = ( tANI_U8 ) pHTCaps->lsigTXOPProtection;
5205 // Send change notification to HAL
5206 }
5207
5208 if ( pMac->lim.gHTAMpduDensity != ( tANI_U8 ) pHTCaps->mpduDensity )
5209 {
5210 pMac->lim.gHTAMpduDensity = ( tANI_U8 ) pHTCaps->mpduDensity;
5211 // Send change notification to HAL
5212 }
5213
5214 if ( pMac->lim.gHTMaxRxAMpduFactor != ( tANI_U8 ) pHTCaps->maxRxAMPDUFactor )
5215 {
5216 pMac->lim.gHTMaxRxAMpduFactor = ( tANI_U8 ) pHTCaps->maxRxAMPDUFactor;
5217 // Send change notification to HAL
5218 }
5219
5220
5221} // End limUpdateStaRunTimeHTCapability.
5222
5223/**
5224 * \brief This function updates lim global structure, if any of the HT
5225 * Info Parameters have changed.
5226 *
5227 *
5228 * \param pMac Pointer to the global MAC structure
5229 *
5230 * \param pHTInfo Pointer to the HT Info IE obtained from a Beacon or
5231 * Probe Response
5232 *
5233 *
5234 */
5235
5236void limUpdateStaRunTimeHTInfo( tpAniSirGlobal pMac,
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305237 tDot11fIEHTInfo *pHTInfo, tpPESession psessionEntry)
Jeff Johnson295189b2012-06-20 16:38:30 -07005238{
Jeff Johnsone7245742012-09-05 17:12:55 -07005239 if ( psessionEntry->htRecommendedTxWidthSet != ( tANI_U8 )pHTInfo->recommendedTxWidthSet )
Jeff Johnson295189b2012-06-20 16:38:30 -07005240 {
Jeff Johnsone7245742012-09-05 17:12:55 -07005241 psessionEntry->htRecommendedTxWidthSet = ( tANI_U8 )pHTInfo->recommendedTxWidthSet;
Jeff Johnson295189b2012-06-20 16:38:30 -07005242 // Send change notification to HAL
5243 }
5244
5245 if ( psessionEntry->beaconParams.fRIFSMode != ( tANI_U8 )pHTInfo->rifsMode )
5246 {
5247 psessionEntry->beaconParams.fRIFSMode = ( tANI_U8 )pHTInfo->rifsMode;
5248 // Send change notification to HAL
5249 }
5250
5251 if ( pMac->lim.gHTServiceIntervalGranularity != ( tANI_U8 )pHTInfo->serviceIntervalGranularity )
5252 {
5253 pMac->lim.gHTServiceIntervalGranularity = ( tANI_U8 )pHTInfo->serviceIntervalGranularity;
5254 // Send change notification to HAL
5255 }
5256
5257 if ( pMac->lim.gHTOperMode != ( tSirMacHTOperatingMode )pHTInfo->opMode )
5258 {
5259 pMac->lim.gHTOperMode = ( tSirMacHTOperatingMode )pHTInfo->opMode;
5260 // Send change notification to HAL
5261 }
5262
5263 if ( psessionEntry->beaconParams.llnNonGFCoexist != pHTInfo->nonGFDevicesPresent )
5264 {
5265 psessionEntry->beaconParams.llnNonGFCoexist = ( tANI_U8 )pHTInfo->nonGFDevicesPresent;
5266 }
5267
5268 if ( pMac->lim.gHTSTBCBasicMCS != ( tANI_U8 )pHTInfo->basicSTBCMCS )
5269 {
5270 pMac->lim.gHTSTBCBasicMCS = ( tANI_U8 )pHTInfo->basicSTBCMCS;
5271 // Send change notification to HAL
5272 }
5273
5274 if ( pMac->lim.gHTDualCTSProtection != ( tANI_U8 )pHTInfo->dualCTSProtection )
5275 {
5276 pMac->lim.gHTDualCTSProtection = ( tANI_U8 )pHTInfo->dualCTSProtection;
5277 // Send change notification to HAL
5278 }
5279
5280 if ( pMac->lim.gHTSecondaryBeacon != ( tANI_U8 )pHTInfo->secondaryBeacon )
5281 {
5282 pMac->lim.gHTSecondaryBeacon = ( tANI_U8 )pHTInfo->secondaryBeacon;
5283 // Send change notification to HAL
5284 }
5285
5286 if ( psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport != ( tANI_U8 )pHTInfo->lsigTXOPProtectionFullSupport )
5287 {
5288 psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport = ( tANI_U8 )pHTInfo->lsigTXOPProtectionFullSupport;
5289 // Send change notification to HAL
5290 }
5291
5292 if ( pMac->lim.gHTPCOActive != ( tANI_U8 )pHTInfo->pcoActive )
5293 {
5294 pMac->lim.gHTPCOActive = ( tANI_U8 )pHTInfo->pcoActive;
5295 // Send change notification to HAL
5296 }
5297
5298 if ( pMac->lim.gHTPCOPhase != ( tANI_U8 )pHTInfo->pcoPhase )
5299 {
5300 pMac->lim.gHTPCOPhase = ( tANI_U8 )pHTInfo->pcoPhase;
5301 // Send change notification to HAL
5302 }
5303
5304} // End limUpdateStaRunTimeHTInfo.
5305
5306
5307/** -------------------------------------------------------------
5308\fn limProcessHalIndMessages
5309\brief callback function for HAL indication
5310\param tpAniSirGlobal pMac
5311\param tANI_U32 mesgId
5312\param void *mesgParam
5313\return tSirRetStatu - status
5314 -------------------------------------------------------------*/
5315
5316tSirRetStatus limProcessHalIndMessages(tpAniSirGlobal pMac, tANI_U32 msgId, void *msgParam )
5317{
5318 //its PE's responsibility to free msgparam when its done extracting the message parameters.
5319 tSirMsgQ msg;
5320
5321 switch(msgId)
5322 {
5323 case SIR_LIM_DEL_TS_IND:
5324 case SIR_LIM_ADD_BA_IND:
5325 case SIR_LIM_DEL_BA_ALL_IND:
5326 case SIR_LIM_DELETE_STA_CONTEXT_IND:
5327 case SIR_LIM_BEACON_GEN_IND:
5328 msg.type = (tANI_U16) msgId;
5329 msg.bodyptr = msgParam;
5330 msg.bodyval = 0;
5331 break;
5332
5333 default:
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305334 vos_mem_free(msgParam);
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005335 limLog(pMac, LOGP, FL("invalid message id = %d received"), msgId);
Jeff Johnson295189b2012-06-20 16:38:30 -07005336 return eSIR_FAILURE;
5337 }
5338
5339 if (limPostMsgApi(pMac, &msg) != eSIR_SUCCESS)
5340 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305341 vos_mem_free(msgParam);
Jeff Johnson295189b2012-06-20 16:38:30 -07005342 limLog(pMac, LOGP, FL("limPostMsgApi failed for msgid = %d"), msg.type);
5343 return eSIR_FAILURE;
5344 }
5345 return eSIR_SUCCESS;
5346}
5347
5348/** -------------------------------------------------------------
5349\fn limValidateDeltsReq
5350\brief Validates DelTs req originated by SME or by HAL and also sends halMsg_DelTs to HAL
5351\param tpAniSirGlobal pMac
5352\param tpSirDeltsReq pDeltsReq
5353\param tSirMacAddr peerMacAddr
5354\return eSirRetStatus - status
5355 -------------------------------------------------------------*/
5356
5357tSirRetStatus
5358limValidateDeltsReq(tpAniSirGlobal pMac, tpSirDeltsReq pDeltsReq, tSirMacAddr peerMacAddr,tpPESession psessionEntry)
5359{
5360 tpDphHashNode pSta;
5361 tANI_U8 tsStatus;
5362 tSirMacTSInfo *tsinfo;
5363 tANI_U32 i;
5364 tANI_U8 tspecIdx;
5365 /* if sta
5366 * - verify assoc state
5367 * - del tspec locally
5368 * if ap,
5369 * - verify sta is in assoc state
5370 * - del sta tspec locally
5371 */
5372 if(pDeltsReq == NULL)
5373 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005374 PELOGE(limLog(pMac, LOGE, FL("Delete TS request pointer is NULL"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005375 return eSIR_FAILURE;
5376 }
5377
5378 if ((psessionEntry->limSystemRole == eLIM_STA_ROLE)||(psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE))
5379 {
5380 tANI_U32 val;
5381
5382 // station always talks to the AP
5383 pSta = dphGetHashEntry(pMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable);
5384
5385 val = sizeof(tSirMacAddr);
5386 #if 0
5387 if (wlan_cfgGetStr(pMac, WNI_CFG_BSSID, peerMacAddr, &val) != eSIR_SUCCESS)
5388 {
5389 /// Could not get BSSID from CFG. Log error.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005390 limLog(pMac, LOGP, FL("could not retrieve BSSID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07005391 return eSIR_FAILURE;
5392 }
5393 #endif// TO SUPPORT BT-AMP
5394 sirCopyMacAddr(peerMacAddr,psessionEntry->bssId);
5395
5396 }
5397 else
5398 {
5399 tANI_U16 assocId;
5400 tANI_U8 *macaddr = (tANI_U8 *) peerMacAddr;
5401
5402 assocId = pDeltsReq->aid;
5403 if (assocId != 0)
5404 pSta = dphGetHashEntry(pMac, assocId, &psessionEntry->dph.dphHashTable);
5405 else
5406 pSta = dphLookupHashEntry(pMac, pDeltsReq->macAddr, &assocId, &psessionEntry->dph.dphHashTable);
5407
5408 if (pSta != NULL)
5409 // TBD: check sta assoc state as well
5410 for (i =0; i < sizeof(tSirMacAddr); i++)
5411 macaddr[i] = pSta->staAddr[i];
5412 }
5413
5414 if (pSta == NULL)
5415 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005416 PELOGE(limLog(pMac, LOGE, "Cannot find station context for delts req");)
Jeff Johnson295189b2012-06-20 16:38:30 -07005417 return eSIR_FAILURE;
5418 }
5419
5420 if ((! pSta->valid) ||
5421 (pSta->mlmStaContext.mlmState != eLIM_MLM_LINK_ESTABLISHED_STATE))
5422 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005423 PELOGE(limLog(pMac, LOGE, "Invalid Sta (or state) for DelTsReq");)
Jeff Johnson295189b2012-06-20 16:38:30 -07005424 return eSIR_FAILURE;
5425 }
5426
5427 pDeltsReq->req.wsmTspecPresent = 0;
5428 pDeltsReq->req.wmeTspecPresent = 0;
5429 pDeltsReq->req.lleTspecPresent = 0;
5430
5431 if ((pSta->wsmEnabled) &&
5432 (pDeltsReq->req.tspec.tsinfo.traffic.accessPolicy != SIR_MAC_ACCESSPOLICY_EDCA))
5433 pDeltsReq->req.wsmTspecPresent = 1;
5434 else if (pSta->wmeEnabled)
5435 pDeltsReq->req.wmeTspecPresent = 1;
5436 else if (pSta->lleEnabled)
5437 pDeltsReq->req.lleTspecPresent = 1;
5438 else
5439 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005440 PELOGW(limLog(pMac, LOGW, FL("DELTS_REQ ignore - qos is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005441 return eSIR_FAILURE;
5442 }
5443
5444 tsinfo = pDeltsReq->req.wmeTspecPresent ? &pDeltsReq->req.tspec.tsinfo
5445 : &pDeltsReq->req.tsinfo;
5446 PELOG1(limLog(pMac, LOG1,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005447 FL("received DELTS_REQ message (wmeTspecPresent = %d, lleTspecPresent = %d, wsmTspecPresent = %d, tsid %d, up %d, direction = %d)"),
Jeff Johnson295189b2012-06-20 16:38:30 -07005448 pDeltsReq->req.wmeTspecPresent, pDeltsReq->req.lleTspecPresent, pDeltsReq->req.wsmTspecPresent,
5449 tsinfo->traffic.tsid, tsinfo->traffic.userPrio, tsinfo->traffic.direction);)
5450
5451 // if no Access Control, ignore the request
Jeff Johnson295189b2012-06-20 16:38:30 -07005452
5453 if (limAdmitControlDeleteTS(pMac, pSta->assocId, tsinfo, &tsStatus, &tspecIdx)
5454 != eSIR_SUCCESS)
5455 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005456 PELOGE(limLog(pMac, LOGE, "ERROR DELTS request for sta assocId %d (tsid %d, up %d)",
Jeff Johnson295189b2012-06-20 16:38:30 -07005457 pSta->assocId, tsinfo->traffic.tsid, tsinfo->traffic.userPrio);)
5458 return eSIR_FAILURE;
5459 }
5460 else if ((tsinfo->traffic.accessPolicy == SIR_MAC_ACCESSPOLICY_HCCA) ||
5461 (tsinfo->traffic.accessPolicy == SIR_MAC_ACCESSPOLICY_BOTH))
5462 {
5463 //edca only now.
5464 }
5465 else
5466 {
5467 if((tsinfo->traffic.accessPolicy == SIR_MAC_ACCESSPOLICY_EDCA) &&
5468 psessionEntry->gLimEdcaParams[upToAc(tsinfo->traffic.userPrio)].aci.acm)
5469 {
5470 //send message to HAL to delete TS
Madan Mohan Koyyalamudic0a75a42013-10-07 04:20:49 +05305471 if(eSIR_SUCCESS != limSendHalMsgDelTs(pMac,
5472 pSta->staIndex,
5473 tspecIdx,
5474 pDeltsReq->req,
5475 psessionEntry->peSessionId,
5476 psessionEntry->bssId))
Jeff Johnson295189b2012-06-20 16:38:30 -07005477 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005478 limLog(pMac, LOGW, FL("DelTs with UP %d failed in limSendHalMsgDelTs - ignoring request"),
Jeff Johnson295189b2012-06-20 16:38:30 -07005479 tsinfo->traffic.userPrio);
5480 return eSIR_FAILURE;
5481 }
5482 }
5483 }
5484 return eSIR_SUCCESS;
5485}
5486
5487/** -------------------------------------------------------------
5488\fn limRegisterHalIndCallBack
5489\brief registers callback function to HAL for any indication.
5490\param tpAniSirGlobal pMac
5491\return none.
5492 -------------------------------------------------------------*/
5493void
5494limRegisterHalIndCallBack(tpAniSirGlobal pMac)
5495{
5496 tSirMsgQ msg;
5497 tpHalIndCB pHalCB;
5498
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305499 pHalCB = vos_mem_malloc(sizeof(tHalIndCB));
5500 if ( NULL == pHalCB )
Jeff Johnson295189b2012-06-20 16:38:30 -07005501 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305502 limLog(pMac, LOGP, FL("AllocateMemory() failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07005503 return;
5504 }
5505
5506 pHalCB->pHalIndCB = limProcessHalIndMessages;
5507
5508 msg.type = WDA_REGISTER_PE_CALLBACK;
5509 msg.bodyptr = pHalCB;
5510 msg.bodyval = 0;
5511
Jeff Johnsone7245742012-09-05 17:12:55 -07005512 MTRACE(macTraceMsgTx(pMac, NO_SESSION, msg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07005513 if(eSIR_SUCCESS != wdaPostCtrlMsg(pMac, &msg))
5514 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305515 vos_mem_free(pHalCB);
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005516 limLog(pMac, LOGP, FL("wdaPostCtrlMsg() failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07005517 }
5518
5519 return;
5520}
5521
5522
5523/** -------------------------------------------------------------
5524\fn limProcessAddBaInd
5525
5526\brief handles the BA activity check timeout indication coming from HAL.
5527 Validates the request, posts request for sending addBaReq message for every candidate in the list.
5528\param tpAniSirGlobal pMac
5529\param tSirMsgQ limMsg
5530\return None
5531-------------------------------------------------------------*/
5532void
5533limProcessAddBaInd(tpAniSirGlobal pMac, tpSirMsgQ limMsg)
5534{
5535 tANI_U8 i;
5536 tANI_U8 tid;
5537 tANI_U16 assocId;
5538 tpDphHashNode pSta;
5539 tpAddBaCandidate pBaCandidate;
5540 tANI_U32 baCandidateCnt;
5541 tpBaActivityInd pBaActivityInd;
5542 tpPESession psessionEntry;
5543 tANI_U8 sessionId;
Gopichand Nakkala681989c2013-03-06 22:27:48 -08005544#ifdef FEATURE_WLAN_TDLS
5545 boolean htCapable = FALSE;
5546#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07005547
5548
Gopichand Nakkala681989c2013-03-06 22:27:48 -08005549 if (limMsg->bodyptr == NULL)
Jeff Johnson295189b2012-06-20 16:38:30 -07005550 return;
5551
5552 pBaActivityInd = (tpBaActivityInd)limMsg->bodyptr;
5553 baCandidateCnt = pBaActivityInd->baCandidateCnt;
5554
Gopichand Nakkala681989c2013-03-06 22:27:48 -08005555 if ((psessionEntry = peFindSessionByBssid(pMac,pBaActivityInd->bssId,&sessionId))== NULL)
Jeff Johnson295189b2012-06-20 16:38:30 -07005556 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005557 limLog(pMac, LOGE,FL("session does not exist for given BSSId"));
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305558 vos_mem_free(limMsg->bodyptr);
Jeff Johnson295189b2012-06-20 16:38:30 -07005559 return;
5560 }
5561
5562 //if we are not HT capable we don't need to handle BA timeout indication from HAL.
Gopichand Nakkala681989c2013-03-06 22:27:48 -08005563#ifdef FEATURE_WLAN_TDLS
5564 if ((baCandidateCnt > pMac->lim.maxStation))
5565#else
5566 if ((baCandidateCnt > pMac->lim.maxStation) || !psessionEntry->htCapability )
5567#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07005568 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305569 vos_mem_free(limMsg->bodyptr);
Jeff Johnson295189b2012-06-20 16:38:30 -07005570 return;
5571 }
Gopichand Nakkala681989c2013-03-06 22:27:48 -08005572
5573#ifdef FEATURE_WLAN_TDLS
5574 //if we have TDLS peers, we should look at peers HT capability, which can be different than
5575 //AP capability
5576 pBaCandidate = (tpAddBaCandidate) (((tANI_U8*)pBaActivityInd) + sizeof(tBaActivityInd));
5577
5578 for (i=0; i<baCandidateCnt; i++, pBaCandidate++)
5579 {
5580 pSta = dphLookupHashEntry(pMac, pBaCandidate->staAddr, &assocId, &psessionEntry->dph.dphHashTable);
5581 if ((NULL == pSta) || (!pSta->valid))
5582 continue;
5583
5584 if (STA_ENTRY_TDLS_PEER == pSta->staType)
5585 htCapable = pSta->mlmStaContext.htCapability;
5586 else
5587 htCapable = psessionEntry->htCapability;
5588
5589 if (htCapable)
5590 break;
5591 }
5592 if (!htCapable)
5593 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305594 vos_mem_free(limMsg->bodyptr);
Gopichand Nakkala681989c2013-03-06 22:27:48 -08005595 return;
5596 }
5597#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07005598
5599 //delete the complete dialoguetoken linked list
5600 limDeleteDialogueTokenList(pMac);
5601 pBaCandidate = (tpAddBaCandidate) (((tANI_U8*)pBaActivityInd) + sizeof(tBaActivityInd));
5602
Gopichand Nakkala681989c2013-03-06 22:27:48 -08005603 for (i=0; i<baCandidateCnt; i++, pBaCandidate++)
Jeff Johnson295189b2012-06-20 16:38:30 -07005604 {
5605 pSta = dphLookupHashEntry(pMac, pBaCandidate->staAddr, &assocId, &psessionEntry->dph.dphHashTable);
Gopichand Nakkala681989c2013-03-06 22:27:48 -08005606 if ((NULL == pSta) || (!pSta->valid))
5607 continue;
Jeff Johnson295189b2012-06-20 16:38:30 -07005608
5609 for (tid=0; tid<STACFG_MAX_TC; tid++)
5610 {
Gopichand Nakkala681989c2013-03-06 22:27:48 -08005611 if((eBA_DISABLE == pSta->tcCfg[tid].fUseBATx) &&
Jeff Johnson295189b2012-06-20 16:38:30 -07005612 (pBaCandidate->baInfo[tid].fBaEnable))
5613 {
Hoonki Lee9af07cf2013-04-24 01:21:58 -07005614 limLog(pMac, LOGE, FL("BA setup for staId = %d, TID: %d, SSN: %d"),
5615 pSta->staIndex, tid, pBaCandidate->baInfo[tid].startingSeqNum);
Jeff Johnson295189b2012-06-20 16:38:30 -07005616 limPostMlmAddBAReq(pMac, pSta, tid, pBaCandidate->baInfo[tid].startingSeqNum,psessionEntry);
5617 }
5618 }
5619 }
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305620 vos_mem_free(limMsg->bodyptr);
Jeff Johnson295189b2012-06-20 16:38:30 -07005621 return;
5622}
5623
5624
5625/** -------------------------------------------------------------
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005626\fn limDeleteBASessions
5627\brief Deletes all the exisitng BA sessions for given session
5628 and BA direction.
Jeff Johnson295189b2012-06-20 16:38:30 -07005629\param tpAniSirGlobal pMac
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005630\param tpPESession pSessionEntry
5631\param tANI_U32 baDirection
5632\return None
Jeff Johnson295189b2012-06-20 16:38:30 -07005633-------------------------------------------------------------*/
5634
5635void
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005636limDeleteBASessions(tpAniSirGlobal pMac, tpPESession pSessionEntry,
5637 tANI_U32 baDirection)
Jeff Johnson295189b2012-06-20 16:38:30 -07005638{
5639 tANI_U32 i;
5640 tANI_U8 tid;
5641 tpDphHashNode pSta;
5642
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005643 if (NULL == pSessionEntry)
Jeff Johnson295189b2012-06-20 16:38:30 -07005644 {
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005645 limLog(pMac, LOGE, FL("Session does not exist"));
5646 }
5647 else
5648 {
5649 for(tid = 0; tid < STACFG_MAX_TC; tid++)
Jeff Johnson295189b2012-06-20 16:38:30 -07005650 {
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005651 if ((eLIM_AP_ROLE == pSessionEntry->limSystemRole) ||
5652 (pSessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE) ||
5653 (eLIM_STA_IN_IBSS_ROLE == pSessionEntry->limSystemRole) ||
5654 (pSessionEntry->limSystemRole == eLIM_P2P_DEVICE_GO))
Jeff Johnson295189b2012-06-20 16:38:30 -07005655 {
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005656 for (i = 0; i < pMac->lim.maxStation; i++)
Jeff Johnson295189b2012-06-20 16:38:30 -07005657 {
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005658 pSta = pSessionEntry->dph.dphHashTable.pDphNodeArray + i;
5659 if (pSta && pSta->added)
Kiran Kumar Lokerec1641f52013-05-29 14:29:43 -07005660 {
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005661 if ((eBA_ENABLE == pSta->tcCfg[tid].fUseBATx) &&
5662 (baDirection & BA_INITIATOR))
5663 {
5664 limPostMlmDelBAReq(pMac, pSta, eBA_INITIATOR, tid,
5665 eSIR_MAC_UNSPEC_FAILURE_REASON,
5666 pSessionEntry);
5667 }
5668 if ((eBA_ENABLE == pSta->tcCfg[tid].fUseBARx) &&
5669 (baDirection & BA_RECIPIENT))
5670 {
5671 limPostMlmDelBAReq(pMac, pSta, eBA_RECIPIENT, tid,
5672 eSIR_MAC_UNSPEC_FAILURE_REASON,
5673 pSessionEntry);
5674 }
Kiran Kumar Lokerec1641f52013-05-29 14:29:43 -07005675 }
Jeff Johnson295189b2012-06-20 16:38:30 -07005676 }
5677 }
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005678 else if ((eLIM_STA_ROLE == pSessionEntry->limSystemRole) ||
5679 (eLIM_BT_AMP_STA_ROLE == pSessionEntry->limSystemRole) ||
5680 (eLIM_P2P_DEVICE_ROLE == pSessionEntry->limSystemRole))
Gopichand Nakkala6a36e142013-06-07 21:23:15 -07005681 {
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005682 pSta = dphGetHashEntry(pMac, DPH_STA_HASH_INDEX_PEER,
5683 &pSessionEntry->dph.dphHashTable);
5684 if (pSta && pSta->added)
Gopichand Nakkala6a36e142013-06-07 21:23:15 -07005685 {
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005686 if ((eBA_ENABLE == pSta->tcCfg[tid].fUseBATx) &&
5687 (baDirection & BA_INITIATOR))
5688 {
5689 limPostMlmDelBAReq(pMac, pSta, eBA_INITIATOR, tid,
5690 eSIR_MAC_UNSPEC_FAILURE_REASON,
5691 pSessionEntry);
5692 }
5693 if ((eBA_ENABLE == pSta->tcCfg[tid].fUseBARx) &&
5694 (baDirection & BA_RECIPIENT))
5695 {
5696 limPostMlmDelBAReq(pMac, pSta, eBA_RECIPIENT, tid,
5697 eSIR_MAC_UNSPEC_FAILURE_REASON,
5698 pSessionEntry);
5699 }
Gopichand Nakkala6a36e142013-06-07 21:23:15 -07005700 }
5701 }
5702 }
Jeff Johnson295189b2012-06-20 16:38:30 -07005703 }
5704}
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005705
5706/** -------------------------------------------------------------
5707\fn limDelAllBASessions
5708\brief Deletes all the exisitng BA sessions.
5709\param tpAniSirGlobal pMac
5710\return None
5711-------------------------------------------------------------*/
5712
5713void limDelAllBASessions(tpAniSirGlobal pMac)
5714{
5715 tANI_U32 i;
5716 tpPESession pSessionEntry;
5717
5718 for (i = 0; i < pMac->lim.maxBssId; i++)
5719 {
5720 pSessionEntry = peFindSessionBySessionId(pMac, i);
5721 if (pSessionEntry)
5722 {
5723 limDeleteBASessions(pMac, pSessionEntry, BA_BOTH_DIRECTIONS);
5724 }
5725 }
5726}
5727
5728/** -------------------------------------------------------------
5729\fn limDelAllBASessionsBtc
5730\brief Deletes all the exisitng BA receipent sessions in 2.4GHz
5731 band.
5732\param tpAniSirGlobal pMac
5733\return None
5734-------------------------------------------------------------*/
5735
5736void limDelAllBASessionsBtc(tpAniSirGlobal pMac)
5737{
5738 tANI_U32 i;
5739 tpPESession pSessionEntry;
5740
5741 for (i = 0; i < pMac->lim.maxBssId; i++)
5742 {
5743 pSessionEntry = peFindSessionBySessionId(pMac, i);
5744 if (pSessionEntry)
5745 {
5746 if (SIR_BAND_2_4_GHZ ==
5747 limGetRFBand(pSessionEntry->currentOperChannel))
5748 {
5749 limDeleteBASessions(pMac, pSessionEntry, BA_RECIPIENT);
5750 }
5751 }
5752 }
5753}
5754
Jeff Johnson295189b2012-06-20 16:38:30 -07005755/** -------------------------------------------------------------
5756\fn limProcessDelTsInd
5757\brief handles the DeleteTS indication coming from HAL or generated by PE itself in some error cases.
5758 Validates the request, sends the DelTs action frame to the Peer and sends DelTs indicatoin to HDD.
5759\param tpAniSirGlobal pMac
5760\param tSirMsgQ limMsg
5761\return None
5762-------------------------------------------------------------*/
5763void
5764limProcessDelTsInd(tpAniSirGlobal pMac, tpSirMsgQ limMsg)
5765{
5766 tpDphHashNode pSta;
5767 tpDelTsParams pDelTsParam = (tpDelTsParams) (limMsg->bodyptr);
5768 tpSirDeltsReq pDelTsReq = NULL;
5769 tSirMacAddr peerMacAddr;
5770 tpSirDeltsReqInfo pDelTsReqInfo;
5771 tpLimTspecInfo pTspecInfo;
5772 tpPESession psessionEntry;
5773 tANI_U8 sessionId;
5774
5775if((psessionEntry = peFindSessionByBssid(pMac,pDelTsParam->bssId,&sessionId))== NULL)
5776 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005777 limLog(pMac, LOGE,FL("session does not exist for given BssId"));
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305778 vos_mem_free(limMsg->bodyptr);
Jeff Johnson295189b2012-06-20 16:38:30 -07005779 return;
5780 }
5781
5782 pTspecInfo = &(pMac->lim.tspecInfo[pDelTsParam->tspecIdx]);
5783 if(pTspecInfo->inuse == false)
5784 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005785 PELOGE(limLog(pMac, LOGE, FL("tspec entry with index %d is not in use"), pDelTsParam->tspecIdx);)
Jeff Johnson295189b2012-06-20 16:38:30 -07005786 goto error1;
5787 }
5788
5789 pSta = dphGetHashEntry(pMac, pTspecInfo->assocId, &psessionEntry->dph.dphHashTable);
5790 if(pSta == NULL)
5791 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005792 limLog(pMac, LOGE, FL("Could not find entry in DPH table for assocId = %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07005793 pTspecInfo->assocId);
5794 goto error1;
5795 }
5796
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305797 pDelTsReq = vos_mem_malloc(sizeof(tSirDeltsReq));
5798 if ( NULL == pDelTsReq )
Jeff Johnson295189b2012-06-20 16:38:30 -07005799 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305800 PELOGE(limLog(pMac, LOGE, FL("AllocateMemory() failed"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005801 goto error1;
5802 }
5803
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305804 vos_mem_set( (tANI_U8 *)pDelTsReq, sizeof(tSirDeltsReq), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07005805
5806 if(pSta->wmeEnabled)
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305807 vos_mem_copy( &(pDelTsReq->req.tspec), &(pTspecInfo->tspec), sizeof(tSirMacTspecIE));
Jeff Johnson295189b2012-06-20 16:38:30 -07005808 else
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305809 vos_mem_copy( &(pDelTsReq->req.tsinfo), &(pTspecInfo->tspec.tsinfo), sizeof(tSirMacTSInfo));
Jeff Johnson295189b2012-06-20 16:38:30 -07005810
5811
5812 //validate the req
5813 if (eSIR_SUCCESS != limValidateDeltsReq(pMac, pDelTsReq, peerMacAddr,psessionEntry))
5814 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005815 PELOGE(limLog(pMac, LOGE, FL("limValidateDeltsReq failed"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005816 goto error2;
5817 }
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005818 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 -07005819 pDelTsReq->aid, peerMacAddr[0], peerMacAddr[1], peerMacAddr[2],
5820 peerMacAddr[3], peerMacAddr[4], peerMacAddr[5]);)
5821
5822 limSendDeltsReqActionFrame(pMac, peerMacAddr, pDelTsReq->req.wmeTspecPresent, &pDelTsReq->req.tsinfo, &pDelTsReq->req.tspec,
5823 psessionEntry);
5824
5825 // prepare and send an sme indication to HDD
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305826 pDelTsReqInfo = vos_mem_malloc(sizeof(tSirDeltsReqInfo));
5827 if ( NULL == pDelTsReqInfo )
Jeff Johnson295189b2012-06-20 16:38:30 -07005828 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305829 PELOGE(limLog(pMac, LOGE, FL("AllocateMemory() failed"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005830 goto error3;
5831 }
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305832 vos_mem_set( (tANI_U8 *)pDelTsReqInfo, sizeof(tSirDeltsReqInfo), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07005833
5834 if(pSta->wmeEnabled)
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305835 vos_mem_copy( &(pDelTsReqInfo->tspec), &(pTspecInfo->tspec), sizeof(tSirMacTspecIE));
Jeff Johnson295189b2012-06-20 16:38:30 -07005836 else
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305837 vos_mem_copy( &(pDelTsReqInfo->tsinfo), &(pTspecInfo->tspec.tsinfo), sizeof(tSirMacTSInfo));
Jeff Johnson295189b2012-06-20 16:38:30 -07005838
5839 limSendSmeDeltsInd(pMac, pDelTsReqInfo, pDelTsReq->aid,psessionEntry);
5840
5841error3:
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305842 vos_mem_free(pDelTsReqInfo);
Jeff Johnson295189b2012-06-20 16:38:30 -07005843error2:
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305844 vos_mem_free(pDelTsReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07005845error1:
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305846 vos_mem_free(limMsg->bodyptr);
Jeff Johnson295189b2012-06-20 16:38:30 -07005847 return;
5848}
5849
5850/**
5851 * \brief Setup an A-MPDU/BA session
5852 *
5853 * \sa limPostMlmAddBAReq
5854 *
5855 * \param pMac The global tpAniSirGlobal object
5856 *
5857 * \param pStaDs DPH Hash Node object of peer STA
5858 *
5859 * \param tid TID for which a BA is being setup.
5860 * If this is set to 0xFFFF, then we retrieve
5861 * the default TID from the CFG
5862 *
5863 * \return eSIR_SUCCESS if setup completes successfully
5864 * eSIR_FAILURE is some problem is encountered
5865 */
5866tSirRetStatus limPostMlmAddBAReq( tpAniSirGlobal pMac,
5867 tpDphHashNode pStaDs,
5868 tANI_U8 tid, tANI_U16 startingSeqNum,tpPESession psessionEntry)
5869{
5870 tSirRetStatus status = eSIR_SUCCESS;
Jeff Johnson09fb4cd2013-04-03 15:27:59 -07005871 tpLimMlmAddBAReq pMlmAddBAReq = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07005872 tpDialogueToken dialogueTokenNode;
5873 tANI_U32 val = 0;
Jeff Johnson09fb4cd2013-04-03 15:27:59 -07005874
Jeff Johnson295189b2012-06-20 16:38:30 -07005875 // Check if the peer is a 11n capable STA
5876 // FIXME - Need a 11n peer indication in DPH.
5877 // For now, using the taurusPeer attribute
5878 //if( 0 == pStaDs->taurusPeer == )
5879 //return eSIR_SUCCESS;
5880
5881 // Allocate for LIM_MLM_ADDBA_REQ
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305882 pMlmAddBAReq = vos_mem_malloc(sizeof( tLimMlmAddBAReq ));
5883 if ( NULL == pMlmAddBAReq )
Jeff Johnson295189b2012-06-20 16:38:30 -07005884 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305885 limLog( pMac, LOGP, FL("AllocateMemory failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07005886 status = eSIR_MEM_ALLOC_FAILED;
5887 goto returnFailure;
5888 }
5889
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305890 vos_mem_set( (void *) pMlmAddBAReq, sizeof( tLimMlmAddBAReq ), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07005891
5892 // Copy the peer MAC
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305893 vos_mem_copy(
Jeff Johnson295189b2012-06-20 16:38:30 -07005894 pMlmAddBAReq->peerMacAddr,
5895 pStaDs->staAddr,
5896 sizeof( tSirMacAddr ));
5897
5898 // Update the TID
5899 pMlmAddBAReq->baTID = tid;
5900
5901 // Determine the supported BA policy of local STA
5902 // for the TID of interest
5903 pMlmAddBAReq->baPolicy = (pStaDs->baPolicyFlag >> tid) & 0x1;
5904
5905 // BA Buffer Size
5906 // Requesting the ADDBA recipient to populate the size.
5907 // If ADDBA is accepted, a non-zero buffer size should
5908 // be returned in the ADDBA Rsp
5909 pMlmAddBAReq->baBufferSize = 0;
5910
5911 limLog( pMac, LOGW,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005912 FL( "Requesting an ADDBA to setup a %s BA session with STA %d for TID %d" ),
Jeff Johnson295189b2012-06-20 16:38:30 -07005913 (pMlmAddBAReq->baPolicy ? "Immediate": "Delayed"),
5914 pStaDs->staIndex,
5915 tid );
5916
5917 // BA Timeout
Jeff Johnson09fb4cd2013-04-03 15:27:59 -07005918 if (wlan_cfgGetInt(pMac, WNI_CFG_BA_TIMEOUT, &val) != eSIR_SUCCESS)
Jeff Johnson295189b2012-06-20 16:38:30 -07005919 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005920 limLog(pMac, LOGE, FL("could not retrieve BA TIME OUT Param CFG"));
Jeff Johnson295189b2012-06-20 16:38:30 -07005921 status = eSIR_FAILURE;
5922 goto returnFailure;
5923 }
5924 pMlmAddBAReq->baTimeout = val; // In TU's
5925
5926 // ADDBA Failure Timeout
Jeff Johnson09fb4cd2013-04-03 15:27:59 -07005927 // FIXME_AMPDU - Need to retrieve this from CFG.
Jeff Johnson295189b2012-06-20 16:38:30 -07005928 //right now we are not checking for response timeout. so this field is dummy just to be compliant with the spec.
5929 pMlmAddBAReq->addBAFailureTimeout = 2000; // In TU's
5930
5931 // BA Starting Sequence Number
5932 pMlmAddBAReq->baSSN = startingSeqNum;
5933
5934 /* Update PE session Id*/
5935 pMlmAddBAReq->sessionId = psessionEntry->peSessionId;
5936
5937 LIM_SET_STA_BA_STATE(pStaDs, tid, eLIM_BA_STATE_WT_ADD_RSP);
5938
Jeff Johnson09fb4cd2013-04-03 15:27:59 -07005939 dialogueTokenNode = limAssignDialogueToken(pMac);
5940 if (NULL == dialogueTokenNode)
5941 {
5942 limLog(pMac, LOGE, FL("could not assign dialogue token"));
5943 status = eSIR_FAILURE;
5944 goto returnFailure;
5945 }
5946
Jeff Johnson295189b2012-06-20 16:38:30 -07005947 pMlmAddBAReq->baDialogToken = dialogueTokenNode->token;
Jeff Johnson09fb4cd2013-04-03 15:27:59 -07005948 //set assocId and tid information in the lim linked list
Jeff Johnson295189b2012-06-20 16:38:30 -07005949 dialogueTokenNode->assocId = pStaDs->assocId;
5950 dialogueTokenNode->tid = tid;
5951 // Send ADDBA Req to MLME
5952 limPostMlmMessage( pMac,
5953 LIM_MLM_ADDBA_REQ,
5954 (tANI_U32 *) pMlmAddBAReq );
Jeff Johnson09fb4cd2013-04-03 15:27:59 -07005955 return eSIR_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -07005956
5957returnFailure:
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305958 vos_mem_free(pMlmAddBAReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07005959 return status;
5960}
5961
5962/**
5963 * \brief Post LIM_MLM_ADDBA_RSP to MLME. MLME
5964 * will then send an ADDBA Rsp to peer MAC entity
5965 * with the appropriate ADDBA status code
5966 *
5967 * \sa limPostMlmAddBARsp
5968 *
5969 * \param pMac The global tpAniSirGlobal object
5970 *
5971 * \param peerMacAddr MAC address of peer entity that will
5972 * be the recipient of this ADDBA Rsp
5973 *
5974 * \param baStatusCode ADDBA Rsp status code
5975 *
5976 * \param baDialogToken ADDBA Rsp dialog token
5977 *
5978 * \param baTID TID of interest
5979 *
5980 * \param baPolicy The BA policy
5981 *
5982 * \param baBufferSize The BA buffer size
5983 *
5984 * \param baTimeout BA timeout in TU's
5985 *
5986 * \return eSIR_SUCCESS if setup completes successfully
5987 * eSIR_FAILURE is some problem is encountered
5988 */
5989tSirRetStatus limPostMlmAddBARsp( tpAniSirGlobal pMac,
5990 tSirMacAddr peerMacAddr,
5991 tSirMacStatusCodes baStatusCode,
5992 tANI_U8 baDialogToken,
5993 tANI_U8 baTID,
5994 tANI_U8 baPolicy,
5995 tANI_U16 baBufferSize,
5996 tANI_U16 baTimeout,
5997 tpPESession psessionEntry)
5998{
5999tSirRetStatus status = eSIR_SUCCESS;
6000tpLimMlmAddBARsp pMlmAddBARsp;
6001
6002 // Allocate for LIM_MLM_ADDBA_RSP
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306003 pMlmAddBARsp = vos_mem_malloc(sizeof( tLimMlmAddBARsp ));
6004 if ( NULL == pMlmAddBARsp )
Jeff Johnson295189b2012-06-20 16:38:30 -07006005 {
6006 limLog( pMac, LOGE,
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306007 FL("AllocateMemory failed with error code %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07006008 status );
6009
6010 status = eSIR_MEM_ALLOC_FAILED;
6011 goto returnFailure;
6012 }
6013
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306014 vos_mem_set( (void *) pMlmAddBARsp, sizeof( tLimMlmAddBARsp ), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07006015
6016 // Copy the peer MAC
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306017 vos_mem_copy(
Jeff Johnson295189b2012-06-20 16:38:30 -07006018 pMlmAddBARsp->peerMacAddr,
6019 peerMacAddr,
6020 sizeof( tSirMacAddr ));
6021
6022 pMlmAddBARsp->baDialogToken = baDialogToken;
6023 pMlmAddBARsp->addBAResultCode = baStatusCode;
6024 pMlmAddBARsp->baTID = baTID;
6025 pMlmAddBARsp->baPolicy = baPolicy;
6026 pMlmAddBARsp->baBufferSize = baBufferSize;
6027 pMlmAddBARsp->baTimeout = baTimeout;
6028
6029 /* UPdate PE session ID*/
6030 pMlmAddBARsp->sessionId = psessionEntry->peSessionId;
6031
6032 // Send ADDBA Rsp to MLME
6033 limPostMlmMessage( pMac,
6034 LIM_MLM_ADDBA_RSP,
6035 (tANI_U32 *) pMlmAddBARsp );
6036
6037returnFailure:
6038
6039 return status;
6040}
6041
6042/**
6043 * \brief Post LIM_MLM_DELBA_REQ to MLME. MLME
6044 * will then send an DELBA Ind to peer MAC entity
6045 * with the appropriate DELBA status code
6046 *
6047 * \sa limPostMlmDelBAReq
6048 *
6049 * \param pMac The global tpAniSirGlobal object
6050 *
6051 * \param pSta DPH Hash Node object of peer MAC entity
6052 * for which the BA session is being deleted
6053 *
6054 * \param baDirection DELBA direction
6055 *
6056 * \param baTID TID for which the BA session is being deleted
6057 *
6058 * \param baReasonCode DELBA Req reason code
6059 *
6060 * \return eSIR_SUCCESS if setup completes successfully
6061 * eSIR_FAILURE is some problem is encountered
6062 */
6063tSirRetStatus limPostMlmDelBAReq( tpAniSirGlobal pMac,
6064 tpDphHashNode pSta,
6065 tANI_U8 baDirection,
6066 tANI_U8 baTID,
6067 tSirMacReasonCodes baReasonCode,
6068 tpPESession psessionEntry)
6069{
6070tSirRetStatus status = eSIR_SUCCESS;
6071tpLimMlmDelBAReq pMlmDelBAReq;
6072tLimBAState curBaState;
6073
6074if(NULL == pSta)
6075 return eSIR_FAILURE;
6076
6077LIM_GET_STA_BA_STATE(pSta, baTID, &curBaState);
6078
6079 // Need to validate the current BA State.
6080 if( eLIM_BA_STATE_IDLE != curBaState)
6081 {
6082 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006083 FL( "Received unexpected DELBA REQ when STA BA state for tid = %d is %d" ),
Jeff Johnson295189b2012-06-20 16:38:30 -07006084 baTID,
6085 curBaState);
6086
6087 status = eSIR_FAILURE;
6088 goto returnFailure;
6089 }
6090
6091 // Allocate for LIM_MLM_DELBA_REQ
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306092 pMlmDelBAReq = vos_mem_malloc(sizeof( tLimMlmDelBAReq ));
6093 if ( NULL == pMlmDelBAReq )
Jeff Johnson295189b2012-06-20 16:38:30 -07006094 {
6095 limLog( pMac, LOGE,
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306096 FL("AllocateMemory failed with error code %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07006097 status );
6098
6099 status = eSIR_MEM_ALLOC_FAILED;
6100 goto returnFailure;
6101 }
6102
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306103 vos_mem_set( (void *) pMlmDelBAReq, sizeof( tLimMlmDelBAReq ), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07006104
6105 // Copy the peer MAC
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306106 vos_mem_copy(
Jeff Johnson295189b2012-06-20 16:38:30 -07006107 pMlmDelBAReq->peerMacAddr,
6108 pSta->staAddr,
6109 sizeof( tSirMacAddr ));
6110
6111 pMlmDelBAReq->baDirection = baDirection;
6112 pMlmDelBAReq->baTID = baTID;
6113 pMlmDelBAReq->delBAReasonCode = baReasonCode;
6114
6115 /* Update PE session ID*/
6116 pMlmDelBAReq->sessionId = psessionEntry->peSessionId;
6117
6118 //we don't have valid BA session for the given direction.
6119 // HDD wants to get the BA session deleted on PEER in this case.
6120 // in this case we just need to send DelBA to the peer.
6121 if(((eBA_RECIPIENT == baDirection) && (eBA_DISABLE == pSta->tcCfg[baTID].fUseBARx)) ||
6122 ((eBA_INITIATOR == baDirection) && (eBA_DISABLE == pSta->tcCfg[baTID].fUseBATx)))
6123 {
6124 // Send DELBA Ind over the air
6125 if( eSIR_SUCCESS !=
6126 (status = limSendDelBAInd( pMac, pMlmDelBAReq,psessionEntry)))
6127 status = eSIR_FAILURE;
6128
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306129 vos_mem_free(pMlmDelBAReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07006130 return status;
6131 }
6132
6133
6134 // Update the BA state in STA
6135 LIM_SET_STA_BA_STATE(pSta, pMlmDelBAReq->baTID, eLIM_BA_STATE_WT_DEL_RSP);
6136
6137 // Send DELBA Req to MLME
6138 limPostMlmMessage( pMac,
6139 LIM_MLM_DELBA_REQ,
6140 (tANI_U32 *) pMlmDelBAReq );
6141
6142returnFailure:
6143
6144 return status;
6145}
6146
6147/**
6148 * \brief Send WDA_ADDBA_REQ to HAL, in order
6149 * to setup a new BA session with a peer
6150 *
6151 * \sa limPostMsgAddBAReq
6152 *
6153 * \param pMac The global tpAniSirGlobal object
6154 *
6155 * \param pSta Runtime, STA-related configuration cached
6156 * in the HashNode object
6157 *
6158 * \param baDialogToken The Action Frame dialog token
6159 *
6160 * \param baTID TID for which the BA session is being setup
6161 *
6162 * \param baPolicy BA Policy
6163 *
6164 * \param baBufferSize The requested BA buffer size
6165 *
6166 * \param baTimeout BA Timeout. 0 indicates no BA timeout enforced
6167 *
6168 * \param baSSN Starting Sequence Number for this BA session
6169 *
6170 * \param baDirection BA Direction: 1 - Initiator, 0 - Recipient
6171 *
6172 * \return none
6173 *
6174 */
6175tSirRetStatus limPostMsgAddBAReq( tpAniSirGlobal pMac,
6176 tpDphHashNode pSta,
6177 tANI_U8 baDialogToken,
6178 tANI_U8 baTID,
6179 tANI_U8 baPolicy,
6180 tANI_U16 baBufferSize,
6181 tANI_U16 baTimeout,
6182 tANI_U16 baSSN,
6183 tANI_U8 baDirection,
6184 tpPESession psessionEntry)
6185{
6186tpAddBAParams pAddBAParams = NULL;
6187tSirRetStatus retCode = eSIR_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -07006188tSirMsgQ msgQ;
6189
6190#ifdef WLAN_SOFTAP_VSTA_FEATURE
6191 // we can only do BA on "hard" STAs
6192 if (!(IS_HWSTA_IDX(pSta->staIndex)))
6193 {
6194 retCode = eHAL_STATUS_FAILURE;
6195 goto returnFailure;
6196 }
6197#endif //WLAN_SOFTAP_VSTA_FEATURE
6198
6199 // Allocate for WDA_ADDBA_REQ
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306200 pAddBAParams = vos_mem_malloc(sizeof( tAddBAParams ));
6201 if ( NULL == pAddBAParams )
Jeff Johnson295189b2012-06-20 16:38:30 -07006202 {
6203 limLog( pMac, LOGE,
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306204 FL("AllocateMemory failed")
6205 );
Jeff Johnson295189b2012-06-20 16:38:30 -07006206
6207 retCode = eSIR_MEM_ALLOC_FAILED;
6208 goto returnFailure;
6209 }
6210
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306211 vos_mem_set( (void *) pAddBAParams, sizeof( tAddBAParams ), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07006212
6213 // Copy the peer MAC address
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306214 vos_mem_copy(
Jeff Johnson295189b2012-06-20 16:38:30 -07006215 (void *) pAddBAParams->peerMacAddr,
6216 (void *) pSta->staAddr,
6217 sizeof( tSirMacAddr ));
6218
6219 // Populate the REQ parameters
6220 pAddBAParams->staIdx = pSta->staIndex;
6221 pAddBAParams->baDialogToken = baDialogToken;
6222 pAddBAParams->baTID = baTID;
6223 pAddBAParams->baPolicy = baPolicy;
6224 pAddBAParams->baBufferSize = baBufferSize;
6225 pAddBAParams->baTimeout = baTimeout;
6226 pAddBAParams->baSSN = baSSN;
6227 pAddBAParams->baDirection = baDirection;
6228 pAddBAParams->respReqd = 1;
6229
6230 /* UPdate PE session ID */
6231 pAddBAParams->sessionId = psessionEntry->peSessionId;
6232
6233 // Post WDA_ADDBA_REQ to HAL.
6234 msgQ.type = WDA_ADDBA_REQ;
6235 //
6236 // FIXME_AMPDU
6237 // A global counter (dialog token) is required to keep track of
6238 // all PE <-> HAL communication(s)
6239 //
6240 msgQ.reserved = 0;
6241 msgQ.bodyptr = pAddBAParams;
6242 msgQ.bodyval = 0;
6243
6244 limLog( pMac, LOGW,
6245 FL( "Sending WDA_ADDBA_REQ..." ));
6246
6247 //defer any other message until we get response back.
6248 SET_LIM_PROCESS_DEFD_MESGS(pMac, false);
6249
Jeff Johnsone7245742012-09-05 17:12:55 -07006250 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07006251#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
6252 limDiagEventReport(pMac, WLAN_PE_DIAG_HAL_ADDBA_REQ_EVENT, psessionEntry, 0, 0);
6253#endif //FEATURE_WLAN_DIAG_SUPPORT
6254
6255 if( eSIR_SUCCESS != (retCode = wdaPostCtrlMsg( pMac, &msgQ )))
6256 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006257 FL("Posting WDA_ADDBA_REQ to HAL failed! Reason = %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07006258 retCode );
6259 else
6260 return retCode;
6261
6262returnFailure:
6263
6264 // Clean-up...
6265 if( NULL != pAddBAParams )
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306266 vos_mem_free( pAddBAParams );
Jeff Johnson295189b2012-06-20 16:38:30 -07006267
6268 return retCode;
6269
6270}
6271
6272/**
6273 * \brief Send WDA_DELBA_IND to HAL, in order
6274 * to delete an existing BA session with peer
6275 *
6276 * \sa limPostMsgDelBAInd
6277 *
6278 * \param pMac The global tpAniSirGlobal object
6279 *
6280 * \param pSta Runtime, STA-related configuration cached
6281 * in the HashNode object
6282 *
6283 * \param baTID TID for which the BA session is being setup
6284 *
6285 * \param baDirection Identifies whether the DELBA Ind was
6286 * sent by the BA initiator or recipient
6287 *
6288 * \return none
6289 *
6290 */
6291tSirRetStatus limPostMsgDelBAInd( tpAniSirGlobal pMac,
6292 tpDphHashNode pSta,
6293 tANI_U8 baTID,
6294 tANI_U8 baDirection,
6295 tpPESession psessionEntry)
6296{
6297tpDelBAParams pDelBAParams = NULL;
6298tSirRetStatus retCode = eSIR_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -07006299tSirMsgQ msgQ;
6300
6301 // Allocate for SIR_HAL_DELBA_IND
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306302 pDelBAParams = vos_mem_malloc(sizeof( tDelBAParams ));
6303 if ( NULL == pDelBAParams )
Jeff Johnson295189b2012-06-20 16:38:30 -07006304 {
6305 limLog( pMac, LOGE,
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306306 FL("AllocateMemory failed")
6307 );
Jeff Johnson295189b2012-06-20 16:38:30 -07006308
6309 retCode = eSIR_MEM_ALLOC_FAILED;
6310 goto returnFailure;
6311 }
6312
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306313 vos_mem_set( (void *) pDelBAParams, sizeof( tDelBAParams ), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07006314
6315 // Populate the REQ parameters
6316 pDelBAParams->staIdx = pSta->staIndex;
6317 pDelBAParams->baTID = baTID;
6318 pDelBAParams->baDirection = baDirection;
6319
6320 /* Update PE session ID */
6321
6322
6323 //TBD-RAJESH Updating of the session ID is requird for SIR_HAL_DELBA_IND?????
6324 //pDelBAParams->sessionId = psessionEntry->peSessionId;
6325
6326 // Post WDA_DELBA_IND to HAL.
6327 msgQ.type = WDA_DELBA_IND;
6328 //
6329 // FIXME:
6330 // A global counter (dialog token) is required to keep track of
6331 // all PE <-> HAL communication(s)
6332 //
6333 msgQ.reserved = 0;
6334 msgQ.bodyptr = pDelBAParams;
6335 msgQ.bodyval = 0;
6336
6337 limLog( pMac, LOGW,
6338 FL( "Sending SIR_HAL_DELBA_IND..." ));
6339
Jeff Johnsone7245742012-09-05 17:12:55 -07006340 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07006341#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
6342 limDiagEventReport(pMac, WLAN_PE_DIAG_HAL_DELBA_IND_EVENT, psessionEntry, 0, 0);
6343#endif //FEATURE_WLAN_DIAG_SUPPORT
6344
6345 if( eSIR_SUCCESS != (retCode = wdaPostCtrlMsg( pMac, &msgQ )))
6346 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006347 FL("Posting WDA_DELBA_IND to HAL failed! Reason = %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07006348 retCode );
6349 else
6350 {
6351 // Update LIM's internal cache...
6352 if( eBA_INITIATOR == baDirection)
6353 {
6354 pSta->tcCfg[baTID].fUseBATx = 0;
6355 pSta->tcCfg[baTID].txBufSize = 0;
6356 }
6357 else
6358 {
6359 pSta->tcCfg[baTID].fUseBARx = 0;
6360 pSta->tcCfg[baTID].rxBufSize = 0;
6361 }
6362
6363 return retCode;
6364 }
6365
6366returnFailure:
6367
6368 // Clean-up...
6369 if( NULL != pDelBAParams )
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306370 vos_mem_free( pDelBAParams );
Jeff Johnson295189b2012-06-20 16:38:30 -07006371
6372 return retCode;
6373
6374}
6375
6376/**
6377 * @function : limPostSMStateUpdate()
6378 *
6379 * @brief : This function Updates the HAL and Softmac about the change in the STA's SMPS state.
6380 *
6381 * LOGIC:
6382 *
6383 * ASSUMPTIONS:
6384 * NA
6385 *
6386 * NOTE:
6387 * NA
6388 *
6389 * @param pMac - Pointer to Global MAC structure
6390 * @param limMsg - Lim Message structure object with the MimoPSparam in body
6391 * @return None
6392 */
6393tSirRetStatus
6394limPostSMStateUpdate(tpAniSirGlobal pMac,
6395 tANI_U16 staIdx, tSirMacHTMIMOPowerSaveState state)
6396{
6397 tSirRetStatus retCode = eSIR_SUCCESS;
6398 tSirMsgQ msgQ;
Jeff Johnson295189b2012-06-20 16:38:30 -07006399 tpSetMIMOPS pMIMO_PSParams;
6400
6401 msgQ.reserved = 0;
6402 msgQ.type = WDA_SET_MIMOPS_REQ;
6403
6404 // Allocate for WDA_SET_MIMOPS_REQ
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306405 pMIMO_PSParams = vos_mem_malloc(sizeof(tSetMIMOPS));
6406 if ( NULL == pMIMO_PSParams )
6407 {
6408 limLog( pMac, LOGP,FL(" AllocateMemory failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07006409 return eSIR_MEM_ALLOC_FAILED;
6410 }
6411
6412 pMIMO_PSParams->htMIMOPSState = state;
6413 pMIMO_PSParams->staIdx = staIdx;
6414 pMIMO_PSParams->fsendRsp = true;
6415 msgQ.bodyptr = pMIMO_PSParams;
6416 msgQ.bodyval = 0;
6417
6418 limLog( pMac, LOG2, FL( "Sending WDA_SET_MIMOPS_REQ..." ));
6419
Jeff Johnsone7245742012-09-05 17:12:55 -07006420 MTRACE(macTraceMsgTx(pMac, NO_SESSION, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07006421 retCode = wdaPostCtrlMsg( pMac, &msgQ );
6422 if (eSIR_SUCCESS != retCode)
6423 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006424 limLog( pMac, LOGP, FL("Posting WDA_SET_MIMOPS_REQ to HAL failed! Reason = %d"), retCode );
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306425 vos_mem_free(pMIMO_PSParams);
Jeff Johnson295189b2012-06-20 16:38:30 -07006426 return retCode;
6427 }
6428
6429 return retCode;
6430}
6431
6432void limPktFree (
6433 tpAniSirGlobal pMac,
6434 eFrameType frmType,
6435 tANI_U8 *pRxPacketInfo,
6436 void *pBody)
6437{
6438 (void) pMac; (void) frmType; (void) pRxPacketInfo; (void) pBody;
Jeff Johnson295189b2012-06-20 16:38:30 -07006439}
6440
6441/**
6442 * limGetBDfromRxPacket()
6443 *
6444 *FUNCTION:
6445 * This function is called to get pointer to Polaris
6446 * Buffer Descriptor containing MAC header & other control
6447 * info from the body of the message posted to LIM.
6448 *
6449 *LOGIC:
6450 * NA
6451 *
6452 *ASSUMPTIONS:
6453 * NA
6454 *
6455 *NOTE:
6456 * NA
6457 *
6458 * @param body - Received message body
6459 * @param pRxPacketInfo - Pointer to received BD
6460 * @return None
6461 */
6462
6463void
6464limGetBDfromRxPacket(tpAniSirGlobal pMac, void *body, tANI_U32 **pRxPacketInfo)
6465{
Jeff Johnson295189b2012-06-20 16:38:30 -07006466 *pRxPacketInfo = (tANI_U32 *) body;
Jeff Johnson295189b2012-06-20 16:38:30 -07006467} /*** end limGetBDfromRxPacket() ***/
6468
6469
6470
6471
6472
6473void limRessetScanChannelInfo(tpAniSirGlobal pMac)
6474{
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306475 vos_mem_set(&pMac->lim.scanChnInfo, sizeof(tLimScanChnInfo), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07006476}
6477
6478
6479void limAddScanChannelInfo(tpAniSirGlobal pMac, tANI_U8 channelId)
6480{
6481 tANI_U8 i;
6482 tANI_BOOLEAN fFound = eANI_BOOLEAN_FALSE;
6483
6484 for(i = 0; i < pMac->lim.scanChnInfo.numChnInfo; i++)
6485 {
6486 if(pMac->lim.scanChnInfo.scanChn[i].channelId == channelId)
6487 {
6488 pMac->lim.scanChnInfo.scanChn[i].numTimeScan++;
6489 fFound = eANI_BOOLEAN_TRUE;
6490 break;
6491 }
6492 }
6493 if(eANI_BOOLEAN_FALSE == fFound)
6494 {
6495 if(pMac->lim.scanChnInfo.numChnInfo < SIR_MAX_SUPPORTED_CHANNEL_LIST)
6496 {
6497 pMac->lim.scanChnInfo.scanChn[pMac->lim.scanChnInfo.numChnInfo].channelId = channelId;
6498 pMac->lim.scanChnInfo.scanChn[pMac->lim.scanChnInfo.numChnInfo++].numTimeScan = 1;
6499 }
6500 else
6501 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006502 PELOGW(limLog(pMac, LOGW, FL(" -- number of channels exceed mac"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07006503 }
6504 }
6505}
6506
6507
6508/**
6509 * @function : limIsChannelValidForChannelSwitch()
6510 *
6511 * @brief : This function checks if the channel to which AP
6512 * is expecting us to switch, is a valid channel for us.
6513 * LOGIC:
6514 *
6515 * ASSUMPTIONS:
6516 * NA
6517 *
6518 * NOTE:
6519 * NA
6520 *
6521 * @param pMac - Pointer to Global MAC structure
6522 * @param channel - New channel to which we are expected to move
6523 * @return None
6524 */
6525tAniBool
6526limIsChannelValidForChannelSwitch(tpAniSirGlobal pMac, tANI_U8 channel)
6527{
6528 tANI_U8 index;
6529 tANI_U32 validChannelListLen = WNI_CFG_VALID_CHANNEL_LIST_LEN;
6530 tSirMacChanNum validChannelList[WNI_CFG_VALID_CHANNEL_LIST_LEN];
6531
6532 if (wlan_cfgGetStr(pMac, WNI_CFG_VALID_CHANNEL_LIST,
6533 (tANI_U8 *)validChannelList,
6534 (tANI_U32 *)&validChannelListLen) != eSIR_SUCCESS)
6535 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006536 PELOGE(limLog(pMac, LOGE, FL("could not retrieve valid channel list"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07006537 return (eSIR_FALSE);
6538 }
6539
6540 for(index = 0; index < validChannelListLen; index++)
6541 {
6542 if(validChannelList[index] == channel)
6543 return (eSIR_TRUE);
6544 }
6545
6546 /* channel does not belong to list of valid channels */
6547 return (eSIR_FALSE);
6548}
6549
6550/**------------------------------------------------------
6551\fn __limFillTxControlParams
6552\brief Fill the message for stopping/resuming tx.
6553
6554\param pMac
6555\param pTxCtrlMsg - Pointer to tx control message.
6556\param type - Which way we want to stop/ resume tx.
6557\param mode - To stop/resume.
6558 -------------------------------------------------------*/
6559static eHalStatus
6560__limFillTxControlParams(tpAniSirGlobal pMac, tpTxControlParams pTxCtrlMsg,
6561 tLimQuietTxMode type, tLimControlTx mode)
6562{
6563
6564 //TBD-RAJESH HOW TO GET sessionEntry?????
6565 tpPESession psessionEntry = &pMac->lim.gpSession[0];
6566
6567 if (mode == eLIM_STOP_TX)
6568 pTxCtrlMsg->stopTx = eANI_BOOLEAN_TRUE;
6569 else
6570 pTxCtrlMsg->stopTx = eANI_BOOLEAN_FALSE;
6571
6572 switch (type)
6573 {
6574 case eLIM_TX_ALL:
6575 /** Stops/resumes transmission completely */
6576 pTxCtrlMsg->fCtrlGlobal = 1;
6577 break;
6578
6579 case eLIM_TX_BSS_BUT_BEACON:
6580 /** Stops/resumes transmission on a particular BSS. Stopping BSS, doesnt
6581 * stop beacon transmission.
6582 */
6583 pTxCtrlMsg->ctrlBss = 1;
6584 pTxCtrlMsg->bssBitmap |= (1 << psessionEntry->bssIdx);
6585 break;
6586
6587 case eLIM_TX_STA:
6588 /** Memory for station bitmap is allocated dynamically in caller of this
6589 * so decode properly here and fill the bitmap. Now not implemented,
6590 * fall through.
6591 */
6592 case eLIM_TX_BSS:
6593 //Fall thru...
6594 default:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006595 PELOGW(limLog(pMac, LOGW, FL("Invalid case: Not Handled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07006596 return eHAL_STATUS_FAILURE;
6597 }
6598
6599 return eHAL_STATUS_SUCCESS;
6600}
6601
6602/**
6603 * @function : limFrameTransmissionControl()
6604 *
6605 * @brief : This API is called by the user to halt/resume any frame
6606 * transmission from the device. If stopped, all frames will be
6607 * queued starting from hardware. Then back-pressure
6608 * is built till the driver.
6609 * LOGIC:
6610 *
6611 * ASSUMPTIONS:
6612 * NA
6613 *
6614 * NOTE:
6615 * NA
6616 *
6617 * @param pMac - Pointer to Global MAC structure
6618 * @return None
6619 */
6620void limFrameTransmissionControl(tpAniSirGlobal pMac, tLimQuietTxMode type, tLimControlTx mode)
6621{
6622
6623 eHalStatus status = eHAL_STATUS_FAILURE;
6624 tpTxControlParams pTxCtrlMsg;
6625 tSirMsgQ msgQ;
6626 tANI_U8 nBytes = 0; // No of bytes required for station bitmap.
6627
6628 /** Allocate only required number of bytes for station bitmap
6629 * Make it to align to 4 byte boundary */
6630 nBytes = (tANI_U8)HALMSG_NUMBYTES_STATION_BITMAP(pMac->lim.maxStation);
6631
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306632 pTxCtrlMsg = vos_mem_malloc(sizeof(*pTxCtrlMsg) + nBytes);
6633 if ( NULL == pTxCtrlMsg )
Jeff Johnson295189b2012-06-20 16:38:30 -07006634 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306635 limLog(pMac, LOGP, FL("AllocateMemory() failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07006636 return;
6637 }
6638
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306639 vos_mem_set((void *) pTxCtrlMsg,
6640 (sizeof(*pTxCtrlMsg) + nBytes), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07006641 status = __limFillTxControlParams(pMac, pTxCtrlMsg, type, mode);
6642 if (status != eHAL_STATUS_SUCCESS)
6643 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306644 vos_mem_free(pTxCtrlMsg);
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006645 limLog(pMac, LOGP, FL("__limFillTxControlParams failed, status = %d"), status);
Jeff Johnson295189b2012-06-20 16:38:30 -07006646 return;
6647 }
6648
6649 msgQ.bodyptr = (void *) pTxCtrlMsg;
6650 msgQ.bodyval = 0;
6651 msgQ.reserved = 0;
6652 msgQ.type = WDA_TRANSMISSION_CONTROL_IND;
6653
Jeff Johnsone7245742012-09-05 17:12:55 -07006654 MTRACE(macTraceMsgTx(pMac, NO_SESSION, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07006655 if(wdaPostCtrlMsg( pMac, &msgQ) != eSIR_SUCCESS)
6656 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306657 vos_mem_free(pTxCtrlMsg);
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006658 limLog( pMac, LOGP, FL("Posting Message to HAL failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07006659 return;
6660 }
6661
6662 if (mode == eLIM_STOP_TX)
6663 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006664 PELOG1(limLog(pMac, LOG1, FL("Stopping the transmission of all packets, indicated softmac"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07006665 }
6666 else
6667 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006668 PELOG1(limLog(pMac, LOG1, FL("Resuming the transmission of all packets, indicated softmac"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07006669 }
6670 return;
6671}
6672
6673
6674/**
6675 * @function : limRestorePreChannelSwitchState()
6676 *
6677 * @brief : This API is called by the user to undo any
6678 * specific changes done on the device during
6679 * channel switch.
6680 * LOGIC:
6681 *
6682 * ASSUMPTIONS:
6683 * NA
6684 *
6685 * NOTE:
6686 * NA
6687 *
6688 * @param pMac - Pointer to Global MAC structure
6689 * @return None
6690 */
6691
6692tSirRetStatus
6693limRestorePreChannelSwitchState(tpAniSirGlobal pMac, tpPESession psessionEntry)
6694{
6695
6696 tSirRetStatus retCode = eSIR_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -07006697 tANI_U32 val = 0;
6698
6699 if (psessionEntry->limSystemRole != eLIM_STA_ROLE)
6700 return retCode;
6701
6702 /* Channel switch should be ready for the next time */
Jeff Johnsone7245742012-09-05 17:12:55 -07006703 psessionEntry->gLimSpecMgmt.dot11hChanSwState = eLIM_11H_CHANSW_INIT;
Jeff Johnson295189b2012-06-20 16:38:30 -07006704
6705 /* Restore the frame transmission, all the time. */
6706 limFrameTransmissionControl(pMac, eLIM_TX_ALL, eLIM_RESUME_TX);
6707
6708 /* Free to enter BMPS */
6709 limSendSmePostChannelSwitchInd(pMac);
6710
6711 //Background scan is now enabled by SME
6712 if(pMac->lim.gLimBackgroundScanTerminate == FALSE)
6713 {
6714 /* Enable background scan if already enabled, else don't bother */
6715 if ((retCode = wlan_cfgGetInt(pMac, WNI_CFG_BACKGROUND_SCAN_PERIOD,
6716 &val)) != eSIR_SUCCESS)
6717
6718 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006719 limLog(pMac, LOGP, FL("could not retrieve Background scan period value"));
Jeff Johnson295189b2012-06-20 16:38:30 -07006720 return (retCode);
6721 }
6722
6723 if (val > 0 && TX_TIMER_VALID(pMac->lim.limTimers.gLimBackgroundScanTimer))
6724 {
Ravi Joshid2ca7c42013-07-23 08:37:49 -07006725 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE,
6726 psessionEntry->peSessionId, eLIM_BACKGROUND_SCAN_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -07006727 if(tx_timer_activate(&pMac->lim.limTimers.gLimBackgroundScanTimer) != TX_SUCCESS)
6728 {
6729 limLog(pMac, LOGP, FL("Could not restart background scan timer, doing LOGP"));
6730 return (eSIR_FAILURE);
6731 }
6732
6733 }
6734 }
6735
6736 /* Enable heartbeat timer */
6737 if (TX_TIMER_VALID(pMac->lim.limTimers.gLimHeartBeatTimer))
6738 {
Ravi Joshid2ca7c42013-07-23 08:37:49 -07006739 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE,
6740 psessionEntry->peSessionId, eLIM_HEART_BEAT_TIMER));
6741 if((limActivateHearBeatTimer(pMac, psessionEntry) != TX_SUCCESS) &&
6742 (!IS_ACTIVEMODE_OFFLOAD_FEATURE_ENABLE))
Jeff Johnson295189b2012-06-20 16:38:30 -07006743 {
6744 limLog(pMac, LOGP, FL("Could not restart heartbeat timer, doing LOGP"));
6745 return (eSIR_FAILURE);
6746 }
6747 }
Jeff Johnson295189b2012-06-20 16:38:30 -07006748 return (retCode);
6749}
6750
6751
6752/**--------------------------------------------
6753\fn limRestorePreQuietState
6754\brief Restore the pre quiet state
6755
6756\param pMac
6757\return NONE
6758---------------------------------------------*/
Jeff Johnsone7245742012-09-05 17:12:55 -07006759tSirRetStatus limRestorePreQuietState(tpAniSirGlobal pMac, tpPESession psessionEntry)
Jeff Johnson295189b2012-06-20 16:38:30 -07006760{
6761
6762 tSirRetStatus retCode = eSIR_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -07006763 tANI_U32 val = 0;
6764
6765 if (pMac->lim.gLimSystemRole != eLIM_STA_ROLE)
6766 return retCode;
6767
6768 /* Quiet should be ready for the next time */
Jeff Johnsone7245742012-09-05 17:12:55 -07006769 psessionEntry->gLimSpecMgmt.quietState = eLIM_QUIET_INIT;
Jeff Johnson295189b2012-06-20 16:38:30 -07006770
6771 /* Restore the frame transmission, all the time. */
Jeff Johnsone7245742012-09-05 17:12:55 -07006772 if (psessionEntry->gLimSpecMgmt.quietState == eLIM_QUIET_RUNNING)
Jeff Johnson295189b2012-06-20 16:38:30 -07006773 limFrameTransmissionControl(pMac, eLIM_TX_ALL, eLIM_RESUME_TX);
6774
6775
6776 //Background scan is now enabled by SME
6777 if(pMac->lim.gLimBackgroundScanTerminate == FALSE)
6778 {
6779 /* Enable background scan if already enabled, else don't bother */
6780 if ((retCode = wlan_cfgGetInt(pMac, WNI_CFG_BACKGROUND_SCAN_PERIOD,
6781 &val)) != eSIR_SUCCESS)
6782
6783 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006784 limLog(pMac, LOGP, FL("could not retrieve Background scan period value"));
Jeff Johnson295189b2012-06-20 16:38:30 -07006785 return (retCode);
6786 }
6787
6788 if (val > 0 && TX_TIMER_VALID(pMac->lim.limTimers.gLimBackgroundScanTimer))
6789 {
Leela V Kiran Kumar Reddy Chiralac3b9d382013-01-31 20:49:53 -08006790 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, psessionEntry->peSessionId, eLIM_BACKGROUND_SCAN_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -07006791 if(tx_timer_activate(&pMac->lim.limTimers.gLimBackgroundScanTimer) != TX_SUCCESS)
6792 {
6793 limLog(pMac, LOGP, FL("Could not restart background scan timer, doing LOGP"));
6794 return (eSIR_FAILURE);
6795 }
6796
6797 }
6798 }
6799
6800 /* Enable heartbeat timer */
6801 if (TX_TIMER_VALID(pMac->lim.limTimers.gLimHeartBeatTimer))
6802 {
Leela V Kiran Kumar Reddy Chiralac3b9d382013-01-31 20:49:53 -08006803 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, psessionEntry->peSessionId, eLIM_HEART_BEAT_TIMER));
Ravi Joshid2ca7c42013-07-23 08:37:49 -07006804 if(limActivateHearBeatTimer(pMac, psessionEntry) != TX_SUCCESS)
Jeff Johnson295189b2012-06-20 16:38:30 -07006805 {
6806 limLog(pMac, LOGP, FL("Could not restart heartbeat timer, doing LOGP"));
6807 return (eSIR_FAILURE);
6808 }
6809 }
Jeff Johnson295189b2012-06-20 16:38:30 -07006810 return (retCode);
6811}
6812
6813
6814/**
6815 * @function: limPrepareFor11hChannelSwitch()
6816 *
6817 * @brief : This API is called by the user to prepare for
6818 * 11h channel switch. As of now, the API does
6819 * very minimal work. User can add more into the
6820 * same API if needed.
6821 * LOGIC:
6822 *
6823 * ASSUMPTIONS:
6824 * NA
6825 *
6826 * NOTE:
6827 * NA
6828 *
6829 * @param pMac - Pointer to Global MAC structure
6830 * @param psessionEntry
6831 * @return None
6832 */
6833void
6834limPrepareFor11hChannelSwitch(tpAniSirGlobal pMac, tpPESession psessionEntry)
6835{
Jeff Johnson295189b2012-06-20 16:38:30 -07006836 if (psessionEntry->limSystemRole != eLIM_STA_ROLE)
6837 return;
6838
6839 /* Flag to indicate 11h channel switch in progress */
Jeff Johnsone7245742012-09-05 17:12:55 -07006840 psessionEntry->gLimSpecMgmt.dot11hChanSwState = eLIM_11H_CHANSW_RUNNING;
Jeff Johnson295189b2012-06-20 16:38:30 -07006841
6842 /* Disable, Stop background scan if enabled and running */
6843 limDeactivateAndChangeTimer(pMac, eLIM_BACKGROUND_SCAN_TIMER);
6844
6845 /* Stop heart-beat timer to stop heartbeat disassociation */
6846 limHeartBeatDeactivateAndChangeTimer(pMac, psessionEntry);
6847
6848 if(pMac->lim.gLimSmeState == eLIM_SME_LINK_EST_WT_SCAN_STATE ||
6849 pMac->lim.gLimSmeState == eLIM_SME_CHANNEL_SCAN_STATE)
6850 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006851 PELOGE(limLog(pMac, LOGE, FL("Posting finish scan as we are in scan state"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07006852 /* Stop ongoing scanning if any */
6853 if (GET_LIM_PROCESS_DEFD_MESGS(pMac))
6854 {
6855 //Set the resume channel to Any valid channel (invalid).
6856 //This will instruct HAL to set it to any previous valid channel.
6857 peSetResumeChannel(pMac, 0, 0);
6858 limSendHalFinishScanReq(pMac, eLIM_HAL_FINISH_SCAN_WAIT_STATE);
6859 }
6860 else
6861 {
6862 limRestorePreChannelSwitchState(pMac, psessionEntry);
6863 }
6864 return;
6865 }
6866 else
6867 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006868 PELOGE(limLog(pMac, LOGE, FL("Not in scan state, start channel switch timer"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07006869 /** We are safe to switch channel at this point */
6870 limStopTxAndSwitchChannel(pMac, psessionEntry->peSessionId);
6871 }
Jeff Johnson295189b2012-06-20 16:38:30 -07006872}
6873
6874
6875
6876/**----------------------------------------------------
6877\fn limGetNwType
6878
6879\brief Get type of the network from data packet or beacon
6880\param pMac
6881\param channelNum - Channel number
6882\param type - Type of packet.
6883\param pBeacon - Pointer to beacon or probe response
6884
6885\return Network type a/b/g.
6886-----------------------------------------------------*/
6887tSirNwType limGetNwType(tpAniSirGlobal pMac, tANI_U8 channelNum, tANI_U32 type, tpSchBeaconStruct pBeacon)
6888{
6889 tSirNwType nwType = eSIR_11B_NW_TYPE;
6890
6891 if (type == SIR_MAC_DATA_FRAME)
6892 {
6893 if ((channelNum > 0) && (channelNum < 15))
6894 {
6895 nwType = eSIR_11G_NW_TYPE;
6896 }
6897 else
6898 {
6899 nwType = eSIR_11A_NW_TYPE;
6900 }
6901 }
6902 else
6903 {
6904 if ((channelNum > 0) && (channelNum < 15))
6905 {
6906 int i;
6907 // 11b or 11g packet
6908 // 11g iff extended Rate IE is present or
6909 // if there is an A rate in suppRate IE
6910 for (i = 0; i < pBeacon->supportedRates.numRates; i++)
6911 {
6912 if (sirIsArate(pBeacon->supportedRates.rate[i] & 0x7f))
6913 {
6914 nwType = eSIR_11G_NW_TYPE;
6915 break;
6916 }
6917 }
6918 if (pBeacon->extendedRatesPresent)
6919 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006920 PELOG3(limLog(pMac, LOG3, FL("Beacon, nwtype=G"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07006921 nwType = eSIR_11G_NW_TYPE;
6922 }
6923 }
6924 else
6925 {
6926 // 11a packet
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006927 PELOG3(limLog(pMac, LOG3,FL("Beacon, nwtype=A"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07006928 nwType = eSIR_11A_NW_TYPE;
6929 }
6930 }
6931 return nwType;
6932}
6933
6934
6935/**---------------------------------------------------------
6936\fn limGetChannelFromBeacon
6937\brief To extract channel number from beacon
6938
6939\param pMac
6940\param pBeacon - Pointer to beacon or probe rsp
6941\return channel number
6942-----------------------------------------------------------*/
6943tANI_U8 limGetChannelFromBeacon(tpAniSirGlobal pMac, tpSchBeaconStruct pBeacon)
6944{
6945 tANI_U8 channelNum = 0;
6946
6947 if (pBeacon->dsParamsPresent)
6948 channelNum = pBeacon->channelNumber;
6949 else if(pBeacon->HTInfo.present)
6950 channelNum = pBeacon->HTInfo.primaryChannel;
6951 else
6952 channelNum = pBeacon->channelNumber;
6953
6954 return channelNum;
6955}
6956
6957
6958/** ---------------------------------------------------------
6959\fn limSetTspecUapsdMask
6960\brief This function sets the PE global variable:
6961\ 1) gUapsdPerAcTriggerEnableMask and
6962\ 2) gUapsdPerAcDeliveryEnableMask
6963\ based on the user priority field and direction field
6964\ in the TS Info Fields.
6965\
6966\ An AC is a trigger-enabled AC if the PSB subfield
6967\ is set to 1 in the uplink direction.
6968\ An AC is a delivery-enabled AC if the PSB subfield
6969\ is set to 1 in the down-link direction.
6970\
6971\param tpAniSirGlobal pMac
6972\param tSirMacTSInfo pTsInfo
6973\param tANI_U32 action
6974\return None
6975 ------------------------------------------------------------*/
6976void limSetTspecUapsdMask(tpAniSirGlobal pMac, tSirMacTSInfo *pTsInfo, tANI_U32 action)
6977{
6978 tANI_U8 userPrio = (tANI_U8)pTsInfo->traffic.userPrio;
6979 tANI_U16 direction = pTsInfo->traffic.direction;
6980 tANI_U8 ac = upToAc(userPrio);
6981
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006982 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 -07006983
6984 /* Converting AC to appropriate Uapsd Bit Mask
6985 * AC_BE(0) --> UAPSD_BITOFFSET_ACVO(3)
6986 * AC_BK(1) --> UAPSD_BITOFFSET_ACVO(2)
6987 * AC_VI(2) --> UAPSD_BITOFFSET_ACVO(1)
6988 * AC_VO(3) --> UAPSD_BITOFFSET_ACVO(0)
6989 */
6990 ac = ((~ac) & 0x3);
6991
6992 if (action == CLEAR_UAPSD_MASK)
6993 {
6994 if (direction == SIR_MAC_DIRECTION_UPLINK)
6995 pMac->lim.gUapsdPerAcTriggerEnableMask &= ~(1 << ac);
6996 else if (direction == SIR_MAC_DIRECTION_DNLINK)
6997 pMac->lim.gUapsdPerAcDeliveryEnableMask &= ~(1 << ac);
6998 else if (direction == SIR_MAC_DIRECTION_BIDIR)
6999 {
7000 pMac->lim.gUapsdPerAcTriggerEnableMask &= ~(1 << ac);
7001 pMac->lim.gUapsdPerAcDeliveryEnableMask &= ~(1 << ac);
7002 }
7003 }
7004 else if (action == SET_UAPSD_MASK)
7005 {
7006 if (direction == SIR_MAC_DIRECTION_UPLINK)
7007 pMac->lim.gUapsdPerAcTriggerEnableMask |= (1 << ac);
7008 else if (direction == SIR_MAC_DIRECTION_DNLINK)
7009 pMac->lim.gUapsdPerAcDeliveryEnableMask |= (1 << ac);
7010 else if (direction == SIR_MAC_DIRECTION_BIDIR)
7011 {
7012 pMac->lim.gUapsdPerAcTriggerEnableMask |= (1 << ac);
7013 pMac->lim.gUapsdPerAcDeliveryEnableMask |= (1 << ac);
7014 }
7015 }
7016
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007017 limLog(pMac, LOGE, FL("New pMac->lim.gUapsdPerAcTriggerEnableMask = 0x%x "), pMac->lim.gUapsdPerAcTriggerEnableMask );
7018 limLog(pMac, LOGE, FL("New pMac->lim.gUapsdPerAcDeliveryEnableMask = 0x%x "), pMac->lim.gUapsdPerAcDeliveryEnableMask );
Jeff Johnson295189b2012-06-20 16:38:30 -07007019
7020 return;
7021}
7022
7023
7024
7025void limHandleHeartBeatTimeout(tpAniSirGlobal pMac )
7026{
7027
7028 tANI_U8 i;
7029 for(i =0;i < pMac->lim.maxBssId;i++)
7030 {
7031 if(pMac->lim.gpSession[i].valid == TRUE )
7032 {
7033 if(pMac->lim.gpSession[i].bssType == eSIR_IBSS_MODE)
7034 {
7035 limIbssHeartBeatHandle(pMac,&pMac->lim.gpSession[i]);
7036 break;
7037 }
7038
7039 if((pMac->lim.gpSession[i].bssType == eSIR_INFRASTRUCTURE_MODE) &&
7040 (pMac->lim.gpSession[i].limSystemRole == eLIM_STA_ROLE))
7041 {
7042 limHandleHeartBeatFailure(pMac,&pMac->lim.gpSession[i]);
7043 }
7044 }
7045 }
7046 for(i=0; i< pMac->lim.maxBssId; i++)
7047 {
7048 if(pMac->lim.gpSession[i].valid == TRUE )
7049 {
7050 if((pMac->lim.gpSession[i].bssType == eSIR_INFRASTRUCTURE_MODE) &&
7051 (pMac->lim.gpSession[i].limSystemRole == eLIM_STA_ROLE))
7052 {
7053 if(pMac->lim.gpSession[i].LimHBFailureStatus == eANI_BOOLEAN_TRUE)
7054 {
7055 /* Activate Probe After HeartBeat Timer incase HB Failure detected */
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007056 PELOGW(limLog(pMac, LOGW,FL("Sending Probe for Session: %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07007057 i);)
7058 limDeactivateAndChangeTimer(pMac, eLIM_PROBE_AFTER_HB_TIMER);
7059 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, 0, eLIM_PROBE_AFTER_HB_TIMER));
7060 if (tx_timer_activate(&pMac->lim.limTimers.gLimProbeAfterHBTimer) != TX_SUCCESS)
7061 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007062 limLog(pMac, LOGP, FL("Fail to re-activate Probe-after-heartbeat timer"));
Jeff Johnson295189b2012-06-20 16:38:30 -07007063 limReactivateHeartBeatTimer(pMac, &pMac->lim.gpSession[i]);
7064 }
7065 break;
7066 }
7067 }
7068 }
7069 }
7070}
7071
Leela Venkata Kiran Kumar Reddy Chirala3ca17902013-02-27 19:50:05 -08007072void limHandleHeartBeatTimeoutForSession(tpAniSirGlobal pMac, tpPESession psessionEntry)
7073{
7074 if(psessionEntry->valid == TRUE )
7075 {
7076 if(psessionEntry->bssType == eSIR_IBSS_MODE)
7077 {
7078 limIbssHeartBeatHandle(pMac,psessionEntry);
7079 }
7080 if((psessionEntry->bssType == eSIR_INFRASTRUCTURE_MODE) &&
7081 (psessionEntry->limSystemRole == eLIM_STA_ROLE))
7082 {
7083 limHandleHeartBeatFailure(pMac,psessionEntry);
7084 }
7085 }
7086 /* In the function limHandleHeartBeatFailure things can change so check for the session entry valid
7087 and the other things again */
7088 if(psessionEntry->valid == TRUE )
7089 {
7090 if((psessionEntry->bssType == eSIR_INFRASTRUCTURE_MODE) &&
7091 (psessionEntry->limSystemRole == eLIM_STA_ROLE))
7092 {
7093 if(psessionEntry->LimHBFailureStatus == eANI_BOOLEAN_TRUE)
7094 {
7095 /* Activate Probe After HeartBeat Timer incase HB Failure detected */
7096 PELOGW(limLog(pMac, LOGW,FL("Sending Probe for Session: %d"),
7097 psessionEntry->bssIdx);)
7098 limDeactivateAndChangeTimer(pMac, eLIM_PROBE_AFTER_HB_TIMER);
7099 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, 0, eLIM_PROBE_AFTER_HB_TIMER));
7100 if (tx_timer_activate(&pMac->lim.limTimers.gLimProbeAfterHBTimer) != TX_SUCCESS)
7101 {
7102 limLog(pMac, LOGP, FL("Fail to re-activate Probe-after-heartbeat timer"));
7103 limReactivateHeartBeatTimer(pMac, psessionEntry);
7104 }
7105 }
7106 }
7107 }
7108}
7109
7110
Jeff Johnson295189b2012-06-20 16:38:30 -07007111tANI_U8 limGetCurrentOperatingChannel(tpAniSirGlobal pMac)
7112{
7113 tANI_U8 i;
7114 for(i =0;i < pMac->lim.maxBssId;i++)
7115 {
7116 if(pMac->lim.gpSession[i].valid == TRUE )
7117 {
7118 if((pMac->lim.gpSession[i].bssType == eSIR_INFRASTRUCTURE_MODE) &&
7119 (pMac->lim.gpSession[i].limSystemRole == eLIM_STA_ROLE))
7120 {
7121 return pMac->lim.gpSession[i].currentOperChannel;
7122 }
7123 }
7124 }
7125 return 0;
7126}
7127
7128void limProcessAddStaRsp(tpAniSirGlobal pMac,tpSirMsgQ limMsgQ)
7129{
7130
7131 tpPESession psessionEntry;
7132// tANI_U8 sessionId;
7133 tpAddStaParams pAddStaParams;
7134
7135 pAddStaParams = (tpAddStaParams)limMsgQ->bodyptr;
7136
7137 if((psessionEntry = peFindSessionBySessionId(pMac,pAddStaParams->sessionId))==NULL)
7138 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007139 limLog(pMac, LOGP,FL("Session Does not exist for given sessionID"));
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307140 vos_mem_free(pAddStaParams);
Jeff Johnson295189b2012-06-20 16:38:30 -07007141 return;
7142 }
7143 if (psessionEntry->limSystemRole == eLIM_STA_IN_IBSS_ROLE)
7144 (void) limIbssAddStaRsp(pMac, limMsgQ->bodyptr,psessionEntry);
Mohit Khanna698ba2a2012-12-04 15:08:18 -08007145#ifdef FEATURE_WLAN_TDLS
7146 else if(pMac->lim.gLimAddStaTdls)
7147 {
7148 limProcessTdlsAddStaRsp(pMac, limMsgQ->bodyptr, psessionEntry) ;
7149 pMac->lim.gLimAddStaTdls = FALSE ;
7150 }
7151#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07007152 else
7153 limProcessMlmAddStaRsp(pMac, limMsgQ,psessionEntry);
7154
7155}
7156
7157
7158void limUpdateBeacon(tpAniSirGlobal pMac)
7159{
7160 tANI_U8 i;
7161
7162 for(i =0;i < pMac->lim.maxBssId;i++)
7163 {
7164 if(pMac->lim.gpSession[i].valid == TRUE )
7165 {
7166 if( ( (pMac->lim.gpSession[i].limSystemRole == eLIM_AP_ROLE) ||
7167 (pMac->lim.gpSession[i].limSystemRole == eLIM_STA_IN_IBSS_ROLE) )
7168 && (eLIM_SME_NORMAL_STATE == pMac->lim.gpSession[i].limSmeState)
7169 )
7170 {
7171 schSetFixedBeaconFields(pMac,&pMac->lim.gpSession[i]);
7172 limSendBeaconInd(pMac, &pMac->lim.gpSession[i]);
7173 }
7174 else
7175 {
7176 if( (pMac->lim.gpSession[i].limSystemRole == eLIM_BT_AMP_AP_ROLE)||
7177 (pMac->lim.gpSession[i].limSystemRole == eLIM_BT_AMP_STA_ROLE))
7178 {
7179
7180 if(pMac->lim.gpSession[i].statypeForBss == STA_ENTRY_SELF)
7181 {
7182 schSetFixedBeaconFields(pMac,&pMac->lim.gpSession[i]);
7183 }
7184 }
7185 }
7186 }
7187 }
7188}
7189
7190void limHandleHeartBeatFailureTimeout(tpAniSirGlobal pMac)
7191{
7192 tANI_U8 i;
7193 tpPESession psessionEntry;
7194 /* Probe response is not received after HB failure. This is handled by LMM sub module. */
7195 for(i =0; i < pMac->lim.maxBssId; i++)
7196 {
7197 if(pMac->lim.gpSession[i].valid == TRUE)
7198 {
7199 psessionEntry = &pMac->lim.gpSession[i];
7200 if(psessionEntry->LimHBFailureStatus == eANI_BOOLEAN_TRUE)
7201 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007202 limLog(pMac, LOGE, FL("Probe_hb_failure: SME %d, MLME %d, HB-Count %d"),psessionEntry->limSmeState,
Jeff Johnson295189b2012-06-20 16:38:30 -07007203 psessionEntry->limMlmState, psessionEntry->LimRxedBeaconCntDuringHB);
Leela Venkata Kiran Kumar Reddy Chirala2365ee62013-05-09 17:30:12 -07007204#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
7205 limDiagEventReport(pMac, WLAN_PE_DIAG_HB_FAILURE_TIMEOUT, psessionEntry, 0, 0);
7206#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07007207 if (psessionEntry->limMlmState == eLIM_MLM_LINK_ESTABLISHED_STATE)
7208 {
Leela Venkata Kiran Kumar Reddy Chiralaab842fb2013-04-30 12:27:35 -07007209 if ((!LIM_IS_CONNECTION_ACTIVE(psessionEntry))&&
7210 (psessionEntry->limSmeState != eLIM_SME_WT_DISASSOC_STATE))
Jeff Johnson295189b2012-06-20 16:38:30 -07007211 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007212 limLog(pMac, LOGE, FL("Probe_hb_failure: for session:%d " ),psessionEntry->peSessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07007213 /* AP did not respond to Probe Request. Tear down link with it.*/
7214 limTearDownLinkWithAp(pMac,
7215 psessionEntry->peSessionId,
7216 eSIR_BEACON_MISSED);
7217 pMac->lim.gLimProbeFailureAfterHBfailedCnt++ ;
7218 }
7219 else // restart heartbeat timer
7220 {
7221 limReactivateHeartBeatTimer(pMac, psessionEntry);
7222 }
7223 }
7224 else
7225 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007226 limLog(pMac, LOGE, FL("Unexpected wt-probe-timeout in state "));
Jeff Johnson295189b2012-06-20 16:38:30 -07007227 limPrintMlmState(pMac, LOGE, psessionEntry->limMlmState);
7228 limReactivateHeartBeatTimer(pMac, psessionEntry);
7229 }
7230
7231 }
7232 }
7233 }
7234 /* Deactivate Timer ProbeAfterHB Timer -> As its a oneshot timer, need not deactivate the timer */
7235 // tx_timer_deactivate(&pMac->lim.limTimers.gLimProbeAfterHBTimer);
7236}
7237
7238
7239/*
7240* This function assumes there will not be more than one IBSS session active at any time.
7241*/
7242tpPESession limIsIBSSSessionActive(tpAniSirGlobal pMac)
7243{
7244 tANI_U8 i;
7245
7246 for(i =0;i < pMac->lim.maxBssId;i++)
7247 {
7248 if( (pMac->lim.gpSession[i].valid) &&
7249 (pMac->lim.gpSession[i].limSystemRole == eLIM_STA_IN_IBSS_ROLE))
7250 return (&pMac->lim.gpSession[i]);
7251 }
7252
7253 return NULL;
7254}
7255
7256tpPESession limIsApSessionActive(tpAniSirGlobal pMac)
7257{
7258 tANI_U8 i;
7259
7260 for(i =0;i < pMac->lim.maxBssId;i++)
7261 {
7262 if( (pMac->lim.gpSession[i].valid) &&
7263 ( (pMac->lim.gpSession[i].limSystemRole == eLIM_AP_ROLE) ||
7264 (pMac->lim.gpSession[i].limSystemRole == eLIM_BT_AMP_AP_ROLE)))
7265 return (&pMac->lim.gpSession[i]);
7266 }
7267
7268 return NULL;
7269}
7270
7271/**---------------------------------------------------------
7272\fn limHandleDeferMsgError
7273\brief handles error scenario, when the msg can not be deferred.
7274\param pMac
7275\param pLimMsg LIM msg, which could not be deferred.
7276\return void
7277-----------------------------------------------------------*/
7278
7279void limHandleDeferMsgError(tpAniSirGlobal pMac, tpSirMsgQ pLimMsg)
7280{
7281 if(SIR_BB_XPORT_MGMT_MSG == pLimMsg->type)
7282 {
7283 vos_pkt_return_packet((vos_pkt_t*)pLimMsg->bodyptr);
7284 }
7285 else if(pLimMsg->bodyptr != NULL)
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307286 vos_mem_free( pLimMsg->bodyptr);
Jeff Johnson295189b2012-06-20 16:38:30 -07007287
7288}
7289
7290
7291#ifdef FEATURE_WLAN_DIAG_SUPPORT
7292/**---------------------------------------------------------
7293\fn limDiagEventReport
7294\brief This function reports Diag event
7295\param pMac
7296\param eventType
7297\param bssid
7298\param status
7299\param reasonCode
7300\return void
7301-----------------------------------------------------------*/
7302void limDiagEventReport(tpAniSirGlobal pMac, tANI_U16 eventType, tpPESession pSessionEntry, tANI_U16 status, tANI_U16 reasonCode)
7303{
7304 tSirMacAddr nullBssid = { 0, 0, 0, 0, 0, 0 };
7305 WLAN_VOS_DIAG_EVENT_DEF(peEvent, vos_event_wlan_pe_payload_type);
7306
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307307 vos_mem_set(&peEvent, sizeof(vos_event_wlan_pe_payload_type), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07007308
7309 if (NULL == pSessionEntry)
7310 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307311 vos_mem_copy( peEvent.bssid, nullBssid, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07007312 peEvent.sme_state = (tANI_U16)pMac->lim.gLimSmeState;
7313 peEvent.mlm_state = (tANI_U16)pMac->lim.gLimMlmState;
7314
7315 }
7316 else
7317 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307318 vos_mem_copy(peEvent.bssid, pSessionEntry->bssId, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07007319 peEvent.sme_state = (tANI_U16)pSessionEntry->limSmeState;
7320 peEvent.mlm_state = (tANI_U16)pSessionEntry->limMlmState;
7321 }
7322 peEvent.event_type = eventType;
7323 peEvent.status = status;
7324 peEvent.reason_code = reasonCode;
7325
7326 WLAN_VOS_DIAG_EVENT_REPORT(&peEvent, EVENT_WLAN_PE);
7327 return;
7328}
7329
7330#endif /* FEATURE_WLAN_DIAG_SUPPORT */
7331
7332void limProcessAddStaSelfRsp(tpAniSirGlobal pMac,tpSirMsgQ limMsgQ)
7333{
7334
7335 tpAddStaSelfParams pAddStaSelfParams;
7336 tSirMsgQ mmhMsg;
7337 tpSirSmeAddStaSelfRsp pRsp;
7338
7339
7340 pAddStaSelfParams = (tpAddStaSelfParams)limMsgQ->bodyptr;
7341
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307342 pRsp = vos_mem_malloc(sizeof(tSirSmeAddStaSelfRsp));
7343 if ( NULL == pRsp )
Jeff Johnson295189b2012-06-20 16:38:30 -07007344 {
7345 /// Buffer not available. Log error
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307346 limLog(pMac, LOGP, FL("call to AllocateMemory failed for Add Sta self RSP"));
7347 vos_mem_free(pAddStaSelfParams);
Jeff Johnson295189b2012-06-20 16:38:30 -07007348 return;
7349 }
7350
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307351 vos_mem_set((tANI_U8*)pRsp, sizeof(tSirSmeAddStaSelfRsp), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07007352
7353 pRsp->mesgType = eWNI_SME_ADD_STA_SELF_RSP;
7354 pRsp->mesgLen = (tANI_U16) sizeof(tSirSmeAddStaSelfRsp);
7355 pRsp->status = pAddStaSelfParams->status;
7356
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307357 vos_mem_copy( pRsp->selfMacAddr, pAddStaSelfParams->selfMacAddr, sizeof(tSirMacAddr) );
Jeff Johnson295189b2012-06-20 16:38:30 -07007358
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307359 vos_mem_free(pAddStaSelfParams);
Jeff Johnson295189b2012-06-20 16:38:30 -07007360
7361 mmhMsg.type = eWNI_SME_ADD_STA_SELF_RSP;
7362 mmhMsg.bodyptr = pRsp;
7363 mmhMsg.bodyval = 0;
Jeff Johnsone7245742012-09-05 17:12:55 -07007364 MTRACE(macTraceMsgTx(pMac, NO_SESSION, mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07007365 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
7366
7367}
7368
7369void limProcessDelStaSelfRsp(tpAniSirGlobal pMac,tpSirMsgQ limMsgQ)
7370{
7371
7372 tpDelStaSelfParams pDelStaSelfParams;
7373 tSirMsgQ mmhMsg;
7374 tpSirSmeDelStaSelfRsp pRsp;
7375
7376
7377 pDelStaSelfParams = (tpDelStaSelfParams)limMsgQ->bodyptr;
7378
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307379 pRsp = vos_mem_malloc(sizeof(tSirSmeDelStaSelfRsp));
7380 if ( NULL == pRsp )
Jeff Johnson295189b2012-06-20 16:38:30 -07007381 {
7382 /// Buffer not available. Log error
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307383 limLog(pMac, LOGP, FL("call to AllocateMemory failed for Add Sta self RSP"));
7384 vos_mem_free(pDelStaSelfParams);
Jeff Johnson295189b2012-06-20 16:38:30 -07007385 return;
7386 }
7387
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307388 vos_mem_set((tANI_U8*)pRsp, sizeof(tSirSmeDelStaSelfRsp), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07007389
7390 pRsp->mesgType = eWNI_SME_DEL_STA_SELF_RSP;
7391 pRsp->mesgLen = (tANI_U16) sizeof(tSirSmeDelStaSelfRsp);
7392 pRsp->status = pDelStaSelfParams->status;
7393
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307394 vos_mem_copy( pRsp->selfMacAddr, pDelStaSelfParams->selfMacAddr, sizeof(tSirMacAddr) );
Jeff Johnson295189b2012-06-20 16:38:30 -07007395
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307396 vos_mem_free(pDelStaSelfParams);
Jeff Johnson295189b2012-06-20 16:38:30 -07007397
7398 mmhMsg.type = eWNI_SME_DEL_STA_SELF_RSP;
7399 mmhMsg.bodyptr = pRsp;
7400 mmhMsg.bodyval = 0;
Jeff Johnsone7245742012-09-05 17:12:55 -07007401 MTRACE(macTraceMsgTx(pMac, NO_SESSION, mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07007402 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
7403
7404}
7405
7406/***************************************************************
7407* tANI_U8 limUnmapChannel(tANI_U8 mapChannel)
7408* To unmap the channel to reverse the effect of mapping
7409* a band channel in hal .Mapping was done hal to overcome the
7410* limitation of the rxbd which use only 4 bit for channel number.
7411*****************************************************************/
7412tANI_U8 limUnmapChannel(tANI_U8 mapChannel)
7413{
7414 if( mapChannel > 0 && mapChannel < 25 )
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07007415#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
7416 if (IS_ROAM_SCAN_OFFLOAD_FEATURE_ENABLE)
7417 return aUnsortedChannelList[mapChannel -1];
7418 else
7419#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07007420 return abChannel[mapChannel -1];
7421 else
7422 return 0;
7423}
7424
7425
7426v_U8_t* limGetIEPtr(tpAniSirGlobal pMac, v_U8_t *pIes, int length, v_U8_t eid,eSizeOfLenField size_of_len_field)
7427{
7428 int left = length;
7429 v_U8_t *ptr = pIes;
7430 v_U8_t elem_id;
7431 v_U16_t elem_len;
7432
7433 while(left >= (size_of_len_field+1))
7434 {
7435 elem_id = ptr[0];
7436 if (size_of_len_field == TWO_BYTE)
7437 {
7438 elem_len = ((v_U16_t) ptr[1]) | (ptr[2]<<8);
7439 }
7440 else
7441 {
7442 elem_len = ptr[1];
7443 }
7444
7445
7446 left -= (size_of_len_field+1);
7447 if(elem_len > left)
7448 {
7449 limLog(pMac, LOGE,
Madan Mohan Koyyalamudi8bdd3112012-09-24 13:55:14 -07007450 FL("****Invalid IEs eid = %d elem_len=%d left=%d*****"),
Jeff Johnson295189b2012-06-20 16:38:30 -07007451 eid,elem_len,left);
7452 return NULL;
7453 }
7454 if (elem_id == eid)
7455 {
7456 return ptr;
7457 }
7458
7459 left -= elem_len;
7460 ptr += (elem_len + (size_of_len_field+1));
7461 }
7462 return NULL;
7463}
7464
7465/* return NULL if oui is not found in ie
7466 return !NULL pointer to vendor IE (starting from 0xDD) if oui is found
7467 */
7468v_U8_t* limGetVendorIEOuiPtr(tpAniSirGlobal pMac, tANI_U8 *oui, tANI_U8 oui_size, tANI_U8 *ie, tANI_U16 ie_len)
7469{
7470 int left = ie_len;
7471 v_U8_t *ptr = ie;
7472 v_U8_t elem_id, elem_len;
7473
7474 while(left >= 2)
7475 {
7476 elem_id = ptr[0];
7477 elem_len = ptr[1];
7478 left -= 2;
7479 if(elem_len > left)
7480 {
7481 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007482 FL("****Invalid IEs eid = %d elem_len=%d left=%d*****"),
Jeff Johnson295189b2012-06-20 16:38:30 -07007483 elem_id,elem_len,left);
7484 return NULL;
7485 }
7486 if (SIR_MAC_EID_VENDOR == elem_id)
7487 {
7488 if(memcmp(&ptr[2], oui, oui_size)==0)
7489 return ptr;
7490 }
7491
7492 left -= elem_len;
7493 ptr += (elem_len + 2);
7494 }
7495 return NULL;
7496}
7497
Jeff Johnson295189b2012-06-20 16:38:30 -07007498//Returns length of P2P stream and Pointer ie passed to this function is filled with noa stream
7499
7500v_U8_t limBuildP2pIe(tpAniSirGlobal pMac, tANI_U8 *ie, tANI_U8 *data, tANI_U8 ie_len)
7501{
7502 int length = 0;
7503 tANI_U8 *ptr = ie;
7504
7505 ptr[length++] = SIR_MAC_EID_VENDOR;
7506 ptr[length++] = ie_len + SIR_MAC_P2P_OUI_SIZE;
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307507 vos_mem_copy(&ptr[length], SIR_MAC_P2P_OUI, SIR_MAC_P2P_OUI_SIZE);
7508 vos_mem_copy(&ptr[length + SIR_MAC_P2P_OUI_SIZE], data, ie_len);
Jeff Johnson295189b2012-06-20 16:38:30 -07007509 return (ie_len + SIR_P2P_IE_HEADER_LEN);
7510}
7511
7512//Returns length of NoA stream and Pointer pNoaStream passed to this function is filled with noa stream
7513
7514v_U8_t limGetNoaAttrStreamInMultP2pIes(tpAniSirGlobal pMac,v_U8_t* noaStream,v_U8_t noaLen,v_U8_t overFlowLen)
7515{
7516 v_U8_t overFlowP2pStream[SIR_MAX_NOA_ATTR_LEN];
Krunal Sonic768a932013-05-15 19:26:30 -07007517
7518 if ((noaLen <= (SIR_MAX_NOA_ATTR_LEN+SIR_P2P_IE_HEADER_LEN)) &&
7519 (noaLen >= overFlowLen) && (overFlowLen <= SIR_MAX_NOA_ATTR_LEN))
7520 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307521 vos_mem_copy(overFlowP2pStream,
Krunal Sonic768a932013-05-15 19:26:30 -07007522 noaStream + noaLen - overFlowLen, overFlowLen);
7523 noaStream[noaLen - overFlowLen] = SIR_MAC_EID_VENDOR;
7524 noaStream[noaLen - overFlowLen + 1] = overFlowLen + SIR_MAC_P2P_OUI_SIZE;
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307525 vos_mem_copy(noaStream+noaLen-overFlowLen + 2,
Krunal Sonic768a932013-05-15 19:26:30 -07007526 SIR_MAC_P2P_OUI, SIR_MAC_P2P_OUI_SIZE);
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307527 vos_mem_copy(noaStream+noaLen + 2 + SIR_MAC_P2P_OUI_SIZE - overFlowLen,
7528 overFlowP2pStream, overFlowLen);
Krunal Sonic768a932013-05-15 19:26:30 -07007529 }
7530
Jeff Johnson295189b2012-06-20 16:38:30 -07007531 return (noaLen + SIR_P2P_IE_HEADER_LEN);
7532
7533}
7534
7535//Returns length of NoA stream and Pointer pNoaStream passed to this function is filled with noa stream
7536v_U8_t limGetNoaAttrStream(tpAniSirGlobal pMac, v_U8_t*pNoaStream,tpPESession psessionEntry)
7537{
7538 v_U8_t len=0;
7539
7540 v_U8_t *pBody = pNoaStream;
7541
7542
7543 if ( (psessionEntry != NULL) && (psessionEntry->valid) &&
7544 (psessionEntry->pePersona == VOS_P2P_GO_MODE))
7545 {
7546 if ((!(psessionEntry->p2pGoPsUpdate.uNoa1Duration)) && (!(psessionEntry->p2pGoPsUpdate.uNoa2Duration))
7547 && (!psessionEntry->p2pGoPsUpdate.oppPsFlag)
7548 )
7549 return 0; //No NoA Descriptor then return 0
7550
7551
7552 pBody[0] = SIR_P2P_NOA_ATTR;
7553
7554 pBody[3] = psessionEntry->p2pGoPsUpdate.index;
7555 pBody[4] = psessionEntry->p2pGoPsUpdate.ctWin | (psessionEntry->p2pGoPsUpdate.oppPsFlag<<7);
7556 len = 5;
7557 pBody += len;
7558
7559
7560 if (psessionEntry->p2pGoPsUpdate.uNoa1Duration)
7561 {
7562 *pBody = psessionEntry->p2pGoPsUpdate.uNoa1IntervalCnt;
7563 pBody += 1;
7564 len +=1;
7565
7566 *((tANI_U32 *)(pBody)) = sirSwapU32ifNeeded(psessionEntry->p2pGoPsUpdate.uNoa1Duration);
7567 pBody += sizeof(tANI_U32);
7568 len +=4;
7569
7570 *((tANI_U32 *)(pBody)) = sirSwapU32ifNeeded(psessionEntry->p2pGoPsUpdate.uNoa1Interval);
7571 pBody += sizeof(tANI_U32);
7572 len +=4;
7573
7574 *((tANI_U32 *)(pBody)) = sirSwapU32ifNeeded(psessionEntry->p2pGoPsUpdate.uNoa1StartTime);
7575 pBody += sizeof(tANI_U32);
7576 len +=4;
7577
7578 }
7579
7580 if (psessionEntry->p2pGoPsUpdate.uNoa2Duration)
7581 {
7582 *pBody = psessionEntry->p2pGoPsUpdate.uNoa2IntervalCnt;
7583 pBody += 1;
7584 len +=1;
7585
7586 *((tANI_U32 *)(pBody)) = sirSwapU32ifNeeded(psessionEntry->p2pGoPsUpdate.uNoa2Duration);
7587 pBody += sizeof(tANI_U32);
7588 len +=4;
7589
7590 *((tANI_U32 *)(pBody)) = sirSwapU32ifNeeded(psessionEntry->p2pGoPsUpdate.uNoa2Interval);
7591 pBody += sizeof(tANI_U32);
7592 len +=4;
7593
7594 *((tANI_U32 *)(pBody)) = sirSwapU32ifNeeded(psessionEntry->p2pGoPsUpdate.uNoa2StartTime);
7595 pBody += sizeof(tANI_U32);
7596 len +=4;
7597
7598 }
7599
7600
7601 pBody = pNoaStream + 1;
7602 *((tANI_U16 *)(pBody)) = sirSwapU16ifNeeded(len-3);/*one byte for Attr and 2 bytes for length*/
7603
7604 return (len);
7605
7606 }
7607 return 0;
7608
7609}
Jeff Johnsone7245742012-09-05 17:12:55 -07007610
7611void peSetResumeChannel(tpAniSirGlobal pMac, tANI_U16 channel, ePhyChanBondState phyCbState)
Jeff Johnson295189b2012-06-20 16:38:30 -07007612{
7613
7614 pMac->lim.gResumeChannel = channel;
Jeff Johnsone7245742012-09-05 17:12:55 -07007615 pMac->lim.gResumePhyCbState = phyCbState;
Jeff Johnson295189b2012-06-20 16:38:30 -07007616}
Jeff Johnsone7245742012-09-05 17:12:55 -07007617
Jeff Johnson295189b2012-06-20 16:38:30 -07007618/*--------------------------------------------------------------------------
7619
7620 \brief peGetResumeChannel() - Returns the channel number for scanning, from a valid session.
7621
Jeff Johnsone7245742012-09-05 17:12:55 -07007622 This function returns the channel to resume to during link resume. channel id of 0 means HAL will
7623 resume to previous channel before link suspend
Jeff Johnson295189b2012-06-20 16:38:30 -07007624
7625 \param pMac - pointer to global adapter context
7626 \return - channel to scan from valid session else zero.
7627
7628 \sa
7629
7630 --------------------------------------------------------------------------*/
Jeff Johnsone7245742012-09-05 17:12:55 -07007631void peGetResumeChannel(tpAniSirGlobal pMac, tANI_U8* resumeChannel, ePhyChanBondState* resumePhyCbState)
Jeff Johnson295189b2012-06-20 16:38:30 -07007632{
7633
7634 //Rationale - this could be the suspend/resume for assoc and it is essential that
7635 //the new BSS is active for some time. Other BSS was anyway suspended.
7636 //TODO: Comeup with a better alternative. Sending NULL with PM=0 on other BSS means
7637 //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 -07007638 //and hence should be ok. Need to discuss this further
7639 if( !limIsInMCC(pMac) )
Jeff Johnson295189b2012-06-20 16:38:30 -07007640 {
7641 //Get current active session channel
Jeff Johnsone7245742012-09-05 17:12:55 -07007642 peGetActiveSessionChannel(pMac, resumeChannel, resumePhyCbState);
Jeff Johnson295189b2012-06-20 16:38:30 -07007643 }
7644 else
7645 {
Jeff Johnsone7245742012-09-05 17:12:55 -07007646 *resumeChannel = pMac->lim.gResumeChannel;
7647 *resumePhyCbState = pMac->lim.gResumePhyCbState;
Jeff Johnson295189b2012-06-20 16:38:30 -07007648 }
Jeff Johnsone7245742012-09-05 17:12:55 -07007649 return;
Jeff Johnson295189b2012-06-20 16:38:30 -07007650}
7651
Viral Modid86bde22012-12-10 13:09:21 -08007652tANI_BOOLEAN limIsNOAInsertReqd(tpAniSirGlobal pMac)
7653{
7654 tANI_U8 i;
7655 for(i =0; i < pMac->lim.maxBssId; i++)
7656 {
7657 if(pMac->lim.gpSession[i].valid == TRUE)
7658 {
7659 if( (eLIM_AP_ROLE == pMac->lim.gpSession[i].limSystemRole )
7660 && ( VOS_P2P_GO_MODE == pMac->lim.gpSession[i].pePersona )
7661 )
7662 {
7663 return TRUE;
7664 }
7665 }
7666 }
7667 return FALSE;
7668}
Jeff Johnsone7245742012-09-05 17:12:55 -07007669
Jeff Johnson295189b2012-06-20 16:38:30 -07007670
7671tANI_BOOLEAN limIsconnectedOnDFSChannel(tANI_U8 currentChannel)
7672{
7673 if(NV_CHANNEL_DFS == vos_nv_getChannelEnabledState(currentChannel))
7674 {
7675 return eANI_BOOLEAN_TRUE;
7676 }
7677 else
7678 {
7679 return eANI_BOOLEAN_FALSE;
7680 }
7681}
Madan Mohan Koyyalamudi1bed5982012-10-22 14:38:06 -07007682
Mohit Khanna4a70d262012-09-11 16:30:12 -07007683#ifdef WLAN_FEATURE_11AC
7684tANI_BOOLEAN limCheckVHTOpModeChange( tpAniSirGlobal pMac, tpPESession psessionEntry, tANI_U8 chanWidth, tANI_U8 staId)
7685{
7686 tUpdateVHTOpMode tempParam;
7687
7688 tempParam.opMode = chanWidth;
7689 tempParam.staId = staId;
7690
7691 limSendModeUpdate( pMac, &tempParam, psessionEntry );
7692
7693 return eANI_BOOLEAN_TRUE;
7694}
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -07007695#endif
7696
7697tANI_U8 limGetShortSlotFromPhyMode(tpAniSirGlobal pMac, tpPESession psessionEntry, tANI_U32 phyMode)
7698{
7699 tANI_U8 val=0;
7700
7701 if (phyMode == WNI_CFG_PHY_MODE_11A)
7702 {
7703 // 11a mode always uses short slot
7704 // Check this since some APs in 11a mode broadcast long slot in their beacons. As per standard, always use what PHY mandates.
7705 val = true;
7706 }
7707 else if (phyMode == WNI_CFG_PHY_MODE_11G)
7708 {
7709 if ((psessionEntry->pePersona == VOS_STA_SAP_MODE) ||
7710 (psessionEntry->pePersona == VOS_P2P_GO_MODE))
7711 {
7712 val = true;
7713 }
7714
7715 // Program Polaris based on AP capability
7716
7717 if (psessionEntry->limMlmState == eLIM_MLM_WT_JOIN_BEACON_STATE)
7718 // Joining BSS.
7719 val = SIR_MAC_GET_SHORT_SLOT_TIME( psessionEntry->limCurrentBssCaps);
7720 else if (psessionEntry->limMlmState == eLIM_MLM_WT_REASSOC_RSP_STATE)
7721 // Reassociating with AP.
7722 val = SIR_MAC_GET_SHORT_SLOT_TIME( psessionEntry->limReassocBssCaps);
7723 }
7724 else // if (phyMode == WNI_CFG_PHY_MODE_11B) - use this if another phymode is added later ON
7725 {
7726 // Will reach here in 11b case
7727 val = false;
7728 }
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007729 limLog(pMac, LOG1, FL("phyMode = %u shortslotsupported = %u"), phyMode, val);
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -07007730 return val;
7731}