blob: 52f06d65d4f221a4a3e800c9b9b8e2e44fb0289c [file] [log] [blame]
Jeff Johnson295189b2012-06-20 16:38:30 -07001/*
Manjunathappa Prakasheb5a3a32014-02-13 19:57:55 -08002 * Copyright (c) 2012-2014 The Linux Foundation. All rights reserved.
Kiet Lam842dad02014-02-18 18:44:02 -08003 *
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.
Gopichand Nakkala92f07d82013-01-08 21:16:34 -080020 */
Kiet Lam842dad02014-02-18 18:44:02 -080021
Gopichand Nakkala92f07d82013-01-08 21:16:34 -080022/*
Kiet Lam842dad02014-02-18 18:44:02 -080023 * This file was originally distributed by Qualcomm Atheros, Inc.
24 * under proprietary terms before Copyright ownership was assigned
25 * to the Linux Foundation.
26 */
27
28/*
Jeff Johnson295189b2012-06-20 16:38:30 -070029 * This file limUtils.cc contains the utility functions
30 * LIM uses.
31 * Author: Chandra Modumudi
32 * Date: 02/13/02
33 * History:-
34 * Date Modified by Modification Information
35 * --------------------------------------------------------------------
36 */
37
38#include "schApi.h"
39#include "limUtils.h"
40#include "limTypes.h"
41#include "limSecurityUtils.h"
42#include "limPropExtsUtils.h"
43#include "limSendMessages.h"
44#include "limSerDesUtils.h"
45#include "limAdmitControl.h"
46#include "limStaHashApi.h"
47#include "dot11f.h"
48#include "wmmApsd.h"
49#include "limTrace.h"
Jeff Johnson77165482013-03-07 08:15:44 -080050#ifdef FEATURE_WLAN_DIAG_SUPPORT
Jeff Johnson295189b2012-06-20 16:38:30 -070051#include "vos_diag_core_event.h"
52#endif //FEATURE_WLAN_DIAG_SUPPORT
53#include "limIbssPeerMgmt.h"
54#include "limSessionUtils.h"
55#include "limSession.h"
56#include "vos_nvitem.h"
Chet Lanctot8cecea22014-02-11 19:09:36 -080057#ifdef WLAN_FEATURE_11W
58#include "wniCfgAp.h"
59#endif
Jeff Johnson295189b2012-06-20 16:38:30 -070060
61/* Static global used to mark situations where pMac->lim.gLimTriggerBackgroundScanDuringQuietBss is SET
62 * and limTriggerBackgroundScanDuringQuietBss() returned failure. In this case, we will stop data
63 * traffic instead of going into scan. The recover function limProcessQuietBssTimeout() needs to have
64 * this information. */
65static tAniBool glimTriggerBackgroundScanDuringQuietBss_Status = eSIR_TRUE;
66
67/* 11A Channel list to decode RX BD channel information */
68static const tANI_U8 abChannel[]= {36,40,44,48,52,56,60,64,100,104,108,112,116,
Manjunathappa Prakasheb5a3a32014-02-13 19:57:55 -080069 120,124,128,132,136,140,149,153,157,161,165
70#ifdef FEATURE_WLAN_CH144
71 ,144
72#endif
73};
74#define abChannelSize (sizeof(abChannel)/ \
75 sizeof(abChannel[0]))
Jeff Johnson295189b2012-06-20 16:38:30 -070076
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -070077#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
78static const tANI_U8 aUnsortedChannelList[]= {52,56,60,64,100,104,108,112,116,
Manjunathappa Prakasheb5a3a32014-02-13 19:57:55 -080079 120,124,128,132,136,140,36,40,44,48,149,153,157,161,165
80#ifdef FEATURE_WLAN_CH144
81 ,144
82#endif
83};
84#define aUnsortedChannelListSize (sizeof(aUnsortedChannelList)/ \
85 sizeof(aUnsortedChannelList[0]))
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -070086#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
Agarwal Ashish87039eb2014-01-15 14:13:15 +053091#define MAX_BA_WINDOW_SIZE_FOR_CISCO 25
Jeff Johnson295189b2012-06-20 16:38:30 -070092/** -------------------------------------------------------------
93\fn limAssignDialogueToken
94\brief Assigns dialogue token.
95\param tpAniSirGlobal pMac
96\return tpDialogueToken - dialogueToken data structure.
97 -------------------------------------------------------------*/
98
99tpDialogueToken
100limAssignDialogueToken(tpAniSirGlobal pMac)
101{
Madan Mohan Koyyalamudidfd6aa82012-10-18 20:18:43 -0700102 static tANI_U8 token;
Jeff Johnson295189b2012-06-20 16:38:30 -0700103 tpDialogueToken pCurrNode;
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530104 pCurrNode = vos_mem_malloc(sizeof(tDialogueToken));
105 if ( NULL == pCurrNode )
Jeff Johnson295189b2012-06-20 16:38:30 -0700106 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530107 PELOGE(limLog(pMac, LOGE, FL("AllocateMemory failed"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700108 return NULL;
109 }
110
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530111 vos_mem_set((void *) pCurrNode, sizeof(tDialogueToken), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -0700112 //first node in the list is being added.
113 if(NULL == pMac->lim.pDialogueTokenHead)
114 {
115 pMac->lim.pDialogueTokenHead = pMac->lim.pDialogueTokenTail = pCurrNode;
116 }
117 else
118 {
119 pMac->lim.pDialogueTokenTail->next = pCurrNode;
120 pMac->lim.pDialogueTokenTail = pCurrNode;
121 }
122 //assocId and tid of the node will be filled in by caller.
123 pCurrNode->next = NULL;
124 pCurrNode->token = token++;
Praveen Kumar Sirisilla539f7422013-08-28 17:01:05 -0700125
126 /* Dialog token should be a non-zero value */
127 if (0 == pCurrNode->token)
128 pCurrNode->token = token;
129
130 PELOG4(limLog(pMac, LOG4, FL("token assigned = %d"), pCurrNode->token);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700131 return pCurrNode;
132}
133
134/** -------------------------------------------------------------
135\fn limSearchAndDeleteDialogueToken
136\brief search dialogue token in the list and deletes it if found. returns failure if not found.
137\param tpAniSirGlobal pMac
138\param tANI_U8 token
139\param tANI_U16 assocId
140\param tANI_U16 tid
141\return eSirRetStatus - status of the search
142 -------------------------------------------------------------*/
143
144
145tSirRetStatus
146limSearchAndDeleteDialogueToken(tpAniSirGlobal pMac, tANI_U8 token, tANI_U16 assocId, tANI_U16 tid)
147{
148 tpDialogueToken pCurrNode = pMac->lim.pDialogueTokenHead;
149 tpDialogueToken pPrevNode = pMac->lim.pDialogueTokenHead;
150
151 //if the list is empty
152 if(NULL == pCurrNode)
153 return eSIR_FAILURE;
154
155 // if the matching node is the first node.
156 if(pCurrNode &&
157 (assocId == pCurrNode->assocId) &&
158 (tid == pCurrNode->tid))
159 {
160 pMac->lim.pDialogueTokenHead = pCurrNode->next;
161 //there was only one node in the list. So tail pointer also needs to be adjusted.
162 if(NULL == pMac->lim.pDialogueTokenHead)
163 pMac->lim.pDialogueTokenTail = NULL;
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530164 vos_mem_free(pCurrNode);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -0800165 pMac->lim.pDialogueTokenHead = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -0700166 return eSIR_SUCCESS;
167 }
168
169 //first node did not match. so move to the next one.
170 pCurrNode = pCurrNode->next;
171 while(NULL != pCurrNode )
172 {
173 if(token == pCurrNode->token)
174 {
175 break;
176 }
177
178 pPrevNode = pCurrNode;
179 pCurrNode = pCurrNode->next;
180 }
181
182 if(pCurrNode &&
183 (assocId == pCurrNode->assocId) &&
184 (tid == pCurrNode->tid))
185 {
186 pPrevNode->next = pCurrNode->next;
187 //if the node being deleted is the last one then we also need to move the tail pointer to the prevNode.
188 if(NULL == pCurrNode->next)
189 pMac->lim.pDialogueTokenTail = pPrevNode;
Kiet Lam842c3e12013-11-16 22:40:57 +0530190 vos_mem_free(pCurrNode);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -0800191 pMac->lim.pDialogueTokenHead = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -0700192 return eSIR_SUCCESS;
193 }
194
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700195 PELOGW(limLog(pMac, LOGW, FL("LIM does not have matching dialogue token node"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700196 return eSIR_FAILURE;
197
198}
199
200
201/** -------------------------------------------------------------
202\fn limDeleteDialogueTokenList
203\brief deletes the complete lim dialogue token linked list.
204\param tpAniSirGlobal pMac
205\return None
206 -------------------------------------------------------------*/
207void
208limDeleteDialogueTokenList(tpAniSirGlobal pMac)
209{
210 tpDialogueToken pCurrNode = pMac->lim.pDialogueTokenHead;
211
212 while(NULL != pMac->lim.pDialogueTokenHead)
213 {
214 pCurrNode = pMac->lim.pDialogueTokenHead;
215 pMac->lim.pDialogueTokenHead = pMac->lim.pDialogueTokenHead->next;
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530216 vos_mem_free(pCurrNode);
Jeff Johnson295189b2012-06-20 16:38:30 -0700217 pCurrNode = NULL;
218 }
219 pMac->lim.pDialogueTokenTail = NULL;
220}
221
222void
223limGetBssidFromBD(tpAniSirGlobal pMac, tANI_U8 * pRxPacketInfo, tANI_U8 *bssId, tANI_U32 *pIgnore)
224{
225 tpSirMacDataHdr3a pMh = WDA_GET_RX_MPDUHEADER3A(pRxPacketInfo);
226 *pIgnore = 0;
227
228 if (pMh->fc.toDS == 1 && pMh->fc.fromDS == 0)
229 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530230 vos_mem_copy( bssId, pMh->addr1, 6);
Jeff Johnson295189b2012-06-20 16:38:30 -0700231 *pIgnore = 1;
232 }
233 else if (pMh->fc.toDS == 0 && pMh->fc.fromDS == 1)
234 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530235 vos_mem_copy ( bssId, pMh->addr2, 6);
Jeff Johnson295189b2012-06-20 16:38:30 -0700236 *pIgnore = 1;
237 }
238 else if (pMh->fc.toDS == 0 && pMh->fc.fromDS == 0)
239 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530240 vos_mem_copy( bssId, pMh->addr3, 6);
Jeff Johnson295189b2012-06-20 16:38:30 -0700241 *pIgnore = 0;
242 }
243 else
244 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530245 vos_mem_copy( bssId, pMh->addr1, 6);
Jeff Johnson295189b2012-06-20 16:38:30 -0700246 *pIgnore = 1;
247 }
248}
249
250char *
251limMlmStateStr(tLimMlmStates state)
252{
Jeff Johnson295189b2012-06-20 16:38:30 -0700253 switch (state)
254 {
255 case eLIM_MLM_OFFLINE_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700256 return "eLIM_MLM_OFFLINE_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700257 case eLIM_MLM_IDLE_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700258 return "eLIM_MLM_IDLE_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700259 case eLIM_MLM_WT_PROBE_RESP_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700260 return "eLIM_MLM_WT_PROBE_RESP_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700261 case eLIM_MLM_PASSIVE_SCAN_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700262 return "eLIM_MLM_PASSIVE_SCAN_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700263 case eLIM_MLM_WT_JOIN_BEACON_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700264 return "eLIM_MLM_WT_JOIN_BEACON_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700265 case eLIM_MLM_JOINED_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700266 return "eLIM_MLM_JOINED_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700267 case eLIM_MLM_BSS_STARTED_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700268 return "eLIM_MLM_BSS_STARTED_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700269 case eLIM_MLM_WT_AUTH_FRAME2_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700270 return "eLIM_MLM_WT_AUTH_FRAME2_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700271 case eLIM_MLM_WT_AUTH_FRAME3_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700272 return "eLIM_MLM_WT_AUTH_FRAME3_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700273 case eLIM_MLM_WT_AUTH_FRAME4_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700274 return "eLIM_MLM_WT_AUTH_FRAME4_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700275 case eLIM_MLM_AUTH_RSP_TIMEOUT_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700276 return "eLIM_MLM_AUTH_RSP_TIMEOUT_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700277 case eLIM_MLM_AUTHENTICATED_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700278 return "eLIM_MLM_AUTHENTICATED_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700279 case eLIM_MLM_WT_ASSOC_RSP_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700280 return "eLIM_MLM_WT_ASSOC_RSP_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700281 case eLIM_MLM_WT_REASSOC_RSP_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700282 return "eLIM_MLM_WT_REASSOC_RSP_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700283 case eLIM_MLM_WT_FT_REASSOC_RSP_STATE:
284 return "eLIM_MLM_WT_FT_REASSOC_RSP_STATE";
285 case eLIM_MLM_WT_DEL_STA_RSP_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700286 return "eLIM_MLM_WT_DEL_STA_RSP_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700287 case eLIM_MLM_WT_DEL_BSS_RSP_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700288 return "eLIM_MLM_WT_DEL_BSS_RSP_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700289 case eLIM_MLM_WT_ADD_STA_RSP_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700290 return "eLIM_MLM_WT_ADD_STA_RSP_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700291 case eLIM_MLM_WT_ADD_BSS_RSP_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700292 return "eLIM_MLM_WT_ADD_BSS_RSP_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700293 case eLIM_MLM_REASSOCIATED_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700294 return "eLIM_MLM_REASSOCIATED_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700295 case eLIM_MLM_LINK_ESTABLISHED_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700296 return "eLIM_MLM_LINK_ESTABLISHED_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700297 case eLIM_MLM_WT_ASSOC_CNF_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700298 return "eLIM_MLM_WT_ASSOC_CNF_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700299 case eLIM_MLM_WT_ADD_BSS_RSP_ASSOC_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700300 return "eLIM_MLM_WT_ADD_BSS_RSP_ASSOC_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700301 case eLIM_MLM_WT_ADD_BSS_RSP_REASSOC_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700302 return "eLIM_MLM_WT_ADD_BSS_RSP_REASSOC_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700303 case eLIM_MLM_WT_ADD_BSS_RSP_FT_REASSOC_STATE:
304 return "eLIM_MLM_WT_ADD_BSS_RSP_FT_REASSOC_STATE";
305 case eLIM_MLM_WT_ASSOC_DEL_STA_RSP_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700306 return "eLIM_MLM_WT_ASSOC_DEL_STA_RSP_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700307 case eLIM_MLM_WT_SET_BSS_KEY_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700308 return "eLIM_MLM_WT_SET_BSS_KEY_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700309 case eLIM_MLM_WT_SET_STA_KEY_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700310 return "eLIM_MLM_WT_SET_STA_KEY_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700311 default:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700312 return "INVALID MLM state";
Jeff Johnson295189b2012-06-20 16:38:30 -0700313 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700314}
315
316void
317limPrintMlmState(tpAniSirGlobal pMac, tANI_U16 logLevel, tLimMlmStates state)
318{
319 limLog(pMac, logLevel, limMlmStateStr(state));
320}
321
322char *
323limSmeStateStr(tLimSmeStates state)
324{
325#ifdef FIXME_GEN6
326 switch (state)
327 {
328 case eLIM_SME_OFFLINE_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700329 return "eLIM_SME_OFFLINE_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700330 case eLIM_SME_IDLE_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700331 return "eLIM_SME_IDLE_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700332 case eLIM_SME_SUSPEND_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700333 return "eLIM_SME_SUSPEND_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700334 case eLIM_SME_WT_SCAN_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700335 return "eLIM_SME_WT_SCAN_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700336 case eLIM_SME_WT_JOIN_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700337 return "eLIM_SME_WT_JOIN_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700338 case eLIM_SME_WT_AUTH_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700339 return "eLIM_SME_WT_AUTH_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700340 case eLIM_SME_WT_ASSOC_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700341 return "eLIM_SME_WT_ASSOC_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700342 case eLIM_SME_WT_REASSOC_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700343 return "eLIM_SME_WT_REASSOC_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700344 case eLIM_SME_WT_REASSOC_LINK_FAIL_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700345 return "eLIM_SME_WT_REASSOC_LINK_FAIL_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700346 case eLIM_SME_JOIN_FAILURE_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700347 return "eLIM_SME_JOIN_FAILURE_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700348 case eLIM_SME_ASSOCIATED_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700349 return "eLIM_SME_ASSOCIATED_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700350 case eLIM_SME_REASSOCIATED_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700351 return "eLIM_SME_REASSOCIATED_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700352 case eLIM_SME_LINK_EST_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700353 return "eLIM_SME_LINK_EST_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700354 case eLIM_SME_LINK_EST_WT_SCAN_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700355 return "eLIM_SME_LINK_EST_WT_SCAN_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700356 case eLIM_SME_WT_PRE_AUTH_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700357 return "eLIM_SME_WT_PRE_AUTH_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700358 case eLIM_SME_WT_DISASSOC_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700359 return "eLIM_SME_WT_DISASSOC_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700360 case eLIM_SME_WT_DEAUTH_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700361 return "eLIM_SME_WT_DEAUTH_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700362 case eLIM_SME_WT_START_BSS_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700363 return "eLIM_SME_WT_START_BSS_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700364 case eLIM_SME_WT_STOP_BSS_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700365 return "eLIM_SME_WT_STOP_BSS_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700366 case eLIM_SME_NORMAL_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700367 return "eLIM_SME_NORMAL_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700368 case eLIM_SME_CHANNEL_SCAN_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700369 return "eLIM_SME_CHANNEL_SCAN_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700370 case eLIM_SME_NORMAL_CHANNEL_SCAN_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700371 return "eLIM_SME_NORMAL_CHANNEL_SCAN_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700372 default:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700373 return "INVALID SME state";
Jeff Johnson295189b2012-06-20 16:38:30 -0700374 }
375#endif
376return "";
377}
378
379
380char* limDot11ModeStr(tpAniSirGlobal pMac, tANI_U8 dot11Mode)
381{
382#ifdef FIXME_GEN6
383
384 switch(dot11Mode)
385 {
386 case WNI_CFG_DOT11_MODE_ALL:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700387 return "ALL";
Jeff Johnson295189b2012-06-20 16:38:30 -0700388 case WNI_CFG_DOT11_MODE_11A:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700389 return "11A";
390 case WNI_CFG_DOT11_MODE_11B:
391 return "11B";
392 case WNI_CFG_DOT11_MODE_11G:
393 return "11G";
394 case WNI_CFG_DOT11_MODE_11N:
395 return "11N";
396 case WNI_CFG_DOT11_MODE_POLARIS:
397 return "Polaris";
398 case WNI_CFG_DOT11_MODE_TITAN:
399 return "Titan";
Jeff Johnson295189b2012-06-20 16:38:30 -0700400 case WNI_CFG_DOT11_MODE_TAURUS:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700401 return "Taurus";
Jeff Johnson295189b2012-06-20 16:38:30 -0700402 default:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700403 return "Invalid Dot11 Mode";
Jeff Johnson295189b2012-06-20 16:38:30 -0700404 }
405#endif
406return "";
407}
408
409
410char* limStaOpRateModeStr(tStaRateMode opRateMode)
411{
412#ifdef FIXME_GEN6
413
414 switch(opRateMode)
415 {
416 case eSTA_TAURUS:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700417 return "Taurus";
Jeff Johnson295189b2012-06-20 16:38:30 -0700418 case eSTA_11a:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700419 return "11A";
420 case eSTA_11b:
421 return "11B";
422 case eSTA_11bg:
423 return "11G";
424 case eSTA_11n:
425 return "11N";
426 case eSTA_POLARIS:
427 return "Polaris";
Jeff Johnson295189b2012-06-20 16:38:30 -0700428 case eSTA_TITAN:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700429 return "Titan";
Jeff Johnson295189b2012-06-20 16:38:30 -0700430 default:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700431 return "Invalid Dot11 Mode";
Jeff Johnson295189b2012-06-20 16:38:30 -0700432 }
433#endif
434return "";
435}
436
437char* limBssTypeStr(tSirBssType bssType)
438{
439 switch(bssType)
440 {
441 case eSIR_INFRASTRUCTURE_MODE:
442 return "eSIR_INFRASTRUCTURE_MODE";
443 case eSIR_IBSS_MODE:
444 return "eSIR_IBSS_MODE";
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700445 case eSIR_BTAMP_STA_MODE:
Jeff Johnson295189b2012-06-20 16:38:30 -0700446 return "eSIR_BTAMP_STA_MODE";
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700447 case eSIR_BTAMP_AP_MODE:
Jeff Johnson295189b2012-06-20 16:38:30 -0700448 return "eSIR_BTAMP_AP_MODE";
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700449 case eSIR_AUTO_MODE:
Jeff Johnson295189b2012-06-20 16:38:30 -0700450 return "eSIR_AUTO_MODE";
451 default:
452 return "Invalid BSS Type";
453 }
454}
455
456void
457limPrintSmeState(tpAniSirGlobal pMac, tANI_U16 logLevel, tLimSmeStates state)
458{
459 limLog(pMac, logLevel, limSmeStateStr(state));
460}
461
462char *limMsgStr(tANI_U32 msgType)
463{
464#ifdef FIXME_GEN6
465 switch (msgType)
466 {
467 case eWNI_SME_START_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700468 return "eWNI_SME_START_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700469 case eWNI_SME_START_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700470 return "eWNI_SME_START_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700471 case eWNI_SME_SYS_READY_IND:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700472 return "eWNI_SME_SYS_READY_IND";
Jeff Johnson295189b2012-06-20 16:38:30 -0700473 case eWNI_SME_SCAN_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700474 return "eWNI_SME_SCAN_REQ";
Jeff Johnsone7245742012-09-05 17:12:55 -0700475#ifdef FEATURE_OEM_DATA_SUPPORT
476 case eWNI_SME_OEM_DATA_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700477 return "eWNI_SME_OEM_DATA_REQ";
Jeff Johnsone7245742012-09-05 17:12:55 -0700478 case eWNI_SME_OEM_DATA_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700479 return "eWNI_SME_OEM_DATA_RSP";
Jeff Johnsone7245742012-09-05 17:12:55 -0700480#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700481 case eWNI_SME_SCAN_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700482 return "eWNI_SME_SCAN_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700483 case eWNI_SME_JOIN_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700484 return "eWNI_SME_JOIN_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700485 case eWNI_SME_JOIN_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700486 return "eWNI_SME_JOIN_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700487 case eWNI_SME_SETCONTEXT_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700488 return "eWNI_SME_SETCONTEXT_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700489 case eWNI_SME_SETCONTEXT_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700490 return "eWNI_SME_SETCONTEXT_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700491 case eWNI_SME_REASSOC_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700492 return "eWNI_SME_REASSOC_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700493 case eWNI_SME_REASSOC_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700494 return "eWNI_SME_REASSOC_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700495 case eWNI_SME_AUTH_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700496 return "eWNI_SME_AUTH_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700497 case eWNI_SME_AUTH_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700498 return "eWNI_SME_AUTH_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700499 case eWNI_SME_DISASSOC_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700500 return "eWNI_SME_DISASSOC_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700501 case eWNI_SME_DISASSOC_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700502 return "eWNI_SME_DISASSOC_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700503 case eWNI_SME_DISASSOC_IND:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700504 return "eWNI_SME_DISASSOC_IND";
Jeff Johnson295189b2012-06-20 16:38:30 -0700505 case eWNI_SME_DISASSOC_CNF:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700506 return "eWNI_SME_DISASSOC_CNF";
Jeff Johnson295189b2012-06-20 16:38:30 -0700507 case eWNI_SME_DEAUTH_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700508 return "eWNI_SME_DEAUTH_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700509 case eWNI_SME_DEAUTH_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700510 return "eWNI_SME_DEAUTH_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700511 case eWNI_SME_DEAUTH_IND:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700512 return "eWNI_SME_DEAUTH_IND";
Jeff Johnson295189b2012-06-20 16:38:30 -0700513 case eWNI_SME_WM_STATUS_CHANGE_NTF:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700514 return "eWNI_SME_WM_STATUS_CHANGE_NTF";
Jeff Johnson295189b2012-06-20 16:38:30 -0700515 case eWNI_SME_START_BSS_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700516 return "eWNI_SME_START_BSS_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700517 case eWNI_SME_START_BSS_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700518 return "eWNI_SME_START_BSS_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700519 case eWNI_SME_AUTH_IND:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700520 return "eWNI_SME_AUTH_IND";
Jeff Johnson295189b2012-06-20 16:38:30 -0700521 case eWNI_SME_ASSOC_IND:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700522 return "eWNI_SME_ASSOC_IND";
Jeff Johnson295189b2012-06-20 16:38:30 -0700523 case eWNI_SME_ASSOC_CNF:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700524 return "eWNI_SME_ASSOC_CNF";
Jeff Johnson295189b2012-06-20 16:38:30 -0700525 case eWNI_SME_REASSOC_IND:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700526 return "eWNI_SME_REASSOC_IND";
Jeff Johnson295189b2012-06-20 16:38:30 -0700527 case eWNI_SME_REASSOC_CNF:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700528 return "eWNI_SME_REASSOC_CNF";
Jeff Johnson295189b2012-06-20 16:38:30 -0700529 case eWNI_SME_SWITCH_CHL_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700530 return "eWNI_SME_SWITCH_CHL_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700531 case eWNI_SME_SWITCH_CHL_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700532 return "eWNI_SME_SWITCH_CHL_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700533 case eWNI_SME_SWITCH_CHL_CB_PRIMARY_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700534 return "eWNI_SME_SWITCH_CHL_CB_PRIMARY_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700535 case eWNI_SME_SWITCH_CHL_CB_SECONDARY_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700536 return "eWNI_SME_SWITCH_CHL_CB_SECONDARY_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700537 case eWNI_SME_STOP_BSS_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700538 return "eWNI_SME_STOP_BSS_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700539 case eWNI_SME_STOP_BSS_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700540 return "eWNI_SME_STOP_BSS_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700541 case eWNI_SME_PROMISCUOUS_MODE_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700542 return "eWNI_SME_PROMISCUOUS_MODE_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700543 case eWNI_SME_PROMISCUOUS_MODE_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700544 return "eWNI_SME_PROMISCUOUS_MODE_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700545 case eWNI_SME_NEIGHBOR_BSS_IND:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700546 return "eWNI_SME_NEIGHBOR_BSS_IND";
Jeff Johnson295189b2012-06-20 16:38:30 -0700547 case eWNI_SME_MEASUREMENT_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700548 return "eWNI_SME_MEASUREMENT_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700549 case eWNI_SME_MEASUREMENT_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700550 return "eWNI_SME_MEASUREMENT_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700551 case eWNI_SME_MEASUREMENT_IND:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700552 return "eWNI_SME_MEASUREMENT_IND";
Jeff Johnson295189b2012-06-20 16:38:30 -0700553 case eWNI_SME_SET_WDS_INFO_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700554 return "eWNI_SME_SET_WDS_INFO_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700555 case eWNI_SME_SET_WDS_INFO_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700556 return "eWNI_SME_SET_WDS_INFO_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700557 case eWNI_SME_WDS_INFO_IND:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700558 return "eWNI_SME_WDS_INFO_IND";
Jeff Johnson295189b2012-06-20 16:38:30 -0700559 case eWNI_SME_DEAUTH_CNF:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700560 return "eWNI_SME_DEAUTH_CNF";
Jeff Johnson295189b2012-06-20 16:38:30 -0700561 case eWNI_SME_MIC_FAILURE_IND:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700562 return "eWNI_SME_MIC_FAILURE_IND";
Jeff Johnson295189b2012-06-20 16:38:30 -0700563 case eWNI_SME_ADDTS_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700564 return "eWNI_SME_ADDTS_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700565 case eWNI_SME_ADDTS_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700566 return "eWNI_SME_ADDTS_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700567 case eWNI_SME_ADDTS_CNF:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700568 return "eWNI_SME_ADDTS_CNF";
Jeff Johnson295189b2012-06-20 16:38:30 -0700569 case eWNI_SME_ADDTS_IND:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700570 return "eWNI_SME_ADDTS_IND";
Jeff Johnson295189b2012-06-20 16:38:30 -0700571 case eWNI_SME_DELTS_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700572 return "eWNI_SME_DELTS_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700573 case eWNI_SME_DELTS_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700574 return "eWNI_SME_DELTS_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700575 case eWNI_SME_DELTS_IND:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700576 return "eWNI_SME_DELTS_IND";
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -0800577#if defined WLAN_FEATURE_VOWIFI_11R || defined FEATURE_WLAN_ESE || defined(FEATURE_WLAN_LFR)
Srinivas Girigowdad34cedb2013-01-25 13:33:11 -0800578 case eWNI_SME_GET_ROAM_RSSI_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700579 return "eWNI_SME_GET_ROAM_RSSI_REQ";
Srinivas Girigowdad34cedb2013-01-25 13:33:11 -0800580 case eWNI_SME_GET_ROAM_RSSI_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700581 return "eWNI_SME_GET_ROAM_RSSI_RSP";
Srinivas Girigowdad34cedb2013-01-25 13:33:11 -0800582#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700583
Jeff Johnson295189b2012-06-20 16:38:30 -0700584 case WDA_SUSPEND_ACTIVITY_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700585 return "WDA_SUSPEND_ACTIVITY_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700586 case SIR_LIM_RETRY_INTERRUPT_MSG:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700587 return "SIR_LIM_RETRY_INTERRUPT_MSG";
Jeff Johnson295189b2012-06-20 16:38:30 -0700588 case SIR_BB_XPORT_MGMT_MSG:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700589 return "SIR_BB_XPORT_MGMT_MSG";
Jeff Johnson295189b2012-06-20 16:38:30 -0700590 case SIR_LIM_INV_KEY_INTERRUPT_MSG:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700591 return "SIR_LIM_INV_KEY_INTERRUPT_MSG";
Jeff Johnson295189b2012-06-20 16:38:30 -0700592 case SIR_LIM_KEY_ID_INTERRUPT_MSG:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700593 return "SIR_LIM_KEY_ID_INTERRUPT_MSG";
Jeff Johnson295189b2012-06-20 16:38:30 -0700594 case SIR_LIM_REPLAY_THRES_INTERRUPT_MSG:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700595 return "SIR_LIM_REPLAY_THRES_INTERRUPT_MSG";
Jeff Johnson295189b2012-06-20 16:38:30 -0700596 case SIR_LIM_MIN_CHANNEL_TIMEOUT:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700597 return "SIR_LIM_MIN_CHANNEL_TIMEOUT";
Jeff Johnson295189b2012-06-20 16:38:30 -0700598 case SIR_LIM_MAX_CHANNEL_TIMEOUT:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700599 return "SIR_LIM_MAX_CHANNEL_TIMEOUT";
Jeff Johnson295189b2012-06-20 16:38:30 -0700600 case SIR_LIM_JOIN_FAIL_TIMEOUT:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700601 return "SIR_LIM_JOIN_FAIL_TIMEOUT";
Jeff Johnson295189b2012-06-20 16:38:30 -0700602 case SIR_LIM_AUTH_FAIL_TIMEOUT:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700603 return "SIR_LIM_AUTH_FAIL_TIMEOUT";
Jeff Johnson295189b2012-06-20 16:38:30 -0700604 case SIR_LIM_AUTH_RSP_TIMEOUT:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700605 return "SIR_LIM_AUTH_RSP_TIMEOUT";
Jeff Johnson295189b2012-06-20 16:38:30 -0700606 case SIR_LIM_ASSOC_FAIL_TIMEOUT:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700607 return "SIR_LIM_ASSOC_FAIL_TIMEOUT";
Jeff Johnson295189b2012-06-20 16:38:30 -0700608 case SIR_LIM_REASSOC_FAIL_TIMEOUT:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700609 return "SIR_LIM_REASSOC_FAIL_TIMEOUT";
Jeff Johnson295189b2012-06-20 16:38:30 -0700610 case SIR_LIM_HEART_BEAT_TIMEOUT:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700611 return "SIR_LIM_HEART_BEAT_TIMEOUT";
Jeff Johnson295189b2012-06-20 16:38:30 -0700612 case SIR_LIM_ADDTS_RSP_TIMEOUT:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700613 return "SIR_LIM_ADDTS_RSP_TIMEOUT";
Jeff Johnson295189b2012-06-20 16:38:30 -0700614 case SIR_LIM_CHANNEL_SCAN_TIMEOUT:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700615 return "SIR_LIM_CHANNEL_SCAN_TIMEOUT";
Jeff Johnson295189b2012-06-20 16:38:30 -0700616 case SIR_LIM_LINK_TEST_DURATION_TIMEOUT:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700617 return "SIR_LIM_LINK_TEST_DURATION_TIMEOUT";
Jeff Johnson295189b2012-06-20 16:38:30 -0700618 case SIR_LIM_HASH_MISS_THRES_TIMEOUT:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700619 return "SIR_LIM_HASH_MISS_THRES_TIMEOUT";
Jeff Johnson295189b2012-06-20 16:38:30 -0700620 case SIR_LIM_KEEPALIVE_TIMEOUT:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700621 return "SIR_LIM_KEEPALIVE_TIMEOUT";
Jeff Johnson295189b2012-06-20 16:38:30 -0700622 case SIR_LIM_UPDATE_OLBC_CACHEL_TIMEOUT:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700623 return "SIR_LIM_UPDATE_OLBC_CACHEL_TIMEOUT";
Jeff Johnson295189b2012-06-20 16:38:30 -0700624 case SIR_LIM_CNF_WAIT_TIMEOUT:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700625 return "SIR_LIM_CNF_WAIT_TIMEOUT";
Jeff Johnson295189b2012-06-20 16:38:30 -0700626 case SIR_LIM_RADAR_DETECT_IND:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700627 return "SIR_LIM_RADAR_DETECT_IND";
Jeff Johnson295189b2012-06-20 16:38:30 -0700628#ifdef WLAN_FEATURE_VOWIFI_11R
629 case SIR_LIM_FT_PREAUTH_RSP_TIMEOUT:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700630 return "SIR_LIM_FT_PREAUTH_RSP_TIMEOUT";
Jeff Johnson295189b2012-06-20 16:38:30 -0700631#endif
632
633 case SIR_HAL_APP_SETUP_NTF:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700634 return "SIR_HAL_APP_SETUP_NTF";
Jeff Johnson295189b2012-06-20 16:38:30 -0700635 case SIR_HAL_INITIAL_CAL_FAILED_NTF:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700636 return "SIR_HAL_INITIAL_CAL_FAILED_NTF";
Jeff Johnson295189b2012-06-20 16:38:30 -0700637 case SIR_HAL_NIC_OPER_NTF:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700638 return "SIR_HAL_NIC_OPER_NTF";
Jeff Johnson295189b2012-06-20 16:38:30 -0700639 case SIR_HAL_INIT_START_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700640 return "SIR_HAL_INIT_START_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700641 case SIR_HAL_SHUTDOWN_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700642 return "SIR_HAL_SHUTDOWN_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700643 case SIR_HAL_SHUTDOWN_CNF:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700644 return "SIR_HAL_SHUTDOWN_CNF";
Jeff Johnson295189b2012-06-20 16:38:30 -0700645 case SIR_HAL_RESET_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700646 return "SIR_HAL_RESET_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700647 case SIR_HAL_RESET_CNF:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700648 return "SIR_HAL_RESET_CNF";
Jeff Johnson295189b2012-06-20 16:38:30 -0700649 case SIR_WRITE_TO_TD:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700650 return "SIR_WRITE_TO_TD";
Jeff Johnson295189b2012-06-20 16:38:30 -0700651
652 case WNI_CFG_PARAM_UPDATE_IND:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700653 return "WNI_CFG_PARAM_UPDATE_IND";
Jeff Johnson295189b2012-06-20 16:38:30 -0700654 case WNI_CFG_DNLD_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700655 return "WNI_CFG_DNLD_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700656 case WNI_CFG_DNLD_CNF:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700657 return "WNI_CFG_DNLD_CNF";
Jeff Johnson295189b2012-06-20 16:38:30 -0700658 case WNI_CFG_GET_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700659 return "WNI_CFG_GET_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700660 case WNI_CFG_SET_CNF:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700661 return "WNI_CFG_SET_CNF";
Jeff Johnson295189b2012-06-20 16:38:30 -0700662 case WNI_CFG_GET_ATTRIB_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700663 return "WNI_CFG_GET_ATTRIB_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700664 case WNI_CFG_ADD_GRP_ADDR_CNF:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700665 return "WNI_CFG_ADD_GRP_ADDR_CNF";
Jeff Johnson295189b2012-06-20 16:38:30 -0700666 case WNI_CFG_DEL_GRP_ADDR_CNF:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700667 return "WNI_CFG_DEL_GRP_ADDR_CNF";
Jeff Johnson295189b2012-06-20 16:38:30 -0700668 case ANI_CFG_GET_RADIO_STAT_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700669 return "ANI_CFG_GET_RADIO_STAT_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700670 case ANI_CFG_GET_PER_STA_STAT_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700671 return "ANI_CFG_GET_PER_STA_STAT_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700672 case ANI_CFG_GET_AGG_STA_STAT_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700673 return "ANI_CFG_GET_AGG_STA_STAT_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700674 case ANI_CFG_CLEAR_STAT_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700675 return "ANI_CFG_CLEAR_STAT_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700676 case WNI_CFG_DNLD_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700677 return "WNI_CFG_DNLD_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700678 case WNI_CFG_GET_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700679 return "WNI_CFG_GET_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700680 case WNI_CFG_SET_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700681 return "WNI_CFG_SET_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700682 case WNI_CFG_SET_REQ_NO_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700683 return "WNI_CFG_SET_REQ_NO_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700684 case eWNI_PMC_ENTER_IMPS_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700685 return "eWNI_PMC_ENTER_IMPS_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700686 case eWNI_PMC_EXIT_IMPS_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700687 return "eWNI_PMC_EXIT_IMPS_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700688 case eWNI_PMC_ENTER_BMPS_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700689 return "eWNI_PMC_ENTER_BMPS_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700690 case eWNI_PMC_EXIT_BMPS_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700691 return "eWNI_PMC_EXIT_BMPS_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700692 case eWNI_PMC_EXIT_BMPS_IND:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700693 return "eWNI_PMC_EXIT_BMPS_IND";
Yathish9f22e662012-12-10 14:21:35 -0800694 case eWNI_SME_SET_BCN_FILTER_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700695 return "eWNI_SME_SET_BCN_FILTER_REQ";
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -0800696#if defined(FEATURE_WLAN_ESE) && defined(FEATURE_WLAN_ESE_UPLOAD)
Srinivas Girigowda5cecb202013-10-08 09:13:25 -0700697 case eWNI_SME_GET_TSM_STATS_REQ:
698 return "eWNI_SME_GET_TSM_STATS_REQ";
699 case eWNI_SME_GET_TSM_STATS_RSP:
700 return "eWNI_SME_GET_TSM_STATS_RSP";
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -0800701#endif /* FEATURE_WLAN_ESE && FEATURE_WLAN_ESE_UPLOAD */
Jeff Johnson295189b2012-06-20 16:38:30 -0700702 default:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700703 return "INVALID SME message";
Jeff Johnson295189b2012-06-20 16:38:30 -0700704 }
705#endif
706return "";
707}
708
709
710
711char *limResultCodeStr(tSirResultCodes resultCode)
712{
Jeff Johnson295189b2012-06-20 16:38:30 -0700713 switch (resultCode)
714 {
715 case eSIR_SME_SUCCESS:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700716 return "eSIR_SME_SUCCESS";
Jeff Johnson295189b2012-06-20 16:38:30 -0700717 case eSIR_EOF_SOF_EXCEPTION:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700718 return "eSIR_EOF_SOF_EXCEPTION";
Jeff Johnson295189b2012-06-20 16:38:30 -0700719 case eSIR_BMU_EXCEPTION:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700720 return "eSIR_BMU_EXCEPTION";
Jeff Johnson295189b2012-06-20 16:38:30 -0700721 case eSIR_LOW_PDU_EXCEPTION:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700722 return "eSIR_LOW_PDU_EXCEPTION";
Jeff Johnson295189b2012-06-20 16:38:30 -0700723 case eSIR_USER_TRIG_RESET:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700724 return"eSIR_USER_TRIG_RESET";
Jeff Johnson295189b2012-06-20 16:38:30 -0700725 case eSIR_LOGP_EXCEPTION:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700726 return "eSIR_LOGP_EXCEPTION";
Jeff Johnson295189b2012-06-20 16:38:30 -0700727 case eSIR_CP_EXCEPTION:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700728 return "eSIR_CP_EXCEPTION";
Jeff Johnson295189b2012-06-20 16:38:30 -0700729 case eSIR_STOP_BSS:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700730 return "eSIR_STOP_BSS";
Jeff Johnson295189b2012-06-20 16:38:30 -0700731 case eSIR_AHB_HANG_EXCEPTION:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700732 return "eSIR_AHB_HANG_EXCEPTION";
Jeff Johnson295189b2012-06-20 16:38:30 -0700733 case eSIR_DPU_EXCEPTION:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700734 return "eSIR_DPU_EXCEPTION";
Jeff Johnson295189b2012-06-20 16:38:30 -0700735 case eSIR_RXP_EXCEPTION:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700736 return "eSIR_RXP_EXCEPTION";
Jeff Johnson295189b2012-06-20 16:38:30 -0700737 case eSIR_MCPU_EXCEPTION:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700738 return "eSIR_MCPU_EXCEPTION";
Jeff Johnson295189b2012-06-20 16:38:30 -0700739 case eSIR_MCU_EXCEPTION:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700740 return "eSIR_MCU_EXCEPTION";
Jeff Johnson295189b2012-06-20 16:38:30 -0700741 case eSIR_MTU_EXCEPTION:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700742 return "eSIR_MTU_EXCEPTION";
Jeff Johnson295189b2012-06-20 16:38:30 -0700743 case eSIR_MIF_EXCEPTION:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700744 return "eSIR_MIF_EXCEPTION";
Jeff Johnson295189b2012-06-20 16:38:30 -0700745 case eSIR_FW_EXCEPTION:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700746 return "eSIR_FW_EXCEPTION";
Jeff Johnson295189b2012-06-20 16:38:30 -0700747 case eSIR_MAILBOX_SANITY_CHK_FAILED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700748 return "eSIR_MAILBOX_SANITY_CHK_FAILED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700749 case eSIR_RADIO_HW_SWITCH_STATUS_IS_OFF:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700750 return "eSIR_RADIO_HW_SWITCH_STATUS_IS_OFF";
Jeff Johnson295189b2012-06-20 16:38:30 -0700751 case eSIR_CFB_FLAG_STUCK_EXCEPTION:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700752 return "eSIR_CFB_FLAG_STUCK_EXCEPTION";
Jeff Johnson295189b2012-06-20 16:38:30 -0700753 case eSIR_SME_BASIC_RATES_NOT_SUPPORTED_STATUS:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700754 return "eSIR_SME_BASIC_RATES_NOT_SUPPORTED_STATUS";
Jeff Johnson295189b2012-06-20 16:38:30 -0700755 case eSIR_SME_INVALID_PARAMETERS:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700756 return "eSIR_SME_INVALID_PARAMETERS";
Jeff Johnson295189b2012-06-20 16:38:30 -0700757 case eSIR_SME_UNEXPECTED_REQ_RESULT_CODE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700758 return "eSIR_SME_UNEXPECTED_REQ_RESULT_CODE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700759 case eSIR_SME_RESOURCES_UNAVAILABLE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700760 return "eSIR_SME_RESOURCES_UNAVAILABLE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700761 case eSIR_SME_SCAN_FAILED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700762 return "eSIR_SME_SCAN_FAILED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700763 case eSIR_SME_BSS_ALREADY_STARTED_OR_JOINED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700764 return "eSIR_SME_BSS_ALREADY_STARTED_OR_JOINED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700765 case eSIR_SME_LOST_LINK_WITH_PEER_RESULT_CODE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700766 return "eSIR_SME_LOST_LINK_WITH_PEER_RESULT_CODE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700767 case eSIR_SME_REFUSED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700768 return "eSIR_SME_REFUSED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700769 case eSIR_SME_JOIN_TIMEOUT_RESULT_CODE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700770 return "eSIR_SME_JOIN_TIMEOUT_RESULT_CODE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700771 case eSIR_SME_AUTH_TIMEOUT_RESULT_CODE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700772 return "eSIR_SME_AUTH_TIMEOUT_RESULT_CODE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700773 case eSIR_SME_ASSOC_TIMEOUT_RESULT_CODE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700774 return "eSIR_SME_ASSOC_TIMEOUT_RESULT_CODE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700775 case eSIR_SME_REASSOC_TIMEOUT_RESULT_CODE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700776 return "eSIR_SME_REASSOC_TIMEOUT_RESULT_CODE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700777 case eSIR_SME_MAX_NUM_OF_PRE_AUTH_REACHED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700778 return "eSIR_SME_MAX_NUM_OF_PRE_AUTH_REACHED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700779 case eSIR_SME_AUTH_REFUSED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700780 return "eSIR_SME_AUTH_REFUSED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700781 case eSIR_SME_INVALID_WEP_DEFAULT_KEY:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700782 return "eSIR_SME_INVALID_WEP_DEFAULT_KEY";
Jeff Johnson295189b2012-06-20 16:38:30 -0700783 case eSIR_SME_ASSOC_REFUSED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700784 return "eSIR_SME_ASSOC_REFUSED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700785 case eSIR_SME_REASSOC_REFUSED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700786 return "eSIR_SME_REASSOC_REFUSED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700787 case eSIR_SME_STA_NOT_AUTHENTICATED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700788 return "eSIR_SME_STA_NOT_AUTHENTICATED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700789 case eSIR_SME_STA_NOT_ASSOCIATED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700790 return "eSIR_SME_STA_NOT_ASSOCIATED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700791 case eSIR_SME_STA_DISASSOCIATED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700792 return "eSIR_SME_STA_DISASSOCIATED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700793 case eSIR_SME_ALREADY_JOINED_A_BSS:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700794 return "eSIR_SME_ALREADY_JOINED_A_BSS";
Jeff Johnson295189b2012-06-20 16:38:30 -0700795 case eSIR_ULA_COMPLETED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700796 return "eSIR_ULA_COMPLETED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700797 case eSIR_ULA_FAILURE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700798 return "eSIR_ULA_FAILURE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700799 case eSIR_SME_LINK_ESTABLISHED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700800 return "eSIR_SME_LINK_ESTABLISHED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700801 case eSIR_SME_UNABLE_TO_PERFORM_MEASUREMENTS:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700802 return "eSIR_SME_UNABLE_TO_PERFORM_MEASUREMENTS";
Jeff Johnson295189b2012-06-20 16:38:30 -0700803 case eSIR_SME_UNABLE_TO_PERFORM_DFS:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700804 return "eSIR_SME_UNABLE_TO_PERFORM_DFS";
Jeff Johnson295189b2012-06-20 16:38:30 -0700805 case eSIR_SME_DFS_FAILED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700806 return "eSIR_SME_DFS_FAILED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700807 case eSIR_SME_TRANSFER_STA:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700808 return "eSIR_SME_TRANSFER_STA";
Jeff Johnson295189b2012-06-20 16:38:30 -0700809 case eSIR_SME_INVALID_LINK_TEST_PARAMETERS:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700810 return "eSIR_SME_INVALID_LINK_TEST_PARAMETERS";
Jeff Johnson295189b2012-06-20 16:38:30 -0700811 case eSIR_SME_LINK_TEST_MAX_EXCEEDED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700812 return "eSIR_SME_LINK_TEST_MAX_EXCEEDED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700813 case eSIR_SME_UNSUPPORTED_RATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700814 return "eSIR_SME_UNSUPPORTED_RATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700815 case eSIR_SME_LINK_TEST_TIMEOUT:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700816 return "eSIR_SME_LINK_TEST_TIMEOUT";
Jeff Johnson295189b2012-06-20 16:38:30 -0700817 case eSIR_SME_LINK_TEST_COMPLETE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700818 return "eSIR_SME_LINK_TEST_COMPLETE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700819 case eSIR_SME_LINK_TEST_INVALID_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700820 return "eSIR_SME_LINK_TEST_INVALID_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700821 case eSIR_SME_LINK_TEST_INVALID_ADDRESS:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700822 return "eSIR_SME_LINK_TEST_INVALID_ADDRESS";
Jeff Johnson295189b2012-06-20 16:38:30 -0700823 case eSIR_SME_POLARIS_RESET:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700824 return "eSIR_SME_POLARIS_RESET";
Jeff Johnson295189b2012-06-20 16:38:30 -0700825 case eSIR_SME_SETCONTEXT_FAILED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700826 return "eSIR_SME_SETCONTEXT_FAILED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700827 case eSIR_SME_BSS_RESTART:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700828 return "eSIR_SME_BSS_RESTART";
Jeff Johnson295189b2012-06-20 16:38:30 -0700829 case eSIR_SME_MORE_SCAN_RESULTS_FOLLOW:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700830 return "eSIR_SME_MORE_SCAN_RESULTS_FOLLOW";
Jeff Johnson295189b2012-06-20 16:38:30 -0700831 case eSIR_SME_INVALID_ASSOC_RSP_RXED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700832 return "eSIR_SME_INVALID_ASSOC_RSP_RXED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700833 case eSIR_SME_MIC_COUNTER_MEASURES:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700834 return "eSIR_SME_MIC_COUNTER_MEASURES";
Jeff Johnson295189b2012-06-20 16:38:30 -0700835 case eSIR_SME_ADDTS_RSP_TIMEOUT:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700836 return "eSIR_SME_ADDTS_RSP_TIMEOUT";
Jeff Johnson295189b2012-06-20 16:38:30 -0700837 case eSIR_SME_RECEIVED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700838 return "eSIR_SME_RECEIVED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700839 case eSIR_SME_CHANNEL_SWITCH_FAIL:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700840 return "eSIR_SME_CHANNEL_SWITCH_FAIL";
Jeff Johnson295189b2012-06-20 16:38:30 -0700841#ifdef GEN4_SCAN
842 case eSIR_SME_CHANNEL_SWITCH_DISABLED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700843 return "eSIR_SME_CHANNEL_SWITCH_DISABLED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700844 case eSIR_SME_HAL_SCAN_INIT_FAILED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700845 return "eSIR_SME_HAL_SCAN_INIT_FAILED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700846 case eSIR_SME_HAL_SCAN_START_FAILED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700847 return "eSIR_SME_HAL_SCAN_START_FAILED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700848 case eSIR_SME_HAL_SCAN_END_FAILED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700849 return "eSIR_SME_HAL_SCAN_END_FAILED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700850 case eSIR_SME_HAL_SCAN_FINISH_FAILED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700851 return "eSIR_SME_HAL_SCAN_FINISH_FAILED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700852 case eSIR_SME_HAL_SEND_MESSAGE_FAIL:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700853 return "eSIR_SME_HAL_SEND_MESSAGE_FAIL";
Jeff Johnson295189b2012-06-20 16:38:30 -0700854#else // GEN4_SCAN
855 case eSIR_SME_CHANNEL_SWITCH_DISABLED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700856 return "eSIR_SME_CHANNEL_SWITCH_DISABLED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700857 case eSIR_SME_HAL_SEND_MESSAGE_FAIL:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700858 return "eSIR_SME_HAL_SEND_MESSAGE_FAIL";
Jeff Johnson295189b2012-06-20 16:38:30 -0700859#endif // GEN4_SCAN
860
861 default:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700862 return "INVALID resultCode";
Jeff Johnson295189b2012-06-20 16:38:30 -0700863 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700864}
865
866void
867limPrintMsgName(tpAniSirGlobal pMac, tANI_U16 logLevel, tANI_U32 msgType)
868{
869 limLog(pMac, logLevel, limMsgStr(msgType));
870}
871
Jeff Johnson295189b2012-06-20 16:38:30 -0700872void
873limPrintMsgInfo(tpAniSirGlobal pMac, tANI_U16 logLevel, tSirMsgQ *msg)
874{
Jeff Johnson295189b2012-06-20 16:38:30 -0700875 if (logLevel <= pMac->utils.gLogDbgLevel[SIR_LIM_MODULE_ID - LOG_FIRST_MODULE_ID])
876 {
877 switch (msg->type)
878 {
879 case SIR_BB_XPORT_MGMT_MSG:
Jeff Johnson295189b2012-06-20 16:38:30 -0700880 limPrintMsgName(pMac, logLevel,msg->type);
Jeff Johnson295189b2012-06-20 16:38:30 -0700881 break;
882 default:
883 limPrintMsgName(pMac, logLevel,msg->type);
884 break;
885 }
886 }
887}
888
889/**
890 * limInitMlm()
891 *
892 *FUNCTION:
893 * This function is called by limProcessSmeMessages() to
894 * initialize MLM state machine on STA
895 *
896 *PARAMS:
897 *
898 *LOGIC:
899 *
900 *ASSUMPTIONS:
901 * NA
902 *
903 *NOTE:
904 * NA
905 *
906 * @param pMac Pointer to Global MAC structure
907 * @return None
908 */
909void
910limInitMlm(tpAniSirGlobal pMac)
911{
Madan Mohan Koyyalamudi694f8d72012-10-11 16:32:55 -0700912 tANI_U32 retVal;
913
914 pMac->lim.gLimTimersCreated = 0;
Madan Mohan Koyyalamudi1bed5982012-10-22 14:38:06 -0700915
Jeff Johnsone7245742012-09-05 17:12:55 -0700916 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, NO_SESSION, pMac->lim.gLimMlmState));
Jeff Johnson295189b2012-06-20 16:38:30 -0700917
918 /// Initialize scan result hash table
919 limReInitScanResults(pMac); //sep26th review
920
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -0700921#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
922 /// Initialize lfr scan result hash table
923 // Could there be a problem in multisession with SAP/P2P GO, when in the
924 // middle of FW bg scan, SAP started; Again that could be a problem even on
925 // infra + SAP/P2P GO too - TBD
926 limReInitLfrScanResults(pMac);
927#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700928
929 /// Initialize number of pre-auth contexts
930 pMac->lim.gLimNumPreAuthContexts = 0;
931
932 /// Initialize MAC based Authentication STA list
933 limInitPreAuthList(pMac);
934
935 //pMac->lim.gpLimMlmJoinReq = NULL;
936
937 if (pMac->lim.gLimTimersCreated)
938 return;
939
940 // Create timers used by LIM
Madan Mohan Koyyalamudi694f8d72012-10-11 16:32:55 -0700941 retVal = limCreateTimers(pMac);
942 if(retVal == TX_SUCCESS)
943 {
944 pMac->lim.gLimTimersCreated = 1;
945 }
946 else
947 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700948 limLog(pMac, LOGP, FL(" limCreateTimers Failed to create lim timers "));
Madan Mohan Koyyalamudi694f8d72012-10-11 16:32:55 -0700949 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700950} /*** end limInitMlm() ***/
951
952
953
954/**
955 * limCleanupMlm()
956 *
957 *FUNCTION:
958 * This function is called to cleanup any resources
959 * allocated by the MLM state machine.
960 *
961 *PARAMS:
962 *
963 *LOGIC:
964 *
965 *ASSUMPTIONS:
966 * NA
967 *
968 *NOTE:
969 * It is assumed that BSS is already informed that we're leaving it
970 * before this function is called.
971 *
972 * @param pMac Pointer to Global MAC structure
973 * @param None
974 * @return None
975 */
976void
977limCleanupMlm(tpAniSirGlobal pMac)
978{
979 tANI_U32 n;
980 tLimPreAuthNode *pAuthNode;
981
982 if (pMac->lim.gLimTimersCreated == 1)
983 {
984 // Deactivate and delete MIN/MAX channel timers.
985 tx_timer_deactivate(&pMac->lim.limTimers.gLimMinChannelTimer);
986 tx_timer_delete(&pMac->lim.limTimers.gLimMinChannelTimer);
987 tx_timer_deactivate(&pMac->lim.limTimers.gLimMaxChannelTimer);
988 tx_timer_delete(&pMac->lim.limTimers.gLimMaxChannelTimer);
989 tx_timer_deactivate(&pMac->lim.limTimers.gLimPeriodicProbeReqTimer);
990 tx_timer_delete(&pMac->lim.limTimers.gLimPeriodicProbeReqTimer);
991
992
993 // Deactivate and delete channel switch timer.
994 tx_timer_deactivate(&pMac->lim.limTimers.gLimChannelSwitchTimer);
995 tx_timer_delete(&pMac->lim.limTimers.gLimChannelSwitchTimer);
996
997
998 // Deactivate and delete addts response timer.
999 tx_timer_deactivate(&pMac->lim.limTimers.gLimAddtsRspTimer);
1000 tx_timer_delete(&pMac->lim.limTimers.gLimAddtsRspTimer);
1001
1002 // Deactivate and delete Join failure timer.
1003 tx_timer_deactivate(&pMac->lim.limTimers.gLimJoinFailureTimer);
1004 tx_timer_delete(&pMac->lim.limTimers.gLimJoinFailureTimer);
1005
Madan Mohan Koyyalamudi9aff9ff2012-11-29 11:27:25 -08001006 // Deactivate and delete Periodic Join Probe Request timer.
1007 tx_timer_deactivate(&pMac->lim.limTimers.gLimPeriodicJoinProbeReqTimer);
1008 tx_timer_delete(&pMac->lim.limTimers.gLimPeriodicJoinProbeReqTimer);
1009
Jeff Johnson295189b2012-06-20 16:38:30 -07001010 // Deactivate and delete Association failure timer.
1011 tx_timer_deactivate(&pMac->lim.limTimers.gLimAssocFailureTimer);
1012 tx_timer_delete(&pMac->lim.limTimers.gLimAssocFailureTimer);
1013
1014 // Deactivate and delete Reassociation failure timer.
1015 tx_timer_deactivate(&pMac->lim.limTimers.gLimReassocFailureTimer);
1016 tx_timer_delete(&pMac->lim.limTimers.gLimReassocFailureTimer);
1017
1018 // Deactivate and delete Authentication failure timer.
1019 tx_timer_deactivate(&pMac->lim.limTimers.gLimAuthFailureTimer);
1020 tx_timer_delete(&pMac->lim.limTimers.gLimAuthFailureTimer);
1021
1022 // Deactivate and delete Heartbeat timer.
1023 tx_timer_deactivate(&pMac->lim.limTimers.gLimHeartBeatTimer);
1024 tx_timer_delete(&pMac->lim.limTimers.gLimHeartBeatTimer);
1025
1026 // Deactivate and delete wait-for-probe-after-Heartbeat timer.
1027 tx_timer_deactivate(&pMac->lim.limTimers.gLimProbeAfterHBTimer);
1028 tx_timer_delete(&pMac->lim.limTimers.gLimProbeAfterHBTimer);
1029
1030 // Deactivate and delete Quiet timer.
1031 tx_timer_deactivate(&pMac->lim.limTimers.gLimQuietTimer);
1032 tx_timer_delete(&pMac->lim.limTimers.gLimQuietTimer);
1033
1034 // Deactivate and delete Quiet BSS timer.
1035 tx_timer_deactivate(&pMac->lim.limTimers.gLimQuietBssTimer);
1036 tx_timer_delete(&pMac->lim.limTimers.gLimQuietBssTimer);
1037
Jeff Johnson295189b2012-06-20 16:38:30 -07001038 // Deactivate and delete LIM background scan timer.
1039 tx_timer_deactivate(&pMac->lim.limTimers.gLimBackgroundScanTimer);
1040 tx_timer_delete(&pMac->lim.limTimers.gLimBackgroundScanTimer);
Jeff Johnson295189b2012-06-20 16:38:30 -07001041
1042
1043 // Deactivate and delete cnf wait timer
1044 for (n = 0; n < pMac->lim.maxStation; n++)
1045 {
1046 tx_timer_deactivate(&pMac->lim.limTimers.gpLimCnfWaitTimer[n]);
1047 tx_timer_delete(&pMac->lim.limTimers.gpLimCnfWaitTimer[n]);
1048 }
1049
1050 // Deactivate and delete keepalive timer
1051 tx_timer_deactivate(&pMac->lim.limTimers.gLimKeepaliveTimer);
1052 tx_timer_delete(&pMac->lim.limTimers.gLimKeepaliveTimer);
1053
1054 pAuthNode = pMac->lim.gLimPreAuthTimerTable.pTable;
1055
1056 //Deactivate any Authentication response timers
1057 limDeletePreAuthList(pMac);
1058
1059 for (n = 0; n < pMac->lim.gLimPreAuthTimerTable.numEntry; n++,pAuthNode++)
1060 {
1061 // Delete any Authentication response
1062 // timers, which might have been started.
1063 tx_timer_delete(&pAuthNode->timer);
1064 }
1065
Jeff Johnson295189b2012-06-20 16:38:30 -07001066
1067
1068 // Deactivate and delete Hash Miss throttle timer
1069 tx_timer_deactivate(&pMac->lim.limTimers.gLimSendDisassocFrameThresholdTimer);
1070 tx_timer_delete(&pMac->lim.limTimers.gLimSendDisassocFrameThresholdTimer);
1071
Jeff Johnson295189b2012-06-20 16:38:30 -07001072 tx_timer_deactivate(&pMac->lim.limTimers.gLimUpdateOlbcCacheTimer);
1073 tx_timer_delete(&pMac->lim.limTimers.gLimUpdateOlbcCacheTimer);
1074 tx_timer_deactivate(&pMac->lim.limTimers.gLimPreAuthClnupTimer);
1075 tx_timer_delete(&pMac->lim.limTimers.gLimPreAuthClnupTimer);
1076
1077#if 0 // The WPS PBC clean up timer is disabled
1078 if (pMac->lim.gLimSystemRole == eLIM_AP_ROLE)
1079 {
1080 if(pMac->lim.limTimers.gLimWPSOverlapTimerObj.isTimerCreated == eANI_BOOLEAN_TRUE)
1081 {
1082 tx_timer_deactivate(&pMac->lim.limTimers.gLimWPSOverlapTimerObj.gLimWPSOverlapTimer);
1083 tx_timer_delete(&pMac->lim.limTimers.gLimWPSOverlapTimerObj.gLimWPSOverlapTimer);
1084 pMac->lim.limTimers.gLimWPSOverlapTimerObj.isTimerCreated = eANI_BOOLEAN_FALSE;
1085 }
1086 }
1087#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001088#ifdef WLAN_FEATURE_VOWIFI_11R
1089 // Deactivate and delete FT Preauth response timer
1090 tx_timer_deactivate(&pMac->lim.limTimers.gLimFTPreAuthRspTimer);
1091 tx_timer_delete(&pMac->lim.limTimers.gLimFTPreAuthRspTimer);
1092#endif
1093
Jeff Johnson295189b2012-06-20 16:38:30 -07001094 // Deactivate and delete remain on channel timer
1095 tx_timer_deactivate(&pMac->lim.limTimers.gLimRemainOnChannelTimer);
1096 tx_timer_delete(&pMac->lim.limTimers.gLimRemainOnChannelTimer);
Jeff Johnson295189b2012-06-20 16:38:30 -07001097
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001098#if defined(FEATURE_WLAN_ESE) && !defined(FEATURE_WLAN_ESE_UPLOAD)
Jeff Johnson295189b2012-06-20 16:38:30 -07001099 // Deactivate and delete TSM
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001100 tx_timer_deactivate(&pMac->lim.limTimers.gLimEseTsmTimer);
1101 tx_timer_delete(&pMac->lim.limTimers.gLimEseTsmTimer);
1102#endif /* FEATURE_WLAN_ESE && !FEATURE_WLAN_ESE_UPLOAD */
Jeff Johnson295189b2012-06-20 16:38:30 -07001103
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -08001104 tx_timer_deactivate(&pMac->lim.limTimers.gLimDisassocAckTimer);
1105 tx_timer_delete(&pMac->lim.limTimers.gLimDisassocAckTimer);
1106
1107 tx_timer_deactivate(&pMac->lim.limTimers.gLimDeauthAckTimer);
1108 tx_timer_delete(&pMac->lim.limTimers.gLimDeauthAckTimer);
1109
Hoonki Leef63df0d2013-01-16 19:29:14 -08001110 tx_timer_deactivate(&pMac->lim.limTimers.gLimP2pSingleShotNoaInsertTimer);
1111 tx_timer_delete(&pMac->lim.limTimers.gLimP2pSingleShotNoaInsertTimer);
Hoonki Leef63df0d2013-01-16 19:29:14 -08001112
Gopichand Nakkala0d6e4ad2013-05-17 02:30:25 +05301113 tx_timer_deactivate(&pMac->lim.limTimers.gLimActiveToPassiveChannelTimer);
1114 tx_timer_delete(&pMac->lim.limTimers.gLimActiveToPassiveChannelTimer);
1115
Jeff Johnson295189b2012-06-20 16:38:30 -07001116 pMac->lim.gLimTimersCreated = 0;
1117 }
1118
1119 /// Cleanup cached scan list
1120 limReInitScanResults(pMac);
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07001121#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
1122 /// Cleanup cached scan list
1123 limReInitLfrScanResults(pMac);
1124#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001125
1126} /*** end limCleanupMlm() ***/
1127
1128
1129
1130/**
1131 * limCleanupLmm()
1132 *
1133 *FUNCTION:
1134 * This function is called to cleanup any resources
1135 * allocated by LMM sub-module.
1136 *
1137 *PARAMS:
1138 *
1139 *LOGIC:
1140 *
1141 *ASSUMPTIONS:
1142 * NA
1143 *
1144 *NOTE:
1145 * NA
1146 *
1147 * @param pMac Pointer to Global MAC structure
1148 * @return None
1149 */
1150
1151void
1152limCleanupLmm(tpAniSirGlobal pMac)
1153{
Jeff Johnson295189b2012-06-20 16:38:30 -07001154} /*** end limCleanupLmm() ***/
1155
1156
1157
1158/**
1159 * limIsAddrBC()
1160 *
1161 *FUNCTION:
1162 * This function is called in various places within LIM code
1163 * to determine whether passed MAC address is a broadcast or not
1164 *
1165 *LOGIC:
1166 *
1167 *ASSUMPTIONS:
1168 * NA
1169 *
1170 *NOTE:
1171 * NA
1172 *
1173 * @param macAddr Indicates MAC address that need to be determined
1174 * whether it is Broadcast address or not
1175 *
1176 * @return true if passed address is Broadcast address else false
1177 */
1178
1179tANI_U8
1180limIsAddrBC(tSirMacAddr macAddr)
1181{
1182 int i;
1183 for (i = 0; i < 6; i++)
1184 {
1185 if ((macAddr[i] & 0xFF) != 0xFF)
1186 return false;
1187 }
1188
1189 return true;
1190} /****** end limIsAddrBC() ******/
1191
1192
1193
1194/**
1195 * limIsGroupAddr()
1196 *
1197 *FUNCTION:
1198 * This function is called in various places within LIM code
1199 * to determine whether passed MAC address is a group address or not
1200 *
1201 *LOGIC:
1202 * If least significant bit of first octet of the MAC address is
1203 * set to 1, it is a Group address.
1204 *
1205 *ASSUMPTIONS:
1206 * NA
1207 *
1208 *NOTE:
1209 * NA
1210 *
1211 * @param macAddr Indicates MAC address that need to be determined
1212 * whether it is Group address or not
1213 *
1214 * @return true if passed address is Group address else false
1215 */
1216
1217tANI_U8
1218limIsGroupAddr(tSirMacAddr macAddr)
1219{
1220 if ((macAddr[0] & 0x01) == 0x01)
1221 return true;
1222 else
1223 return false;
1224} /****** end limIsGroupAddr() ******/
1225
1226/**
1227 * limPostMsgApiNoWait()
1228 *
1229 *FUNCTION:
1230 * This function is called from other thread while posting a
1231 * message to LIM message Queue gSirLimMsgQ with NO_WAIT option
1232 *
1233 *LOGIC:
1234 * NA
1235 *
1236 *ASSUMPTIONS:
1237 * NA
1238 *
1239 *NOTE:
1240 * NA
1241 *
1242 * @param pMsg - Pointer to the Global MAC structure
1243 * @param pMsg - Pointer to the message structure
1244 * @return None
1245 */
1246
1247tANI_U32
1248limPostMsgApiNoWait(tpAniSirGlobal pMac, tSirMsgQ *pMsg)
1249{
Jeff Johnson295189b2012-06-20 16:38:30 -07001250 limProcessMessages(pMac, pMsg);
1251 return TX_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -07001252} /*** end limPostMsgApiNoWait() ***/
1253
1254
1255
1256/**
1257 * limPrintMacAddr()
1258 *
1259 *FUNCTION:
1260 * This function is called to print passed MAC address
1261 * in : format.
1262 *
1263 *LOGIC:
1264 *
1265 *ASSUMPTIONS:
1266 * NA
1267 *
1268 *NOTE:
1269 * @param macAddr - MacAddr to be printed
1270 * @param logLevel - Loglevel to be used
1271 *
1272 * @return None.
1273 */
1274
1275void
1276limPrintMacAddr(tpAniSirGlobal pMac, tSirMacAddr macAddr, tANI_U8 logLevel)
1277{
1278 limLog(pMac, logLevel,
Arif Hussaina7c8e412013-11-20 11:06:42 -08001279 FL(MAC_ADDRESS_STR), MAC_ADDR_ARRAY(macAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001280} /****** end limPrintMacAddr() ******/
1281
1282
Jeff Johnson295189b2012-06-20 16:38:30 -07001283/*
1284 * limResetDeferredMsgQ()
1285 *
1286 *FUNCTION:
1287 * This function resets the deferred message queue parameters.
1288 *
1289 *PARAMS:
1290 * @param pMac - Pointer to Global MAC structure
1291 *
1292 *LOGIC:
1293 *
1294 *ASSUMPTIONS:
1295 * NA
1296 *
1297 *NOTE:
1298 * NA
1299 *
1300 *RETURNS:
1301 * None
1302 */
1303
1304void limResetDeferredMsgQ(tpAniSirGlobal pMac)
1305{
1306 pMac->lim.gLimDeferredMsgQ.size =
1307 pMac->lim.gLimDeferredMsgQ.write =
1308 pMac->lim.gLimDeferredMsgQ.read = 0;
1309
1310}
1311
1312
1313#define LIM_DEFERRED_Q_CHECK_THRESHOLD (MAX_DEFERRED_QUEUE_LEN/2)
1314#define LIM_MAX_NUM_MGMT_FRAME_DEFERRED (MAX_DEFERRED_QUEUE_LEN/2)
1315
1316/*
1317 * limWriteDeferredMsgQ()
1318 *
1319 *FUNCTION:
1320 * This function queues up a deferred message for later processing on the
1321 * STA side.
1322 *
1323 *PARAMS:
1324 * @param pMac - Pointer to Global MAC structure
1325 * @param limMsg - a LIM message
1326 *
1327 *LOGIC:
1328 *
1329 *ASSUMPTIONS:
1330 * NA
1331 *
1332 *NOTE:
1333 * NA
1334 *
1335 *RETURNS:
1336 * None
1337 */
1338
1339tANI_U8 limWriteDeferredMsgQ(tpAniSirGlobal pMac, tpSirMsgQ limMsg)
1340{
1341 PELOG1(limLog(pMac, LOG1,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001342 FL("** Queue a deferred message (size %d, write %d) - type 0x%x **"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001343 pMac->lim.gLimDeferredMsgQ.size, pMac->lim.gLimDeferredMsgQ.write,
1344 limMsg->type);)
1345
1346 /*
1347 ** check if the deferred message queue is full
1348 **/
1349 if (pMac->lim.gLimDeferredMsgQ.size >= MAX_DEFERRED_QUEUE_LEN)
1350 {
Leela Venkata Kiran Kumar Reddy Chirala2247e962013-03-22 19:21:10 -07001351 if(!(pMac->lim.deferredMsgCnt & 0xF))
1352 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001353 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 -07001354 }
1355 else
1356 {
1357 pMac->lim.deferredMsgCnt++;
1358 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001359 return TX_QUEUE_FULL;
1360 }
1361
1362 /*
1363 ** In the application, there should not be more than 1 message get
1364 ** queued up. If happens, flags a warning. In the future, this can
1365 ** happen.
1366 **/
1367 if (pMac->lim.gLimDeferredMsgQ.size > 0)
1368 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001369 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 -07001370 pMac->lim.gLimDeferredMsgQ.size, limMsg->type,
1371 limIsSystemInScanState(pMac),
1372 pMac->lim.gLimSmeState, pMac->lim.gLimMlmState,
1373 pMac->lim.gLimAddtsSent);)
1374 }
1375
1376 /*
1377 ** To prevent the deferred Q is full of management frames, only give them certain space
1378 **/
1379 if( SIR_BB_XPORT_MGMT_MSG == limMsg->type )
1380 {
1381 if( LIM_DEFERRED_Q_CHECK_THRESHOLD < pMac->lim.gLimDeferredMsgQ.size )
1382 {
1383 tANI_U16 idx, count = 0;
1384 for(idx = 0; idx < pMac->lim.gLimDeferredMsgQ.size; idx++)
1385 {
1386 if( SIR_BB_XPORT_MGMT_MSG == pMac->lim.gLimDeferredMsgQ.deferredQueue[idx].type )
1387 {
1388 count++;
1389 }
1390 }
1391 if( LIM_MAX_NUM_MGMT_FRAME_DEFERRED < count )
1392 {
1393 //We reach the quota for management frames, drop this one
Madan Mohan Koyyalamudi5695b502012-09-24 14:21:12 -07001394 PELOGW(limLog(pMac, LOGW, FL("Cannot deferred. Msg: %d Too many (count=%d) already"), limMsg->type, count);)
Jeff Johnson295189b2012-06-20 16:38:30 -07001395 //Return error, caller knows what to do
1396 return TX_QUEUE_FULL;
1397 }
1398 }
1399 }
1400
1401 ++pMac->lim.gLimDeferredMsgQ.size;
1402
Leela Venkata Kiran Kumar Reddy Chirala2247e962013-03-22 19:21:10 -07001403 /* reset the count here since we are able to defer the message */
1404 if(pMac->lim.deferredMsgCnt != 0)
1405 {
1406 pMac->lim.deferredMsgCnt = 0;
1407 }
1408
Jeff Johnson295189b2012-06-20 16:38:30 -07001409 /*
1410 ** if the write pointer hits the end of the queue, rewind it
1411 **/
1412 if (pMac->lim.gLimDeferredMsgQ.write >= MAX_DEFERRED_QUEUE_LEN)
1413 pMac->lim.gLimDeferredMsgQ.write = 0;
1414
1415 /*
1416 ** save the message to the queue and advanced the write pointer
1417 **/
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301418 vos_mem_copy( (tANI_U8 *)&pMac->lim.gLimDeferredMsgQ.deferredQueue[
1419 pMac->lim.gLimDeferredMsgQ.write++],
Jeff Johnson295189b2012-06-20 16:38:30 -07001420 (tANI_U8 *)limMsg,
1421 sizeof(tSirMsgQ));
1422 return TX_SUCCESS;
1423
1424}
1425
1426/*
1427 * limReadDeferredMsgQ()
1428 *
1429 *FUNCTION:
1430 * This function dequeues a deferred message for processing on the
1431 * STA side.
1432 *
1433 *PARAMS:
1434 * @param pMac - Pointer to Global MAC structure
1435 *
1436 *LOGIC:
1437 *
1438 *ASSUMPTIONS:
1439 * NA
1440 *
1441 *NOTE:
1442 *
1443 *
1444 *RETURNS:
1445 * Returns the message at the head of the deferred message queue
1446 */
1447
1448tSirMsgQ* limReadDeferredMsgQ(tpAniSirGlobal pMac)
1449{
1450 tSirMsgQ *msg;
1451
1452 /*
1453 ** check any messages left. If no, return
1454 **/
1455 if (pMac->lim.gLimDeferredMsgQ.size <= 0)
1456 return NULL;
1457
1458 /*
1459 ** decrement the queue size
1460 **/
1461 pMac->lim.gLimDeferredMsgQ.size--;
1462
1463 /*
1464 ** retrieve the message from the head of the queue
1465 **/
1466 msg = &pMac->lim.gLimDeferredMsgQ.deferredQueue[pMac->lim.gLimDeferredMsgQ.read];
1467
1468 /*
1469 ** advance the read pointer
1470 **/
1471 pMac->lim.gLimDeferredMsgQ.read++;
1472
1473 /*
1474 ** if the read pointer hits the end of the queue, rewind it
1475 **/
1476 if (pMac->lim.gLimDeferredMsgQ.read >= MAX_DEFERRED_QUEUE_LEN)
1477 pMac->lim.gLimDeferredMsgQ.read = 0;
1478
1479 PELOG1(limLog(pMac, LOG1,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001480 FL("** DeQueue a deferred message (size %d read %d) - type 0x%x **"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001481 pMac->lim.gLimDeferredMsgQ.size, pMac->lim.gLimDeferredMsgQ.read,
1482 msg->type);)
1483
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001484 PELOG1(limLog(pMac, LOG1, FL("DQ msg -- scan %d, global sme %d, global mlme %d, addts %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001485 limIsSystemInScanState(pMac),
1486 pMac->lim.gLimSmeState, pMac->lim.gLimMlmState,
1487 pMac->lim.gLimAddtsSent);)
1488
1489 return(msg);
1490}
1491
1492tSirRetStatus
1493limSysProcessMmhMsgApi(tpAniSirGlobal pMac,
1494 tSirMsgQ *pMsg,
1495 tANI_U8 qType)
1496{
1497// FIXME
Jeff Johnson295189b2012-06-20 16:38:30 -07001498 SysProcessMmhMsg(pMac, pMsg);
1499 return eSIR_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -07001500}
1501
1502char *limFrameStr(tANI_U32 type, tANI_U32 subType)
1503{
1504#ifdef FIXME_GEN6
1505
1506 if (type == SIR_MAC_MGMT_FRAME)
1507 {
1508 switch (subType)
1509 {
1510 case SIR_MAC_MGMT_ASSOC_REQ:
1511 return "MAC_MGMT_ASSOC_REQ";
1512 case SIR_MAC_MGMT_ASSOC_RSP:
1513 return "MAC_MGMT_ASSOC_RSP";
1514 case SIR_MAC_MGMT_REASSOC_REQ:
1515 return "MAC_MGMT_REASSOC_REQ";
1516 case SIR_MAC_MGMT_REASSOC_RSP:
1517 return "MAC_MGMT_REASSOC_RSP";
1518 case SIR_MAC_MGMT_PROBE_REQ:
1519 return "MAC_MGMT_PROBE_REQ";
1520 case SIR_MAC_MGMT_PROBE_RSP:
1521 return "MAC_MGMT_PROBE_RSP";
1522 case SIR_MAC_MGMT_BEACON:
1523 return "MAC_MGMT_BEACON";
1524 case SIR_MAC_MGMT_ATIM:
1525 return "MAC_MGMT_ATIM";
1526 case SIR_MAC_MGMT_DISASSOC:
1527 return "MAC_MGMT_DISASSOC";
1528 case SIR_MAC_MGMT_AUTH:
1529 return "MAC_MGMT_AUTH";
1530 case SIR_MAC_MGMT_DEAUTH:
1531 return "MAC_MGMT_DEAUTH";
1532 case SIR_MAC_MGMT_ACTION:
1533 return "MAC_MGMT_ACTION";
1534 case SIR_MAC_MGMT_RESERVED15:
1535 return "MAC_MGMT_RESERVED15";
1536 default:
1537 return "Unknown MGMT Frame";
1538 }
1539 }
1540
1541 else if (type == SIR_MAC_CTRL_FRAME)
1542 {
1543 switch (subType)
1544 {
1545 case SIR_MAC_CTRL_RR:
1546 return "MAC_CTRL_RR";
1547 case SIR_MAC_CTRL_BAR:
1548 return "MAC_CTRL_BAR";
1549 case SIR_MAC_CTRL_BA:
1550 return "MAC_CTRL_BA";
1551 case SIR_MAC_CTRL_PS_POLL:
1552 return "MAC_CTRL_PS_POLL";
1553 case SIR_MAC_CTRL_RTS:
1554 return "MAC_CTRL_RTS";
1555 case SIR_MAC_CTRL_CTS:
1556 return "MAC_CTRL_CTS";
1557 case SIR_MAC_CTRL_ACK:
1558 return "MAC_CTRL_ACK";
1559 case SIR_MAC_CTRL_CF_END:
1560 return "MAC_CTRL_CF_END";
1561 case SIR_MAC_CTRL_CF_END_ACK:
1562 return "MAC_CTRL_CF_END_ACK";
1563 default:
1564 return "Unknown CTRL Frame";
1565 }
1566 }
1567
1568 else if (type == SIR_MAC_DATA_FRAME)
1569 {
1570 switch (subType)
1571 {
1572 case SIR_MAC_DATA_DATA:
1573 return "MAC_DATA_DATA";
1574 case SIR_MAC_DATA_DATA_ACK:
1575 return "MAC_DATA_DATA_ACK";
1576 case SIR_MAC_DATA_DATA_POLL:
1577 return "MAC_DATA_DATA_POLL";
1578 case SIR_MAC_DATA_DATA_ACK_POLL:
1579 return "MAC_DATA_DATA_ACK_POLL";
1580 case SIR_MAC_DATA_NULL:
1581 return "MAC_DATA_NULL";
1582 case SIR_MAC_DATA_NULL_ACK:
1583 return "MAC_DATA_NULL_ACK";
1584 case SIR_MAC_DATA_NULL_POLL:
1585 return "MAC_DATA_NULL_POLL";
1586 case SIR_MAC_DATA_NULL_ACK_POLL:
1587 return "MAC_DATA_NULL_ACK_POLL";
1588 case SIR_MAC_DATA_QOS_DATA:
1589 return "MAC_DATA_QOS_DATA";
1590 case SIR_MAC_DATA_QOS_DATA_ACK:
1591 return "MAC_DATA_QOS_DATA_ACK";
1592 case SIR_MAC_DATA_QOS_DATA_POLL:
1593 return "MAC_DATA_QOS_DATA_POLL";
1594 case SIR_MAC_DATA_QOS_DATA_ACK_POLL:
1595 return "MAC_DATA_QOS_DATA_ACK_POLL";
1596 case SIR_MAC_DATA_QOS_NULL:
1597 return "MAC_DATA_QOS_NULL";
1598 case SIR_MAC_DATA_QOS_NULL_ACK:
1599 return "MAC_DATA_QOS_NULL_ACK";
1600 case SIR_MAC_DATA_QOS_NULL_POLL:
1601 return "MAC_DATA_QOS_NULL_POLL";
1602 case SIR_MAC_DATA_QOS_NULL_ACK_POLL:
1603 return "MAC_DATA_QOS_NULL_ACK_POLL";
1604 default:
1605 return "Unknown Data Frame";
1606 }
1607 }
1608 else
1609 return "Unknown";
1610#endif
1611return "";
1612}
1613
Jeff Johnson295189b2012-06-20 16:38:30 -07001614void limHandleUpdateOlbcCache(tpAniSirGlobal pMac)
1615{
1616 int i;
1617 static int enable;
1618 tUpdateBeaconParams beaconParams;
1619
1620 tpPESession psessionEntry = limIsApSessionActive(pMac);
1621
1622 if (psessionEntry == NULL)
Madan Mohan Koyyalamudi788b4ee2012-09-25 10:42:09 -07001623 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001624 PELOGE(limLog(pMac, LOGE, FL(" Session not found"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001625 return;
Madan Mohan Koyyalamudi788b4ee2012-09-25 10:42:09 -07001626 }
Pratik Bhalgatb44ea3f2012-11-22 16:41:39 +05301627
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301628 vos_mem_set( ( tANI_U8* )&beaconParams, sizeof( tUpdateBeaconParams), 0);
Madan Mohan Koyyalamudib2733142012-10-31 13:59:17 -07001629 beaconParams.bssIdx = psessionEntry->bssIdx;
Jeff Johnson295189b2012-06-20 16:38:30 -07001630
1631 beaconParams.paramChangeBitmap = 0;
1632 /*
1633 ** This is doing a 2 pass check. The first pass is to invalidate
1634 ** all the cache entries. The second pass is to decide whether to
1635 ** disable protection.
1636 **/
1637 if (!enable)
1638 {
1639
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001640 PELOG2(limLog(pMac, LOG2, FL("Resetting OLBC cache"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001641 psessionEntry->gLimOlbcParams.numSta = 0;
1642 psessionEntry->gLimOverlap11gParams.numSta = 0;
1643 psessionEntry->gLimOverlapHt20Params.numSta = 0;
1644 psessionEntry->gLimNonGfParams.numSta = 0;
1645 psessionEntry->gLimLsigTxopParams.numSta = 0;
1646
1647 for (i=0; i < LIM_PROT_STA_OVERLAP_CACHE_SIZE; i++)
1648 pMac->lim.protStaOverlapCache[i].active = false;
1649
1650 enable = 1;
1651 }
1652 else
1653 {
1654
Madan Mohan Koyyalamudi788b4ee2012-09-25 10:42:09 -07001655 if (!psessionEntry->gLimOlbcParams.numSta)
Jeff Johnson295189b2012-06-20 16:38:30 -07001656 {
1657 if (psessionEntry->gLimOlbcParams.protectionEnabled)
1658 {
1659 if (!psessionEntry->gLim11bParams.protectionEnabled)
1660 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001661 PELOG1(limLog(pMac, LOG1, FL("Overlap cache all clear and no 11B STA detected"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001662 limEnable11gProtection(pMac, false, true, &beaconParams, psessionEntry);
1663 }
1664 }
1665 }
1666
1667 if (!psessionEntry->gLimOverlap11gParams.numSta)
1668 {
1669 if (psessionEntry->gLimOverlap11gParams.protectionEnabled)
1670 {
1671 if (!psessionEntry->gLim11gParams.protectionEnabled)
1672 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001673 PELOG1(limLog(pMac, LOG1, FL("Overlap cache all clear and no 11G STA detected"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001674 limEnableHtProtectionFrom11g(pMac, false, true, &beaconParams,psessionEntry);
1675 }
1676 }
1677 }
1678
1679 if (!psessionEntry->gLimOverlapHt20Params.numSta)
1680 {
1681 if (psessionEntry->gLimOverlapHt20Params.protectionEnabled)
1682 {
1683 if (!psessionEntry->gLimHt20Params.protectionEnabled)
1684 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001685 PELOG1(limLog(pMac, LOG1, FL("Overlap cache all clear and no HT20 STA detected"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001686 limEnable11gProtection(pMac, false, true, &beaconParams,psessionEntry);
1687 }
1688 }
1689 }
1690
1691 enable = 0;
1692 }
1693
1694 if(beaconParams.paramChangeBitmap)
1695 {
1696 schSetFixedBeaconFields(pMac,psessionEntry);
1697 limSendBeaconParams(pMac, &beaconParams, psessionEntry);
1698 }
1699
1700 // Start OLBC timer
1701 if (tx_timer_activate(&pMac->lim.limTimers.gLimUpdateOlbcCacheTimer) != TX_SUCCESS)
1702 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001703 limLog(pMac, LOGE, FL("tx_timer_activate failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001704 }
1705}
Jeff Johnson295189b2012-06-20 16:38:30 -07001706
1707/**
1708 * limIsNullSsid()
1709 *
1710 *FUNCTION:
1711 * This function checks if Ssid supplied is Null SSID
1712 *
1713 *
1714 *LOGIC:
1715 *
1716 *ASSUMPTIONS:
1717 * NA
1718 *
1719 *NOTE:
1720 * NA
1721 *
1722 * @param tSirMacSSid *
1723 *
1724 *
1725 * @return true if SSID is Null SSID else false
1726 */
1727
1728tANI_U8
1729limIsNullSsid( tSirMacSSid *pSsid )
1730{
1731 tANI_U8 fNullSsid = false;
1732 tANI_U32 SsidLength;
1733 tANI_U8 *pSsidStr;
1734
1735 do
1736 {
1737 if ( 0 == pSsid->length )
1738 {
1739 fNullSsid = true;
1740 break;
1741 }
1742
1743#define ASCII_SPACE_CHARACTER 0x20
1744 /* If the first charactes is space, then check if all characters in
1745 * SSID are spaces to consider it as NULL SSID*/
1746 if( ASCII_SPACE_CHARACTER == pSsid->ssId[0])
1747 {
1748 SsidLength = pSsid->length;
1749 pSsidStr = pSsid->ssId;
1750 /* check if all the charactes in SSID are spaces*/
1751 while ( SsidLength )
1752 {
1753 if( ASCII_SPACE_CHARACTER != *pSsidStr )
1754 break;
1755
1756 pSsidStr++;
1757 SsidLength--;
1758 }
1759
1760 if( 0 == SsidLength )
1761 {
1762 fNullSsid = true;
1763 break;
1764 }
1765 }
1766 else
1767 {
1768 /* check if all the charactes in SSID are NULL*/
1769 SsidLength = pSsid->length;
1770 pSsidStr = pSsid->ssId;
1771
1772 while ( SsidLength )
1773 {
1774 if( *pSsidStr )
1775 break;
1776
1777 pSsidStr++;
1778 SsidLength--;
1779 }
1780
1781 if( 0 == SsidLength )
1782 {
1783 fNullSsid = true;
1784 break;
1785 }
1786 }
1787 }
1788 while( 0 );
1789
1790 return fNullSsid;
1791} /****** end limIsNullSsid() ******/
1792
1793
1794
Jeff Johnson295189b2012-06-20 16:38:30 -07001795
1796/** -------------------------------------------------------------
1797\fn limUpdateProtStaParams
1798\brief updates protection related counters.
1799\param tpAniSirGlobal pMac
1800\param tSirMacAddr peerMacAddr
1801\param tLimProtStaCacheType protStaCacheType
1802\param tHalBitVal gfSupported
1803\param tHalBitVal lsigTxopSupported
1804\return None
1805 -------------------------------------------------------------*/
1806void
1807limUpdateProtStaParams(tpAniSirGlobal pMac,
1808tSirMacAddr peerMacAddr, tLimProtStaCacheType protStaCacheType,
1809tHalBitVal gfSupported, tHalBitVal lsigTxopSupported,
1810tpPESession psessionEntry)
1811{
1812 tANI_U32 i;
1813
1814 PELOG1(limLog(pMac,LOG1, FL("A STA is associated:"));
1815 limLog(pMac,LOG1, FL("Addr : "));
1816 limPrintMacAddr(pMac, peerMacAddr, LOG1);)
1817
1818 for (i=0; i<LIM_PROT_STA_CACHE_SIZE; i++)
1819 {
1820 if (psessionEntry->protStaCache[i].active)
1821 {
1822 PELOG1(limLog(pMac, LOG1, FL("Addr: "));)
1823 PELOG1(limPrintMacAddr(pMac, psessionEntry->protStaCache[i].addr, LOG1);)
1824
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301825 if (vos_mem_compare(
Jeff Johnson295189b2012-06-20 16:38:30 -07001826 psessionEntry->protStaCache[i].addr,
1827 peerMacAddr, sizeof(tSirMacAddr)))
1828 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001829 PELOG1(limLog(pMac, LOG1, FL("matching cache entry at %d already active."), i);)
Jeff Johnson295189b2012-06-20 16:38:30 -07001830 return;
1831 }
1832 }
1833 }
1834
1835 for (i=0; i<LIM_PROT_STA_CACHE_SIZE; i++)
1836 {
1837 if (!psessionEntry->protStaCache[i].active)
1838 break;
1839 }
1840
1841 if (i >= LIM_PROT_STA_CACHE_SIZE)
1842 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001843 PELOGE(limLog(pMac, LOGE, FL("No space in ProtStaCache"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001844 return;
1845 }
1846
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301847 vos_mem_copy( psessionEntry->protStaCache[i].addr,
Jeff Johnson295189b2012-06-20 16:38:30 -07001848 peerMacAddr,
1849 sizeof(tSirMacAddr));
1850
1851 psessionEntry->protStaCache[i].protStaCacheType = protStaCacheType;
1852 psessionEntry->protStaCache[i].active = true;
1853 if(eLIM_PROT_STA_CACHE_TYPE_llB == protStaCacheType)
1854 {
1855 psessionEntry->gLim11bParams.numSta++;
1856 limLog(pMac,LOG1, FL("11B, "));
1857 }
1858 else if(eLIM_PROT_STA_CACHE_TYPE_llG == protStaCacheType)
1859 {
1860 psessionEntry->gLim11gParams.numSta++;
1861 limLog(pMac,LOG1, FL("11G, "));
1862 }
1863 else if(eLIM_PROT_STA_CACHE_TYPE_HT20 == protStaCacheType)
1864 {
1865 psessionEntry->gLimHt20Params.numSta++;
1866 limLog(pMac,LOG1, FL("HT20, "));
1867 }
1868
1869 if(!gfSupported)
1870 {
1871 psessionEntry->gLimNonGfParams.numSta++;
1872 limLog(pMac,LOG1, FL("NonGf, "));
1873 }
1874 if(!lsigTxopSupported)
1875 {
1876 psessionEntry->gLimLsigTxopParams.numSta++;
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001877 limLog(pMac,LOG1, FL("!lsigTxopSupported"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001878 }
1879}// ---------------------------------------------------------------------
1880
1881/** -------------------------------------------------------------
1882\fn limDecideApProtection
1883\brief Decides all the protection related staiton coexistence and also sets
1884\ short preamble and short slot appropriately. This function will be called
1885\ when AP is ready to send assocRsp tp the station joining right now.
1886\param tpAniSirGlobal pMac
1887\param tSirMacAddr peerMacAddr
1888\return None
1889 -------------------------------------------------------------*/
1890void
1891limDecideApProtection(tpAniSirGlobal pMac, tSirMacAddr peerMacAddr, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry)
1892{
1893 tANI_U16 tmpAid;
1894 tpDphHashNode pStaDs;
1895 tSirRFBand rfBand = SIR_BAND_UNKNOWN;
1896 tANI_U32 phyMode;
1897 tLimProtStaCacheType protStaCacheType = eLIM_PROT_STA_CACHE_TYPE_INVALID;
1898 tHalBitVal gfSupported = eHAL_SET, lsigTxopSupported = eHAL_SET;
1899
1900 pBeaconParams->paramChangeBitmap = 0;
1901 // check whether to enable protection or not
1902 pStaDs = dphLookupHashEntry(pMac, peerMacAddr, &tmpAid, &psessionEntry->dph.dphHashTable);
1903 if(NULL == pStaDs)
1904 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001905 PELOG1(limLog(pMac, LOG1, FL("pStaDs is NULL"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001906 return;
1907 }
1908 limGetRfBand(pMac, &rfBand, psessionEntry);
1909 //if we are in 5 GHZ band
1910 if(SIR_BAND_5_GHZ == rfBand)
1911 {
1912 //We are 11N. we need to protect from 11A and Ht20. we don't need any other protection in 5 GHZ.
1913 //HT20 case is common between both the bands and handled down as common code.
Jeff Johnsone7245742012-09-05 17:12:55 -07001914 if(true == psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07001915 {
1916 //we are 11N and 11A station is joining.
1917 //protection from 11A required.
1918 if(false == pStaDs->mlmStaContext.htCapability)
1919 {
1920 limEnable11aProtection(pMac, true, false, pBeaconParams,psessionEntry);
1921 return;
1922 }
1923 }
1924 }
1925 else if(SIR_BAND_2_4_GHZ== rfBand)
1926 {
1927 limGetPhyMode(pMac, &phyMode, psessionEntry);
1928
1929 //We are 11G. Check if we need protection from 11b Stations.
1930 if ((phyMode == WNI_CFG_PHY_MODE_11G) &&
Jeff Johnsone7245742012-09-05 17:12:55 -07001931 (false == psessionEntry->htCapability))
Jeff Johnson295189b2012-06-20 16:38:30 -07001932 {
1933
1934 if (pStaDs->erpEnabled== eHAL_CLEAR)
1935 {
1936 protStaCacheType = eLIM_PROT_STA_CACHE_TYPE_llB;
1937 // enable protection
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001938 PELOG3(limLog(pMac, LOG3, FL("Enabling protection from 11B"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001939 limEnable11gProtection(pMac, true, false, pBeaconParams,psessionEntry);
1940 }
1941 }
1942
1943 //HT station.
Jeff Johnsone7245742012-09-05 17:12:55 -07001944 if (true == psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07001945 {
1946 //check if we need protection from 11b station
1947 if ((pStaDs->erpEnabled == eHAL_CLEAR) &&
1948 (!pStaDs->mlmStaContext.htCapability))
1949 {
1950 protStaCacheType = eLIM_PROT_STA_CACHE_TYPE_llB;
1951 // enable protection
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001952 PELOG3(limLog(pMac, LOG3, FL("Enabling protection from 11B"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001953 limEnable11gProtection(pMac, true, false, pBeaconParams, psessionEntry);
1954 }
1955 //station being joined is non-11b and non-ht ==> 11g device
1956 else if(!pStaDs->mlmStaContext.htCapability)
1957 {
1958 protStaCacheType = eLIM_PROT_STA_CACHE_TYPE_llG;
1959 //enable protection
1960 limEnableHtProtectionFrom11g(pMac, true, false, pBeaconParams, psessionEntry);
1961 }
1962 //ERP mode is enabled for the latest station joined
1963 //latest station joined is HT capable
1964 //This case is being handled in common code (commn between both the bands) below.
1965 }
1966 }
1967
1968 //we are HT and HT station is joining. This code is common for both the bands.
Jeff Johnsone7245742012-09-05 17:12:55 -07001969 if((true == psessionEntry->htCapability) &&
Jeff Johnson295189b2012-06-20 16:38:30 -07001970 (true == pStaDs->mlmStaContext.htCapability))
1971 {
1972 if(!pStaDs->htGreenfield)
1973 {
1974 limEnableHTNonGfProtection(pMac, true, false, pBeaconParams, psessionEntry);
1975 gfSupported = eHAL_CLEAR;
1976 }
1977 //Station joining is HT 20Mhz
1978 if(eHT_CHANNEL_WIDTH_20MHZ == pStaDs->htSupportedChannelWidthSet)
1979 {
1980 protStaCacheType = eLIM_PROT_STA_CACHE_TYPE_HT20;
1981 limEnableHT20Protection(pMac, true, false, pBeaconParams, psessionEntry);
1982 }
1983 //Station joining does not support LSIG TXOP Protection
1984 if(!pStaDs->htLsigTXOPProtection)
1985 {
1986 limEnableHTLsigTxopProtection(pMac, false, false, pBeaconParams,psessionEntry);
1987 lsigTxopSupported = eHAL_CLEAR;
1988 }
1989 }
1990
1991 limUpdateProtStaParams(pMac, peerMacAddr, protStaCacheType,
1992 gfSupported, lsigTxopSupported, psessionEntry);
1993
1994 return;
1995}
Jeff Johnson295189b2012-06-20 16:38:30 -07001996
1997
1998/** -------------------------------------------------------------
1999\fn limEnableOverlap11gProtection
2000\brief wrapper function for setting overlap 11g protection.
2001\param tpAniSirGlobal pMac
2002\param tpUpdateBeaconParams pBeaconParams
2003\param tpSirMacMgmtHdr pMh
2004\return None
2005 -------------------------------------------------------------*/
2006void
2007limEnableOverlap11gProtection(tpAniSirGlobal pMac,
2008tpUpdateBeaconParams pBeaconParams, tpSirMacMgmtHdr pMh,tpPESession psessionEntry)
2009{
2010 limUpdateOverlapStaParam(pMac, pMh->bssId, &(psessionEntry->gLimOlbcParams));
2011
2012 if (psessionEntry->gLimOlbcParams.numSta &&
2013 !psessionEntry->gLimOlbcParams.protectionEnabled)
2014 {
2015 // enable protection
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002016 PELOG1(limLog(pMac, LOG1, FL("OLBC happens!!!"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002017 limEnable11gProtection(pMac, true, true, pBeaconParams,psessionEntry);
2018 }
2019}
2020
2021
2022/** -------------------------------------------------------------
2023\fn limUpdateShortPreamble
2024\brief Updates short preamble if needed when a new station joins.
2025\param tpAniSirGlobal pMac
2026\param tSirMacAddr peerMacAddr
2027\param tpUpdateBeaconParams pBeaconParams
2028\return None
2029 -------------------------------------------------------------*/
2030void
2031limUpdateShortPreamble(tpAniSirGlobal pMac, tSirMacAddr peerMacAddr,
2032 tpUpdateBeaconParams pBeaconParams, tpPESession psessionEntry)
2033{
2034 tANI_U16 tmpAid;
2035 tpDphHashNode pStaDs;
2036 tANI_U32 phyMode;
2037 tANI_U16 i;
2038
2039 // check whether to enable protection or not
2040 pStaDs = dphLookupHashEntry(pMac, peerMacAddr, &tmpAid, &psessionEntry->dph.dphHashTable);
2041
2042 limGetPhyMode(pMac, &phyMode, psessionEntry);
2043
2044 if (pStaDs != NULL && phyMode == WNI_CFG_PHY_MODE_11G)
2045
2046 {
2047 if (pStaDs->shortPreambleEnabled == eHAL_CLEAR)
2048 {
2049 PELOG1(limLog(pMac,LOG1,FL("Short Preamble is not enabled in Assoc Req from "));
2050 limPrintMacAddr(pMac, peerMacAddr, LOG1);)
2051
2052 for (i=0; i<LIM_PROT_STA_CACHE_SIZE; i++)
2053 {
Jeff Johnson295189b2012-06-20 16:38:30 -07002054 if ((psessionEntry->limSystemRole == eLIM_AP_ROLE ) &&
2055 psessionEntry->gLimNoShortParams.staNoShortCache[i].active)
2056 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05302057 if (vos_mem_compare(
Jeff Johnson295189b2012-06-20 16:38:30 -07002058 psessionEntry->gLimNoShortParams.staNoShortCache[i].addr,
2059 peerMacAddr, sizeof(tSirMacAddr)))
2060 return;
2061 }else if(psessionEntry->limSystemRole != eLIM_AP_ROLE)
Jeff Johnson295189b2012-06-20 16:38:30 -07002062 {
2063 if (pMac->lim.gLimNoShortParams.staNoShortCache[i].active)
2064 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05302065 if (vos_mem_compare(
Jeff Johnson295189b2012-06-20 16:38:30 -07002066 pMac->lim.gLimNoShortParams.staNoShortCache[i].addr,
2067 peerMacAddr, sizeof(tSirMacAddr)))
2068 return;
2069 }
2070 }
2071 }
2072
2073
2074 for (i=0; i<LIM_PROT_STA_CACHE_SIZE; i++)
2075 {
Jeff Johnson295189b2012-06-20 16:38:30 -07002076 if ( (psessionEntry->limSystemRole == eLIM_AP_ROLE ) &&
2077 !psessionEntry->gLimNoShortParams.staNoShortCache[i].active)
2078 break;
2079 else
Jeff Johnson295189b2012-06-20 16:38:30 -07002080 {
2081 if (!pMac->lim.gLimNoShortParams.staNoShortCache[i].active)
2082 break;
2083 }
2084 }
2085
2086 if (i >= LIM_PROT_STA_CACHE_SIZE)
2087 {
Jeff Johnson295189b2012-06-20 16:38:30 -07002088 if(psessionEntry->limSystemRole == eLIM_AP_ROLE){
2089 limLog(pMac, LOGE, FL("No space in Short cache (#active %d, #sta %d) for sta "),
2090 i, psessionEntry->gLimNoShortParams.numNonShortPreambleSta);
2091 limPrintMacAddr(pMac, peerMacAddr, LOGE);
2092 return;
2093 }
2094 else
Jeff Johnson295189b2012-06-20 16:38:30 -07002095 {
2096 limLog(pMac, LOGE, FL("No space in Short cache (#active %d, #sta %d) for sta "),
2097 i, pMac->lim.gLimNoShortParams.numNonShortPreambleSta);
2098 limPrintMacAddr(pMac, peerMacAddr, LOGE);
2099 return;
2100 }
2101
2102 }
2103
2104
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05302105 if (psessionEntry->limSystemRole == eLIM_AP_ROLE){
2106 vos_mem_copy( psessionEntry->gLimNoShortParams.staNoShortCache[i].addr,
Jeff Johnson295189b2012-06-20 16:38:30 -07002107 peerMacAddr, sizeof(tSirMacAddr));
2108 psessionEntry->gLimNoShortParams.staNoShortCache[i].active = true;
2109 psessionEntry->gLimNoShortParams.numNonShortPreambleSta++;
2110 }else
Jeff Johnson295189b2012-06-20 16:38:30 -07002111 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05302112 vos_mem_copy( pMac->lim.gLimNoShortParams.staNoShortCache[i].addr,
Jeff Johnson295189b2012-06-20 16:38:30 -07002113 peerMacAddr, sizeof(tSirMacAddr));
2114 pMac->lim.gLimNoShortParams.staNoShortCache[i].active = true;
2115 pMac->lim.gLimNoShortParams.numNonShortPreambleSta++;
2116 }
2117
2118
2119 // enable long preamble
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002120 PELOG1(limLog(pMac, LOG1, FL("Disabling short preamble"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002121
Jeff Johnson295189b2012-06-20 16:38:30 -07002122 if (limEnableShortPreamble(pMac, false, pBeaconParams, psessionEntry) != eSIR_SUCCESS)
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002123 PELOGE(limLog(pMac, LOGE, FL("Cannot enable long preamble"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002124 }
2125 }
2126}
2127
2128/** -------------------------------------------------------------
2129\fn limUpdateShortSlotTime
2130\brief Updates short slot time if needed when a new station joins.
2131\param tpAniSirGlobal pMac
2132\param tSirMacAddr peerMacAddr
2133\param tpUpdateBeaconParams pBeaconParams
2134\return None
2135 -------------------------------------------------------------*/
2136
2137void
2138limUpdateShortSlotTime(tpAniSirGlobal pMac, tSirMacAddr peerMacAddr,
2139 tpUpdateBeaconParams pBeaconParams, tpPESession psessionEntry)
2140{
2141 tANI_U16 tmpAid;
2142 tpDphHashNode pStaDs;
2143 tANI_U32 phyMode;
2144 tANI_U32 val;
Jeff Johnson295189b2012-06-20 16:38:30 -07002145 tANI_U16 i;
2146
2147 // check whether to enable protection or not
2148 pStaDs = dphLookupHashEntry(pMac, peerMacAddr, &tmpAid, &psessionEntry->dph.dphHashTable);
2149 limGetPhyMode(pMac, &phyMode, psessionEntry);
2150
Jeff Johnsone7245742012-09-05 17:12:55 -07002151 /* Only in case of softap in 11g mode, slot time might change depending on the STA being added. In 11a case, it should
2152 * be always 1 and in 11b case, it should be always 0
2153 */
Jeff Johnson295189b2012-06-20 16:38:30 -07002154 if (pStaDs != NULL && phyMode == WNI_CFG_PHY_MODE_11G)
2155 {
Jeff Johnsone7245742012-09-05 17:12:55 -07002156 /* Only when the new STA has short slot time disabled, we need to change softap's overall slot time settings
2157 * else the default for softap is always short slot enabled. When the last long slot STA leaves softAP, we take care of
2158 * it in limDecideShortSlot
2159 */
Jeff Johnson295189b2012-06-20 16:38:30 -07002160 if (pStaDs->shortSlotTimeEnabled == eHAL_CLEAR)
2161 {
2162 PELOG1(limLog(pMac, LOG1, FL("Short Slot Time is not enabled in Assoc Req from "));
2163 limPrintMacAddr(pMac, peerMacAddr, LOG1);)
2164 for (i=0; i<LIM_PROT_STA_CACHE_SIZE; i++)
2165 {
Jeff Johnson295189b2012-06-20 16:38:30 -07002166 if ((psessionEntry->limSystemRole == eLIM_AP_ROLE ) &&
2167 psessionEntry->gLimNoShortSlotParams.staNoShortSlotCache[i].active)
2168 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05302169 if (vos_mem_compare(
Jeff Johnson295189b2012-06-20 16:38:30 -07002170 psessionEntry->gLimNoShortSlotParams.staNoShortSlotCache[i].addr,
2171 peerMacAddr, sizeof(tSirMacAddr)))
2172 return;
2173 }
2174 else if(psessionEntry->limSystemRole != eLIM_AP_ROLE )
Jeff Johnson295189b2012-06-20 16:38:30 -07002175 {
2176 if (pMac->lim.gLimNoShortSlotParams.staNoShortSlotCache[i].active)
2177 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05302178 if (vos_mem_compare(
Jeff Johnson295189b2012-06-20 16:38:30 -07002179 pMac->lim.gLimNoShortSlotParams.staNoShortSlotCache[i].addr,
2180 peerMacAddr, sizeof(tSirMacAddr)))
2181 return;
2182 }
2183 }
2184 }
2185
2186 for (i=0; i<LIM_PROT_STA_CACHE_SIZE; i++)
2187 {
Jeff Johnson295189b2012-06-20 16:38:30 -07002188 if ((psessionEntry->limSystemRole == eLIM_AP_ROLE ) &&
2189 !psessionEntry->gLimNoShortSlotParams.staNoShortSlotCache[i].active)
2190 break;
2191 else
Jeff Johnson295189b2012-06-20 16:38:30 -07002192 {
2193 if (!pMac->lim.gLimNoShortSlotParams.staNoShortSlotCache[i].active)
2194 break;
2195 }
2196 }
2197
2198 if (i >= LIM_PROT_STA_CACHE_SIZE)
2199 {
Jeff Johnson295189b2012-06-20 16:38:30 -07002200 if(psessionEntry->limSystemRole == eLIM_AP_ROLE){
2201 limLog(pMac, LOGE, FL("No space in ShortSlot cache (#active %d, #sta %d) for sta "),
2202 i, psessionEntry->gLimNoShortSlotParams.numNonShortSlotSta);
2203 limPrintMacAddr(pMac, peerMacAddr, LOGE);
2204 return;
2205 }else
Jeff Johnson295189b2012-06-20 16:38:30 -07002206 {
2207 limLog(pMac, LOGE, FL("No space in ShortSlot cache (#active %d, #sta %d) for sta "),
2208 i, pMac->lim.gLimNoShortSlotParams.numNonShortSlotSta);
2209 limPrintMacAddr(pMac, peerMacAddr, LOGE);
2210 return;
2211 }
2212 }
2213
2214
Jeff Johnson295189b2012-06-20 16:38:30 -07002215 if(psessionEntry->limSystemRole == eLIM_AP_ROLE){
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05302216 vos_mem_copy( psessionEntry->gLimNoShortSlotParams.staNoShortSlotCache[i].addr,
Jeff Johnson295189b2012-06-20 16:38:30 -07002217 peerMacAddr, sizeof(tSirMacAddr));
2218 psessionEntry->gLimNoShortSlotParams.staNoShortSlotCache[i].active = true;
2219 psessionEntry->gLimNoShortSlotParams.numNonShortSlotSta++;
2220 }else
Jeff Johnson295189b2012-06-20 16:38:30 -07002221 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05302222 vos_mem_copy( pMac->lim.gLimNoShortSlotParams.staNoShortSlotCache[i].addr,
Jeff Johnson295189b2012-06-20 16:38:30 -07002223 peerMacAddr, sizeof(tSirMacAddr));
2224 pMac->lim.gLimNoShortSlotParams.staNoShortSlotCache[i].active = true;
2225 pMac->lim.gLimNoShortSlotParams.numNonShortSlotSta++;
2226 }
2227 wlan_cfgGetInt(pMac, WNI_CFG_11G_SHORT_SLOT_TIME_ENABLED, &val);
2228
Jeff Johnsone7245742012-09-05 17:12:55 -07002229 /* 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
2230 * only long slot enabled, we need to change our beacon/pb rsp to broadcast short slot disabled
2231 */
Jeff Johnson295189b2012-06-20 16:38:30 -07002232 if ( (psessionEntry->limSystemRole == eLIM_AP_ROLE) &&
Jeff Johnsone7245742012-09-05 17:12:55 -07002233 (val && psessionEntry->gLimNoShortSlotParams.numNonShortSlotSta && psessionEntry->shortSlotTimeSupported))
Jeff Johnson295189b2012-06-20 16:38:30 -07002234 {
2235 // enable long slot time
2236 pBeaconParams->fShortSlotTime = false;
2237 pBeaconParams->paramChangeBitmap |= PARAM_SHORT_SLOT_TIME_CHANGED;
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002238 PELOG1(limLog(pMac, LOG1, FL("Disable short slot time. Enable long slot time."));)
Jeff Johnsone7245742012-09-05 17:12:55 -07002239 psessionEntry->shortSlotTimeSupported = false;
Jeff Johnson295189b2012-06-20 16:38:30 -07002240 }
2241 else if ( psessionEntry->limSystemRole != eLIM_AP_ROLE)
Jeff Johnson295189b2012-06-20 16:38:30 -07002242 {
Jeff Johnsone7245742012-09-05 17:12:55 -07002243 if (val && pMac->lim.gLimNoShortSlotParams.numNonShortSlotSta && psessionEntry->shortSlotTimeSupported)
Jeff Johnson295189b2012-06-20 16:38:30 -07002244 {
2245 // enable long slot time
2246 pBeaconParams->fShortSlotTime = false;
2247 pBeaconParams->paramChangeBitmap |= PARAM_SHORT_SLOT_TIME_CHANGED;
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002248 PELOG1(limLog(pMac, LOG1, FL("Disable short slot time. Enable long slot time."));)
Jeff Johnsone7245742012-09-05 17:12:55 -07002249 psessionEntry->shortSlotTimeSupported = false;
Jeff Johnson295189b2012-06-20 16:38:30 -07002250 }
2251 }
2252 }
2253 }
2254}
2255
Jeff Johnson295189b2012-06-20 16:38:30 -07002256
2257/** -------------------------------------------------------------
2258\fn limDecideStaProtectionOnAssoc
2259\brief Decide protection related settings on Sta while association.
2260\param tpAniSirGlobal pMac
2261\param tpSchBeaconStruct pBeaconStruct
2262\return None
2263 -------------------------------------------------------------*/
2264void
2265limDecideStaProtectionOnAssoc(tpAniSirGlobal pMac,
2266 tpSchBeaconStruct pBeaconStruct, tpPESession psessionEntry)
2267{
2268 tSirRFBand rfBand = SIR_BAND_UNKNOWN;
2269 tANI_U32 phyMode = WNI_CFG_PHY_MODE_NONE;
2270
2271 limGetRfBand(pMac, &rfBand, psessionEntry);
2272 limGetPhyMode(pMac, &phyMode, psessionEntry);
2273
2274 if(SIR_BAND_5_GHZ == rfBand)
2275 {
2276 if((eSIR_HT_OP_MODE_MIXED == pBeaconStruct->HTInfo.opMode) ||
2277 (eSIR_HT_OP_MODE_OVERLAP_LEGACY == pBeaconStruct->HTInfo.opMode))
2278 {
2279 if(pMac->lim.cfgProtection.fromlla)
2280 psessionEntry->beaconParams.llaCoexist = true;
2281 }
2282 else if(eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT == pBeaconStruct->HTInfo.opMode)
2283 {
2284 if(pMac->lim.cfgProtection.ht20)
2285 psessionEntry->beaconParams.ht20Coexist = true;
2286 }
2287
2288 }
2289 else if(SIR_BAND_2_4_GHZ == rfBand)
2290 {
2291 //spec 7.3.2.13
2292 //UseProtection will be set when nonERP STA is associated.
2293 //NonERPPresent bit will be set when:
2294 //--nonERP Sta is associated OR
2295 //--nonERP Sta exists in overlapping BSS
2296 //when useProtection is not set then protection from nonERP stations is optional.
2297
2298 //CFG protection from 11b is enabled and
2299 //11B device in the BSS
2300 /* TODO, This is not sessionized */
2301 if (phyMode != WNI_CFG_PHY_MODE_11B)
2302 {
2303 if (pMac->lim.cfgProtection.fromllb &&
2304 pBeaconStruct->erpPresent &&
2305 (pBeaconStruct->erpIEInfo.useProtection ||
2306 pBeaconStruct->erpIEInfo.nonErpPresent))
2307 {
2308 psessionEntry->beaconParams.llbCoexist = true;
2309 }
2310 //AP has no 11b station associated.
2311 else
2312 {
2313 psessionEntry->beaconParams.llbCoexist = false;
2314 }
2315 }
2316 //following code block is only for HT station.
Jeff Johnsone7245742012-09-05 17:12:55 -07002317 if((psessionEntry->htCapability) &&
Jeff Johnson295189b2012-06-20 16:38:30 -07002318 (pBeaconStruct->HTInfo.present))
2319 {
2320 tDot11fIEHTInfo htInfo = pBeaconStruct->HTInfo;
2321
2322 //Obss Non HT STA present mode
2323 psessionEntry->beaconParams.gHTObssMode = (tANI_U8)htInfo.obssNonHTStaPresent;
2324
2325
2326 //CFG protection from 11G is enabled and
2327 //our AP has at least one 11G station associated.
2328 if(pMac->lim.cfgProtection.fromllg &&
2329 ((eSIR_HT_OP_MODE_MIXED == htInfo.opMode) ||
2330 (eSIR_HT_OP_MODE_OVERLAP_LEGACY == htInfo.opMode))&&
2331 (!psessionEntry->beaconParams.llbCoexist))
2332 {
2333 if(pMac->lim.cfgProtection.fromllg)
2334 psessionEntry->beaconParams.llgCoexist = true;
2335 }
2336
2337 //AP has only HT stations associated and at least one station is HT 20
2338 //disable protection from any non-HT devices.
2339 //decision for disabling protection from 11b has already been taken above.
2340 if(eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT == htInfo.opMode)
2341 {
2342 //Disable protection from 11G station.
2343 psessionEntry->beaconParams.llgCoexist = false;
2344 //CFG protection from HT 20 is enabled.
2345 if(pMac->lim.cfgProtection.ht20)
2346 psessionEntry->beaconParams.ht20Coexist = true;
2347 }
2348 //Disable protection from non-HT and HT20 devices.
2349 //decision for disabling protection from 11b has already been taken above.
2350 if(eSIR_HT_OP_MODE_PURE == htInfo.opMode)
2351 {
2352 psessionEntry->beaconParams.llgCoexist = false;
2353 psessionEntry->beaconParams.ht20Coexist = false;
2354 }
2355
2356 }
2357 }
2358
2359 //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 -07002360 if((psessionEntry->htCapability) &&
Jeff Johnson295189b2012-06-20 16:38:30 -07002361 (pBeaconStruct->HTInfo.present))
2362 {
2363 tDot11fIEHTInfo htInfo = pBeaconStruct->HTInfo;
2364 psessionEntry->beaconParams.fRIFSMode =
2365 ( tANI_U8 ) htInfo.rifsMode;
2366 psessionEntry->beaconParams.llnNonGFCoexist =
2367 ( tANI_U8 )htInfo.nonGFDevicesPresent;
2368 psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport =
2369 ( tANI_U8 )htInfo.lsigTXOPProtectionFullSupport;
2370 }
2371}
2372
2373
2374/** -------------------------------------------------------------
2375\fn limDecideStaProtection
2376\brief Decides protection related settings on Sta while processing beacon.
2377\param tpAniSirGlobal pMac
2378\param tpUpdateBeaconParams pBeaconParams
2379\return None
2380 -------------------------------------------------------------*/
2381void
2382limDecideStaProtection(tpAniSirGlobal pMac,
2383 tpSchBeaconStruct pBeaconStruct, tpUpdateBeaconParams pBeaconParams, tpPESession psessionEntry)
2384{
2385
2386 tSirRFBand rfBand = SIR_BAND_UNKNOWN;
2387 tANI_U32 phyMode = WNI_CFG_PHY_MODE_NONE;
2388
2389 limGetRfBand(pMac, &rfBand, psessionEntry);
2390 limGetPhyMode(pMac, &phyMode, psessionEntry);
2391
2392 if(SIR_BAND_5_GHZ == rfBand)
2393 {
2394 //we are HT capable.
Jeff Johnsone7245742012-09-05 17:12:55 -07002395 if((true == psessionEntry->htCapability) &&
Jeff Johnson295189b2012-06-20 16:38:30 -07002396 (pBeaconStruct->HTInfo.present))
2397 {
2398 //we are HT capable, AP's HT OPMode is mixed / overlap legacy ==> need protection from 11A.
2399 if((eSIR_HT_OP_MODE_MIXED == pBeaconStruct->HTInfo.opMode) ||
2400 (eSIR_HT_OP_MODE_OVERLAP_LEGACY == pBeaconStruct->HTInfo.opMode))
2401 {
2402 limEnable11aProtection(pMac, true, false, pBeaconParams,psessionEntry);
2403 }
2404 //we are HT capable, AP's HT OPMode is HT20 ==> disable protection from 11A if enabled. enabled
2405 //protection from HT20 if needed.
2406 else if(eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT== pBeaconStruct->HTInfo.opMode)
2407 {
2408 limEnable11aProtection(pMac, false, false, pBeaconParams,psessionEntry);
2409 limEnableHT20Protection(pMac, true, false, pBeaconParams,psessionEntry);
2410 }
2411 else if(eSIR_HT_OP_MODE_PURE == pBeaconStruct->HTInfo.opMode)
2412 {
2413 limEnable11aProtection(pMac, false, false, pBeaconParams,psessionEntry);
2414 limEnableHT20Protection(pMac, false, false, pBeaconParams,psessionEntry);
2415 }
2416 }
2417 }
2418 else if(SIR_BAND_2_4_GHZ == rfBand)
2419 {
2420 /* spec 7.3.2.13
2421 * UseProtection will be set when nonERP STA is associated.
2422 * NonERPPresent bit will be set when:
2423 * --nonERP Sta is associated OR
2424 * --nonERP Sta exists in overlapping BSS
2425 * when useProtection is not set then protection from nonERP stations is optional.
2426 */
2427
2428 if (phyMode != WNI_CFG_PHY_MODE_11B)
2429 {
2430 if (pBeaconStruct->erpPresent &&
2431 (pBeaconStruct->erpIEInfo.useProtection ||
2432 pBeaconStruct->erpIEInfo.nonErpPresent))
2433 {
2434 limEnable11gProtection(pMac, true, false, pBeaconParams, psessionEntry);
2435 }
2436 //AP has no 11b station associated.
2437 else
2438 {
2439 //disable protection from 11b station
2440 limEnable11gProtection(pMac, false, false, pBeaconParams, psessionEntry);
2441 }
2442 }
2443
2444 //following code block is only for HT station.
Jeff Johnsone7245742012-09-05 17:12:55 -07002445 if((psessionEntry->htCapability) &&
Jeff Johnson295189b2012-06-20 16:38:30 -07002446 (pBeaconStruct->HTInfo.present))
2447 {
2448
2449 tDot11fIEHTInfo htInfo = pBeaconStruct->HTInfo;
2450 //AP has at least one 11G station associated.
2451 if(((eSIR_HT_OP_MODE_MIXED == htInfo.opMode) ||
2452 (eSIR_HT_OP_MODE_OVERLAP_LEGACY == htInfo.opMode))&&
2453 (!psessionEntry->beaconParams.llbCoexist))
2454 {
2455 limEnableHtProtectionFrom11g(pMac, true, false, pBeaconParams,psessionEntry);
2456
2457 }
2458
2459 //no HT operating mode change ==> no change in protection settings except for MIXED_MODE/Legacy Mode.
2460 //in Mixed mode/legacy Mode even if there is no change in HT operating mode, there might be change in 11bCoexist
2461 //or 11gCoexist. that is why this check is being done after mixed/legacy mode check.
2462 if ( pMac->lim.gHTOperMode != ( tSirMacHTOperatingMode )htInfo.opMode )
2463 {
2464 pMac->lim.gHTOperMode = ( tSirMacHTOperatingMode )htInfo.opMode;
2465
2466 //AP has only HT stations associated and at least one station is HT 20
2467 //disable protection from any non-HT devices.
2468 //decision for disabling protection from 11b has already been taken above.
2469 if(eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT == htInfo.opMode)
2470 {
2471 //Disable protection from 11G station.
2472 limEnableHtProtectionFrom11g(pMac, false, false, pBeaconParams,psessionEntry);
2473
2474 limEnableHT20Protection(pMac, true, false, pBeaconParams,psessionEntry);
2475 }
2476 //Disable protection from non-HT and HT20 devices.
2477 //decision for disabling protection from 11b has already been taken above.
2478 else if(eSIR_HT_OP_MODE_PURE == htInfo.opMode)
2479 {
2480 limEnableHtProtectionFrom11g(pMac, false, false, pBeaconParams,psessionEntry);
2481 limEnableHT20Protection(pMac, false, false, pBeaconParams,psessionEntry);
2482
2483 }
2484 }
2485 }
2486 }
2487
2488 //following code block is only for HT station. ( 2.4 GHZ as well as 5 GHZ)
Jeff Johnsone7245742012-09-05 17:12:55 -07002489 if((psessionEntry->htCapability) &&
Jeff Johnson295189b2012-06-20 16:38:30 -07002490 (pBeaconStruct->HTInfo.present))
2491 {
2492 tDot11fIEHTInfo htInfo = pBeaconStruct->HTInfo;
2493 //Check for changes in protection related factors other than HT operating mode.
2494 //Check for changes in RIFS mode, nonGFDevicesPresent, lsigTXOPProtectionFullSupport.
2495 if ( psessionEntry->beaconParams.fRIFSMode !=
2496 ( tANI_U8 ) htInfo.rifsMode )
2497 {
2498 pBeaconParams->fRIFSMode =
2499 psessionEntry->beaconParams.fRIFSMode =
2500 ( tANI_U8 ) htInfo.rifsMode;
2501 pBeaconParams->paramChangeBitmap |= PARAM_RIFS_MODE_CHANGED;
2502 }
2503
2504 if ( psessionEntry->beaconParams.llnNonGFCoexist !=
2505 htInfo.nonGFDevicesPresent )
2506 {
2507 pBeaconParams->llnNonGFCoexist =
2508 psessionEntry->beaconParams.llnNonGFCoexist =
2509 ( tANI_U8 )htInfo.nonGFDevicesPresent;
2510 pBeaconParams->paramChangeBitmap |=
2511 PARAM_NON_GF_DEVICES_PRESENT_CHANGED;
2512 }
2513
2514 if ( psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport !=
2515 ( tANI_U8 )htInfo.lsigTXOPProtectionFullSupport )
2516 {
2517 pBeaconParams->fLsigTXOPProtectionFullSupport =
2518 psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport =
2519 ( tANI_U8 )htInfo.lsigTXOPProtectionFullSupport;
2520 pBeaconParams->paramChangeBitmap |=
2521 PARAM_LSIG_TXOP_FULL_SUPPORT_CHANGED;
2522 }
2523
2524 // For Station just update the global lim variable, no need to send message to HAL
2525 // Station already taking care of HT OPR Mode=01, meaning AP is seeing legacy
2526 //stations in overlapping BSS.
2527 if ( psessionEntry->beaconParams.gHTObssMode != ( tANI_U8 )htInfo.obssNonHTStaPresent )
2528 psessionEntry->beaconParams.gHTObssMode = ( tANI_U8 )htInfo.obssNonHTStaPresent ;
2529
2530 }
2531}
2532
2533
2534/**
2535 * limProcessChannelSwitchTimeout()
2536 *
2537 *FUNCTION:
2538 * This function is invoked when Channel Switch Timer expires at
2539 * the STA. Now, STA must stop traffic, and then change/disable
2540 * primary or secondary channel.
2541 *
2542 *
2543 *NOTE:
2544 * @param pMac - Pointer to Global MAC structure
2545 * @return None
2546 */
2547void limProcessChannelSwitchTimeout(tpAniSirGlobal pMac)
2548{
2549 tpPESession psessionEntry = NULL;
Jeff Johnsone7245742012-09-05 17:12:55 -07002550 tANI_U8 channel; // This is received and stored from channelSwitch Action frame
Jeff Johnson295189b2012-06-20 16:38:30 -07002551
2552 if((psessionEntry = peFindSessionBySessionId(pMac, pMac->lim.limTimers.gLimChannelSwitchTimer.sessionId))== NULL)
2553 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002554 limLog(pMac, LOGP,FL("Session Does not exist for given sessionID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002555 return;
2556 }
2557
2558 if (psessionEntry->limSystemRole != eLIM_STA_ROLE)
2559 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002560 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 -07002561 return;
2562 }
Jeff Johnsone7245742012-09-05 17:12:55 -07002563 channel = psessionEntry->gLimChannelSwitch.primaryChannel;
Jeff Johnson295189b2012-06-20 16:38:30 -07002564 /*
2565 * This potentially can create issues if the function tries to set
2566 * channel while device is in power-save, hence putting an extra check
2567 * to verify if the device is in power-save or not
2568 */
2569 if(!limIsSystemInActiveState(pMac))
2570 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002571 PELOGW(limLog(pMac, LOGW, FL("Device is not in active state, cannot switch channel"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002572 return;
2573 }
2574
2575 // Restore Channel Switch parameters to default
Jeff Johnsone7245742012-09-05 17:12:55 -07002576 psessionEntry->gLimChannelSwitch.switchTimeoutValue = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07002577
2578 /* Channel-switch timeout has occurred. reset the state */
Jeff Johnsone7245742012-09-05 17:12:55 -07002579 psessionEntry->gLimSpecMgmt.dot11hChanSwState = eLIM_11H_CHANSW_END;
Jeff Johnson295189b2012-06-20 16:38:30 -07002580
2581 /* Check if the AP is switching to a channel that we support.
2582 * Else, just don't bother to switch. Indicate HDD to look for a
2583 * better AP to associate
2584 */
2585 if(!limIsChannelValidForChannelSwitch(pMac, channel))
2586 {
2587 /* We need to restore pre-channelSwitch state on the STA */
2588 if(limRestorePreChannelSwitchState(pMac, psessionEntry) != eSIR_SUCCESS)
2589 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002590 limLog(pMac, LOGP, FL("Could not restore pre-channelSwitch (11h) state, resetting the system"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002591 return;
2592 }
2593
2594 /* If the channel-list that AP is asking us to switch is invalid,
2595 * then we cannot switch the channel. Just disassociate from AP.
2596 * We will find a better AP !!!
2597 */
2598 limTearDownLinkWithAp(pMac,
2599 pMac->lim.limTimers.gLimChannelSwitchTimer.sessionId,
2600 eSIR_MAC_UNSPEC_FAILURE_REASON);
2601 return;
2602 }
Kiran Kumar Lokereb8bb6842013-08-12 16:40:24 -07002603 limCovertChannelScanType(pMac, psessionEntry->currentOperChannel, false);
2604 pMac->lim.dfschannelList.timeStamp[psessionEntry->currentOperChannel] = 0;
Jeff Johnsone7245742012-09-05 17:12:55 -07002605 switch(psessionEntry->gLimChannelSwitch.state)
Jeff Johnson295189b2012-06-20 16:38:30 -07002606 {
2607 case eLIM_CHANNEL_SWITCH_PRIMARY_ONLY:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002608 PELOGW(limLog(pMac, LOGW, FL("CHANNEL_SWITCH_PRIMARY_ONLY "));)
Jeff Johnsone7245742012-09-05 17:12:55 -07002609 limSwitchPrimaryChannel(pMac, psessionEntry->gLimChannelSwitch.primaryChannel,psessionEntry);
2610 psessionEntry->gLimChannelSwitch.state = eLIM_CHANNEL_SWITCH_IDLE;
Jeff Johnson295189b2012-06-20 16:38:30 -07002611 break;
2612
2613 case eLIM_CHANNEL_SWITCH_SECONDARY_ONLY:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002614 PELOGW(limLog(pMac, LOGW, FL("CHANNEL_SWITCH_SECONDARY_ONLY "));)
Jeff Johnsone7245742012-09-05 17:12:55 -07002615 limSwitchPrimarySecondaryChannel(pMac, psessionEntry,
Jeff Johnson295189b2012-06-20 16:38:30 -07002616 psessionEntry->currentOperChannel,
Jeff Johnsone7245742012-09-05 17:12:55 -07002617 psessionEntry->gLimChannelSwitch.secondarySubBand);
2618 psessionEntry->gLimChannelSwitch.state = eLIM_CHANNEL_SWITCH_IDLE;
Jeff Johnson295189b2012-06-20 16:38:30 -07002619 break;
2620
2621 case eLIM_CHANNEL_SWITCH_PRIMARY_AND_SECONDARY:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002622 PELOGW(limLog(pMac, LOGW, FL("CHANNEL_SWITCH_PRIMARY_AND_SECONDARY"));)
Jeff Johnsone7245742012-09-05 17:12:55 -07002623 limSwitchPrimarySecondaryChannel(pMac, psessionEntry,
2624 psessionEntry->gLimChannelSwitch.primaryChannel,
2625 psessionEntry->gLimChannelSwitch.secondarySubBand);
2626 psessionEntry->gLimChannelSwitch.state = eLIM_CHANNEL_SWITCH_IDLE;
Jeff Johnson295189b2012-06-20 16:38:30 -07002627 break;
2628
2629 case eLIM_CHANNEL_SWITCH_IDLE:
2630 default:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002631 PELOGE(limLog(pMac, LOGE, FL("incorrect state "));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002632 if(limRestorePreChannelSwitchState(pMac, psessionEntry) != eSIR_SUCCESS)
2633 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002634 limLog(pMac, LOGP, FL("Could not restore pre-channelSwitch (11h) state, resetting the system"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002635 }
2636 return; /* Please note, this is 'return' and not 'break' */
2637 }
Jeff Johnsone7245742012-09-05 17:12:55 -07002638}
Jeff Johnson295189b2012-06-20 16:38:30 -07002639
2640/**
2641 * limUpdateChannelSwitch()
2642 *
2643 *FUNCTION:
2644 * This function is invoked whenever Station receives
2645 * either 802.11h channel switch IE or airgo proprietary
2646 * channel switch IE.
2647 *
2648 *NOTE:
2649 * @param pMac - Pointer to Global MAC structure
2650 * @return tpSirProbeRespBeacon - Pointer to Beacon/Probe Rsp
2651 * @param psessionentry
2652 */
2653void
2654limUpdateChannelSwitch(struct sAniSirGlobal *pMac, tpSirProbeRespBeacon pBeacon, tpPESession psessionEntry)
2655{
2656
2657 tANI_U16 beaconPeriod;
Jeff Johnson295189b2012-06-20 16:38:30 -07002658 tChannelSwitchPropIEStruct *pPropChnlSwitch;
2659 tDot11fIEChanSwitchAnn *pChnlSwitch;
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -07002660#ifdef WLAN_FEATURE_11AC
2661 tDot11fIEWiderBWChanSwitchAnn *pWiderChnlSwitch;
2662#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002663
Jeff Johnsone7245742012-09-05 17:12:55 -07002664 beaconPeriod = psessionEntry->beaconParams.beaconInterval;
Jeff Johnson295189b2012-06-20 16:38:30 -07002665
2666 /* STA either received proprietary channel switch IE or 802.11h
2667 * standard channel switch IE.
2668 */
2669 if (pBeacon->propIEinfo.propChannelSwitchPresent)
2670 {
2671 pPropChnlSwitch = &(pBeacon->propIEinfo.channelSwitch);
2672
2673 /* Add logic to determine which change this is: */
2674 /* primary, secondary, both. For now assume both. */
Jeff Johnsone7245742012-09-05 17:12:55 -07002675 psessionEntry->gLimChannelSwitch.state = eLIM_CHANNEL_SWITCH_PRIMARY_AND_SECONDARY;
2676 psessionEntry->gLimChannelSwitch.primaryChannel = pPropChnlSwitch->primaryChannel;
2677 psessionEntry->gLimChannelSwitch.secondarySubBand = (ePhyChanBondState)pPropChnlSwitch->subBand;
2678 psessionEntry->gLimChannelSwitch.switchCount = pPropChnlSwitch->channelSwitchCount;
2679 psessionEntry->gLimChannelSwitch.switchTimeoutValue =
Jeff Johnson295189b2012-06-20 16:38:30 -07002680 SYS_MS_TO_TICKS(beaconPeriod)* (pPropChnlSwitch->channelSwitchCount);
Jeff Johnsone7245742012-09-05 17:12:55 -07002681 psessionEntry->gLimChannelSwitch.switchMode = pPropChnlSwitch->mode;
Jeff Johnson295189b2012-06-20 16:38:30 -07002682 }
2683 else
2684 {
2685 pChnlSwitch = &(pBeacon->channelSwitchIE);
Jeff Johnsone7245742012-09-05 17:12:55 -07002686 psessionEntry->gLimChannelSwitch.primaryChannel = pChnlSwitch->newChannel;
2687 psessionEntry->gLimChannelSwitch.switchCount = pChnlSwitch->switchCount;
2688 psessionEntry->gLimChannelSwitch.switchTimeoutValue =
Jeff Johnson295189b2012-06-20 16:38:30 -07002689 SYS_MS_TO_TICKS(beaconPeriod)* (pChnlSwitch->switchCount);
Jeff Johnsone7245742012-09-05 17:12:55 -07002690 psessionEntry->gLimChannelSwitch.switchMode = pChnlSwitch->switchMode;
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -07002691#ifdef WLAN_FEATURE_11AC
2692 pWiderChnlSwitch = &(pBeacon->WiderBWChanSwitchAnn);
2693 if(pBeacon->WiderBWChanSwitchAnnPresent)
2694 {
2695 psessionEntry->gLimWiderBWChannelSwitch.newChanWidth = pWiderChnlSwitch->newChanWidth;
2696 psessionEntry->gLimWiderBWChannelSwitch.newCenterChanFreq0 = pWiderChnlSwitch->newCenterChanFreq0;
2697 psessionEntry->gLimWiderBWChannelSwitch.newCenterChanFreq1 = pWiderChnlSwitch->newCenterChanFreq1;
2698 }
2699#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002700
2701 /* Only primary channel switch element is present */
Jeff Johnsone7245742012-09-05 17:12:55 -07002702 psessionEntry->gLimChannelSwitch.state = eLIM_CHANNEL_SWITCH_PRIMARY_ONLY;
2703 psessionEntry->gLimChannelSwitch.secondarySubBand = PHY_SINGLE_CHANNEL_CENTERED;
Jeff Johnson295189b2012-06-20 16:38:30 -07002704
2705 /* Do not bother to look and operate on extended channel switch element
2706 * if our own channel-bonding state is not enabled
2707 */
Jeff Johnsone7245742012-09-05 17:12:55 -07002708 if (psessionEntry->htSupportedChannelWidthSet)
Jeff Johnson295189b2012-06-20 16:38:30 -07002709 {
2710 if (pBeacon->extChannelSwitchPresent)
2711 {
Jeff Johnsone7245742012-09-05 17:12:55 -07002712 if ((pBeacon->extChannelSwitchIE.secondaryChannelOffset == PHY_DOUBLE_CHANNEL_LOW_PRIMARY) ||
2713 (pBeacon->extChannelSwitchIE.secondaryChannelOffset == PHY_DOUBLE_CHANNEL_HIGH_PRIMARY))
Jeff Johnson295189b2012-06-20 16:38:30 -07002714 {
Jeff Johnsone7245742012-09-05 17:12:55 -07002715 psessionEntry->gLimChannelSwitch.state = eLIM_CHANNEL_SWITCH_PRIMARY_AND_SECONDARY;
2716 psessionEntry->gLimChannelSwitch.secondarySubBand = pBeacon->extChannelSwitchIE.secondaryChannelOffset;
Jeff Johnson295189b2012-06-20 16:38:30 -07002717 }
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -07002718#ifdef WLAN_FEATURE_11AC
2719 if(psessionEntry->vhtCapability && pBeacon->WiderBWChanSwitchAnnPresent)
2720 {
2721 if (pWiderChnlSwitch->newChanWidth == WNI_CFG_VHT_CHANNEL_WIDTH_80MHZ)
2722 {
2723 if(pBeacon->extChannelSwitchPresent)
2724 {
2725 if ((pBeacon->extChannelSwitchIE.secondaryChannelOffset == PHY_DOUBLE_CHANNEL_LOW_PRIMARY) ||
2726 (pBeacon->extChannelSwitchIE.secondaryChannelOffset == PHY_DOUBLE_CHANNEL_HIGH_PRIMARY))
2727 {
2728 psessionEntry->gLimChannelSwitch.state = eLIM_CHANNEL_SWITCH_PRIMARY_AND_SECONDARY;
2729 psessionEntry->gLimChannelSwitch.secondarySubBand = limGet11ACPhyCBState(pMac,
2730 psessionEntry->gLimChannelSwitch.primaryChannel,
2731 pBeacon->extChannelSwitchIE.secondaryChannelOffset,
2732 pWiderChnlSwitch->newCenterChanFreq0,
2733 psessionEntry);
2734 }
2735 }
2736 }
2737 }
2738#endif
Jeff Johnsone7245742012-09-05 17:12:55 -07002739 }
2740 }
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -07002741 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002742 if (eSIR_SUCCESS != limStartChannelSwitch(pMac, psessionEntry))
2743 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002744 PELOGW(limLog(pMac, LOGW, FL("Could not start Channel Switch"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002745 }
2746
2747 limLog(pMac, LOGW,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002748 FL("session %d primary chl %d, subband %d, count %d (%d ticks) "),
Jeff Johnsone7245742012-09-05 17:12:55 -07002749 psessionEntry->peSessionId,
2750 psessionEntry->gLimChannelSwitch.primaryChannel,
2751 psessionEntry->gLimChannelSwitch.secondarySubBand,
2752 psessionEntry->gLimChannelSwitch.switchCount,
2753 psessionEntry->gLimChannelSwitch.switchTimeoutValue);
Jeff Johnson295189b2012-06-20 16:38:30 -07002754 return;
2755}
2756
2757/**
2758 * limCancelDot11hChannelSwitch
2759 *
2760 *FUNCTION:
2761 * This function is called when STA does not send updated channel-swith IE
2762 * after indicating channel-switch start. This will cancel the channel-swith
2763 * timer which is already running.
2764 *
2765 *LOGIC:
2766 *
2767 *ASSUMPTIONS:
2768 *
2769 *NOTE:
2770 *
2771 * @param pMac - Pointer to Global MAC structure
2772 *
2773 * @return None
2774 */
2775void limCancelDot11hChannelSwitch(tpAniSirGlobal pMac, tpPESession psessionEntry)
2776{
Jeff Johnson295189b2012-06-20 16:38:30 -07002777 if (psessionEntry->limSystemRole != eLIM_STA_ROLE)
2778 return;
2779
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002780 PELOGW(limLog(pMac, LOGW, FL("Received a beacon without channel switch IE"));)
Jeff Johnsone7245742012-09-05 17:12:55 -07002781 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_DEACTIVATE, psessionEntry->peSessionId, eLIM_CHANNEL_SWITCH_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -07002782
2783 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimChannelSwitchTimer) != eSIR_SUCCESS)
2784 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002785 PELOGE(limLog(pMac, LOGE, FL("tx_timer_deactivate failed!"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002786 }
2787
2788 /* We need to restore pre-channelSwitch state on the STA */
2789 if (limRestorePreChannelSwitchState(pMac, psessionEntry) != eSIR_SUCCESS)
2790 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002791 PELOGE(limLog(pMac, LOGE, FL("LIM: Could not restore pre-channelSwitch (11h) state, resetting the system"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002792
2793 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002794}
2795
2796/**----------------------------------------------
2797\fn limCancelDot11hQuiet
2798\brief Cancel the quieting on Station if latest
2799 beacon doesn't contain quiet IE in it.
2800
2801\param pMac
2802\return NONE
2803-----------------------------------------------*/
2804void limCancelDot11hQuiet(tpAniSirGlobal pMac, tpPESession psessionEntry)
2805{
Jeff Johnson295189b2012-06-20 16:38:30 -07002806 if (psessionEntry->limSystemRole != eLIM_STA_ROLE)
2807 return;
2808
Jeff Johnsone7245742012-09-05 17:12:55 -07002809 if (psessionEntry->gLimSpecMgmt.quietState == eLIM_QUIET_BEGIN)
Jeff Johnson295189b2012-06-20 16:38:30 -07002810 {
Jeff Johnsone7245742012-09-05 17:12:55 -07002811 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_DEACTIVATE, psessionEntry->peSessionId, eLIM_QUIET_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -07002812 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimQuietTimer) != TX_SUCCESS)
2813 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002814 PELOGE(limLog(pMac, LOGE, FL("tx_timer_deactivate failed"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002815 }
2816 }
Jeff Johnsone7245742012-09-05 17:12:55 -07002817 else if (psessionEntry->gLimSpecMgmt.quietState == eLIM_QUIET_RUNNING)
Jeff Johnson295189b2012-06-20 16:38:30 -07002818 {
Jeff Johnsone7245742012-09-05 17:12:55 -07002819 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_DEACTIVATE, psessionEntry->peSessionId, eLIM_QUIET_BSS_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -07002820 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimQuietBssTimer) != TX_SUCCESS)
2821 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002822 PELOGE(limLog(pMac, LOGE, FL("tx_timer_deactivate failed"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002823 }
2824 /**
2825 * If the channel switch is already running in silent mode, dont resume the
2826 * transmission. Channel switch timer when timeout, transmission will be resumed.
2827 */
Jeff Johnsone7245742012-09-05 17:12:55 -07002828 if(!((psessionEntry->gLimSpecMgmt.dot11hChanSwState == eLIM_11H_CHANSW_RUNNING) &&
2829 (psessionEntry->gLimChannelSwitch.switchMode == eSIR_CHANSW_MODE_SILENT)))
Jeff Johnson295189b2012-06-20 16:38:30 -07002830 {
2831 limFrameTransmissionControl(pMac, eLIM_TX_ALL, eLIM_RESUME_TX);
Jeff Johnsone7245742012-09-05 17:12:55 -07002832 limRestorePreQuietState(pMac, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07002833 }
2834 }
Jeff Johnsone7245742012-09-05 17:12:55 -07002835 psessionEntry->gLimSpecMgmt.quietState = eLIM_QUIET_INIT;
Jeff Johnson295189b2012-06-20 16:38:30 -07002836}
2837
2838/**
2839 * limProcessQuietTimeout
2840 *
2841 * FUNCTION:
2842 * This function is active only on the STA.
2843 * Handles SIR_LIM_QUIET_TIMEOUT
2844 *
2845 * LOGIC:
2846 * This timeout can occur under only one circumstance:
2847 *
2848 * 1) When gLimQuietState = eLIM_QUIET_BEGIN
2849 * This indicates that the timeout "interval" has
2850 * expired. This is a trigger for the STA to now
2851 * shut-off Tx/Rx for the specified gLimQuietDuration
2852 * -> The TIMER object gLimQuietBssTimer is
2853 * activated
2854 * -> With timeout = gLimQuietDuration
2855 * -> gLimQuietState is set to eLIM_QUIET_RUNNING
2856 *
2857 * ASSUMPTIONS:
2858 * Using two TIMER objects -
2859 * gLimQuietTimer & gLimQuietBssTimer
2860 *
2861 * NOTE:
2862 *
2863 * @param pMac - Pointer to Global MAC structure
2864 *
2865 * @return None
2866 */
2867void limProcessQuietTimeout(tpAniSirGlobal pMac)
2868{
Jeff Johnson295189b2012-06-20 16:38:30 -07002869 //fetch the sessionEntry based on the sessionId
2870 //priority - MEDIUM
Jeff Johnsone7245742012-09-05 17:12:55 -07002871 tpPESession psessionEntry;
Jeff Johnson295189b2012-06-20 16:38:30 -07002872
Jeff Johnsone7245742012-09-05 17:12:55 -07002873 if((psessionEntry = peFindSessionBySessionId(pMac, pMac->lim.limTimers.gLimQuietTimer.sessionId))== NULL)
Jeff Johnson295189b2012-06-20 16:38:30 -07002874 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002875 limLog(pMac, LOGE,FL("Session Does not exist for given sessionID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002876 return;
2877 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002878
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002879 PELOG1(limLog(pMac, LOG1, FL("quietState = %d"), psessionEntry->gLimSpecMgmt.quietState);)
Jeff Johnsone7245742012-09-05 17:12:55 -07002880 switch( psessionEntry->gLimSpecMgmt.quietState )
Jeff Johnson295189b2012-06-20 16:38:30 -07002881 {
2882 case eLIM_QUIET_BEGIN:
2883 // Time to Stop data traffic for quietDuration
Jeff Johnsone7245742012-09-05 17:12:55 -07002884 //limDeactivateAndChangeTimer(pMac, eLIM_QUIET_BSS_TIMER);
2885 if (TX_SUCCESS !=
2886 tx_timer_deactivate(&pMac->lim.limTimers.gLimQuietBssTimer))
2887 {
2888 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002889 FL("Unable to de-activate gLimQuietBssTimer! Will attempt to activate anyway..."));
Jeff Johnsone7245742012-09-05 17:12:55 -07002890 }
2891
2892 // gLimQuietDuration appears to be in units of ticks
2893 // Use it as is
2894 if (TX_SUCCESS !=
2895 tx_timer_change( &pMac->lim.limTimers.gLimQuietBssTimer,
2896 psessionEntry->gLimSpecMgmt.quietDuration,
2897 0))
2898 {
2899 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002900 FL("Unable to change gLimQuietBssTimer! Will still attempt to activate anyway..."));
Jeff Johnsone7245742012-09-05 17:12:55 -07002901 }
Leela V Kiran Kumar Reddy Chiralac3b9d382013-01-31 20:49:53 -08002902 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, pMac->lim.limTimers.gLimQuietTimer.sessionId, eLIM_QUIET_BSS_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -07002903#ifdef GEN6_TODO
2904 /* revisit this piece of code to assign the appropriate sessionId below
2905 * priority - HIGH
2906 */
2907 pMac->lim.limTimers.gLimQuietBssTimer.sessionId = sessionId;
2908#endif
2909 if( TX_SUCCESS !=
2910 tx_timer_activate( &pMac->lim.limTimers.gLimQuietBssTimer ))
2911 {
2912 limLog( pMac, LOGW,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002913 FL("Unable to activate gLimQuietBssTimer! The STA will be unable to honor Quiet BSS..."));
Jeff Johnson295189b2012-06-20 16:38:30 -07002914 }
2915 else
2916 {
2917 // Transition to eLIM_QUIET_RUNNING
Jeff Johnsone7245742012-09-05 17:12:55 -07002918 psessionEntry->gLimSpecMgmt.quietState = eLIM_QUIET_RUNNING;
Jeff Johnson295189b2012-06-20 16:38:30 -07002919
2920 /* If we have sta bk scan triggered and trigger bk scan actually started successfully, */
2921 /* print message, otherwise, stop data traffic and stay quiet */
2922 if( pMac->lim.gLimTriggerBackgroundScanDuringQuietBss &&
2923 (eSIR_TRUE == (glimTriggerBackgroundScanDuringQuietBss_Status = limTriggerBackgroundScanDuringQuietBss( pMac ))) )
2924 {
2925 limLog( pMac, LOG2,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002926 FL("Attempting to trigger a background scan..."));
Jeff Johnson295189b2012-06-20 16:38:30 -07002927 }
2928 else
2929 {
2930 // Shut-off Tx/Rx for gLimSpecMgmt.quietDuration
2931 /* freeze the transmission */
2932 limFrameTransmissionControl(pMac, eLIM_TX_ALL, eLIM_STOP_TX);
2933
2934 limLog( pMac, LOG2,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002935 FL("Quiet BSS: STA shutting down for %d ticks"),
Jeff Johnsone7245742012-09-05 17:12:55 -07002936 psessionEntry->gLimSpecMgmt.quietDuration );
Jeff Johnson295189b2012-06-20 16:38:30 -07002937 }
2938 }
2939 break;
2940
2941 case eLIM_QUIET_RUNNING:
2942 case eLIM_QUIET_INIT:
2943 case eLIM_QUIET_END:
2944 default:
2945 //
2946 // As of now, nothing to be done
2947 //
2948 break;
2949 }
2950}
2951
2952/**
2953 * limProcessQuietBssTimeout
2954 *
2955 * FUNCTION:
2956 * This function is active on the AP and STA.
2957 * Handles SIR_LIM_QUIET_BSS_TIMEOUT
2958 *
2959 * LOGIC:
2960 * On the AP -
2961 * When the SIR_LIM_QUIET_BSS_TIMEOUT is triggered, it is
2962 * an indication for the AP to START sending out the
2963 * Quiet BSS IE.
2964 * If 802.11H is enabled, the Quiet BSS IE is sent as per
2965 * the 11H spec
2966 * If 802.11H is not enabled, the Quiet BSS IE is sent as
2967 * a Proprietary IE. This will be understood by all the
2968 * TITAN STA's
2969 * Transitioning gLimQuietState to eLIM_QUIET_BEGIN will
2970 * initiate the SCH to include the Quiet BSS IE in all
2971 * its subsequent Beacons/PR's.
2972 * The Quiet BSS IE will be included in all the Beacons
2973 * & PR's until the next DTIM period
2974 *
2975 * On the STA -
2976 * When gLimQuietState = eLIM_QUIET_RUNNING
2977 * This indicates that the STA was successfully shut-off
2978 * for the specified gLimQuietDuration. This is a trigger
2979 * for the STA to now resume data traffic.
2980 * -> gLimQuietState is set to eLIM_QUIET_INIT
2981 *
2982 * ASSUMPTIONS:
2983 *
2984 * NOTE:
2985 *
2986 * @param pMac - Pointer to Global MAC structure
2987 *
2988 * @return None
2989 */
2990void limProcessQuietBssTimeout( tpAniSirGlobal pMac )
2991{
Jeff Johnsone7245742012-09-05 17:12:55 -07002992 tpPESession psessionEntry;
Jeff Johnson295189b2012-06-20 16:38:30 -07002993
Jeff Johnsone7245742012-09-05 17:12:55 -07002994 if((psessionEntry = peFindSessionBySessionId(pMac, pMac->lim.limTimers.gLimQuietBssTimer.sessionId))== NULL)
Jeff Johnson295189b2012-06-20 16:38:30 -07002995 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002996 limLog(pMac, LOGP,FL("Session Does not exist for given sessionID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002997 return;
2998 }
2999
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003000 PELOG1(limLog(pMac, LOG1, FL("quietState = %d"), psessionEntry->gLimSpecMgmt.quietState);)
Jeff Johnsone7245742012-09-05 17:12:55 -07003001 if (eLIM_AP_ROLE == psessionEntry->limSystemRole)
Jeff Johnson295189b2012-06-20 16:38:30 -07003002 {
Jeff Johnson295189b2012-06-20 16:38:30 -07003003 }
3004 else
3005 {
3006 // eLIM_STA_ROLE
Jeff Johnsone7245742012-09-05 17:12:55 -07003007 switch( psessionEntry->gLimSpecMgmt.quietState )
Jeff Johnson295189b2012-06-20 16:38:30 -07003008 {
3009 case eLIM_QUIET_RUNNING:
3010 // Transition to eLIM_QUIET_INIT
Jeff Johnsone7245742012-09-05 17:12:55 -07003011 psessionEntry->gLimSpecMgmt.quietState = eLIM_QUIET_INIT;
Jeff Johnson295189b2012-06-20 16:38:30 -07003012
3013 if( !pMac->lim.gLimTriggerBackgroundScanDuringQuietBss || (glimTriggerBackgroundScanDuringQuietBss_Status == eSIR_FALSE) )
3014 {
3015 // Resume data traffic only if channel switch is not running in silent mode.
Jeff Johnsone7245742012-09-05 17:12:55 -07003016 if (!((psessionEntry->gLimSpecMgmt.dot11hChanSwState == eLIM_11H_CHANSW_RUNNING) &&
3017 (psessionEntry->gLimChannelSwitch.switchMode == eSIR_CHANSW_MODE_SILENT)))
Jeff Johnson295189b2012-06-20 16:38:30 -07003018 {
3019 limFrameTransmissionControl(pMac, eLIM_TX_ALL, eLIM_RESUME_TX);
Jeff Johnsone7245742012-09-05 17:12:55 -07003020 limRestorePreQuietState(pMac, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07003021 }
3022
3023 /* Reset status flag */
3024 if(glimTriggerBackgroundScanDuringQuietBss_Status == eSIR_FALSE)
3025 glimTriggerBackgroundScanDuringQuietBss_Status = eSIR_TRUE;
3026
3027 limLog( pMac, LOG2,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003028 FL("Quiet BSS: Resuming traffic..."));
Jeff Johnson295189b2012-06-20 16:38:30 -07003029 }
3030 else
3031 {
3032 //
3033 // Nothing specific to be done in this case
3034 // A background scan that was triggered during
3035 // SIR_LIM_QUIET_TIMEOUT will complete on its own
3036 //
3037 limLog( pMac, LOG2,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003038 FL("Background scan should be complete now..."));
Jeff Johnson295189b2012-06-20 16:38:30 -07003039 }
3040 break;
3041
3042 case eLIM_QUIET_INIT:
3043 case eLIM_QUIET_BEGIN:
3044 case eLIM_QUIET_END:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003045 PELOG2(limLog(pMac, LOG2, FL("Quiet state not in RUNNING"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003046 /* If the quiet period has ended, then resume the frame transmission */
3047 limFrameTransmissionControl(pMac, eLIM_TX_ALL, eLIM_RESUME_TX);
Jeff Johnsone7245742012-09-05 17:12:55 -07003048 limRestorePreQuietState(pMac, psessionEntry);
3049 psessionEntry->gLimSpecMgmt.quietState = eLIM_QUIET_INIT;
Jeff Johnson295189b2012-06-20 16:38:30 -07003050 break;
3051
3052 default:
3053 //
3054 // As of now, nothing to be done
3055 //
3056 break;
3057 }
3058 }
3059}
Jeff Johnson295189b2012-06-20 16:38:30 -07003060/**
3061 * limProcessWPSOverlapTimeout
3062 *
3063 * FUNCTION: This function call limWPSPBCTimeout() to clean WPS PBC probe request entries
3064 *
3065 * LOGIC:
3066 *
3067 * ASSUMPTIONS:
3068 *
3069 * NOTE:
3070 *
3071 * @param pMac - Pointer to Global MAC structure
3072 *
3073 * @return None
3074 */
3075#if 0
3076void limProcessWPSOverlapTimeout(tpAniSirGlobal pMac)
3077{
3078
3079 tpPESession psessionEntry;
3080 tANI_U32 sessionId;
3081
3082 if (tx_timer_activate(&pMac->lim.limTimers.gLimWPSOverlapTimerObj.gLimWPSOverlapTimer) != TX_SUCCESS)
3083 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003084 limLog(pMac, LOGP, FL("tx_timer_activate failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003085 }
3086
3087 sessionId = pMac->lim.limTimers.gLimWPSOverlapTimerObj.sessionId;
3088
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003089 PELOGE(limLog(pMac, LOGE, FL("WPS overlap timeout, sessionId=%d"), sessionId);)
Jeff Johnson295189b2012-06-20 16:38:30 -07003090
3091 if((psessionEntry = peFindSessionBySessionId(pMac, sessionId)) == NULL)
3092 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003093 PELOGE(limLog(pMac, LOGP,FL("Session Does not exist for given sessionID"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003094 return;
3095 }
3096
3097 limWPSPBCTimeout(pMac, psessionEntry);
3098}
3099#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07003100
Jeff Johnson295189b2012-06-20 16:38:30 -07003101/**----------------------------------------------
3102\fn limStartQuietTimer
3103\brief Starts the quiet timer.
3104
3105\param pMac
3106\return NONE
3107-----------------------------------------------*/
3108void limStartQuietTimer(tpAniSirGlobal pMac, tANI_U8 sessionId)
3109{
3110 tpPESession psessionEntry;
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05303111 psessionEntry = peFindSessionBySessionId(pMac, sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07003112
3113 if(psessionEntry == NULL) {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003114 limLog(pMac, LOGP,FL("Session Does not exist for given sessionID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003115 return;
3116 }
3117
Jeff Johnson295189b2012-06-20 16:38:30 -07003118
3119 if (psessionEntry->limSystemRole != eLIM_STA_ROLE)
3120 return;
3121 // First, de-activate Timer, if its already active
3122 limCancelDot11hQuiet(pMac, psessionEntry);
3123
Jeff Johnsone7245742012-09-05 17:12:55 -07003124 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, sessionId, eLIM_QUIET_TIMER));
3125 if( TX_SUCCESS != tx_timer_deactivate(&pMac->lim.limTimers.gLimQuietTimer))
3126 {
3127 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003128 FL( "Unable to deactivate gLimQuietTimer! Will still attempt to re-activate anyway..." ));
Jeff Johnsone7245742012-09-05 17:12:55 -07003129 }
3130
3131 // Set the NEW timeout value, in ticks
3132 if( TX_SUCCESS != tx_timer_change( &pMac->lim.limTimers.gLimQuietTimer,
3133 SYS_MS_TO_TICKS(psessionEntry->gLimSpecMgmt.quietTimeoutValue), 0))
3134 {
3135 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003136 FL( "Unable to change gLimQuietTimer! Will still attempt to re-activate anyway..." ));
Jeff Johnsone7245742012-09-05 17:12:55 -07003137 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003138
3139 pMac->lim.limTimers.gLimQuietTimer.sessionId = sessionId;
3140 if( TX_SUCCESS != tx_timer_activate(&pMac->lim.limTimers.gLimQuietTimer))
3141 {
3142 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003143 FL("Unable to activate gLimQuietTimer! STA cannot honor Quiet BSS!"));
Jeff Johnsone7245742012-09-05 17:12:55 -07003144 limRestorePreQuietState(pMac, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07003145
Jeff Johnsone7245742012-09-05 17:12:55 -07003146 psessionEntry->gLimSpecMgmt.quietState = eLIM_QUIET_INIT;
Jeff Johnson295189b2012-06-20 16:38:30 -07003147 return;
3148 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003149}
3150
Jeff Johnson295189b2012-06-20 16:38:30 -07003151
3152/** ------------------------------------------------------------------------ **/
3153/**
3154 * keep track of the number of ANI peers associated in the BSS
3155 * For the first and last ANI peer, we have to update EDCA params as needed
3156 *
3157 * When the first ANI peer joins the BSS, we notify SCH
3158 * When the last ANI peer leaves the BSS, we notfiy SCH
3159 */
3160void
3161limUtilCountStaAdd(
3162 tpAniSirGlobal pMac,
3163 tpDphHashNode pSta,
3164 tpPESession psessionEntry)
3165{
3166
3167 if ((! pSta) || (! pSta->valid) || (! pSta->aniPeer) || (pSta->fAniCount))
3168 return;
3169
3170 pSta->fAniCount = 1;
3171
3172 if (pMac->lim.gLimNumOfAniSTAs++ != 0)
3173 return;
3174
3175 // get here only if this is the first ANI peer in the BSS
3176 schEdcaProfileUpdate(pMac, psessionEntry);
3177}
3178
3179void
3180limUtilCountStaDel(
3181 tpAniSirGlobal pMac,
3182 tpDphHashNode pSta,
3183 tpPESession psessionEntry)
3184{
3185
3186 if ((pSta == NULL) || (pSta->aniPeer == eHAL_CLEAR) || (! pSta->fAniCount))
3187 return;
3188
3189 /* Only if sta is invalid and the validInDummyState bit is set to 1,
3190 * then go ahead and update the count and profiles. This ensures
3191 * that the "number of ani station" count is properly incremented/decremented.
3192 */
3193 if (pSta->valid == 1)
3194 return;
3195
3196 pSta->fAniCount = 0;
3197
3198 if (pMac->lim.gLimNumOfAniSTAs <= 0)
3199 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003200 limLog(pMac, LOGE, FL("CountStaDel: ignoring Delete Req when AniPeer count is %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07003201 pMac->lim.gLimNumOfAniSTAs);
3202 return;
3203 }
3204
3205 pMac->lim.gLimNumOfAniSTAs--;
3206
3207 if (pMac->lim.gLimNumOfAniSTAs != 0)
3208 return;
3209
3210 // get here only if this is the last ANI peer in the BSS
3211 schEdcaProfileUpdate(pMac, psessionEntry);
3212}
3213
Jeff Johnson295189b2012-06-20 16:38:30 -07003214/**
3215 * limSwitchChannelCback()
3216 *
3217 *FUNCTION:
3218 * This is the callback function registered while requesting to switch channel
3219 * after AP indicates a channel switch for spectrum management (11h).
3220 *
3221 *NOTE:
3222 * @param pMac Pointer to Global MAC structure
3223 * @param status Status of channel switch request
3224 * @param data User data
3225 * @param psessionEntry Session information
3226 * @return NONE
3227 */
3228void limSwitchChannelCback(tpAniSirGlobal pMac, eHalStatus status,
3229 tANI_U32 *data, tpPESession psessionEntry)
3230{
3231 tSirMsgQ mmhMsg = {0};
3232 tSirSmeSwitchChannelInd *pSirSmeSwitchChInd;
3233
Jeff Johnson295189b2012-06-20 16:38:30 -07003234 psessionEntry->currentOperChannel = psessionEntry->currentReqChannel;
3235
3236 /* We need to restore pre-channelSwitch state on the STA */
3237 if (limRestorePreChannelSwitchState(pMac, psessionEntry) != eSIR_SUCCESS)
3238 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003239 limLog(pMac, LOGP, FL("Could not restore pre-channelSwitch (11h) state, resetting the system"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003240 return;
3241 }
3242
3243 mmhMsg.type = eWNI_SME_SWITCH_CHL_REQ;
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05303244 pSirSmeSwitchChInd = vos_mem_malloc(sizeof(tSirSmeSwitchChannelInd));
3245 if ( NULL == pSirSmeSwitchChInd )
Jeff Johnson295189b2012-06-20 16:38:30 -07003246 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003247 limLog(pMac, LOGP, FL("Failed to allocate buffer for buffer descriptor"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003248 return;
3249 }
3250
3251 pSirSmeSwitchChInd->messageType = eWNI_SME_SWITCH_CHL_REQ;
3252 pSirSmeSwitchChInd->length = sizeof(tSirSmeSwitchChannelInd);
Jeff Johnsone7245742012-09-05 17:12:55 -07003253 pSirSmeSwitchChInd->newChannelId = psessionEntry->gLimChannelSwitch.primaryChannel;
Jeff Johnson295189b2012-06-20 16:38:30 -07003254 pSirSmeSwitchChInd->sessionId = psessionEntry->smeSessionId;
3255 //BSS ID
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05303256 vos_mem_copy( pSirSmeSwitchChInd->bssId, psessionEntry->bssId, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07003257 mmhMsg.bodyptr = pSirSmeSwitchChInd;
3258 mmhMsg.bodyval = 0;
3259
Jeff Johnsone7245742012-09-05 17:12:55 -07003260 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07003261
Jeff Johnson295189b2012-06-20 16:38:30 -07003262 SysProcessMmhMsg(pMac, &mmhMsg);
Jeff Johnson295189b2012-06-20 16:38:30 -07003263}
3264
3265/**
3266 * limSwitchPrimaryChannel()
3267 *
3268 *FUNCTION:
3269 * This function changes the current operating channel
3270 * and sets the new new channel ID in WNI_CFG_CURRENT_CHANNEL.
3271 *
3272 *NOTE:
3273 * @param pMac Pointer to Global MAC structure
3274 * @param newChannel new chnannel ID
3275 * @return NONE
3276 */
3277void limSwitchPrimaryChannel(tpAniSirGlobal pMac, tANI_U8 newChannel,tpPESession psessionEntry)
3278{
3279#if !defined WLAN_FEATURE_VOWIFI
3280 tANI_U32 localPwrConstraint;
3281#endif
3282
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003283 PELOG3(limLog(pMac, LOG3, FL("limSwitchPrimaryChannel: old chnl %d --> new chnl %d "),
Jeff Johnson295189b2012-06-20 16:38:30 -07003284 psessionEntry->currentOperChannel, newChannel);)
3285 psessionEntry->currentReqChannel = newChannel;
3286 psessionEntry->limRFBand = limGetRFBand(newChannel);
3287
3288 psessionEntry->channelChangeReasonCode=LIM_SWITCH_CHANNEL_OPERATION;
3289
3290 pMac->lim.gpchangeChannelCallback = limSwitchChannelCback;
3291 pMac->lim.gpchangeChannelData = NULL;
3292
3293#if defined WLAN_FEATURE_VOWIFI
Jeff Johnsone7245742012-09-05 17:12:55 -07003294 limSendSwitchChnlParams(pMac, newChannel, PHY_SINGLE_CHANNEL_CENTERED,
Jeff Johnson295189b2012-06-20 16:38:30 -07003295 psessionEntry->maxTxPower, psessionEntry->peSessionId);
3296#else
3297 if(wlan_cfgGetInt(pMac, WNI_CFG_LOCAL_POWER_CONSTRAINT, &localPwrConstraint) != eSIR_SUCCESS)
3298 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003299 limLog( pMac, LOGP, FL( "Unable to read Local Power Constraint from cfg" ));
Jeff Johnson295189b2012-06-20 16:38:30 -07003300 return;
3301 }
Jeff Johnsone7245742012-09-05 17:12:55 -07003302 limSendSwitchChnlParams(pMac, newChannel, PHY_SINGLE_CHANNEL_CENTERED,
Jeff Johnson295189b2012-06-20 16:38:30 -07003303 (tPowerdBm)localPwrConstraint, psessionEntry->peSessionId);
3304#endif
3305 return;
3306}
3307
3308/**
3309 * limSwitchPrimarySecondaryChannel()
3310 *
3311 *FUNCTION:
3312 * This function changes the primary and secondary channel.
3313 * If 11h is enabled and user provides a "new channel ID"
3314 * that is different from the current operating channel,
3315 * then we must set this new channel in WNI_CFG_CURRENT_CHANNEL,
3316 * assign notify LIM of such change.
3317 *
3318 *NOTE:
3319 * @param pMac Pointer to Global MAC structure
3320 * @param newChannel New chnannel ID (or current channel ID)
3321 * @param subband CB secondary info:
3322 * - eANI_CB_SECONDARY_NONE
3323 * - eANI_CB_SECONDARY_UP
3324 * - eANI_CB_SECONDARY_DOWN
3325 * @return NONE
3326 */
Jeff Johnsone7245742012-09-05 17:12:55 -07003327void limSwitchPrimarySecondaryChannel(tpAniSirGlobal pMac, tpPESession psessionEntry, tANI_U8 newChannel, ePhyChanBondState subband)
Jeff Johnson295189b2012-06-20 16:38:30 -07003328{
3329#if !defined WLAN_FEATURE_VOWIFI
3330 tANI_U32 localPwrConstraint;
3331#endif
3332
Jeff Johnson295189b2012-06-20 16:38:30 -07003333#if !defined WLAN_FEATURE_VOWIFI
3334 if(wlan_cfgGetInt(pMac, WNI_CFG_LOCAL_POWER_CONSTRAINT, &localPwrConstraint) != eSIR_SUCCESS) {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003335 limLog( pMac, LOGP, FL( "Unable to get Local Power Constraint from cfg" ));
Jeff Johnson295189b2012-06-20 16:38:30 -07003336 return;
3337 }
3338#endif
3339
Jeff Johnson295189b2012-06-20 16:38:30 -07003340#if defined WLAN_FEATURE_VOWIFI
Jeff Johnsone7245742012-09-05 17:12:55 -07003341 limSendSwitchChnlParams(pMac, newChannel, subband, psessionEntry->maxTxPower, psessionEntry->peSessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07003342#else
Jeff Johnsone7245742012-09-05 17:12:55 -07003343 limSendSwitchChnlParams(pMac, newChannel, subband, (tPowerdBm)localPwrConstraint, psessionEntry->peSessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07003344#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07003345
Jeff Johnsone7245742012-09-05 17:12:55 -07003346 // Store the new primary and secondary channel in session entries if different
3347 if (psessionEntry->currentOperChannel != newChannel)
Jeff Johnson295189b2012-06-20 16:38:30 -07003348 {
3349 limLog(pMac, LOGW,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003350 FL("switch old chnl %d --> new chnl %d "),
Jeff Johnson295189b2012-06-20 16:38:30 -07003351 psessionEntry->currentOperChannel, newChannel);
Jeff Johnson295189b2012-06-20 16:38:30 -07003352 psessionEntry->currentOperChannel = newChannel;
3353 }
Jeff Johnsone7245742012-09-05 17:12:55 -07003354 if (psessionEntry->htSecondaryChannelOffset != subband)
3355 {
3356 limLog(pMac, LOGW,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003357 FL("switch old sec chnl %d --> new sec chnl %d "),
Jeff Johnsone7245742012-09-05 17:12:55 -07003358 psessionEntry->htSecondaryChannelOffset, subband);
3359 psessionEntry->htSecondaryChannelOffset = subband;
3360 if (psessionEntry->htSecondaryChannelOffset == PHY_SINGLE_CHANNEL_CENTERED)
3361 {
3362 psessionEntry->htSupportedChannelWidthSet = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE;
3363 }
3364 else
3365 {
3366 psessionEntry->htSupportedChannelWidthSet = WNI_CFG_CHANNEL_BONDING_MODE_ENABLE;
3367 }
3368 psessionEntry->htRecommendedTxWidthSet = psessionEntry->htSupportedChannelWidthSet;
3369 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003370
3371 return;
3372}
3373
3374
3375/**
3376 * limActiveScanAllowed()
3377 *
3378 *FUNCTION:
3379 * Checks if active scans are permitted on the given channel
3380 *
3381 *LOGIC:
3382 * The config variable SCAN_CONTROL_LIST contains pairs of (channelNum, activeScanAllowed)
3383 * Need to check if the channelNum matches, then depending on the corresponding
3384 * scan flag, return true (for activeScanAllowed==1) or false (otherwise).
3385 *
3386 *ASSUMPTIONS:
3387 *
3388 *NOTE:
3389 *
3390 * @param pMac Pointer to Global MAC structure
3391 * @param channelNum channel number
3392 * @return None
3393 */
3394
3395tANI_U8 limActiveScanAllowed(
3396 tpAniSirGlobal pMac,
3397 tANI_U8 channelNum)
3398{
3399 tANI_U32 i;
3400 tANI_U8 channelPair[WNI_CFG_SCAN_CONTROL_LIST_LEN];
3401 tANI_U32 len = WNI_CFG_SCAN_CONTROL_LIST_LEN;
3402 if (wlan_cfgGetStr(pMac, WNI_CFG_SCAN_CONTROL_LIST, channelPair, &len)
3403 != eSIR_SUCCESS)
3404 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003405 PELOGE(limLog(pMac, LOGE, FL("Unable to get scan control list"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003406 return false;
3407 }
3408
3409 if (len > WNI_CFG_SCAN_CONTROL_LIST_LEN)
3410 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003411 limLog(pMac, LOGE, FL("Invalid scan control list length:%d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07003412 len);
3413 return false;
3414 }
3415
3416 for (i=0; (i+1) < len; i+=2)
3417 {
3418 if (channelPair[i] == channelNum)
3419 return ((channelPair[i+1] == eSIR_ACTIVE_SCAN) ? true : false);
3420 }
3421 return false;
3422}
3423
3424/**
3425 * limTriggerBackgroundScanDuringQuietBss()
3426 *
3427 *FUNCTION:
3428 * This function is applicable to the STA only.
3429 * This function is called by limProcessQuietTimeout(),
3430 * when it is time to honor the Quiet BSS IE from the AP.
3431 *
3432 *LOGIC:
3433 * If 11H is enabled:
3434 * We cannot trigger a background scan. The STA needs to
3435 * shut-off Tx/Rx.
3436 * If 11 is not enabled:
3437 * Determine if the next channel that we are going to
3438 * scan is NOT the same channel (or not) on which the
3439 * Quiet BSS was requested.
3440 * If yes, then we cannot trigger a background scan on
3441 * this channel. Return with a false.
3442 * If no, then trigger a background scan. Return with
3443 * a true.
3444 *
3445 *ASSUMPTIONS:
3446 *
3447 *NOTE:
3448 * This API is redundant if the existing API,
3449 * limTriggerBackgroundScan(), were to return a valid
3450 * response instead of returning void.
3451 * If possible, try to revisit this API
3452 *
3453 * @param pMac Pointer to Global MAC structure
3454 * @return eSIR_TRUE, if a background scan was attempted
3455 * eSIR_FALSE, if not
3456 */
3457tAniBool limTriggerBackgroundScanDuringQuietBss( tpAniSirGlobal pMac )
3458{
3459 tAniBool bScanTriggered = eSIR_FALSE;
Jeff Johnson295189b2012-06-20 16:38:30 -07003460
3461
3462
3463 //TBD-RAJESH HOW TO GET sessionEntry?????
3464 tpPESession psessionEntry = &pMac->lim.gpSession[0];
3465
3466 if (psessionEntry->limSystemRole != eLIM_STA_ROLE)
3467 return bScanTriggered;
3468
Jeff Johnsone7245742012-09-05 17:12:55 -07003469 if( !psessionEntry->lim11hEnable )
Jeff Johnson295189b2012-06-20 16:38:30 -07003470 {
3471 tSirMacChanNum bgScanChannelList[WNI_CFG_BG_SCAN_CHANNEL_LIST_LEN];
3472 tANI_U32 len = WNI_CFG_BG_SCAN_CHANNEL_LIST_LEN;
3473
3474 // Determine the next scan channel
3475
3476 // Get background scan channel list from CFG
3477 if( eSIR_SUCCESS == wlan_cfgGetStr( pMac,
3478 WNI_CFG_BG_SCAN_CHANNEL_LIST,
3479 (tANI_U8 *) bgScanChannelList,
3480 (tANI_U32 *) &len ))
3481 {
3482 // Ensure that we do not go off scanning on the same
3483 // channel on which the Quiet BSS was requested
3484 if( psessionEntry->currentOperChannel!=
3485 bgScanChannelList[pMac->lim.gLimBackgroundScanChannelId] )
3486 {
3487 // For now, try and attempt a background scan. It will
3488 // be ideal if this API actually returns a success or
3489 // failure instead of having a void return type
3490 limTriggerBackgroundScan( pMac );
3491
3492 bScanTriggered = eSIR_TRUE;
3493 }
3494 else
3495 {
3496 limLog( pMac, LOGW,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003497 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 -07003498 }
3499 }
3500 else
3501 {
3502 limLog( pMac, LOGW,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003503 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 -07003504 }
3505 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003506 return bScanTriggered;
3507}
3508
3509
3510/**
3511 * limGetHTCapability()
3512 *
3513 *FUNCTION:
3514 * A utility function that returns the "current HT capability state" for the HT
3515 * capability of interest (as requested in the API)
3516 *
3517 *LOGIC:
3518 * This routine will return with the "current" setting of a requested HT
3519 * capability. This state info could be retrieved from -
3520 * a) CFG (for static entries)
3521 * b) Run time info
3522 * - Dynamic state maintained by LIM
3523 * - Configured at radio init time by SME
3524 *
3525 *
3526 *ASSUMPTIONS:
3527 * NA
3528 *
3529 *NOTE:
3530 *
3531 * @param pMac Pointer to Global MAC structure
3532 * @param htCap The HT capability being queried
3533 * @return tANI_U8 The current state of the requested HT capability is returned in a
3534 * tANI_U8 variable
3535 */
3536
Jeff Johnson295189b2012-06-20 16:38:30 -07003537tANI_U8 limGetHTCapability( tpAniSirGlobal pMac,
3538 tANI_U32 htCap, tpPESession psessionEntry)
Jeff Johnson295189b2012-06-20 16:38:30 -07003539{
3540tANI_U8 retVal = 0;
3541tANI_U8 *ptr;
3542tANI_U32 cfgValue;
3543tSirMacHTCapabilityInfo macHTCapabilityInfo = {0};
3544tSirMacExtendedHTCapabilityInfo macExtHTCapabilityInfo = {0};
3545tSirMacTxBFCapabilityInfo macTxBFCapabilityInfo = {0};
3546tSirMacASCapabilityInfo macASCapabilityInfo = {0};
3547
3548 //
3549 // Determine which CFG to read from. Not ALL of the HT
3550 // related CFG's need to be read each time this API is
3551 // accessed
3552 //
3553 if( htCap >= eHT_ANTENNA_SELECTION &&
3554 htCap < eHT_SI_GRANULARITY )
3555 {
3556 // Get Antenna Seletion HT Capabilities
3557 if( eSIR_SUCCESS != wlan_cfgGetInt( pMac, WNI_CFG_AS_CAP, &cfgValue ))
3558 cfgValue = 0;
3559 ptr = (tANI_U8 *) &macASCapabilityInfo;
3560 *((tANI_U8 *)ptr) = (tANI_U8) (cfgValue & 0xff);
3561 }
3562 else
3563 {
3564 if( htCap >= eHT_TX_BEAMFORMING &&
3565 htCap < eHT_ANTENNA_SELECTION )
3566 {
3567 // Get Transmit Beam Forming HT Capabilities
3568 if( eSIR_SUCCESS != wlan_cfgGetInt( pMac, WNI_CFG_TX_BF_CAP, &cfgValue ))
3569 cfgValue = 0;
3570 ptr = (tANI_U8 *) &macTxBFCapabilityInfo;
3571 *((tANI_U32 *)ptr) = (tANI_U32) (cfgValue);
3572 }
3573 else
3574 {
3575 if( htCap >= eHT_PCO &&
3576 htCap < eHT_TX_BEAMFORMING )
3577 {
3578 // Get Extended HT Capabilities
3579 if( eSIR_SUCCESS != wlan_cfgGetInt( pMac, WNI_CFG_EXT_HT_CAP_INFO, &cfgValue ))
3580 cfgValue = 0;
3581 ptr = (tANI_U8 *) &macExtHTCapabilityInfo;
3582 *((tANI_U16 *)ptr) = (tANI_U16) (cfgValue & 0xffff);
3583 }
3584 else
3585 {
3586 if( htCap < eHT_MAX_RX_AMPDU_FACTOR )
3587 {
3588 // Get HT Capabilities
3589 if( eSIR_SUCCESS != wlan_cfgGetInt( pMac, WNI_CFG_HT_CAP_INFO, &cfgValue ))
3590 cfgValue = 0;
3591 ptr = (tANI_U8 *) &macHTCapabilityInfo;
3592 // 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
3593 *ptr++ = cfgValue & 0xff;
3594 *ptr = (cfgValue >> 8) & 0xff;
3595 }
3596 }
3597 }
3598 }
3599
3600 switch( htCap )
3601 {
3602 case eHT_LSIG_TXOP_PROTECTION:
3603 retVal = pMac->lim.gHTLsigTXOPProtection;
3604 break;
3605
3606 case eHT_STBC_CONTROL_FRAME:
3607 retVal = (tANI_U8) macHTCapabilityInfo.stbcControlFrame;
3608 break;
3609
3610 case eHT_PSMP:
3611 retVal = pMac->lim.gHTPSMPSupport;
3612 break;
3613
3614 case eHT_DSSS_CCK_MODE_40MHZ:
3615 retVal = pMac->lim.gHTDsssCckRate40MHzSupport;
3616 break;
3617
3618 case eHT_MAX_AMSDU_LENGTH:
3619 retVal = (tANI_U8) macHTCapabilityInfo.maximalAMSDUsize;
3620 break;
3621
3622 case eHT_DELAYED_BA:
3623 retVal = (tANI_U8) macHTCapabilityInfo.delayedBA;
3624 break;
3625
3626 case eHT_RX_STBC:
3627 retVal = (tANI_U8) macHTCapabilityInfo.rxSTBC;
3628 break;
3629
3630 case eHT_TX_STBC:
3631 retVal = (tANI_U8) macHTCapabilityInfo.txSTBC;
3632 break;
3633
3634 case eHT_SHORT_GI_40MHZ:
3635 retVal = (tANI_U8) macHTCapabilityInfo.shortGI40MHz;
3636 break;
3637
3638 case eHT_SHORT_GI_20MHZ:
3639 retVal = (tANI_U8) macHTCapabilityInfo.shortGI20MHz;
3640 break;
3641
3642 case eHT_GREENFIELD:
3643 retVal = (tANI_U8) macHTCapabilityInfo.greenField;
3644 break;
3645
3646 case eHT_MIMO_POWER_SAVE:
3647 retVal = (tANI_U8) pMac->lim.gHTMIMOPSState;
3648 break;
3649
3650 case eHT_SUPPORTED_CHANNEL_WIDTH_SET:
Jeff Johnsone7245742012-09-05 17:12:55 -07003651 retVal = (tANI_U8) psessionEntry->htSupportedChannelWidthSet;
Jeff Johnson295189b2012-06-20 16:38:30 -07003652 break;
3653
3654 case eHT_ADVANCED_CODING:
3655 retVal = (tANI_U8) macHTCapabilityInfo.advCodingCap;
3656 break;
3657
3658 case eHT_MAX_RX_AMPDU_FACTOR:
3659 retVal = pMac->lim.gHTMaxRxAMpduFactor;
3660 break;
3661
3662 case eHT_MPDU_DENSITY:
3663 retVal = pMac->lim.gHTAMpduDensity;
3664 break;
3665
3666 case eHT_PCO:
3667 retVal = (tANI_U8) macExtHTCapabilityInfo.pco;
3668 break;
3669
3670 case eHT_TRANSITION_TIME:
3671 retVal = (tANI_U8) macExtHTCapabilityInfo.transitionTime;
3672 break;
3673
3674 case eHT_MCS_FEEDBACK:
3675 retVal = (tANI_U8) macExtHTCapabilityInfo.mcsFeedback;
3676 break;
3677
3678 case eHT_TX_BEAMFORMING:
3679 retVal = (tANI_U8) macTxBFCapabilityInfo.txBF;
3680 break;
3681
3682 case eHT_ANTENNA_SELECTION:
3683 retVal = (tANI_U8) macASCapabilityInfo.antennaSelection;
3684 break;
3685
3686 case eHT_SI_GRANULARITY:
3687 retVal = pMac->lim.gHTServiceIntervalGranularity;
3688 break;
3689
3690 case eHT_CONTROLLED_ACCESS:
3691 retVal = pMac->lim.gHTControlledAccessOnly;
3692 break;
3693
3694 case eHT_RIFS_MODE:
3695 retVal = psessionEntry->beaconParams.fRIFSMode;
3696 break;
3697
3698 case eHT_RECOMMENDED_TX_WIDTH_SET:
Jeff Johnsone7245742012-09-05 17:12:55 -07003699 retVal = psessionEntry->htRecommendedTxWidthSet;
Jeff Johnson295189b2012-06-20 16:38:30 -07003700 break;
3701
3702 case eHT_EXTENSION_CHANNEL_OFFSET:
Jeff Johnsone7245742012-09-05 17:12:55 -07003703 retVal = psessionEntry->htSecondaryChannelOffset;
Jeff Johnson295189b2012-06-20 16:38:30 -07003704 break;
3705
3706 case eHT_OP_MODE:
Jeff Johnson295189b2012-06-20 16:38:30 -07003707 if(psessionEntry->limSystemRole == eLIM_AP_ROLE )
3708 retVal = psessionEntry->htOperMode;
3709 else
Jeff Johnson295189b2012-06-20 16:38:30 -07003710 retVal = pMac->lim.gHTOperMode;
3711 break;
3712
3713 case eHT_BASIC_STBC_MCS:
3714 retVal = pMac->lim.gHTSTBCBasicMCS;
3715 break;
3716
3717 case eHT_DUAL_CTS_PROTECTION:
3718 retVal = pMac->lim.gHTDualCTSProtection;
3719 break;
3720
3721 case eHT_LSIG_TXOP_PROTECTION_FULL_SUPPORT:
3722 retVal = psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport;
3723 break;
3724
3725 case eHT_PCO_ACTIVE:
3726 retVal = pMac->lim.gHTPCOActive;
3727 break;
3728
3729 case eHT_PCO_PHASE:
3730 retVal = pMac->lim.gHTPCOPhase;
3731 break;
3732
3733 default:
3734 break;
3735 }
3736
3737 return retVal;
3738}
3739
Jeff Johnson295189b2012-06-20 16:38:30 -07003740void limGetMyMacAddr(tpAniSirGlobal pMac, tANI_U8 *mac)
3741{
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05303742 vos_mem_copy( mac, pMac->lim.gLimMyMacAddr, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07003743 return;
3744}
3745
3746
3747
3748
3749/** -------------------------------------------------------------
3750\fn limEnable11aProtection
3751\brief based on config setting enables\disables 11a protection.
3752\param tANI_U8 enable : 1=> enable protection, 0=> disable protection.
3753\param tANI_U8 overlap: 1=> called from overlap context, 0 => called from assoc context.
3754\param tpUpdateBeaconParams pBeaconParams
3755\return None
3756 -------------------------------------------------------------*/
3757tSirRetStatus
3758limEnable11aProtection(tpAniSirGlobal pMac, tANI_U8 enable,
3759 tANI_U8 overlap, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry)
3760{
Madan Mohan Koyyalamudi33ef6a22012-10-30 17:44:43 -07003761 if(NULL == psessionEntry)
3762 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003763 PELOG3(limLog(pMac, LOG3, FL("psessionEntry is NULL"));)
Madan Mohan Koyyalamudi33ef6a22012-10-30 17:44:43 -07003764 return eSIR_FAILURE;
3765 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003766 //overlapping protection configuration check.
3767 if(overlap)
3768 {
Jeff Johnson295189b2012-06-20 16:38:30 -07003769 }
3770 else
3771 {
3772 //normal protection config check
Madan Mohan Koyyalamudi33ef6a22012-10-30 17:44:43 -07003773 if ((psessionEntry->limSystemRole == eLIM_AP_ROLE) &&
Jeff Johnsone7245742012-09-05 17:12:55 -07003774 (!psessionEntry->cfgProtection.fromlla))
Jeff Johnson295189b2012-06-20 16:38:30 -07003775 {
3776 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003777 PELOG3(limLog(pMac, LOG3, FL("protection from 11a is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003778 return eSIR_SUCCESS;
3779 }
3780 }
3781
3782 if (enable)
3783 {
3784 //If we are AP and HT capable, we need to set the HT OP mode
3785 //appropriately.
3786 if(((eLIM_AP_ROLE == psessionEntry->limSystemRole)||(eLIM_BT_AMP_AP_ROLE == psessionEntry->limSystemRole))&&
Jeff Johnsone7245742012-09-05 17:12:55 -07003787 (true == psessionEntry->htCapability))
Jeff Johnson295189b2012-06-20 16:38:30 -07003788 {
3789 if(overlap)
3790 {
3791 pMac->lim.gLimOverlap11aParams.protectionEnabled = true;
3792 if((eSIR_HT_OP_MODE_OVERLAP_LEGACY != pMac->lim.gHTOperMode) &&
3793 (eSIR_HT_OP_MODE_MIXED != pMac->lim.gHTOperMode))
3794 {
3795 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
3796 psessionEntry->htOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
3797 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
3798 limEnableHtOBSSProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
3799 }
3800 }
3801 else
3802 {
3803 psessionEntry->gLim11aParams.protectionEnabled = true;
3804 if(eSIR_HT_OP_MODE_MIXED != pMac->lim.gHTOperMode)
3805 {
3806 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_MIXED;
Jeff Johnsone7245742012-09-05 17:12:55 -07003807 psessionEntry->htOperMode = eSIR_HT_OP_MODE_MIXED;
Jeff Johnson295189b2012-06-20 16:38:30 -07003808 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
3809 limEnableHtOBSSProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
3810
3811 }
3812 }
3813 }
3814
3815 //This part is common for staiton as well.
3816 if(false == psessionEntry->beaconParams.llaCoexist)
3817 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003818 PELOG1(limLog(pMac, LOG1, FL(" => protection from 11A Enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003819 pBeaconParams->llaCoexist = psessionEntry->beaconParams.llaCoexist = true;
3820 pBeaconParams->paramChangeBitmap |= PARAM_llACOEXIST_CHANGED;
3821 }
3822 }
3823 else if (true == psessionEntry->beaconParams.llaCoexist)
3824 {
3825 //for AP role.
3826 //we need to take care of HT OP mode change if needed.
3827 //We need to take care of Overlap cases.
3828 if(eLIM_AP_ROLE == psessionEntry->limSystemRole)
3829 {
3830 if(overlap)
3831 {
3832 //Overlap Legacy protection disabled.
3833 pMac->lim.gLimOverlap11aParams.protectionEnabled = false;
3834
3835 //We need to take care of HT OP mode iff we are HT AP.
Jeff Johnsone7245742012-09-05 17:12:55 -07003836 if(psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07003837 {
3838 // no HT op mode change if any of the overlap protection enabled.
3839 if(!(pMac->lim.gLimOverlap11aParams.protectionEnabled ||
3840 pMac->lim.gLimOverlapHt20Params.protectionEnabled ||
3841 pMac->lim.gLimOverlapNonGfParams.protectionEnabled))
3842
3843 {
3844 //Check if there is a need to change HT OP mode.
3845 if(eSIR_HT_OP_MODE_OVERLAP_LEGACY == pMac->lim.gHTOperMode)
3846 {
3847 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
3848 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
3849
3850 if(psessionEntry->gLimHt20Params.protectionEnabled)
3851 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
3852 else
3853 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_PURE;
3854 }
3855 }
3856 }
3857 }
3858 else
3859 {
3860 //Disable protection from 11A stations.
3861 psessionEntry->gLim11aParams.protectionEnabled = false;
3862 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
3863
3864 //Check if any other non-HT protection enabled.
3865 //Right now we are in HT OP Mixed mode.
3866 //Change HT op mode appropriately.
3867
3868 //Change HT OP mode to 01 if any overlap protection enabled
3869 if(pMac->lim.gLimOverlap11aParams.protectionEnabled ||
3870 pMac->lim.gLimOverlapHt20Params.protectionEnabled ||
3871 pMac->lim.gLimOverlapNonGfParams.protectionEnabled)
3872
3873 {
3874 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
Jeff Johnsone7245742012-09-05 17:12:55 -07003875 psessionEntry->htOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
Jeff Johnson295189b2012-06-20 16:38:30 -07003876 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
3877 }
3878 else if(psessionEntry->gLimHt20Params.protectionEnabled)
3879 {
3880 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
Jeff Johnsone7245742012-09-05 17:12:55 -07003881 psessionEntry->htOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
Jeff Johnson295189b2012-06-20 16:38:30 -07003882 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
3883 }
3884 else
3885 {
3886 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_PURE;
Jeff Johnsone7245742012-09-05 17:12:55 -07003887 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
Jeff Johnson295189b2012-06-20 16:38:30 -07003888 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
3889 }
3890 }
3891 if(!pMac->lim.gLimOverlap11aParams.protectionEnabled &&
3892 !psessionEntry->gLim11aParams.protectionEnabled)
3893 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003894 PELOG1(limLog(pMac, LOG1, FL("===> Protection from 11A Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003895 pBeaconParams->llaCoexist = psessionEntry->beaconParams.llaCoexist = false;
3896 pBeaconParams->paramChangeBitmap |= PARAM_llACOEXIST_CHANGED;
3897 }
3898 }
3899 //for station role
3900 else
3901 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003902 PELOG1(limLog(pMac, LOG1, FL("===> Protection from 11A Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003903 pBeaconParams->llaCoexist = psessionEntry->beaconParams.llaCoexist = false;
3904 pBeaconParams->paramChangeBitmap |= PARAM_llACOEXIST_CHANGED;
3905 }
3906 }
3907
3908 return eSIR_SUCCESS;
3909}
3910
3911/** -------------------------------------------------------------
3912\fn limEnable11gProtection
3913\brief based on config setting enables\disables 11g protection.
3914\param tANI_U8 enable : 1=> enable protection, 0=> disable protection.
3915\param tANI_U8 overlap: 1=> called from overlap context, 0 => called from assoc context.
3916\param tpUpdateBeaconParams pBeaconParams
3917\return None
3918 -------------------------------------------------------------*/
3919
3920tSirRetStatus
3921limEnable11gProtection(tpAniSirGlobal pMac, tANI_U8 enable,
3922 tANI_U8 overlap, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry)
3923{
3924
3925 //overlapping protection configuration check.
3926 if(overlap)
3927 {
Jeff Johnson295189b2012-06-20 16:38:30 -07003928 }
3929 else
3930 {
3931 //normal protection config check
Jeff Johnson295189b2012-06-20 16:38:30 -07003932 if((psessionEntry->limSystemRole == eLIM_AP_ROLE ) &&
3933 !psessionEntry->cfgProtection.fromllb)
3934 {
3935 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003936 PELOG1(limLog(pMac, LOG1, FL("protection from 11b is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003937 return eSIR_SUCCESS;
3938 }else if(psessionEntry->limSystemRole != eLIM_AP_ROLE)
Jeff Johnson295189b2012-06-20 16:38:30 -07003939 {
3940 if(!pMac->lim.cfgProtection.fromllb)
3941 {
3942 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003943 PELOG1(limLog(pMac, LOG1, FL("protection from 11b is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003944 return eSIR_SUCCESS;
3945 }
3946 }
3947 }
3948
3949 if (enable)
3950 {
3951 //If we are AP and HT capable, we need to set the HT OP mode
3952 //appropriately.
Jeff Johnson295189b2012-06-20 16:38:30 -07003953 if(eLIM_AP_ROLE == psessionEntry->limSystemRole)
3954 {
3955 if(overlap)
3956 {
3957 psessionEntry->gLimOlbcParams.protectionEnabled = true;
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003958 PELOGE(limLog(pMac, LOGE, FL("protection from olbc is enabled"));)
Jeff Johnsone7245742012-09-05 17:12:55 -07003959 if(true == psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07003960 {
3961 if((eSIR_HT_OP_MODE_OVERLAP_LEGACY != psessionEntry->htOperMode) &&
3962 (eSIR_HT_OP_MODE_MIXED != psessionEntry->htOperMode))
3963 {
3964 psessionEntry->htOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
3965 }
3966 //CR-263021: OBSS bit is not switching back to 0 after disabling the overlapping legacy BSS
3967 // This fixes issue of OBSS bit not set after 11b, 11g station leaves
3968 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
3969 //Not processing OBSS bit from other APs, as we are already taking care
3970 //of Protection from overlapping BSS based on erp IE or useProtection bit
3971 limEnableHtOBSSProtection(pMac, true, overlap, pBeaconParams, psessionEntry);
3972 }
3973 }
3974 else
3975 {
3976 psessionEntry->gLim11bParams.protectionEnabled = true;
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003977 PELOGE(limLog(pMac, LOGE, FL("protection from 11b is enabled"));)
Jeff Johnsone7245742012-09-05 17:12:55 -07003978 if(true == psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07003979 {
3980 if(eSIR_HT_OP_MODE_MIXED != psessionEntry->htOperMode)
3981 {
3982 psessionEntry->htOperMode = eSIR_HT_OP_MODE_MIXED;
3983 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
3984 limEnableHtOBSSProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
3985 }
3986 }
3987 }
3988 }else if ((eLIM_BT_AMP_AP_ROLE == psessionEntry->limSystemRole) &&
Jeff Johnsone7245742012-09-05 17:12:55 -07003989 (true == psessionEntry->htCapability))
Jeff Johnson295189b2012-06-20 16:38:30 -07003990 {
3991 if(overlap)
3992 {
3993 psessionEntry->gLimOlbcParams.protectionEnabled = true;
3994 if((eSIR_HT_OP_MODE_OVERLAP_LEGACY != pMac->lim.gHTOperMode) &&
3995 (eSIR_HT_OP_MODE_MIXED != pMac->lim.gHTOperMode))
3996 {
3997 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
3998 }
3999 //CR-263021: OBSS bit is not switching back to 0 after disabling the overlapping legacy BSS
4000 // This fixes issue of OBSS bit not set after 11b, 11g station leaves
4001 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4002 //Not processing OBSS bit from other APs, as we are already taking care
4003 //of Protection from overlapping BSS based on erp IE or useProtection bit
4004 limEnableHtOBSSProtection(pMac, true, overlap, pBeaconParams, psessionEntry);
4005 }
4006 else
4007 {
4008 psessionEntry->gLim11bParams.protectionEnabled = true;
4009 if(eSIR_HT_OP_MODE_MIXED != pMac->lim.gHTOperMode)
4010 {
4011 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_MIXED;
4012 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4013 limEnableHtOBSSProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4014 }
4015 }
4016 }
4017
4018 //This part is common for staiton as well.
4019 if(false == psessionEntry->beaconParams.llbCoexist)
4020 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004021 PELOG1(limLog(pMac, LOG1, FL("=> 11G Protection Enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004022 pBeaconParams->llbCoexist = psessionEntry->beaconParams.llbCoexist = true;
4023 pBeaconParams->paramChangeBitmap |= PARAM_llBCOEXIST_CHANGED;
4024 }
4025 }
4026 else if (true == psessionEntry->beaconParams.llbCoexist)
4027 {
4028 //for AP role.
4029 //we need to take care of HT OP mode change if needed.
4030 //We need to take care of Overlap cases.
Jeff Johnson295189b2012-06-20 16:38:30 -07004031 if(eLIM_AP_ROLE == psessionEntry->limSystemRole)
4032 {
4033 if(overlap)
4034 {
4035 //Overlap Legacy protection disabled.
4036 psessionEntry->gLimOlbcParams.protectionEnabled = false;
4037
4038 //We need to take care of HT OP mode if we are HT AP.
Jeff Johnsone7245742012-09-05 17:12:55 -07004039 if(psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07004040 {
4041 // no HT op mode change if any of the overlap protection enabled.
4042 if(!(psessionEntry->gLimOverlap11gParams.protectionEnabled ||
4043 psessionEntry->gLimOverlapHt20Params.protectionEnabled ||
4044 psessionEntry->gLimOverlapNonGfParams.protectionEnabled))
4045 {
4046 //Check if there is a need to change HT OP mode.
Jeff Johnson04dd8a82012-06-29 20:41:40 -07004047 if(eSIR_HT_OP_MODE_OVERLAP_LEGACY == psessionEntry->htOperMode)
Jeff Johnson295189b2012-06-20 16:38:30 -07004048 {
4049 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4050 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4051 if(psessionEntry->gLimHt20Params.protectionEnabled){
4052 //Commenting out beacuse of CR 258588 WFA cert
4053 //psessionEntry->htOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4054 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
4055 }
4056 else
4057 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
4058 }
4059 }
4060 }
4061 }
4062 else
4063 {
4064 //Disable protection from 11B stations.
4065 psessionEntry->gLim11bParams.protectionEnabled = false;
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004066 PELOGE(limLog(pMac, LOGE, FL("===> 11B Protection Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004067 //Check if any other non-HT protection enabled.
4068 if(!psessionEntry->gLim11gParams.protectionEnabled)
4069 {
4070 //Right now we are in HT OP Mixed mode.
4071 //Change HT op mode appropriately.
4072 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4073
4074 //Change HT OP mode to 01 if any overlap protection enabled
4075 if(psessionEntry->gLimOlbcParams.protectionEnabled ||
4076 psessionEntry->gLimOverlap11gParams.protectionEnabled ||
4077 psessionEntry->gLimOverlapHt20Params.protectionEnabled ||
4078 psessionEntry->gLimOverlapNonGfParams.protectionEnabled)
4079 {
4080 psessionEntry->htOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004081 PELOGE(limLog(pMac, LOGE, FL("===> 11G Protection Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004082 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4083 }
4084 else if(psessionEntry->gLimHt20Params.protectionEnabled)
4085 {
4086 //Commenting because of CR 258588 WFA cert
4087 //psessionEntry->htOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4088 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004089 PELOGE(limLog(pMac, LOGE, FL("===> 11G Protection Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004090 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4091 }
4092 else
4093 {
4094 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
4095 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4096 }
4097 }
4098 }
4099 if(!psessionEntry->gLimOlbcParams.protectionEnabled &&
4100 !psessionEntry->gLim11bParams.protectionEnabled)
4101 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004102 PELOGE(limLog(pMac, LOGE, FL("===> 11G Protection Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004103 pBeaconParams->llbCoexist = psessionEntry->beaconParams.llbCoexist = false;
4104 pBeaconParams->paramChangeBitmap |= PARAM_llBCOEXIST_CHANGED;
4105 }
4106 }else if(eLIM_BT_AMP_AP_ROLE == psessionEntry->limSystemRole)
Jeff Johnson295189b2012-06-20 16:38:30 -07004107 {
4108 if(overlap)
4109 {
4110 //Overlap Legacy protection disabled.
4111 psessionEntry->gLimOlbcParams.protectionEnabled = false;
4112
4113 //We need to take care of HT OP mode iff we are HT AP.
Jeff Johnsone7245742012-09-05 17:12:55 -07004114 if(psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07004115 {
4116 // no HT op mode change if any of the overlap protection enabled.
4117 if(!(pMac->lim.gLimOverlap11gParams.protectionEnabled ||
4118 pMac->lim.gLimOverlapHt20Params.protectionEnabled ||
4119 pMac->lim.gLimOverlapNonGfParams.protectionEnabled))
4120
4121 {
4122 //Check if there is a need to change HT OP mode.
4123 if(eSIR_HT_OP_MODE_OVERLAP_LEGACY == pMac->lim.gHTOperMode)
4124 {
4125 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4126 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4127 if(psessionEntry->gLimHt20Params.protectionEnabled)
4128 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4129 else
4130 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_PURE;
4131 }
4132 }
4133 }
4134 }
4135 else
4136 {
4137 //Disable protection from 11B stations.
4138 psessionEntry->gLim11bParams.protectionEnabled = false;
4139 //Check if any other non-HT protection enabled.
4140 if(!psessionEntry->gLim11gParams.protectionEnabled)
4141 {
4142 //Right now we are in HT OP Mixed mode.
4143 //Change HT op mode appropriately.
4144 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4145
4146 //Change HT OP mode to 01 if any overlap protection enabled
4147 if(psessionEntry->gLimOlbcParams.protectionEnabled ||
4148 pMac->lim.gLimOverlap11gParams.protectionEnabled ||
4149 pMac->lim.gLimOverlapHt20Params.protectionEnabled ||
4150 pMac->lim.gLimOverlapNonGfParams.protectionEnabled)
4151
4152 {
4153 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
4154 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4155 }
4156 else if(psessionEntry->gLimHt20Params.protectionEnabled)
4157 {
4158 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4159 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4160 }
4161 else
4162 {
4163 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_PURE;
4164 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4165 }
4166 }
4167 }
4168 if(!psessionEntry->gLimOlbcParams.protectionEnabled &&
4169 !psessionEntry->gLim11bParams.protectionEnabled)
4170 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004171 PELOG1(limLog(pMac, LOG1, FL("===> 11G Protection Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004172 pBeaconParams->llbCoexist = psessionEntry->beaconParams.llbCoexist = false;
4173 pBeaconParams->paramChangeBitmap |= PARAM_llBCOEXIST_CHANGED;
4174 }
4175 }
4176 //for station role
4177 else
4178 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004179 PELOG1(limLog(pMac, LOG1, FL("===> 11G Protection Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004180 pBeaconParams->llbCoexist = psessionEntry->beaconParams.llbCoexist = false;
4181 pBeaconParams->paramChangeBitmap |= PARAM_llBCOEXIST_CHANGED;
4182 }
4183 }
4184 return eSIR_SUCCESS;
4185}
4186
4187/** -------------------------------------------------------------
4188\fn limEnableHtProtectionFrom11g
4189\brief based on cofig enables\disables protection from 11g.
4190\param tANI_U8 enable : 1=> enable protection, 0=> disable protection.
4191\param tANI_U8 overlap: 1=> called from overlap context, 0 => called from assoc context.
4192\param tpUpdateBeaconParams pBeaconParams
4193\return None
4194 -------------------------------------------------------------*/
4195tSirRetStatus
4196limEnableHtProtectionFrom11g(tpAniSirGlobal pMac, tANI_U8 enable,
4197 tANI_U8 overlap, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry)
4198{
Jeff Johnsone7245742012-09-05 17:12:55 -07004199 if(!psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07004200 return eSIR_SUCCESS; // protection from 11g is only for HT stations.
4201
4202 //overlapping protection configuration check.
4203 if(overlap)
4204 {
Jeff Johnson295189b2012-06-20 16:38:30 -07004205 if((psessionEntry->limSystemRole == eLIM_AP_ROLE ) && (!psessionEntry->cfgProtection.overlapFromllg))
4206 {
4207 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004208 PELOG3(limLog(pMac, LOG3, FL("overlap protection from 11g is disabled")););
Jeff Johnson295189b2012-06-20 16:38:30 -07004209 return eSIR_SUCCESS;
4210 }else if ((psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE) && (!pMac->lim.cfgProtection.overlapFromllg))
Jeff Johnson295189b2012-06-20 16:38:30 -07004211 {
4212 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004213 PELOG3(limLog(pMac, LOG3, FL("overlap protection from 11g is disabled")););
Jeff Johnson295189b2012-06-20 16:38:30 -07004214 return eSIR_SUCCESS;
4215 }
4216 }
4217 else
4218 {
4219 //normal protection config check
Jeff Johnson295189b2012-06-20 16:38:30 -07004220 if((psessionEntry->limSystemRole == eLIM_AP_ROLE ) &&
4221 !psessionEntry->cfgProtection.fromllg){
4222 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004223 PELOG3(limLog(pMac, LOG3, FL("protection from 11g is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004224 return eSIR_SUCCESS;
4225 }else if(psessionEntry->limSystemRole != eLIM_AP_ROLE )
Jeff Johnson295189b2012-06-20 16:38:30 -07004226 {
4227 if(!pMac->lim.cfgProtection.fromllg)
4228 {
4229 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004230 PELOG3(limLog(pMac, LOG3, FL("protection from 11g is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004231 return eSIR_SUCCESS;
4232 }
4233 }
4234 }
4235 if (enable)
4236 {
4237 //If we are AP and HT capable, we need to set the HT OP mode
4238 //appropriately.
4239
Jeff Johnson295189b2012-06-20 16:38:30 -07004240 if(eLIM_AP_ROLE == psessionEntry->limSystemRole)
4241 {
4242 if(overlap)
4243 {
4244 psessionEntry->gLimOverlap11gParams.protectionEnabled = true;
4245 //11g exists in overlap BSS.
4246 //need not to change the operating mode to overlap_legacy
4247 //if higher or same protection operating mode is enabled right now.
4248 if((eSIR_HT_OP_MODE_OVERLAP_LEGACY != psessionEntry->htOperMode) &&
4249 (eSIR_HT_OP_MODE_MIXED != psessionEntry->htOperMode))
4250 {
4251 psessionEntry->htOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
4252 }
4253 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05304254 limEnableHtOBSSProtection(pMac, true, overlap, pBeaconParams, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07004255 }
4256 else
4257 {
4258 //11g is associated to an AP operating in 11n mode.
4259 //Change the HT operating mode to 'mixed mode'.
4260 psessionEntry->gLim11gParams.protectionEnabled = true;
4261 if(eSIR_HT_OP_MODE_MIXED != psessionEntry->htOperMode)
4262 {
4263 psessionEntry->htOperMode = eSIR_HT_OP_MODE_MIXED;
4264 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05304265 limEnableHtOBSSProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07004266 }
4267 }
4268 }else if(eLIM_BT_AMP_AP_ROLE == psessionEntry->limSystemRole)
Jeff Johnson295189b2012-06-20 16:38:30 -07004269 {
4270 if(overlap)
4271 {
4272 pMac->lim.gLimOverlap11gParams.protectionEnabled = true;
4273 //11g exists in overlap BSS.
4274 //need not to change the operating mode to overlap_legacy
4275 //if higher or same protection operating mode is enabled right now.
4276 if((eSIR_HT_OP_MODE_OVERLAP_LEGACY != pMac->lim.gHTOperMode) &&
4277 (eSIR_HT_OP_MODE_MIXED != pMac->lim.gHTOperMode))
4278 {
4279 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
4280 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4281 }
4282 }
4283 else
4284 {
4285 //11g is associated to an AP operating in 11n mode.
4286 //Change the HT operating mode to 'mixed mode'.
4287 psessionEntry->gLim11gParams.protectionEnabled = true;
4288 if(eSIR_HT_OP_MODE_MIXED != pMac->lim.gHTOperMode)
4289 {
4290 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_MIXED;
4291 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05304292 limEnableHtOBSSProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07004293 }
4294 }
4295 }
4296
4297 //This part is common for staiton as well.
4298 if(false == psessionEntry->beaconParams.llgCoexist)
4299 {
4300 pBeaconParams->llgCoexist = psessionEntry->beaconParams.llgCoexist = true;
4301 pBeaconParams->paramChangeBitmap |= PARAM_llGCOEXIST_CHANGED;
4302 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004303 else if (true == psessionEntry->gLimOverlap11gParams.protectionEnabled)
4304 {
4305 // As operating mode changed after G station assoc some way to update beacon
4306 // This addresses the issue of mode not changing to - 11 in beacon when OBSS overlap is enabled
4307 //pMac->sch.schObject.fBeaconChanged = 1;
4308 pBeaconParams->paramChangeBitmap |= PARAM_llGCOEXIST_CHANGED;
4309 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004310 }
4311 else if (true == psessionEntry->beaconParams.llgCoexist)
4312 {
4313 //for AP role.
4314 //we need to take care of HT OP mode change if needed.
4315 //We need to take care of Overlap cases.
4316
Jeff Johnson295189b2012-06-20 16:38:30 -07004317 if(eLIM_AP_ROLE == psessionEntry->limSystemRole)
4318 {
4319 if(overlap)
4320 {
4321 //Overlap Legacy protection disabled.
4322 if (psessionEntry->gLim11gParams.numSta == 0)
4323 psessionEntry->gLimOverlap11gParams.protectionEnabled = false;
4324
4325 // no HT op mode change if any of the overlap protection enabled.
4326 if(!(psessionEntry->gLimOlbcParams.protectionEnabled ||
4327 psessionEntry->gLimOverlapHt20Params.protectionEnabled ||
4328 psessionEntry->gLimOverlapNonGfParams.protectionEnabled))
4329 {
4330 //Check if there is a need to change HT OP mode.
4331 if(eSIR_HT_OP_MODE_OVERLAP_LEGACY == psessionEntry->htOperMode)
4332 {
4333 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4334 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4335
4336 if(psessionEntry->gLimHt20Params.protectionEnabled){
4337 //Commenting because of CR 258588 WFA cert
4338 //psessionEntry->htOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4339 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
4340 }
4341 else
4342 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
4343 }
4344 }
4345 }
4346 else
4347 {
4348 //Disable protection from 11G stations.
4349 psessionEntry->gLim11gParams.protectionEnabled = false;
4350 //Check if any other non-HT protection enabled.
4351 if(!psessionEntry->gLim11bParams.protectionEnabled)
4352 {
4353
4354 //Right now we are in HT OP Mixed mode.
4355 //Change HT op mode appropriately.
4356 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4357
4358 //Change HT OP mode to 01 if any overlap protection enabled
4359 if(psessionEntry->gLimOlbcParams.protectionEnabled ||
4360 psessionEntry->gLimOverlap11gParams.protectionEnabled ||
4361 psessionEntry->gLimOverlapHt20Params.protectionEnabled ||
4362 psessionEntry->gLimOverlapNonGfParams.protectionEnabled)
4363
4364 {
4365 psessionEntry->htOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
4366 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4367 }
4368 else if(psessionEntry->gLimHt20Params.protectionEnabled)
4369 {
4370 //Commenting because of CR 258588 WFA cert
4371 //psessionEntry->htOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4372 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
4373 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4374 }
4375 else
4376 {
4377 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
4378 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4379 }
4380 }
4381 }
4382 if(!psessionEntry->gLimOverlap11gParams.protectionEnabled &&
4383 !psessionEntry->gLim11gParams.protectionEnabled)
4384 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004385 PELOG1(limLog(pMac, LOG1, FL("===> Protection from 11G Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004386 pBeaconParams->llgCoexist = psessionEntry->beaconParams.llgCoexist = false;
4387 pBeaconParams->paramChangeBitmap |= PARAM_llGCOEXIST_CHANGED;
4388 }
4389 }else if(eLIM_BT_AMP_AP_ROLE == psessionEntry->limSystemRole)
Jeff Johnson295189b2012-06-20 16:38:30 -07004390 {
4391 if(overlap)
4392 {
4393 //Overlap Legacy protection disabled.
4394 pMac->lim.gLimOverlap11gParams.protectionEnabled = false;
4395
4396 // no HT op mode change if any of the overlap protection enabled.
4397 if(!(psessionEntry->gLimOlbcParams.protectionEnabled ||
4398 psessionEntry->gLimOverlapHt20Params.protectionEnabled ||
4399 psessionEntry->gLimOverlapNonGfParams.protectionEnabled))
4400 {
4401 //Check if there is a need to change HT OP mode.
4402 if(eSIR_HT_OP_MODE_OVERLAP_LEGACY == pMac->lim.gHTOperMode)
4403 {
4404 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4405 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4406
4407 if(psessionEntry->gLimHt20Params.protectionEnabled)
4408 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4409 else
4410 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_PURE;
4411 }
4412 }
4413 }
4414 else
4415 {
4416 //Disable protection from 11G stations.
4417 psessionEntry->gLim11gParams.protectionEnabled = false;
4418 //Check if any other non-HT protection enabled.
4419 if(!psessionEntry->gLim11bParams.protectionEnabled)
4420 {
4421
4422 //Right now we are in HT OP Mixed mode.
4423 //Change HT op mode appropriately.
4424 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4425
4426 //Change HT OP mode to 01 if any overlap protection enabled
4427 if(psessionEntry->gLimOlbcParams.protectionEnabled ||
4428 pMac->lim.gLimOverlap11gParams.protectionEnabled ||
4429 pMac->lim.gLimOverlapHt20Params.protectionEnabled ||
4430 pMac->lim.gLimOverlapNonGfParams.protectionEnabled)
4431
4432 {
4433 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
4434 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4435 }
4436 else if(psessionEntry->gLimHt20Params.protectionEnabled)
4437 {
4438 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4439 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4440 }
4441 else
4442 {
4443 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_PURE;
4444 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4445 }
4446 }
4447 }
4448 if(!pMac->lim.gLimOverlap11gParams.protectionEnabled &&
4449 !psessionEntry->gLim11gParams.protectionEnabled)
4450 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004451 PELOG1(limLog(pMac, LOG1, FL("===> Protection from 11G Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004452 pBeaconParams->llgCoexist = psessionEntry->beaconParams.llgCoexist = false;
4453 pBeaconParams->paramChangeBitmap |= PARAM_llGCOEXIST_CHANGED;
4454 }
4455 }
4456 //for station role
4457 else
4458 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004459 PELOG1(limLog(pMac, LOG1, FL("===> Protection from 11G Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004460 pBeaconParams->llgCoexist = psessionEntry->beaconParams.llgCoexist = false;
4461 pBeaconParams->paramChangeBitmap |= PARAM_llGCOEXIST_CHANGED;
4462 }
4463 }
4464 return eSIR_SUCCESS;
4465}
4466//FIXME_PROTECTION : need to check for no APSD whenever we want to enable this protection.
4467//This check will be done at the caller.
4468
4469/** -------------------------------------------------------------
4470\fn limEnableHtObssProtection
4471\brief based on cofig enables\disables obss protection.
4472\param tANI_U8 enable : 1=> enable protection, 0=> disable protection.
4473\param tANI_U8 overlap: 1=> called from overlap context, 0 => called from assoc context.
4474\param tpUpdateBeaconParams pBeaconParams
4475\return None
4476 -------------------------------------------------------------*/
4477tSirRetStatus
4478limEnableHtOBSSProtection(tpAniSirGlobal pMac, tANI_U8 enable,
4479 tANI_U8 overlap, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry)
4480{
4481
4482
Jeff Johnsone7245742012-09-05 17:12:55 -07004483 if(!psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07004484 return eSIR_SUCCESS; // this protection is only for HT stations.
4485
4486 //overlapping protection configuration check.
4487 if(overlap)
4488 {
4489 //overlapping protection configuration check.
Jeff Johnson295189b2012-06-20 16:38:30 -07004490 }
4491 else
4492 {
4493 //normal protection config check
Jeff Johnson295189b2012-06-20 16:38:30 -07004494 if((psessionEntry->limSystemRole == eLIM_AP_ROLE) && !psessionEntry->cfgProtection.obss)
4495 { //ToDo Update this field
4496 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004497 PELOG1(limLog(pMac, LOG1, FL("protection from Obss is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004498 return eSIR_SUCCESS;
4499 }else if(psessionEntry->limSystemRole != eLIM_AP_ROLE)
Jeff Johnson295189b2012-06-20 16:38:30 -07004500 {
4501 if(!pMac->lim.cfgProtection.obss)
4502 { //ToDo Update this field
4503 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004504 PELOG1(limLog(pMac, LOG1, FL("protection from Obss is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004505 return eSIR_SUCCESS;
4506 }
4507 }
4508 }
4509
4510
Jeff Johnson295189b2012-06-20 16:38:30 -07004511 if (eLIM_AP_ROLE == psessionEntry->limSystemRole){
4512 if ((enable) && (false == psessionEntry->beaconParams.gHTObssMode) )
4513 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004514 PELOG1(limLog(pMac, LOG1, FL("=>obss protection enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004515 psessionEntry->beaconParams.gHTObssMode = true;
4516 pBeaconParams->paramChangeBitmap |= PARAM_OBSS_MODE_CHANGED; // UPDATE AN ENUM FOR OBSS MODE <todo>
4517
4518 }
4519 else if (!enable && (true == psessionEntry->beaconParams.gHTObssMode))
4520 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004521 PELOG1(limLog(pMac, LOG1, FL("===> obss Protection disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004522 psessionEntry->beaconParams.gHTObssMode = false;
4523 pBeaconParams->paramChangeBitmap |= PARAM_OBSS_MODE_CHANGED;
4524
4525 }
4526//CR-263021: OBSS bit is not switching back to 0 after disabling the overlapping legacy BSS
4527 if (!enable && !overlap)
4528 {
4529 psessionEntry->gLimOverlap11gParams.protectionEnabled = false;
4530 }
4531 } else
Jeff Johnson295189b2012-06-20 16:38:30 -07004532 {
4533 if ((enable) && (false == psessionEntry->beaconParams.gHTObssMode) )
4534 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004535 PELOG1(limLog(pMac, LOG1, FL("=>obss protection enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004536 psessionEntry->beaconParams.gHTObssMode = true;
4537 pBeaconParams->paramChangeBitmap |= PARAM_OBSS_MODE_CHANGED; // UPDATE AN ENUM FOR OBSS MODE <todo>
4538
4539 }
4540 else if (!enable && (true == psessionEntry->beaconParams.gHTObssMode))
4541 {
4542
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004543 PELOG1(limLog(pMac, LOG1, FL("===> obss Protection disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004544 psessionEntry->beaconParams.gHTObssMode = false;
4545 pBeaconParams->paramChangeBitmap |= PARAM_OBSS_MODE_CHANGED;
4546
4547 }
4548 }
4549 return eSIR_SUCCESS;
4550}
4551/** -------------------------------------------------------------
4552\fn limEnableHT20Protection
4553\brief based on cofig enables\disables protection from Ht20.
4554\param tANI_U8 enable : 1=> enable protection, 0=> disable protection.
4555\param tANI_U8 overlap: 1=> called from overlap context, 0 => called from assoc context.
4556\param tpUpdateBeaconParams pBeaconParams
4557\return None
4558 -------------------------------------------------------------*/
4559tSirRetStatus
4560limEnableHT20Protection(tpAniSirGlobal pMac, tANI_U8 enable,
4561 tANI_U8 overlap, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry)
4562{
Jeff Johnsone7245742012-09-05 17:12:55 -07004563 if(!psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07004564 return eSIR_SUCCESS; // this protection is only for HT stations.
4565
4566 //overlapping protection configuration check.
4567 if(overlap)
4568 {
Jeff Johnson295189b2012-06-20 16:38:30 -07004569 }
4570 else
4571 {
4572 //normal protection config check
Jeff Johnson295189b2012-06-20 16:38:30 -07004573 if((psessionEntry->limSystemRole == eLIM_AP_ROLE ) &&
4574 !psessionEntry->cfgProtection.ht20)
4575 {
4576 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004577 PELOG3(limLog(pMac, LOG3, FL("protection from HT20 is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004578 return eSIR_SUCCESS;
4579 }else if(psessionEntry->limSystemRole != eLIM_AP_ROLE )
Jeff Johnson295189b2012-06-20 16:38:30 -07004580 {
4581 if(!pMac->lim.cfgProtection.ht20)
4582 {
4583 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004584 PELOG3(limLog(pMac, LOG3, FL("protection from HT20 is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004585 return eSIR_SUCCESS;
4586 }
4587 }
4588 }
4589
4590 if (enable)
4591 {
4592 //If we are AP and HT capable, we need to set the HT OP mode
4593 //appropriately.
4594
Jeff Johnson295189b2012-06-20 16:38:30 -07004595 if(eLIM_AP_ROLE == psessionEntry->limSystemRole){
4596 if(overlap)
4597 {
4598 psessionEntry->gLimOverlapHt20Params.protectionEnabled = true;
4599 if((eSIR_HT_OP_MODE_OVERLAP_LEGACY != psessionEntry->htOperMode) &&
4600 (eSIR_HT_OP_MODE_MIXED != psessionEntry->htOperMode))
4601 {
4602 psessionEntry->htOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
4603 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4604 }
4605 }
4606 else
4607 {
4608 psessionEntry->gLimHt20Params.protectionEnabled = true;
4609 if(eSIR_HT_OP_MODE_PURE == psessionEntry->htOperMode)
4610 {
4611 //Commenting because of CR 258588 WFA cert
4612 //psessionEntry->htOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4613 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
4614 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4615 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4616 }
4617 }
4618 }else if(eLIM_BT_AMP_AP_ROLE == psessionEntry->limSystemRole)
Jeff Johnson295189b2012-06-20 16:38:30 -07004619 {
4620 if(overlap)
4621 {
4622 pMac->lim.gLimOverlapHt20Params.protectionEnabled = true;
4623 if((eSIR_HT_OP_MODE_OVERLAP_LEGACY != pMac->lim.gHTOperMode) &&
4624 (eSIR_HT_OP_MODE_MIXED != pMac->lim.gHTOperMode))
4625 {
4626 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
4627 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4628 }
4629 }
4630 else
4631 {
4632 psessionEntry->gLimHt20Params.protectionEnabled = true;
4633 if(eSIR_HT_OP_MODE_PURE == pMac->lim.gHTOperMode)
4634 {
4635 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4636 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4637 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4638 }
4639 }
4640 }
4641
4642 //This part is common for staiton as well.
4643 if(false == psessionEntry->beaconParams.ht20Coexist)
4644 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004645 PELOG1(limLog(pMac, LOG1, FL("=> Prtection from HT20 Enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004646 pBeaconParams->ht20MhzCoexist = psessionEntry->beaconParams.ht20Coexist = true;
4647 pBeaconParams->paramChangeBitmap |= PARAM_HT20MHZCOEXIST_CHANGED;
4648 }
4649 }
4650 else if (true == psessionEntry->beaconParams.ht20Coexist)
4651 {
4652 //for AP role.
4653 //we need to take care of HT OP mode change if needed.
4654 //We need to take care of Overlap cases.
Jeff Johnson295189b2012-06-20 16:38:30 -07004655 if(eLIM_AP_ROLE == psessionEntry->limSystemRole){
4656 if(overlap)
4657 {
4658 //Overlap Legacy protection disabled.
4659 psessionEntry->gLimOverlapHt20Params.protectionEnabled = false;
4660
4661 // no HT op mode change if any of the overlap protection enabled.
4662 if(!(psessionEntry->gLimOlbcParams.protectionEnabled ||
4663 psessionEntry->gLimOverlap11gParams.protectionEnabled ||
4664 psessionEntry->gLimOverlapHt20Params.protectionEnabled ||
4665 psessionEntry->gLimOverlapNonGfParams.protectionEnabled))
4666 {
4667
4668 //Check if there is a need to change HT OP mode.
4669 if(eSIR_HT_OP_MODE_OVERLAP_LEGACY == psessionEntry->htOperMode)
4670 {
4671 if(psessionEntry->gLimHt20Params.protectionEnabled)
4672 {
4673 //Commented beacuse of CR 258588 for WFA Cert
4674 //psessionEntry->htOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4675 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
4676 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4677 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4678 }
4679 else
4680 {
4681 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
4682 }
4683 }
4684 }
4685 }
4686 else
4687 {
4688 //Disable protection from 11G stations.
4689 psessionEntry->gLimHt20Params.protectionEnabled = false;
4690
4691 //Change HT op mode appropriately.
4692 if(eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT == psessionEntry->htOperMode)
4693 {
4694 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
4695 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4696 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4697 }
4698 }
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004699 PELOG1(limLog(pMac, LOG1, FL("===> Protection from HT 20 Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004700 pBeaconParams->ht20MhzCoexist = psessionEntry->beaconParams.ht20Coexist = false;
4701 pBeaconParams->paramChangeBitmap |= PARAM_HT20MHZCOEXIST_CHANGED;
4702 }else if(eLIM_BT_AMP_AP_ROLE == psessionEntry->limSystemRole)
Jeff Johnson295189b2012-06-20 16:38:30 -07004703 {
4704 if(overlap)
4705 {
4706 //Overlap Legacy protection disabled.
4707 pMac->lim.gLimOverlapHt20Params.protectionEnabled = false;
4708
4709 // no HT op mode change if any of the overlap protection enabled.
4710 if(!(psessionEntry->gLimOlbcParams.protectionEnabled ||
4711 pMac->lim.gLimOverlap11gParams.protectionEnabled ||
4712 pMac->lim.gLimOverlapHt20Params.protectionEnabled ||
4713 pMac->lim.gLimOverlapNonGfParams.protectionEnabled))
4714 {
4715
4716 //Check if there is a need to change HT OP mode.
4717 if(eSIR_HT_OP_MODE_OVERLAP_LEGACY == pMac->lim.gHTOperMode)
4718 {
4719 if(psessionEntry->gLimHt20Params.protectionEnabled)
4720 {
4721 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4722 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4723 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4724 }
4725 else
4726 {
4727 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_PURE;
4728 }
4729 }
4730 }
4731 }
4732 else
4733 {
4734 //Disable protection from 11G stations.
4735 psessionEntry->gLimHt20Params.protectionEnabled = false;
4736
4737 //Change HT op mode appropriately.
4738 if(eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT == pMac->lim.gHTOperMode)
4739 {
4740 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_PURE;
4741 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4742 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4743 }
4744 }
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004745 PELOG1(limLog(pMac, LOG1, FL("===> Protection from HT 20 Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004746 pBeaconParams->ht20MhzCoexist = psessionEntry->beaconParams.ht20Coexist = false;
4747 pBeaconParams->paramChangeBitmap |= PARAM_HT20MHZCOEXIST_CHANGED;
4748 }
4749 //for station role
4750 else
4751 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004752 PELOG1(limLog(pMac, LOG1, FL("===> Protection from HT20 Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004753 pBeaconParams->ht20MhzCoexist = psessionEntry->beaconParams.ht20Coexist = false;
4754 pBeaconParams->paramChangeBitmap |= PARAM_HT20MHZCOEXIST_CHANGED;
4755 }
4756 }
4757
4758 return eSIR_SUCCESS;
4759}
4760
4761/** -------------------------------------------------------------
4762\fn limEnableHTNonGfProtection
4763\brief based on cofig enables\disables protection from NonGf.
4764\param tANI_U8 enable : 1=> enable protection, 0=> disable protection.
4765\param tANI_U8 overlap: 1=> called from overlap context, 0 => called from assoc context.
4766\param tpUpdateBeaconParams pBeaconParams
4767\return None
4768 -------------------------------------------------------------*/
4769tSirRetStatus
4770limEnableHTNonGfProtection(tpAniSirGlobal pMac, tANI_U8 enable,
4771 tANI_U8 overlap, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry)
4772{
Jeff Johnsone7245742012-09-05 17:12:55 -07004773 if(!psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07004774 return eSIR_SUCCESS; // this protection is only for HT stations.
4775
4776 //overlapping protection configuration check.
4777 if(overlap)
4778 {
Jeff Johnson295189b2012-06-20 16:38:30 -07004779 }
4780 else
4781 {
Jeff Johnson295189b2012-06-20 16:38:30 -07004782 //normal protection config check
4783 if((psessionEntry->limSystemRole == eLIM_AP_ROLE ) &&
4784 !psessionEntry->cfgProtection.nonGf)
4785 {
4786 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004787 PELOG3(limLog(pMac, LOG3, FL("protection from NonGf is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004788 return eSIR_SUCCESS;
4789 }else if(psessionEntry->limSystemRole != eLIM_AP_ROLE)
Jeff Johnson295189b2012-06-20 16:38:30 -07004790 {
4791 //normal protection config check
4792 if(!pMac->lim.cfgProtection.nonGf)
4793 {
4794 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004795 PELOG3(limLog(pMac, LOG3, FL("protection from NonGf is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004796 return eSIR_SUCCESS;
4797 }
4798 }
4799 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004800 if(psessionEntry->limSystemRole == eLIM_AP_ROLE){
4801 if ((enable) && (false == psessionEntry->beaconParams.llnNonGFCoexist))
4802 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004803 PELOG1(limLog(pMac, LOG1, FL(" => Prtection from non GF Enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004804 pBeaconParams->llnNonGFCoexist = psessionEntry->beaconParams.llnNonGFCoexist = true;
4805 pBeaconParams->paramChangeBitmap |= PARAM_NON_GF_DEVICES_PRESENT_CHANGED;
4806 }
4807 else if (!enable && (true == psessionEntry->beaconParams.llnNonGFCoexist))
4808 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004809 PELOG1(limLog(pMac, LOG1, FL("===> Protection from Non GF Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004810 pBeaconParams->llnNonGFCoexist = psessionEntry->beaconParams.llnNonGFCoexist = false;
4811 pBeaconParams->paramChangeBitmap |= PARAM_NON_GF_DEVICES_PRESENT_CHANGED;
4812 }
4813 }else
Jeff Johnson295189b2012-06-20 16:38:30 -07004814 {
4815 if ((enable) && (false == psessionEntry->beaconParams.llnNonGFCoexist))
4816 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004817 PELOG1(limLog(pMac, LOG1, FL(" => Prtection from non GF Enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004818 pBeaconParams->llnNonGFCoexist = psessionEntry->beaconParams.llnNonGFCoexist = true;
4819 pBeaconParams->paramChangeBitmap |= PARAM_NON_GF_DEVICES_PRESENT_CHANGED;
4820 }
4821 else if (!enable && (true == psessionEntry->beaconParams.llnNonGFCoexist))
4822 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004823 PELOG1(limLog(pMac, LOG1, FL("===> Protection from Non GF Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004824 pBeaconParams->llnNonGFCoexist = psessionEntry->beaconParams.llnNonGFCoexist = false;
4825 pBeaconParams->paramChangeBitmap |= PARAM_NON_GF_DEVICES_PRESENT_CHANGED;
4826 }
4827 }
4828
4829 return eSIR_SUCCESS;
4830}
4831
4832/** -------------------------------------------------------------
4833\fn limEnableHTLsigTxopProtection
4834\brief based on cofig enables\disables LsigTxop protection.
4835\param tANI_U8 enable : 1=> enable protection, 0=> disable protection.
4836\param tANI_U8 overlap: 1=> called from overlap context, 0 => called from assoc context.
4837\param tpUpdateBeaconParams pBeaconParams
4838\return None
4839 -------------------------------------------------------------*/
4840tSirRetStatus
4841limEnableHTLsigTxopProtection(tpAniSirGlobal pMac, tANI_U8 enable,
4842 tANI_U8 overlap, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry)
4843{
Jeff Johnsone7245742012-09-05 17:12:55 -07004844 if(!psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07004845 return eSIR_SUCCESS; // this protection is only for HT stations.
4846
4847 //overlapping protection configuration check.
4848 if(overlap)
4849 {
Jeff Johnson295189b2012-06-20 16:38:30 -07004850 }
4851 else
4852 {
Jeff Johnson295189b2012-06-20 16:38:30 -07004853 //normal protection config check
4854 if((psessionEntry->limSystemRole == eLIM_AP_ROLE ) &&
4855 !psessionEntry->cfgProtection.lsigTxop)
4856 {
4857 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004858 PELOG3(limLog(pMac, LOG3, FL(" protection from LsigTxop not supported is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004859 return eSIR_SUCCESS;
4860 }else if(psessionEntry->limSystemRole != eLIM_AP_ROLE)
Jeff Johnson295189b2012-06-20 16:38:30 -07004861 {
4862 //normal protection config check
4863 if(!pMac->lim.cfgProtection.lsigTxop)
4864 {
4865 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004866 PELOG3(limLog(pMac, LOG3, FL(" protection from LsigTxop not supported is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004867 return eSIR_SUCCESS;
4868 }
4869 }
4870 }
4871
4872
Jeff Johnson295189b2012-06-20 16:38:30 -07004873 if(psessionEntry->limSystemRole == eLIM_AP_ROLE){
4874 if ((enable) && (false == psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport))
4875 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004876 PELOG1(limLog(pMac, LOG1, FL(" => Prtection from LsigTxop Enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004877 pBeaconParams->fLsigTXOPProtectionFullSupport = psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport = true;
4878 pBeaconParams->paramChangeBitmap |= PARAM_LSIG_TXOP_FULL_SUPPORT_CHANGED;
4879 }
4880 else if (!enable && (true == psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport))
4881 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004882 PELOG1(limLog(pMac, LOG1, FL("===> Protection from LsigTxop Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004883 pBeaconParams->fLsigTXOPProtectionFullSupport= psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport = false;
4884 pBeaconParams->paramChangeBitmap |= PARAM_LSIG_TXOP_FULL_SUPPORT_CHANGED;
4885 }
4886 }else
Jeff Johnson295189b2012-06-20 16:38:30 -07004887 {
4888 if ((enable) && (false == psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport))
4889 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004890 PELOG1(limLog(pMac, LOG1, FL(" => Prtection from LsigTxop Enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004891 pBeaconParams->fLsigTXOPProtectionFullSupport = psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport = true;
4892 pBeaconParams->paramChangeBitmap |= PARAM_LSIG_TXOP_FULL_SUPPORT_CHANGED;
4893 }
4894 else if (!enable && (true == psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport))
4895 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004896 PELOG1(limLog(pMac, LOG1, FL("===> Protection from LsigTxop Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004897 pBeaconParams->fLsigTXOPProtectionFullSupport= psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport = false;
4898 pBeaconParams->paramChangeBitmap |= PARAM_LSIG_TXOP_FULL_SUPPORT_CHANGED;
4899 }
4900 }
4901 return eSIR_SUCCESS;
4902}
4903//FIXME_PROTECTION : need to check for no APSD whenever we want to enable this protection.
4904//This check will be done at the caller.
4905/** -------------------------------------------------------------
4906\fn limEnableHtRifsProtection
4907\brief based on cofig enables\disables Rifs protection.
4908\param tANI_U8 enable : 1=> enable protection, 0=> disable protection.
4909\param tANI_U8 overlap: 1=> called from overlap context, 0 => called from assoc context.
4910\param tpUpdateBeaconParams pBeaconParams
4911\return None
4912 -------------------------------------------------------------*/
4913tSirRetStatus
4914limEnableHtRifsProtection(tpAniSirGlobal pMac, tANI_U8 enable,
4915 tANI_U8 overlap, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry)
4916{
Jeff Johnsone7245742012-09-05 17:12:55 -07004917 if(!psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07004918 return eSIR_SUCCESS; // this protection is only for HT stations.
4919
4920
4921 //overlapping protection configuration check.
4922 if(overlap)
4923 {
Jeff Johnson295189b2012-06-20 16:38:30 -07004924 }
4925 else
4926 {
Jeff Johnson295189b2012-06-20 16:38:30 -07004927 //normal protection config check
4928 if((psessionEntry->limSystemRole == eLIM_AP_ROLE) &&
4929 !psessionEntry->cfgProtection.rifs)
4930 {
4931 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004932 PELOG3(limLog(pMac, LOG3, FL(" protection from Rifs is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004933 return eSIR_SUCCESS;
4934 }else if(psessionEntry->limSystemRole != eLIM_AP_ROLE )
Jeff Johnson295189b2012-06-20 16:38:30 -07004935 {
4936 //normal protection config check
4937 if(!pMac->lim.cfgProtection.rifs)
4938 {
4939 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004940 PELOG3(limLog(pMac, LOG3, FL(" protection from Rifs is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004941 return eSIR_SUCCESS;
4942 }
4943 }
4944 }
4945
Jeff Johnson295189b2012-06-20 16:38:30 -07004946 if(psessionEntry->limSystemRole == eLIM_AP_ROLE){
4947 // Disabling the RIFS Protection means Enable the RIFS mode of operation in the BSS
4948 if ((!enable) && (false == psessionEntry->beaconParams.fRIFSMode))
4949 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004950 PELOG1(limLog(pMac, LOG1, FL(" => Rifs protection Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004951 pBeaconParams->fRIFSMode = psessionEntry->beaconParams.fRIFSMode = true;
4952 pBeaconParams->paramChangeBitmap |= PARAM_RIFS_MODE_CHANGED;
4953 }
4954 // Enabling the RIFS Protection means Disable the RIFS mode of operation in the BSS
4955 else if (enable && (true == psessionEntry->beaconParams.fRIFSMode))
4956 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004957 PELOG1(limLog(pMac, LOG1, FL("===> Rifs Protection Enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004958 pBeaconParams->fRIFSMode = psessionEntry->beaconParams.fRIFSMode = false;
4959 pBeaconParams->paramChangeBitmap |= PARAM_RIFS_MODE_CHANGED;
4960 }
4961 }else
Jeff Johnson295189b2012-06-20 16:38:30 -07004962 {
4963 // Disabling the RIFS Protection means Enable the RIFS mode of operation in the BSS
4964 if ((!enable) && (false == psessionEntry->beaconParams.fRIFSMode))
4965 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004966 PELOG1(limLog(pMac, LOG1, FL(" => Rifs protection Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004967 pBeaconParams->fRIFSMode = psessionEntry->beaconParams.fRIFSMode = true;
4968 pBeaconParams->paramChangeBitmap |= PARAM_RIFS_MODE_CHANGED;
4969 }
4970 // Enabling the RIFS Protection means Disable the RIFS mode of operation in the BSS
4971 else if (enable && (true == psessionEntry->beaconParams.fRIFSMode))
4972 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004973 PELOG1(limLog(pMac, LOG1, FL("===> Rifs Protection Enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004974 pBeaconParams->fRIFSMode = psessionEntry->beaconParams.fRIFSMode = false;
4975 pBeaconParams->paramChangeBitmap |= PARAM_RIFS_MODE_CHANGED;
4976 }
4977 }
4978 return eSIR_SUCCESS;
4979}
4980
4981// ---------------------------------------------------------------------
4982/**
4983 * limEnableShortPreamble
4984 *
4985 * FUNCTION:
4986 * Enable/Disable short preamble
4987 *
4988 * LOGIC:
4989 *
4990 * ASSUMPTIONS:
4991 *
4992 * NOTE:
4993 *
4994 * @param enable Flag to enable/disable short preamble
4995 * @return None
4996 */
4997
4998tSirRetStatus
4999limEnableShortPreamble(tpAniSirGlobal pMac, tANI_U8 enable, tpUpdateBeaconParams pBeaconParams, tpPESession psessionEntry)
5000{
5001 tANI_U32 val;
5002
5003 if (wlan_cfgGetInt(pMac, WNI_CFG_SHORT_PREAMBLE, &val) != eSIR_SUCCESS)
5004 {
5005 /* Could not get short preamble enabled flag from CFG. Log error. */
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005006 limLog(pMac, LOGP, FL("could not retrieve short preamble flag"));
Jeff Johnson295189b2012-06-20 16:38:30 -07005007 return eSIR_FAILURE;
5008 }
5009
5010 if (!val)
5011 return eSIR_SUCCESS;
5012
5013 if (wlan_cfgGetInt(pMac, WNI_CFG_11G_SHORT_PREAMBLE_ENABLED, &val) != eSIR_SUCCESS)
5014 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005015 limLog(pMac, LOGP, FL("could not retrieve 11G short preamble switching enabled flag"));
Jeff Johnson295189b2012-06-20 16:38:30 -07005016 return eSIR_FAILURE;
5017 }
5018
5019 if (!val) // 11G short preamble switching is disabled.
5020 return eSIR_SUCCESS;
5021
5022 if ( psessionEntry->limSystemRole == eLIM_AP_ROLE )
5023 {
5024 if (enable && (psessionEntry->beaconParams.fShortPreamble == 0))
5025 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005026 PELOG1(limLog(pMac, LOG1, FL("===> Short Preamble Enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005027 psessionEntry->beaconParams.fShortPreamble = true;
5028 pBeaconParams->fShortPreamble = (tANI_U8) psessionEntry->beaconParams.fShortPreamble;
5029 pBeaconParams->paramChangeBitmap |= PARAM_SHORT_PREAMBLE_CHANGED;
5030 }
5031 else if (!enable && (psessionEntry->beaconParams.fShortPreamble == 1))
5032 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005033 PELOG1(limLog(pMac, LOG1, FL("===> Short Preamble Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005034 psessionEntry->beaconParams.fShortPreamble = false;
5035 pBeaconParams->fShortPreamble = (tANI_U8) psessionEntry->beaconParams.fShortPreamble;
5036 pBeaconParams->paramChangeBitmap |= PARAM_SHORT_PREAMBLE_CHANGED;
5037 }
5038 }
5039
5040 return eSIR_SUCCESS;
5041 }
5042
5043/**
5044 * limTxComplete
5045 *
5046 * Function:
5047 * This is LIM's very own "TX MGMT frame complete" completion routine.
5048 *
5049 * Logic:
5050 * LIM wants to send a MGMT frame (broadcast or unicast)
5051 * LIM allocates memory using palPktAlloc( ..., **pData, **pPacket )
5052 * LIM transmits the MGMT frame using the API:
5053 * halTxFrame( ... pPacket, ..., (void *) limTxComplete, pData )
5054 * HDD, via halTxFrame/DXE, "transfers" the packet over to BMU
5055 * HDD, if it determines that a TX completion routine (in this case
5056 * limTxComplete) has been provided, will invoke this callback
5057 * LIM will try to free the TX MGMT packet that was earlier allocated, in order
5058 * to send this MGMT frame, using the PAL API palPktFree( ... pData, pPacket )
5059 *
5060 * Assumptions:
5061 * Presently, this is ONLY being used for MGMT frames/packets
5062 * TODO:
5063 * Would it do good for LIM to have some sort of "signature" validation to
5064 * ensure that the pData argument passed in was a buffer that was actually
5065 * allocated by LIM and/or is not corrupted?
5066 *
5067 * Note: FIXME and TODO
5068 * Looks like palPktFree() is interested in pPacket. But, when this completion
5069 * routine is called, only pData is made available to LIM!!
5070 *
5071 * @param void A pointer to pData. Shouldn't it be pPacket?!
5072 *
5073 * @return none
5074 */
5075void limTxComplete( tHalHandle hHal, void *pData )
5076{
5077 tpAniSirGlobal pMac;
5078 pMac = (tpAniSirGlobal)hHal;
5079
5080#ifdef FIXME_PRIMA
5081 /* the trace logic needs to be fixed for Prima. Refer to CR 306075 */
5082#ifdef TRACE_RECORD
5083 {
5084 tpSirMacMgmtHdr mHdr;
5085 v_U8_t *pRxBd;
5086 vos_pkt_t *pVosPkt;
5087 VOS_STATUS vosStatus;
5088
5089
5090
5091 pVosPkt = (vos_pkt_t *)pData;
5092 vosStatus = vos_pkt_peek_data( pVosPkt, 0, (v_PVOID_t *)&pRxBd, WLANHAL_RX_BD_HEADER_SIZE);
5093
5094 if(VOS_IS_STATUS_SUCCESS(vosStatus))
5095 {
5096 mHdr = WDA_GET_RX_MAC_HEADER(pRxBd);
Jeff Johnson295189b2012-06-20 16:38:30 -07005097
5098 }
5099 }
5100#endif
5101#endif
5102
5103 palPktFree( pMac->hHdd,
5104 HAL_TXRX_FRM_802_11_MGMT,
5105 (void *) NULL, // this is ignored and will likely be removed from this API
5106 (void *) pData ); // lim passed in pPacket in the pData pointer that is given in this completion routine
5107}
5108
5109/**
5110 * \brief This function updates lim global structure, if CB parameters in the BSS
5111 * have changed, and sends an indication to HAL also with the
5112 * updated HT Parameters.
5113 * This function does not detect the change in the primary channel, that is done as part
5114 * of channel Swtich IE processing.
5115 * If STA is configured with '20Mhz only' mode, then this function does not do anything
5116 * This function changes the CB mode, only if the self capability is set to '20 as well as 40Mhz'
5117 *
5118 *
5119 * \param pMac Pointer to global MAC structure
5120 *
5121 * \param pRcvdHTInfo Pointer to HT Info IE obtained from a Beacon or
5122 * Probe Response
5123 *
5124 * \param bssIdx BSS Index of the Bss to which Station is associated.
5125 *
5126 *
5127 */
5128
5129void limUpdateStaRunTimeHTSwitchChnlParams( tpAniSirGlobal pMac,
5130 tDot11fIEHTInfo *pHTInfo,
5131 tANI_U8 bssIdx,
5132 tpPESession psessionEntry)
5133{
Jeff Johnsone7245742012-09-05 17:12:55 -07005134 ePhyChanBondState secondaryChnlOffset = PHY_SINGLE_CHANNEL_CENTERED;
Jeff Johnson295189b2012-06-20 16:38:30 -07005135#if !defined WLAN_FEATURE_VOWIFI
5136 tANI_U32 localPwrConstraint;
5137#endif
5138
5139 //If self capability is set to '20Mhz only', then do not change the CB mode.
Jeff Johnson295189b2012-06-20 16:38:30 -07005140 if( !limGetHTCapability( pMac, eHT_SUPPORTED_CHANNEL_WIDTH_SET, psessionEntry ))
Jeff Johnson295189b2012-06-20 16:38:30 -07005141 return;
5142
5143#if !defined WLAN_FEATURE_VOWIFI
5144 if(wlan_cfgGetInt(pMac, WNI_CFG_LOCAL_POWER_CONSTRAINT, &localPwrConstraint) != eSIR_SUCCESS) {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005145 limLog( pMac, LOGP, FL( "Unable to get Local Power Constraint from cfg" ));
Jeff Johnson295189b2012-06-20 16:38:30 -07005146 return;
5147 }
5148#endif
5149
Jeff Johnsone7245742012-09-05 17:12:55 -07005150 if ( psessionEntry->htSecondaryChannelOffset != ( tANI_U8 ) pHTInfo->secondaryChannelOffset ||
5151 psessionEntry->htRecommendedTxWidthSet != ( tANI_U8 ) pHTInfo->recommendedTxWidthSet )
Jeff Johnson295189b2012-06-20 16:38:30 -07005152 {
Jeff Johnsone7245742012-09-05 17:12:55 -07005153 psessionEntry->htSecondaryChannelOffset = ( ePhyChanBondState ) pHTInfo->secondaryChannelOffset;
5154 psessionEntry->htRecommendedTxWidthSet = ( tANI_U8 ) pHTInfo->recommendedTxWidthSet;
5155 if ( eHT_CHANNEL_WIDTH_40MHZ == psessionEntry->htRecommendedTxWidthSet )
5156 secondaryChnlOffset = (ePhyChanBondState)pHTInfo->secondaryChannelOffset;
Jeff Johnson295189b2012-06-20 16:38:30 -07005157
5158 // Notify HAL
5159 limLog( pMac, LOGW, FL( "Channel Information in HT IE change"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005160 "d; sending notification to HAL." ) );
Jeff Johnson295189b2012-06-20 16:38:30 -07005161 limLog( pMac, LOGW, FL( "Primary Channel: %d, Secondary Chan"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005162 "nel Offset: %d, Channel Width: %d" ),
Jeff Johnson295189b2012-06-20 16:38:30 -07005163 pHTInfo->primaryChannel, secondaryChnlOffset,
Jeff Johnsone7245742012-09-05 17:12:55 -07005164 psessionEntry->htRecommendedTxWidthSet );
Madan Mohan Koyyalamudifd322a02012-10-05 12:01:26 -07005165 psessionEntry->channelChangeReasonCode=LIM_SWITCH_CHANNEL_OPERATION;
5166 pMac->lim.gpchangeChannelCallback = NULL;
5167 pMac->lim.gpchangeChannelData = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07005168
5169#if defined WLAN_FEATURE_VOWIFI
5170 limSendSwitchChnlParams( pMac, ( tANI_U8 ) pHTInfo->primaryChannel,
5171 secondaryChnlOffset, psessionEntry->maxTxPower, psessionEntry->peSessionId);
5172#else
5173 limSendSwitchChnlParams( pMac, ( tANI_U8 ) pHTInfo->primaryChannel,
5174 secondaryChnlOffset, (tPowerdBm)localPwrConstraint, psessionEntry->peSessionId);
5175#endif
5176
5177 //In case of IBSS, if STA should update HT Info IE in its beacons.
5178 if (eLIM_STA_IN_IBSS_ROLE == psessionEntry->limSystemRole)
5179 {
5180 schSetFixedBeaconFields(pMac,psessionEntry);
5181 }
5182
5183 }
5184} // End limUpdateStaRunTimeHTParams.
5185
5186/**
5187 * \brief This function updates the lim global structure, if any of the
5188 * HT Capabilities have changed.
5189 *
5190 *
5191 * \param pMac Pointer to Global MAC structure
5192 *
5193 * \param pHTCapability Pointer to HT Capability Information Element
5194 * obtained from a Beacon or Probe Response
5195 *
5196 *
5197 *
5198 */
5199
5200void limUpdateStaRunTimeHTCapability( tpAniSirGlobal pMac,
5201 tDot11fIEHTCaps *pHTCaps )
5202{
5203
5204 if ( pMac->lim.gHTLsigTXOPProtection != ( tANI_U8 ) pHTCaps->lsigTXOPProtection )
5205 {
5206 pMac->lim.gHTLsigTXOPProtection = ( tANI_U8 ) pHTCaps->lsigTXOPProtection;
5207 // Send change notification to HAL
5208 }
5209
5210 if ( pMac->lim.gHTAMpduDensity != ( tANI_U8 ) pHTCaps->mpduDensity )
5211 {
5212 pMac->lim.gHTAMpduDensity = ( tANI_U8 ) pHTCaps->mpduDensity;
5213 // Send change notification to HAL
5214 }
5215
5216 if ( pMac->lim.gHTMaxRxAMpduFactor != ( tANI_U8 ) pHTCaps->maxRxAMPDUFactor )
5217 {
5218 pMac->lim.gHTMaxRxAMpduFactor = ( tANI_U8 ) pHTCaps->maxRxAMPDUFactor;
5219 // Send change notification to HAL
5220 }
5221
5222
5223} // End limUpdateStaRunTimeHTCapability.
5224
5225/**
5226 * \brief This function updates lim global structure, if any of the HT
5227 * Info Parameters have changed.
5228 *
5229 *
5230 * \param pMac Pointer to the global MAC structure
5231 *
5232 * \param pHTInfo Pointer to the HT Info IE obtained from a Beacon or
5233 * Probe Response
5234 *
5235 *
5236 */
5237
5238void limUpdateStaRunTimeHTInfo( tpAniSirGlobal pMac,
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305239 tDot11fIEHTInfo *pHTInfo, tpPESession psessionEntry)
Jeff Johnson295189b2012-06-20 16:38:30 -07005240{
Jeff Johnsone7245742012-09-05 17:12:55 -07005241 if ( psessionEntry->htRecommendedTxWidthSet != ( tANI_U8 )pHTInfo->recommendedTxWidthSet )
Jeff Johnson295189b2012-06-20 16:38:30 -07005242 {
Jeff Johnsone7245742012-09-05 17:12:55 -07005243 psessionEntry->htRecommendedTxWidthSet = ( tANI_U8 )pHTInfo->recommendedTxWidthSet;
Jeff Johnson295189b2012-06-20 16:38:30 -07005244 // Send change notification to HAL
5245 }
5246
5247 if ( psessionEntry->beaconParams.fRIFSMode != ( tANI_U8 )pHTInfo->rifsMode )
5248 {
5249 psessionEntry->beaconParams.fRIFSMode = ( tANI_U8 )pHTInfo->rifsMode;
5250 // Send change notification to HAL
5251 }
5252
5253 if ( pMac->lim.gHTServiceIntervalGranularity != ( tANI_U8 )pHTInfo->serviceIntervalGranularity )
5254 {
5255 pMac->lim.gHTServiceIntervalGranularity = ( tANI_U8 )pHTInfo->serviceIntervalGranularity;
5256 // Send change notification to HAL
5257 }
5258
5259 if ( pMac->lim.gHTOperMode != ( tSirMacHTOperatingMode )pHTInfo->opMode )
5260 {
5261 pMac->lim.gHTOperMode = ( tSirMacHTOperatingMode )pHTInfo->opMode;
5262 // Send change notification to HAL
5263 }
5264
5265 if ( psessionEntry->beaconParams.llnNonGFCoexist != pHTInfo->nonGFDevicesPresent )
5266 {
5267 psessionEntry->beaconParams.llnNonGFCoexist = ( tANI_U8 )pHTInfo->nonGFDevicesPresent;
5268 }
5269
5270 if ( pMac->lim.gHTSTBCBasicMCS != ( tANI_U8 )pHTInfo->basicSTBCMCS )
5271 {
5272 pMac->lim.gHTSTBCBasicMCS = ( tANI_U8 )pHTInfo->basicSTBCMCS;
5273 // Send change notification to HAL
5274 }
5275
5276 if ( pMac->lim.gHTDualCTSProtection != ( tANI_U8 )pHTInfo->dualCTSProtection )
5277 {
5278 pMac->lim.gHTDualCTSProtection = ( tANI_U8 )pHTInfo->dualCTSProtection;
5279 // Send change notification to HAL
5280 }
5281
5282 if ( pMac->lim.gHTSecondaryBeacon != ( tANI_U8 )pHTInfo->secondaryBeacon )
5283 {
5284 pMac->lim.gHTSecondaryBeacon = ( tANI_U8 )pHTInfo->secondaryBeacon;
5285 // Send change notification to HAL
5286 }
5287
5288 if ( psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport != ( tANI_U8 )pHTInfo->lsigTXOPProtectionFullSupport )
5289 {
5290 psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport = ( tANI_U8 )pHTInfo->lsigTXOPProtectionFullSupport;
5291 // Send change notification to HAL
5292 }
5293
5294 if ( pMac->lim.gHTPCOActive != ( tANI_U8 )pHTInfo->pcoActive )
5295 {
5296 pMac->lim.gHTPCOActive = ( tANI_U8 )pHTInfo->pcoActive;
5297 // Send change notification to HAL
5298 }
5299
5300 if ( pMac->lim.gHTPCOPhase != ( tANI_U8 )pHTInfo->pcoPhase )
5301 {
5302 pMac->lim.gHTPCOPhase = ( tANI_U8 )pHTInfo->pcoPhase;
5303 // Send change notification to HAL
5304 }
5305
5306} // End limUpdateStaRunTimeHTInfo.
5307
5308
5309/** -------------------------------------------------------------
5310\fn limProcessHalIndMessages
5311\brief callback function for HAL indication
5312\param tpAniSirGlobal pMac
5313\param tANI_U32 mesgId
5314\param void *mesgParam
5315\return tSirRetStatu - status
5316 -------------------------------------------------------------*/
5317
5318tSirRetStatus limProcessHalIndMessages(tpAniSirGlobal pMac, tANI_U32 msgId, void *msgParam )
5319{
5320 //its PE's responsibility to free msgparam when its done extracting the message parameters.
5321 tSirMsgQ msg;
5322
5323 switch(msgId)
5324 {
5325 case SIR_LIM_DEL_TS_IND:
5326 case SIR_LIM_ADD_BA_IND:
5327 case SIR_LIM_DEL_BA_ALL_IND:
5328 case SIR_LIM_DELETE_STA_CONTEXT_IND:
5329 case SIR_LIM_BEACON_GEN_IND:
5330 msg.type = (tANI_U16) msgId;
5331 msg.bodyptr = msgParam;
5332 msg.bodyval = 0;
5333 break;
5334
5335 default:
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305336 vos_mem_free(msgParam);
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005337 limLog(pMac, LOGP, FL("invalid message id = %d received"), msgId);
Jeff Johnson295189b2012-06-20 16:38:30 -07005338 return eSIR_FAILURE;
5339 }
5340
5341 if (limPostMsgApi(pMac, &msg) != eSIR_SUCCESS)
5342 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305343 vos_mem_free(msgParam);
Jeff Johnson295189b2012-06-20 16:38:30 -07005344 limLog(pMac, LOGP, FL("limPostMsgApi failed for msgid = %d"), msg.type);
5345 return eSIR_FAILURE;
5346 }
5347 return eSIR_SUCCESS;
5348}
5349
5350/** -------------------------------------------------------------
5351\fn limValidateDeltsReq
5352\brief Validates DelTs req originated by SME or by HAL and also sends halMsg_DelTs to HAL
5353\param tpAniSirGlobal pMac
5354\param tpSirDeltsReq pDeltsReq
5355\param tSirMacAddr peerMacAddr
5356\return eSirRetStatus - status
5357 -------------------------------------------------------------*/
5358
5359tSirRetStatus
5360limValidateDeltsReq(tpAniSirGlobal pMac, tpSirDeltsReq pDeltsReq, tSirMacAddr peerMacAddr,tpPESession psessionEntry)
5361{
5362 tpDphHashNode pSta;
5363 tANI_U8 tsStatus;
5364 tSirMacTSInfo *tsinfo;
5365 tANI_U32 i;
5366 tANI_U8 tspecIdx;
5367 /* if sta
5368 * - verify assoc state
5369 * - del tspec locally
5370 * if ap,
5371 * - verify sta is in assoc state
5372 * - del sta tspec locally
5373 */
5374 if(pDeltsReq == NULL)
5375 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005376 PELOGE(limLog(pMac, LOGE, FL("Delete TS request pointer is NULL"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005377 return eSIR_FAILURE;
5378 }
5379
5380 if ((psessionEntry->limSystemRole == eLIM_STA_ROLE)||(psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE))
5381 {
5382 tANI_U32 val;
5383
5384 // station always talks to the AP
5385 pSta = dphGetHashEntry(pMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable);
5386
5387 val = sizeof(tSirMacAddr);
5388 #if 0
5389 if (wlan_cfgGetStr(pMac, WNI_CFG_BSSID, peerMacAddr, &val) != eSIR_SUCCESS)
5390 {
5391 /// Could not get BSSID from CFG. Log error.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005392 limLog(pMac, LOGP, FL("could not retrieve BSSID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07005393 return eSIR_FAILURE;
5394 }
5395 #endif// TO SUPPORT BT-AMP
5396 sirCopyMacAddr(peerMacAddr,psessionEntry->bssId);
5397
5398 }
5399 else
5400 {
5401 tANI_U16 assocId;
5402 tANI_U8 *macaddr = (tANI_U8 *) peerMacAddr;
5403
5404 assocId = pDeltsReq->aid;
5405 if (assocId != 0)
5406 pSta = dphGetHashEntry(pMac, assocId, &psessionEntry->dph.dphHashTable);
5407 else
5408 pSta = dphLookupHashEntry(pMac, pDeltsReq->macAddr, &assocId, &psessionEntry->dph.dphHashTable);
5409
5410 if (pSta != NULL)
5411 // TBD: check sta assoc state as well
5412 for (i =0; i < sizeof(tSirMacAddr); i++)
5413 macaddr[i] = pSta->staAddr[i];
5414 }
5415
5416 if (pSta == NULL)
5417 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005418 PELOGE(limLog(pMac, LOGE, "Cannot find station context for delts req");)
Jeff Johnson295189b2012-06-20 16:38:30 -07005419 return eSIR_FAILURE;
5420 }
5421
5422 if ((! pSta->valid) ||
5423 (pSta->mlmStaContext.mlmState != eLIM_MLM_LINK_ESTABLISHED_STATE))
5424 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005425 PELOGE(limLog(pMac, LOGE, "Invalid Sta (or state) for DelTsReq");)
Jeff Johnson295189b2012-06-20 16:38:30 -07005426 return eSIR_FAILURE;
5427 }
5428
5429 pDeltsReq->req.wsmTspecPresent = 0;
5430 pDeltsReq->req.wmeTspecPresent = 0;
5431 pDeltsReq->req.lleTspecPresent = 0;
5432
5433 if ((pSta->wsmEnabled) &&
5434 (pDeltsReq->req.tspec.tsinfo.traffic.accessPolicy != SIR_MAC_ACCESSPOLICY_EDCA))
5435 pDeltsReq->req.wsmTspecPresent = 1;
5436 else if (pSta->wmeEnabled)
5437 pDeltsReq->req.wmeTspecPresent = 1;
5438 else if (pSta->lleEnabled)
5439 pDeltsReq->req.lleTspecPresent = 1;
5440 else
5441 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005442 PELOGW(limLog(pMac, LOGW, FL("DELTS_REQ ignore - qos is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005443 return eSIR_FAILURE;
5444 }
5445
5446 tsinfo = pDeltsReq->req.wmeTspecPresent ? &pDeltsReq->req.tspec.tsinfo
5447 : &pDeltsReq->req.tsinfo;
5448 PELOG1(limLog(pMac, LOG1,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005449 FL("received DELTS_REQ message (wmeTspecPresent = %d, lleTspecPresent = %d, wsmTspecPresent = %d, tsid %d, up %d, direction = %d)"),
Jeff Johnson295189b2012-06-20 16:38:30 -07005450 pDeltsReq->req.wmeTspecPresent, pDeltsReq->req.lleTspecPresent, pDeltsReq->req.wsmTspecPresent,
5451 tsinfo->traffic.tsid, tsinfo->traffic.userPrio, tsinfo->traffic.direction);)
5452
5453 // if no Access Control, ignore the request
Jeff Johnson295189b2012-06-20 16:38:30 -07005454
5455 if (limAdmitControlDeleteTS(pMac, pSta->assocId, tsinfo, &tsStatus, &tspecIdx)
5456 != eSIR_SUCCESS)
5457 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005458 PELOGE(limLog(pMac, LOGE, "ERROR DELTS request for sta assocId %d (tsid %d, up %d)",
Jeff Johnson295189b2012-06-20 16:38:30 -07005459 pSta->assocId, tsinfo->traffic.tsid, tsinfo->traffic.userPrio);)
5460 return eSIR_FAILURE;
5461 }
5462 else if ((tsinfo->traffic.accessPolicy == SIR_MAC_ACCESSPOLICY_HCCA) ||
5463 (tsinfo->traffic.accessPolicy == SIR_MAC_ACCESSPOLICY_BOTH))
5464 {
5465 //edca only now.
5466 }
5467 else
5468 {
5469 if((tsinfo->traffic.accessPolicy == SIR_MAC_ACCESSPOLICY_EDCA) &&
5470 psessionEntry->gLimEdcaParams[upToAc(tsinfo->traffic.userPrio)].aci.acm)
5471 {
5472 //send message to HAL to delete TS
Madan Mohan Koyyalamudic0a75a42013-10-07 04:20:49 +05305473 if(eSIR_SUCCESS != limSendHalMsgDelTs(pMac,
5474 pSta->staIndex,
5475 tspecIdx,
5476 pDeltsReq->req,
5477 psessionEntry->peSessionId,
5478 psessionEntry->bssId))
Jeff Johnson295189b2012-06-20 16:38:30 -07005479 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005480 limLog(pMac, LOGW, FL("DelTs with UP %d failed in limSendHalMsgDelTs - ignoring request"),
Jeff Johnson295189b2012-06-20 16:38:30 -07005481 tsinfo->traffic.userPrio);
5482 return eSIR_FAILURE;
5483 }
5484 }
5485 }
5486 return eSIR_SUCCESS;
5487}
5488
5489/** -------------------------------------------------------------
5490\fn limRegisterHalIndCallBack
5491\brief registers callback function to HAL for any indication.
5492\param tpAniSirGlobal pMac
5493\return none.
5494 -------------------------------------------------------------*/
5495void
5496limRegisterHalIndCallBack(tpAniSirGlobal pMac)
5497{
5498 tSirMsgQ msg;
5499 tpHalIndCB pHalCB;
5500
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305501 pHalCB = vos_mem_malloc(sizeof(tHalIndCB));
5502 if ( NULL == pHalCB )
Jeff Johnson295189b2012-06-20 16:38:30 -07005503 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305504 limLog(pMac, LOGP, FL("AllocateMemory() failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07005505 return;
5506 }
5507
5508 pHalCB->pHalIndCB = limProcessHalIndMessages;
5509
5510 msg.type = WDA_REGISTER_PE_CALLBACK;
5511 msg.bodyptr = pHalCB;
5512 msg.bodyval = 0;
5513
Jeff Johnsone7245742012-09-05 17:12:55 -07005514 MTRACE(macTraceMsgTx(pMac, NO_SESSION, msg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07005515 if(eSIR_SUCCESS != wdaPostCtrlMsg(pMac, &msg))
5516 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305517 vos_mem_free(pHalCB);
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005518 limLog(pMac, LOGP, FL("wdaPostCtrlMsg() failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07005519 }
5520
5521 return;
5522}
5523
5524
5525/** -------------------------------------------------------------
5526\fn limProcessAddBaInd
5527
5528\brief handles the BA activity check timeout indication coming from HAL.
5529 Validates the request, posts request for sending addBaReq message for every candidate in the list.
5530\param tpAniSirGlobal pMac
5531\param tSirMsgQ limMsg
5532\return None
5533-------------------------------------------------------------*/
5534void
5535limProcessAddBaInd(tpAniSirGlobal pMac, tpSirMsgQ limMsg)
5536{
5537 tANI_U8 i;
5538 tANI_U8 tid;
5539 tANI_U16 assocId;
5540 tpDphHashNode pSta;
5541 tpAddBaCandidate pBaCandidate;
5542 tANI_U32 baCandidateCnt;
5543 tpBaActivityInd pBaActivityInd;
5544 tpPESession psessionEntry;
5545 tANI_U8 sessionId;
Gopichand Nakkala681989c2013-03-06 22:27:48 -08005546#ifdef FEATURE_WLAN_TDLS
5547 boolean htCapable = FALSE;
5548#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07005549
5550
Gopichand Nakkala681989c2013-03-06 22:27:48 -08005551 if (limMsg->bodyptr == NULL)
Jeff Johnson295189b2012-06-20 16:38:30 -07005552 return;
5553
5554 pBaActivityInd = (tpBaActivityInd)limMsg->bodyptr;
5555 baCandidateCnt = pBaActivityInd->baCandidateCnt;
5556
Gopichand Nakkala681989c2013-03-06 22:27:48 -08005557 if ((psessionEntry = peFindSessionByBssid(pMac,pBaActivityInd->bssId,&sessionId))== NULL)
Jeff Johnson295189b2012-06-20 16:38:30 -07005558 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005559 limLog(pMac, LOGE,FL("session does not exist for given BSSId"));
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305560 vos_mem_free(limMsg->bodyptr);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08005561 limMsg->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07005562 return;
5563 }
5564
5565 //if we are not HT capable we don't need to handle BA timeout indication from HAL.
Gopichand Nakkala681989c2013-03-06 22:27:48 -08005566#ifdef FEATURE_WLAN_TDLS
5567 if ((baCandidateCnt > pMac->lim.maxStation))
5568#else
5569 if ((baCandidateCnt > pMac->lim.maxStation) || !psessionEntry->htCapability )
5570#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07005571 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305572 vos_mem_free(limMsg->bodyptr);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08005573 limMsg->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07005574 return;
5575 }
Gopichand Nakkala681989c2013-03-06 22:27:48 -08005576
5577#ifdef FEATURE_WLAN_TDLS
5578 //if we have TDLS peers, we should look at peers HT capability, which can be different than
5579 //AP capability
5580 pBaCandidate = (tpAddBaCandidate) (((tANI_U8*)pBaActivityInd) + sizeof(tBaActivityInd));
5581
5582 for (i=0; i<baCandidateCnt; i++, pBaCandidate++)
5583 {
5584 pSta = dphLookupHashEntry(pMac, pBaCandidate->staAddr, &assocId, &psessionEntry->dph.dphHashTable);
5585 if ((NULL == pSta) || (!pSta->valid))
5586 continue;
5587
5588 if (STA_ENTRY_TDLS_PEER == pSta->staType)
5589 htCapable = pSta->mlmStaContext.htCapability;
5590 else
5591 htCapable = psessionEntry->htCapability;
5592
5593 if (htCapable)
5594 break;
5595 }
5596 if (!htCapable)
5597 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305598 vos_mem_free(limMsg->bodyptr);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08005599 limMsg->bodyptr = NULL;
Gopichand Nakkala681989c2013-03-06 22:27:48 -08005600 return;
5601 }
5602#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07005603
5604 //delete the complete dialoguetoken linked list
5605 limDeleteDialogueTokenList(pMac);
5606 pBaCandidate = (tpAddBaCandidate) (((tANI_U8*)pBaActivityInd) + sizeof(tBaActivityInd));
5607
Gopichand Nakkala681989c2013-03-06 22:27:48 -08005608 for (i=0; i<baCandidateCnt; i++, pBaCandidate++)
Jeff Johnson295189b2012-06-20 16:38:30 -07005609 {
5610 pSta = dphLookupHashEntry(pMac, pBaCandidate->staAddr, &assocId, &psessionEntry->dph.dphHashTable);
Gopichand Nakkala681989c2013-03-06 22:27:48 -08005611 if ((NULL == pSta) || (!pSta->valid))
5612 continue;
Jeff Johnson295189b2012-06-20 16:38:30 -07005613
5614 for (tid=0; tid<STACFG_MAX_TC; tid++)
5615 {
Gopichand Nakkala681989c2013-03-06 22:27:48 -08005616 if((eBA_DISABLE == pSta->tcCfg[tid].fUseBATx) &&
Jeff Johnson295189b2012-06-20 16:38:30 -07005617 (pBaCandidate->baInfo[tid].fBaEnable))
5618 {
Hoonki Lee9af07cf2013-04-24 01:21:58 -07005619 limLog(pMac, LOGE, FL("BA setup for staId = %d, TID: %d, SSN: %d"),
5620 pSta->staIndex, tid, pBaCandidate->baInfo[tid].startingSeqNum);
Jeff Johnson295189b2012-06-20 16:38:30 -07005621 limPostMlmAddBAReq(pMac, pSta, tid, pBaCandidate->baInfo[tid].startingSeqNum,psessionEntry);
5622 }
5623 }
5624 }
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305625 vos_mem_free(limMsg->bodyptr);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08005626 limMsg->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07005627 return;
5628}
5629
5630
5631/** -------------------------------------------------------------
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005632\fn limDeleteBASessions
5633\brief Deletes all the exisitng BA sessions for given session
5634 and BA direction.
Jeff Johnson295189b2012-06-20 16:38:30 -07005635\param tpAniSirGlobal pMac
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005636\param tpPESession pSessionEntry
5637\param tANI_U32 baDirection
5638\return None
Jeff Johnson295189b2012-06-20 16:38:30 -07005639-------------------------------------------------------------*/
5640
5641void
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005642limDeleteBASessions(tpAniSirGlobal pMac, tpPESession pSessionEntry,
5643 tANI_U32 baDirection)
Jeff Johnson295189b2012-06-20 16:38:30 -07005644{
5645 tANI_U32 i;
5646 tANI_U8 tid;
5647 tpDphHashNode pSta;
5648
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005649 if (NULL == pSessionEntry)
Jeff Johnson295189b2012-06-20 16:38:30 -07005650 {
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005651 limLog(pMac, LOGE, FL("Session does not exist"));
5652 }
5653 else
5654 {
5655 for(tid = 0; tid < STACFG_MAX_TC; tid++)
Jeff Johnson295189b2012-06-20 16:38:30 -07005656 {
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005657 if ((eLIM_AP_ROLE == pSessionEntry->limSystemRole) ||
5658 (pSessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE) ||
5659 (eLIM_STA_IN_IBSS_ROLE == pSessionEntry->limSystemRole) ||
5660 (pSessionEntry->limSystemRole == eLIM_P2P_DEVICE_GO))
Jeff Johnson295189b2012-06-20 16:38:30 -07005661 {
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005662 for (i = 0; i < pMac->lim.maxStation; i++)
Jeff Johnson295189b2012-06-20 16:38:30 -07005663 {
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005664 pSta = pSessionEntry->dph.dphHashTable.pDphNodeArray + i;
5665 if (pSta && pSta->added)
Kiran Kumar Lokerec1641f52013-05-29 14:29:43 -07005666 {
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005667 if ((eBA_ENABLE == pSta->tcCfg[tid].fUseBATx) &&
5668 (baDirection & BA_INITIATOR))
5669 {
5670 limPostMlmDelBAReq(pMac, pSta, eBA_INITIATOR, tid,
5671 eSIR_MAC_UNSPEC_FAILURE_REASON,
5672 pSessionEntry);
5673 }
5674 if ((eBA_ENABLE == pSta->tcCfg[tid].fUseBARx) &&
5675 (baDirection & BA_RECIPIENT))
5676 {
5677 limPostMlmDelBAReq(pMac, pSta, eBA_RECIPIENT, tid,
5678 eSIR_MAC_UNSPEC_FAILURE_REASON,
5679 pSessionEntry);
5680 }
Kiran Kumar Lokerec1641f52013-05-29 14:29:43 -07005681 }
Jeff Johnson295189b2012-06-20 16:38:30 -07005682 }
5683 }
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005684 else if ((eLIM_STA_ROLE == pSessionEntry->limSystemRole) ||
5685 (eLIM_BT_AMP_STA_ROLE == pSessionEntry->limSystemRole) ||
5686 (eLIM_P2P_DEVICE_ROLE == pSessionEntry->limSystemRole))
Gopichand Nakkala6a36e142013-06-07 21:23:15 -07005687 {
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005688 pSta = dphGetHashEntry(pMac, DPH_STA_HASH_INDEX_PEER,
5689 &pSessionEntry->dph.dphHashTable);
5690 if (pSta && pSta->added)
Gopichand Nakkala6a36e142013-06-07 21:23:15 -07005691 {
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005692 if ((eBA_ENABLE == pSta->tcCfg[tid].fUseBATx) &&
5693 (baDirection & BA_INITIATOR))
5694 {
5695 limPostMlmDelBAReq(pMac, pSta, eBA_INITIATOR, tid,
5696 eSIR_MAC_UNSPEC_FAILURE_REASON,
5697 pSessionEntry);
5698 }
5699 if ((eBA_ENABLE == pSta->tcCfg[tid].fUseBARx) &&
5700 (baDirection & BA_RECIPIENT))
5701 {
5702 limPostMlmDelBAReq(pMac, pSta, eBA_RECIPIENT, tid,
5703 eSIR_MAC_UNSPEC_FAILURE_REASON,
5704 pSessionEntry);
5705 }
Gopichand Nakkala6a36e142013-06-07 21:23:15 -07005706 }
5707 }
5708 }
Jeff Johnson295189b2012-06-20 16:38:30 -07005709 }
5710}
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005711
5712/** -------------------------------------------------------------
5713\fn limDelAllBASessions
5714\brief Deletes all the exisitng BA sessions.
5715\param tpAniSirGlobal pMac
5716\return None
5717-------------------------------------------------------------*/
5718
5719void limDelAllBASessions(tpAniSirGlobal pMac)
5720{
5721 tANI_U32 i;
5722 tpPESession pSessionEntry;
5723
5724 for (i = 0; i < pMac->lim.maxBssId; i++)
5725 {
5726 pSessionEntry = peFindSessionBySessionId(pMac, i);
5727 if (pSessionEntry)
5728 {
5729 limDeleteBASessions(pMac, pSessionEntry, BA_BOTH_DIRECTIONS);
5730 }
5731 }
5732}
5733
5734/** -------------------------------------------------------------
5735\fn limDelAllBASessionsBtc
5736\brief Deletes all the exisitng BA receipent sessions in 2.4GHz
5737 band.
5738\param tpAniSirGlobal pMac
5739\return None
5740-------------------------------------------------------------*/
5741
Leela Venkata Kiran Kumar Reddy Chiralab8dadc22013-11-05 12:34:32 -08005742void limDelPerBssBASessionsBtc(tpAniSirGlobal pMac)
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005743{
Leela Venkata Kiran Kumar Reddy Chiralab8dadc22013-11-05 12:34:32 -08005744 tANI_U8 sessionId;
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005745 tpPESession pSessionEntry;
Leela Venkata Kiran Kumar Reddy Chiralab8dadc22013-11-05 12:34:32 -08005746 pSessionEntry = peFindSessionByBssid(pMac,pMac->btc.btcBssfordisableaggr,
5747 &sessionId);
5748 if (pSessionEntry)
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005749 {
Leela Venkata Kiran Kumar Reddy Chiralab8dadc22013-11-05 12:34:32 -08005750 PELOGW(limLog(pMac, LOGW,
5751 "Deleting the BA for session %d as host got BTC event", sessionId);)
5752 limDeleteBASessions(pMac, pSessionEntry, BA_RECIPIENT);
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005753 }
5754}
5755
Jeff Johnson295189b2012-06-20 16:38:30 -07005756/** -------------------------------------------------------------
5757\fn limProcessDelTsInd
5758\brief handles the DeleteTS indication coming from HAL or generated by PE itself in some error cases.
5759 Validates the request, sends the DelTs action frame to the Peer and sends DelTs indicatoin to HDD.
5760\param tpAniSirGlobal pMac
5761\param tSirMsgQ limMsg
5762\return None
5763-------------------------------------------------------------*/
5764void
5765limProcessDelTsInd(tpAniSirGlobal pMac, tpSirMsgQ limMsg)
5766{
5767 tpDphHashNode pSta;
5768 tpDelTsParams pDelTsParam = (tpDelTsParams) (limMsg->bodyptr);
5769 tpSirDeltsReq pDelTsReq = NULL;
5770 tSirMacAddr peerMacAddr;
5771 tpSirDeltsReqInfo pDelTsReqInfo;
5772 tpLimTspecInfo pTspecInfo;
5773 tpPESession psessionEntry;
5774 tANI_U8 sessionId;
5775
5776if((psessionEntry = peFindSessionByBssid(pMac,pDelTsParam->bssId,&sessionId))== NULL)
5777 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005778 limLog(pMac, LOGE,FL("session does not exist for given BssId"));
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305779 vos_mem_free(limMsg->bodyptr);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08005780 limMsg->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07005781 return;
5782 }
5783
5784 pTspecInfo = &(pMac->lim.tspecInfo[pDelTsParam->tspecIdx]);
5785 if(pTspecInfo->inuse == false)
5786 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005787 PELOGE(limLog(pMac, LOGE, FL("tspec entry with index %d is not in use"), pDelTsParam->tspecIdx);)
Jeff Johnson295189b2012-06-20 16:38:30 -07005788 goto error1;
5789 }
5790
5791 pSta = dphGetHashEntry(pMac, pTspecInfo->assocId, &psessionEntry->dph.dphHashTable);
5792 if(pSta == NULL)
5793 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005794 limLog(pMac, LOGE, FL("Could not find entry in DPH table for assocId = %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07005795 pTspecInfo->assocId);
5796 goto error1;
5797 }
5798
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305799 pDelTsReq = vos_mem_malloc(sizeof(tSirDeltsReq));
5800 if ( NULL == pDelTsReq )
Jeff Johnson295189b2012-06-20 16:38:30 -07005801 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305802 PELOGE(limLog(pMac, LOGE, FL("AllocateMemory() failed"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005803 goto error1;
5804 }
5805
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305806 vos_mem_set( (tANI_U8 *)pDelTsReq, sizeof(tSirDeltsReq), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07005807
5808 if(pSta->wmeEnabled)
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305809 vos_mem_copy( &(pDelTsReq->req.tspec), &(pTspecInfo->tspec), sizeof(tSirMacTspecIE));
Jeff Johnson295189b2012-06-20 16:38:30 -07005810 else
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305811 vos_mem_copy( &(pDelTsReq->req.tsinfo), &(pTspecInfo->tspec.tsinfo), sizeof(tSirMacTSInfo));
Jeff Johnson295189b2012-06-20 16:38:30 -07005812
5813
5814 //validate the req
5815 if (eSIR_SUCCESS != limValidateDeltsReq(pMac, pDelTsReq, peerMacAddr,psessionEntry))
5816 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005817 PELOGE(limLog(pMac, LOGE, FL("limValidateDeltsReq failed"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005818 goto error2;
5819 }
Arif Hussaina7c8e412013-11-20 11:06:42 -08005820 PELOG1(limLog(pMac, LOG1, "Sent DELTS request to station with "
5821 "assocId = %d MacAddr = "MAC_ADDRESS_STR,
5822 pDelTsReq->aid, MAC_ADDR_ARRAY(peerMacAddr));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005823
5824 limSendDeltsReqActionFrame(pMac, peerMacAddr, pDelTsReq->req.wmeTspecPresent, &pDelTsReq->req.tsinfo, &pDelTsReq->req.tspec,
5825 psessionEntry);
5826
5827 // prepare and send an sme indication to HDD
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305828 pDelTsReqInfo = vos_mem_malloc(sizeof(tSirDeltsReqInfo));
5829 if ( NULL == pDelTsReqInfo )
Jeff Johnson295189b2012-06-20 16:38:30 -07005830 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305831 PELOGE(limLog(pMac, LOGE, FL("AllocateMemory() failed"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005832 goto error3;
5833 }
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305834 vos_mem_set( (tANI_U8 *)pDelTsReqInfo, sizeof(tSirDeltsReqInfo), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07005835
5836 if(pSta->wmeEnabled)
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305837 vos_mem_copy( &(pDelTsReqInfo->tspec), &(pTspecInfo->tspec), sizeof(tSirMacTspecIE));
Jeff Johnson295189b2012-06-20 16:38:30 -07005838 else
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305839 vos_mem_copy( &(pDelTsReqInfo->tsinfo), &(pTspecInfo->tspec.tsinfo), sizeof(tSirMacTSInfo));
Jeff Johnson295189b2012-06-20 16:38:30 -07005840
5841 limSendSmeDeltsInd(pMac, pDelTsReqInfo, pDelTsReq->aid,psessionEntry);
5842
5843error3:
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305844 vos_mem_free(pDelTsReqInfo);
Jeff Johnson295189b2012-06-20 16:38:30 -07005845error2:
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305846 vos_mem_free(pDelTsReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07005847error1:
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305848 vos_mem_free(limMsg->bodyptr);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08005849 limMsg->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07005850 return;
5851}
5852
5853/**
5854 * \brief Setup an A-MPDU/BA session
5855 *
5856 * \sa limPostMlmAddBAReq
5857 *
5858 * \param pMac The global tpAniSirGlobal object
5859 *
5860 * \param pStaDs DPH Hash Node object of peer STA
5861 *
5862 * \param tid TID for which a BA is being setup.
5863 * If this is set to 0xFFFF, then we retrieve
5864 * the default TID from the CFG
5865 *
5866 * \return eSIR_SUCCESS if setup completes successfully
5867 * eSIR_FAILURE is some problem is encountered
5868 */
5869tSirRetStatus limPostMlmAddBAReq( tpAniSirGlobal pMac,
5870 tpDphHashNode pStaDs,
5871 tANI_U8 tid, tANI_U16 startingSeqNum,tpPESession psessionEntry)
5872{
5873 tSirRetStatus status = eSIR_SUCCESS;
Jeff Johnson09fb4cd2013-04-03 15:27:59 -07005874 tpLimMlmAddBAReq pMlmAddBAReq = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07005875 tpDialogueToken dialogueTokenNode;
5876 tANI_U32 val = 0;
Jeff Johnson09fb4cd2013-04-03 15:27:59 -07005877
Jeff Johnson295189b2012-06-20 16:38:30 -07005878 // Check if the peer is a 11n capable STA
5879 // FIXME - Need a 11n peer indication in DPH.
5880 // For now, using the taurusPeer attribute
5881 //if( 0 == pStaDs->taurusPeer == )
5882 //return eSIR_SUCCESS;
5883
5884 // Allocate for LIM_MLM_ADDBA_REQ
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305885 pMlmAddBAReq = vos_mem_malloc(sizeof( tLimMlmAddBAReq ));
5886 if ( NULL == pMlmAddBAReq )
Jeff Johnson295189b2012-06-20 16:38:30 -07005887 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305888 limLog( pMac, LOGP, FL("AllocateMemory failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07005889 status = eSIR_MEM_ALLOC_FAILED;
5890 goto returnFailure;
5891 }
5892
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305893 vos_mem_set( (void *) pMlmAddBAReq, sizeof( tLimMlmAddBAReq ), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07005894
5895 // Copy the peer MAC
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305896 vos_mem_copy(
Jeff Johnson295189b2012-06-20 16:38:30 -07005897 pMlmAddBAReq->peerMacAddr,
5898 pStaDs->staAddr,
5899 sizeof( tSirMacAddr ));
5900
5901 // Update the TID
5902 pMlmAddBAReq->baTID = tid;
5903
5904 // Determine the supported BA policy of local STA
5905 // for the TID of interest
5906 pMlmAddBAReq->baPolicy = (pStaDs->baPolicyFlag >> tid) & 0x1;
5907
5908 // BA Buffer Size
5909 // Requesting the ADDBA recipient to populate the size.
5910 // If ADDBA is accepted, a non-zero buffer size should
5911 // be returned in the ADDBA Rsp
Agarwal Ashish87039eb2014-01-15 14:13:15 +05305912 if ((TRUE == psessionEntry->isCiscoVendorAP) &&
5913 (eHT_CHANNEL_WIDTH_80MHZ != pStaDs->htSupportedChannelWidthSet))
5914 {
5915 /* Cisco AP has issues in receiving more than 25 "mpdu in ampdu"
5916 causing very low throughput in HT40 case */
5917 limLog( pMac, LOGW,
5918 FL( "Requesting ADDBA with Cisco 1225 AP, window size 25"));
5919 pMlmAddBAReq->baBufferSize = MAX_BA_WINDOW_SIZE_FOR_CISCO;
5920 }
5921 else
5922 pMlmAddBAReq->baBufferSize = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07005923
5924 limLog( pMac, LOGW,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005925 FL( "Requesting an ADDBA to setup a %s BA session with STA %d for TID %d" ),
Jeff Johnson295189b2012-06-20 16:38:30 -07005926 (pMlmAddBAReq->baPolicy ? "Immediate": "Delayed"),
5927 pStaDs->staIndex,
5928 tid );
5929
5930 // BA Timeout
Jeff Johnson09fb4cd2013-04-03 15:27:59 -07005931 if (wlan_cfgGetInt(pMac, WNI_CFG_BA_TIMEOUT, &val) != eSIR_SUCCESS)
Jeff Johnson295189b2012-06-20 16:38:30 -07005932 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005933 limLog(pMac, LOGE, FL("could not retrieve BA TIME OUT Param CFG"));
Jeff Johnson295189b2012-06-20 16:38:30 -07005934 status = eSIR_FAILURE;
5935 goto returnFailure;
5936 }
5937 pMlmAddBAReq->baTimeout = val; // In TU's
5938
5939 // ADDBA Failure Timeout
Jeff Johnson09fb4cd2013-04-03 15:27:59 -07005940 // FIXME_AMPDU - Need to retrieve this from CFG.
Jeff Johnson295189b2012-06-20 16:38:30 -07005941 //right now we are not checking for response timeout. so this field is dummy just to be compliant with the spec.
5942 pMlmAddBAReq->addBAFailureTimeout = 2000; // In TU's
5943
5944 // BA Starting Sequence Number
5945 pMlmAddBAReq->baSSN = startingSeqNum;
5946
5947 /* Update PE session Id*/
5948 pMlmAddBAReq->sessionId = psessionEntry->peSessionId;
5949
5950 LIM_SET_STA_BA_STATE(pStaDs, tid, eLIM_BA_STATE_WT_ADD_RSP);
5951
Jeff Johnson09fb4cd2013-04-03 15:27:59 -07005952 dialogueTokenNode = limAssignDialogueToken(pMac);
5953 if (NULL == dialogueTokenNode)
5954 {
5955 limLog(pMac, LOGE, FL("could not assign dialogue token"));
5956 status = eSIR_FAILURE;
5957 goto returnFailure;
5958 }
5959
Jeff Johnson295189b2012-06-20 16:38:30 -07005960 pMlmAddBAReq->baDialogToken = dialogueTokenNode->token;
Jeff Johnson09fb4cd2013-04-03 15:27:59 -07005961 //set assocId and tid information in the lim linked list
Jeff Johnson295189b2012-06-20 16:38:30 -07005962 dialogueTokenNode->assocId = pStaDs->assocId;
5963 dialogueTokenNode->tid = tid;
5964 // Send ADDBA Req to MLME
5965 limPostMlmMessage( pMac,
5966 LIM_MLM_ADDBA_REQ,
5967 (tANI_U32 *) pMlmAddBAReq );
Jeff Johnson09fb4cd2013-04-03 15:27:59 -07005968 return eSIR_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -07005969
5970returnFailure:
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305971 vos_mem_free(pMlmAddBAReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07005972 return status;
5973}
5974
5975/**
5976 * \brief Post LIM_MLM_ADDBA_RSP to MLME. MLME
5977 * will then send an ADDBA Rsp to peer MAC entity
5978 * with the appropriate ADDBA status code
5979 *
5980 * \sa limPostMlmAddBARsp
5981 *
5982 * \param pMac The global tpAniSirGlobal object
5983 *
5984 * \param peerMacAddr MAC address of peer entity that will
5985 * be the recipient of this ADDBA Rsp
5986 *
5987 * \param baStatusCode ADDBA Rsp status code
5988 *
5989 * \param baDialogToken ADDBA Rsp dialog token
5990 *
5991 * \param baTID TID of interest
5992 *
5993 * \param baPolicy The BA policy
5994 *
5995 * \param baBufferSize The BA buffer size
5996 *
5997 * \param baTimeout BA timeout in TU's
5998 *
5999 * \return eSIR_SUCCESS if setup completes successfully
6000 * eSIR_FAILURE is some problem is encountered
6001 */
6002tSirRetStatus limPostMlmAddBARsp( tpAniSirGlobal pMac,
6003 tSirMacAddr peerMacAddr,
6004 tSirMacStatusCodes baStatusCode,
6005 tANI_U8 baDialogToken,
6006 tANI_U8 baTID,
6007 tANI_U8 baPolicy,
6008 tANI_U16 baBufferSize,
6009 tANI_U16 baTimeout,
6010 tpPESession psessionEntry)
6011{
6012tSirRetStatus status = eSIR_SUCCESS;
6013tpLimMlmAddBARsp pMlmAddBARsp;
6014
6015 // Allocate for LIM_MLM_ADDBA_RSP
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306016 pMlmAddBARsp = vos_mem_malloc(sizeof( tLimMlmAddBARsp ));
6017 if ( NULL == pMlmAddBARsp )
Jeff Johnson295189b2012-06-20 16:38:30 -07006018 {
6019 limLog( pMac, LOGE,
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306020 FL("AllocateMemory failed with error code %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07006021 status );
6022
6023 status = eSIR_MEM_ALLOC_FAILED;
6024 goto returnFailure;
6025 }
6026
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306027 vos_mem_set( (void *) pMlmAddBARsp, sizeof( tLimMlmAddBARsp ), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07006028
6029 // Copy the peer MAC
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306030 vos_mem_copy(
Jeff Johnson295189b2012-06-20 16:38:30 -07006031 pMlmAddBARsp->peerMacAddr,
6032 peerMacAddr,
6033 sizeof( tSirMacAddr ));
6034
6035 pMlmAddBARsp->baDialogToken = baDialogToken;
6036 pMlmAddBARsp->addBAResultCode = baStatusCode;
6037 pMlmAddBARsp->baTID = baTID;
6038 pMlmAddBARsp->baPolicy = baPolicy;
6039 pMlmAddBARsp->baBufferSize = baBufferSize;
6040 pMlmAddBARsp->baTimeout = baTimeout;
6041
6042 /* UPdate PE session ID*/
6043 pMlmAddBARsp->sessionId = psessionEntry->peSessionId;
6044
6045 // Send ADDBA Rsp to MLME
6046 limPostMlmMessage( pMac,
6047 LIM_MLM_ADDBA_RSP,
6048 (tANI_U32 *) pMlmAddBARsp );
6049
6050returnFailure:
6051
6052 return status;
6053}
6054
6055/**
6056 * \brief Post LIM_MLM_DELBA_REQ to MLME. MLME
6057 * will then send an DELBA Ind to peer MAC entity
6058 * with the appropriate DELBA status code
6059 *
6060 * \sa limPostMlmDelBAReq
6061 *
6062 * \param pMac The global tpAniSirGlobal object
6063 *
6064 * \param pSta DPH Hash Node object of peer MAC entity
6065 * for which the BA session is being deleted
6066 *
6067 * \param baDirection DELBA direction
6068 *
6069 * \param baTID TID for which the BA session is being deleted
6070 *
6071 * \param baReasonCode DELBA Req reason code
6072 *
6073 * \return eSIR_SUCCESS if setup completes successfully
6074 * eSIR_FAILURE is some problem is encountered
6075 */
6076tSirRetStatus limPostMlmDelBAReq( tpAniSirGlobal pMac,
6077 tpDphHashNode pSta,
6078 tANI_U8 baDirection,
6079 tANI_U8 baTID,
6080 tSirMacReasonCodes baReasonCode,
6081 tpPESession psessionEntry)
6082{
6083tSirRetStatus status = eSIR_SUCCESS;
6084tpLimMlmDelBAReq pMlmDelBAReq;
6085tLimBAState curBaState;
6086
6087if(NULL == pSta)
6088 return eSIR_FAILURE;
6089
6090LIM_GET_STA_BA_STATE(pSta, baTID, &curBaState);
6091
6092 // Need to validate the current BA State.
6093 if( eLIM_BA_STATE_IDLE != curBaState)
6094 {
6095 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006096 FL( "Received unexpected DELBA REQ when STA BA state for tid = %d is %d" ),
Jeff Johnson295189b2012-06-20 16:38:30 -07006097 baTID,
6098 curBaState);
6099
6100 status = eSIR_FAILURE;
6101 goto returnFailure;
6102 }
6103
6104 // Allocate for LIM_MLM_DELBA_REQ
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306105 pMlmDelBAReq = vos_mem_malloc(sizeof( tLimMlmDelBAReq ));
6106 if ( NULL == pMlmDelBAReq )
Jeff Johnson295189b2012-06-20 16:38:30 -07006107 {
6108 limLog( pMac, LOGE,
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306109 FL("AllocateMemory failed with error code %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07006110 status );
6111
6112 status = eSIR_MEM_ALLOC_FAILED;
6113 goto returnFailure;
6114 }
6115
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306116 vos_mem_set( (void *) pMlmDelBAReq, sizeof( tLimMlmDelBAReq ), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07006117
6118 // Copy the peer MAC
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306119 vos_mem_copy(
Jeff Johnson295189b2012-06-20 16:38:30 -07006120 pMlmDelBAReq->peerMacAddr,
6121 pSta->staAddr,
6122 sizeof( tSirMacAddr ));
6123
6124 pMlmDelBAReq->baDirection = baDirection;
6125 pMlmDelBAReq->baTID = baTID;
6126 pMlmDelBAReq->delBAReasonCode = baReasonCode;
6127
6128 /* Update PE session ID*/
6129 pMlmDelBAReq->sessionId = psessionEntry->peSessionId;
6130
6131 //we don't have valid BA session for the given direction.
6132 // HDD wants to get the BA session deleted on PEER in this case.
6133 // in this case we just need to send DelBA to the peer.
6134 if(((eBA_RECIPIENT == baDirection) && (eBA_DISABLE == pSta->tcCfg[baTID].fUseBARx)) ||
6135 ((eBA_INITIATOR == baDirection) && (eBA_DISABLE == pSta->tcCfg[baTID].fUseBATx)))
6136 {
6137 // Send DELBA Ind over the air
6138 if( eSIR_SUCCESS !=
6139 (status = limSendDelBAInd( pMac, pMlmDelBAReq,psessionEntry)))
6140 status = eSIR_FAILURE;
6141
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306142 vos_mem_free(pMlmDelBAReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07006143 return status;
6144 }
6145
6146
6147 // Update the BA state in STA
6148 LIM_SET_STA_BA_STATE(pSta, pMlmDelBAReq->baTID, eLIM_BA_STATE_WT_DEL_RSP);
6149
6150 // Send DELBA Req to MLME
6151 limPostMlmMessage( pMac,
6152 LIM_MLM_DELBA_REQ,
6153 (tANI_U32 *) pMlmDelBAReq );
6154
6155returnFailure:
6156
6157 return status;
6158}
6159
6160/**
6161 * \brief Send WDA_ADDBA_REQ to HAL, in order
6162 * to setup a new BA session with a peer
6163 *
6164 * \sa limPostMsgAddBAReq
6165 *
6166 * \param pMac The global tpAniSirGlobal object
6167 *
6168 * \param pSta Runtime, STA-related configuration cached
6169 * in the HashNode object
6170 *
6171 * \param baDialogToken The Action Frame dialog token
6172 *
6173 * \param baTID TID for which the BA session is being setup
6174 *
6175 * \param baPolicy BA Policy
6176 *
6177 * \param baBufferSize The requested BA buffer size
6178 *
6179 * \param baTimeout BA Timeout. 0 indicates no BA timeout enforced
6180 *
6181 * \param baSSN Starting Sequence Number for this BA session
6182 *
6183 * \param baDirection BA Direction: 1 - Initiator, 0 - Recipient
6184 *
6185 * \return none
6186 *
6187 */
6188tSirRetStatus limPostMsgAddBAReq( tpAniSirGlobal pMac,
6189 tpDphHashNode pSta,
6190 tANI_U8 baDialogToken,
6191 tANI_U8 baTID,
6192 tANI_U8 baPolicy,
6193 tANI_U16 baBufferSize,
6194 tANI_U16 baTimeout,
6195 tANI_U16 baSSN,
6196 tANI_U8 baDirection,
6197 tpPESession psessionEntry)
6198{
6199tpAddBAParams pAddBAParams = NULL;
6200tSirRetStatus retCode = eSIR_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -07006201tSirMsgQ msgQ;
6202
6203#ifdef WLAN_SOFTAP_VSTA_FEATURE
6204 // we can only do BA on "hard" STAs
6205 if (!(IS_HWSTA_IDX(pSta->staIndex)))
6206 {
6207 retCode = eHAL_STATUS_FAILURE;
6208 goto returnFailure;
6209 }
6210#endif //WLAN_SOFTAP_VSTA_FEATURE
6211
6212 // Allocate for WDA_ADDBA_REQ
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306213 pAddBAParams = vos_mem_malloc(sizeof( tAddBAParams ));
6214 if ( NULL == pAddBAParams )
Jeff Johnson295189b2012-06-20 16:38:30 -07006215 {
6216 limLog( pMac, LOGE,
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306217 FL("AllocateMemory failed")
6218 );
Jeff Johnson295189b2012-06-20 16:38:30 -07006219
6220 retCode = eSIR_MEM_ALLOC_FAILED;
6221 goto returnFailure;
6222 }
6223
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306224 vos_mem_set( (void *) pAddBAParams, sizeof( tAddBAParams ), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07006225
6226 // Copy the peer MAC address
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306227 vos_mem_copy(
Jeff Johnson295189b2012-06-20 16:38:30 -07006228 (void *) pAddBAParams->peerMacAddr,
6229 (void *) pSta->staAddr,
6230 sizeof( tSirMacAddr ));
6231
6232 // Populate the REQ parameters
6233 pAddBAParams->staIdx = pSta->staIndex;
6234 pAddBAParams->baDialogToken = baDialogToken;
6235 pAddBAParams->baTID = baTID;
6236 pAddBAParams->baPolicy = baPolicy;
6237 pAddBAParams->baBufferSize = baBufferSize;
6238 pAddBAParams->baTimeout = baTimeout;
6239 pAddBAParams->baSSN = baSSN;
6240 pAddBAParams->baDirection = baDirection;
6241 pAddBAParams->respReqd = 1;
6242
6243 /* UPdate PE session ID */
6244 pAddBAParams->sessionId = psessionEntry->peSessionId;
6245
6246 // Post WDA_ADDBA_REQ to HAL.
6247 msgQ.type = WDA_ADDBA_REQ;
6248 //
6249 // FIXME_AMPDU
6250 // A global counter (dialog token) is required to keep track of
6251 // all PE <-> HAL communication(s)
6252 //
6253 msgQ.reserved = 0;
6254 msgQ.bodyptr = pAddBAParams;
6255 msgQ.bodyval = 0;
6256
6257 limLog( pMac, LOGW,
6258 FL( "Sending WDA_ADDBA_REQ..." ));
6259
6260 //defer any other message until we get response back.
6261 SET_LIM_PROCESS_DEFD_MESGS(pMac, false);
6262
Jeff Johnsone7245742012-09-05 17:12:55 -07006263 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07006264#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
6265 limDiagEventReport(pMac, WLAN_PE_DIAG_HAL_ADDBA_REQ_EVENT, psessionEntry, 0, 0);
6266#endif //FEATURE_WLAN_DIAG_SUPPORT
6267
6268 if( eSIR_SUCCESS != (retCode = wdaPostCtrlMsg( pMac, &msgQ )))
6269 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006270 FL("Posting WDA_ADDBA_REQ to HAL failed! Reason = %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07006271 retCode );
6272 else
6273 return retCode;
6274
6275returnFailure:
6276
6277 // Clean-up...
6278 if( NULL != pAddBAParams )
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306279 vos_mem_free( pAddBAParams );
Jeff Johnson295189b2012-06-20 16:38:30 -07006280
6281 return retCode;
6282
6283}
6284
6285/**
6286 * \brief Send WDA_DELBA_IND to HAL, in order
6287 * to delete an existing BA session with peer
6288 *
6289 * \sa limPostMsgDelBAInd
6290 *
6291 * \param pMac The global tpAniSirGlobal object
6292 *
6293 * \param pSta Runtime, STA-related configuration cached
6294 * in the HashNode object
6295 *
6296 * \param baTID TID for which the BA session is being setup
6297 *
6298 * \param baDirection Identifies whether the DELBA Ind was
6299 * sent by the BA initiator or recipient
6300 *
6301 * \return none
6302 *
6303 */
6304tSirRetStatus limPostMsgDelBAInd( tpAniSirGlobal pMac,
6305 tpDphHashNode pSta,
6306 tANI_U8 baTID,
6307 tANI_U8 baDirection,
6308 tpPESession psessionEntry)
6309{
6310tpDelBAParams pDelBAParams = NULL;
6311tSirRetStatus retCode = eSIR_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -07006312tSirMsgQ msgQ;
6313
6314 // Allocate for SIR_HAL_DELBA_IND
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306315 pDelBAParams = vos_mem_malloc(sizeof( tDelBAParams ));
6316 if ( NULL == pDelBAParams )
Jeff Johnson295189b2012-06-20 16:38:30 -07006317 {
6318 limLog( pMac, LOGE,
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306319 FL("AllocateMemory failed")
6320 );
Jeff Johnson295189b2012-06-20 16:38:30 -07006321
6322 retCode = eSIR_MEM_ALLOC_FAILED;
6323 goto returnFailure;
6324 }
6325
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306326 vos_mem_set( (void *) pDelBAParams, sizeof( tDelBAParams ), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07006327
6328 // Populate the REQ parameters
6329 pDelBAParams->staIdx = pSta->staIndex;
6330 pDelBAParams->baTID = baTID;
6331 pDelBAParams->baDirection = baDirection;
6332
6333 /* Update PE session ID */
6334
6335
6336 //TBD-RAJESH Updating of the session ID is requird for SIR_HAL_DELBA_IND?????
6337 //pDelBAParams->sessionId = psessionEntry->peSessionId;
6338
6339 // Post WDA_DELBA_IND to HAL.
6340 msgQ.type = WDA_DELBA_IND;
6341 //
6342 // FIXME:
6343 // A global counter (dialog token) is required to keep track of
6344 // all PE <-> HAL communication(s)
6345 //
6346 msgQ.reserved = 0;
6347 msgQ.bodyptr = pDelBAParams;
6348 msgQ.bodyval = 0;
6349
6350 limLog( pMac, LOGW,
6351 FL( "Sending SIR_HAL_DELBA_IND..." ));
6352
Jeff Johnsone7245742012-09-05 17:12:55 -07006353 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07006354#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
6355 limDiagEventReport(pMac, WLAN_PE_DIAG_HAL_DELBA_IND_EVENT, psessionEntry, 0, 0);
6356#endif //FEATURE_WLAN_DIAG_SUPPORT
6357
6358 if( eSIR_SUCCESS != (retCode = wdaPostCtrlMsg( pMac, &msgQ )))
6359 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006360 FL("Posting WDA_DELBA_IND to HAL failed! Reason = %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07006361 retCode );
6362 else
6363 {
6364 // Update LIM's internal cache...
6365 if( eBA_INITIATOR == baDirection)
6366 {
6367 pSta->tcCfg[baTID].fUseBATx = 0;
6368 pSta->tcCfg[baTID].txBufSize = 0;
6369 }
6370 else
6371 {
6372 pSta->tcCfg[baTID].fUseBARx = 0;
6373 pSta->tcCfg[baTID].rxBufSize = 0;
6374 }
6375
6376 return retCode;
6377 }
6378
6379returnFailure:
6380
6381 // Clean-up...
6382 if( NULL != pDelBAParams )
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306383 vos_mem_free( pDelBAParams );
Jeff Johnson295189b2012-06-20 16:38:30 -07006384
6385 return retCode;
6386
6387}
6388
6389/**
6390 * @function : limPostSMStateUpdate()
6391 *
6392 * @brief : This function Updates the HAL and Softmac about the change in the STA's SMPS state.
6393 *
6394 * LOGIC:
6395 *
6396 * ASSUMPTIONS:
6397 * NA
6398 *
6399 * NOTE:
6400 * NA
6401 *
6402 * @param pMac - Pointer to Global MAC structure
6403 * @param limMsg - Lim Message structure object with the MimoPSparam in body
6404 * @return None
6405 */
6406tSirRetStatus
6407limPostSMStateUpdate(tpAniSirGlobal pMac,
6408 tANI_U16 staIdx, tSirMacHTMIMOPowerSaveState state)
6409{
6410 tSirRetStatus retCode = eSIR_SUCCESS;
6411 tSirMsgQ msgQ;
Jeff Johnson295189b2012-06-20 16:38:30 -07006412 tpSetMIMOPS pMIMO_PSParams;
6413
6414 msgQ.reserved = 0;
6415 msgQ.type = WDA_SET_MIMOPS_REQ;
6416
6417 // Allocate for WDA_SET_MIMOPS_REQ
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306418 pMIMO_PSParams = vos_mem_malloc(sizeof(tSetMIMOPS));
6419 if ( NULL == pMIMO_PSParams )
6420 {
6421 limLog( pMac, LOGP,FL(" AllocateMemory failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07006422 return eSIR_MEM_ALLOC_FAILED;
6423 }
6424
6425 pMIMO_PSParams->htMIMOPSState = state;
6426 pMIMO_PSParams->staIdx = staIdx;
6427 pMIMO_PSParams->fsendRsp = true;
6428 msgQ.bodyptr = pMIMO_PSParams;
6429 msgQ.bodyval = 0;
6430
6431 limLog( pMac, LOG2, FL( "Sending WDA_SET_MIMOPS_REQ..." ));
6432
Jeff Johnsone7245742012-09-05 17:12:55 -07006433 MTRACE(macTraceMsgTx(pMac, NO_SESSION, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07006434 retCode = wdaPostCtrlMsg( pMac, &msgQ );
6435 if (eSIR_SUCCESS != retCode)
6436 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006437 limLog( pMac, LOGP, FL("Posting WDA_SET_MIMOPS_REQ to HAL failed! Reason = %d"), retCode );
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306438 vos_mem_free(pMIMO_PSParams);
Jeff Johnson295189b2012-06-20 16:38:30 -07006439 return retCode;
6440 }
6441
6442 return retCode;
6443}
6444
6445void limPktFree (
6446 tpAniSirGlobal pMac,
6447 eFrameType frmType,
6448 tANI_U8 *pRxPacketInfo,
6449 void *pBody)
6450{
6451 (void) pMac; (void) frmType; (void) pRxPacketInfo; (void) pBody;
Jeff Johnson295189b2012-06-20 16:38:30 -07006452}
6453
6454/**
6455 * limGetBDfromRxPacket()
6456 *
6457 *FUNCTION:
6458 * This function is called to get pointer to Polaris
6459 * Buffer Descriptor containing MAC header & other control
6460 * info from the body of the message posted to LIM.
6461 *
6462 *LOGIC:
6463 * NA
6464 *
6465 *ASSUMPTIONS:
6466 * NA
6467 *
6468 *NOTE:
6469 * NA
6470 *
6471 * @param body - Received message body
6472 * @param pRxPacketInfo - Pointer to received BD
6473 * @return None
6474 */
6475
6476void
6477limGetBDfromRxPacket(tpAniSirGlobal pMac, void *body, tANI_U32 **pRxPacketInfo)
6478{
Jeff Johnson295189b2012-06-20 16:38:30 -07006479 *pRxPacketInfo = (tANI_U32 *) body;
Jeff Johnson295189b2012-06-20 16:38:30 -07006480} /*** end limGetBDfromRxPacket() ***/
6481
6482
6483
6484
6485
6486void limRessetScanChannelInfo(tpAniSirGlobal pMac)
6487{
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306488 vos_mem_set(&pMac->lim.scanChnInfo, sizeof(tLimScanChnInfo), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07006489}
6490
6491
6492void limAddScanChannelInfo(tpAniSirGlobal pMac, tANI_U8 channelId)
6493{
6494 tANI_U8 i;
6495 tANI_BOOLEAN fFound = eANI_BOOLEAN_FALSE;
6496
6497 for(i = 0; i < pMac->lim.scanChnInfo.numChnInfo; i++)
6498 {
6499 if(pMac->lim.scanChnInfo.scanChn[i].channelId == channelId)
6500 {
6501 pMac->lim.scanChnInfo.scanChn[i].numTimeScan++;
6502 fFound = eANI_BOOLEAN_TRUE;
6503 break;
6504 }
6505 }
6506 if(eANI_BOOLEAN_FALSE == fFound)
6507 {
6508 if(pMac->lim.scanChnInfo.numChnInfo < SIR_MAX_SUPPORTED_CHANNEL_LIST)
6509 {
6510 pMac->lim.scanChnInfo.scanChn[pMac->lim.scanChnInfo.numChnInfo].channelId = channelId;
6511 pMac->lim.scanChnInfo.scanChn[pMac->lim.scanChnInfo.numChnInfo++].numTimeScan = 1;
6512 }
6513 else
6514 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006515 PELOGW(limLog(pMac, LOGW, FL(" -- number of channels exceed mac"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07006516 }
6517 }
6518}
6519
6520
6521/**
6522 * @function : limIsChannelValidForChannelSwitch()
6523 *
6524 * @brief : This function checks if the channel to which AP
6525 * is expecting us to switch, is a valid channel for us.
6526 * LOGIC:
6527 *
6528 * ASSUMPTIONS:
6529 * NA
6530 *
6531 * NOTE:
6532 * NA
6533 *
6534 * @param pMac - Pointer to Global MAC structure
6535 * @param channel - New channel to which we are expected to move
6536 * @return None
6537 */
6538tAniBool
6539limIsChannelValidForChannelSwitch(tpAniSirGlobal pMac, tANI_U8 channel)
6540{
6541 tANI_U8 index;
6542 tANI_U32 validChannelListLen = WNI_CFG_VALID_CHANNEL_LIST_LEN;
6543 tSirMacChanNum validChannelList[WNI_CFG_VALID_CHANNEL_LIST_LEN];
6544
6545 if (wlan_cfgGetStr(pMac, WNI_CFG_VALID_CHANNEL_LIST,
6546 (tANI_U8 *)validChannelList,
6547 (tANI_U32 *)&validChannelListLen) != eSIR_SUCCESS)
6548 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006549 PELOGE(limLog(pMac, LOGE, FL("could not retrieve valid channel list"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07006550 return (eSIR_FALSE);
6551 }
6552
6553 for(index = 0; index < validChannelListLen; index++)
6554 {
6555 if(validChannelList[index] == channel)
6556 return (eSIR_TRUE);
6557 }
6558
6559 /* channel does not belong to list of valid channels */
6560 return (eSIR_FALSE);
6561}
6562
6563/**------------------------------------------------------
6564\fn __limFillTxControlParams
6565\brief Fill the message for stopping/resuming tx.
6566
6567\param pMac
6568\param pTxCtrlMsg - Pointer to tx control message.
6569\param type - Which way we want to stop/ resume tx.
6570\param mode - To stop/resume.
6571 -------------------------------------------------------*/
6572static eHalStatus
6573__limFillTxControlParams(tpAniSirGlobal pMac, tpTxControlParams pTxCtrlMsg,
6574 tLimQuietTxMode type, tLimControlTx mode)
6575{
6576
6577 //TBD-RAJESH HOW TO GET sessionEntry?????
6578 tpPESession psessionEntry = &pMac->lim.gpSession[0];
6579
6580 if (mode == eLIM_STOP_TX)
6581 pTxCtrlMsg->stopTx = eANI_BOOLEAN_TRUE;
6582 else
6583 pTxCtrlMsg->stopTx = eANI_BOOLEAN_FALSE;
6584
6585 switch (type)
6586 {
6587 case eLIM_TX_ALL:
6588 /** Stops/resumes transmission completely */
6589 pTxCtrlMsg->fCtrlGlobal = 1;
6590 break;
6591
6592 case eLIM_TX_BSS_BUT_BEACON:
6593 /** Stops/resumes transmission on a particular BSS. Stopping BSS, doesnt
6594 * stop beacon transmission.
6595 */
6596 pTxCtrlMsg->ctrlBss = 1;
6597 pTxCtrlMsg->bssBitmap |= (1 << psessionEntry->bssIdx);
6598 break;
6599
6600 case eLIM_TX_STA:
6601 /** Memory for station bitmap is allocated dynamically in caller of this
6602 * so decode properly here and fill the bitmap. Now not implemented,
6603 * fall through.
6604 */
6605 case eLIM_TX_BSS:
6606 //Fall thru...
6607 default:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006608 PELOGW(limLog(pMac, LOGW, FL("Invalid case: Not Handled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07006609 return eHAL_STATUS_FAILURE;
6610 }
6611
6612 return eHAL_STATUS_SUCCESS;
6613}
6614
6615/**
6616 * @function : limFrameTransmissionControl()
6617 *
6618 * @brief : This API is called by the user to halt/resume any frame
6619 * transmission from the device. If stopped, all frames will be
6620 * queued starting from hardware. Then back-pressure
6621 * is built till the driver.
6622 * LOGIC:
6623 *
6624 * ASSUMPTIONS:
6625 * NA
6626 *
6627 * NOTE:
6628 * NA
6629 *
6630 * @param pMac - Pointer to Global MAC structure
6631 * @return None
6632 */
6633void limFrameTransmissionControl(tpAniSirGlobal pMac, tLimQuietTxMode type, tLimControlTx mode)
6634{
6635
6636 eHalStatus status = eHAL_STATUS_FAILURE;
6637 tpTxControlParams pTxCtrlMsg;
6638 tSirMsgQ msgQ;
6639 tANI_U8 nBytes = 0; // No of bytes required for station bitmap.
6640
6641 /** Allocate only required number of bytes for station bitmap
6642 * Make it to align to 4 byte boundary */
6643 nBytes = (tANI_U8)HALMSG_NUMBYTES_STATION_BITMAP(pMac->lim.maxStation);
6644
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306645 pTxCtrlMsg = vos_mem_malloc(sizeof(*pTxCtrlMsg) + nBytes);
6646 if ( NULL == pTxCtrlMsg )
Jeff Johnson295189b2012-06-20 16:38:30 -07006647 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306648 limLog(pMac, LOGP, FL("AllocateMemory() failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07006649 return;
6650 }
6651
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306652 vos_mem_set((void *) pTxCtrlMsg,
6653 (sizeof(*pTxCtrlMsg) + nBytes), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07006654 status = __limFillTxControlParams(pMac, pTxCtrlMsg, type, mode);
6655 if (status != eHAL_STATUS_SUCCESS)
6656 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306657 vos_mem_free(pTxCtrlMsg);
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006658 limLog(pMac, LOGP, FL("__limFillTxControlParams failed, status = %d"), status);
Jeff Johnson295189b2012-06-20 16:38:30 -07006659 return;
6660 }
6661
6662 msgQ.bodyptr = (void *) pTxCtrlMsg;
6663 msgQ.bodyval = 0;
6664 msgQ.reserved = 0;
6665 msgQ.type = WDA_TRANSMISSION_CONTROL_IND;
6666
Jeff Johnsone7245742012-09-05 17:12:55 -07006667 MTRACE(macTraceMsgTx(pMac, NO_SESSION, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07006668 if(wdaPostCtrlMsg( pMac, &msgQ) != eSIR_SUCCESS)
6669 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306670 vos_mem_free(pTxCtrlMsg);
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006671 limLog( pMac, LOGP, FL("Posting Message to HAL failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07006672 return;
6673 }
6674
6675 if (mode == eLIM_STOP_TX)
6676 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006677 PELOG1(limLog(pMac, LOG1, FL("Stopping the transmission of all packets, indicated softmac"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07006678 }
6679 else
6680 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006681 PELOG1(limLog(pMac, LOG1, FL("Resuming the transmission of all packets, indicated softmac"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07006682 }
6683 return;
6684}
6685
6686
6687/**
6688 * @function : limRestorePreChannelSwitchState()
6689 *
6690 * @brief : This API is called by the user to undo any
6691 * specific changes done on the device during
6692 * channel switch.
6693 * LOGIC:
6694 *
6695 * ASSUMPTIONS:
6696 * NA
6697 *
6698 * NOTE:
6699 * NA
6700 *
6701 * @param pMac - Pointer to Global MAC structure
6702 * @return None
6703 */
6704
6705tSirRetStatus
6706limRestorePreChannelSwitchState(tpAniSirGlobal pMac, tpPESession psessionEntry)
6707{
6708
6709 tSirRetStatus retCode = eSIR_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -07006710 tANI_U32 val = 0;
6711
6712 if (psessionEntry->limSystemRole != eLIM_STA_ROLE)
6713 return retCode;
6714
6715 /* Channel switch should be ready for the next time */
Jeff Johnsone7245742012-09-05 17:12:55 -07006716 psessionEntry->gLimSpecMgmt.dot11hChanSwState = eLIM_11H_CHANSW_INIT;
Jeff Johnson295189b2012-06-20 16:38:30 -07006717
6718 /* Restore the frame transmission, all the time. */
6719 limFrameTransmissionControl(pMac, eLIM_TX_ALL, eLIM_RESUME_TX);
6720
6721 /* Free to enter BMPS */
6722 limSendSmePostChannelSwitchInd(pMac);
6723
6724 //Background scan is now enabled by SME
6725 if(pMac->lim.gLimBackgroundScanTerminate == FALSE)
6726 {
6727 /* Enable background scan if already enabled, else don't bother */
6728 if ((retCode = wlan_cfgGetInt(pMac, WNI_CFG_BACKGROUND_SCAN_PERIOD,
6729 &val)) != eSIR_SUCCESS)
6730
6731 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006732 limLog(pMac, LOGP, FL("could not retrieve Background scan period value"));
Jeff Johnson295189b2012-06-20 16:38:30 -07006733 return (retCode);
6734 }
6735
6736 if (val > 0 && TX_TIMER_VALID(pMac->lim.limTimers.gLimBackgroundScanTimer))
6737 {
Ravi Joshid2ca7c42013-07-23 08:37:49 -07006738 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE,
6739 psessionEntry->peSessionId, eLIM_BACKGROUND_SCAN_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -07006740 if(tx_timer_activate(&pMac->lim.limTimers.gLimBackgroundScanTimer) != TX_SUCCESS)
6741 {
6742 limLog(pMac, LOGP, FL("Could not restart background scan timer, doing LOGP"));
6743 return (eSIR_FAILURE);
6744 }
6745
6746 }
6747 }
6748
6749 /* Enable heartbeat timer */
6750 if (TX_TIMER_VALID(pMac->lim.limTimers.gLimHeartBeatTimer))
6751 {
Ravi Joshid2ca7c42013-07-23 08:37:49 -07006752 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE,
6753 psessionEntry->peSessionId, eLIM_HEART_BEAT_TIMER));
6754 if((limActivateHearBeatTimer(pMac, psessionEntry) != TX_SUCCESS) &&
6755 (!IS_ACTIVEMODE_OFFLOAD_FEATURE_ENABLE))
Jeff Johnson295189b2012-06-20 16:38:30 -07006756 {
6757 limLog(pMac, LOGP, FL("Could not restart heartbeat timer, doing LOGP"));
6758 return (eSIR_FAILURE);
6759 }
6760 }
Jeff Johnson295189b2012-06-20 16:38:30 -07006761 return (retCode);
6762}
6763
6764
6765/**--------------------------------------------
6766\fn limRestorePreQuietState
6767\brief Restore the pre quiet state
6768
6769\param pMac
6770\return NONE
6771---------------------------------------------*/
Jeff Johnsone7245742012-09-05 17:12:55 -07006772tSirRetStatus limRestorePreQuietState(tpAniSirGlobal pMac, tpPESession psessionEntry)
Jeff Johnson295189b2012-06-20 16:38:30 -07006773{
6774
6775 tSirRetStatus retCode = eSIR_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -07006776 tANI_U32 val = 0;
6777
6778 if (pMac->lim.gLimSystemRole != eLIM_STA_ROLE)
6779 return retCode;
6780
6781 /* Quiet should be ready for the next time */
Jeff Johnsone7245742012-09-05 17:12:55 -07006782 psessionEntry->gLimSpecMgmt.quietState = eLIM_QUIET_INIT;
Jeff Johnson295189b2012-06-20 16:38:30 -07006783
6784 /* Restore the frame transmission, all the time. */
Jeff Johnsone7245742012-09-05 17:12:55 -07006785 if (psessionEntry->gLimSpecMgmt.quietState == eLIM_QUIET_RUNNING)
Jeff Johnson295189b2012-06-20 16:38:30 -07006786 limFrameTransmissionControl(pMac, eLIM_TX_ALL, eLIM_RESUME_TX);
6787
6788
6789 //Background scan is now enabled by SME
6790 if(pMac->lim.gLimBackgroundScanTerminate == FALSE)
6791 {
6792 /* Enable background scan if already enabled, else don't bother */
6793 if ((retCode = wlan_cfgGetInt(pMac, WNI_CFG_BACKGROUND_SCAN_PERIOD,
6794 &val)) != eSIR_SUCCESS)
6795
6796 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006797 limLog(pMac, LOGP, FL("could not retrieve Background scan period value"));
Jeff Johnson295189b2012-06-20 16:38:30 -07006798 return (retCode);
6799 }
6800
6801 if (val > 0 && TX_TIMER_VALID(pMac->lim.limTimers.gLimBackgroundScanTimer))
6802 {
Leela V Kiran Kumar Reddy Chiralac3b9d382013-01-31 20:49:53 -08006803 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, psessionEntry->peSessionId, eLIM_BACKGROUND_SCAN_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -07006804 if(tx_timer_activate(&pMac->lim.limTimers.gLimBackgroundScanTimer) != TX_SUCCESS)
6805 {
6806 limLog(pMac, LOGP, FL("Could not restart background scan timer, doing LOGP"));
6807 return (eSIR_FAILURE);
6808 }
6809
6810 }
6811 }
6812
6813 /* Enable heartbeat timer */
6814 if (TX_TIMER_VALID(pMac->lim.limTimers.gLimHeartBeatTimer))
6815 {
Leela V Kiran Kumar Reddy Chiralac3b9d382013-01-31 20:49:53 -08006816 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, psessionEntry->peSessionId, eLIM_HEART_BEAT_TIMER));
Ravi Joshid2ca7c42013-07-23 08:37:49 -07006817 if(limActivateHearBeatTimer(pMac, psessionEntry) != TX_SUCCESS)
Jeff Johnson295189b2012-06-20 16:38:30 -07006818 {
6819 limLog(pMac, LOGP, FL("Could not restart heartbeat timer, doing LOGP"));
6820 return (eSIR_FAILURE);
6821 }
6822 }
Jeff Johnson295189b2012-06-20 16:38:30 -07006823 return (retCode);
6824}
6825
6826
6827/**
6828 * @function: limPrepareFor11hChannelSwitch()
6829 *
6830 * @brief : This API is called by the user to prepare for
6831 * 11h channel switch. As of now, the API does
6832 * very minimal work. User can add more into the
6833 * same API if needed.
6834 * LOGIC:
6835 *
6836 * ASSUMPTIONS:
6837 * NA
6838 *
6839 * NOTE:
6840 * NA
6841 *
6842 * @param pMac - Pointer to Global MAC structure
6843 * @param psessionEntry
6844 * @return None
6845 */
6846void
6847limPrepareFor11hChannelSwitch(tpAniSirGlobal pMac, tpPESession psessionEntry)
6848{
Jeff Johnson295189b2012-06-20 16:38:30 -07006849 if (psessionEntry->limSystemRole != eLIM_STA_ROLE)
6850 return;
6851
6852 /* Flag to indicate 11h channel switch in progress */
Jeff Johnsone7245742012-09-05 17:12:55 -07006853 psessionEntry->gLimSpecMgmt.dot11hChanSwState = eLIM_11H_CHANSW_RUNNING;
Jeff Johnson295189b2012-06-20 16:38:30 -07006854
6855 /* Disable, Stop background scan if enabled and running */
6856 limDeactivateAndChangeTimer(pMac, eLIM_BACKGROUND_SCAN_TIMER);
6857
6858 /* Stop heart-beat timer to stop heartbeat disassociation */
6859 limHeartBeatDeactivateAndChangeTimer(pMac, psessionEntry);
6860
6861 if(pMac->lim.gLimSmeState == eLIM_SME_LINK_EST_WT_SCAN_STATE ||
6862 pMac->lim.gLimSmeState == eLIM_SME_CHANNEL_SCAN_STATE)
6863 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006864 PELOGE(limLog(pMac, LOGE, FL("Posting finish scan as we are in scan state"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07006865 /* Stop ongoing scanning if any */
6866 if (GET_LIM_PROCESS_DEFD_MESGS(pMac))
6867 {
6868 //Set the resume channel to Any valid channel (invalid).
6869 //This will instruct HAL to set it to any previous valid channel.
6870 peSetResumeChannel(pMac, 0, 0);
6871 limSendHalFinishScanReq(pMac, eLIM_HAL_FINISH_SCAN_WAIT_STATE);
6872 }
6873 else
6874 {
6875 limRestorePreChannelSwitchState(pMac, psessionEntry);
6876 }
6877 return;
6878 }
6879 else
6880 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006881 PELOGE(limLog(pMac, LOGE, FL("Not in scan state, start channel switch timer"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07006882 /** We are safe to switch channel at this point */
6883 limStopTxAndSwitchChannel(pMac, psessionEntry->peSessionId);
6884 }
Jeff Johnson295189b2012-06-20 16:38:30 -07006885}
6886
6887
6888
6889/**----------------------------------------------------
6890\fn limGetNwType
6891
6892\brief Get type of the network from data packet or beacon
6893\param pMac
6894\param channelNum - Channel number
6895\param type - Type of packet.
6896\param pBeacon - Pointer to beacon or probe response
6897
6898\return Network type a/b/g.
6899-----------------------------------------------------*/
6900tSirNwType limGetNwType(tpAniSirGlobal pMac, tANI_U8 channelNum, tANI_U32 type, tpSchBeaconStruct pBeacon)
6901{
6902 tSirNwType nwType = eSIR_11B_NW_TYPE;
6903
6904 if (type == SIR_MAC_DATA_FRAME)
6905 {
6906 if ((channelNum > 0) && (channelNum < 15))
6907 {
6908 nwType = eSIR_11G_NW_TYPE;
6909 }
6910 else
6911 {
6912 nwType = eSIR_11A_NW_TYPE;
6913 }
6914 }
6915 else
6916 {
6917 if ((channelNum > 0) && (channelNum < 15))
6918 {
6919 int i;
6920 // 11b or 11g packet
6921 // 11g iff extended Rate IE is present or
6922 // if there is an A rate in suppRate IE
6923 for (i = 0; i < pBeacon->supportedRates.numRates; i++)
6924 {
6925 if (sirIsArate(pBeacon->supportedRates.rate[i] & 0x7f))
6926 {
6927 nwType = eSIR_11G_NW_TYPE;
6928 break;
6929 }
6930 }
6931 if (pBeacon->extendedRatesPresent)
6932 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006933 PELOG3(limLog(pMac, LOG3, FL("Beacon, nwtype=G"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07006934 nwType = eSIR_11G_NW_TYPE;
6935 }
6936 }
6937 else
6938 {
6939 // 11a packet
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006940 PELOG3(limLog(pMac, LOG3,FL("Beacon, nwtype=A"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07006941 nwType = eSIR_11A_NW_TYPE;
6942 }
6943 }
6944 return nwType;
6945}
6946
6947
6948/**---------------------------------------------------------
6949\fn limGetChannelFromBeacon
6950\brief To extract channel number from beacon
6951
6952\param pMac
6953\param pBeacon - Pointer to beacon or probe rsp
6954\return channel number
6955-----------------------------------------------------------*/
6956tANI_U8 limGetChannelFromBeacon(tpAniSirGlobal pMac, tpSchBeaconStruct pBeacon)
6957{
6958 tANI_U8 channelNum = 0;
6959
6960 if (pBeacon->dsParamsPresent)
6961 channelNum = pBeacon->channelNumber;
6962 else if(pBeacon->HTInfo.present)
6963 channelNum = pBeacon->HTInfo.primaryChannel;
6964 else
6965 channelNum = pBeacon->channelNumber;
6966
6967 return channelNum;
6968}
6969
6970
6971/** ---------------------------------------------------------
6972\fn limSetTspecUapsdMask
6973\brief This function sets the PE global variable:
6974\ 1) gUapsdPerAcTriggerEnableMask and
6975\ 2) gUapsdPerAcDeliveryEnableMask
6976\ based on the user priority field and direction field
6977\ in the TS Info Fields.
6978\
6979\ An AC is a trigger-enabled AC if the PSB subfield
6980\ is set to 1 in the uplink direction.
6981\ An AC is a delivery-enabled AC if the PSB subfield
6982\ is set to 1 in the down-link direction.
6983\
6984\param tpAniSirGlobal pMac
6985\param tSirMacTSInfo pTsInfo
6986\param tANI_U32 action
6987\return None
6988 ------------------------------------------------------------*/
6989void limSetTspecUapsdMask(tpAniSirGlobal pMac, tSirMacTSInfo *pTsInfo, tANI_U32 action)
6990{
6991 tANI_U8 userPrio = (tANI_U8)pTsInfo->traffic.userPrio;
6992 tANI_U16 direction = pTsInfo->traffic.direction;
6993 tANI_U8 ac = upToAc(userPrio);
6994
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006995 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 -07006996
6997 /* Converting AC to appropriate Uapsd Bit Mask
6998 * AC_BE(0) --> UAPSD_BITOFFSET_ACVO(3)
6999 * AC_BK(1) --> UAPSD_BITOFFSET_ACVO(2)
7000 * AC_VI(2) --> UAPSD_BITOFFSET_ACVO(1)
7001 * AC_VO(3) --> UAPSD_BITOFFSET_ACVO(0)
7002 */
7003 ac = ((~ac) & 0x3);
7004
7005 if (action == CLEAR_UAPSD_MASK)
7006 {
7007 if (direction == SIR_MAC_DIRECTION_UPLINK)
7008 pMac->lim.gUapsdPerAcTriggerEnableMask &= ~(1 << ac);
7009 else if (direction == SIR_MAC_DIRECTION_DNLINK)
7010 pMac->lim.gUapsdPerAcDeliveryEnableMask &= ~(1 << ac);
7011 else if (direction == SIR_MAC_DIRECTION_BIDIR)
7012 {
7013 pMac->lim.gUapsdPerAcTriggerEnableMask &= ~(1 << ac);
7014 pMac->lim.gUapsdPerAcDeliveryEnableMask &= ~(1 << ac);
7015 }
7016 }
7017 else if (action == SET_UAPSD_MASK)
7018 {
7019 if (direction == SIR_MAC_DIRECTION_UPLINK)
7020 pMac->lim.gUapsdPerAcTriggerEnableMask |= (1 << ac);
7021 else if (direction == SIR_MAC_DIRECTION_DNLINK)
7022 pMac->lim.gUapsdPerAcDeliveryEnableMask |= (1 << ac);
7023 else if (direction == SIR_MAC_DIRECTION_BIDIR)
7024 {
7025 pMac->lim.gUapsdPerAcTriggerEnableMask |= (1 << ac);
7026 pMac->lim.gUapsdPerAcDeliveryEnableMask |= (1 << ac);
7027 }
7028 }
7029
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007030 limLog(pMac, LOGE, FL("New pMac->lim.gUapsdPerAcTriggerEnableMask = 0x%x "), pMac->lim.gUapsdPerAcTriggerEnableMask );
7031 limLog(pMac, LOGE, FL("New pMac->lim.gUapsdPerAcDeliveryEnableMask = 0x%x "), pMac->lim.gUapsdPerAcDeliveryEnableMask );
Jeff Johnson295189b2012-06-20 16:38:30 -07007032
7033 return;
7034}
7035
7036
7037
7038void limHandleHeartBeatTimeout(tpAniSirGlobal pMac )
7039{
7040
7041 tANI_U8 i;
7042 for(i =0;i < pMac->lim.maxBssId;i++)
7043 {
7044 if(pMac->lim.gpSession[i].valid == TRUE )
7045 {
7046 if(pMac->lim.gpSession[i].bssType == eSIR_IBSS_MODE)
7047 {
7048 limIbssHeartBeatHandle(pMac,&pMac->lim.gpSession[i]);
7049 break;
7050 }
7051
7052 if((pMac->lim.gpSession[i].bssType == eSIR_INFRASTRUCTURE_MODE) &&
7053 (pMac->lim.gpSession[i].limSystemRole == eLIM_STA_ROLE))
7054 {
7055 limHandleHeartBeatFailure(pMac,&pMac->lim.gpSession[i]);
7056 }
7057 }
7058 }
7059 for(i=0; i< pMac->lim.maxBssId; i++)
7060 {
7061 if(pMac->lim.gpSession[i].valid == TRUE )
7062 {
7063 if((pMac->lim.gpSession[i].bssType == eSIR_INFRASTRUCTURE_MODE) &&
7064 (pMac->lim.gpSession[i].limSystemRole == eLIM_STA_ROLE))
7065 {
7066 if(pMac->lim.gpSession[i].LimHBFailureStatus == eANI_BOOLEAN_TRUE)
7067 {
7068 /* Activate Probe After HeartBeat Timer incase HB Failure detected */
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007069 PELOGW(limLog(pMac, LOGW,FL("Sending Probe for Session: %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07007070 i);)
7071 limDeactivateAndChangeTimer(pMac, eLIM_PROBE_AFTER_HB_TIMER);
7072 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, 0, eLIM_PROBE_AFTER_HB_TIMER));
7073 if (tx_timer_activate(&pMac->lim.limTimers.gLimProbeAfterHBTimer) != TX_SUCCESS)
7074 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007075 limLog(pMac, LOGP, FL("Fail to re-activate Probe-after-heartbeat timer"));
Jeff Johnson295189b2012-06-20 16:38:30 -07007076 limReactivateHeartBeatTimer(pMac, &pMac->lim.gpSession[i]);
7077 }
7078 break;
7079 }
7080 }
7081 }
7082 }
7083}
7084
Leela Venkata Kiran Kumar Reddy Chirala3ca17902013-02-27 19:50:05 -08007085void limHandleHeartBeatTimeoutForSession(tpAniSirGlobal pMac, tpPESession psessionEntry)
7086{
7087 if(psessionEntry->valid == TRUE )
7088 {
7089 if(psessionEntry->bssType == eSIR_IBSS_MODE)
7090 {
7091 limIbssHeartBeatHandle(pMac,psessionEntry);
7092 }
7093 if((psessionEntry->bssType == eSIR_INFRASTRUCTURE_MODE) &&
7094 (psessionEntry->limSystemRole == eLIM_STA_ROLE))
7095 {
7096 limHandleHeartBeatFailure(pMac,psessionEntry);
7097 }
7098 }
7099 /* In the function limHandleHeartBeatFailure things can change so check for the session entry valid
7100 and the other things again */
7101 if(psessionEntry->valid == TRUE )
7102 {
7103 if((psessionEntry->bssType == eSIR_INFRASTRUCTURE_MODE) &&
7104 (psessionEntry->limSystemRole == eLIM_STA_ROLE))
7105 {
7106 if(psessionEntry->LimHBFailureStatus == eANI_BOOLEAN_TRUE)
7107 {
7108 /* Activate Probe After HeartBeat Timer incase HB Failure detected */
7109 PELOGW(limLog(pMac, LOGW,FL("Sending Probe for Session: %d"),
7110 psessionEntry->bssIdx);)
7111 limDeactivateAndChangeTimer(pMac, eLIM_PROBE_AFTER_HB_TIMER);
7112 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, 0, eLIM_PROBE_AFTER_HB_TIMER));
7113 if (tx_timer_activate(&pMac->lim.limTimers.gLimProbeAfterHBTimer) != TX_SUCCESS)
7114 {
7115 limLog(pMac, LOGP, FL("Fail to re-activate Probe-after-heartbeat timer"));
7116 limReactivateHeartBeatTimer(pMac, psessionEntry);
7117 }
7118 }
7119 }
7120 }
7121}
7122
7123
Jeff Johnson295189b2012-06-20 16:38:30 -07007124tANI_U8 limGetCurrentOperatingChannel(tpAniSirGlobal pMac)
7125{
7126 tANI_U8 i;
7127 for(i =0;i < pMac->lim.maxBssId;i++)
7128 {
7129 if(pMac->lim.gpSession[i].valid == TRUE )
7130 {
7131 if((pMac->lim.gpSession[i].bssType == eSIR_INFRASTRUCTURE_MODE) &&
7132 (pMac->lim.gpSession[i].limSystemRole == eLIM_STA_ROLE))
7133 {
7134 return pMac->lim.gpSession[i].currentOperChannel;
7135 }
7136 }
7137 }
7138 return 0;
7139}
7140
7141void limProcessAddStaRsp(tpAniSirGlobal pMac,tpSirMsgQ limMsgQ)
7142{
7143
7144 tpPESession psessionEntry;
7145// tANI_U8 sessionId;
7146 tpAddStaParams pAddStaParams;
7147
7148 pAddStaParams = (tpAddStaParams)limMsgQ->bodyptr;
7149
7150 if((psessionEntry = peFindSessionBySessionId(pMac,pAddStaParams->sessionId))==NULL)
7151 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007152 limLog(pMac, LOGP,FL("Session Does not exist for given sessionID"));
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307153 vos_mem_free(pAddStaParams);
Jeff Johnson295189b2012-06-20 16:38:30 -07007154 return;
7155 }
7156 if (psessionEntry->limSystemRole == eLIM_STA_IN_IBSS_ROLE)
7157 (void) limIbssAddStaRsp(pMac, limMsgQ->bodyptr,psessionEntry);
Mohit Khanna698ba2a2012-12-04 15:08:18 -08007158#ifdef FEATURE_WLAN_TDLS
7159 else if(pMac->lim.gLimAddStaTdls)
7160 {
7161 limProcessTdlsAddStaRsp(pMac, limMsgQ->bodyptr, psessionEntry) ;
7162 pMac->lim.gLimAddStaTdls = FALSE ;
7163 }
7164#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07007165 else
7166 limProcessMlmAddStaRsp(pMac, limMsgQ,psessionEntry);
7167
7168}
7169
7170
7171void limUpdateBeacon(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 == TRUE )
7178 {
7179 if( ( (pMac->lim.gpSession[i].limSystemRole == eLIM_AP_ROLE) ||
7180 (pMac->lim.gpSession[i].limSystemRole == eLIM_STA_IN_IBSS_ROLE) )
7181 && (eLIM_SME_NORMAL_STATE == pMac->lim.gpSession[i].limSmeState)
7182 )
7183 {
7184 schSetFixedBeaconFields(pMac,&pMac->lim.gpSession[i]);
7185 limSendBeaconInd(pMac, &pMac->lim.gpSession[i]);
7186 }
7187 else
7188 {
7189 if( (pMac->lim.gpSession[i].limSystemRole == eLIM_BT_AMP_AP_ROLE)||
7190 (pMac->lim.gpSession[i].limSystemRole == eLIM_BT_AMP_STA_ROLE))
7191 {
7192
7193 if(pMac->lim.gpSession[i].statypeForBss == STA_ENTRY_SELF)
7194 {
7195 schSetFixedBeaconFields(pMac,&pMac->lim.gpSession[i]);
7196 }
7197 }
7198 }
7199 }
7200 }
7201}
7202
7203void limHandleHeartBeatFailureTimeout(tpAniSirGlobal pMac)
7204{
7205 tANI_U8 i;
7206 tpPESession psessionEntry;
7207 /* Probe response is not received after HB failure. This is handled by LMM sub module. */
7208 for(i =0; i < pMac->lim.maxBssId; i++)
7209 {
7210 if(pMac->lim.gpSession[i].valid == TRUE)
7211 {
7212 psessionEntry = &pMac->lim.gpSession[i];
7213 if(psessionEntry->LimHBFailureStatus == eANI_BOOLEAN_TRUE)
7214 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007215 limLog(pMac, LOGE, FL("Probe_hb_failure: SME %d, MLME %d, HB-Count %d"),psessionEntry->limSmeState,
Jeff Johnson295189b2012-06-20 16:38:30 -07007216 psessionEntry->limMlmState, psessionEntry->LimRxedBeaconCntDuringHB);
Leela Venkata Kiran Kumar Reddy Chirala2365ee62013-05-09 17:30:12 -07007217#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
7218 limDiagEventReport(pMac, WLAN_PE_DIAG_HB_FAILURE_TIMEOUT, psessionEntry, 0, 0);
7219#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07007220 if (psessionEntry->limMlmState == eLIM_MLM_LINK_ESTABLISHED_STATE)
7221 {
Leela Venkata Kiran Kumar Reddy Chiralaab842fb2013-04-30 12:27:35 -07007222 if ((!LIM_IS_CONNECTION_ACTIVE(psessionEntry))&&
7223 (psessionEntry->limSmeState != eLIM_SME_WT_DISASSOC_STATE))
Jeff Johnson295189b2012-06-20 16:38:30 -07007224 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007225 limLog(pMac, LOGE, FL("Probe_hb_failure: for session:%d " ),psessionEntry->peSessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07007226 /* AP did not respond to Probe Request. Tear down link with it.*/
7227 limTearDownLinkWithAp(pMac,
7228 psessionEntry->peSessionId,
7229 eSIR_BEACON_MISSED);
7230 pMac->lim.gLimProbeFailureAfterHBfailedCnt++ ;
7231 }
7232 else // restart heartbeat timer
7233 {
7234 limReactivateHeartBeatTimer(pMac, psessionEntry);
7235 }
7236 }
7237 else
7238 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007239 limLog(pMac, LOGE, FL("Unexpected wt-probe-timeout in state "));
Jeff Johnson295189b2012-06-20 16:38:30 -07007240 limPrintMlmState(pMac, LOGE, psessionEntry->limMlmState);
7241 limReactivateHeartBeatTimer(pMac, psessionEntry);
7242 }
7243
7244 }
7245 }
7246 }
7247 /* Deactivate Timer ProbeAfterHB Timer -> As its a oneshot timer, need not deactivate the timer */
7248 // tx_timer_deactivate(&pMac->lim.limTimers.gLimProbeAfterHBTimer);
7249}
7250
7251
7252/*
7253* This function assumes there will not be more than one IBSS session active at any time.
7254*/
7255tpPESession limIsIBSSSessionActive(tpAniSirGlobal pMac)
7256{
7257 tANI_U8 i;
7258
7259 for(i =0;i < pMac->lim.maxBssId;i++)
7260 {
7261 if( (pMac->lim.gpSession[i].valid) &&
7262 (pMac->lim.gpSession[i].limSystemRole == eLIM_STA_IN_IBSS_ROLE))
7263 return (&pMac->lim.gpSession[i]);
7264 }
7265
7266 return NULL;
7267}
7268
7269tpPESession limIsApSessionActive(tpAniSirGlobal pMac)
7270{
7271 tANI_U8 i;
7272
7273 for(i =0;i < pMac->lim.maxBssId;i++)
7274 {
7275 if( (pMac->lim.gpSession[i].valid) &&
7276 ( (pMac->lim.gpSession[i].limSystemRole == eLIM_AP_ROLE) ||
7277 (pMac->lim.gpSession[i].limSystemRole == eLIM_BT_AMP_AP_ROLE)))
7278 return (&pMac->lim.gpSession[i]);
7279 }
7280
7281 return NULL;
7282}
7283
7284/**---------------------------------------------------------
7285\fn limHandleDeferMsgError
7286\brief handles error scenario, when the msg can not be deferred.
7287\param pMac
7288\param pLimMsg LIM msg, which could not be deferred.
7289\return void
7290-----------------------------------------------------------*/
7291
7292void limHandleDeferMsgError(tpAniSirGlobal pMac, tpSirMsgQ pLimMsg)
7293{
7294 if(SIR_BB_XPORT_MGMT_MSG == pLimMsg->type)
7295 {
7296 vos_pkt_return_packet((vos_pkt_t*)pLimMsg->bodyptr);
7297 }
7298 else if(pLimMsg->bodyptr != NULL)
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08007299 {
7300 vos_mem_free( pLimMsg->bodyptr);
7301 pLimMsg->bodyptr = NULL;
7302 }
Jeff Johnson295189b2012-06-20 16:38:30 -07007303}
7304
7305
7306#ifdef FEATURE_WLAN_DIAG_SUPPORT
7307/**---------------------------------------------------------
7308\fn limDiagEventReport
7309\brief This function reports Diag event
7310\param pMac
7311\param eventType
7312\param bssid
7313\param status
7314\param reasonCode
7315\return void
7316-----------------------------------------------------------*/
7317void limDiagEventReport(tpAniSirGlobal pMac, tANI_U16 eventType, tpPESession pSessionEntry, tANI_U16 status, tANI_U16 reasonCode)
7318{
7319 tSirMacAddr nullBssid = { 0, 0, 0, 0, 0, 0 };
7320 WLAN_VOS_DIAG_EVENT_DEF(peEvent, vos_event_wlan_pe_payload_type);
7321
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307322 vos_mem_set(&peEvent, sizeof(vos_event_wlan_pe_payload_type), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07007323
7324 if (NULL == pSessionEntry)
7325 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307326 vos_mem_copy( peEvent.bssid, nullBssid, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07007327 peEvent.sme_state = (tANI_U16)pMac->lim.gLimSmeState;
7328 peEvent.mlm_state = (tANI_U16)pMac->lim.gLimMlmState;
7329
7330 }
7331 else
7332 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307333 vos_mem_copy(peEvent.bssid, pSessionEntry->bssId, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07007334 peEvent.sme_state = (tANI_U16)pSessionEntry->limSmeState;
7335 peEvent.mlm_state = (tANI_U16)pSessionEntry->limMlmState;
7336 }
7337 peEvent.event_type = eventType;
7338 peEvent.status = status;
7339 peEvent.reason_code = reasonCode;
7340
7341 WLAN_VOS_DIAG_EVENT_REPORT(&peEvent, EVENT_WLAN_PE);
7342 return;
7343}
7344
7345#endif /* FEATURE_WLAN_DIAG_SUPPORT */
7346
7347void limProcessAddStaSelfRsp(tpAniSirGlobal pMac,tpSirMsgQ limMsgQ)
7348{
7349
7350 tpAddStaSelfParams pAddStaSelfParams;
7351 tSirMsgQ mmhMsg;
7352 tpSirSmeAddStaSelfRsp pRsp;
7353
7354
7355 pAddStaSelfParams = (tpAddStaSelfParams)limMsgQ->bodyptr;
7356
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307357 pRsp = vos_mem_malloc(sizeof(tSirSmeAddStaSelfRsp));
7358 if ( NULL == pRsp )
Jeff Johnson295189b2012-06-20 16:38:30 -07007359 {
7360 /// Buffer not available. Log error
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307361 limLog(pMac, LOGP, FL("call to AllocateMemory failed for Add Sta self RSP"));
7362 vos_mem_free(pAddStaSelfParams);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08007363 limMsgQ->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07007364 return;
7365 }
7366
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307367 vos_mem_set((tANI_U8*)pRsp, sizeof(tSirSmeAddStaSelfRsp), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07007368
7369 pRsp->mesgType = eWNI_SME_ADD_STA_SELF_RSP;
7370 pRsp->mesgLen = (tANI_U16) sizeof(tSirSmeAddStaSelfRsp);
7371 pRsp->status = pAddStaSelfParams->status;
7372
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307373 vos_mem_copy( pRsp->selfMacAddr, pAddStaSelfParams->selfMacAddr, sizeof(tSirMacAddr) );
Jeff Johnson295189b2012-06-20 16:38:30 -07007374
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307375 vos_mem_free(pAddStaSelfParams);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08007376 limMsgQ->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07007377
7378 mmhMsg.type = eWNI_SME_ADD_STA_SELF_RSP;
7379 mmhMsg.bodyptr = pRsp;
7380 mmhMsg.bodyval = 0;
Jeff Johnsone7245742012-09-05 17:12:55 -07007381 MTRACE(macTraceMsgTx(pMac, NO_SESSION, mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07007382 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
7383
7384}
7385
7386void limProcessDelStaSelfRsp(tpAniSirGlobal pMac,tpSirMsgQ limMsgQ)
7387{
7388
7389 tpDelStaSelfParams pDelStaSelfParams;
7390 tSirMsgQ mmhMsg;
7391 tpSirSmeDelStaSelfRsp pRsp;
7392
7393
7394 pDelStaSelfParams = (tpDelStaSelfParams)limMsgQ->bodyptr;
7395
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307396 pRsp = vos_mem_malloc(sizeof(tSirSmeDelStaSelfRsp));
7397 if ( NULL == pRsp )
Jeff Johnson295189b2012-06-20 16:38:30 -07007398 {
7399 /// Buffer not available. Log error
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307400 limLog(pMac, LOGP, FL("call to AllocateMemory failed for Add Sta self RSP"));
7401 vos_mem_free(pDelStaSelfParams);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08007402 limMsgQ->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07007403 return;
7404 }
7405
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307406 vos_mem_set((tANI_U8*)pRsp, sizeof(tSirSmeDelStaSelfRsp), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07007407
7408 pRsp->mesgType = eWNI_SME_DEL_STA_SELF_RSP;
7409 pRsp->mesgLen = (tANI_U16) sizeof(tSirSmeDelStaSelfRsp);
7410 pRsp->status = pDelStaSelfParams->status;
7411
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307412 vos_mem_copy( pRsp->selfMacAddr, pDelStaSelfParams->selfMacAddr, sizeof(tSirMacAddr) );
Jeff Johnson295189b2012-06-20 16:38:30 -07007413
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307414 vos_mem_free(pDelStaSelfParams);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08007415 limMsgQ->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07007416
7417 mmhMsg.type = eWNI_SME_DEL_STA_SELF_RSP;
7418 mmhMsg.bodyptr = pRsp;
7419 mmhMsg.bodyval = 0;
Jeff Johnsone7245742012-09-05 17:12:55 -07007420 MTRACE(macTraceMsgTx(pMac, NO_SESSION, mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07007421 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
7422
7423}
7424
7425/***************************************************************
7426* tANI_U8 limUnmapChannel(tANI_U8 mapChannel)
7427* To unmap the channel to reverse the effect of mapping
7428* a band channel in hal .Mapping was done hal to overcome the
7429* limitation of the rxbd which use only 4 bit for channel number.
7430*****************************************************************/
7431tANI_U8 limUnmapChannel(tANI_U8 mapChannel)
7432{
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07007433#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
Manjunathappa Prakasheb5a3a32014-02-13 19:57:55 -08007434 if( mapChannel > 0 && mapChannel < aUnsortedChannelListSize )
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07007435 if (IS_ROAM_SCAN_OFFLOAD_FEATURE_ENABLE)
7436 return aUnsortedChannelList[mapChannel -1];
7437 else
Manjunathappa Prakasheb5a3a32014-02-13 19:57:55 -08007438#else
7439 if( mapChannel > 0 && mapChannel < abChannelSize )
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07007440#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07007441 return abChannel[mapChannel -1];
7442 else
7443 return 0;
7444}
7445
7446
7447v_U8_t* limGetIEPtr(tpAniSirGlobal pMac, v_U8_t *pIes, int length, v_U8_t eid,eSizeOfLenField size_of_len_field)
7448{
7449 int left = length;
7450 v_U8_t *ptr = pIes;
7451 v_U8_t elem_id;
7452 v_U16_t elem_len;
7453
7454 while(left >= (size_of_len_field+1))
7455 {
7456 elem_id = ptr[0];
7457 if (size_of_len_field == TWO_BYTE)
7458 {
7459 elem_len = ((v_U16_t) ptr[1]) | (ptr[2]<<8);
7460 }
7461 else
7462 {
7463 elem_len = ptr[1];
7464 }
7465
7466
7467 left -= (size_of_len_field+1);
7468 if(elem_len > left)
7469 {
7470 limLog(pMac, LOGE,
Madan Mohan Koyyalamudi8bdd3112012-09-24 13:55:14 -07007471 FL("****Invalid IEs eid = %d elem_len=%d left=%d*****"),
Jeff Johnson295189b2012-06-20 16:38:30 -07007472 eid,elem_len,left);
7473 return NULL;
7474 }
7475 if (elem_id == eid)
7476 {
7477 return ptr;
7478 }
7479
7480 left -= elem_len;
7481 ptr += (elem_len + (size_of_len_field+1));
7482 }
7483 return NULL;
7484}
7485
7486/* return NULL if oui is not found in ie
7487 return !NULL pointer to vendor IE (starting from 0xDD) if oui is found
7488 */
7489v_U8_t* limGetVendorIEOuiPtr(tpAniSirGlobal pMac, tANI_U8 *oui, tANI_U8 oui_size, tANI_U8 *ie, tANI_U16 ie_len)
7490{
7491 int left = ie_len;
7492 v_U8_t *ptr = ie;
7493 v_U8_t elem_id, elem_len;
7494
7495 while(left >= 2)
7496 {
7497 elem_id = ptr[0];
7498 elem_len = ptr[1];
7499 left -= 2;
7500 if(elem_len > left)
7501 {
7502 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007503 FL("****Invalid IEs eid = %d elem_len=%d left=%d*****"),
Jeff Johnson295189b2012-06-20 16:38:30 -07007504 elem_id,elem_len,left);
7505 return NULL;
7506 }
7507 if (SIR_MAC_EID_VENDOR == elem_id)
7508 {
7509 if(memcmp(&ptr[2], oui, oui_size)==0)
7510 return ptr;
7511 }
7512
7513 left -= elem_len;
7514 ptr += (elem_len + 2);
7515 }
7516 return NULL;
7517}
7518
Jeff Johnson295189b2012-06-20 16:38:30 -07007519//Returns length of P2P stream and Pointer ie passed to this function is filled with noa stream
7520
7521v_U8_t limBuildP2pIe(tpAniSirGlobal pMac, tANI_U8 *ie, tANI_U8 *data, tANI_U8 ie_len)
7522{
7523 int length = 0;
7524 tANI_U8 *ptr = ie;
7525
7526 ptr[length++] = SIR_MAC_EID_VENDOR;
7527 ptr[length++] = ie_len + SIR_MAC_P2P_OUI_SIZE;
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307528 vos_mem_copy(&ptr[length], SIR_MAC_P2P_OUI, SIR_MAC_P2P_OUI_SIZE);
7529 vos_mem_copy(&ptr[length + SIR_MAC_P2P_OUI_SIZE], data, ie_len);
Jeff Johnson295189b2012-06-20 16:38:30 -07007530 return (ie_len + SIR_P2P_IE_HEADER_LEN);
7531}
7532
7533//Returns length of NoA stream and Pointer pNoaStream passed to this function is filled with noa stream
7534
7535v_U8_t limGetNoaAttrStreamInMultP2pIes(tpAniSirGlobal pMac,v_U8_t* noaStream,v_U8_t noaLen,v_U8_t overFlowLen)
7536{
7537 v_U8_t overFlowP2pStream[SIR_MAX_NOA_ATTR_LEN];
Krunal Sonic768a932013-05-15 19:26:30 -07007538
7539 if ((noaLen <= (SIR_MAX_NOA_ATTR_LEN+SIR_P2P_IE_HEADER_LEN)) &&
7540 (noaLen >= overFlowLen) && (overFlowLen <= SIR_MAX_NOA_ATTR_LEN))
7541 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307542 vos_mem_copy(overFlowP2pStream,
Krunal Sonic768a932013-05-15 19:26:30 -07007543 noaStream + noaLen - overFlowLen, overFlowLen);
7544 noaStream[noaLen - overFlowLen] = SIR_MAC_EID_VENDOR;
7545 noaStream[noaLen - overFlowLen + 1] = overFlowLen + SIR_MAC_P2P_OUI_SIZE;
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307546 vos_mem_copy(noaStream+noaLen-overFlowLen + 2,
Krunal Sonic768a932013-05-15 19:26:30 -07007547 SIR_MAC_P2P_OUI, SIR_MAC_P2P_OUI_SIZE);
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307548 vos_mem_copy(noaStream+noaLen + 2 + SIR_MAC_P2P_OUI_SIZE - overFlowLen,
7549 overFlowP2pStream, overFlowLen);
Krunal Sonic768a932013-05-15 19:26:30 -07007550 }
7551
Jeff Johnson295189b2012-06-20 16:38:30 -07007552 return (noaLen + SIR_P2P_IE_HEADER_LEN);
7553
7554}
7555
7556//Returns length of NoA stream and Pointer pNoaStream passed to this function is filled with noa stream
7557v_U8_t limGetNoaAttrStream(tpAniSirGlobal pMac, v_U8_t*pNoaStream,tpPESession psessionEntry)
7558{
7559 v_U8_t len=0;
7560
7561 v_U8_t *pBody = pNoaStream;
7562
7563
7564 if ( (psessionEntry != NULL) && (psessionEntry->valid) &&
7565 (psessionEntry->pePersona == VOS_P2P_GO_MODE))
7566 {
7567 if ((!(psessionEntry->p2pGoPsUpdate.uNoa1Duration)) && (!(psessionEntry->p2pGoPsUpdate.uNoa2Duration))
7568 && (!psessionEntry->p2pGoPsUpdate.oppPsFlag)
7569 )
7570 return 0; //No NoA Descriptor then return 0
7571
7572
7573 pBody[0] = SIR_P2P_NOA_ATTR;
7574
7575 pBody[3] = psessionEntry->p2pGoPsUpdate.index;
7576 pBody[4] = psessionEntry->p2pGoPsUpdate.ctWin | (psessionEntry->p2pGoPsUpdate.oppPsFlag<<7);
7577 len = 5;
7578 pBody += len;
7579
7580
7581 if (psessionEntry->p2pGoPsUpdate.uNoa1Duration)
7582 {
7583 *pBody = psessionEntry->p2pGoPsUpdate.uNoa1IntervalCnt;
7584 pBody += 1;
7585 len +=1;
7586
7587 *((tANI_U32 *)(pBody)) = sirSwapU32ifNeeded(psessionEntry->p2pGoPsUpdate.uNoa1Duration);
7588 pBody += sizeof(tANI_U32);
7589 len +=4;
7590
7591 *((tANI_U32 *)(pBody)) = sirSwapU32ifNeeded(psessionEntry->p2pGoPsUpdate.uNoa1Interval);
7592 pBody += sizeof(tANI_U32);
7593 len +=4;
7594
7595 *((tANI_U32 *)(pBody)) = sirSwapU32ifNeeded(psessionEntry->p2pGoPsUpdate.uNoa1StartTime);
7596 pBody += sizeof(tANI_U32);
7597 len +=4;
7598
7599 }
7600
7601 if (psessionEntry->p2pGoPsUpdate.uNoa2Duration)
7602 {
7603 *pBody = psessionEntry->p2pGoPsUpdate.uNoa2IntervalCnt;
7604 pBody += 1;
7605 len +=1;
7606
7607 *((tANI_U32 *)(pBody)) = sirSwapU32ifNeeded(psessionEntry->p2pGoPsUpdate.uNoa2Duration);
7608 pBody += sizeof(tANI_U32);
7609 len +=4;
7610
7611 *((tANI_U32 *)(pBody)) = sirSwapU32ifNeeded(psessionEntry->p2pGoPsUpdate.uNoa2Interval);
7612 pBody += sizeof(tANI_U32);
7613 len +=4;
7614
7615 *((tANI_U32 *)(pBody)) = sirSwapU32ifNeeded(psessionEntry->p2pGoPsUpdate.uNoa2StartTime);
7616 pBody += sizeof(tANI_U32);
7617 len +=4;
7618
7619 }
7620
7621
7622 pBody = pNoaStream + 1;
7623 *((tANI_U16 *)(pBody)) = sirSwapU16ifNeeded(len-3);/*one byte for Attr and 2 bytes for length*/
7624
7625 return (len);
7626
7627 }
7628 return 0;
7629
7630}
Jeff Johnsone7245742012-09-05 17:12:55 -07007631
7632void peSetResumeChannel(tpAniSirGlobal pMac, tANI_U16 channel, ePhyChanBondState phyCbState)
Jeff Johnson295189b2012-06-20 16:38:30 -07007633{
7634
7635 pMac->lim.gResumeChannel = channel;
Jeff Johnsone7245742012-09-05 17:12:55 -07007636 pMac->lim.gResumePhyCbState = phyCbState;
Jeff Johnson295189b2012-06-20 16:38:30 -07007637}
Jeff Johnsone7245742012-09-05 17:12:55 -07007638
Jeff Johnson295189b2012-06-20 16:38:30 -07007639/*--------------------------------------------------------------------------
7640
7641 \brief peGetResumeChannel() - Returns the channel number for scanning, from a valid session.
7642
Jeff Johnsone7245742012-09-05 17:12:55 -07007643 This function returns the channel to resume to during link resume. channel id of 0 means HAL will
7644 resume to previous channel before link suspend
Jeff Johnson295189b2012-06-20 16:38:30 -07007645
7646 \param pMac - pointer to global adapter context
7647 \return - channel to scan from valid session else zero.
7648
7649 \sa
7650
7651 --------------------------------------------------------------------------*/
Jeff Johnsone7245742012-09-05 17:12:55 -07007652void peGetResumeChannel(tpAniSirGlobal pMac, tANI_U8* resumeChannel, ePhyChanBondState* resumePhyCbState)
Jeff Johnson295189b2012-06-20 16:38:30 -07007653{
7654
7655 //Rationale - this could be the suspend/resume for assoc and it is essential that
7656 //the new BSS is active for some time. Other BSS was anyway suspended.
7657 //TODO: Comeup with a better alternative. Sending NULL with PM=0 on other BSS means
7658 //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 -07007659 //and hence should be ok. Need to discuss this further
7660 if( !limIsInMCC(pMac) )
Jeff Johnson295189b2012-06-20 16:38:30 -07007661 {
7662 //Get current active session channel
Jeff Johnsone7245742012-09-05 17:12:55 -07007663 peGetActiveSessionChannel(pMac, resumeChannel, resumePhyCbState);
Jeff Johnson295189b2012-06-20 16:38:30 -07007664 }
7665 else
7666 {
Jeff Johnsone7245742012-09-05 17:12:55 -07007667 *resumeChannel = pMac->lim.gResumeChannel;
7668 *resumePhyCbState = pMac->lim.gResumePhyCbState;
Jeff Johnson295189b2012-06-20 16:38:30 -07007669 }
Jeff Johnsone7245742012-09-05 17:12:55 -07007670 return;
Jeff Johnson295189b2012-06-20 16:38:30 -07007671}
7672
Viral Modid86bde22012-12-10 13:09:21 -08007673tANI_BOOLEAN limIsNOAInsertReqd(tpAniSirGlobal pMac)
7674{
7675 tANI_U8 i;
7676 for(i =0; i < pMac->lim.maxBssId; i++)
7677 {
7678 if(pMac->lim.gpSession[i].valid == TRUE)
7679 {
7680 if( (eLIM_AP_ROLE == pMac->lim.gpSession[i].limSystemRole )
7681 && ( VOS_P2P_GO_MODE == pMac->lim.gpSession[i].pePersona )
7682 )
7683 {
7684 return TRUE;
7685 }
7686 }
7687 }
7688 return FALSE;
7689}
Jeff Johnsone7245742012-09-05 17:12:55 -07007690
Jeff Johnson295189b2012-06-20 16:38:30 -07007691
7692tANI_BOOLEAN limIsconnectedOnDFSChannel(tANI_U8 currentChannel)
7693{
7694 if(NV_CHANNEL_DFS == vos_nv_getChannelEnabledState(currentChannel))
7695 {
7696 return eANI_BOOLEAN_TRUE;
7697 }
7698 else
7699 {
7700 return eANI_BOOLEAN_FALSE;
7701 }
7702}
Madan Mohan Koyyalamudi1bed5982012-10-22 14:38:06 -07007703
Sandeep Puligilla60342762014-01-30 21:05:37 +05307704/**
7705 * \brief verify the changes in channel bonding
7706 *
7707 * \param pMac Pointer to the global MAC structure
7708 *
7709 * \param psessionEntry session entry
7710 * beaconSecChanWidth Secondary channel width
7711 * advertized in beacon
7712 * currentSecChanWidth Current configured width
7713 * staId Station Id
7714 * \return eSIR_SUCCESS on success, eSIR_FAILURE else
7715 */
7716tANI_BOOLEAN limCheckHTChanBondModeChange(tpAniSirGlobal pMac,
7717 tpPESession psessionEntry,
7718 tANI_U8 beaconSecChanWidth,
7719 tANI_U8 currentSecChanWidth,
7720 tANI_U8 staId)
7721{
7722 tUpdateVHTOpMode tempParam;
7723 tANI_BOOLEAN fCbMode24G = FALSE;
7724 tANI_BOOLEAN status = eANI_BOOLEAN_FALSE;
7725
7726 /* Moving from HT40 to HT20 operation*/
7727 if (((PHY_DOUBLE_CHANNEL_LOW_PRIMARY == currentSecChanWidth) ||
7728 (PHY_DOUBLE_CHANNEL_HIGH_PRIMARY == currentSecChanWidth))
7729 && (PHY_SINGLE_CHANNEL_CENTERED == beaconSecChanWidth))
7730 {
7731 tempParam.opMode = eHT_CHANNEL_WIDTH_20MHZ;
7732 tempParam.staId = staId;
7733 fCbMode24G = TRUE;
7734 }
7735
7736 /* Moving from HT20 to HT40 operation*/
7737 if ((( PHY_DOUBLE_CHANNEL_LOW_PRIMARY == beaconSecChanWidth) ||
7738 ( PHY_DOUBLE_CHANNEL_HIGH_PRIMARY == beaconSecChanWidth ))
7739 && (PHY_SINGLE_CHANNEL_CENTERED == currentSecChanWidth))
7740 {
7741 tempParam.opMode = eHT_CHANNEL_WIDTH_40MHZ;
7742 tempParam.staId = staId;
7743 fCbMode24G = TRUE;
7744 }
7745
7746 if (TRUE == fCbMode24G)
7747 {
7748 VOS_TRACE( VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,
7749 "Changing CBMODE to = %d staId = %d",
7750 tempParam.opMode, tempParam.staId );
7751 if( eSIR_SUCCESS == limSendModeUpdate(pMac, &tempParam, psessionEntry))
7752 status = eANI_BOOLEAN_TRUE;
7753 }
7754 return status;
7755}
7756
Mohit Khanna4a70d262012-09-11 16:30:12 -07007757#ifdef WLAN_FEATURE_11AC
7758tANI_BOOLEAN limCheckVHTOpModeChange( tpAniSirGlobal pMac, tpPESession psessionEntry, tANI_U8 chanWidth, tANI_U8 staId)
7759{
7760 tUpdateVHTOpMode tempParam;
7761
7762 tempParam.opMode = chanWidth;
7763 tempParam.staId = staId;
7764
7765 limSendModeUpdate( pMac, &tempParam, psessionEntry );
7766
7767 return eANI_BOOLEAN_TRUE;
7768}
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -07007769#endif
7770
7771tANI_U8 limGetShortSlotFromPhyMode(tpAniSirGlobal pMac, tpPESession psessionEntry, tANI_U32 phyMode)
7772{
7773 tANI_U8 val=0;
7774
7775 if (phyMode == WNI_CFG_PHY_MODE_11A)
7776 {
7777 // 11a mode always uses short slot
7778 // Check this since some APs in 11a mode broadcast long slot in their beacons. As per standard, always use what PHY mandates.
7779 val = true;
7780 }
7781 else if (phyMode == WNI_CFG_PHY_MODE_11G)
7782 {
7783 if ((psessionEntry->pePersona == VOS_STA_SAP_MODE) ||
Ravi Joshi27216f12013-10-19 17:04:39 -07007784 (psessionEntry->pePersona == VOS_IBSS_MODE) ||
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -07007785 (psessionEntry->pePersona == VOS_P2P_GO_MODE))
7786 {
7787 val = true;
7788 }
7789
7790 // Program Polaris based on AP capability
7791
7792 if (psessionEntry->limMlmState == eLIM_MLM_WT_JOIN_BEACON_STATE)
7793 // Joining BSS.
7794 val = SIR_MAC_GET_SHORT_SLOT_TIME( psessionEntry->limCurrentBssCaps);
7795 else if (psessionEntry->limMlmState == eLIM_MLM_WT_REASSOC_RSP_STATE)
7796 // Reassociating with AP.
7797 val = SIR_MAC_GET_SHORT_SLOT_TIME( psessionEntry->limReassocBssCaps);
7798 }
7799 else // if (phyMode == WNI_CFG_PHY_MODE_11B) - use this if another phymode is added later ON
7800 {
7801 // Will reach here in 11b case
7802 val = false;
7803 }
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007804 limLog(pMac, LOG1, FL("phyMode = %u shortslotsupported = %u"), phyMode, val);
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -07007805 return val;
7806}
Sandeep Puligilla11d49a62014-01-30 12:05:16 +05307807
7808/**--------------------------------------------
7809\fn limUpdateOBSSScanParams
7810\brief Updates OBSS SCAN IE parameters to session
7811
7812\param psessionEntry - Session Entry
7813\return NONE
7814---------------------------------------------*/
7815void limUpdateOBSSScanParams(tpPESession psessionEntry ,
7816 tDot11fIEOBSSScanParameters *pOBSSScanParameters)
7817{
7818 /*If the recieved value is not in the range specified by the Specification
7819 then it will be the default value configured through cfg */
7820 if (( pOBSSScanParameters->obssScanActiveDwell >
7821 WNI_CFG_OBSS_HT40_SCAN_ACTIVE_DWELL_TIME_STAMIN ) &&
7822 ( pOBSSScanParameters->obssScanActiveDwell <
7823 WNI_CFG_OBSS_HT40_SCAN_ACTIVE_DWELL_TIME_STAMAX))
7824 {
7825 psessionEntry->obssHT40ScanParam.OBSSScanActiveDwellTime=
7826 pOBSSScanParameters->obssScanActiveDwell;
7827 }
7828 if((pOBSSScanParameters->obssScanPassiveDwell >
7829 WNI_CFG_OBSS_HT40_SCAN_PASSIVE_DWELL_TIME_STAMIN ) &&
7830 (pOBSSScanParameters->obssScanPassiveDwell <
7831 WNI_CFG_OBSS_HT40_SCAN_PASSIVE_DWELL_TIME_STAMAX))
7832 {
7833 psessionEntry->obssHT40ScanParam.OBSSScanPassiveDwellTime =
7834 pOBSSScanParameters->obssScanPassiveDwell;
7835 }
7836 if((pOBSSScanParameters->bssWidthChannelTransitionDelayFactor >
7837 WNI_CFG_OBSS_HT40_WIDTH_CHANNEL_TRANSITION_DELAY_FACTOR_STAMIN) &&
7838 (pOBSSScanParameters->bssWidthChannelTransitionDelayFactor <
7839 WNI_CFG_OBSS_HT40_WIDTH_CHANNEL_TRANSITION_DELAY_FACTOR_STAMAX))
7840 {
7841 psessionEntry->obssHT40ScanParam.BSSWidthChannelTransitionDelayFactor =
7842 pOBSSScanParameters->bssWidthChannelTransitionDelayFactor;
7843 }
7844 if((pOBSSScanParameters->obssScanActiveTotalPerChannel >
7845 WNI_CFG_OBSS_HT40_SCAN_ACTIVE_TOTAL_PER_CHANNEL_STAMIN) &&
7846 (pOBSSScanParameters->obssScanActiveTotalPerChannel <
7847 WNI_CFG_OBSS_HT40_SCAN_ACTIVE_TOTAL_PER_CHANNEL_STAMAX))
7848 {
7849 psessionEntry->obssHT40ScanParam.OBSSScanActiveTotalPerChannel =
7850 pOBSSScanParameters->obssScanActiveTotalPerChannel;
7851 }
7852 if((pOBSSScanParameters->obssScanPassiveTotalPerChannel >
7853 WNI_CFG_OBSS_HT40_SCAN_PASSIVE_TOTAL_PER_CHANNEL_STAMIN) &&
7854 (pOBSSScanParameters->obssScanPassiveTotalPerChannel <
7855 WNI_CFG_OBSS_HT40_SCAN_PASSIVE_TOTAL_PER_CHANNEL_STAMAX))
7856 {
7857 psessionEntry->obssHT40ScanParam.OBSSScanPassiveTotalPerChannel =
7858 pOBSSScanParameters->obssScanPassiveTotalPerChannel;
7859 }
7860 if((pOBSSScanParameters->bssChannelWidthTriggerScanInterval >
7861 WNI_CFG_OBSS_HT40_SCAN_WIDTH_TRIGGER_INTERVAL_STAMIN) &&
7862 (pOBSSScanParameters->bssChannelWidthTriggerScanInterval <
7863 WNI_CFG_OBSS_HT40_SCAN_WIDTH_TRIGGER_INTERVAL_STAMAX))
7864 {
7865 psessionEntry->obssHT40ScanParam.BSSChannelWidthTriggerScanInterval =
7866 pOBSSScanParameters->bssChannelWidthTriggerScanInterval;
7867 }
7868 if((pOBSSScanParameters->obssScanActivityThreshold >
7869 WNI_CFG_OBSS_HT40_SCAN_ACTIVITY_THRESHOLD_STAMIN )&&
7870 (pOBSSScanParameters->obssScanActivityThreshold <
7871 WNI_CFG_OBSS_HT40_SCAN_ACTIVITY_THRESHOLD_STAMAX))
7872 {
7873 psessionEntry->obssHT40ScanParam.OBSSScanActivityThreshold =
7874 pOBSSScanParameters->obssScanActivityThreshold;
7875 }
7876}
Chet Lanctot8cecea22014-02-11 19:09:36 -08007877
7878#ifdef WLAN_FEATURE_11W
7879void limPmfSaQueryTimerHandler(void *pMacGlobal, tANI_U32 param)
7880{
7881 tpAniSirGlobal pMac = (tpAniSirGlobal)pMacGlobal;
7882 tPmfSaQueryTimerId timerId;
7883 tpPESession psessionEntry;
7884 tpDphHashNode pSta;
7885 tANI_U32 maxRetries;
7886
7887 limLog(pMac, LOG1, FL("SA Query timer fires"));
7888 timerId.value = param;
7889
7890 // Check that SA Query is in progress
7891 if ((psessionEntry = peFindSessionBySessionId(
7892 pMac, timerId.fields.sessionId)) == NULL)
7893 {
7894 limLog(pMac, LOGE, FL("Session does not exist for given session ID %d"),
7895 timerId.fields.sessionId);
7896 pSta->pmfSaQueryState = DPH_SA_QUERY_NOT_IN_PROGRESS;
7897 return;
7898 }
7899 if ((pSta = dphGetHashEntry(pMac, timerId.fields.peerIdx,
7900 &psessionEntry->dph.dphHashTable)) == NULL)
7901 {
7902 limLog(pMac, LOGE, FL("Entry does not exist for given peer index %d"),
7903 timerId.fields.peerIdx);
7904 pSta->pmfSaQueryState = DPH_SA_QUERY_NOT_IN_PROGRESS;
7905 return;
7906 }
7907 if (DPH_SA_QUERY_IN_PROGRESS != pSta->pmfSaQueryState)
7908 return;
7909
7910 // Increment the retry count, check if reached maximum
7911 if (wlan_cfgGetInt(pMac, WNI_CFG_PMF_SA_QUERY_MAX_RETRIES,
7912 &maxRetries) != eSIR_SUCCESS)
7913 {
7914 limLog(pMac, LOGE, FL("Could not retrieve PMF SA Query maximum retries value"));
7915 pSta->pmfSaQueryState = DPH_SA_QUERY_NOT_IN_PROGRESS;
7916 return;
7917 }
7918 pSta->pmfSaQueryRetryCount++;
7919 if (pSta->pmfSaQueryRetryCount >= maxRetries)
7920 {
7921 limLog(pMac, LOG1, FL("SA Query timed out"));
7922 /* remove before submission */
7923 limLog(pMac, LOGE, FL("SA Query timed out"));
7924 pSta->pmfSaQueryState = DPH_SA_QUERY_TIMED_OUT;
7925 return;
7926 }
7927
7928 // Retry SA Query
7929 limSendSaQueryRequestFrame(pMac, (tANI_U8 *)&(pSta->pmfSaQueryCurrentTransId),
7930 pSta->staAddr, psessionEntry);
7931 pSta->pmfSaQueryCurrentTransId++;
7932 /* remove before submission */
7933 limLog(pMac, LOGE, FL("Starting SA Query retry %d"), pSta->pmfSaQueryRetryCount);
7934 if (tx_timer_activate(&pSta->pmfSaQueryTimer) != TX_SUCCESS)
7935 {
7936 limLog(pMac, LOGE, FL("PMF SA Query timer activation failed!"));
7937 pSta->pmfSaQueryState = DPH_SA_QUERY_NOT_IN_PROGRESS;
7938 }
7939}
7940#endif
7941