blob: 49decb2bc6542a6b73d9cde15e90a65afaac4080 [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;
103 if(eHAL_STATUS_SUCCESS !=
104 palAllocateMemory(pMac->hHdd, (void **) &pCurrNode, sizeof(tDialogueToken)))
105 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700106 PELOGE(limLog(pMac, LOGE, FL("palAllocateMemory failed"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700107 return NULL;
108 }
109
110 palZeroMemory(pMac->hHdd, (void *) pCurrNode, sizeof(tDialogueToken));
111 //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++;
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700124 PELOG4(limLog(pMac, LOG4, FL("token assigned = %d"), token);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700125 return pCurrNode;
126}
127
128/** -------------------------------------------------------------
129\fn limSearchAndDeleteDialogueToken
130\brief search dialogue token in the list and deletes it if found. returns failure if not found.
131\param tpAniSirGlobal pMac
132\param tANI_U8 token
133\param tANI_U16 assocId
134\param tANI_U16 tid
135\return eSirRetStatus - status of the search
136 -------------------------------------------------------------*/
137
138
139tSirRetStatus
140limSearchAndDeleteDialogueToken(tpAniSirGlobal pMac, tANI_U8 token, tANI_U16 assocId, tANI_U16 tid)
141{
142 tpDialogueToken pCurrNode = pMac->lim.pDialogueTokenHead;
143 tpDialogueToken pPrevNode = pMac->lim.pDialogueTokenHead;
144
145 //if the list is empty
146 if(NULL == pCurrNode)
147 return eSIR_FAILURE;
148
149 // if the matching node is the first node.
150 if(pCurrNode &&
151 (assocId == pCurrNode->assocId) &&
152 (tid == pCurrNode->tid))
153 {
154 pMac->lim.pDialogueTokenHead = pCurrNode->next;
155 //there was only one node in the list. So tail pointer also needs to be adjusted.
156 if(NULL == pMac->lim.pDialogueTokenHead)
157 pMac->lim.pDialogueTokenTail = NULL;
158 palFreeMemory(pMac->hHdd, (void *) pCurrNode);
159 return eSIR_SUCCESS;
160 }
161
162 //first node did not match. so move to the next one.
163 pCurrNode = pCurrNode->next;
164 while(NULL != pCurrNode )
165 {
166 if(token == pCurrNode->token)
167 {
168 break;
169 }
170
171 pPrevNode = pCurrNode;
172 pCurrNode = pCurrNode->next;
173 }
174
175 if(pCurrNode &&
176 (assocId == pCurrNode->assocId) &&
177 (tid == pCurrNode->tid))
178 {
179 pPrevNode->next = pCurrNode->next;
180 //if the node being deleted is the last one then we also need to move the tail pointer to the prevNode.
181 if(NULL == pCurrNode->next)
182 pMac->lim.pDialogueTokenTail = pPrevNode;
183 return eSIR_SUCCESS;
184 }
185
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700186 PELOGW(limLog(pMac, LOGW, FL("LIM does not have matching dialogue token node"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700187 return eSIR_FAILURE;
188
189}
190
191
192/** -------------------------------------------------------------
193\fn limDeleteDialogueTokenList
194\brief deletes the complete lim dialogue token linked list.
195\param tpAniSirGlobal pMac
196\return None
197 -------------------------------------------------------------*/
198void
199limDeleteDialogueTokenList(tpAniSirGlobal pMac)
200{
201 tpDialogueToken pCurrNode = pMac->lim.pDialogueTokenHead;
202
203 while(NULL != pMac->lim.pDialogueTokenHead)
204 {
205 pCurrNode = pMac->lim.pDialogueTokenHead;
206 pMac->lim.pDialogueTokenHead = pMac->lim.pDialogueTokenHead->next;
207 palFreeMemory(pMac->hHdd, (void *) pCurrNode);
208 pCurrNode = NULL;
209 }
210 pMac->lim.pDialogueTokenTail = NULL;
211}
212
213void
214limGetBssidFromBD(tpAniSirGlobal pMac, tANI_U8 * pRxPacketInfo, tANI_U8 *bssId, tANI_U32 *pIgnore)
215{
216 tpSirMacDataHdr3a pMh = WDA_GET_RX_MPDUHEADER3A(pRxPacketInfo);
217 *pIgnore = 0;
218
219 if (pMh->fc.toDS == 1 && pMh->fc.fromDS == 0)
220 {
221 palCopyMemory( pMac->hHdd, bssId, pMh->addr1, 6);
222 *pIgnore = 1;
223 }
224 else if (pMh->fc.toDS == 0 && pMh->fc.fromDS == 1)
225 {
226 palCopyMemory( pMac->hHdd, bssId, pMh->addr2, 6);
227 *pIgnore = 1;
228 }
229 else if (pMh->fc.toDS == 0 && pMh->fc.fromDS == 0)
230 {
231 palCopyMemory( pMac->hHdd, bssId, pMh->addr3, 6);
232 *pIgnore = 0;
233 }
234 else
235 {
236 palCopyMemory( pMac->hHdd, bssId, pMh->addr1, 6);
237 *pIgnore = 1;
238 }
239}
240
241char *
242limMlmStateStr(tLimMlmStates state)
243{
Jeff Johnson295189b2012-06-20 16:38:30 -0700244 switch (state)
245 {
246 case eLIM_MLM_OFFLINE_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700247 return "eLIM_MLM_OFFLINE_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700248 case eLIM_MLM_IDLE_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700249 return "eLIM_MLM_IDLE_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700250 case eLIM_MLM_WT_PROBE_RESP_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700251 return "eLIM_MLM_WT_PROBE_RESP_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700252 case eLIM_MLM_PASSIVE_SCAN_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700253 return "eLIM_MLM_PASSIVE_SCAN_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700254 case eLIM_MLM_WT_JOIN_BEACON_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700255 return "eLIM_MLM_WT_JOIN_BEACON_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700256 case eLIM_MLM_JOINED_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700257 return "eLIM_MLM_JOINED_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700258 case eLIM_MLM_BSS_STARTED_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700259 return "eLIM_MLM_BSS_STARTED_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700260 case eLIM_MLM_WT_AUTH_FRAME2_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700261 return "eLIM_MLM_WT_AUTH_FRAME2_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700262 case eLIM_MLM_WT_AUTH_FRAME3_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700263 return "eLIM_MLM_WT_AUTH_FRAME3_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700264 case eLIM_MLM_WT_AUTH_FRAME4_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700265 return "eLIM_MLM_WT_AUTH_FRAME4_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700266 case eLIM_MLM_AUTH_RSP_TIMEOUT_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700267 return "eLIM_MLM_AUTH_RSP_TIMEOUT_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700268 case eLIM_MLM_AUTHENTICATED_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700269 return "eLIM_MLM_AUTHENTICATED_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700270 case eLIM_MLM_WT_ASSOC_RSP_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700271 return "eLIM_MLM_WT_ASSOC_RSP_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700272 case eLIM_MLM_WT_REASSOC_RSP_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700273 return "eLIM_MLM_WT_REASSOC_RSP_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700274 case eLIM_MLM_WT_FT_REASSOC_RSP_STATE:
275 return "eLIM_MLM_WT_FT_REASSOC_RSP_STATE";
276 case eLIM_MLM_WT_DEL_STA_RSP_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700277 return "eLIM_MLM_WT_DEL_STA_RSP_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700278 case eLIM_MLM_WT_DEL_BSS_RSP_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700279 return "eLIM_MLM_WT_DEL_BSS_RSP_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700280 case eLIM_MLM_WT_ADD_STA_RSP_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700281 return "eLIM_MLM_WT_ADD_STA_RSP_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700282 case eLIM_MLM_WT_ADD_BSS_RSP_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700283 return "eLIM_MLM_WT_ADD_BSS_RSP_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700284 case eLIM_MLM_REASSOCIATED_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700285 return "eLIM_MLM_REASSOCIATED_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700286 case eLIM_MLM_LINK_ESTABLISHED_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700287 return "eLIM_MLM_LINK_ESTABLISHED_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700288 case eLIM_MLM_WT_ASSOC_CNF_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700289 return "eLIM_MLM_WT_ASSOC_CNF_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700290 case eLIM_MLM_WT_ADD_BSS_RSP_ASSOC_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700291 return "eLIM_MLM_WT_ADD_BSS_RSP_ASSOC_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700292 case eLIM_MLM_WT_ADD_BSS_RSP_REASSOC_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700293 return "eLIM_MLM_WT_ADD_BSS_RSP_REASSOC_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700294 case eLIM_MLM_WT_ADD_BSS_RSP_FT_REASSOC_STATE:
295 return "eLIM_MLM_WT_ADD_BSS_RSP_FT_REASSOC_STATE";
296 case eLIM_MLM_WT_ASSOC_DEL_STA_RSP_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700297 return "eLIM_MLM_WT_ASSOC_DEL_STA_RSP_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700298 case eLIM_MLM_WT_SET_BSS_KEY_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700299 return "eLIM_MLM_WT_SET_BSS_KEY_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700300 case eLIM_MLM_WT_SET_STA_KEY_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700301 return "eLIM_MLM_WT_SET_STA_KEY_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700302 default:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700303 return "INVALID MLM state";
Jeff Johnson295189b2012-06-20 16:38:30 -0700304 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700305}
306
307void
308limPrintMlmState(tpAniSirGlobal pMac, tANI_U16 logLevel, tLimMlmStates state)
309{
310 limLog(pMac, logLevel, limMlmStateStr(state));
311}
312
313char *
314limSmeStateStr(tLimSmeStates state)
315{
316#ifdef FIXME_GEN6
317 switch (state)
318 {
319 case eLIM_SME_OFFLINE_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700320 return "eLIM_SME_OFFLINE_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700321 case eLIM_SME_IDLE_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700322 return "eLIM_SME_IDLE_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700323 case eLIM_SME_SUSPEND_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700324 return "eLIM_SME_SUSPEND_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700325 case eLIM_SME_WT_SCAN_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700326 return "eLIM_SME_WT_SCAN_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700327 case eLIM_SME_WT_JOIN_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700328 return "eLIM_SME_WT_JOIN_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700329 case eLIM_SME_WT_AUTH_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700330 return "eLIM_SME_WT_AUTH_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700331 case eLIM_SME_WT_ASSOC_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700332 return "eLIM_SME_WT_ASSOC_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700333 case eLIM_SME_WT_REASSOC_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700334 return "eLIM_SME_WT_REASSOC_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700335 case eLIM_SME_WT_REASSOC_LINK_FAIL_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700336 return "eLIM_SME_WT_REASSOC_LINK_FAIL_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700337 case eLIM_SME_JOIN_FAILURE_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700338 return "eLIM_SME_JOIN_FAILURE_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700339 case eLIM_SME_ASSOCIATED_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700340 return "eLIM_SME_ASSOCIATED_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700341 case eLIM_SME_REASSOCIATED_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700342 return "eLIM_SME_REASSOCIATED_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700343 case eLIM_SME_LINK_EST_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700344 return "eLIM_SME_LINK_EST_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700345 case eLIM_SME_LINK_EST_WT_SCAN_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700346 return "eLIM_SME_LINK_EST_WT_SCAN_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700347 case eLIM_SME_WT_PRE_AUTH_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700348 return "eLIM_SME_WT_PRE_AUTH_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700349 case eLIM_SME_WT_DISASSOC_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700350 return "eLIM_SME_WT_DISASSOC_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700351 case eLIM_SME_WT_DEAUTH_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700352 return "eLIM_SME_WT_DEAUTH_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700353 case eLIM_SME_WT_START_BSS_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700354 return "eLIM_SME_WT_START_BSS_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700355 case eLIM_SME_WT_STOP_BSS_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700356 return "eLIM_SME_WT_STOP_BSS_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700357 case eLIM_SME_NORMAL_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700358 return "eLIM_SME_NORMAL_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700359 case eLIM_SME_CHANNEL_SCAN_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700360 return "eLIM_SME_CHANNEL_SCAN_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700361 case eLIM_SME_NORMAL_CHANNEL_SCAN_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700362 return "eLIM_SME_NORMAL_CHANNEL_SCAN_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700363 default:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700364 return "INVALID SME state";
Jeff Johnson295189b2012-06-20 16:38:30 -0700365 }
366#endif
367return "";
368}
369
370
371char* limDot11ModeStr(tpAniSirGlobal pMac, tANI_U8 dot11Mode)
372{
373#ifdef FIXME_GEN6
374
375 switch(dot11Mode)
376 {
377 case WNI_CFG_DOT11_MODE_ALL:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700378 return "ALL";
Jeff Johnson295189b2012-06-20 16:38:30 -0700379 case WNI_CFG_DOT11_MODE_11A:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700380 return "11A";
381 case WNI_CFG_DOT11_MODE_11B:
382 return "11B";
383 case WNI_CFG_DOT11_MODE_11G:
384 return "11G";
385 case WNI_CFG_DOT11_MODE_11N:
386 return "11N";
387 case WNI_CFG_DOT11_MODE_POLARIS:
388 return "Polaris";
389 case WNI_CFG_DOT11_MODE_TITAN:
390 return "Titan";
Jeff Johnson295189b2012-06-20 16:38:30 -0700391 case WNI_CFG_DOT11_MODE_TAURUS:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700392 return "Taurus";
Jeff Johnson295189b2012-06-20 16:38:30 -0700393 default:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700394 return "Invalid Dot11 Mode";
Jeff Johnson295189b2012-06-20 16:38:30 -0700395 }
396#endif
397return "";
398}
399
400
401char* limStaOpRateModeStr(tStaRateMode opRateMode)
402{
403#ifdef FIXME_GEN6
404
405 switch(opRateMode)
406 {
407 case eSTA_TAURUS:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700408 return "Taurus";
Jeff Johnson295189b2012-06-20 16:38:30 -0700409 case eSTA_11a:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700410 return "11A";
411 case eSTA_11b:
412 return "11B";
413 case eSTA_11bg:
414 return "11G";
415 case eSTA_11n:
416 return "11N";
417 case eSTA_POLARIS:
418 return "Polaris";
Jeff Johnson295189b2012-06-20 16:38:30 -0700419 case eSTA_TITAN:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700420 return "Titan";
Jeff Johnson295189b2012-06-20 16:38:30 -0700421 default:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700422 return "Invalid Dot11 Mode";
Jeff Johnson295189b2012-06-20 16:38:30 -0700423 }
424#endif
425return "";
426}
427
428char* limBssTypeStr(tSirBssType bssType)
429{
430 switch(bssType)
431 {
432 case eSIR_INFRASTRUCTURE_MODE:
433 return "eSIR_INFRASTRUCTURE_MODE";
434 case eSIR_IBSS_MODE:
435 return "eSIR_IBSS_MODE";
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700436 case eSIR_BTAMP_STA_MODE:
Jeff Johnson295189b2012-06-20 16:38:30 -0700437 return "eSIR_BTAMP_STA_MODE";
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700438 case eSIR_BTAMP_AP_MODE:
Jeff Johnson295189b2012-06-20 16:38:30 -0700439 return "eSIR_BTAMP_AP_MODE";
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700440 case eSIR_AUTO_MODE:
Jeff Johnson295189b2012-06-20 16:38:30 -0700441 return "eSIR_AUTO_MODE";
442 default:
443 return "Invalid BSS Type";
444 }
445}
446
447void
448limPrintSmeState(tpAniSirGlobal pMac, tANI_U16 logLevel, tLimSmeStates state)
449{
450 limLog(pMac, logLevel, limSmeStateStr(state));
451}
452
453char *limMsgStr(tANI_U32 msgType)
454{
455#ifdef FIXME_GEN6
456 switch (msgType)
457 {
458 case eWNI_SME_START_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700459 return "eWNI_SME_START_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700460 case eWNI_SME_START_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700461 return "eWNI_SME_START_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700462 case eWNI_SME_SYS_READY_IND:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700463 return "eWNI_SME_SYS_READY_IND";
Jeff Johnson295189b2012-06-20 16:38:30 -0700464 case eWNI_SME_SCAN_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700465 return "eWNI_SME_SCAN_REQ";
Jeff Johnsone7245742012-09-05 17:12:55 -0700466#ifdef FEATURE_OEM_DATA_SUPPORT
467 case eWNI_SME_OEM_DATA_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700468 return "eWNI_SME_OEM_DATA_REQ";
Jeff Johnsone7245742012-09-05 17:12:55 -0700469 case eWNI_SME_OEM_DATA_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700470 return "eWNI_SME_OEM_DATA_RSP";
Jeff Johnsone7245742012-09-05 17:12:55 -0700471#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700472 case eWNI_SME_SCAN_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700473 return "eWNI_SME_SCAN_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700474 case eWNI_SME_JOIN_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700475 return "eWNI_SME_JOIN_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700476 case eWNI_SME_JOIN_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700477 return "eWNI_SME_JOIN_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700478 case eWNI_SME_SETCONTEXT_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700479 return "eWNI_SME_SETCONTEXT_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700480 case eWNI_SME_SETCONTEXT_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700481 return "eWNI_SME_SETCONTEXT_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700482 case eWNI_SME_REASSOC_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700483 return "eWNI_SME_REASSOC_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700484 case eWNI_SME_REASSOC_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700485 return "eWNI_SME_REASSOC_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700486 case eWNI_SME_AUTH_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700487 return "eWNI_SME_AUTH_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700488 case eWNI_SME_AUTH_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700489 return "eWNI_SME_AUTH_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700490 case eWNI_SME_DISASSOC_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700491 return "eWNI_SME_DISASSOC_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700492 case eWNI_SME_DISASSOC_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700493 return "eWNI_SME_DISASSOC_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700494 case eWNI_SME_DISASSOC_IND:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700495 return "eWNI_SME_DISASSOC_IND";
Jeff Johnson295189b2012-06-20 16:38:30 -0700496 case eWNI_SME_DISASSOC_CNF:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700497 return "eWNI_SME_DISASSOC_CNF";
Jeff Johnson295189b2012-06-20 16:38:30 -0700498 case eWNI_SME_DEAUTH_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700499 return "eWNI_SME_DEAUTH_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700500 case eWNI_SME_DEAUTH_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700501 return "eWNI_SME_DEAUTH_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700502 case eWNI_SME_DEAUTH_IND:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700503 return "eWNI_SME_DEAUTH_IND";
Jeff Johnson295189b2012-06-20 16:38:30 -0700504 case eWNI_SME_WM_STATUS_CHANGE_NTF:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700505 return "eWNI_SME_WM_STATUS_CHANGE_NTF";
Jeff Johnson295189b2012-06-20 16:38:30 -0700506 case eWNI_SME_START_BSS_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700507 return "eWNI_SME_START_BSS_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700508 case eWNI_SME_START_BSS_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700509 return "eWNI_SME_START_BSS_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700510 case eWNI_SME_AUTH_IND:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700511 return "eWNI_SME_AUTH_IND";
Jeff Johnson295189b2012-06-20 16:38:30 -0700512 case eWNI_SME_ASSOC_IND:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700513 return "eWNI_SME_ASSOC_IND";
Jeff Johnson295189b2012-06-20 16:38:30 -0700514 case eWNI_SME_ASSOC_CNF:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700515 return "eWNI_SME_ASSOC_CNF";
Jeff Johnson295189b2012-06-20 16:38:30 -0700516 case eWNI_SME_REASSOC_IND:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700517 return "eWNI_SME_REASSOC_IND";
Jeff Johnson295189b2012-06-20 16:38:30 -0700518 case eWNI_SME_REASSOC_CNF:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700519 return "eWNI_SME_REASSOC_CNF";
Jeff Johnson295189b2012-06-20 16:38:30 -0700520 case eWNI_SME_SWITCH_CHL_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700521 return "eWNI_SME_SWITCH_CHL_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700522 case eWNI_SME_SWITCH_CHL_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700523 return "eWNI_SME_SWITCH_CHL_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700524 case eWNI_SME_SWITCH_CHL_CB_PRIMARY_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700525 return "eWNI_SME_SWITCH_CHL_CB_PRIMARY_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700526 case eWNI_SME_SWITCH_CHL_CB_SECONDARY_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700527 return "eWNI_SME_SWITCH_CHL_CB_SECONDARY_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700528 case eWNI_SME_STOP_BSS_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700529 return "eWNI_SME_STOP_BSS_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700530 case eWNI_SME_STOP_BSS_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700531 return "eWNI_SME_STOP_BSS_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700532 case eWNI_SME_PROMISCUOUS_MODE_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700533 return "eWNI_SME_PROMISCUOUS_MODE_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700534 case eWNI_SME_PROMISCUOUS_MODE_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700535 return "eWNI_SME_PROMISCUOUS_MODE_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700536 case eWNI_SME_NEIGHBOR_BSS_IND:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700537 return "eWNI_SME_NEIGHBOR_BSS_IND";
Jeff Johnson295189b2012-06-20 16:38:30 -0700538 case eWNI_SME_MEASUREMENT_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700539 return "eWNI_SME_MEASUREMENT_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700540 case eWNI_SME_MEASUREMENT_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700541 return "eWNI_SME_MEASUREMENT_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700542 case eWNI_SME_MEASUREMENT_IND:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700543 return "eWNI_SME_MEASUREMENT_IND";
Jeff Johnson295189b2012-06-20 16:38:30 -0700544 case eWNI_SME_SET_WDS_INFO_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700545 return "eWNI_SME_SET_WDS_INFO_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700546 case eWNI_SME_SET_WDS_INFO_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700547 return "eWNI_SME_SET_WDS_INFO_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700548 case eWNI_SME_WDS_INFO_IND:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700549 return "eWNI_SME_WDS_INFO_IND";
Jeff Johnson295189b2012-06-20 16:38:30 -0700550 case eWNI_SME_DEAUTH_CNF:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700551 return "eWNI_SME_DEAUTH_CNF";
Jeff Johnson295189b2012-06-20 16:38:30 -0700552 case eWNI_SME_MIC_FAILURE_IND:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700553 return "eWNI_SME_MIC_FAILURE_IND";
Jeff Johnson295189b2012-06-20 16:38:30 -0700554 case eWNI_SME_ADDTS_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700555 return "eWNI_SME_ADDTS_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700556 case eWNI_SME_ADDTS_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700557 return "eWNI_SME_ADDTS_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700558 case eWNI_SME_ADDTS_CNF:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700559 return "eWNI_SME_ADDTS_CNF";
Jeff Johnson295189b2012-06-20 16:38:30 -0700560 case eWNI_SME_ADDTS_IND:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700561 return "eWNI_SME_ADDTS_IND";
Jeff Johnson295189b2012-06-20 16:38:30 -0700562 case eWNI_SME_DELTS_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700563 return "eWNI_SME_DELTS_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700564 case eWNI_SME_DELTS_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700565 return "eWNI_SME_DELTS_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700566 case eWNI_SME_DELTS_IND:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700567 return "eWNI_SME_DELTS_IND";
Srinivas Girigowdad34cedb2013-01-25 13:33:11 -0800568#if defined WLAN_FEATURE_VOWIFI_11R || defined FEATURE_WLAN_CCX || defined(FEATURE_WLAN_LFR)
569 case eWNI_SME_GET_ROAM_RSSI_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700570 return "eWNI_SME_GET_ROAM_RSSI_REQ";
Srinivas Girigowdad34cedb2013-01-25 13:33:11 -0800571 case eWNI_SME_GET_ROAM_RSSI_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700572 return "eWNI_SME_GET_ROAM_RSSI_RSP";
Srinivas Girigowdad34cedb2013-01-25 13:33:11 -0800573#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700574
Jeff Johnson295189b2012-06-20 16:38:30 -0700575 case WDA_SUSPEND_ACTIVITY_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700576 return "WDA_SUSPEND_ACTIVITY_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700577 case SIR_LIM_RETRY_INTERRUPT_MSG:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700578 return "SIR_LIM_RETRY_INTERRUPT_MSG";
Jeff Johnson295189b2012-06-20 16:38:30 -0700579 case SIR_BB_XPORT_MGMT_MSG:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700580 return "SIR_BB_XPORT_MGMT_MSG";
Jeff Johnson295189b2012-06-20 16:38:30 -0700581 case SIR_LIM_INV_KEY_INTERRUPT_MSG:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700582 return "SIR_LIM_INV_KEY_INTERRUPT_MSG";
Jeff Johnson295189b2012-06-20 16:38:30 -0700583 case SIR_LIM_KEY_ID_INTERRUPT_MSG:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700584 return "SIR_LIM_KEY_ID_INTERRUPT_MSG";
Jeff Johnson295189b2012-06-20 16:38:30 -0700585 case SIR_LIM_REPLAY_THRES_INTERRUPT_MSG:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700586 return "SIR_LIM_REPLAY_THRES_INTERRUPT_MSG";
Jeff Johnson295189b2012-06-20 16:38:30 -0700587 case SIR_LIM_MIN_CHANNEL_TIMEOUT:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700588 return "SIR_LIM_MIN_CHANNEL_TIMEOUT";
Jeff Johnson295189b2012-06-20 16:38:30 -0700589 case SIR_LIM_MAX_CHANNEL_TIMEOUT:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700590 return "SIR_LIM_MAX_CHANNEL_TIMEOUT";
Jeff Johnson295189b2012-06-20 16:38:30 -0700591 case SIR_LIM_JOIN_FAIL_TIMEOUT:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700592 return "SIR_LIM_JOIN_FAIL_TIMEOUT";
Jeff Johnson295189b2012-06-20 16:38:30 -0700593 case SIR_LIM_AUTH_FAIL_TIMEOUT:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700594 return "SIR_LIM_AUTH_FAIL_TIMEOUT";
Jeff Johnson295189b2012-06-20 16:38:30 -0700595 case SIR_LIM_AUTH_RSP_TIMEOUT:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700596 return "SIR_LIM_AUTH_RSP_TIMEOUT";
Jeff Johnson295189b2012-06-20 16:38:30 -0700597 case SIR_LIM_ASSOC_FAIL_TIMEOUT:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700598 return "SIR_LIM_ASSOC_FAIL_TIMEOUT";
Jeff Johnson295189b2012-06-20 16:38:30 -0700599 case SIR_LIM_REASSOC_FAIL_TIMEOUT:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700600 return "SIR_LIM_REASSOC_FAIL_TIMEOUT";
Jeff Johnson295189b2012-06-20 16:38:30 -0700601 case SIR_LIM_HEART_BEAT_TIMEOUT:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700602 return "SIR_LIM_HEART_BEAT_TIMEOUT";
Jeff Johnson295189b2012-06-20 16:38:30 -0700603 case SIR_LIM_ADDTS_RSP_TIMEOUT:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700604 return "SIR_LIM_ADDTS_RSP_TIMEOUT";
Jeff Johnson295189b2012-06-20 16:38:30 -0700605 case SIR_LIM_CHANNEL_SCAN_TIMEOUT:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700606 return "SIR_LIM_CHANNEL_SCAN_TIMEOUT";
Jeff Johnson295189b2012-06-20 16:38:30 -0700607 case SIR_LIM_LINK_TEST_DURATION_TIMEOUT:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700608 return "SIR_LIM_LINK_TEST_DURATION_TIMEOUT";
Jeff Johnson295189b2012-06-20 16:38:30 -0700609 case SIR_LIM_HASH_MISS_THRES_TIMEOUT:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700610 return "SIR_LIM_HASH_MISS_THRES_TIMEOUT";
Jeff Johnson295189b2012-06-20 16:38:30 -0700611 case SIR_LIM_KEEPALIVE_TIMEOUT:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700612 return "SIR_LIM_KEEPALIVE_TIMEOUT";
Jeff Johnson295189b2012-06-20 16:38:30 -0700613 case SIR_LIM_UPDATE_OLBC_CACHEL_TIMEOUT:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700614 return "SIR_LIM_UPDATE_OLBC_CACHEL_TIMEOUT";
Jeff Johnson295189b2012-06-20 16:38:30 -0700615 case SIR_LIM_CNF_WAIT_TIMEOUT:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700616 return "SIR_LIM_CNF_WAIT_TIMEOUT";
Jeff Johnson295189b2012-06-20 16:38:30 -0700617 case SIR_LIM_RADAR_DETECT_IND:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700618 return "SIR_LIM_RADAR_DETECT_IND";
Jeff Johnson295189b2012-06-20 16:38:30 -0700619#ifdef WLAN_FEATURE_VOWIFI_11R
620 case SIR_LIM_FT_PREAUTH_RSP_TIMEOUT:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700621 return "SIR_LIM_FT_PREAUTH_RSP_TIMEOUT";
Jeff Johnson295189b2012-06-20 16:38:30 -0700622#endif
623
624 case SIR_HAL_APP_SETUP_NTF:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700625 return "SIR_HAL_APP_SETUP_NTF";
Jeff Johnson295189b2012-06-20 16:38:30 -0700626 case SIR_HAL_INITIAL_CAL_FAILED_NTF:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700627 return "SIR_HAL_INITIAL_CAL_FAILED_NTF";
Jeff Johnson295189b2012-06-20 16:38:30 -0700628 case SIR_HAL_NIC_OPER_NTF:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700629 return "SIR_HAL_NIC_OPER_NTF";
Jeff Johnson295189b2012-06-20 16:38:30 -0700630 case SIR_HAL_INIT_START_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700631 return "SIR_HAL_INIT_START_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700632 case SIR_HAL_SHUTDOWN_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700633 return "SIR_HAL_SHUTDOWN_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700634 case SIR_HAL_SHUTDOWN_CNF:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700635 return "SIR_HAL_SHUTDOWN_CNF";
Jeff Johnson295189b2012-06-20 16:38:30 -0700636 case SIR_HAL_RESET_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700637 return "SIR_HAL_RESET_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700638 case SIR_HAL_RESET_CNF:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700639 return "SIR_HAL_RESET_CNF";
Jeff Johnson295189b2012-06-20 16:38:30 -0700640 case SIR_WRITE_TO_TD:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700641 return "SIR_WRITE_TO_TD";
Jeff Johnson295189b2012-06-20 16:38:30 -0700642
643 case WNI_CFG_PARAM_UPDATE_IND:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700644 return "WNI_CFG_PARAM_UPDATE_IND";
Jeff Johnson295189b2012-06-20 16:38:30 -0700645 case WNI_CFG_DNLD_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700646 return "WNI_CFG_DNLD_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700647 case WNI_CFG_DNLD_CNF:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700648 return "WNI_CFG_DNLD_CNF";
Jeff Johnson295189b2012-06-20 16:38:30 -0700649 case WNI_CFG_GET_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700650 return "WNI_CFG_GET_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700651 case WNI_CFG_SET_CNF:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700652 return "WNI_CFG_SET_CNF";
Jeff Johnson295189b2012-06-20 16:38:30 -0700653 case WNI_CFG_GET_ATTRIB_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700654 return "WNI_CFG_GET_ATTRIB_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700655 case WNI_CFG_ADD_GRP_ADDR_CNF:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700656 return "WNI_CFG_ADD_GRP_ADDR_CNF";
Jeff Johnson295189b2012-06-20 16:38:30 -0700657 case WNI_CFG_DEL_GRP_ADDR_CNF:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700658 return "WNI_CFG_DEL_GRP_ADDR_CNF";
Jeff Johnson295189b2012-06-20 16:38:30 -0700659 case ANI_CFG_GET_RADIO_STAT_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700660 return "ANI_CFG_GET_RADIO_STAT_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700661 case ANI_CFG_GET_PER_STA_STAT_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700662 return "ANI_CFG_GET_PER_STA_STAT_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700663 case ANI_CFG_GET_AGG_STA_STAT_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700664 return "ANI_CFG_GET_AGG_STA_STAT_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700665 case ANI_CFG_CLEAR_STAT_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700666 return "ANI_CFG_CLEAR_STAT_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700667 case WNI_CFG_DNLD_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700668 return "WNI_CFG_DNLD_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700669 case WNI_CFG_GET_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700670 return "WNI_CFG_GET_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700671 case WNI_CFG_SET_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700672 return "WNI_CFG_SET_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700673 case WNI_CFG_SET_REQ_NO_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700674 return "WNI_CFG_SET_REQ_NO_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700675 case eWNI_PMC_ENTER_IMPS_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700676 return "eWNI_PMC_ENTER_IMPS_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700677 case eWNI_PMC_EXIT_IMPS_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700678 return "eWNI_PMC_EXIT_IMPS_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700679 case eWNI_PMC_ENTER_BMPS_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700680 return "eWNI_PMC_ENTER_BMPS_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700681 case eWNI_PMC_EXIT_BMPS_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700682 return "eWNI_PMC_EXIT_BMPS_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700683 case eWNI_PMC_EXIT_BMPS_IND:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700684 return "eWNI_PMC_EXIT_BMPS_IND";
Yathish9f22e662012-12-10 14:21:35 -0800685 case eWNI_SME_SET_BCN_FILTER_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700686 return "eWNI_SME_SET_BCN_FILTER_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700687 default:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700688 return "INVALID SME message";
Jeff Johnson295189b2012-06-20 16:38:30 -0700689 }
690#endif
691return "";
692}
693
694
695
696char *limResultCodeStr(tSirResultCodes resultCode)
697{
Jeff Johnson295189b2012-06-20 16:38:30 -0700698 switch (resultCode)
699 {
700 case eSIR_SME_SUCCESS:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700701 return "eSIR_SME_SUCCESS";
Jeff Johnson295189b2012-06-20 16:38:30 -0700702 case eSIR_EOF_SOF_EXCEPTION:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700703 return "eSIR_EOF_SOF_EXCEPTION";
Jeff Johnson295189b2012-06-20 16:38:30 -0700704 case eSIR_BMU_EXCEPTION:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700705 return "eSIR_BMU_EXCEPTION";
Jeff Johnson295189b2012-06-20 16:38:30 -0700706 case eSIR_LOW_PDU_EXCEPTION:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700707 return "eSIR_LOW_PDU_EXCEPTION";
Jeff Johnson295189b2012-06-20 16:38:30 -0700708 case eSIR_USER_TRIG_RESET:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700709 return"eSIR_USER_TRIG_RESET";
Jeff Johnson295189b2012-06-20 16:38:30 -0700710 case eSIR_LOGP_EXCEPTION:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700711 return "eSIR_LOGP_EXCEPTION";
Jeff Johnson295189b2012-06-20 16:38:30 -0700712 case eSIR_CP_EXCEPTION:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700713 return "eSIR_CP_EXCEPTION";
Jeff Johnson295189b2012-06-20 16:38:30 -0700714 case eSIR_STOP_BSS:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700715 return "eSIR_STOP_BSS";
Jeff Johnson295189b2012-06-20 16:38:30 -0700716 case eSIR_AHB_HANG_EXCEPTION:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700717 return "eSIR_AHB_HANG_EXCEPTION";
Jeff Johnson295189b2012-06-20 16:38:30 -0700718 case eSIR_DPU_EXCEPTION:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700719 return "eSIR_DPU_EXCEPTION";
Jeff Johnson295189b2012-06-20 16:38:30 -0700720 case eSIR_RXP_EXCEPTION:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700721 return "eSIR_RXP_EXCEPTION";
Jeff Johnson295189b2012-06-20 16:38:30 -0700722 case eSIR_MCPU_EXCEPTION:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700723 return "eSIR_MCPU_EXCEPTION";
Jeff Johnson295189b2012-06-20 16:38:30 -0700724 case eSIR_MCU_EXCEPTION:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700725 return "eSIR_MCU_EXCEPTION";
Jeff Johnson295189b2012-06-20 16:38:30 -0700726 case eSIR_MTU_EXCEPTION:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700727 return "eSIR_MTU_EXCEPTION";
Jeff Johnson295189b2012-06-20 16:38:30 -0700728 case eSIR_MIF_EXCEPTION:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700729 return "eSIR_MIF_EXCEPTION";
Jeff Johnson295189b2012-06-20 16:38:30 -0700730 case eSIR_FW_EXCEPTION:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700731 return "eSIR_FW_EXCEPTION";
Jeff Johnson295189b2012-06-20 16:38:30 -0700732 case eSIR_MAILBOX_SANITY_CHK_FAILED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700733 return "eSIR_MAILBOX_SANITY_CHK_FAILED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700734 case eSIR_RADIO_HW_SWITCH_STATUS_IS_OFF:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700735 return "eSIR_RADIO_HW_SWITCH_STATUS_IS_OFF";
Jeff Johnson295189b2012-06-20 16:38:30 -0700736 case eSIR_CFB_FLAG_STUCK_EXCEPTION:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700737 return "eSIR_CFB_FLAG_STUCK_EXCEPTION";
Jeff Johnson295189b2012-06-20 16:38:30 -0700738 case eSIR_SME_BASIC_RATES_NOT_SUPPORTED_STATUS:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700739 return "eSIR_SME_BASIC_RATES_NOT_SUPPORTED_STATUS";
Jeff Johnson295189b2012-06-20 16:38:30 -0700740 case eSIR_SME_INVALID_PARAMETERS:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700741 return "eSIR_SME_INVALID_PARAMETERS";
Jeff Johnson295189b2012-06-20 16:38:30 -0700742 case eSIR_SME_UNEXPECTED_REQ_RESULT_CODE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700743 return "eSIR_SME_UNEXPECTED_REQ_RESULT_CODE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700744 case eSIR_SME_RESOURCES_UNAVAILABLE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700745 return "eSIR_SME_RESOURCES_UNAVAILABLE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700746 case eSIR_SME_SCAN_FAILED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700747 return "eSIR_SME_SCAN_FAILED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700748 case eSIR_SME_BSS_ALREADY_STARTED_OR_JOINED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700749 return "eSIR_SME_BSS_ALREADY_STARTED_OR_JOINED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700750 case eSIR_SME_LOST_LINK_WITH_PEER_RESULT_CODE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700751 return "eSIR_SME_LOST_LINK_WITH_PEER_RESULT_CODE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700752 case eSIR_SME_REFUSED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700753 return "eSIR_SME_REFUSED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700754 case eSIR_SME_JOIN_TIMEOUT_RESULT_CODE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700755 return "eSIR_SME_JOIN_TIMEOUT_RESULT_CODE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700756 case eSIR_SME_AUTH_TIMEOUT_RESULT_CODE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700757 return "eSIR_SME_AUTH_TIMEOUT_RESULT_CODE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700758 case eSIR_SME_ASSOC_TIMEOUT_RESULT_CODE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700759 return "eSIR_SME_ASSOC_TIMEOUT_RESULT_CODE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700760 case eSIR_SME_REASSOC_TIMEOUT_RESULT_CODE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700761 return "eSIR_SME_REASSOC_TIMEOUT_RESULT_CODE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700762 case eSIR_SME_MAX_NUM_OF_PRE_AUTH_REACHED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700763 return "eSIR_SME_MAX_NUM_OF_PRE_AUTH_REACHED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700764 case eSIR_SME_AUTH_REFUSED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700765 return "eSIR_SME_AUTH_REFUSED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700766 case eSIR_SME_INVALID_WEP_DEFAULT_KEY:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700767 return "eSIR_SME_INVALID_WEP_DEFAULT_KEY";
Jeff Johnson295189b2012-06-20 16:38:30 -0700768 case eSIR_SME_ASSOC_REFUSED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700769 return "eSIR_SME_ASSOC_REFUSED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700770 case eSIR_SME_REASSOC_REFUSED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700771 return "eSIR_SME_REASSOC_REFUSED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700772 case eSIR_SME_STA_NOT_AUTHENTICATED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700773 return "eSIR_SME_STA_NOT_AUTHENTICATED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700774 case eSIR_SME_STA_NOT_ASSOCIATED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700775 return "eSIR_SME_STA_NOT_ASSOCIATED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700776 case eSIR_SME_STA_DISASSOCIATED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700777 return "eSIR_SME_STA_DISASSOCIATED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700778 case eSIR_SME_ALREADY_JOINED_A_BSS:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700779 return "eSIR_SME_ALREADY_JOINED_A_BSS";
Jeff Johnson295189b2012-06-20 16:38:30 -0700780 case eSIR_ULA_COMPLETED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700781 return "eSIR_ULA_COMPLETED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700782 case eSIR_ULA_FAILURE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700783 return "eSIR_ULA_FAILURE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700784 case eSIR_SME_LINK_ESTABLISHED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700785 return "eSIR_SME_LINK_ESTABLISHED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700786 case eSIR_SME_UNABLE_TO_PERFORM_MEASUREMENTS:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700787 return "eSIR_SME_UNABLE_TO_PERFORM_MEASUREMENTS";
Jeff Johnson295189b2012-06-20 16:38:30 -0700788 case eSIR_SME_UNABLE_TO_PERFORM_DFS:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700789 return "eSIR_SME_UNABLE_TO_PERFORM_DFS";
Jeff Johnson295189b2012-06-20 16:38:30 -0700790 case eSIR_SME_DFS_FAILED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700791 return "eSIR_SME_DFS_FAILED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700792 case eSIR_SME_TRANSFER_STA:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700793 return "eSIR_SME_TRANSFER_STA";
Jeff Johnson295189b2012-06-20 16:38:30 -0700794 case eSIR_SME_INVALID_LINK_TEST_PARAMETERS:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700795 return "eSIR_SME_INVALID_LINK_TEST_PARAMETERS";
Jeff Johnson295189b2012-06-20 16:38:30 -0700796 case eSIR_SME_LINK_TEST_MAX_EXCEEDED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700797 return "eSIR_SME_LINK_TEST_MAX_EXCEEDED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700798 case eSIR_SME_UNSUPPORTED_RATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700799 return "eSIR_SME_UNSUPPORTED_RATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700800 case eSIR_SME_LINK_TEST_TIMEOUT:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700801 return "eSIR_SME_LINK_TEST_TIMEOUT";
Jeff Johnson295189b2012-06-20 16:38:30 -0700802 case eSIR_SME_LINK_TEST_COMPLETE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700803 return "eSIR_SME_LINK_TEST_COMPLETE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700804 case eSIR_SME_LINK_TEST_INVALID_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700805 return "eSIR_SME_LINK_TEST_INVALID_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700806 case eSIR_SME_LINK_TEST_INVALID_ADDRESS:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700807 return "eSIR_SME_LINK_TEST_INVALID_ADDRESS";
Jeff Johnson295189b2012-06-20 16:38:30 -0700808 case eSIR_SME_POLARIS_RESET:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700809 return "eSIR_SME_POLARIS_RESET";
Jeff Johnson295189b2012-06-20 16:38:30 -0700810 case eSIR_SME_SETCONTEXT_FAILED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700811 return "eSIR_SME_SETCONTEXT_FAILED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700812 case eSIR_SME_BSS_RESTART:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700813 return "eSIR_SME_BSS_RESTART";
Jeff Johnson295189b2012-06-20 16:38:30 -0700814 case eSIR_SME_MORE_SCAN_RESULTS_FOLLOW:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700815 return "eSIR_SME_MORE_SCAN_RESULTS_FOLLOW";
Jeff Johnson295189b2012-06-20 16:38:30 -0700816 case eSIR_SME_INVALID_ASSOC_RSP_RXED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700817 return "eSIR_SME_INVALID_ASSOC_RSP_RXED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700818 case eSIR_SME_MIC_COUNTER_MEASURES:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700819 return "eSIR_SME_MIC_COUNTER_MEASURES";
Jeff Johnson295189b2012-06-20 16:38:30 -0700820 case eSIR_SME_ADDTS_RSP_TIMEOUT:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700821 return "eSIR_SME_ADDTS_RSP_TIMEOUT";
Jeff Johnson295189b2012-06-20 16:38:30 -0700822 case eSIR_SME_RECEIVED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700823 return "eSIR_SME_RECEIVED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700824 case eSIR_SME_CHANNEL_SWITCH_FAIL:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700825 return "eSIR_SME_CHANNEL_SWITCH_FAIL";
Jeff Johnson295189b2012-06-20 16:38:30 -0700826#ifdef GEN4_SCAN
827 case eSIR_SME_CHANNEL_SWITCH_DISABLED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700828 return "eSIR_SME_CHANNEL_SWITCH_DISABLED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700829 case eSIR_SME_HAL_SCAN_INIT_FAILED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700830 return "eSIR_SME_HAL_SCAN_INIT_FAILED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700831 case eSIR_SME_HAL_SCAN_START_FAILED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700832 return "eSIR_SME_HAL_SCAN_START_FAILED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700833 case eSIR_SME_HAL_SCAN_END_FAILED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700834 return "eSIR_SME_HAL_SCAN_END_FAILED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700835 case eSIR_SME_HAL_SCAN_FINISH_FAILED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700836 return "eSIR_SME_HAL_SCAN_FINISH_FAILED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700837 case eSIR_SME_HAL_SEND_MESSAGE_FAIL:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700838 return "eSIR_SME_HAL_SEND_MESSAGE_FAIL";
Jeff Johnson295189b2012-06-20 16:38:30 -0700839#else // GEN4_SCAN
840 case eSIR_SME_CHANNEL_SWITCH_DISABLED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700841 return "eSIR_SME_CHANNEL_SWITCH_DISABLED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700842 case eSIR_SME_HAL_SEND_MESSAGE_FAIL:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700843 return "eSIR_SME_HAL_SEND_MESSAGE_FAIL";
Jeff Johnson295189b2012-06-20 16:38:30 -0700844#endif // GEN4_SCAN
845
846 default:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700847 return "INVALID resultCode";
Jeff Johnson295189b2012-06-20 16:38:30 -0700848 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700849}
850
851void
852limPrintMsgName(tpAniSirGlobal pMac, tANI_U16 logLevel, tANI_U32 msgType)
853{
854 limLog(pMac, logLevel, limMsgStr(msgType));
855}
856
Jeff Johnson295189b2012-06-20 16:38:30 -0700857void
858limPrintMsgInfo(tpAniSirGlobal pMac, tANI_U16 logLevel, tSirMsgQ *msg)
859{
Jeff Johnson295189b2012-06-20 16:38:30 -0700860 if (logLevel <= pMac->utils.gLogDbgLevel[SIR_LIM_MODULE_ID - LOG_FIRST_MODULE_ID])
861 {
862 switch (msg->type)
863 {
864 case SIR_BB_XPORT_MGMT_MSG:
Jeff Johnson295189b2012-06-20 16:38:30 -0700865 limPrintMsgName(pMac, logLevel,msg->type);
Jeff Johnson295189b2012-06-20 16:38:30 -0700866 break;
867 default:
868 limPrintMsgName(pMac, logLevel,msg->type);
869 break;
870 }
871 }
872}
873
874/**
875 * limInitMlm()
876 *
877 *FUNCTION:
878 * This function is called by limProcessSmeMessages() to
879 * initialize MLM state machine on STA
880 *
881 *PARAMS:
882 *
883 *LOGIC:
884 *
885 *ASSUMPTIONS:
886 * NA
887 *
888 *NOTE:
889 * NA
890 *
891 * @param pMac Pointer to Global MAC structure
892 * @return None
893 */
894void
895limInitMlm(tpAniSirGlobal pMac)
896{
Madan Mohan Koyyalamudi694f8d72012-10-11 16:32:55 -0700897 tANI_U32 retVal;
898
899 pMac->lim.gLimTimersCreated = 0;
Madan Mohan Koyyalamudi1bed5982012-10-22 14:38:06 -0700900
Jeff Johnsone7245742012-09-05 17:12:55 -0700901 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, NO_SESSION, pMac->lim.gLimMlmState));
Jeff Johnson295189b2012-06-20 16:38:30 -0700902
903 /// Initialize scan result hash table
904 limReInitScanResults(pMac); //sep26th review
905
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -0700906#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
907 /// Initialize lfr scan result hash table
908 // Could there be a problem in multisession with SAP/P2P GO, when in the
909 // middle of FW bg scan, SAP started; Again that could be a problem even on
910 // infra + SAP/P2P GO too - TBD
911 limReInitLfrScanResults(pMac);
912#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700913
914 /// Initialize number of pre-auth contexts
915 pMac->lim.gLimNumPreAuthContexts = 0;
916
917 /// Initialize MAC based Authentication STA list
918 limInitPreAuthList(pMac);
919
920 //pMac->lim.gpLimMlmJoinReq = NULL;
921
922 if (pMac->lim.gLimTimersCreated)
923 return;
924
925 // Create timers used by LIM
Madan Mohan Koyyalamudi694f8d72012-10-11 16:32:55 -0700926 retVal = limCreateTimers(pMac);
927 if(retVal == TX_SUCCESS)
928 {
929 pMac->lim.gLimTimersCreated = 1;
930 }
931 else
932 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700933 limLog(pMac, LOGP, FL(" limCreateTimers Failed to create lim timers "));
Madan Mohan Koyyalamudi694f8d72012-10-11 16:32:55 -0700934 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700935} /*** end limInitMlm() ***/
936
937
938
939/**
940 * limCleanupMlm()
941 *
942 *FUNCTION:
943 * This function is called to cleanup any resources
944 * allocated by the MLM state machine.
945 *
946 *PARAMS:
947 *
948 *LOGIC:
949 *
950 *ASSUMPTIONS:
951 * NA
952 *
953 *NOTE:
954 * It is assumed that BSS is already informed that we're leaving it
955 * before this function is called.
956 *
957 * @param pMac Pointer to Global MAC structure
958 * @param None
959 * @return None
960 */
961void
962limCleanupMlm(tpAniSirGlobal pMac)
963{
964 tANI_U32 n;
965 tLimPreAuthNode *pAuthNode;
966
967 if (pMac->lim.gLimTimersCreated == 1)
968 {
969 // Deactivate and delete MIN/MAX channel timers.
970 tx_timer_deactivate(&pMac->lim.limTimers.gLimMinChannelTimer);
971 tx_timer_delete(&pMac->lim.limTimers.gLimMinChannelTimer);
972 tx_timer_deactivate(&pMac->lim.limTimers.gLimMaxChannelTimer);
973 tx_timer_delete(&pMac->lim.limTimers.gLimMaxChannelTimer);
974 tx_timer_deactivate(&pMac->lim.limTimers.gLimPeriodicProbeReqTimer);
975 tx_timer_delete(&pMac->lim.limTimers.gLimPeriodicProbeReqTimer);
976
977
978 // Deactivate and delete channel switch timer.
979 tx_timer_deactivate(&pMac->lim.limTimers.gLimChannelSwitchTimer);
980 tx_timer_delete(&pMac->lim.limTimers.gLimChannelSwitchTimer);
981
982
983 // Deactivate and delete addts response timer.
984 tx_timer_deactivate(&pMac->lim.limTimers.gLimAddtsRspTimer);
985 tx_timer_delete(&pMac->lim.limTimers.gLimAddtsRspTimer);
986
987 // Deactivate and delete Join failure timer.
988 tx_timer_deactivate(&pMac->lim.limTimers.gLimJoinFailureTimer);
989 tx_timer_delete(&pMac->lim.limTimers.gLimJoinFailureTimer);
990
Madan Mohan Koyyalamudi9aff9ff2012-11-29 11:27:25 -0800991 // Deactivate and delete Periodic Join Probe Request timer.
992 tx_timer_deactivate(&pMac->lim.limTimers.gLimPeriodicJoinProbeReqTimer);
993 tx_timer_delete(&pMac->lim.limTimers.gLimPeriodicJoinProbeReqTimer);
994
Jeff Johnson295189b2012-06-20 16:38:30 -0700995 // Deactivate and delete Association failure timer.
996 tx_timer_deactivate(&pMac->lim.limTimers.gLimAssocFailureTimer);
997 tx_timer_delete(&pMac->lim.limTimers.gLimAssocFailureTimer);
998
999 // Deactivate and delete Reassociation failure timer.
1000 tx_timer_deactivate(&pMac->lim.limTimers.gLimReassocFailureTimer);
1001 tx_timer_delete(&pMac->lim.limTimers.gLimReassocFailureTimer);
1002
1003 // Deactivate and delete Authentication failure timer.
1004 tx_timer_deactivate(&pMac->lim.limTimers.gLimAuthFailureTimer);
1005 tx_timer_delete(&pMac->lim.limTimers.gLimAuthFailureTimer);
1006
1007 // Deactivate and delete Heartbeat timer.
1008 tx_timer_deactivate(&pMac->lim.limTimers.gLimHeartBeatTimer);
1009 tx_timer_delete(&pMac->lim.limTimers.gLimHeartBeatTimer);
1010
1011 // Deactivate and delete wait-for-probe-after-Heartbeat timer.
1012 tx_timer_deactivate(&pMac->lim.limTimers.gLimProbeAfterHBTimer);
1013 tx_timer_delete(&pMac->lim.limTimers.gLimProbeAfterHBTimer);
1014
1015 // Deactivate and delete Quiet timer.
1016 tx_timer_deactivate(&pMac->lim.limTimers.gLimQuietTimer);
1017 tx_timer_delete(&pMac->lim.limTimers.gLimQuietTimer);
1018
1019 // Deactivate and delete Quiet BSS timer.
1020 tx_timer_deactivate(&pMac->lim.limTimers.gLimQuietBssTimer);
1021 tx_timer_delete(&pMac->lim.limTimers.gLimQuietBssTimer);
1022
Jeff Johnson295189b2012-06-20 16:38:30 -07001023 // Deactivate and delete LIM background scan timer.
1024 tx_timer_deactivate(&pMac->lim.limTimers.gLimBackgroundScanTimer);
1025 tx_timer_delete(&pMac->lim.limTimers.gLimBackgroundScanTimer);
Jeff Johnson295189b2012-06-20 16:38:30 -07001026
1027
1028 // Deactivate and delete cnf wait timer
1029 for (n = 0; n < pMac->lim.maxStation; n++)
1030 {
1031 tx_timer_deactivate(&pMac->lim.limTimers.gpLimCnfWaitTimer[n]);
1032 tx_timer_delete(&pMac->lim.limTimers.gpLimCnfWaitTimer[n]);
1033 }
1034
1035 // Deactivate and delete keepalive timer
1036 tx_timer_deactivate(&pMac->lim.limTimers.gLimKeepaliveTimer);
1037 tx_timer_delete(&pMac->lim.limTimers.gLimKeepaliveTimer);
1038
1039 pAuthNode = pMac->lim.gLimPreAuthTimerTable.pTable;
1040
1041 //Deactivate any Authentication response timers
1042 limDeletePreAuthList(pMac);
1043
1044 for (n = 0; n < pMac->lim.gLimPreAuthTimerTable.numEntry; n++,pAuthNode++)
1045 {
1046 // Delete any Authentication response
1047 // timers, which might have been started.
1048 tx_timer_delete(&pAuthNode->timer);
1049 }
1050
Jeff Johnson295189b2012-06-20 16:38:30 -07001051
1052
1053 // Deactivate and delete Hash Miss throttle timer
1054 tx_timer_deactivate(&pMac->lim.limTimers.gLimSendDisassocFrameThresholdTimer);
1055 tx_timer_delete(&pMac->lim.limTimers.gLimSendDisassocFrameThresholdTimer);
1056
Jeff Johnson295189b2012-06-20 16:38:30 -07001057 tx_timer_deactivate(&pMac->lim.limTimers.gLimUpdateOlbcCacheTimer);
1058 tx_timer_delete(&pMac->lim.limTimers.gLimUpdateOlbcCacheTimer);
1059 tx_timer_deactivate(&pMac->lim.limTimers.gLimPreAuthClnupTimer);
1060 tx_timer_delete(&pMac->lim.limTimers.gLimPreAuthClnupTimer);
1061
1062#if 0 // The WPS PBC clean up timer is disabled
1063 if (pMac->lim.gLimSystemRole == eLIM_AP_ROLE)
1064 {
1065 if(pMac->lim.limTimers.gLimWPSOverlapTimerObj.isTimerCreated == eANI_BOOLEAN_TRUE)
1066 {
1067 tx_timer_deactivate(&pMac->lim.limTimers.gLimWPSOverlapTimerObj.gLimWPSOverlapTimer);
1068 tx_timer_delete(&pMac->lim.limTimers.gLimWPSOverlapTimerObj.gLimWPSOverlapTimer);
1069 pMac->lim.limTimers.gLimWPSOverlapTimerObj.isTimerCreated = eANI_BOOLEAN_FALSE;
1070 }
1071 }
1072#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001073#ifdef WLAN_FEATURE_VOWIFI_11R
1074 // Deactivate and delete FT Preauth response timer
1075 tx_timer_deactivate(&pMac->lim.limTimers.gLimFTPreAuthRspTimer);
1076 tx_timer_delete(&pMac->lim.limTimers.gLimFTPreAuthRspTimer);
1077#endif
1078
Jeff Johnson295189b2012-06-20 16:38:30 -07001079 // Deactivate and delete remain on channel timer
1080 tx_timer_deactivate(&pMac->lim.limTimers.gLimRemainOnChannelTimer);
1081 tx_timer_delete(&pMac->lim.limTimers.gLimRemainOnChannelTimer);
Jeff Johnson295189b2012-06-20 16:38:30 -07001082
1083#ifdef FEATURE_WLAN_CCX
1084 // Deactivate and delete TSM
1085 tx_timer_deactivate(&pMac->lim.limTimers.gLimCcxTsmTimer);
1086 tx_timer_delete(&pMac->lim.limTimers.gLimCcxTsmTimer);
1087#endif
1088
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -08001089 tx_timer_deactivate(&pMac->lim.limTimers.gLimDisassocAckTimer);
1090 tx_timer_delete(&pMac->lim.limTimers.gLimDisassocAckTimer);
1091
1092 tx_timer_deactivate(&pMac->lim.limTimers.gLimDeauthAckTimer);
1093 tx_timer_delete(&pMac->lim.limTimers.gLimDeauthAckTimer);
1094
Hoonki Leef63df0d2013-01-16 19:29:14 -08001095 tx_timer_deactivate(&pMac->lim.limTimers.gLimP2pSingleShotNoaInsertTimer);
1096 tx_timer_delete(&pMac->lim.limTimers.gLimP2pSingleShotNoaInsertTimer);
Hoonki Leef63df0d2013-01-16 19:29:14 -08001097
Gopichand Nakkala0d6e4ad2013-05-17 02:30:25 +05301098 tx_timer_deactivate(&pMac->lim.limTimers.gLimActiveToPassiveChannelTimer);
1099 tx_timer_delete(&pMac->lim.limTimers.gLimActiveToPassiveChannelTimer);
1100
Jeff Johnson295189b2012-06-20 16:38:30 -07001101 pMac->lim.gLimTimersCreated = 0;
1102 }
1103
1104 /// Cleanup cached scan list
1105 limReInitScanResults(pMac);
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07001106#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
1107 /// Cleanup cached scan list
1108 limReInitLfrScanResults(pMac);
1109#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001110
1111} /*** end limCleanupMlm() ***/
1112
1113
1114
1115/**
1116 * limCleanupLmm()
1117 *
1118 *FUNCTION:
1119 * This function is called to cleanup any resources
1120 * allocated by LMM sub-module.
1121 *
1122 *PARAMS:
1123 *
1124 *LOGIC:
1125 *
1126 *ASSUMPTIONS:
1127 * NA
1128 *
1129 *NOTE:
1130 * NA
1131 *
1132 * @param pMac Pointer to Global MAC structure
1133 * @return None
1134 */
1135
1136void
1137limCleanupLmm(tpAniSirGlobal pMac)
1138{
Jeff Johnson295189b2012-06-20 16:38:30 -07001139} /*** end limCleanupLmm() ***/
1140
1141
1142
1143/**
1144 * limIsAddrBC()
1145 *
1146 *FUNCTION:
1147 * This function is called in various places within LIM code
1148 * to determine whether passed MAC address is a broadcast or not
1149 *
1150 *LOGIC:
1151 *
1152 *ASSUMPTIONS:
1153 * NA
1154 *
1155 *NOTE:
1156 * NA
1157 *
1158 * @param macAddr Indicates MAC address that need to be determined
1159 * whether it is Broadcast address or not
1160 *
1161 * @return true if passed address is Broadcast address else false
1162 */
1163
1164tANI_U8
1165limIsAddrBC(tSirMacAddr macAddr)
1166{
1167 int i;
1168 for (i = 0; i < 6; i++)
1169 {
1170 if ((macAddr[i] & 0xFF) != 0xFF)
1171 return false;
1172 }
1173
1174 return true;
1175} /****** end limIsAddrBC() ******/
1176
1177
1178
1179/**
1180 * limIsGroupAddr()
1181 *
1182 *FUNCTION:
1183 * This function is called in various places within LIM code
1184 * to determine whether passed MAC address is a group address or not
1185 *
1186 *LOGIC:
1187 * If least significant bit of first octet of the MAC address is
1188 * set to 1, it is a Group address.
1189 *
1190 *ASSUMPTIONS:
1191 * NA
1192 *
1193 *NOTE:
1194 * NA
1195 *
1196 * @param macAddr Indicates MAC address that need to be determined
1197 * whether it is Group address or not
1198 *
1199 * @return true if passed address is Group address else false
1200 */
1201
1202tANI_U8
1203limIsGroupAddr(tSirMacAddr macAddr)
1204{
1205 if ((macAddr[0] & 0x01) == 0x01)
1206 return true;
1207 else
1208 return false;
1209} /****** end limIsGroupAddr() ******/
1210
1211/**
1212 * limPostMsgApiNoWait()
1213 *
1214 *FUNCTION:
1215 * This function is called from other thread while posting a
1216 * message to LIM message Queue gSirLimMsgQ with NO_WAIT option
1217 *
1218 *LOGIC:
1219 * NA
1220 *
1221 *ASSUMPTIONS:
1222 * NA
1223 *
1224 *NOTE:
1225 * NA
1226 *
1227 * @param pMsg - Pointer to the Global MAC structure
1228 * @param pMsg - Pointer to the message structure
1229 * @return None
1230 */
1231
1232tANI_U32
1233limPostMsgApiNoWait(tpAniSirGlobal pMac, tSirMsgQ *pMsg)
1234{
Jeff Johnson295189b2012-06-20 16:38:30 -07001235 limProcessMessages(pMac, pMsg);
1236 return TX_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -07001237} /*** end limPostMsgApiNoWait() ***/
1238
1239
1240
1241/**
1242 * limPrintMacAddr()
1243 *
1244 *FUNCTION:
1245 * This function is called to print passed MAC address
1246 * in : format.
1247 *
1248 *LOGIC:
1249 *
1250 *ASSUMPTIONS:
1251 * NA
1252 *
1253 *NOTE:
1254 * @param macAddr - MacAddr to be printed
1255 * @param logLevel - Loglevel to be used
1256 *
1257 * @return None.
1258 */
1259
1260void
1261limPrintMacAddr(tpAniSirGlobal pMac, tSirMacAddr macAddr, tANI_U8 logLevel)
1262{
1263 limLog(pMac, logLevel,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001264 FL("%X:%X:%X:%X:%X:%X"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001265 macAddr[0], macAddr[1], macAddr[2], macAddr[3], macAddr[4],
1266 macAddr[5]);
1267} /****** end limPrintMacAddr() ******/
1268
1269
1270
1271
1272
1273
1274/*
1275 * limResetDeferredMsgQ()
1276 *
1277 *FUNCTION:
1278 * This function resets the deferred message queue parameters.
1279 *
1280 *PARAMS:
1281 * @param pMac - Pointer to Global MAC structure
1282 *
1283 *LOGIC:
1284 *
1285 *ASSUMPTIONS:
1286 * NA
1287 *
1288 *NOTE:
1289 * NA
1290 *
1291 *RETURNS:
1292 * None
1293 */
1294
1295void limResetDeferredMsgQ(tpAniSirGlobal pMac)
1296{
1297 pMac->lim.gLimDeferredMsgQ.size =
1298 pMac->lim.gLimDeferredMsgQ.write =
1299 pMac->lim.gLimDeferredMsgQ.read = 0;
1300
1301}
1302
1303
1304#define LIM_DEFERRED_Q_CHECK_THRESHOLD (MAX_DEFERRED_QUEUE_LEN/2)
1305#define LIM_MAX_NUM_MGMT_FRAME_DEFERRED (MAX_DEFERRED_QUEUE_LEN/2)
1306
1307/*
1308 * limWriteDeferredMsgQ()
1309 *
1310 *FUNCTION:
1311 * This function queues up a deferred message for later processing on the
1312 * STA side.
1313 *
1314 *PARAMS:
1315 * @param pMac - Pointer to Global MAC structure
1316 * @param limMsg - a LIM message
1317 *
1318 *LOGIC:
1319 *
1320 *ASSUMPTIONS:
1321 * NA
1322 *
1323 *NOTE:
1324 * NA
1325 *
1326 *RETURNS:
1327 * None
1328 */
1329
1330tANI_U8 limWriteDeferredMsgQ(tpAniSirGlobal pMac, tpSirMsgQ limMsg)
1331{
1332 PELOG1(limLog(pMac, LOG1,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001333 FL("** Queue a deferred message (size %d, write %d) - type 0x%x **"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001334 pMac->lim.gLimDeferredMsgQ.size, pMac->lim.gLimDeferredMsgQ.write,
1335 limMsg->type);)
1336
1337 /*
1338 ** check if the deferred message queue is full
1339 **/
1340 if (pMac->lim.gLimDeferredMsgQ.size >= MAX_DEFERRED_QUEUE_LEN)
1341 {
Leela Venkata Kiran Kumar Reddy Chirala2247e962013-03-22 19:21:10 -07001342 if(!(pMac->lim.deferredMsgCnt & 0xF))
1343 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001344 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 -07001345 }
1346 else
1347 {
1348 pMac->lim.deferredMsgCnt++;
1349 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001350 return TX_QUEUE_FULL;
1351 }
1352
1353 /*
1354 ** In the application, there should not be more than 1 message get
1355 ** queued up. If happens, flags a warning. In the future, this can
1356 ** happen.
1357 **/
1358 if (pMac->lim.gLimDeferredMsgQ.size > 0)
1359 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001360 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 -07001361 pMac->lim.gLimDeferredMsgQ.size, limMsg->type,
1362 limIsSystemInScanState(pMac),
1363 pMac->lim.gLimSmeState, pMac->lim.gLimMlmState,
1364 pMac->lim.gLimAddtsSent);)
1365 }
1366
1367 /*
1368 ** To prevent the deferred Q is full of management frames, only give them certain space
1369 **/
1370 if( SIR_BB_XPORT_MGMT_MSG == limMsg->type )
1371 {
1372 if( LIM_DEFERRED_Q_CHECK_THRESHOLD < pMac->lim.gLimDeferredMsgQ.size )
1373 {
1374 tANI_U16 idx, count = 0;
1375 for(idx = 0; idx < pMac->lim.gLimDeferredMsgQ.size; idx++)
1376 {
1377 if( SIR_BB_XPORT_MGMT_MSG == pMac->lim.gLimDeferredMsgQ.deferredQueue[idx].type )
1378 {
1379 count++;
1380 }
1381 }
1382 if( LIM_MAX_NUM_MGMT_FRAME_DEFERRED < count )
1383 {
1384 //We reach the quota for management frames, drop this one
Madan Mohan Koyyalamudi5695b502012-09-24 14:21:12 -07001385 PELOGW(limLog(pMac, LOGW, FL("Cannot deferred. Msg: %d Too many (count=%d) already"), limMsg->type, count);)
Jeff Johnson295189b2012-06-20 16:38:30 -07001386 //Return error, caller knows what to do
1387 return TX_QUEUE_FULL;
1388 }
1389 }
1390 }
1391
1392 ++pMac->lim.gLimDeferredMsgQ.size;
1393
Leela Venkata Kiran Kumar Reddy Chirala2247e962013-03-22 19:21:10 -07001394 /* reset the count here since we are able to defer the message */
1395 if(pMac->lim.deferredMsgCnt != 0)
1396 {
1397 pMac->lim.deferredMsgCnt = 0;
1398 }
1399
Jeff Johnson295189b2012-06-20 16:38:30 -07001400 /*
1401 ** if the write pointer hits the end of the queue, rewind it
1402 **/
1403 if (pMac->lim.gLimDeferredMsgQ.write >= MAX_DEFERRED_QUEUE_LEN)
1404 pMac->lim.gLimDeferredMsgQ.write = 0;
1405
1406 /*
1407 ** save the message to the queue and advanced the write pointer
1408 **/
1409 palCopyMemory(pMac->hHdd,
1410 (tANI_U8 *)&pMac->lim.gLimDeferredMsgQ.deferredQueue[pMac->lim.gLimDeferredMsgQ.write++],
1411 (tANI_U8 *)limMsg,
1412 sizeof(tSirMsgQ));
1413 return TX_SUCCESS;
1414
1415}
1416
1417/*
1418 * limReadDeferredMsgQ()
1419 *
1420 *FUNCTION:
1421 * This function dequeues a deferred message for processing on the
1422 * STA side.
1423 *
1424 *PARAMS:
1425 * @param pMac - Pointer to Global MAC structure
1426 *
1427 *LOGIC:
1428 *
1429 *ASSUMPTIONS:
1430 * NA
1431 *
1432 *NOTE:
1433 *
1434 *
1435 *RETURNS:
1436 * Returns the message at the head of the deferred message queue
1437 */
1438
1439tSirMsgQ* limReadDeferredMsgQ(tpAniSirGlobal pMac)
1440{
1441 tSirMsgQ *msg;
1442
1443 /*
1444 ** check any messages left. If no, return
1445 **/
1446 if (pMac->lim.gLimDeferredMsgQ.size <= 0)
1447 return NULL;
1448
1449 /*
1450 ** decrement the queue size
1451 **/
1452 pMac->lim.gLimDeferredMsgQ.size--;
1453
1454 /*
1455 ** retrieve the message from the head of the queue
1456 **/
1457 msg = &pMac->lim.gLimDeferredMsgQ.deferredQueue[pMac->lim.gLimDeferredMsgQ.read];
1458
1459 /*
1460 ** advance the read pointer
1461 **/
1462 pMac->lim.gLimDeferredMsgQ.read++;
1463
1464 /*
1465 ** if the read pointer hits the end of the queue, rewind it
1466 **/
1467 if (pMac->lim.gLimDeferredMsgQ.read >= MAX_DEFERRED_QUEUE_LEN)
1468 pMac->lim.gLimDeferredMsgQ.read = 0;
1469
1470 PELOG1(limLog(pMac, LOG1,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001471 FL("** DeQueue a deferred message (size %d read %d) - type 0x%x **"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001472 pMac->lim.gLimDeferredMsgQ.size, pMac->lim.gLimDeferredMsgQ.read,
1473 msg->type);)
1474
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001475 PELOG1(limLog(pMac, LOG1, FL("DQ msg -- scan %d, global sme %d, global mlme %d, addts %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001476 limIsSystemInScanState(pMac),
1477 pMac->lim.gLimSmeState, pMac->lim.gLimMlmState,
1478 pMac->lim.gLimAddtsSent);)
1479
1480 return(msg);
1481}
1482
1483tSirRetStatus
1484limSysProcessMmhMsgApi(tpAniSirGlobal pMac,
1485 tSirMsgQ *pMsg,
1486 tANI_U8 qType)
1487{
1488// FIXME
Jeff Johnson295189b2012-06-20 16:38:30 -07001489 SysProcessMmhMsg(pMac, pMsg);
1490 return eSIR_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -07001491}
1492
1493char *limFrameStr(tANI_U32 type, tANI_U32 subType)
1494{
1495#ifdef FIXME_GEN6
1496
1497 if (type == SIR_MAC_MGMT_FRAME)
1498 {
1499 switch (subType)
1500 {
1501 case SIR_MAC_MGMT_ASSOC_REQ:
1502 return "MAC_MGMT_ASSOC_REQ";
1503 case SIR_MAC_MGMT_ASSOC_RSP:
1504 return "MAC_MGMT_ASSOC_RSP";
1505 case SIR_MAC_MGMT_REASSOC_REQ:
1506 return "MAC_MGMT_REASSOC_REQ";
1507 case SIR_MAC_MGMT_REASSOC_RSP:
1508 return "MAC_MGMT_REASSOC_RSP";
1509 case SIR_MAC_MGMT_PROBE_REQ:
1510 return "MAC_MGMT_PROBE_REQ";
1511 case SIR_MAC_MGMT_PROBE_RSP:
1512 return "MAC_MGMT_PROBE_RSP";
1513 case SIR_MAC_MGMT_BEACON:
1514 return "MAC_MGMT_BEACON";
1515 case SIR_MAC_MGMT_ATIM:
1516 return "MAC_MGMT_ATIM";
1517 case SIR_MAC_MGMT_DISASSOC:
1518 return "MAC_MGMT_DISASSOC";
1519 case SIR_MAC_MGMT_AUTH:
1520 return "MAC_MGMT_AUTH";
1521 case SIR_MAC_MGMT_DEAUTH:
1522 return "MAC_MGMT_DEAUTH";
1523 case SIR_MAC_MGMT_ACTION:
1524 return "MAC_MGMT_ACTION";
1525 case SIR_MAC_MGMT_RESERVED15:
1526 return "MAC_MGMT_RESERVED15";
1527 default:
1528 return "Unknown MGMT Frame";
1529 }
1530 }
1531
1532 else if (type == SIR_MAC_CTRL_FRAME)
1533 {
1534 switch (subType)
1535 {
1536 case SIR_MAC_CTRL_RR:
1537 return "MAC_CTRL_RR";
1538 case SIR_MAC_CTRL_BAR:
1539 return "MAC_CTRL_BAR";
1540 case SIR_MAC_CTRL_BA:
1541 return "MAC_CTRL_BA";
1542 case SIR_MAC_CTRL_PS_POLL:
1543 return "MAC_CTRL_PS_POLL";
1544 case SIR_MAC_CTRL_RTS:
1545 return "MAC_CTRL_RTS";
1546 case SIR_MAC_CTRL_CTS:
1547 return "MAC_CTRL_CTS";
1548 case SIR_MAC_CTRL_ACK:
1549 return "MAC_CTRL_ACK";
1550 case SIR_MAC_CTRL_CF_END:
1551 return "MAC_CTRL_CF_END";
1552 case SIR_MAC_CTRL_CF_END_ACK:
1553 return "MAC_CTRL_CF_END_ACK";
1554 default:
1555 return "Unknown CTRL Frame";
1556 }
1557 }
1558
1559 else if (type == SIR_MAC_DATA_FRAME)
1560 {
1561 switch (subType)
1562 {
1563 case SIR_MAC_DATA_DATA:
1564 return "MAC_DATA_DATA";
1565 case SIR_MAC_DATA_DATA_ACK:
1566 return "MAC_DATA_DATA_ACK";
1567 case SIR_MAC_DATA_DATA_POLL:
1568 return "MAC_DATA_DATA_POLL";
1569 case SIR_MAC_DATA_DATA_ACK_POLL:
1570 return "MAC_DATA_DATA_ACK_POLL";
1571 case SIR_MAC_DATA_NULL:
1572 return "MAC_DATA_NULL";
1573 case SIR_MAC_DATA_NULL_ACK:
1574 return "MAC_DATA_NULL_ACK";
1575 case SIR_MAC_DATA_NULL_POLL:
1576 return "MAC_DATA_NULL_POLL";
1577 case SIR_MAC_DATA_NULL_ACK_POLL:
1578 return "MAC_DATA_NULL_ACK_POLL";
1579 case SIR_MAC_DATA_QOS_DATA:
1580 return "MAC_DATA_QOS_DATA";
1581 case SIR_MAC_DATA_QOS_DATA_ACK:
1582 return "MAC_DATA_QOS_DATA_ACK";
1583 case SIR_MAC_DATA_QOS_DATA_POLL:
1584 return "MAC_DATA_QOS_DATA_POLL";
1585 case SIR_MAC_DATA_QOS_DATA_ACK_POLL:
1586 return "MAC_DATA_QOS_DATA_ACK_POLL";
1587 case SIR_MAC_DATA_QOS_NULL:
1588 return "MAC_DATA_QOS_NULL";
1589 case SIR_MAC_DATA_QOS_NULL_ACK:
1590 return "MAC_DATA_QOS_NULL_ACK";
1591 case SIR_MAC_DATA_QOS_NULL_POLL:
1592 return "MAC_DATA_QOS_NULL_POLL";
1593 case SIR_MAC_DATA_QOS_NULL_ACK_POLL:
1594 return "MAC_DATA_QOS_NULL_ACK_POLL";
1595 default:
1596 return "Unknown Data Frame";
1597 }
1598 }
1599 else
1600 return "Unknown";
1601#endif
1602return "";
1603}
1604
Jeff Johnson295189b2012-06-20 16:38:30 -07001605void limHandleUpdateOlbcCache(tpAniSirGlobal pMac)
1606{
1607 int i;
1608 static int enable;
1609 tUpdateBeaconParams beaconParams;
1610
1611 tpPESession psessionEntry = limIsApSessionActive(pMac);
1612
1613 if (psessionEntry == NULL)
Madan Mohan Koyyalamudi788b4ee2012-09-25 10:42:09 -07001614 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001615 PELOGE(limLog(pMac, LOGE, FL(" Session not found"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001616 return;
Madan Mohan Koyyalamudi788b4ee2012-09-25 10:42:09 -07001617 }
Pratik Bhalgatb44ea3f2012-11-22 16:41:39 +05301618
Madan Mohan Koyyalamudib2733142012-10-31 13:59:17 -07001619 palZeroMemory( pMac->hHdd, ( tANI_U8* )&beaconParams, sizeof( tUpdateBeaconParams) );
1620 beaconParams.bssIdx = psessionEntry->bssIdx;
Jeff Johnson295189b2012-06-20 16:38:30 -07001621
1622 beaconParams.paramChangeBitmap = 0;
1623 /*
1624 ** This is doing a 2 pass check. The first pass is to invalidate
1625 ** all the cache entries. The second pass is to decide whether to
1626 ** disable protection.
1627 **/
1628 if (!enable)
1629 {
1630
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001631 PELOG2(limLog(pMac, LOG2, FL("Resetting OLBC cache"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001632 psessionEntry->gLimOlbcParams.numSta = 0;
1633 psessionEntry->gLimOverlap11gParams.numSta = 0;
1634 psessionEntry->gLimOverlapHt20Params.numSta = 0;
1635 psessionEntry->gLimNonGfParams.numSta = 0;
1636 psessionEntry->gLimLsigTxopParams.numSta = 0;
1637
1638 for (i=0; i < LIM_PROT_STA_OVERLAP_CACHE_SIZE; i++)
1639 pMac->lim.protStaOverlapCache[i].active = false;
1640
1641 enable = 1;
1642 }
1643 else
1644 {
1645
Madan Mohan Koyyalamudi788b4ee2012-09-25 10:42:09 -07001646 if (!psessionEntry->gLimOlbcParams.numSta)
Jeff Johnson295189b2012-06-20 16:38:30 -07001647 {
1648 if (psessionEntry->gLimOlbcParams.protectionEnabled)
1649 {
1650 if (!psessionEntry->gLim11bParams.protectionEnabled)
1651 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001652 PELOG1(limLog(pMac, LOG1, FL("Overlap cache all clear and no 11B STA detected"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001653 limEnable11gProtection(pMac, false, true, &beaconParams, psessionEntry);
1654 }
1655 }
1656 }
1657
1658 if (!psessionEntry->gLimOverlap11gParams.numSta)
1659 {
1660 if (psessionEntry->gLimOverlap11gParams.protectionEnabled)
1661 {
1662 if (!psessionEntry->gLim11gParams.protectionEnabled)
1663 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001664 PELOG1(limLog(pMac, LOG1, FL("Overlap cache all clear and no 11G STA detected"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001665 limEnableHtProtectionFrom11g(pMac, false, true, &beaconParams,psessionEntry);
1666 }
1667 }
1668 }
1669
1670 if (!psessionEntry->gLimOverlapHt20Params.numSta)
1671 {
1672 if (psessionEntry->gLimOverlapHt20Params.protectionEnabled)
1673 {
1674 if (!psessionEntry->gLimHt20Params.protectionEnabled)
1675 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001676 PELOG1(limLog(pMac, LOG1, FL("Overlap cache all clear and no HT20 STA detected"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001677 limEnable11gProtection(pMac, false, true, &beaconParams,psessionEntry);
1678 }
1679 }
1680 }
1681
1682 enable = 0;
1683 }
1684
1685 if(beaconParams.paramChangeBitmap)
1686 {
1687 schSetFixedBeaconFields(pMac,psessionEntry);
1688 limSendBeaconParams(pMac, &beaconParams, psessionEntry);
1689 }
1690
1691 // Start OLBC timer
1692 if (tx_timer_activate(&pMac->lim.limTimers.gLimUpdateOlbcCacheTimer) != TX_SUCCESS)
1693 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001694 limLog(pMac, LOGE, FL("tx_timer_activate failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001695 }
1696}
Jeff Johnson295189b2012-06-20 16:38:30 -07001697
1698/**
1699 * limIsNullSsid()
1700 *
1701 *FUNCTION:
1702 * This function checks if Ssid supplied is Null SSID
1703 *
1704 *
1705 *LOGIC:
1706 *
1707 *ASSUMPTIONS:
1708 * NA
1709 *
1710 *NOTE:
1711 * NA
1712 *
1713 * @param tSirMacSSid *
1714 *
1715 *
1716 * @return true if SSID is Null SSID else false
1717 */
1718
1719tANI_U8
1720limIsNullSsid( tSirMacSSid *pSsid )
1721{
1722 tANI_U8 fNullSsid = false;
1723 tANI_U32 SsidLength;
1724 tANI_U8 *pSsidStr;
1725
1726 do
1727 {
1728 if ( 0 == pSsid->length )
1729 {
1730 fNullSsid = true;
1731 break;
1732 }
1733
1734#define ASCII_SPACE_CHARACTER 0x20
1735 /* If the first charactes is space, then check if all characters in
1736 * SSID are spaces to consider it as NULL SSID*/
1737 if( ASCII_SPACE_CHARACTER == pSsid->ssId[0])
1738 {
1739 SsidLength = pSsid->length;
1740 pSsidStr = pSsid->ssId;
1741 /* check if all the charactes in SSID are spaces*/
1742 while ( SsidLength )
1743 {
1744 if( ASCII_SPACE_CHARACTER != *pSsidStr )
1745 break;
1746
1747 pSsidStr++;
1748 SsidLength--;
1749 }
1750
1751 if( 0 == SsidLength )
1752 {
1753 fNullSsid = true;
1754 break;
1755 }
1756 }
1757 else
1758 {
1759 /* check if all the charactes in SSID are NULL*/
1760 SsidLength = pSsid->length;
1761 pSsidStr = pSsid->ssId;
1762
1763 while ( SsidLength )
1764 {
1765 if( *pSsidStr )
1766 break;
1767
1768 pSsidStr++;
1769 SsidLength--;
1770 }
1771
1772 if( 0 == SsidLength )
1773 {
1774 fNullSsid = true;
1775 break;
1776 }
1777 }
1778 }
1779 while( 0 );
1780
1781 return fNullSsid;
1782} /****** end limIsNullSsid() ******/
1783
1784
1785
Jeff Johnson295189b2012-06-20 16:38:30 -07001786
1787/** -------------------------------------------------------------
1788\fn limUpdateProtStaParams
1789\brief updates protection related counters.
1790\param tpAniSirGlobal pMac
1791\param tSirMacAddr peerMacAddr
1792\param tLimProtStaCacheType protStaCacheType
1793\param tHalBitVal gfSupported
1794\param tHalBitVal lsigTxopSupported
1795\return None
1796 -------------------------------------------------------------*/
1797void
1798limUpdateProtStaParams(tpAniSirGlobal pMac,
1799tSirMacAddr peerMacAddr, tLimProtStaCacheType protStaCacheType,
1800tHalBitVal gfSupported, tHalBitVal lsigTxopSupported,
1801tpPESession psessionEntry)
1802{
1803 tANI_U32 i;
1804
1805 PELOG1(limLog(pMac,LOG1, FL("A STA is associated:"));
1806 limLog(pMac,LOG1, FL("Addr : "));
1807 limPrintMacAddr(pMac, peerMacAddr, LOG1);)
1808
1809 for (i=0; i<LIM_PROT_STA_CACHE_SIZE; i++)
1810 {
1811 if (psessionEntry->protStaCache[i].active)
1812 {
1813 PELOG1(limLog(pMac, LOG1, FL("Addr: "));)
1814 PELOG1(limPrintMacAddr(pMac, psessionEntry->protStaCache[i].addr, LOG1);)
1815
1816 if (palEqualMemory( pMac->hHdd,
1817 psessionEntry->protStaCache[i].addr,
1818 peerMacAddr, sizeof(tSirMacAddr)))
1819 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001820 PELOG1(limLog(pMac, LOG1, FL("matching cache entry at %d already active."), i);)
Jeff Johnson295189b2012-06-20 16:38:30 -07001821 return;
1822 }
1823 }
1824 }
1825
1826 for (i=0; i<LIM_PROT_STA_CACHE_SIZE; i++)
1827 {
1828 if (!psessionEntry->protStaCache[i].active)
1829 break;
1830 }
1831
1832 if (i >= LIM_PROT_STA_CACHE_SIZE)
1833 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001834 PELOGE(limLog(pMac, LOGE, FL("No space in ProtStaCache"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001835 return;
1836 }
1837
1838 palCopyMemory( pMac->hHdd, psessionEntry->protStaCache[i].addr,
1839 peerMacAddr,
1840 sizeof(tSirMacAddr));
1841
1842 psessionEntry->protStaCache[i].protStaCacheType = protStaCacheType;
1843 psessionEntry->protStaCache[i].active = true;
1844 if(eLIM_PROT_STA_CACHE_TYPE_llB == protStaCacheType)
1845 {
1846 psessionEntry->gLim11bParams.numSta++;
1847 limLog(pMac,LOG1, FL("11B, "));
1848 }
1849 else if(eLIM_PROT_STA_CACHE_TYPE_llG == protStaCacheType)
1850 {
1851 psessionEntry->gLim11gParams.numSta++;
1852 limLog(pMac,LOG1, FL("11G, "));
1853 }
1854 else if(eLIM_PROT_STA_CACHE_TYPE_HT20 == protStaCacheType)
1855 {
1856 psessionEntry->gLimHt20Params.numSta++;
1857 limLog(pMac,LOG1, FL("HT20, "));
1858 }
1859
1860 if(!gfSupported)
1861 {
1862 psessionEntry->gLimNonGfParams.numSta++;
1863 limLog(pMac,LOG1, FL("NonGf, "));
1864 }
1865 if(!lsigTxopSupported)
1866 {
1867 psessionEntry->gLimLsigTxopParams.numSta++;
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001868 limLog(pMac,LOG1, FL("!lsigTxopSupported"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001869 }
1870}// ---------------------------------------------------------------------
1871
1872/** -------------------------------------------------------------
1873\fn limDecideApProtection
1874\brief Decides all the protection related staiton coexistence and also sets
1875\ short preamble and short slot appropriately. This function will be called
1876\ when AP is ready to send assocRsp tp the station joining right now.
1877\param tpAniSirGlobal pMac
1878\param tSirMacAddr peerMacAddr
1879\return None
1880 -------------------------------------------------------------*/
1881void
1882limDecideApProtection(tpAniSirGlobal pMac, tSirMacAddr peerMacAddr, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry)
1883{
1884 tANI_U16 tmpAid;
1885 tpDphHashNode pStaDs;
1886 tSirRFBand rfBand = SIR_BAND_UNKNOWN;
1887 tANI_U32 phyMode;
1888 tLimProtStaCacheType protStaCacheType = eLIM_PROT_STA_CACHE_TYPE_INVALID;
1889 tHalBitVal gfSupported = eHAL_SET, lsigTxopSupported = eHAL_SET;
1890
1891 pBeaconParams->paramChangeBitmap = 0;
1892 // check whether to enable protection or not
1893 pStaDs = dphLookupHashEntry(pMac, peerMacAddr, &tmpAid, &psessionEntry->dph.dphHashTable);
1894 if(NULL == pStaDs)
1895 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001896 PELOG1(limLog(pMac, LOG1, FL("pStaDs is NULL"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001897 return;
1898 }
1899 limGetRfBand(pMac, &rfBand, psessionEntry);
1900 //if we are in 5 GHZ band
1901 if(SIR_BAND_5_GHZ == rfBand)
1902 {
1903 //We are 11N. we need to protect from 11A and Ht20. we don't need any other protection in 5 GHZ.
1904 //HT20 case is common between both the bands and handled down as common code.
Jeff Johnsone7245742012-09-05 17:12:55 -07001905 if(true == psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07001906 {
1907 //we are 11N and 11A station is joining.
1908 //protection from 11A required.
1909 if(false == pStaDs->mlmStaContext.htCapability)
1910 {
1911 limEnable11aProtection(pMac, true, false, pBeaconParams,psessionEntry);
1912 return;
1913 }
1914 }
1915 }
1916 else if(SIR_BAND_2_4_GHZ== rfBand)
1917 {
1918 limGetPhyMode(pMac, &phyMode, psessionEntry);
1919
1920 //We are 11G. Check if we need protection from 11b Stations.
1921 if ((phyMode == WNI_CFG_PHY_MODE_11G) &&
Jeff Johnsone7245742012-09-05 17:12:55 -07001922 (false == psessionEntry->htCapability))
Jeff Johnson295189b2012-06-20 16:38:30 -07001923 {
1924
1925 if (pStaDs->erpEnabled== eHAL_CLEAR)
1926 {
1927 protStaCacheType = eLIM_PROT_STA_CACHE_TYPE_llB;
1928 // enable protection
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001929 PELOG3(limLog(pMac, LOG3, FL("Enabling protection from 11B"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001930 limEnable11gProtection(pMac, true, false, pBeaconParams,psessionEntry);
1931 }
1932 }
1933
1934 //HT station.
Jeff Johnsone7245742012-09-05 17:12:55 -07001935 if (true == psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07001936 {
1937 //check if we need protection from 11b station
1938 if ((pStaDs->erpEnabled == eHAL_CLEAR) &&
1939 (!pStaDs->mlmStaContext.htCapability))
1940 {
1941 protStaCacheType = eLIM_PROT_STA_CACHE_TYPE_llB;
1942 // enable protection
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001943 PELOG3(limLog(pMac, LOG3, FL("Enabling protection from 11B"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001944 limEnable11gProtection(pMac, true, false, pBeaconParams, psessionEntry);
1945 }
1946 //station being joined is non-11b and non-ht ==> 11g device
1947 else if(!pStaDs->mlmStaContext.htCapability)
1948 {
1949 protStaCacheType = eLIM_PROT_STA_CACHE_TYPE_llG;
1950 //enable protection
1951 limEnableHtProtectionFrom11g(pMac, true, false, pBeaconParams, psessionEntry);
1952 }
1953 //ERP mode is enabled for the latest station joined
1954 //latest station joined is HT capable
1955 //This case is being handled in common code (commn between both the bands) below.
1956 }
1957 }
1958
1959 //we are HT and HT station is joining. This code is common for both the bands.
Jeff Johnsone7245742012-09-05 17:12:55 -07001960 if((true == psessionEntry->htCapability) &&
Jeff Johnson295189b2012-06-20 16:38:30 -07001961 (true == pStaDs->mlmStaContext.htCapability))
1962 {
1963 if(!pStaDs->htGreenfield)
1964 {
1965 limEnableHTNonGfProtection(pMac, true, false, pBeaconParams, psessionEntry);
1966 gfSupported = eHAL_CLEAR;
1967 }
1968 //Station joining is HT 20Mhz
1969 if(eHT_CHANNEL_WIDTH_20MHZ == pStaDs->htSupportedChannelWidthSet)
1970 {
1971 protStaCacheType = eLIM_PROT_STA_CACHE_TYPE_HT20;
1972 limEnableHT20Protection(pMac, true, false, pBeaconParams, psessionEntry);
1973 }
1974 //Station joining does not support LSIG TXOP Protection
1975 if(!pStaDs->htLsigTXOPProtection)
1976 {
1977 limEnableHTLsigTxopProtection(pMac, false, false, pBeaconParams,psessionEntry);
1978 lsigTxopSupported = eHAL_CLEAR;
1979 }
1980 }
1981
1982 limUpdateProtStaParams(pMac, peerMacAddr, protStaCacheType,
1983 gfSupported, lsigTxopSupported, psessionEntry);
1984
1985 return;
1986}
Jeff Johnson295189b2012-06-20 16:38:30 -07001987
1988
1989/** -------------------------------------------------------------
1990\fn limEnableOverlap11gProtection
1991\brief wrapper function for setting overlap 11g protection.
1992\param tpAniSirGlobal pMac
1993\param tpUpdateBeaconParams pBeaconParams
1994\param tpSirMacMgmtHdr pMh
1995\return None
1996 -------------------------------------------------------------*/
1997void
1998limEnableOverlap11gProtection(tpAniSirGlobal pMac,
1999tpUpdateBeaconParams pBeaconParams, tpSirMacMgmtHdr pMh,tpPESession psessionEntry)
2000{
2001 limUpdateOverlapStaParam(pMac, pMh->bssId, &(psessionEntry->gLimOlbcParams));
2002
2003 if (psessionEntry->gLimOlbcParams.numSta &&
2004 !psessionEntry->gLimOlbcParams.protectionEnabled)
2005 {
2006 // enable protection
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002007 PELOG1(limLog(pMac, LOG1, FL("OLBC happens!!!"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002008 limEnable11gProtection(pMac, true, true, pBeaconParams,psessionEntry);
2009 }
2010}
2011
2012
2013/** -------------------------------------------------------------
2014\fn limUpdateShortPreamble
2015\brief Updates short preamble if needed when a new station joins.
2016\param tpAniSirGlobal pMac
2017\param tSirMacAddr peerMacAddr
2018\param tpUpdateBeaconParams pBeaconParams
2019\return None
2020 -------------------------------------------------------------*/
2021void
2022limUpdateShortPreamble(tpAniSirGlobal pMac, tSirMacAddr peerMacAddr,
2023 tpUpdateBeaconParams pBeaconParams, tpPESession psessionEntry)
2024{
2025 tANI_U16 tmpAid;
2026 tpDphHashNode pStaDs;
2027 tANI_U32 phyMode;
2028 tANI_U16 i;
2029
2030 // check whether to enable protection or not
2031 pStaDs = dphLookupHashEntry(pMac, peerMacAddr, &tmpAid, &psessionEntry->dph.dphHashTable);
2032
2033 limGetPhyMode(pMac, &phyMode, psessionEntry);
2034
2035 if (pStaDs != NULL && phyMode == WNI_CFG_PHY_MODE_11G)
2036
2037 {
2038 if (pStaDs->shortPreambleEnabled == eHAL_CLEAR)
2039 {
2040 PELOG1(limLog(pMac,LOG1,FL("Short Preamble is not enabled in Assoc Req from "));
2041 limPrintMacAddr(pMac, peerMacAddr, LOG1);)
2042
2043 for (i=0; i<LIM_PROT_STA_CACHE_SIZE; i++)
2044 {
Jeff Johnson295189b2012-06-20 16:38:30 -07002045 if ((psessionEntry->limSystemRole == eLIM_AP_ROLE ) &&
2046 psessionEntry->gLimNoShortParams.staNoShortCache[i].active)
2047 {
2048 if (palEqualMemory( pMac->hHdd,
2049 psessionEntry->gLimNoShortParams.staNoShortCache[i].addr,
2050 peerMacAddr, sizeof(tSirMacAddr)))
2051 return;
2052 }else if(psessionEntry->limSystemRole != eLIM_AP_ROLE)
Jeff Johnson295189b2012-06-20 16:38:30 -07002053 {
2054 if (pMac->lim.gLimNoShortParams.staNoShortCache[i].active)
2055 {
2056 if (palEqualMemory( pMac->hHdd,
2057 pMac->lim.gLimNoShortParams.staNoShortCache[i].addr,
2058 peerMacAddr, sizeof(tSirMacAddr)))
2059 return;
2060 }
2061 }
2062 }
2063
2064
2065 for (i=0; i<LIM_PROT_STA_CACHE_SIZE; i++)
2066 {
Jeff Johnson295189b2012-06-20 16:38:30 -07002067 if ( (psessionEntry->limSystemRole == eLIM_AP_ROLE ) &&
2068 !psessionEntry->gLimNoShortParams.staNoShortCache[i].active)
2069 break;
2070 else
Jeff Johnson295189b2012-06-20 16:38:30 -07002071 {
2072 if (!pMac->lim.gLimNoShortParams.staNoShortCache[i].active)
2073 break;
2074 }
2075 }
2076
2077 if (i >= LIM_PROT_STA_CACHE_SIZE)
2078 {
Jeff Johnson295189b2012-06-20 16:38:30 -07002079 if(psessionEntry->limSystemRole == eLIM_AP_ROLE){
2080 limLog(pMac, LOGE, FL("No space in Short cache (#active %d, #sta %d) for sta "),
2081 i, psessionEntry->gLimNoShortParams.numNonShortPreambleSta);
2082 limPrintMacAddr(pMac, peerMacAddr, LOGE);
2083 return;
2084 }
2085 else
Jeff Johnson295189b2012-06-20 16:38:30 -07002086 {
2087 limLog(pMac, LOGE, FL("No space in Short cache (#active %d, #sta %d) for sta "),
2088 i, pMac->lim.gLimNoShortParams.numNonShortPreambleSta);
2089 limPrintMacAddr(pMac, peerMacAddr, LOGE);
2090 return;
2091 }
2092
2093 }
2094
2095
Jeff Johnson295189b2012-06-20 16:38:30 -07002096 if(psessionEntry->limSystemRole == eLIM_AP_ROLE){
2097 palCopyMemory( pMac->hHdd, psessionEntry->gLimNoShortParams.staNoShortCache[i].addr,
2098 peerMacAddr, sizeof(tSirMacAddr));
2099 psessionEntry->gLimNoShortParams.staNoShortCache[i].active = true;
2100 psessionEntry->gLimNoShortParams.numNonShortPreambleSta++;
2101 }else
Jeff Johnson295189b2012-06-20 16:38:30 -07002102 {
2103 palCopyMemory( pMac->hHdd, pMac->lim.gLimNoShortParams.staNoShortCache[i].addr,
2104 peerMacAddr, sizeof(tSirMacAddr));
2105 pMac->lim.gLimNoShortParams.staNoShortCache[i].active = true;
2106 pMac->lim.gLimNoShortParams.numNonShortPreambleSta++;
2107 }
2108
2109
2110 // enable long preamble
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002111 PELOG1(limLog(pMac, LOG1, FL("Disabling short preamble"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002112
Jeff Johnson295189b2012-06-20 16:38:30 -07002113 if (limEnableShortPreamble(pMac, false, pBeaconParams, psessionEntry) != eSIR_SUCCESS)
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002114 PELOGE(limLog(pMac, LOGE, FL("Cannot enable long preamble"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002115 }
2116 }
2117}
2118
2119/** -------------------------------------------------------------
2120\fn limUpdateShortSlotTime
2121\brief Updates short slot time if needed when a new station joins.
2122\param tpAniSirGlobal pMac
2123\param tSirMacAddr peerMacAddr
2124\param tpUpdateBeaconParams pBeaconParams
2125\return None
2126 -------------------------------------------------------------*/
2127
2128void
2129limUpdateShortSlotTime(tpAniSirGlobal pMac, tSirMacAddr peerMacAddr,
2130 tpUpdateBeaconParams pBeaconParams, tpPESession psessionEntry)
2131{
2132 tANI_U16 tmpAid;
2133 tpDphHashNode pStaDs;
2134 tANI_U32 phyMode;
2135 tANI_U32 val;
Jeff Johnson295189b2012-06-20 16:38:30 -07002136 tANI_U16 i;
2137
2138 // check whether to enable protection or not
2139 pStaDs = dphLookupHashEntry(pMac, peerMacAddr, &tmpAid, &psessionEntry->dph.dphHashTable);
2140 limGetPhyMode(pMac, &phyMode, psessionEntry);
2141
Jeff Johnsone7245742012-09-05 17:12:55 -07002142 /* Only in case of softap in 11g mode, slot time might change depending on the STA being added. In 11a case, it should
2143 * be always 1 and in 11b case, it should be always 0
2144 */
Jeff Johnson295189b2012-06-20 16:38:30 -07002145 if (pStaDs != NULL && phyMode == WNI_CFG_PHY_MODE_11G)
2146 {
Jeff Johnsone7245742012-09-05 17:12:55 -07002147 /* Only when the new STA has short slot time disabled, we need to change softap's overall slot time settings
2148 * else the default for softap is always short slot enabled. When the last long slot STA leaves softAP, we take care of
2149 * it in limDecideShortSlot
2150 */
Jeff Johnson295189b2012-06-20 16:38:30 -07002151 if (pStaDs->shortSlotTimeEnabled == eHAL_CLEAR)
2152 {
2153 PELOG1(limLog(pMac, LOG1, FL("Short Slot Time is not enabled in Assoc Req from "));
2154 limPrintMacAddr(pMac, peerMacAddr, LOG1);)
2155 for (i=0; i<LIM_PROT_STA_CACHE_SIZE; i++)
2156 {
Jeff Johnson295189b2012-06-20 16:38:30 -07002157 if ((psessionEntry->limSystemRole == eLIM_AP_ROLE ) &&
2158 psessionEntry->gLimNoShortSlotParams.staNoShortSlotCache[i].active)
2159 {
2160 if (palEqualMemory( pMac->hHdd,
2161 psessionEntry->gLimNoShortSlotParams.staNoShortSlotCache[i].addr,
2162 peerMacAddr, sizeof(tSirMacAddr)))
2163 return;
2164 }
2165 else if(psessionEntry->limSystemRole != eLIM_AP_ROLE )
Jeff Johnson295189b2012-06-20 16:38:30 -07002166 {
2167 if (pMac->lim.gLimNoShortSlotParams.staNoShortSlotCache[i].active)
2168 {
2169 if (palEqualMemory( pMac->hHdd,
2170 pMac->lim.gLimNoShortSlotParams.staNoShortSlotCache[i].addr,
2171 peerMacAddr, sizeof(tSirMacAddr)))
2172 return;
2173 }
2174 }
2175 }
2176
2177 for (i=0; i<LIM_PROT_STA_CACHE_SIZE; i++)
2178 {
Jeff Johnson295189b2012-06-20 16:38:30 -07002179 if ((psessionEntry->limSystemRole == eLIM_AP_ROLE ) &&
2180 !psessionEntry->gLimNoShortSlotParams.staNoShortSlotCache[i].active)
2181 break;
2182 else
Jeff Johnson295189b2012-06-20 16:38:30 -07002183 {
2184 if (!pMac->lim.gLimNoShortSlotParams.staNoShortSlotCache[i].active)
2185 break;
2186 }
2187 }
2188
2189 if (i >= LIM_PROT_STA_CACHE_SIZE)
2190 {
Jeff Johnson295189b2012-06-20 16:38:30 -07002191 if(psessionEntry->limSystemRole == eLIM_AP_ROLE){
2192 limLog(pMac, LOGE, FL("No space in ShortSlot cache (#active %d, #sta %d) for sta "),
2193 i, psessionEntry->gLimNoShortSlotParams.numNonShortSlotSta);
2194 limPrintMacAddr(pMac, peerMacAddr, LOGE);
2195 return;
2196 }else
Jeff Johnson295189b2012-06-20 16:38:30 -07002197 {
2198 limLog(pMac, LOGE, FL("No space in ShortSlot cache (#active %d, #sta %d) for sta "),
2199 i, pMac->lim.gLimNoShortSlotParams.numNonShortSlotSta);
2200 limPrintMacAddr(pMac, peerMacAddr, LOGE);
2201 return;
2202 }
2203 }
2204
2205
Jeff Johnson295189b2012-06-20 16:38:30 -07002206 if(psessionEntry->limSystemRole == eLIM_AP_ROLE){
2207 palCopyMemory( pMac->hHdd, psessionEntry->gLimNoShortSlotParams.staNoShortSlotCache[i].addr,
2208 peerMacAddr, sizeof(tSirMacAddr));
2209 psessionEntry->gLimNoShortSlotParams.staNoShortSlotCache[i].active = true;
2210 psessionEntry->gLimNoShortSlotParams.numNonShortSlotSta++;
2211 }else
Jeff Johnson295189b2012-06-20 16:38:30 -07002212 {
2213 palCopyMemory( pMac->hHdd, pMac->lim.gLimNoShortSlotParams.staNoShortSlotCache[i].addr,
2214 peerMacAddr, sizeof(tSirMacAddr));
2215 pMac->lim.gLimNoShortSlotParams.staNoShortSlotCache[i].active = true;
2216 pMac->lim.gLimNoShortSlotParams.numNonShortSlotSta++;
2217 }
2218 wlan_cfgGetInt(pMac, WNI_CFG_11G_SHORT_SLOT_TIME_ENABLED, &val);
2219
Jeff Johnsone7245742012-09-05 17:12:55 -07002220 /* 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
2221 * only long slot enabled, we need to change our beacon/pb rsp to broadcast short slot disabled
2222 */
Jeff Johnson295189b2012-06-20 16:38:30 -07002223 if ( (psessionEntry->limSystemRole == eLIM_AP_ROLE) &&
Jeff Johnsone7245742012-09-05 17:12:55 -07002224 (val && psessionEntry->gLimNoShortSlotParams.numNonShortSlotSta && psessionEntry->shortSlotTimeSupported))
Jeff Johnson295189b2012-06-20 16:38:30 -07002225 {
2226 // enable long slot time
2227 pBeaconParams->fShortSlotTime = false;
2228 pBeaconParams->paramChangeBitmap |= PARAM_SHORT_SLOT_TIME_CHANGED;
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002229 PELOG1(limLog(pMac, LOG1, FL("Disable short slot time. Enable long slot time."));)
Jeff Johnsone7245742012-09-05 17:12:55 -07002230 psessionEntry->shortSlotTimeSupported = false;
Jeff Johnson295189b2012-06-20 16:38:30 -07002231 }
2232 else if ( psessionEntry->limSystemRole != eLIM_AP_ROLE)
Jeff Johnson295189b2012-06-20 16:38:30 -07002233 {
Jeff Johnsone7245742012-09-05 17:12:55 -07002234 if (val && pMac->lim.gLimNoShortSlotParams.numNonShortSlotSta && psessionEntry->shortSlotTimeSupported)
Jeff Johnson295189b2012-06-20 16:38:30 -07002235 {
2236 // enable long slot time
2237 pBeaconParams->fShortSlotTime = false;
2238 pBeaconParams->paramChangeBitmap |= PARAM_SHORT_SLOT_TIME_CHANGED;
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002239 PELOG1(limLog(pMac, LOG1, FL("Disable short slot time. Enable long slot time."));)
Jeff Johnsone7245742012-09-05 17:12:55 -07002240 psessionEntry->shortSlotTimeSupported = false;
Jeff Johnson295189b2012-06-20 16:38:30 -07002241 }
2242 }
2243 }
2244 }
2245}
2246
Jeff Johnson295189b2012-06-20 16:38:30 -07002247
2248/** -------------------------------------------------------------
2249\fn limDecideStaProtectionOnAssoc
2250\brief Decide protection related settings on Sta while association.
2251\param tpAniSirGlobal pMac
2252\param tpSchBeaconStruct pBeaconStruct
2253\return None
2254 -------------------------------------------------------------*/
2255void
2256limDecideStaProtectionOnAssoc(tpAniSirGlobal pMac,
2257 tpSchBeaconStruct pBeaconStruct, tpPESession psessionEntry)
2258{
2259 tSirRFBand rfBand = SIR_BAND_UNKNOWN;
2260 tANI_U32 phyMode = WNI_CFG_PHY_MODE_NONE;
2261
2262 limGetRfBand(pMac, &rfBand, psessionEntry);
2263 limGetPhyMode(pMac, &phyMode, psessionEntry);
2264
2265 if(SIR_BAND_5_GHZ == rfBand)
2266 {
2267 if((eSIR_HT_OP_MODE_MIXED == pBeaconStruct->HTInfo.opMode) ||
2268 (eSIR_HT_OP_MODE_OVERLAP_LEGACY == pBeaconStruct->HTInfo.opMode))
2269 {
2270 if(pMac->lim.cfgProtection.fromlla)
2271 psessionEntry->beaconParams.llaCoexist = true;
2272 }
2273 else if(eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT == pBeaconStruct->HTInfo.opMode)
2274 {
2275 if(pMac->lim.cfgProtection.ht20)
2276 psessionEntry->beaconParams.ht20Coexist = true;
2277 }
2278
2279 }
2280 else if(SIR_BAND_2_4_GHZ == rfBand)
2281 {
2282 //spec 7.3.2.13
2283 //UseProtection will be set when nonERP STA is associated.
2284 //NonERPPresent bit will be set when:
2285 //--nonERP Sta is associated OR
2286 //--nonERP Sta exists in overlapping BSS
2287 //when useProtection is not set then protection from nonERP stations is optional.
2288
2289 //CFG protection from 11b is enabled and
2290 //11B device in the BSS
2291 /* TODO, This is not sessionized */
2292 if (phyMode != WNI_CFG_PHY_MODE_11B)
2293 {
2294 if (pMac->lim.cfgProtection.fromllb &&
2295 pBeaconStruct->erpPresent &&
2296 (pBeaconStruct->erpIEInfo.useProtection ||
2297 pBeaconStruct->erpIEInfo.nonErpPresent))
2298 {
2299 psessionEntry->beaconParams.llbCoexist = true;
2300 }
2301 //AP has no 11b station associated.
2302 else
2303 {
2304 psessionEntry->beaconParams.llbCoexist = false;
2305 }
2306 }
2307 //following code block is only for HT station.
Jeff Johnsone7245742012-09-05 17:12:55 -07002308 if((psessionEntry->htCapability) &&
Jeff Johnson295189b2012-06-20 16:38:30 -07002309 (pBeaconStruct->HTInfo.present))
2310 {
2311 tDot11fIEHTInfo htInfo = pBeaconStruct->HTInfo;
2312
2313 //Obss Non HT STA present mode
2314 psessionEntry->beaconParams.gHTObssMode = (tANI_U8)htInfo.obssNonHTStaPresent;
2315
2316
2317 //CFG protection from 11G is enabled and
2318 //our AP has at least one 11G station associated.
2319 if(pMac->lim.cfgProtection.fromllg &&
2320 ((eSIR_HT_OP_MODE_MIXED == htInfo.opMode) ||
2321 (eSIR_HT_OP_MODE_OVERLAP_LEGACY == htInfo.opMode))&&
2322 (!psessionEntry->beaconParams.llbCoexist))
2323 {
2324 if(pMac->lim.cfgProtection.fromllg)
2325 psessionEntry->beaconParams.llgCoexist = true;
2326 }
2327
2328 //AP has only HT stations associated and at least one station is HT 20
2329 //disable protection from any non-HT devices.
2330 //decision for disabling protection from 11b has already been taken above.
2331 if(eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT == htInfo.opMode)
2332 {
2333 //Disable protection from 11G station.
2334 psessionEntry->beaconParams.llgCoexist = false;
2335 //CFG protection from HT 20 is enabled.
2336 if(pMac->lim.cfgProtection.ht20)
2337 psessionEntry->beaconParams.ht20Coexist = true;
2338 }
2339 //Disable protection from non-HT and HT20 devices.
2340 //decision for disabling protection from 11b has already been taken above.
2341 if(eSIR_HT_OP_MODE_PURE == htInfo.opMode)
2342 {
2343 psessionEntry->beaconParams.llgCoexist = false;
2344 psessionEntry->beaconParams.ht20Coexist = false;
2345 }
2346
2347 }
2348 }
2349
2350 //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 -07002351 if((psessionEntry->htCapability) &&
Jeff Johnson295189b2012-06-20 16:38:30 -07002352 (pBeaconStruct->HTInfo.present))
2353 {
2354 tDot11fIEHTInfo htInfo = pBeaconStruct->HTInfo;
2355 psessionEntry->beaconParams.fRIFSMode =
2356 ( tANI_U8 ) htInfo.rifsMode;
2357 psessionEntry->beaconParams.llnNonGFCoexist =
2358 ( tANI_U8 )htInfo.nonGFDevicesPresent;
2359 psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport =
2360 ( tANI_U8 )htInfo.lsigTXOPProtectionFullSupport;
2361 }
2362}
2363
2364
2365/** -------------------------------------------------------------
2366\fn limDecideStaProtection
2367\brief Decides protection related settings on Sta while processing beacon.
2368\param tpAniSirGlobal pMac
2369\param tpUpdateBeaconParams pBeaconParams
2370\return None
2371 -------------------------------------------------------------*/
2372void
2373limDecideStaProtection(tpAniSirGlobal pMac,
2374 tpSchBeaconStruct pBeaconStruct, tpUpdateBeaconParams pBeaconParams, tpPESession psessionEntry)
2375{
2376
2377 tSirRFBand rfBand = SIR_BAND_UNKNOWN;
2378 tANI_U32 phyMode = WNI_CFG_PHY_MODE_NONE;
2379
2380 limGetRfBand(pMac, &rfBand, psessionEntry);
2381 limGetPhyMode(pMac, &phyMode, psessionEntry);
2382
2383 if(SIR_BAND_5_GHZ == rfBand)
2384 {
2385 //we are HT capable.
Jeff Johnsone7245742012-09-05 17:12:55 -07002386 if((true == psessionEntry->htCapability) &&
Jeff Johnson295189b2012-06-20 16:38:30 -07002387 (pBeaconStruct->HTInfo.present))
2388 {
2389 //we are HT capable, AP's HT OPMode is mixed / overlap legacy ==> need protection from 11A.
2390 if((eSIR_HT_OP_MODE_MIXED == pBeaconStruct->HTInfo.opMode) ||
2391 (eSIR_HT_OP_MODE_OVERLAP_LEGACY == pBeaconStruct->HTInfo.opMode))
2392 {
2393 limEnable11aProtection(pMac, true, false, pBeaconParams,psessionEntry);
2394 }
2395 //we are HT capable, AP's HT OPMode is HT20 ==> disable protection from 11A if enabled. enabled
2396 //protection from HT20 if needed.
2397 else if(eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT== pBeaconStruct->HTInfo.opMode)
2398 {
2399 limEnable11aProtection(pMac, false, false, pBeaconParams,psessionEntry);
2400 limEnableHT20Protection(pMac, true, false, pBeaconParams,psessionEntry);
2401 }
2402 else if(eSIR_HT_OP_MODE_PURE == pBeaconStruct->HTInfo.opMode)
2403 {
2404 limEnable11aProtection(pMac, false, false, pBeaconParams,psessionEntry);
2405 limEnableHT20Protection(pMac, false, false, pBeaconParams,psessionEntry);
2406 }
2407 }
2408 }
2409 else if(SIR_BAND_2_4_GHZ == rfBand)
2410 {
2411 /* spec 7.3.2.13
2412 * UseProtection will be set when nonERP STA is associated.
2413 * NonERPPresent bit will be set when:
2414 * --nonERP Sta is associated OR
2415 * --nonERP Sta exists in overlapping BSS
2416 * when useProtection is not set then protection from nonERP stations is optional.
2417 */
2418
2419 if (phyMode != WNI_CFG_PHY_MODE_11B)
2420 {
2421 if (pBeaconStruct->erpPresent &&
2422 (pBeaconStruct->erpIEInfo.useProtection ||
2423 pBeaconStruct->erpIEInfo.nonErpPresent))
2424 {
2425 limEnable11gProtection(pMac, true, false, pBeaconParams, psessionEntry);
2426 }
2427 //AP has no 11b station associated.
2428 else
2429 {
2430 //disable protection from 11b station
2431 limEnable11gProtection(pMac, false, false, pBeaconParams, psessionEntry);
2432 }
2433 }
2434
2435 //following code block is only for HT station.
Jeff Johnsone7245742012-09-05 17:12:55 -07002436 if((psessionEntry->htCapability) &&
Jeff Johnson295189b2012-06-20 16:38:30 -07002437 (pBeaconStruct->HTInfo.present))
2438 {
2439
2440 tDot11fIEHTInfo htInfo = pBeaconStruct->HTInfo;
2441 //AP has at least one 11G station associated.
2442 if(((eSIR_HT_OP_MODE_MIXED == htInfo.opMode) ||
2443 (eSIR_HT_OP_MODE_OVERLAP_LEGACY == htInfo.opMode))&&
2444 (!psessionEntry->beaconParams.llbCoexist))
2445 {
2446 limEnableHtProtectionFrom11g(pMac, true, false, pBeaconParams,psessionEntry);
2447
2448 }
2449
2450 //no HT operating mode change ==> no change in protection settings except for MIXED_MODE/Legacy Mode.
2451 //in Mixed mode/legacy Mode even if there is no change in HT operating mode, there might be change in 11bCoexist
2452 //or 11gCoexist. that is why this check is being done after mixed/legacy mode check.
2453 if ( pMac->lim.gHTOperMode != ( tSirMacHTOperatingMode )htInfo.opMode )
2454 {
2455 pMac->lim.gHTOperMode = ( tSirMacHTOperatingMode )htInfo.opMode;
2456
2457 //AP has only HT stations associated and at least one station is HT 20
2458 //disable protection from any non-HT devices.
2459 //decision for disabling protection from 11b has already been taken above.
2460 if(eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT == htInfo.opMode)
2461 {
2462 //Disable protection from 11G station.
2463 limEnableHtProtectionFrom11g(pMac, false, false, pBeaconParams,psessionEntry);
2464
2465 limEnableHT20Protection(pMac, true, false, pBeaconParams,psessionEntry);
2466 }
2467 //Disable protection from non-HT and HT20 devices.
2468 //decision for disabling protection from 11b has already been taken above.
2469 else if(eSIR_HT_OP_MODE_PURE == htInfo.opMode)
2470 {
2471 limEnableHtProtectionFrom11g(pMac, false, false, pBeaconParams,psessionEntry);
2472 limEnableHT20Protection(pMac, false, false, pBeaconParams,psessionEntry);
2473
2474 }
2475 }
2476 }
2477 }
2478
2479 //following code block is only for HT station. ( 2.4 GHZ as well as 5 GHZ)
Jeff Johnsone7245742012-09-05 17:12:55 -07002480 if((psessionEntry->htCapability) &&
Jeff Johnson295189b2012-06-20 16:38:30 -07002481 (pBeaconStruct->HTInfo.present))
2482 {
2483 tDot11fIEHTInfo htInfo = pBeaconStruct->HTInfo;
2484 //Check for changes in protection related factors other than HT operating mode.
2485 //Check for changes in RIFS mode, nonGFDevicesPresent, lsigTXOPProtectionFullSupport.
2486 if ( psessionEntry->beaconParams.fRIFSMode !=
2487 ( tANI_U8 ) htInfo.rifsMode )
2488 {
2489 pBeaconParams->fRIFSMode =
2490 psessionEntry->beaconParams.fRIFSMode =
2491 ( tANI_U8 ) htInfo.rifsMode;
2492 pBeaconParams->paramChangeBitmap |= PARAM_RIFS_MODE_CHANGED;
2493 }
2494
2495 if ( psessionEntry->beaconParams.llnNonGFCoexist !=
2496 htInfo.nonGFDevicesPresent )
2497 {
2498 pBeaconParams->llnNonGFCoexist =
2499 psessionEntry->beaconParams.llnNonGFCoexist =
2500 ( tANI_U8 )htInfo.nonGFDevicesPresent;
2501 pBeaconParams->paramChangeBitmap |=
2502 PARAM_NON_GF_DEVICES_PRESENT_CHANGED;
2503 }
2504
2505 if ( psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport !=
2506 ( tANI_U8 )htInfo.lsigTXOPProtectionFullSupport )
2507 {
2508 pBeaconParams->fLsigTXOPProtectionFullSupport =
2509 psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport =
2510 ( tANI_U8 )htInfo.lsigTXOPProtectionFullSupport;
2511 pBeaconParams->paramChangeBitmap |=
2512 PARAM_LSIG_TXOP_FULL_SUPPORT_CHANGED;
2513 }
2514
2515 // For Station just update the global lim variable, no need to send message to HAL
2516 // Station already taking care of HT OPR Mode=01, meaning AP is seeing legacy
2517 //stations in overlapping BSS.
2518 if ( psessionEntry->beaconParams.gHTObssMode != ( tANI_U8 )htInfo.obssNonHTStaPresent )
2519 psessionEntry->beaconParams.gHTObssMode = ( tANI_U8 )htInfo.obssNonHTStaPresent ;
2520
2521 }
2522}
2523
2524
2525/**
2526 * limProcessChannelSwitchTimeout()
2527 *
2528 *FUNCTION:
2529 * This function is invoked when Channel Switch Timer expires at
2530 * the STA. Now, STA must stop traffic, and then change/disable
2531 * primary or secondary channel.
2532 *
2533 *
2534 *NOTE:
2535 * @param pMac - Pointer to Global MAC structure
2536 * @return None
2537 */
2538void limProcessChannelSwitchTimeout(tpAniSirGlobal pMac)
2539{
2540 tpPESession psessionEntry = NULL;
Jeff Johnsone7245742012-09-05 17:12:55 -07002541 tANI_U8 channel; // This is received and stored from channelSwitch Action frame
Jeff Johnson295189b2012-06-20 16:38:30 -07002542
2543 if((psessionEntry = peFindSessionBySessionId(pMac, pMac->lim.limTimers.gLimChannelSwitchTimer.sessionId))== NULL)
2544 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002545 limLog(pMac, LOGP,FL("Session Does not exist for given sessionID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002546 return;
2547 }
2548
2549 if (psessionEntry->limSystemRole != eLIM_STA_ROLE)
2550 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002551 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 -07002552 return;
2553 }
Jeff Johnsone7245742012-09-05 17:12:55 -07002554 channel = psessionEntry->gLimChannelSwitch.primaryChannel;
Jeff Johnson295189b2012-06-20 16:38:30 -07002555 /*
2556 * This potentially can create issues if the function tries to set
2557 * channel while device is in power-save, hence putting an extra check
2558 * to verify if the device is in power-save or not
2559 */
2560 if(!limIsSystemInActiveState(pMac))
2561 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002562 PELOGW(limLog(pMac, LOGW, FL("Device is not in active state, cannot switch channel"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002563 return;
2564 }
2565
2566 // Restore Channel Switch parameters to default
Jeff Johnsone7245742012-09-05 17:12:55 -07002567 psessionEntry->gLimChannelSwitch.switchTimeoutValue = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07002568
2569 /* Channel-switch timeout has occurred. reset the state */
Jeff Johnsone7245742012-09-05 17:12:55 -07002570 psessionEntry->gLimSpecMgmt.dot11hChanSwState = eLIM_11H_CHANSW_END;
Jeff Johnson295189b2012-06-20 16:38:30 -07002571
2572 /* Check if the AP is switching to a channel that we support.
2573 * Else, just don't bother to switch. Indicate HDD to look for a
2574 * better AP to associate
2575 */
2576 if(!limIsChannelValidForChannelSwitch(pMac, channel))
2577 {
2578 /* We need to restore pre-channelSwitch state on the STA */
2579 if(limRestorePreChannelSwitchState(pMac, psessionEntry) != eSIR_SUCCESS)
2580 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002581 limLog(pMac, LOGP, FL("Could not restore pre-channelSwitch (11h) state, resetting the system"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002582 return;
2583 }
2584
2585 /* If the channel-list that AP is asking us to switch is invalid,
2586 * then we cannot switch the channel. Just disassociate from AP.
2587 * We will find a better AP !!!
2588 */
2589 limTearDownLinkWithAp(pMac,
2590 pMac->lim.limTimers.gLimChannelSwitchTimer.sessionId,
2591 eSIR_MAC_UNSPEC_FAILURE_REASON);
2592 return;
2593 }
Jeff Johnsone7245742012-09-05 17:12:55 -07002594 switch(psessionEntry->gLimChannelSwitch.state)
Jeff Johnson295189b2012-06-20 16:38:30 -07002595 {
2596 case eLIM_CHANNEL_SWITCH_PRIMARY_ONLY:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002597 PELOGW(limLog(pMac, LOGW, FL("CHANNEL_SWITCH_PRIMARY_ONLY "));)
Jeff Johnsone7245742012-09-05 17:12:55 -07002598 limSwitchPrimaryChannel(pMac, psessionEntry->gLimChannelSwitch.primaryChannel,psessionEntry);
2599 psessionEntry->gLimChannelSwitch.state = eLIM_CHANNEL_SWITCH_IDLE;
Jeff Johnson295189b2012-06-20 16:38:30 -07002600 break;
2601
2602 case eLIM_CHANNEL_SWITCH_SECONDARY_ONLY:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002603 PELOGW(limLog(pMac, LOGW, FL("CHANNEL_SWITCH_SECONDARY_ONLY "));)
Jeff Johnsone7245742012-09-05 17:12:55 -07002604 limSwitchPrimarySecondaryChannel(pMac, psessionEntry,
Jeff Johnson295189b2012-06-20 16:38:30 -07002605 psessionEntry->currentOperChannel,
Jeff Johnsone7245742012-09-05 17:12:55 -07002606 psessionEntry->gLimChannelSwitch.secondarySubBand);
2607 psessionEntry->gLimChannelSwitch.state = eLIM_CHANNEL_SWITCH_IDLE;
Jeff Johnson295189b2012-06-20 16:38:30 -07002608 break;
2609
2610 case eLIM_CHANNEL_SWITCH_PRIMARY_AND_SECONDARY:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002611 PELOGW(limLog(pMac, LOGW, FL("CHANNEL_SWITCH_PRIMARY_AND_SECONDARY"));)
Jeff Johnsone7245742012-09-05 17:12:55 -07002612 limSwitchPrimarySecondaryChannel(pMac, psessionEntry,
2613 psessionEntry->gLimChannelSwitch.primaryChannel,
2614 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_IDLE:
2619 default:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002620 PELOGE(limLog(pMac, LOGE, FL("incorrect state "));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002621 if(limRestorePreChannelSwitchState(pMac, psessionEntry) != eSIR_SUCCESS)
2622 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002623 limLog(pMac, LOGP, FL("Could not restore pre-channelSwitch (11h) state, resetting the system"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002624 }
2625 return; /* Please note, this is 'return' and not 'break' */
2626 }
Jeff Johnsone7245742012-09-05 17:12:55 -07002627}
Jeff Johnson295189b2012-06-20 16:38:30 -07002628
2629/**
2630 * limUpdateChannelSwitch()
2631 *
2632 *FUNCTION:
2633 * This function is invoked whenever Station receives
2634 * either 802.11h channel switch IE or airgo proprietary
2635 * channel switch IE.
2636 *
2637 *NOTE:
2638 * @param pMac - Pointer to Global MAC structure
2639 * @return tpSirProbeRespBeacon - Pointer to Beacon/Probe Rsp
2640 * @param psessionentry
2641 */
2642void
2643limUpdateChannelSwitch(struct sAniSirGlobal *pMac, tpSirProbeRespBeacon pBeacon, tpPESession psessionEntry)
2644{
2645
2646 tANI_U16 beaconPeriod;
Jeff Johnson295189b2012-06-20 16:38:30 -07002647 tChannelSwitchPropIEStruct *pPropChnlSwitch;
2648 tDot11fIEChanSwitchAnn *pChnlSwitch;
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -07002649#ifdef WLAN_FEATURE_11AC
2650 tDot11fIEWiderBWChanSwitchAnn *pWiderChnlSwitch;
2651#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002652
Jeff Johnsone7245742012-09-05 17:12:55 -07002653 beaconPeriod = psessionEntry->beaconParams.beaconInterval;
Jeff Johnson295189b2012-06-20 16:38:30 -07002654
2655 /* STA either received proprietary channel switch IE or 802.11h
2656 * standard channel switch IE.
2657 */
2658 if (pBeacon->propIEinfo.propChannelSwitchPresent)
2659 {
2660 pPropChnlSwitch = &(pBeacon->propIEinfo.channelSwitch);
2661
2662 /* Add logic to determine which change this is: */
2663 /* primary, secondary, both. For now assume both. */
Jeff Johnsone7245742012-09-05 17:12:55 -07002664 psessionEntry->gLimChannelSwitch.state = eLIM_CHANNEL_SWITCH_PRIMARY_AND_SECONDARY;
2665 psessionEntry->gLimChannelSwitch.primaryChannel = pPropChnlSwitch->primaryChannel;
2666 psessionEntry->gLimChannelSwitch.secondarySubBand = (ePhyChanBondState)pPropChnlSwitch->subBand;
2667 psessionEntry->gLimChannelSwitch.switchCount = pPropChnlSwitch->channelSwitchCount;
2668 psessionEntry->gLimChannelSwitch.switchTimeoutValue =
Jeff Johnson295189b2012-06-20 16:38:30 -07002669 SYS_MS_TO_TICKS(beaconPeriod)* (pPropChnlSwitch->channelSwitchCount);
Jeff Johnsone7245742012-09-05 17:12:55 -07002670 psessionEntry->gLimChannelSwitch.switchMode = pPropChnlSwitch->mode;
Jeff Johnson295189b2012-06-20 16:38:30 -07002671 }
2672 else
2673 {
2674 pChnlSwitch = &(pBeacon->channelSwitchIE);
Jeff Johnsone7245742012-09-05 17:12:55 -07002675 psessionEntry->gLimChannelSwitch.primaryChannel = pChnlSwitch->newChannel;
2676 psessionEntry->gLimChannelSwitch.switchCount = pChnlSwitch->switchCount;
2677 psessionEntry->gLimChannelSwitch.switchTimeoutValue =
Jeff Johnson295189b2012-06-20 16:38:30 -07002678 SYS_MS_TO_TICKS(beaconPeriod)* (pChnlSwitch->switchCount);
Jeff Johnsone7245742012-09-05 17:12:55 -07002679 psessionEntry->gLimChannelSwitch.switchMode = pChnlSwitch->switchMode;
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -07002680#ifdef WLAN_FEATURE_11AC
2681 pWiderChnlSwitch = &(pBeacon->WiderBWChanSwitchAnn);
2682 if(pBeacon->WiderBWChanSwitchAnnPresent)
2683 {
2684 psessionEntry->gLimWiderBWChannelSwitch.newChanWidth = pWiderChnlSwitch->newChanWidth;
2685 psessionEntry->gLimWiderBWChannelSwitch.newCenterChanFreq0 = pWiderChnlSwitch->newCenterChanFreq0;
2686 psessionEntry->gLimWiderBWChannelSwitch.newCenterChanFreq1 = pWiderChnlSwitch->newCenterChanFreq1;
2687 }
2688#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002689
2690 /* Only primary channel switch element is present */
Jeff Johnsone7245742012-09-05 17:12:55 -07002691 psessionEntry->gLimChannelSwitch.state = eLIM_CHANNEL_SWITCH_PRIMARY_ONLY;
2692 psessionEntry->gLimChannelSwitch.secondarySubBand = PHY_SINGLE_CHANNEL_CENTERED;
Jeff Johnson295189b2012-06-20 16:38:30 -07002693
2694 /* Do not bother to look and operate on extended channel switch element
2695 * if our own channel-bonding state is not enabled
2696 */
Jeff Johnsone7245742012-09-05 17:12:55 -07002697 if (psessionEntry->htSupportedChannelWidthSet)
Jeff Johnson295189b2012-06-20 16:38:30 -07002698 {
2699 if (pBeacon->extChannelSwitchPresent)
2700 {
Jeff Johnsone7245742012-09-05 17:12:55 -07002701 if ((pBeacon->extChannelSwitchIE.secondaryChannelOffset == PHY_DOUBLE_CHANNEL_LOW_PRIMARY) ||
2702 (pBeacon->extChannelSwitchIE.secondaryChannelOffset == PHY_DOUBLE_CHANNEL_HIGH_PRIMARY))
Jeff Johnson295189b2012-06-20 16:38:30 -07002703 {
Jeff Johnsone7245742012-09-05 17:12:55 -07002704 psessionEntry->gLimChannelSwitch.state = eLIM_CHANNEL_SWITCH_PRIMARY_AND_SECONDARY;
2705 psessionEntry->gLimChannelSwitch.secondarySubBand = pBeacon->extChannelSwitchIE.secondaryChannelOffset;
Jeff Johnson295189b2012-06-20 16:38:30 -07002706 }
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -07002707#ifdef WLAN_FEATURE_11AC
2708 if(psessionEntry->vhtCapability && pBeacon->WiderBWChanSwitchAnnPresent)
2709 {
2710 if (pWiderChnlSwitch->newChanWidth == WNI_CFG_VHT_CHANNEL_WIDTH_80MHZ)
2711 {
2712 if(pBeacon->extChannelSwitchPresent)
2713 {
2714 if ((pBeacon->extChannelSwitchIE.secondaryChannelOffset == PHY_DOUBLE_CHANNEL_LOW_PRIMARY) ||
2715 (pBeacon->extChannelSwitchIE.secondaryChannelOffset == PHY_DOUBLE_CHANNEL_HIGH_PRIMARY))
2716 {
2717 psessionEntry->gLimChannelSwitch.state = eLIM_CHANNEL_SWITCH_PRIMARY_AND_SECONDARY;
2718 psessionEntry->gLimChannelSwitch.secondarySubBand = limGet11ACPhyCBState(pMac,
2719 psessionEntry->gLimChannelSwitch.primaryChannel,
2720 pBeacon->extChannelSwitchIE.secondaryChannelOffset,
2721 pWiderChnlSwitch->newCenterChanFreq0,
2722 psessionEntry);
2723 }
2724 }
2725 }
2726 }
2727#endif
Jeff Johnsone7245742012-09-05 17:12:55 -07002728 }
2729 }
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -07002730 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002731 if (eSIR_SUCCESS != limStartChannelSwitch(pMac, psessionEntry))
2732 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002733 PELOGW(limLog(pMac, LOGW, FL("Could not start Channel Switch"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002734 }
2735
2736 limLog(pMac, LOGW,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002737 FL("session %d primary chl %d, subband %d, count %d (%d ticks) "),
Jeff Johnsone7245742012-09-05 17:12:55 -07002738 psessionEntry->peSessionId,
2739 psessionEntry->gLimChannelSwitch.primaryChannel,
2740 psessionEntry->gLimChannelSwitch.secondarySubBand,
2741 psessionEntry->gLimChannelSwitch.switchCount,
2742 psessionEntry->gLimChannelSwitch.switchTimeoutValue);
Jeff Johnson295189b2012-06-20 16:38:30 -07002743 return;
2744}
2745
2746/**
2747 * limCancelDot11hChannelSwitch
2748 *
2749 *FUNCTION:
2750 * This function is called when STA does not send updated channel-swith IE
2751 * after indicating channel-switch start. This will cancel the channel-swith
2752 * timer which is already running.
2753 *
2754 *LOGIC:
2755 *
2756 *ASSUMPTIONS:
2757 *
2758 *NOTE:
2759 *
2760 * @param pMac - Pointer to Global MAC structure
2761 *
2762 * @return None
2763 */
2764void limCancelDot11hChannelSwitch(tpAniSirGlobal pMac, tpPESession psessionEntry)
2765{
Jeff Johnson295189b2012-06-20 16:38:30 -07002766 if (psessionEntry->limSystemRole != eLIM_STA_ROLE)
2767 return;
2768
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002769 PELOGW(limLog(pMac, LOGW, FL("Received a beacon without channel switch IE"));)
Jeff Johnsone7245742012-09-05 17:12:55 -07002770 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_DEACTIVATE, psessionEntry->peSessionId, eLIM_CHANNEL_SWITCH_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -07002771
2772 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimChannelSwitchTimer) != eSIR_SUCCESS)
2773 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002774 PELOGE(limLog(pMac, LOGE, FL("tx_timer_deactivate failed!"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002775 }
2776
2777 /* We need to restore pre-channelSwitch state on the STA */
2778 if (limRestorePreChannelSwitchState(pMac, psessionEntry) != eSIR_SUCCESS)
2779 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002780 PELOGE(limLog(pMac, LOGE, FL("LIM: Could not restore pre-channelSwitch (11h) state, resetting the system"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002781
2782 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002783}
2784
2785/**----------------------------------------------
2786\fn limCancelDot11hQuiet
2787\brief Cancel the quieting on Station if latest
2788 beacon doesn't contain quiet IE in it.
2789
2790\param pMac
2791\return NONE
2792-----------------------------------------------*/
2793void limCancelDot11hQuiet(tpAniSirGlobal pMac, tpPESession psessionEntry)
2794{
Jeff Johnson295189b2012-06-20 16:38:30 -07002795 if (psessionEntry->limSystemRole != eLIM_STA_ROLE)
2796 return;
2797
Jeff Johnsone7245742012-09-05 17:12:55 -07002798 if (psessionEntry->gLimSpecMgmt.quietState == eLIM_QUIET_BEGIN)
Jeff Johnson295189b2012-06-20 16:38:30 -07002799 {
Jeff Johnsone7245742012-09-05 17:12:55 -07002800 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_DEACTIVATE, psessionEntry->peSessionId, eLIM_QUIET_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -07002801 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimQuietTimer) != TX_SUCCESS)
2802 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002803 PELOGE(limLog(pMac, LOGE, FL("tx_timer_deactivate failed"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002804 }
2805 }
Jeff Johnsone7245742012-09-05 17:12:55 -07002806 else if (psessionEntry->gLimSpecMgmt.quietState == eLIM_QUIET_RUNNING)
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_BSS_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -07002809 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimQuietBssTimer) != 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 /**
2814 * If the channel switch is already running in silent mode, dont resume the
2815 * transmission. Channel switch timer when timeout, transmission will be resumed.
2816 */
Jeff Johnsone7245742012-09-05 17:12:55 -07002817 if(!((psessionEntry->gLimSpecMgmt.dot11hChanSwState == eLIM_11H_CHANSW_RUNNING) &&
2818 (psessionEntry->gLimChannelSwitch.switchMode == eSIR_CHANSW_MODE_SILENT)))
Jeff Johnson295189b2012-06-20 16:38:30 -07002819 {
2820 limFrameTransmissionControl(pMac, eLIM_TX_ALL, eLIM_RESUME_TX);
Jeff Johnsone7245742012-09-05 17:12:55 -07002821 limRestorePreQuietState(pMac, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07002822 }
2823 }
Jeff Johnsone7245742012-09-05 17:12:55 -07002824 psessionEntry->gLimSpecMgmt.quietState = eLIM_QUIET_INIT;
Jeff Johnson295189b2012-06-20 16:38:30 -07002825}
2826
2827/**
2828 * limProcessQuietTimeout
2829 *
2830 * FUNCTION:
2831 * This function is active only on the STA.
2832 * Handles SIR_LIM_QUIET_TIMEOUT
2833 *
2834 * LOGIC:
2835 * This timeout can occur under only one circumstance:
2836 *
2837 * 1) When gLimQuietState = eLIM_QUIET_BEGIN
2838 * This indicates that the timeout "interval" has
2839 * expired. This is a trigger for the STA to now
2840 * shut-off Tx/Rx for the specified gLimQuietDuration
2841 * -> The TIMER object gLimQuietBssTimer is
2842 * activated
2843 * -> With timeout = gLimQuietDuration
2844 * -> gLimQuietState is set to eLIM_QUIET_RUNNING
2845 *
2846 * ASSUMPTIONS:
2847 * Using two TIMER objects -
2848 * gLimQuietTimer & gLimQuietBssTimer
2849 *
2850 * NOTE:
2851 *
2852 * @param pMac - Pointer to Global MAC structure
2853 *
2854 * @return None
2855 */
2856void limProcessQuietTimeout(tpAniSirGlobal pMac)
2857{
Jeff Johnson295189b2012-06-20 16:38:30 -07002858 //fetch the sessionEntry based on the sessionId
2859 //priority - MEDIUM
Jeff Johnsone7245742012-09-05 17:12:55 -07002860 tpPESession psessionEntry;
Jeff Johnson295189b2012-06-20 16:38:30 -07002861
Jeff Johnsone7245742012-09-05 17:12:55 -07002862 if((psessionEntry = peFindSessionBySessionId(pMac, pMac->lim.limTimers.gLimQuietTimer.sessionId))== NULL)
Jeff Johnson295189b2012-06-20 16:38:30 -07002863 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002864 limLog(pMac, LOGE,FL("Session Does not exist for given sessionID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002865 return;
2866 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002867
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002868 PELOG1(limLog(pMac, LOG1, FL("quietState = %d"), psessionEntry->gLimSpecMgmt.quietState);)
Jeff Johnsone7245742012-09-05 17:12:55 -07002869 switch( psessionEntry->gLimSpecMgmt.quietState )
Jeff Johnson295189b2012-06-20 16:38:30 -07002870 {
2871 case eLIM_QUIET_BEGIN:
2872 // Time to Stop data traffic for quietDuration
Jeff Johnsone7245742012-09-05 17:12:55 -07002873 //limDeactivateAndChangeTimer(pMac, eLIM_QUIET_BSS_TIMER);
2874 if (TX_SUCCESS !=
2875 tx_timer_deactivate(&pMac->lim.limTimers.gLimQuietBssTimer))
2876 {
2877 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002878 FL("Unable to de-activate gLimQuietBssTimer! Will attempt to activate anyway..."));
Jeff Johnsone7245742012-09-05 17:12:55 -07002879 }
2880
2881 // gLimQuietDuration appears to be in units of ticks
2882 // Use it as is
2883 if (TX_SUCCESS !=
2884 tx_timer_change( &pMac->lim.limTimers.gLimQuietBssTimer,
2885 psessionEntry->gLimSpecMgmt.quietDuration,
2886 0))
2887 {
2888 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002889 FL("Unable to change gLimQuietBssTimer! Will still attempt to activate anyway..."));
Jeff Johnsone7245742012-09-05 17:12:55 -07002890 }
Leela V Kiran Kumar Reddy Chiralac3b9d382013-01-31 20:49:53 -08002891 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, pMac->lim.limTimers.gLimQuietTimer.sessionId, eLIM_QUIET_BSS_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -07002892#ifdef GEN6_TODO
2893 /* revisit this piece of code to assign the appropriate sessionId below
2894 * priority - HIGH
2895 */
2896 pMac->lim.limTimers.gLimQuietBssTimer.sessionId = sessionId;
2897#endif
2898 if( TX_SUCCESS !=
2899 tx_timer_activate( &pMac->lim.limTimers.gLimQuietBssTimer ))
2900 {
2901 limLog( pMac, LOGW,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002902 FL("Unable to activate gLimQuietBssTimer! The STA will be unable to honor Quiet BSS..."));
Jeff Johnson295189b2012-06-20 16:38:30 -07002903 }
2904 else
2905 {
2906 // Transition to eLIM_QUIET_RUNNING
Jeff Johnsone7245742012-09-05 17:12:55 -07002907 psessionEntry->gLimSpecMgmt.quietState = eLIM_QUIET_RUNNING;
Jeff Johnson295189b2012-06-20 16:38:30 -07002908
2909 /* If we have sta bk scan triggered and trigger bk scan actually started successfully, */
2910 /* print message, otherwise, stop data traffic and stay quiet */
2911 if( pMac->lim.gLimTriggerBackgroundScanDuringQuietBss &&
2912 (eSIR_TRUE == (glimTriggerBackgroundScanDuringQuietBss_Status = limTriggerBackgroundScanDuringQuietBss( pMac ))) )
2913 {
2914 limLog( pMac, LOG2,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002915 FL("Attempting to trigger a background scan..."));
Jeff Johnson295189b2012-06-20 16:38:30 -07002916 }
2917 else
2918 {
2919 // Shut-off Tx/Rx for gLimSpecMgmt.quietDuration
2920 /* freeze the transmission */
2921 limFrameTransmissionControl(pMac, eLIM_TX_ALL, eLIM_STOP_TX);
2922
2923 limLog( pMac, LOG2,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002924 FL("Quiet BSS: STA shutting down for %d ticks"),
Jeff Johnsone7245742012-09-05 17:12:55 -07002925 psessionEntry->gLimSpecMgmt.quietDuration );
Jeff Johnson295189b2012-06-20 16:38:30 -07002926 }
2927 }
2928 break;
2929
2930 case eLIM_QUIET_RUNNING:
2931 case eLIM_QUIET_INIT:
2932 case eLIM_QUIET_END:
2933 default:
2934 //
2935 // As of now, nothing to be done
2936 //
2937 break;
2938 }
2939}
2940
2941/**
2942 * limProcessQuietBssTimeout
2943 *
2944 * FUNCTION:
2945 * This function is active on the AP and STA.
2946 * Handles SIR_LIM_QUIET_BSS_TIMEOUT
2947 *
2948 * LOGIC:
2949 * On the AP -
2950 * When the SIR_LIM_QUIET_BSS_TIMEOUT is triggered, it is
2951 * an indication for the AP to START sending out the
2952 * Quiet BSS IE.
2953 * If 802.11H is enabled, the Quiet BSS IE is sent as per
2954 * the 11H spec
2955 * If 802.11H is not enabled, the Quiet BSS IE is sent as
2956 * a Proprietary IE. This will be understood by all the
2957 * TITAN STA's
2958 * Transitioning gLimQuietState to eLIM_QUIET_BEGIN will
2959 * initiate the SCH to include the Quiet BSS IE in all
2960 * its subsequent Beacons/PR's.
2961 * The Quiet BSS IE will be included in all the Beacons
2962 * & PR's until the next DTIM period
2963 *
2964 * On the STA -
2965 * When gLimQuietState = eLIM_QUIET_RUNNING
2966 * This indicates that the STA was successfully shut-off
2967 * for the specified gLimQuietDuration. This is a trigger
2968 * for the STA to now resume data traffic.
2969 * -> gLimQuietState is set to eLIM_QUIET_INIT
2970 *
2971 * ASSUMPTIONS:
2972 *
2973 * NOTE:
2974 *
2975 * @param pMac - Pointer to Global MAC structure
2976 *
2977 * @return None
2978 */
2979void limProcessQuietBssTimeout( tpAniSirGlobal pMac )
2980{
Jeff Johnsone7245742012-09-05 17:12:55 -07002981 tpPESession psessionEntry;
Jeff Johnson295189b2012-06-20 16:38:30 -07002982
Jeff Johnsone7245742012-09-05 17:12:55 -07002983 if((psessionEntry = peFindSessionBySessionId(pMac, pMac->lim.limTimers.gLimQuietBssTimer.sessionId))== NULL)
Jeff Johnson295189b2012-06-20 16:38:30 -07002984 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002985 limLog(pMac, LOGP,FL("Session Does not exist for given sessionID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002986 return;
2987 }
2988
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002989 PELOG1(limLog(pMac, LOG1, FL("quietState = %d"), psessionEntry->gLimSpecMgmt.quietState);)
Jeff Johnsone7245742012-09-05 17:12:55 -07002990 if (eLIM_AP_ROLE == psessionEntry->limSystemRole)
Jeff Johnson295189b2012-06-20 16:38:30 -07002991 {
Jeff Johnson295189b2012-06-20 16:38:30 -07002992 }
2993 else
2994 {
2995 // eLIM_STA_ROLE
Jeff Johnsone7245742012-09-05 17:12:55 -07002996 switch( psessionEntry->gLimSpecMgmt.quietState )
Jeff Johnson295189b2012-06-20 16:38:30 -07002997 {
2998 case eLIM_QUIET_RUNNING:
2999 // Transition to eLIM_QUIET_INIT
Jeff Johnsone7245742012-09-05 17:12:55 -07003000 psessionEntry->gLimSpecMgmt.quietState = eLIM_QUIET_INIT;
Jeff Johnson295189b2012-06-20 16:38:30 -07003001
3002 if( !pMac->lim.gLimTriggerBackgroundScanDuringQuietBss || (glimTriggerBackgroundScanDuringQuietBss_Status == eSIR_FALSE) )
3003 {
3004 // Resume data traffic only if channel switch is not running in silent mode.
Jeff Johnsone7245742012-09-05 17:12:55 -07003005 if (!((psessionEntry->gLimSpecMgmt.dot11hChanSwState == eLIM_11H_CHANSW_RUNNING) &&
3006 (psessionEntry->gLimChannelSwitch.switchMode == eSIR_CHANSW_MODE_SILENT)))
Jeff Johnson295189b2012-06-20 16:38:30 -07003007 {
3008 limFrameTransmissionControl(pMac, eLIM_TX_ALL, eLIM_RESUME_TX);
Jeff Johnsone7245742012-09-05 17:12:55 -07003009 limRestorePreQuietState(pMac, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07003010 }
3011
3012 /* Reset status flag */
3013 if(glimTriggerBackgroundScanDuringQuietBss_Status == eSIR_FALSE)
3014 glimTriggerBackgroundScanDuringQuietBss_Status = eSIR_TRUE;
3015
3016 limLog( pMac, LOG2,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003017 FL("Quiet BSS: Resuming traffic..."));
Jeff Johnson295189b2012-06-20 16:38:30 -07003018 }
3019 else
3020 {
3021 //
3022 // Nothing specific to be done in this case
3023 // A background scan that was triggered during
3024 // SIR_LIM_QUIET_TIMEOUT will complete on its own
3025 //
3026 limLog( pMac, LOG2,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003027 FL("Background scan should be complete now..."));
Jeff Johnson295189b2012-06-20 16:38:30 -07003028 }
3029 break;
3030
3031 case eLIM_QUIET_INIT:
3032 case eLIM_QUIET_BEGIN:
3033 case eLIM_QUIET_END:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003034 PELOG2(limLog(pMac, LOG2, FL("Quiet state not in RUNNING"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003035 /* If the quiet period has ended, then resume the frame transmission */
3036 limFrameTransmissionControl(pMac, eLIM_TX_ALL, eLIM_RESUME_TX);
Jeff Johnsone7245742012-09-05 17:12:55 -07003037 limRestorePreQuietState(pMac, psessionEntry);
3038 psessionEntry->gLimSpecMgmt.quietState = eLIM_QUIET_INIT;
Jeff Johnson295189b2012-06-20 16:38:30 -07003039 break;
3040
3041 default:
3042 //
3043 // As of now, nothing to be done
3044 //
3045 break;
3046 }
3047 }
3048}
Jeff Johnson295189b2012-06-20 16:38:30 -07003049/**
3050 * limProcessWPSOverlapTimeout
3051 *
3052 * FUNCTION: This function call limWPSPBCTimeout() to clean WPS PBC probe request entries
3053 *
3054 * LOGIC:
3055 *
3056 * ASSUMPTIONS:
3057 *
3058 * NOTE:
3059 *
3060 * @param pMac - Pointer to Global MAC structure
3061 *
3062 * @return None
3063 */
3064#if 0
3065void limProcessWPSOverlapTimeout(tpAniSirGlobal pMac)
3066{
3067
3068 tpPESession psessionEntry;
3069 tANI_U32 sessionId;
3070
3071 if (tx_timer_activate(&pMac->lim.limTimers.gLimWPSOverlapTimerObj.gLimWPSOverlapTimer) != TX_SUCCESS)
3072 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003073 limLog(pMac, LOGP, FL("tx_timer_activate failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003074 }
3075
3076 sessionId = pMac->lim.limTimers.gLimWPSOverlapTimerObj.sessionId;
3077
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003078 PELOGE(limLog(pMac, LOGE, FL("WPS overlap timeout, sessionId=%d"), sessionId);)
Jeff Johnson295189b2012-06-20 16:38:30 -07003079
3080 if((psessionEntry = peFindSessionBySessionId(pMac, sessionId)) == NULL)
3081 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003082 PELOGE(limLog(pMac, LOGP,FL("Session Does not exist for given sessionID"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003083 return;
3084 }
3085
3086 limWPSPBCTimeout(pMac, psessionEntry);
3087}
3088#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07003089
Jeff Johnson295189b2012-06-20 16:38:30 -07003090/**----------------------------------------------
3091\fn limStartQuietTimer
3092\brief Starts the quiet timer.
3093
3094\param pMac
3095\return NONE
3096-----------------------------------------------*/
3097void limStartQuietTimer(tpAniSirGlobal pMac, tANI_U8 sessionId)
3098{
3099 tpPESession psessionEntry;
3100 psessionEntry = peFindSessionBySessionId(pMac , sessionId);
3101
3102 if(psessionEntry == NULL) {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003103 limLog(pMac, LOGP,FL("Session Does not exist for given sessionID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003104 return;
3105 }
3106
Jeff Johnson295189b2012-06-20 16:38:30 -07003107
3108 if (psessionEntry->limSystemRole != eLIM_STA_ROLE)
3109 return;
3110 // First, de-activate Timer, if its already active
3111 limCancelDot11hQuiet(pMac, psessionEntry);
3112
Jeff Johnsone7245742012-09-05 17:12:55 -07003113 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, sessionId, eLIM_QUIET_TIMER));
3114 if( TX_SUCCESS != tx_timer_deactivate(&pMac->lim.limTimers.gLimQuietTimer))
3115 {
3116 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003117 FL( "Unable to deactivate gLimQuietTimer! Will still attempt to re-activate anyway..." ));
Jeff Johnsone7245742012-09-05 17:12:55 -07003118 }
3119
3120 // Set the NEW timeout value, in ticks
3121 if( TX_SUCCESS != tx_timer_change( &pMac->lim.limTimers.gLimQuietTimer,
3122 SYS_MS_TO_TICKS(psessionEntry->gLimSpecMgmt.quietTimeoutValue), 0))
3123 {
3124 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003125 FL( "Unable to change gLimQuietTimer! Will still attempt to re-activate anyway..." ));
Jeff Johnsone7245742012-09-05 17:12:55 -07003126 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003127
3128 pMac->lim.limTimers.gLimQuietTimer.sessionId = sessionId;
3129 if( TX_SUCCESS != tx_timer_activate(&pMac->lim.limTimers.gLimQuietTimer))
3130 {
3131 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003132 FL("Unable to activate gLimQuietTimer! STA cannot honor Quiet BSS!"));
Jeff Johnsone7245742012-09-05 17:12:55 -07003133 limRestorePreQuietState(pMac, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07003134
Jeff Johnsone7245742012-09-05 17:12:55 -07003135 psessionEntry->gLimSpecMgmt.quietState = eLIM_QUIET_INIT;
Jeff Johnson295189b2012-06-20 16:38:30 -07003136 return;
3137 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003138}
3139
Jeff Johnson295189b2012-06-20 16:38:30 -07003140
3141/** ------------------------------------------------------------------------ **/
3142/**
3143 * keep track of the number of ANI peers associated in the BSS
3144 * For the first and last ANI peer, we have to update EDCA params as needed
3145 *
3146 * When the first ANI peer joins the BSS, we notify SCH
3147 * When the last ANI peer leaves the BSS, we notfiy SCH
3148 */
3149void
3150limUtilCountStaAdd(
3151 tpAniSirGlobal pMac,
3152 tpDphHashNode pSta,
3153 tpPESession psessionEntry)
3154{
3155
3156 if ((! pSta) || (! pSta->valid) || (! pSta->aniPeer) || (pSta->fAniCount))
3157 return;
3158
3159 pSta->fAniCount = 1;
3160
3161 if (pMac->lim.gLimNumOfAniSTAs++ != 0)
3162 return;
3163
3164 // get here only if this is the first ANI peer in the BSS
3165 schEdcaProfileUpdate(pMac, psessionEntry);
3166}
3167
3168void
3169limUtilCountStaDel(
3170 tpAniSirGlobal pMac,
3171 tpDphHashNode pSta,
3172 tpPESession psessionEntry)
3173{
3174
3175 if ((pSta == NULL) || (pSta->aniPeer == eHAL_CLEAR) || (! pSta->fAniCount))
3176 return;
3177
3178 /* Only if sta is invalid and the validInDummyState bit is set to 1,
3179 * then go ahead and update the count and profiles. This ensures
3180 * that the "number of ani station" count is properly incremented/decremented.
3181 */
3182 if (pSta->valid == 1)
3183 return;
3184
3185 pSta->fAniCount = 0;
3186
3187 if (pMac->lim.gLimNumOfAniSTAs <= 0)
3188 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003189 limLog(pMac, LOGE, FL("CountStaDel: ignoring Delete Req when AniPeer count is %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07003190 pMac->lim.gLimNumOfAniSTAs);
3191 return;
3192 }
3193
3194 pMac->lim.gLimNumOfAniSTAs--;
3195
3196 if (pMac->lim.gLimNumOfAniSTAs != 0)
3197 return;
3198
3199 // get here only if this is the last ANI peer in the BSS
3200 schEdcaProfileUpdate(pMac, psessionEntry);
3201}
3202
Jeff Johnson295189b2012-06-20 16:38:30 -07003203/**
3204 * limSwitchChannelCback()
3205 *
3206 *FUNCTION:
3207 * This is the callback function registered while requesting to switch channel
3208 * after AP indicates a channel switch for spectrum management (11h).
3209 *
3210 *NOTE:
3211 * @param pMac Pointer to Global MAC structure
3212 * @param status Status of channel switch request
3213 * @param data User data
3214 * @param psessionEntry Session information
3215 * @return NONE
3216 */
3217void limSwitchChannelCback(tpAniSirGlobal pMac, eHalStatus status,
3218 tANI_U32 *data, tpPESession psessionEntry)
3219{
3220 tSirMsgQ mmhMsg = {0};
3221 tSirSmeSwitchChannelInd *pSirSmeSwitchChInd;
3222
Jeff Johnson295189b2012-06-20 16:38:30 -07003223 psessionEntry->currentOperChannel = psessionEntry->currentReqChannel;
3224
3225 /* We need to restore pre-channelSwitch state on the STA */
3226 if (limRestorePreChannelSwitchState(pMac, psessionEntry) != eSIR_SUCCESS)
3227 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003228 limLog(pMac, LOGP, FL("Could not restore pre-channelSwitch (11h) state, resetting the system"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003229 return;
3230 }
3231
3232 mmhMsg.type = eWNI_SME_SWITCH_CHL_REQ;
3233 if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&pSirSmeSwitchChInd, sizeof(tSirSmeSwitchChannelInd)))
3234 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003235 limLog(pMac, LOGP, FL("Failed to allocate buffer for buffer descriptor"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003236 return;
3237 }
3238
3239 pSirSmeSwitchChInd->messageType = eWNI_SME_SWITCH_CHL_REQ;
3240 pSirSmeSwitchChInd->length = sizeof(tSirSmeSwitchChannelInd);
Jeff Johnsone7245742012-09-05 17:12:55 -07003241 pSirSmeSwitchChInd->newChannelId = psessionEntry->gLimChannelSwitch.primaryChannel;
Jeff Johnson295189b2012-06-20 16:38:30 -07003242 pSirSmeSwitchChInd->sessionId = psessionEntry->smeSessionId;
3243 //BSS ID
3244 palCopyMemory( pMac->hHdd, pSirSmeSwitchChInd->bssId, psessionEntry->bssId, sizeof(tSirMacAddr));
3245 mmhMsg.bodyptr = pSirSmeSwitchChInd;
3246 mmhMsg.bodyval = 0;
3247
Jeff Johnsone7245742012-09-05 17:12:55 -07003248 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07003249
Jeff Johnson295189b2012-06-20 16:38:30 -07003250 SysProcessMmhMsg(pMac, &mmhMsg);
Jeff Johnson295189b2012-06-20 16:38:30 -07003251}
3252
3253/**
3254 * limSwitchPrimaryChannel()
3255 *
3256 *FUNCTION:
3257 * This function changes the current operating channel
3258 * and sets the new new channel ID in WNI_CFG_CURRENT_CHANNEL.
3259 *
3260 *NOTE:
3261 * @param pMac Pointer to Global MAC structure
3262 * @param newChannel new chnannel ID
3263 * @return NONE
3264 */
3265void limSwitchPrimaryChannel(tpAniSirGlobal pMac, tANI_U8 newChannel,tpPESession psessionEntry)
3266{
3267#if !defined WLAN_FEATURE_VOWIFI
3268 tANI_U32 localPwrConstraint;
3269#endif
3270
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003271 PELOG3(limLog(pMac, LOG3, FL("limSwitchPrimaryChannel: old chnl %d --> new chnl %d "),
Jeff Johnson295189b2012-06-20 16:38:30 -07003272 psessionEntry->currentOperChannel, newChannel);)
3273 psessionEntry->currentReqChannel = newChannel;
3274 psessionEntry->limRFBand = limGetRFBand(newChannel);
3275
3276 psessionEntry->channelChangeReasonCode=LIM_SWITCH_CHANNEL_OPERATION;
3277
3278 pMac->lim.gpchangeChannelCallback = limSwitchChannelCback;
3279 pMac->lim.gpchangeChannelData = NULL;
3280
3281#if defined WLAN_FEATURE_VOWIFI
Jeff Johnsone7245742012-09-05 17:12:55 -07003282 limSendSwitchChnlParams(pMac, newChannel, PHY_SINGLE_CHANNEL_CENTERED,
Jeff Johnson295189b2012-06-20 16:38:30 -07003283 psessionEntry->maxTxPower, psessionEntry->peSessionId);
3284#else
3285 if(wlan_cfgGetInt(pMac, WNI_CFG_LOCAL_POWER_CONSTRAINT, &localPwrConstraint) != eSIR_SUCCESS)
3286 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003287 limLog( pMac, LOGP, FL( "Unable to read Local Power Constraint from cfg" ));
Jeff Johnson295189b2012-06-20 16:38:30 -07003288 return;
3289 }
Jeff Johnsone7245742012-09-05 17:12:55 -07003290 limSendSwitchChnlParams(pMac, newChannel, PHY_SINGLE_CHANNEL_CENTERED,
Jeff Johnson295189b2012-06-20 16:38:30 -07003291 (tPowerdBm)localPwrConstraint, psessionEntry->peSessionId);
3292#endif
3293 return;
3294}
3295
3296/**
3297 * limSwitchPrimarySecondaryChannel()
3298 *
3299 *FUNCTION:
3300 * This function changes the primary and secondary channel.
3301 * If 11h is enabled and user provides a "new channel ID"
3302 * that is different from the current operating channel,
3303 * then we must set this new channel in WNI_CFG_CURRENT_CHANNEL,
3304 * assign notify LIM of such change.
3305 *
3306 *NOTE:
3307 * @param pMac Pointer to Global MAC structure
3308 * @param newChannel New chnannel ID (or current channel ID)
3309 * @param subband CB secondary info:
3310 * - eANI_CB_SECONDARY_NONE
3311 * - eANI_CB_SECONDARY_UP
3312 * - eANI_CB_SECONDARY_DOWN
3313 * @return NONE
3314 */
Jeff Johnsone7245742012-09-05 17:12:55 -07003315void limSwitchPrimarySecondaryChannel(tpAniSirGlobal pMac, tpPESession psessionEntry, tANI_U8 newChannel, ePhyChanBondState subband)
Jeff Johnson295189b2012-06-20 16:38:30 -07003316{
3317#if !defined WLAN_FEATURE_VOWIFI
3318 tANI_U32 localPwrConstraint;
3319#endif
3320
Jeff Johnson295189b2012-06-20 16:38:30 -07003321#if !defined WLAN_FEATURE_VOWIFI
3322 if(wlan_cfgGetInt(pMac, WNI_CFG_LOCAL_POWER_CONSTRAINT, &localPwrConstraint) != eSIR_SUCCESS) {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003323 limLog( pMac, LOGP, FL( "Unable to get Local Power Constraint from cfg" ));
Jeff Johnson295189b2012-06-20 16:38:30 -07003324 return;
3325 }
3326#endif
3327
Jeff Johnson295189b2012-06-20 16:38:30 -07003328#if defined WLAN_FEATURE_VOWIFI
Jeff Johnsone7245742012-09-05 17:12:55 -07003329 limSendSwitchChnlParams(pMac, newChannel, subband, psessionEntry->maxTxPower, psessionEntry->peSessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07003330#else
Jeff Johnsone7245742012-09-05 17:12:55 -07003331 limSendSwitchChnlParams(pMac, newChannel, subband, (tPowerdBm)localPwrConstraint, psessionEntry->peSessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07003332#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07003333
Jeff Johnsone7245742012-09-05 17:12:55 -07003334 // Store the new primary and secondary channel in session entries if different
3335 if (psessionEntry->currentOperChannel != newChannel)
Jeff Johnson295189b2012-06-20 16:38:30 -07003336 {
3337 limLog(pMac, LOGW,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003338 FL("switch old chnl %d --> new chnl %d "),
Jeff Johnson295189b2012-06-20 16:38:30 -07003339 psessionEntry->currentOperChannel, newChannel);
Jeff Johnson295189b2012-06-20 16:38:30 -07003340 psessionEntry->currentOperChannel = newChannel;
3341 }
Jeff Johnsone7245742012-09-05 17:12:55 -07003342 if (psessionEntry->htSecondaryChannelOffset != subband)
3343 {
3344 limLog(pMac, LOGW,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003345 FL("switch old sec chnl %d --> new sec chnl %d "),
Jeff Johnsone7245742012-09-05 17:12:55 -07003346 psessionEntry->htSecondaryChannelOffset, subband);
3347 psessionEntry->htSecondaryChannelOffset = subband;
3348 if (psessionEntry->htSecondaryChannelOffset == PHY_SINGLE_CHANNEL_CENTERED)
3349 {
3350 psessionEntry->htSupportedChannelWidthSet = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE;
3351 }
3352 else
3353 {
3354 psessionEntry->htSupportedChannelWidthSet = WNI_CFG_CHANNEL_BONDING_MODE_ENABLE;
3355 }
3356 psessionEntry->htRecommendedTxWidthSet = psessionEntry->htSupportedChannelWidthSet;
3357 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003358
3359 return;
3360}
3361
3362
3363/**
3364 * limActiveScanAllowed()
3365 *
3366 *FUNCTION:
3367 * Checks if active scans are permitted on the given channel
3368 *
3369 *LOGIC:
3370 * The config variable SCAN_CONTROL_LIST contains pairs of (channelNum, activeScanAllowed)
3371 * Need to check if the channelNum matches, then depending on the corresponding
3372 * scan flag, return true (for activeScanAllowed==1) or false (otherwise).
3373 *
3374 *ASSUMPTIONS:
3375 *
3376 *NOTE:
3377 *
3378 * @param pMac Pointer to Global MAC structure
3379 * @param channelNum channel number
3380 * @return None
3381 */
3382
3383tANI_U8 limActiveScanAllowed(
3384 tpAniSirGlobal pMac,
3385 tANI_U8 channelNum)
3386{
3387 tANI_U32 i;
3388 tANI_U8 channelPair[WNI_CFG_SCAN_CONTROL_LIST_LEN];
3389 tANI_U32 len = WNI_CFG_SCAN_CONTROL_LIST_LEN;
3390 if (wlan_cfgGetStr(pMac, WNI_CFG_SCAN_CONTROL_LIST, channelPair, &len)
3391 != eSIR_SUCCESS)
3392 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003393 PELOGE(limLog(pMac, LOGE, FL("Unable to get scan control list"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003394 return false;
3395 }
3396
3397 if (len > WNI_CFG_SCAN_CONTROL_LIST_LEN)
3398 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003399 limLog(pMac, LOGE, FL("Invalid scan control list length:%d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07003400 len);
3401 return false;
3402 }
3403
3404 for (i=0; (i+1) < len; i+=2)
3405 {
3406 if (channelPair[i] == channelNum)
3407 return ((channelPair[i+1] == eSIR_ACTIVE_SCAN) ? true : false);
3408 }
3409 return false;
3410}
3411
3412/**
3413 * limTriggerBackgroundScanDuringQuietBss()
3414 *
3415 *FUNCTION:
3416 * This function is applicable to the STA only.
3417 * This function is called by limProcessQuietTimeout(),
3418 * when it is time to honor the Quiet BSS IE from the AP.
3419 *
3420 *LOGIC:
3421 * If 11H is enabled:
3422 * We cannot trigger a background scan. The STA needs to
3423 * shut-off Tx/Rx.
3424 * If 11 is not enabled:
3425 * Determine if the next channel that we are going to
3426 * scan is NOT the same channel (or not) on which the
3427 * Quiet BSS was requested.
3428 * If yes, then we cannot trigger a background scan on
3429 * this channel. Return with a false.
3430 * If no, then trigger a background scan. Return with
3431 * a true.
3432 *
3433 *ASSUMPTIONS:
3434 *
3435 *NOTE:
3436 * This API is redundant if the existing API,
3437 * limTriggerBackgroundScan(), were to return a valid
3438 * response instead of returning void.
3439 * If possible, try to revisit this API
3440 *
3441 * @param pMac Pointer to Global MAC structure
3442 * @return eSIR_TRUE, if a background scan was attempted
3443 * eSIR_FALSE, if not
3444 */
3445tAniBool limTriggerBackgroundScanDuringQuietBss( tpAniSirGlobal pMac )
3446{
3447 tAniBool bScanTriggered = eSIR_FALSE;
Jeff Johnson295189b2012-06-20 16:38:30 -07003448
3449
3450
3451 //TBD-RAJESH HOW TO GET sessionEntry?????
3452 tpPESession psessionEntry = &pMac->lim.gpSession[0];
3453
3454 if (psessionEntry->limSystemRole != eLIM_STA_ROLE)
3455 return bScanTriggered;
3456
Jeff Johnsone7245742012-09-05 17:12:55 -07003457 if( !psessionEntry->lim11hEnable )
Jeff Johnson295189b2012-06-20 16:38:30 -07003458 {
3459 tSirMacChanNum bgScanChannelList[WNI_CFG_BG_SCAN_CHANNEL_LIST_LEN];
3460 tANI_U32 len = WNI_CFG_BG_SCAN_CHANNEL_LIST_LEN;
3461
3462 // Determine the next scan channel
3463
3464 // Get background scan channel list from CFG
3465 if( eSIR_SUCCESS == wlan_cfgGetStr( pMac,
3466 WNI_CFG_BG_SCAN_CHANNEL_LIST,
3467 (tANI_U8 *) bgScanChannelList,
3468 (tANI_U32 *) &len ))
3469 {
3470 // Ensure that we do not go off scanning on the same
3471 // channel on which the Quiet BSS was requested
3472 if( psessionEntry->currentOperChannel!=
3473 bgScanChannelList[pMac->lim.gLimBackgroundScanChannelId] )
3474 {
3475 // For now, try and attempt a background scan. It will
3476 // be ideal if this API actually returns a success or
3477 // failure instead of having a void return type
3478 limTriggerBackgroundScan( pMac );
3479
3480 bScanTriggered = eSIR_TRUE;
3481 }
3482 else
3483 {
3484 limLog( pMac, LOGW,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003485 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 -07003486 }
3487 }
3488 else
3489 {
3490 limLog( pMac, LOGW,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003491 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 -07003492 }
3493 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003494 return bScanTriggered;
3495}
3496
3497
3498/**
3499 * limGetHTCapability()
3500 *
3501 *FUNCTION:
3502 * A utility function that returns the "current HT capability state" for the HT
3503 * capability of interest (as requested in the API)
3504 *
3505 *LOGIC:
3506 * This routine will return with the "current" setting of a requested HT
3507 * capability. This state info could be retrieved from -
3508 * a) CFG (for static entries)
3509 * b) Run time info
3510 * - Dynamic state maintained by LIM
3511 * - Configured at radio init time by SME
3512 *
3513 *
3514 *ASSUMPTIONS:
3515 * NA
3516 *
3517 *NOTE:
3518 *
3519 * @param pMac Pointer to Global MAC structure
3520 * @param htCap The HT capability being queried
3521 * @return tANI_U8 The current state of the requested HT capability is returned in a
3522 * tANI_U8 variable
3523 */
3524
Jeff Johnson295189b2012-06-20 16:38:30 -07003525tANI_U8 limGetHTCapability( tpAniSirGlobal pMac,
3526 tANI_U32 htCap, tpPESession psessionEntry)
Jeff Johnson295189b2012-06-20 16:38:30 -07003527{
3528tANI_U8 retVal = 0;
3529tANI_U8 *ptr;
3530tANI_U32 cfgValue;
3531tSirMacHTCapabilityInfo macHTCapabilityInfo = {0};
3532tSirMacExtendedHTCapabilityInfo macExtHTCapabilityInfo = {0};
3533tSirMacTxBFCapabilityInfo macTxBFCapabilityInfo = {0};
3534tSirMacASCapabilityInfo macASCapabilityInfo = {0};
3535
3536 //
3537 // Determine which CFG to read from. Not ALL of the HT
3538 // related CFG's need to be read each time this API is
3539 // accessed
3540 //
3541 if( htCap >= eHT_ANTENNA_SELECTION &&
3542 htCap < eHT_SI_GRANULARITY )
3543 {
3544 // Get Antenna Seletion HT Capabilities
3545 if( eSIR_SUCCESS != wlan_cfgGetInt( pMac, WNI_CFG_AS_CAP, &cfgValue ))
3546 cfgValue = 0;
3547 ptr = (tANI_U8 *) &macASCapabilityInfo;
3548 *((tANI_U8 *)ptr) = (tANI_U8) (cfgValue & 0xff);
3549 }
3550 else
3551 {
3552 if( htCap >= eHT_TX_BEAMFORMING &&
3553 htCap < eHT_ANTENNA_SELECTION )
3554 {
3555 // Get Transmit Beam Forming HT Capabilities
3556 if( eSIR_SUCCESS != wlan_cfgGetInt( pMac, WNI_CFG_TX_BF_CAP, &cfgValue ))
3557 cfgValue = 0;
3558 ptr = (tANI_U8 *) &macTxBFCapabilityInfo;
3559 *((tANI_U32 *)ptr) = (tANI_U32) (cfgValue);
3560 }
3561 else
3562 {
3563 if( htCap >= eHT_PCO &&
3564 htCap < eHT_TX_BEAMFORMING )
3565 {
3566 // Get Extended HT Capabilities
3567 if( eSIR_SUCCESS != wlan_cfgGetInt( pMac, WNI_CFG_EXT_HT_CAP_INFO, &cfgValue ))
3568 cfgValue = 0;
3569 ptr = (tANI_U8 *) &macExtHTCapabilityInfo;
3570 *((tANI_U16 *)ptr) = (tANI_U16) (cfgValue & 0xffff);
3571 }
3572 else
3573 {
3574 if( htCap < eHT_MAX_RX_AMPDU_FACTOR )
3575 {
3576 // Get HT Capabilities
3577 if( eSIR_SUCCESS != wlan_cfgGetInt( pMac, WNI_CFG_HT_CAP_INFO, &cfgValue ))
3578 cfgValue = 0;
3579 ptr = (tANI_U8 *) &macHTCapabilityInfo;
3580 // 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
3581 *ptr++ = cfgValue & 0xff;
3582 *ptr = (cfgValue >> 8) & 0xff;
3583 }
3584 }
3585 }
3586 }
3587
3588 switch( htCap )
3589 {
3590 case eHT_LSIG_TXOP_PROTECTION:
3591 retVal = pMac->lim.gHTLsigTXOPProtection;
3592 break;
3593
3594 case eHT_STBC_CONTROL_FRAME:
3595 retVal = (tANI_U8) macHTCapabilityInfo.stbcControlFrame;
3596 break;
3597
3598 case eHT_PSMP:
3599 retVal = pMac->lim.gHTPSMPSupport;
3600 break;
3601
3602 case eHT_DSSS_CCK_MODE_40MHZ:
3603 retVal = pMac->lim.gHTDsssCckRate40MHzSupport;
3604 break;
3605
3606 case eHT_MAX_AMSDU_LENGTH:
3607 retVal = (tANI_U8) macHTCapabilityInfo.maximalAMSDUsize;
3608 break;
3609
3610 case eHT_DELAYED_BA:
3611 retVal = (tANI_U8) macHTCapabilityInfo.delayedBA;
3612 break;
3613
3614 case eHT_RX_STBC:
3615 retVal = (tANI_U8) macHTCapabilityInfo.rxSTBC;
3616 break;
3617
3618 case eHT_TX_STBC:
3619 retVal = (tANI_U8) macHTCapabilityInfo.txSTBC;
3620 break;
3621
3622 case eHT_SHORT_GI_40MHZ:
3623 retVal = (tANI_U8) macHTCapabilityInfo.shortGI40MHz;
3624 break;
3625
3626 case eHT_SHORT_GI_20MHZ:
3627 retVal = (tANI_U8) macHTCapabilityInfo.shortGI20MHz;
3628 break;
3629
3630 case eHT_GREENFIELD:
3631 retVal = (tANI_U8) macHTCapabilityInfo.greenField;
3632 break;
3633
3634 case eHT_MIMO_POWER_SAVE:
3635 retVal = (tANI_U8) pMac->lim.gHTMIMOPSState;
3636 break;
3637
3638 case eHT_SUPPORTED_CHANNEL_WIDTH_SET:
Jeff Johnsone7245742012-09-05 17:12:55 -07003639 retVal = (tANI_U8) psessionEntry->htSupportedChannelWidthSet;
Jeff Johnson295189b2012-06-20 16:38:30 -07003640 break;
3641
3642 case eHT_ADVANCED_CODING:
3643 retVal = (tANI_U8) macHTCapabilityInfo.advCodingCap;
3644 break;
3645
3646 case eHT_MAX_RX_AMPDU_FACTOR:
3647 retVal = pMac->lim.gHTMaxRxAMpduFactor;
3648 break;
3649
3650 case eHT_MPDU_DENSITY:
3651 retVal = pMac->lim.gHTAMpduDensity;
3652 break;
3653
3654 case eHT_PCO:
3655 retVal = (tANI_U8) macExtHTCapabilityInfo.pco;
3656 break;
3657
3658 case eHT_TRANSITION_TIME:
3659 retVal = (tANI_U8) macExtHTCapabilityInfo.transitionTime;
3660 break;
3661
3662 case eHT_MCS_FEEDBACK:
3663 retVal = (tANI_U8) macExtHTCapabilityInfo.mcsFeedback;
3664 break;
3665
3666 case eHT_TX_BEAMFORMING:
3667 retVal = (tANI_U8) macTxBFCapabilityInfo.txBF;
3668 break;
3669
3670 case eHT_ANTENNA_SELECTION:
3671 retVal = (tANI_U8) macASCapabilityInfo.antennaSelection;
3672 break;
3673
3674 case eHT_SI_GRANULARITY:
3675 retVal = pMac->lim.gHTServiceIntervalGranularity;
3676 break;
3677
3678 case eHT_CONTROLLED_ACCESS:
3679 retVal = pMac->lim.gHTControlledAccessOnly;
3680 break;
3681
3682 case eHT_RIFS_MODE:
3683 retVal = psessionEntry->beaconParams.fRIFSMode;
3684 break;
3685
3686 case eHT_RECOMMENDED_TX_WIDTH_SET:
Jeff Johnsone7245742012-09-05 17:12:55 -07003687 retVal = psessionEntry->htRecommendedTxWidthSet;
Jeff Johnson295189b2012-06-20 16:38:30 -07003688 break;
3689
3690 case eHT_EXTENSION_CHANNEL_OFFSET:
Jeff Johnsone7245742012-09-05 17:12:55 -07003691 retVal = psessionEntry->htSecondaryChannelOffset;
Jeff Johnson295189b2012-06-20 16:38:30 -07003692 break;
3693
3694 case eHT_OP_MODE:
Jeff Johnson295189b2012-06-20 16:38:30 -07003695 if(psessionEntry->limSystemRole == eLIM_AP_ROLE )
3696 retVal = psessionEntry->htOperMode;
3697 else
Jeff Johnson295189b2012-06-20 16:38:30 -07003698 retVal = pMac->lim.gHTOperMode;
3699 break;
3700
3701 case eHT_BASIC_STBC_MCS:
3702 retVal = pMac->lim.gHTSTBCBasicMCS;
3703 break;
3704
3705 case eHT_DUAL_CTS_PROTECTION:
3706 retVal = pMac->lim.gHTDualCTSProtection;
3707 break;
3708
3709 case eHT_LSIG_TXOP_PROTECTION_FULL_SUPPORT:
3710 retVal = psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport;
3711 break;
3712
3713 case eHT_PCO_ACTIVE:
3714 retVal = pMac->lim.gHTPCOActive;
3715 break;
3716
3717 case eHT_PCO_PHASE:
3718 retVal = pMac->lim.gHTPCOPhase;
3719 break;
3720
3721 default:
3722 break;
3723 }
3724
3725 return retVal;
3726}
3727
Jeff Johnson295189b2012-06-20 16:38:30 -07003728void limGetMyMacAddr(tpAniSirGlobal pMac, tANI_U8 *mac)
3729{
3730 palCopyMemory( pMac->hHdd, mac, pMac->lim.gLimMyMacAddr, sizeof(tSirMacAddr));
3731 return;
3732}
3733
3734
3735
3736
3737/** -------------------------------------------------------------
3738\fn limEnable11aProtection
3739\brief based on config setting enables\disables 11a protection.
3740\param tANI_U8 enable : 1=> enable protection, 0=> disable protection.
3741\param tANI_U8 overlap: 1=> called from overlap context, 0 => called from assoc context.
3742\param tpUpdateBeaconParams pBeaconParams
3743\return None
3744 -------------------------------------------------------------*/
3745tSirRetStatus
3746limEnable11aProtection(tpAniSirGlobal pMac, tANI_U8 enable,
3747 tANI_U8 overlap, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry)
3748{
Madan Mohan Koyyalamudi33ef6a22012-10-30 17:44:43 -07003749 if(NULL == psessionEntry)
3750 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003751 PELOG3(limLog(pMac, LOG3, FL("psessionEntry is NULL"));)
Madan Mohan Koyyalamudi33ef6a22012-10-30 17:44:43 -07003752 return eSIR_FAILURE;
3753 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003754 //overlapping protection configuration check.
3755 if(overlap)
3756 {
Jeff Johnson295189b2012-06-20 16:38:30 -07003757 }
3758 else
3759 {
3760 //normal protection config check
Madan Mohan Koyyalamudi33ef6a22012-10-30 17:44:43 -07003761 if ((psessionEntry->limSystemRole == eLIM_AP_ROLE) &&
Jeff Johnsone7245742012-09-05 17:12:55 -07003762 (!psessionEntry->cfgProtection.fromlla))
Jeff Johnson295189b2012-06-20 16:38:30 -07003763 {
3764 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003765 PELOG3(limLog(pMac, LOG3, FL("protection from 11a is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003766 return eSIR_SUCCESS;
3767 }
3768 }
3769
3770 if (enable)
3771 {
3772 //If we are AP and HT capable, we need to set the HT OP mode
3773 //appropriately.
3774 if(((eLIM_AP_ROLE == psessionEntry->limSystemRole)||(eLIM_BT_AMP_AP_ROLE == psessionEntry->limSystemRole))&&
Jeff Johnsone7245742012-09-05 17:12:55 -07003775 (true == psessionEntry->htCapability))
Jeff Johnson295189b2012-06-20 16:38:30 -07003776 {
3777 if(overlap)
3778 {
3779 pMac->lim.gLimOverlap11aParams.protectionEnabled = true;
3780 if((eSIR_HT_OP_MODE_OVERLAP_LEGACY != pMac->lim.gHTOperMode) &&
3781 (eSIR_HT_OP_MODE_MIXED != pMac->lim.gHTOperMode))
3782 {
3783 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
3784 psessionEntry->htOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
3785 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
3786 limEnableHtOBSSProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
3787 }
3788 }
3789 else
3790 {
3791 psessionEntry->gLim11aParams.protectionEnabled = true;
3792 if(eSIR_HT_OP_MODE_MIXED != pMac->lim.gHTOperMode)
3793 {
3794 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_MIXED;
Jeff Johnsone7245742012-09-05 17:12:55 -07003795 psessionEntry->htOperMode = eSIR_HT_OP_MODE_MIXED;
Jeff Johnson295189b2012-06-20 16:38:30 -07003796 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
3797 limEnableHtOBSSProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
3798
3799 }
3800 }
3801 }
3802
3803 //This part is common for staiton as well.
3804 if(false == psessionEntry->beaconParams.llaCoexist)
3805 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003806 PELOG1(limLog(pMac, LOG1, FL(" => protection from 11A Enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003807 pBeaconParams->llaCoexist = psessionEntry->beaconParams.llaCoexist = true;
3808 pBeaconParams->paramChangeBitmap |= PARAM_llACOEXIST_CHANGED;
3809 }
3810 }
3811 else if (true == psessionEntry->beaconParams.llaCoexist)
3812 {
3813 //for AP role.
3814 //we need to take care of HT OP mode change if needed.
3815 //We need to take care of Overlap cases.
3816 if(eLIM_AP_ROLE == psessionEntry->limSystemRole)
3817 {
3818 if(overlap)
3819 {
3820 //Overlap Legacy protection disabled.
3821 pMac->lim.gLimOverlap11aParams.protectionEnabled = false;
3822
3823 //We need to take care of HT OP mode iff we are HT AP.
Jeff Johnsone7245742012-09-05 17:12:55 -07003824 if(psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07003825 {
3826 // no HT op mode change if any of the overlap protection enabled.
3827 if(!(pMac->lim.gLimOverlap11aParams.protectionEnabled ||
3828 pMac->lim.gLimOverlapHt20Params.protectionEnabled ||
3829 pMac->lim.gLimOverlapNonGfParams.protectionEnabled))
3830
3831 {
3832 //Check if there is a need to change HT OP mode.
3833 if(eSIR_HT_OP_MODE_OVERLAP_LEGACY == pMac->lim.gHTOperMode)
3834 {
3835 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
3836 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
3837
3838 if(psessionEntry->gLimHt20Params.protectionEnabled)
3839 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
3840 else
3841 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_PURE;
3842 }
3843 }
3844 }
3845 }
3846 else
3847 {
3848 //Disable protection from 11A stations.
3849 psessionEntry->gLim11aParams.protectionEnabled = false;
3850 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
3851
3852 //Check if any other non-HT protection enabled.
3853 //Right now we are in HT OP Mixed mode.
3854 //Change HT op mode appropriately.
3855
3856 //Change HT OP mode to 01 if any overlap protection enabled
3857 if(pMac->lim.gLimOverlap11aParams.protectionEnabled ||
3858 pMac->lim.gLimOverlapHt20Params.protectionEnabled ||
3859 pMac->lim.gLimOverlapNonGfParams.protectionEnabled)
3860
3861 {
3862 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
Jeff Johnsone7245742012-09-05 17:12:55 -07003863 psessionEntry->htOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
Jeff Johnson295189b2012-06-20 16:38:30 -07003864 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
3865 }
3866 else if(psessionEntry->gLimHt20Params.protectionEnabled)
3867 {
3868 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
Jeff Johnsone7245742012-09-05 17:12:55 -07003869 psessionEntry->htOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
Jeff Johnson295189b2012-06-20 16:38:30 -07003870 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
3871 }
3872 else
3873 {
3874 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_PURE;
Jeff Johnsone7245742012-09-05 17:12:55 -07003875 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
Jeff Johnson295189b2012-06-20 16:38:30 -07003876 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
3877 }
3878 }
3879 if(!pMac->lim.gLimOverlap11aParams.protectionEnabled &&
3880 !psessionEntry->gLim11aParams.protectionEnabled)
3881 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003882 PELOG1(limLog(pMac, LOG1, FL("===> Protection from 11A Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003883 pBeaconParams->llaCoexist = psessionEntry->beaconParams.llaCoexist = false;
3884 pBeaconParams->paramChangeBitmap |= PARAM_llACOEXIST_CHANGED;
3885 }
3886 }
3887 //for station role
3888 else
3889 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003890 PELOG1(limLog(pMac, LOG1, FL("===> Protection from 11A Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003891 pBeaconParams->llaCoexist = psessionEntry->beaconParams.llaCoexist = false;
3892 pBeaconParams->paramChangeBitmap |= PARAM_llACOEXIST_CHANGED;
3893 }
3894 }
3895
3896 return eSIR_SUCCESS;
3897}
3898
3899/** -------------------------------------------------------------
3900\fn limEnable11gProtection
3901\brief based on config setting enables\disables 11g protection.
3902\param tANI_U8 enable : 1=> enable protection, 0=> disable protection.
3903\param tANI_U8 overlap: 1=> called from overlap context, 0 => called from assoc context.
3904\param tpUpdateBeaconParams pBeaconParams
3905\return None
3906 -------------------------------------------------------------*/
3907
3908tSirRetStatus
3909limEnable11gProtection(tpAniSirGlobal pMac, tANI_U8 enable,
3910 tANI_U8 overlap, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry)
3911{
3912
3913 //overlapping protection configuration check.
3914 if(overlap)
3915 {
Jeff Johnson295189b2012-06-20 16:38:30 -07003916 }
3917 else
3918 {
3919 //normal protection config check
Jeff Johnson295189b2012-06-20 16:38:30 -07003920 if((psessionEntry->limSystemRole == eLIM_AP_ROLE ) &&
3921 !psessionEntry->cfgProtection.fromllb)
3922 {
3923 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003924 PELOG1(limLog(pMac, LOG1, FL("protection from 11b is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003925 return eSIR_SUCCESS;
3926 }else if(psessionEntry->limSystemRole != eLIM_AP_ROLE)
Jeff Johnson295189b2012-06-20 16:38:30 -07003927 {
3928 if(!pMac->lim.cfgProtection.fromllb)
3929 {
3930 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003931 PELOG1(limLog(pMac, LOG1, FL("protection from 11b is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003932 return eSIR_SUCCESS;
3933 }
3934 }
3935 }
3936
3937 if (enable)
3938 {
3939 //If we are AP and HT capable, we need to set the HT OP mode
3940 //appropriately.
Jeff Johnson295189b2012-06-20 16:38:30 -07003941 if(eLIM_AP_ROLE == psessionEntry->limSystemRole)
3942 {
3943 if(overlap)
3944 {
3945 psessionEntry->gLimOlbcParams.protectionEnabled = true;
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003946 PELOGE(limLog(pMac, LOGE, FL("protection from olbc is enabled"));)
Jeff Johnsone7245742012-09-05 17:12:55 -07003947 if(true == psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07003948 {
3949 if((eSIR_HT_OP_MODE_OVERLAP_LEGACY != psessionEntry->htOperMode) &&
3950 (eSIR_HT_OP_MODE_MIXED != psessionEntry->htOperMode))
3951 {
3952 psessionEntry->htOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
3953 }
3954 //CR-263021: OBSS bit is not switching back to 0 after disabling the overlapping legacy BSS
3955 // This fixes issue of OBSS bit not set after 11b, 11g station leaves
3956 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
3957 //Not processing OBSS bit from other APs, as we are already taking care
3958 //of Protection from overlapping BSS based on erp IE or useProtection bit
3959 limEnableHtOBSSProtection(pMac, true, overlap, pBeaconParams, psessionEntry);
3960 }
3961 }
3962 else
3963 {
3964 psessionEntry->gLim11bParams.protectionEnabled = true;
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003965 PELOGE(limLog(pMac, LOGE, FL("protection from 11b is enabled"));)
Jeff Johnsone7245742012-09-05 17:12:55 -07003966 if(true == psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07003967 {
3968 if(eSIR_HT_OP_MODE_MIXED != psessionEntry->htOperMode)
3969 {
3970 psessionEntry->htOperMode = eSIR_HT_OP_MODE_MIXED;
3971 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
3972 limEnableHtOBSSProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
3973 }
3974 }
3975 }
3976 }else if ((eLIM_BT_AMP_AP_ROLE == psessionEntry->limSystemRole) &&
Jeff Johnsone7245742012-09-05 17:12:55 -07003977 (true == psessionEntry->htCapability))
Jeff Johnson295189b2012-06-20 16:38:30 -07003978 {
3979 if(overlap)
3980 {
3981 psessionEntry->gLimOlbcParams.protectionEnabled = true;
3982 if((eSIR_HT_OP_MODE_OVERLAP_LEGACY != pMac->lim.gHTOperMode) &&
3983 (eSIR_HT_OP_MODE_MIXED != pMac->lim.gHTOperMode))
3984 {
3985 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
3986 }
3987 //CR-263021: OBSS bit is not switching back to 0 after disabling the overlapping legacy BSS
3988 // This fixes issue of OBSS bit not set after 11b, 11g station leaves
3989 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
3990 //Not processing OBSS bit from other APs, as we are already taking care
3991 //of Protection from overlapping BSS based on erp IE or useProtection bit
3992 limEnableHtOBSSProtection(pMac, true, overlap, pBeaconParams, psessionEntry);
3993 }
3994 else
3995 {
3996 psessionEntry->gLim11bParams.protectionEnabled = true;
3997 if(eSIR_HT_OP_MODE_MIXED != pMac->lim.gHTOperMode)
3998 {
3999 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_MIXED;
4000 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4001 limEnableHtOBSSProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4002 }
4003 }
4004 }
4005
4006 //This part is common for staiton as well.
4007 if(false == psessionEntry->beaconParams.llbCoexist)
4008 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004009 PELOG1(limLog(pMac, LOG1, FL("=> 11G Protection Enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004010 pBeaconParams->llbCoexist = psessionEntry->beaconParams.llbCoexist = true;
4011 pBeaconParams->paramChangeBitmap |= PARAM_llBCOEXIST_CHANGED;
4012 }
4013 }
4014 else if (true == psessionEntry->beaconParams.llbCoexist)
4015 {
4016 //for AP role.
4017 //we need to take care of HT OP mode change if needed.
4018 //We need to take care of Overlap cases.
Jeff Johnson295189b2012-06-20 16:38:30 -07004019 if(eLIM_AP_ROLE == psessionEntry->limSystemRole)
4020 {
4021 if(overlap)
4022 {
4023 //Overlap Legacy protection disabled.
4024 psessionEntry->gLimOlbcParams.protectionEnabled = false;
4025
4026 //We need to take care of HT OP mode if we are HT AP.
Jeff Johnsone7245742012-09-05 17:12:55 -07004027 if(psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07004028 {
4029 // no HT op mode change if any of the overlap protection enabled.
4030 if(!(psessionEntry->gLimOverlap11gParams.protectionEnabled ||
4031 psessionEntry->gLimOverlapHt20Params.protectionEnabled ||
4032 psessionEntry->gLimOverlapNonGfParams.protectionEnabled))
4033 {
4034 //Check if there is a need to change HT OP mode.
Jeff Johnson04dd8a82012-06-29 20:41:40 -07004035 if(eSIR_HT_OP_MODE_OVERLAP_LEGACY == psessionEntry->htOperMode)
Jeff Johnson295189b2012-06-20 16:38:30 -07004036 {
4037 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4038 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4039 if(psessionEntry->gLimHt20Params.protectionEnabled){
4040 //Commenting out beacuse of CR 258588 WFA cert
4041 //psessionEntry->htOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4042 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
4043 }
4044 else
4045 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
4046 }
4047 }
4048 }
4049 }
4050 else
4051 {
4052 //Disable protection from 11B stations.
4053 psessionEntry->gLim11bParams.protectionEnabled = false;
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004054 PELOGE(limLog(pMac, LOGE, FL("===> 11B Protection Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004055 //Check if any other non-HT protection enabled.
4056 if(!psessionEntry->gLim11gParams.protectionEnabled)
4057 {
4058 //Right now we are in HT OP Mixed mode.
4059 //Change HT op mode appropriately.
4060 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4061
4062 //Change HT OP mode to 01 if any overlap protection enabled
4063 if(psessionEntry->gLimOlbcParams.protectionEnabled ||
4064 psessionEntry->gLimOverlap11gParams.protectionEnabled ||
4065 psessionEntry->gLimOverlapHt20Params.protectionEnabled ||
4066 psessionEntry->gLimOverlapNonGfParams.protectionEnabled)
4067 {
4068 psessionEntry->htOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004069 PELOGE(limLog(pMac, LOGE, FL("===> 11G Protection Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004070 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4071 }
4072 else if(psessionEntry->gLimHt20Params.protectionEnabled)
4073 {
4074 //Commenting because of CR 258588 WFA cert
4075 //psessionEntry->htOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4076 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004077 PELOGE(limLog(pMac, LOGE, FL("===> 11G Protection Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004078 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4079 }
4080 else
4081 {
4082 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
4083 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4084 }
4085 }
4086 }
4087 if(!psessionEntry->gLimOlbcParams.protectionEnabled &&
4088 !psessionEntry->gLim11bParams.protectionEnabled)
4089 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004090 PELOGE(limLog(pMac, LOGE, FL("===> 11G Protection Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004091 pBeaconParams->llbCoexist = psessionEntry->beaconParams.llbCoexist = false;
4092 pBeaconParams->paramChangeBitmap |= PARAM_llBCOEXIST_CHANGED;
4093 }
4094 }else if(eLIM_BT_AMP_AP_ROLE == psessionEntry->limSystemRole)
Jeff Johnson295189b2012-06-20 16:38:30 -07004095 {
4096 if(overlap)
4097 {
4098 //Overlap Legacy protection disabled.
4099 psessionEntry->gLimOlbcParams.protectionEnabled = false;
4100
4101 //We need to take care of HT OP mode iff we are HT AP.
Jeff Johnsone7245742012-09-05 17:12:55 -07004102 if(psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07004103 {
4104 // no HT op mode change if any of the overlap protection enabled.
4105 if(!(pMac->lim.gLimOverlap11gParams.protectionEnabled ||
4106 pMac->lim.gLimOverlapHt20Params.protectionEnabled ||
4107 pMac->lim.gLimOverlapNonGfParams.protectionEnabled))
4108
4109 {
4110 //Check if there is a need to change HT OP mode.
4111 if(eSIR_HT_OP_MODE_OVERLAP_LEGACY == pMac->lim.gHTOperMode)
4112 {
4113 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4114 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4115 if(psessionEntry->gLimHt20Params.protectionEnabled)
4116 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4117 else
4118 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_PURE;
4119 }
4120 }
4121 }
4122 }
4123 else
4124 {
4125 //Disable protection from 11B stations.
4126 psessionEntry->gLim11bParams.protectionEnabled = false;
4127 //Check if any other non-HT protection enabled.
4128 if(!psessionEntry->gLim11gParams.protectionEnabled)
4129 {
4130 //Right now we are in HT OP Mixed mode.
4131 //Change HT op mode appropriately.
4132 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4133
4134 //Change HT OP mode to 01 if any overlap protection enabled
4135 if(psessionEntry->gLimOlbcParams.protectionEnabled ||
4136 pMac->lim.gLimOverlap11gParams.protectionEnabled ||
4137 pMac->lim.gLimOverlapHt20Params.protectionEnabled ||
4138 pMac->lim.gLimOverlapNonGfParams.protectionEnabled)
4139
4140 {
4141 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
4142 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4143 }
4144 else if(psessionEntry->gLimHt20Params.protectionEnabled)
4145 {
4146 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4147 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4148 }
4149 else
4150 {
4151 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_PURE;
4152 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4153 }
4154 }
4155 }
4156 if(!psessionEntry->gLimOlbcParams.protectionEnabled &&
4157 !psessionEntry->gLim11bParams.protectionEnabled)
4158 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004159 PELOG1(limLog(pMac, LOG1, FL("===> 11G Protection Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004160 pBeaconParams->llbCoexist = psessionEntry->beaconParams.llbCoexist = false;
4161 pBeaconParams->paramChangeBitmap |= PARAM_llBCOEXIST_CHANGED;
4162 }
4163 }
4164 //for station role
4165 else
4166 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004167 PELOG1(limLog(pMac, LOG1, FL("===> 11G Protection Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004168 pBeaconParams->llbCoexist = psessionEntry->beaconParams.llbCoexist = false;
4169 pBeaconParams->paramChangeBitmap |= PARAM_llBCOEXIST_CHANGED;
4170 }
4171 }
4172 return eSIR_SUCCESS;
4173}
4174
4175/** -------------------------------------------------------------
4176\fn limEnableHtProtectionFrom11g
4177\brief based on cofig enables\disables protection from 11g.
4178\param tANI_U8 enable : 1=> enable protection, 0=> disable protection.
4179\param tANI_U8 overlap: 1=> called from overlap context, 0 => called from assoc context.
4180\param tpUpdateBeaconParams pBeaconParams
4181\return None
4182 -------------------------------------------------------------*/
4183tSirRetStatus
4184limEnableHtProtectionFrom11g(tpAniSirGlobal pMac, tANI_U8 enable,
4185 tANI_U8 overlap, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry)
4186{
Jeff Johnsone7245742012-09-05 17:12:55 -07004187 if(!psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07004188 return eSIR_SUCCESS; // protection from 11g is only for HT stations.
4189
4190 //overlapping protection configuration check.
4191 if(overlap)
4192 {
Jeff Johnson295189b2012-06-20 16:38:30 -07004193 if((psessionEntry->limSystemRole == eLIM_AP_ROLE ) && (!psessionEntry->cfgProtection.overlapFromllg))
4194 {
4195 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004196 PELOG3(limLog(pMac, LOG3, FL("overlap protection from 11g is disabled")););
Jeff Johnson295189b2012-06-20 16:38:30 -07004197 return eSIR_SUCCESS;
4198 }else if ((psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE) && (!pMac->lim.cfgProtection.overlapFromllg))
Jeff Johnson295189b2012-06-20 16:38:30 -07004199 {
4200 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004201 PELOG3(limLog(pMac, LOG3, FL("overlap protection from 11g is disabled")););
Jeff Johnson295189b2012-06-20 16:38:30 -07004202 return eSIR_SUCCESS;
4203 }
4204 }
4205 else
4206 {
4207 //normal protection config check
Jeff Johnson295189b2012-06-20 16:38:30 -07004208 if((psessionEntry->limSystemRole == eLIM_AP_ROLE ) &&
4209 !psessionEntry->cfgProtection.fromllg){
4210 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004211 PELOG3(limLog(pMac, LOG3, FL("protection from 11g is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004212 return eSIR_SUCCESS;
4213 }else if(psessionEntry->limSystemRole != eLIM_AP_ROLE )
Jeff Johnson295189b2012-06-20 16:38:30 -07004214 {
4215 if(!pMac->lim.cfgProtection.fromllg)
4216 {
4217 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004218 PELOG3(limLog(pMac, LOG3, FL("protection from 11g is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004219 return eSIR_SUCCESS;
4220 }
4221 }
4222 }
4223 if (enable)
4224 {
4225 //If we are AP and HT capable, we need to set the HT OP mode
4226 //appropriately.
4227
Jeff Johnson295189b2012-06-20 16:38:30 -07004228 if(eLIM_AP_ROLE == psessionEntry->limSystemRole)
4229 {
4230 if(overlap)
4231 {
4232 psessionEntry->gLimOverlap11gParams.protectionEnabled = true;
4233 //11g exists in overlap BSS.
4234 //need not to change the operating mode to overlap_legacy
4235 //if higher or same protection operating mode is enabled right now.
4236 if((eSIR_HT_OP_MODE_OVERLAP_LEGACY != psessionEntry->htOperMode) &&
4237 (eSIR_HT_OP_MODE_MIXED != psessionEntry->htOperMode))
4238 {
4239 psessionEntry->htOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
4240 }
4241 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4242 limEnableHtOBSSProtection(pMac, true , overlap, pBeaconParams, psessionEntry);
4243 }
4244 else
4245 {
4246 //11g is associated to an AP operating in 11n mode.
4247 //Change the HT operating mode to 'mixed mode'.
4248 psessionEntry->gLim11gParams.protectionEnabled = true;
4249 if(eSIR_HT_OP_MODE_MIXED != psessionEntry->htOperMode)
4250 {
4251 psessionEntry->htOperMode = eSIR_HT_OP_MODE_MIXED;
4252 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4253 limEnableHtOBSSProtection(pMac, true , overlap, pBeaconParams,psessionEntry);
4254 }
4255 }
4256 }else if(eLIM_BT_AMP_AP_ROLE == psessionEntry->limSystemRole)
Jeff Johnson295189b2012-06-20 16:38:30 -07004257 {
4258 if(overlap)
4259 {
4260 pMac->lim.gLimOverlap11gParams.protectionEnabled = true;
4261 //11g exists in overlap BSS.
4262 //need not to change the operating mode to overlap_legacy
4263 //if higher or same protection operating mode is enabled right now.
4264 if((eSIR_HT_OP_MODE_OVERLAP_LEGACY != pMac->lim.gHTOperMode) &&
4265 (eSIR_HT_OP_MODE_MIXED != pMac->lim.gHTOperMode))
4266 {
4267 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
4268 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4269 }
4270 }
4271 else
4272 {
4273 //11g is associated to an AP operating in 11n mode.
4274 //Change the HT operating mode to 'mixed mode'.
4275 psessionEntry->gLim11gParams.protectionEnabled = true;
4276 if(eSIR_HT_OP_MODE_MIXED != pMac->lim.gHTOperMode)
4277 {
4278 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_MIXED;
4279 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4280 limEnableHtOBSSProtection(pMac, true , overlap, pBeaconParams,psessionEntry);
4281 }
4282 }
4283 }
4284
4285 //This part is common for staiton as well.
4286 if(false == psessionEntry->beaconParams.llgCoexist)
4287 {
4288 pBeaconParams->llgCoexist = psessionEntry->beaconParams.llgCoexist = true;
4289 pBeaconParams->paramChangeBitmap |= PARAM_llGCOEXIST_CHANGED;
4290 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004291 else if (true == psessionEntry->gLimOverlap11gParams.protectionEnabled)
4292 {
4293 // As operating mode changed after G station assoc some way to update beacon
4294 // This addresses the issue of mode not changing to - 11 in beacon when OBSS overlap is enabled
4295 //pMac->sch.schObject.fBeaconChanged = 1;
4296 pBeaconParams->paramChangeBitmap |= PARAM_llGCOEXIST_CHANGED;
4297 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004298 }
4299 else if (true == psessionEntry->beaconParams.llgCoexist)
4300 {
4301 //for AP role.
4302 //we need to take care of HT OP mode change if needed.
4303 //We need to take care of Overlap cases.
4304
Jeff Johnson295189b2012-06-20 16:38:30 -07004305 if(eLIM_AP_ROLE == psessionEntry->limSystemRole)
4306 {
4307 if(overlap)
4308 {
4309 //Overlap Legacy protection disabled.
4310 if (psessionEntry->gLim11gParams.numSta == 0)
4311 psessionEntry->gLimOverlap11gParams.protectionEnabled = false;
4312
4313 // no HT op mode change if any of the overlap protection enabled.
4314 if(!(psessionEntry->gLimOlbcParams.protectionEnabled ||
4315 psessionEntry->gLimOverlapHt20Params.protectionEnabled ||
4316 psessionEntry->gLimOverlapNonGfParams.protectionEnabled))
4317 {
4318 //Check if there is a need to change HT OP mode.
4319 if(eSIR_HT_OP_MODE_OVERLAP_LEGACY == psessionEntry->htOperMode)
4320 {
4321 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4322 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4323
4324 if(psessionEntry->gLimHt20Params.protectionEnabled){
4325 //Commenting because of CR 258588 WFA cert
4326 //psessionEntry->htOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4327 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
4328 }
4329 else
4330 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
4331 }
4332 }
4333 }
4334 else
4335 {
4336 //Disable protection from 11G stations.
4337 psessionEntry->gLim11gParams.protectionEnabled = false;
4338 //Check if any other non-HT protection enabled.
4339 if(!psessionEntry->gLim11bParams.protectionEnabled)
4340 {
4341
4342 //Right now we are in HT OP Mixed mode.
4343 //Change HT op mode appropriately.
4344 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4345
4346 //Change HT OP mode to 01 if any overlap protection enabled
4347 if(psessionEntry->gLimOlbcParams.protectionEnabled ||
4348 psessionEntry->gLimOverlap11gParams.protectionEnabled ||
4349 psessionEntry->gLimOverlapHt20Params.protectionEnabled ||
4350 psessionEntry->gLimOverlapNonGfParams.protectionEnabled)
4351
4352 {
4353 psessionEntry->htOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
4354 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4355 }
4356 else if(psessionEntry->gLimHt20Params.protectionEnabled)
4357 {
4358 //Commenting because of CR 258588 WFA cert
4359 //psessionEntry->htOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4360 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
4361 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4362 }
4363 else
4364 {
4365 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
4366 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4367 }
4368 }
4369 }
4370 if(!psessionEntry->gLimOverlap11gParams.protectionEnabled &&
4371 !psessionEntry->gLim11gParams.protectionEnabled)
4372 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004373 PELOG1(limLog(pMac, LOG1, FL("===> Protection from 11G Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004374 pBeaconParams->llgCoexist = psessionEntry->beaconParams.llgCoexist = false;
4375 pBeaconParams->paramChangeBitmap |= PARAM_llGCOEXIST_CHANGED;
4376 }
4377 }else if(eLIM_BT_AMP_AP_ROLE == psessionEntry->limSystemRole)
Jeff Johnson295189b2012-06-20 16:38:30 -07004378 {
4379 if(overlap)
4380 {
4381 //Overlap Legacy protection disabled.
4382 pMac->lim.gLimOverlap11gParams.protectionEnabled = false;
4383
4384 // no HT op mode change if any of the overlap protection enabled.
4385 if(!(psessionEntry->gLimOlbcParams.protectionEnabled ||
4386 psessionEntry->gLimOverlapHt20Params.protectionEnabled ||
4387 psessionEntry->gLimOverlapNonGfParams.protectionEnabled))
4388 {
4389 //Check if there is a need to change HT OP mode.
4390 if(eSIR_HT_OP_MODE_OVERLAP_LEGACY == pMac->lim.gHTOperMode)
4391 {
4392 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4393 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4394
4395 if(psessionEntry->gLimHt20Params.protectionEnabled)
4396 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4397 else
4398 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_PURE;
4399 }
4400 }
4401 }
4402 else
4403 {
4404 //Disable protection from 11G stations.
4405 psessionEntry->gLim11gParams.protectionEnabled = false;
4406 //Check if any other non-HT protection enabled.
4407 if(!psessionEntry->gLim11bParams.protectionEnabled)
4408 {
4409
4410 //Right now we are in HT OP Mixed mode.
4411 //Change HT op mode appropriately.
4412 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4413
4414 //Change HT OP mode to 01 if any overlap protection enabled
4415 if(psessionEntry->gLimOlbcParams.protectionEnabled ||
4416 pMac->lim.gLimOverlap11gParams.protectionEnabled ||
4417 pMac->lim.gLimOverlapHt20Params.protectionEnabled ||
4418 pMac->lim.gLimOverlapNonGfParams.protectionEnabled)
4419
4420 {
4421 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
4422 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4423 }
4424 else if(psessionEntry->gLimHt20Params.protectionEnabled)
4425 {
4426 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4427 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4428 }
4429 else
4430 {
4431 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_PURE;
4432 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4433 }
4434 }
4435 }
4436 if(!pMac->lim.gLimOverlap11gParams.protectionEnabled &&
4437 !psessionEntry->gLim11gParams.protectionEnabled)
4438 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004439 PELOG1(limLog(pMac, LOG1, FL("===> Protection from 11G Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004440 pBeaconParams->llgCoexist = psessionEntry->beaconParams.llgCoexist = false;
4441 pBeaconParams->paramChangeBitmap |= PARAM_llGCOEXIST_CHANGED;
4442 }
4443 }
4444 //for station role
4445 else
4446 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004447 PELOG1(limLog(pMac, LOG1, FL("===> Protection from 11G Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004448 pBeaconParams->llgCoexist = psessionEntry->beaconParams.llgCoexist = false;
4449 pBeaconParams->paramChangeBitmap |= PARAM_llGCOEXIST_CHANGED;
4450 }
4451 }
4452 return eSIR_SUCCESS;
4453}
4454//FIXME_PROTECTION : need to check for no APSD whenever we want to enable this protection.
4455//This check will be done at the caller.
4456
4457/** -------------------------------------------------------------
4458\fn limEnableHtObssProtection
4459\brief based on cofig enables\disables obss protection.
4460\param tANI_U8 enable : 1=> enable protection, 0=> disable protection.
4461\param tANI_U8 overlap: 1=> called from overlap context, 0 => called from assoc context.
4462\param tpUpdateBeaconParams pBeaconParams
4463\return None
4464 -------------------------------------------------------------*/
4465tSirRetStatus
4466limEnableHtOBSSProtection(tpAniSirGlobal pMac, tANI_U8 enable,
4467 tANI_U8 overlap, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry)
4468{
4469
4470
Jeff Johnsone7245742012-09-05 17:12:55 -07004471 if(!psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07004472 return eSIR_SUCCESS; // this protection is only for HT stations.
4473
4474 //overlapping protection configuration check.
4475 if(overlap)
4476 {
4477 //overlapping protection configuration check.
Jeff Johnson295189b2012-06-20 16:38:30 -07004478 }
4479 else
4480 {
4481 //normal protection config check
Jeff Johnson295189b2012-06-20 16:38:30 -07004482 if((psessionEntry->limSystemRole == eLIM_AP_ROLE) && !psessionEntry->cfgProtection.obss)
4483 { //ToDo Update this field
4484 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004485 PELOG1(limLog(pMac, LOG1, FL("protection from Obss is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004486 return eSIR_SUCCESS;
4487 }else if(psessionEntry->limSystemRole != eLIM_AP_ROLE)
Jeff Johnson295189b2012-06-20 16:38:30 -07004488 {
4489 if(!pMac->lim.cfgProtection.obss)
4490 { //ToDo Update this field
4491 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004492 PELOG1(limLog(pMac, LOG1, FL("protection from Obss is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004493 return eSIR_SUCCESS;
4494 }
4495 }
4496 }
4497
4498
Jeff Johnson295189b2012-06-20 16:38:30 -07004499 if (eLIM_AP_ROLE == psessionEntry->limSystemRole){
4500 if ((enable) && (false == psessionEntry->beaconParams.gHTObssMode) )
4501 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004502 PELOG1(limLog(pMac, LOG1, FL("=>obss protection enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004503 psessionEntry->beaconParams.gHTObssMode = true;
4504 pBeaconParams->paramChangeBitmap |= PARAM_OBSS_MODE_CHANGED; // UPDATE AN ENUM FOR OBSS MODE <todo>
4505
4506 }
4507 else if (!enable && (true == psessionEntry->beaconParams.gHTObssMode))
4508 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004509 PELOG1(limLog(pMac, LOG1, FL("===> obss Protection disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004510 psessionEntry->beaconParams.gHTObssMode = false;
4511 pBeaconParams->paramChangeBitmap |= PARAM_OBSS_MODE_CHANGED;
4512
4513 }
4514//CR-263021: OBSS bit is not switching back to 0 after disabling the overlapping legacy BSS
4515 if (!enable && !overlap)
4516 {
4517 psessionEntry->gLimOverlap11gParams.protectionEnabled = false;
4518 }
4519 } else
Jeff Johnson295189b2012-06-20 16:38:30 -07004520 {
4521 if ((enable) && (false == psessionEntry->beaconParams.gHTObssMode) )
4522 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004523 PELOG1(limLog(pMac, LOG1, FL("=>obss protection enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004524 psessionEntry->beaconParams.gHTObssMode = true;
4525 pBeaconParams->paramChangeBitmap |= PARAM_OBSS_MODE_CHANGED; // UPDATE AN ENUM FOR OBSS MODE <todo>
4526
4527 }
4528 else if (!enable && (true == psessionEntry->beaconParams.gHTObssMode))
4529 {
4530
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004531 PELOG1(limLog(pMac, LOG1, FL("===> obss Protection disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004532 psessionEntry->beaconParams.gHTObssMode = false;
4533 pBeaconParams->paramChangeBitmap |= PARAM_OBSS_MODE_CHANGED;
4534
4535 }
4536 }
4537 return eSIR_SUCCESS;
4538}
4539/** -------------------------------------------------------------
4540\fn limEnableHT20Protection
4541\brief based on cofig enables\disables protection from Ht20.
4542\param tANI_U8 enable : 1=> enable protection, 0=> disable protection.
4543\param tANI_U8 overlap: 1=> called from overlap context, 0 => called from assoc context.
4544\param tpUpdateBeaconParams pBeaconParams
4545\return None
4546 -------------------------------------------------------------*/
4547tSirRetStatus
4548limEnableHT20Protection(tpAniSirGlobal pMac, tANI_U8 enable,
4549 tANI_U8 overlap, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry)
4550{
Jeff Johnsone7245742012-09-05 17:12:55 -07004551 if(!psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07004552 return eSIR_SUCCESS; // this protection is only for HT stations.
4553
4554 //overlapping protection configuration check.
4555 if(overlap)
4556 {
Jeff Johnson295189b2012-06-20 16:38:30 -07004557 }
4558 else
4559 {
4560 //normal protection config check
Jeff Johnson295189b2012-06-20 16:38:30 -07004561 if((psessionEntry->limSystemRole == eLIM_AP_ROLE ) &&
4562 !psessionEntry->cfgProtection.ht20)
4563 {
4564 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004565 PELOG3(limLog(pMac, LOG3, FL("protection from HT20 is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004566 return eSIR_SUCCESS;
4567 }else if(psessionEntry->limSystemRole != eLIM_AP_ROLE )
Jeff Johnson295189b2012-06-20 16:38:30 -07004568 {
4569 if(!pMac->lim.cfgProtection.ht20)
4570 {
4571 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004572 PELOG3(limLog(pMac, LOG3, FL("protection from HT20 is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004573 return eSIR_SUCCESS;
4574 }
4575 }
4576 }
4577
4578 if (enable)
4579 {
4580 //If we are AP and HT capable, we need to set the HT OP mode
4581 //appropriately.
4582
Jeff Johnson295189b2012-06-20 16:38:30 -07004583 if(eLIM_AP_ROLE == psessionEntry->limSystemRole){
4584 if(overlap)
4585 {
4586 psessionEntry->gLimOverlapHt20Params.protectionEnabled = true;
4587 if((eSIR_HT_OP_MODE_OVERLAP_LEGACY != psessionEntry->htOperMode) &&
4588 (eSIR_HT_OP_MODE_MIXED != psessionEntry->htOperMode))
4589 {
4590 psessionEntry->htOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
4591 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4592 }
4593 }
4594 else
4595 {
4596 psessionEntry->gLimHt20Params.protectionEnabled = true;
4597 if(eSIR_HT_OP_MODE_PURE == psessionEntry->htOperMode)
4598 {
4599 //Commenting because of CR 258588 WFA cert
4600 //psessionEntry->htOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4601 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
4602 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4603 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4604 }
4605 }
4606 }else if(eLIM_BT_AMP_AP_ROLE == psessionEntry->limSystemRole)
Jeff Johnson295189b2012-06-20 16:38:30 -07004607 {
4608 if(overlap)
4609 {
4610 pMac->lim.gLimOverlapHt20Params.protectionEnabled = true;
4611 if((eSIR_HT_OP_MODE_OVERLAP_LEGACY != pMac->lim.gHTOperMode) &&
4612 (eSIR_HT_OP_MODE_MIXED != pMac->lim.gHTOperMode))
4613 {
4614 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
4615 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4616 }
4617 }
4618 else
4619 {
4620 psessionEntry->gLimHt20Params.protectionEnabled = true;
4621 if(eSIR_HT_OP_MODE_PURE == pMac->lim.gHTOperMode)
4622 {
4623 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4624 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4625 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4626 }
4627 }
4628 }
4629
4630 //This part is common for staiton as well.
4631 if(false == psessionEntry->beaconParams.ht20Coexist)
4632 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004633 PELOG1(limLog(pMac, LOG1, FL("=> Prtection from HT20 Enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004634 pBeaconParams->ht20MhzCoexist = psessionEntry->beaconParams.ht20Coexist = true;
4635 pBeaconParams->paramChangeBitmap |= PARAM_HT20MHZCOEXIST_CHANGED;
4636 }
4637 }
4638 else if (true == psessionEntry->beaconParams.ht20Coexist)
4639 {
4640 //for AP role.
4641 //we need to take care of HT OP mode change if needed.
4642 //We need to take care of Overlap cases.
Jeff Johnson295189b2012-06-20 16:38:30 -07004643 if(eLIM_AP_ROLE == psessionEntry->limSystemRole){
4644 if(overlap)
4645 {
4646 //Overlap Legacy protection disabled.
4647 psessionEntry->gLimOverlapHt20Params.protectionEnabled = false;
4648
4649 // no HT op mode change if any of the overlap protection enabled.
4650 if(!(psessionEntry->gLimOlbcParams.protectionEnabled ||
4651 psessionEntry->gLimOverlap11gParams.protectionEnabled ||
4652 psessionEntry->gLimOverlapHt20Params.protectionEnabled ||
4653 psessionEntry->gLimOverlapNonGfParams.protectionEnabled))
4654 {
4655
4656 //Check if there is a need to change HT OP mode.
4657 if(eSIR_HT_OP_MODE_OVERLAP_LEGACY == psessionEntry->htOperMode)
4658 {
4659 if(psessionEntry->gLimHt20Params.protectionEnabled)
4660 {
4661 //Commented beacuse of CR 258588 for WFA Cert
4662 //psessionEntry->htOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4663 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
4664 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4665 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4666 }
4667 else
4668 {
4669 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
4670 }
4671 }
4672 }
4673 }
4674 else
4675 {
4676 //Disable protection from 11G stations.
4677 psessionEntry->gLimHt20Params.protectionEnabled = false;
4678
4679 //Change HT op mode appropriately.
4680 if(eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT == psessionEntry->htOperMode)
4681 {
4682 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
4683 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4684 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4685 }
4686 }
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004687 PELOG1(limLog(pMac, LOG1, FL("===> Protection from HT 20 Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004688 pBeaconParams->ht20MhzCoexist = psessionEntry->beaconParams.ht20Coexist = false;
4689 pBeaconParams->paramChangeBitmap |= PARAM_HT20MHZCOEXIST_CHANGED;
4690 }else if(eLIM_BT_AMP_AP_ROLE == psessionEntry->limSystemRole)
Jeff Johnson295189b2012-06-20 16:38:30 -07004691 {
4692 if(overlap)
4693 {
4694 //Overlap Legacy protection disabled.
4695 pMac->lim.gLimOverlapHt20Params.protectionEnabled = false;
4696
4697 // no HT op mode change if any of the overlap protection enabled.
4698 if(!(psessionEntry->gLimOlbcParams.protectionEnabled ||
4699 pMac->lim.gLimOverlap11gParams.protectionEnabled ||
4700 pMac->lim.gLimOverlapHt20Params.protectionEnabled ||
4701 pMac->lim.gLimOverlapNonGfParams.protectionEnabled))
4702 {
4703
4704 //Check if there is a need to change HT OP mode.
4705 if(eSIR_HT_OP_MODE_OVERLAP_LEGACY == pMac->lim.gHTOperMode)
4706 {
4707 if(psessionEntry->gLimHt20Params.protectionEnabled)
4708 {
4709 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4710 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4711 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4712 }
4713 else
4714 {
4715 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_PURE;
4716 }
4717 }
4718 }
4719 }
4720 else
4721 {
4722 //Disable protection from 11G stations.
4723 psessionEntry->gLimHt20Params.protectionEnabled = false;
4724
4725 //Change HT op mode appropriately.
4726 if(eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT == pMac->lim.gHTOperMode)
4727 {
4728 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_PURE;
4729 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4730 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4731 }
4732 }
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004733 PELOG1(limLog(pMac, LOG1, FL("===> Protection from HT 20 Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004734 pBeaconParams->ht20MhzCoexist = psessionEntry->beaconParams.ht20Coexist = false;
4735 pBeaconParams->paramChangeBitmap |= PARAM_HT20MHZCOEXIST_CHANGED;
4736 }
4737 //for station role
4738 else
4739 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004740 PELOG1(limLog(pMac, LOG1, FL("===> Protection from HT20 Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004741 pBeaconParams->ht20MhzCoexist = psessionEntry->beaconParams.ht20Coexist = false;
4742 pBeaconParams->paramChangeBitmap |= PARAM_HT20MHZCOEXIST_CHANGED;
4743 }
4744 }
4745
4746 return eSIR_SUCCESS;
4747}
4748
4749/** -------------------------------------------------------------
4750\fn limEnableHTNonGfProtection
4751\brief based on cofig enables\disables protection from NonGf.
4752\param tANI_U8 enable : 1=> enable protection, 0=> disable protection.
4753\param tANI_U8 overlap: 1=> called from overlap context, 0 => called from assoc context.
4754\param tpUpdateBeaconParams pBeaconParams
4755\return None
4756 -------------------------------------------------------------*/
4757tSirRetStatus
4758limEnableHTNonGfProtection(tpAniSirGlobal pMac, tANI_U8 enable,
4759 tANI_U8 overlap, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry)
4760{
Jeff Johnsone7245742012-09-05 17:12:55 -07004761 if(!psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07004762 return eSIR_SUCCESS; // this protection is only for HT stations.
4763
4764 //overlapping protection configuration check.
4765 if(overlap)
4766 {
Jeff Johnson295189b2012-06-20 16:38:30 -07004767 }
4768 else
4769 {
Jeff Johnson295189b2012-06-20 16:38:30 -07004770 //normal protection config check
4771 if((psessionEntry->limSystemRole == eLIM_AP_ROLE ) &&
4772 !psessionEntry->cfgProtection.nonGf)
4773 {
4774 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004775 PELOG3(limLog(pMac, LOG3, FL("protection from NonGf is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004776 return eSIR_SUCCESS;
4777 }else if(psessionEntry->limSystemRole != eLIM_AP_ROLE)
Jeff Johnson295189b2012-06-20 16:38:30 -07004778 {
4779 //normal protection config check
4780 if(!pMac->lim.cfgProtection.nonGf)
4781 {
4782 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004783 PELOG3(limLog(pMac, LOG3, FL("protection from NonGf is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004784 return eSIR_SUCCESS;
4785 }
4786 }
4787 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004788 if(psessionEntry->limSystemRole == eLIM_AP_ROLE){
4789 if ((enable) && (false == psessionEntry->beaconParams.llnNonGFCoexist))
4790 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004791 PELOG1(limLog(pMac, LOG1, FL(" => Prtection from non GF Enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004792 pBeaconParams->llnNonGFCoexist = psessionEntry->beaconParams.llnNonGFCoexist = true;
4793 pBeaconParams->paramChangeBitmap |= PARAM_NON_GF_DEVICES_PRESENT_CHANGED;
4794 }
4795 else if (!enable && (true == psessionEntry->beaconParams.llnNonGFCoexist))
4796 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004797 PELOG1(limLog(pMac, LOG1, FL("===> Protection from Non GF Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004798 pBeaconParams->llnNonGFCoexist = psessionEntry->beaconParams.llnNonGFCoexist = false;
4799 pBeaconParams->paramChangeBitmap |= PARAM_NON_GF_DEVICES_PRESENT_CHANGED;
4800 }
4801 }else
Jeff Johnson295189b2012-06-20 16:38:30 -07004802 {
4803 if ((enable) && (false == psessionEntry->beaconParams.llnNonGFCoexist))
4804 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004805 PELOG1(limLog(pMac, LOG1, FL(" => Prtection from non GF Enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004806 pBeaconParams->llnNonGFCoexist = psessionEntry->beaconParams.llnNonGFCoexist = true;
4807 pBeaconParams->paramChangeBitmap |= PARAM_NON_GF_DEVICES_PRESENT_CHANGED;
4808 }
4809 else if (!enable && (true == psessionEntry->beaconParams.llnNonGFCoexist))
4810 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004811 PELOG1(limLog(pMac, LOG1, FL("===> Protection from Non GF Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004812 pBeaconParams->llnNonGFCoexist = psessionEntry->beaconParams.llnNonGFCoexist = false;
4813 pBeaconParams->paramChangeBitmap |= PARAM_NON_GF_DEVICES_PRESENT_CHANGED;
4814 }
4815 }
4816
4817 return eSIR_SUCCESS;
4818}
4819
4820/** -------------------------------------------------------------
4821\fn limEnableHTLsigTxopProtection
4822\brief based on cofig enables\disables LsigTxop protection.
4823\param tANI_U8 enable : 1=> enable protection, 0=> disable protection.
4824\param tANI_U8 overlap: 1=> called from overlap context, 0 => called from assoc context.
4825\param tpUpdateBeaconParams pBeaconParams
4826\return None
4827 -------------------------------------------------------------*/
4828tSirRetStatus
4829limEnableHTLsigTxopProtection(tpAniSirGlobal pMac, tANI_U8 enable,
4830 tANI_U8 overlap, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry)
4831{
Jeff Johnsone7245742012-09-05 17:12:55 -07004832 if(!psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07004833 return eSIR_SUCCESS; // this protection is only for HT stations.
4834
4835 //overlapping protection configuration check.
4836 if(overlap)
4837 {
Jeff Johnson295189b2012-06-20 16:38:30 -07004838 }
4839 else
4840 {
Jeff Johnson295189b2012-06-20 16:38:30 -07004841 //normal protection config check
4842 if((psessionEntry->limSystemRole == eLIM_AP_ROLE ) &&
4843 !psessionEntry->cfgProtection.lsigTxop)
4844 {
4845 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004846 PELOG3(limLog(pMac, LOG3, FL(" protection from LsigTxop not supported is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004847 return eSIR_SUCCESS;
4848 }else if(psessionEntry->limSystemRole != eLIM_AP_ROLE)
Jeff Johnson295189b2012-06-20 16:38:30 -07004849 {
4850 //normal protection config check
4851 if(!pMac->lim.cfgProtection.lsigTxop)
4852 {
4853 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004854 PELOG3(limLog(pMac, LOG3, FL(" protection from LsigTxop not supported is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004855 return eSIR_SUCCESS;
4856 }
4857 }
4858 }
4859
4860
Jeff Johnson295189b2012-06-20 16:38:30 -07004861 if(psessionEntry->limSystemRole == eLIM_AP_ROLE){
4862 if ((enable) && (false == psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport))
4863 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004864 PELOG1(limLog(pMac, LOG1, FL(" => Prtection from LsigTxop Enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004865 pBeaconParams->fLsigTXOPProtectionFullSupport = psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport = true;
4866 pBeaconParams->paramChangeBitmap |= PARAM_LSIG_TXOP_FULL_SUPPORT_CHANGED;
4867 }
4868 else if (!enable && (true == psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport))
4869 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004870 PELOG1(limLog(pMac, LOG1, FL("===> Protection from LsigTxop Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004871 pBeaconParams->fLsigTXOPProtectionFullSupport= psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport = false;
4872 pBeaconParams->paramChangeBitmap |= PARAM_LSIG_TXOP_FULL_SUPPORT_CHANGED;
4873 }
4874 }else
Jeff Johnson295189b2012-06-20 16:38:30 -07004875 {
4876 if ((enable) && (false == psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport))
4877 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004878 PELOG1(limLog(pMac, LOG1, FL(" => Prtection from LsigTxop Enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004879 pBeaconParams->fLsigTXOPProtectionFullSupport = psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport = true;
4880 pBeaconParams->paramChangeBitmap |= PARAM_LSIG_TXOP_FULL_SUPPORT_CHANGED;
4881 }
4882 else if (!enable && (true == psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport))
4883 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004884 PELOG1(limLog(pMac, LOG1, FL("===> Protection from LsigTxop Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004885 pBeaconParams->fLsigTXOPProtectionFullSupport= psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport = false;
4886 pBeaconParams->paramChangeBitmap |= PARAM_LSIG_TXOP_FULL_SUPPORT_CHANGED;
4887 }
4888 }
4889 return eSIR_SUCCESS;
4890}
4891//FIXME_PROTECTION : need to check for no APSD whenever we want to enable this protection.
4892//This check will be done at the caller.
4893/** -------------------------------------------------------------
4894\fn limEnableHtRifsProtection
4895\brief based on cofig enables\disables Rifs protection.
4896\param tANI_U8 enable : 1=> enable protection, 0=> disable protection.
4897\param tANI_U8 overlap: 1=> called from overlap context, 0 => called from assoc context.
4898\param tpUpdateBeaconParams pBeaconParams
4899\return None
4900 -------------------------------------------------------------*/
4901tSirRetStatus
4902limEnableHtRifsProtection(tpAniSirGlobal pMac, tANI_U8 enable,
4903 tANI_U8 overlap, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry)
4904{
Jeff Johnsone7245742012-09-05 17:12:55 -07004905 if(!psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07004906 return eSIR_SUCCESS; // this protection is only for HT stations.
4907
4908
4909 //overlapping protection configuration check.
4910 if(overlap)
4911 {
Jeff Johnson295189b2012-06-20 16:38:30 -07004912 }
4913 else
4914 {
Jeff Johnson295189b2012-06-20 16:38:30 -07004915 //normal protection config check
4916 if((psessionEntry->limSystemRole == eLIM_AP_ROLE) &&
4917 !psessionEntry->cfgProtection.rifs)
4918 {
4919 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004920 PELOG3(limLog(pMac, LOG3, FL(" protection from Rifs is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004921 return eSIR_SUCCESS;
4922 }else if(psessionEntry->limSystemRole != eLIM_AP_ROLE )
Jeff Johnson295189b2012-06-20 16:38:30 -07004923 {
4924 //normal protection config check
4925 if(!pMac->lim.cfgProtection.rifs)
4926 {
4927 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004928 PELOG3(limLog(pMac, LOG3, FL(" protection from Rifs is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004929 return eSIR_SUCCESS;
4930 }
4931 }
4932 }
4933
Jeff Johnson295189b2012-06-20 16:38:30 -07004934 if(psessionEntry->limSystemRole == eLIM_AP_ROLE){
4935 // Disabling the RIFS Protection means Enable the RIFS mode of operation in the BSS
4936 if ((!enable) && (false == psessionEntry->beaconParams.fRIFSMode))
4937 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004938 PELOG1(limLog(pMac, LOG1, FL(" => Rifs protection Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004939 pBeaconParams->fRIFSMode = psessionEntry->beaconParams.fRIFSMode = true;
4940 pBeaconParams->paramChangeBitmap |= PARAM_RIFS_MODE_CHANGED;
4941 }
4942 // Enabling the RIFS Protection means Disable the RIFS mode of operation in the BSS
4943 else if (enable && (true == psessionEntry->beaconParams.fRIFSMode))
4944 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004945 PELOG1(limLog(pMac, LOG1, FL("===> Rifs Protection Enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004946 pBeaconParams->fRIFSMode = psessionEntry->beaconParams.fRIFSMode = false;
4947 pBeaconParams->paramChangeBitmap |= PARAM_RIFS_MODE_CHANGED;
4948 }
4949 }else
Jeff Johnson295189b2012-06-20 16:38:30 -07004950 {
4951 // Disabling the RIFS Protection means Enable the RIFS mode of operation in the BSS
4952 if ((!enable) && (false == psessionEntry->beaconParams.fRIFSMode))
4953 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004954 PELOG1(limLog(pMac, LOG1, FL(" => Rifs protection Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004955 pBeaconParams->fRIFSMode = psessionEntry->beaconParams.fRIFSMode = true;
4956 pBeaconParams->paramChangeBitmap |= PARAM_RIFS_MODE_CHANGED;
4957 }
4958 // Enabling the RIFS Protection means Disable the RIFS mode of operation in the BSS
4959 else if (enable && (true == psessionEntry->beaconParams.fRIFSMode))
4960 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004961 PELOG1(limLog(pMac, LOG1, FL("===> Rifs Protection Enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004962 pBeaconParams->fRIFSMode = psessionEntry->beaconParams.fRIFSMode = false;
4963 pBeaconParams->paramChangeBitmap |= PARAM_RIFS_MODE_CHANGED;
4964 }
4965 }
4966 return eSIR_SUCCESS;
4967}
4968
4969// ---------------------------------------------------------------------
4970/**
4971 * limEnableShortPreamble
4972 *
4973 * FUNCTION:
4974 * Enable/Disable short preamble
4975 *
4976 * LOGIC:
4977 *
4978 * ASSUMPTIONS:
4979 *
4980 * NOTE:
4981 *
4982 * @param enable Flag to enable/disable short preamble
4983 * @return None
4984 */
4985
4986tSirRetStatus
4987limEnableShortPreamble(tpAniSirGlobal pMac, tANI_U8 enable, tpUpdateBeaconParams pBeaconParams, tpPESession psessionEntry)
4988{
4989 tANI_U32 val;
4990
4991 if (wlan_cfgGetInt(pMac, WNI_CFG_SHORT_PREAMBLE, &val) != eSIR_SUCCESS)
4992 {
4993 /* Could not get short preamble enabled flag from CFG. Log error. */
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004994 limLog(pMac, LOGP, FL("could not retrieve short preamble flag"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004995 return eSIR_FAILURE;
4996 }
4997
4998 if (!val)
4999 return eSIR_SUCCESS;
5000
5001 if (wlan_cfgGetInt(pMac, WNI_CFG_11G_SHORT_PREAMBLE_ENABLED, &val) != eSIR_SUCCESS)
5002 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005003 limLog(pMac, LOGP, FL("could not retrieve 11G short preamble switching enabled flag"));
Jeff Johnson295189b2012-06-20 16:38:30 -07005004 return eSIR_FAILURE;
5005 }
5006
5007 if (!val) // 11G short preamble switching is disabled.
5008 return eSIR_SUCCESS;
5009
5010 if ( psessionEntry->limSystemRole == eLIM_AP_ROLE )
5011 {
5012 if (enable && (psessionEntry->beaconParams.fShortPreamble == 0))
5013 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005014 PELOG1(limLog(pMac, LOG1, FL("===> Short Preamble Enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005015 psessionEntry->beaconParams.fShortPreamble = true;
5016 pBeaconParams->fShortPreamble = (tANI_U8) psessionEntry->beaconParams.fShortPreamble;
5017 pBeaconParams->paramChangeBitmap |= PARAM_SHORT_PREAMBLE_CHANGED;
5018 }
5019 else if (!enable && (psessionEntry->beaconParams.fShortPreamble == 1))
5020 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005021 PELOG1(limLog(pMac, LOG1, FL("===> Short Preamble Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005022 psessionEntry->beaconParams.fShortPreamble = false;
5023 pBeaconParams->fShortPreamble = (tANI_U8) psessionEntry->beaconParams.fShortPreamble;
5024 pBeaconParams->paramChangeBitmap |= PARAM_SHORT_PREAMBLE_CHANGED;
5025 }
5026 }
5027
5028 return eSIR_SUCCESS;
5029 }
5030
5031/**
5032 * limTxComplete
5033 *
5034 * Function:
5035 * This is LIM's very own "TX MGMT frame complete" completion routine.
5036 *
5037 * Logic:
5038 * LIM wants to send a MGMT frame (broadcast or unicast)
5039 * LIM allocates memory using palPktAlloc( ..., **pData, **pPacket )
5040 * LIM transmits the MGMT frame using the API:
5041 * halTxFrame( ... pPacket, ..., (void *) limTxComplete, pData )
5042 * HDD, via halTxFrame/DXE, "transfers" the packet over to BMU
5043 * HDD, if it determines that a TX completion routine (in this case
5044 * limTxComplete) has been provided, will invoke this callback
5045 * LIM will try to free the TX MGMT packet that was earlier allocated, in order
5046 * to send this MGMT frame, using the PAL API palPktFree( ... pData, pPacket )
5047 *
5048 * Assumptions:
5049 * Presently, this is ONLY being used for MGMT frames/packets
5050 * TODO:
5051 * Would it do good for LIM to have some sort of "signature" validation to
5052 * ensure that the pData argument passed in was a buffer that was actually
5053 * allocated by LIM and/or is not corrupted?
5054 *
5055 * Note: FIXME and TODO
5056 * Looks like palPktFree() is interested in pPacket. But, when this completion
5057 * routine is called, only pData is made available to LIM!!
5058 *
5059 * @param void A pointer to pData. Shouldn't it be pPacket?!
5060 *
5061 * @return none
5062 */
5063void limTxComplete( tHalHandle hHal, void *pData )
5064{
5065 tpAniSirGlobal pMac;
5066 pMac = (tpAniSirGlobal)hHal;
5067
5068#ifdef FIXME_PRIMA
5069 /* the trace logic needs to be fixed for Prima. Refer to CR 306075 */
5070#ifdef TRACE_RECORD
5071 {
5072 tpSirMacMgmtHdr mHdr;
5073 v_U8_t *pRxBd;
5074 vos_pkt_t *pVosPkt;
5075 VOS_STATUS vosStatus;
5076
5077
5078
5079 pVosPkt = (vos_pkt_t *)pData;
5080 vosStatus = vos_pkt_peek_data( pVosPkt, 0, (v_PVOID_t *)&pRxBd, WLANHAL_RX_BD_HEADER_SIZE);
5081
5082 if(VOS_IS_STATUS_SUCCESS(vosStatus))
5083 {
5084 mHdr = WDA_GET_RX_MAC_HEADER(pRxBd);
Jeff Johnsone7245742012-09-05 17:12:55 -07005085 MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE, NO_SESSION, mHdr->fc.subType);)
Jeff Johnson295189b2012-06-20 16:38:30 -07005086
5087 }
5088 }
5089#endif
5090#endif
5091
5092 palPktFree( pMac->hHdd,
5093 HAL_TXRX_FRM_802_11_MGMT,
5094 (void *) NULL, // this is ignored and will likely be removed from this API
5095 (void *) pData ); // lim passed in pPacket in the pData pointer that is given in this completion routine
5096}
5097
5098/**
5099 * \brief This function updates lim global structure, if CB parameters in the BSS
5100 * have changed, and sends an indication to HAL also with the
5101 * updated HT Parameters.
5102 * This function does not detect the change in the primary channel, that is done as part
5103 * of channel Swtich IE processing.
5104 * If STA is configured with '20Mhz only' mode, then this function does not do anything
5105 * This function changes the CB mode, only if the self capability is set to '20 as well as 40Mhz'
5106 *
5107 *
5108 * \param pMac Pointer to global MAC structure
5109 *
5110 * \param pRcvdHTInfo Pointer to HT Info IE obtained from a Beacon or
5111 * Probe Response
5112 *
5113 * \param bssIdx BSS Index of the Bss to which Station is associated.
5114 *
5115 *
5116 */
5117
5118void limUpdateStaRunTimeHTSwitchChnlParams( tpAniSirGlobal pMac,
5119 tDot11fIEHTInfo *pHTInfo,
5120 tANI_U8 bssIdx,
5121 tpPESession psessionEntry)
5122{
Jeff Johnsone7245742012-09-05 17:12:55 -07005123 ePhyChanBondState secondaryChnlOffset = PHY_SINGLE_CHANNEL_CENTERED;
Jeff Johnson295189b2012-06-20 16:38:30 -07005124#if !defined WLAN_FEATURE_VOWIFI
5125 tANI_U32 localPwrConstraint;
5126#endif
5127
5128 //If self capability is set to '20Mhz only', then do not change the CB mode.
Jeff Johnson295189b2012-06-20 16:38:30 -07005129 if( !limGetHTCapability( pMac, eHT_SUPPORTED_CHANNEL_WIDTH_SET, psessionEntry ))
Jeff Johnson295189b2012-06-20 16:38:30 -07005130 return;
5131
5132#if !defined WLAN_FEATURE_VOWIFI
5133 if(wlan_cfgGetInt(pMac, WNI_CFG_LOCAL_POWER_CONSTRAINT, &localPwrConstraint) != eSIR_SUCCESS) {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005134 limLog( pMac, LOGP, FL( "Unable to get Local Power Constraint from cfg" ));
Jeff Johnson295189b2012-06-20 16:38:30 -07005135 return;
5136 }
5137#endif
5138
Jeff Johnsone7245742012-09-05 17:12:55 -07005139 if ( psessionEntry->htSecondaryChannelOffset != ( tANI_U8 ) pHTInfo->secondaryChannelOffset ||
5140 psessionEntry->htRecommendedTxWidthSet != ( tANI_U8 ) pHTInfo->recommendedTxWidthSet )
Jeff Johnson295189b2012-06-20 16:38:30 -07005141 {
Jeff Johnsone7245742012-09-05 17:12:55 -07005142 psessionEntry->htSecondaryChannelOffset = ( ePhyChanBondState ) pHTInfo->secondaryChannelOffset;
5143 psessionEntry->htRecommendedTxWidthSet = ( tANI_U8 ) pHTInfo->recommendedTxWidthSet;
5144 if ( eHT_CHANNEL_WIDTH_40MHZ == psessionEntry->htRecommendedTxWidthSet )
5145 secondaryChnlOffset = (ePhyChanBondState)pHTInfo->secondaryChannelOffset;
Jeff Johnson295189b2012-06-20 16:38:30 -07005146
5147 // Notify HAL
5148 limLog( pMac, LOGW, FL( "Channel Information in HT IE change"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005149 "d; sending notification to HAL." ) );
Jeff Johnson295189b2012-06-20 16:38:30 -07005150 limLog( pMac, LOGW, FL( "Primary Channel: %d, Secondary Chan"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005151 "nel Offset: %d, Channel Width: %d" ),
Jeff Johnson295189b2012-06-20 16:38:30 -07005152 pHTInfo->primaryChannel, secondaryChnlOffset,
Jeff Johnsone7245742012-09-05 17:12:55 -07005153 psessionEntry->htRecommendedTxWidthSet );
Madan Mohan Koyyalamudifd322a02012-10-05 12:01:26 -07005154 psessionEntry->channelChangeReasonCode=LIM_SWITCH_CHANNEL_OPERATION;
5155 pMac->lim.gpchangeChannelCallback = NULL;
5156 pMac->lim.gpchangeChannelData = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07005157
5158#if defined WLAN_FEATURE_VOWIFI
5159 limSendSwitchChnlParams( pMac, ( tANI_U8 ) pHTInfo->primaryChannel,
5160 secondaryChnlOffset, psessionEntry->maxTxPower, psessionEntry->peSessionId);
5161#else
5162 limSendSwitchChnlParams( pMac, ( tANI_U8 ) pHTInfo->primaryChannel,
5163 secondaryChnlOffset, (tPowerdBm)localPwrConstraint, psessionEntry->peSessionId);
5164#endif
5165
5166 //In case of IBSS, if STA should update HT Info IE in its beacons.
5167 if (eLIM_STA_IN_IBSS_ROLE == psessionEntry->limSystemRole)
5168 {
5169 schSetFixedBeaconFields(pMac,psessionEntry);
5170 }
5171
5172 }
5173} // End limUpdateStaRunTimeHTParams.
5174
5175/**
5176 * \brief This function updates the lim global structure, if any of the
5177 * HT Capabilities have changed.
5178 *
5179 *
5180 * \param pMac Pointer to Global MAC structure
5181 *
5182 * \param pHTCapability Pointer to HT Capability Information Element
5183 * obtained from a Beacon or Probe Response
5184 *
5185 *
5186 *
5187 */
5188
5189void limUpdateStaRunTimeHTCapability( tpAniSirGlobal pMac,
5190 tDot11fIEHTCaps *pHTCaps )
5191{
5192
5193 if ( pMac->lim.gHTLsigTXOPProtection != ( tANI_U8 ) pHTCaps->lsigTXOPProtection )
5194 {
5195 pMac->lim.gHTLsigTXOPProtection = ( tANI_U8 ) pHTCaps->lsigTXOPProtection;
5196 // Send change notification to HAL
5197 }
5198
5199 if ( pMac->lim.gHTAMpduDensity != ( tANI_U8 ) pHTCaps->mpduDensity )
5200 {
5201 pMac->lim.gHTAMpduDensity = ( tANI_U8 ) pHTCaps->mpduDensity;
5202 // Send change notification to HAL
5203 }
5204
5205 if ( pMac->lim.gHTMaxRxAMpduFactor != ( tANI_U8 ) pHTCaps->maxRxAMPDUFactor )
5206 {
5207 pMac->lim.gHTMaxRxAMpduFactor = ( tANI_U8 ) pHTCaps->maxRxAMPDUFactor;
5208 // Send change notification to HAL
5209 }
5210
5211
5212} // End limUpdateStaRunTimeHTCapability.
5213
5214/**
5215 * \brief This function updates lim global structure, if any of the HT
5216 * Info Parameters have changed.
5217 *
5218 *
5219 * \param pMac Pointer to the global MAC structure
5220 *
5221 * \param pHTInfo Pointer to the HT Info IE obtained from a Beacon or
5222 * Probe Response
5223 *
5224 *
5225 */
5226
5227void limUpdateStaRunTimeHTInfo( tpAniSirGlobal pMac,
5228 tDot11fIEHTInfo *pHTInfo , tpPESession psessionEntry)
5229{
Jeff Johnsone7245742012-09-05 17:12:55 -07005230 if ( psessionEntry->htRecommendedTxWidthSet != ( tANI_U8 )pHTInfo->recommendedTxWidthSet )
Jeff Johnson295189b2012-06-20 16:38:30 -07005231 {
Jeff Johnsone7245742012-09-05 17:12:55 -07005232 psessionEntry->htRecommendedTxWidthSet = ( tANI_U8 )pHTInfo->recommendedTxWidthSet;
Jeff Johnson295189b2012-06-20 16:38:30 -07005233 // Send change notification to HAL
5234 }
5235
5236 if ( psessionEntry->beaconParams.fRIFSMode != ( tANI_U8 )pHTInfo->rifsMode )
5237 {
5238 psessionEntry->beaconParams.fRIFSMode = ( tANI_U8 )pHTInfo->rifsMode;
5239 // Send change notification to HAL
5240 }
5241
5242 if ( pMac->lim.gHTServiceIntervalGranularity != ( tANI_U8 )pHTInfo->serviceIntervalGranularity )
5243 {
5244 pMac->lim.gHTServiceIntervalGranularity = ( tANI_U8 )pHTInfo->serviceIntervalGranularity;
5245 // Send change notification to HAL
5246 }
5247
5248 if ( pMac->lim.gHTOperMode != ( tSirMacHTOperatingMode )pHTInfo->opMode )
5249 {
5250 pMac->lim.gHTOperMode = ( tSirMacHTOperatingMode )pHTInfo->opMode;
5251 // Send change notification to HAL
5252 }
5253
5254 if ( psessionEntry->beaconParams.llnNonGFCoexist != pHTInfo->nonGFDevicesPresent )
5255 {
5256 psessionEntry->beaconParams.llnNonGFCoexist = ( tANI_U8 )pHTInfo->nonGFDevicesPresent;
5257 }
5258
5259 if ( pMac->lim.gHTSTBCBasicMCS != ( tANI_U8 )pHTInfo->basicSTBCMCS )
5260 {
5261 pMac->lim.gHTSTBCBasicMCS = ( tANI_U8 )pHTInfo->basicSTBCMCS;
5262 // Send change notification to HAL
5263 }
5264
5265 if ( pMac->lim.gHTDualCTSProtection != ( tANI_U8 )pHTInfo->dualCTSProtection )
5266 {
5267 pMac->lim.gHTDualCTSProtection = ( tANI_U8 )pHTInfo->dualCTSProtection;
5268 // Send change notification to HAL
5269 }
5270
5271 if ( pMac->lim.gHTSecondaryBeacon != ( tANI_U8 )pHTInfo->secondaryBeacon )
5272 {
5273 pMac->lim.gHTSecondaryBeacon = ( tANI_U8 )pHTInfo->secondaryBeacon;
5274 // Send change notification to HAL
5275 }
5276
5277 if ( psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport != ( tANI_U8 )pHTInfo->lsigTXOPProtectionFullSupport )
5278 {
5279 psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport = ( tANI_U8 )pHTInfo->lsigTXOPProtectionFullSupport;
5280 // Send change notification to HAL
5281 }
5282
5283 if ( pMac->lim.gHTPCOActive != ( tANI_U8 )pHTInfo->pcoActive )
5284 {
5285 pMac->lim.gHTPCOActive = ( tANI_U8 )pHTInfo->pcoActive;
5286 // Send change notification to HAL
5287 }
5288
5289 if ( pMac->lim.gHTPCOPhase != ( tANI_U8 )pHTInfo->pcoPhase )
5290 {
5291 pMac->lim.gHTPCOPhase = ( tANI_U8 )pHTInfo->pcoPhase;
5292 // Send change notification to HAL
5293 }
5294
5295} // End limUpdateStaRunTimeHTInfo.
5296
5297
5298/** -------------------------------------------------------------
5299\fn limProcessHalIndMessages
5300\brief callback function for HAL indication
5301\param tpAniSirGlobal pMac
5302\param tANI_U32 mesgId
5303\param void *mesgParam
5304\return tSirRetStatu - status
5305 -------------------------------------------------------------*/
5306
5307tSirRetStatus limProcessHalIndMessages(tpAniSirGlobal pMac, tANI_U32 msgId, void *msgParam )
5308{
5309 //its PE's responsibility to free msgparam when its done extracting the message parameters.
5310 tSirMsgQ msg;
5311
5312 switch(msgId)
5313 {
5314 case SIR_LIM_DEL_TS_IND:
5315 case SIR_LIM_ADD_BA_IND:
5316 case SIR_LIM_DEL_BA_ALL_IND:
5317 case SIR_LIM_DELETE_STA_CONTEXT_IND:
5318 case SIR_LIM_BEACON_GEN_IND:
5319 msg.type = (tANI_U16) msgId;
5320 msg.bodyptr = msgParam;
5321 msg.bodyval = 0;
5322 break;
5323
5324 default:
5325 palFreeMemory(pMac->hHdd, msgParam);
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005326 limLog(pMac, LOGP, FL("invalid message id = %d received"), msgId);
Jeff Johnson295189b2012-06-20 16:38:30 -07005327 return eSIR_FAILURE;
5328 }
5329
5330 if (limPostMsgApi(pMac, &msg) != eSIR_SUCCESS)
5331 {
5332 palFreeMemory(pMac->hHdd, msgParam);
5333 limLog(pMac, LOGP, FL("limPostMsgApi failed for msgid = %d"), msg.type);
5334 return eSIR_FAILURE;
5335 }
5336 return eSIR_SUCCESS;
5337}
5338
5339/** -------------------------------------------------------------
5340\fn limValidateDeltsReq
5341\brief Validates DelTs req originated by SME or by HAL and also sends halMsg_DelTs to HAL
5342\param tpAniSirGlobal pMac
5343\param tpSirDeltsReq pDeltsReq
5344\param tSirMacAddr peerMacAddr
5345\return eSirRetStatus - status
5346 -------------------------------------------------------------*/
5347
5348tSirRetStatus
5349limValidateDeltsReq(tpAniSirGlobal pMac, tpSirDeltsReq pDeltsReq, tSirMacAddr peerMacAddr,tpPESession psessionEntry)
5350{
5351 tpDphHashNode pSta;
5352 tANI_U8 tsStatus;
5353 tSirMacTSInfo *tsinfo;
5354 tANI_U32 i;
5355 tANI_U8 tspecIdx;
5356 /* if sta
5357 * - verify assoc state
5358 * - del tspec locally
5359 * if ap,
5360 * - verify sta is in assoc state
5361 * - del sta tspec locally
5362 */
5363 if(pDeltsReq == NULL)
5364 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005365 PELOGE(limLog(pMac, LOGE, FL("Delete TS request pointer is NULL"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005366 return eSIR_FAILURE;
5367 }
5368
5369 if ((psessionEntry->limSystemRole == eLIM_STA_ROLE)||(psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE))
5370 {
5371 tANI_U32 val;
5372
5373 // station always talks to the AP
5374 pSta = dphGetHashEntry(pMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable);
5375
5376 val = sizeof(tSirMacAddr);
5377 #if 0
5378 if (wlan_cfgGetStr(pMac, WNI_CFG_BSSID, peerMacAddr, &val) != eSIR_SUCCESS)
5379 {
5380 /// Could not get BSSID from CFG. Log error.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005381 limLog(pMac, LOGP, FL("could not retrieve BSSID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07005382 return eSIR_FAILURE;
5383 }
5384 #endif// TO SUPPORT BT-AMP
5385 sirCopyMacAddr(peerMacAddr,psessionEntry->bssId);
5386
5387 }
5388 else
5389 {
5390 tANI_U16 assocId;
5391 tANI_U8 *macaddr = (tANI_U8 *) peerMacAddr;
5392
5393 assocId = pDeltsReq->aid;
5394 if (assocId != 0)
5395 pSta = dphGetHashEntry(pMac, assocId, &psessionEntry->dph.dphHashTable);
5396 else
5397 pSta = dphLookupHashEntry(pMac, pDeltsReq->macAddr, &assocId, &psessionEntry->dph.dphHashTable);
5398
5399 if (pSta != NULL)
5400 // TBD: check sta assoc state as well
5401 for (i =0; i < sizeof(tSirMacAddr); i++)
5402 macaddr[i] = pSta->staAddr[i];
5403 }
5404
5405 if (pSta == NULL)
5406 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005407 PELOGE(limLog(pMac, LOGE, "Cannot find station context for delts req");)
Jeff Johnson295189b2012-06-20 16:38:30 -07005408 return eSIR_FAILURE;
5409 }
5410
5411 if ((! pSta->valid) ||
5412 (pSta->mlmStaContext.mlmState != eLIM_MLM_LINK_ESTABLISHED_STATE))
5413 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005414 PELOGE(limLog(pMac, LOGE, "Invalid Sta (or state) for DelTsReq");)
Jeff Johnson295189b2012-06-20 16:38:30 -07005415 return eSIR_FAILURE;
5416 }
5417
5418 pDeltsReq->req.wsmTspecPresent = 0;
5419 pDeltsReq->req.wmeTspecPresent = 0;
5420 pDeltsReq->req.lleTspecPresent = 0;
5421
5422 if ((pSta->wsmEnabled) &&
5423 (pDeltsReq->req.tspec.tsinfo.traffic.accessPolicy != SIR_MAC_ACCESSPOLICY_EDCA))
5424 pDeltsReq->req.wsmTspecPresent = 1;
5425 else if (pSta->wmeEnabled)
5426 pDeltsReq->req.wmeTspecPresent = 1;
5427 else if (pSta->lleEnabled)
5428 pDeltsReq->req.lleTspecPresent = 1;
5429 else
5430 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005431 PELOGW(limLog(pMac, LOGW, FL("DELTS_REQ ignore - qos is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005432 return eSIR_FAILURE;
5433 }
5434
5435 tsinfo = pDeltsReq->req.wmeTspecPresent ? &pDeltsReq->req.tspec.tsinfo
5436 : &pDeltsReq->req.tsinfo;
5437 PELOG1(limLog(pMac, LOG1,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005438 FL("received DELTS_REQ message (wmeTspecPresent = %d, lleTspecPresent = %d, wsmTspecPresent = %d, tsid %d, up %d, direction = %d)"),
Jeff Johnson295189b2012-06-20 16:38:30 -07005439 pDeltsReq->req.wmeTspecPresent, pDeltsReq->req.lleTspecPresent, pDeltsReq->req.wsmTspecPresent,
5440 tsinfo->traffic.tsid, tsinfo->traffic.userPrio, tsinfo->traffic.direction);)
5441
5442 // if no Access Control, ignore the request
Jeff Johnson295189b2012-06-20 16:38:30 -07005443
5444 if (limAdmitControlDeleteTS(pMac, pSta->assocId, tsinfo, &tsStatus, &tspecIdx)
5445 != eSIR_SUCCESS)
5446 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005447 PELOGE(limLog(pMac, LOGE, "ERROR DELTS request for sta assocId %d (tsid %d, up %d)",
Jeff Johnson295189b2012-06-20 16:38:30 -07005448 pSta->assocId, tsinfo->traffic.tsid, tsinfo->traffic.userPrio);)
5449 return eSIR_FAILURE;
5450 }
5451 else if ((tsinfo->traffic.accessPolicy == SIR_MAC_ACCESSPOLICY_HCCA) ||
5452 (tsinfo->traffic.accessPolicy == SIR_MAC_ACCESSPOLICY_BOTH))
5453 {
5454 //edca only now.
5455 }
5456 else
5457 {
5458 if((tsinfo->traffic.accessPolicy == SIR_MAC_ACCESSPOLICY_EDCA) &&
5459 psessionEntry->gLimEdcaParams[upToAc(tsinfo->traffic.userPrio)].aci.acm)
5460 {
5461 //send message to HAL to delete TS
Jeff Johnsone7245742012-09-05 17:12:55 -07005462 if(eSIR_SUCCESS != limSendHalMsgDelTs(pMac, pSta->staIndex, tspecIdx, pDeltsReq->req, psessionEntry->peSessionId))
Jeff Johnson295189b2012-06-20 16:38:30 -07005463 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005464 limLog(pMac, LOGW, FL("DelTs with UP %d failed in limSendHalMsgDelTs - ignoring request"),
Jeff Johnson295189b2012-06-20 16:38:30 -07005465 tsinfo->traffic.userPrio);
5466 return eSIR_FAILURE;
5467 }
5468 }
5469 }
5470 return eSIR_SUCCESS;
5471}
5472
5473/** -------------------------------------------------------------
5474\fn limRegisterHalIndCallBack
5475\brief registers callback function to HAL for any indication.
5476\param tpAniSirGlobal pMac
5477\return none.
5478 -------------------------------------------------------------*/
5479void
5480limRegisterHalIndCallBack(tpAniSirGlobal pMac)
5481{
5482 tSirMsgQ msg;
5483 tpHalIndCB pHalCB;
5484
5485 if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&pHalCB, sizeof(tHalIndCB)))
5486 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005487 limLog(pMac, LOGP, FL("palAllocateMemory() failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07005488 return;
5489 }
5490
5491 pHalCB->pHalIndCB = limProcessHalIndMessages;
5492
5493 msg.type = WDA_REGISTER_PE_CALLBACK;
5494 msg.bodyptr = pHalCB;
5495 msg.bodyval = 0;
5496
Jeff Johnsone7245742012-09-05 17:12:55 -07005497 MTRACE(macTraceMsgTx(pMac, NO_SESSION, msg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07005498 if(eSIR_SUCCESS != wdaPostCtrlMsg(pMac, &msg))
5499 {
5500 palFreeMemory(pMac->hHdd, pHalCB);
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005501 limLog(pMac, LOGP, FL("wdaPostCtrlMsg() failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07005502 }
5503
5504 return;
5505}
5506
5507
5508/** -------------------------------------------------------------
5509\fn limProcessAddBaInd
5510
5511\brief handles the BA activity check timeout indication coming from HAL.
5512 Validates the request, posts request for sending addBaReq message for every candidate in the list.
5513\param tpAniSirGlobal pMac
5514\param tSirMsgQ limMsg
5515\return None
5516-------------------------------------------------------------*/
5517void
5518limProcessAddBaInd(tpAniSirGlobal pMac, tpSirMsgQ limMsg)
5519{
5520 tANI_U8 i;
5521 tANI_U8 tid;
5522 tANI_U16 assocId;
5523 tpDphHashNode pSta;
5524 tpAddBaCandidate pBaCandidate;
5525 tANI_U32 baCandidateCnt;
5526 tpBaActivityInd pBaActivityInd;
5527 tpPESession psessionEntry;
5528 tANI_U8 sessionId;
Gopichand Nakkala681989c2013-03-06 22:27:48 -08005529#ifdef FEATURE_WLAN_TDLS
5530 boolean htCapable = FALSE;
5531#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07005532
5533
Gopichand Nakkala681989c2013-03-06 22:27:48 -08005534 if (limMsg->bodyptr == NULL)
Jeff Johnson295189b2012-06-20 16:38:30 -07005535 return;
5536
5537 pBaActivityInd = (tpBaActivityInd)limMsg->bodyptr;
5538 baCandidateCnt = pBaActivityInd->baCandidateCnt;
5539
Gopichand Nakkala681989c2013-03-06 22:27:48 -08005540 if ((psessionEntry = peFindSessionByBssid(pMac,pBaActivityInd->bssId,&sessionId))== NULL)
Jeff Johnson295189b2012-06-20 16:38:30 -07005541 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005542 limLog(pMac, LOGE,FL("session does not exist for given BSSId"));
Jeff Johnson295189b2012-06-20 16:38:30 -07005543 palFreeMemory(pMac->hHdd, limMsg->bodyptr);
5544 return;
5545 }
5546
5547 //if we are not HT capable we don't need to handle BA timeout indication from HAL.
Gopichand Nakkala681989c2013-03-06 22:27:48 -08005548#ifdef FEATURE_WLAN_TDLS
5549 if ((baCandidateCnt > pMac->lim.maxStation))
5550#else
5551 if ((baCandidateCnt > pMac->lim.maxStation) || !psessionEntry->htCapability )
5552#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07005553 {
5554 palFreeMemory(pMac->hHdd, limMsg->bodyptr);
5555 return;
5556 }
Gopichand Nakkala681989c2013-03-06 22:27:48 -08005557
5558#ifdef FEATURE_WLAN_TDLS
5559 //if we have TDLS peers, we should look at peers HT capability, which can be different than
5560 //AP capability
5561 pBaCandidate = (tpAddBaCandidate) (((tANI_U8*)pBaActivityInd) + sizeof(tBaActivityInd));
5562
5563 for (i=0; i<baCandidateCnt; i++, pBaCandidate++)
5564 {
5565 pSta = dphLookupHashEntry(pMac, pBaCandidate->staAddr, &assocId, &psessionEntry->dph.dphHashTable);
5566 if ((NULL == pSta) || (!pSta->valid))
5567 continue;
5568
5569 if (STA_ENTRY_TDLS_PEER == pSta->staType)
5570 htCapable = pSta->mlmStaContext.htCapability;
5571 else
5572 htCapable = psessionEntry->htCapability;
5573
5574 if (htCapable)
5575 break;
5576 }
5577 if (!htCapable)
5578 {
5579 palFreeMemory(pMac->hHdd, limMsg->bodyptr);
5580 return;
5581 }
5582#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07005583
5584 //delete the complete dialoguetoken linked list
5585 limDeleteDialogueTokenList(pMac);
5586 pBaCandidate = (tpAddBaCandidate) (((tANI_U8*)pBaActivityInd) + sizeof(tBaActivityInd));
5587
Gopichand Nakkala681989c2013-03-06 22:27:48 -08005588 for (i=0; i<baCandidateCnt; i++, pBaCandidate++)
Jeff Johnson295189b2012-06-20 16:38:30 -07005589 {
5590 pSta = dphLookupHashEntry(pMac, pBaCandidate->staAddr, &assocId, &psessionEntry->dph.dphHashTable);
Gopichand Nakkala681989c2013-03-06 22:27:48 -08005591 if ((NULL == pSta) || (!pSta->valid))
5592 continue;
Jeff Johnson295189b2012-06-20 16:38:30 -07005593
5594 for (tid=0; tid<STACFG_MAX_TC; tid++)
5595 {
Gopichand Nakkala681989c2013-03-06 22:27:48 -08005596 if((eBA_DISABLE == pSta->tcCfg[tid].fUseBATx) &&
Jeff Johnson295189b2012-06-20 16:38:30 -07005597 (pBaCandidate->baInfo[tid].fBaEnable))
5598 {
Hoonki Lee9af07cf2013-04-24 01:21:58 -07005599 limLog(pMac, LOGE, FL("BA setup for staId = %d, TID: %d, SSN: %d"),
5600 pSta->staIndex, tid, pBaCandidate->baInfo[tid].startingSeqNum);
Jeff Johnson295189b2012-06-20 16:38:30 -07005601 limPostMlmAddBAReq(pMac, pSta, tid, pBaCandidate->baInfo[tid].startingSeqNum,psessionEntry);
5602 }
5603 }
5604 }
5605 palFreeMemory(pMac->hHdd, limMsg->bodyptr);
5606 return;
5607}
5608
5609
5610/** -------------------------------------------------------------
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005611\fn limDeleteBASessions
5612\brief Deletes all the exisitng BA sessions for given session
5613 and BA direction.
Jeff Johnson295189b2012-06-20 16:38:30 -07005614\param tpAniSirGlobal pMac
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005615\param tpPESession pSessionEntry
5616\param tANI_U32 baDirection
5617\return None
Jeff Johnson295189b2012-06-20 16:38:30 -07005618-------------------------------------------------------------*/
5619
5620void
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005621limDeleteBASessions(tpAniSirGlobal pMac, tpPESession pSessionEntry,
5622 tANI_U32 baDirection)
Jeff Johnson295189b2012-06-20 16:38:30 -07005623{
5624 tANI_U32 i;
5625 tANI_U8 tid;
5626 tpDphHashNode pSta;
5627
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005628 if (NULL == pSessionEntry)
Jeff Johnson295189b2012-06-20 16:38:30 -07005629 {
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005630 limLog(pMac, LOGE, FL("Session does not exist"));
5631 }
5632 else
5633 {
5634 for(tid = 0; tid < STACFG_MAX_TC; tid++)
Jeff Johnson295189b2012-06-20 16:38:30 -07005635 {
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005636 if ((eLIM_AP_ROLE == pSessionEntry->limSystemRole) ||
5637 (pSessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE) ||
5638 (eLIM_STA_IN_IBSS_ROLE == pSessionEntry->limSystemRole) ||
5639 (pSessionEntry->limSystemRole == eLIM_P2P_DEVICE_GO))
Jeff Johnson295189b2012-06-20 16:38:30 -07005640 {
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005641 for (i = 0; i < pMac->lim.maxStation; i++)
Jeff Johnson295189b2012-06-20 16:38:30 -07005642 {
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005643 pSta = pSessionEntry->dph.dphHashTable.pDphNodeArray + i;
5644 if (pSta && pSta->added)
Kiran Kumar Lokerec1641f52013-05-29 14:29:43 -07005645 {
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005646 if ((eBA_ENABLE == pSta->tcCfg[tid].fUseBATx) &&
5647 (baDirection & BA_INITIATOR))
5648 {
5649 limPostMlmDelBAReq(pMac, pSta, eBA_INITIATOR, tid,
5650 eSIR_MAC_UNSPEC_FAILURE_REASON,
5651 pSessionEntry);
5652 }
5653 if ((eBA_ENABLE == pSta->tcCfg[tid].fUseBARx) &&
5654 (baDirection & BA_RECIPIENT))
5655 {
5656 limPostMlmDelBAReq(pMac, pSta, eBA_RECIPIENT, tid,
5657 eSIR_MAC_UNSPEC_FAILURE_REASON,
5658 pSessionEntry);
5659 }
Kiran Kumar Lokerec1641f52013-05-29 14:29:43 -07005660 }
Jeff Johnson295189b2012-06-20 16:38:30 -07005661 }
5662 }
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005663 else if ((eLIM_STA_ROLE == pSessionEntry->limSystemRole) ||
5664 (eLIM_BT_AMP_STA_ROLE == pSessionEntry->limSystemRole) ||
5665 (eLIM_P2P_DEVICE_ROLE == pSessionEntry->limSystemRole))
Gopichand Nakkala6a36e142013-06-07 21:23:15 -07005666 {
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005667 pSta = dphGetHashEntry(pMac, DPH_STA_HASH_INDEX_PEER,
5668 &pSessionEntry->dph.dphHashTable);
5669 if (pSta && pSta->added)
Gopichand Nakkala6a36e142013-06-07 21:23:15 -07005670 {
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005671 if ((eBA_ENABLE == pSta->tcCfg[tid].fUseBATx) &&
5672 (baDirection & BA_INITIATOR))
5673 {
5674 limPostMlmDelBAReq(pMac, pSta, eBA_INITIATOR, tid,
5675 eSIR_MAC_UNSPEC_FAILURE_REASON,
5676 pSessionEntry);
5677 }
5678 if ((eBA_ENABLE == pSta->tcCfg[tid].fUseBARx) &&
5679 (baDirection & BA_RECIPIENT))
5680 {
5681 limPostMlmDelBAReq(pMac, pSta, eBA_RECIPIENT, tid,
5682 eSIR_MAC_UNSPEC_FAILURE_REASON,
5683 pSessionEntry);
5684 }
Gopichand Nakkala6a36e142013-06-07 21:23:15 -07005685 }
5686 }
5687 }
Jeff Johnson295189b2012-06-20 16:38:30 -07005688 }
5689}
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005690
5691/** -------------------------------------------------------------
5692\fn limDelAllBASessions
5693\brief Deletes all the exisitng BA sessions.
5694\param tpAniSirGlobal pMac
5695\return None
5696-------------------------------------------------------------*/
5697
5698void limDelAllBASessions(tpAniSirGlobal pMac)
5699{
5700 tANI_U32 i;
5701 tpPESession pSessionEntry;
5702
5703 for (i = 0; i < pMac->lim.maxBssId; i++)
5704 {
5705 pSessionEntry = peFindSessionBySessionId(pMac, i);
5706 if (pSessionEntry)
5707 {
5708 limDeleteBASessions(pMac, pSessionEntry, BA_BOTH_DIRECTIONS);
5709 }
5710 }
5711}
5712
5713/** -------------------------------------------------------------
5714\fn limDelAllBASessionsBtc
5715\brief Deletes all the exisitng BA receipent sessions in 2.4GHz
5716 band.
5717\param tpAniSirGlobal pMac
5718\return None
5719-------------------------------------------------------------*/
5720
5721void limDelAllBASessionsBtc(tpAniSirGlobal pMac)
5722{
5723 tANI_U32 i;
5724 tpPESession pSessionEntry;
5725
5726 for (i = 0; i < pMac->lim.maxBssId; i++)
5727 {
5728 pSessionEntry = peFindSessionBySessionId(pMac, i);
5729 if (pSessionEntry)
5730 {
5731 if (SIR_BAND_2_4_GHZ ==
5732 limGetRFBand(pSessionEntry->currentOperChannel))
5733 {
5734 limDeleteBASessions(pMac, pSessionEntry, BA_RECIPIENT);
5735 }
5736 }
5737 }
5738}
5739
Jeff Johnson295189b2012-06-20 16:38:30 -07005740/** -------------------------------------------------------------
5741\fn limProcessDelTsInd
5742\brief handles the DeleteTS indication coming from HAL or generated by PE itself in some error cases.
5743 Validates the request, sends the DelTs action frame to the Peer and sends DelTs indicatoin to HDD.
5744\param tpAniSirGlobal pMac
5745\param tSirMsgQ limMsg
5746\return None
5747-------------------------------------------------------------*/
5748void
5749limProcessDelTsInd(tpAniSirGlobal pMac, tpSirMsgQ limMsg)
5750{
5751 tpDphHashNode pSta;
5752 tpDelTsParams pDelTsParam = (tpDelTsParams) (limMsg->bodyptr);
5753 tpSirDeltsReq pDelTsReq = NULL;
5754 tSirMacAddr peerMacAddr;
5755 tpSirDeltsReqInfo pDelTsReqInfo;
5756 tpLimTspecInfo pTspecInfo;
5757 tpPESession psessionEntry;
5758 tANI_U8 sessionId;
5759
5760if((psessionEntry = peFindSessionByBssid(pMac,pDelTsParam->bssId,&sessionId))== NULL)
5761 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005762 limLog(pMac, LOGE,FL("session does not exist for given BssId"));
Jeff Johnsone7245742012-09-05 17:12:55 -07005763 palFreeMemory(pMac->hHdd, (void *)(limMsg->bodyptr));
Jeff Johnson295189b2012-06-20 16:38:30 -07005764 return;
5765 }
5766
5767 pTspecInfo = &(pMac->lim.tspecInfo[pDelTsParam->tspecIdx]);
5768 if(pTspecInfo->inuse == false)
5769 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005770 PELOGE(limLog(pMac, LOGE, FL("tspec entry with index %d is not in use"), pDelTsParam->tspecIdx);)
Jeff Johnson295189b2012-06-20 16:38:30 -07005771 goto error1;
5772 }
5773
5774 pSta = dphGetHashEntry(pMac, pTspecInfo->assocId, &psessionEntry->dph.dphHashTable);
5775 if(pSta == NULL)
5776 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005777 limLog(pMac, LOGE, FL("Could not find entry in DPH table for assocId = %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07005778 pTspecInfo->assocId);
5779 goto error1;
5780 }
5781
5782 if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&pDelTsReq, sizeof(tSirDeltsReq)))
5783 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005784 PELOGE(limLog(pMac, LOGE, FL("palAllocateMemory() failed"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005785 goto error1;
5786 }
5787
5788 palZeroMemory( pMac->hHdd, (tANI_U8 *)pDelTsReq, sizeof(tSirDeltsReq));
5789
5790 if(pSta->wmeEnabled)
5791 palCopyMemory(pMac->hHdd, &(pDelTsReq->req.tspec), &(pTspecInfo->tspec), sizeof(tSirMacTspecIE));
5792 else
5793 palCopyMemory(pMac->hHdd, &(pDelTsReq->req.tsinfo), &(pTspecInfo->tspec.tsinfo), sizeof(tSirMacTSInfo));
5794
5795
5796 //validate the req
5797 if (eSIR_SUCCESS != limValidateDeltsReq(pMac, pDelTsReq, peerMacAddr,psessionEntry))
5798 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005799 PELOGE(limLog(pMac, LOGE, FL("limValidateDeltsReq failed"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005800 goto error2;
5801 }
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005802 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 -07005803 pDelTsReq->aid, peerMacAddr[0], peerMacAddr[1], peerMacAddr[2],
5804 peerMacAddr[3], peerMacAddr[4], peerMacAddr[5]);)
5805
5806 limSendDeltsReqActionFrame(pMac, peerMacAddr, pDelTsReq->req.wmeTspecPresent, &pDelTsReq->req.tsinfo, &pDelTsReq->req.tspec,
5807 psessionEntry);
5808
5809 // prepare and send an sme indication to HDD
5810 if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&pDelTsReqInfo, sizeof(tSirDeltsReqInfo)))
5811 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005812 PELOGE(limLog(pMac, LOGE, FL("palAllocateMemory() failed"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005813 goto error3;
5814 }
5815 palZeroMemory( pMac->hHdd, (tANI_U8 *)pDelTsReqInfo, sizeof(tSirDeltsReqInfo));
5816
5817 if(pSta->wmeEnabled)
5818 palCopyMemory(pMac->hHdd, &(pDelTsReqInfo->tspec), &(pTspecInfo->tspec), sizeof(tSirMacTspecIE));
5819 else
5820 palCopyMemory(pMac->hHdd, &(pDelTsReqInfo->tsinfo), &(pTspecInfo->tspec.tsinfo), sizeof(tSirMacTSInfo));
5821
5822 limSendSmeDeltsInd(pMac, pDelTsReqInfo, pDelTsReq->aid,psessionEntry);
5823
5824error3:
5825 palFreeMemory(pMac->hHdd, (void *) pDelTsReqInfo);
5826error2:
5827 palFreeMemory(pMac->hHdd, (void *) pDelTsReq);
5828error1:
5829 palFreeMemory(pMac->hHdd, (void *)(limMsg->bodyptr));
5830 return;
5831}
5832
5833/**
5834 * \brief Setup an A-MPDU/BA session
5835 *
5836 * \sa limPostMlmAddBAReq
5837 *
5838 * \param pMac The global tpAniSirGlobal object
5839 *
5840 * \param pStaDs DPH Hash Node object of peer STA
5841 *
5842 * \param tid TID for which a BA is being setup.
5843 * If this is set to 0xFFFF, then we retrieve
5844 * the default TID from the CFG
5845 *
5846 * \return eSIR_SUCCESS if setup completes successfully
5847 * eSIR_FAILURE is some problem is encountered
5848 */
5849tSirRetStatus limPostMlmAddBAReq( tpAniSirGlobal pMac,
5850 tpDphHashNode pStaDs,
5851 tANI_U8 tid, tANI_U16 startingSeqNum,tpPESession psessionEntry)
5852{
5853 tSirRetStatus status = eSIR_SUCCESS;
Jeff Johnson09fb4cd2013-04-03 15:27:59 -07005854 tpLimMlmAddBAReq pMlmAddBAReq = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07005855 tpDialogueToken dialogueTokenNode;
5856 tANI_U32 val = 0;
Jeff Johnson09fb4cd2013-04-03 15:27:59 -07005857
Jeff Johnson295189b2012-06-20 16:38:30 -07005858 // Check if the peer is a 11n capable STA
5859 // FIXME - Need a 11n peer indication in DPH.
5860 // For now, using the taurusPeer attribute
5861 //if( 0 == pStaDs->taurusPeer == )
5862 //return eSIR_SUCCESS;
5863
5864 // Allocate for LIM_MLM_ADDBA_REQ
5865 if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd,
5866 (void **) &pMlmAddBAReq,
5867 sizeof( tLimMlmAddBAReq )))
5868 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005869 limLog( pMac, LOGP, FL("palAllocateMemory failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07005870 status = eSIR_MEM_ALLOC_FAILED;
5871 goto returnFailure;
5872 }
5873
5874 palZeroMemory( pMac->hHdd, (void *) pMlmAddBAReq, sizeof( tLimMlmAddBAReq ));
5875
5876 // Copy the peer MAC
5877 palCopyMemory( pMac->hHdd,
5878 pMlmAddBAReq->peerMacAddr,
5879 pStaDs->staAddr,
5880 sizeof( tSirMacAddr ));
5881
5882 // Update the TID
5883 pMlmAddBAReq->baTID = tid;
5884
5885 // Determine the supported BA policy of local STA
5886 // for the TID of interest
5887 pMlmAddBAReq->baPolicy = (pStaDs->baPolicyFlag >> tid) & 0x1;
5888
5889 // BA Buffer Size
5890 // Requesting the ADDBA recipient to populate the size.
5891 // If ADDBA is accepted, a non-zero buffer size should
5892 // be returned in the ADDBA Rsp
5893 pMlmAddBAReq->baBufferSize = 0;
5894
5895 limLog( pMac, LOGW,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005896 FL( "Requesting an ADDBA to setup a %s BA session with STA %d for TID %d" ),
Jeff Johnson295189b2012-06-20 16:38:30 -07005897 (pMlmAddBAReq->baPolicy ? "Immediate": "Delayed"),
5898 pStaDs->staIndex,
5899 tid );
5900
5901 // BA Timeout
Jeff Johnson09fb4cd2013-04-03 15:27:59 -07005902 if (wlan_cfgGetInt(pMac, WNI_CFG_BA_TIMEOUT, &val) != eSIR_SUCCESS)
Jeff Johnson295189b2012-06-20 16:38:30 -07005903 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005904 limLog(pMac, LOGE, FL("could not retrieve BA TIME OUT Param CFG"));
Jeff Johnson295189b2012-06-20 16:38:30 -07005905 status = eSIR_FAILURE;
5906 goto returnFailure;
5907 }
5908 pMlmAddBAReq->baTimeout = val; // In TU's
5909
5910 // ADDBA Failure Timeout
Jeff Johnson09fb4cd2013-04-03 15:27:59 -07005911 // FIXME_AMPDU - Need to retrieve this from CFG.
Jeff Johnson295189b2012-06-20 16:38:30 -07005912 //right now we are not checking for response timeout. so this field is dummy just to be compliant with the spec.
5913 pMlmAddBAReq->addBAFailureTimeout = 2000; // In TU's
5914
5915 // BA Starting Sequence Number
5916 pMlmAddBAReq->baSSN = startingSeqNum;
5917
5918 /* Update PE session Id*/
5919 pMlmAddBAReq->sessionId = psessionEntry->peSessionId;
5920
5921 LIM_SET_STA_BA_STATE(pStaDs, tid, eLIM_BA_STATE_WT_ADD_RSP);
5922
Jeff Johnson09fb4cd2013-04-03 15:27:59 -07005923 dialogueTokenNode = limAssignDialogueToken(pMac);
5924 if (NULL == dialogueTokenNode)
5925 {
5926 limLog(pMac, LOGE, FL("could not assign dialogue token"));
5927 status = eSIR_FAILURE;
5928 goto returnFailure;
5929 }
5930
Jeff Johnson295189b2012-06-20 16:38:30 -07005931 pMlmAddBAReq->baDialogToken = dialogueTokenNode->token;
Jeff Johnson09fb4cd2013-04-03 15:27:59 -07005932 //set assocId and tid information in the lim linked list
Jeff Johnson295189b2012-06-20 16:38:30 -07005933 dialogueTokenNode->assocId = pStaDs->assocId;
5934 dialogueTokenNode->tid = tid;
5935 // Send ADDBA Req to MLME
5936 limPostMlmMessage( pMac,
5937 LIM_MLM_ADDBA_REQ,
5938 (tANI_U32 *) pMlmAddBAReq );
Jeff Johnson09fb4cd2013-04-03 15:27:59 -07005939 return eSIR_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -07005940
5941returnFailure:
Jeff Johnson09fb4cd2013-04-03 15:27:59 -07005942 palFreeMemory(pMac->hHdd, pMlmAddBAReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07005943 return status;
5944}
5945
5946/**
5947 * \brief Post LIM_MLM_ADDBA_RSP to MLME. MLME
5948 * will then send an ADDBA Rsp to peer MAC entity
5949 * with the appropriate ADDBA status code
5950 *
5951 * \sa limPostMlmAddBARsp
5952 *
5953 * \param pMac The global tpAniSirGlobal object
5954 *
5955 * \param peerMacAddr MAC address of peer entity that will
5956 * be the recipient of this ADDBA Rsp
5957 *
5958 * \param baStatusCode ADDBA Rsp status code
5959 *
5960 * \param baDialogToken ADDBA Rsp dialog token
5961 *
5962 * \param baTID TID of interest
5963 *
5964 * \param baPolicy The BA policy
5965 *
5966 * \param baBufferSize The BA buffer size
5967 *
5968 * \param baTimeout BA timeout in TU's
5969 *
5970 * \return eSIR_SUCCESS if setup completes successfully
5971 * eSIR_FAILURE is some problem is encountered
5972 */
5973tSirRetStatus limPostMlmAddBARsp( tpAniSirGlobal pMac,
5974 tSirMacAddr peerMacAddr,
5975 tSirMacStatusCodes baStatusCode,
5976 tANI_U8 baDialogToken,
5977 tANI_U8 baTID,
5978 tANI_U8 baPolicy,
5979 tANI_U16 baBufferSize,
5980 tANI_U16 baTimeout,
5981 tpPESession psessionEntry)
5982{
5983tSirRetStatus status = eSIR_SUCCESS;
5984tpLimMlmAddBARsp pMlmAddBARsp;
5985
5986 // Allocate for LIM_MLM_ADDBA_RSP
5987 if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd,
5988 (void **) &pMlmAddBARsp,
5989 sizeof( tLimMlmAddBARsp )))
5990 {
5991 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005992 FL("palAllocateMemory failed with error code %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07005993 status );
5994
5995 status = eSIR_MEM_ALLOC_FAILED;
5996 goto returnFailure;
5997 }
5998
5999 palZeroMemory( pMac->hHdd, (void *) pMlmAddBARsp, sizeof( tLimMlmAddBARsp ));
6000
6001 // Copy the peer MAC
6002 palCopyMemory( pMac->hHdd,
6003 pMlmAddBARsp->peerMacAddr,
6004 peerMacAddr,
6005 sizeof( tSirMacAddr ));
6006
6007 pMlmAddBARsp->baDialogToken = baDialogToken;
6008 pMlmAddBARsp->addBAResultCode = baStatusCode;
6009 pMlmAddBARsp->baTID = baTID;
6010 pMlmAddBARsp->baPolicy = baPolicy;
6011 pMlmAddBARsp->baBufferSize = baBufferSize;
6012 pMlmAddBARsp->baTimeout = baTimeout;
6013
6014 /* UPdate PE session ID*/
6015 pMlmAddBARsp->sessionId = psessionEntry->peSessionId;
6016
6017 // Send ADDBA Rsp to MLME
6018 limPostMlmMessage( pMac,
6019 LIM_MLM_ADDBA_RSP,
6020 (tANI_U32 *) pMlmAddBARsp );
6021
6022returnFailure:
6023
6024 return status;
6025}
6026
6027/**
6028 * \brief Post LIM_MLM_DELBA_REQ to MLME. MLME
6029 * will then send an DELBA Ind to peer MAC entity
6030 * with the appropriate DELBA status code
6031 *
6032 * \sa limPostMlmDelBAReq
6033 *
6034 * \param pMac The global tpAniSirGlobal object
6035 *
6036 * \param pSta DPH Hash Node object of peer MAC entity
6037 * for which the BA session is being deleted
6038 *
6039 * \param baDirection DELBA direction
6040 *
6041 * \param baTID TID for which the BA session is being deleted
6042 *
6043 * \param baReasonCode DELBA Req reason code
6044 *
6045 * \return eSIR_SUCCESS if setup completes successfully
6046 * eSIR_FAILURE is some problem is encountered
6047 */
6048tSirRetStatus limPostMlmDelBAReq( tpAniSirGlobal pMac,
6049 tpDphHashNode pSta,
6050 tANI_U8 baDirection,
6051 tANI_U8 baTID,
6052 tSirMacReasonCodes baReasonCode,
6053 tpPESession psessionEntry)
6054{
6055tSirRetStatus status = eSIR_SUCCESS;
6056tpLimMlmDelBAReq pMlmDelBAReq;
6057tLimBAState curBaState;
6058
6059if(NULL == pSta)
6060 return eSIR_FAILURE;
6061
6062LIM_GET_STA_BA_STATE(pSta, baTID, &curBaState);
6063
6064 // Need to validate the current BA State.
6065 if( eLIM_BA_STATE_IDLE != curBaState)
6066 {
6067 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006068 FL( "Received unexpected DELBA REQ when STA BA state for tid = %d is %d" ),
Jeff Johnson295189b2012-06-20 16:38:30 -07006069 baTID,
6070 curBaState);
6071
6072 status = eSIR_FAILURE;
6073 goto returnFailure;
6074 }
6075
6076 // Allocate for LIM_MLM_DELBA_REQ
6077 if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd,
6078 (void **) &pMlmDelBAReq,
6079 sizeof( tLimMlmDelBAReq )))
6080 {
6081 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006082 FL("palAllocateMemory failed with error code %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07006083 status );
6084
6085 status = eSIR_MEM_ALLOC_FAILED;
6086 goto returnFailure;
6087 }
6088
6089 palZeroMemory( pMac->hHdd, (void *) pMlmDelBAReq, sizeof( tLimMlmDelBAReq ));
6090
6091 // Copy the peer MAC
6092 palCopyMemory( pMac->hHdd,
6093 pMlmDelBAReq->peerMacAddr,
6094 pSta->staAddr,
6095 sizeof( tSirMacAddr ));
6096
6097 pMlmDelBAReq->baDirection = baDirection;
6098 pMlmDelBAReq->baTID = baTID;
6099 pMlmDelBAReq->delBAReasonCode = baReasonCode;
6100
6101 /* Update PE session ID*/
6102 pMlmDelBAReq->sessionId = psessionEntry->peSessionId;
6103
6104 //we don't have valid BA session for the given direction.
6105 // HDD wants to get the BA session deleted on PEER in this case.
6106 // in this case we just need to send DelBA to the peer.
6107 if(((eBA_RECIPIENT == baDirection) && (eBA_DISABLE == pSta->tcCfg[baTID].fUseBARx)) ||
6108 ((eBA_INITIATOR == baDirection) && (eBA_DISABLE == pSta->tcCfg[baTID].fUseBATx)))
6109 {
6110 // Send DELBA Ind over the air
6111 if( eSIR_SUCCESS !=
6112 (status = limSendDelBAInd( pMac, pMlmDelBAReq,psessionEntry)))
6113 status = eSIR_FAILURE;
6114
6115 palFreeMemory(pMac->hHdd, (void*) pMlmDelBAReq);
6116 return status;
6117 }
6118
6119
6120 // Update the BA state in STA
6121 LIM_SET_STA_BA_STATE(pSta, pMlmDelBAReq->baTID, eLIM_BA_STATE_WT_DEL_RSP);
6122
6123 // Send DELBA Req to MLME
6124 limPostMlmMessage( pMac,
6125 LIM_MLM_DELBA_REQ,
6126 (tANI_U32 *) pMlmDelBAReq );
6127
6128returnFailure:
6129
6130 return status;
6131}
6132
6133/**
6134 * \brief Send WDA_ADDBA_REQ to HAL, in order
6135 * to setup a new BA session with a peer
6136 *
6137 * \sa limPostMsgAddBAReq
6138 *
6139 * \param pMac The global tpAniSirGlobal object
6140 *
6141 * \param pSta Runtime, STA-related configuration cached
6142 * in the HashNode object
6143 *
6144 * \param baDialogToken The Action Frame dialog token
6145 *
6146 * \param baTID TID for which the BA session is being setup
6147 *
6148 * \param baPolicy BA Policy
6149 *
6150 * \param baBufferSize The requested BA buffer size
6151 *
6152 * \param baTimeout BA Timeout. 0 indicates no BA timeout enforced
6153 *
6154 * \param baSSN Starting Sequence Number for this BA session
6155 *
6156 * \param baDirection BA Direction: 1 - Initiator, 0 - Recipient
6157 *
6158 * \return none
6159 *
6160 */
6161tSirRetStatus limPostMsgAddBAReq( tpAniSirGlobal pMac,
6162 tpDphHashNode pSta,
6163 tANI_U8 baDialogToken,
6164 tANI_U8 baTID,
6165 tANI_U8 baPolicy,
6166 tANI_U16 baBufferSize,
6167 tANI_U16 baTimeout,
6168 tANI_U16 baSSN,
6169 tANI_U8 baDirection,
6170 tpPESession psessionEntry)
6171{
6172tpAddBAParams pAddBAParams = NULL;
6173tSirRetStatus retCode = eSIR_SUCCESS;
6174eHalStatus status;
6175tSirMsgQ msgQ;
6176
6177#ifdef WLAN_SOFTAP_VSTA_FEATURE
6178 // we can only do BA on "hard" STAs
6179 if (!(IS_HWSTA_IDX(pSta->staIndex)))
6180 {
6181 retCode = eHAL_STATUS_FAILURE;
6182 goto returnFailure;
6183 }
6184#endif //WLAN_SOFTAP_VSTA_FEATURE
6185
6186 // Allocate for WDA_ADDBA_REQ
6187 if( eHAL_STATUS_SUCCESS !=
6188 (status = palAllocateMemory( pMac->hHdd,
6189 (void **) &pAddBAParams,
6190 sizeof( tAddBAParams ))))
6191 {
6192 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006193 FL("palAllocateMemory failed with error code %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07006194 status );
6195
6196 retCode = eSIR_MEM_ALLOC_FAILED;
6197 goto returnFailure;
6198 }
6199
6200 palZeroMemory( pMac->hHdd, (void *) pAddBAParams, sizeof( tAddBAParams ));
6201
6202 // Copy the peer MAC address
6203 palCopyMemory( pMac->hHdd,
6204 (void *) pAddBAParams->peerMacAddr,
6205 (void *) pSta->staAddr,
6206 sizeof( tSirMacAddr ));
6207
6208 // Populate the REQ parameters
6209 pAddBAParams->staIdx = pSta->staIndex;
6210 pAddBAParams->baDialogToken = baDialogToken;
6211 pAddBAParams->baTID = baTID;
6212 pAddBAParams->baPolicy = baPolicy;
6213 pAddBAParams->baBufferSize = baBufferSize;
6214 pAddBAParams->baTimeout = baTimeout;
6215 pAddBAParams->baSSN = baSSN;
6216 pAddBAParams->baDirection = baDirection;
6217 pAddBAParams->respReqd = 1;
6218
6219 /* UPdate PE session ID */
6220 pAddBAParams->sessionId = psessionEntry->peSessionId;
6221
6222 // Post WDA_ADDBA_REQ to HAL.
6223 msgQ.type = WDA_ADDBA_REQ;
6224 //
6225 // FIXME_AMPDU
6226 // A global counter (dialog token) is required to keep track of
6227 // all PE <-> HAL communication(s)
6228 //
6229 msgQ.reserved = 0;
6230 msgQ.bodyptr = pAddBAParams;
6231 msgQ.bodyval = 0;
6232
6233 limLog( pMac, LOGW,
6234 FL( "Sending WDA_ADDBA_REQ..." ));
6235
6236 //defer any other message until we get response back.
6237 SET_LIM_PROCESS_DEFD_MESGS(pMac, false);
6238
Jeff Johnsone7245742012-09-05 17:12:55 -07006239 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07006240#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
6241 limDiagEventReport(pMac, WLAN_PE_DIAG_HAL_ADDBA_REQ_EVENT, psessionEntry, 0, 0);
6242#endif //FEATURE_WLAN_DIAG_SUPPORT
6243
6244 if( eSIR_SUCCESS != (retCode = wdaPostCtrlMsg( pMac, &msgQ )))
6245 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006246 FL("Posting WDA_ADDBA_REQ to HAL failed! Reason = %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07006247 retCode );
6248 else
6249 return retCode;
6250
6251returnFailure:
6252
6253 // Clean-up...
6254 if( NULL != pAddBAParams )
6255 palFreeMemory( pMac->hHdd, (void *) pAddBAParams );
6256
6257 return retCode;
6258
6259}
6260
6261/**
6262 * \brief Send WDA_DELBA_IND to HAL, in order
6263 * to delete an existing BA session with peer
6264 *
6265 * \sa limPostMsgDelBAInd
6266 *
6267 * \param pMac The global tpAniSirGlobal object
6268 *
6269 * \param pSta Runtime, STA-related configuration cached
6270 * in the HashNode object
6271 *
6272 * \param baTID TID for which the BA session is being setup
6273 *
6274 * \param baDirection Identifies whether the DELBA Ind was
6275 * sent by the BA initiator or recipient
6276 *
6277 * \return none
6278 *
6279 */
6280tSirRetStatus limPostMsgDelBAInd( tpAniSirGlobal pMac,
6281 tpDphHashNode pSta,
6282 tANI_U8 baTID,
6283 tANI_U8 baDirection,
6284 tpPESession psessionEntry)
6285{
6286tpDelBAParams pDelBAParams = NULL;
6287tSirRetStatus retCode = eSIR_SUCCESS;
6288eHalStatus status;
6289tSirMsgQ msgQ;
6290
6291 // Allocate for SIR_HAL_DELBA_IND
6292 if( eHAL_STATUS_SUCCESS !=
6293 (status = palAllocateMemory( pMac->hHdd,
6294 (void **) &pDelBAParams,
6295 sizeof( tDelBAParams ))))
6296 {
6297 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006298 FL("palAllocateMemory failed with error code %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07006299 status );
6300
6301 retCode = eSIR_MEM_ALLOC_FAILED;
6302 goto returnFailure;
6303 }
6304
6305 palZeroMemory( pMac->hHdd, (void *) pDelBAParams, sizeof( tDelBAParams ));
6306
6307 // Populate the REQ parameters
6308 pDelBAParams->staIdx = pSta->staIndex;
6309 pDelBAParams->baTID = baTID;
6310 pDelBAParams->baDirection = baDirection;
6311
6312 /* Update PE session ID */
6313
6314
6315 //TBD-RAJESH Updating of the session ID is requird for SIR_HAL_DELBA_IND?????
6316 //pDelBAParams->sessionId = psessionEntry->peSessionId;
6317
6318 // Post WDA_DELBA_IND to HAL.
6319 msgQ.type = WDA_DELBA_IND;
6320 //
6321 // FIXME:
6322 // A global counter (dialog token) is required to keep track of
6323 // all PE <-> HAL communication(s)
6324 //
6325 msgQ.reserved = 0;
6326 msgQ.bodyptr = pDelBAParams;
6327 msgQ.bodyval = 0;
6328
6329 limLog( pMac, LOGW,
6330 FL( "Sending SIR_HAL_DELBA_IND..." ));
6331
Jeff Johnsone7245742012-09-05 17:12:55 -07006332 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07006333#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
6334 limDiagEventReport(pMac, WLAN_PE_DIAG_HAL_DELBA_IND_EVENT, psessionEntry, 0, 0);
6335#endif //FEATURE_WLAN_DIAG_SUPPORT
6336
6337 if( eSIR_SUCCESS != (retCode = wdaPostCtrlMsg( pMac, &msgQ )))
6338 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006339 FL("Posting WDA_DELBA_IND to HAL failed! Reason = %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07006340 retCode );
6341 else
6342 {
6343 // Update LIM's internal cache...
6344 if( eBA_INITIATOR == baDirection)
6345 {
6346 pSta->tcCfg[baTID].fUseBATx = 0;
6347 pSta->tcCfg[baTID].txBufSize = 0;
6348 }
6349 else
6350 {
6351 pSta->tcCfg[baTID].fUseBARx = 0;
6352 pSta->tcCfg[baTID].rxBufSize = 0;
6353 }
6354
6355 return retCode;
6356 }
6357
6358returnFailure:
6359
6360 // Clean-up...
6361 if( NULL != pDelBAParams )
6362 palFreeMemory( pMac->hHdd, (void *) pDelBAParams );
6363
6364 return retCode;
6365
6366}
6367
6368/**
6369 * @function : limPostSMStateUpdate()
6370 *
6371 * @brief : This function Updates the HAL and Softmac about the change in the STA's SMPS state.
6372 *
6373 * LOGIC:
6374 *
6375 * ASSUMPTIONS:
6376 * NA
6377 *
6378 * NOTE:
6379 * NA
6380 *
6381 * @param pMac - Pointer to Global MAC structure
6382 * @param limMsg - Lim Message structure object with the MimoPSparam in body
6383 * @return None
6384 */
6385tSirRetStatus
6386limPostSMStateUpdate(tpAniSirGlobal pMac,
6387 tANI_U16 staIdx, tSirMacHTMIMOPowerSaveState state)
6388{
6389 tSirRetStatus retCode = eSIR_SUCCESS;
6390 tSirMsgQ msgQ;
6391 eHalStatus status;
6392 tpSetMIMOPS pMIMO_PSParams;
6393
6394 msgQ.reserved = 0;
6395 msgQ.type = WDA_SET_MIMOPS_REQ;
6396
6397 // Allocate for WDA_SET_MIMOPS_REQ
6398 status = palAllocateMemory( pMac->hHdd, (void **) &pMIMO_PSParams, sizeof( tSetMIMOPS));
6399 if( eHAL_STATUS_SUCCESS != status) {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006400 limLog( pMac, LOGP,FL(" palAllocateMemory failed with error code %d"), status );
Jeff Johnson295189b2012-06-20 16:38:30 -07006401 return eSIR_MEM_ALLOC_FAILED;
6402 }
6403
6404 pMIMO_PSParams->htMIMOPSState = state;
6405 pMIMO_PSParams->staIdx = staIdx;
6406 pMIMO_PSParams->fsendRsp = true;
6407 msgQ.bodyptr = pMIMO_PSParams;
6408 msgQ.bodyval = 0;
6409
6410 limLog( pMac, LOG2, FL( "Sending WDA_SET_MIMOPS_REQ..." ));
6411
Jeff Johnsone7245742012-09-05 17:12:55 -07006412 MTRACE(macTraceMsgTx(pMac, NO_SESSION, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07006413 retCode = wdaPostCtrlMsg( pMac, &msgQ );
6414 if (eSIR_SUCCESS != retCode)
6415 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006416 limLog( pMac, LOGP, FL("Posting WDA_SET_MIMOPS_REQ to HAL failed! Reason = %d"), retCode );
Jeff Johnson295189b2012-06-20 16:38:30 -07006417 palFreeMemory(pMac->hHdd, (void *) pMIMO_PSParams);
6418 return retCode;
6419 }
6420
6421 return retCode;
6422}
6423
6424void limPktFree (
6425 tpAniSirGlobal pMac,
6426 eFrameType frmType,
6427 tANI_U8 *pRxPacketInfo,
6428 void *pBody)
6429{
6430 (void) pMac; (void) frmType; (void) pRxPacketInfo; (void) pBody;
Jeff Johnson295189b2012-06-20 16:38:30 -07006431}
6432
6433/**
6434 * limGetBDfromRxPacket()
6435 *
6436 *FUNCTION:
6437 * This function is called to get pointer to Polaris
6438 * Buffer Descriptor containing MAC header & other control
6439 * info from the body of the message posted to LIM.
6440 *
6441 *LOGIC:
6442 * NA
6443 *
6444 *ASSUMPTIONS:
6445 * NA
6446 *
6447 *NOTE:
6448 * NA
6449 *
6450 * @param body - Received message body
6451 * @param pRxPacketInfo - Pointer to received BD
6452 * @return None
6453 */
6454
6455void
6456limGetBDfromRxPacket(tpAniSirGlobal pMac, void *body, tANI_U32 **pRxPacketInfo)
6457{
Jeff Johnson295189b2012-06-20 16:38:30 -07006458 *pRxPacketInfo = (tANI_U32 *) body;
Jeff Johnson295189b2012-06-20 16:38:30 -07006459} /*** end limGetBDfromRxPacket() ***/
6460
6461
6462
6463
6464
6465void limRessetScanChannelInfo(tpAniSirGlobal pMac)
6466{
6467 palZeroMemory(pMac->hHdd, &pMac->lim.scanChnInfo, sizeof(tLimScanChnInfo));
6468}
6469
6470
6471void limAddScanChannelInfo(tpAniSirGlobal pMac, tANI_U8 channelId)
6472{
6473 tANI_U8 i;
6474 tANI_BOOLEAN fFound = eANI_BOOLEAN_FALSE;
6475
6476 for(i = 0; i < pMac->lim.scanChnInfo.numChnInfo; i++)
6477 {
6478 if(pMac->lim.scanChnInfo.scanChn[i].channelId == channelId)
6479 {
6480 pMac->lim.scanChnInfo.scanChn[i].numTimeScan++;
6481 fFound = eANI_BOOLEAN_TRUE;
6482 break;
6483 }
6484 }
6485 if(eANI_BOOLEAN_FALSE == fFound)
6486 {
6487 if(pMac->lim.scanChnInfo.numChnInfo < SIR_MAX_SUPPORTED_CHANNEL_LIST)
6488 {
6489 pMac->lim.scanChnInfo.scanChn[pMac->lim.scanChnInfo.numChnInfo].channelId = channelId;
6490 pMac->lim.scanChnInfo.scanChn[pMac->lim.scanChnInfo.numChnInfo++].numTimeScan = 1;
6491 }
6492 else
6493 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006494 PELOGW(limLog(pMac, LOGW, FL(" -- number of channels exceed mac"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07006495 }
6496 }
6497}
6498
6499
6500/**
6501 * @function : limIsChannelValidForChannelSwitch()
6502 *
6503 * @brief : This function checks if the channel to which AP
6504 * is expecting us to switch, is a valid channel for us.
6505 * LOGIC:
6506 *
6507 * ASSUMPTIONS:
6508 * NA
6509 *
6510 * NOTE:
6511 * NA
6512 *
6513 * @param pMac - Pointer to Global MAC structure
6514 * @param channel - New channel to which we are expected to move
6515 * @return None
6516 */
6517tAniBool
6518limIsChannelValidForChannelSwitch(tpAniSirGlobal pMac, tANI_U8 channel)
6519{
6520 tANI_U8 index;
6521 tANI_U32 validChannelListLen = WNI_CFG_VALID_CHANNEL_LIST_LEN;
6522 tSirMacChanNum validChannelList[WNI_CFG_VALID_CHANNEL_LIST_LEN];
6523
6524 if (wlan_cfgGetStr(pMac, WNI_CFG_VALID_CHANNEL_LIST,
6525 (tANI_U8 *)validChannelList,
6526 (tANI_U32 *)&validChannelListLen) != eSIR_SUCCESS)
6527 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006528 PELOGE(limLog(pMac, LOGE, FL("could not retrieve valid channel list"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07006529 return (eSIR_FALSE);
6530 }
6531
6532 for(index = 0; index < validChannelListLen; index++)
6533 {
6534 if(validChannelList[index] == channel)
6535 return (eSIR_TRUE);
6536 }
6537
6538 /* channel does not belong to list of valid channels */
6539 return (eSIR_FALSE);
6540}
6541
6542/**------------------------------------------------------
6543\fn __limFillTxControlParams
6544\brief Fill the message for stopping/resuming tx.
6545
6546\param pMac
6547\param pTxCtrlMsg - Pointer to tx control message.
6548\param type - Which way we want to stop/ resume tx.
6549\param mode - To stop/resume.
6550 -------------------------------------------------------*/
6551static eHalStatus
6552__limFillTxControlParams(tpAniSirGlobal pMac, tpTxControlParams pTxCtrlMsg,
6553 tLimQuietTxMode type, tLimControlTx mode)
6554{
6555
6556 //TBD-RAJESH HOW TO GET sessionEntry?????
6557 tpPESession psessionEntry = &pMac->lim.gpSession[0];
6558
6559 if (mode == eLIM_STOP_TX)
6560 pTxCtrlMsg->stopTx = eANI_BOOLEAN_TRUE;
6561 else
6562 pTxCtrlMsg->stopTx = eANI_BOOLEAN_FALSE;
6563
6564 switch (type)
6565 {
6566 case eLIM_TX_ALL:
6567 /** Stops/resumes transmission completely */
6568 pTxCtrlMsg->fCtrlGlobal = 1;
6569 break;
6570
6571 case eLIM_TX_BSS_BUT_BEACON:
6572 /** Stops/resumes transmission on a particular BSS. Stopping BSS, doesnt
6573 * stop beacon transmission.
6574 */
6575 pTxCtrlMsg->ctrlBss = 1;
6576 pTxCtrlMsg->bssBitmap |= (1 << psessionEntry->bssIdx);
6577 break;
6578
6579 case eLIM_TX_STA:
6580 /** Memory for station bitmap is allocated dynamically in caller of this
6581 * so decode properly here and fill the bitmap. Now not implemented,
6582 * fall through.
6583 */
6584 case eLIM_TX_BSS:
6585 //Fall thru...
6586 default:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006587 PELOGW(limLog(pMac, LOGW, FL("Invalid case: Not Handled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07006588 return eHAL_STATUS_FAILURE;
6589 }
6590
6591 return eHAL_STATUS_SUCCESS;
6592}
6593
6594/**
6595 * @function : limFrameTransmissionControl()
6596 *
6597 * @brief : This API is called by the user to halt/resume any frame
6598 * transmission from the device. If stopped, all frames will be
6599 * queued starting from hardware. Then back-pressure
6600 * is built till the driver.
6601 * LOGIC:
6602 *
6603 * ASSUMPTIONS:
6604 * NA
6605 *
6606 * NOTE:
6607 * NA
6608 *
6609 * @param pMac - Pointer to Global MAC structure
6610 * @return None
6611 */
6612void limFrameTransmissionControl(tpAniSirGlobal pMac, tLimQuietTxMode type, tLimControlTx mode)
6613{
6614
6615 eHalStatus status = eHAL_STATUS_FAILURE;
6616 tpTxControlParams pTxCtrlMsg;
6617 tSirMsgQ msgQ;
6618 tANI_U8 nBytes = 0; // No of bytes required for station bitmap.
6619
6620 /** Allocate only required number of bytes for station bitmap
6621 * Make it to align to 4 byte boundary */
6622 nBytes = (tANI_U8)HALMSG_NUMBYTES_STATION_BITMAP(pMac->lim.maxStation);
6623
6624 status = palAllocateMemory(pMac->hHdd, (void **) &pTxCtrlMsg,
6625 (sizeof(*pTxCtrlMsg) + nBytes));
6626 if (status != eHAL_STATUS_SUCCESS)
6627 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006628 limLog(pMac, LOGP, FL("palAllocateMemory() failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07006629 return;
6630 }
6631
6632 status = palZeroMemory(pMac->hHdd, (void *) pTxCtrlMsg,
6633 (sizeof(*pTxCtrlMsg) + nBytes));
6634 if (status != eHAL_STATUS_SUCCESS)
6635 {
6636 palFreeMemory(pMac->hHdd, (void *) pTxCtrlMsg);
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006637 limLog(pMac, LOGP, FL("palZeroMemory() failed, status = %d"), status);
Jeff Johnson295189b2012-06-20 16:38:30 -07006638 return;
6639 }
6640
6641 status = __limFillTxControlParams(pMac, pTxCtrlMsg, type, mode);
6642 if (status != eHAL_STATUS_SUCCESS)
6643 {
6644 palFreeMemory(pMac->hHdd, (void *) pTxCtrlMsg);
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006645 limLog(pMac, LOGP, FL("__limFillTxControlParams failed, status = %d"), status);
Jeff Johnson295189b2012-06-20 16:38:30 -07006646 return;
6647 }
6648
6649 msgQ.bodyptr = (void *) pTxCtrlMsg;
6650 msgQ.bodyval = 0;
6651 msgQ.reserved = 0;
6652 msgQ.type = WDA_TRANSMISSION_CONTROL_IND;
6653
Jeff Johnsone7245742012-09-05 17:12:55 -07006654 MTRACE(macTraceMsgTx(pMac, NO_SESSION, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07006655 if(wdaPostCtrlMsg( pMac, &msgQ) != eSIR_SUCCESS)
6656 {
6657 palFreeMemory(pMac->hHdd, (void *) pTxCtrlMsg);
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006658 limLog( pMac, LOGP, FL("Posting Message to HAL failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07006659 return;
6660 }
6661
6662 if (mode == eLIM_STOP_TX)
6663 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006664 PELOG1(limLog(pMac, LOG1, FL("Stopping the transmission of all packets, indicated softmac"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07006665 }
6666 else
6667 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006668 PELOG1(limLog(pMac, LOG1, FL("Resuming the transmission of all packets, indicated softmac"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07006669 }
6670 return;
6671}
6672
6673
6674/**
6675 * @function : limRestorePreChannelSwitchState()
6676 *
6677 * @brief : This API is called by the user to undo any
6678 * specific changes done on the device during
6679 * channel switch.
6680 * LOGIC:
6681 *
6682 * ASSUMPTIONS:
6683 * NA
6684 *
6685 * NOTE:
6686 * NA
6687 *
6688 * @param pMac - Pointer to Global MAC structure
6689 * @return None
6690 */
6691
6692tSirRetStatus
6693limRestorePreChannelSwitchState(tpAniSirGlobal pMac, tpPESession psessionEntry)
6694{
6695
6696 tSirRetStatus retCode = eSIR_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -07006697 tANI_U32 val = 0;
6698
6699 if (psessionEntry->limSystemRole != eLIM_STA_ROLE)
6700 return retCode;
6701
6702 /* Channel switch should be ready for the next time */
Jeff Johnsone7245742012-09-05 17:12:55 -07006703 psessionEntry->gLimSpecMgmt.dot11hChanSwState = eLIM_11H_CHANSW_INIT;
Jeff Johnson295189b2012-06-20 16:38:30 -07006704
6705 /* Restore the frame transmission, all the time. */
6706 limFrameTransmissionControl(pMac, eLIM_TX_ALL, eLIM_RESUME_TX);
6707
6708 /* Free to enter BMPS */
6709 limSendSmePostChannelSwitchInd(pMac);
6710
6711 //Background scan is now enabled by SME
6712 if(pMac->lim.gLimBackgroundScanTerminate == FALSE)
6713 {
6714 /* Enable background scan if already enabled, else don't bother */
6715 if ((retCode = wlan_cfgGetInt(pMac, WNI_CFG_BACKGROUND_SCAN_PERIOD,
6716 &val)) != eSIR_SUCCESS)
6717
6718 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006719 limLog(pMac, LOGP, FL("could not retrieve Background scan period value"));
Jeff Johnson295189b2012-06-20 16:38:30 -07006720 return (retCode);
6721 }
6722
6723 if (val > 0 && TX_TIMER_VALID(pMac->lim.limTimers.gLimBackgroundScanTimer))
6724 {
Jeff Johnsone7245742012-09-05 17:12:55 -07006725 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, psessionEntry->peSessionId, eLIM_BACKGROUND_SCAN_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -07006726 if(tx_timer_activate(&pMac->lim.limTimers.gLimBackgroundScanTimer) != TX_SUCCESS)
6727 {
6728 limLog(pMac, LOGP, FL("Could not restart background scan timer, doing LOGP"));
6729 return (eSIR_FAILURE);
6730 }
6731
6732 }
6733 }
6734
6735 /* Enable heartbeat timer */
6736 if (TX_TIMER_VALID(pMac->lim.limTimers.gLimHeartBeatTimer))
6737 {
Jeff Johnsone7245742012-09-05 17:12:55 -07006738 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, psessionEntry->peSessionId, eLIM_HEART_BEAT_TIMER));
Yathish9f22e662012-12-10 14:21:35 -08006739 if((limActivateHearBeatTimer(pMac) != TX_SUCCESS) && (!IS_ACTIVEMODE_OFFLOAD_FEATURE_ENABLE))
Jeff Johnson295189b2012-06-20 16:38:30 -07006740 {
6741 limLog(pMac, LOGP, FL("Could not restart heartbeat timer, doing LOGP"));
6742 return (eSIR_FAILURE);
6743 }
6744 }
Jeff Johnson295189b2012-06-20 16:38:30 -07006745 return (retCode);
6746}
6747
6748
6749/**--------------------------------------------
6750\fn limRestorePreQuietState
6751\brief Restore the pre quiet state
6752
6753\param pMac
6754\return NONE
6755---------------------------------------------*/
Jeff Johnsone7245742012-09-05 17:12:55 -07006756tSirRetStatus limRestorePreQuietState(tpAniSirGlobal pMac, tpPESession psessionEntry)
Jeff Johnson295189b2012-06-20 16:38:30 -07006757{
6758
6759 tSirRetStatus retCode = eSIR_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -07006760 tANI_U32 val = 0;
6761
6762 if (pMac->lim.gLimSystemRole != eLIM_STA_ROLE)
6763 return retCode;
6764
6765 /* Quiet should be ready for the next time */
Jeff Johnsone7245742012-09-05 17:12:55 -07006766 psessionEntry->gLimSpecMgmt.quietState = eLIM_QUIET_INIT;
Jeff Johnson295189b2012-06-20 16:38:30 -07006767
6768 /* Restore the frame transmission, all the time. */
Jeff Johnsone7245742012-09-05 17:12:55 -07006769 if (psessionEntry->gLimSpecMgmt.quietState == eLIM_QUIET_RUNNING)
Jeff Johnson295189b2012-06-20 16:38:30 -07006770 limFrameTransmissionControl(pMac, eLIM_TX_ALL, eLIM_RESUME_TX);
6771
6772
6773 //Background scan is now enabled by SME
6774 if(pMac->lim.gLimBackgroundScanTerminate == FALSE)
6775 {
6776 /* Enable background scan if already enabled, else don't bother */
6777 if ((retCode = wlan_cfgGetInt(pMac, WNI_CFG_BACKGROUND_SCAN_PERIOD,
6778 &val)) != eSIR_SUCCESS)
6779
6780 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006781 limLog(pMac, LOGP, FL("could not retrieve Background scan period value"));
Jeff Johnson295189b2012-06-20 16:38:30 -07006782 return (retCode);
6783 }
6784
6785 if (val > 0 && TX_TIMER_VALID(pMac->lim.limTimers.gLimBackgroundScanTimer))
6786 {
Leela V Kiran Kumar Reddy Chiralac3b9d382013-01-31 20:49:53 -08006787 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, psessionEntry->peSessionId, eLIM_BACKGROUND_SCAN_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -07006788 if(tx_timer_activate(&pMac->lim.limTimers.gLimBackgroundScanTimer) != TX_SUCCESS)
6789 {
6790 limLog(pMac, LOGP, FL("Could not restart background scan timer, doing LOGP"));
6791 return (eSIR_FAILURE);
6792 }
6793
6794 }
6795 }
6796
6797 /* Enable heartbeat timer */
6798 if (TX_TIMER_VALID(pMac->lim.limTimers.gLimHeartBeatTimer))
6799 {
Leela V Kiran Kumar Reddy Chiralac3b9d382013-01-31 20:49:53 -08006800 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, psessionEntry->peSessionId, eLIM_HEART_BEAT_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -07006801 if(limActivateHearBeatTimer(pMac) != TX_SUCCESS)
6802 {
6803 limLog(pMac, LOGP, FL("Could not restart heartbeat timer, doing LOGP"));
6804 return (eSIR_FAILURE);
6805 }
6806 }
Jeff Johnson295189b2012-06-20 16:38:30 -07006807 return (retCode);
6808}
6809
6810
6811/**
6812 * @function: limPrepareFor11hChannelSwitch()
6813 *
6814 * @brief : This API is called by the user to prepare for
6815 * 11h channel switch. As of now, the API does
6816 * very minimal work. User can add more into the
6817 * same API if needed.
6818 * LOGIC:
6819 *
6820 * ASSUMPTIONS:
6821 * NA
6822 *
6823 * NOTE:
6824 * NA
6825 *
6826 * @param pMac - Pointer to Global MAC structure
6827 * @param psessionEntry
6828 * @return None
6829 */
6830void
6831limPrepareFor11hChannelSwitch(tpAniSirGlobal pMac, tpPESession psessionEntry)
6832{
Jeff Johnson295189b2012-06-20 16:38:30 -07006833 if (psessionEntry->limSystemRole != eLIM_STA_ROLE)
6834 return;
6835
6836 /* Flag to indicate 11h channel switch in progress */
Jeff Johnsone7245742012-09-05 17:12:55 -07006837 psessionEntry->gLimSpecMgmt.dot11hChanSwState = eLIM_11H_CHANSW_RUNNING;
Jeff Johnson295189b2012-06-20 16:38:30 -07006838
6839 /* Disable, Stop background scan if enabled and running */
6840 limDeactivateAndChangeTimer(pMac, eLIM_BACKGROUND_SCAN_TIMER);
6841
6842 /* Stop heart-beat timer to stop heartbeat disassociation */
6843 limHeartBeatDeactivateAndChangeTimer(pMac, psessionEntry);
6844
6845 if(pMac->lim.gLimSmeState == eLIM_SME_LINK_EST_WT_SCAN_STATE ||
6846 pMac->lim.gLimSmeState == eLIM_SME_CHANNEL_SCAN_STATE)
6847 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006848 PELOGE(limLog(pMac, LOGE, FL("Posting finish scan as we are in scan state"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07006849 /* Stop ongoing scanning if any */
6850 if (GET_LIM_PROCESS_DEFD_MESGS(pMac))
6851 {
6852 //Set the resume channel to Any valid channel (invalid).
6853 //This will instruct HAL to set it to any previous valid channel.
6854 peSetResumeChannel(pMac, 0, 0);
6855 limSendHalFinishScanReq(pMac, eLIM_HAL_FINISH_SCAN_WAIT_STATE);
6856 }
6857 else
6858 {
6859 limRestorePreChannelSwitchState(pMac, psessionEntry);
6860 }
6861 return;
6862 }
6863 else
6864 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006865 PELOGE(limLog(pMac, LOGE, FL("Not in scan state, start channel switch timer"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07006866 /** We are safe to switch channel at this point */
6867 limStopTxAndSwitchChannel(pMac, psessionEntry->peSessionId);
6868 }
Jeff Johnson295189b2012-06-20 16:38:30 -07006869}
6870
6871
6872
6873/**----------------------------------------------------
6874\fn limGetNwType
6875
6876\brief Get type of the network from data packet or beacon
6877\param pMac
6878\param channelNum - Channel number
6879\param type - Type of packet.
6880\param pBeacon - Pointer to beacon or probe response
6881
6882\return Network type a/b/g.
6883-----------------------------------------------------*/
6884tSirNwType limGetNwType(tpAniSirGlobal pMac, tANI_U8 channelNum, tANI_U32 type, tpSchBeaconStruct pBeacon)
6885{
6886 tSirNwType nwType = eSIR_11B_NW_TYPE;
6887
6888 if (type == SIR_MAC_DATA_FRAME)
6889 {
6890 if ((channelNum > 0) && (channelNum < 15))
6891 {
6892 nwType = eSIR_11G_NW_TYPE;
6893 }
6894 else
6895 {
6896 nwType = eSIR_11A_NW_TYPE;
6897 }
6898 }
6899 else
6900 {
6901 if ((channelNum > 0) && (channelNum < 15))
6902 {
6903 int i;
6904 // 11b or 11g packet
6905 // 11g iff extended Rate IE is present or
6906 // if there is an A rate in suppRate IE
6907 for (i = 0; i < pBeacon->supportedRates.numRates; i++)
6908 {
6909 if (sirIsArate(pBeacon->supportedRates.rate[i] & 0x7f))
6910 {
6911 nwType = eSIR_11G_NW_TYPE;
6912 break;
6913 }
6914 }
6915 if (pBeacon->extendedRatesPresent)
6916 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006917 PELOG3(limLog(pMac, LOG3, FL("Beacon, nwtype=G"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07006918 nwType = eSIR_11G_NW_TYPE;
6919 }
6920 }
6921 else
6922 {
6923 // 11a packet
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006924 PELOG3(limLog(pMac, LOG3,FL("Beacon, nwtype=A"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07006925 nwType = eSIR_11A_NW_TYPE;
6926 }
6927 }
6928 return nwType;
6929}
6930
6931
6932/**---------------------------------------------------------
6933\fn limGetChannelFromBeacon
6934\brief To extract channel number from beacon
6935
6936\param pMac
6937\param pBeacon - Pointer to beacon or probe rsp
6938\return channel number
6939-----------------------------------------------------------*/
6940tANI_U8 limGetChannelFromBeacon(tpAniSirGlobal pMac, tpSchBeaconStruct pBeacon)
6941{
6942 tANI_U8 channelNum = 0;
6943
6944 if (pBeacon->dsParamsPresent)
6945 channelNum = pBeacon->channelNumber;
6946 else if(pBeacon->HTInfo.present)
6947 channelNum = pBeacon->HTInfo.primaryChannel;
6948 else
6949 channelNum = pBeacon->channelNumber;
6950
6951 return channelNum;
6952}
6953
6954
6955/** ---------------------------------------------------------
6956\fn limSetTspecUapsdMask
6957\brief This function sets the PE global variable:
6958\ 1) gUapsdPerAcTriggerEnableMask and
6959\ 2) gUapsdPerAcDeliveryEnableMask
6960\ based on the user priority field and direction field
6961\ in the TS Info Fields.
6962\
6963\ An AC is a trigger-enabled AC if the PSB subfield
6964\ is set to 1 in the uplink direction.
6965\ An AC is a delivery-enabled AC if the PSB subfield
6966\ is set to 1 in the down-link direction.
6967\
6968\param tpAniSirGlobal pMac
6969\param tSirMacTSInfo pTsInfo
6970\param tANI_U32 action
6971\return None
6972 ------------------------------------------------------------*/
6973void limSetTspecUapsdMask(tpAniSirGlobal pMac, tSirMacTSInfo *pTsInfo, tANI_U32 action)
6974{
6975 tANI_U8 userPrio = (tANI_U8)pTsInfo->traffic.userPrio;
6976 tANI_U16 direction = pTsInfo->traffic.direction;
6977 tANI_U8 ac = upToAc(userPrio);
6978
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006979 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 -07006980
6981 /* Converting AC to appropriate Uapsd Bit Mask
6982 * AC_BE(0) --> UAPSD_BITOFFSET_ACVO(3)
6983 * AC_BK(1) --> UAPSD_BITOFFSET_ACVO(2)
6984 * AC_VI(2) --> UAPSD_BITOFFSET_ACVO(1)
6985 * AC_VO(3) --> UAPSD_BITOFFSET_ACVO(0)
6986 */
6987 ac = ((~ac) & 0x3);
6988
6989 if (action == CLEAR_UAPSD_MASK)
6990 {
6991 if (direction == SIR_MAC_DIRECTION_UPLINK)
6992 pMac->lim.gUapsdPerAcTriggerEnableMask &= ~(1 << ac);
6993 else if (direction == SIR_MAC_DIRECTION_DNLINK)
6994 pMac->lim.gUapsdPerAcDeliveryEnableMask &= ~(1 << ac);
6995 else if (direction == SIR_MAC_DIRECTION_BIDIR)
6996 {
6997 pMac->lim.gUapsdPerAcTriggerEnableMask &= ~(1 << ac);
6998 pMac->lim.gUapsdPerAcDeliveryEnableMask &= ~(1 << ac);
6999 }
7000 }
7001 else if (action == SET_UAPSD_MASK)
7002 {
7003 if (direction == SIR_MAC_DIRECTION_UPLINK)
7004 pMac->lim.gUapsdPerAcTriggerEnableMask |= (1 << ac);
7005 else if (direction == SIR_MAC_DIRECTION_DNLINK)
7006 pMac->lim.gUapsdPerAcDeliveryEnableMask |= (1 << ac);
7007 else if (direction == SIR_MAC_DIRECTION_BIDIR)
7008 {
7009 pMac->lim.gUapsdPerAcTriggerEnableMask |= (1 << ac);
7010 pMac->lim.gUapsdPerAcDeliveryEnableMask |= (1 << ac);
7011 }
7012 }
7013
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007014 limLog(pMac, LOGE, FL("New pMac->lim.gUapsdPerAcTriggerEnableMask = 0x%x "), pMac->lim.gUapsdPerAcTriggerEnableMask );
7015 limLog(pMac, LOGE, FL("New pMac->lim.gUapsdPerAcDeliveryEnableMask = 0x%x "), pMac->lim.gUapsdPerAcDeliveryEnableMask );
Jeff Johnson295189b2012-06-20 16:38:30 -07007016
7017 return;
7018}
7019
7020
7021
7022void limHandleHeartBeatTimeout(tpAniSirGlobal pMac )
7023{
7024
7025 tANI_U8 i;
7026 for(i =0;i < pMac->lim.maxBssId;i++)
7027 {
7028 if(pMac->lim.gpSession[i].valid == TRUE )
7029 {
7030 if(pMac->lim.gpSession[i].bssType == eSIR_IBSS_MODE)
7031 {
7032 limIbssHeartBeatHandle(pMac,&pMac->lim.gpSession[i]);
7033 break;
7034 }
7035
7036 if((pMac->lim.gpSession[i].bssType == eSIR_INFRASTRUCTURE_MODE) &&
7037 (pMac->lim.gpSession[i].limSystemRole == eLIM_STA_ROLE))
7038 {
7039 limHandleHeartBeatFailure(pMac,&pMac->lim.gpSession[i]);
7040 }
7041 }
7042 }
7043 for(i=0; i< pMac->lim.maxBssId; i++)
7044 {
7045 if(pMac->lim.gpSession[i].valid == TRUE )
7046 {
7047 if((pMac->lim.gpSession[i].bssType == eSIR_INFRASTRUCTURE_MODE) &&
7048 (pMac->lim.gpSession[i].limSystemRole == eLIM_STA_ROLE))
7049 {
7050 if(pMac->lim.gpSession[i].LimHBFailureStatus == eANI_BOOLEAN_TRUE)
7051 {
7052 /* Activate Probe After HeartBeat Timer incase HB Failure detected */
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007053 PELOGW(limLog(pMac, LOGW,FL("Sending Probe for Session: %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07007054 i);)
7055 limDeactivateAndChangeTimer(pMac, eLIM_PROBE_AFTER_HB_TIMER);
7056 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, 0, eLIM_PROBE_AFTER_HB_TIMER));
7057 if (tx_timer_activate(&pMac->lim.limTimers.gLimProbeAfterHBTimer) != TX_SUCCESS)
7058 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007059 limLog(pMac, LOGP, FL("Fail to re-activate Probe-after-heartbeat timer"));
Jeff Johnson295189b2012-06-20 16:38:30 -07007060 limReactivateHeartBeatTimer(pMac, &pMac->lim.gpSession[i]);
7061 }
7062 break;
7063 }
7064 }
7065 }
7066 }
7067}
7068
Leela Venkata Kiran Kumar Reddy Chirala3ca17902013-02-27 19:50:05 -08007069void limHandleHeartBeatTimeoutForSession(tpAniSirGlobal pMac, tpPESession psessionEntry)
7070{
7071 if(psessionEntry->valid == TRUE )
7072 {
7073 if(psessionEntry->bssType == eSIR_IBSS_MODE)
7074 {
7075 limIbssHeartBeatHandle(pMac,psessionEntry);
7076 }
7077 if((psessionEntry->bssType == eSIR_INFRASTRUCTURE_MODE) &&
7078 (psessionEntry->limSystemRole == eLIM_STA_ROLE))
7079 {
7080 limHandleHeartBeatFailure(pMac,psessionEntry);
7081 }
7082 }
7083 /* In the function limHandleHeartBeatFailure things can change so check for the session entry valid
7084 and the other things again */
7085 if(psessionEntry->valid == TRUE )
7086 {
7087 if((psessionEntry->bssType == eSIR_INFRASTRUCTURE_MODE) &&
7088 (psessionEntry->limSystemRole == eLIM_STA_ROLE))
7089 {
7090 if(psessionEntry->LimHBFailureStatus == eANI_BOOLEAN_TRUE)
7091 {
7092 /* Activate Probe After HeartBeat Timer incase HB Failure detected */
7093 PELOGW(limLog(pMac, LOGW,FL("Sending Probe for Session: %d"),
7094 psessionEntry->bssIdx);)
7095 limDeactivateAndChangeTimer(pMac, eLIM_PROBE_AFTER_HB_TIMER);
7096 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, 0, eLIM_PROBE_AFTER_HB_TIMER));
7097 if (tx_timer_activate(&pMac->lim.limTimers.gLimProbeAfterHBTimer) != TX_SUCCESS)
7098 {
7099 limLog(pMac, LOGP, FL("Fail to re-activate Probe-after-heartbeat timer"));
7100 limReactivateHeartBeatTimer(pMac, psessionEntry);
7101 }
7102 }
7103 }
7104 }
7105}
7106
7107
Jeff Johnson295189b2012-06-20 16:38:30 -07007108tANI_U8 limGetCurrentOperatingChannel(tpAniSirGlobal pMac)
7109{
7110 tANI_U8 i;
7111 for(i =0;i < pMac->lim.maxBssId;i++)
7112 {
7113 if(pMac->lim.gpSession[i].valid == TRUE )
7114 {
7115 if((pMac->lim.gpSession[i].bssType == eSIR_INFRASTRUCTURE_MODE) &&
7116 (pMac->lim.gpSession[i].limSystemRole == eLIM_STA_ROLE))
7117 {
7118 return pMac->lim.gpSession[i].currentOperChannel;
7119 }
7120 }
7121 }
7122 return 0;
7123}
7124
7125void limProcessAddStaRsp(tpAniSirGlobal pMac,tpSirMsgQ limMsgQ)
7126{
7127
7128 tpPESession psessionEntry;
7129// tANI_U8 sessionId;
7130 tpAddStaParams pAddStaParams;
7131
7132 pAddStaParams = (tpAddStaParams)limMsgQ->bodyptr;
7133
7134 if((psessionEntry = peFindSessionBySessionId(pMac,pAddStaParams->sessionId))==NULL)
7135 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007136 limLog(pMac, LOGP,FL("Session Does not exist for given sessionID"));
Jeff Johnsone7245742012-09-05 17:12:55 -07007137 palFreeMemory(pMac, pAddStaParams);
Jeff Johnson295189b2012-06-20 16:38:30 -07007138 return;
7139 }
7140 if (psessionEntry->limSystemRole == eLIM_STA_IN_IBSS_ROLE)
7141 (void) limIbssAddStaRsp(pMac, limMsgQ->bodyptr,psessionEntry);
Mohit Khanna698ba2a2012-12-04 15:08:18 -08007142#ifdef FEATURE_WLAN_TDLS
7143 else if(pMac->lim.gLimAddStaTdls)
7144 {
7145 limProcessTdlsAddStaRsp(pMac, limMsgQ->bodyptr, psessionEntry) ;
7146 pMac->lim.gLimAddStaTdls = FALSE ;
7147 }
7148#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07007149 else
7150 limProcessMlmAddStaRsp(pMac, limMsgQ,psessionEntry);
7151
7152}
7153
7154
7155void limUpdateBeacon(tpAniSirGlobal pMac)
7156{
7157 tANI_U8 i;
7158
7159 for(i =0;i < pMac->lim.maxBssId;i++)
7160 {
7161 if(pMac->lim.gpSession[i].valid == TRUE )
7162 {
7163 if( ( (pMac->lim.gpSession[i].limSystemRole == eLIM_AP_ROLE) ||
7164 (pMac->lim.gpSession[i].limSystemRole == eLIM_STA_IN_IBSS_ROLE) )
7165 && (eLIM_SME_NORMAL_STATE == pMac->lim.gpSession[i].limSmeState)
7166 )
7167 {
7168 schSetFixedBeaconFields(pMac,&pMac->lim.gpSession[i]);
7169 limSendBeaconInd(pMac, &pMac->lim.gpSession[i]);
7170 }
7171 else
7172 {
7173 if( (pMac->lim.gpSession[i].limSystemRole == eLIM_BT_AMP_AP_ROLE)||
7174 (pMac->lim.gpSession[i].limSystemRole == eLIM_BT_AMP_STA_ROLE))
7175 {
7176
7177 if(pMac->lim.gpSession[i].statypeForBss == STA_ENTRY_SELF)
7178 {
7179 schSetFixedBeaconFields(pMac,&pMac->lim.gpSession[i]);
7180 }
7181 }
7182 }
7183 }
7184 }
7185}
7186
7187void limHandleHeartBeatFailureTimeout(tpAniSirGlobal pMac)
7188{
7189 tANI_U8 i;
7190 tpPESession psessionEntry;
7191 /* Probe response is not received after HB failure. This is handled by LMM sub module. */
7192 for(i =0; i < pMac->lim.maxBssId; i++)
7193 {
7194 if(pMac->lim.gpSession[i].valid == TRUE)
7195 {
7196 psessionEntry = &pMac->lim.gpSession[i];
7197 if(psessionEntry->LimHBFailureStatus == eANI_BOOLEAN_TRUE)
7198 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007199 limLog(pMac, LOGE, FL("Probe_hb_failure: SME %d, MLME %d, HB-Count %d"),psessionEntry->limSmeState,
Jeff Johnson295189b2012-06-20 16:38:30 -07007200 psessionEntry->limMlmState, psessionEntry->LimRxedBeaconCntDuringHB);
7201 if (psessionEntry->limMlmState == eLIM_MLM_LINK_ESTABLISHED_STATE)
7202 {
7203 if (!LIM_IS_CONNECTION_ACTIVE(psessionEntry))
7204 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007205 limLog(pMac, LOGE, FL("Probe_hb_failure: for session:%d " ),psessionEntry->peSessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07007206 /* AP did not respond to Probe Request. Tear down link with it.*/
7207 limTearDownLinkWithAp(pMac,
7208 psessionEntry->peSessionId,
7209 eSIR_BEACON_MISSED);
7210 pMac->lim.gLimProbeFailureAfterHBfailedCnt++ ;
7211 }
7212 else // restart heartbeat timer
7213 {
7214 limReactivateHeartBeatTimer(pMac, psessionEntry);
7215 }
7216 }
7217 else
7218 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007219 limLog(pMac, LOGE, FL("Unexpected wt-probe-timeout in state "));
Jeff Johnson295189b2012-06-20 16:38:30 -07007220 limPrintMlmState(pMac, LOGE, psessionEntry->limMlmState);
7221 limReactivateHeartBeatTimer(pMac, psessionEntry);
7222 }
7223
7224 }
7225 }
7226 }
7227 /* Deactivate Timer ProbeAfterHB Timer -> As its a oneshot timer, need not deactivate the timer */
7228 // tx_timer_deactivate(&pMac->lim.limTimers.gLimProbeAfterHBTimer);
7229}
7230
7231
7232/*
7233* This function assumes there will not be more than one IBSS session active at any time.
7234*/
7235tpPESession limIsIBSSSessionActive(tpAniSirGlobal pMac)
7236{
7237 tANI_U8 i;
7238
7239 for(i =0;i < pMac->lim.maxBssId;i++)
7240 {
7241 if( (pMac->lim.gpSession[i].valid) &&
7242 (pMac->lim.gpSession[i].limSystemRole == eLIM_STA_IN_IBSS_ROLE))
7243 return (&pMac->lim.gpSession[i]);
7244 }
7245
7246 return NULL;
7247}
7248
7249tpPESession limIsApSessionActive(tpAniSirGlobal pMac)
7250{
7251 tANI_U8 i;
7252
7253 for(i =0;i < pMac->lim.maxBssId;i++)
7254 {
7255 if( (pMac->lim.gpSession[i].valid) &&
7256 ( (pMac->lim.gpSession[i].limSystemRole == eLIM_AP_ROLE) ||
7257 (pMac->lim.gpSession[i].limSystemRole == eLIM_BT_AMP_AP_ROLE)))
7258 return (&pMac->lim.gpSession[i]);
7259 }
7260
7261 return NULL;
7262}
7263
7264/**---------------------------------------------------------
7265\fn limHandleDeferMsgError
7266\brief handles error scenario, when the msg can not be deferred.
7267\param pMac
7268\param pLimMsg LIM msg, which could not be deferred.
7269\return void
7270-----------------------------------------------------------*/
7271
7272void limHandleDeferMsgError(tpAniSirGlobal pMac, tpSirMsgQ pLimMsg)
7273{
7274 if(SIR_BB_XPORT_MGMT_MSG == pLimMsg->type)
7275 {
7276 vos_pkt_return_packet((vos_pkt_t*)pLimMsg->bodyptr);
7277 }
7278 else if(pLimMsg->bodyptr != NULL)
7279 palFreeMemory( pMac->hHdd, (tANI_U8 *) pLimMsg->bodyptr);
7280
7281}
7282
7283
7284#ifdef FEATURE_WLAN_DIAG_SUPPORT
7285/**---------------------------------------------------------
7286\fn limDiagEventReport
7287\brief This function reports Diag event
7288\param pMac
7289\param eventType
7290\param bssid
7291\param status
7292\param reasonCode
7293\return void
7294-----------------------------------------------------------*/
7295void limDiagEventReport(tpAniSirGlobal pMac, tANI_U16 eventType, tpPESession pSessionEntry, tANI_U16 status, tANI_U16 reasonCode)
7296{
7297 tSirMacAddr nullBssid = { 0, 0, 0, 0, 0, 0 };
7298 WLAN_VOS_DIAG_EVENT_DEF(peEvent, vos_event_wlan_pe_payload_type);
7299
7300 palZeroMemory(pMac->hHdd, &peEvent, sizeof(vos_event_wlan_pe_payload_type));
7301
7302 if (NULL == pSessionEntry)
7303 {
7304 palCopyMemory(pMac->hHdd, peEvent.bssid, nullBssid, sizeof(tSirMacAddr));
7305 peEvent.sme_state = (tANI_U16)pMac->lim.gLimSmeState;
7306 peEvent.mlm_state = (tANI_U16)pMac->lim.gLimMlmState;
7307
7308 }
7309 else
7310 {
7311 palCopyMemory(pMac->hHdd, peEvent.bssid, pSessionEntry->bssId, sizeof(tSirMacAddr));
7312 peEvent.sme_state = (tANI_U16)pSessionEntry->limSmeState;
7313 peEvent.mlm_state = (tANI_U16)pSessionEntry->limMlmState;
7314 }
7315 peEvent.event_type = eventType;
7316 peEvent.status = status;
7317 peEvent.reason_code = reasonCode;
7318
7319 WLAN_VOS_DIAG_EVENT_REPORT(&peEvent, EVENT_WLAN_PE);
7320 return;
7321}
7322
7323#endif /* FEATURE_WLAN_DIAG_SUPPORT */
7324
7325void limProcessAddStaSelfRsp(tpAniSirGlobal pMac,tpSirMsgQ limMsgQ)
7326{
7327
7328 tpAddStaSelfParams pAddStaSelfParams;
7329 tSirMsgQ mmhMsg;
7330 tpSirSmeAddStaSelfRsp pRsp;
7331
7332
7333 pAddStaSelfParams = (tpAddStaSelfParams)limMsgQ->bodyptr;
7334
7335 if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&pRsp, sizeof(tSirSmeAddStaSelfRsp)))
7336 {
7337 /// Buffer not available. Log error
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007338 limLog(pMac, LOGP, FL("call to palAllocateMemory failed for Add Sta self RSP"));
Jeff Johnsone7245742012-09-05 17:12:55 -07007339 palFreeMemory( pMac->hHdd, (tANI_U8 *)pAddStaSelfParams);
Jeff Johnson295189b2012-06-20 16:38:30 -07007340 return;
7341 }
7342
7343 palZeroMemory(pMac, (tANI_U8*)pRsp, sizeof(tSirSmeAddStaSelfRsp));
7344
7345 pRsp->mesgType = eWNI_SME_ADD_STA_SELF_RSP;
7346 pRsp->mesgLen = (tANI_U16) sizeof(tSirSmeAddStaSelfRsp);
7347 pRsp->status = pAddStaSelfParams->status;
7348
7349 palCopyMemory( pMac->hHdd, pRsp->selfMacAddr, pAddStaSelfParams->selfMacAddr, sizeof(tSirMacAddr) );
7350
7351 palFreeMemory( pMac->hHdd, (tANI_U8 *)pAddStaSelfParams);
7352
7353 mmhMsg.type = eWNI_SME_ADD_STA_SELF_RSP;
7354 mmhMsg.bodyptr = pRsp;
7355 mmhMsg.bodyval = 0;
Jeff Johnsone7245742012-09-05 17:12:55 -07007356 MTRACE(macTraceMsgTx(pMac, NO_SESSION, mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07007357 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
7358
7359}
7360
7361void limProcessDelStaSelfRsp(tpAniSirGlobal pMac,tpSirMsgQ limMsgQ)
7362{
7363
7364 tpDelStaSelfParams pDelStaSelfParams;
7365 tSirMsgQ mmhMsg;
7366 tpSirSmeDelStaSelfRsp pRsp;
7367
7368
7369 pDelStaSelfParams = (tpDelStaSelfParams)limMsgQ->bodyptr;
7370
7371 if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&pRsp, sizeof(tSirSmeDelStaSelfRsp)))
7372 {
7373 /// Buffer not available. Log error
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007374 limLog(pMac, LOGP, FL("call to palAllocateMemory failed for Add Sta self RSP"));
Jeff Johnsone7245742012-09-05 17:12:55 -07007375 palFreeMemory( pMac->hHdd, (tANI_U8 *)pDelStaSelfParams);
Jeff Johnson295189b2012-06-20 16:38:30 -07007376 return;
7377 }
7378
7379 palZeroMemory(pMac, (tANI_U8*)pRsp, sizeof(tSirSmeDelStaSelfRsp));
7380
7381 pRsp->mesgType = eWNI_SME_DEL_STA_SELF_RSP;
7382 pRsp->mesgLen = (tANI_U16) sizeof(tSirSmeDelStaSelfRsp);
7383 pRsp->status = pDelStaSelfParams->status;
7384
7385 palCopyMemory( pMac->hHdd, pRsp->selfMacAddr, pDelStaSelfParams->selfMacAddr, sizeof(tSirMacAddr) );
7386
7387 palFreeMemory( pMac->hHdd, (tANI_U8 *)pDelStaSelfParams);
7388
7389 mmhMsg.type = eWNI_SME_DEL_STA_SELF_RSP;
7390 mmhMsg.bodyptr = pRsp;
7391 mmhMsg.bodyval = 0;
Jeff Johnsone7245742012-09-05 17:12:55 -07007392 MTRACE(macTraceMsgTx(pMac, NO_SESSION, mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07007393 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
7394
7395}
7396
7397/***************************************************************
7398* tANI_U8 limUnmapChannel(tANI_U8 mapChannel)
7399* To unmap the channel to reverse the effect of mapping
7400* a band channel in hal .Mapping was done hal to overcome the
7401* limitation of the rxbd which use only 4 bit for channel number.
7402*****************************************************************/
7403tANI_U8 limUnmapChannel(tANI_U8 mapChannel)
7404{
7405 if( mapChannel > 0 && mapChannel < 25 )
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07007406#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
7407 if (IS_ROAM_SCAN_OFFLOAD_FEATURE_ENABLE)
7408 return aUnsortedChannelList[mapChannel -1];
7409 else
7410#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07007411 return abChannel[mapChannel -1];
7412 else
7413 return 0;
7414}
7415
7416
7417v_U8_t* limGetIEPtr(tpAniSirGlobal pMac, v_U8_t *pIes, int length, v_U8_t eid,eSizeOfLenField size_of_len_field)
7418{
7419 int left = length;
7420 v_U8_t *ptr = pIes;
7421 v_U8_t elem_id;
7422 v_U16_t elem_len;
7423
7424 while(left >= (size_of_len_field+1))
7425 {
7426 elem_id = ptr[0];
7427 if (size_of_len_field == TWO_BYTE)
7428 {
7429 elem_len = ((v_U16_t) ptr[1]) | (ptr[2]<<8);
7430 }
7431 else
7432 {
7433 elem_len = ptr[1];
7434 }
7435
7436
7437 left -= (size_of_len_field+1);
7438 if(elem_len > left)
7439 {
7440 limLog(pMac, LOGE,
Madan Mohan Koyyalamudi8bdd3112012-09-24 13:55:14 -07007441 FL("****Invalid IEs eid = %d elem_len=%d left=%d*****"),
Jeff Johnson295189b2012-06-20 16:38:30 -07007442 eid,elem_len,left);
7443 return NULL;
7444 }
7445 if (elem_id == eid)
7446 {
7447 return ptr;
7448 }
7449
7450 left -= elem_len;
7451 ptr += (elem_len + (size_of_len_field+1));
7452 }
7453 return NULL;
7454}
7455
7456/* return NULL if oui is not found in ie
7457 return !NULL pointer to vendor IE (starting from 0xDD) if oui is found
7458 */
7459v_U8_t* limGetVendorIEOuiPtr(tpAniSirGlobal pMac, tANI_U8 *oui, tANI_U8 oui_size, tANI_U8 *ie, tANI_U16 ie_len)
7460{
7461 int left = ie_len;
7462 v_U8_t *ptr = ie;
7463 v_U8_t elem_id, elem_len;
7464
7465 while(left >= 2)
7466 {
7467 elem_id = ptr[0];
7468 elem_len = ptr[1];
7469 left -= 2;
7470 if(elem_len > left)
7471 {
7472 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007473 FL("****Invalid IEs eid = %d elem_len=%d left=%d*****"),
Jeff Johnson295189b2012-06-20 16:38:30 -07007474 elem_id,elem_len,left);
7475 return NULL;
7476 }
7477 if (SIR_MAC_EID_VENDOR == elem_id)
7478 {
7479 if(memcmp(&ptr[2], oui, oui_size)==0)
7480 return ptr;
7481 }
7482
7483 left -= elem_len;
7484 ptr += (elem_len + 2);
7485 }
7486 return NULL;
7487}
7488
Jeff Johnson295189b2012-06-20 16:38:30 -07007489//Returns length of P2P stream and Pointer ie passed to this function is filled with noa stream
7490
7491v_U8_t limBuildP2pIe(tpAniSirGlobal pMac, tANI_U8 *ie, tANI_U8 *data, tANI_U8 ie_len)
7492{
7493 int length = 0;
7494 tANI_U8 *ptr = ie;
7495
7496 ptr[length++] = SIR_MAC_EID_VENDOR;
7497 ptr[length++] = ie_len + SIR_MAC_P2P_OUI_SIZE;
7498 palCopyMemory( pMac->hHdd, &ptr[length], SIR_MAC_P2P_OUI, SIR_MAC_P2P_OUI_SIZE);
7499 palCopyMemory( pMac->hHdd, &ptr[length + SIR_MAC_P2P_OUI_SIZE], data, ie_len);
7500 return (ie_len + SIR_P2P_IE_HEADER_LEN);
7501}
7502
7503//Returns length of NoA stream and Pointer pNoaStream passed to this function is filled with noa stream
7504
7505v_U8_t limGetNoaAttrStreamInMultP2pIes(tpAniSirGlobal pMac,v_U8_t* noaStream,v_U8_t noaLen,v_U8_t overFlowLen)
7506{
7507 v_U8_t overFlowP2pStream[SIR_MAX_NOA_ATTR_LEN];
Krunal Sonic768a932013-05-15 19:26:30 -07007508
7509 if ((noaLen <= (SIR_MAX_NOA_ATTR_LEN+SIR_P2P_IE_HEADER_LEN)) &&
7510 (noaLen >= overFlowLen) && (overFlowLen <= SIR_MAX_NOA_ATTR_LEN))
7511 {
7512 palCopyMemory( pMac->hHdd, overFlowP2pStream,
7513 noaStream + noaLen - overFlowLen, overFlowLen);
7514 noaStream[noaLen - overFlowLen] = SIR_MAC_EID_VENDOR;
7515 noaStream[noaLen - overFlowLen + 1] = overFlowLen + SIR_MAC_P2P_OUI_SIZE;
7516 palCopyMemory( pMac->hHdd, noaStream+noaLen-overFlowLen + 2,
7517 SIR_MAC_P2P_OUI, SIR_MAC_P2P_OUI_SIZE);
7518 palCopyMemory( pMac->hHdd,
7519 noaStream+noaLen + 2 + SIR_MAC_P2P_OUI_SIZE - overFlowLen,
7520 overFlowP2pStream, overFlowLen);
7521 }
7522
Jeff Johnson295189b2012-06-20 16:38:30 -07007523 return (noaLen + SIR_P2P_IE_HEADER_LEN);
7524
7525}
7526
7527//Returns length of NoA stream and Pointer pNoaStream passed to this function is filled with noa stream
7528v_U8_t limGetNoaAttrStream(tpAniSirGlobal pMac, v_U8_t*pNoaStream,tpPESession psessionEntry)
7529{
7530 v_U8_t len=0;
7531
7532 v_U8_t *pBody = pNoaStream;
7533
7534
7535 if ( (psessionEntry != NULL) && (psessionEntry->valid) &&
7536 (psessionEntry->pePersona == VOS_P2P_GO_MODE))
7537 {
7538 if ((!(psessionEntry->p2pGoPsUpdate.uNoa1Duration)) && (!(psessionEntry->p2pGoPsUpdate.uNoa2Duration))
7539 && (!psessionEntry->p2pGoPsUpdate.oppPsFlag)
7540 )
7541 return 0; //No NoA Descriptor then return 0
7542
7543
7544 pBody[0] = SIR_P2P_NOA_ATTR;
7545
7546 pBody[3] = psessionEntry->p2pGoPsUpdate.index;
7547 pBody[4] = psessionEntry->p2pGoPsUpdate.ctWin | (psessionEntry->p2pGoPsUpdate.oppPsFlag<<7);
7548 len = 5;
7549 pBody += len;
7550
7551
7552 if (psessionEntry->p2pGoPsUpdate.uNoa1Duration)
7553 {
7554 *pBody = psessionEntry->p2pGoPsUpdate.uNoa1IntervalCnt;
7555 pBody += 1;
7556 len +=1;
7557
7558 *((tANI_U32 *)(pBody)) = sirSwapU32ifNeeded(psessionEntry->p2pGoPsUpdate.uNoa1Duration);
7559 pBody += sizeof(tANI_U32);
7560 len +=4;
7561
7562 *((tANI_U32 *)(pBody)) = sirSwapU32ifNeeded(psessionEntry->p2pGoPsUpdate.uNoa1Interval);
7563 pBody += sizeof(tANI_U32);
7564 len +=4;
7565
7566 *((tANI_U32 *)(pBody)) = sirSwapU32ifNeeded(psessionEntry->p2pGoPsUpdate.uNoa1StartTime);
7567 pBody += sizeof(tANI_U32);
7568 len +=4;
7569
7570 }
7571
7572 if (psessionEntry->p2pGoPsUpdate.uNoa2Duration)
7573 {
7574 *pBody = psessionEntry->p2pGoPsUpdate.uNoa2IntervalCnt;
7575 pBody += 1;
7576 len +=1;
7577
7578 *((tANI_U32 *)(pBody)) = sirSwapU32ifNeeded(psessionEntry->p2pGoPsUpdate.uNoa2Duration);
7579 pBody += sizeof(tANI_U32);
7580 len +=4;
7581
7582 *((tANI_U32 *)(pBody)) = sirSwapU32ifNeeded(psessionEntry->p2pGoPsUpdate.uNoa2Interval);
7583 pBody += sizeof(tANI_U32);
7584 len +=4;
7585
7586 *((tANI_U32 *)(pBody)) = sirSwapU32ifNeeded(psessionEntry->p2pGoPsUpdate.uNoa2StartTime);
7587 pBody += sizeof(tANI_U32);
7588 len +=4;
7589
7590 }
7591
7592
7593 pBody = pNoaStream + 1;
7594 *((tANI_U16 *)(pBody)) = sirSwapU16ifNeeded(len-3);/*one byte for Attr and 2 bytes for length*/
7595
7596 return (len);
7597
7598 }
7599 return 0;
7600
7601}
Jeff Johnsone7245742012-09-05 17:12:55 -07007602
7603void peSetResumeChannel(tpAniSirGlobal pMac, tANI_U16 channel, ePhyChanBondState phyCbState)
Jeff Johnson295189b2012-06-20 16:38:30 -07007604{
7605
7606 pMac->lim.gResumeChannel = channel;
Jeff Johnsone7245742012-09-05 17:12:55 -07007607 pMac->lim.gResumePhyCbState = phyCbState;
Jeff Johnson295189b2012-06-20 16:38:30 -07007608}
Jeff Johnsone7245742012-09-05 17:12:55 -07007609
Jeff Johnson295189b2012-06-20 16:38:30 -07007610/*--------------------------------------------------------------------------
7611
7612 \brief peGetResumeChannel() - Returns the channel number for scanning, from a valid session.
7613
Jeff Johnsone7245742012-09-05 17:12:55 -07007614 This function returns the channel to resume to during link resume. channel id of 0 means HAL will
7615 resume to previous channel before link suspend
Jeff Johnson295189b2012-06-20 16:38:30 -07007616
7617 \param pMac - pointer to global adapter context
7618 \return - channel to scan from valid session else zero.
7619
7620 \sa
7621
7622 --------------------------------------------------------------------------*/
Jeff Johnsone7245742012-09-05 17:12:55 -07007623void peGetResumeChannel(tpAniSirGlobal pMac, tANI_U8* resumeChannel, ePhyChanBondState* resumePhyCbState)
Jeff Johnson295189b2012-06-20 16:38:30 -07007624{
7625
7626 //Rationale - this could be the suspend/resume for assoc and it is essential that
7627 //the new BSS is active for some time. Other BSS was anyway suspended.
7628 //TODO: Comeup with a better alternative. Sending NULL with PM=0 on other BSS means
7629 //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 -07007630 //and hence should be ok. Need to discuss this further
7631 if( !limIsInMCC(pMac) )
Jeff Johnson295189b2012-06-20 16:38:30 -07007632 {
7633 //Get current active session channel
Jeff Johnsone7245742012-09-05 17:12:55 -07007634 peGetActiveSessionChannel(pMac, resumeChannel, resumePhyCbState);
Jeff Johnson295189b2012-06-20 16:38:30 -07007635 }
7636 else
7637 {
Jeff Johnsone7245742012-09-05 17:12:55 -07007638 *resumeChannel = pMac->lim.gResumeChannel;
7639 *resumePhyCbState = pMac->lim.gResumePhyCbState;
Jeff Johnson295189b2012-06-20 16:38:30 -07007640 }
Jeff Johnsone7245742012-09-05 17:12:55 -07007641 return;
Jeff Johnson295189b2012-06-20 16:38:30 -07007642}
7643
Viral Modid86bde22012-12-10 13:09:21 -08007644tANI_BOOLEAN limIsNOAInsertReqd(tpAniSirGlobal pMac)
7645{
7646 tANI_U8 i;
7647 for(i =0; i < pMac->lim.maxBssId; i++)
7648 {
7649 if(pMac->lim.gpSession[i].valid == TRUE)
7650 {
7651 if( (eLIM_AP_ROLE == pMac->lim.gpSession[i].limSystemRole )
7652 && ( VOS_P2P_GO_MODE == pMac->lim.gpSession[i].pePersona )
7653 )
7654 {
7655 return TRUE;
7656 }
7657 }
7658 }
7659 return FALSE;
7660}
Jeff Johnsone7245742012-09-05 17:12:55 -07007661
Jeff Johnson295189b2012-06-20 16:38:30 -07007662
7663tANI_BOOLEAN limIsconnectedOnDFSChannel(tANI_U8 currentChannel)
7664{
7665 if(NV_CHANNEL_DFS == vos_nv_getChannelEnabledState(currentChannel))
7666 {
7667 return eANI_BOOLEAN_TRUE;
7668 }
7669 else
7670 {
7671 return eANI_BOOLEAN_FALSE;
7672 }
7673}
Madan Mohan Koyyalamudi1bed5982012-10-22 14:38:06 -07007674
Mohit Khanna4a70d262012-09-11 16:30:12 -07007675#ifdef WLAN_FEATURE_11AC
7676tANI_BOOLEAN limCheckVHTOpModeChange( tpAniSirGlobal pMac, tpPESession psessionEntry, tANI_U8 chanWidth, tANI_U8 staId)
7677{
7678 tUpdateVHTOpMode tempParam;
7679
7680 tempParam.opMode = chanWidth;
7681 tempParam.staId = staId;
7682
7683 limSendModeUpdate( pMac, &tempParam, psessionEntry );
7684
7685 return eANI_BOOLEAN_TRUE;
7686}
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -07007687#endif
7688
7689tANI_U8 limGetShortSlotFromPhyMode(tpAniSirGlobal pMac, tpPESession psessionEntry, tANI_U32 phyMode)
7690{
7691 tANI_U8 val=0;
7692
7693 if (phyMode == WNI_CFG_PHY_MODE_11A)
7694 {
7695 // 11a mode always uses short slot
7696 // Check this since some APs in 11a mode broadcast long slot in their beacons. As per standard, always use what PHY mandates.
7697 val = true;
7698 }
7699 else if (phyMode == WNI_CFG_PHY_MODE_11G)
7700 {
7701 if ((psessionEntry->pePersona == VOS_STA_SAP_MODE) ||
7702 (psessionEntry->pePersona == VOS_P2P_GO_MODE))
7703 {
7704 val = true;
7705 }
7706
7707 // Program Polaris based on AP capability
7708
7709 if (psessionEntry->limMlmState == eLIM_MLM_WT_JOIN_BEACON_STATE)
7710 // Joining BSS.
7711 val = SIR_MAC_GET_SHORT_SLOT_TIME( psessionEntry->limCurrentBssCaps);
7712 else if (psessionEntry->limMlmState == eLIM_MLM_WT_REASSOC_RSP_STATE)
7713 // Reassociating with AP.
7714 val = SIR_MAC_GET_SHORT_SLOT_TIME( psessionEntry->limReassocBssCaps);
7715 }
7716 else // if (phyMode == WNI_CFG_PHY_MODE_11B) - use this if another phymode is added later ON
7717 {
7718 // Will reach here in 11b case
7719 val = false;
7720 }
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007721 limLog(pMac, LOG1, FL("phyMode = %u shortslotsupported = %u"), phyMode, val);
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -07007722 return val;
7723}