blob: cca6c4d76e92f2596df0c153829d8bffb472f1eb [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
Jeff Johnson295189b2012-06-20 16:38:30 -07001098 pMac->lim.gLimTimersCreated = 0;
1099 }
1100
1101 /// Cleanup cached scan list
1102 limReInitScanResults(pMac);
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07001103#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
1104 /// Cleanup cached scan list
1105 limReInitLfrScanResults(pMac);
1106#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001107
1108} /*** end limCleanupMlm() ***/
1109
1110
1111
1112/**
1113 * limCleanupLmm()
1114 *
1115 *FUNCTION:
1116 * This function is called to cleanup any resources
1117 * allocated by LMM sub-module.
1118 *
1119 *PARAMS:
1120 *
1121 *LOGIC:
1122 *
1123 *ASSUMPTIONS:
1124 * NA
1125 *
1126 *NOTE:
1127 * NA
1128 *
1129 * @param pMac Pointer to Global MAC structure
1130 * @return None
1131 */
1132
1133void
1134limCleanupLmm(tpAniSirGlobal pMac)
1135{
Jeff Johnson295189b2012-06-20 16:38:30 -07001136} /*** end limCleanupLmm() ***/
1137
1138
1139
1140/**
1141 * limIsAddrBC()
1142 *
1143 *FUNCTION:
1144 * This function is called in various places within LIM code
1145 * to determine whether passed MAC address is a broadcast or not
1146 *
1147 *LOGIC:
1148 *
1149 *ASSUMPTIONS:
1150 * NA
1151 *
1152 *NOTE:
1153 * NA
1154 *
1155 * @param macAddr Indicates MAC address that need to be determined
1156 * whether it is Broadcast address or not
1157 *
1158 * @return true if passed address is Broadcast address else false
1159 */
1160
1161tANI_U8
1162limIsAddrBC(tSirMacAddr macAddr)
1163{
1164 int i;
1165 for (i = 0; i < 6; i++)
1166 {
1167 if ((macAddr[i] & 0xFF) != 0xFF)
1168 return false;
1169 }
1170
1171 return true;
1172} /****** end limIsAddrBC() ******/
1173
1174
1175
1176/**
1177 * limIsGroupAddr()
1178 *
1179 *FUNCTION:
1180 * This function is called in various places within LIM code
1181 * to determine whether passed MAC address is a group address or not
1182 *
1183 *LOGIC:
1184 * If least significant bit of first octet of the MAC address is
1185 * set to 1, it is a Group address.
1186 *
1187 *ASSUMPTIONS:
1188 * NA
1189 *
1190 *NOTE:
1191 * NA
1192 *
1193 * @param macAddr Indicates MAC address that need to be determined
1194 * whether it is Group address or not
1195 *
1196 * @return true if passed address is Group address else false
1197 */
1198
1199tANI_U8
1200limIsGroupAddr(tSirMacAddr macAddr)
1201{
1202 if ((macAddr[0] & 0x01) == 0x01)
1203 return true;
1204 else
1205 return false;
1206} /****** end limIsGroupAddr() ******/
1207
1208/**
1209 * limPostMsgApiNoWait()
1210 *
1211 *FUNCTION:
1212 * This function is called from other thread while posting a
1213 * message to LIM message Queue gSirLimMsgQ with NO_WAIT option
1214 *
1215 *LOGIC:
1216 * NA
1217 *
1218 *ASSUMPTIONS:
1219 * NA
1220 *
1221 *NOTE:
1222 * NA
1223 *
1224 * @param pMsg - Pointer to the Global MAC structure
1225 * @param pMsg - Pointer to the message structure
1226 * @return None
1227 */
1228
1229tANI_U32
1230limPostMsgApiNoWait(tpAniSirGlobal pMac, tSirMsgQ *pMsg)
1231{
Jeff Johnson295189b2012-06-20 16:38:30 -07001232 limProcessMessages(pMac, pMsg);
1233 return TX_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -07001234} /*** end limPostMsgApiNoWait() ***/
1235
1236
1237
1238/**
1239 * limPrintMacAddr()
1240 *
1241 *FUNCTION:
1242 * This function is called to print passed MAC address
1243 * in : format.
1244 *
1245 *LOGIC:
1246 *
1247 *ASSUMPTIONS:
1248 * NA
1249 *
1250 *NOTE:
1251 * @param macAddr - MacAddr to be printed
1252 * @param logLevel - Loglevel to be used
1253 *
1254 * @return None.
1255 */
1256
1257void
1258limPrintMacAddr(tpAniSirGlobal pMac, tSirMacAddr macAddr, tANI_U8 logLevel)
1259{
1260 limLog(pMac, logLevel,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001261 FL("%X:%X:%X:%X:%X:%X"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001262 macAddr[0], macAddr[1], macAddr[2], macAddr[3], macAddr[4],
1263 macAddr[5]);
1264} /****** end limPrintMacAddr() ******/
1265
1266
1267
1268
1269
1270
1271/*
1272 * limResetDeferredMsgQ()
1273 *
1274 *FUNCTION:
1275 * This function resets the deferred message queue parameters.
1276 *
1277 *PARAMS:
1278 * @param pMac - Pointer to Global MAC structure
1279 *
1280 *LOGIC:
1281 *
1282 *ASSUMPTIONS:
1283 * NA
1284 *
1285 *NOTE:
1286 * NA
1287 *
1288 *RETURNS:
1289 * None
1290 */
1291
1292void limResetDeferredMsgQ(tpAniSirGlobal pMac)
1293{
1294 pMac->lim.gLimDeferredMsgQ.size =
1295 pMac->lim.gLimDeferredMsgQ.write =
1296 pMac->lim.gLimDeferredMsgQ.read = 0;
1297
1298}
1299
1300
1301#define LIM_DEFERRED_Q_CHECK_THRESHOLD (MAX_DEFERRED_QUEUE_LEN/2)
1302#define LIM_MAX_NUM_MGMT_FRAME_DEFERRED (MAX_DEFERRED_QUEUE_LEN/2)
1303
1304/*
1305 * limWriteDeferredMsgQ()
1306 *
1307 *FUNCTION:
1308 * This function queues up a deferred message for later processing on the
1309 * STA side.
1310 *
1311 *PARAMS:
1312 * @param pMac - Pointer to Global MAC structure
1313 * @param limMsg - a LIM message
1314 *
1315 *LOGIC:
1316 *
1317 *ASSUMPTIONS:
1318 * NA
1319 *
1320 *NOTE:
1321 * NA
1322 *
1323 *RETURNS:
1324 * None
1325 */
1326
1327tANI_U8 limWriteDeferredMsgQ(tpAniSirGlobal pMac, tpSirMsgQ limMsg)
1328{
1329 PELOG1(limLog(pMac, LOG1,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001330 FL("** Queue a deferred message (size %d, write %d) - type 0x%x **"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001331 pMac->lim.gLimDeferredMsgQ.size, pMac->lim.gLimDeferredMsgQ.write,
1332 limMsg->type);)
1333
1334 /*
1335 ** check if the deferred message queue is full
1336 **/
1337 if (pMac->lim.gLimDeferredMsgQ.size >= MAX_DEFERRED_QUEUE_LEN)
1338 {
Leela Venkata Kiran Kumar Reddy Chirala2247e962013-03-22 19:21:10 -07001339 if(!(pMac->lim.deferredMsgCnt & 0xF))
1340 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001341 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 -07001342 }
1343 else
1344 {
1345 pMac->lim.deferredMsgCnt++;
1346 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001347 return TX_QUEUE_FULL;
1348 }
1349
1350 /*
1351 ** In the application, there should not be more than 1 message get
1352 ** queued up. If happens, flags a warning. In the future, this can
1353 ** happen.
1354 **/
1355 if (pMac->lim.gLimDeferredMsgQ.size > 0)
1356 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001357 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 -07001358 pMac->lim.gLimDeferredMsgQ.size, limMsg->type,
1359 limIsSystemInScanState(pMac),
1360 pMac->lim.gLimSmeState, pMac->lim.gLimMlmState,
1361 pMac->lim.gLimAddtsSent);)
1362 }
1363
1364 /*
1365 ** To prevent the deferred Q is full of management frames, only give them certain space
1366 **/
1367 if( SIR_BB_XPORT_MGMT_MSG == limMsg->type )
1368 {
1369 if( LIM_DEFERRED_Q_CHECK_THRESHOLD < pMac->lim.gLimDeferredMsgQ.size )
1370 {
1371 tANI_U16 idx, count = 0;
1372 for(idx = 0; idx < pMac->lim.gLimDeferredMsgQ.size; idx++)
1373 {
1374 if( SIR_BB_XPORT_MGMT_MSG == pMac->lim.gLimDeferredMsgQ.deferredQueue[idx].type )
1375 {
1376 count++;
1377 }
1378 }
1379 if( LIM_MAX_NUM_MGMT_FRAME_DEFERRED < count )
1380 {
1381 //We reach the quota for management frames, drop this one
Madan Mohan Koyyalamudi5695b502012-09-24 14:21:12 -07001382 PELOGW(limLog(pMac, LOGW, FL("Cannot deferred. Msg: %d Too many (count=%d) already"), limMsg->type, count);)
Jeff Johnson295189b2012-06-20 16:38:30 -07001383 //Return error, caller knows what to do
1384 return TX_QUEUE_FULL;
1385 }
1386 }
1387 }
1388
1389 ++pMac->lim.gLimDeferredMsgQ.size;
1390
Leela Venkata Kiran Kumar Reddy Chirala2247e962013-03-22 19:21:10 -07001391 /* reset the count here since we are able to defer the message */
1392 if(pMac->lim.deferredMsgCnt != 0)
1393 {
1394 pMac->lim.deferredMsgCnt = 0;
1395 }
1396
Jeff Johnson295189b2012-06-20 16:38:30 -07001397 /*
1398 ** if the write pointer hits the end of the queue, rewind it
1399 **/
1400 if (pMac->lim.gLimDeferredMsgQ.write >= MAX_DEFERRED_QUEUE_LEN)
1401 pMac->lim.gLimDeferredMsgQ.write = 0;
1402
1403 /*
1404 ** save the message to the queue and advanced the write pointer
1405 **/
1406 palCopyMemory(pMac->hHdd,
1407 (tANI_U8 *)&pMac->lim.gLimDeferredMsgQ.deferredQueue[pMac->lim.gLimDeferredMsgQ.write++],
1408 (tANI_U8 *)limMsg,
1409 sizeof(tSirMsgQ));
1410 return TX_SUCCESS;
1411
1412}
1413
1414/*
1415 * limReadDeferredMsgQ()
1416 *
1417 *FUNCTION:
1418 * This function dequeues a deferred message for processing on the
1419 * STA side.
1420 *
1421 *PARAMS:
1422 * @param pMac - Pointer to Global MAC structure
1423 *
1424 *LOGIC:
1425 *
1426 *ASSUMPTIONS:
1427 * NA
1428 *
1429 *NOTE:
1430 *
1431 *
1432 *RETURNS:
1433 * Returns the message at the head of the deferred message queue
1434 */
1435
1436tSirMsgQ* limReadDeferredMsgQ(tpAniSirGlobal pMac)
1437{
1438 tSirMsgQ *msg;
1439
1440 /*
1441 ** check any messages left. If no, return
1442 **/
1443 if (pMac->lim.gLimDeferredMsgQ.size <= 0)
1444 return NULL;
1445
1446 /*
1447 ** decrement the queue size
1448 **/
1449 pMac->lim.gLimDeferredMsgQ.size--;
1450
1451 /*
1452 ** retrieve the message from the head of the queue
1453 **/
1454 msg = &pMac->lim.gLimDeferredMsgQ.deferredQueue[pMac->lim.gLimDeferredMsgQ.read];
1455
1456 /*
1457 ** advance the read pointer
1458 **/
1459 pMac->lim.gLimDeferredMsgQ.read++;
1460
1461 /*
1462 ** if the read pointer hits the end of the queue, rewind it
1463 **/
1464 if (pMac->lim.gLimDeferredMsgQ.read >= MAX_DEFERRED_QUEUE_LEN)
1465 pMac->lim.gLimDeferredMsgQ.read = 0;
1466
1467 PELOG1(limLog(pMac, LOG1,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001468 FL("** DeQueue a deferred message (size %d read %d) - type 0x%x **"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001469 pMac->lim.gLimDeferredMsgQ.size, pMac->lim.gLimDeferredMsgQ.read,
1470 msg->type);)
1471
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001472 PELOG1(limLog(pMac, LOG1, FL("DQ msg -- scan %d, global sme %d, global mlme %d, addts %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001473 limIsSystemInScanState(pMac),
1474 pMac->lim.gLimSmeState, pMac->lim.gLimMlmState,
1475 pMac->lim.gLimAddtsSent);)
1476
1477 return(msg);
1478}
1479
1480tSirRetStatus
1481limSysProcessMmhMsgApi(tpAniSirGlobal pMac,
1482 tSirMsgQ *pMsg,
1483 tANI_U8 qType)
1484{
1485// FIXME
Jeff Johnson295189b2012-06-20 16:38:30 -07001486 SysProcessMmhMsg(pMac, pMsg);
1487 return eSIR_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -07001488}
1489
1490char *limFrameStr(tANI_U32 type, tANI_U32 subType)
1491{
1492#ifdef FIXME_GEN6
1493
1494 if (type == SIR_MAC_MGMT_FRAME)
1495 {
1496 switch (subType)
1497 {
1498 case SIR_MAC_MGMT_ASSOC_REQ:
1499 return "MAC_MGMT_ASSOC_REQ";
1500 case SIR_MAC_MGMT_ASSOC_RSP:
1501 return "MAC_MGMT_ASSOC_RSP";
1502 case SIR_MAC_MGMT_REASSOC_REQ:
1503 return "MAC_MGMT_REASSOC_REQ";
1504 case SIR_MAC_MGMT_REASSOC_RSP:
1505 return "MAC_MGMT_REASSOC_RSP";
1506 case SIR_MAC_MGMT_PROBE_REQ:
1507 return "MAC_MGMT_PROBE_REQ";
1508 case SIR_MAC_MGMT_PROBE_RSP:
1509 return "MAC_MGMT_PROBE_RSP";
1510 case SIR_MAC_MGMT_BEACON:
1511 return "MAC_MGMT_BEACON";
1512 case SIR_MAC_MGMT_ATIM:
1513 return "MAC_MGMT_ATIM";
1514 case SIR_MAC_MGMT_DISASSOC:
1515 return "MAC_MGMT_DISASSOC";
1516 case SIR_MAC_MGMT_AUTH:
1517 return "MAC_MGMT_AUTH";
1518 case SIR_MAC_MGMT_DEAUTH:
1519 return "MAC_MGMT_DEAUTH";
1520 case SIR_MAC_MGMT_ACTION:
1521 return "MAC_MGMT_ACTION";
1522 case SIR_MAC_MGMT_RESERVED15:
1523 return "MAC_MGMT_RESERVED15";
1524 default:
1525 return "Unknown MGMT Frame";
1526 }
1527 }
1528
1529 else if (type == SIR_MAC_CTRL_FRAME)
1530 {
1531 switch (subType)
1532 {
1533 case SIR_MAC_CTRL_RR:
1534 return "MAC_CTRL_RR";
1535 case SIR_MAC_CTRL_BAR:
1536 return "MAC_CTRL_BAR";
1537 case SIR_MAC_CTRL_BA:
1538 return "MAC_CTRL_BA";
1539 case SIR_MAC_CTRL_PS_POLL:
1540 return "MAC_CTRL_PS_POLL";
1541 case SIR_MAC_CTRL_RTS:
1542 return "MAC_CTRL_RTS";
1543 case SIR_MAC_CTRL_CTS:
1544 return "MAC_CTRL_CTS";
1545 case SIR_MAC_CTRL_ACK:
1546 return "MAC_CTRL_ACK";
1547 case SIR_MAC_CTRL_CF_END:
1548 return "MAC_CTRL_CF_END";
1549 case SIR_MAC_CTRL_CF_END_ACK:
1550 return "MAC_CTRL_CF_END_ACK";
1551 default:
1552 return "Unknown CTRL Frame";
1553 }
1554 }
1555
1556 else if (type == SIR_MAC_DATA_FRAME)
1557 {
1558 switch (subType)
1559 {
1560 case SIR_MAC_DATA_DATA:
1561 return "MAC_DATA_DATA";
1562 case SIR_MAC_DATA_DATA_ACK:
1563 return "MAC_DATA_DATA_ACK";
1564 case SIR_MAC_DATA_DATA_POLL:
1565 return "MAC_DATA_DATA_POLL";
1566 case SIR_MAC_DATA_DATA_ACK_POLL:
1567 return "MAC_DATA_DATA_ACK_POLL";
1568 case SIR_MAC_DATA_NULL:
1569 return "MAC_DATA_NULL";
1570 case SIR_MAC_DATA_NULL_ACK:
1571 return "MAC_DATA_NULL_ACK";
1572 case SIR_MAC_DATA_NULL_POLL:
1573 return "MAC_DATA_NULL_POLL";
1574 case SIR_MAC_DATA_NULL_ACK_POLL:
1575 return "MAC_DATA_NULL_ACK_POLL";
1576 case SIR_MAC_DATA_QOS_DATA:
1577 return "MAC_DATA_QOS_DATA";
1578 case SIR_MAC_DATA_QOS_DATA_ACK:
1579 return "MAC_DATA_QOS_DATA_ACK";
1580 case SIR_MAC_DATA_QOS_DATA_POLL:
1581 return "MAC_DATA_QOS_DATA_POLL";
1582 case SIR_MAC_DATA_QOS_DATA_ACK_POLL:
1583 return "MAC_DATA_QOS_DATA_ACK_POLL";
1584 case SIR_MAC_DATA_QOS_NULL:
1585 return "MAC_DATA_QOS_NULL";
1586 case SIR_MAC_DATA_QOS_NULL_ACK:
1587 return "MAC_DATA_QOS_NULL_ACK";
1588 case SIR_MAC_DATA_QOS_NULL_POLL:
1589 return "MAC_DATA_QOS_NULL_POLL";
1590 case SIR_MAC_DATA_QOS_NULL_ACK_POLL:
1591 return "MAC_DATA_QOS_NULL_ACK_POLL";
1592 default:
1593 return "Unknown Data Frame";
1594 }
1595 }
1596 else
1597 return "Unknown";
1598#endif
1599return "";
1600}
1601
Jeff Johnson295189b2012-06-20 16:38:30 -07001602void limHandleUpdateOlbcCache(tpAniSirGlobal pMac)
1603{
1604 int i;
1605 static int enable;
1606 tUpdateBeaconParams beaconParams;
1607
1608 tpPESession psessionEntry = limIsApSessionActive(pMac);
1609
1610 if (psessionEntry == NULL)
Madan Mohan Koyyalamudi788b4ee2012-09-25 10:42:09 -07001611 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001612 PELOGE(limLog(pMac, LOGE, FL(" Session not found"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001613 return;
Madan Mohan Koyyalamudi788b4ee2012-09-25 10:42:09 -07001614 }
Pratik Bhalgatb44ea3f2012-11-22 16:41:39 +05301615
Madan Mohan Koyyalamudib2733142012-10-31 13:59:17 -07001616 palZeroMemory( pMac->hHdd, ( tANI_U8* )&beaconParams, sizeof( tUpdateBeaconParams) );
1617 beaconParams.bssIdx = psessionEntry->bssIdx;
Jeff Johnson295189b2012-06-20 16:38:30 -07001618
1619 beaconParams.paramChangeBitmap = 0;
1620 /*
1621 ** This is doing a 2 pass check. The first pass is to invalidate
1622 ** all the cache entries. The second pass is to decide whether to
1623 ** disable protection.
1624 **/
1625 if (!enable)
1626 {
1627
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001628 PELOG2(limLog(pMac, LOG2, FL("Resetting OLBC cache"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001629 psessionEntry->gLimOlbcParams.numSta = 0;
1630 psessionEntry->gLimOverlap11gParams.numSta = 0;
1631 psessionEntry->gLimOverlapHt20Params.numSta = 0;
1632 psessionEntry->gLimNonGfParams.numSta = 0;
1633 psessionEntry->gLimLsigTxopParams.numSta = 0;
1634
1635 for (i=0; i < LIM_PROT_STA_OVERLAP_CACHE_SIZE; i++)
1636 pMac->lim.protStaOverlapCache[i].active = false;
1637
1638 enable = 1;
1639 }
1640 else
1641 {
1642
Madan Mohan Koyyalamudi788b4ee2012-09-25 10:42:09 -07001643 if (!psessionEntry->gLimOlbcParams.numSta)
Jeff Johnson295189b2012-06-20 16:38:30 -07001644 {
1645 if (psessionEntry->gLimOlbcParams.protectionEnabled)
1646 {
1647 if (!psessionEntry->gLim11bParams.protectionEnabled)
1648 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001649 PELOG1(limLog(pMac, LOG1, FL("Overlap cache all clear and no 11B STA detected"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001650 limEnable11gProtection(pMac, false, true, &beaconParams, psessionEntry);
1651 }
1652 }
1653 }
1654
1655 if (!psessionEntry->gLimOverlap11gParams.numSta)
1656 {
1657 if (psessionEntry->gLimOverlap11gParams.protectionEnabled)
1658 {
1659 if (!psessionEntry->gLim11gParams.protectionEnabled)
1660 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001661 PELOG1(limLog(pMac, LOG1, FL("Overlap cache all clear and no 11G STA detected"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001662 limEnableHtProtectionFrom11g(pMac, false, true, &beaconParams,psessionEntry);
1663 }
1664 }
1665 }
1666
1667 if (!psessionEntry->gLimOverlapHt20Params.numSta)
1668 {
1669 if (psessionEntry->gLimOverlapHt20Params.protectionEnabled)
1670 {
1671 if (!psessionEntry->gLimHt20Params.protectionEnabled)
1672 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001673 PELOG1(limLog(pMac, LOG1, FL("Overlap cache all clear and no HT20 STA detected"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001674 limEnable11gProtection(pMac, false, true, &beaconParams,psessionEntry);
1675 }
1676 }
1677 }
1678
1679 enable = 0;
1680 }
1681
1682 if(beaconParams.paramChangeBitmap)
1683 {
1684 schSetFixedBeaconFields(pMac,psessionEntry);
1685 limSendBeaconParams(pMac, &beaconParams, psessionEntry);
1686 }
1687
1688 // Start OLBC timer
1689 if (tx_timer_activate(&pMac->lim.limTimers.gLimUpdateOlbcCacheTimer) != TX_SUCCESS)
1690 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001691 limLog(pMac, LOGE, FL("tx_timer_activate failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001692 }
1693}
Jeff Johnson295189b2012-06-20 16:38:30 -07001694
1695/**
1696 * limIsNullSsid()
1697 *
1698 *FUNCTION:
1699 * This function checks if Ssid supplied is Null SSID
1700 *
1701 *
1702 *LOGIC:
1703 *
1704 *ASSUMPTIONS:
1705 * NA
1706 *
1707 *NOTE:
1708 * NA
1709 *
1710 * @param tSirMacSSid *
1711 *
1712 *
1713 * @return true if SSID is Null SSID else false
1714 */
1715
1716tANI_U8
1717limIsNullSsid( tSirMacSSid *pSsid )
1718{
1719 tANI_U8 fNullSsid = false;
1720 tANI_U32 SsidLength;
1721 tANI_U8 *pSsidStr;
1722
1723 do
1724 {
1725 if ( 0 == pSsid->length )
1726 {
1727 fNullSsid = true;
1728 break;
1729 }
1730
1731#define ASCII_SPACE_CHARACTER 0x20
1732 /* If the first charactes is space, then check if all characters in
1733 * SSID are spaces to consider it as NULL SSID*/
1734 if( ASCII_SPACE_CHARACTER == pSsid->ssId[0])
1735 {
1736 SsidLength = pSsid->length;
1737 pSsidStr = pSsid->ssId;
1738 /* check if all the charactes in SSID are spaces*/
1739 while ( SsidLength )
1740 {
1741 if( ASCII_SPACE_CHARACTER != *pSsidStr )
1742 break;
1743
1744 pSsidStr++;
1745 SsidLength--;
1746 }
1747
1748 if( 0 == SsidLength )
1749 {
1750 fNullSsid = true;
1751 break;
1752 }
1753 }
1754 else
1755 {
1756 /* check if all the charactes in SSID are NULL*/
1757 SsidLength = pSsid->length;
1758 pSsidStr = pSsid->ssId;
1759
1760 while ( SsidLength )
1761 {
1762 if( *pSsidStr )
1763 break;
1764
1765 pSsidStr++;
1766 SsidLength--;
1767 }
1768
1769 if( 0 == SsidLength )
1770 {
1771 fNullSsid = true;
1772 break;
1773 }
1774 }
1775 }
1776 while( 0 );
1777
1778 return fNullSsid;
1779} /****** end limIsNullSsid() ******/
1780
1781
1782
Jeff Johnson295189b2012-06-20 16:38:30 -07001783
1784/** -------------------------------------------------------------
1785\fn limUpdateProtStaParams
1786\brief updates protection related counters.
1787\param tpAniSirGlobal pMac
1788\param tSirMacAddr peerMacAddr
1789\param tLimProtStaCacheType protStaCacheType
1790\param tHalBitVal gfSupported
1791\param tHalBitVal lsigTxopSupported
1792\return None
1793 -------------------------------------------------------------*/
1794void
1795limUpdateProtStaParams(tpAniSirGlobal pMac,
1796tSirMacAddr peerMacAddr, tLimProtStaCacheType protStaCacheType,
1797tHalBitVal gfSupported, tHalBitVal lsigTxopSupported,
1798tpPESession psessionEntry)
1799{
1800 tANI_U32 i;
1801
1802 PELOG1(limLog(pMac,LOG1, FL("A STA is associated:"));
1803 limLog(pMac,LOG1, FL("Addr : "));
1804 limPrintMacAddr(pMac, peerMacAddr, LOG1);)
1805
1806 for (i=0; i<LIM_PROT_STA_CACHE_SIZE; i++)
1807 {
1808 if (psessionEntry->protStaCache[i].active)
1809 {
1810 PELOG1(limLog(pMac, LOG1, FL("Addr: "));)
1811 PELOG1(limPrintMacAddr(pMac, psessionEntry->protStaCache[i].addr, LOG1);)
1812
1813 if (palEqualMemory( pMac->hHdd,
1814 psessionEntry->protStaCache[i].addr,
1815 peerMacAddr, sizeof(tSirMacAddr)))
1816 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001817 PELOG1(limLog(pMac, LOG1, FL("matching cache entry at %d already active."), i);)
Jeff Johnson295189b2012-06-20 16:38:30 -07001818 return;
1819 }
1820 }
1821 }
1822
1823 for (i=0; i<LIM_PROT_STA_CACHE_SIZE; i++)
1824 {
1825 if (!psessionEntry->protStaCache[i].active)
1826 break;
1827 }
1828
1829 if (i >= LIM_PROT_STA_CACHE_SIZE)
1830 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001831 PELOGE(limLog(pMac, LOGE, FL("No space in ProtStaCache"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001832 return;
1833 }
1834
1835 palCopyMemory( pMac->hHdd, psessionEntry->protStaCache[i].addr,
1836 peerMacAddr,
1837 sizeof(tSirMacAddr));
1838
1839 psessionEntry->protStaCache[i].protStaCacheType = protStaCacheType;
1840 psessionEntry->protStaCache[i].active = true;
1841 if(eLIM_PROT_STA_CACHE_TYPE_llB == protStaCacheType)
1842 {
1843 psessionEntry->gLim11bParams.numSta++;
1844 limLog(pMac,LOG1, FL("11B, "));
1845 }
1846 else if(eLIM_PROT_STA_CACHE_TYPE_llG == protStaCacheType)
1847 {
1848 psessionEntry->gLim11gParams.numSta++;
1849 limLog(pMac,LOG1, FL("11G, "));
1850 }
1851 else if(eLIM_PROT_STA_CACHE_TYPE_HT20 == protStaCacheType)
1852 {
1853 psessionEntry->gLimHt20Params.numSta++;
1854 limLog(pMac,LOG1, FL("HT20, "));
1855 }
1856
1857 if(!gfSupported)
1858 {
1859 psessionEntry->gLimNonGfParams.numSta++;
1860 limLog(pMac,LOG1, FL("NonGf, "));
1861 }
1862 if(!lsigTxopSupported)
1863 {
1864 psessionEntry->gLimLsigTxopParams.numSta++;
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001865 limLog(pMac,LOG1, FL("!lsigTxopSupported"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001866 }
1867}// ---------------------------------------------------------------------
1868
1869/** -------------------------------------------------------------
1870\fn limDecideApProtection
1871\brief Decides all the protection related staiton coexistence and also sets
1872\ short preamble and short slot appropriately. This function will be called
1873\ when AP is ready to send assocRsp tp the station joining right now.
1874\param tpAniSirGlobal pMac
1875\param tSirMacAddr peerMacAddr
1876\return None
1877 -------------------------------------------------------------*/
1878void
1879limDecideApProtection(tpAniSirGlobal pMac, tSirMacAddr peerMacAddr, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry)
1880{
1881 tANI_U16 tmpAid;
1882 tpDphHashNode pStaDs;
1883 tSirRFBand rfBand = SIR_BAND_UNKNOWN;
1884 tANI_U32 phyMode;
1885 tLimProtStaCacheType protStaCacheType = eLIM_PROT_STA_CACHE_TYPE_INVALID;
1886 tHalBitVal gfSupported = eHAL_SET, lsigTxopSupported = eHAL_SET;
1887
1888 pBeaconParams->paramChangeBitmap = 0;
1889 // check whether to enable protection or not
1890 pStaDs = dphLookupHashEntry(pMac, peerMacAddr, &tmpAid, &psessionEntry->dph.dphHashTable);
1891 if(NULL == pStaDs)
1892 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001893 PELOG1(limLog(pMac, LOG1, FL("pStaDs is NULL"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001894 return;
1895 }
1896 limGetRfBand(pMac, &rfBand, psessionEntry);
1897 //if we are in 5 GHZ band
1898 if(SIR_BAND_5_GHZ == rfBand)
1899 {
1900 //We are 11N. we need to protect from 11A and Ht20. we don't need any other protection in 5 GHZ.
1901 //HT20 case is common between both the bands and handled down as common code.
Jeff Johnsone7245742012-09-05 17:12:55 -07001902 if(true == psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07001903 {
1904 //we are 11N and 11A station is joining.
1905 //protection from 11A required.
1906 if(false == pStaDs->mlmStaContext.htCapability)
1907 {
1908 limEnable11aProtection(pMac, true, false, pBeaconParams,psessionEntry);
1909 return;
1910 }
1911 }
1912 }
1913 else if(SIR_BAND_2_4_GHZ== rfBand)
1914 {
1915 limGetPhyMode(pMac, &phyMode, psessionEntry);
1916
1917 //We are 11G. Check if we need protection from 11b Stations.
1918 if ((phyMode == WNI_CFG_PHY_MODE_11G) &&
Jeff Johnsone7245742012-09-05 17:12:55 -07001919 (false == psessionEntry->htCapability))
Jeff Johnson295189b2012-06-20 16:38:30 -07001920 {
1921
1922 if (pStaDs->erpEnabled== eHAL_CLEAR)
1923 {
1924 protStaCacheType = eLIM_PROT_STA_CACHE_TYPE_llB;
1925 // enable protection
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001926 PELOG3(limLog(pMac, LOG3, FL("Enabling protection from 11B"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001927 limEnable11gProtection(pMac, true, false, pBeaconParams,psessionEntry);
1928 }
1929 }
1930
1931 //HT station.
Jeff Johnsone7245742012-09-05 17:12:55 -07001932 if (true == psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07001933 {
1934 //check if we need protection from 11b station
1935 if ((pStaDs->erpEnabled == eHAL_CLEAR) &&
1936 (!pStaDs->mlmStaContext.htCapability))
1937 {
1938 protStaCacheType = eLIM_PROT_STA_CACHE_TYPE_llB;
1939 // enable protection
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001940 PELOG3(limLog(pMac, LOG3, FL("Enabling protection from 11B"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001941 limEnable11gProtection(pMac, true, false, pBeaconParams, psessionEntry);
1942 }
1943 //station being joined is non-11b and non-ht ==> 11g device
1944 else if(!pStaDs->mlmStaContext.htCapability)
1945 {
1946 protStaCacheType = eLIM_PROT_STA_CACHE_TYPE_llG;
1947 //enable protection
1948 limEnableHtProtectionFrom11g(pMac, true, false, pBeaconParams, psessionEntry);
1949 }
1950 //ERP mode is enabled for the latest station joined
1951 //latest station joined is HT capable
1952 //This case is being handled in common code (commn between both the bands) below.
1953 }
1954 }
1955
1956 //we are HT and HT station is joining. This code is common for both the bands.
Jeff Johnsone7245742012-09-05 17:12:55 -07001957 if((true == psessionEntry->htCapability) &&
Jeff Johnson295189b2012-06-20 16:38:30 -07001958 (true == pStaDs->mlmStaContext.htCapability))
1959 {
1960 if(!pStaDs->htGreenfield)
1961 {
1962 limEnableHTNonGfProtection(pMac, true, false, pBeaconParams, psessionEntry);
1963 gfSupported = eHAL_CLEAR;
1964 }
1965 //Station joining is HT 20Mhz
1966 if(eHT_CHANNEL_WIDTH_20MHZ == pStaDs->htSupportedChannelWidthSet)
1967 {
1968 protStaCacheType = eLIM_PROT_STA_CACHE_TYPE_HT20;
1969 limEnableHT20Protection(pMac, true, false, pBeaconParams, psessionEntry);
1970 }
1971 //Station joining does not support LSIG TXOP Protection
1972 if(!pStaDs->htLsigTXOPProtection)
1973 {
1974 limEnableHTLsigTxopProtection(pMac, false, false, pBeaconParams,psessionEntry);
1975 lsigTxopSupported = eHAL_CLEAR;
1976 }
1977 }
1978
1979 limUpdateProtStaParams(pMac, peerMacAddr, protStaCacheType,
1980 gfSupported, lsigTxopSupported, psessionEntry);
1981
1982 return;
1983}
Jeff Johnson295189b2012-06-20 16:38:30 -07001984
1985
1986/** -------------------------------------------------------------
1987\fn limEnableOverlap11gProtection
1988\brief wrapper function for setting overlap 11g protection.
1989\param tpAniSirGlobal pMac
1990\param tpUpdateBeaconParams pBeaconParams
1991\param tpSirMacMgmtHdr pMh
1992\return None
1993 -------------------------------------------------------------*/
1994void
1995limEnableOverlap11gProtection(tpAniSirGlobal pMac,
1996tpUpdateBeaconParams pBeaconParams, tpSirMacMgmtHdr pMh,tpPESession psessionEntry)
1997{
1998 limUpdateOverlapStaParam(pMac, pMh->bssId, &(psessionEntry->gLimOlbcParams));
1999
2000 if (psessionEntry->gLimOlbcParams.numSta &&
2001 !psessionEntry->gLimOlbcParams.protectionEnabled)
2002 {
2003 // enable protection
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002004 PELOG1(limLog(pMac, LOG1, FL("OLBC happens!!!"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002005 limEnable11gProtection(pMac, true, true, pBeaconParams,psessionEntry);
2006 }
2007}
2008
2009
2010/** -------------------------------------------------------------
2011\fn limUpdateShortPreamble
2012\brief Updates short preamble if needed when a new station joins.
2013\param tpAniSirGlobal pMac
2014\param tSirMacAddr peerMacAddr
2015\param tpUpdateBeaconParams pBeaconParams
2016\return None
2017 -------------------------------------------------------------*/
2018void
2019limUpdateShortPreamble(tpAniSirGlobal pMac, tSirMacAddr peerMacAddr,
2020 tpUpdateBeaconParams pBeaconParams, tpPESession psessionEntry)
2021{
2022 tANI_U16 tmpAid;
2023 tpDphHashNode pStaDs;
2024 tANI_U32 phyMode;
2025 tANI_U16 i;
2026
2027 // check whether to enable protection or not
2028 pStaDs = dphLookupHashEntry(pMac, peerMacAddr, &tmpAid, &psessionEntry->dph.dphHashTable);
2029
2030 limGetPhyMode(pMac, &phyMode, psessionEntry);
2031
2032 if (pStaDs != NULL && phyMode == WNI_CFG_PHY_MODE_11G)
2033
2034 {
2035 if (pStaDs->shortPreambleEnabled == eHAL_CLEAR)
2036 {
2037 PELOG1(limLog(pMac,LOG1,FL("Short Preamble is not enabled in Assoc Req from "));
2038 limPrintMacAddr(pMac, peerMacAddr, LOG1);)
2039
2040 for (i=0; i<LIM_PROT_STA_CACHE_SIZE; i++)
2041 {
Jeff Johnson295189b2012-06-20 16:38:30 -07002042 if ((psessionEntry->limSystemRole == eLIM_AP_ROLE ) &&
2043 psessionEntry->gLimNoShortParams.staNoShortCache[i].active)
2044 {
2045 if (palEqualMemory( pMac->hHdd,
2046 psessionEntry->gLimNoShortParams.staNoShortCache[i].addr,
2047 peerMacAddr, sizeof(tSirMacAddr)))
2048 return;
2049 }else if(psessionEntry->limSystemRole != eLIM_AP_ROLE)
Jeff Johnson295189b2012-06-20 16:38:30 -07002050 {
2051 if (pMac->lim.gLimNoShortParams.staNoShortCache[i].active)
2052 {
2053 if (palEqualMemory( pMac->hHdd,
2054 pMac->lim.gLimNoShortParams.staNoShortCache[i].addr,
2055 peerMacAddr, sizeof(tSirMacAddr)))
2056 return;
2057 }
2058 }
2059 }
2060
2061
2062 for (i=0; i<LIM_PROT_STA_CACHE_SIZE; i++)
2063 {
Jeff Johnson295189b2012-06-20 16:38:30 -07002064 if ( (psessionEntry->limSystemRole == eLIM_AP_ROLE ) &&
2065 !psessionEntry->gLimNoShortParams.staNoShortCache[i].active)
2066 break;
2067 else
Jeff Johnson295189b2012-06-20 16:38:30 -07002068 {
2069 if (!pMac->lim.gLimNoShortParams.staNoShortCache[i].active)
2070 break;
2071 }
2072 }
2073
2074 if (i >= LIM_PROT_STA_CACHE_SIZE)
2075 {
Jeff Johnson295189b2012-06-20 16:38:30 -07002076 if(psessionEntry->limSystemRole == eLIM_AP_ROLE){
2077 limLog(pMac, LOGE, FL("No space in Short cache (#active %d, #sta %d) for sta "),
2078 i, psessionEntry->gLimNoShortParams.numNonShortPreambleSta);
2079 limPrintMacAddr(pMac, peerMacAddr, LOGE);
2080 return;
2081 }
2082 else
Jeff Johnson295189b2012-06-20 16:38:30 -07002083 {
2084 limLog(pMac, LOGE, FL("No space in Short cache (#active %d, #sta %d) for sta "),
2085 i, pMac->lim.gLimNoShortParams.numNonShortPreambleSta);
2086 limPrintMacAddr(pMac, peerMacAddr, LOGE);
2087 return;
2088 }
2089
2090 }
2091
2092
Jeff Johnson295189b2012-06-20 16:38:30 -07002093 if(psessionEntry->limSystemRole == eLIM_AP_ROLE){
2094 palCopyMemory( pMac->hHdd, psessionEntry->gLimNoShortParams.staNoShortCache[i].addr,
2095 peerMacAddr, sizeof(tSirMacAddr));
2096 psessionEntry->gLimNoShortParams.staNoShortCache[i].active = true;
2097 psessionEntry->gLimNoShortParams.numNonShortPreambleSta++;
2098 }else
Jeff Johnson295189b2012-06-20 16:38:30 -07002099 {
2100 palCopyMemory( pMac->hHdd, pMac->lim.gLimNoShortParams.staNoShortCache[i].addr,
2101 peerMacAddr, sizeof(tSirMacAddr));
2102 pMac->lim.gLimNoShortParams.staNoShortCache[i].active = true;
2103 pMac->lim.gLimNoShortParams.numNonShortPreambleSta++;
2104 }
2105
2106
2107 // enable long preamble
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002108 PELOG1(limLog(pMac, LOG1, FL("Disabling short preamble"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002109
Jeff Johnson295189b2012-06-20 16:38:30 -07002110 if (limEnableShortPreamble(pMac, false, pBeaconParams, psessionEntry) != eSIR_SUCCESS)
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002111 PELOGE(limLog(pMac, LOGE, FL("Cannot enable long preamble"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002112 }
2113 }
2114}
2115
2116/** -------------------------------------------------------------
2117\fn limUpdateShortSlotTime
2118\brief Updates short slot time if needed when a new station joins.
2119\param tpAniSirGlobal pMac
2120\param tSirMacAddr peerMacAddr
2121\param tpUpdateBeaconParams pBeaconParams
2122\return None
2123 -------------------------------------------------------------*/
2124
2125void
2126limUpdateShortSlotTime(tpAniSirGlobal pMac, tSirMacAddr peerMacAddr,
2127 tpUpdateBeaconParams pBeaconParams, tpPESession psessionEntry)
2128{
2129 tANI_U16 tmpAid;
2130 tpDphHashNode pStaDs;
2131 tANI_U32 phyMode;
2132 tANI_U32 val;
Jeff Johnson295189b2012-06-20 16:38:30 -07002133 tANI_U16 i;
2134
2135 // check whether to enable protection or not
2136 pStaDs = dphLookupHashEntry(pMac, peerMacAddr, &tmpAid, &psessionEntry->dph.dphHashTable);
2137 limGetPhyMode(pMac, &phyMode, psessionEntry);
2138
Jeff Johnsone7245742012-09-05 17:12:55 -07002139 /* Only in case of softap in 11g mode, slot time might change depending on the STA being added. In 11a case, it should
2140 * be always 1 and in 11b case, it should be always 0
2141 */
Jeff Johnson295189b2012-06-20 16:38:30 -07002142 if (pStaDs != NULL && phyMode == WNI_CFG_PHY_MODE_11G)
2143 {
Jeff Johnsone7245742012-09-05 17:12:55 -07002144 /* Only when the new STA has short slot time disabled, we need to change softap's overall slot time settings
2145 * else the default for softap is always short slot enabled. When the last long slot STA leaves softAP, we take care of
2146 * it in limDecideShortSlot
2147 */
Jeff Johnson295189b2012-06-20 16:38:30 -07002148 if (pStaDs->shortSlotTimeEnabled == eHAL_CLEAR)
2149 {
2150 PELOG1(limLog(pMac, LOG1, FL("Short Slot Time is not enabled in Assoc Req from "));
2151 limPrintMacAddr(pMac, peerMacAddr, LOG1);)
2152 for (i=0; i<LIM_PROT_STA_CACHE_SIZE; i++)
2153 {
Jeff Johnson295189b2012-06-20 16:38:30 -07002154 if ((psessionEntry->limSystemRole == eLIM_AP_ROLE ) &&
2155 psessionEntry->gLimNoShortSlotParams.staNoShortSlotCache[i].active)
2156 {
2157 if (palEqualMemory( pMac->hHdd,
2158 psessionEntry->gLimNoShortSlotParams.staNoShortSlotCache[i].addr,
2159 peerMacAddr, sizeof(tSirMacAddr)))
2160 return;
2161 }
2162 else if(psessionEntry->limSystemRole != eLIM_AP_ROLE )
Jeff Johnson295189b2012-06-20 16:38:30 -07002163 {
2164 if (pMac->lim.gLimNoShortSlotParams.staNoShortSlotCache[i].active)
2165 {
2166 if (palEqualMemory( pMac->hHdd,
2167 pMac->lim.gLimNoShortSlotParams.staNoShortSlotCache[i].addr,
2168 peerMacAddr, sizeof(tSirMacAddr)))
2169 return;
2170 }
2171 }
2172 }
2173
2174 for (i=0; i<LIM_PROT_STA_CACHE_SIZE; i++)
2175 {
Jeff Johnson295189b2012-06-20 16:38:30 -07002176 if ((psessionEntry->limSystemRole == eLIM_AP_ROLE ) &&
2177 !psessionEntry->gLimNoShortSlotParams.staNoShortSlotCache[i].active)
2178 break;
2179 else
Jeff Johnson295189b2012-06-20 16:38:30 -07002180 {
2181 if (!pMac->lim.gLimNoShortSlotParams.staNoShortSlotCache[i].active)
2182 break;
2183 }
2184 }
2185
2186 if (i >= LIM_PROT_STA_CACHE_SIZE)
2187 {
Jeff Johnson295189b2012-06-20 16:38:30 -07002188 if(psessionEntry->limSystemRole == eLIM_AP_ROLE){
2189 limLog(pMac, LOGE, FL("No space in ShortSlot cache (#active %d, #sta %d) for sta "),
2190 i, psessionEntry->gLimNoShortSlotParams.numNonShortSlotSta);
2191 limPrintMacAddr(pMac, peerMacAddr, LOGE);
2192 return;
2193 }else
Jeff Johnson295189b2012-06-20 16:38:30 -07002194 {
2195 limLog(pMac, LOGE, FL("No space in ShortSlot cache (#active %d, #sta %d) for sta "),
2196 i, pMac->lim.gLimNoShortSlotParams.numNonShortSlotSta);
2197 limPrintMacAddr(pMac, peerMacAddr, LOGE);
2198 return;
2199 }
2200 }
2201
2202
Jeff Johnson295189b2012-06-20 16:38:30 -07002203 if(psessionEntry->limSystemRole == eLIM_AP_ROLE){
2204 palCopyMemory( pMac->hHdd, psessionEntry->gLimNoShortSlotParams.staNoShortSlotCache[i].addr,
2205 peerMacAddr, sizeof(tSirMacAddr));
2206 psessionEntry->gLimNoShortSlotParams.staNoShortSlotCache[i].active = true;
2207 psessionEntry->gLimNoShortSlotParams.numNonShortSlotSta++;
2208 }else
Jeff Johnson295189b2012-06-20 16:38:30 -07002209 {
2210 palCopyMemory( pMac->hHdd, pMac->lim.gLimNoShortSlotParams.staNoShortSlotCache[i].addr,
2211 peerMacAddr, sizeof(tSirMacAddr));
2212 pMac->lim.gLimNoShortSlotParams.staNoShortSlotCache[i].active = true;
2213 pMac->lim.gLimNoShortSlotParams.numNonShortSlotSta++;
2214 }
2215 wlan_cfgGetInt(pMac, WNI_CFG_11G_SHORT_SLOT_TIME_ENABLED, &val);
2216
Jeff Johnsone7245742012-09-05 17:12:55 -07002217 /* 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
2218 * only long slot enabled, we need to change our beacon/pb rsp to broadcast short slot disabled
2219 */
Jeff Johnson295189b2012-06-20 16:38:30 -07002220 if ( (psessionEntry->limSystemRole == eLIM_AP_ROLE) &&
Jeff Johnsone7245742012-09-05 17:12:55 -07002221 (val && psessionEntry->gLimNoShortSlotParams.numNonShortSlotSta && psessionEntry->shortSlotTimeSupported))
Jeff Johnson295189b2012-06-20 16:38:30 -07002222 {
2223 // enable long slot time
2224 pBeaconParams->fShortSlotTime = false;
2225 pBeaconParams->paramChangeBitmap |= PARAM_SHORT_SLOT_TIME_CHANGED;
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002226 PELOG1(limLog(pMac, LOG1, FL("Disable short slot time. Enable long slot time."));)
Jeff Johnsone7245742012-09-05 17:12:55 -07002227 psessionEntry->shortSlotTimeSupported = false;
Jeff Johnson295189b2012-06-20 16:38:30 -07002228 }
2229 else if ( psessionEntry->limSystemRole != eLIM_AP_ROLE)
Jeff Johnson295189b2012-06-20 16:38:30 -07002230 {
Jeff Johnsone7245742012-09-05 17:12:55 -07002231 if (val && pMac->lim.gLimNoShortSlotParams.numNonShortSlotSta && psessionEntry->shortSlotTimeSupported)
Jeff Johnson295189b2012-06-20 16:38:30 -07002232 {
2233 // enable long slot time
2234 pBeaconParams->fShortSlotTime = false;
2235 pBeaconParams->paramChangeBitmap |= PARAM_SHORT_SLOT_TIME_CHANGED;
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002236 PELOG1(limLog(pMac, LOG1, FL("Disable short slot time. Enable long slot time."));)
Jeff Johnsone7245742012-09-05 17:12:55 -07002237 psessionEntry->shortSlotTimeSupported = false;
Jeff Johnson295189b2012-06-20 16:38:30 -07002238 }
2239 }
2240 }
2241 }
2242}
2243
Jeff Johnson295189b2012-06-20 16:38:30 -07002244
2245/** -------------------------------------------------------------
2246\fn limDecideStaProtectionOnAssoc
2247\brief Decide protection related settings on Sta while association.
2248\param tpAniSirGlobal pMac
2249\param tpSchBeaconStruct pBeaconStruct
2250\return None
2251 -------------------------------------------------------------*/
2252void
2253limDecideStaProtectionOnAssoc(tpAniSirGlobal pMac,
2254 tpSchBeaconStruct pBeaconStruct, tpPESession psessionEntry)
2255{
2256 tSirRFBand rfBand = SIR_BAND_UNKNOWN;
2257 tANI_U32 phyMode = WNI_CFG_PHY_MODE_NONE;
2258
2259 limGetRfBand(pMac, &rfBand, psessionEntry);
2260 limGetPhyMode(pMac, &phyMode, psessionEntry);
2261
2262 if(SIR_BAND_5_GHZ == rfBand)
2263 {
2264 if((eSIR_HT_OP_MODE_MIXED == pBeaconStruct->HTInfo.opMode) ||
2265 (eSIR_HT_OP_MODE_OVERLAP_LEGACY == pBeaconStruct->HTInfo.opMode))
2266 {
2267 if(pMac->lim.cfgProtection.fromlla)
2268 psessionEntry->beaconParams.llaCoexist = true;
2269 }
2270 else if(eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT == pBeaconStruct->HTInfo.opMode)
2271 {
2272 if(pMac->lim.cfgProtection.ht20)
2273 psessionEntry->beaconParams.ht20Coexist = true;
2274 }
2275
2276 }
2277 else if(SIR_BAND_2_4_GHZ == rfBand)
2278 {
2279 //spec 7.3.2.13
2280 //UseProtection will be set when nonERP STA is associated.
2281 //NonERPPresent bit will be set when:
2282 //--nonERP Sta is associated OR
2283 //--nonERP Sta exists in overlapping BSS
2284 //when useProtection is not set then protection from nonERP stations is optional.
2285
2286 //CFG protection from 11b is enabled and
2287 //11B device in the BSS
2288 /* TODO, This is not sessionized */
2289 if (phyMode != WNI_CFG_PHY_MODE_11B)
2290 {
2291 if (pMac->lim.cfgProtection.fromllb &&
2292 pBeaconStruct->erpPresent &&
2293 (pBeaconStruct->erpIEInfo.useProtection ||
2294 pBeaconStruct->erpIEInfo.nonErpPresent))
2295 {
2296 psessionEntry->beaconParams.llbCoexist = true;
2297 }
2298 //AP has no 11b station associated.
2299 else
2300 {
2301 psessionEntry->beaconParams.llbCoexist = false;
2302 }
2303 }
2304 //following code block is only for HT station.
Jeff Johnsone7245742012-09-05 17:12:55 -07002305 if((psessionEntry->htCapability) &&
Jeff Johnson295189b2012-06-20 16:38:30 -07002306 (pBeaconStruct->HTInfo.present))
2307 {
2308 tDot11fIEHTInfo htInfo = pBeaconStruct->HTInfo;
2309
2310 //Obss Non HT STA present mode
2311 psessionEntry->beaconParams.gHTObssMode = (tANI_U8)htInfo.obssNonHTStaPresent;
2312
2313
2314 //CFG protection from 11G is enabled and
2315 //our AP has at least one 11G station associated.
2316 if(pMac->lim.cfgProtection.fromllg &&
2317 ((eSIR_HT_OP_MODE_MIXED == htInfo.opMode) ||
2318 (eSIR_HT_OP_MODE_OVERLAP_LEGACY == htInfo.opMode))&&
2319 (!psessionEntry->beaconParams.llbCoexist))
2320 {
2321 if(pMac->lim.cfgProtection.fromllg)
2322 psessionEntry->beaconParams.llgCoexist = true;
2323 }
2324
2325 //AP has only HT stations associated and at least one station is HT 20
2326 //disable protection from any non-HT devices.
2327 //decision for disabling protection from 11b has already been taken above.
2328 if(eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT == htInfo.opMode)
2329 {
2330 //Disable protection from 11G station.
2331 psessionEntry->beaconParams.llgCoexist = false;
2332 //CFG protection from HT 20 is enabled.
2333 if(pMac->lim.cfgProtection.ht20)
2334 psessionEntry->beaconParams.ht20Coexist = true;
2335 }
2336 //Disable protection from non-HT and HT20 devices.
2337 //decision for disabling protection from 11b has already been taken above.
2338 if(eSIR_HT_OP_MODE_PURE == htInfo.opMode)
2339 {
2340 psessionEntry->beaconParams.llgCoexist = false;
2341 psessionEntry->beaconParams.ht20Coexist = false;
2342 }
2343
2344 }
2345 }
2346
2347 //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 -07002348 if((psessionEntry->htCapability) &&
Jeff Johnson295189b2012-06-20 16:38:30 -07002349 (pBeaconStruct->HTInfo.present))
2350 {
2351 tDot11fIEHTInfo htInfo = pBeaconStruct->HTInfo;
2352 psessionEntry->beaconParams.fRIFSMode =
2353 ( tANI_U8 ) htInfo.rifsMode;
2354 psessionEntry->beaconParams.llnNonGFCoexist =
2355 ( tANI_U8 )htInfo.nonGFDevicesPresent;
2356 psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport =
2357 ( tANI_U8 )htInfo.lsigTXOPProtectionFullSupport;
2358 }
2359}
2360
2361
2362/** -------------------------------------------------------------
2363\fn limDecideStaProtection
2364\brief Decides protection related settings on Sta while processing beacon.
2365\param tpAniSirGlobal pMac
2366\param tpUpdateBeaconParams pBeaconParams
2367\return None
2368 -------------------------------------------------------------*/
2369void
2370limDecideStaProtection(tpAniSirGlobal pMac,
2371 tpSchBeaconStruct pBeaconStruct, tpUpdateBeaconParams pBeaconParams, tpPESession psessionEntry)
2372{
2373
2374 tSirRFBand rfBand = SIR_BAND_UNKNOWN;
2375 tANI_U32 phyMode = WNI_CFG_PHY_MODE_NONE;
2376
2377 limGetRfBand(pMac, &rfBand, psessionEntry);
2378 limGetPhyMode(pMac, &phyMode, psessionEntry);
2379
2380 if(SIR_BAND_5_GHZ == rfBand)
2381 {
2382 //we are HT capable.
Jeff Johnsone7245742012-09-05 17:12:55 -07002383 if((true == psessionEntry->htCapability) &&
Jeff Johnson295189b2012-06-20 16:38:30 -07002384 (pBeaconStruct->HTInfo.present))
2385 {
2386 //we are HT capable, AP's HT OPMode is mixed / overlap legacy ==> need protection from 11A.
2387 if((eSIR_HT_OP_MODE_MIXED == pBeaconStruct->HTInfo.opMode) ||
2388 (eSIR_HT_OP_MODE_OVERLAP_LEGACY == pBeaconStruct->HTInfo.opMode))
2389 {
2390 limEnable11aProtection(pMac, true, false, pBeaconParams,psessionEntry);
2391 }
2392 //we are HT capable, AP's HT OPMode is HT20 ==> disable protection from 11A if enabled. enabled
2393 //protection from HT20 if needed.
2394 else if(eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT== pBeaconStruct->HTInfo.opMode)
2395 {
2396 limEnable11aProtection(pMac, false, false, pBeaconParams,psessionEntry);
2397 limEnableHT20Protection(pMac, true, false, pBeaconParams,psessionEntry);
2398 }
2399 else if(eSIR_HT_OP_MODE_PURE == pBeaconStruct->HTInfo.opMode)
2400 {
2401 limEnable11aProtection(pMac, false, false, pBeaconParams,psessionEntry);
2402 limEnableHT20Protection(pMac, false, false, pBeaconParams,psessionEntry);
2403 }
2404 }
2405 }
2406 else if(SIR_BAND_2_4_GHZ == rfBand)
2407 {
2408 /* spec 7.3.2.13
2409 * UseProtection will be set when nonERP STA is associated.
2410 * NonERPPresent bit will be set when:
2411 * --nonERP Sta is associated OR
2412 * --nonERP Sta exists in overlapping BSS
2413 * when useProtection is not set then protection from nonERP stations is optional.
2414 */
2415
2416 if (phyMode != WNI_CFG_PHY_MODE_11B)
2417 {
2418 if (pBeaconStruct->erpPresent &&
2419 (pBeaconStruct->erpIEInfo.useProtection ||
2420 pBeaconStruct->erpIEInfo.nonErpPresent))
2421 {
2422 limEnable11gProtection(pMac, true, false, pBeaconParams, psessionEntry);
2423 }
2424 //AP has no 11b station associated.
2425 else
2426 {
2427 //disable protection from 11b station
2428 limEnable11gProtection(pMac, false, false, pBeaconParams, psessionEntry);
2429 }
2430 }
2431
2432 //following code block is only for HT station.
Jeff Johnsone7245742012-09-05 17:12:55 -07002433 if((psessionEntry->htCapability) &&
Jeff Johnson295189b2012-06-20 16:38:30 -07002434 (pBeaconStruct->HTInfo.present))
2435 {
2436
2437 tDot11fIEHTInfo htInfo = pBeaconStruct->HTInfo;
2438 //AP has at least one 11G station associated.
2439 if(((eSIR_HT_OP_MODE_MIXED == htInfo.opMode) ||
2440 (eSIR_HT_OP_MODE_OVERLAP_LEGACY == htInfo.opMode))&&
2441 (!psessionEntry->beaconParams.llbCoexist))
2442 {
2443 limEnableHtProtectionFrom11g(pMac, true, false, pBeaconParams,psessionEntry);
2444
2445 }
2446
2447 //no HT operating mode change ==> no change in protection settings except for MIXED_MODE/Legacy Mode.
2448 //in Mixed mode/legacy Mode even if there is no change in HT operating mode, there might be change in 11bCoexist
2449 //or 11gCoexist. that is why this check is being done after mixed/legacy mode check.
2450 if ( pMac->lim.gHTOperMode != ( tSirMacHTOperatingMode )htInfo.opMode )
2451 {
2452 pMac->lim.gHTOperMode = ( tSirMacHTOperatingMode )htInfo.opMode;
2453
2454 //AP has only HT stations associated and at least one station is HT 20
2455 //disable protection from any non-HT devices.
2456 //decision for disabling protection from 11b has already been taken above.
2457 if(eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT == htInfo.opMode)
2458 {
2459 //Disable protection from 11G station.
2460 limEnableHtProtectionFrom11g(pMac, false, false, pBeaconParams,psessionEntry);
2461
2462 limEnableHT20Protection(pMac, true, false, pBeaconParams,psessionEntry);
2463 }
2464 //Disable protection from non-HT and HT20 devices.
2465 //decision for disabling protection from 11b has already been taken above.
2466 else if(eSIR_HT_OP_MODE_PURE == htInfo.opMode)
2467 {
2468 limEnableHtProtectionFrom11g(pMac, false, false, pBeaconParams,psessionEntry);
2469 limEnableHT20Protection(pMac, false, false, pBeaconParams,psessionEntry);
2470
2471 }
2472 }
2473 }
2474 }
2475
2476 //following code block is only for HT station. ( 2.4 GHZ as well as 5 GHZ)
Jeff Johnsone7245742012-09-05 17:12:55 -07002477 if((psessionEntry->htCapability) &&
Jeff Johnson295189b2012-06-20 16:38:30 -07002478 (pBeaconStruct->HTInfo.present))
2479 {
2480 tDot11fIEHTInfo htInfo = pBeaconStruct->HTInfo;
2481 //Check for changes in protection related factors other than HT operating mode.
2482 //Check for changes in RIFS mode, nonGFDevicesPresent, lsigTXOPProtectionFullSupport.
2483 if ( psessionEntry->beaconParams.fRIFSMode !=
2484 ( tANI_U8 ) htInfo.rifsMode )
2485 {
2486 pBeaconParams->fRIFSMode =
2487 psessionEntry->beaconParams.fRIFSMode =
2488 ( tANI_U8 ) htInfo.rifsMode;
2489 pBeaconParams->paramChangeBitmap |= PARAM_RIFS_MODE_CHANGED;
2490 }
2491
2492 if ( psessionEntry->beaconParams.llnNonGFCoexist !=
2493 htInfo.nonGFDevicesPresent )
2494 {
2495 pBeaconParams->llnNonGFCoexist =
2496 psessionEntry->beaconParams.llnNonGFCoexist =
2497 ( tANI_U8 )htInfo.nonGFDevicesPresent;
2498 pBeaconParams->paramChangeBitmap |=
2499 PARAM_NON_GF_DEVICES_PRESENT_CHANGED;
2500 }
2501
2502 if ( psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport !=
2503 ( tANI_U8 )htInfo.lsigTXOPProtectionFullSupport )
2504 {
2505 pBeaconParams->fLsigTXOPProtectionFullSupport =
2506 psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport =
2507 ( tANI_U8 )htInfo.lsigTXOPProtectionFullSupport;
2508 pBeaconParams->paramChangeBitmap |=
2509 PARAM_LSIG_TXOP_FULL_SUPPORT_CHANGED;
2510 }
2511
2512 // For Station just update the global lim variable, no need to send message to HAL
2513 // Station already taking care of HT OPR Mode=01, meaning AP is seeing legacy
2514 //stations in overlapping BSS.
2515 if ( psessionEntry->beaconParams.gHTObssMode != ( tANI_U8 )htInfo.obssNonHTStaPresent )
2516 psessionEntry->beaconParams.gHTObssMode = ( tANI_U8 )htInfo.obssNonHTStaPresent ;
2517
2518 }
2519}
2520
2521
2522/**
2523 * limProcessChannelSwitchTimeout()
2524 *
2525 *FUNCTION:
2526 * This function is invoked when Channel Switch Timer expires at
2527 * the STA. Now, STA must stop traffic, and then change/disable
2528 * primary or secondary channel.
2529 *
2530 *
2531 *NOTE:
2532 * @param pMac - Pointer to Global MAC structure
2533 * @return None
2534 */
2535void limProcessChannelSwitchTimeout(tpAniSirGlobal pMac)
2536{
2537 tpPESession psessionEntry = NULL;
Jeff Johnsone7245742012-09-05 17:12:55 -07002538 tANI_U8 channel; // This is received and stored from channelSwitch Action frame
Jeff Johnson295189b2012-06-20 16:38:30 -07002539
2540 if((psessionEntry = peFindSessionBySessionId(pMac, pMac->lim.limTimers.gLimChannelSwitchTimer.sessionId))== NULL)
2541 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002542 limLog(pMac, LOGP,FL("Session Does not exist for given sessionID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002543 return;
2544 }
2545
2546 if (psessionEntry->limSystemRole != eLIM_STA_ROLE)
2547 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002548 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 -07002549 return;
2550 }
Jeff Johnsone7245742012-09-05 17:12:55 -07002551 channel = psessionEntry->gLimChannelSwitch.primaryChannel;
Jeff Johnson295189b2012-06-20 16:38:30 -07002552 /*
2553 * This potentially can create issues if the function tries to set
2554 * channel while device is in power-save, hence putting an extra check
2555 * to verify if the device is in power-save or not
2556 */
2557 if(!limIsSystemInActiveState(pMac))
2558 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002559 PELOGW(limLog(pMac, LOGW, FL("Device is not in active state, cannot switch channel"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002560 return;
2561 }
2562
2563 // Restore Channel Switch parameters to default
Jeff Johnsone7245742012-09-05 17:12:55 -07002564 psessionEntry->gLimChannelSwitch.switchTimeoutValue = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07002565
2566 /* Channel-switch timeout has occurred. reset the state */
Jeff Johnsone7245742012-09-05 17:12:55 -07002567 psessionEntry->gLimSpecMgmt.dot11hChanSwState = eLIM_11H_CHANSW_END;
Jeff Johnson295189b2012-06-20 16:38:30 -07002568
2569 /* Check if the AP is switching to a channel that we support.
2570 * Else, just don't bother to switch. Indicate HDD to look for a
2571 * better AP to associate
2572 */
2573 if(!limIsChannelValidForChannelSwitch(pMac, channel))
2574 {
2575 /* We need to restore pre-channelSwitch state on the STA */
2576 if(limRestorePreChannelSwitchState(pMac, psessionEntry) != eSIR_SUCCESS)
2577 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002578 limLog(pMac, LOGP, FL("Could not restore pre-channelSwitch (11h) state, resetting the system"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002579 return;
2580 }
2581
2582 /* If the channel-list that AP is asking us to switch is invalid,
2583 * then we cannot switch the channel. Just disassociate from AP.
2584 * We will find a better AP !!!
2585 */
2586 limTearDownLinkWithAp(pMac,
2587 pMac->lim.limTimers.gLimChannelSwitchTimer.sessionId,
2588 eSIR_MAC_UNSPEC_FAILURE_REASON);
2589 return;
2590 }
Jeff Johnsone7245742012-09-05 17:12:55 -07002591 switch(psessionEntry->gLimChannelSwitch.state)
Jeff Johnson295189b2012-06-20 16:38:30 -07002592 {
2593 case eLIM_CHANNEL_SWITCH_PRIMARY_ONLY:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002594 PELOGW(limLog(pMac, LOGW, FL("CHANNEL_SWITCH_PRIMARY_ONLY "));)
Jeff Johnsone7245742012-09-05 17:12:55 -07002595 limSwitchPrimaryChannel(pMac, psessionEntry->gLimChannelSwitch.primaryChannel,psessionEntry);
2596 psessionEntry->gLimChannelSwitch.state = eLIM_CHANNEL_SWITCH_IDLE;
Jeff Johnson295189b2012-06-20 16:38:30 -07002597 break;
2598
2599 case eLIM_CHANNEL_SWITCH_SECONDARY_ONLY:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002600 PELOGW(limLog(pMac, LOGW, FL("CHANNEL_SWITCH_SECONDARY_ONLY "));)
Jeff Johnsone7245742012-09-05 17:12:55 -07002601 limSwitchPrimarySecondaryChannel(pMac, psessionEntry,
Jeff Johnson295189b2012-06-20 16:38:30 -07002602 psessionEntry->currentOperChannel,
Jeff Johnsone7245742012-09-05 17:12:55 -07002603 psessionEntry->gLimChannelSwitch.secondarySubBand);
2604 psessionEntry->gLimChannelSwitch.state = eLIM_CHANNEL_SWITCH_IDLE;
Jeff Johnson295189b2012-06-20 16:38:30 -07002605 break;
2606
2607 case eLIM_CHANNEL_SWITCH_PRIMARY_AND_SECONDARY:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002608 PELOGW(limLog(pMac, LOGW, FL("CHANNEL_SWITCH_PRIMARY_AND_SECONDARY"));)
Jeff Johnsone7245742012-09-05 17:12:55 -07002609 limSwitchPrimarySecondaryChannel(pMac, psessionEntry,
2610 psessionEntry->gLimChannelSwitch.primaryChannel,
2611 psessionEntry->gLimChannelSwitch.secondarySubBand);
2612 psessionEntry->gLimChannelSwitch.state = eLIM_CHANNEL_SWITCH_IDLE;
Jeff Johnson295189b2012-06-20 16:38:30 -07002613 break;
2614
2615 case eLIM_CHANNEL_SWITCH_IDLE:
2616 default:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002617 PELOGE(limLog(pMac, LOGE, FL("incorrect state "));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002618 if(limRestorePreChannelSwitchState(pMac, psessionEntry) != eSIR_SUCCESS)
2619 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002620 limLog(pMac, LOGP, FL("Could not restore pre-channelSwitch (11h) state, resetting the system"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002621 }
2622 return; /* Please note, this is 'return' and not 'break' */
2623 }
Jeff Johnsone7245742012-09-05 17:12:55 -07002624}
Jeff Johnson295189b2012-06-20 16:38:30 -07002625
2626/**
2627 * limUpdateChannelSwitch()
2628 *
2629 *FUNCTION:
2630 * This function is invoked whenever Station receives
2631 * either 802.11h channel switch IE or airgo proprietary
2632 * channel switch IE.
2633 *
2634 *NOTE:
2635 * @param pMac - Pointer to Global MAC structure
2636 * @return tpSirProbeRespBeacon - Pointer to Beacon/Probe Rsp
2637 * @param psessionentry
2638 */
2639void
2640limUpdateChannelSwitch(struct sAniSirGlobal *pMac, tpSirProbeRespBeacon pBeacon, tpPESession psessionEntry)
2641{
2642
2643 tANI_U16 beaconPeriod;
Jeff Johnson295189b2012-06-20 16:38:30 -07002644 tChannelSwitchPropIEStruct *pPropChnlSwitch;
2645 tDot11fIEChanSwitchAnn *pChnlSwitch;
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -07002646#ifdef WLAN_FEATURE_11AC
2647 tDot11fIEWiderBWChanSwitchAnn *pWiderChnlSwitch;
2648#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002649
Jeff Johnsone7245742012-09-05 17:12:55 -07002650 beaconPeriod = psessionEntry->beaconParams.beaconInterval;
Jeff Johnson295189b2012-06-20 16:38:30 -07002651
2652 /* STA either received proprietary channel switch IE or 802.11h
2653 * standard channel switch IE.
2654 */
2655 if (pBeacon->propIEinfo.propChannelSwitchPresent)
2656 {
2657 pPropChnlSwitch = &(pBeacon->propIEinfo.channelSwitch);
2658
2659 /* Add logic to determine which change this is: */
2660 /* primary, secondary, both. For now assume both. */
Jeff Johnsone7245742012-09-05 17:12:55 -07002661 psessionEntry->gLimChannelSwitch.state = eLIM_CHANNEL_SWITCH_PRIMARY_AND_SECONDARY;
2662 psessionEntry->gLimChannelSwitch.primaryChannel = pPropChnlSwitch->primaryChannel;
2663 psessionEntry->gLimChannelSwitch.secondarySubBand = (ePhyChanBondState)pPropChnlSwitch->subBand;
2664 psessionEntry->gLimChannelSwitch.switchCount = pPropChnlSwitch->channelSwitchCount;
2665 psessionEntry->gLimChannelSwitch.switchTimeoutValue =
Jeff Johnson295189b2012-06-20 16:38:30 -07002666 SYS_MS_TO_TICKS(beaconPeriod)* (pPropChnlSwitch->channelSwitchCount);
Jeff Johnsone7245742012-09-05 17:12:55 -07002667 psessionEntry->gLimChannelSwitch.switchMode = pPropChnlSwitch->mode;
Jeff Johnson295189b2012-06-20 16:38:30 -07002668 }
2669 else
2670 {
2671 pChnlSwitch = &(pBeacon->channelSwitchIE);
Jeff Johnsone7245742012-09-05 17:12:55 -07002672 psessionEntry->gLimChannelSwitch.primaryChannel = pChnlSwitch->newChannel;
2673 psessionEntry->gLimChannelSwitch.switchCount = pChnlSwitch->switchCount;
2674 psessionEntry->gLimChannelSwitch.switchTimeoutValue =
Jeff Johnson295189b2012-06-20 16:38:30 -07002675 SYS_MS_TO_TICKS(beaconPeriod)* (pChnlSwitch->switchCount);
Jeff Johnsone7245742012-09-05 17:12:55 -07002676 psessionEntry->gLimChannelSwitch.switchMode = pChnlSwitch->switchMode;
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -07002677#ifdef WLAN_FEATURE_11AC
2678 pWiderChnlSwitch = &(pBeacon->WiderBWChanSwitchAnn);
2679 if(pBeacon->WiderBWChanSwitchAnnPresent)
2680 {
2681 psessionEntry->gLimWiderBWChannelSwitch.newChanWidth = pWiderChnlSwitch->newChanWidth;
2682 psessionEntry->gLimWiderBWChannelSwitch.newCenterChanFreq0 = pWiderChnlSwitch->newCenterChanFreq0;
2683 psessionEntry->gLimWiderBWChannelSwitch.newCenterChanFreq1 = pWiderChnlSwitch->newCenterChanFreq1;
2684 }
2685#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002686
2687 /* Only primary channel switch element is present */
Jeff Johnsone7245742012-09-05 17:12:55 -07002688 psessionEntry->gLimChannelSwitch.state = eLIM_CHANNEL_SWITCH_PRIMARY_ONLY;
2689 psessionEntry->gLimChannelSwitch.secondarySubBand = PHY_SINGLE_CHANNEL_CENTERED;
Jeff Johnson295189b2012-06-20 16:38:30 -07002690
2691 /* Do not bother to look and operate on extended channel switch element
2692 * if our own channel-bonding state is not enabled
2693 */
Jeff Johnsone7245742012-09-05 17:12:55 -07002694 if (psessionEntry->htSupportedChannelWidthSet)
Jeff Johnson295189b2012-06-20 16:38:30 -07002695 {
2696 if (pBeacon->extChannelSwitchPresent)
2697 {
Jeff Johnsone7245742012-09-05 17:12:55 -07002698 if ((pBeacon->extChannelSwitchIE.secondaryChannelOffset == PHY_DOUBLE_CHANNEL_LOW_PRIMARY) ||
2699 (pBeacon->extChannelSwitchIE.secondaryChannelOffset == PHY_DOUBLE_CHANNEL_HIGH_PRIMARY))
Jeff Johnson295189b2012-06-20 16:38:30 -07002700 {
Jeff Johnsone7245742012-09-05 17:12:55 -07002701 psessionEntry->gLimChannelSwitch.state = eLIM_CHANNEL_SWITCH_PRIMARY_AND_SECONDARY;
2702 psessionEntry->gLimChannelSwitch.secondarySubBand = pBeacon->extChannelSwitchIE.secondaryChannelOffset;
Jeff Johnson295189b2012-06-20 16:38:30 -07002703 }
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -07002704#ifdef WLAN_FEATURE_11AC
2705 if(psessionEntry->vhtCapability && pBeacon->WiderBWChanSwitchAnnPresent)
2706 {
2707 if (pWiderChnlSwitch->newChanWidth == WNI_CFG_VHT_CHANNEL_WIDTH_80MHZ)
2708 {
2709 if(pBeacon->extChannelSwitchPresent)
2710 {
2711 if ((pBeacon->extChannelSwitchIE.secondaryChannelOffset == PHY_DOUBLE_CHANNEL_LOW_PRIMARY) ||
2712 (pBeacon->extChannelSwitchIE.secondaryChannelOffset == PHY_DOUBLE_CHANNEL_HIGH_PRIMARY))
2713 {
2714 psessionEntry->gLimChannelSwitch.state = eLIM_CHANNEL_SWITCH_PRIMARY_AND_SECONDARY;
2715 psessionEntry->gLimChannelSwitch.secondarySubBand = limGet11ACPhyCBState(pMac,
2716 psessionEntry->gLimChannelSwitch.primaryChannel,
2717 pBeacon->extChannelSwitchIE.secondaryChannelOffset,
2718 pWiderChnlSwitch->newCenterChanFreq0,
2719 psessionEntry);
2720 }
2721 }
2722 }
2723 }
2724#endif
Jeff Johnsone7245742012-09-05 17:12:55 -07002725 }
2726 }
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -07002727 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002728 if (eSIR_SUCCESS != limStartChannelSwitch(pMac, psessionEntry))
2729 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002730 PELOGW(limLog(pMac, LOGW, FL("Could not start Channel Switch"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002731 }
2732
2733 limLog(pMac, LOGW,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002734 FL("session %d primary chl %d, subband %d, count %d (%d ticks) "),
Jeff Johnsone7245742012-09-05 17:12:55 -07002735 psessionEntry->peSessionId,
2736 psessionEntry->gLimChannelSwitch.primaryChannel,
2737 psessionEntry->gLimChannelSwitch.secondarySubBand,
2738 psessionEntry->gLimChannelSwitch.switchCount,
2739 psessionEntry->gLimChannelSwitch.switchTimeoutValue);
Jeff Johnson295189b2012-06-20 16:38:30 -07002740 return;
2741}
2742
2743/**
2744 * limCancelDot11hChannelSwitch
2745 *
2746 *FUNCTION:
2747 * This function is called when STA does not send updated channel-swith IE
2748 * after indicating channel-switch start. This will cancel the channel-swith
2749 * timer which is already running.
2750 *
2751 *LOGIC:
2752 *
2753 *ASSUMPTIONS:
2754 *
2755 *NOTE:
2756 *
2757 * @param pMac - Pointer to Global MAC structure
2758 *
2759 * @return None
2760 */
2761void limCancelDot11hChannelSwitch(tpAniSirGlobal pMac, tpPESession psessionEntry)
2762{
Jeff Johnson295189b2012-06-20 16:38:30 -07002763 if (psessionEntry->limSystemRole != eLIM_STA_ROLE)
2764 return;
2765
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002766 PELOGW(limLog(pMac, LOGW, FL("Received a beacon without channel switch IE"));)
Jeff Johnsone7245742012-09-05 17:12:55 -07002767 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_DEACTIVATE, psessionEntry->peSessionId, eLIM_CHANNEL_SWITCH_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -07002768
2769 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimChannelSwitchTimer) != eSIR_SUCCESS)
2770 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002771 PELOGE(limLog(pMac, LOGE, FL("tx_timer_deactivate failed!"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002772 }
2773
2774 /* We need to restore pre-channelSwitch state on the STA */
2775 if (limRestorePreChannelSwitchState(pMac, psessionEntry) != eSIR_SUCCESS)
2776 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002777 PELOGE(limLog(pMac, LOGE, FL("LIM: Could not restore pre-channelSwitch (11h) state, resetting the system"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002778
2779 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002780}
2781
2782/**----------------------------------------------
2783\fn limCancelDot11hQuiet
2784\brief Cancel the quieting on Station if latest
2785 beacon doesn't contain quiet IE in it.
2786
2787\param pMac
2788\return NONE
2789-----------------------------------------------*/
2790void limCancelDot11hQuiet(tpAniSirGlobal pMac, tpPESession psessionEntry)
2791{
Jeff Johnson295189b2012-06-20 16:38:30 -07002792 if (psessionEntry->limSystemRole != eLIM_STA_ROLE)
2793 return;
2794
Jeff Johnsone7245742012-09-05 17:12:55 -07002795 if (psessionEntry->gLimSpecMgmt.quietState == eLIM_QUIET_BEGIN)
Jeff Johnson295189b2012-06-20 16:38:30 -07002796 {
Jeff Johnsone7245742012-09-05 17:12:55 -07002797 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_DEACTIVATE, psessionEntry->peSessionId, eLIM_QUIET_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -07002798 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimQuietTimer) != TX_SUCCESS)
2799 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002800 PELOGE(limLog(pMac, LOGE, FL("tx_timer_deactivate failed"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002801 }
2802 }
Jeff Johnsone7245742012-09-05 17:12:55 -07002803 else if (psessionEntry->gLimSpecMgmt.quietState == eLIM_QUIET_RUNNING)
Jeff Johnson295189b2012-06-20 16:38:30 -07002804 {
Jeff Johnsone7245742012-09-05 17:12:55 -07002805 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_DEACTIVATE, psessionEntry->peSessionId, eLIM_QUIET_BSS_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -07002806 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimQuietBssTimer) != TX_SUCCESS)
2807 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002808 PELOGE(limLog(pMac, LOGE, FL("tx_timer_deactivate failed"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002809 }
2810 /**
2811 * If the channel switch is already running in silent mode, dont resume the
2812 * transmission. Channel switch timer when timeout, transmission will be resumed.
2813 */
Jeff Johnsone7245742012-09-05 17:12:55 -07002814 if(!((psessionEntry->gLimSpecMgmt.dot11hChanSwState == eLIM_11H_CHANSW_RUNNING) &&
2815 (psessionEntry->gLimChannelSwitch.switchMode == eSIR_CHANSW_MODE_SILENT)))
Jeff Johnson295189b2012-06-20 16:38:30 -07002816 {
2817 limFrameTransmissionControl(pMac, eLIM_TX_ALL, eLIM_RESUME_TX);
Jeff Johnsone7245742012-09-05 17:12:55 -07002818 limRestorePreQuietState(pMac, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07002819 }
2820 }
Jeff Johnsone7245742012-09-05 17:12:55 -07002821 psessionEntry->gLimSpecMgmt.quietState = eLIM_QUIET_INIT;
Jeff Johnson295189b2012-06-20 16:38:30 -07002822}
2823
2824/**
2825 * limProcessQuietTimeout
2826 *
2827 * FUNCTION:
2828 * This function is active only on the STA.
2829 * Handles SIR_LIM_QUIET_TIMEOUT
2830 *
2831 * LOGIC:
2832 * This timeout can occur under only one circumstance:
2833 *
2834 * 1) When gLimQuietState = eLIM_QUIET_BEGIN
2835 * This indicates that the timeout "interval" has
2836 * expired. This is a trigger for the STA to now
2837 * shut-off Tx/Rx for the specified gLimQuietDuration
2838 * -> The TIMER object gLimQuietBssTimer is
2839 * activated
2840 * -> With timeout = gLimQuietDuration
2841 * -> gLimQuietState is set to eLIM_QUIET_RUNNING
2842 *
2843 * ASSUMPTIONS:
2844 * Using two TIMER objects -
2845 * gLimQuietTimer & gLimQuietBssTimer
2846 *
2847 * NOTE:
2848 *
2849 * @param pMac - Pointer to Global MAC structure
2850 *
2851 * @return None
2852 */
2853void limProcessQuietTimeout(tpAniSirGlobal pMac)
2854{
Jeff Johnson295189b2012-06-20 16:38:30 -07002855 //fetch the sessionEntry based on the sessionId
2856 //priority - MEDIUM
Jeff Johnsone7245742012-09-05 17:12:55 -07002857 tpPESession psessionEntry;
Jeff Johnson295189b2012-06-20 16:38:30 -07002858
Jeff Johnsone7245742012-09-05 17:12:55 -07002859 if((psessionEntry = peFindSessionBySessionId(pMac, pMac->lim.limTimers.gLimQuietTimer.sessionId))== NULL)
Jeff Johnson295189b2012-06-20 16:38:30 -07002860 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002861 limLog(pMac, LOGE,FL("Session Does not exist for given sessionID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002862 return;
2863 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002864
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002865 PELOG1(limLog(pMac, LOG1, FL("quietState = %d"), psessionEntry->gLimSpecMgmt.quietState);)
Jeff Johnsone7245742012-09-05 17:12:55 -07002866 switch( psessionEntry->gLimSpecMgmt.quietState )
Jeff Johnson295189b2012-06-20 16:38:30 -07002867 {
2868 case eLIM_QUIET_BEGIN:
2869 // Time to Stop data traffic for quietDuration
Jeff Johnsone7245742012-09-05 17:12:55 -07002870 //limDeactivateAndChangeTimer(pMac, eLIM_QUIET_BSS_TIMER);
2871 if (TX_SUCCESS !=
2872 tx_timer_deactivate(&pMac->lim.limTimers.gLimQuietBssTimer))
2873 {
2874 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002875 FL("Unable to de-activate gLimQuietBssTimer! Will attempt to activate anyway..."));
Jeff Johnsone7245742012-09-05 17:12:55 -07002876 }
2877
2878 // gLimQuietDuration appears to be in units of ticks
2879 // Use it as is
2880 if (TX_SUCCESS !=
2881 tx_timer_change( &pMac->lim.limTimers.gLimQuietBssTimer,
2882 psessionEntry->gLimSpecMgmt.quietDuration,
2883 0))
2884 {
2885 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002886 FL("Unable to change gLimQuietBssTimer! Will still attempt to activate anyway..."));
Jeff Johnsone7245742012-09-05 17:12:55 -07002887 }
Leela V Kiran Kumar Reddy Chiralac3b9d382013-01-31 20:49:53 -08002888 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, pMac->lim.limTimers.gLimQuietTimer.sessionId, eLIM_QUIET_BSS_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -07002889#ifdef GEN6_TODO
2890 /* revisit this piece of code to assign the appropriate sessionId below
2891 * priority - HIGH
2892 */
2893 pMac->lim.limTimers.gLimQuietBssTimer.sessionId = sessionId;
2894#endif
2895 if( TX_SUCCESS !=
2896 tx_timer_activate( &pMac->lim.limTimers.gLimQuietBssTimer ))
2897 {
2898 limLog( pMac, LOGW,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002899 FL("Unable to activate gLimQuietBssTimer! The STA will be unable to honor Quiet BSS..."));
Jeff Johnson295189b2012-06-20 16:38:30 -07002900 }
2901 else
2902 {
2903 // Transition to eLIM_QUIET_RUNNING
Jeff Johnsone7245742012-09-05 17:12:55 -07002904 psessionEntry->gLimSpecMgmt.quietState = eLIM_QUIET_RUNNING;
Jeff Johnson295189b2012-06-20 16:38:30 -07002905
2906 /* If we have sta bk scan triggered and trigger bk scan actually started successfully, */
2907 /* print message, otherwise, stop data traffic and stay quiet */
2908 if( pMac->lim.gLimTriggerBackgroundScanDuringQuietBss &&
2909 (eSIR_TRUE == (glimTriggerBackgroundScanDuringQuietBss_Status = limTriggerBackgroundScanDuringQuietBss( pMac ))) )
2910 {
2911 limLog( pMac, LOG2,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002912 FL("Attempting to trigger a background scan..."));
Jeff Johnson295189b2012-06-20 16:38:30 -07002913 }
2914 else
2915 {
2916 // Shut-off Tx/Rx for gLimSpecMgmt.quietDuration
2917 /* freeze the transmission */
2918 limFrameTransmissionControl(pMac, eLIM_TX_ALL, eLIM_STOP_TX);
2919
2920 limLog( pMac, LOG2,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002921 FL("Quiet BSS: STA shutting down for %d ticks"),
Jeff Johnsone7245742012-09-05 17:12:55 -07002922 psessionEntry->gLimSpecMgmt.quietDuration );
Jeff Johnson295189b2012-06-20 16:38:30 -07002923 }
2924 }
2925 break;
2926
2927 case eLIM_QUIET_RUNNING:
2928 case eLIM_QUIET_INIT:
2929 case eLIM_QUIET_END:
2930 default:
2931 //
2932 // As of now, nothing to be done
2933 //
2934 break;
2935 }
2936}
2937
2938/**
2939 * limProcessQuietBssTimeout
2940 *
2941 * FUNCTION:
2942 * This function is active on the AP and STA.
2943 * Handles SIR_LIM_QUIET_BSS_TIMEOUT
2944 *
2945 * LOGIC:
2946 * On the AP -
2947 * When the SIR_LIM_QUIET_BSS_TIMEOUT is triggered, it is
2948 * an indication for the AP to START sending out the
2949 * Quiet BSS IE.
2950 * If 802.11H is enabled, the Quiet BSS IE is sent as per
2951 * the 11H spec
2952 * If 802.11H is not enabled, the Quiet BSS IE is sent as
2953 * a Proprietary IE. This will be understood by all the
2954 * TITAN STA's
2955 * Transitioning gLimQuietState to eLIM_QUIET_BEGIN will
2956 * initiate the SCH to include the Quiet BSS IE in all
2957 * its subsequent Beacons/PR's.
2958 * The Quiet BSS IE will be included in all the Beacons
2959 * & PR's until the next DTIM period
2960 *
2961 * On the STA -
2962 * When gLimQuietState = eLIM_QUIET_RUNNING
2963 * This indicates that the STA was successfully shut-off
2964 * for the specified gLimQuietDuration. This is a trigger
2965 * for the STA to now resume data traffic.
2966 * -> gLimQuietState is set to eLIM_QUIET_INIT
2967 *
2968 * ASSUMPTIONS:
2969 *
2970 * NOTE:
2971 *
2972 * @param pMac - Pointer to Global MAC structure
2973 *
2974 * @return None
2975 */
2976void limProcessQuietBssTimeout( tpAniSirGlobal pMac )
2977{
Jeff Johnsone7245742012-09-05 17:12:55 -07002978 tpPESession psessionEntry;
Jeff Johnson295189b2012-06-20 16:38:30 -07002979
Jeff Johnsone7245742012-09-05 17:12:55 -07002980 if((psessionEntry = peFindSessionBySessionId(pMac, pMac->lim.limTimers.gLimQuietBssTimer.sessionId))== NULL)
Jeff Johnson295189b2012-06-20 16:38:30 -07002981 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002982 limLog(pMac, LOGP,FL("Session Does not exist for given sessionID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002983 return;
2984 }
2985
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002986 PELOG1(limLog(pMac, LOG1, FL("quietState = %d"), psessionEntry->gLimSpecMgmt.quietState);)
Jeff Johnsone7245742012-09-05 17:12:55 -07002987 if (eLIM_AP_ROLE == psessionEntry->limSystemRole)
Jeff Johnson295189b2012-06-20 16:38:30 -07002988 {
Jeff Johnson295189b2012-06-20 16:38:30 -07002989 }
2990 else
2991 {
2992 // eLIM_STA_ROLE
Jeff Johnsone7245742012-09-05 17:12:55 -07002993 switch( psessionEntry->gLimSpecMgmt.quietState )
Jeff Johnson295189b2012-06-20 16:38:30 -07002994 {
2995 case eLIM_QUIET_RUNNING:
2996 // Transition to eLIM_QUIET_INIT
Jeff Johnsone7245742012-09-05 17:12:55 -07002997 psessionEntry->gLimSpecMgmt.quietState = eLIM_QUIET_INIT;
Jeff Johnson295189b2012-06-20 16:38:30 -07002998
2999 if( !pMac->lim.gLimTriggerBackgroundScanDuringQuietBss || (glimTriggerBackgroundScanDuringQuietBss_Status == eSIR_FALSE) )
3000 {
3001 // Resume data traffic only if channel switch is not running in silent mode.
Jeff Johnsone7245742012-09-05 17:12:55 -07003002 if (!((psessionEntry->gLimSpecMgmt.dot11hChanSwState == eLIM_11H_CHANSW_RUNNING) &&
3003 (psessionEntry->gLimChannelSwitch.switchMode == eSIR_CHANSW_MODE_SILENT)))
Jeff Johnson295189b2012-06-20 16:38:30 -07003004 {
3005 limFrameTransmissionControl(pMac, eLIM_TX_ALL, eLIM_RESUME_TX);
Jeff Johnsone7245742012-09-05 17:12:55 -07003006 limRestorePreQuietState(pMac, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07003007 }
3008
3009 /* Reset status flag */
3010 if(glimTriggerBackgroundScanDuringQuietBss_Status == eSIR_FALSE)
3011 glimTriggerBackgroundScanDuringQuietBss_Status = eSIR_TRUE;
3012
3013 limLog( pMac, LOG2,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003014 FL("Quiet BSS: Resuming traffic..."));
Jeff Johnson295189b2012-06-20 16:38:30 -07003015 }
3016 else
3017 {
3018 //
3019 // Nothing specific to be done in this case
3020 // A background scan that was triggered during
3021 // SIR_LIM_QUIET_TIMEOUT will complete on its own
3022 //
3023 limLog( pMac, LOG2,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003024 FL("Background scan should be complete now..."));
Jeff Johnson295189b2012-06-20 16:38:30 -07003025 }
3026 break;
3027
3028 case eLIM_QUIET_INIT:
3029 case eLIM_QUIET_BEGIN:
3030 case eLIM_QUIET_END:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003031 PELOG2(limLog(pMac, LOG2, FL("Quiet state not in RUNNING"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003032 /* If the quiet period has ended, then resume the frame transmission */
3033 limFrameTransmissionControl(pMac, eLIM_TX_ALL, eLIM_RESUME_TX);
Jeff Johnsone7245742012-09-05 17:12:55 -07003034 limRestorePreQuietState(pMac, psessionEntry);
3035 psessionEntry->gLimSpecMgmt.quietState = eLIM_QUIET_INIT;
Jeff Johnson295189b2012-06-20 16:38:30 -07003036 break;
3037
3038 default:
3039 //
3040 // As of now, nothing to be done
3041 //
3042 break;
3043 }
3044 }
3045}
Jeff Johnson295189b2012-06-20 16:38:30 -07003046/**
3047 * limProcessWPSOverlapTimeout
3048 *
3049 * FUNCTION: This function call limWPSPBCTimeout() to clean WPS PBC probe request entries
3050 *
3051 * LOGIC:
3052 *
3053 * ASSUMPTIONS:
3054 *
3055 * NOTE:
3056 *
3057 * @param pMac - Pointer to Global MAC structure
3058 *
3059 * @return None
3060 */
3061#if 0
3062void limProcessWPSOverlapTimeout(tpAniSirGlobal pMac)
3063{
3064
3065 tpPESession psessionEntry;
3066 tANI_U32 sessionId;
3067
3068 if (tx_timer_activate(&pMac->lim.limTimers.gLimWPSOverlapTimerObj.gLimWPSOverlapTimer) != TX_SUCCESS)
3069 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003070 limLog(pMac, LOGP, FL("tx_timer_activate failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003071 }
3072
3073 sessionId = pMac->lim.limTimers.gLimWPSOverlapTimerObj.sessionId;
3074
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003075 PELOGE(limLog(pMac, LOGE, FL("WPS overlap timeout, sessionId=%d"), sessionId);)
Jeff Johnson295189b2012-06-20 16:38:30 -07003076
3077 if((psessionEntry = peFindSessionBySessionId(pMac, sessionId)) == NULL)
3078 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003079 PELOGE(limLog(pMac, LOGP,FL("Session Does not exist for given sessionID"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003080 return;
3081 }
3082
3083 limWPSPBCTimeout(pMac, psessionEntry);
3084}
3085#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07003086
Jeff Johnson295189b2012-06-20 16:38:30 -07003087/**----------------------------------------------
3088\fn limStartQuietTimer
3089\brief Starts the quiet timer.
3090
3091\param pMac
3092\return NONE
3093-----------------------------------------------*/
3094void limStartQuietTimer(tpAniSirGlobal pMac, tANI_U8 sessionId)
3095{
3096 tpPESession psessionEntry;
3097 psessionEntry = peFindSessionBySessionId(pMac , sessionId);
3098
3099 if(psessionEntry == NULL) {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003100 limLog(pMac, LOGP,FL("Session Does not exist for given sessionID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003101 return;
3102 }
3103
Jeff Johnson295189b2012-06-20 16:38:30 -07003104
3105 if (psessionEntry->limSystemRole != eLIM_STA_ROLE)
3106 return;
3107 // First, de-activate Timer, if its already active
3108 limCancelDot11hQuiet(pMac, psessionEntry);
3109
Jeff Johnsone7245742012-09-05 17:12:55 -07003110 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, sessionId, eLIM_QUIET_TIMER));
3111 if( TX_SUCCESS != tx_timer_deactivate(&pMac->lim.limTimers.gLimQuietTimer))
3112 {
3113 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003114 FL( "Unable to deactivate gLimQuietTimer! Will still attempt to re-activate anyway..." ));
Jeff Johnsone7245742012-09-05 17:12:55 -07003115 }
3116
3117 // Set the NEW timeout value, in ticks
3118 if( TX_SUCCESS != tx_timer_change( &pMac->lim.limTimers.gLimQuietTimer,
3119 SYS_MS_TO_TICKS(psessionEntry->gLimSpecMgmt.quietTimeoutValue), 0))
3120 {
3121 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003122 FL( "Unable to change gLimQuietTimer! Will still attempt to re-activate anyway..." ));
Jeff Johnsone7245742012-09-05 17:12:55 -07003123 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003124
3125 pMac->lim.limTimers.gLimQuietTimer.sessionId = sessionId;
3126 if( TX_SUCCESS != tx_timer_activate(&pMac->lim.limTimers.gLimQuietTimer))
3127 {
3128 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003129 FL("Unable to activate gLimQuietTimer! STA cannot honor Quiet BSS!"));
Jeff Johnsone7245742012-09-05 17:12:55 -07003130 limRestorePreQuietState(pMac, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07003131
Jeff Johnsone7245742012-09-05 17:12:55 -07003132 psessionEntry->gLimSpecMgmt.quietState = eLIM_QUIET_INIT;
Jeff Johnson295189b2012-06-20 16:38:30 -07003133 return;
3134 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003135}
3136
Jeff Johnson295189b2012-06-20 16:38:30 -07003137
3138/** ------------------------------------------------------------------------ **/
3139/**
3140 * keep track of the number of ANI peers associated in the BSS
3141 * For the first and last ANI peer, we have to update EDCA params as needed
3142 *
3143 * When the first ANI peer joins the BSS, we notify SCH
3144 * When the last ANI peer leaves the BSS, we notfiy SCH
3145 */
3146void
3147limUtilCountStaAdd(
3148 tpAniSirGlobal pMac,
3149 tpDphHashNode pSta,
3150 tpPESession psessionEntry)
3151{
3152
3153 if ((! pSta) || (! pSta->valid) || (! pSta->aniPeer) || (pSta->fAniCount))
3154 return;
3155
3156 pSta->fAniCount = 1;
3157
3158 if (pMac->lim.gLimNumOfAniSTAs++ != 0)
3159 return;
3160
3161 // get here only if this is the first ANI peer in the BSS
3162 schEdcaProfileUpdate(pMac, psessionEntry);
3163}
3164
3165void
3166limUtilCountStaDel(
3167 tpAniSirGlobal pMac,
3168 tpDphHashNode pSta,
3169 tpPESession psessionEntry)
3170{
3171
3172 if ((pSta == NULL) || (pSta->aniPeer == eHAL_CLEAR) || (! pSta->fAniCount))
3173 return;
3174
3175 /* Only if sta is invalid and the validInDummyState bit is set to 1,
3176 * then go ahead and update the count and profiles. This ensures
3177 * that the "number of ani station" count is properly incremented/decremented.
3178 */
3179 if (pSta->valid == 1)
3180 return;
3181
3182 pSta->fAniCount = 0;
3183
3184 if (pMac->lim.gLimNumOfAniSTAs <= 0)
3185 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003186 limLog(pMac, LOGE, FL("CountStaDel: ignoring Delete Req when AniPeer count is %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07003187 pMac->lim.gLimNumOfAniSTAs);
3188 return;
3189 }
3190
3191 pMac->lim.gLimNumOfAniSTAs--;
3192
3193 if (pMac->lim.gLimNumOfAniSTAs != 0)
3194 return;
3195
3196 // get here only if this is the last ANI peer in the BSS
3197 schEdcaProfileUpdate(pMac, psessionEntry);
3198}
3199
Jeff Johnson295189b2012-06-20 16:38:30 -07003200/**
3201 * limSwitchChannelCback()
3202 *
3203 *FUNCTION:
3204 * This is the callback function registered while requesting to switch channel
3205 * after AP indicates a channel switch for spectrum management (11h).
3206 *
3207 *NOTE:
3208 * @param pMac Pointer to Global MAC structure
3209 * @param status Status of channel switch request
3210 * @param data User data
3211 * @param psessionEntry Session information
3212 * @return NONE
3213 */
3214void limSwitchChannelCback(tpAniSirGlobal pMac, eHalStatus status,
3215 tANI_U32 *data, tpPESession psessionEntry)
3216{
3217 tSirMsgQ mmhMsg = {0};
3218 tSirSmeSwitchChannelInd *pSirSmeSwitchChInd;
3219
Jeff Johnson295189b2012-06-20 16:38:30 -07003220 psessionEntry->currentOperChannel = psessionEntry->currentReqChannel;
3221
3222 /* We need to restore pre-channelSwitch state on the STA */
3223 if (limRestorePreChannelSwitchState(pMac, psessionEntry) != eSIR_SUCCESS)
3224 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003225 limLog(pMac, LOGP, FL("Could not restore pre-channelSwitch (11h) state, resetting the system"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003226 return;
3227 }
3228
3229 mmhMsg.type = eWNI_SME_SWITCH_CHL_REQ;
3230 if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&pSirSmeSwitchChInd, sizeof(tSirSmeSwitchChannelInd)))
3231 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003232 limLog(pMac, LOGP, FL("Failed to allocate buffer for buffer descriptor"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003233 return;
3234 }
3235
3236 pSirSmeSwitchChInd->messageType = eWNI_SME_SWITCH_CHL_REQ;
3237 pSirSmeSwitchChInd->length = sizeof(tSirSmeSwitchChannelInd);
Jeff Johnsone7245742012-09-05 17:12:55 -07003238 pSirSmeSwitchChInd->newChannelId = psessionEntry->gLimChannelSwitch.primaryChannel;
Jeff Johnson295189b2012-06-20 16:38:30 -07003239 pSirSmeSwitchChInd->sessionId = psessionEntry->smeSessionId;
3240 //BSS ID
3241 palCopyMemory( pMac->hHdd, pSirSmeSwitchChInd->bssId, psessionEntry->bssId, sizeof(tSirMacAddr));
3242 mmhMsg.bodyptr = pSirSmeSwitchChInd;
3243 mmhMsg.bodyval = 0;
3244
Jeff Johnsone7245742012-09-05 17:12:55 -07003245 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07003246
Jeff Johnson295189b2012-06-20 16:38:30 -07003247 SysProcessMmhMsg(pMac, &mmhMsg);
Jeff Johnson295189b2012-06-20 16:38:30 -07003248}
3249
3250/**
3251 * limSwitchPrimaryChannel()
3252 *
3253 *FUNCTION:
3254 * This function changes the current operating channel
3255 * and sets the new new channel ID in WNI_CFG_CURRENT_CHANNEL.
3256 *
3257 *NOTE:
3258 * @param pMac Pointer to Global MAC structure
3259 * @param newChannel new chnannel ID
3260 * @return NONE
3261 */
3262void limSwitchPrimaryChannel(tpAniSirGlobal pMac, tANI_U8 newChannel,tpPESession psessionEntry)
3263{
3264#if !defined WLAN_FEATURE_VOWIFI
3265 tANI_U32 localPwrConstraint;
3266#endif
3267
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003268 PELOG3(limLog(pMac, LOG3, FL("limSwitchPrimaryChannel: old chnl %d --> new chnl %d "),
Jeff Johnson295189b2012-06-20 16:38:30 -07003269 psessionEntry->currentOperChannel, newChannel);)
3270 psessionEntry->currentReqChannel = newChannel;
3271 psessionEntry->limRFBand = limGetRFBand(newChannel);
3272
3273 psessionEntry->channelChangeReasonCode=LIM_SWITCH_CHANNEL_OPERATION;
3274
3275 pMac->lim.gpchangeChannelCallback = limSwitchChannelCback;
3276 pMac->lim.gpchangeChannelData = NULL;
3277
3278#if defined WLAN_FEATURE_VOWIFI
Jeff Johnsone7245742012-09-05 17:12:55 -07003279 limSendSwitchChnlParams(pMac, newChannel, PHY_SINGLE_CHANNEL_CENTERED,
Jeff Johnson295189b2012-06-20 16:38:30 -07003280 psessionEntry->maxTxPower, psessionEntry->peSessionId);
3281#else
3282 if(wlan_cfgGetInt(pMac, WNI_CFG_LOCAL_POWER_CONSTRAINT, &localPwrConstraint) != eSIR_SUCCESS)
3283 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003284 limLog( pMac, LOGP, FL( "Unable to read Local Power Constraint from cfg" ));
Jeff Johnson295189b2012-06-20 16:38:30 -07003285 return;
3286 }
Jeff Johnsone7245742012-09-05 17:12:55 -07003287 limSendSwitchChnlParams(pMac, newChannel, PHY_SINGLE_CHANNEL_CENTERED,
Jeff Johnson295189b2012-06-20 16:38:30 -07003288 (tPowerdBm)localPwrConstraint, psessionEntry->peSessionId);
3289#endif
3290 return;
3291}
3292
3293/**
3294 * limSwitchPrimarySecondaryChannel()
3295 *
3296 *FUNCTION:
3297 * This function changes the primary and secondary channel.
3298 * If 11h is enabled and user provides a "new channel ID"
3299 * that is different from the current operating channel,
3300 * then we must set this new channel in WNI_CFG_CURRENT_CHANNEL,
3301 * assign notify LIM of such change.
3302 *
3303 *NOTE:
3304 * @param pMac Pointer to Global MAC structure
3305 * @param newChannel New chnannel ID (or current channel ID)
3306 * @param subband CB secondary info:
3307 * - eANI_CB_SECONDARY_NONE
3308 * - eANI_CB_SECONDARY_UP
3309 * - eANI_CB_SECONDARY_DOWN
3310 * @return NONE
3311 */
Jeff Johnsone7245742012-09-05 17:12:55 -07003312void limSwitchPrimarySecondaryChannel(tpAniSirGlobal pMac, tpPESession psessionEntry, tANI_U8 newChannel, ePhyChanBondState subband)
Jeff Johnson295189b2012-06-20 16:38:30 -07003313{
3314#if !defined WLAN_FEATURE_VOWIFI
3315 tANI_U32 localPwrConstraint;
3316#endif
3317
Jeff Johnson295189b2012-06-20 16:38:30 -07003318#if !defined WLAN_FEATURE_VOWIFI
3319 if(wlan_cfgGetInt(pMac, WNI_CFG_LOCAL_POWER_CONSTRAINT, &localPwrConstraint) != eSIR_SUCCESS) {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003320 limLog( pMac, LOGP, FL( "Unable to get Local Power Constraint from cfg" ));
Jeff Johnson295189b2012-06-20 16:38:30 -07003321 return;
3322 }
3323#endif
3324
Jeff Johnson295189b2012-06-20 16:38:30 -07003325#if defined WLAN_FEATURE_VOWIFI
Jeff Johnsone7245742012-09-05 17:12:55 -07003326 limSendSwitchChnlParams(pMac, newChannel, subband, psessionEntry->maxTxPower, psessionEntry->peSessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07003327#else
Jeff Johnsone7245742012-09-05 17:12:55 -07003328 limSendSwitchChnlParams(pMac, newChannel, subband, (tPowerdBm)localPwrConstraint, psessionEntry->peSessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07003329#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07003330
Jeff Johnsone7245742012-09-05 17:12:55 -07003331 // Store the new primary and secondary channel in session entries if different
3332 if (psessionEntry->currentOperChannel != newChannel)
Jeff Johnson295189b2012-06-20 16:38:30 -07003333 {
3334 limLog(pMac, LOGW,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003335 FL("switch old chnl %d --> new chnl %d "),
Jeff Johnson295189b2012-06-20 16:38:30 -07003336 psessionEntry->currentOperChannel, newChannel);
Jeff Johnson295189b2012-06-20 16:38:30 -07003337 psessionEntry->currentOperChannel = newChannel;
3338 }
Jeff Johnsone7245742012-09-05 17:12:55 -07003339 if (psessionEntry->htSecondaryChannelOffset != subband)
3340 {
3341 limLog(pMac, LOGW,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003342 FL("switch old sec chnl %d --> new sec chnl %d "),
Jeff Johnsone7245742012-09-05 17:12:55 -07003343 psessionEntry->htSecondaryChannelOffset, subband);
3344 psessionEntry->htSecondaryChannelOffset = subband;
3345 if (psessionEntry->htSecondaryChannelOffset == PHY_SINGLE_CHANNEL_CENTERED)
3346 {
3347 psessionEntry->htSupportedChannelWidthSet = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE;
3348 }
3349 else
3350 {
3351 psessionEntry->htSupportedChannelWidthSet = WNI_CFG_CHANNEL_BONDING_MODE_ENABLE;
3352 }
3353 psessionEntry->htRecommendedTxWidthSet = psessionEntry->htSupportedChannelWidthSet;
3354 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003355
3356 return;
3357}
3358
3359
3360/**
3361 * limActiveScanAllowed()
3362 *
3363 *FUNCTION:
3364 * Checks if active scans are permitted on the given channel
3365 *
3366 *LOGIC:
3367 * The config variable SCAN_CONTROL_LIST contains pairs of (channelNum, activeScanAllowed)
3368 * Need to check if the channelNum matches, then depending on the corresponding
3369 * scan flag, return true (for activeScanAllowed==1) or false (otherwise).
3370 *
3371 *ASSUMPTIONS:
3372 *
3373 *NOTE:
3374 *
3375 * @param pMac Pointer to Global MAC structure
3376 * @param channelNum channel number
3377 * @return None
3378 */
3379
3380tANI_U8 limActiveScanAllowed(
3381 tpAniSirGlobal pMac,
3382 tANI_U8 channelNum)
3383{
3384 tANI_U32 i;
3385 tANI_U8 channelPair[WNI_CFG_SCAN_CONTROL_LIST_LEN];
3386 tANI_U32 len = WNI_CFG_SCAN_CONTROL_LIST_LEN;
3387 if (wlan_cfgGetStr(pMac, WNI_CFG_SCAN_CONTROL_LIST, channelPair, &len)
3388 != eSIR_SUCCESS)
3389 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003390 PELOGE(limLog(pMac, LOGE, FL("Unable to get scan control list"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003391 return false;
3392 }
3393
3394 if (len > WNI_CFG_SCAN_CONTROL_LIST_LEN)
3395 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003396 limLog(pMac, LOGE, FL("Invalid scan control list length:%d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07003397 len);
3398 return false;
3399 }
3400
3401 for (i=0; (i+1) < len; i+=2)
3402 {
3403 if (channelPair[i] == channelNum)
3404 return ((channelPair[i+1] == eSIR_ACTIVE_SCAN) ? true : false);
3405 }
3406 return false;
3407}
3408
3409/**
3410 * limTriggerBackgroundScanDuringQuietBss()
3411 *
3412 *FUNCTION:
3413 * This function is applicable to the STA only.
3414 * This function is called by limProcessQuietTimeout(),
3415 * when it is time to honor the Quiet BSS IE from the AP.
3416 *
3417 *LOGIC:
3418 * If 11H is enabled:
3419 * We cannot trigger a background scan. The STA needs to
3420 * shut-off Tx/Rx.
3421 * If 11 is not enabled:
3422 * Determine if the next channel that we are going to
3423 * scan is NOT the same channel (or not) on which the
3424 * Quiet BSS was requested.
3425 * If yes, then we cannot trigger a background scan on
3426 * this channel. Return with a false.
3427 * If no, then trigger a background scan. Return with
3428 * a true.
3429 *
3430 *ASSUMPTIONS:
3431 *
3432 *NOTE:
3433 * This API is redundant if the existing API,
3434 * limTriggerBackgroundScan(), were to return a valid
3435 * response instead of returning void.
3436 * If possible, try to revisit this API
3437 *
3438 * @param pMac Pointer to Global MAC structure
3439 * @return eSIR_TRUE, if a background scan was attempted
3440 * eSIR_FALSE, if not
3441 */
3442tAniBool limTriggerBackgroundScanDuringQuietBss( tpAniSirGlobal pMac )
3443{
3444 tAniBool bScanTriggered = eSIR_FALSE;
Jeff Johnson295189b2012-06-20 16:38:30 -07003445
3446
3447
3448 //TBD-RAJESH HOW TO GET sessionEntry?????
3449 tpPESession psessionEntry = &pMac->lim.gpSession[0];
3450
3451 if (psessionEntry->limSystemRole != eLIM_STA_ROLE)
3452 return bScanTriggered;
3453
Jeff Johnsone7245742012-09-05 17:12:55 -07003454 if( !psessionEntry->lim11hEnable )
Jeff Johnson295189b2012-06-20 16:38:30 -07003455 {
3456 tSirMacChanNum bgScanChannelList[WNI_CFG_BG_SCAN_CHANNEL_LIST_LEN];
3457 tANI_U32 len = WNI_CFG_BG_SCAN_CHANNEL_LIST_LEN;
3458
3459 // Determine the next scan channel
3460
3461 // Get background scan channel list from CFG
3462 if( eSIR_SUCCESS == wlan_cfgGetStr( pMac,
3463 WNI_CFG_BG_SCAN_CHANNEL_LIST,
3464 (tANI_U8 *) bgScanChannelList,
3465 (tANI_U32 *) &len ))
3466 {
3467 // Ensure that we do not go off scanning on the same
3468 // channel on which the Quiet BSS was requested
3469 if( psessionEntry->currentOperChannel!=
3470 bgScanChannelList[pMac->lim.gLimBackgroundScanChannelId] )
3471 {
3472 // For now, try and attempt a background scan. It will
3473 // be ideal if this API actually returns a success or
3474 // failure instead of having a void return type
3475 limTriggerBackgroundScan( pMac );
3476
3477 bScanTriggered = eSIR_TRUE;
3478 }
3479 else
3480 {
3481 limLog( pMac, LOGW,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003482 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 -07003483 }
3484 }
3485 else
3486 {
3487 limLog( pMac, LOGW,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003488 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 -07003489 }
3490 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003491 return bScanTriggered;
3492}
3493
3494
3495/**
3496 * limGetHTCapability()
3497 *
3498 *FUNCTION:
3499 * A utility function that returns the "current HT capability state" for the HT
3500 * capability of interest (as requested in the API)
3501 *
3502 *LOGIC:
3503 * This routine will return with the "current" setting of a requested HT
3504 * capability. This state info could be retrieved from -
3505 * a) CFG (for static entries)
3506 * b) Run time info
3507 * - Dynamic state maintained by LIM
3508 * - Configured at radio init time by SME
3509 *
3510 *
3511 *ASSUMPTIONS:
3512 * NA
3513 *
3514 *NOTE:
3515 *
3516 * @param pMac Pointer to Global MAC structure
3517 * @param htCap The HT capability being queried
3518 * @return tANI_U8 The current state of the requested HT capability is returned in a
3519 * tANI_U8 variable
3520 */
3521
Jeff Johnson295189b2012-06-20 16:38:30 -07003522tANI_U8 limGetHTCapability( tpAniSirGlobal pMac,
3523 tANI_U32 htCap, tpPESession psessionEntry)
Jeff Johnson295189b2012-06-20 16:38:30 -07003524{
3525tANI_U8 retVal = 0;
3526tANI_U8 *ptr;
3527tANI_U32 cfgValue;
3528tSirMacHTCapabilityInfo macHTCapabilityInfo = {0};
3529tSirMacExtendedHTCapabilityInfo macExtHTCapabilityInfo = {0};
3530tSirMacTxBFCapabilityInfo macTxBFCapabilityInfo = {0};
3531tSirMacASCapabilityInfo macASCapabilityInfo = {0};
3532
3533 //
3534 // Determine which CFG to read from. Not ALL of the HT
3535 // related CFG's need to be read each time this API is
3536 // accessed
3537 //
3538 if( htCap >= eHT_ANTENNA_SELECTION &&
3539 htCap < eHT_SI_GRANULARITY )
3540 {
3541 // Get Antenna Seletion HT Capabilities
3542 if( eSIR_SUCCESS != wlan_cfgGetInt( pMac, WNI_CFG_AS_CAP, &cfgValue ))
3543 cfgValue = 0;
3544 ptr = (tANI_U8 *) &macASCapabilityInfo;
3545 *((tANI_U8 *)ptr) = (tANI_U8) (cfgValue & 0xff);
3546 }
3547 else
3548 {
3549 if( htCap >= eHT_TX_BEAMFORMING &&
3550 htCap < eHT_ANTENNA_SELECTION )
3551 {
3552 // Get Transmit Beam Forming HT Capabilities
3553 if( eSIR_SUCCESS != wlan_cfgGetInt( pMac, WNI_CFG_TX_BF_CAP, &cfgValue ))
3554 cfgValue = 0;
3555 ptr = (tANI_U8 *) &macTxBFCapabilityInfo;
3556 *((tANI_U32 *)ptr) = (tANI_U32) (cfgValue);
3557 }
3558 else
3559 {
3560 if( htCap >= eHT_PCO &&
3561 htCap < eHT_TX_BEAMFORMING )
3562 {
3563 // Get Extended HT Capabilities
3564 if( eSIR_SUCCESS != wlan_cfgGetInt( pMac, WNI_CFG_EXT_HT_CAP_INFO, &cfgValue ))
3565 cfgValue = 0;
3566 ptr = (tANI_U8 *) &macExtHTCapabilityInfo;
3567 *((tANI_U16 *)ptr) = (tANI_U16) (cfgValue & 0xffff);
3568 }
3569 else
3570 {
3571 if( htCap < eHT_MAX_RX_AMPDU_FACTOR )
3572 {
3573 // Get HT Capabilities
3574 if( eSIR_SUCCESS != wlan_cfgGetInt( pMac, WNI_CFG_HT_CAP_INFO, &cfgValue ))
3575 cfgValue = 0;
3576 ptr = (tANI_U8 *) &macHTCapabilityInfo;
3577 // 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
3578 *ptr++ = cfgValue & 0xff;
3579 *ptr = (cfgValue >> 8) & 0xff;
3580 }
3581 }
3582 }
3583 }
3584
3585 switch( htCap )
3586 {
3587 case eHT_LSIG_TXOP_PROTECTION:
3588 retVal = pMac->lim.gHTLsigTXOPProtection;
3589 break;
3590
3591 case eHT_STBC_CONTROL_FRAME:
3592 retVal = (tANI_U8) macHTCapabilityInfo.stbcControlFrame;
3593 break;
3594
3595 case eHT_PSMP:
3596 retVal = pMac->lim.gHTPSMPSupport;
3597 break;
3598
3599 case eHT_DSSS_CCK_MODE_40MHZ:
3600 retVal = pMac->lim.gHTDsssCckRate40MHzSupport;
3601 break;
3602
3603 case eHT_MAX_AMSDU_LENGTH:
3604 retVal = (tANI_U8) macHTCapabilityInfo.maximalAMSDUsize;
3605 break;
3606
3607 case eHT_DELAYED_BA:
3608 retVal = (tANI_U8) macHTCapabilityInfo.delayedBA;
3609 break;
3610
3611 case eHT_RX_STBC:
3612 retVal = (tANI_U8) macHTCapabilityInfo.rxSTBC;
3613 break;
3614
3615 case eHT_TX_STBC:
3616 retVal = (tANI_U8) macHTCapabilityInfo.txSTBC;
3617 break;
3618
3619 case eHT_SHORT_GI_40MHZ:
3620 retVal = (tANI_U8) macHTCapabilityInfo.shortGI40MHz;
3621 break;
3622
3623 case eHT_SHORT_GI_20MHZ:
3624 retVal = (tANI_U8) macHTCapabilityInfo.shortGI20MHz;
3625 break;
3626
3627 case eHT_GREENFIELD:
3628 retVal = (tANI_U8) macHTCapabilityInfo.greenField;
3629 break;
3630
3631 case eHT_MIMO_POWER_SAVE:
3632 retVal = (tANI_U8) pMac->lim.gHTMIMOPSState;
3633 break;
3634
3635 case eHT_SUPPORTED_CHANNEL_WIDTH_SET:
Jeff Johnsone7245742012-09-05 17:12:55 -07003636 retVal = (tANI_U8) psessionEntry->htSupportedChannelWidthSet;
Jeff Johnson295189b2012-06-20 16:38:30 -07003637 break;
3638
3639 case eHT_ADVANCED_CODING:
3640 retVal = (tANI_U8) macHTCapabilityInfo.advCodingCap;
3641 break;
3642
3643 case eHT_MAX_RX_AMPDU_FACTOR:
3644 retVal = pMac->lim.gHTMaxRxAMpduFactor;
3645 break;
3646
3647 case eHT_MPDU_DENSITY:
3648 retVal = pMac->lim.gHTAMpduDensity;
3649 break;
3650
3651 case eHT_PCO:
3652 retVal = (tANI_U8) macExtHTCapabilityInfo.pco;
3653 break;
3654
3655 case eHT_TRANSITION_TIME:
3656 retVal = (tANI_U8) macExtHTCapabilityInfo.transitionTime;
3657 break;
3658
3659 case eHT_MCS_FEEDBACK:
3660 retVal = (tANI_U8) macExtHTCapabilityInfo.mcsFeedback;
3661 break;
3662
3663 case eHT_TX_BEAMFORMING:
3664 retVal = (tANI_U8) macTxBFCapabilityInfo.txBF;
3665 break;
3666
3667 case eHT_ANTENNA_SELECTION:
3668 retVal = (tANI_U8) macASCapabilityInfo.antennaSelection;
3669 break;
3670
3671 case eHT_SI_GRANULARITY:
3672 retVal = pMac->lim.gHTServiceIntervalGranularity;
3673 break;
3674
3675 case eHT_CONTROLLED_ACCESS:
3676 retVal = pMac->lim.gHTControlledAccessOnly;
3677 break;
3678
3679 case eHT_RIFS_MODE:
3680 retVal = psessionEntry->beaconParams.fRIFSMode;
3681 break;
3682
3683 case eHT_RECOMMENDED_TX_WIDTH_SET:
Jeff Johnsone7245742012-09-05 17:12:55 -07003684 retVal = psessionEntry->htRecommendedTxWidthSet;
Jeff Johnson295189b2012-06-20 16:38:30 -07003685 break;
3686
3687 case eHT_EXTENSION_CHANNEL_OFFSET:
Jeff Johnsone7245742012-09-05 17:12:55 -07003688 retVal = psessionEntry->htSecondaryChannelOffset;
Jeff Johnson295189b2012-06-20 16:38:30 -07003689 break;
3690
3691 case eHT_OP_MODE:
Jeff Johnson295189b2012-06-20 16:38:30 -07003692 if(psessionEntry->limSystemRole == eLIM_AP_ROLE )
3693 retVal = psessionEntry->htOperMode;
3694 else
Jeff Johnson295189b2012-06-20 16:38:30 -07003695 retVal = pMac->lim.gHTOperMode;
3696 break;
3697
3698 case eHT_BASIC_STBC_MCS:
3699 retVal = pMac->lim.gHTSTBCBasicMCS;
3700 break;
3701
3702 case eHT_DUAL_CTS_PROTECTION:
3703 retVal = pMac->lim.gHTDualCTSProtection;
3704 break;
3705
3706 case eHT_LSIG_TXOP_PROTECTION_FULL_SUPPORT:
3707 retVal = psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport;
3708 break;
3709
3710 case eHT_PCO_ACTIVE:
3711 retVal = pMac->lim.gHTPCOActive;
3712 break;
3713
3714 case eHT_PCO_PHASE:
3715 retVal = pMac->lim.gHTPCOPhase;
3716 break;
3717
3718 default:
3719 break;
3720 }
3721
3722 return retVal;
3723}
3724
Jeff Johnson295189b2012-06-20 16:38:30 -07003725void limGetMyMacAddr(tpAniSirGlobal pMac, tANI_U8 *mac)
3726{
3727 palCopyMemory( pMac->hHdd, mac, pMac->lim.gLimMyMacAddr, sizeof(tSirMacAddr));
3728 return;
3729}
3730
3731
3732
3733
3734/** -------------------------------------------------------------
3735\fn limEnable11aProtection
3736\brief based on config setting enables\disables 11a protection.
3737\param tANI_U8 enable : 1=> enable protection, 0=> disable protection.
3738\param tANI_U8 overlap: 1=> called from overlap context, 0 => called from assoc context.
3739\param tpUpdateBeaconParams pBeaconParams
3740\return None
3741 -------------------------------------------------------------*/
3742tSirRetStatus
3743limEnable11aProtection(tpAniSirGlobal pMac, tANI_U8 enable,
3744 tANI_U8 overlap, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry)
3745{
Madan Mohan Koyyalamudi33ef6a22012-10-30 17:44:43 -07003746 if(NULL == psessionEntry)
3747 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003748 PELOG3(limLog(pMac, LOG3, FL("psessionEntry is NULL"));)
Madan Mohan Koyyalamudi33ef6a22012-10-30 17:44:43 -07003749 return eSIR_FAILURE;
3750 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003751 //overlapping protection configuration check.
3752 if(overlap)
3753 {
Jeff Johnson295189b2012-06-20 16:38:30 -07003754 }
3755 else
3756 {
3757 //normal protection config check
Madan Mohan Koyyalamudi33ef6a22012-10-30 17:44:43 -07003758 if ((psessionEntry->limSystemRole == eLIM_AP_ROLE) &&
Jeff Johnsone7245742012-09-05 17:12:55 -07003759 (!psessionEntry->cfgProtection.fromlla))
Jeff Johnson295189b2012-06-20 16:38:30 -07003760 {
3761 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003762 PELOG3(limLog(pMac, LOG3, FL("protection from 11a is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003763 return eSIR_SUCCESS;
3764 }
3765 }
3766
3767 if (enable)
3768 {
3769 //If we are AP and HT capable, we need to set the HT OP mode
3770 //appropriately.
3771 if(((eLIM_AP_ROLE == psessionEntry->limSystemRole)||(eLIM_BT_AMP_AP_ROLE == psessionEntry->limSystemRole))&&
Jeff Johnsone7245742012-09-05 17:12:55 -07003772 (true == psessionEntry->htCapability))
Jeff Johnson295189b2012-06-20 16:38:30 -07003773 {
3774 if(overlap)
3775 {
3776 pMac->lim.gLimOverlap11aParams.protectionEnabled = true;
3777 if((eSIR_HT_OP_MODE_OVERLAP_LEGACY != pMac->lim.gHTOperMode) &&
3778 (eSIR_HT_OP_MODE_MIXED != pMac->lim.gHTOperMode))
3779 {
3780 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
3781 psessionEntry->htOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
3782 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
3783 limEnableHtOBSSProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
3784 }
3785 }
3786 else
3787 {
3788 psessionEntry->gLim11aParams.protectionEnabled = true;
3789 if(eSIR_HT_OP_MODE_MIXED != pMac->lim.gHTOperMode)
3790 {
3791 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_MIXED;
Jeff Johnsone7245742012-09-05 17:12:55 -07003792 psessionEntry->htOperMode = eSIR_HT_OP_MODE_MIXED;
Jeff Johnson295189b2012-06-20 16:38:30 -07003793 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
3794 limEnableHtOBSSProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
3795
3796 }
3797 }
3798 }
3799
3800 //This part is common for staiton as well.
3801 if(false == psessionEntry->beaconParams.llaCoexist)
3802 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003803 PELOG1(limLog(pMac, LOG1, FL(" => protection from 11A Enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003804 pBeaconParams->llaCoexist = psessionEntry->beaconParams.llaCoexist = true;
3805 pBeaconParams->paramChangeBitmap |= PARAM_llACOEXIST_CHANGED;
3806 }
3807 }
3808 else if (true == psessionEntry->beaconParams.llaCoexist)
3809 {
3810 //for AP role.
3811 //we need to take care of HT OP mode change if needed.
3812 //We need to take care of Overlap cases.
3813 if(eLIM_AP_ROLE == psessionEntry->limSystemRole)
3814 {
3815 if(overlap)
3816 {
3817 //Overlap Legacy protection disabled.
3818 pMac->lim.gLimOverlap11aParams.protectionEnabled = false;
3819
3820 //We need to take care of HT OP mode iff we are HT AP.
Jeff Johnsone7245742012-09-05 17:12:55 -07003821 if(psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07003822 {
3823 // no HT op mode change if any of the overlap protection enabled.
3824 if(!(pMac->lim.gLimOverlap11aParams.protectionEnabled ||
3825 pMac->lim.gLimOverlapHt20Params.protectionEnabled ||
3826 pMac->lim.gLimOverlapNonGfParams.protectionEnabled))
3827
3828 {
3829 //Check if there is a need to change HT OP mode.
3830 if(eSIR_HT_OP_MODE_OVERLAP_LEGACY == pMac->lim.gHTOperMode)
3831 {
3832 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
3833 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
3834
3835 if(psessionEntry->gLimHt20Params.protectionEnabled)
3836 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
3837 else
3838 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_PURE;
3839 }
3840 }
3841 }
3842 }
3843 else
3844 {
3845 //Disable protection from 11A stations.
3846 psessionEntry->gLim11aParams.protectionEnabled = false;
3847 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
3848
3849 //Check if any other non-HT protection enabled.
3850 //Right now we are in HT OP Mixed mode.
3851 //Change HT op mode appropriately.
3852
3853 //Change HT OP mode to 01 if any overlap protection enabled
3854 if(pMac->lim.gLimOverlap11aParams.protectionEnabled ||
3855 pMac->lim.gLimOverlapHt20Params.protectionEnabled ||
3856 pMac->lim.gLimOverlapNonGfParams.protectionEnabled)
3857
3858 {
3859 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
Jeff Johnsone7245742012-09-05 17:12:55 -07003860 psessionEntry->htOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
Jeff Johnson295189b2012-06-20 16:38:30 -07003861 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
3862 }
3863 else if(psessionEntry->gLimHt20Params.protectionEnabled)
3864 {
3865 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
Jeff Johnsone7245742012-09-05 17:12:55 -07003866 psessionEntry->htOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
Jeff Johnson295189b2012-06-20 16:38:30 -07003867 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
3868 }
3869 else
3870 {
3871 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_PURE;
Jeff Johnsone7245742012-09-05 17:12:55 -07003872 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
Jeff Johnson295189b2012-06-20 16:38:30 -07003873 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
3874 }
3875 }
3876 if(!pMac->lim.gLimOverlap11aParams.protectionEnabled &&
3877 !psessionEntry->gLim11aParams.protectionEnabled)
3878 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003879 PELOG1(limLog(pMac, LOG1, FL("===> Protection from 11A Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003880 pBeaconParams->llaCoexist = psessionEntry->beaconParams.llaCoexist = false;
3881 pBeaconParams->paramChangeBitmap |= PARAM_llACOEXIST_CHANGED;
3882 }
3883 }
3884 //for station role
3885 else
3886 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003887 PELOG1(limLog(pMac, LOG1, FL("===> Protection from 11A Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003888 pBeaconParams->llaCoexist = psessionEntry->beaconParams.llaCoexist = false;
3889 pBeaconParams->paramChangeBitmap |= PARAM_llACOEXIST_CHANGED;
3890 }
3891 }
3892
3893 return eSIR_SUCCESS;
3894}
3895
3896/** -------------------------------------------------------------
3897\fn limEnable11gProtection
3898\brief based on config setting enables\disables 11g protection.
3899\param tANI_U8 enable : 1=> enable protection, 0=> disable protection.
3900\param tANI_U8 overlap: 1=> called from overlap context, 0 => called from assoc context.
3901\param tpUpdateBeaconParams pBeaconParams
3902\return None
3903 -------------------------------------------------------------*/
3904
3905tSirRetStatus
3906limEnable11gProtection(tpAniSirGlobal pMac, tANI_U8 enable,
3907 tANI_U8 overlap, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry)
3908{
3909
3910 //overlapping protection configuration check.
3911 if(overlap)
3912 {
Jeff Johnson295189b2012-06-20 16:38:30 -07003913 }
3914 else
3915 {
3916 //normal protection config check
Jeff Johnson295189b2012-06-20 16:38:30 -07003917 if((psessionEntry->limSystemRole == eLIM_AP_ROLE ) &&
3918 !psessionEntry->cfgProtection.fromllb)
3919 {
3920 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003921 PELOG1(limLog(pMac, LOG1, FL("protection from 11b is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003922 return eSIR_SUCCESS;
3923 }else if(psessionEntry->limSystemRole != eLIM_AP_ROLE)
Jeff Johnson295189b2012-06-20 16:38:30 -07003924 {
3925 if(!pMac->lim.cfgProtection.fromllb)
3926 {
3927 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003928 PELOG1(limLog(pMac, LOG1, FL("protection from 11b is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003929 return eSIR_SUCCESS;
3930 }
3931 }
3932 }
3933
3934 if (enable)
3935 {
3936 //If we are AP and HT capable, we need to set the HT OP mode
3937 //appropriately.
Jeff Johnson295189b2012-06-20 16:38:30 -07003938 if(eLIM_AP_ROLE == psessionEntry->limSystemRole)
3939 {
3940 if(overlap)
3941 {
3942 psessionEntry->gLimOlbcParams.protectionEnabled = true;
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003943 PELOGE(limLog(pMac, LOGE, FL("protection from olbc is enabled"));)
Jeff Johnsone7245742012-09-05 17:12:55 -07003944 if(true == psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07003945 {
3946 if((eSIR_HT_OP_MODE_OVERLAP_LEGACY != psessionEntry->htOperMode) &&
3947 (eSIR_HT_OP_MODE_MIXED != psessionEntry->htOperMode))
3948 {
3949 psessionEntry->htOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
3950 }
3951 //CR-263021: OBSS bit is not switching back to 0 after disabling the overlapping legacy BSS
3952 // This fixes issue of OBSS bit not set after 11b, 11g station leaves
3953 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
3954 //Not processing OBSS bit from other APs, as we are already taking care
3955 //of Protection from overlapping BSS based on erp IE or useProtection bit
3956 limEnableHtOBSSProtection(pMac, true, overlap, pBeaconParams, psessionEntry);
3957 }
3958 }
3959 else
3960 {
3961 psessionEntry->gLim11bParams.protectionEnabled = true;
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003962 PELOGE(limLog(pMac, LOGE, FL("protection from 11b is enabled"));)
Jeff Johnsone7245742012-09-05 17:12:55 -07003963 if(true == psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07003964 {
3965 if(eSIR_HT_OP_MODE_MIXED != psessionEntry->htOperMode)
3966 {
3967 psessionEntry->htOperMode = eSIR_HT_OP_MODE_MIXED;
3968 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
3969 limEnableHtOBSSProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
3970 }
3971 }
3972 }
3973 }else if ((eLIM_BT_AMP_AP_ROLE == psessionEntry->limSystemRole) &&
Jeff Johnsone7245742012-09-05 17:12:55 -07003974 (true == psessionEntry->htCapability))
Jeff Johnson295189b2012-06-20 16:38:30 -07003975 {
3976 if(overlap)
3977 {
3978 psessionEntry->gLimOlbcParams.protectionEnabled = true;
3979 if((eSIR_HT_OP_MODE_OVERLAP_LEGACY != pMac->lim.gHTOperMode) &&
3980 (eSIR_HT_OP_MODE_MIXED != pMac->lim.gHTOperMode))
3981 {
3982 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
3983 }
3984 //CR-263021: OBSS bit is not switching back to 0 after disabling the overlapping legacy BSS
3985 // This fixes issue of OBSS bit not set after 11b, 11g station leaves
3986 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
3987 //Not processing OBSS bit from other APs, as we are already taking care
3988 //of Protection from overlapping BSS based on erp IE or useProtection bit
3989 limEnableHtOBSSProtection(pMac, true, overlap, pBeaconParams, psessionEntry);
3990 }
3991 else
3992 {
3993 psessionEntry->gLim11bParams.protectionEnabled = true;
3994 if(eSIR_HT_OP_MODE_MIXED != pMac->lim.gHTOperMode)
3995 {
3996 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_MIXED;
3997 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
3998 limEnableHtOBSSProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
3999 }
4000 }
4001 }
4002
4003 //This part is common for staiton as well.
4004 if(false == psessionEntry->beaconParams.llbCoexist)
4005 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004006 PELOG1(limLog(pMac, LOG1, FL("=> 11G Protection Enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004007 pBeaconParams->llbCoexist = psessionEntry->beaconParams.llbCoexist = true;
4008 pBeaconParams->paramChangeBitmap |= PARAM_llBCOEXIST_CHANGED;
4009 }
4010 }
4011 else if (true == psessionEntry->beaconParams.llbCoexist)
4012 {
4013 //for AP role.
4014 //we need to take care of HT OP mode change if needed.
4015 //We need to take care of Overlap cases.
Jeff Johnson295189b2012-06-20 16:38:30 -07004016 if(eLIM_AP_ROLE == psessionEntry->limSystemRole)
4017 {
4018 if(overlap)
4019 {
4020 //Overlap Legacy protection disabled.
4021 psessionEntry->gLimOlbcParams.protectionEnabled = false;
4022
4023 //We need to take care of HT OP mode if we are HT AP.
Jeff Johnsone7245742012-09-05 17:12:55 -07004024 if(psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07004025 {
4026 // no HT op mode change if any of the overlap protection enabled.
4027 if(!(psessionEntry->gLimOverlap11gParams.protectionEnabled ||
4028 psessionEntry->gLimOverlapHt20Params.protectionEnabled ||
4029 psessionEntry->gLimOverlapNonGfParams.protectionEnabled))
4030 {
4031 //Check if there is a need to change HT OP mode.
Jeff Johnson04dd8a82012-06-29 20:41:40 -07004032 if(eSIR_HT_OP_MODE_OVERLAP_LEGACY == psessionEntry->htOperMode)
Jeff Johnson295189b2012-06-20 16:38:30 -07004033 {
4034 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4035 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4036 if(psessionEntry->gLimHt20Params.protectionEnabled){
4037 //Commenting out beacuse of CR 258588 WFA cert
4038 //psessionEntry->htOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4039 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
4040 }
4041 else
4042 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
4043 }
4044 }
4045 }
4046 }
4047 else
4048 {
4049 //Disable protection from 11B stations.
4050 psessionEntry->gLim11bParams.protectionEnabled = false;
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004051 PELOGE(limLog(pMac, LOGE, FL("===> 11B Protection Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004052 //Check if any other non-HT protection enabled.
4053 if(!psessionEntry->gLim11gParams.protectionEnabled)
4054 {
4055 //Right now we are in HT OP Mixed mode.
4056 //Change HT op mode appropriately.
4057 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4058
4059 //Change HT OP mode to 01 if any overlap protection enabled
4060 if(psessionEntry->gLimOlbcParams.protectionEnabled ||
4061 psessionEntry->gLimOverlap11gParams.protectionEnabled ||
4062 psessionEntry->gLimOverlapHt20Params.protectionEnabled ||
4063 psessionEntry->gLimOverlapNonGfParams.protectionEnabled)
4064 {
4065 psessionEntry->htOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004066 PELOGE(limLog(pMac, LOGE, FL("===> 11G Protection Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004067 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4068 }
4069 else if(psessionEntry->gLimHt20Params.protectionEnabled)
4070 {
4071 //Commenting because of CR 258588 WFA cert
4072 //psessionEntry->htOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4073 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004074 PELOGE(limLog(pMac, LOGE, FL("===> 11G Protection Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004075 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4076 }
4077 else
4078 {
4079 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
4080 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4081 }
4082 }
4083 }
4084 if(!psessionEntry->gLimOlbcParams.protectionEnabled &&
4085 !psessionEntry->gLim11bParams.protectionEnabled)
4086 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004087 PELOGE(limLog(pMac, LOGE, FL("===> 11G Protection Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004088 pBeaconParams->llbCoexist = psessionEntry->beaconParams.llbCoexist = false;
4089 pBeaconParams->paramChangeBitmap |= PARAM_llBCOEXIST_CHANGED;
4090 }
4091 }else if(eLIM_BT_AMP_AP_ROLE == psessionEntry->limSystemRole)
Jeff Johnson295189b2012-06-20 16:38:30 -07004092 {
4093 if(overlap)
4094 {
4095 //Overlap Legacy protection disabled.
4096 psessionEntry->gLimOlbcParams.protectionEnabled = false;
4097
4098 //We need to take care of HT OP mode iff we are HT AP.
Jeff Johnsone7245742012-09-05 17:12:55 -07004099 if(psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07004100 {
4101 // no HT op mode change if any of the overlap protection enabled.
4102 if(!(pMac->lim.gLimOverlap11gParams.protectionEnabled ||
4103 pMac->lim.gLimOverlapHt20Params.protectionEnabled ||
4104 pMac->lim.gLimOverlapNonGfParams.protectionEnabled))
4105
4106 {
4107 //Check if there is a need to change HT OP mode.
4108 if(eSIR_HT_OP_MODE_OVERLAP_LEGACY == pMac->lim.gHTOperMode)
4109 {
4110 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4111 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4112 if(psessionEntry->gLimHt20Params.protectionEnabled)
4113 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4114 else
4115 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_PURE;
4116 }
4117 }
4118 }
4119 }
4120 else
4121 {
4122 //Disable protection from 11B stations.
4123 psessionEntry->gLim11bParams.protectionEnabled = false;
4124 //Check if any other non-HT protection enabled.
4125 if(!psessionEntry->gLim11gParams.protectionEnabled)
4126 {
4127 //Right now we are in HT OP Mixed mode.
4128 //Change HT op mode appropriately.
4129 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4130
4131 //Change HT OP mode to 01 if any overlap protection enabled
4132 if(psessionEntry->gLimOlbcParams.protectionEnabled ||
4133 pMac->lim.gLimOverlap11gParams.protectionEnabled ||
4134 pMac->lim.gLimOverlapHt20Params.protectionEnabled ||
4135 pMac->lim.gLimOverlapNonGfParams.protectionEnabled)
4136
4137 {
4138 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
4139 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4140 }
4141 else if(psessionEntry->gLimHt20Params.protectionEnabled)
4142 {
4143 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4144 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4145 }
4146 else
4147 {
4148 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_PURE;
4149 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4150 }
4151 }
4152 }
4153 if(!psessionEntry->gLimOlbcParams.protectionEnabled &&
4154 !psessionEntry->gLim11bParams.protectionEnabled)
4155 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004156 PELOG1(limLog(pMac, LOG1, FL("===> 11G Protection Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004157 pBeaconParams->llbCoexist = psessionEntry->beaconParams.llbCoexist = false;
4158 pBeaconParams->paramChangeBitmap |= PARAM_llBCOEXIST_CHANGED;
4159 }
4160 }
4161 //for station role
4162 else
4163 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004164 PELOG1(limLog(pMac, LOG1, FL("===> 11G Protection Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004165 pBeaconParams->llbCoexist = psessionEntry->beaconParams.llbCoexist = false;
4166 pBeaconParams->paramChangeBitmap |= PARAM_llBCOEXIST_CHANGED;
4167 }
4168 }
4169 return eSIR_SUCCESS;
4170}
4171
4172/** -------------------------------------------------------------
4173\fn limEnableHtProtectionFrom11g
4174\brief based on cofig enables\disables protection from 11g.
4175\param tANI_U8 enable : 1=> enable protection, 0=> disable protection.
4176\param tANI_U8 overlap: 1=> called from overlap context, 0 => called from assoc context.
4177\param tpUpdateBeaconParams pBeaconParams
4178\return None
4179 -------------------------------------------------------------*/
4180tSirRetStatus
4181limEnableHtProtectionFrom11g(tpAniSirGlobal pMac, tANI_U8 enable,
4182 tANI_U8 overlap, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry)
4183{
Jeff Johnsone7245742012-09-05 17:12:55 -07004184 if(!psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07004185 return eSIR_SUCCESS; // protection from 11g is only for HT stations.
4186
4187 //overlapping protection configuration check.
4188 if(overlap)
4189 {
Jeff Johnson295189b2012-06-20 16:38:30 -07004190 if((psessionEntry->limSystemRole == eLIM_AP_ROLE ) && (!psessionEntry->cfgProtection.overlapFromllg))
4191 {
4192 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004193 PELOG3(limLog(pMac, LOG3, FL("overlap protection from 11g is disabled")););
Jeff Johnson295189b2012-06-20 16:38:30 -07004194 return eSIR_SUCCESS;
4195 }else if ((psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE) && (!pMac->lim.cfgProtection.overlapFromllg))
Jeff Johnson295189b2012-06-20 16:38:30 -07004196 {
4197 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004198 PELOG3(limLog(pMac, LOG3, FL("overlap protection from 11g is disabled")););
Jeff Johnson295189b2012-06-20 16:38:30 -07004199 return eSIR_SUCCESS;
4200 }
4201 }
4202 else
4203 {
4204 //normal protection config check
Jeff Johnson295189b2012-06-20 16:38:30 -07004205 if((psessionEntry->limSystemRole == eLIM_AP_ROLE ) &&
4206 !psessionEntry->cfgProtection.fromllg){
4207 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004208 PELOG3(limLog(pMac, LOG3, FL("protection from 11g is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004209 return eSIR_SUCCESS;
4210 }else if(psessionEntry->limSystemRole != eLIM_AP_ROLE )
Jeff Johnson295189b2012-06-20 16:38:30 -07004211 {
4212 if(!pMac->lim.cfgProtection.fromllg)
4213 {
4214 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004215 PELOG3(limLog(pMac, LOG3, FL("protection from 11g is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004216 return eSIR_SUCCESS;
4217 }
4218 }
4219 }
4220 if (enable)
4221 {
4222 //If we are AP and HT capable, we need to set the HT OP mode
4223 //appropriately.
4224
Jeff Johnson295189b2012-06-20 16:38:30 -07004225 if(eLIM_AP_ROLE == psessionEntry->limSystemRole)
4226 {
4227 if(overlap)
4228 {
4229 psessionEntry->gLimOverlap11gParams.protectionEnabled = true;
4230 //11g exists in overlap BSS.
4231 //need not to change the operating mode to overlap_legacy
4232 //if higher or same protection operating mode is enabled right now.
4233 if((eSIR_HT_OP_MODE_OVERLAP_LEGACY != psessionEntry->htOperMode) &&
4234 (eSIR_HT_OP_MODE_MIXED != psessionEntry->htOperMode))
4235 {
4236 psessionEntry->htOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
4237 }
4238 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4239 limEnableHtOBSSProtection(pMac, true , overlap, pBeaconParams, psessionEntry);
4240 }
4241 else
4242 {
4243 //11g is associated to an AP operating in 11n mode.
4244 //Change the HT operating mode to 'mixed mode'.
4245 psessionEntry->gLim11gParams.protectionEnabled = true;
4246 if(eSIR_HT_OP_MODE_MIXED != psessionEntry->htOperMode)
4247 {
4248 psessionEntry->htOperMode = eSIR_HT_OP_MODE_MIXED;
4249 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4250 limEnableHtOBSSProtection(pMac, true , overlap, pBeaconParams,psessionEntry);
4251 }
4252 }
4253 }else if(eLIM_BT_AMP_AP_ROLE == psessionEntry->limSystemRole)
Jeff Johnson295189b2012-06-20 16:38:30 -07004254 {
4255 if(overlap)
4256 {
4257 pMac->lim.gLimOverlap11gParams.protectionEnabled = true;
4258 //11g exists in overlap BSS.
4259 //need not to change the operating mode to overlap_legacy
4260 //if higher or same protection operating mode is enabled right now.
4261 if((eSIR_HT_OP_MODE_OVERLAP_LEGACY != pMac->lim.gHTOperMode) &&
4262 (eSIR_HT_OP_MODE_MIXED != pMac->lim.gHTOperMode))
4263 {
4264 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
4265 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4266 }
4267 }
4268 else
4269 {
4270 //11g is associated to an AP operating in 11n mode.
4271 //Change the HT operating mode to 'mixed mode'.
4272 psessionEntry->gLim11gParams.protectionEnabled = true;
4273 if(eSIR_HT_OP_MODE_MIXED != pMac->lim.gHTOperMode)
4274 {
4275 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_MIXED;
4276 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4277 limEnableHtOBSSProtection(pMac, true , overlap, pBeaconParams,psessionEntry);
4278 }
4279 }
4280 }
4281
4282 //This part is common for staiton as well.
4283 if(false == psessionEntry->beaconParams.llgCoexist)
4284 {
4285 pBeaconParams->llgCoexist = psessionEntry->beaconParams.llgCoexist = true;
4286 pBeaconParams->paramChangeBitmap |= PARAM_llGCOEXIST_CHANGED;
4287 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004288 else if (true == psessionEntry->gLimOverlap11gParams.protectionEnabled)
4289 {
4290 // As operating mode changed after G station assoc some way to update beacon
4291 // This addresses the issue of mode not changing to - 11 in beacon when OBSS overlap is enabled
4292 //pMac->sch.schObject.fBeaconChanged = 1;
4293 pBeaconParams->paramChangeBitmap |= PARAM_llGCOEXIST_CHANGED;
4294 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004295 }
4296 else if (true == psessionEntry->beaconParams.llgCoexist)
4297 {
4298 //for AP role.
4299 //we need to take care of HT OP mode change if needed.
4300 //We need to take care of Overlap cases.
4301
Jeff Johnson295189b2012-06-20 16:38:30 -07004302 if(eLIM_AP_ROLE == psessionEntry->limSystemRole)
4303 {
4304 if(overlap)
4305 {
4306 //Overlap Legacy protection disabled.
4307 if (psessionEntry->gLim11gParams.numSta == 0)
4308 psessionEntry->gLimOverlap11gParams.protectionEnabled = false;
4309
4310 // no HT op mode change if any of the overlap protection enabled.
4311 if(!(psessionEntry->gLimOlbcParams.protectionEnabled ||
4312 psessionEntry->gLimOverlapHt20Params.protectionEnabled ||
4313 psessionEntry->gLimOverlapNonGfParams.protectionEnabled))
4314 {
4315 //Check if there is a need to change HT OP mode.
4316 if(eSIR_HT_OP_MODE_OVERLAP_LEGACY == psessionEntry->htOperMode)
4317 {
4318 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4319 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4320
4321 if(psessionEntry->gLimHt20Params.protectionEnabled){
4322 //Commenting because of CR 258588 WFA cert
4323 //psessionEntry->htOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4324 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
4325 }
4326 else
4327 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
4328 }
4329 }
4330 }
4331 else
4332 {
4333 //Disable protection from 11G stations.
4334 psessionEntry->gLim11gParams.protectionEnabled = false;
4335 //Check if any other non-HT protection enabled.
4336 if(!psessionEntry->gLim11bParams.protectionEnabled)
4337 {
4338
4339 //Right now we are in HT OP Mixed mode.
4340 //Change HT op mode appropriately.
4341 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4342
4343 //Change HT OP mode to 01 if any overlap protection enabled
4344 if(psessionEntry->gLimOlbcParams.protectionEnabled ||
4345 psessionEntry->gLimOverlap11gParams.protectionEnabled ||
4346 psessionEntry->gLimOverlapHt20Params.protectionEnabled ||
4347 psessionEntry->gLimOverlapNonGfParams.protectionEnabled)
4348
4349 {
4350 psessionEntry->htOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
4351 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4352 }
4353 else if(psessionEntry->gLimHt20Params.protectionEnabled)
4354 {
4355 //Commenting because of CR 258588 WFA cert
4356 //psessionEntry->htOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4357 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
4358 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4359 }
4360 else
4361 {
4362 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
4363 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4364 }
4365 }
4366 }
4367 if(!psessionEntry->gLimOverlap11gParams.protectionEnabled &&
4368 !psessionEntry->gLim11gParams.protectionEnabled)
4369 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004370 PELOG1(limLog(pMac, LOG1, FL("===> Protection from 11G Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004371 pBeaconParams->llgCoexist = psessionEntry->beaconParams.llgCoexist = false;
4372 pBeaconParams->paramChangeBitmap |= PARAM_llGCOEXIST_CHANGED;
4373 }
4374 }else if(eLIM_BT_AMP_AP_ROLE == psessionEntry->limSystemRole)
Jeff Johnson295189b2012-06-20 16:38:30 -07004375 {
4376 if(overlap)
4377 {
4378 //Overlap Legacy protection disabled.
4379 pMac->lim.gLimOverlap11gParams.protectionEnabled = false;
4380
4381 // no HT op mode change if any of the overlap protection enabled.
4382 if(!(psessionEntry->gLimOlbcParams.protectionEnabled ||
4383 psessionEntry->gLimOverlapHt20Params.protectionEnabled ||
4384 psessionEntry->gLimOverlapNonGfParams.protectionEnabled))
4385 {
4386 //Check if there is a need to change HT OP mode.
4387 if(eSIR_HT_OP_MODE_OVERLAP_LEGACY == pMac->lim.gHTOperMode)
4388 {
4389 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4390 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4391
4392 if(psessionEntry->gLimHt20Params.protectionEnabled)
4393 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4394 else
4395 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_PURE;
4396 }
4397 }
4398 }
4399 else
4400 {
4401 //Disable protection from 11G stations.
4402 psessionEntry->gLim11gParams.protectionEnabled = false;
4403 //Check if any other non-HT protection enabled.
4404 if(!psessionEntry->gLim11bParams.protectionEnabled)
4405 {
4406
4407 //Right now we are in HT OP Mixed mode.
4408 //Change HT op mode appropriately.
4409 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4410
4411 //Change HT OP mode to 01 if any overlap protection enabled
4412 if(psessionEntry->gLimOlbcParams.protectionEnabled ||
4413 pMac->lim.gLimOverlap11gParams.protectionEnabled ||
4414 pMac->lim.gLimOverlapHt20Params.protectionEnabled ||
4415 pMac->lim.gLimOverlapNonGfParams.protectionEnabled)
4416
4417 {
4418 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
4419 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4420 }
4421 else if(psessionEntry->gLimHt20Params.protectionEnabled)
4422 {
4423 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4424 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4425 }
4426 else
4427 {
4428 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_PURE;
4429 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4430 }
4431 }
4432 }
4433 if(!pMac->lim.gLimOverlap11gParams.protectionEnabled &&
4434 !psessionEntry->gLim11gParams.protectionEnabled)
4435 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004436 PELOG1(limLog(pMac, LOG1, FL("===> Protection from 11G Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004437 pBeaconParams->llgCoexist = psessionEntry->beaconParams.llgCoexist = false;
4438 pBeaconParams->paramChangeBitmap |= PARAM_llGCOEXIST_CHANGED;
4439 }
4440 }
4441 //for station role
4442 else
4443 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004444 PELOG1(limLog(pMac, LOG1, FL("===> Protection from 11G Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004445 pBeaconParams->llgCoexist = psessionEntry->beaconParams.llgCoexist = false;
4446 pBeaconParams->paramChangeBitmap |= PARAM_llGCOEXIST_CHANGED;
4447 }
4448 }
4449 return eSIR_SUCCESS;
4450}
4451//FIXME_PROTECTION : need to check for no APSD whenever we want to enable this protection.
4452//This check will be done at the caller.
4453
4454/** -------------------------------------------------------------
4455\fn limEnableHtObssProtection
4456\brief based on cofig enables\disables obss protection.
4457\param tANI_U8 enable : 1=> enable protection, 0=> disable protection.
4458\param tANI_U8 overlap: 1=> called from overlap context, 0 => called from assoc context.
4459\param tpUpdateBeaconParams pBeaconParams
4460\return None
4461 -------------------------------------------------------------*/
4462tSirRetStatus
4463limEnableHtOBSSProtection(tpAniSirGlobal pMac, tANI_U8 enable,
4464 tANI_U8 overlap, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry)
4465{
4466
4467
Jeff Johnsone7245742012-09-05 17:12:55 -07004468 if(!psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07004469 return eSIR_SUCCESS; // this protection is only for HT stations.
4470
4471 //overlapping protection configuration check.
4472 if(overlap)
4473 {
4474 //overlapping protection configuration check.
Jeff Johnson295189b2012-06-20 16:38:30 -07004475 }
4476 else
4477 {
4478 //normal protection config check
Jeff Johnson295189b2012-06-20 16:38:30 -07004479 if((psessionEntry->limSystemRole == eLIM_AP_ROLE) && !psessionEntry->cfgProtection.obss)
4480 { //ToDo Update this field
4481 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004482 PELOG1(limLog(pMac, LOG1, FL("protection from Obss is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004483 return eSIR_SUCCESS;
4484 }else if(psessionEntry->limSystemRole != eLIM_AP_ROLE)
Jeff Johnson295189b2012-06-20 16:38:30 -07004485 {
4486 if(!pMac->lim.cfgProtection.obss)
4487 { //ToDo Update this field
4488 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004489 PELOG1(limLog(pMac, LOG1, FL("protection from Obss is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004490 return eSIR_SUCCESS;
4491 }
4492 }
4493 }
4494
4495
Jeff Johnson295189b2012-06-20 16:38:30 -07004496 if (eLIM_AP_ROLE == psessionEntry->limSystemRole){
4497 if ((enable) && (false == psessionEntry->beaconParams.gHTObssMode) )
4498 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004499 PELOG1(limLog(pMac, LOG1, FL("=>obss protection enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004500 psessionEntry->beaconParams.gHTObssMode = true;
4501 pBeaconParams->paramChangeBitmap |= PARAM_OBSS_MODE_CHANGED; // UPDATE AN ENUM FOR OBSS MODE <todo>
4502
4503 }
4504 else if (!enable && (true == psessionEntry->beaconParams.gHTObssMode))
4505 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004506 PELOG1(limLog(pMac, LOG1, FL("===> obss Protection disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004507 psessionEntry->beaconParams.gHTObssMode = false;
4508 pBeaconParams->paramChangeBitmap |= PARAM_OBSS_MODE_CHANGED;
4509
4510 }
4511//CR-263021: OBSS bit is not switching back to 0 after disabling the overlapping legacy BSS
4512 if (!enable && !overlap)
4513 {
4514 psessionEntry->gLimOverlap11gParams.protectionEnabled = false;
4515 }
4516 } else
Jeff Johnson295189b2012-06-20 16:38:30 -07004517 {
4518 if ((enable) && (false == psessionEntry->beaconParams.gHTObssMode) )
4519 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004520 PELOG1(limLog(pMac, LOG1, FL("=>obss protection enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004521 psessionEntry->beaconParams.gHTObssMode = true;
4522 pBeaconParams->paramChangeBitmap |= PARAM_OBSS_MODE_CHANGED; // UPDATE AN ENUM FOR OBSS MODE <todo>
4523
4524 }
4525 else if (!enable && (true == psessionEntry->beaconParams.gHTObssMode))
4526 {
4527
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004528 PELOG1(limLog(pMac, LOG1, FL("===> obss Protection disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004529 psessionEntry->beaconParams.gHTObssMode = false;
4530 pBeaconParams->paramChangeBitmap |= PARAM_OBSS_MODE_CHANGED;
4531
4532 }
4533 }
4534 return eSIR_SUCCESS;
4535}
4536/** -------------------------------------------------------------
4537\fn limEnableHT20Protection
4538\brief based on cofig enables\disables protection from Ht20.
4539\param tANI_U8 enable : 1=> enable protection, 0=> disable protection.
4540\param tANI_U8 overlap: 1=> called from overlap context, 0 => called from assoc context.
4541\param tpUpdateBeaconParams pBeaconParams
4542\return None
4543 -------------------------------------------------------------*/
4544tSirRetStatus
4545limEnableHT20Protection(tpAniSirGlobal pMac, tANI_U8 enable,
4546 tANI_U8 overlap, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry)
4547{
Jeff Johnsone7245742012-09-05 17:12:55 -07004548 if(!psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07004549 return eSIR_SUCCESS; // this protection is only for HT stations.
4550
4551 //overlapping protection configuration check.
4552 if(overlap)
4553 {
Jeff Johnson295189b2012-06-20 16:38:30 -07004554 }
4555 else
4556 {
4557 //normal protection config check
Jeff Johnson295189b2012-06-20 16:38:30 -07004558 if((psessionEntry->limSystemRole == eLIM_AP_ROLE ) &&
4559 !psessionEntry->cfgProtection.ht20)
4560 {
4561 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004562 PELOG3(limLog(pMac, LOG3, FL("protection from HT20 is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004563 return eSIR_SUCCESS;
4564 }else if(psessionEntry->limSystemRole != eLIM_AP_ROLE )
Jeff Johnson295189b2012-06-20 16:38:30 -07004565 {
4566 if(!pMac->lim.cfgProtection.ht20)
4567 {
4568 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004569 PELOG3(limLog(pMac, LOG3, FL("protection from HT20 is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004570 return eSIR_SUCCESS;
4571 }
4572 }
4573 }
4574
4575 if (enable)
4576 {
4577 //If we are AP and HT capable, we need to set the HT OP mode
4578 //appropriately.
4579
Jeff Johnson295189b2012-06-20 16:38:30 -07004580 if(eLIM_AP_ROLE == psessionEntry->limSystemRole){
4581 if(overlap)
4582 {
4583 psessionEntry->gLimOverlapHt20Params.protectionEnabled = true;
4584 if((eSIR_HT_OP_MODE_OVERLAP_LEGACY != psessionEntry->htOperMode) &&
4585 (eSIR_HT_OP_MODE_MIXED != psessionEntry->htOperMode))
4586 {
4587 psessionEntry->htOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
4588 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4589 }
4590 }
4591 else
4592 {
4593 psessionEntry->gLimHt20Params.protectionEnabled = true;
4594 if(eSIR_HT_OP_MODE_PURE == psessionEntry->htOperMode)
4595 {
4596 //Commenting because of CR 258588 WFA cert
4597 //psessionEntry->htOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4598 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
4599 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4600 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4601 }
4602 }
4603 }else if(eLIM_BT_AMP_AP_ROLE == psessionEntry->limSystemRole)
Jeff Johnson295189b2012-06-20 16:38:30 -07004604 {
4605 if(overlap)
4606 {
4607 pMac->lim.gLimOverlapHt20Params.protectionEnabled = true;
4608 if((eSIR_HT_OP_MODE_OVERLAP_LEGACY != pMac->lim.gHTOperMode) &&
4609 (eSIR_HT_OP_MODE_MIXED != pMac->lim.gHTOperMode))
4610 {
4611 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
4612 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4613 }
4614 }
4615 else
4616 {
4617 psessionEntry->gLimHt20Params.protectionEnabled = true;
4618 if(eSIR_HT_OP_MODE_PURE == pMac->lim.gHTOperMode)
4619 {
4620 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4621 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4622 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4623 }
4624 }
4625 }
4626
4627 //This part is common for staiton as well.
4628 if(false == psessionEntry->beaconParams.ht20Coexist)
4629 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004630 PELOG1(limLog(pMac, LOG1, FL("=> Prtection from HT20 Enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004631 pBeaconParams->ht20MhzCoexist = psessionEntry->beaconParams.ht20Coexist = true;
4632 pBeaconParams->paramChangeBitmap |= PARAM_HT20MHZCOEXIST_CHANGED;
4633 }
4634 }
4635 else if (true == psessionEntry->beaconParams.ht20Coexist)
4636 {
4637 //for AP role.
4638 //we need to take care of HT OP mode change if needed.
4639 //We need to take care of Overlap cases.
Jeff Johnson295189b2012-06-20 16:38:30 -07004640 if(eLIM_AP_ROLE == psessionEntry->limSystemRole){
4641 if(overlap)
4642 {
4643 //Overlap Legacy protection disabled.
4644 psessionEntry->gLimOverlapHt20Params.protectionEnabled = false;
4645
4646 // no HT op mode change if any of the overlap protection enabled.
4647 if(!(psessionEntry->gLimOlbcParams.protectionEnabled ||
4648 psessionEntry->gLimOverlap11gParams.protectionEnabled ||
4649 psessionEntry->gLimOverlapHt20Params.protectionEnabled ||
4650 psessionEntry->gLimOverlapNonGfParams.protectionEnabled))
4651 {
4652
4653 //Check if there is a need to change HT OP mode.
4654 if(eSIR_HT_OP_MODE_OVERLAP_LEGACY == psessionEntry->htOperMode)
4655 {
4656 if(psessionEntry->gLimHt20Params.protectionEnabled)
4657 {
4658 //Commented beacuse of CR 258588 for WFA Cert
4659 //psessionEntry->htOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4660 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
4661 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4662 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4663 }
4664 else
4665 {
4666 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
4667 }
4668 }
4669 }
4670 }
4671 else
4672 {
4673 //Disable protection from 11G stations.
4674 psessionEntry->gLimHt20Params.protectionEnabled = false;
4675
4676 //Change HT op mode appropriately.
4677 if(eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT == psessionEntry->htOperMode)
4678 {
4679 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
4680 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4681 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4682 }
4683 }
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004684 PELOG1(limLog(pMac, LOG1, FL("===> Protection from HT 20 Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004685 pBeaconParams->ht20MhzCoexist = psessionEntry->beaconParams.ht20Coexist = false;
4686 pBeaconParams->paramChangeBitmap |= PARAM_HT20MHZCOEXIST_CHANGED;
4687 }else if(eLIM_BT_AMP_AP_ROLE == psessionEntry->limSystemRole)
Jeff Johnson295189b2012-06-20 16:38:30 -07004688 {
4689 if(overlap)
4690 {
4691 //Overlap Legacy protection disabled.
4692 pMac->lim.gLimOverlapHt20Params.protectionEnabled = false;
4693
4694 // no HT op mode change if any of the overlap protection enabled.
4695 if(!(psessionEntry->gLimOlbcParams.protectionEnabled ||
4696 pMac->lim.gLimOverlap11gParams.protectionEnabled ||
4697 pMac->lim.gLimOverlapHt20Params.protectionEnabled ||
4698 pMac->lim.gLimOverlapNonGfParams.protectionEnabled))
4699 {
4700
4701 //Check if there is a need to change HT OP mode.
4702 if(eSIR_HT_OP_MODE_OVERLAP_LEGACY == pMac->lim.gHTOperMode)
4703 {
4704 if(psessionEntry->gLimHt20Params.protectionEnabled)
4705 {
4706 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4707 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4708 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4709 }
4710 else
4711 {
4712 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_PURE;
4713 }
4714 }
4715 }
4716 }
4717 else
4718 {
4719 //Disable protection from 11G stations.
4720 psessionEntry->gLimHt20Params.protectionEnabled = false;
4721
4722 //Change HT op mode appropriately.
4723 if(eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT == pMac->lim.gHTOperMode)
4724 {
4725 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_PURE;
4726 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4727 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4728 }
4729 }
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004730 PELOG1(limLog(pMac, LOG1, FL("===> Protection from HT 20 Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004731 pBeaconParams->ht20MhzCoexist = psessionEntry->beaconParams.ht20Coexist = false;
4732 pBeaconParams->paramChangeBitmap |= PARAM_HT20MHZCOEXIST_CHANGED;
4733 }
4734 //for station role
4735 else
4736 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004737 PELOG1(limLog(pMac, LOG1, FL("===> Protection from HT20 Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004738 pBeaconParams->ht20MhzCoexist = psessionEntry->beaconParams.ht20Coexist = false;
4739 pBeaconParams->paramChangeBitmap |= PARAM_HT20MHZCOEXIST_CHANGED;
4740 }
4741 }
4742
4743 return eSIR_SUCCESS;
4744}
4745
4746/** -------------------------------------------------------------
4747\fn limEnableHTNonGfProtection
4748\brief based on cofig enables\disables protection from NonGf.
4749\param tANI_U8 enable : 1=> enable protection, 0=> disable protection.
4750\param tANI_U8 overlap: 1=> called from overlap context, 0 => called from assoc context.
4751\param tpUpdateBeaconParams pBeaconParams
4752\return None
4753 -------------------------------------------------------------*/
4754tSirRetStatus
4755limEnableHTNonGfProtection(tpAniSirGlobal pMac, tANI_U8 enable,
4756 tANI_U8 overlap, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry)
4757{
Jeff Johnsone7245742012-09-05 17:12:55 -07004758 if(!psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07004759 return eSIR_SUCCESS; // this protection is only for HT stations.
4760
4761 //overlapping protection configuration check.
4762 if(overlap)
4763 {
Jeff Johnson295189b2012-06-20 16:38:30 -07004764 }
4765 else
4766 {
Jeff Johnson295189b2012-06-20 16:38:30 -07004767 //normal protection config check
4768 if((psessionEntry->limSystemRole == eLIM_AP_ROLE ) &&
4769 !psessionEntry->cfgProtection.nonGf)
4770 {
4771 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004772 PELOG3(limLog(pMac, LOG3, FL("protection from NonGf is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004773 return eSIR_SUCCESS;
4774 }else if(psessionEntry->limSystemRole != eLIM_AP_ROLE)
Jeff Johnson295189b2012-06-20 16:38:30 -07004775 {
4776 //normal protection config check
4777 if(!pMac->lim.cfgProtection.nonGf)
4778 {
4779 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004780 PELOG3(limLog(pMac, LOG3, FL("protection from NonGf is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004781 return eSIR_SUCCESS;
4782 }
4783 }
4784 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004785 if(psessionEntry->limSystemRole == eLIM_AP_ROLE){
4786 if ((enable) && (false == psessionEntry->beaconParams.llnNonGFCoexist))
4787 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004788 PELOG1(limLog(pMac, LOG1, FL(" => Prtection from non GF Enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004789 pBeaconParams->llnNonGFCoexist = psessionEntry->beaconParams.llnNonGFCoexist = true;
4790 pBeaconParams->paramChangeBitmap |= PARAM_NON_GF_DEVICES_PRESENT_CHANGED;
4791 }
4792 else if (!enable && (true == psessionEntry->beaconParams.llnNonGFCoexist))
4793 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004794 PELOG1(limLog(pMac, LOG1, FL("===> Protection from Non GF Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004795 pBeaconParams->llnNonGFCoexist = psessionEntry->beaconParams.llnNonGFCoexist = false;
4796 pBeaconParams->paramChangeBitmap |= PARAM_NON_GF_DEVICES_PRESENT_CHANGED;
4797 }
4798 }else
Jeff Johnson295189b2012-06-20 16:38:30 -07004799 {
4800 if ((enable) && (false == psessionEntry->beaconParams.llnNonGFCoexist))
4801 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004802 PELOG1(limLog(pMac, LOG1, FL(" => Prtection from non GF Enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004803 pBeaconParams->llnNonGFCoexist = psessionEntry->beaconParams.llnNonGFCoexist = true;
4804 pBeaconParams->paramChangeBitmap |= PARAM_NON_GF_DEVICES_PRESENT_CHANGED;
4805 }
4806 else if (!enable && (true == psessionEntry->beaconParams.llnNonGFCoexist))
4807 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004808 PELOG1(limLog(pMac, LOG1, FL("===> Protection from Non GF Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004809 pBeaconParams->llnNonGFCoexist = psessionEntry->beaconParams.llnNonGFCoexist = false;
4810 pBeaconParams->paramChangeBitmap |= PARAM_NON_GF_DEVICES_PRESENT_CHANGED;
4811 }
4812 }
4813
4814 return eSIR_SUCCESS;
4815}
4816
4817/** -------------------------------------------------------------
4818\fn limEnableHTLsigTxopProtection
4819\brief based on cofig enables\disables LsigTxop protection.
4820\param tANI_U8 enable : 1=> enable protection, 0=> disable protection.
4821\param tANI_U8 overlap: 1=> called from overlap context, 0 => called from assoc context.
4822\param tpUpdateBeaconParams pBeaconParams
4823\return None
4824 -------------------------------------------------------------*/
4825tSirRetStatus
4826limEnableHTLsigTxopProtection(tpAniSirGlobal pMac, tANI_U8 enable,
4827 tANI_U8 overlap, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry)
4828{
Jeff Johnsone7245742012-09-05 17:12:55 -07004829 if(!psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07004830 return eSIR_SUCCESS; // this protection is only for HT stations.
4831
4832 //overlapping protection configuration check.
4833 if(overlap)
4834 {
Jeff Johnson295189b2012-06-20 16:38:30 -07004835 }
4836 else
4837 {
Jeff Johnson295189b2012-06-20 16:38:30 -07004838 //normal protection config check
4839 if((psessionEntry->limSystemRole == eLIM_AP_ROLE ) &&
4840 !psessionEntry->cfgProtection.lsigTxop)
4841 {
4842 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004843 PELOG3(limLog(pMac, LOG3, FL(" protection from LsigTxop not supported is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004844 return eSIR_SUCCESS;
4845 }else if(psessionEntry->limSystemRole != eLIM_AP_ROLE)
Jeff Johnson295189b2012-06-20 16:38:30 -07004846 {
4847 //normal protection config check
4848 if(!pMac->lim.cfgProtection.lsigTxop)
4849 {
4850 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004851 PELOG3(limLog(pMac, LOG3, FL(" protection from LsigTxop not supported is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004852 return eSIR_SUCCESS;
4853 }
4854 }
4855 }
4856
4857
Jeff Johnson295189b2012-06-20 16:38:30 -07004858 if(psessionEntry->limSystemRole == eLIM_AP_ROLE){
4859 if ((enable) && (false == psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport))
4860 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004861 PELOG1(limLog(pMac, LOG1, FL(" => Prtection from LsigTxop Enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004862 pBeaconParams->fLsigTXOPProtectionFullSupport = psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport = true;
4863 pBeaconParams->paramChangeBitmap |= PARAM_LSIG_TXOP_FULL_SUPPORT_CHANGED;
4864 }
4865 else if (!enable && (true == psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport))
4866 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004867 PELOG1(limLog(pMac, LOG1, FL("===> Protection from LsigTxop Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004868 pBeaconParams->fLsigTXOPProtectionFullSupport= psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport = false;
4869 pBeaconParams->paramChangeBitmap |= PARAM_LSIG_TXOP_FULL_SUPPORT_CHANGED;
4870 }
4871 }else
Jeff Johnson295189b2012-06-20 16:38:30 -07004872 {
4873 if ((enable) && (false == psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport))
4874 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004875 PELOG1(limLog(pMac, LOG1, FL(" => Prtection from LsigTxop Enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004876 pBeaconParams->fLsigTXOPProtectionFullSupport = psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport = true;
4877 pBeaconParams->paramChangeBitmap |= PARAM_LSIG_TXOP_FULL_SUPPORT_CHANGED;
4878 }
4879 else if (!enable && (true == psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport))
4880 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004881 PELOG1(limLog(pMac, LOG1, FL("===> Protection from LsigTxop Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004882 pBeaconParams->fLsigTXOPProtectionFullSupport= psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport = false;
4883 pBeaconParams->paramChangeBitmap |= PARAM_LSIG_TXOP_FULL_SUPPORT_CHANGED;
4884 }
4885 }
4886 return eSIR_SUCCESS;
4887}
4888//FIXME_PROTECTION : need to check for no APSD whenever we want to enable this protection.
4889//This check will be done at the caller.
4890/** -------------------------------------------------------------
4891\fn limEnableHtRifsProtection
4892\brief based on cofig enables\disables Rifs protection.
4893\param tANI_U8 enable : 1=> enable protection, 0=> disable protection.
4894\param tANI_U8 overlap: 1=> called from overlap context, 0 => called from assoc context.
4895\param tpUpdateBeaconParams pBeaconParams
4896\return None
4897 -------------------------------------------------------------*/
4898tSirRetStatus
4899limEnableHtRifsProtection(tpAniSirGlobal pMac, tANI_U8 enable,
4900 tANI_U8 overlap, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry)
4901{
Jeff Johnsone7245742012-09-05 17:12:55 -07004902 if(!psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07004903 return eSIR_SUCCESS; // this protection is only for HT stations.
4904
4905
4906 //overlapping protection configuration check.
4907 if(overlap)
4908 {
Jeff Johnson295189b2012-06-20 16:38:30 -07004909 }
4910 else
4911 {
Jeff Johnson295189b2012-06-20 16:38:30 -07004912 //normal protection config check
4913 if((psessionEntry->limSystemRole == eLIM_AP_ROLE) &&
4914 !psessionEntry->cfgProtection.rifs)
4915 {
4916 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004917 PELOG3(limLog(pMac, LOG3, FL(" protection from Rifs is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004918 return eSIR_SUCCESS;
4919 }else if(psessionEntry->limSystemRole != eLIM_AP_ROLE )
Jeff Johnson295189b2012-06-20 16:38:30 -07004920 {
4921 //normal protection config check
4922 if(!pMac->lim.cfgProtection.rifs)
4923 {
4924 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004925 PELOG3(limLog(pMac, LOG3, FL(" protection from Rifs is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004926 return eSIR_SUCCESS;
4927 }
4928 }
4929 }
4930
Jeff Johnson295189b2012-06-20 16:38:30 -07004931 if(psessionEntry->limSystemRole == eLIM_AP_ROLE){
4932 // Disabling the RIFS Protection means Enable the RIFS mode of operation in the BSS
4933 if ((!enable) && (false == psessionEntry->beaconParams.fRIFSMode))
4934 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004935 PELOG1(limLog(pMac, LOG1, FL(" => Rifs protection Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004936 pBeaconParams->fRIFSMode = psessionEntry->beaconParams.fRIFSMode = true;
4937 pBeaconParams->paramChangeBitmap |= PARAM_RIFS_MODE_CHANGED;
4938 }
4939 // Enabling the RIFS Protection means Disable the RIFS mode of operation in the BSS
4940 else if (enable && (true == psessionEntry->beaconParams.fRIFSMode))
4941 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004942 PELOG1(limLog(pMac, LOG1, FL("===> Rifs Protection Enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004943 pBeaconParams->fRIFSMode = psessionEntry->beaconParams.fRIFSMode = false;
4944 pBeaconParams->paramChangeBitmap |= PARAM_RIFS_MODE_CHANGED;
4945 }
4946 }else
Jeff Johnson295189b2012-06-20 16:38:30 -07004947 {
4948 // Disabling the RIFS Protection means Enable the RIFS mode of operation in the BSS
4949 if ((!enable) && (false == psessionEntry->beaconParams.fRIFSMode))
4950 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004951 PELOG1(limLog(pMac, LOG1, FL(" => Rifs protection Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004952 pBeaconParams->fRIFSMode = psessionEntry->beaconParams.fRIFSMode = true;
4953 pBeaconParams->paramChangeBitmap |= PARAM_RIFS_MODE_CHANGED;
4954 }
4955 // Enabling the RIFS Protection means Disable the RIFS mode of operation in the BSS
4956 else if (enable && (true == psessionEntry->beaconParams.fRIFSMode))
4957 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004958 PELOG1(limLog(pMac, LOG1, FL("===> Rifs Protection Enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004959 pBeaconParams->fRIFSMode = psessionEntry->beaconParams.fRIFSMode = false;
4960 pBeaconParams->paramChangeBitmap |= PARAM_RIFS_MODE_CHANGED;
4961 }
4962 }
4963 return eSIR_SUCCESS;
4964}
4965
4966// ---------------------------------------------------------------------
4967/**
4968 * limEnableShortPreamble
4969 *
4970 * FUNCTION:
4971 * Enable/Disable short preamble
4972 *
4973 * LOGIC:
4974 *
4975 * ASSUMPTIONS:
4976 *
4977 * NOTE:
4978 *
4979 * @param enable Flag to enable/disable short preamble
4980 * @return None
4981 */
4982
4983tSirRetStatus
4984limEnableShortPreamble(tpAniSirGlobal pMac, tANI_U8 enable, tpUpdateBeaconParams pBeaconParams, tpPESession psessionEntry)
4985{
4986 tANI_U32 val;
4987
4988 if (wlan_cfgGetInt(pMac, WNI_CFG_SHORT_PREAMBLE, &val) != eSIR_SUCCESS)
4989 {
4990 /* Could not get short preamble enabled flag from CFG. Log error. */
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004991 limLog(pMac, LOGP, FL("could not retrieve short preamble flag"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004992 return eSIR_FAILURE;
4993 }
4994
4995 if (!val)
4996 return eSIR_SUCCESS;
4997
4998 if (wlan_cfgGetInt(pMac, WNI_CFG_11G_SHORT_PREAMBLE_ENABLED, &val) != eSIR_SUCCESS)
4999 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005000 limLog(pMac, LOGP, FL("could not retrieve 11G short preamble switching enabled flag"));
Jeff Johnson295189b2012-06-20 16:38:30 -07005001 return eSIR_FAILURE;
5002 }
5003
5004 if (!val) // 11G short preamble switching is disabled.
5005 return eSIR_SUCCESS;
5006
5007 if ( psessionEntry->limSystemRole == eLIM_AP_ROLE )
5008 {
5009 if (enable && (psessionEntry->beaconParams.fShortPreamble == 0))
5010 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005011 PELOG1(limLog(pMac, LOG1, FL("===> Short Preamble Enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005012 psessionEntry->beaconParams.fShortPreamble = true;
5013 pBeaconParams->fShortPreamble = (tANI_U8) psessionEntry->beaconParams.fShortPreamble;
5014 pBeaconParams->paramChangeBitmap |= PARAM_SHORT_PREAMBLE_CHANGED;
5015 }
5016 else if (!enable && (psessionEntry->beaconParams.fShortPreamble == 1))
5017 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005018 PELOG1(limLog(pMac, LOG1, FL("===> Short Preamble Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005019 psessionEntry->beaconParams.fShortPreamble = false;
5020 pBeaconParams->fShortPreamble = (tANI_U8) psessionEntry->beaconParams.fShortPreamble;
5021 pBeaconParams->paramChangeBitmap |= PARAM_SHORT_PREAMBLE_CHANGED;
5022 }
5023 }
5024
5025 return eSIR_SUCCESS;
5026 }
5027
5028/**
5029 * limTxComplete
5030 *
5031 * Function:
5032 * This is LIM's very own "TX MGMT frame complete" completion routine.
5033 *
5034 * Logic:
5035 * LIM wants to send a MGMT frame (broadcast or unicast)
5036 * LIM allocates memory using palPktAlloc( ..., **pData, **pPacket )
5037 * LIM transmits the MGMT frame using the API:
5038 * halTxFrame( ... pPacket, ..., (void *) limTxComplete, pData )
5039 * HDD, via halTxFrame/DXE, "transfers" the packet over to BMU
5040 * HDD, if it determines that a TX completion routine (in this case
5041 * limTxComplete) has been provided, will invoke this callback
5042 * LIM will try to free the TX MGMT packet that was earlier allocated, in order
5043 * to send this MGMT frame, using the PAL API palPktFree( ... pData, pPacket )
5044 *
5045 * Assumptions:
5046 * Presently, this is ONLY being used for MGMT frames/packets
5047 * TODO:
5048 * Would it do good for LIM to have some sort of "signature" validation to
5049 * ensure that the pData argument passed in was a buffer that was actually
5050 * allocated by LIM and/or is not corrupted?
5051 *
5052 * Note: FIXME and TODO
5053 * Looks like palPktFree() is interested in pPacket. But, when this completion
5054 * routine is called, only pData is made available to LIM!!
5055 *
5056 * @param void A pointer to pData. Shouldn't it be pPacket?!
5057 *
5058 * @return none
5059 */
5060void limTxComplete( tHalHandle hHal, void *pData )
5061{
5062 tpAniSirGlobal pMac;
5063 pMac = (tpAniSirGlobal)hHal;
5064
5065#ifdef FIXME_PRIMA
5066 /* the trace logic needs to be fixed for Prima. Refer to CR 306075 */
5067#ifdef TRACE_RECORD
5068 {
5069 tpSirMacMgmtHdr mHdr;
5070 v_U8_t *pRxBd;
5071 vos_pkt_t *pVosPkt;
5072 VOS_STATUS vosStatus;
5073
5074
5075
5076 pVosPkt = (vos_pkt_t *)pData;
5077 vosStatus = vos_pkt_peek_data( pVosPkt, 0, (v_PVOID_t *)&pRxBd, WLANHAL_RX_BD_HEADER_SIZE);
5078
5079 if(VOS_IS_STATUS_SUCCESS(vosStatus))
5080 {
5081 mHdr = WDA_GET_RX_MAC_HEADER(pRxBd);
Jeff Johnsone7245742012-09-05 17:12:55 -07005082 MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE, NO_SESSION, mHdr->fc.subType);)
Jeff Johnson295189b2012-06-20 16:38:30 -07005083
5084 }
5085 }
5086#endif
5087#endif
5088
5089 palPktFree( pMac->hHdd,
5090 HAL_TXRX_FRM_802_11_MGMT,
5091 (void *) NULL, // this is ignored and will likely be removed from this API
5092 (void *) pData ); // lim passed in pPacket in the pData pointer that is given in this completion routine
5093}
5094
5095/**
5096 * \brief This function updates lim global structure, if CB parameters in the BSS
5097 * have changed, and sends an indication to HAL also with the
5098 * updated HT Parameters.
5099 * This function does not detect the change in the primary channel, that is done as part
5100 * of channel Swtich IE processing.
5101 * If STA is configured with '20Mhz only' mode, then this function does not do anything
5102 * This function changes the CB mode, only if the self capability is set to '20 as well as 40Mhz'
5103 *
5104 *
5105 * \param pMac Pointer to global MAC structure
5106 *
5107 * \param pRcvdHTInfo Pointer to HT Info IE obtained from a Beacon or
5108 * Probe Response
5109 *
5110 * \param bssIdx BSS Index of the Bss to which Station is associated.
5111 *
5112 *
5113 */
5114
5115void limUpdateStaRunTimeHTSwitchChnlParams( tpAniSirGlobal pMac,
5116 tDot11fIEHTInfo *pHTInfo,
5117 tANI_U8 bssIdx,
5118 tpPESession psessionEntry)
5119{
Jeff Johnsone7245742012-09-05 17:12:55 -07005120 ePhyChanBondState secondaryChnlOffset = PHY_SINGLE_CHANNEL_CENTERED;
Jeff Johnson295189b2012-06-20 16:38:30 -07005121#if !defined WLAN_FEATURE_VOWIFI
5122 tANI_U32 localPwrConstraint;
5123#endif
5124
5125 //If self capability is set to '20Mhz only', then do not change the CB mode.
Jeff Johnson295189b2012-06-20 16:38:30 -07005126 if( !limGetHTCapability( pMac, eHT_SUPPORTED_CHANNEL_WIDTH_SET, psessionEntry ))
Jeff Johnson295189b2012-06-20 16:38:30 -07005127 return;
5128
5129#if !defined WLAN_FEATURE_VOWIFI
5130 if(wlan_cfgGetInt(pMac, WNI_CFG_LOCAL_POWER_CONSTRAINT, &localPwrConstraint) != eSIR_SUCCESS) {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005131 limLog( pMac, LOGP, FL( "Unable to get Local Power Constraint from cfg" ));
Jeff Johnson295189b2012-06-20 16:38:30 -07005132 return;
5133 }
5134#endif
5135
Jeff Johnsone7245742012-09-05 17:12:55 -07005136 if ( psessionEntry->htSecondaryChannelOffset != ( tANI_U8 ) pHTInfo->secondaryChannelOffset ||
5137 psessionEntry->htRecommendedTxWidthSet != ( tANI_U8 ) pHTInfo->recommendedTxWidthSet )
Jeff Johnson295189b2012-06-20 16:38:30 -07005138 {
Jeff Johnsone7245742012-09-05 17:12:55 -07005139 psessionEntry->htSecondaryChannelOffset = ( ePhyChanBondState ) pHTInfo->secondaryChannelOffset;
5140 psessionEntry->htRecommendedTxWidthSet = ( tANI_U8 ) pHTInfo->recommendedTxWidthSet;
5141 if ( eHT_CHANNEL_WIDTH_40MHZ == psessionEntry->htRecommendedTxWidthSet )
5142 secondaryChnlOffset = (ePhyChanBondState)pHTInfo->secondaryChannelOffset;
Jeff Johnson295189b2012-06-20 16:38:30 -07005143
5144 // Notify HAL
5145 limLog( pMac, LOGW, FL( "Channel Information in HT IE change"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005146 "d; sending notification to HAL." ) );
Jeff Johnson295189b2012-06-20 16:38:30 -07005147 limLog( pMac, LOGW, FL( "Primary Channel: %d, Secondary Chan"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005148 "nel Offset: %d, Channel Width: %d" ),
Jeff Johnson295189b2012-06-20 16:38:30 -07005149 pHTInfo->primaryChannel, secondaryChnlOffset,
Jeff Johnsone7245742012-09-05 17:12:55 -07005150 psessionEntry->htRecommendedTxWidthSet );
Madan Mohan Koyyalamudifd322a02012-10-05 12:01:26 -07005151 psessionEntry->channelChangeReasonCode=LIM_SWITCH_CHANNEL_OPERATION;
5152 pMac->lim.gpchangeChannelCallback = NULL;
5153 pMac->lim.gpchangeChannelData = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07005154
5155#if defined WLAN_FEATURE_VOWIFI
5156 limSendSwitchChnlParams( pMac, ( tANI_U8 ) pHTInfo->primaryChannel,
5157 secondaryChnlOffset, psessionEntry->maxTxPower, psessionEntry->peSessionId);
5158#else
5159 limSendSwitchChnlParams( pMac, ( tANI_U8 ) pHTInfo->primaryChannel,
5160 secondaryChnlOffset, (tPowerdBm)localPwrConstraint, psessionEntry->peSessionId);
5161#endif
5162
5163 //In case of IBSS, if STA should update HT Info IE in its beacons.
5164 if (eLIM_STA_IN_IBSS_ROLE == psessionEntry->limSystemRole)
5165 {
5166 schSetFixedBeaconFields(pMac,psessionEntry);
5167 }
5168
5169 }
5170} // End limUpdateStaRunTimeHTParams.
5171
5172/**
5173 * \brief This function updates the lim global structure, if any of the
5174 * HT Capabilities have changed.
5175 *
5176 *
5177 * \param pMac Pointer to Global MAC structure
5178 *
5179 * \param pHTCapability Pointer to HT Capability Information Element
5180 * obtained from a Beacon or Probe Response
5181 *
5182 *
5183 *
5184 */
5185
5186void limUpdateStaRunTimeHTCapability( tpAniSirGlobal pMac,
5187 tDot11fIEHTCaps *pHTCaps )
5188{
5189
5190 if ( pMac->lim.gHTLsigTXOPProtection != ( tANI_U8 ) pHTCaps->lsigTXOPProtection )
5191 {
5192 pMac->lim.gHTLsigTXOPProtection = ( tANI_U8 ) pHTCaps->lsigTXOPProtection;
5193 // Send change notification to HAL
5194 }
5195
5196 if ( pMac->lim.gHTAMpduDensity != ( tANI_U8 ) pHTCaps->mpduDensity )
5197 {
5198 pMac->lim.gHTAMpduDensity = ( tANI_U8 ) pHTCaps->mpduDensity;
5199 // Send change notification to HAL
5200 }
5201
5202 if ( pMac->lim.gHTMaxRxAMpduFactor != ( tANI_U8 ) pHTCaps->maxRxAMPDUFactor )
5203 {
5204 pMac->lim.gHTMaxRxAMpduFactor = ( tANI_U8 ) pHTCaps->maxRxAMPDUFactor;
5205 // Send change notification to HAL
5206 }
5207
5208
5209} // End limUpdateStaRunTimeHTCapability.
5210
5211/**
5212 * \brief This function updates lim global structure, if any of the HT
5213 * Info Parameters have changed.
5214 *
5215 *
5216 * \param pMac Pointer to the global MAC structure
5217 *
5218 * \param pHTInfo Pointer to the HT Info IE obtained from a Beacon or
5219 * Probe Response
5220 *
5221 *
5222 */
5223
5224void limUpdateStaRunTimeHTInfo( tpAniSirGlobal pMac,
5225 tDot11fIEHTInfo *pHTInfo , tpPESession psessionEntry)
5226{
Jeff Johnsone7245742012-09-05 17:12:55 -07005227 if ( psessionEntry->htRecommendedTxWidthSet != ( tANI_U8 )pHTInfo->recommendedTxWidthSet )
Jeff Johnson295189b2012-06-20 16:38:30 -07005228 {
Jeff Johnsone7245742012-09-05 17:12:55 -07005229 psessionEntry->htRecommendedTxWidthSet = ( tANI_U8 )pHTInfo->recommendedTxWidthSet;
Jeff Johnson295189b2012-06-20 16:38:30 -07005230 // Send change notification to HAL
5231 }
5232
5233 if ( psessionEntry->beaconParams.fRIFSMode != ( tANI_U8 )pHTInfo->rifsMode )
5234 {
5235 psessionEntry->beaconParams.fRIFSMode = ( tANI_U8 )pHTInfo->rifsMode;
5236 // Send change notification to HAL
5237 }
5238
5239 if ( pMac->lim.gHTServiceIntervalGranularity != ( tANI_U8 )pHTInfo->serviceIntervalGranularity )
5240 {
5241 pMac->lim.gHTServiceIntervalGranularity = ( tANI_U8 )pHTInfo->serviceIntervalGranularity;
5242 // Send change notification to HAL
5243 }
5244
5245 if ( pMac->lim.gHTOperMode != ( tSirMacHTOperatingMode )pHTInfo->opMode )
5246 {
5247 pMac->lim.gHTOperMode = ( tSirMacHTOperatingMode )pHTInfo->opMode;
5248 // Send change notification to HAL
5249 }
5250
5251 if ( psessionEntry->beaconParams.llnNonGFCoexist != pHTInfo->nonGFDevicesPresent )
5252 {
5253 psessionEntry->beaconParams.llnNonGFCoexist = ( tANI_U8 )pHTInfo->nonGFDevicesPresent;
5254 }
5255
5256 if ( pMac->lim.gHTSTBCBasicMCS != ( tANI_U8 )pHTInfo->basicSTBCMCS )
5257 {
5258 pMac->lim.gHTSTBCBasicMCS = ( tANI_U8 )pHTInfo->basicSTBCMCS;
5259 // Send change notification to HAL
5260 }
5261
5262 if ( pMac->lim.gHTDualCTSProtection != ( tANI_U8 )pHTInfo->dualCTSProtection )
5263 {
5264 pMac->lim.gHTDualCTSProtection = ( tANI_U8 )pHTInfo->dualCTSProtection;
5265 // Send change notification to HAL
5266 }
5267
5268 if ( pMac->lim.gHTSecondaryBeacon != ( tANI_U8 )pHTInfo->secondaryBeacon )
5269 {
5270 pMac->lim.gHTSecondaryBeacon = ( tANI_U8 )pHTInfo->secondaryBeacon;
5271 // Send change notification to HAL
5272 }
5273
5274 if ( psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport != ( tANI_U8 )pHTInfo->lsigTXOPProtectionFullSupport )
5275 {
5276 psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport = ( tANI_U8 )pHTInfo->lsigTXOPProtectionFullSupport;
5277 // Send change notification to HAL
5278 }
5279
5280 if ( pMac->lim.gHTPCOActive != ( tANI_U8 )pHTInfo->pcoActive )
5281 {
5282 pMac->lim.gHTPCOActive = ( tANI_U8 )pHTInfo->pcoActive;
5283 // Send change notification to HAL
5284 }
5285
5286 if ( pMac->lim.gHTPCOPhase != ( tANI_U8 )pHTInfo->pcoPhase )
5287 {
5288 pMac->lim.gHTPCOPhase = ( tANI_U8 )pHTInfo->pcoPhase;
5289 // Send change notification to HAL
5290 }
5291
5292} // End limUpdateStaRunTimeHTInfo.
5293
5294
5295/** -------------------------------------------------------------
5296\fn limProcessHalIndMessages
5297\brief callback function for HAL indication
5298\param tpAniSirGlobal pMac
5299\param tANI_U32 mesgId
5300\param void *mesgParam
5301\return tSirRetStatu - status
5302 -------------------------------------------------------------*/
5303
5304tSirRetStatus limProcessHalIndMessages(tpAniSirGlobal pMac, tANI_U32 msgId, void *msgParam )
5305{
5306 //its PE's responsibility to free msgparam when its done extracting the message parameters.
5307 tSirMsgQ msg;
5308
5309 switch(msgId)
5310 {
5311 case SIR_LIM_DEL_TS_IND:
5312 case SIR_LIM_ADD_BA_IND:
5313 case SIR_LIM_DEL_BA_ALL_IND:
5314 case SIR_LIM_DELETE_STA_CONTEXT_IND:
5315 case SIR_LIM_BEACON_GEN_IND:
5316 msg.type = (tANI_U16) msgId;
5317 msg.bodyptr = msgParam;
5318 msg.bodyval = 0;
5319 break;
5320
5321 default:
5322 palFreeMemory(pMac->hHdd, msgParam);
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005323 limLog(pMac, LOGP, FL("invalid message id = %d received"), msgId);
Jeff Johnson295189b2012-06-20 16:38:30 -07005324 return eSIR_FAILURE;
5325 }
5326
5327 if (limPostMsgApi(pMac, &msg) != eSIR_SUCCESS)
5328 {
5329 palFreeMemory(pMac->hHdd, msgParam);
5330 limLog(pMac, LOGP, FL("limPostMsgApi failed for msgid = %d"), msg.type);
5331 return eSIR_FAILURE;
5332 }
5333 return eSIR_SUCCESS;
5334}
5335
5336/** -------------------------------------------------------------
5337\fn limValidateDeltsReq
5338\brief Validates DelTs req originated by SME or by HAL and also sends halMsg_DelTs to HAL
5339\param tpAniSirGlobal pMac
5340\param tpSirDeltsReq pDeltsReq
5341\param tSirMacAddr peerMacAddr
5342\return eSirRetStatus - status
5343 -------------------------------------------------------------*/
5344
5345tSirRetStatus
5346limValidateDeltsReq(tpAniSirGlobal pMac, tpSirDeltsReq pDeltsReq, tSirMacAddr peerMacAddr,tpPESession psessionEntry)
5347{
5348 tpDphHashNode pSta;
5349 tANI_U8 tsStatus;
5350 tSirMacTSInfo *tsinfo;
5351 tANI_U32 i;
5352 tANI_U8 tspecIdx;
5353 /* if sta
5354 * - verify assoc state
5355 * - del tspec locally
5356 * if ap,
5357 * - verify sta is in assoc state
5358 * - del sta tspec locally
5359 */
5360 if(pDeltsReq == NULL)
5361 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005362 PELOGE(limLog(pMac, LOGE, FL("Delete TS request pointer is NULL"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005363 return eSIR_FAILURE;
5364 }
5365
5366 if ((psessionEntry->limSystemRole == eLIM_STA_ROLE)||(psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE))
5367 {
5368 tANI_U32 val;
5369
5370 // station always talks to the AP
5371 pSta = dphGetHashEntry(pMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable);
5372
5373 val = sizeof(tSirMacAddr);
5374 #if 0
5375 if (wlan_cfgGetStr(pMac, WNI_CFG_BSSID, peerMacAddr, &val) != eSIR_SUCCESS)
5376 {
5377 /// Could not get BSSID from CFG. Log error.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005378 limLog(pMac, LOGP, FL("could not retrieve BSSID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07005379 return eSIR_FAILURE;
5380 }
5381 #endif// TO SUPPORT BT-AMP
5382 sirCopyMacAddr(peerMacAddr,psessionEntry->bssId);
5383
5384 }
5385 else
5386 {
5387 tANI_U16 assocId;
5388 tANI_U8 *macaddr = (tANI_U8 *) peerMacAddr;
5389
5390 assocId = pDeltsReq->aid;
5391 if (assocId != 0)
5392 pSta = dphGetHashEntry(pMac, assocId, &psessionEntry->dph.dphHashTable);
5393 else
5394 pSta = dphLookupHashEntry(pMac, pDeltsReq->macAddr, &assocId, &psessionEntry->dph.dphHashTable);
5395
5396 if (pSta != NULL)
5397 // TBD: check sta assoc state as well
5398 for (i =0; i < sizeof(tSirMacAddr); i++)
5399 macaddr[i] = pSta->staAddr[i];
5400 }
5401
5402 if (pSta == NULL)
5403 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005404 PELOGE(limLog(pMac, LOGE, "Cannot find station context for delts req");)
Jeff Johnson295189b2012-06-20 16:38:30 -07005405 return eSIR_FAILURE;
5406 }
5407
5408 if ((! pSta->valid) ||
5409 (pSta->mlmStaContext.mlmState != eLIM_MLM_LINK_ESTABLISHED_STATE))
5410 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005411 PELOGE(limLog(pMac, LOGE, "Invalid Sta (or state) for DelTsReq");)
Jeff Johnson295189b2012-06-20 16:38:30 -07005412 return eSIR_FAILURE;
5413 }
5414
5415 pDeltsReq->req.wsmTspecPresent = 0;
5416 pDeltsReq->req.wmeTspecPresent = 0;
5417 pDeltsReq->req.lleTspecPresent = 0;
5418
5419 if ((pSta->wsmEnabled) &&
5420 (pDeltsReq->req.tspec.tsinfo.traffic.accessPolicy != SIR_MAC_ACCESSPOLICY_EDCA))
5421 pDeltsReq->req.wsmTspecPresent = 1;
5422 else if (pSta->wmeEnabled)
5423 pDeltsReq->req.wmeTspecPresent = 1;
5424 else if (pSta->lleEnabled)
5425 pDeltsReq->req.lleTspecPresent = 1;
5426 else
5427 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005428 PELOGW(limLog(pMac, LOGW, FL("DELTS_REQ ignore - qos is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005429 return eSIR_FAILURE;
5430 }
5431
5432 tsinfo = pDeltsReq->req.wmeTspecPresent ? &pDeltsReq->req.tspec.tsinfo
5433 : &pDeltsReq->req.tsinfo;
5434 PELOG1(limLog(pMac, LOG1,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005435 FL("received DELTS_REQ message (wmeTspecPresent = %d, lleTspecPresent = %d, wsmTspecPresent = %d, tsid %d, up %d, direction = %d)"),
Jeff Johnson295189b2012-06-20 16:38:30 -07005436 pDeltsReq->req.wmeTspecPresent, pDeltsReq->req.lleTspecPresent, pDeltsReq->req.wsmTspecPresent,
5437 tsinfo->traffic.tsid, tsinfo->traffic.userPrio, tsinfo->traffic.direction);)
5438
5439 // if no Access Control, ignore the request
Jeff Johnson295189b2012-06-20 16:38:30 -07005440
5441 if (limAdmitControlDeleteTS(pMac, pSta->assocId, tsinfo, &tsStatus, &tspecIdx)
5442 != eSIR_SUCCESS)
5443 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005444 PELOGE(limLog(pMac, LOGE, "ERROR DELTS request for sta assocId %d (tsid %d, up %d)",
Jeff Johnson295189b2012-06-20 16:38:30 -07005445 pSta->assocId, tsinfo->traffic.tsid, tsinfo->traffic.userPrio);)
5446 return eSIR_FAILURE;
5447 }
5448 else if ((tsinfo->traffic.accessPolicy == SIR_MAC_ACCESSPOLICY_HCCA) ||
5449 (tsinfo->traffic.accessPolicy == SIR_MAC_ACCESSPOLICY_BOTH))
5450 {
5451 //edca only now.
5452 }
5453 else
5454 {
5455 if((tsinfo->traffic.accessPolicy == SIR_MAC_ACCESSPOLICY_EDCA) &&
5456 psessionEntry->gLimEdcaParams[upToAc(tsinfo->traffic.userPrio)].aci.acm)
5457 {
5458 //send message to HAL to delete TS
Jeff Johnsone7245742012-09-05 17:12:55 -07005459 if(eSIR_SUCCESS != limSendHalMsgDelTs(pMac, pSta->staIndex, tspecIdx, pDeltsReq->req, psessionEntry->peSessionId))
Jeff Johnson295189b2012-06-20 16:38:30 -07005460 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005461 limLog(pMac, LOGW, FL("DelTs with UP %d failed in limSendHalMsgDelTs - ignoring request"),
Jeff Johnson295189b2012-06-20 16:38:30 -07005462 tsinfo->traffic.userPrio);
5463 return eSIR_FAILURE;
5464 }
5465 }
5466 }
5467 return eSIR_SUCCESS;
5468}
5469
5470/** -------------------------------------------------------------
5471\fn limRegisterHalIndCallBack
5472\brief registers callback function to HAL for any indication.
5473\param tpAniSirGlobal pMac
5474\return none.
5475 -------------------------------------------------------------*/
5476void
5477limRegisterHalIndCallBack(tpAniSirGlobal pMac)
5478{
5479 tSirMsgQ msg;
5480 tpHalIndCB pHalCB;
5481
5482 if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&pHalCB, sizeof(tHalIndCB)))
5483 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005484 limLog(pMac, LOGP, FL("palAllocateMemory() failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07005485 return;
5486 }
5487
5488 pHalCB->pHalIndCB = limProcessHalIndMessages;
5489
5490 msg.type = WDA_REGISTER_PE_CALLBACK;
5491 msg.bodyptr = pHalCB;
5492 msg.bodyval = 0;
5493
Jeff Johnsone7245742012-09-05 17:12:55 -07005494 MTRACE(macTraceMsgTx(pMac, NO_SESSION, msg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07005495 if(eSIR_SUCCESS != wdaPostCtrlMsg(pMac, &msg))
5496 {
5497 palFreeMemory(pMac->hHdd, pHalCB);
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005498 limLog(pMac, LOGP, FL("wdaPostCtrlMsg() failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07005499 }
5500
5501 return;
5502}
5503
5504
5505/** -------------------------------------------------------------
5506\fn limProcessAddBaInd
5507
5508\brief handles the BA activity check timeout indication coming from HAL.
5509 Validates the request, posts request for sending addBaReq message for every candidate in the list.
5510\param tpAniSirGlobal pMac
5511\param tSirMsgQ limMsg
5512\return None
5513-------------------------------------------------------------*/
5514void
5515limProcessAddBaInd(tpAniSirGlobal pMac, tpSirMsgQ limMsg)
5516{
5517 tANI_U8 i;
5518 tANI_U8 tid;
5519 tANI_U16 assocId;
5520 tpDphHashNode pSta;
5521 tpAddBaCandidate pBaCandidate;
5522 tANI_U32 baCandidateCnt;
5523 tpBaActivityInd pBaActivityInd;
5524 tpPESession psessionEntry;
5525 tANI_U8 sessionId;
Gopichand Nakkala681989c2013-03-06 22:27:48 -08005526#ifdef FEATURE_WLAN_TDLS
5527 boolean htCapable = FALSE;
5528#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07005529
5530
Gopichand Nakkala681989c2013-03-06 22:27:48 -08005531 if (limMsg->bodyptr == NULL)
Jeff Johnson295189b2012-06-20 16:38:30 -07005532 return;
5533
5534 pBaActivityInd = (tpBaActivityInd)limMsg->bodyptr;
5535 baCandidateCnt = pBaActivityInd->baCandidateCnt;
5536
Gopichand Nakkala681989c2013-03-06 22:27:48 -08005537 if ((psessionEntry = peFindSessionByBssid(pMac,pBaActivityInd->bssId,&sessionId))== NULL)
Jeff Johnson295189b2012-06-20 16:38:30 -07005538 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005539 limLog(pMac, LOGE,FL("session does not exist for given BSSId"));
Jeff Johnson295189b2012-06-20 16:38:30 -07005540 palFreeMemory(pMac->hHdd, limMsg->bodyptr);
5541 return;
5542 }
5543
5544 //if we are not HT capable we don't need to handle BA timeout indication from HAL.
Gopichand Nakkala681989c2013-03-06 22:27:48 -08005545#ifdef FEATURE_WLAN_TDLS
5546 if ((baCandidateCnt > pMac->lim.maxStation))
5547#else
5548 if ((baCandidateCnt > pMac->lim.maxStation) || !psessionEntry->htCapability )
5549#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07005550 {
5551 palFreeMemory(pMac->hHdd, limMsg->bodyptr);
5552 return;
5553 }
Gopichand Nakkala681989c2013-03-06 22:27:48 -08005554
5555#ifdef FEATURE_WLAN_TDLS
5556 //if we have TDLS peers, we should look at peers HT capability, which can be different than
5557 //AP capability
5558 pBaCandidate = (tpAddBaCandidate) (((tANI_U8*)pBaActivityInd) + sizeof(tBaActivityInd));
5559
5560 for (i=0; i<baCandidateCnt; i++, pBaCandidate++)
5561 {
5562 pSta = dphLookupHashEntry(pMac, pBaCandidate->staAddr, &assocId, &psessionEntry->dph.dphHashTable);
5563 if ((NULL == pSta) || (!pSta->valid))
5564 continue;
5565
5566 if (STA_ENTRY_TDLS_PEER == pSta->staType)
5567 htCapable = pSta->mlmStaContext.htCapability;
5568 else
5569 htCapable = psessionEntry->htCapability;
5570
5571 if (htCapable)
5572 break;
5573 }
5574 if (!htCapable)
5575 {
5576 palFreeMemory(pMac->hHdd, limMsg->bodyptr);
5577 return;
5578 }
5579#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07005580
5581 //delete the complete dialoguetoken linked list
5582 limDeleteDialogueTokenList(pMac);
5583 pBaCandidate = (tpAddBaCandidate) (((tANI_U8*)pBaActivityInd) + sizeof(tBaActivityInd));
5584
Gopichand Nakkala681989c2013-03-06 22:27:48 -08005585 for (i=0; i<baCandidateCnt; i++, pBaCandidate++)
Jeff Johnson295189b2012-06-20 16:38:30 -07005586 {
5587 pSta = dphLookupHashEntry(pMac, pBaCandidate->staAddr, &assocId, &psessionEntry->dph.dphHashTable);
Gopichand Nakkala681989c2013-03-06 22:27:48 -08005588 if ((NULL == pSta) || (!pSta->valid))
5589 continue;
Jeff Johnson295189b2012-06-20 16:38:30 -07005590
5591 for (tid=0; tid<STACFG_MAX_TC; tid++)
5592 {
Gopichand Nakkala681989c2013-03-06 22:27:48 -08005593 if((eBA_DISABLE == pSta->tcCfg[tid].fUseBATx) &&
Jeff Johnson295189b2012-06-20 16:38:30 -07005594 (pBaCandidate->baInfo[tid].fBaEnable))
5595 {
Hoonki Lee9af07cf2013-04-24 01:21:58 -07005596 limLog(pMac, LOGE, FL("BA setup for staId = %d, TID: %d, SSN: %d"),
5597 pSta->staIndex, tid, pBaCandidate->baInfo[tid].startingSeqNum);
Jeff Johnson295189b2012-06-20 16:38:30 -07005598 limPostMlmAddBAReq(pMac, pSta, tid, pBaCandidate->baInfo[tid].startingSeqNum,psessionEntry);
5599 }
5600 }
5601 }
5602 palFreeMemory(pMac->hHdd, limMsg->bodyptr);
5603 return;
5604}
5605
5606
5607/** -------------------------------------------------------------
5608\fn limDelAllBASessions
5609\brief Deletes all the exisitng BA sessions.
5610\ Note : This API is provided for Mac OSx only. The reason for this is that Mac OSx may not
5611\ restart after CFG update.
5612\param tpAniSirGlobal pMac
5613\return None
5614-------------------------------------------------------------*/
5615
5616void
5617limDelAllBASessions(tpAniSirGlobal pMac)
5618{
5619 tANI_U32 i;
5620 tANI_U8 tid;
5621 tpDphHashNode pSta;
5622
5623 tpPESession psessionEntry = &pMac->lim.gpSession[0]; //TBD-RAJESH HOW TO GET sessionEntry?????
5624 for(tid = 0; tid < STACFG_MAX_TC; tid++)
5625 {
5626 if((eLIM_AP_ROLE == psessionEntry->limSystemRole) ||(psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE)||
5627 (eLIM_STA_IN_IBSS_ROLE == psessionEntry->limSystemRole))
5628 {
5629 for(i = 0; i < pMac->lim.maxStation; i++)
5630 {
5631 pSta = psessionEntry->dph.dphHashTable.pDphNodeArray + i;
5632 if (pSta && pSta->added)
5633 {
5634 if(eBA_ENABLE == pSta->tcCfg[tid].fUseBATx)
5635 {
5636 limPostMlmDelBAReq(pMac, pSta, eBA_INITIATOR, tid, eSIR_MAC_UNSPEC_FAILURE_REASON,psessionEntry);
5637 }
5638 else if(eBA_ENABLE == pSta->tcCfg[tid].fUseBARx)
5639 {
5640 limPostMlmDelBAReq(pMac, pSta, eBA_RECIPIENT, tid, eSIR_MAC_UNSPEC_FAILURE_REASON,psessionEntry);
5641 }
5642 }
5643 }
5644 }
5645 else if((eLIM_STA_ROLE == psessionEntry->limSystemRole)||(eLIM_BT_AMP_STA_ROLE == psessionEntry->limSystemRole))
5646 {
5647 pSta = dphGetHashEntry(pMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable);
5648 if (pSta && pSta->added)
5649 {
5650 if(eBA_ENABLE == pSta->tcCfg[tid].fUseBATx)
5651 {
5652 limPostMlmDelBAReq(pMac, pSta, eBA_INITIATOR, tid, eSIR_MAC_UNSPEC_FAILURE_REASON,psessionEntry);
5653 }
5654 if(eBA_ENABLE == pSta->tcCfg[tid].fUseBARx)
5655 {
5656 limPostMlmDelBAReq(pMac, pSta, eBA_RECIPIENT, tid, eSIR_MAC_UNSPEC_FAILURE_REASON,psessionEntry);
5657 }
5658 }
5659 }
5660 }
5661}
5662/** -------------------------------------------------------------
5663\fn limProcessDelTsInd
5664\brief handles the DeleteTS indication coming from HAL or generated by PE itself in some error cases.
5665 Validates the request, sends the DelTs action frame to the Peer and sends DelTs indicatoin to HDD.
5666\param tpAniSirGlobal pMac
5667\param tSirMsgQ limMsg
5668\return None
5669-------------------------------------------------------------*/
5670void
5671limProcessDelTsInd(tpAniSirGlobal pMac, tpSirMsgQ limMsg)
5672{
5673 tpDphHashNode pSta;
5674 tpDelTsParams pDelTsParam = (tpDelTsParams) (limMsg->bodyptr);
5675 tpSirDeltsReq pDelTsReq = NULL;
5676 tSirMacAddr peerMacAddr;
5677 tpSirDeltsReqInfo pDelTsReqInfo;
5678 tpLimTspecInfo pTspecInfo;
5679 tpPESession psessionEntry;
5680 tANI_U8 sessionId;
5681
5682if((psessionEntry = peFindSessionByBssid(pMac,pDelTsParam->bssId,&sessionId))== NULL)
5683 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005684 limLog(pMac, LOGE,FL("session does not exist for given BssId"));
Jeff Johnsone7245742012-09-05 17:12:55 -07005685 palFreeMemory(pMac->hHdd, (void *)(limMsg->bodyptr));
Jeff Johnson295189b2012-06-20 16:38:30 -07005686 return;
5687 }
5688
5689 pTspecInfo = &(pMac->lim.tspecInfo[pDelTsParam->tspecIdx]);
5690 if(pTspecInfo->inuse == false)
5691 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005692 PELOGE(limLog(pMac, LOGE, FL("tspec entry with index %d is not in use"), pDelTsParam->tspecIdx);)
Jeff Johnson295189b2012-06-20 16:38:30 -07005693 goto error1;
5694 }
5695
5696 pSta = dphGetHashEntry(pMac, pTspecInfo->assocId, &psessionEntry->dph.dphHashTable);
5697 if(pSta == NULL)
5698 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005699 limLog(pMac, LOGE, FL("Could not find entry in DPH table for assocId = %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07005700 pTspecInfo->assocId);
5701 goto error1;
5702 }
5703
5704 if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&pDelTsReq, sizeof(tSirDeltsReq)))
5705 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005706 PELOGE(limLog(pMac, LOGE, FL("palAllocateMemory() failed"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005707 goto error1;
5708 }
5709
5710 palZeroMemory( pMac->hHdd, (tANI_U8 *)pDelTsReq, sizeof(tSirDeltsReq));
5711
5712 if(pSta->wmeEnabled)
5713 palCopyMemory(pMac->hHdd, &(pDelTsReq->req.tspec), &(pTspecInfo->tspec), sizeof(tSirMacTspecIE));
5714 else
5715 palCopyMemory(pMac->hHdd, &(pDelTsReq->req.tsinfo), &(pTspecInfo->tspec.tsinfo), sizeof(tSirMacTSInfo));
5716
5717
5718 //validate the req
5719 if (eSIR_SUCCESS != limValidateDeltsReq(pMac, pDelTsReq, peerMacAddr,psessionEntry))
5720 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005721 PELOGE(limLog(pMac, LOGE, FL("limValidateDeltsReq failed"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005722 goto error2;
5723 }
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005724 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 -07005725 pDelTsReq->aid, peerMacAddr[0], peerMacAddr[1], peerMacAddr[2],
5726 peerMacAddr[3], peerMacAddr[4], peerMacAddr[5]);)
5727
5728 limSendDeltsReqActionFrame(pMac, peerMacAddr, pDelTsReq->req.wmeTspecPresent, &pDelTsReq->req.tsinfo, &pDelTsReq->req.tspec,
5729 psessionEntry);
5730
5731 // prepare and send an sme indication to HDD
5732 if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&pDelTsReqInfo, sizeof(tSirDeltsReqInfo)))
5733 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005734 PELOGE(limLog(pMac, LOGE, FL("palAllocateMemory() failed"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005735 goto error3;
5736 }
5737 palZeroMemory( pMac->hHdd, (tANI_U8 *)pDelTsReqInfo, sizeof(tSirDeltsReqInfo));
5738
5739 if(pSta->wmeEnabled)
5740 palCopyMemory(pMac->hHdd, &(pDelTsReqInfo->tspec), &(pTspecInfo->tspec), sizeof(tSirMacTspecIE));
5741 else
5742 palCopyMemory(pMac->hHdd, &(pDelTsReqInfo->tsinfo), &(pTspecInfo->tspec.tsinfo), sizeof(tSirMacTSInfo));
5743
5744 limSendSmeDeltsInd(pMac, pDelTsReqInfo, pDelTsReq->aid,psessionEntry);
5745
5746error3:
5747 palFreeMemory(pMac->hHdd, (void *) pDelTsReqInfo);
5748error2:
5749 palFreeMemory(pMac->hHdd, (void *) pDelTsReq);
5750error1:
5751 palFreeMemory(pMac->hHdd, (void *)(limMsg->bodyptr));
5752 return;
5753}
5754
5755/**
5756 * \brief Setup an A-MPDU/BA session
5757 *
5758 * \sa limPostMlmAddBAReq
5759 *
5760 * \param pMac The global tpAniSirGlobal object
5761 *
5762 * \param pStaDs DPH Hash Node object of peer STA
5763 *
5764 * \param tid TID for which a BA is being setup.
5765 * If this is set to 0xFFFF, then we retrieve
5766 * the default TID from the CFG
5767 *
5768 * \return eSIR_SUCCESS if setup completes successfully
5769 * eSIR_FAILURE is some problem is encountered
5770 */
5771tSirRetStatus limPostMlmAddBAReq( tpAniSirGlobal pMac,
5772 tpDphHashNode pStaDs,
5773 tANI_U8 tid, tANI_U16 startingSeqNum,tpPESession psessionEntry)
5774{
5775 tSirRetStatus status = eSIR_SUCCESS;
Jeff Johnson09fb4cd2013-04-03 15:27:59 -07005776 tpLimMlmAddBAReq pMlmAddBAReq = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07005777 tpDialogueToken dialogueTokenNode;
5778 tANI_U32 val = 0;
Jeff Johnson09fb4cd2013-04-03 15:27:59 -07005779
Jeff Johnson295189b2012-06-20 16:38:30 -07005780 // Check if the peer is a 11n capable STA
5781 // FIXME - Need a 11n peer indication in DPH.
5782 // For now, using the taurusPeer attribute
5783 //if( 0 == pStaDs->taurusPeer == )
5784 //return eSIR_SUCCESS;
5785
5786 // Allocate for LIM_MLM_ADDBA_REQ
5787 if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd,
5788 (void **) &pMlmAddBAReq,
5789 sizeof( tLimMlmAddBAReq )))
5790 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005791 limLog( pMac, LOGP, FL("palAllocateMemory failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07005792 status = eSIR_MEM_ALLOC_FAILED;
5793 goto returnFailure;
5794 }
5795
5796 palZeroMemory( pMac->hHdd, (void *) pMlmAddBAReq, sizeof( tLimMlmAddBAReq ));
5797
5798 // Copy the peer MAC
5799 palCopyMemory( pMac->hHdd,
5800 pMlmAddBAReq->peerMacAddr,
5801 pStaDs->staAddr,
5802 sizeof( tSirMacAddr ));
5803
5804 // Update the TID
5805 pMlmAddBAReq->baTID = tid;
5806
5807 // Determine the supported BA policy of local STA
5808 // for the TID of interest
5809 pMlmAddBAReq->baPolicy = (pStaDs->baPolicyFlag >> tid) & 0x1;
5810
5811 // BA Buffer Size
5812 // Requesting the ADDBA recipient to populate the size.
5813 // If ADDBA is accepted, a non-zero buffer size should
5814 // be returned in the ADDBA Rsp
5815 pMlmAddBAReq->baBufferSize = 0;
5816
5817 limLog( pMac, LOGW,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005818 FL( "Requesting an ADDBA to setup a %s BA session with STA %d for TID %d" ),
Jeff Johnson295189b2012-06-20 16:38:30 -07005819 (pMlmAddBAReq->baPolicy ? "Immediate": "Delayed"),
5820 pStaDs->staIndex,
5821 tid );
5822
5823 // BA Timeout
Jeff Johnson09fb4cd2013-04-03 15:27:59 -07005824 if (wlan_cfgGetInt(pMac, WNI_CFG_BA_TIMEOUT, &val) != eSIR_SUCCESS)
Jeff Johnson295189b2012-06-20 16:38:30 -07005825 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005826 limLog(pMac, LOGE, FL("could not retrieve BA TIME OUT Param CFG"));
Jeff Johnson295189b2012-06-20 16:38:30 -07005827 status = eSIR_FAILURE;
5828 goto returnFailure;
5829 }
5830 pMlmAddBAReq->baTimeout = val; // In TU's
5831
5832 // ADDBA Failure Timeout
Jeff Johnson09fb4cd2013-04-03 15:27:59 -07005833 // FIXME_AMPDU - Need to retrieve this from CFG.
Jeff Johnson295189b2012-06-20 16:38:30 -07005834 //right now we are not checking for response timeout. so this field is dummy just to be compliant with the spec.
5835 pMlmAddBAReq->addBAFailureTimeout = 2000; // In TU's
5836
5837 // BA Starting Sequence Number
5838 pMlmAddBAReq->baSSN = startingSeqNum;
5839
5840 /* Update PE session Id*/
5841 pMlmAddBAReq->sessionId = psessionEntry->peSessionId;
5842
5843 LIM_SET_STA_BA_STATE(pStaDs, tid, eLIM_BA_STATE_WT_ADD_RSP);
5844
Jeff Johnson09fb4cd2013-04-03 15:27:59 -07005845 dialogueTokenNode = limAssignDialogueToken(pMac);
5846 if (NULL == dialogueTokenNode)
5847 {
5848 limLog(pMac, LOGE, FL("could not assign dialogue token"));
5849 status = eSIR_FAILURE;
5850 goto returnFailure;
5851 }
5852
Jeff Johnson295189b2012-06-20 16:38:30 -07005853 pMlmAddBAReq->baDialogToken = dialogueTokenNode->token;
Jeff Johnson09fb4cd2013-04-03 15:27:59 -07005854 //set assocId and tid information in the lim linked list
Jeff Johnson295189b2012-06-20 16:38:30 -07005855 dialogueTokenNode->assocId = pStaDs->assocId;
5856 dialogueTokenNode->tid = tid;
5857 // Send ADDBA Req to MLME
5858 limPostMlmMessage( pMac,
5859 LIM_MLM_ADDBA_REQ,
5860 (tANI_U32 *) pMlmAddBAReq );
Jeff Johnson09fb4cd2013-04-03 15:27:59 -07005861 return eSIR_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -07005862
5863returnFailure:
Jeff Johnson09fb4cd2013-04-03 15:27:59 -07005864 palFreeMemory(pMac->hHdd, pMlmAddBAReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07005865 return status;
5866}
5867
5868/**
5869 * \brief Post LIM_MLM_ADDBA_RSP to MLME. MLME
5870 * will then send an ADDBA Rsp to peer MAC entity
5871 * with the appropriate ADDBA status code
5872 *
5873 * \sa limPostMlmAddBARsp
5874 *
5875 * \param pMac The global tpAniSirGlobal object
5876 *
5877 * \param peerMacAddr MAC address of peer entity that will
5878 * be the recipient of this ADDBA Rsp
5879 *
5880 * \param baStatusCode ADDBA Rsp status code
5881 *
5882 * \param baDialogToken ADDBA Rsp dialog token
5883 *
5884 * \param baTID TID of interest
5885 *
5886 * \param baPolicy The BA policy
5887 *
5888 * \param baBufferSize The BA buffer size
5889 *
5890 * \param baTimeout BA timeout in TU's
5891 *
5892 * \return eSIR_SUCCESS if setup completes successfully
5893 * eSIR_FAILURE is some problem is encountered
5894 */
5895tSirRetStatus limPostMlmAddBARsp( tpAniSirGlobal pMac,
5896 tSirMacAddr peerMacAddr,
5897 tSirMacStatusCodes baStatusCode,
5898 tANI_U8 baDialogToken,
5899 tANI_U8 baTID,
5900 tANI_U8 baPolicy,
5901 tANI_U16 baBufferSize,
5902 tANI_U16 baTimeout,
5903 tpPESession psessionEntry)
5904{
5905tSirRetStatus status = eSIR_SUCCESS;
5906tpLimMlmAddBARsp pMlmAddBARsp;
5907
5908 // Allocate for LIM_MLM_ADDBA_RSP
5909 if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd,
5910 (void **) &pMlmAddBARsp,
5911 sizeof( tLimMlmAddBARsp )))
5912 {
5913 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005914 FL("palAllocateMemory failed with error code %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07005915 status );
5916
5917 status = eSIR_MEM_ALLOC_FAILED;
5918 goto returnFailure;
5919 }
5920
5921 palZeroMemory( pMac->hHdd, (void *) pMlmAddBARsp, sizeof( tLimMlmAddBARsp ));
5922
5923 // Copy the peer MAC
5924 palCopyMemory( pMac->hHdd,
5925 pMlmAddBARsp->peerMacAddr,
5926 peerMacAddr,
5927 sizeof( tSirMacAddr ));
5928
5929 pMlmAddBARsp->baDialogToken = baDialogToken;
5930 pMlmAddBARsp->addBAResultCode = baStatusCode;
5931 pMlmAddBARsp->baTID = baTID;
5932 pMlmAddBARsp->baPolicy = baPolicy;
5933 pMlmAddBARsp->baBufferSize = baBufferSize;
5934 pMlmAddBARsp->baTimeout = baTimeout;
5935
5936 /* UPdate PE session ID*/
5937 pMlmAddBARsp->sessionId = psessionEntry->peSessionId;
5938
5939 // Send ADDBA Rsp to MLME
5940 limPostMlmMessage( pMac,
5941 LIM_MLM_ADDBA_RSP,
5942 (tANI_U32 *) pMlmAddBARsp );
5943
5944returnFailure:
5945
5946 return status;
5947}
5948
5949/**
5950 * \brief Post LIM_MLM_DELBA_REQ to MLME. MLME
5951 * will then send an DELBA Ind to peer MAC entity
5952 * with the appropriate DELBA status code
5953 *
5954 * \sa limPostMlmDelBAReq
5955 *
5956 * \param pMac The global tpAniSirGlobal object
5957 *
5958 * \param pSta DPH Hash Node object of peer MAC entity
5959 * for which the BA session is being deleted
5960 *
5961 * \param baDirection DELBA direction
5962 *
5963 * \param baTID TID for which the BA session is being deleted
5964 *
5965 * \param baReasonCode DELBA Req reason code
5966 *
5967 * \return eSIR_SUCCESS if setup completes successfully
5968 * eSIR_FAILURE is some problem is encountered
5969 */
5970tSirRetStatus limPostMlmDelBAReq( tpAniSirGlobal pMac,
5971 tpDphHashNode pSta,
5972 tANI_U8 baDirection,
5973 tANI_U8 baTID,
5974 tSirMacReasonCodes baReasonCode,
5975 tpPESession psessionEntry)
5976{
5977tSirRetStatus status = eSIR_SUCCESS;
5978tpLimMlmDelBAReq pMlmDelBAReq;
5979tLimBAState curBaState;
5980
5981if(NULL == pSta)
5982 return eSIR_FAILURE;
5983
5984LIM_GET_STA_BA_STATE(pSta, baTID, &curBaState);
5985
5986 // Need to validate the current BA State.
5987 if( eLIM_BA_STATE_IDLE != curBaState)
5988 {
5989 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005990 FL( "Received unexpected DELBA REQ when STA BA state for tid = %d is %d" ),
Jeff Johnson295189b2012-06-20 16:38:30 -07005991 baTID,
5992 curBaState);
5993
5994 status = eSIR_FAILURE;
5995 goto returnFailure;
5996 }
5997
5998 // Allocate for LIM_MLM_DELBA_REQ
5999 if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd,
6000 (void **) &pMlmDelBAReq,
6001 sizeof( tLimMlmDelBAReq )))
6002 {
6003 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006004 FL("palAllocateMemory failed with error code %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07006005 status );
6006
6007 status = eSIR_MEM_ALLOC_FAILED;
6008 goto returnFailure;
6009 }
6010
6011 palZeroMemory( pMac->hHdd, (void *) pMlmDelBAReq, sizeof( tLimMlmDelBAReq ));
6012
6013 // Copy the peer MAC
6014 palCopyMemory( pMac->hHdd,
6015 pMlmDelBAReq->peerMacAddr,
6016 pSta->staAddr,
6017 sizeof( tSirMacAddr ));
6018
6019 pMlmDelBAReq->baDirection = baDirection;
6020 pMlmDelBAReq->baTID = baTID;
6021 pMlmDelBAReq->delBAReasonCode = baReasonCode;
6022
6023 /* Update PE session ID*/
6024 pMlmDelBAReq->sessionId = psessionEntry->peSessionId;
6025
6026 //we don't have valid BA session for the given direction.
6027 // HDD wants to get the BA session deleted on PEER in this case.
6028 // in this case we just need to send DelBA to the peer.
6029 if(((eBA_RECIPIENT == baDirection) && (eBA_DISABLE == pSta->tcCfg[baTID].fUseBARx)) ||
6030 ((eBA_INITIATOR == baDirection) && (eBA_DISABLE == pSta->tcCfg[baTID].fUseBATx)))
6031 {
6032 // Send DELBA Ind over the air
6033 if( eSIR_SUCCESS !=
6034 (status = limSendDelBAInd( pMac, pMlmDelBAReq,psessionEntry)))
6035 status = eSIR_FAILURE;
6036
6037 palFreeMemory(pMac->hHdd, (void*) pMlmDelBAReq);
6038 return status;
6039 }
6040
6041
6042 // Update the BA state in STA
6043 LIM_SET_STA_BA_STATE(pSta, pMlmDelBAReq->baTID, eLIM_BA_STATE_WT_DEL_RSP);
6044
6045 // Send DELBA Req to MLME
6046 limPostMlmMessage( pMac,
6047 LIM_MLM_DELBA_REQ,
6048 (tANI_U32 *) pMlmDelBAReq );
6049
6050returnFailure:
6051
6052 return status;
6053}
6054
6055/**
6056 * \brief Send WDA_ADDBA_REQ to HAL, in order
6057 * to setup a new BA session with a peer
6058 *
6059 * \sa limPostMsgAddBAReq
6060 *
6061 * \param pMac The global tpAniSirGlobal object
6062 *
6063 * \param pSta Runtime, STA-related configuration cached
6064 * in the HashNode object
6065 *
6066 * \param baDialogToken The Action Frame dialog token
6067 *
6068 * \param baTID TID for which the BA session is being setup
6069 *
6070 * \param baPolicy BA Policy
6071 *
6072 * \param baBufferSize The requested BA buffer size
6073 *
6074 * \param baTimeout BA Timeout. 0 indicates no BA timeout enforced
6075 *
6076 * \param baSSN Starting Sequence Number for this BA session
6077 *
6078 * \param baDirection BA Direction: 1 - Initiator, 0 - Recipient
6079 *
6080 * \return none
6081 *
6082 */
6083tSirRetStatus limPostMsgAddBAReq( tpAniSirGlobal pMac,
6084 tpDphHashNode pSta,
6085 tANI_U8 baDialogToken,
6086 tANI_U8 baTID,
6087 tANI_U8 baPolicy,
6088 tANI_U16 baBufferSize,
6089 tANI_U16 baTimeout,
6090 tANI_U16 baSSN,
6091 tANI_U8 baDirection,
6092 tpPESession psessionEntry)
6093{
6094tpAddBAParams pAddBAParams = NULL;
6095tSirRetStatus retCode = eSIR_SUCCESS;
6096eHalStatus status;
6097tSirMsgQ msgQ;
6098
6099#ifdef WLAN_SOFTAP_VSTA_FEATURE
6100 // we can only do BA on "hard" STAs
6101 if (!(IS_HWSTA_IDX(pSta->staIndex)))
6102 {
6103 retCode = eHAL_STATUS_FAILURE;
6104 goto returnFailure;
6105 }
6106#endif //WLAN_SOFTAP_VSTA_FEATURE
6107
6108 // Allocate for WDA_ADDBA_REQ
6109 if( eHAL_STATUS_SUCCESS !=
6110 (status = palAllocateMemory( pMac->hHdd,
6111 (void **) &pAddBAParams,
6112 sizeof( tAddBAParams ))))
6113 {
6114 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006115 FL("palAllocateMemory failed with error code %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07006116 status );
6117
6118 retCode = eSIR_MEM_ALLOC_FAILED;
6119 goto returnFailure;
6120 }
6121
6122 palZeroMemory( pMac->hHdd, (void *) pAddBAParams, sizeof( tAddBAParams ));
6123
6124 // Copy the peer MAC address
6125 palCopyMemory( pMac->hHdd,
6126 (void *) pAddBAParams->peerMacAddr,
6127 (void *) pSta->staAddr,
6128 sizeof( tSirMacAddr ));
6129
6130 // Populate the REQ parameters
6131 pAddBAParams->staIdx = pSta->staIndex;
6132 pAddBAParams->baDialogToken = baDialogToken;
6133 pAddBAParams->baTID = baTID;
6134 pAddBAParams->baPolicy = baPolicy;
6135 pAddBAParams->baBufferSize = baBufferSize;
6136 pAddBAParams->baTimeout = baTimeout;
6137 pAddBAParams->baSSN = baSSN;
6138 pAddBAParams->baDirection = baDirection;
6139 pAddBAParams->respReqd = 1;
6140
6141 /* UPdate PE session ID */
6142 pAddBAParams->sessionId = psessionEntry->peSessionId;
6143
6144 // Post WDA_ADDBA_REQ to HAL.
6145 msgQ.type = WDA_ADDBA_REQ;
6146 //
6147 // FIXME_AMPDU
6148 // A global counter (dialog token) is required to keep track of
6149 // all PE <-> HAL communication(s)
6150 //
6151 msgQ.reserved = 0;
6152 msgQ.bodyptr = pAddBAParams;
6153 msgQ.bodyval = 0;
6154
6155 limLog( pMac, LOGW,
6156 FL( "Sending WDA_ADDBA_REQ..." ));
6157
6158 //defer any other message until we get response back.
6159 SET_LIM_PROCESS_DEFD_MESGS(pMac, false);
6160
Jeff Johnsone7245742012-09-05 17:12:55 -07006161 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07006162#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
6163 limDiagEventReport(pMac, WLAN_PE_DIAG_HAL_ADDBA_REQ_EVENT, psessionEntry, 0, 0);
6164#endif //FEATURE_WLAN_DIAG_SUPPORT
6165
6166 if( eSIR_SUCCESS != (retCode = wdaPostCtrlMsg( pMac, &msgQ )))
6167 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006168 FL("Posting WDA_ADDBA_REQ to HAL failed! Reason = %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07006169 retCode );
6170 else
6171 return retCode;
6172
6173returnFailure:
6174
6175 // Clean-up...
6176 if( NULL != pAddBAParams )
6177 palFreeMemory( pMac->hHdd, (void *) pAddBAParams );
6178
6179 return retCode;
6180
6181}
6182
6183/**
6184 * \brief Send WDA_DELBA_IND to HAL, in order
6185 * to delete an existing BA session with peer
6186 *
6187 * \sa limPostMsgDelBAInd
6188 *
6189 * \param pMac The global tpAniSirGlobal object
6190 *
6191 * \param pSta Runtime, STA-related configuration cached
6192 * in the HashNode object
6193 *
6194 * \param baTID TID for which the BA session is being setup
6195 *
6196 * \param baDirection Identifies whether the DELBA Ind was
6197 * sent by the BA initiator or recipient
6198 *
6199 * \return none
6200 *
6201 */
6202tSirRetStatus limPostMsgDelBAInd( tpAniSirGlobal pMac,
6203 tpDphHashNode pSta,
6204 tANI_U8 baTID,
6205 tANI_U8 baDirection,
6206 tpPESession psessionEntry)
6207{
6208tpDelBAParams pDelBAParams = NULL;
6209tSirRetStatus retCode = eSIR_SUCCESS;
6210eHalStatus status;
6211tSirMsgQ msgQ;
6212
6213 // Allocate for SIR_HAL_DELBA_IND
6214 if( eHAL_STATUS_SUCCESS !=
6215 (status = palAllocateMemory( pMac->hHdd,
6216 (void **) &pDelBAParams,
6217 sizeof( tDelBAParams ))))
6218 {
6219 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006220 FL("palAllocateMemory failed with error code %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07006221 status );
6222
6223 retCode = eSIR_MEM_ALLOC_FAILED;
6224 goto returnFailure;
6225 }
6226
6227 palZeroMemory( pMac->hHdd, (void *) pDelBAParams, sizeof( tDelBAParams ));
6228
6229 // Populate the REQ parameters
6230 pDelBAParams->staIdx = pSta->staIndex;
6231 pDelBAParams->baTID = baTID;
6232 pDelBAParams->baDirection = baDirection;
6233
6234 /* Update PE session ID */
6235
6236
6237 //TBD-RAJESH Updating of the session ID is requird for SIR_HAL_DELBA_IND?????
6238 //pDelBAParams->sessionId = psessionEntry->peSessionId;
6239
6240 // Post WDA_DELBA_IND to HAL.
6241 msgQ.type = WDA_DELBA_IND;
6242 //
6243 // FIXME:
6244 // A global counter (dialog token) is required to keep track of
6245 // all PE <-> HAL communication(s)
6246 //
6247 msgQ.reserved = 0;
6248 msgQ.bodyptr = pDelBAParams;
6249 msgQ.bodyval = 0;
6250
6251 limLog( pMac, LOGW,
6252 FL( "Sending SIR_HAL_DELBA_IND..." ));
6253
Jeff Johnsone7245742012-09-05 17:12:55 -07006254 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07006255#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
6256 limDiagEventReport(pMac, WLAN_PE_DIAG_HAL_DELBA_IND_EVENT, psessionEntry, 0, 0);
6257#endif //FEATURE_WLAN_DIAG_SUPPORT
6258
6259 if( eSIR_SUCCESS != (retCode = wdaPostCtrlMsg( pMac, &msgQ )))
6260 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006261 FL("Posting WDA_DELBA_IND to HAL failed! Reason = %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07006262 retCode );
6263 else
6264 {
6265 // Update LIM's internal cache...
6266 if( eBA_INITIATOR == baDirection)
6267 {
6268 pSta->tcCfg[baTID].fUseBATx = 0;
6269 pSta->tcCfg[baTID].txBufSize = 0;
6270 }
6271 else
6272 {
6273 pSta->tcCfg[baTID].fUseBARx = 0;
6274 pSta->tcCfg[baTID].rxBufSize = 0;
6275 }
6276
6277 return retCode;
6278 }
6279
6280returnFailure:
6281
6282 // Clean-up...
6283 if( NULL != pDelBAParams )
6284 palFreeMemory( pMac->hHdd, (void *) pDelBAParams );
6285
6286 return retCode;
6287
6288}
6289
6290/**
6291 * @function : limPostSMStateUpdate()
6292 *
6293 * @brief : This function Updates the HAL and Softmac about the change in the STA's SMPS state.
6294 *
6295 * LOGIC:
6296 *
6297 * ASSUMPTIONS:
6298 * NA
6299 *
6300 * NOTE:
6301 * NA
6302 *
6303 * @param pMac - Pointer to Global MAC structure
6304 * @param limMsg - Lim Message structure object with the MimoPSparam in body
6305 * @return None
6306 */
6307tSirRetStatus
6308limPostSMStateUpdate(tpAniSirGlobal pMac,
6309 tANI_U16 staIdx, tSirMacHTMIMOPowerSaveState state)
6310{
6311 tSirRetStatus retCode = eSIR_SUCCESS;
6312 tSirMsgQ msgQ;
6313 eHalStatus status;
6314 tpSetMIMOPS pMIMO_PSParams;
6315
6316 msgQ.reserved = 0;
6317 msgQ.type = WDA_SET_MIMOPS_REQ;
6318
6319 // Allocate for WDA_SET_MIMOPS_REQ
6320 status = palAllocateMemory( pMac->hHdd, (void **) &pMIMO_PSParams, sizeof( tSetMIMOPS));
6321 if( eHAL_STATUS_SUCCESS != status) {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006322 limLog( pMac, LOGP,FL(" palAllocateMemory failed with error code %d"), status );
Jeff Johnson295189b2012-06-20 16:38:30 -07006323 return eSIR_MEM_ALLOC_FAILED;
6324 }
6325
6326 pMIMO_PSParams->htMIMOPSState = state;
6327 pMIMO_PSParams->staIdx = staIdx;
6328 pMIMO_PSParams->fsendRsp = true;
6329 msgQ.bodyptr = pMIMO_PSParams;
6330 msgQ.bodyval = 0;
6331
6332 limLog( pMac, LOG2, FL( "Sending WDA_SET_MIMOPS_REQ..." ));
6333
Jeff Johnsone7245742012-09-05 17:12:55 -07006334 MTRACE(macTraceMsgTx(pMac, NO_SESSION, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07006335 retCode = wdaPostCtrlMsg( pMac, &msgQ );
6336 if (eSIR_SUCCESS != retCode)
6337 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006338 limLog( pMac, LOGP, FL("Posting WDA_SET_MIMOPS_REQ to HAL failed! Reason = %d"), retCode );
Jeff Johnson295189b2012-06-20 16:38:30 -07006339 palFreeMemory(pMac->hHdd, (void *) pMIMO_PSParams);
6340 return retCode;
6341 }
6342
6343 return retCode;
6344}
6345
6346void limPktFree (
6347 tpAniSirGlobal pMac,
6348 eFrameType frmType,
6349 tANI_U8 *pRxPacketInfo,
6350 void *pBody)
6351{
6352 (void) pMac; (void) frmType; (void) pRxPacketInfo; (void) pBody;
Jeff Johnson295189b2012-06-20 16:38:30 -07006353}
6354
6355/**
6356 * limGetBDfromRxPacket()
6357 *
6358 *FUNCTION:
6359 * This function is called to get pointer to Polaris
6360 * Buffer Descriptor containing MAC header & other control
6361 * info from the body of the message posted to LIM.
6362 *
6363 *LOGIC:
6364 * NA
6365 *
6366 *ASSUMPTIONS:
6367 * NA
6368 *
6369 *NOTE:
6370 * NA
6371 *
6372 * @param body - Received message body
6373 * @param pRxPacketInfo - Pointer to received BD
6374 * @return None
6375 */
6376
6377void
6378limGetBDfromRxPacket(tpAniSirGlobal pMac, void *body, tANI_U32 **pRxPacketInfo)
6379{
Jeff Johnson295189b2012-06-20 16:38:30 -07006380 *pRxPacketInfo = (tANI_U32 *) body;
Jeff Johnson295189b2012-06-20 16:38:30 -07006381} /*** end limGetBDfromRxPacket() ***/
6382
6383
6384
6385
6386
6387void limRessetScanChannelInfo(tpAniSirGlobal pMac)
6388{
6389 palZeroMemory(pMac->hHdd, &pMac->lim.scanChnInfo, sizeof(tLimScanChnInfo));
6390}
6391
6392
6393void limAddScanChannelInfo(tpAniSirGlobal pMac, tANI_U8 channelId)
6394{
6395 tANI_U8 i;
6396 tANI_BOOLEAN fFound = eANI_BOOLEAN_FALSE;
6397
6398 for(i = 0; i < pMac->lim.scanChnInfo.numChnInfo; i++)
6399 {
6400 if(pMac->lim.scanChnInfo.scanChn[i].channelId == channelId)
6401 {
6402 pMac->lim.scanChnInfo.scanChn[i].numTimeScan++;
6403 fFound = eANI_BOOLEAN_TRUE;
6404 break;
6405 }
6406 }
6407 if(eANI_BOOLEAN_FALSE == fFound)
6408 {
6409 if(pMac->lim.scanChnInfo.numChnInfo < SIR_MAX_SUPPORTED_CHANNEL_LIST)
6410 {
6411 pMac->lim.scanChnInfo.scanChn[pMac->lim.scanChnInfo.numChnInfo].channelId = channelId;
6412 pMac->lim.scanChnInfo.scanChn[pMac->lim.scanChnInfo.numChnInfo++].numTimeScan = 1;
6413 }
6414 else
6415 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006416 PELOGW(limLog(pMac, LOGW, FL(" -- number of channels exceed mac"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07006417 }
6418 }
6419}
6420
6421
6422/**
6423 * @function : limIsChannelValidForChannelSwitch()
6424 *
6425 * @brief : This function checks if the channel to which AP
6426 * is expecting us to switch, is a valid channel for us.
6427 * LOGIC:
6428 *
6429 * ASSUMPTIONS:
6430 * NA
6431 *
6432 * NOTE:
6433 * NA
6434 *
6435 * @param pMac - Pointer to Global MAC structure
6436 * @param channel - New channel to which we are expected to move
6437 * @return None
6438 */
6439tAniBool
6440limIsChannelValidForChannelSwitch(tpAniSirGlobal pMac, tANI_U8 channel)
6441{
6442 tANI_U8 index;
6443 tANI_U32 validChannelListLen = WNI_CFG_VALID_CHANNEL_LIST_LEN;
6444 tSirMacChanNum validChannelList[WNI_CFG_VALID_CHANNEL_LIST_LEN];
6445
6446 if (wlan_cfgGetStr(pMac, WNI_CFG_VALID_CHANNEL_LIST,
6447 (tANI_U8 *)validChannelList,
6448 (tANI_U32 *)&validChannelListLen) != eSIR_SUCCESS)
6449 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006450 PELOGE(limLog(pMac, LOGE, FL("could not retrieve valid channel list"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07006451 return (eSIR_FALSE);
6452 }
6453
6454 for(index = 0; index < validChannelListLen; index++)
6455 {
6456 if(validChannelList[index] == channel)
6457 return (eSIR_TRUE);
6458 }
6459
6460 /* channel does not belong to list of valid channels */
6461 return (eSIR_FALSE);
6462}
6463
6464/**------------------------------------------------------
6465\fn __limFillTxControlParams
6466\brief Fill the message for stopping/resuming tx.
6467
6468\param pMac
6469\param pTxCtrlMsg - Pointer to tx control message.
6470\param type - Which way we want to stop/ resume tx.
6471\param mode - To stop/resume.
6472 -------------------------------------------------------*/
6473static eHalStatus
6474__limFillTxControlParams(tpAniSirGlobal pMac, tpTxControlParams pTxCtrlMsg,
6475 tLimQuietTxMode type, tLimControlTx mode)
6476{
6477
6478 //TBD-RAJESH HOW TO GET sessionEntry?????
6479 tpPESession psessionEntry = &pMac->lim.gpSession[0];
6480
6481 if (mode == eLIM_STOP_TX)
6482 pTxCtrlMsg->stopTx = eANI_BOOLEAN_TRUE;
6483 else
6484 pTxCtrlMsg->stopTx = eANI_BOOLEAN_FALSE;
6485
6486 switch (type)
6487 {
6488 case eLIM_TX_ALL:
6489 /** Stops/resumes transmission completely */
6490 pTxCtrlMsg->fCtrlGlobal = 1;
6491 break;
6492
6493 case eLIM_TX_BSS_BUT_BEACON:
6494 /** Stops/resumes transmission on a particular BSS. Stopping BSS, doesnt
6495 * stop beacon transmission.
6496 */
6497 pTxCtrlMsg->ctrlBss = 1;
6498 pTxCtrlMsg->bssBitmap |= (1 << psessionEntry->bssIdx);
6499 break;
6500
6501 case eLIM_TX_STA:
6502 /** Memory for station bitmap is allocated dynamically in caller of this
6503 * so decode properly here and fill the bitmap. Now not implemented,
6504 * fall through.
6505 */
6506 case eLIM_TX_BSS:
6507 //Fall thru...
6508 default:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006509 PELOGW(limLog(pMac, LOGW, FL("Invalid case: Not Handled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07006510 return eHAL_STATUS_FAILURE;
6511 }
6512
6513 return eHAL_STATUS_SUCCESS;
6514}
6515
6516/**
6517 * @function : limFrameTransmissionControl()
6518 *
6519 * @brief : This API is called by the user to halt/resume any frame
6520 * transmission from the device. If stopped, all frames will be
6521 * queued starting from hardware. Then back-pressure
6522 * is built till the driver.
6523 * LOGIC:
6524 *
6525 * ASSUMPTIONS:
6526 * NA
6527 *
6528 * NOTE:
6529 * NA
6530 *
6531 * @param pMac - Pointer to Global MAC structure
6532 * @return None
6533 */
6534void limFrameTransmissionControl(tpAniSirGlobal pMac, tLimQuietTxMode type, tLimControlTx mode)
6535{
6536
6537 eHalStatus status = eHAL_STATUS_FAILURE;
6538 tpTxControlParams pTxCtrlMsg;
6539 tSirMsgQ msgQ;
6540 tANI_U8 nBytes = 0; // No of bytes required for station bitmap.
6541
6542 /** Allocate only required number of bytes for station bitmap
6543 * Make it to align to 4 byte boundary */
6544 nBytes = (tANI_U8)HALMSG_NUMBYTES_STATION_BITMAP(pMac->lim.maxStation);
6545
6546 status = palAllocateMemory(pMac->hHdd, (void **) &pTxCtrlMsg,
6547 (sizeof(*pTxCtrlMsg) + nBytes));
6548 if (status != eHAL_STATUS_SUCCESS)
6549 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006550 limLog(pMac, LOGP, FL("palAllocateMemory() failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07006551 return;
6552 }
6553
6554 status = palZeroMemory(pMac->hHdd, (void *) pTxCtrlMsg,
6555 (sizeof(*pTxCtrlMsg) + nBytes));
6556 if (status != eHAL_STATUS_SUCCESS)
6557 {
6558 palFreeMemory(pMac->hHdd, (void *) pTxCtrlMsg);
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006559 limLog(pMac, LOGP, FL("palZeroMemory() failed, status = %d"), status);
Jeff Johnson295189b2012-06-20 16:38:30 -07006560 return;
6561 }
6562
6563 status = __limFillTxControlParams(pMac, pTxCtrlMsg, type, mode);
6564 if (status != eHAL_STATUS_SUCCESS)
6565 {
6566 palFreeMemory(pMac->hHdd, (void *) pTxCtrlMsg);
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006567 limLog(pMac, LOGP, FL("__limFillTxControlParams failed, status = %d"), status);
Jeff Johnson295189b2012-06-20 16:38:30 -07006568 return;
6569 }
6570
6571 msgQ.bodyptr = (void *) pTxCtrlMsg;
6572 msgQ.bodyval = 0;
6573 msgQ.reserved = 0;
6574 msgQ.type = WDA_TRANSMISSION_CONTROL_IND;
6575
Jeff Johnsone7245742012-09-05 17:12:55 -07006576 MTRACE(macTraceMsgTx(pMac, NO_SESSION, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07006577 if(wdaPostCtrlMsg( pMac, &msgQ) != eSIR_SUCCESS)
6578 {
6579 palFreeMemory(pMac->hHdd, (void *) pTxCtrlMsg);
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006580 limLog( pMac, LOGP, FL("Posting Message to HAL failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07006581 return;
6582 }
6583
6584 if (mode == eLIM_STOP_TX)
6585 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006586 PELOG1(limLog(pMac, LOG1, FL("Stopping the transmission of all packets, indicated softmac"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07006587 }
6588 else
6589 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006590 PELOG1(limLog(pMac, LOG1, FL("Resuming the transmission of all packets, indicated softmac"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07006591 }
6592 return;
6593}
6594
6595
6596/**
6597 * @function : limRestorePreChannelSwitchState()
6598 *
6599 * @brief : This API is called by the user to undo any
6600 * specific changes done on the device during
6601 * channel switch.
6602 * LOGIC:
6603 *
6604 * ASSUMPTIONS:
6605 * NA
6606 *
6607 * NOTE:
6608 * NA
6609 *
6610 * @param pMac - Pointer to Global MAC structure
6611 * @return None
6612 */
6613
6614tSirRetStatus
6615limRestorePreChannelSwitchState(tpAniSirGlobal pMac, tpPESession psessionEntry)
6616{
6617
6618 tSirRetStatus retCode = eSIR_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -07006619 tANI_U32 val = 0;
6620
6621 if (psessionEntry->limSystemRole != eLIM_STA_ROLE)
6622 return retCode;
6623
6624 /* Channel switch should be ready for the next time */
Jeff Johnsone7245742012-09-05 17:12:55 -07006625 psessionEntry->gLimSpecMgmt.dot11hChanSwState = eLIM_11H_CHANSW_INIT;
Jeff Johnson295189b2012-06-20 16:38:30 -07006626
6627 /* Restore the frame transmission, all the time. */
6628 limFrameTransmissionControl(pMac, eLIM_TX_ALL, eLIM_RESUME_TX);
6629
6630 /* Free to enter BMPS */
6631 limSendSmePostChannelSwitchInd(pMac);
6632
6633 //Background scan is now enabled by SME
6634 if(pMac->lim.gLimBackgroundScanTerminate == FALSE)
6635 {
6636 /* Enable background scan if already enabled, else don't bother */
6637 if ((retCode = wlan_cfgGetInt(pMac, WNI_CFG_BACKGROUND_SCAN_PERIOD,
6638 &val)) != eSIR_SUCCESS)
6639
6640 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006641 limLog(pMac, LOGP, FL("could not retrieve Background scan period value"));
Jeff Johnson295189b2012-06-20 16:38:30 -07006642 return (retCode);
6643 }
6644
6645 if (val > 0 && TX_TIMER_VALID(pMac->lim.limTimers.gLimBackgroundScanTimer))
6646 {
Jeff Johnsone7245742012-09-05 17:12:55 -07006647 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, psessionEntry->peSessionId, eLIM_BACKGROUND_SCAN_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -07006648 if(tx_timer_activate(&pMac->lim.limTimers.gLimBackgroundScanTimer) != TX_SUCCESS)
6649 {
6650 limLog(pMac, LOGP, FL("Could not restart background scan timer, doing LOGP"));
6651 return (eSIR_FAILURE);
6652 }
6653
6654 }
6655 }
6656
6657 /* Enable heartbeat timer */
6658 if (TX_TIMER_VALID(pMac->lim.limTimers.gLimHeartBeatTimer))
6659 {
Jeff Johnsone7245742012-09-05 17:12:55 -07006660 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, psessionEntry->peSessionId, eLIM_HEART_BEAT_TIMER));
Yathish9f22e662012-12-10 14:21:35 -08006661 if((limActivateHearBeatTimer(pMac) != TX_SUCCESS) && (!IS_ACTIVEMODE_OFFLOAD_FEATURE_ENABLE))
Jeff Johnson295189b2012-06-20 16:38:30 -07006662 {
6663 limLog(pMac, LOGP, FL("Could not restart heartbeat timer, doing LOGP"));
6664 return (eSIR_FAILURE);
6665 }
6666 }
Jeff Johnson295189b2012-06-20 16:38:30 -07006667 return (retCode);
6668}
6669
6670
6671/**--------------------------------------------
6672\fn limRestorePreQuietState
6673\brief Restore the pre quiet state
6674
6675\param pMac
6676\return NONE
6677---------------------------------------------*/
Jeff Johnsone7245742012-09-05 17:12:55 -07006678tSirRetStatus limRestorePreQuietState(tpAniSirGlobal pMac, tpPESession psessionEntry)
Jeff Johnson295189b2012-06-20 16:38:30 -07006679{
6680
6681 tSirRetStatus retCode = eSIR_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -07006682 tANI_U32 val = 0;
6683
6684 if (pMac->lim.gLimSystemRole != eLIM_STA_ROLE)
6685 return retCode;
6686
6687 /* Quiet should be ready for the next time */
Jeff Johnsone7245742012-09-05 17:12:55 -07006688 psessionEntry->gLimSpecMgmt.quietState = eLIM_QUIET_INIT;
Jeff Johnson295189b2012-06-20 16:38:30 -07006689
6690 /* Restore the frame transmission, all the time. */
Jeff Johnsone7245742012-09-05 17:12:55 -07006691 if (psessionEntry->gLimSpecMgmt.quietState == eLIM_QUIET_RUNNING)
Jeff Johnson295189b2012-06-20 16:38:30 -07006692 limFrameTransmissionControl(pMac, eLIM_TX_ALL, eLIM_RESUME_TX);
6693
6694
6695 //Background scan is now enabled by SME
6696 if(pMac->lim.gLimBackgroundScanTerminate == FALSE)
6697 {
6698 /* Enable background scan if already enabled, else don't bother */
6699 if ((retCode = wlan_cfgGetInt(pMac, WNI_CFG_BACKGROUND_SCAN_PERIOD,
6700 &val)) != eSIR_SUCCESS)
6701
6702 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006703 limLog(pMac, LOGP, FL("could not retrieve Background scan period value"));
Jeff Johnson295189b2012-06-20 16:38:30 -07006704 return (retCode);
6705 }
6706
6707 if (val > 0 && TX_TIMER_VALID(pMac->lim.limTimers.gLimBackgroundScanTimer))
6708 {
Leela V Kiran Kumar Reddy Chiralac3b9d382013-01-31 20:49:53 -08006709 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, psessionEntry->peSessionId, eLIM_BACKGROUND_SCAN_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -07006710 if(tx_timer_activate(&pMac->lim.limTimers.gLimBackgroundScanTimer) != TX_SUCCESS)
6711 {
6712 limLog(pMac, LOGP, FL("Could not restart background scan timer, doing LOGP"));
6713 return (eSIR_FAILURE);
6714 }
6715
6716 }
6717 }
6718
6719 /* Enable heartbeat timer */
6720 if (TX_TIMER_VALID(pMac->lim.limTimers.gLimHeartBeatTimer))
6721 {
Leela V Kiran Kumar Reddy Chiralac3b9d382013-01-31 20:49:53 -08006722 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, psessionEntry->peSessionId, eLIM_HEART_BEAT_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -07006723 if(limActivateHearBeatTimer(pMac) != TX_SUCCESS)
6724 {
6725 limLog(pMac, LOGP, FL("Could not restart heartbeat timer, doing LOGP"));
6726 return (eSIR_FAILURE);
6727 }
6728 }
Jeff Johnson295189b2012-06-20 16:38:30 -07006729 return (retCode);
6730}
6731
6732
6733/**
6734 * @function: limPrepareFor11hChannelSwitch()
6735 *
6736 * @brief : This API is called by the user to prepare for
6737 * 11h channel switch. As of now, the API does
6738 * very minimal work. User can add more into the
6739 * same API if needed.
6740 * LOGIC:
6741 *
6742 * ASSUMPTIONS:
6743 * NA
6744 *
6745 * NOTE:
6746 * NA
6747 *
6748 * @param pMac - Pointer to Global MAC structure
6749 * @param psessionEntry
6750 * @return None
6751 */
6752void
6753limPrepareFor11hChannelSwitch(tpAniSirGlobal pMac, tpPESession psessionEntry)
6754{
Jeff Johnson295189b2012-06-20 16:38:30 -07006755 if (psessionEntry->limSystemRole != eLIM_STA_ROLE)
6756 return;
6757
6758 /* Flag to indicate 11h channel switch in progress */
Jeff Johnsone7245742012-09-05 17:12:55 -07006759 psessionEntry->gLimSpecMgmt.dot11hChanSwState = eLIM_11H_CHANSW_RUNNING;
Jeff Johnson295189b2012-06-20 16:38:30 -07006760
6761 /* Disable, Stop background scan if enabled and running */
6762 limDeactivateAndChangeTimer(pMac, eLIM_BACKGROUND_SCAN_TIMER);
6763
6764 /* Stop heart-beat timer to stop heartbeat disassociation */
6765 limHeartBeatDeactivateAndChangeTimer(pMac, psessionEntry);
6766
6767 if(pMac->lim.gLimSmeState == eLIM_SME_LINK_EST_WT_SCAN_STATE ||
6768 pMac->lim.gLimSmeState == eLIM_SME_CHANNEL_SCAN_STATE)
6769 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006770 PELOGE(limLog(pMac, LOGE, FL("Posting finish scan as we are in scan state"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07006771 /* Stop ongoing scanning if any */
6772 if (GET_LIM_PROCESS_DEFD_MESGS(pMac))
6773 {
6774 //Set the resume channel to Any valid channel (invalid).
6775 //This will instruct HAL to set it to any previous valid channel.
6776 peSetResumeChannel(pMac, 0, 0);
6777 limSendHalFinishScanReq(pMac, eLIM_HAL_FINISH_SCAN_WAIT_STATE);
6778 }
6779 else
6780 {
6781 limRestorePreChannelSwitchState(pMac, psessionEntry);
6782 }
6783 return;
6784 }
6785 else
6786 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006787 PELOGE(limLog(pMac, LOGE, FL("Not in scan state, start channel switch timer"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07006788 /** We are safe to switch channel at this point */
6789 limStopTxAndSwitchChannel(pMac, psessionEntry->peSessionId);
6790 }
Jeff Johnson295189b2012-06-20 16:38:30 -07006791}
6792
6793
6794
6795/**----------------------------------------------------
6796\fn limGetNwType
6797
6798\brief Get type of the network from data packet or beacon
6799\param pMac
6800\param channelNum - Channel number
6801\param type - Type of packet.
6802\param pBeacon - Pointer to beacon or probe response
6803
6804\return Network type a/b/g.
6805-----------------------------------------------------*/
6806tSirNwType limGetNwType(tpAniSirGlobal pMac, tANI_U8 channelNum, tANI_U32 type, tpSchBeaconStruct pBeacon)
6807{
6808 tSirNwType nwType = eSIR_11B_NW_TYPE;
6809
6810 if (type == SIR_MAC_DATA_FRAME)
6811 {
6812 if ((channelNum > 0) && (channelNum < 15))
6813 {
6814 nwType = eSIR_11G_NW_TYPE;
6815 }
6816 else
6817 {
6818 nwType = eSIR_11A_NW_TYPE;
6819 }
6820 }
6821 else
6822 {
6823 if ((channelNum > 0) && (channelNum < 15))
6824 {
6825 int i;
6826 // 11b or 11g packet
6827 // 11g iff extended Rate IE is present or
6828 // if there is an A rate in suppRate IE
6829 for (i = 0; i < pBeacon->supportedRates.numRates; i++)
6830 {
6831 if (sirIsArate(pBeacon->supportedRates.rate[i] & 0x7f))
6832 {
6833 nwType = eSIR_11G_NW_TYPE;
6834 break;
6835 }
6836 }
6837 if (pBeacon->extendedRatesPresent)
6838 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006839 PELOG3(limLog(pMac, LOG3, FL("Beacon, nwtype=G"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07006840 nwType = eSIR_11G_NW_TYPE;
6841 }
6842 }
6843 else
6844 {
6845 // 11a packet
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006846 PELOG3(limLog(pMac, LOG3,FL("Beacon, nwtype=A"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07006847 nwType = eSIR_11A_NW_TYPE;
6848 }
6849 }
6850 return nwType;
6851}
6852
6853
6854/**---------------------------------------------------------
6855\fn limGetChannelFromBeacon
6856\brief To extract channel number from beacon
6857
6858\param pMac
6859\param pBeacon - Pointer to beacon or probe rsp
6860\return channel number
6861-----------------------------------------------------------*/
6862tANI_U8 limGetChannelFromBeacon(tpAniSirGlobal pMac, tpSchBeaconStruct pBeacon)
6863{
6864 tANI_U8 channelNum = 0;
6865
6866 if (pBeacon->dsParamsPresent)
6867 channelNum = pBeacon->channelNumber;
6868 else if(pBeacon->HTInfo.present)
6869 channelNum = pBeacon->HTInfo.primaryChannel;
6870 else
6871 channelNum = pBeacon->channelNumber;
6872
6873 return channelNum;
6874}
6875
6876
6877/** ---------------------------------------------------------
6878\fn limSetTspecUapsdMask
6879\brief This function sets the PE global variable:
6880\ 1) gUapsdPerAcTriggerEnableMask and
6881\ 2) gUapsdPerAcDeliveryEnableMask
6882\ based on the user priority field and direction field
6883\ in the TS Info Fields.
6884\
6885\ An AC is a trigger-enabled AC if the PSB subfield
6886\ is set to 1 in the uplink direction.
6887\ An AC is a delivery-enabled AC if the PSB subfield
6888\ is set to 1 in the down-link direction.
6889\
6890\param tpAniSirGlobal pMac
6891\param tSirMacTSInfo pTsInfo
6892\param tANI_U32 action
6893\return None
6894 ------------------------------------------------------------*/
6895void limSetTspecUapsdMask(tpAniSirGlobal pMac, tSirMacTSInfo *pTsInfo, tANI_U32 action)
6896{
6897 tANI_U8 userPrio = (tANI_U8)pTsInfo->traffic.userPrio;
6898 tANI_U16 direction = pTsInfo->traffic.direction;
6899 tANI_U8 ac = upToAc(userPrio);
6900
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006901 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 -07006902
6903 /* Converting AC to appropriate Uapsd Bit Mask
6904 * AC_BE(0) --> UAPSD_BITOFFSET_ACVO(3)
6905 * AC_BK(1) --> UAPSD_BITOFFSET_ACVO(2)
6906 * AC_VI(2) --> UAPSD_BITOFFSET_ACVO(1)
6907 * AC_VO(3) --> UAPSD_BITOFFSET_ACVO(0)
6908 */
6909 ac = ((~ac) & 0x3);
6910
6911 if (action == CLEAR_UAPSD_MASK)
6912 {
6913 if (direction == SIR_MAC_DIRECTION_UPLINK)
6914 pMac->lim.gUapsdPerAcTriggerEnableMask &= ~(1 << ac);
6915 else if (direction == SIR_MAC_DIRECTION_DNLINK)
6916 pMac->lim.gUapsdPerAcDeliveryEnableMask &= ~(1 << ac);
6917 else if (direction == SIR_MAC_DIRECTION_BIDIR)
6918 {
6919 pMac->lim.gUapsdPerAcTriggerEnableMask &= ~(1 << ac);
6920 pMac->lim.gUapsdPerAcDeliveryEnableMask &= ~(1 << ac);
6921 }
6922 }
6923 else if (action == SET_UAPSD_MASK)
6924 {
6925 if (direction == SIR_MAC_DIRECTION_UPLINK)
6926 pMac->lim.gUapsdPerAcTriggerEnableMask |= (1 << ac);
6927 else if (direction == SIR_MAC_DIRECTION_DNLINK)
6928 pMac->lim.gUapsdPerAcDeliveryEnableMask |= (1 << ac);
6929 else if (direction == SIR_MAC_DIRECTION_BIDIR)
6930 {
6931 pMac->lim.gUapsdPerAcTriggerEnableMask |= (1 << ac);
6932 pMac->lim.gUapsdPerAcDeliveryEnableMask |= (1 << ac);
6933 }
6934 }
6935
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006936 limLog(pMac, LOGE, FL("New pMac->lim.gUapsdPerAcTriggerEnableMask = 0x%x "), pMac->lim.gUapsdPerAcTriggerEnableMask );
6937 limLog(pMac, LOGE, FL("New pMac->lim.gUapsdPerAcDeliveryEnableMask = 0x%x "), pMac->lim.gUapsdPerAcDeliveryEnableMask );
Jeff Johnson295189b2012-06-20 16:38:30 -07006938
6939 return;
6940}
6941
6942
6943
6944void limHandleHeartBeatTimeout(tpAniSirGlobal pMac )
6945{
6946
6947 tANI_U8 i;
6948 for(i =0;i < pMac->lim.maxBssId;i++)
6949 {
6950 if(pMac->lim.gpSession[i].valid == TRUE )
6951 {
6952 if(pMac->lim.gpSession[i].bssType == eSIR_IBSS_MODE)
6953 {
6954 limIbssHeartBeatHandle(pMac,&pMac->lim.gpSession[i]);
6955 break;
6956 }
6957
6958 if((pMac->lim.gpSession[i].bssType == eSIR_INFRASTRUCTURE_MODE) &&
6959 (pMac->lim.gpSession[i].limSystemRole == eLIM_STA_ROLE))
6960 {
6961 limHandleHeartBeatFailure(pMac,&pMac->lim.gpSession[i]);
6962 }
6963 }
6964 }
6965 for(i=0; i< pMac->lim.maxBssId; i++)
6966 {
6967 if(pMac->lim.gpSession[i].valid == TRUE )
6968 {
6969 if((pMac->lim.gpSession[i].bssType == eSIR_INFRASTRUCTURE_MODE) &&
6970 (pMac->lim.gpSession[i].limSystemRole == eLIM_STA_ROLE))
6971 {
6972 if(pMac->lim.gpSession[i].LimHBFailureStatus == eANI_BOOLEAN_TRUE)
6973 {
6974 /* Activate Probe After HeartBeat Timer incase HB Failure detected */
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006975 PELOGW(limLog(pMac, LOGW,FL("Sending Probe for Session: %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07006976 i);)
6977 limDeactivateAndChangeTimer(pMac, eLIM_PROBE_AFTER_HB_TIMER);
6978 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, 0, eLIM_PROBE_AFTER_HB_TIMER));
6979 if (tx_timer_activate(&pMac->lim.limTimers.gLimProbeAfterHBTimer) != TX_SUCCESS)
6980 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006981 limLog(pMac, LOGP, FL("Fail to re-activate Probe-after-heartbeat timer"));
Jeff Johnson295189b2012-06-20 16:38:30 -07006982 limReactivateHeartBeatTimer(pMac, &pMac->lim.gpSession[i]);
6983 }
6984 break;
6985 }
6986 }
6987 }
6988 }
6989}
6990
Leela Venkata Kiran Kumar Reddy Chirala3ca17902013-02-27 19:50:05 -08006991void limHandleHeartBeatTimeoutForSession(tpAniSirGlobal pMac, tpPESession psessionEntry)
6992{
6993 if(psessionEntry->valid == TRUE )
6994 {
6995 if(psessionEntry->bssType == eSIR_IBSS_MODE)
6996 {
6997 limIbssHeartBeatHandle(pMac,psessionEntry);
6998 }
6999 if((psessionEntry->bssType == eSIR_INFRASTRUCTURE_MODE) &&
7000 (psessionEntry->limSystemRole == eLIM_STA_ROLE))
7001 {
7002 limHandleHeartBeatFailure(pMac,psessionEntry);
7003 }
7004 }
7005 /* In the function limHandleHeartBeatFailure things can change so check for the session entry valid
7006 and the other things again */
7007 if(psessionEntry->valid == TRUE )
7008 {
7009 if((psessionEntry->bssType == eSIR_INFRASTRUCTURE_MODE) &&
7010 (psessionEntry->limSystemRole == eLIM_STA_ROLE))
7011 {
7012 if(psessionEntry->LimHBFailureStatus == eANI_BOOLEAN_TRUE)
7013 {
7014 /* Activate Probe After HeartBeat Timer incase HB Failure detected */
7015 PELOGW(limLog(pMac, LOGW,FL("Sending Probe for Session: %d"),
7016 psessionEntry->bssIdx);)
7017 limDeactivateAndChangeTimer(pMac, eLIM_PROBE_AFTER_HB_TIMER);
7018 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, 0, eLIM_PROBE_AFTER_HB_TIMER));
7019 if (tx_timer_activate(&pMac->lim.limTimers.gLimProbeAfterHBTimer) != TX_SUCCESS)
7020 {
7021 limLog(pMac, LOGP, FL("Fail to re-activate Probe-after-heartbeat timer"));
7022 limReactivateHeartBeatTimer(pMac, psessionEntry);
7023 }
7024 }
7025 }
7026 }
7027}
7028
7029
Jeff Johnson295189b2012-06-20 16:38:30 -07007030tANI_U8 limGetCurrentOperatingChannel(tpAniSirGlobal pMac)
7031{
7032 tANI_U8 i;
7033 for(i =0;i < pMac->lim.maxBssId;i++)
7034 {
7035 if(pMac->lim.gpSession[i].valid == TRUE )
7036 {
7037 if((pMac->lim.gpSession[i].bssType == eSIR_INFRASTRUCTURE_MODE) &&
7038 (pMac->lim.gpSession[i].limSystemRole == eLIM_STA_ROLE))
7039 {
7040 return pMac->lim.gpSession[i].currentOperChannel;
7041 }
7042 }
7043 }
7044 return 0;
7045}
7046
7047void limProcessAddStaRsp(tpAniSirGlobal pMac,tpSirMsgQ limMsgQ)
7048{
7049
7050 tpPESession psessionEntry;
7051// tANI_U8 sessionId;
7052 tpAddStaParams pAddStaParams;
7053
7054 pAddStaParams = (tpAddStaParams)limMsgQ->bodyptr;
7055
7056 if((psessionEntry = peFindSessionBySessionId(pMac,pAddStaParams->sessionId))==NULL)
7057 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007058 limLog(pMac, LOGP,FL("Session Does not exist for given sessionID"));
Jeff Johnsone7245742012-09-05 17:12:55 -07007059 palFreeMemory(pMac, pAddStaParams);
Jeff Johnson295189b2012-06-20 16:38:30 -07007060 return;
7061 }
7062 if (psessionEntry->limSystemRole == eLIM_STA_IN_IBSS_ROLE)
7063 (void) limIbssAddStaRsp(pMac, limMsgQ->bodyptr,psessionEntry);
Mohit Khanna698ba2a2012-12-04 15:08:18 -08007064#ifdef FEATURE_WLAN_TDLS
7065 else if(pMac->lim.gLimAddStaTdls)
7066 {
7067 limProcessTdlsAddStaRsp(pMac, limMsgQ->bodyptr, psessionEntry) ;
7068 pMac->lim.gLimAddStaTdls = FALSE ;
7069 }
7070#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07007071 else
7072 limProcessMlmAddStaRsp(pMac, limMsgQ,psessionEntry);
7073
7074}
7075
7076
7077void limUpdateBeacon(tpAniSirGlobal pMac)
7078{
7079 tANI_U8 i;
7080
7081 for(i =0;i < pMac->lim.maxBssId;i++)
7082 {
7083 if(pMac->lim.gpSession[i].valid == TRUE )
7084 {
7085 if( ( (pMac->lim.gpSession[i].limSystemRole == eLIM_AP_ROLE) ||
7086 (pMac->lim.gpSession[i].limSystemRole == eLIM_STA_IN_IBSS_ROLE) )
7087 && (eLIM_SME_NORMAL_STATE == pMac->lim.gpSession[i].limSmeState)
7088 )
7089 {
7090 schSetFixedBeaconFields(pMac,&pMac->lim.gpSession[i]);
7091 limSendBeaconInd(pMac, &pMac->lim.gpSession[i]);
7092 }
7093 else
7094 {
7095 if( (pMac->lim.gpSession[i].limSystemRole == eLIM_BT_AMP_AP_ROLE)||
7096 (pMac->lim.gpSession[i].limSystemRole == eLIM_BT_AMP_STA_ROLE))
7097 {
7098
7099 if(pMac->lim.gpSession[i].statypeForBss == STA_ENTRY_SELF)
7100 {
7101 schSetFixedBeaconFields(pMac,&pMac->lim.gpSession[i]);
7102 }
7103 }
7104 }
7105 }
7106 }
7107}
7108
7109void limHandleHeartBeatFailureTimeout(tpAniSirGlobal pMac)
7110{
7111 tANI_U8 i;
7112 tpPESession psessionEntry;
7113 /* Probe response is not received after HB failure. This is handled by LMM sub module. */
7114 for(i =0; i < pMac->lim.maxBssId; i++)
7115 {
7116 if(pMac->lim.gpSession[i].valid == TRUE)
7117 {
7118 psessionEntry = &pMac->lim.gpSession[i];
7119 if(psessionEntry->LimHBFailureStatus == eANI_BOOLEAN_TRUE)
7120 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007121 limLog(pMac, LOGE, FL("Probe_hb_failure: SME %d, MLME %d, HB-Count %d"),psessionEntry->limSmeState,
Jeff Johnson295189b2012-06-20 16:38:30 -07007122 psessionEntry->limMlmState, psessionEntry->LimRxedBeaconCntDuringHB);
7123 if (psessionEntry->limMlmState == eLIM_MLM_LINK_ESTABLISHED_STATE)
7124 {
7125 if (!LIM_IS_CONNECTION_ACTIVE(psessionEntry))
7126 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007127 limLog(pMac, LOGE, FL("Probe_hb_failure: for session:%d " ),psessionEntry->peSessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07007128 /* AP did not respond to Probe Request. Tear down link with it.*/
7129 limTearDownLinkWithAp(pMac,
7130 psessionEntry->peSessionId,
7131 eSIR_BEACON_MISSED);
7132 pMac->lim.gLimProbeFailureAfterHBfailedCnt++ ;
7133 }
7134 else // restart heartbeat timer
7135 {
7136 limReactivateHeartBeatTimer(pMac, psessionEntry);
7137 }
7138 }
7139 else
7140 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007141 limLog(pMac, LOGE, FL("Unexpected wt-probe-timeout in state "));
Jeff Johnson295189b2012-06-20 16:38:30 -07007142 limPrintMlmState(pMac, LOGE, psessionEntry->limMlmState);
7143 limReactivateHeartBeatTimer(pMac, psessionEntry);
7144 }
7145
7146 }
7147 }
7148 }
7149 /* Deactivate Timer ProbeAfterHB Timer -> As its a oneshot timer, need not deactivate the timer */
7150 // tx_timer_deactivate(&pMac->lim.limTimers.gLimProbeAfterHBTimer);
7151}
7152
7153
7154/*
7155* This function assumes there will not be more than one IBSS session active at any time.
7156*/
7157tpPESession limIsIBSSSessionActive(tpAniSirGlobal pMac)
7158{
7159 tANI_U8 i;
7160
7161 for(i =0;i < pMac->lim.maxBssId;i++)
7162 {
7163 if( (pMac->lim.gpSession[i].valid) &&
7164 (pMac->lim.gpSession[i].limSystemRole == eLIM_STA_IN_IBSS_ROLE))
7165 return (&pMac->lim.gpSession[i]);
7166 }
7167
7168 return NULL;
7169}
7170
7171tpPESession limIsApSessionActive(tpAniSirGlobal pMac)
7172{
7173 tANI_U8 i;
7174
7175 for(i =0;i < pMac->lim.maxBssId;i++)
7176 {
7177 if( (pMac->lim.gpSession[i].valid) &&
7178 ( (pMac->lim.gpSession[i].limSystemRole == eLIM_AP_ROLE) ||
7179 (pMac->lim.gpSession[i].limSystemRole == eLIM_BT_AMP_AP_ROLE)))
7180 return (&pMac->lim.gpSession[i]);
7181 }
7182
7183 return NULL;
7184}
7185
7186/**---------------------------------------------------------
7187\fn limHandleDeferMsgError
7188\brief handles error scenario, when the msg can not be deferred.
7189\param pMac
7190\param pLimMsg LIM msg, which could not be deferred.
7191\return void
7192-----------------------------------------------------------*/
7193
7194void limHandleDeferMsgError(tpAniSirGlobal pMac, tpSirMsgQ pLimMsg)
7195{
7196 if(SIR_BB_XPORT_MGMT_MSG == pLimMsg->type)
7197 {
7198 vos_pkt_return_packet((vos_pkt_t*)pLimMsg->bodyptr);
7199 }
7200 else if(pLimMsg->bodyptr != NULL)
7201 palFreeMemory( pMac->hHdd, (tANI_U8 *) pLimMsg->bodyptr);
7202
7203}
7204
7205
7206#ifdef FEATURE_WLAN_DIAG_SUPPORT
7207/**---------------------------------------------------------
7208\fn limDiagEventReport
7209\brief This function reports Diag event
7210\param pMac
7211\param eventType
7212\param bssid
7213\param status
7214\param reasonCode
7215\return void
7216-----------------------------------------------------------*/
7217void limDiagEventReport(tpAniSirGlobal pMac, tANI_U16 eventType, tpPESession pSessionEntry, tANI_U16 status, tANI_U16 reasonCode)
7218{
7219 tSirMacAddr nullBssid = { 0, 0, 0, 0, 0, 0 };
7220 WLAN_VOS_DIAG_EVENT_DEF(peEvent, vos_event_wlan_pe_payload_type);
7221
7222 palZeroMemory(pMac->hHdd, &peEvent, sizeof(vos_event_wlan_pe_payload_type));
7223
7224 if (NULL == pSessionEntry)
7225 {
7226 palCopyMemory(pMac->hHdd, peEvent.bssid, nullBssid, sizeof(tSirMacAddr));
7227 peEvent.sme_state = (tANI_U16)pMac->lim.gLimSmeState;
7228 peEvent.mlm_state = (tANI_U16)pMac->lim.gLimMlmState;
7229
7230 }
7231 else
7232 {
7233 palCopyMemory(pMac->hHdd, peEvent.bssid, pSessionEntry->bssId, sizeof(tSirMacAddr));
7234 peEvent.sme_state = (tANI_U16)pSessionEntry->limSmeState;
7235 peEvent.mlm_state = (tANI_U16)pSessionEntry->limMlmState;
7236 }
7237 peEvent.event_type = eventType;
7238 peEvent.status = status;
7239 peEvent.reason_code = reasonCode;
7240
7241 WLAN_VOS_DIAG_EVENT_REPORT(&peEvent, EVENT_WLAN_PE);
7242 return;
7243}
7244
7245#endif /* FEATURE_WLAN_DIAG_SUPPORT */
7246
7247void limProcessAddStaSelfRsp(tpAniSirGlobal pMac,tpSirMsgQ limMsgQ)
7248{
7249
7250 tpAddStaSelfParams pAddStaSelfParams;
7251 tSirMsgQ mmhMsg;
7252 tpSirSmeAddStaSelfRsp pRsp;
7253
7254
7255 pAddStaSelfParams = (tpAddStaSelfParams)limMsgQ->bodyptr;
7256
7257 if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&pRsp, sizeof(tSirSmeAddStaSelfRsp)))
7258 {
7259 /// Buffer not available. Log error
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007260 limLog(pMac, LOGP, FL("call to palAllocateMemory failed for Add Sta self RSP"));
Jeff Johnsone7245742012-09-05 17:12:55 -07007261 palFreeMemory( pMac->hHdd, (tANI_U8 *)pAddStaSelfParams);
Jeff Johnson295189b2012-06-20 16:38:30 -07007262 return;
7263 }
7264
7265 palZeroMemory(pMac, (tANI_U8*)pRsp, sizeof(tSirSmeAddStaSelfRsp));
7266
7267 pRsp->mesgType = eWNI_SME_ADD_STA_SELF_RSP;
7268 pRsp->mesgLen = (tANI_U16) sizeof(tSirSmeAddStaSelfRsp);
7269 pRsp->status = pAddStaSelfParams->status;
7270
7271 palCopyMemory( pMac->hHdd, pRsp->selfMacAddr, pAddStaSelfParams->selfMacAddr, sizeof(tSirMacAddr) );
7272
7273 palFreeMemory( pMac->hHdd, (tANI_U8 *)pAddStaSelfParams);
7274
7275 mmhMsg.type = eWNI_SME_ADD_STA_SELF_RSP;
7276 mmhMsg.bodyptr = pRsp;
7277 mmhMsg.bodyval = 0;
Jeff Johnsone7245742012-09-05 17:12:55 -07007278 MTRACE(macTraceMsgTx(pMac, NO_SESSION, mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07007279 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
7280
7281}
7282
7283void limProcessDelStaSelfRsp(tpAniSirGlobal pMac,tpSirMsgQ limMsgQ)
7284{
7285
7286 tpDelStaSelfParams pDelStaSelfParams;
7287 tSirMsgQ mmhMsg;
7288 tpSirSmeDelStaSelfRsp pRsp;
7289
7290
7291 pDelStaSelfParams = (tpDelStaSelfParams)limMsgQ->bodyptr;
7292
7293 if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&pRsp, sizeof(tSirSmeDelStaSelfRsp)))
7294 {
7295 /// Buffer not available. Log error
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007296 limLog(pMac, LOGP, FL("call to palAllocateMemory failed for Add Sta self RSP"));
Jeff Johnsone7245742012-09-05 17:12:55 -07007297 palFreeMemory( pMac->hHdd, (tANI_U8 *)pDelStaSelfParams);
Jeff Johnson295189b2012-06-20 16:38:30 -07007298 return;
7299 }
7300
7301 palZeroMemory(pMac, (tANI_U8*)pRsp, sizeof(tSirSmeDelStaSelfRsp));
7302
7303 pRsp->mesgType = eWNI_SME_DEL_STA_SELF_RSP;
7304 pRsp->mesgLen = (tANI_U16) sizeof(tSirSmeDelStaSelfRsp);
7305 pRsp->status = pDelStaSelfParams->status;
7306
7307 palCopyMemory( pMac->hHdd, pRsp->selfMacAddr, pDelStaSelfParams->selfMacAddr, sizeof(tSirMacAddr) );
7308
7309 palFreeMemory( pMac->hHdd, (tANI_U8 *)pDelStaSelfParams);
7310
7311 mmhMsg.type = eWNI_SME_DEL_STA_SELF_RSP;
7312 mmhMsg.bodyptr = pRsp;
7313 mmhMsg.bodyval = 0;
Jeff Johnsone7245742012-09-05 17:12:55 -07007314 MTRACE(macTraceMsgTx(pMac, NO_SESSION, mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07007315 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
7316
7317}
7318
7319/***************************************************************
7320* tANI_U8 limUnmapChannel(tANI_U8 mapChannel)
7321* To unmap the channel to reverse the effect of mapping
7322* a band channel in hal .Mapping was done hal to overcome the
7323* limitation of the rxbd which use only 4 bit for channel number.
7324*****************************************************************/
7325tANI_U8 limUnmapChannel(tANI_U8 mapChannel)
7326{
7327 if( mapChannel > 0 && mapChannel < 25 )
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07007328#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
7329 if (IS_ROAM_SCAN_OFFLOAD_FEATURE_ENABLE)
7330 return aUnsortedChannelList[mapChannel -1];
7331 else
7332#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07007333 return abChannel[mapChannel -1];
7334 else
7335 return 0;
7336}
7337
7338
7339v_U8_t* limGetIEPtr(tpAniSirGlobal pMac, v_U8_t *pIes, int length, v_U8_t eid,eSizeOfLenField size_of_len_field)
7340{
7341 int left = length;
7342 v_U8_t *ptr = pIes;
7343 v_U8_t elem_id;
7344 v_U16_t elem_len;
7345
7346 while(left >= (size_of_len_field+1))
7347 {
7348 elem_id = ptr[0];
7349 if (size_of_len_field == TWO_BYTE)
7350 {
7351 elem_len = ((v_U16_t) ptr[1]) | (ptr[2]<<8);
7352 }
7353 else
7354 {
7355 elem_len = ptr[1];
7356 }
7357
7358
7359 left -= (size_of_len_field+1);
7360 if(elem_len > left)
7361 {
7362 limLog(pMac, LOGE,
Madan Mohan Koyyalamudi8bdd3112012-09-24 13:55:14 -07007363 FL("****Invalid IEs eid = %d elem_len=%d left=%d*****"),
Jeff Johnson295189b2012-06-20 16:38:30 -07007364 eid,elem_len,left);
7365 return NULL;
7366 }
7367 if (elem_id == eid)
7368 {
7369 return ptr;
7370 }
7371
7372 left -= elem_len;
7373 ptr += (elem_len + (size_of_len_field+1));
7374 }
7375 return NULL;
7376}
7377
7378/* return NULL if oui is not found in ie
7379 return !NULL pointer to vendor IE (starting from 0xDD) if oui is found
7380 */
7381v_U8_t* limGetVendorIEOuiPtr(tpAniSirGlobal pMac, tANI_U8 *oui, tANI_U8 oui_size, tANI_U8 *ie, tANI_U16 ie_len)
7382{
7383 int left = ie_len;
7384 v_U8_t *ptr = ie;
7385 v_U8_t elem_id, elem_len;
7386
7387 while(left >= 2)
7388 {
7389 elem_id = ptr[0];
7390 elem_len = ptr[1];
7391 left -= 2;
7392 if(elem_len > left)
7393 {
7394 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007395 FL("****Invalid IEs eid = %d elem_len=%d left=%d*****"),
Jeff Johnson295189b2012-06-20 16:38:30 -07007396 elem_id,elem_len,left);
7397 return NULL;
7398 }
7399 if (SIR_MAC_EID_VENDOR == elem_id)
7400 {
7401 if(memcmp(&ptr[2], oui, oui_size)==0)
7402 return ptr;
7403 }
7404
7405 left -= elem_len;
7406 ptr += (elem_len + 2);
7407 }
7408 return NULL;
7409}
7410
Jeff Johnson295189b2012-06-20 16:38:30 -07007411//Returns length of P2P stream and Pointer ie passed to this function is filled with noa stream
7412
7413v_U8_t limBuildP2pIe(tpAniSirGlobal pMac, tANI_U8 *ie, tANI_U8 *data, tANI_U8 ie_len)
7414{
7415 int length = 0;
7416 tANI_U8 *ptr = ie;
7417
7418 ptr[length++] = SIR_MAC_EID_VENDOR;
7419 ptr[length++] = ie_len + SIR_MAC_P2P_OUI_SIZE;
7420 palCopyMemory( pMac->hHdd, &ptr[length], SIR_MAC_P2P_OUI, SIR_MAC_P2P_OUI_SIZE);
7421 palCopyMemory( pMac->hHdd, &ptr[length + SIR_MAC_P2P_OUI_SIZE], data, ie_len);
7422 return (ie_len + SIR_P2P_IE_HEADER_LEN);
7423}
7424
7425//Returns length of NoA stream and Pointer pNoaStream passed to this function is filled with noa stream
7426
7427v_U8_t limGetNoaAttrStreamInMultP2pIes(tpAniSirGlobal pMac,v_U8_t* noaStream,v_U8_t noaLen,v_U8_t overFlowLen)
7428{
7429 v_U8_t overFlowP2pStream[SIR_MAX_NOA_ATTR_LEN];
Krunal Sonic768a932013-05-15 19:26:30 -07007430
7431 if ((noaLen <= (SIR_MAX_NOA_ATTR_LEN+SIR_P2P_IE_HEADER_LEN)) &&
7432 (noaLen >= overFlowLen) && (overFlowLen <= SIR_MAX_NOA_ATTR_LEN))
7433 {
7434 palCopyMemory( pMac->hHdd, overFlowP2pStream,
7435 noaStream + noaLen - overFlowLen, overFlowLen);
7436 noaStream[noaLen - overFlowLen] = SIR_MAC_EID_VENDOR;
7437 noaStream[noaLen - overFlowLen + 1] = overFlowLen + SIR_MAC_P2P_OUI_SIZE;
7438 palCopyMemory( pMac->hHdd, noaStream+noaLen-overFlowLen + 2,
7439 SIR_MAC_P2P_OUI, SIR_MAC_P2P_OUI_SIZE);
7440 palCopyMemory( pMac->hHdd,
7441 noaStream+noaLen + 2 + SIR_MAC_P2P_OUI_SIZE - overFlowLen,
7442 overFlowP2pStream, overFlowLen);
7443 }
7444
Jeff Johnson295189b2012-06-20 16:38:30 -07007445 return (noaLen + SIR_P2P_IE_HEADER_LEN);
7446
7447}
7448
7449//Returns length of NoA stream and Pointer pNoaStream passed to this function is filled with noa stream
7450v_U8_t limGetNoaAttrStream(tpAniSirGlobal pMac, v_U8_t*pNoaStream,tpPESession psessionEntry)
7451{
7452 v_U8_t len=0;
7453
7454 v_U8_t *pBody = pNoaStream;
7455
7456
7457 if ( (psessionEntry != NULL) && (psessionEntry->valid) &&
7458 (psessionEntry->pePersona == VOS_P2P_GO_MODE))
7459 {
7460 if ((!(psessionEntry->p2pGoPsUpdate.uNoa1Duration)) && (!(psessionEntry->p2pGoPsUpdate.uNoa2Duration))
7461 && (!psessionEntry->p2pGoPsUpdate.oppPsFlag)
7462 )
7463 return 0; //No NoA Descriptor then return 0
7464
7465
7466 pBody[0] = SIR_P2P_NOA_ATTR;
7467
7468 pBody[3] = psessionEntry->p2pGoPsUpdate.index;
7469 pBody[4] = psessionEntry->p2pGoPsUpdate.ctWin | (psessionEntry->p2pGoPsUpdate.oppPsFlag<<7);
7470 len = 5;
7471 pBody += len;
7472
7473
7474 if (psessionEntry->p2pGoPsUpdate.uNoa1Duration)
7475 {
7476 *pBody = psessionEntry->p2pGoPsUpdate.uNoa1IntervalCnt;
7477 pBody += 1;
7478 len +=1;
7479
7480 *((tANI_U32 *)(pBody)) = sirSwapU32ifNeeded(psessionEntry->p2pGoPsUpdate.uNoa1Duration);
7481 pBody += sizeof(tANI_U32);
7482 len +=4;
7483
7484 *((tANI_U32 *)(pBody)) = sirSwapU32ifNeeded(psessionEntry->p2pGoPsUpdate.uNoa1Interval);
7485 pBody += sizeof(tANI_U32);
7486 len +=4;
7487
7488 *((tANI_U32 *)(pBody)) = sirSwapU32ifNeeded(psessionEntry->p2pGoPsUpdate.uNoa1StartTime);
7489 pBody += sizeof(tANI_U32);
7490 len +=4;
7491
7492 }
7493
7494 if (psessionEntry->p2pGoPsUpdate.uNoa2Duration)
7495 {
7496 *pBody = psessionEntry->p2pGoPsUpdate.uNoa2IntervalCnt;
7497 pBody += 1;
7498 len +=1;
7499
7500 *((tANI_U32 *)(pBody)) = sirSwapU32ifNeeded(psessionEntry->p2pGoPsUpdate.uNoa2Duration);
7501 pBody += sizeof(tANI_U32);
7502 len +=4;
7503
7504 *((tANI_U32 *)(pBody)) = sirSwapU32ifNeeded(psessionEntry->p2pGoPsUpdate.uNoa2Interval);
7505 pBody += sizeof(tANI_U32);
7506 len +=4;
7507
7508 *((tANI_U32 *)(pBody)) = sirSwapU32ifNeeded(psessionEntry->p2pGoPsUpdate.uNoa2StartTime);
7509 pBody += sizeof(tANI_U32);
7510 len +=4;
7511
7512 }
7513
7514
7515 pBody = pNoaStream + 1;
7516 *((tANI_U16 *)(pBody)) = sirSwapU16ifNeeded(len-3);/*one byte for Attr and 2 bytes for length*/
7517
7518 return (len);
7519
7520 }
7521 return 0;
7522
7523}
Jeff Johnsone7245742012-09-05 17:12:55 -07007524
7525void peSetResumeChannel(tpAniSirGlobal pMac, tANI_U16 channel, ePhyChanBondState phyCbState)
Jeff Johnson295189b2012-06-20 16:38:30 -07007526{
7527
7528 pMac->lim.gResumeChannel = channel;
Jeff Johnsone7245742012-09-05 17:12:55 -07007529 pMac->lim.gResumePhyCbState = phyCbState;
Jeff Johnson295189b2012-06-20 16:38:30 -07007530}
Jeff Johnsone7245742012-09-05 17:12:55 -07007531
Jeff Johnson295189b2012-06-20 16:38:30 -07007532/*--------------------------------------------------------------------------
7533
7534 \brief peGetResumeChannel() - Returns the channel number for scanning, from a valid session.
7535
Jeff Johnsone7245742012-09-05 17:12:55 -07007536 This function returns the channel to resume to during link resume. channel id of 0 means HAL will
7537 resume to previous channel before link suspend
Jeff Johnson295189b2012-06-20 16:38:30 -07007538
7539 \param pMac - pointer to global adapter context
7540 \return - channel to scan from valid session else zero.
7541
7542 \sa
7543
7544 --------------------------------------------------------------------------*/
Jeff Johnsone7245742012-09-05 17:12:55 -07007545void peGetResumeChannel(tpAniSirGlobal pMac, tANI_U8* resumeChannel, ePhyChanBondState* resumePhyCbState)
Jeff Johnson295189b2012-06-20 16:38:30 -07007546{
7547
7548 //Rationale - this could be the suspend/resume for assoc and it is essential that
7549 //the new BSS is active for some time. Other BSS was anyway suspended.
7550 //TODO: Comeup with a better alternative. Sending NULL with PM=0 on other BSS means
7551 //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 -07007552 //and hence should be ok. Need to discuss this further
7553 if( !limIsInMCC(pMac) )
Jeff Johnson295189b2012-06-20 16:38:30 -07007554 {
7555 //Get current active session channel
Jeff Johnsone7245742012-09-05 17:12:55 -07007556 peGetActiveSessionChannel(pMac, resumeChannel, resumePhyCbState);
Jeff Johnson295189b2012-06-20 16:38:30 -07007557 }
7558 else
7559 {
Jeff Johnsone7245742012-09-05 17:12:55 -07007560 *resumeChannel = pMac->lim.gResumeChannel;
7561 *resumePhyCbState = pMac->lim.gResumePhyCbState;
Jeff Johnson295189b2012-06-20 16:38:30 -07007562 }
Jeff Johnsone7245742012-09-05 17:12:55 -07007563 return;
Jeff Johnson295189b2012-06-20 16:38:30 -07007564}
7565
Viral Modid86bde22012-12-10 13:09:21 -08007566tANI_BOOLEAN limIsNOAInsertReqd(tpAniSirGlobal pMac)
7567{
7568 tANI_U8 i;
7569 for(i =0; i < pMac->lim.maxBssId; i++)
7570 {
7571 if(pMac->lim.gpSession[i].valid == TRUE)
7572 {
7573 if( (eLIM_AP_ROLE == pMac->lim.gpSession[i].limSystemRole )
7574 && ( VOS_P2P_GO_MODE == pMac->lim.gpSession[i].pePersona )
7575 )
7576 {
7577 return TRUE;
7578 }
7579 }
7580 }
7581 return FALSE;
7582}
Jeff Johnsone7245742012-09-05 17:12:55 -07007583
Jeff Johnson295189b2012-06-20 16:38:30 -07007584
7585tANI_BOOLEAN limIsconnectedOnDFSChannel(tANI_U8 currentChannel)
7586{
7587 if(NV_CHANNEL_DFS == vos_nv_getChannelEnabledState(currentChannel))
7588 {
7589 return eANI_BOOLEAN_TRUE;
7590 }
7591 else
7592 {
7593 return eANI_BOOLEAN_FALSE;
7594 }
7595}
Madan Mohan Koyyalamudi1bed5982012-10-22 14:38:06 -07007596
Mohit Khanna4a70d262012-09-11 16:30:12 -07007597#ifdef WLAN_FEATURE_11AC
7598tANI_BOOLEAN limCheckVHTOpModeChange( tpAniSirGlobal pMac, tpPESession psessionEntry, tANI_U8 chanWidth, tANI_U8 staId)
7599{
7600 tUpdateVHTOpMode tempParam;
7601
7602 tempParam.opMode = chanWidth;
7603 tempParam.staId = staId;
7604
7605 limSendModeUpdate( pMac, &tempParam, psessionEntry );
7606
7607 return eANI_BOOLEAN_TRUE;
7608}
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -07007609#endif
7610
7611tANI_U8 limGetShortSlotFromPhyMode(tpAniSirGlobal pMac, tpPESession psessionEntry, tANI_U32 phyMode)
7612{
7613 tANI_U8 val=0;
7614
7615 if (phyMode == WNI_CFG_PHY_MODE_11A)
7616 {
7617 // 11a mode always uses short slot
7618 // Check this since some APs in 11a mode broadcast long slot in their beacons. As per standard, always use what PHY mandates.
7619 val = true;
7620 }
7621 else if (phyMode == WNI_CFG_PHY_MODE_11G)
7622 {
7623 if ((psessionEntry->pePersona == VOS_STA_SAP_MODE) ||
7624 (psessionEntry->pePersona == VOS_P2P_GO_MODE))
7625 {
7626 val = true;
7627 }
7628
7629 // Program Polaris based on AP capability
7630
7631 if (psessionEntry->limMlmState == eLIM_MLM_WT_JOIN_BEACON_STATE)
7632 // Joining BSS.
7633 val = SIR_MAC_GET_SHORT_SLOT_TIME( psessionEntry->limCurrentBssCaps);
7634 else if (psessionEntry->limMlmState == eLIM_MLM_WT_REASSOC_RSP_STATE)
7635 // Reassociating with AP.
7636 val = SIR_MAC_GET_SHORT_SLOT_TIME( psessionEntry->limReassocBssCaps);
7637 }
7638 else // if (phyMode == WNI_CFG_PHY_MODE_11B) - use this if another phymode is added later ON
7639 {
7640 // Will reach here in 11b case
7641 val = false;
7642 }
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007643 limLog(pMac, LOG1, FL("phyMode = %u shortslotsupported = %u"), phyMode, val);
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -07007644 return val;
7645}