blob: d30647c39b715b9ac3dd098ddc83cddb2a1d8a2b [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
Jeff Johnsone7245742012-09-05 17:12:55 -07005471 if(eSIR_SUCCESS != limSendHalMsgDelTs(pMac, pSta->staIndex, tspecIdx, pDeltsReq->req, psessionEntry->peSessionId))
Jeff Johnson295189b2012-06-20 16:38:30 -07005472 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005473 limLog(pMac, LOGW, FL("DelTs with UP %d failed in limSendHalMsgDelTs - ignoring request"),
Jeff Johnson295189b2012-06-20 16:38:30 -07005474 tsinfo->traffic.userPrio);
5475 return eSIR_FAILURE;
5476 }
5477 }
5478 }
5479 return eSIR_SUCCESS;
5480}
5481
5482/** -------------------------------------------------------------
5483\fn limRegisterHalIndCallBack
5484\brief registers callback function to HAL for any indication.
5485\param tpAniSirGlobal pMac
5486\return none.
5487 -------------------------------------------------------------*/
5488void
5489limRegisterHalIndCallBack(tpAniSirGlobal pMac)
5490{
5491 tSirMsgQ msg;
5492 tpHalIndCB pHalCB;
5493
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305494 pHalCB = vos_mem_malloc(sizeof(tHalIndCB));
5495 if ( NULL == pHalCB )
Jeff Johnson295189b2012-06-20 16:38:30 -07005496 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305497 limLog(pMac, LOGP, FL("AllocateMemory() failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07005498 return;
5499 }
5500
5501 pHalCB->pHalIndCB = limProcessHalIndMessages;
5502
5503 msg.type = WDA_REGISTER_PE_CALLBACK;
5504 msg.bodyptr = pHalCB;
5505 msg.bodyval = 0;
5506
Jeff Johnsone7245742012-09-05 17:12:55 -07005507 MTRACE(macTraceMsgTx(pMac, NO_SESSION, msg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07005508 if(eSIR_SUCCESS != wdaPostCtrlMsg(pMac, &msg))
5509 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305510 vos_mem_free(pHalCB);
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005511 limLog(pMac, LOGP, FL("wdaPostCtrlMsg() failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07005512 }
5513
5514 return;
5515}
5516
5517
5518/** -------------------------------------------------------------
5519\fn limProcessAddBaInd
5520
5521\brief handles the BA activity check timeout indication coming from HAL.
5522 Validates the request, posts request for sending addBaReq message for every candidate in the list.
5523\param tpAniSirGlobal pMac
5524\param tSirMsgQ limMsg
5525\return None
5526-------------------------------------------------------------*/
5527void
5528limProcessAddBaInd(tpAniSirGlobal pMac, tpSirMsgQ limMsg)
5529{
5530 tANI_U8 i;
5531 tANI_U8 tid;
5532 tANI_U16 assocId;
5533 tpDphHashNode pSta;
5534 tpAddBaCandidate pBaCandidate;
5535 tANI_U32 baCandidateCnt;
5536 tpBaActivityInd pBaActivityInd;
5537 tpPESession psessionEntry;
5538 tANI_U8 sessionId;
Gopichand Nakkala681989c2013-03-06 22:27:48 -08005539#ifdef FEATURE_WLAN_TDLS
5540 boolean htCapable = FALSE;
5541#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07005542
5543
Gopichand Nakkala681989c2013-03-06 22:27:48 -08005544 if (limMsg->bodyptr == NULL)
Jeff Johnson295189b2012-06-20 16:38:30 -07005545 return;
5546
5547 pBaActivityInd = (tpBaActivityInd)limMsg->bodyptr;
5548 baCandidateCnt = pBaActivityInd->baCandidateCnt;
5549
Gopichand Nakkala681989c2013-03-06 22:27:48 -08005550 if ((psessionEntry = peFindSessionByBssid(pMac,pBaActivityInd->bssId,&sessionId))== NULL)
Jeff Johnson295189b2012-06-20 16:38:30 -07005551 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005552 limLog(pMac, LOGE,FL("session does not exist for given BSSId"));
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305553 vos_mem_free(limMsg->bodyptr);
Jeff Johnson295189b2012-06-20 16:38:30 -07005554 return;
5555 }
5556
5557 //if we are not HT capable we don't need to handle BA timeout indication from HAL.
Gopichand Nakkala681989c2013-03-06 22:27:48 -08005558#ifdef FEATURE_WLAN_TDLS
5559 if ((baCandidateCnt > pMac->lim.maxStation))
5560#else
5561 if ((baCandidateCnt > pMac->lim.maxStation) || !psessionEntry->htCapability )
5562#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07005563 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305564 vos_mem_free(limMsg->bodyptr);
Jeff Johnson295189b2012-06-20 16:38:30 -07005565 return;
5566 }
Gopichand Nakkala681989c2013-03-06 22:27:48 -08005567
5568#ifdef FEATURE_WLAN_TDLS
5569 //if we have TDLS peers, we should look at peers HT capability, which can be different than
5570 //AP capability
5571 pBaCandidate = (tpAddBaCandidate) (((tANI_U8*)pBaActivityInd) + sizeof(tBaActivityInd));
5572
5573 for (i=0; i<baCandidateCnt; i++, pBaCandidate++)
5574 {
5575 pSta = dphLookupHashEntry(pMac, pBaCandidate->staAddr, &assocId, &psessionEntry->dph.dphHashTable);
5576 if ((NULL == pSta) || (!pSta->valid))
5577 continue;
5578
5579 if (STA_ENTRY_TDLS_PEER == pSta->staType)
5580 htCapable = pSta->mlmStaContext.htCapability;
5581 else
5582 htCapable = psessionEntry->htCapability;
5583
5584 if (htCapable)
5585 break;
5586 }
5587 if (!htCapable)
5588 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305589 vos_mem_free(limMsg->bodyptr);
Gopichand Nakkala681989c2013-03-06 22:27:48 -08005590 return;
5591 }
5592#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07005593
5594 //delete the complete dialoguetoken linked list
5595 limDeleteDialogueTokenList(pMac);
5596 pBaCandidate = (tpAddBaCandidate) (((tANI_U8*)pBaActivityInd) + sizeof(tBaActivityInd));
5597
Gopichand Nakkala681989c2013-03-06 22:27:48 -08005598 for (i=0; i<baCandidateCnt; i++, pBaCandidate++)
Jeff Johnson295189b2012-06-20 16:38:30 -07005599 {
5600 pSta = dphLookupHashEntry(pMac, pBaCandidate->staAddr, &assocId, &psessionEntry->dph.dphHashTable);
Gopichand Nakkala681989c2013-03-06 22:27:48 -08005601 if ((NULL == pSta) || (!pSta->valid))
5602 continue;
Jeff Johnson295189b2012-06-20 16:38:30 -07005603
5604 for (tid=0; tid<STACFG_MAX_TC; tid++)
5605 {
Gopichand Nakkala681989c2013-03-06 22:27:48 -08005606 if((eBA_DISABLE == pSta->tcCfg[tid].fUseBATx) &&
Jeff Johnson295189b2012-06-20 16:38:30 -07005607 (pBaCandidate->baInfo[tid].fBaEnable))
5608 {
Hoonki Lee9af07cf2013-04-24 01:21:58 -07005609 limLog(pMac, LOGE, FL("BA setup for staId = %d, TID: %d, SSN: %d"),
5610 pSta->staIndex, tid, pBaCandidate->baInfo[tid].startingSeqNum);
Jeff Johnson295189b2012-06-20 16:38:30 -07005611 limPostMlmAddBAReq(pMac, pSta, tid, pBaCandidate->baInfo[tid].startingSeqNum,psessionEntry);
5612 }
5613 }
5614 }
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305615 vos_mem_free(limMsg->bodyptr);
Jeff Johnson295189b2012-06-20 16:38:30 -07005616 return;
5617}
5618
5619
5620/** -------------------------------------------------------------
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005621\fn limDeleteBASessions
5622\brief Deletes all the exisitng BA sessions for given session
5623 and BA direction.
Jeff Johnson295189b2012-06-20 16:38:30 -07005624\param tpAniSirGlobal pMac
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005625\param tpPESession pSessionEntry
5626\param tANI_U32 baDirection
5627\return None
Jeff Johnson295189b2012-06-20 16:38:30 -07005628-------------------------------------------------------------*/
5629
5630void
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005631limDeleteBASessions(tpAniSirGlobal pMac, tpPESession pSessionEntry,
5632 tANI_U32 baDirection)
Jeff Johnson295189b2012-06-20 16:38:30 -07005633{
5634 tANI_U32 i;
5635 tANI_U8 tid;
5636 tpDphHashNode pSta;
5637
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005638 if (NULL == pSessionEntry)
Jeff Johnson295189b2012-06-20 16:38:30 -07005639 {
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005640 limLog(pMac, LOGE, FL("Session does not exist"));
5641 }
5642 else
5643 {
5644 for(tid = 0; tid < STACFG_MAX_TC; tid++)
Jeff Johnson295189b2012-06-20 16:38:30 -07005645 {
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005646 if ((eLIM_AP_ROLE == pSessionEntry->limSystemRole) ||
5647 (pSessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE) ||
5648 (eLIM_STA_IN_IBSS_ROLE == pSessionEntry->limSystemRole) ||
5649 (pSessionEntry->limSystemRole == eLIM_P2P_DEVICE_GO))
Jeff Johnson295189b2012-06-20 16:38:30 -07005650 {
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005651 for (i = 0; i < pMac->lim.maxStation; i++)
Jeff Johnson295189b2012-06-20 16:38:30 -07005652 {
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005653 pSta = pSessionEntry->dph.dphHashTable.pDphNodeArray + i;
5654 if (pSta && pSta->added)
Kiran Kumar Lokerec1641f52013-05-29 14:29:43 -07005655 {
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005656 if ((eBA_ENABLE == pSta->tcCfg[tid].fUseBATx) &&
5657 (baDirection & BA_INITIATOR))
5658 {
5659 limPostMlmDelBAReq(pMac, pSta, eBA_INITIATOR, tid,
5660 eSIR_MAC_UNSPEC_FAILURE_REASON,
5661 pSessionEntry);
5662 }
5663 if ((eBA_ENABLE == pSta->tcCfg[tid].fUseBARx) &&
5664 (baDirection & BA_RECIPIENT))
5665 {
5666 limPostMlmDelBAReq(pMac, pSta, eBA_RECIPIENT, tid,
5667 eSIR_MAC_UNSPEC_FAILURE_REASON,
5668 pSessionEntry);
5669 }
Kiran Kumar Lokerec1641f52013-05-29 14:29:43 -07005670 }
Jeff Johnson295189b2012-06-20 16:38:30 -07005671 }
5672 }
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005673 else if ((eLIM_STA_ROLE == pSessionEntry->limSystemRole) ||
5674 (eLIM_BT_AMP_STA_ROLE == pSessionEntry->limSystemRole) ||
5675 (eLIM_P2P_DEVICE_ROLE == pSessionEntry->limSystemRole))
Gopichand Nakkala6a36e142013-06-07 21:23:15 -07005676 {
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005677 pSta = dphGetHashEntry(pMac, DPH_STA_HASH_INDEX_PEER,
5678 &pSessionEntry->dph.dphHashTable);
5679 if (pSta && pSta->added)
Gopichand Nakkala6a36e142013-06-07 21:23:15 -07005680 {
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005681 if ((eBA_ENABLE == pSta->tcCfg[tid].fUseBATx) &&
5682 (baDirection & BA_INITIATOR))
5683 {
5684 limPostMlmDelBAReq(pMac, pSta, eBA_INITIATOR, tid,
5685 eSIR_MAC_UNSPEC_FAILURE_REASON,
5686 pSessionEntry);
5687 }
5688 if ((eBA_ENABLE == pSta->tcCfg[tid].fUseBARx) &&
5689 (baDirection & BA_RECIPIENT))
5690 {
5691 limPostMlmDelBAReq(pMac, pSta, eBA_RECIPIENT, tid,
5692 eSIR_MAC_UNSPEC_FAILURE_REASON,
5693 pSessionEntry);
5694 }
Gopichand Nakkala6a36e142013-06-07 21:23:15 -07005695 }
5696 }
5697 }
Jeff Johnson295189b2012-06-20 16:38:30 -07005698 }
5699}
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005700
5701/** -------------------------------------------------------------
5702\fn limDelAllBASessions
5703\brief Deletes all the exisitng BA sessions.
5704\param tpAniSirGlobal pMac
5705\return None
5706-------------------------------------------------------------*/
5707
5708void limDelAllBASessions(tpAniSirGlobal pMac)
5709{
5710 tANI_U32 i;
5711 tpPESession pSessionEntry;
5712
5713 for (i = 0; i < pMac->lim.maxBssId; i++)
5714 {
5715 pSessionEntry = peFindSessionBySessionId(pMac, i);
5716 if (pSessionEntry)
5717 {
5718 limDeleteBASessions(pMac, pSessionEntry, BA_BOTH_DIRECTIONS);
5719 }
5720 }
5721}
5722
5723/** -------------------------------------------------------------
5724\fn limDelAllBASessionsBtc
5725\brief Deletes all the exisitng BA receipent sessions in 2.4GHz
5726 band.
5727\param tpAniSirGlobal pMac
5728\return None
5729-------------------------------------------------------------*/
5730
5731void limDelAllBASessionsBtc(tpAniSirGlobal pMac)
5732{
5733 tANI_U32 i;
5734 tpPESession pSessionEntry;
5735
5736 for (i = 0; i < pMac->lim.maxBssId; i++)
5737 {
5738 pSessionEntry = peFindSessionBySessionId(pMac, i);
5739 if (pSessionEntry)
5740 {
5741 if (SIR_BAND_2_4_GHZ ==
5742 limGetRFBand(pSessionEntry->currentOperChannel))
5743 {
5744 limDeleteBASessions(pMac, pSessionEntry, BA_RECIPIENT);
5745 }
5746 }
5747 }
5748}
5749
Jeff Johnson295189b2012-06-20 16:38:30 -07005750/** -------------------------------------------------------------
5751\fn limProcessDelTsInd
5752\brief handles the DeleteTS indication coming from HAL or generated by PE itself in some error cases.
5753 Validates the request, sends the DelTs action frame to the Peer and sends DelTs indicatoin to HDD.
5754\param tpAniSirGlobal pMac
5755\param tSirMsgQ limMsg
5756\return None
5757-------------------------------------------------------------*/
5758void
5759limProcessDelTsInd(tpAniSirGlobal pMac, tpSirMsgQ limMsg)
5760{
5761 tpDphHashNode pSta;
5762 tpDelTsParams pDelTsParam = (tpDelTsParams) (limMsg->bodyptr);
5763 tpSirDeltsReq pDelTsReq = NULL;
5764 tSirMacAddr peerMacAddr;
5765 tpSirDeltsReqInfo pDelTsReqInfo;
5766 tpLimTspecInfo pTspecInfo;
5767 tpPESession psessionEntry;
5768 tANI_U8 sessionId;
5769
5770if((psessionEntry = peFindSessionByBssid(pMac,pDelTsParam->bssId,&sessionId))== NULL)
5771 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005772 limLog(pMac, LOGE,FL("session does not exist for given BssId"));
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305773 vos_mem_free(limMsg->bodyptr);
Jeff Johnson295189b2012-06-20 16:38:30 -07005774 return;
5775 }
5776
5777 pTspecInfo = &(pMac->lim.tspecInfo[pDelTsParam->tspecIdx]);
5778 if(pTspecInfo->inuse == false)
5779 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005780 PELOGE(limLog(pMac, LOGE, FL("tspec entry with index %d is not in use"), pDelTsParam->tspecIdx);)
Jeff Johnson295189b2012-06-20 16:38:30 -07005781 goto error1;
5782 }
5783
5784 pSta = dphGetHashEntry(pMac, pTspecInfo->assocId, &psessionEntry->dph.dphHashTable);
5785 if(pSta == NULL)
5786 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005787 limLog(pMac, LOGE, FL("Could not find entry in DPH table for assocId = %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07005788 pTspecInfo->assocId);
5789 goto error1;
5790 }
5791
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305792 pDelTsReq = vos_mem_malloc(sizeof(tSirDeltsReq));
5793 if ( NULL == pDelTsReq )
Jeff Johnson295189b2012-06-20 16:38:30 -07005794 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305795 PELOGE(limLog(pMac, LOGE, FL("AllocateMemory() failed"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005796 goto error1;
5797 }
5798
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305799 vos_mem_set( (tANI_U8 *)pDelTsReq, sizeof(tSirDeltsReq), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07005800
5801 if(pSta->wmeEnabled)
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305802 vos_mem_copy( &(pDelTsReq->req.tspec), &(pTspecInfo->tspec), sizeof(tSirMacTspecIE));
Jeff Johnson295189b2012-06-20 16:38:30 -07005803 else
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305804 vos_mem_copy( &(pDelTsReq->req.tsinfo), &(pTspecInfo->tspec.tsinfo), sizeof(tSirMacTSInfo));
Jeff Johnson295189b2012-06-20 16:38:30 -07005805
5806
5807 //validate the req
5808 if (eSIR_SUCCESS != limValidateDeltsReq(pMac, pDelTsReq, peerMacAddr,psessionEntry))
5809 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005810 PELOGE(limLog(pMac, LOGE, FL("limValidateDeltsReq failed"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005811 goto error2;
5812 }
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005813 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 -07005814 pDelTsReq->aid, peerMacAddr[0], peerMacAddr[1], peerMacAddr[2],
5815 peerMacAddr[3], peerMacAddr[4], peerMacAddr[5]);)
5816
5817 limSendDeltsReqActionFrame(pMac, peerMacAddr, pDelTsReq->req.wmeTspecPresent, &pDelTsReq->req.tsinfo, &pDelTsReq->req.tspec,
5818 psessionEntry);
5819
5820 // prepare and send an sme indication to HDD
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305821 pDelTsReqInfo = vos_mem_malloc(sizeof(tSirDeltsReqInfo));
5822 if ( NULL == pDelTsReqInfo )
Jeff Johnson295189b2012-06-20 16:38:30 -07005823 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305824 PELOGE(limLog(pMac, LOGE, FL("AllocateMemory() failed"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005825 goto error3;
5826 }
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305827 vos_mem_set( (tANI_U8 *)pDelTsReqInfo, sizeof(tSirDeltsReqInfo), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07005828
5829 if(pSta->wmeEnabled)
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305830 vos_mem_copy( &(pDelTsReqInfo->tspec), &(pTspecInfo->tspec), sizeof(tSirMacTspecIE));
Jeff Johnson295189b2012-06-20 16:38:30 -07005831 else
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305832 vos_mem_copy( &(pDelTsReqInfo->tsinfo), &(pTspecInfo->tspec.tsinfo), sizeof(tSirMacTSInfo));
Jeff Johnson295189b2012-06-20 16:38:30 -07005833
5834 limSendSmeDeltsInd(pMac, pDelTsReqInfo, pDelTsReq->aid,psessionEntry);
5835
5836error3:
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305837 vos_mem_free(pDelTsReqInfo);
Jeff Johnson295189b2012-06-20 16:38:30 -07005838error2:
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305839 vos_mem_free(pDelTsReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07005840error1:
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305841 vos_mem_free(limMsg->bodyptr);
Jeff Johnson295189b2012-06-20 16:38:30 -07005842 return;
5843}
5844
5845/**
5846 * \brief Setup an A-MPDU/BA session
5847 *
5848 * \sa limPostMlmAddBAReq
5849 *
5850 * \param pMac The global tpAniSirGlobal object
5851 *
5852 * \param pStaDs DPH Hash Node object of peer STA
5853 *
5854 * \param tid TID for which a BA is being setup.
5855 * If this is set to 0xFFFF, then we retrieve
5856 * the default TID from the CFG
5857 *
5858 * \return eSIR_SUCCESS if setup completes successfully
5859 * eSIR_FAILURE is some problem is encountered
5860 */
5861tSirRetStatus limPostMlmAddBAReq( tpAniSirGlobal pMac,
5862 tpDphHashNode pStaDs,
5863 tANI_U8 tid, tANI_U16 startingSeqNum,tpPESession psessionEntry)
5864{
5865 tSirRetStatus status = eSIR_SUCCESS;
Jeff Johnson09fb4cd2013-04-03 15:27:59 -07005866 tpLimMlmAddBAReq pMlmAddBAReq = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07005867 tpDialogueToken dialogueTokenNode;
5868 tANI_U32 val = 0;
Jeff Johnson09fb4cd2013-04-03 15:27:59 -07005869
Jeff Johnson295189b2012-06-20 16:38:30 -07005870 // Check if the peer is a 11n capable STA
5871 // FIXME - Need a 11n peer indication in DPH.
5872 // For now, using the taurusPeer attribute
5873 //if( 0 == pStaDs->taurusPeer == )
5874 //return eSIR_SUCCESS;
5875
5876 // Allocate for LIM_MLM_ADDBA_REQ
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305877 pMlmAddBAReq = vos_mem_malloc(sizeof( tLimMlmAddBAReq ));
5878 if ( NULL == pMlmAddBAReq )
Jeff Johnson295189b2012-06-20 16:38:30 -07005879 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305880 limLog( pMac, LOGP, FL("AllocateMemory failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07005881 status = eSIR_MEM_ALLOC_FAILED;
5882 goto returnFailure;
5883 }
5884
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305885 vos_mem_set( (void *) pMlmAddBAReq, sizeof( tLimMlmAddBAReq ), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07005886
5887 // Copy the peer MAC
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305888 vos_mem_copy(
Jeff Johnson295189b2012-06-20 16:38:30 -07005889 pMlmAddBAReq->peerMacAddr,
5890 pStaDs->staAddr,
5891 sizeof( tSirMacAddr ));
5892
5893 // Update the TID
5894 pMlmAddBAReq->baTID = tid;
5895
5896 // Determine the supported BA policy of local STA
5897 // for the TID of interest
5898 pMlmAddBAReq->baPolicy = (pStaDs->baPolicyFlag >> tid) & 0x1;
5899
5900 // BA Buffer Size
5901 // Requesting the ADDBA recipient to populate the size.
5902 // If ADDBA is accepted, a non-zero buffer size should
5903 // be returned in the ADDBA Rsp
5904 pMlmAddBAReq->baBufferSize = 0;
5905
5906 limLog( pMac, LOGW,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005907 FL( "Requesting an ADDBA to setup a %s BA session with STA %d for TID %d" ),
Jeff Johnson295189b2012-06-20 16:38:30 -07005908 (pMlmAddBAReq->baPolicy ? "Immediate": "Delayed"),
5909 pStaDs->staIndex,
5910 tid );
5911
5912 // BA Timeout
Jeff Johnson09fb4cd2013-04-03 15:27:59 -07005913 if (wlan_cfgGetInt(pMac, WNI_CFG_BA_TIMEOUT, &val) != eSIR_SUCCESS)
Jeff Johnson295189b2012-06-20 16:38:30 -07005914 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005915 limLog(pMac, LOGE, FL("could not retrieve BA TIME OUT Param CFG"));
Jeff Johnson295189b2012-06-20 16:38:30 -07005916 status = eSIR_FAILURE;
5917 goto returnFailure;
5918 }
5919 pMlmAddBAReq->baTimeout = val; // In TU's
5920
5921 // ADDBA Failure Timeout
Jeff Johnson09fb4cd2013-04-03 15:27:59 -07005922 // FIXME_AMPDU - Need to retrieve this from CFG.
Jeff Johnson295189b2012-06-20 16:38:30 -07005923 //right now we are not checking for response timeout. so this field is dummy just to be compliant with the spec.
5924 pMlmAddBAReq->addBAFailureTimeout = 2000; // In TU's
5925
5926 // BA Starting Sequence Number
5927 pMlmAddBAReq->baSSN = startingSeqNum;
5928
5929 /* Update PE session Id*/
5930 pMlmAddBAReq->sessionId = psessionEntry->peSessionId;
5931
5932 LIM_SET_STA_BA_STATE(pStaDs, tid, eLIM_BA_STATE_WT_ADD_RSP);
5933
Jeff Johnson09fb4cd2013-04-03 15:27:59 -07005934 dialogueTokenNode = limAssignDialogueToken(pMac);
5935 if (NULL == dialogueTokenNode)
5936 {
5937 limLog(pMac, LOGE, FL("could not assign dialogue token"));
5938 status = eSIR_FAILURE;
5939 goto returnFailure;
5940 }
5941
Jeff Johnson295189b2012-06-20 16:38:30 -07005942 pMlmAddBAReq->baDialogToken = dialogueTokenNode->token;
Jeff Johnson09fb4cd2013-04-03 15:27:59 -07005943 //set assocId and tid information in the lim linked list
Jeff Johnson295189b2012-06-20 16:38:30 -07005944 dialogueTokenNode->assocId = pStaDs->assocId;
5945 dialogueTokenNode->tid = tid;
5946 // Send ADDBA Req to MLME
5947 limPostMlmMessage( pMac,
5948 LIM_MLM_ADDBA_REQ,
5949 (tANI_U32 *) pMlmAddBAReq );
Jeff Johnson09fb4cd2013-04-03 15:27:59 -07005950 return eSIR_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -07005951
5952returnFailure:
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305953 vos_mem_free(pMlmAddBAReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07005954 return status;
5955}
5956
5957/**
5958 * \brief Post LIM_MLM_ADDBA_RSP to MLME. MLME
5959 * will then send an ADDBA Rsp to peer MAC entity
5960 * with the appropriate ADDBA status code
5961 *
5962 * \sa limPostMlmAddBARsp
5963 *
5964 * \param pMac The global tpAniSirGlobal object
5965 *
5966 * \param peerMacAddr MAC address of peer entity that will
5967 * be the recipient of this ADDBA Rsp
5968 *
5969 * \param baStatusCode ADDBA Rsp status code
5970 *
5971 * \param baDialogToken ADDBA Rsp dialog token
5972 *
5973 * \param baTID TID of interest
5974 *
5975 * \param baPolicy The BA policy
5976 *
5977 * \param baBufferSize The BA buffer size
5978 *
5979 * \param baTimeout BA timeout in TU's
5980 *
5981 * \return eSIR_SUCCESS if setup completes successfully
5982 * eSIR_FAILURE is some problem is encountered
5983 */
5984tSirRetStatus limPostMlmAddBARsp( tpAniSirGlobal pMac,
5985 tSirMacAddr peerMacAddr,
5986 tSirMacStatusCodes baStatusCode,
5987 tANI_U8 baDialogToken,
5988 tANI_U8 baTID,
5989 tANI_U8 baPolicy,
5990 tANI_U16 baBufferSize,
5991 tANI_U16 baTimeout,
5992 tpPESession psessionEntry)
5993{
5994tSirRetStatus status = eSIR_SUCCESS;
5995tpLimMlmAddBARsp pMlmAddBARsp;
5996
5997 // Allocate for LIM_MLM_ADDBA_RSP
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305998 pMlmAddBARsp = vos_mem_malloc(sizeof( tLimMlmAddBARsp ));
5999 if ( NULL == pMlmAddBARsp )
Jeff Johnson295189b2012-06-20 16:38:30 -07006000 {
6001 limLog( pMac, LOGE,
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306002 FL("AllocateMemory failed with error code %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07006003 status );
6004
6005 status = eSIR_MEM_ALLOC_FAILED;
6006 goto returnFailure;
6007 }
6008
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306009 vos_mem_set( (void *) pMlmAddBARsp, sizeof( tLimMlmAddBARsp ), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07006010
6011 // Copy the peer MAC
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306012 vos_mem_copy(
Jeff Johnson295189b2012-06-20 16:38:30 -07006013 pMlmAddBARsp->peerMacAddr,
6014 peerMacAddr,
6015 sizeof( tSirMacAddr ));
6016
6017 pMlmAddBARsp->baDialogToken = baDialogToken;
6018 pMlmAddBARsp->addBAResultCode = baStatusCode;
6019 pMlmAddBARsp->baTID = baTID;
6020 pMlmAddBARsp->baPolicy = baPolicy;
6021 pMlmAddBARsp->baBufferSize = baBufferSize;
6022 pMlmAddBARsp->baTimeout = baTimeout;
6023
6024 /* UPdate PE session ID*/
6025 pMlmAddBARsp->sessionId = psessionEntry->peSessionId;
6026
6027 // Send ADDBA Rsp to MLME
6028 limPostMlmMessage( pMac,
6029 LIM_MLM_ADDBA_RSP,
6030 (tANI_U32 *) pMlmAddBARsp );
6031
6032returnFailure:
6033
6034 return status;
6035}
6036
6037/**
6038 * \brief Post LIM_MLM_DELBA_REQ to MLME. MLME
6039 * will then send an DELBA Ind to peer MAC entity
6040 * with the appropriate DELBA status code
6041 *
6042 * \sa limPostMlmDelBAReq
6043 *
6044 * \param pMac The global tpAniSirGlobal object
6045 *
6046 * \param pSta DPH Hash Node object of peer MAC entity
6047 * for which the BA session is being deleted
6048 *
6049 * \param baDirection DELBA direction
6050 *
6051 * \param baTID TID for which the BA session is being deleted
6052 *
6053 * \param baReasonCode DELBA Req reason code
6054 *
6055 * \return eSIR_SUCCESS if setup completes successfully
6056 * eSIR_FAILURE is some problem is encountered
6057 */
6058tSirRetStatus limPostMlmDelBAReq( tpAniSirGlobal pMac,
6059 tpDphHashNode pSta,
6060 tANI_U8 baDirection,
6061 tANI_U8 baTID,
6062 tSirMacReasonCodes baReasonCode,
6063 tpPESession psessionEntry)
6064{
6065tSirRetStatus status = eSIR_SUCCESS;
6066tpLimMlmDelBAReq pMlmDelBAReq;
6067tLimBAState curBaState;
6068
6069if(NULL == pSta)
6070 return eSIR_FAILURE;
6071
6072LIM_GET_STA_BA_STATE(pSta, baTID, &curBaState);
6073
6074 // Need to validate the current BA State.
6075 if( eLIM_BA_STATE_IDLE != curBaState)
6076 {
6077 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006078 FL( "Received unexpected DELBA REQ when STA BA state for tid = %d is %d" ),
Jeff Johnson295189b2012-06-20 16:38:30 -07006079 baTID,
6080 curBaState);
6081
6082 status = eSIR_FAILURE;
6083 goto returnFailure;
6084 }
6085
6086 // Allocate for LIM_MLM_DELBA_REQ
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306087 pMlmDelBAReq = vos_mem_malloc(sizeof( tLimMlmDelBAReq ));
6088 if ( NULL == pMlmDelBAReq )
Jeff Johnson295189b2012-06-20 16:38:30 -07006089 {
6090 limLog( pMac, LOGE,
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306091 FL("AllocateMemory failed with error code %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07006092 status );
6093
6094 status = eSIR_MEM_ALLOC_FAILED;
6095 goto returnFailure;
6096 }
6097
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306098 vos_mem_set( (void *) pMlmDelBAReq, sizeof( tLimMlmDelBAReq ), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07006099
6100 // Copy the peer MAC
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306101 vos_mem_copy(
Jeff Johnson295189b2012-06-20 16:38:30 -07006102 pMlmDelBAReq->peerMacAddr,
6103 pSta->staAddr,
6104 sizeof( tSirMacAddr ));
6105
6106 pMlmDelBAReq->baDirection = baDirection;
6107 pMlmDelBAReq->baTID = baTID;
6108 pMlmDelBAReq->delBAReasonCode = baReasonCode;
6109
6110 /* Update PE session ID*/
6111 pMlmDelBAReq->sessionId = psessionEntry->peSessionId;
6112
6113 //we don't have valid BA session for the given direction.
6114 // HDD wants to get the BA session deleted on PEER in this case.
6115 // in this case we just need to send DelBA to the peer.
6116 if(((eBA_RECIPIENT == baDirection) && (eBA_DISABLE == pSta->tcCfg[baTID].fUseBARx)) ||
6117 ((eBA_INITIATOR == baDirection) && (eBA_DISABLE == pSta->tcCfg[baTID].fUseBATx)))
6118 {
6119 // Send DELBA Ind over the air
6120 if( eSIR_SUCCESS !=
6121 (status = limSendDelBAInd( pMac, pMlmDelBAReq,psessionEntry)))
6122 status = eSIR_FAILURE;
6123
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306124 vos_mem_free(pMlmDelBAReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07006125 return status;
6126 }
6127
6128
6129 // Update the BA state in STA
6130 LIM_SET_STA_BA_STATE(pSta, pMlmDelBAReq->baTID, eLIM_BA_STATE_WT_DEL_RSP);
6131
6132 // Send DELBA Req to MLME
6133 limPostMlmMessage( pMac,
6134 LIM_MLM_DELBA_REQ,
6135 (tANI_U32 *) pMlmDelBAReq );
6136
6137returnFailure:
6138
6139 return status;
6140}
6141
6142/**
6143 * \brief Send WDA_ADDBA_REQ to HAL, in order
6144 * to setup a new BA session with a peer
6145 *
6146 * \sa limPostMsgAddBAReq
6147 *
6148 * \param pMac The global tpAniSirGlobal object
6149 *
6150 * \param pSta Runtime, STA-related configuration cached
6151 * in the HashNode object
6152 *
6153 * \param baDialogToken The Action Frame dialog token
6154 *
6155 * \param baTID TID for which the BA session is being setup
6156 *
6157 * \param baPolicy BA Policy
6158 *
6159 * \param baBufferSize The requested BA buffer size
6160 *
6161 * \param baTimeout BA Timeout. 0 indicates no BA timeout enforced
6162 *
6163 * \param baSSN Starting Sequence Number for this BA session
6164 *
6165 * \param baDirection BA Direction: 1 - Initiator, 0 - Recipient
6166 *
6167 * \return none
6168 *
6169 */
6170tSirRetStatus limPostMsgAddBAReq( tpAniSirGlobal pMac,
6171 tpDphHashNode pSta,
6172 tANI_U8 baDialogToken,
6173 tANI_U8 baTID,
6174 tANI_U8 baPolicy,
6175 tANI_U16 baBufferSize,
6176 tANI_U16 baTimeout,
6177 tANI_U16 baSSN,
6178 tANI_U8 baDirection,
6179 tpPESession psessionEntry)
6180{
6181tpAddBAParams pAddBAParams = NULL;
6182tSirRetStatus retCode = eSIR_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -07006183tSirMsgQ msgQ;
6184
6185#ifdef WLAN_SOFTAP_VSTA_FEATURE
6186 // we can only do BA on "hard" STAs
6187 if (!(IS_HWSTA_IDX(pSta->staIndex)))
6188 {
6189 retCode = eHAL_STATUS_FAILURE;
6190 goto returnFailure;
6191 }
6192#endif //WLAN_SOFTAP_VSTA_FEATURE
6193
6194 // Allocate for WDA_ADDBA_REQ
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306195 pAddBAParams = vos_mem_malloc(sizeof( tAddBAParams ));
6196 if ( NULL == pAddBAParams )
Jeff Johnson295189b2012-06-20 16:38:30 -07006197 {
6198 limLog( pMac, LOGE,
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306199 FL("AllocateMemory failed")
6200 );
Jeff Johnson295189b2012-06-20 16:38:30 -07006201
6202 retCode = eSIR_MEM_ALLOC_FAILED;
6203 goto returnFailure;
6204 }
6205
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306206 vos_mem_set( (void *) pAddBAParams, sizeof( tAddBAParams ), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07006207
6208 // Copy the peer MAC address
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306209 vos_mem_copy(
Jeff Johnson295189b2012-06-20 16:38:30 -07006210 (void *) pAddBAParams->peerMacAddr,
6211 (void *) pSta->staAddr,
6212 sizeof( tSirMacAddr ));
6213
6214 // Populate the REQ parameters
6215 pAddBAParams->staIdx = pSta->staIndex;
6216 pAddBAParams->baDialogToken = baDialogToken;
6217 pAddBAParams->baTID = baTID;
6218 pAddBAParams->baPolicy = baPolicy;
6219 pAddBAParams->baBufferSize = baBufferSize;
6220 pAddBAParams->baTimeout = baTimeout;
6221 pAddBAParams->baSSN = baSSN;
6222 pAddBAParams->baDirection = baDirection;
6223 pAddBAParams->respReqd = 1;
6224
6225 /* UPdate PE session ID */
6226 pAddBAParams->sessionId = psessionEntry->peSessionId;
6227
6228 // Post WDA_ADDBA_REQ to HAL.
6229 msgQ.type = WDA_ADDBA_REQ;
6230 //
6231 // FIXME_AMPDU
6232 // A global counter (dialog token) is required to keep track of
6233 // all PE <-> HAL communication(s)
6234 //
6235 msgQ.reserved = 0;
6236 msgQ.bodyptr = pAddBAParams;
6237 msgQ.bodyval = 0;
6238
6239 limLog( pMac, LOGW,
6240 FL( "Sending WDA_ADDBA_REQ..." ));
6241
6242 //defer any other message until we get response back.
6243 SET_LIM_PROCESS_DEFD_MESGS(pMac, false);
6244
Jeff Johnsone7245742012-09-05 17:12:55 -07006245 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07006246#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
6247 limDiagEventReport(pMac, WLAN_PE_DIAG_HAL_ADDBA_REQ_EVENT, psessionEntry, 0, 0);
6248#endif //FEATURE_WLAN_DIAG_SUPPORT
6249
6250 if( eSIR_SUCCESS != (retCode = wdaPostCtrlMsg( pMac, &msgQ )))
6251 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006252 FL("Posting WDA_ADDBA_REQ to HAL failed! Reason = %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07006253 retCode );
6254 else
6255 return retCode;
6256
6257returnFailure:
6258
6259 // Clean-up...
6260 if( NULL != pAddBAParams )
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306261 vos_mem_free( pAddBAParams );
Jeff Johnson295189b2012-06-20 16:38:30 -07006262
6263 return retCode;
6264
6265}
6266
6267/**
6268 * \brief Send WDA_DELBA_IND to HAL, in order
6269 * to delete an existing BA session with peer
6270 *
6271 * \sa limPostMsgDelBAInd
6272 *
6273 * \param pMac The global tpAniSirGlobal object
6274 *
6275 * \param pSta Runtime, STA-related configuration cached
6276 * in the HashNode object
6277 *
6278 * \param baTID TID for which the BA session is being setup
6279 *
6280 * \param baDirection Identifies whether the DELBA Ind was
6281 * sent by the BA initiator or recipient
6282 *
6283 * \return none
6284 *
6285 */
6286tSirRetStatus limPostMsgDelBAInd( tpAniSirGlobal pMac,
6287 tpDphHashNode pSta,
6288 tANI_U8 baTID,
6289 tANI_U8 baDirection,
6290 tpPESession psessionEntry)
6291{
6292tpDelBAParams pDelBAParams = NULL;
6293tSirRetStatus retCode = eSIR_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -07006294tSirMsgQ msgQ;
6295
6296 // Allocate for SIR_HAL_DELBA_IND
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306297 pDelBAParams = vos_mem_malloc(sizeof( tDelBAParams ));
6298 if ( NULL == pDelBAParams )
Jeff Johnson295189b2012-06-20 16:38:30 -07006299 {
6300 limLog( pMac, LOGE,
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306301 FL("AllocateMemory failed")
6302 );
Jeff Johnson295189b2012-06-20 16:38:30 -07006303
6304 retCode = eSIR_MEM_ALLOC_FAILED;
6305 goto returnFailure;
6306 }
6307
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306308 vos_mem_set( (void *) pDelBAParams, sizeof( tDelBAParams ), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07006309
6310 // Populate the REQ parameters
6311 pDelBAParams->staIdx = pSta->staIndex;
6312 pDelBAParams->baTID = baTID;
6313 pDelBAParams->baDirection = baDirection;
6314
6315 /* Update PE session ID */
6316
6317
6318 //TBD-RAJESH Updating of the session ID is requird for SIR_HAL_DELBA_IND?????
6319 //pDelBAParams->sessionId = psessionEntry->peSessionId;
6320
6321 // Post WDA_DELBA_IND to HAL.
6322 msgQ.type = WDA_DELBA_IND;
6323 //
6324 // FIXME:
6325 // A global counter (dialog token) is required to keep track of
6326 // all PE <-> HAL communication(s)
6327 //
6328 msgQ.reserved = 0;
6329 msgQ.bodyptr = pDelBAParams;
6330 msgQ.bodyval = 0;
6331
6332 limLog( pMac, LOGW,
6333 FL( "Sending SIR_HAL_DELBA_IND..." ));
6334
Jeff Johnsone7245742012-09-05 17:12:55 -07006335 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07006336#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
6337 limDiagEventReport(pMac, WLAN_PE_DIAG_HAL_DELBA_IND_EVENT, psessionEntry, 0, 0);
6338#endif //FEATURE_WLAN_DIAG_SUPPORT
6339
6340 if( eSIR_SUCCESS != (retCode = wdaPostCtrlMsg( pMac, &msgQ )))
6341 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006342 FL("Posting WDA_DELBA_IND to HAL failed! Reason = %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07006343 retCode );
6344 else
6345 {
6346 // Update LIM's internal cache...
6347 if( eBA_INITIATOR == baDirection)
6348 {
6349 pSta->tcCfg[baTID].fUseBATx = 0;
6350 pSta->tcCfg[baTID].txBufSize = 0;
6351 }
6352 else
6353 {
6354 pSta->tcCfg[baTID].fUseBARx = 0;
6355 pSta->tcCfg[baTID].rxBufSize = 0;
6356 }
6357
6358 return retCode;
6359 }
6360
6361returnFailure:
6362
6363 // Clean-up...
6364 if( NULL != pDelBAParams )
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306365 vos_mem_free( pDelBAParams );
Jeff Johnson295189b2012-06-20 16:38:30 -07006366
6367 return retCode;
6368
6369}
6370
6371/**
6372 * @function : limPostSMStateUpdate()
6373 *
6374 * @brief : This function Updates the HAL and Softmac about the change in the STA's SMPS state.
6375 *
6376 * LOGIC:
6377 *
6378 * ASSUMPTIONS:
6379 * NA
6380 *
6381 * NOTE:
6382 * NA
6383 *
6384 * @param pMac - Pointer to Global MAC structure
6385 * @param limMsg - Lim Message structure object with the MimoPSparam in body
6386 * @return None
6387 */
6388tSirRetStatus
6389limPostSMStateUpdate(tpAniSirGlobal pMac,
6390 tANI_U16 staIdx, tSirMacHTMIMOPowerSaveState state)
6391{
6392 tSirRetStatus retCode = eSIR_SUCCESS;
6393 tSirMsgQ msgQ;
Jeff Johnson295189b2012-06-20 16:38:30 -07006394 tpSetMIMOPS pMIMO_PSParams;
6395
6396 msgQ.reserved = 0;
6397 msgQ.type = WDA_SET_MIMOPS_REQ;
6398
6399 // Allocate for WDA_SET_MIMOPS_REQ
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306400 pMIMO_PSParams = vos_mem_malloc(sizeof(tSetMIMOPS));
6401 if ( NULL == pMIMO_PSParams )
6402 {
6403 limLog( pMac, LOGP,FL(" AllocateMemory failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07006404 return eSIR_MEM_ALLOC_FAILED;
6405 }
6406
6407 pMIMO_PSParams->htMIMOPSState = state;
6408 pMIMO_PSParams->staIdx = staIdx;
6409 pMIMO_PSParams->fsendRsp = true;
6410 msgQ.bodyptr = pMIMO_PSParams;
6411 msgQ.bodyval = 0;
6412
6413 limLog( pMac, LOG2, FL( "Sending WDA_SET_MIMOPS_REQ..." ));
6414
Jeff Johnsone7245742012-09-05 17:12:55 -07006415 MTRACE(macTraceMsgTx(pMac, NO_SESSION, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07006416 retCode = wdaPostCtrlMsg( pMac, &msgQ );
6417 if (eSIR_SUCCESS != retCode)
6418 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006419 limLog( pMac, LOGP, FL("Posting WDA_SET_MIMOPS_REQ to HAL failed! Reason = %d"), retCode );
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306420 vos_mem_free(pMIMO_PSParams);
Jeff Johnson295189b2012-06-20 16:38:30 -07006421 return retCode;
6422 }
6423
6424 return retCode;
6425}
6426
6427void limPktFree (
6428 tpAniSirGlobal pMac,
6429 eFrameType frmType,
6430 tANI_U8 *pRxPacketInfo,
6431 void *pBody)
6432{
6433 (void) pMac; (void) frmType; (void) pRxPacketInfo; (void) pBody;
Jeff Johnson295189b2012-06-20 16:38:30 -07006434}
6435
6436/**
6437 * limGetBDfromRxPacket()
6438 *
6439 *FUNCTION:
6440 * This function is called to get pointer to Polaris
6441 * Buffer Descriptor containing MAC header & other control
6442 * info from the body of the message posted to LIM.
6443 *
6444 *LOGIC:
6445 * NA
6446 *
6447 *ASSUMPTIONS:
6448 * NA
6449 *
6450 *NOTE:
6451 * NA
6452 *
6453 * @param body - Received message body
6454 * @param pRxPacketInfo - Pointer to received BD
6455 * @return None
6456 */
6457
6458void
6459limGetBDfromRxPacket(tpAniSirGlobal pMac, void *body, tANI_U32 **pRxPacketInfo)
6460{
Jeff Johnson295189b2012-06-20 16:38:30 -07006461 *pRxPacketInfo = (tANI_U32 *) body;
Jeff Johnson295189b2012-06-20 16:38:30 -07006462} /*** end limGetBDfromRxPacket() ***/
6463
6464
6465
6466
6467
6468void limRessetScanChannelInfo(tpAniSirGlobal pMac)
6469{
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306470 vos_mem_set(&pMac->lim.scanChnInfo, sizeof(tLimScanChnInfo), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07006471}
6472
6473
6474void limAddScanChannelInfo(tpAniSirGlobal pMac, tANI_U8 channelId)
6475{
6476 tANI_U8 i;
6477 tANI_BOOLEAN fFound = eANI_BOOLEAN_FALSE;
6478
6479 for(i = 0; i < pMac->lim.scanChnInfo.numChnInfo; i++)
6480 {
6481 if(pMac->lim.scanChnInfo.scanChn[i].channelId == channelId)
6482 {
6483 pMac->lim.scanChnInfo.scanChn[i].numTimeScan++;
6484 fFound = eANI_BOOLEAN_TRUE;
6485 break;
6486 }
6487 }
6488 if(eANI_BOOLEAN_FALSE == fFound)
6489 {
6490 if(pMac->lim.scanChnInfo.numChnInfo < SIR_MAX_SUPPORTED_CHANNEL_LIST)
6491 {
6492 pMac->lim.scanChnInfo.scanChn[pMac->lim.scanChnInfo.numChnInfo].channelId = channelId;
6493 pMac->lim.scanChnInfo.scanChn[pMac->lim.scanChnInfo.numChnInfo++].numTimeScan = 1;
6494 }
6495 else
6496 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006497 PELOGW(limLog(pMac, LOGW, FL(" -- number of channels exceed mac"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07006498 }
6499 }
6500}
6501
6502
6503/**
6504 * @function : limIsChannelValidForChannelSwitch()
6505 *
6506 * @brief : This function checks if the channel to which AP
6507 * is expecting us to switch, is a valid channel for us.
6508 * LOGIC:
6509 *
6510 * ASSUMPTIONS:
6511 * NA
6512 *
6513 * NOTE:
6514 * NA
6515 *
6516 * @param pMac - Pointer to Global MAC structure
6517 * @param channel - New channel to which we are expected to move
6518 * @return None
6519 */
6520tAniBool
6521limIsChannelValidForChannelSwitch(tpAniSirGlobal pMac, tANI_U8 channel)
6522{
6523 tANI_U8 index;
6524 tANI_U32 validChannelListLen = WNI_CFG_VALID_CHANNEL_LIST_LEN;
6525 tSirMacChanNum validChannelList[WNI_CFG_VALID_CHANNEL_LIST_LEN];
6526
6527 if (wlan_cfgGetStr(pMac, WNI_CFG_VALID_CHANNEL_LIST,
6528 (tANI_U8 *)validChannelList,
6529 (tANI_U32 *)&validChannelListLen) != eSIR_SUCCESS)
6530 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006531 PELOGE(limLog(pMac, LOGE, FL("could not retrieve valid channel list"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07006532 return (eSIR_FALSE);
6533 }
6534
6535 for(index = 0; index < validChannelListLen; index++)
6536 {
6537 if(validChannelList[index] == channel)
6538 return (eSIR_TRUE);
6539 }
6540
6541 /* channel does not belong to list of valid channels */
6542 return (eSIR_FALSE);
6543}
6544
6545/**------------------------------------------------------
6546\fn __limFillTxControlParams
6547\brief Fill the message for stopping/resuming tx.
6548
6549\param pMac
6550\param pTxCtrlMsg - Pointer to tx control message.
6551\param type - Which way we want to stop/ resume tx.
6552\param mode - To stop/resume.
6553 -------------------------------------------------------*/
6554static eHalStatus
6555__limFillTxControlParams(tpAniSirGlobal pMac, tpTxControlParams pTxCtrlMsg,
6556 tLimQuietTxMode type, tLimControlTx mode)
6557{
6558
6559 //TBD-RAJESH HOW TO GET sessionEntry?????
6560 tpPESession psessionEntry = &pMac->lim.gpSession[0];
6561
6562 if (mode == eLIM_STOP_TX)
6563 pTxCtrlMsg->stopTx = eANI_BOOLEAN_TRUE;
6564 else
6565 pTxCtrlMsg->stopTx = eANI_BOOLEAN_FALSE;
6566
6567 switch (type)
6568 {
6569 case eLIM_TX_ALL:
6570 /** Stops/resumes transmission completely */
6571 pTxCtrlMsg->fCtrlGlobal = 1;
6572 break;
6573
6574 case eLIM_TX_BSS_BUT_BEACON:
6575 /** Stops/resumes transmission on a particular BSS. Stopping BSS, doesnt
6576 * stop beacon transmission.
6577 */
6578 pTxCtrlMsg->ctrlBss = 1;
6579 pTxCtrlMsg->bssBitmap |= (1 << psessionEntry->bssIdx);
6580 break;
6581
6582 case eLIM_TX_STA:
6583 /** Memory for station bitmap is allocated dynamically in caller of this
6584 * so decode properly here and fill the bitmap. Now not implemented,
6585 * fall through.
6586 */
6587 case eLIM_TX_BSS:
6588 //Fall thru...
6589 default:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006590 PELOGW(limLog(pMac, LOGW, FL("Invalid case: Not Handled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07006591 return eHAL_STATUS_FAILURE;
6592 }
6593
6594 return eHAL_STATUS_SUCCESS;
6595}
6596
6597/**
6598 * @function : limFrameTransmissionControl()
6599 *
6600 * @brief : This API is called by the user to halt/resume any frame
6601 * transmission from the device. If stopped, all frames will be
6602 * queued starting from hardware. Then back-pressure
6603 * is built till the driver.
6604 * LOGIC:
6605 *
6606 * ASSUMPTIONS:
6607 * NA
6608 *
6609 * NOTE:
6610 * NA
6611 *
6612 * @param pMac - Pointer to Global MAC structure
6613 * @return None
6614 */
6615void limFrameTransmissionControl(tpAniSirGlobal pMac, tLimQuietTxMode type, tLimControlTx mode)
6616{
6617
6618 eHalStatus status = eHAL_STATUS_FAILURE;
6619 tpTxControlParams pTxCtrlMsg;
6620 tSirMsgQ msgQ;
6621 tANI_U8 nBytes = 0; // No of bytes required for station bitmap.
6622
6623 /** Allocate only required number of bytes for station bitmap
6624 * Make it to align to 4 byte boundary */
6625 nBytes = (tANI_U8)HALMSG_NUMBYTES_STATION_BITMAP(pMac->lim.maxStation);
6626
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306627 pTxCtrlMsg = vos_mem_malloc(sizeof(*pTxCtrlMsg) + nBytes);
6628 if ( NULL == pTxCtrlMsg )
Jeff Johnson295189b2012-06-20 16:38:30 -07006629 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306630 limLog(pMac, LOGP, FL("AllocateMemory() failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07006631 return;
6632 }
6633
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306634 vos_mem_set((void *) pTxCtrlMsg,
6635 (sizeof(*pTxCtrlMsg) + nBytes), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07006636 status = __limFillTxControlParams(pMac, pTxCtrlMsg, type, mode);
6637 if (status != eHAL_STATUS_SUCCESS)
6638 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306639 vos_mem_free(pTxCtrlMsg);
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006640 limLog(pMac, LOGP, FL("__limFillTxControlParams failed, status = %d"), status);
Jeff Johnson295189b2012-06-20 16:38:30 -07006641 return;
6642 }
6643
6644 msgQ.bodyptr = (void *) pTxCtrlMsg;
6645 msgQ.bodyval = 0;
6646 msgQ.reserved = 0;
6647 msgQ.type = WDA_TRANSMISSION_CONTROL_IND;
6648
Jeff Johnsone7245742012-09-05 17:12:55 -07006649 MTRACE(macTraceMsgTx(pMac, NO_SESSION, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07006650 if(wdaPostCtrlMsg( pMac, &msgQ) != eSIR_SUCCESS)
6651 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306652 vos_mem_free(pTxCtrlMsg);
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006653 limLog( pMac, LOGP, FL("Posting Message to HAL failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07006654 return;
6655 }
6656
6657 if (mode == eLIM_STOP_TX)
6658 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006659 PELOG1(limLog(pMac, LOG1, FL("Stopping the transmission of all packets, indicated softmac"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07006660 }
6661 else
6662 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006663 PELOG1(limLog(pMac, LOG1, FL("Resuming the transmission of all packets, indicated softmac"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07006664 }
6665 return;
6666}
6667
6668
6669/**
6670 * @function : limRestorePreChannelSwitchState()
6671 *
6672 * @brief : This API is called by the user to undo any
6673 * specific changes done on the device during
6674 * channel switch.
6675 * LOGIC:
6676 *
6677 * ASSUMPTIONS:
6678 * NA
6679 *
6680 * NOTE:
6681 * NA
6682 *
6683 * @param pMac - Pointer to Global MAC structure
6684 * @return None
6685 */
6686
6687tSirRetStatus
6688limRestorePreChannelSwitchState(tpAniSirGlobal pMac, tpPESession psessionEntry)
6689{
6690
6691 tSirRetStatus retCode = eSIR_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -07006692 tANI_U32 val = 0;
6693
6694 if (psessionEntry->limSystemRole != eLIM_STA_ROLE)
6695 return retCode;
6696
6697 /* Channel switch should be ready for the next time */
Jeff Johnsone7245742012-09-05 17:12:55 -07006698 psessionEntry->gLimSpecMgmt.dot11hChanSwState = eLIM_11H_CHANSW_INIT;
Jeff Johnson295189b2012-06-20 16:38:30 -07006699
6700 /* Restore the frame transmission, all the time. */
6701 limFrameTransmissionControl(pMac, eLIM_TX_ALL, eLIM_RESUME_TX);
6702
6703 /* Free to enter BMPS */
6704 limSendSmePostChannelSwitchInd(pMac);
6705
6706 //Background scan is now enabled by SME
6707 if(pMac->lim.gLimBackgroundScanTerminate == FALSE)
6708 {
6709 /* Enable background scan if already enabled, else don't bother */
6710 if ((retCode = wlan_cfgGetInt(pMac, WNI_CFG_BACKGROUND_SCAN_PERIOD,
6711 &val)) != eSIR_SUCCESS)
6712
6713 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006714 limLog(pMac, LOGP, FL("could not retrieve Background scan period value"));
Jeff Johnson295189b2012-06-20 16:38:30 -07006715 return (retCode);
6716 }
6717
6718 if (val > 0 && TX_TIMER_VALID(pMac->lim.limTimers.gLimBackgroundScanTimer))
6719 {
Ravi Joshid2ca7c42013-07-23 08:37:49 -07006720 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE,
6721 psessionEntry->peSessionId, eLIM_BACKGROUND_SCAN_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -07006722 if(tx_timer_activate(&pMac->lim.limTimers.gLimBackgroundScanTimer) != TX_SUCCESS)
6723 {
6724 limLog(pMac, LOGP, FL("Could not restart background scan timer, doing LOGP"));
6725 return (eSIR_FAILURE);
6726 }
6727
6728 }
6729 }
6730
6731 /* Enable heartbeat timer */
6732 if (TX_TIMER_VALID(pMac->lim.limTimers.gLimHeartBeatTimer))
6733 {
Ravi Joshid2ca7c42013-07-23 08:37:49 -07006734 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE,
6735 psessionEntry->peSessionId, eLIM_HEART_BEAT_TIMER));
6736 if((limActivateHearBeatTimer(pMac, psessionEntry) != TX_SUCCESS) &&
6737 (!IS_ACTIVEMODE_OFFLOAD_FEATURE_ENABLE))
Jeff Johnson295189b2012-06-20 16:38:30 -07006738 {
6739 limLog(pMac, LOGP, FL("Could not restart heartbeat timer, doing LOGP"));
6740 return (eSIR_FAILURE);
6741 }
6742 }
Jeff Johnson295189b2012-06-20 16:38:30 -07006743 return (retCode);
6744}
6745
6746
6747/**--------------------------------------------
6748\fn limRestorePreQuietState
6749\brief Restore the pre quiet state
6750
6751\param pMac
6752\return NONE
6753---------------------------------------------*/
Jeff Johnsone7245742012-09-05 17:12:55 -07006754tSirRetStatus limRestorePreQuietState(tpAniSirGlobal pMac, tpPESession psessionEntry)
Jeff Johnson295189b2012-06-20 16:38:30 -07006755{
6756
6757 tSirRetStatus retCode = eSIR_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -07006758 tANI_U32 val = 0;
6759
6760 if (pMac->lim.gLimSystemRole != eLIM_STA_ROLE)
6761 return retCode;
6762
6763 /* Quiet should be ready for the next time */
Jeff Johnsone7245742012-09-05 17:12:55 -07006764 psessionEntry->gLimSpecMgmt.quietState = eLIM_QUIET_INIT;
Jeff Johnson295189b2012-06-20 16:38:30 -07006765
6766 /* Restore the frame transmission, all the time. */
Jeff Johnsone7245742012-09-05 17:12:55 -07006767 if (psessionEntry->gLimSpecMgmt.quietState == eLIM_QUIET_RUNNING)
Jeff Johnson295189b2012-06-20 16:38:30 -07006768 limFrameTransmissionControl(pMac, eLIM_TX_ALL, eLIM_RESUME_TX);
6769
6770
6771 //Background scan is now enabled by SME
6772 if(pMac->lim.gLimBackgroundScanTerminate == FALSE)
6773 {
6774 /* Enable background scan if already enabled, else don't bother */
6775 if ((retCode = wlan_cfgGetInt(pMac, WNI_CFG_BACKGROUND_SCAN_PERIOD,
6776 &val)) != eSIR_SUCCESS)
6777
6778 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006779 limLog(pMac, LOGP, FL("could not retrieve Background scan period value"));
Jeff Johnson295189b2012-06-20 16:38:30 -07006780 return (retCode);
6781 }
6782
6783 if (val > 0 && TX_TIMER_VALID(pMac->lim.limTimers.gLimBackgroundScanTimer))
6784 {
Leela V Kiran Kumar Reddy Chiralac3b9d382013-01-31 20:49:53 -08006785 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, psessionEntry->peSessionId, eLIM_BACKGROUND_SCAN_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -07006786 if(tx_timer_activate(&pMac->lim.limTimers.gLimBackgroundScanTimer) != TX_SUCCESS)
6787 {
6788 limLog(pMac, LOGP, FL("Could not restart background scan timer, doing LOGP"));
6789 return (eSIR_FAILURE);
6790 }
6791
6792 }
6793 }
6794
6795 /* Enable heartbeat timer */
6796 if (TX_TIMER_VALID(pMac->lim.limTimers.gLimHeartBeatTimer))
6797 {
Leela V Kiran Kumar Reddy Chiralac3b9d382013-01-31 20:49:53 -08006798 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, psessionEntry->peSessionId, eLIM_HEART_BEAT_TIMER));
Ravi Joshid2ca7c42013-07-23 08:37:49 -07006799 if(limActivateHearBeatTimer(pMac, psessionEntry) != TX_SUCCESS)
Jeff Johnson295189b2012-06-20 16:38:30 -07006800 {
6801 limLog(pMac, LOGP, FL("Could not restart heartbeat timer, doing LOGP"));
6802 return (eSIR_FAILURE);
6803 }
6804 }
Jeff Johnson295189b2012-06-20 16:38:30 -07006805 return (retCode);
6806}
6807
6808
6809/**
6810 * @function: limPrepareFor11hChannelSwitch()
6811 *
6812 * @brief : This API is called by the user to prepare for
6813 * 11h channel switch. As of now, the API does
6814 * very minimal work. User can add more into the
6815 * same API if needed.
6816 * LOGIC:
6817 *
6818 * ASSUMPTIONS:
6819 * NA
6820 *
6821 * NOTE:
6822 * NA
6823 *
6824 * @param pMac - Pointer to Global MAC structure
6825 * @param psessionEntry
6826 * @return None
6827 */
6828void
6829limPrepareFor11hChannelSwitch(tpAniSirGlobal pMac, tpPESession psessionEntry)
6830{
Jeff Johnson295189b2012-06-20 16:38:30 -07006831 if (psessionEntry->limSystemRole != eLIM_STA_ROLE)
6832 return;
6833
6834 /* Flag to indicate 11h channel switch in progress */
Jeff Johnsone7245742012-09-05 17:12:55 -07006835 psessionEntry->gLimSpecMgmt.dot11hChanSwState = eLIM_11H_CHANSW_RUNNING;
Jeff Johnson295189b2012-06-20 16:38:30 -07006836
6837 /* Disable, Stop background scan if enabled and running */
6838 limDeactivateAndChangeTimer(pMac, eLIM_BACKGROUND_SCAN_TIMER);
6839
6840 /* Stop heart-beat timer to stop heartbeat disassociation */
6841 limHeartBeatDeactivateAndChangeTimer(pMac, psessionEntry);
6842
6843 if(pMac->lim.gLimSmeState == eLIM_SME_LINK_EST_WT_SCAN_STATE ||
6844 pMac->lim.gLimSmeState == eLIM_SME_CHANNEL_SCAN_STATE)
6845 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006846 PELOGE(limLog(pMac, LOGE, FL("Posting finish scan as we are in scan state"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07006847 /* Stop ongoing scanning if any */
6848 if (GET_LIM_PROCESS_DEFD_MESGS(pMac))
6849 {
6850 //Set the resume channel to Any valid channel (invalid).
6851 //This will instruct HAL to set it to any previous valid channel.
6852 peSetResumeChannel(pMac, 0, 0);
6853 limSendHalFinishScanReq(pMac, eLIM_HAL_FINISH_SCAN_WAIT_STATE);
6854 }
6855 else
6856 {
6857 limRestorePreChannelSwitchState(pMac, psessionEntry);
6858 }
6859 return;
6860 }
6861 else
6862 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006863 PELOGE(limLog(pMac, LOGE, FL("Not in scan state, start channel switch timer"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07006864 /** We are safe to switch channel at this point */
6865 limStopTxAndSwitchChannel(pMac, psessionEntry->peSessionId);
6866 }
Jeff Johnson295189b2012-06-20 16:38:30 -07006867}
6868
6869
6870
6871/**----------------------------------------------------
6872\fn limGetNwType
6873
6874\brief Get type of the network from data packet or beacon
6875\param pMac
6876\param channelNum - Channel number
6877\param type - Type of packet.
6878\param pBeacon - Pointer to beacon or probe response
6879
6880\return Network type a/b/g.
6881-----------------------------------------------------*/
6882tSirNwType limGetNwType(tpAniSirGlobal pMac, tANI_U8 channelNum, tANI_U32 type, tpSchBeaconStruct pBeacon)
6883{
6884 tSirNwType nwType = eSIR_11B_NW_TYPE;
6885
6886 if (type == SIR_MAC_DATA_FRAME)
6887 {
6888 if ((channelNum > 0) && (channelNum < 15))
6889 {
6890 nwType = eSIR_11G_NW_TYPE;
6891 }
6892 else
6893 {
6894 nwType = eSIR_11A_NW_TYPE;
6895 }
6896 }
6897 else
6898 {
6899 if ((channelNum > 0) && (channelNum < 15))
6900 {
6901 int i;
6902 // 11b or 11g packet
6903 // 11g iff extended Rate IE is present or
6904 // if there is an A rate in suppRate IE
6905 for (i = 0; i < pBeacon->supportedRates.numRates; i++)
6906 {
6907 if (sirIsArate(pBeacon->supportedRates.rate[i] & 0x7f))
6908 {
6909 nwType = eSIR_11G_NW_TYPE;
6910 break;
6911 }
6912 }
6913 if (pBeacon->extendedRatesPresent)
6914 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006915 PELOG3(limLog(pMac, LOG3, FL("Beacon, nwtype=G"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07006916 nwType = eSIR_11G_NW_TYPE;
6917 }
6918 }
6919 else
6920 {
6921 // 11a packet
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006922 PELOG3(limLog(pMac, LOG3,FL("Beacon, nwtype=A"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07006923 nwType = eSIR_11A_NW_TYPE;
6924 }
6925 }
6926 return nwType;
6927}
6928
6929
6930/**---------------------------------------------------------
6931\fn limGetChannelFromBeacon
6932\brief To extract channel number from beacon
6933
6934\param pMac
6935\param pBeacon - Pointer to beacon or probe rsp
6936\return channel number
6937-----------------------------------------------------------*/
6938tANI_U8 limGetChannelFromBeacon(tpAniSirGlobal pMac, tpSchBeaconStruct pBeacon)
6939{
6940 tANI_U8 channelNum = 0;
6941
6942 if (pBeacon->dsParamsPresent)
6943 channelNum = pBeacon->channelNumber;
6944 else if(pBeacon->HTInfo.present)
6945 channelNum = pBeacon->HTInfo.primaryChannel;
6946 else
6947 channelNum = pBeacon->channelNumber;
6948
6949 return channelNum;
6950}
6951
6952
6953/** ---------------------------------------------------------
6954\fn limSetTspecUapsdMask
6955\brief This function sets the PE global variable:
6956\ 1) gUapsdPerAcTriggerEnableMask and
6957\ 2) gUapsdPerAcDeliveryEnableMask
6958\ based on the user priority field and direction field
6959\ in the TS Info Fields.
6960\
6961\ An AC is a trigger-enabled AC if the PSB subfield
6962\ is set to 1 in the uplink direction.
6963\ An AC is a delivery-enabled AC if the PSB subfield
6964\ is set to 1 in the down-link direction.
6965\
6966\param tpAniSirGlobal pMac
6967\param tSirMacTSInfo pTsInfo
6968\param tANI_U32 action
6969\return None
6970 ------------------------------------------------------------*/
6971void limSetTspecUapsdMask(tpAniSirGlobal pMac, tSirMacTSInfo *pTsInfo, tANI_U32 action)
6972{
6973 tANI_U8 userPrio = (tANI_U8)pTsInfo->traffic.userPrio;
6974 tANI_U16 direction = pTsInfo->traffic.direction;
6975 tANI_U8 ac = upToAc(userPrio);
6976
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006977 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 -07006978
6979 /* Converting AC to appropriate Uapsd Bit Mask
6980 * AC_BE(0) --> UAPSD_BITOFFSET_ACVO(3)
6981 * AC_BK(1) --> UAPSD_BITOFFSET_ACVO(2)
6982 * AC_VI(2) --> UAPSD_BITOFFSET_ACVO(1)
6983 * AC_VO(3) --> UAPSD_BITOFFSET_ACVO(0)
6984 */
6985 ac = ((~ac) & 0x3);
6986
6987 if (action == CLEAR_UAPSD_MASK)
6988 {
6989 if (direction == SIR_MAC_DIRECTION_UPLINK)
6990 pMac->lim.gUapsdPerAcTriggerEnableMask &= ~(1 << ac);
6991 else if (direction == SIR_MAC_DIRECTION_DNLINK)
6992 pMac->lim.gUapsdPerAcDeliveryEnableMask &= ~(1 << ac);
6993 else if (direction == SIR_MAC_DIRECTION_BIDIR)
6994 {
6995 pMac->lim.gUapsdPerAcTriggerEnableMask &= ~(1 << ac);
6996 pMac->lim.gUapsdPerAcDeliveryEnableMask &= ~(1 << ac);
6997 }
6998 }
6999 else if (action == SET_UAPSD_MASK)
7000 {
7001 if (direction == SIR_MAC_DIRECTION_UPLINK)
7002 pMac->lim.gUapsdPerAcTriggerEnableMask |= (1 << ac);
7003 else if (direction == SIR_MAC_DIRECTION_DNLINK)
7004 pMac->lim.gUapsdPerAcDeliveryEnableMask |= (1 << ac);
7005 else if (direction == SIR_MAC_DIRECTION_BIDIR)
7006 {
7007 pMac->lim.gUapsdPerAcTriggerEnableMask |= (1 << ac);
7008 pMac->lim.gUapsdPerAcDeliveryEnableMask |= (1 << ac);
7009 }
7010 }
7011
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007012 limLog(pMac, LOGE, FL("New pMac->lim.gUapsdPerAcTriggerEnableMask = 0x%x "), pMac->lim.gUapsdPerAcTriggerEnableMask );
7013 limLog(pMac, LOGE, FL("New pMac->lim.gUapsdPerAcDeliveryEnableMask = 0x%x "), pMac->lim.gUapsdPerAcDeliveryEnableMask );
Jeff Johnson295189b2012-06-20 16:38:30 -07007014
7015 return;
7016}
7017
7018
7019
7020void limHandleHeartBeatTimeout(tpAniSirGlobal pMac )
7021{
7022
7023 tANI_U8 i;
7024 for(i =0;i < pMac->lim.maxBssId;i++)
7025 {
7026 if(pMac->lim.gpSession[i].valid == TRUE )
7027 {
7028 if(pMac->lim.gpSession[i].bssType == eSIR_IBSS_MODE)
7029 {
7030 limIbssHeartBeatHandle(pMac,&pMac->lim.gpSession[i]);
7031 break;
7032 }
7033
7034 if((pMac->lim.gpSession[i].bssType == eSIR_INFRASTRUCTURE_MODE) &&
7035 (pMac->lim.gpSession[i].limSystemRole == eLIM_STA_ROLE))
7036 {
7037 limHandleHeartBeatFailure(pMac,&pMac->lim.gpSession[i]);
7038 }
7039 }
7040 }
7041 for(i=0; i< pMac->lim.maxBssId; i++)
7042 {
7043 if(pMac->lim.gpSession[i].valid == TRUE )
7044 {
7045 if((pMac->lim.gpSession[i].bssType == eSIR_INFRASTRUCTURE_MODE) &&
7046 (pMac->lim.gpSession[i].limSystemRole == eLIM_STA_ROLE))
7047 {
7048 if(pMac->lim.gpSession[i].LimHBFailureStatus == eANI_BOOLEAN_TRUE)
7049 {
7050 /* Activate Probe After HeartBeat Timer incase HB Failure detected */
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007051 PELOGW(limLog(pMac, LOGW,FL("Sending Probe for Session: %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07007052 i);)
7053 limDeactivateAndChangeTimer(pMac, eLIM_PROBE_AFTER_HB_TIMER);
7054 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, 0, eLIM_PROBE_AFTER_HB_TIMER));
7055 if (tx_timer_activate(&pMac->lim.limTimers.gLimProbeAfterHBTimer) != TX_SUCCESS)
7056 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007057 limLog(pMac, LOGP, FL("Fail to re-activate Probe-after-heartbeat timer"));
Jeff Johnson295189b2012-06-20 16:38:30 -07007058 limReactivateHeartBeatTimer(pMac, &pMac->lim.gpSession[i]);
7059 }
7060 break;
7061 }
7062 }
7063 }
7064 }
7065}
7066
Leela Venkata Kiran Kumar Reddy Chirala3ca17902013-02-27 19:50:05 -08007067void limHandleHeartBeatTimeoutForSession(tpAniSirGlobal pMac, tpPESession psessionEntry)
7068{
7069 if(psessionEntry->valid == TRUE )
7070 {
7071 if(psessionEntry->bssType == eSIR_IBSS_MODE)
7072 {
7073 limIbssHeartBeatHandle(pMac,psessionEntry);
7074 }
7075 if((psessionEntry->bssType == eSIR_INFRASTRUCTURE_MODE) &&
7076 (psessionEntry->limSystemRole == eLIM_STA_ROLE))
7077 {
7078 limHandleHeartBeatFailure(pMac,psessionEntry);
7079 }
7080 }
7081 /* In the function limHandleHeartBeatFailure things can change so check for the session entry valid
7082 and the other things again */
7083 if(psessionEntry->valid == TRUE )
7084 {
7085 if((psessionEntry->bssType == eSIR_INFRASTRUCTURE_MODE) &&
7086 (psessionEntry->limSystemRole == eLIM_STA_ROLE))
7087 {
7088 if(psessionEntry->LimHBFailureStatus == eANI_BOOLEAN_TRUE)
7089 {
7090 /* Activate Probe After HeartBeat Timer incase HB Failure detected */
7091 PELOGW(limLog(pMac, LOGW,FL("Sending Probe for Session: %d"),
7092 psessionEntry->bssIdx);)
7093 limDeactivateAndChangeTimer(pMac, eLIM_PROBE_AFTER_HB_TIMER);
7094 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, 0, eLIM_PROBE_AFTER_HB_TIMER));
7095 if (tx_timer_activate(&pMac->lim.limTimers.gLimProbeAfterHBTimer) != TX_SUCCESS)
7096 {
7097 limLog(pMac, LOGP, FL("Fail to re-activate Probe-after-heartbeat timer"));
7098 limReactivateHeartBeatTimer(pMac, psessionEntry);
7099 }
7100 }
7101 }
7102 }
7103}
7104
7105
Jeff Johnson295189b2012-06-20 16:38:30 -07007106tANI_U8 limGetCurrentOperatingChannel(tpAniSirGlobal pMac)
7107{
7108 tANI_U8 i;
7109 for(i =0;i < pMac->lim.maxBssId;i++)
7110 {
7111 if(pMac->lim.gpSession[i].valid == TRUE )
7112 {
7113 if((pMac->lim.gpSession[i].bssType == eSIR_INFRASTRUCTURE_MODE) &&
7114 (pMac->lim.gpSession[i].limSystemRole == eLIM_STA_ROLE))
7115 {
7116 return pMac->lim.gpSession[i].currentOperChannel;
7117 }
7118 }
7119 }
7120 return 0;
7121}
7122
7123void limProcessAddStaRsp(tpAniSirGlobal pMac,tpSirMsgQ limMsgQ)
7124{
7125
7126 tpPESession psessionEntry;
7127// tANI_U8 sessionId;
7128 tpAddStaParams pAddStaParams;
7129
7130 pAddStaParams = (tpAddStaParams)limMsgQ->bodyptr;
7131
7132 if((psessionEntry = peFindSessionBySessionId(pMac,pAddStaParams->sessionId))==NULL)
7133 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007134 limLog(pMac, LOGP,FL("Session Does not exist for given sessionID"));
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307135 vos_mem_free(pAddStaParams);
Jeff Johnson295189b2012-06-20 16:38:30 -07007136 return;
7137 }
7138 if (psessionEntry->limSystemRole == eLIM_STA_IN_IBSS_ROLE)
7139 (void) limIbssAddStaRsp(pMac, limMsgQ->bodyptr,psessionEntry);
Mohit Khanna698ba2a2012-12-04 15:08:18 -08007140#ifdef FEATURE_WLAN_TDLS
7141 else if(pMac->lim.gLimAddStaTdls)
7142 {
7143 limProcessTdlsAddStaRsp(pMac, limMsgQ->bodyptr, psessionEntry) ;
7144 pMac->lim.gLimAddStaTdls = FALSE ;
7145 }
7146#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07007147 else
7148 limProcessMlmAddStaRsp(pMac, limMsgQ,psessionEntry);
7149
7150}
7151
7152
7153void limUpdateBeacon(tpAniSirGlobal pMac)
7154{
7155 tANI_U8 i;
7156
7157 for(i =0;i < pMac->lim.maxBssId;i++)
7158 {
7159 if(pMac->lim.gpSession[i].valid == TRUE )
7160 {
7161 if( ( (pMac->lim.gpSession[i].limSystemRole == eLIM_AP_ROLE) ||
7162 (pMac->lim.gpSession[i].limSystemRole == eLIM_STA_IN_IBSS_ROLE) )
7163 && (eLIM_SME_NORMAL_STATE == pMac->lim.gpSession[i].limSmeState)
7164 )
7165 {
7166 schSetFixedBeaconFields(pMac,&pMac->lim.gpSession[i]);
7167 limSendBeaconInd(pMac, &pMac->lim.gpSession[i]);
7168 }
7169 else
7170 {
7171 if( (pMac->lim.gpSession[i].limSystemRole == eLIM_BT_AMP_AP_ROLE)||
7172 (pMac->lim.gpSession[i].limSystemRole == eLIM_BT_AMP_STA_ROLE))
7173 {
7174
7175 if(pMac->lim.gpSession[i].statypeForBss == STA_ENTRY_SELF)
7176 {
7177 schSetFixedBeaconFields(pMac,&pMac->lim.gpSession[i]);
7178 }
7179 }
7180 }
7181 }
7182 }
7183}
7184
7185void limHandleHeartBeatFailureTimeout(tpAniSirGlobal pMac)
7186{
7187 tANI_U8 i;
7188 tpPESession psessionEntry;
7189 /* Probe response is not received after HB failure. This is handled by LMM sub module. */
7190 for(i =0; i < pMac->lim.maxBssId; i++)
7191 {
7192 if(pMac->lim.gpSession[i].valid == TRUE)
7193 {
7194 psessionEntry = &pMac->lim.gpSession[i];
7195 if(psessionEntry->LimHBFailureStatus == eANI_BOOLEAN_TRUE)
7196 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007197 limLog(pMac, LOGE, FL("Probe_hb_failure: SME %d, MLME %d, HB-Count %d"),psessionEntry->limSmeState,
Jeff Johnson295189b2012-06-20 16:38:30 -07007198 psessionEntry->limMlmState, psessionEntry->LimRxedBeaconCntDuringHB);
Leela Venkata Kiran Kumar Reddy Chirala2365ee62013-05-09 17:30:12 -07007199#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
7200 limDiagEventReport(pMac, WLAN_PE_DIAG_HB_FAILURE_TIMEOUT, psessionEntry, 0, 0);
7201#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07007202 if (psessionEntry->limMlmState == eLIM_MLM_LINK_ESTABLISHED_STATE)
7203 {
Leela Venkata Kiran Kumar Reddy Chiralaab842fb2013-04-30 12:27:35 -07007204 if ((!LIM_IS_CONNECTION_ACTIVE(psessionEntry))&&
7205 (psessionEntry->limSmeState != eLIM_SME_WT_DISASSOC_STATE))
Jeff Johnson295189b2012-06-20 16:38:30 -07007206 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007207 limLog(pMac, LOGE, FL("Probe_hb_failure: for session:%d " ),psessionEntry->peSessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07007208 /* AP did not respond to Probe Request. Tear down link with it.*/
7209 limTearDownLinkWithAp(pMac,
7210 psessionEntry->peSessionId,
7211 eSIR_BEACON_MISSED);
7212 pMac->lim.gLimProbeFailureAfterHBfailedCnt++ ;
7213 }
7214 else // restart heartbeat timer
7215 {
7216 limReactivateHeartBeatTimer(pMac, psessionEntry);
7217 }
7218 }
7219 else
7220 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007221 limLog(pMac, LOGE, FL("Unexpected wt-probe-timeout in state "));
Jeff Johnson295189b2012-06-20 16:38:30 -07007222 limPrintMlmState(pMac, LOGE, psessionEntry->limMlmState);
7223 limReactivateHeartBeatTimer(pMac, psessionEntry);
7224 }
7225
7226 }
7227 }
7228 }
7229 /* Deactivate Timer ProbeAfterHB Timer -> As its a oneshot timer, need not deactivate the timer */
7230 // tx_timer_deactivate(&pMac->lim.limTimers.gLimProbeAfterHBTimer);
7231}
7232
7233
7234/*
7235* This function assumes there will not be more than one IBSS session active at any time.
7236*/
7237tpPESession limIsIBSSSessionActive(tpAniSirGlobal pMac)
7238{
7239 tANI_U8 i;
7240
7241 for(i =0;i < pMac->lim.maxBssId;i++)
7242 {
7243 if( (pMac->lim.gpSession[i].valid) &&
7244 (pMac->lim.gpSession[i].limSystemRole == eLIM_STA_IN_IBSS_ROLE))
7245 return (&pMac->lim.gpSession[i]);
7246 }
7247
7248 return NULL;
7249}
7250
7251tpPESession limIsApSessionActive(tpAniSirGlobal pMac)
7252{
7253 tANI_U8 i;
7254
7255 for(i =0;i < pMac->lim.maxBssId;i++)
7256 {
7257 if( (pMac->lim.gpSession[i].valid) &&
7258 ( (pMac->lim.gpSession[i].limSystemRole == eLIM_AP_ROLE) ||
7259 (pMac->lim.gpSession[i].limSystemRole == eLIM_BT_AMP_AP_ROLE)))
7260 return (&pMac->lim.gpSession[i]);
7261 }
7262
7263 return NULL;
7264}
7265
7266/**---------------------------------------------------------
7267\fn limHandleDeferMsgError
7268\brief handles error scenario, when the msg can not be deferred.
7269\param pMac
7270\param pLimMsg LIM msg, which could not be deferred.
7271\return void
7272-----------------------------------------------------------*/
7273
7274void limHandleDeferMsgError(tpAniSirGlobal pMac, tpSirMsgQ pLimMsg)
7275{
7276 if(SIR_BB_XPORT_MGMT_MSG == pLimMsg->type)
7277 {
7278 vos_pkt_return_packet((vos_pkt_t*)pLimMsg->bodyptr);
7279 }
7280 else if(pLimMsg->bodyptr != NULL)
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307281 vos_mem_free( pLimMsg->bodyptr);
Jeff Johnson295189b2012-06-20 16:38:30 -07007282
7283}
7284
7285
7286#ifdef FEATURE_WLAN_DIAG_SUPPORT
7287/**---------------------------------------------------------
7288\fn limDiagEventReport
7289\brief This function reports Diag event
7290\param pMac
7291\param eventType
7292\param bssid
7293\param status
7294\param reasonCode
7295\return void
7296-----------------------------------------------------------*/
7297void limDiagEventReport(tpAniSirGlobal pMac, tANI_U16 eventType, tpPESession pSessionEntry, tANI_U16 status, tANI_U16 reasonCode)
7298{
7299 tSirMacAddr nullBssid = { 0, 0, 0, 0, 0, 0 };
7300 WLAN_VOS_DIAG_EVENT_DEF(peEvent, vos_event_wlan_pe_payload_type);
7301
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307302 vos_mem_set(&peEvent, sizeof(vos_event_wlan_pe_payload_type), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07007303
7304 if (NULL == pSessionEntry)
7305 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307306 vos_mem_copy( peEvent.bssid, nullBssid, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07007307 peEvent.sme_state = (tANI_U16)pMac->lim.gLimSmeState;
7308 peEvent.mlm_state = (tANI_U16)pMac->lim.gLimMlmState;
7309
7310 }
7311 else
7312 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307313 vos_mem_copy(peEvent.bssid, pSessionEntry->bssId, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07007314 peEvent.sme_state = (tANI_U16)pSessionEntry->limSmeState;
7315 peEvent.mlm_state = (tANI_U16)pSessionEntry->limMlmState;
7316 }
7317 peEvent.event_type = eventType;
7318 peEvent.status = status;
7319 peEvent.reason_code = reasonCode;
7320
7321 WLAN_VOS_DIAG_EVENT_REPORT(&peEvent, EVENT_WLAN_PE);
7322 return;
7323}
7324
7325#endif /* FEATURE_WLAN_DIAG_SUPPORT */
7326
7327void limProcessAddStaSelfRsp(tpAniSirGlobal pMac,tpSirMsgQ limMsgQ)
7328{
7329
7330 tpAddStaSelfParams pAddStaSelfParams;
7331 tSirMsgQ mmhMsg;
7332 tpSirSmeAddStaSelfRsp pRsp;
7333
7334
7335 pAddStaSelfParams = (tpAddStaSelfParams)limMsgQ->bodyptr;
7336
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307337 pRsp = vos_mem_malloc(sizeof(tSirSmeAddStaSelfRsp));
7338 if ( NULL == pRsp )
Jeff Johnson295189b2012-06-20 16:38:30 -07007339 {
7340 /// Buffer not available. Log error
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307341 limLog(pMac, LOGP, FL("call to AllocateMemory failed for Add Sta self RSP"));
7342 vos_mem_free(pAddStaSelfParams);
Jeff Johnson295189b2012-06-20 16:38:30 -07007343 return;
7344 }
7345
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307346 vos_mem_set((tANI_U8*)pRsp, sizeof(tSirSmeAddStaSelfRsp), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07007347
7348 pRsp->mesgType = eWNI_SME_ADD_STA_SELF_RSP;
7349 pRsp->mesgLen = (tANI_U16) sizeof(tSirSmeAddStaSelfRsp);
7350 pRsp->status = pAddStaSelfParams->status;
7351
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307352 vos_mem_copy( pRsp->selfMacAddr, pAddStaSelfParams->selfMacAddr, sizeof(tSirMacAddr) );
Jeff Johnson295189b2012-06-20 16:38:30 -07007353
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307354 vos_mem_free(pAddStaSelfParams);
Jeff Johnson295189b2012-06-20 16:38:30 -07007355
7356 mmhMsg.type = eWNI_SME_ADD_STA_SELF_RSP;
7357 mmhMsg.bodyptr = pRsp;
7358 mmhMsg.bodyval = 0;
Jeff Johnsone7245742012-09-05 17:12:55 -07007359 MTRACE(macTraceMsgTx(pMac, NO_SESSION, mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07007360 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
7361
7362}
7363
7364void limProcessDelStaSelfRsp(tpAniSirGlobal pMac,tpSirMsgQ limMsgQ)
7365{
7366
7367 tpDelStaSelfParams pDelStaSelfParams;
7368 tSirMsgQ mmhMsg;
7369 tpSirSmeDelStaSelfRsp pRsp;
7370
7371
7372 pDelStaSelfParams = (tpDelStaSelfParams)limMsgQ->bodyptr;
7373
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307374 pRsp = vos_mem_malloc(sizeof(tSirSmeDelStaSelfRsp));
7375 if ( NULL == pRsp )
Jeff Johnson295189b2012-06-20 16:38:30 -07007376 {
7377 /// Buffer not available. Log error
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307378 limLog(pMac, LOGP, FL("call to AllocateMemory failed for Add Sta self RSP"));
7379 vos_mem_free(pDelStaSelfParams);
Jeff Johnson295189b2012-06-20 16:38:30 -07007380 return;
7381 }
7382
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307383 vos_mem_set((tANI_U8*)pRsp, sizeof(tSirSmeDelStaSelfRsp), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07007384
7385 pRsp->mesgType = eWNI_SME_DEL_STA_SELF_RSP;
7386 pRsp->mesgLen = (tANI_U16) sizeof(tSirSmeDelStaSelfRsp);
7387 pRsp->status = pDelStaSelfParams->status;
7388
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307389 vos_mem_copy( pRsp->selfMacAddr, pDelStaSelfParams->selfMacAddr, sizeof(tSirMacAddr) );
Jeff Johnson295189b2012-06-20 16:38:30 -07007390
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307391 vos_mem_free(pDelStaSelfParams);
Jeff Johnson295189b2012-06-20 16:38:30 -07007392
7393 mmhMsg.type = eWNI_SME_DEL_STA_SELF_RSP;
7394 mmhMsg.bodyptr = pRsp;
7395 mmhMsg.bodyval = 0;
Jeff Johnsone7245742012-09-05 17:12:55 -07007396 MTRACE(macTraceMsgTx(pMac, NO_SESSION, mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07007397 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
7398
7399}
7400
7401/***************************************************************
7402* tANI_U8 limUnmapChannel(tANI_U8 mapChannel)
7403* To unmap the channel to reverse the effect of mapping
7404* a band channel in hal .Mapping was done hal to overcome the
7405* limitation of the rxbd which use only 4 bit for channel number.
7406*****************************************************************/
7407tANI_U8 limUnmapChannel(tANI_U8 mapChannel)
7408{
7409 if( mapChannel > 0 && mapChannel < 25 )
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07007410#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
7411 if (IS_ROAM_SCAN_OFFLOAD_FEATURE_ENABLE)
7412 return aUnsortedChannelList[mapChannel -1];
7413 else
7414#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07007415 return abChannel[mapChannel -1];
7416 else
7417 return 0;
7418}
7419
7420
7421v_U8_t* limGetIEPtr(tpAniSirGlobal pMac, v_U8_t *pIes, int length, v_U8_t eid,eSizeOfLenField size_of_len_field)
7422{
7423 int left = length;
7424 v_U8_t *ptr = pIes;
7425 v_U8_t elem_id;
7426 v_U16_t elem_len;
7427
7428 while(left >= (size_of_len_field+1))
7429 {
7430 elem_id = ptr[0];
7431 if (size_of_len_field == TWO_BYTE)
7432 {
7433 elem_len = ((v_U16_t) ptr[1]) | (ptr[2]<<8);
7434 }
7435 else
7436 {
7437 elem_len = ptr[1];
7438 }
7439
7440
7441 left -= (size_of_len_field+1);
7442 if(elem_len > left)
7443 {
7444 limLog(pMac, LOGE,
Madan Mohan Koyyalamudi8bdd3112012-09-24 13:55:14 -07007445 FL("****Invalid IEs eid = %d elem_len=%d left=%d*****"),
Jeff Johnson295189b2012-06-20 16:38:30 -07007446 eid,elem_len,left);
7447 return NULL;
7448 }
7449 if (elem_id == eid)
7450 {
7451 return ptr;
7452 }
7453
7454 left -= elem_len;
7455 ptr += (elem_len + (size_of_len_field+1));
7456 }
7457 return NULL;
7458}
7459
7460/* return NULL if oui is not found in ie
7461 return !NULL pointer to vendor IE (starting from 0xDD) if oui is found
7462 */
7463v_U8_t* limGetVendorIEOuiPtr(tpAniSirGlobal pMac, tANI_U8 *oui, tANI_U8 oui_size, tANI_U8 *ie, tANI_U16 ie_len)
7464{
7465 int left = ie_len;
7466 v_U8_t *ptr = ie;
7467 v_U8_t elem_id, elem_len;
7468
7469 while(left >= 2)
7470 {
7471 elem_id = ptr[0];
7472 elem_len = ptr[1];
7473 left -= 2;
7474 if(elem_len > left)
7475 {
7476 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007477 FL("****Invalid IEs eid = %d elem_len=%d left=%d*****"),
Jeff Johnson295189b2012-06-20 16:38:30 -07007478 elem_id,elem_len,left);
7479 return NULL;
7480 }
7481 if (SIR_MAC_EID_VENDOR == elem_id)
7482 {
7483 if(memcmp(&ptr[2], oui, oui_size)==0)
7484 return ptr;
7485 }
7486
7487 left -= elem_len;
7488 ptr += (elem_len + 2);
7489 }
7490 return NULL;
7491}
7492
Jeff Johnson295189b2012-06-20 16:38:30 -07007493//Returns length of P2P stream and Pointer ie passed to this function is filled with noa stream
7494
7495v_U8_t limBuildP2pIe(tpAniSirGlobal pMac, tANI_U8 *ie, tANI_U8 *data, tANI_U8 ie_len)
7496{
7497 int length = 0;
7498 tANI_U8 *ptr = ie;
7499
7500 ptr[length++] = SIR_MAC_EID_VENDOR;
7501 ptr[length++] = ie_len + SIR_MAC_P2P_OUI_SIZE;
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307502 vos_mem_copy(&ptr[length], SIR_MAC_P2P_OUI, SIR_MAC_P2P_OUI_SIZE);
7503 vos_mem_copy(&ptr[length + SIR_MAC_P2P_OUI_SIZE], data, ie_len);
Jeff Johnson295189b2012-06-20 16:38:30 -07007504 return (ie_len + SIR_P2P_IE_HEADER_LEN);
7505}
7506
7507//Returns length of NoA stream and Pointer pNoaStream passed to this function is filled with noa stream
7508
7509v_U8_t limGetNoaAttrStreamInMultP2pIes(tpAniSirGlobal pMac,v_U8_t* noaStream,v_U8_t noaLen,v_U8_t overFlowLen)
7510{
7511 v_U8_t overFlowP2pStream[SIR_MAX_NOA_ATTR_LEN];
Krunal Sonic768a932013-05-15 19:26:30 -07007512
7513 if ((noaLen <= (SIR_MAX_NOA_ATTR_LEN+SIR_P2P_IE_HEADER_LEN)) &&
7514 (noaLen >= overFlowLen) && (overFlowLen <= SIR_MAX_NOA_ATTR_LEN))
7515 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307516 vos_mem_copy(overFlowP2pStream,
Krunal Sonic768a932013-05-15 19:26:30 -07007517 noaStream + noaLen - overFlowLen, overFlowLen);
7518 noaStream[noaLen - overFlowLen] = SIR_MAC_EID_VENDOR;
7519 noaStream[noaLen - overFlowLen + 1] = overFlowLen + SIR_MAC_P2P_OUI_SIZE;
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307520 vos_mem_copy(noaStream+noaLen-overFlowLen + 2,
Krunal Sonic768a932013-05-15 19:26:30 -07007521 SIR_MAC_P2P_OUI, SIR_MAC_P2P_OUI_SIZE);
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307522 vos_mem_copy(noaStream+noaLen + 2 + SIR_MAC_P2P_OUI_SIZE - overFlowLen,
7523 overFlowP2pStream, overFlowLen);
Krunal Sonic768a932013-05-15 19:26:30 -07007524 }
7525
Jeff Johnson295189b2012-06-20 16:38:30 -07007526 return (noaLen + SIR_P2P_IE_HEADER_LEN);
7527
7528}
7529
7530//Returns length of NoA stream and Pointer pNoaStream passed to this function is filled with noa stream
7531v_U8_t limGetNoaAttrStream(tpAniSirGlobal pMac, v_U8_t*pNoaStream,tpPESession psessionEntry)
7532{
7533 v_U8_t len=0;
7534
7535 v_U8_t *pBody = pNoaStream;
7536
7537
7538 if ( (psessionEntry != NULL) && (psessionEntry->valid) &&
7539 (psessionEntry->pePersona == VOS_P2P_GO_MODE))
7540 {
7541 if ((!(psessionEntry->p2pGoPsUpdate.uNoa1Duration)) && (!(psessionEntry->p2pGoPsUpdate.uNoa2Duration))
7542 && (!psessionEntry->p2pGoPsUpdate.oppPsFlag)
7543 )
7544 return 0; //No NoA Descriptor then return 0
7545
7546
7547 pBody[0] = SIR_P2P_NOA_ATTR;
7548
7549 pBody[3] = psessionEntry->p2pGoPsUpdate.index;
7550 pBody[4] = psessionEntry->p2pGoPsUpdate.ctWin | (psessionEntry->p2pGoPsUpdate.oppPsFlag<<7);
7551 len = 5;
7552 pBody += len;
7553
7554
7555 if (psessionEntry->p2pGoPsUpdate.uNoa1Duration)
7556 {
7557 *pBody = psessionEntry->p2pGoPsUpdate.uNoa1IntervalCnt;
7558 pBody += 1;
7559 len +=1;
7560
7561 *((tANI_U32 *)(pBody)) = sirSwapU32ifNeeded(psessionEntry->p2pGoPsUpdate.uNoa1Duration);
7562 pBody += sizeof(tANI_U32);
7563 len +=4;
7564
7565 *((tANI_U32 *)(pBody)) = sirSwapU32ifNeeded(psessionEntry->p2pGoPsUpdate.uNoa1Interval);
7566 pBody += sizeof(tANI_U32);
7567 len +=4;
7568
7569 *((tANI_U32 *)(pBody)) = sirSwapU32ifNeeded(psessionEntry->p2pGoPsUpdate.uNoa1StartTime);
7570 pBody += sizeof(tANI_U32);
7571 len +=4;
7572
7573 }
7574
7575 if (psessionEntry->p2pGoPsUpdate.uNoa2Duration)
7576 {
7577 *pBody = psessionEntry->p2pGoPsUpdate.uNoa2IntervalCnt;
7578 pBody += 1;
7579 len +=1;
7580
7581 *((tANI_U32 *)(pBody)) = sirSwapU32ifNeeded(psessionEntry->p2pGoPsUpdate.uNoa2Duration);
7582 pBody += sizeof(tANI_U32);
7583 len +=4;
7584
7585 *((tANI_U32 *)(pBody)) = sirSwapU32ifNeeded(psessionEntry->p2pGoPsUpdate.uNoa2Interval);
7586 pBody += sizeof(tANI_U32);
7587 len +=4;
7588
7589 *((tANI_U32 *)(pBody)) = sirSwapU32ifNeeded(psessionEntry->p2pGoPsUpdate.uNoa2StartTime);
7590 pBody += sizeof(tANI_U32);
7591 len +=4;
7592
7593 }
7594
7595
7596 pBody = pNoaStream + 1;
7597 *((tANI_U16 *)(pBody)) = sirSwapU16ifNeeded(len-3);/*one byte for Attr and 2 bytes for length*/
7598
7599 return (len);
7600
7601 }
7602 return 0;
7603
7604}
Jeff Johnsone7245742012-09-05 17:12:55 -07007605
7606void peSetResumeChannel(tpAniSirGlobal pMac, tANI_U16 channel, ePhyChanBondState phyCbState)
Jeff Johnson295189b2012-06-20 16:38:30 -07007607{
7608
7609 pMac->lim.gResumeChannel = channel;
Jeff Johnsone7245742012-09-05 17:12:55 -07007610 pMac->lim.gResumePhyCbState = phyCbState;
Jeff Johnson295189b2012-06-20 16:38:30 -07007611}
Jeff Johnsone7245742012-09-05 17:12:55 -07007612
Jeff Johnson295189b2012-06-20 16:38:30 -07007613/*--------------------------------------------------------------------------
7614
7615 \brief peGetResumeChannel() - Returns the channel number for scanning, from a valid session.
7616
Jeff Johnsone7245742012-09-05 17:12:55 -07007617 This function returns the channel to resume to during link resume. channel id of 0 means HAL will
7618 resume to previous channel before link suspend
Jeff Johnson295189b2012-06-20 16:38:30 -07007619
7620 \param pMac - pointer to global adapter context
7621 \return - channel to scan from valid session else zero.
7622
7623 \sa
7624
7625 --------------------------------------------------------------------------*/
Jeff Johnsone7245742012-09-05 17:12:55 -07007626void peGetResumeChannel(tpAniSirGlobal pMac, tANI_U8* resumeChannel, ePhyChanBondState* resumePhyCbState)
Jeff Johnson295189b2012-06-20 16:38:30 -07007627{
7628
7629 //Rationale - this could be the suspend/resume for assoc and it is essential that
7630 //the new BSS is active for some time. Other BSS was anyway suspended.
7631 //TODO: Comeup with a better alternative. Sending NULL with PM=0 on other BSS means
7632 //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 -07007633 //and hence should be ok. Need to discuss this further
7634 if( !limIsInMCC(pMac) )
Jeff Johnson295189b2012-06-20 16:38:30 -07007635 {
7636 //Get current active session channel
Jeff Johnsone7245742012-09-05 17:12:55 -07007637 peGetActiveSessionChannel(pMac, resumeChannel, resumePhyCbState);
Jeff Johnson295189b2012-06-20 16:38:30 -07007638 }
7639 else
7640 {
Jeff Johnsone7245742012-09-05 17:12:55 -07007641 *resumeChannel = pMac->lim.gResumeChannel;
7642 *resumePhyCbState = pMac->lim.gResumePhyCbState;
Jeff Johnson295189b2012-06-20 16:38:30 -07007643 }
Jeff Johnsone7245742012-09-05 17:12:55 -07007644 return;
Jeff Johnson295189b2012-06-20 16:38:30 -07007645}
7646
Viral Modid86bde22012-12-10 13:09:21 -08007647tANI_BOOLEAN limIsNOAInsertReqd(tpAniSirGlobal pMac)
7648{
7649 tANI_U8 i;
7650 for(i =0; i < pMac->lim.maxBssId; i++)
7651 {
7652 if(pMac->lim.gpSession[i].valid == TRUE)
7653 {
7654 if( (eLIM_AP_ROLE == pMac->lim.gpSession[i].limSystemRole )
7655 && ( VOS_P2P_GO_MODE == pMac->lim.gpSession[i].pePersona )
7656 )
7657 {
7658 return TRUE;
7659 }
7660 }
7661 }
7662 return FALSE;
7663}
Jeff Johnsone7245742012-09-05 17:12:55 -07007664
Jeff Johnson295189b2012-06-20 16:38:30 -07007665
7666tANI_BOOLEAN limIsconnectedOnDFSChannel(tANI_U8 currentChannel)
7667{
7668 if(NV_CHANNEL_DFS == vos_nv_getChannelEnabledState(currentChannel))
7669 {
7670 return eANI_BOOLEAN_TRUE;
7671 }
7672 else
7673 {
7674 return eANI_BOOLEAN_FALSE;
7675 }
7676}
Madan Mohan Koyyalamudi1bed5982012-10-22 14:38:06 -07007677
Mohit Khanna4a70d262012-09-11 16:30:12 -07007678#ifdef WLAN_FEATURE_11AC
7679tANI_BOOLEAN limCheckVHTOpModeChange( tpAniSirGlobal pMac, tpPESession psessionEntry, tANI_U8 chanWidth, tANI_U8 staId)
7680{
7681 tUpdateVHTOpMode tempParam;
7682
7683 tempParam.opMode = chanWidth;
7684 tempParam.staId = staId;
7685
7686 limSendModeUpdate( pMac, &tempParam, psessionEntry );
7687
7688 return eANI_BOOLEAN_TRUE;
7689}
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -07007690#endif
7691
7692tANI_U8 limGetShortSlotFromPhyMode(tpAniSirGlobal pMac, tpPESession psessionEntry, tANI_U32 phyMode)
7693{
7694 tANI_U8 val=0;
7695
7696 if (phyMode == WNI_CFG_PHY_MODE_11A)
7697 {
7698 // 11a mode always uses short slot
7699 // Check this since some APs in 11a mode broadcast long slot in their beacons. As per standard, always use what PHY mandates.
7700 val = true;
7701 }
7702 else if (phyMode == WNI_CFG_PHY_MODE_11G)
7703 {
7704 if ((psessionEntry->pePersona == VOS_STA_SAP_MODE) ||
7705 (psessionEntry->pePersona == VOS_P2P_GO_MODE))
7706 {
7707 val = true;
7708 }
7709
7710 // Program Polaris based on AP capability
7711
7712 if (psessionEntry->limMlmState == eLIM_MLM_WT_JOIN_BEACON_STATE)
7713 // Joining BSS.
7714 val = SIR_MAC_GET_SHORT_SLOT_TIME( psessionEntry->limCurrentBssCaps);
7715 else if (psessionEntry->limMlmState == eLIM_MLM_WT_REASSOC_RSP_STATE)
7716 // Reassociating with AP.
7717 val = SIR_MAC_GET_SHORT_SLOT_TIME( psessionEntry->limReassocBssCaps);
7718 }
7719 else // if (phyMode == WNI_CFG_PHY_MODE_11B) - use this if another phymode is added later ON
7720 {
7721 // Will reach here in 11b case
7722 val = false;
7723 }
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007724 limLog(pMac, LOG1, FL("phyMode = %u shortslotsupported = %u"), phyMode, val);
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -07007725 return val;
7726}