blob: 4f2bd032d44ce103aae4ded74c2af2e25ca31d96 [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
Kalikinkar dhara085c02f2014-02-28 15:32:12 -080028
Kiet Lam842dad02014-02-18 18:44:02 -080029/*
Jeff Johnson295189b2012-06-20 16:38:30 -070030 * This file limUtils.cc contains the utility functions
31 * LIM uses.
32 * Author: Chandra Modumudi
33 * Date: 02/13/02
34 * History:-
35 * Date Modified by Modification Information
36 * --------------------------------------------------------------------
37 */
38
39#include "schApi.h"
40#include "limUtils.h"
41#include "limTypes.h"
42#include "limSecurityUtils.h"
43#include "limPropExtsUtils.h"
44#include "limSendMessages.h"
45#include "limSerDesUtils.h"
46#include "limAdmitControl.h"
47#include "limStaHashApi.h"
48#include "dot11f.h"
Kalikinkar dhara205da782014-03-21 15:49:32 -070049#include "dot11fdefs.h"
Jeff Johnson295189b2012-06-20 16:38:30 -070050#include "wmmApsd.h"
51#include "limTrace.h"
Jeff Johnson77165482013-03-07 08:15:44 -080052#ifdef FEATURE_WLAN_DIAG_SUPPORT
Jeff Johnson295189b2012-06-20 16:38:30 -070053#include "vos_diag_core_event.h"
54#endif //FEATURE_WLAN_DIAG_SUPPORT
55#include "limIbssPeerMgmt.h"
56#include "limSessionUtils.h"
57#include "limSession.h"
58#include "vos_nvitem.h"
Chet Lanctot8cecea22014-02-11 19:09:36 -080059#ifdef WLAN_FEATURE_11W
60#include "wniCfgAp.h"
61#endif
Jeff Johnson295189b2012-06-20 16:38:30 -070062
63/* Static global used to mark situations where pMac->lim.gLimTriggerBackgroundScanDuringQuietBss is SET
64 * and limTriggerBackgroundScanDuringQuietBss() returned failure. In this case, we will stop data
65 * traffic instead of going into scan. The recover function limProcessQuietBssTimeout() needs to have
66 * this information. */
67static tAniBool glimTriggerBackgroundScanDuringQuietBss_Status = eSIR_TRUE;
68
69/* 11A Channel list to decode RX BD channel information */
70static const tANI_U8 abChannel[]= {36,40,44,48,52,56,60,64,100,104,108,112,116,
Arif Hussain6af38622014-03-12 12:39:57 -070071 120,124,128,132,136,140,149,153,157,161,165,144};
Manjunathappa Prakasheb5a3a32014-02-13 19:57:55 -080072#define abChannelSize (sizeof(abChannel)/ \
73 sizeof(abChannel[0]))
Jeff Johnson295189b2012-06-20 16:38:30 -070074
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -070075#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
76static const tANI_U8 aUnsortedChannelList[]= {52,56,60,64,100,104,108,112,116,
Arif Hussain6af38622014-03-12 12:39:57 -070077 120,124,128,132,136,140,36,40,44,48,149,153,157,161,165,144};
Manjunathappa Prakasheb5a3a32014-02-13 19:57:55 -080078#define aUnsortedChannelListSize (sizeof(aUnsortedChannelList)/ \
79 sizeof(aUnsortedChannelList[0]))
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -070080#endif
81
Arif Hussain6af38622014-03-12 12:39:57 -070082//#define LIM_MAX_ACTIVE_SESSIONS 3 //defined temporarily for BT-AMP SUPPORT
Jeff Johnson295189b2012-06-20 16:38:30 -070083#define SUCCESS 1 //defined temporarily for BT-AMP
84
Agarwal Ashish87039eb2014-01-15 14:13:15 +053085#define MAX_BA_WINDOW_SIZE_FOR_CISCO 25
Kalikinkar dhara085c02f2014-02-28 15:32:12 -080086static void
87limProcessChannelSwitchSuspendLink(tpAniSirGlobal pMac,
88 eHalStatus status,
89 tANI_U32 *ctx);
Jeff Johnson295189b2012-06-20 16:38:30 -070090/** -------------------------------------------------------------
91\fn limAssignDialogueToken
92\brief Assigns dialogue token.
93\param tpAniSirGlobal pMac
94\return tpDialogueToken - dialogueToken data structure.
95 -------------------------------------------------------------*/
96
97tpDialogueToken
98limAssignDialogueToken(tpAniSirGlobal pMac)
99{
Madan Mohan Koyyalamudidfd6aa82012-10-18 20:18:43 -0700100 static tANI_U8 token;
Jeff Johnson295189b2012-06-20 16:38:30 -0700101 tpDialogueToken pCurrNode;
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530102 pCurrNode = vos_mem_malloc(sizeof(tDialogueToken));
103 if ( NULL == pCurrNode )
Jeff Johnson295189b2012-06-20 16:38:30 -0700104 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530105 PELOGE(limLog(pMac, LOGE, FL("AllocateMemory failed"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700106 return NULL;
107 }
108
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530109 vos_mem_set((void *) pCurrNode, sizeof(tDialogueToken), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -0700110 //first node in the list is being added.
111 if(NULL == pMac->lim.pDialogueTokenHead)
112 {
113 pMac->lim.pDialogueTokenHead = pMac->lim.pDialogueTokenTail = pCurrNode;
114 }
115 else
116 {
117 pMac->lim.pDialogueTokenTail->next = pCurrNode;
118 pMac->lim.pDialogueTokenTail = pCurrNode;
119 }
120 //assocId and tid of the node will be filled in by caller.
121 pCurrNode->next = NULL;
122 pCurrNode->token = token++;
Praveen Kumar Sirisilla539f7422013-08-28 17:01:05 -0700123
124 /* Dialog token should be a non-zero value */
125 if (0 == pCurrNode->token)
126 pCurrNode->token = token;
127
128 PELOG4(limLog(pMac, LOG4, FL("token assigned = %d"), pCurrNode->token);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700129 return pCurrNode;
130}
131
132/** -------------------------------------------------------------
133\fn limSearchAndDeleteDialogueToken
134\brief search dialogue token in the list and deletes it if found. returns failure if not found.
135\param tpAniSirGlobal pMac
136\param tANI_U8 token
137\param tANI_U16 assocId
138\param tANI_U16 tid
139\return eSirRetStatus - status of the search
140 -------------------------------------------------------------*/
141
142
143tSirRetStatus
144limSearchAndDeleteDialogueToken(tpAniSirGlobal pMac, tANI_U8 token, tANI_U16 assocId, tANI_U16 tid)
145{
146 tpDialogueToken pCurrNode = pMac->lim.pDialogueTokenHead;
147 tpDialogueToken pPrevNode = pMac->lim.pDialogueTokenHead;
148
149 //if the list is empty
150 if(NULL == pCurrNode)
151 return eSIR_FAILURE;
152
153 // if the matching node is the first node.
154 if(pCurrNode &&
155 (assocId == pCurrNode->assocId) &&
156 (tid == pCurrNode->tid))
157 {
158 pMac->lim.pDialogueTokenHead = pCurrNode->next;
159 //there was only one node in the list. So tail pointer also needs to be adjusted.
160 if(NULL == pMac->lim.pDialogueTokenHead)
161 pMac->lim.pDialogueTokenTail = NULL;
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530162 vos_mem_free(pCurrNode);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -0800163 pMac->lim.pDialogueTokenHead = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -0700164 return eSIR_SUCCESS;
165 }
166
167 //first node did not match. so move to the next one.
168 pCurrNode = pCurrNode->next;
169 while(NULL != pCurrNode )
170 {
171 if(token == pCurrNode->token)
172 {
173 break;
174 }
175
176 pPrevNode = pCurrNode;
177 pCurrNode = pCurrNode->next;
178 }
179
180 if(pCurrNode &&
181 (assocId == pCurrNode->assocId) &&
182 (tid == pCurrNode->tid))
183 {
184 pPrevNode->next = pCurrNode->next;
185 //if the node being deleted is the last one then we also need to move the tail pointer to the prevNode.
186 if(NULL == pCurrNode->next)
187 pMac->lim.pDialogueTokenTail = pPrevNode;
Kiet Lam842c3e12013-11-16 22:40:57 +0530188 vos_mem_free(pCurrNode);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -0800189 pMac->lim.pDialogueTokenHead = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -0700190 return eSIR_SUCCESS;
191 }
192
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700193 PELOGW(limLog(pMac, LOGW, FL("LIM does not have matching dialogue token node"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700194 return eSIR_FAILURE;
195
196}
197
198
199/** -------------------------------------------------------------
200\fn limDeleteDialogueTokenList
201\brief deletes the complete lim dialogue token linked list.
202\param tpAniSirGlobal pMac
203\return None
204 -------------------------------------------------------------*/
205void
206limDeleteDialogueTokenList(tpAniSirGlobal pMac)
207{
208 tpDialogueToken pCurrNode = pMac->lim.pDialogueTokenHead;
209
210 while(NULL != pMac->lim.pDialogueTokenHead)
211 {
212 pCurrNode = pMac->lim.pDialogueTokenHead;
213 pMac->lim.pDialogueTokenHead = pMac->lim.pDialogueTokenHead->next;
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530214 vos_mem_free(pCurrNode);
Jeff Johnson295189b2012-06-20 16:38:30 -0700215 pCurrNode = NULL;
216 }
217 pMac->lim.pDialogueTokenTail = NULL;
218}
219
220void
221limGetBssidFromBD(tpAniSirGlobal pMac, tANI_U8 * pRxPacketInfo, tANI_U8 *bssId, tANI_U32 *pIgnore)
222{
223 tpSirMacDataHdr3a pMh = WDA_GET_RX_MPDUHEADER3A(pRxPacketInfo);
224 *pIgnore = 0;
225
226 if (pMh->fc.toDS == 1 && pMh->fc.fromDS == 0)
227 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530228 vos_mem_copy( bssId, pMh->addr1, 6);
Jeff Johnson295189b2012-06-20 16:38:30 -0700229 *pIgnore = 1;
230 }
231 else if (pMh->fc.toDS == 0 && pMh->fc.fromDS == 1)
232 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530233 vos_mem_copy ( bssId, pMh->addr2, 6);
Jeff Johnson295189b2012-06-20 16:38:30 -0700234 *pIgnore = 1;
235 }
236 else if (pMh->fc.toDS == 0 && pMh->fc.fromDS == 0)
237 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530238 vos_mem_copy( bssId, pMh->addr3, 6);
Jeff Johnson295189b2012-06-20 16:38:30 -0700239 *pIgnore = 0;
240 }
241 else
242 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530243 vos_mem_copy( bssId, pMh->addr1, 6);
Jeff Johnson295189b2012-06-20 16:38:30 -0700244 *pIgnore = 1;
245 }
246}
247
248char *
249limMlmStateStr(tLimMlmStates state)
250{
Jeff Johnson295189b2012-06-20 16:38:30 -0700251 switch (state)
252 {
253 case eLIM_MLM_OFFLINE_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700254 return "eLIM_MLM_OFFLINE_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700255 case eLIM_MLM_IDLE_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700256 return "eLIM_MLM_IDLE_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700257 case eLIM_MLM_WT_PROBE_RESP_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700258 return "eLIM_MLM_WT_PROBE_RESP_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700259 case eLIM_MLM_PASSIVE_SCAN_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700260 return "eLIM_MLM_PASSIVE_SCAN_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700261 case eLIM_MLM_WT_JOIN_BEACON_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700262 return "eLIM_MLM_WT_JOIN_BEACON_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700263 case eLIM_MLM_JOINED_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700264 return "eLIM_MLM_JOINED_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700265 case eLIM_MLM_BSS_STARTED_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700266 return "eLIM_MLM_BSS_STARTED_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700267 case eLIM_MLM_WT_AUTH_FRAME2_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700268 return "eLIM_MLM_WT_AUTH_FRAME2_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700269 case eLIM_MLM_WT_AUTH_FRAME3_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700270 return "eLIM_MLM_WT_AUTH_FRAME3_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700271 case eLIM_MLM_WT_AUTH_FRAME4_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700272 return "eLIM_MLM_WT_AUTH_FRAME4_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700273 case eLIM_MLM_AUTH_RSP_TIMEOUT_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700274 return "eLIM_MLM_AUTH_RSP_TIMEOUT_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700275 case eLIM_MLM_AUTHENTICATED_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700276 return "eLIM_MLM_AUTHENTICATED_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700277 case eLIM_MLM_WT_ASSOC_RSP_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700278 return "eLIM_MLM_WT_ASSOC_RSP_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700279 case eLIM_MLM_WT_REASSOC_RSP_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700280 return "eLIM_MLM_WT_REASSOC_RSP_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700281 case eLIM_MLM_WT_FT_REASSOC_RSP_STATE:
282 return "eLIM_MLM_WT_FT_REASSOC_RSP_STATE";
283 case eLIM_MLM_WT_DEL_STA_RSP_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700284 return "eLIM_MLM_WT_DEL_STA_RSP_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700285 case eLIM_MLM_WT_DEL_BSS_RSP_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700286 return "eLIM_MLM_WT_DEL_BSS_RSP_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700287 case eLIM_MLM_WT_ADD_STA_RSP_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700288 return "eLIM_MLM_WT_ADD_STA_RSP_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700289 case eLIM_MLM_WT_ADD_BSS_RSP_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700290 return "eLIM_MLM_WT_ADD_BSS_RSP_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700291 case eLIM_MLM_REASSOCIATED_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700292 return "eLIM_MLM_REASSOCIATED_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700293 case eLIM_MLM_LINK_ESTABLISHED_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700294 return "eLIM_MLM_LINK_ESTABLISHED_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700295 case eLIM_MLM_WT_ASSOC_CNF_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700296 return "eLIM_MLM_WT_ASSOC_CNF_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700297 case eLIM_MLM_WT_ADD_BSS_RSP_ASSOC_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700298 return "eLIM_MLM_WT_ADD_BSS_RSP_ASSOC_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700299 case eLIM_MLM_WT_ADD_BSS_RSP_REASSOC_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700300 return "eLIM_MLM_WT_ADD_BSS_RSP_REASSOC_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700301 case eLIM_MLM_WT_ADD_BSS_RSP_FT_REASSOC_STATE:
302 return "eLIM_MLM_WT_ADD_BSS_RSP_FT_REASSOC_STATE";
303 case eLIM_MLM_WT_ASSOC_DEL_STA_RSP_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700304 return "eLIM_MLM_WT_ASSOC_DEL_STA_RSP_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700305 case eLIM_MLM_WT_SET_BSS_KEY_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700306 return "eLIM_MLM_WT_SET_BSS_KEY_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700307 case eLIM_MLM_WT_SET_STA_KEY_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700308 return "eLIM_MLM_WT_SET_STA_KEY_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700309 default:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700310 return "INVALID MLM state";
Jeff Johnson295189b2012-06-20 16:38:30 -0700311 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700312}
313
314void
315limPrintMlmState(tpAniSirGlobal pMac, tANI_U16 logLevel, tLimMlmStates state)
316{
317 limLog(pMac, logLevel, limMlmStateStr(state));
318}
319
320char *
321limSmeStateStr(tLimSmeStates state)
322{
323#ifdef FIXME_GEN6
324 switch (state)
325 {
326 case eLIM_SME_OFFLINE_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700327 return "eLIM_SME_OFFLINE_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700328 case eLIM_SME_IDLE_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700329 return "eLIM_SME_IDLE_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700330 case eLIM_SME_SUSPEND_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700331 return "eLIM_SME_SUSPEND_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700332 case eLIM_SME_WT_SCAN_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700333 return "eLIM_SME_WT_SCAN_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700334 case eLIM_SME_WT_JOIN_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700335 return "eLIM_SME_WT_JOIN_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700336 case eLIM_SME_WT_AUTH_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700337 return "eLIM_SME_WT_AUTH_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700338 case eLIM_SME_WT_ASSOC_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700339 return "eLIM_SME_WT_ASSOC_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700340 case eLIM_SME_WT_REASSOC_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700341 return "eLIM_SME_WT_REASSOC_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700342 case eLIM_SME_WT_REASSOC_LINK_FAIL_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700343 return "eLIM_SME_WT_REASSOC_LINK_FAIL_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700344 case eLIM_SME_JOIN_FAILURE_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700345 return "eLIM_SME_JOIN_FAILURE_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700346 case eLIM_SME_ASSOCIATED_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700347 return "eLIM_SME_ASSOCIATED_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700348 case eLIM_SME_REASSOCIATED_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700349 return "eLIM_SME_REASSOCIATED_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700350 case eLIM_SME_LINK_EST_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700351 return "eLIM_SME_LINK_EST_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700352 case eLIM_SME_LINK_EST_WT_SCAN_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700353 return "eLIM_SME_LINK_EST_WT_SCAN_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700354 case eLIM_SME_WT_PRE_AUTH_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700355 return "eLIM_SME_WT_PRE_AUTH_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700356 case eLIM_SME_WT_DISASSOC_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700357 return "eLIM_SME_WT_DISASSOC_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700358 case eLIM_SME_WT_DEAUTH_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700359 return "eLIM_SME_WT_DEAUTH_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700360 case eLIM_SME_WT_START_BSS_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700361 return "eLIM_SME_WT_START_BSS_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700362 case eLIM_SME_WT_STOP_BSS_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700363 return "eLIM_SME_WT_STOP_BSS_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700364 case eLIM_SME_NORMAL_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700365 return "eLIM_SME_NORMAL_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700366 case eLIM_SME_CHANNEL_SCAN_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700367 return "eLIM_SME_CHANNEL_SCAN_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700368 case eLIM_SME_NORMAL_CHANNEL_SCAN_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700369 return "eLIM_SME_NORMAL_CHANNEL_SCAN_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700370 default:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700371 return "INVALID SME state";
Jeff Johnson295189b2012-06-20 16:38:30 -0700372 }
373#endif
374return "";
375}
376
377
378char* limDot11ModeStr(tpAniSirGlobal pMac, tANI_U8 dot11Mode)
379{
380#ifdef FIXME_GEN6
381
382 switch(dot11Mode)
383 {
384 case WNI_CFG_DOT11_MODE_ALL:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700385 return "ALL";
Jeff Johnson295189b2012-06-20 16:38:30 -0700386 case WNI_CFG_DOT11_MODE_11A:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700387 return "11A";
388 case WNI_CFG_DOT11_MODE_11B:
389 return "11B";
390 case WNI_CFG_DOT11_MODE_11G:
391 return "11G";
392 case WNI_CFG_DOT11_MODE_11N:
393 return "11N";
394 case WNI_CFG_DOT11_MODE_POLARIS:
395 return "Polaris";
396 case WNI_CFG_DOT11_MODE_TITAN:
397 return "Titan";
Jeff Johnson295189b2012-06-20 16:38:30 -0700398 case WNI_CFG_DOT11_MODE_TAURUS:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700399 return "Taurus";
Jeff Johnson295189b2012-06-20 16:38:30 -0700400 default:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700401 return "Invalid Dot11 Mode";
Jeff Johnson295189b2012-06-20 16:38:30 -0700402 }
403#endif
404return "";
405}
406
407
408char* limStaOpRateModeStr(tStaRateMode opRateMode)
409{
410#ifdef FIXME_GEN6
411
412 switch(opRateMode)
413 {
414 case eSTA_TAURUS:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700415 return "Taurus";
Jeff Johnson295189b2012-06-20 16:38:30 -0700416 case eSTA_11a:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700417 return "11A";
418 case eSTA_11b:
419 return "11B";
420 case eSTA_11bg:
421 return "11G";
422 case eSTA_11n:
423 return "11N";
424 case eSTA_POLARIS:
425 return "Polaris";
Jeff Johnson295189b2012-06-20 16:38:30 -0700426 case eSTA_TITAN:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700427 return "Titan";
Jeff Johnson295189b2012-06-20 16:38:30 -0700428 default:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700429 return "Invalid Dot11 Mode";
Jeff Johnson295189b2012-06-20 16:38:30 -0700430 }
431#endif
432return "";
433}
434
435char* limBssTypeStr(tSirBssType bssType)
436{
437 switch(bssType)
438 {
439 case eSIR_INFRASTRUCTURE_MODE:
440 return "eSIR_INFRASTRUCTURE_MODE";
441 case eSIR_IBSS_MODE:
442 return "eSIR_IBSS_MODE";
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700443 case eSIR_BTAMP_STA_MODE:
Jeff Johnson295189b2012-06-20 16:38:30 -0700444 return "eSIR_BTAMP_STA_MODE";
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700445 case eSIR_BTAMP_AP_MODE:
Jeff Johnson295189b2012-06-20 16:38:30 -0700446 return "eSIR_BTAMP_AP_MODE";
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700447 case eSIR_AUTO_MODE:
Jeff Johnson295189b2012-06-20 16:38:30 -0700448 return "eSIR_AUTO_MODE";
449 default:
450 return "Invalid BSS Type";
451 }
452}
453
454void
455limPrintSmeState(tpAniSirGlobal pMac, tANI_U16 logLevel, tLimSmeStates state)
456{
457 limLog(pMac, logLevel, limSmeStateStr(state));
458}
459
460char *limMsgStr(tANI_U32 msgType)
461{
462#ifdef FIXME_GEN6
463 switch (msgType)
464 {
465 case eWNI_SME_START_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700466 return "eWNI_SME_START_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700467 case eWNI_SME_START_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700468 return "eWNI_SME_START_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700469 case eWNI_SME_SYS_READY_IND:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700470 return "eWNI_SME_SYS_READY_IND";
Jeff Johnson295189b2012-06-20 16:38:30 -0700471 case eWNI_SME_SCAN_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700472 return "eWNI_SME_SCAN_REQ";
Jeff Johnsone7245742012-09-05 17:12:55 -0700473#ifdef FEATURE_OEM_DATA_SUPPORT
474 case eWNI_SME_OEM_DATA_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700475 return "eWNI_SME_OEM_DATA_REQ";
Jeff Johnsone7245742012-09-05 17:12:55 -0700476 case eWNI_SME_OEM_DATA_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700477 return "eWNI_SME_OEM_DATA_RSP";
Jeff Johnsone7245742012-09-05 17:12:55 -0700478#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700479 case eWNI_SME_SCAN_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700480 return "eWNI_SME_SCAN_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700481 case eWNI_SME_JOIN_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700482 return "eWNI_SME_JOIN_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700483 case eWNI_SME_JOIN_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700484 return "eWNI_SME_JOIN_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700485 case eWNI_SME_SETCONTEXT_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700486 return "eWNI_SME_SETCONTEXT_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700487 case eWNI_SME_SETCONTEXT_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700488 return "eWNI_SME_SETCONTEXT_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700489 case eWNI_SME_REASSOC_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700490 return "eWNI_SME_REASSOC_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700491 case eWNI_SME_REASSOC_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700492 return "eWNI_SME_REASSOC_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700493 case eWNI_SME_AUTH_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700494 return "eWNI_SME_AUTH_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700495 case eWNI_SME_AUTH_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700496 return "eWNI_SME_AUTH_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700497 case eWNI_SME_DISASSOC_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700498 return "eWNI_SME_DISASSOC_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700499 case eWNI_SME_DISASSOC_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700500 return "eWNI_SME_DISASSOC_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700501 case eWNI_SME_DISASSOC_IND:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700502 return "eWNI_SME_DISASSOC_IND";
Jeff Johnson295189b2012-06-20 16:38:30 -0700503 case eWNI_SME_DISASSOC_CNF:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700504 return "eWNI_SME_DISASSOC_CNF";
Jeff Johnson295189b2012-06-20 16:38:30 -0700505 case eWNI_SME_DEAUTH_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700506 return "eWNI_SME_DEAUTH_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700507 case eWNI_SME_DEAUTH_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700508 return "eWNI_SME_DEAUTH_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700509 case eWNI_SME_DEAUTH_IND:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700510 return "eWNI_SME_DEAUTH_IND";
Jeff Johnson295189b2012-06-20 16:38:30 -0700511 case eWNI_SME_WM_STATUS_CHANGE_NTF:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700512 return "eWNI_SME_WM_STATUS_CHANGE_NTF";
Jeff Johnson295189b2012-06-20 16:38:30 -0700513 case eWNI_SME_START_BSS_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700514 return "eWNI_SME_START_BSS_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700515 case eWNI_SME_START_BSS_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700516 return "eWNI_SME_START_BSS_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700517 case eWNI_SME_AUTH_IND:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700518 return "eWNI_SME_AUTH_IND";
Jeff Johnson295189b2012-06-20 16:38:30 -0700519 case eWNI_SME_ASSOC_IND:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700520 return "eWNI_SME_ASSOC_IND";
Jeff Johnson295189b2012-06-20 16:38:30 -0700521 case eWNI_SME_ASSOC_CNF:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700522 return "eWNI_SME_ASSOC_CNF";
Jeff Johnson295189b2012-06-20 16:38:30 -0700523 case eWNI_SME_REASSOC_IND:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700524 return "eWNI_SME_REASSOC_IND";
Jeff Johnson295189b2012-06-20 16:38:30 -0700525 case eWNI_SME_REASSOC_CNF:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700526 return "eWNI_SME_REASSOC_CNF";
Jeff Johnson295189b2012-06-20 16:38:30 -0700527 case eWNI_SME_SWITCH_CHL_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700528 return "eWNI_SME_SWITCH_CHL_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700529 case eWNI_SME_SWITCH_CHL_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700530 return "eWNI_SME_SWITCH_CHL_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700531 case eWNI_SME_SWITCH_CHL_CB_PRIMARY_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700532 return "eWNI_SME_SWITCH_CHL_CB_PRIMARY_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700533 case eWNI_SME_SWITCH_CHL_CB_SECONDARY_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700534 return "eWNI_SME_SWITCH_CHL_CB_SECONDARY_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700535 case eWNI_SME_STOP_BSS_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700536 return "eWNI_SME_STOP_BSS_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700537 case eWNI_SME_STOP_BSS_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700538 return "eWNI_SME_STOP_BSS_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700539 case eWNI_SME_PROMISCUOUS_MODE_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700540 return "eWNI_SME_PROMISCUOUS_MODE_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700541 case eWNI_SME_PROMISCUOUS_MODE_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700542 return "eWNI_SME_PROMISCUOUS_MODE_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700543 case eWNI_SME_NEIGHBOR_BSS_IND:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700544 return "eWNI_SME_NEIGHBOR_BSS_IND";
Jeff Johnson295189b2012-06-20 16:38:30 -0700545 case eWNI_SME_MEASUREMENT_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700546 return "eWNI_SME_MEASUREMENT_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700547 case eWNI_SME_MEASUREMENT_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700548 return "eWNI_SME_MEASUREMENT_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700549 case eWNI_SME_MEASUREMENT_IND:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700550 return "eWNI_SME_MEASUREMENT_IND";
Jeff Johnson295189b2012-06-20 16:38:30 -0700551 case eWNI_SME_SET_WDS_INFO_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700552 return "eWNI_SME_SET_WDS_INFO_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700553 case eWNI_SME_SET_WDS_INFO_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700554 return "eWNI_SME_SET_WDS_INFO_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700555 case eWNI_SME_WDS_INFO_IND:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700556 return "eWNI_SME_WDS_INFO_IND";
Jeff Johnson295189b2012-06-20 16:38:30 -0700557 case eWNI_SME_DEAUTH_CNF:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700558 return "eWNI_SME_DEAUTH_CNF";
Jeff Johnson295189b2012-06-20 16:38:30 -0700559 case eWNI_SME_MIC_FAILURE_IND:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700560 return "eWNI_SME_MIC_FAILURE_IND";
Jeff Johnson295189b2012-06-20 16:38:30 -0700561 case eWNI_SME_ADDTS_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700562 return "eWNI_SME_ADDTS_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700563 case eWNI_SME_ADDTS_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700564 return "eWNI_SME_ADDTS_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700565 case eWNI_SME_ADDTS_CNF:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700566 return "eWNI_SME_ADDTS_CNF";
Jeff Johnson295189b2012-06-20 16:38:30 -0700567 case eWNI_SME_ADDTS_IND:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700568 return "eWNI_SME_ADDTS_IND";
Jeff Johnson295189b2012-06-20 16:38:30 -0700569 case eWNI_SME_DELTS_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700570 return "eWNI_SME_DELTS_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700571 case eWNI_SME_DELTS_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700572 return "eWNI_SME_DELTS_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700573 case eWNI_SME_DELTS_IND:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700574 return "eWNI_SME_DELTS_IND";
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -0800575#if defined WLAN_FEATURE_VOWIFI_11R || defined FEATURE_WLAN_ESE || defined(FEATURE_WLAN_LFR)
Srinivas Girigowdad34cedb2013-01-25 13:33:11 -0800576 case eWNI_SME_GET_ROAM_RSSI_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700577 return "eWNI_SME_GET_ROAM_RSSI_REQ";
Srinivas Girigowdad34cedb2013-01-25 13:33:11 -0800578 case eWNI_SME_GET_ROAM_RSSI_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700579 return "eWNI_SME_GET_ROAM_RSSI_RSP";
Srinivas Girigowdad34cedb2013-01-25 13:33:11 -0800580#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700581
Jeff Johnson295189b2012-06-20 16:38:30 -0700582 case WDA_SUSPEND_ACTIVITY_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700583 return "WDA_SUSPEND_ACTIVITY_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700584 case SIR_LIM_RETRY_INTERRUPT_MSG:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700585 return "SIR_LIM_RETRY_INTERRUPT_MSG";
Jeff Johnson295189b2012-06-20 16:38:30 -0700586 case SIR_BB_XPORT_MGMT_MSG:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700587 return "SIR_BB_XPORT_MGMT_MSG";
Jeff Johnson295189b2012-06-20 16:38:30 -0700588 case SIR_LIM_INV_KEY_INTERRUPT_MSG:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700589 return "SIR_LIM_INV_KEY_INTERRUPT_MSG";
Jeff Johnson295189b2012-06-20 16:38:30 -0700590 case SIR_LIM_KEY_ID_INTERRUPT_MSG:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700591 return "SIR_LIM_KEY_ID_INTERRUPT_MSG";
Jeff Johnson295189b2012-06-20 16:38:30 -0700592 case SIR_LIM_REPLAY_THRES_INTERRUPT_MSG:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700593 return "SIR_LIM_REPLAY_THRES_INTERRUPT_MSG";
Jeff Johnson295189b2012-06-20 16:38:30 -0700594 case SIR_LIM_MIN_CHANNEL_TIMEOUT:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700595 return "SIR_LIM_MIN_CHANNEL_TIMEOUT";
Jeff Johnson295189b2012-06-20 16:38:30 -0700596 case SIR_LIM_MAX_CHANNEL_TIMEOUT:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700597 return "SIR_LIM_MAX_CHANNEL_TIMEOUT";
Jeff Johnson295189b2012-06-20 16:38:30 -0700598 case SIR_LIM_JOIN_FAIL_TIMEOUT:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700599 return "SIR_LIM_JOIN_FAIL_TIMEOUT";
Jeff Johnson295189b2012-06-20 16:38:30 -0700600 case SIR_LIM_AUTH_FAIL_TIMEOUT:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700601 return "SIR_LIM_AUTH_FAIL_TIMEOUT";
Jeff Johnson295189b2012-06-20 16:38:30 -0700602 case SIR_LIM_AUTH_RSP_TIMEOUT:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700603 return "SIR_LIM_AUTH_RSP_TIMEOUT";
Jeff Johnson295189b2012-06-20 16:38:30 -0700604 case SIR_LIM_ASSOC_FAIL_TIMEOUT:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700605 return "SIR_LIM_ASSOC_FAIL_TIMEOUT";
Jeff Johnson295189b2012-06-20 16:38:30 -0700606 case SIR_LIM_REASSOC_FAIL_TIMEOUT:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700607 return "SIR_LIM_REASSOC_FAIL_TIMEOUT";
Jeff Johnson295189b2012-06-20 16:38:30 -0700608 case SIR_LIM_HEART_BEAT_TIMEOUT:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700609 return "SIR_LIM_HEART_BEAT_TIMEOUT";
Jeff Johnson295189b2012-06-20 16:38:30 -0700610 case SIR_LIM_ADDTS_RSP_TIMEOUT:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700611 return "SIR_LIM_ADDTS_RSP_TIMEOUT";
Jeff Johnson295189b2012-06-20 16:38:30 -0700612 case SIR_LIM_CHANNEL_SCAN_TIMEOUT:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700613 return "SIR_LIM_CHANNEL_SCAN_TIMEOUT";
Jeff Johnson295189b2012-06-20 16:38:30 -0700614 case SIR_LIM_LINK_TEST_DURATION_TIMEOUT:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700615 return "SIR_LIM_LINK_TEST_DURATION_TIMEOUT";
Jeff Johnson295189b2012-06-20 16:38:30 -0700616 case SIR_LIM_KEEPALIVE_TIMEOUT:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700617 return "SIR_LIM_KEEPALIVE_TIMEOUT";
Jeff Johnson295189b2012-06-20 16:38:30 -0700618 case SIR_LIM_UPDATE_OLBC_CACHEL_TIMEOUT:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700619 return "SIR_LIM_UPDATE_OLBC_CACHEL_TIMEOUT";
Jeff Johnson295189b2012-06-20 16:38:30 -0700620 case SIR_LIM_CNF_WAIT_TIMEOUT:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700621 return "SIR_LIM_CNF_WAIT_TIMEOUT";
Jeff Johnson295189b2012-06-20 16:38:30 -0700622 case SIR_LIM_RADAR_DETECT_IND:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700623 return "SIR_LIM_RADAR_DETECT_IND";
Jeff Johnson295189b2012-06-20 16:38:30 -0700624#ifdef WLAN_FEATURE_VOWIFI_11R
625 case SIR_LIM_FT_PREAUTH_RSP_TIMEOUT:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700626 return "SIR_LIM_FT_PREAUTH_RSP_TIMEOUT";
Jeff Johnson295189b2012-06-20 16:38:30 -0700627#endif
628
629 case SIR_HAL_APP_SETUP_NTF:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700630 return "SIR_HAL_APP_SETUP_NTF";
Jeff Johnson295189b2012-06-20 16:38:30 -0700631 case SIR_HAL_INITIAL_CAL_FAILED_NTF:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700632 return "SIR_HAL_INITIAL_CAL_FAILED_NTF";
Jeff Johnson295189b2012-06-20 16:38:30 -0700633 case SIR_HAL_NIC_OPER_NTF:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700634 return "SIR_HAL_NIC_OPER_NTF";
Jeff Johnson295189b2012-06-20 16:38:30 -0700635 case SIR_HAL_INIT_START_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700636 return "SIR_HAL_INIT_START_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700637 case SIR_HAL_SHUTDOWN_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700638 return "SIR_HAL_SHUTDOWN_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700639 case SIR_HAL_SHUTDOWN_CNF:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700640 return "SIR_HAL_SHUTDOWN_CNF";
Jeff Johnson295189b2012-06-20 16:38:30 -0700641 case SIR_HAL_RESET_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700642 return "SIR_HAL_RESET_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700643 case SIR_HAL_RESET_CNF:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700644 return "SIR_HAL_RESET_CNF";
Jeff Johnson295189b2012-06-20 16:38:30 -0700645 case SIR_WRITE_TO_TD:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700646 return "SIR_WRITE_TO_TD";
Jeff Johnson295189b2012-06-20 16:38:30 -0700647
648 case WNI_CFG_PARAM_UPDATE_IND:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700649 return "WNI_CFG_PARAM_UPDATE_IND";
Jeff Johnson295189b2012-06-20 16:38:30 -0700650 case WNI_CFG_DNLD_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700651 return "WNI_CFG_DNLD_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700652 case WNI_CFG_DNLD_CNF:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700653 return "WNI_CFG_DNLD_CNF";
Jeff Johnson295189b2012-06-20 16:38:30 -0700654 case WNI_CFG_GET_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700655 return "WNI_CFG_GET_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700656 case WNI_CFG_SET_CNF:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700657 return "WNI_CFG_SET_CNF";
Jeff Johnson295189b2012-06-20 16:38:30 -0700658 case WNI_CFG_GET_ATTRIB_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700659 return "WNI_CFG_GET_ATTRIB_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700660 case WNI_CFG_ADD_GRP_ADDR_CNF:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700661 return "WNI_CFG_ADD_GRP_ADDR_CNF";
Jeff Johnson295189b2012-06-20 16:38:30 -0700662 case WNI_CFG_DEL_GRP_ADDR_CNF:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700663 return "WNI_CFG_DEL_GRP_ADDR_CNF";
Jeff Johnson295189b2012-06-20 16:38:30 -0700664 case ANI_CFG_GET_RADIO_STAT_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700665 return "ANI_CFG_GET_RADIO_STAT_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700666 case ANI_CFG_GET_PER_STA_STAT_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700667 return "ANI_CFG_GET_PER_STA_STAT_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700668 case ANI_CFG_GET_AGG_STA_STAT_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700669 return "ANI_CFG_GET_AGG_STA_STAT_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700670 case ANI_CFG_CLEAR_STAT_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700671 return "ANI_CFG_CLEAR_STAT_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700672 case WNI_CFG_DNLD_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700673 return "WNI_CFG_DNLD_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700674 case WNI_CFG_GET_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700675 return "WNI_CFG_GET_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700676 case WNI_CFG_SET_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700677 return "WNI_CFG_SET_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700678 case WNI_CFG_SET_REQ_NO_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700679 return "WNI_CFG_SET_REQ_NO_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700680 case eWNI_PMC_ENTER_IMPS_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700681 return "eWNI_PMC_ENTER_IMPS_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700682 case eWNI_PMC_EXIT_IMPS_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700683 return "eWNI_PMC_EXIT_IMPS_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700684 case eWNI_PMC_ENTER_BMPS_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700685 return "eWNI_PMC_ENTER_BMPS_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700686 case eWNI_PMC_EXIT_BMPS_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700687 return "eWNI_PMC_EXIT_BMPS_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700688 case eWNI_PMC_EXIT_BMPS_IND:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700689 return "eWNI_PMC_EXIT_BMPS_IND";
Yathish9f22e662012-12-10 14:21:35 -0800690 case eWNI_SME_SET_BCN_FILTER_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700691 return "eWNI_SME_SET_BCN_FILTER_REQ";
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -0800692#if defined(FEATURE_WLAN_ESE) && defined(FEATURE_WLAN_ESE_UPLOAD)
Srinivas Girigowda5cecb202013-10-08 09:13:25 -0700693 case eWNI_SME_GET_TSM_STATS_REQ:
694 return "eWNI_SME_GET_TSM_STATS_REQ";
695 case eWNI_SME_GET_TSM_STATS_RSP:
696 return "eWNI_SME_GET_TSM_STATS_RSP";
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -0800697#endif /* FEATURE_WLAN_ESE && FEATURE_WLAN_ESE_UPLOAD */
Jeff Johnson295189b2012-06-20 16:38:30 -0700698 default:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700699 return "INVALID SME message";
Jeff Johnson295189b2012-06-20 16:38:30 -0700700 }
701#endif
702return "";
703}
704
705
706
707char *limResultCodeStr(tSirResultCodes resultCode)
708{
Jeff Johnson295189b2012-06-20 16:38:30 -0700709 switch (resultCode)
710 {
711 case eSIR_SME_SUCCESS:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700712 return "eSIR_SME_SUCCESS";
Jeff Johnson295189b2012-06-20 16:38:30 -0700713 case eSIR_EOF_SOF_EXCEPTION:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700714 return "eSIR_EOF_SOF_EXCEPTION";
Jeff Johnson295189b2012-06-20 16:38:30 -0700715 case eSIR_BMU_EXCEPTION:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700716 return "eSIR_BMU_EXCEPTION";
Jeff Johnson295189b2012-06-20 16:38:30 -0700717 case eSIR_LOW_PDU_EXCEPTION:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700718 return "eSIR_LOW_PDU_EXCEPTION";
Jeff Johnson295189b2012-06-20 16:38:30 -0700719 case eSIR_USER_TRIG_RESET:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700720 return"eSIR_USER_TRIG_RESET";
Jeff Johnson295189b2012-06-20 16:38:30 -0700721 case eSIR_LOGP_EXCEPTION:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700722 return "eSIR_LOGP_EXCEPTION";
Jeff Johnson295189b2012-06-20 16:38:30 -0700723 case eSIR_CP_EXCEPTION:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700724 return "eSIR_CP_EXCEPTION";
Jeff Johnson295189b2012-06-20 16:38:30 -0700725 case eSIR_STOP_BSS:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700726 return "eSIR_STOP_BSS";
Jeff Johnson295189b2012-06-20 16:38:30 -0700727 case eSIR_AHB_HANG_EXCEPTION:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700728 return "eSIR_AHB_HANG_EXCEPTION";
Jeff Johnson295189b2012-06-20 16:38:30 -0700729 case eSIR_DPU_EXCEPTION:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700730 return "eSIR_DPU_EXCEPTION";
Jeff Johnson295189b2012-06-20 16:38:30 -0700731 case eSIR_RXP_EXCEPTION:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700732 return "eSIR_RXP_EXCEPTION";
Jeff Johnson295189b2012-06-20 16:38:30 -0700733 case eSIR_MCPU_EXCEPTION:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700734 return "eSIR_MCPU_EXCEPTION";
Jeff Johnson295189b2012-06-20 16:38:30 -0700735 case eSIR_MCU_EXCEPTION:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700736 return "eSIR_MCU_EXCEPTION";
Jeff Johnson295189b2012-06-20 16:38:30 -0700737 case eSIR_MTU_EXCEPTION:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700738 return "eSIR_MTU_EXCEPTION";
Jeff Johnson295189b2012-06-20 16:38:30 -0700739 case eSIR_MIF_EXCEPTION:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700740 return "eSIR_MIF_EXCEPTION";
Jeff Johnson295189b2012-06-20 16:38:30 -0700741 case eSIR_FW_EXCEPTION:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700742 return "eSIR_FW_EXCEPTION";
Jeff Johnson295189b2012-06-20 16:38:30 -0700743 case eSIR_MAILBOX_SANITY_CHK_FAILED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700744 return "eSIR_MAILBOX_SANITY_CHK_FAILED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700745 case eSIR_RADIO_HW_SWITCH_STATUS_IS_OFF:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700746 return "eSIR_RADIO_HW_SWITCH_STATUS_IS_OFF";
Jeff Johnson295189b2012-06-20 16:38:30 -0700747 case eSIR_CFB_FLAG_STUCK_EXCEPTION:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700748 return "eSIR_CFB_FLAG_STUCK_EXCEPTION";
Jeff Johnson295189b2012-06-20 16:38:30 -0700749 case eSIR_SME_BASIC_RATES_NOT_SUPPORTED_STATUS:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700750 return "eSIR_SME_BASIC_RATES_NOT_SUPPORTED_STATUS";
Jeff Johnson295189b2012-06-20 16:38:30 -0700751 case eSIR_SME_INVALID_PARAMETERS:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700752 return "eSIR_SME_INVALID_PARAMETERS";
Jeff Johnson295189b2012-06-20 16:38:30 -0700753 case eSIR_SME_UNEXPECTED_REQ_RESULT_CODE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700754 return "eSIR_SME_UNEXPECTED_REQ_RESULT_CODE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700755 case eSIR_SME_RESOURCES_UNAVAILABLE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700756 return "eSIR_SME_RESOURCES_UNAVAILABLE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700757 case eSIR_SME_SCAN_FAILED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700758 return "eSIR_SME_SCAN_FAILED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700759 case eSIR_SME_BSS_ALREADY_STARTED_OR_JOINED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700760 return "eSIR_SME_BSS_ALREADY_STARTED_OR_JOINED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700761 case eSIR_SME_LOST_LINK_WITH_PEER_RESULT_CODE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700762 return "eSIR_SME_LOST_LINK_WITH_PEER_RESULT_CODE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700763 case eSIR_SME_REFUSED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700764 return "eSIR_SME_REFUSED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700765 case eSIR_SME_JOIN_TIMEOUT_RESULT_CODE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700766 return "eSIR_SME_JOIN_TIMEOUT_RESULT_CODE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700767 case eSIR_SME_AUTH_TIMEOUT_RESULT_CODE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700768 return "eSIR_SME_AUTH_TIMEOUT_RESULT_CODE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700769 case eSIR_SME_ASSOC_TIMEOUT_RESULT_CODE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700770 return "eSIR_SME_ASSOC_TIMEOUT_RESULT_CODE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700771 case eSIR_SME_REASSOC_TIMEOUT_RESULT_CODE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700772 return "eSIR_SME_REASSOC_TIMEOUT_RESULT_CODE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700773 case eSIR_SME_MAX_NUM_OF_PRE_AUTH_REACHED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700774 return "eSIR_SME_MAX_NUM_OF_PRE_AUTH_REACHED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700775 case eSIR_SME_AUTH_REFUSED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700776 return "eSIR_SME_AUTH_REFUSED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700777 case eSIR_SME_INVALID_WEP_DEFAULT_KEY:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700778 return "eSIR_SME_INVALID_WEP_DEFAULT_KEY";
Jeff Johnson295189b2012-06-20 16:38:30 -0700779 case eSIR_SME_ASSOC_REFUSED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700780 return "eSIR_SME_ASSOC_REFUSED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700781 case eSIR_SME_REASSOC_REFUSED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700782 return "eSIR_SME_REASSOC_REFUSED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700783 case eSIR_SME_STA_NOT_AUTHENTICATED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700784 return "eSIR_SME_STA_NOT_AUTHENTICATED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700785 case eSIR_SME_STA_NOT_ASSOCIATED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700786 return "eSIR_SME_STA_NOT_ASSOCIATED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700787 case eSIR_SME_STA_DISASSOCIATED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700788 return "eSIR_SME_STA_DISASSOCIATED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700789 case eSIR_SME_ALREADY_JOINED_A_BSS:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700790 return "eSIR_SME_ALREADY_JOINED_A_BSS";
Jeff Johnson295189b2012-06-20 16:38:30 -0700791 case eSIR_ULA_COMPLETED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700792 return "eSIR_ULA_COMPLETED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700793 case eSIR_ULA_FAILURE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700794 return "eSIR_ULA_FAILURE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700795 case eSIR_SME_LINK_ESTABLISHED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700796 return "eSIR_SME_LINK_ESTABLISHED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700797 case eSIR_SME_UNABLE_TO_PERFORM_MEASUREMENTS:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700798 return "eSIR_SME_UNABLE_TO_PERFORM_MEASUREMENTS";
Jeff Johnson295189b2012-06-20 16:38:30 -0700799 case eSIR_SME_UNABLE_TO_PERFORM_DFS:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700800 return "eSIR_SME_UNABLE_TO_PERFORM_DFS";
Jeff Johnson295189b2012-06-20 16:38:30 -0700801 case eSIR_SME_DFS_FAILED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700802 return "eSIR_SME_DFS_FAILED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700803 case eSIR_SME_TRANSFER_STA:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700804 return "eSIR_SME_TRANSFER_STA";
Jeff Johnson295189b2012-06-20 16:38:30 -0700805 case eSIR_SME_INVALID_LINK_TEST_PARAMETERS:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700806 return "eSIR_SME_INVALID_LINK_TEST_PARAMETERS";
Jeff Johnson295189b2012-06-20 16:38:30 -0700807 case eSIR_SME_LINK_TEST_MAX_EXCEEDED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700808 return "eSIR_SME_LINK_TEST_MAX_EXCEEDED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700809 case eSIR_SME_UNSUPPORTED_RATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700810 return "eSIR_SME_UNSUPPORTED_RATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700811 case eSIR_SME_LINK_TEST_TIMEOUT:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700812 return "eSIR_SME_LINK_TEST_TIMEOUT";
Jeff Johnson295189b2012-06-20 16:38:30 -0700813 case eSIR_SME_LINK_TEST_COMPLETE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700814 return "eSIR_SME_LINK_TEST_COMPLETE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700815 case eSIR_SME_LINK_TEST_INVALID_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700816 return "eSIR_SME_LINK_TEST_INVALID_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700817 case eSIR_SME_LINK_TEST_INVALID_ADDRESS:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700818 return "eSIR_SME_LINK_TEST_INVALID_ADDRESS";
Jeff Johnson295189b2012-06-20 16:38:30 -0700819 case eSIR_SME_POLARIS_RESET:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700820 return "eSIR_SME_POLARIS_RESET";
Jeff Johnson295189b2012-06-20 16:38:30 -0700821 case eSIR_SME_SETCONTEXT_FAILED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700822 return "eSIR_SME_SETCONTEXT_FAILED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700823 case eSIR_SME_BSS_RESTART:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700824 return "eSIR_SME_BSS_RESTART";
Jeff Johnson295189b2012-06-20 16:38:30 -0700825 case eSIR_SME_MORE_SCAN_RESULTS_FOLLOW:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700826 return "eSIR_SME_MORE_SCAN_RESULTS_FOLLOW";
Jeff Johnson295189b2012-06-20 16:38:30 -0700827 case eSIR_SME_INVALID_ASSOC_RSP_RXED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700828 return "eSIR_SME_INVALID_ASSOC_RSP_RXED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700829 case eSIR_SME_MIC_COUNTER_MEASURES:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700830 return "eSIR_SME_MIC_COUNTER_MEASURES";
Jeff Johnson295189b2012-06-20 16:38:30 -0700831 case eSIR_SME_ADDTS_RSP_TIMEOUT:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700832 return "eSIR_SME_ADDTS_RSP_TIMEOUT";
Jeff Johnson295189b2012-06-20 16:38:30 -0700833 case eSIR_SME_RECEIVED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700834 return "eSIR_SME_RECEIVED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700835 case eSIR_SME_CHANNEL_SWITCH_FAIL:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700836 return "eSIR_SME_CHANNEL_SWITCH_FAIL";
Jeff Johnson295189b2012-06-20 16:38:30 -0700837#ifdef GEN4_SCAN
838 case eSIR_SME_CHANNEL_SWITCH_DISABLED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700839 return "eSIR_SME_CHANNEL_SWITCH_DISABLED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700840 case eSIR_SME_HAL_SCAN_INIT_FAILED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700841 return "eSIR_SME_HAL_SCAN_INIT_FAILED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700842 case eSIR_SME_HAL_SCAN_START_FAILED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700843 return "eSIR_SME_HAL_SCAN_START_FAILED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700844 case eSIR_SME_HAL_SCAN_END_FAILED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700845 return "eSIR_SME_HAL_SCAN_END_FAILED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700846 case eSIR_SME_HAL_SCAN_FINISH_FAILED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700847 return "eSIR_SME_HAL_SCAN_FINISH_FAILED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700848 case eSIR_SME_HAL_SEND_MESSAGE_FAIL:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700849 return "eSIR_SME_HAL_SEND_MESSAGE_FAIL";
Jeff Johnson295189b2012-06-20 16:38:30 -0700850#else // GEN4_SCAN
851 case eSIR_SME_CHANNEL_SWITCH_DISABLED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700852 return "eSIR_SME_CHANNEL_SWITCH_DISABLED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700853 case eSIR_SME_HAL_SEND_MESSAGE_FAIL:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700854 return "eSIR_SME_HAL_SEND_MESSAGE_FAIL";
Jeff Johnson295189b2012-06-20 16:38:30 -0700855#endif // GEN4_SCAN
856
857 default:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700858 return "INVALID resultCode";
Jeff Johnson295189b2012-06-20 16:38:30 -0700859 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700860}
861
862void
863limPrintMsgName(tpAniSirGlobal pMac, tANI_U16 logLevel, tANI_U32 msgType)
864{
865 limLog(pMac, logLevel, limMsgStr(msgType));
866}
867
Jeff Johnson295189b2012-06-20 16:38:30 -0700868void
869limPrintMsgInfo(tpAniSirGlobal pMac, tANI_U16 logLevel, tSirMsgQ *msg)
870{
Jeff Johnson295189b2012-06-20 16:38:30 -0700871 if (logLevel <= pMac->utils.gLogDbgLevel[SIR_LIM_MODULE_ID - LOG_FIRST_MODULE_ID])
872 {
873 switch (msg->type)
874 {
875 case SIR_BB_XPORT_MGMT_MSG:
Jeff Johnson295189b2012-06-20 16:38:30 -0700876 limPrintMsgName(pMac, logLevel,msg->type);
Jeff Johnson295189b2012-06-20 16:38:30 -0700877 break;
878 default:
879 limPrintMsgName(pMac, logLevel,msg->type);
880 break;
881 }
882 }
883}
884
885/**
886 * limInitMlm()
887 *
888 *FUNCTION:
889 * This function is called by limProcessSmeMessages() to
890 * initialize MLM state machine on STA
891 *
892 *PARAMS:
893 *
894 *LOGIC:
895 *
896 *ASSUMPTIONS:
897 * NA
898 *
899 *NOTE:
900 * NA
901 *
902 * @param pMac Pointer to Global MAC structure
903 * @return None
904 */
905void
906limInitMlm(tpAniSirGlobal pMac)
907{
Madan Mohan Koyyalamudi694f8d72012-10-11 16:32:55 -0700908 tANI_U32 retVal;
909
910 pMac->lim.gLimTimersCreated = 0;
Madan Mohan Koyyalamudi1bed5982012-10-22 14:38:06 -0700911
Jeff Johnsone7245742012-09-05 17:12:55 -0700912 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, NO_SESSION, pMac->lim.gLimMlmState));
Jeff Johnson295189b2012-06-20 16:38:30 -0700913
914 /// Initialize scan result hash table
915 limReInitScanResults(pMac); //sep26th review
916
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -0700917#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
918 /// Initialize lfr scan result hash table
919 // Could there be a problem in multisession with SAP/P2P GO, when in the
920 // middle of FW bg scan, SAP started; Again that could be a problem even on
921 // infra + SAP/P2P GO too - TBD
922 limReInitLfrScanResults(pMac);
923#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700924
925 /// Initialize number of pre-auth contexts
926 pMac->lim.gLimNumPreAuthContexts = 0;
927
928 /// Initialize MAC based Authentication STA list
929 limInitPreAuthList(pMac);
930
931 //pMac->lim.gpLimMlmJoinReq = NULL;
932
933 if (pMac->lim.gLimTimersCreated)
934 return;
935
936 // Create timers used by LIM
Madan Mohan Koyyalamudi694f8d72012-10-11 16:32:55 -0700937 retVal = limCreateTimers(pMac);
938 if(retVal == TX_SUCCESS)
939 {
940 pMac->lim.gLimTimersCreated = 1;
941 }
942 else
943 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700944 limLog(pMac, LOGP, FL(" limCreateTimers Failed to create lim timers "));
Madan Mohan Koyyalamudi694f8d72012-10-11 16:32:55 -0700945 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700946} /*** end limInitMlm() ***/
947
948
949
950/**
951 * limCleanupMlm()
952 *
953 *FUNCTION:
954 * This function is called to cleanup any resources
955 * allocated by the MLM state machine.
956 *
957 *PARAMS:
958 *
959 *LOGIC:
960 *
961 *ASSUMPTIONS:
962 * NA
963 *
964 *NOTE:
965 * It is assumed that BSS is already informed that we're leaving it
966 * before this function is called.
967 *
968 * @param pMac Pointer to Global MAC structure
969 * @param None
970 * @return None
971 */
972void
973limCleanupMlm(tpAniSirGlobal pMac)
974{
975 tANI_U32 n;
976 tLimPreAuthNode *pAuthNode;
Agarwal Ashish888ca022014-11-05 14:25:56 +0530977#ifdef WLAN_FEATURE_11W
978 tANI_U32 bss_entry, sta_entry;
979 tpDphHashNode pStaDs = NULL;
980 tpPESession psessionEntry = NULL;
981#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700982
983 if (pMac->lim.gLimTimersCreated == 1)
984 {
985 // Deactivate and delete MIN/MAX channel timers.
986 tx_timer_deactivate(&pMac->lim.limTimers.gLimMinChannelTimer);
987 tx_timer_delete(&pMac->lim.limTimers.gLimMinChannelTimer);
988 tx_timer_deactivate(&pMac->lim.limTimers.gLimMaxChannelTimer);
989 tx_timer_delete(&pMac->lim.limTimers.gLimMaxChannelTimer);
990 tx_timer_deactivate(&pMac->lim.limTimers.gLimPeriodicProbeReqTimer);
991 tx_timer_delete(&pMac->lim.limTimers.gLimPeriodicProbeReqTimer);
992
993
994 // Deactivate and delete channel switch timer.
995 tx_timer_deactivate(&pMac->lim.limTimers.gLimChannelSwitchTimer);
996 tx_timer_delete(&pMac->lim.limTimers.gLimChannelSwitchTimer);
997
998
999 // Deactivate and delete addts response timer.
1000 tx_timer_deactivate(&pMac->lim.limTimers.gLimAddtsRspTimer);
1001 tx_timer_delete(&pMac->lim.limTimers.gLimAddtsRspTimer);
1002
1003 // Deactivate and delete Join failure timer.
1004 tx_timer_deactivate(&pMac->lim.limTimers.gLimJoinFailureTimer);
1005 tx_timer_delete(&pMac->lim.limTimers.gLimJoinFailureTimer);
1006
Madan Mohan Koyyalamudi9aff9ff2012-11-29 11:27:25 -08001007 // Deactivate and delete Periodic Join Probe Request timer.
1008 tx_timer_deactivate(&pMac->lim.limTimers.gLimPeriodicJoinProbeReqTimer);
1009 tx_timer_delete(&pMac->lim.limTimers.gLimPeriodicJoinProbeReqTimer);
1010
Jeff Johnson295189b2012-06-20 16:38:30 -07001011 // Deactivate and delete Association failure timer.
1012 tx_timer_deactivate(&pMac->lim.limTimers.gLimAssocFailureTimer);
1013 tx_timer_delete(&pMac->lim.limTimers.gLimAssocFailureTimer);
1014
1015 // Deactivate and delete Reassociation failure timer.
1016 tx_timer_deactivate(&pMac->lim.limTimers.gLimReassocFailureTimer);
1017 tx_timer_delete(&pMac->lim.limTimers.gLimReassocFailureTimer);
1018
1019 // Deactivate and delete Authentication failure timer.
1020 tx_timer_deactivate(&pMac->lim.limTimers.gLimAuthFailureTimer);
1021 tx_timer_delete(&pMac->lim.limTimers.gLimAuthFailureTimer);
1022
1023 // Deactivate and delete Heartbeat timer.
1024 tx_timer_deactivate(&pMac->lim.limTimers.gLimHeartBeatTimer);
1025 tx_timer_delete(&pMac->lim.limTimers.gLimHeartBeatTimer);
1026
1027 // Deactivate and delete wait-for-probe-after-Heartbeat timer.
1028 tx_timer_deactivate(&pMac->lim.limTimers.gLimProbeAfterHBTimer);
1029 tx_timer_delete(&pMac->lim.limTimers.gLimProbeAfterHBTimer);
1030
1031 // Deactivate and delete Quiet timer.
1032 tx_timer_deactivate(&pMac->lim.limTimers.gLimQuietTimer);
1033 tx_timer_delete(&pMac->lim.limTimers.gLimQuietTimer);
1034
1035 // Deactivate and delete Quiet BSS timer.
1036 tx_timer_deactivate(&pMac->lim.limTimers.gLimQuietBssTimer);
1037 tx_timer_delete(&pMac->lim.limTimers.gLimQuietBssTimer);
1038
Jeff Johnson295189b2012-06-20 16:38:30 -07001039 // Deactivate and delete LIM background scan timer.
1040 tx_timer_deactivate(&pMac->lim.limTimers.gLimBackgroundScanTimer);
1041 tx_timer_delete(&pMac->lim.limTimers.gLimBackgroundScanTimer);
Jeff Johnson295189b2012-06-20 16:38:30 -07001042
1043
1044 // Deactivate and delete cnf wait timer
1045 for (n = 0; n < pMac->lim.maxStation; n++)
1046 {
1047 tx_timer_deactivate(&pMac->lim.limTimers.gpLimCnfWaitTimer[n]);
1048 tx_timer_delete(&pMac->lim.limTimers.gpLimCnfWaitTimer[n]);
1049 }
1050
1051 // Deactivate and delete keepalive timer
1052 tx_timer_deactivate(&pMac->lim.limTimers.gLimKeepaliveTimer);
1053 tx_timer_delete(&pMac->lim.limTimers.gLimKeepaliveTimer);
1054
1055 pAuthNode = pMac->lim.gLimPreAuthTimerTable.pTable;
1056
1057 //Deactivate any Authentication response timers
1058 limDeletePreAuthList(pMac);
1059
1060 for (n = 0; n < pMac->lim.gLimPreAuthTimerTable.numEntry; n++,pAuthNode++)
1061 {
1062 // Delete any Authentication response
1063 // timers, which might have been started.
1064 tx_timer_delete(&pAuthNode->timer);
1065 }
1066
Jeff Johnson295189b2012-06-20 16:38:30 -07001067 tx_timer_deactivate(&pMac->lim.limTimers.gLimUpdateOlbcCacheTimer);
1068 tx_timer_delete(&pMac->lim.limTimers.gLimUpdateOlbcCacheTimer);
1069 tx_timer_deactivate(&pMac->lim.limTimers.gLimPreAuthClnupTimer);
1070 tx_timer_delete(&pMac->lim.limTimers.gLimPreAuthClnupTimer);
1071
1072#if 0 // The WPS PBC clean up timer is disabled
1073 if (pMac->lim.gLimSystemRole == eLIM_AP_ROLE)
1074 {
1075 if(pMac->lim.limTimers.gLimWPSOverlapTimerObj.isTimerCreated == eANI_BOOLEAN_TRUE)
1076 {
1077 tx_timer_deactivate(&pMac->lim.limTimers.gLimWPSOverlapTimerObj.gLimWPSOverlapTimer);
1078 tx_timer_delete(&pMac->lim.limTimers.gLimWPSOverlapTimerObj.gLimWPSOverlapTimer);
1079 pMac->lim.limTimers.gLimWPSOverlapTimerObj.isTimerCreated = eANI_BOOLEAN_FALSE;
1080 }
1081 }
1082#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001083#ifdef WLAN_FEATURE_VOWIFI_11R
1084 // Deactivate and delete FT Preauth response timer
1085 tx_timer_deactivate(&pMac->lim.limTimers.gLimFTPreAuthRspTimer);
1086 tx_timer_delete(&pMac->lim.limTimers.gLimFTPreAuthRspTimer);
1087#endif
1088
Jeff Johnson295189b2012-06-20 16:38:30 -07001089
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001090#if defined(FEATURE_WLAN_ESE) && !defined(FEATURE_WLAN_ESE_UPLOAD)
Jeff Johnson295189b2012-06-20 16:38:30 -07001091 // Deactivate and delete TSM
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001092 tx_timer_deactivate(&pMac->lim.limTimers.gLimEseTsmTimer);
1093 tx_timer_delete(&pMac->lim.limTimers.gLimEseTsmTimer);
1094#endif /* FEATURE_WLAN_ESE && !FEATURE_WLAN_ESE_UPLOAD */
Jeff Johnson295189b2012-06-20 16:38:30 -07001095
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -08001096 tx_timer_deactivate(&pMac->lim.limTimers.gLimDisassocAckTimer);
1097 tx_timer_delete(&pMac->lim.limTimers.gLimDisassocAckTimer);
1098
1099 tx_timer_deactivate(&pMac->lim.limTimers.gLimDeauthAckTimer);
1100 tx_timer_delete(&pMac->lim.limTimers.gLimDeauthAckTimer);
1101
Hoonki Leef63df0d2013-01-16 19:29:14 -08001102 tx_timer_deactivate(&pMac->lim.limTimers.gLimP2pSingleShotNoaInsertTimer);
1103 tx_timer_delete(&pMac->lim.limTimers.gLimP2pSingleShotNoaInsertTimer);
Hoonki Leef63df0d2013-01-16 19:29:14 -08001104
Gopichand Nakkala0d6e4ad2013-05-17 02:30:25 +05301105 tx_timer_deactivate(&pMac->lim.limTimers.gLimActiveToPassiveChannelTimer);
1106 tx_timer_delete(&pMac->lim.limTimers.gLimActiveToPassiveChannelTimer);
1107
Jeff Johnson295189b2012-06-20 16:38:30 -07001108 pMac->lim.gLimTimersCreated = 0;
1109 }
1110
Agarwal Ashish888ca022014-11-05 14:25:56 +05301111#ifdef WLAN_FEATURE_11W
1112 /*
1113 * When SSR is triggered, we need to loop through
1114 * each STA associated per BSSId and deactivate/delete
1115 * the pmfSaQueryTimer for it
1116 */
1117 if (vos_is_logp_in_progress(VOS_MODULE_ID_PE, NULL))
1118 {
1119 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR,
1120 FL("SSR is detected, proceed to clean up pmfSaQueryTimer"));
1121 for (bss_entry = 0; bss_entry < pMac->lim.maxBssId; bss_entry++)
1122 {
1123 if (pMac->lim.gpSession[bss_entry].valid)
1124 {
1125 for (sta_entry = 1; sta_entry < pMac->lim.gLimAssocStaLimit;
1126 sta_entry++)
1127 {
1128 psessionEntry = &pMac->lim.gpSession[bss_entry];
1129 pStaDs = dphGetHashEntry(pMac, sta_entry,
1130 &psessionEntry->dph.dphHashTable);
1131 if (NULL == pStaDs)
1132 {
1133 continue;
1134 }
1135 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR,
1136 FL("Deleting pmfSaQueryTimer for staid[%d]"),
1137 pStaDs->staIndex) ;
1138 tx_timer_deactivate(&pStaDs->pmfSaQueryTimer);
1139 tx_timer_delete(&pStaDs->pmfSaQueryTimer);
1140 }
1141 }
1142 }
1143 }
1144#endif
1145
Jeff Johnson295189b2012-06-20 16:38:30 -07001146 /// Cleanup cached scan list
1147 limReInitScanResults(pMac);
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07001148#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
1149 /// Cleanup cached scan list
1150 limReInitLfrScanResults(pMac);
1151#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001152
1153} /*** end limCleanupMlm() ***/
1154
1155
1156
1157/**
1158 * limCleanupLmm()
1159 *
1160 *FUNCTION:
1161 * This function is called to cleanup any resources
1162 * allocated by LMM sub-module.
1163 *
1164 *PARAMS:
1165 *
1166 *LOGIC:
1167 *
1168 *ASSUMPTIONS:
1169 * NA
1170 *
1171 *NOTE:
1172 * NA
1173 *
1174 * @param pMac Pointer to Global MAC structure
1175 * @return None
1176 */
1177
1178void
1179limCleanupLmm(tpAniSirGlobal pMac)
1180{
Jeff Johnson295189b2012-06-20 16:38:30 -07001181} /*** end limCleanupLmm() ***/
1182
1183
1184
1185/**
1186 * limIsAddrBC()
1187 *
1188 *FUNCTION:
1189 * This function is called in various places within LIM code
1190 * to determine whether passed MAC address is a broadcast or not
1191 *
1192 *LOGIC:
1193 *
1194 *ASSUMPTIONS:
1195 * NA
1196 *
1197 *NOTE:
1198 * NA
1199 *
1200 * @param macAddr Indicates MAC address that need to be determined
1201 * whether it is Broadcast address or not
1202 *
1203 * @return true if passed address is Broadcast address else false
1204 */
1205
1206tANI_U8
1207limIsAddrBC(tSirMacAddr macAddr)
1208{
1209 int i;
1210 for (i = 0; i < 6; i++)
1211 {
1212 if ((macAddr[i] & 0xFF) != 0xFF)
1213 return false;
1214 }
1215
1216 return true;
1217} /****** end limIsAddrBC() ******/
1218
1219
1220
1221/**
1222 * limIsGroupAddr()
1223 *
1224 *FUNCTION:
1225 * This function is called in various places within LIM code
1226 * to determine whether passed MAC address is a group address or not
1227 *
1228 *LOGIC:
1229 * If least significant bit of first octet of the MAC address is
1230 * set to 1, it is a Group address.
1231 *
1232 *ASSUMPTIONS:
1233 * NA
1234 *
1235 *NOTE:
1236 * NA
1237 *
1238 * @param macAddr Indicates MAC address that need to be determined
1239 * whether it is Group address or not
1240 *
1241 * @return true if passed address is Group address else false
1242 */
1243
1244tANI_U8
1245limIsGroupAddr(tSirMacAddr macAddr)
1246{
1247 if ((macAddr[0] & 0x01) == 0x01)
1248 return true;
1249 else
1250 return false;
1251} /****** end limIsGroupAddr() ******/
1252
1253/**
1254 * limPostMsgApiNoWait()
1255 *
1256 *FUNCTION:
1257 * This function is called from other thread while posting a
1258 * message to LIM message Queue gSirLimMsgQ with NO_WAIT option
1259 *
1260 *LOGIC:
1261 * NA
1262 *
1263 *ASSUMPTIONS:
1264 * NA
1265 *
1266 *NOTE:
1267 * NA
1268 *
1269 * @param pMsg - Pointer to the Global MAC structure
1270 * @param pMsg - Pointer to the message structure
1271 * @return None
1272 */
1273
1274tANI_U32
1275limPostMsgApiNoWait(tpAniSirGlobal pMac, tSirMsgQ *pMsg)
1276{
Jeff Johnson295189b2012-06-20 16:38:30 -07001277 limProcessMessages(pMac, pMsg);
1278 return TX_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -07001279} /*** end limPostMsgApiNoWait() ***/
1280
1281
1282
1283/**
1284 * limPrintMacAddr()
1285 *
1286 *FUNCTION:
1287 * This function is called to print passed MAC address
1288 * in : format.
1289 *
1290 *LOGIC:
1291 *
1292 *ASSUMPTIONS:
1293 * NA
1294 *
1295 *NOTE:
1296 * @param macAddr - MacAddr to be printed
1297 * @param logLevel - Loglevel to be used
1298 *
1299 * @return None.
1300 */
1301
1302void
1303limPrintMacAddr(tpAniSirGlobal pMac, tSirMacAddr macAddr, tANI_U8 logLevel)
1304{
1305 limLog(pMac, logLevel,
Arif Hussaina7c8e412013-11-20 11:06:42 -08001306 FL(MAC_ADDRESS_STR), MAC_ADDR_ARRAY(macAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001307} /****** end limPrintMacAddr() ******/
1308
1309
Jeff Johnson295189b2012-06-20 16:38:30 -07001310/*
1311 * limResetDeferredMsgQ()
1312 *
1313 *FUNCTION:
1314 * This function resets the deferred message queue parameters.
1315 *
1316 *PARAMS:
1317 * @param pMac - Pointer to Global MAC structure
1318 *
1319 *LOGIC:
1320 *
1321 *ASSUMPTIONS:
1322 * NA
1323 *
1324 *NOTE:
1325 * NA
1326 *
1327 *RETURNS:
1328 * None
1329 */
1330
1331void limResetDeferredMsgQ(tpAniSirGlobal pMac)
1332{
1333 pMac->lim.gLimDeferredMsgQ.size =
1334 pMac->lim.gLimDeferredMsgQ.write =
1335 pMac->lim.gLimDeferredMsgQ.read = 0;
1336
1337}
1338
1339
1340#define LIM_DEFERRED_Q_CHECK_THRESHOLD (MAX_DEFERRED_QUEUE_LEN/2)
1341#define LIM_MAX_NUM_MGMT_FRAME_DEFERRED (MAX_DEFERRED_QUEUE_LEN/2)
1342
1343/*
1344 * limWriteDeferredMsgQ()
1345 *
1346 *FUNCTION:
1347 * This function queues up a deferred message for later processing on the
1348 * STA side.
1349 *
1350 *PARAMS:
1351 * @param pMac - Pointer to Global MAC structure
1352 * @param limMsg - a LIM message
1353 *
1354 *LOGIC:
1355 *
1356 *ASSUMPTIONS:
1357 * NA
1358 *
1359 *NOTE:
1360 * NA
1361 *
1362 *RETURNS:
1363 * None
1364 */
1365
1366tANI_U8 limWriteDeferredMsgQ(tpAniSirGlobal pMac, tpSirMsgQ limMsg)
1367{
1368 PELOG1(limLog(pMac, LOG1,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001369 FL("** Queue a deferred message (size %d, write %d) - type 0x%x **"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001370 pMac->lim.gLimDeferredMsgQ.size, pMac->lim.gLimDeferredMsgQ.write,
1371 limMsg->type);)
1372
1373 /*
1374 ** check if the deferred message queue is full
1375 **/
1376 if (pMac->lim.gLimDeferredMsgQ.size >= MAX_DEFERRED_QUEUE_LEN)
1377 {
Leela Venkata Kiran Kumar Reddy Chirala2247e962013-03-22 19:21:10 -07001378 if(!(pMac->lim.deferredMsgCnt & 0xF))
1379 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001380 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 -07001381 }
1382 else
1383 {
1384 pMac->lim.deferredMsgCnt++;
1385 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001386 return TX_QUEUE_FULL;
1387 }
1388
1389 /*
1390 ** In the application, there should not be more than 1 message get
1391 ** queued up. If happens, flags a warning. In the future, this can
1392 ** happen.
1393 **/
1394 if (pMac->lim.gLimDeferredMsgQ.size > 0)
1395 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001396 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 -07001397 pMac->lim.gLimDeferredMsgQ.size, limMsg->type,
1398 limIsSystemInScanState(pMac),
1399 pMac->lim.gLimSmeState, pMac->lim.gLimMlmState,
1400 pMac->lim.gLimAddtsSent);)
1401 }
1402
1403 /*
1404 ** To prevent the deferred Q is full of management frames, only give them certain space
1405 **/
1406 if( SIR_BB_XPORT_MGMT_MSG == limMsg->type )
1407 {
1408 if( LIM_DEFERRED_Q_CHECK_THRESHOLD < pMac->lim.gLimDeferredMsgQ.size )
1409 {
1410 tANI_U16 idx, count = 0;
1411 for(idx = 0; idx < pMac->lim.gLimDeferredMsgQ.size; idx++)
1412 {
1413 if( SIR_BB_XPORT_MGMT_MSG == pMac->lim.gLimDeferredMsgQ.deferredQueue[idx].type )
1414 {
1415 count++;
1416 }
1417 }
1418 if( LIM_MAX_NUM_MGMT_FRAME_DEFERRED < count )
1419 {
1420 //We reach the quota for management frames, drop this one
Madan Mohan Koyyalamudi5695b502012-09-24 14:21:12 -07001421 PELOGW(limLog(pMac, LOGW, FL("Cannot deferred. Msg: %d Too many (count=%d) already"), limMsg->type, count);)
Jeff Johnson295189b2012-06-20 16:38:30 -07001422 //Return error, caller knows what to do
1423 return TX_QUEUE_FULL;
1424 }
1425 }
1426 }
1427
1428 ++pMac->lim.gLimDeferredMsgQ.size;
1429
Leela Venkata Kiran Kumar Reddy Chirala2247e962013-03-22 19:21:10 -07001430 /* reset the count here since we are able to defer the message */
1431 if(pMac->lim.deferredMsgCnt != 0)
1432 {
1433 pMac->lim.deferredMsgCnt = 0;
1434 }
1435
Jeff Johnson295189b2012-06-20 16:38:30 -07001436 /*
1437 ** if the write pointer hits the end of the queue, rewind it
1438 **/
1439 if (pMac->lim.gLimDeferredMsgQ.write >= MAX_DEFERRED_QUEUE_LEN)
1440 pMac->lim.gLimDeferredMsgQ.write = 0;
1441
1442 /*
1443 ** save the message to the queue and advanced the write pointer
1444 **/
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301445 vos_mem_copy( (tANI_U8 *)&pMac->lim.gLimDeferredMsgQ.deferredQueue[
1446 pMac->lim.gLimDeferredMsgQ.write++],
Jeff Johnson295189b2012-06-20 16:38:30 -07001447 (tANI_U8 *)limMsg,
1448 sizeof(tSirMsgQ));
1449 return TX_SUCCESS;
1450
1451}
1452
1453/*
1454 * limReadDeferredMsgQ()
1455 *
1456 *FUNCTION:
1457 * This function dequeues a deferred message for processing on the
1458 * STA side.
1459 *
1460 *PARAMS:
1461 * @param pMac - Pointer to Global MAC structure
1462 *
1463 *LOGIC:
1464 *
1465 *ASSUMPTIONS:
1466 * NA
1467 *
1468 *NOTE:
1469 *
1470 *
1471 *RETURNS:
1472 * Returns the message at the head of the deferred message queue
1473 */
1474
1475tSirMsgQ* limReadDeferredMsgQ(tpAniSirGlobal pMac)
1476{
1477 tSirMsgQ *msg;
1478
1479 /*
1480 ** check any messages left. If no, return
1481 **/
1482 if (pMac->lim.gLimDeferredMsgQ.size <= 0)
1483 return NULL;
1484
1485 /*
1486 ** decrement the queue size
1487 **/
1488 pMac->lim.gLimDeferredMsgQ.size--;
1489
1490 /*
1491 ** retrieve the message from the head of the queue
1492 **/
1493 msg = &pMac->lim.gLimDeferredMsgQ.deferredQueue[pMac->lim.gLimDeferredMsgQ.read];
1494
1495 /*
1496 ** advance the read pointer
1497 **/
1498 pMac->lim.gLimDeferredMsgQ.read++;
1499
1500 /*
1501 ** if the read pointer hits the end of the queue, rewind it
1502 **/
1503 if (pMac->lim.gLimDeferredMsgQ.read >= MAX_DEFERRED_QUEUE_LEN)
1504 pMac->lim.gLimDeferredMsgQ.read = 0;
1505
1506 PELOG1(limLog(pMac, LOG1,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001507 FL("** DeQueue a deferred message (size %d read %d) - type 0x%x **"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001508 pMac->lim.gLimDeferredMsgQ.size, pMac->lim.gLimDeferredMsgQ.read,
1509 msg->type);)
1510
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001511 PELOG1(limLog(pMac, LOG1, FL("DQ msg -- scan %d, global sme %d, global mlme %d, addts %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001512 limIsSystemInScanState(pMac),
1513 pMac->lim.gLimSmeState, pMac->lim.gLimMlmState,
1514 pMac->lim.gLimAddtsSent);)
1515
1516 return(msg);
1517}
1518
1519tSirRetStatus
1520limSysProcessMmhMsgApi(tpAniSirGlobal pMac,
1521 tSirMsgQ *pMsg,
1522 tANI_U8 qType)
1523{
1524// FIXME
Jeff Johnson295189b2012-06-20 16:38:30 -07001525 SysProcessMmhMsg(pMac, pMsg);
1526 return eSIR_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -07001527}
1528
1529char *limFrameStr(tANI_U32 type, tANI_U32 subType)
1530{
1531#ifdef FIXME_GEN6
1532
1533 if (type == SIR_MAC_MGMT_FRAME)
1534 {
1535 switch (subType)
1536 {
1537 case SIR_MAC_MGMT_ASSOC_REQ:
1538 return "MAC_MGMT_ASSOC_REQ";
1539 case SIR_MAC_MGMT_ASSOC_RSP:
1540 return "MAC_MGMT_ASSOC_RSP";
1541 case SIR_MAC_MGMT_REASSOC_REQ:
1542 return "MAC_MGMT_REASSOC_REQ";
1543 case SIR_MAC_MGMT_REASSOC_RSP:
1544 return "MAC_MGMT_REASSOC_RSP";
1545 case SIR_MAC_MGMT_PROBE_REQ:
1546 return "MAC_MGMT_PROBE_REQ";
1547 case SIR_MAC_MGMT_PROBE_RSP:
1548 return "MAC_MGMT_PROBE_RSP";
1549 case SIR_MAC_MGMT_BEACON:
1550 return "MAC_MGMT_BEACON";
1551 case SIR_MAC_MGMT_ATIM:
1552 return "MAC_MGMT_ATIM";
1553 case SIR_MAC_MGMT_DISASSOC:
1554 return "MAC_MGMT_DISASSOC";
1555 case SIR_MAC_MGMT_AUTH:
1556 return "MAC_MGMT_AUTH";
1557 case SIR_MAC_MGMT_DEAUTH:
1558 return "MAC_MGMT_DEAUTH";
1559 case SIR_MAC_MGMT_ACTION:
1560 return "MAC_MGMT_ACTION";
1561 case SIR_MAC_MGMT_RESERVED15:
1562 return "MAC_MGMT_RESERVED15";
1563 default:
1564 return "Unknown MGMT Frame";
1565 }
1566 }
1567
1568 else if (type == SIR_MAC_CTRL_FRAME)
1569 {
1570 switch (subType)
1571 {
1572 case SIR_MAC_CTRL_RR:
1573 return "MAC_CTRL_RR";
1574 case SIR_MAC_CTRL_BAR:
1575 return "MAC_CTRL_BAR";
1576 case SIR_MAC_CTRL_BA:
1577 return "MAC_CTRL_BA";
1578 case SIR_MAC_CTRL_PS_POLL:
1579 return "MAC_CTRL_PS_POLL";
1580 case SIR_MAC_CTRL_RTS:
1581 return "MAC_CTRL_RTS";
1582 case SIR_MAC_CTRL_CTS:
1583 return "MAC_CTRL_CTS";
1584 case SIR_MAC_CTRL_ACK:
1585 return "MAC_CTRL_ACK";
1586 case SIR_MAC_CTRL_CF_END:
1587 return "MAC_CTRL_CF_END";
1588 case SIR_MAC_CTRL_CF_END_ACK:
1589 return "MAC_CTRL_CF_END_ACK";
1590 default:
1591 return "Unknown CTRL Frame";
1592 }
1593 }
1594
1595 else if (type == SIR_MAC_DATA_FRAME)
1596 {
1597 switch (subType)
1598 {
1599 case SIR_MAC_DATA_DATA:
1600 return "MAC_DATA_DATA";
1601 case SIR_MAC_DATA_DATA_ACK:
1602 return "MAC_DATA_DATA_ACK";
1603 case SIR_MAC_DATA_DATA_POLL:
1604 return "MAC_DATA_DATA_POLL";
1605 case SIR_MAC_DATA_DATA_ACK_POLL:
1606 return "MAC_DATA_DATA_ACK_POLL";
1607 case SIR_MAC_DATA_NULL:
1608 return "MAC_DATA_NULL";
1609 case SIR_MAC_DATA_NULL_ACK:
1610 return "MAC_DATA_NULL_ACK";
1611 case SIR_MAC_DATA_NULL_POLL:
1612 return "MAC_DATA_NULL_POLL";
1613 case SIR_MAC_DATA_NULL_ACK_POLL:
1614 return "MAC_DATA_NULL_ACK_POLL";
1615 case SIR_MAC_DATA_QOS_DATA:
1616 return "MAC_DATA_QOS_DATA";
1617 case SIR_MAC_DATA_QOS_DATA_ACK:
1618 return "MAC_DATA_QOS_DATA_ACK";
1619 case SIR_MAC_DATA_QOS_DATA_POLL:
1620 return "MAC_DATA_QOS_DATA_POLL";
1621 case SIR_MAC_DATA_QOS_DATA_ACK_POLL:
1622 return "MAC_DATA_QOS_DATA_ACK_POLL";
1623 case SIR_MAC_DATA_QOS_NULL:
1624 return "MAC_DATA_QOS_NULL";
1625 case SIR_MAC_DATA_QOS_NULL_ACK:
1626 return "MAC_DATA_QOS_NULL_ACK";
1627 case SIR_MAC_DATA_QOS_NULL_POLL:
1628 return "MAC_DATA_QOS_NULL_POLL";
1629 case SIR_MAC_DATA_QOS_NULL_ACK_POLL:
1630 return "MAC_DATA_QOS_NULL_ACK_POLL";
1631 default:
1632 return "Unknown Data Frame";
1633 }
1634 }
1635 else
1636 return "Unknown";
1637#endif
1638return "";
1639}
1640
Jeff Johnson295189b2012-06-20 16:38:30 -07001641void limHandleUpdateOlbcCache(tpAniSirGlobal pMac)
1642{
1643 int i;
1644 static int enable;
1645 tUpdateBeaconParams beaconParams;
1646
1647 tpPESession psessionEntry = limIsApSessionActive(pMac);
1648
1649 if (psessionEntry == NULL)
Madan Mohan Koyyalamudi788b4ee2012-09-25 10:42:09 -07001650 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001651 PELOGE(limLog(pMac, LOGE, FL(" Session not found"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001652 return;
Madan Mohan Koyyalamudi788b4ee2012-09-25 10:42:09 -07001653 }
Pratik Bhalgatb44ea3f2012-11-22 16:41:39 +05301654
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301655 vos_mem_set( ( tANI_U8* )&beaconParams, sizeof( tUpdateBeaconParams), 0);
Madan Mohan Koyyalamudib2733142012-10-31 13:59:17 -07001656 beaconParams.bssIdx = psessionEntry->bssIdx;
Jeff Johnson295189b2012-06-20 16:38:30 -07001657
1658 beaconParams.paramChangeBitmap = 0;
1659 /*
1660 ** This is doing a 2 pass check. The first pass is to invalidate
1661 ** all the cache entries. The second pass is to decide whether to
1662 ** disable protection.
1663 **/
1664 if (!enable)
1665 {
1666
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001667 PELOG2(limLog(pMac, LOG2, FL("Resetting OLBC cache"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001668 psessionEntry->gLimOlbcParams.numSta = 0;
1669 psessionEntry->gLimOverlap11gParams.numSta = 0;
1670 psessionEntry->gLimOverlapHt20Params.numSta = 0;
1671 psessionEntry->gLimNonGfParams.numSta = 0;
1672 psessionEntry->gLimLsigTxopParams.numSta = 0;
1673
1674 for (i=0; i < LIM_PROT_STA_OVERLAP_CACHE_SIZE; i++)
1675 pMac->lim.protStaOverlapCache[i].active = false;
1676
1677 enable = 1;
1678 }
1679 else
1680 {
1681
Madan Mohan Koyyalamudi788b4ee2012-09-25 10:42:09 -07001682 if (!psessionEntry->gLimOlbcParams.numSta)
Jeff Johnson295189b2012-06-20 16:38:30 -07001683 {
1684 if (psessionEntry->gLimOlbcParams.protectionEnabled)
1685 {
1686 if (!psessionEntry->gLim11bParams.protectionEnabled)
1687 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001688 PELOG1(limLog(pMac, LOG1, FL("Overlap cache all clear and no 11B STA detected"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001689 limEnable11gProtection(pMac, false, true, &beaconParams, psessionEntry);
1690 }
1691 }
1692 }
1693
1694 if (!psessionEntry->gLimOverlap11gParams.numSta)
1695 {
1696 if (psessionEntry->gLimOverlap11gParams.protectionEnabled)
1697 {
1698 if (!psessionEntry->gLim11gParams.protectionEnabled)
1699 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001700 PELOG1(limLog(pMac, LOG1, FL("Overlap cache all clear and no 11G STA detected"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001701 limEnableHtProtectionFrom11g(pMac, false, true, &beaconParams,psessionEntry);
1702 }
1703 }
1704 }
1705
1706 if (!psessionEntry->gLimOverlapHt20Params.numSta)
1707 {
1708 if (psessionEntry->gLimOverlapHt20Params.protectionEnabled)
1709 {
1710 if (!psessionEntry->gLimHt20Params.protectionEnabled)
1711 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001712 PELOG1(limLog(pMac, LOG1, FL("Overlap cache all clear and no HT20 STA detected"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001713 limEnable11gProtection(pMac, false, true, &beaconParams,psessionEntry);
1714 }
1715 }
1716 }
1717
1718 enable = 0;
1719 }
1720
1721 if(beaconParams.paramChangeBitmap)
1722 {
1723 schSetFixedBeaconFields(pMac,psessionEntry);
1724 limSendBeaconParams(pMac, &beaconParams, psessionEntry);
1725 }
1726
1727 // Start OLBC timer
1728 if (tx_timer_activate(&pMac->lim.limTimers.gLimUpdateOlbcCacheTimer) != TX_SUCCESS)
1729 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001730 limLog(pMac, LOGE, FL("tx_timer_activate failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001731 }
1732}
Jeff Johnson295189b2012-06-20 16:38:30 -07001733
1734/**
1735 * limIsNullSsid()
1736 *
1737 *FUNCTION:
1738 * This function checks if Ssid supplied is Null SSID
1739 *
1740 *
1741 *LOGIC:
1742 *
1743 *ASSUMPTIONS:
1744 * NA
1745 *
1746 *NOTE:
1747 * NA
1748 *
1749 * @param tSirMacSSid *
1750 *
1751 *
1752 * @return true if SSID is Null SSID else false
1753 */
1754
1755tANI_U8
1756limIsNullSsid( tSirMacSSid *pSsid )
1757{
1758 tANI_U8 fNullSsid = false;
1759 tANI_U32 SsidLength;
1760 tANI_U8 *pSsidStr;
1761
1762 do
1763 {
1764 if ( 0 == pSsid->length )
1765 {
1766 fNullSsid = true;
1767 break;
1768 }
1769
1770#define ASCII_SPACE_CHARACTER 0x20
Sandeep Puligillaf67f9ae2014-03-28 22:40:20 +05301771 /* If the first charactes is space and SSID length is 1
1772 * then consider it as NULL SSID*/
1773 if ((ASCII_SPACE_CHARACTER == pSsid->ssId[0]) &&
1774 (pSsid->length == 1))
Jeff Johnson295189b2012-06-20 16:38:30 -07001775 {
Sandeep Puligillaf67f9ae2014-03-28 22:40:20 +05301776 fNullSsid = true;
1777 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07001778 }
1779 else
1780 {
1781 /* check if all the charactes in SSID are NULL*/
1782 SsidLength = pSsid->length;
1783 pSsidStr = pSsid->ssId;
1784
1785 while ( SsidLength )
1786 {
1787 if( *pSsidStr )
1788 break;
1789
1790 pSsidStr++;
1791 SsidLength--;
1792 }
1793
1794 if( 0 == SsidLength )
1795 {
1796 fNullSsid = true;
1797 break;
1798 }
1799 }
1800 }
1801 while( 0 );
1802
1803 return fNullSsid;
1804} /****** end limIsNullSsid() ******/
1805
1806
1807
Jeff Johnson295189b2012-06-20 16:38:30 -07001808
1809/** -------------------------------------------------------------
1810\fn limUpdateProtStaParams
1811\brief updates protection related counters.
1812\param tpAniSirGlobal pMac
1813\param tSirMacAddr peerMacAddr
1814\param tLimProtStaCacheType protStaCacheType
1815\param tHalBitVal gfSupported
1816\param tHalBitVal lsigTxopSupported
1817\return None
1818 -------------------------------------------------------------*/
1819void
1820limUpdateProtStaParams(tpAniSirGlobal pMac,
1821tSirMacAddr peerMacAddr, tLimProtStaCacheType protStaCacheType,
1822tHalBitVal gfSupported, tHalBitVal lsigTxopSupported,
1823tpPESession psessionEntry)
1824{
1825 tANI_U32 i;
1826
1827 PELOG1(limLog(pMac,LOG1, FL("A STA is associated:"));
1828 limLog(pMac,LOG1, FL("Addr : "));
1829 limPrintMacAddr(pMac, peerMacAddr, LOG1);)
1830
1831 for (i=0; i<LIM_PROT_STA_CACHE_SIZE; i++)
1832 {
1833 if (psessionEntry->protStaCache[i].active)
1834 {
1835 PELOG1(limLog(pMac, LOG1, FL("Addr: "));)
1836 PELOG1(limPrintMacAddr(pMac, psessionEntry->protStaCache[i].addr, LOG1);)
1837
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301838 if (vos_mem_compare(
Jeff Johnson295189b2012-06-20 16:38:30 -07001839 psessionEntry->protStaCache[i].addr,
1840 peerMacAddr, sizeof(tSirMacAddr)))
1841 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001842 PELOG1(limLog(pMac, LOG1, FL("matching cache entry at %d already active."), i);)
Jeff Johnson295189b2012-06-20 16:38:30 -07001843 return;
1844 }
1845 }
1846 }
1847
1848 for (i=0; i<LIM_PROT_STA_CACHE_SIZE; i++)
1849 {
1850 if (!psessionEntry->protStaCache[i].active)
1851 break;
1852 }
1853
1854 if (i >= LIM_PROT_STA_CACHE_SIZE)
1855 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001856 PELOGE(limLog(pMac, LOGE, FL("No space in ProtStaCache"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001857 return;
1858 }
1859
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301860 vos_mem_copy( psessionEntry->protStaCache[i].addr,
Jeff Johnson295189b2012-06-20 16:38:30 -07001861 peerMacAddr,
1862 sizeof(tSirMacAddr));
1863
1864 psessionEntry->protStaCache[i].protStaCacheType = protStaCacheType;
1865 psessionEntry->protStaCache[i].active = true;
1866 if(eLIM_PROT_STA_CACHE_TYPE_llB == protStaCacheType)
1867 {
1868 psessionEntry->gLim11bParams.numSta++;
1869 limLog(pMac,LOG1, FL("11B, "));
1870 }
1871 else if(eLIM_PROT_STA_CACHE_TYPE_llG == protStaCacheType)
1872 {
1873 psessionEntry->gLim11gParams.numSta++;
1874 limLog(pMac,LOG1, FL("11G, "));
1875 }
1876 else if(eLIM_PROT_STA_CACHE_TYPE_HT20 == protStaCacheType)
1877 {
1878 psessionEntry->gLimHt20Params.numSta++;
1879 limLog(pMac,LOG1, FL("HT20, "));
1880 }
1881
1882 if(!gfSupported)
1883 {
1884 psessionEntry->gLimNonGfParams.numSta++;
1885 limLog(pMac,LOG1, FL("NonGf, "));
1886 }
1887 if(!lsigTxopSupported)
1888 {
1889 psessionEntry->gLimLsigTxopParams.numSta++;
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001890 limLog(pMac,LOG1, FL("!lsigTxopSupported"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001891 }
1892}// ---------------------------------------------------------------------
1893
1894/** -------------------------------------------------------------
1895\fn limDecideApProtection
1896\brief Decides all the protection related staiton coexistence and also sets
1897\ short preamble and short slot appropriately. This function will be called
1898\ when AP is ready to send assocRsp tp the station joining right now.
1899\param tpAniSirGlobal pMac
1900\param tSirMacAddr peerMacAddr
1901\return None
1902 -------------------------------------------------------------*/
1903void
1904limDecideApProtection(tpAniSirGlobal pMac, tSirMacAddr peerMacAddr, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry)
1905{
1906 tANI_U16 tmpAid;
1907 tpDphHashNode pStaDs;
1908 tSirRFBand rfBand = SIR_BAND_UNKNOWN;
1909 tANI_U32 phyMode;
1910 tLimProtStaCacheType protStaCacheType = eLIM_PROT_STA_CACHE_TYPE_INVALID;
1911 tHalBitVal gfSupported = eHAL_SET, lsigTxopSupported = eHAL_SET;
1912
1913 pBeaconParams->paramChangeBitmap = 0;
1914 // check whether to enable protection or not
1915 pStaDs = dphLookupHashEntry(pMac, peerMacAddr, &tmpAid, &psessionEntry->dph.dphHashTable);
1916 if(NULL == pStaDs)
1917 {
Abhishek Singh3cbf6052014-12-15 16:46:42 +05301918 limLog(pMac, LOG1, FL("pStaDs is NULL"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001919 return;
1920 }
1921 limGetRfBand(pMac, &rfBand, psessionEntry);
1922 //if we are in 5 GHZ band
1923 if(SIR_BAND_5_GHZ == rfBand)
1924 {
1925 //We are 11N. we need to protect from 11A and Ht20. we don't need any other protection in 5 GHZ.
1926 //HT20 case is common between both the bands and handled down as common code.
Jeff Johnsone7245742012-09-05 17:12:55 -07001927 if(true == psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07001928 {
1929 //we are 11N and 11A station is joining.
1930 //protection from 11A required.
1931 if(false == pStaDs->mlmStaContext.htCapability)
1932 {
1933 limEnable11aProtection(pMac, true, false, pBeaconParams,psessionEntry);
1934 return;
1935 }
1936 }
1937 }
1938 else if(SIR_BAND_2_4_GHZ== rfBand)
1939 {
1940 limGetPhyMode(pMac, &phyMode, psessionEntry);
1941
1942 //We are 11G. Check if we need protection from 11b Stations.
1943 if ((phyMode == WNI_CFG_PHY_MODE_11G) &&
Jeff Johnsone7245742012-09-05 17:12:55 -07001944 (false == psessionEntry->htCapability))
Jeff Johnson295189b2012-06-20 16:38:30 -07001945 {
1946
1947 if (pStaDs->erpEnabled== eHAL_CLEAR)
1948 {
1949 protStaCacheType = eLIM_PROT_STA_CACHE_TYPE_llB;
1950 // enable protection
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001951 PELOG3(limLog(pMac, LOG3, FL("Enabling protection from 11B"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001952 limEnable11gProtection(pMac, true, false, pBeaconParams,psessionEntry);
1953 }
1954 }
1955
1956 //HT station.
Jeff Johnsone7245742012-09-05 17:12:55 -07001957 if (true == psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07001958 {
1959 //check if we need protection from 11b station
1960 if ((pStaDs->erpEnabled == eHAL_CLEAR) &&
1961 (!pStaDs->mlmStaContext.htCapability))
1962 {
1963 protStaCacheType = eLIM_PROT_STA_CACHE_TYPE_llB;
1964 // enable protection
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001965 PELOG3(limLog(pMac, LOG3, FL("Enabling protection from 11B"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001966 limEnable11gProtection(pMac, true, false, pBeaconParams, psessionEntry);
1967 }
1968 //station being joined is non-11b and non-ht ==> 11g device
1969 else if(!pStaDs->mlmStaContext.htCapability)
1970 {
1971 protStaCacheType = eLIM_PROT_STA_CACHE_TYPE_llG;
1972 //enable protection
1973 limEnableHtProtectionFrom11g(pMac, true, false, pBeaconParams, psessionEntry);
1974 }
1975 //ERP mode is enabled for the latest station joined
1976 //latest station joined is HT capable
1977 //This case is being handled in common code (commn between both the bands) below.
1978 }
1979 }
1980
1981 //we are HT and HT station is joining. This code is common for both the bands.
Jeff Johnsone7245742012-09-05 17:12:55 -07001982 if((true == psessionEntry->htCapability) &&
Jeff Johnson295189b2012-06-20 16:38:30 -07001983 (true == pStaDs->mlmStaContext.htCapability))
1984 {
1985 if(!pStaDs->htGreenfield)
1986 {
1987 limEnableHTNonGfProtection(pMac, true, false, pBeaconParams, psessionEntry);
1988 gfSupported = eHAL_CLEAR;
1989 }
1990 //Station joining is HT 20Mhz
1991 if(eHT_CHANNEL_WIDTH_20MHZ == pStaDs->htSupportedChannelWidthSet)
1992 {
1993 protStaCacheType = eLIM_PROT_STA_CACHE_TYPE_HT20;
1994 limEnableHT20Protection(pMac, true, false, pBeaconParams, psessionEntry);
1995 }
1996 //Station joining does not support LSIG TXOP Protection
1997 if(!pStaDs->htLsigTXOPProtection)
1998 {
1999 limEnableHTLsigTxopProtection(pMac, false, false, pBeaconParams,psessionEntry);
2000 lsigTxopSupported = eHAL_CLEAR;
2001 }
2002 }
2003
2004 limUpdateProtStaParams(pMac, peerMacAddr, protStaCacheType,
2005 gfSupported, lsigTxopSupported, psessionEntry);
2006
2007 return;
2008}
Jeff Johnson295189b2012-06-20 16:38:30 -07002009
2010
2011/** -------------------------------------------------------------
2012\fn limEnableOverlap11gProtection
2013\brief wrapper function for setting overlap 11g protection.
2014\param tpAniSirGlobal pMac
2015\param tpUpdateBeaconParams pBeaconParams
2016\param tpSirMacMgmtHdr pMh
2017\return None
2018 -------------------------------------------------------------*/
2019void
2020limEnableOverlap11gProtection(tpAniSirGlobal pMac,
2021tpUpdateBeaconParams pBeaconParams, tpSirMacMgmtHdr pMh,tpPESession psessionEntry)
2022{
2023 limUpdateOverlapStaParam(pMac, pMh->bssId, &(psessionEntry->gLimOlbcParams));
2024
2025 if (psessionEntry->gLimOlbcParams.numSta &&
2026 !psessionEntry->gLimOlbcParams.protectionEnabled)
2027 {
2028 // enable protection
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002029 PELOG1(limLog(pMac, LOG1, FL("OLBC happens!!!"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002030 limEnable11gProtection(pMac, true, true, pBeaconParams,psessionEntry);
2031 }
2032}
2033
2034
2035/** -------------------------------------------------------------
2036\fn limUpdateShortPreamble
2037\brief Updates short preamble if needed when a new station joins.
2038\param tpAniSirGlobal pMac
2039\param tSirMacAddr peerMacAddr
2040\param tpUpdateBeaconParams pBeaconParams
2041\return None
2042 -------------------------------------------------------------*/
2043void
2044limUpdateShortPreamble(tpAniSirGlobal pMac, tSirMacAddr peerMacAddr,
2045 tpUpdateBeaconParams pBeaconParams, tpPESession psessionEntry)
2046{
2047 tANI_U16 tmpAid;
2048 tpDphHashNode pStaDs;
2049 tANI_U32 phyMode;
2050 tANI_U16 i;
2051
2052 // check whether to enable protection or not
2053 pStaDs = dphLookupHashEntry(pMac, peerMacAddr, &tmpAid, &psessionEntry->dph.dphHashTable);
2054
2055 limGetPhyMode(pMac, &phyMode, psessionEntry);
2056
2057 if (pStaDs != NULL && phyMode == WNI_CFG_PHY_MODE_11G)
2058
2059 {
2060 if (pStaDs->shortPreambleEnabled == eHAL_CLEAR)
2061 {
2062 PELOG1(limLog(pMac,LOG1,FL("Short Preamble is not enabled in Assoc Req from "));
2063 limPrintMacAddr(pMac, peerMacAddr, LOG1);)
2064
2065 for (i=0; i<LIM_PROT_STA_CACHE_SIZE; i++)
2066 {
Jeff Johnson295189b2012-06-20 16:38:30 -07002067 if ((psessionEntry->limSystemRole == eLIM_AP_ROLE ) &&
2068 psessionEntry->gLimNoShortParams.staNoShortCache[i].active)
2069 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05302070 if (vos_mem_compare(
Jeff Johnson295189b2012-06-20 16:38:30 -07002071 psessionEntry->gLimNoShortParams.staNoShortCache[i].addr,
2072 peerMacAddr, sizeof(tSirMacAddr)))
2073 return;
2074 }else if(psessionEntry->limSystemRole != eLIM_AP_ROLE)
Jeff Johnson295189b2012-06-20 16:38:30 -07002075 {
2076 if (pMac->lim.gLimNoShortParams.staNoShortCache[i].active)
2077 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05302078 if (vos_mem_compare(
Jeff Johnson295189b2012-06-20 16:38:30 -07002079 pMac->lim.gLimNoShortParams.staNoShortCache[i].addr,
2080 peerMacAddr, sizeof(tSirMacAddr)))
2081 return;
2082 }
2083 }
2084 }
2085
2086
2087 for (i=0; i<LIM_PROT_STA_CACHE_SIZE; i++)
2088 {
Jeff Johnson295189b2012-06-20 16:38:30 -07002089 if ( (psessionEntry->limSystemRole == eLIM_AP_ROLE ) &&
2090 !psessionEntry->gLimNoShortParams.staNoShortCache[i].active)
2091 break;
2092 else
Jeff Johnson295189b2012-06-20 16:38:30 -07002093 {
2094 if (!pMac->lim.gLimNoShortParams.staNoShortCache[i].active)
2095 break;
2096 }
2097 }
2098
2099 if (i >= LIM_PROT_STA_CACHE_SIZE)
2100 {
Jeff Johnson295189b2012-06-20 16:38:30 -07002101 if(psessionEntry->limSystemRole == eLIM_AP_ROLE){
2102 limLog(pMac, LOGE, FL("No space in Short cache (#active %d, #sta %d) for sta "),
2103 i, psessionEntry->gLimNoShortParams.numNonShortPreambleSta);
2104 limPrintMacAddr(pMac, peerMacAddr, LOGE);
2105 return;
2106 }
2107 else
Jeff Johnson295189b2012-06-20 16:38:30 -07002108 {
2109 limLog(pMac, LOGE, FL("No space in Short cache (#active %d, #sta %d) for sta "),
2110 i, pMac->lim.gLimNoShortParams.numNonShortPreambleSta);
2111 limPrintMacAddr(pMac, peerMacAddr, LOGE);
2112 return;
2113 }
2114
2115 }
2116
2117
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05302118 if (psessionEntry->limSystemRole == eLIM_AP_ROLE){
2119 vos_mem_copy( psessionEntry->gLimNoShortParams.staNoShortCache[i].addr,
Jeff Johnson295189b2012-06-20 16:38:30 -07002120 peerMacAddr, sizeof(tSirMacAddr));
2121 psessionEntry->gLimNoShortParams.staNoShortCache[i].active = true;
2122 psessionEntry->gLimNoShortParams.numNonShortPreambleSta++;
2123 }else
Jeff Johnson295189b2012-06-20 16:38:30 -07002124 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05302125 vos_mem_copy( pMac->lim.gLimNoShortParams.staNoShortCache[i].addr,
Jeff Johnson295189b2012-06-20 16:38:30 -07002126 peerMacAddr, sizeof(tSirMacAddr));
2127 pMac->lim.gLimNoShortParams.staNoShortCache[i].active = true;
2128 pMac->lim.gLimNoShortParams.numNonShortPreambleSta++;
2129 }
2130
2131
2132 // enable long preamble
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002133 PELOG1(limLog(pMac, LOG1, FL("Disabling short preamble"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002134
Jeff Johnson295189b2012-06-20 16:38:30 -07002135 if (limEnableShortPreamble(pMac, false, pBeaconParams, psessionEntry) != eSIR_SUCCESS)
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002136 PELOGE(limLog(pMac, LOGE, FL("Cannot enable long preamble"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002137 }
2138 }
2139}
2140
2141/** -------------------------------------------------------------
2142\fn limUpdateShortSlotTime
2143\brief Updates short slot time if needed when a new station joins.
2144\param tpAniSirGlobal pMac
2145\param tSirMacAddr peerMacAddr
2146\param tpUpdateBeaconParams pBeaconParams
2147\return None
2148 -------------------------------------------------------------*/
2149
2150void
2151limUpdateShortSlotTime(tpAniSirGlobal pMac, tSirMacAddr peerMacAddr,
2152 tpUpdateBeaconParams pBeaconParams, tpPESession psessionEntry)
2153{
2154 tANI_U16 tmpAid;
2155 tpDphHashNode pStaDs;
2156 tANI_U32 phyMode;
2157 tANI_U32 val;
Jeff Johnson295189b2012-06-20 16:38:30 -07002158 tANI_U16 i;
2159
2160 // check whether to enable protection or not
2161 pStaDs = dphLookupHashEntry(pMac, peerMacAddr, &tmpAid, &psessionEntry->dph.dphHashTable);
2162 limGetPhyMode(pMac, &phyMode, psessionEntry);
2163
Jeff Johnsone7245742012-09-05 17:12:55 -07002164 /* Only in case of softap in 11g mode, slot time might change depending on the STA being added. In 11a case, it should
2165 * be always 1 and in 11b case, it should be always 0
2166 */
Jeff Johnson295189b2012-06-20 16:38:30 -07002167 if (pStaDs != NULL && phyMode == WNI_CFG_PHY_MODE_11G)
2168 {
Jeff Johnsone7245742012-09-05 17:12:55 -07002169 /* Only when the new STA has short slot time disabled, we need to change softap's overall slot time settings
2170 * else the default for softap is always short slot enabled. When the last long slot STA leaves softAP, we take care of
2171 * it in limDecideShortSlot
2172 */
Jeff Johnson295189b2012-06-20 16:38:30 -07002173 if (pStaDs->shortSlotTimeEnabled == eHAL_CLEAR)
2174 {
2175 PELOG1(limLog(pMac, LOG1, FL("Short Slot Time is not enabled in Assoc Req from "));
2176 limPrintMacAddr(pMac, peerMacAddr, LOG1);)
2177 for (i=0; i<LIM_PROT_STA_CACHE_SIZE; i++)
2178 {
Jeff Johnson295189b2012-06-20 16:38:30 -07002179 if ((psessionEntry->limSystemRole == eLIM_AP_ROLE ) &&
2180 psessionEntry->gLimNoShortSlotParams.staNoShortSlotCache[i].active)
2181 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05302182 if (vos_mem_compare(
Jeff Johnson295189b2012-06-20 16:38:30 -07002183 psessionEntry->gLimNoShortSlotParams.staNoShortSlotCache[i].addr,
2184 peerMacAddr, sizeof(tSirMacAddr)))
2185 return;
2186 }
2187 else if(psessionEntry->limSystemRole != eLIM_AP_ROLE )
Jeff Johnson295189b2012-06-20 16:38:30 -07002188 {
2189 if (pMac->lim.gLimNoShortSlotParams.staNoShortSlotCache[i].active)
2190 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05302191 if (vos_mem_compare(
Jeff Johnson295189b2012-06-20 16:38:30 -07002192 pMac->lim.gLimNoShortSlotParams.staNoShortSlotCache[i].addr,
2193 peerMacAddr, sizeof(tSirMacAddr)))
2194 return;
2195 }
2196 }
2197 }
2198
2199 for (i=0; i<LIM_PROT_STA_CACHE_SIZE; i++)
2200 {
Jeff Johnson295189b2012-06-20 16:38:30 -07002201 if ((psessionEntry->limSystemRole == eLIM_AP_ROLE ) &&
2202 !psessionEntry->gLimNoShortSlotParams.staNoShortSlotCache[i].active)
2203 break;
2204 else
Jeff Johnson295189b2012-06-20 16:38:30 -07002205 {
2206 if (!pMac->lim.gLimNoShortSlotParams.staNoShortSlotCache[i].active)
2207 break;
2208 }
2209 }
2210
2211 if (i >= LIM_PROT_STA_CACHE_SIZE)
2212 {
Jeff Johnson295189b2012-06-20 16:38:30 -07002213 if(psessionEntry->limSystemRole == eLIM_AP_ROLE){
2214 limLog(pMac, LOGE, FL("No space in ShortSlot cache (#active %d, #sta %d) for sta "),
2215 i, psessionEntry->gLimNoShortSlotParams.numNonShortSlotSta);
2216 limPrintMacAddr(pMac, peerMacAddr, LOGE);
2217 return;
2218 }else
Jeff Johnson295189b2012-06-20 16:38:30 -07002219 {
2220 limLog(pMac, LOGE, FL("No space in ShortSlot cache (#active %d, #sta %d) for sta "),
2221 i, pMac->lim.gLimNoShortSlotParams.numNonShortSlotSta);
2222 limPrintMacAddr(pMac, peerMacAddr, LOGE);
2223 return;
2224 }
2225 }
2226
2227
Jeff Johnson295189b2012-06-20 16:38:30 -07002228 if(psessionEntry->limSystemRole == eLIM_AP_ROLE){
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05302229 vos_mem_copy( psessionEntry->gLimNoShortSlotParams.staNoShortSlotCache[i].addr,
Jeff Johnson295189b2012-06-20 16:38:30 -07002230 peerMacAddr, sizeof(tSirMacAddr));
2231 psessionEntry->gLimNoShortSlotParams.staNoShortSlotCache[i].active = true;
2232 psessionEntry->gLimNoShortSlotParams.numNonShortSlotSta++;
2233 }else
Jeff Johnson295189b2012-06-20 16:38:30 -07002234 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05302235 vos_mem_copy( pMac->lim.gLimNoShortSlotParams.staNoShortSlotCache[i].addr,
Jeff Johnson295189b2012-06-20 16:38:30 -07002236 peerMacAddr, sizeof(tSirMacAddr));
2237 pMac->lim.gLimNoShortSlotParams.staNoShortSlotCache[i].active = true;
2238 pMac->lim.gLimNoShortSlotParams.numNonShortSlotSta++;
2239 }
2240 wlan_cfgGetInt(pMac, WNI_CFG_11G_SHORT_SLOT_TIME_ENABLED, &val);
2241
Jeff Johnsone7245742012-09-05 17:12:55 -07002242 /* 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
2243 * only long slot enabled, we need to change our beacon/pb rsp to broadcast short slot disabled
2244 */
Jeff Johnson295189b2012-06-20 16:38:30 -07002245 if ( (psessionEntry->limSystemRole == eLIM_AP_ROLE) &&
Jeff Johnsone7245742012-09-05 17:12:55 -07002246 (val && psessionEntry->gLimNoShortSlotParams.numNonShortSlotSta && psessionEntry->shortSlotTimeSupported))
Jeff Johnson295189b2012-06-20 16:38:30 -07002247 {
2248 // enable long slot time
2249 pBeaconParams->fShortSlotTime = false;
2250 pBeaconParams->paramChangeBitmap |= PARAM_SHORT_SLOT_TIME_CHANGED;
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002251 PELOG1(limLog(pMac, LOG1, FL("Disable short slot time. Enable long slot time."));)
Jeff Johnsone7245742012-09-05 17:12:55 -07002252 psessionEntry->shortSlotTimeSupported = false;
Jeff Johnson295189b2012-06-20 16:38:30 -07002253 }
2254 else if ( psessionEntry->limSystemRole != eLIM_AP_ROLE)
Jeff Johnson295189b2012-06-20 16:38:30 -07002255 {
Jeff Johnsone7245742012-09-05 17:12:55 -07002256 if (val && pMac->lim.gLimNoShortSlotParams.numNonShortSlotSta && psessionEntry->shortSlotTimeSupported)
Jeff Johnson295189b2012-06-20 16:38:30 -07002257 {
2258 // enable long slot time
2259 pBeaconParams->fShortSlotTime = false;
2260 pBeaconParams->paramChangeBitmap |= PARAM_SHORT_SLOT_TIME_CHANGED;
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002261 PELOG1(limLog(pMac, LOG1, FL("Disable short slot time. Enable long slot time."));)
Jeff Johnsone7245742012-09-05 17:12:55 -07002262 psessionEntry->shortSlotTimeSupported = false;
Jeff Johnson295189b2012-06-20 16:38:30 -07002263 }
2264 }
2265 }
2266 }
2267}
2268
Jeff Johnson295189b2012-06-20 16:38:30 -07002269
2270/** -------------------------------------------------------------
2271\fn limDecideStaProtectionOnAssoc
2272\brief Decide protection related settings on Sta while association.
2273\param tpAniSirGlobal pMac
2274\param tpSchBeaconStruct pBeaconStruct
2275\return None
2276 -------------------------------------------------------------*/
2277void
2278limDecideStaProtectionOnAssoc(tpAniSirGlobal pMac,
2279 tpSchBeaconStruct pBeaconStruct, tpPESession psessionEntry)
2280{
2281 tSirRFBand rfBand = SIR_BAND_UNKNOWN;
2282 tANI_U32 phyMode = WNI_CFG_PHY_MODE_NONE;
2283
2284 limGetRfBand(pMac, &rfBand, psessionEntry);
2285 limGetPhyMode(pMac, &phyMode, psessionEntry);
2286
2287 if(SIR_BAND_5_GHZ == rfBand)
2288 {
2289 if((eSIR_HT_OP_MODE_MIXED == pBeaconStruct->HTInfo.opMode) ||
2290 (eSIR_HT_OP_MODE_OVERLAP_LEGACY == pBeaconStruct->HTInfo.opMode))
2291 {
2292 if(pMac->lim.cfgProtection.fromlla)
2293 psessionEntry->beaconParams.llaCoexist = true;
2294 }
2295 else if(eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT == pBeaconStruct->HTInfo.opMode)
2296 {
2297 if(pMac->lim.cfgProtection.ht20)
2298 psessionEntry->beaconParams.ht20Coexist = true;
2299 }
2300
2301 }
2302 else if(SIR_BAND_2_4_GHZ == rfBand)
2303 {
2304 //spec 7.3.2.13
2305 //UseProtection will be set when nonERP STA is associated.
2306 //NonERPPresent bit will be set when:
2307 //--nonERP Sta is associated OR
2308 //--nonERP Sta exists in overlapping BSS
2309 //when useProtection is not set then protection from nonERP stations is optional.
2310
2311 //CFG protection from 11b is enabled and
2312 //11B device in the BSS
2313 /* TODO, This is not sessionized */
2314 if (phyMode != WNI_CFG_PHY_MODE_11B)
2315 {
2316 if (pMac->lim.cfgProtection.fromllb &&
2317 pBeaconStruct->erpPresent &&
2318 (pBeaconStruct->erpIEInfo.useProtection ||
2319 pBeaconStruct->erpIEInfo.nonErpPresent))
2320 {
2321 psessionEntry->beaconParams.llbCoexist = true;
2322 }
2323 //AP has no 11b station associated.
2324 else
2325 {
2326 psessionEntry->beaconParams.llbCoexist = false;
2327 }
2328 }
2329 //following code block is only for HT station.
Jeff Johnsone7245742012-09-05 17:12:55 -07002330 if((psessionEntry->htCapability) &&
Jeff Johnson295189b2012-06-20 16:38:30 -07002331 (pBeaconStruct->HTInfo.present))
2332 {
2333 tDot11fIEHTInfo htInfo = pBeaconStruct->HTInfo;
2334
2335 //Obss Non HT STA present mode
2336 psessionEntry->beaconParams.gHTObssMode = (tANI_U8)htInfo.obssNonHTStaPresent;
2337
2338
2339 //CFG protection from 11G is enabled and
2340 //our AP has at least one 11G station associated.
2341 if(pMac->lim.cfgProtection.fromllg &&
2342 ((eSIR_HT_OP_MODE_MIXED == htInfo.opMode) ||
2343 (eSIR_HT_OP_MODE_OVERLAP_LEGACY == htInfo.opMode))&&
2344 (!psessionEntry->beaconParams.llbCoexist))
2345 {
2346 if(pMac->lim.cfgProtection.fromllg)
2347 psessionEntry->beaconParams.llgCoexist = true;
2348 }
2349
2350 //AP has only HT stations associated and at least one station is HT 20
2351 //disable protection from any non-HT devices.
2352 //decision for disabling protection from 11b has already been taken above.
2353 if(eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT == htInfo.opMode)
2354 {
2355 //Disable protection from 11G station.
2356 psessionEntry->beaconParams.llgCoexist = false;
2357 //CFG protection from HT 20 is enabled.
2358 if(pMac->lim.cfgProtection.ht20)
2359 psessionEntry->beaconParams.ht20Coexist = true;
2360 }
2361 //Disable protection from non-HT and HT20 devices.
2362 //decision for disabling protection from 11b has already been taken above.
2363 if(eSIR_HT_OP_MODE_PURE == htInfo.opMode)
2364 {
2365 psessionEntry->beaconParams.llgCoexist = false;
2366 psessionEntry->beaconParams.ht20Coexist = false;
2367 }
2368
2369 }
2370 }
2371
2372 //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 -07002373 if((psessionEntry->htCapability) &&
Jeff Johnson295189b2012-06-20 16:38:30 -07002374 (pBeaconStruct->HTInfo.present))
2375 {
2376 tDot11fIEHTInfo htInfo = pBeaconStruct->HTInfo;
2377 psessionEntry->beaconParams.fRIFSMode =
2378 ( tANI_U8 ) htInfo.rifsMode;
2379 psessionEntry->beaconParams.llnNonGFCoexist =
2380 ( tANI_U8 )htInfo.nonGFDevicesPresent;
2381 psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport =
2382 ( tANI_U8 )htInfo.lsigTXOPProtectionFullSupport;
2383 }
2384}
2385
2386
2387/** -------------------------------------------------------------
2388\fn limDecideStaProtection
2389\brief Decides protection related settings on Sta while processing beacon.
2390\param tpAniSirGlobal pMac
2391\param tpUpdateBeaconParams pBeaconParams
2392\return None
2393 -------------------------------------------------------------*/
2394void
2395limDecideStaProtection(tpAniSirGlobal pMac,
2396 tpSchBeaconStruct pBeaconStruct, tpUpdateBeaconParams pBeaconParams, tpPESession psessionEntry)
2397{
2398
2399 tSirRFBand rfBand = SIR_BAND_UNKNOWN;
2400 tANI_U32 phyMode = WNI_CFG_PHY_MODE_NONE;
2401
2402 limGetRfBand(pMac, &rfBand, psessionEntry);
2403 limGetPhyMode(pMac, &phyMode, psessionEntry);
2404
2405 if(SIR_BAND_5_GHZ == rfBand)
2406 {
2407 //we are HT capable.
Jeff Johnsone7245742012-09-05 17:12:55 -07002408 if((true == psessionEntry->htCapability) &&
Jeff Johnson295189b2012-06-20 16:38:30 -07002409 (pBeaconStruct->HTInfo.present))
2410 {
2411 //we are HT capable, AP's HT OPMode is mixed / overlap legacy ==> need protection from 11A.
2412 if((eSIR_HT_OP_MODE_MIXED == pBeaconStruct->HTInfo.opMode) ||
2413 (eSIR_HT_OP_MODE_OVERLAP_LEGACY == pBeaconStruct->HTInfo.opMode))
2414 {
2415 limEnable11aProtection(pMac, true, false, pBeaconParams,psessionEntry);
2416 }
2417 //we are HT capable, AP's HT OPMode is HT20 ==> disable protection from 11A if enabled. enabled
2418 //protection from HT20 if needed.
2419 else if(eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT== pBeaconStruct->HTInfo.opMode)
2420 {
2421 limEnable11aProtection(pMac, false, false, pBeaconParams,psessionEntry);
2422 limEnableHT20Protection(pMac, true, false, pBeaconParams,psessionEntry);
2423 }
2424 else if(eSIR_HT_OP_MODE_PURE == pBeaconStruct->HTInfo.opMode)
2425 {
2426 limEnable11aProtection(pMac, false, false, pBeaconParams,psessionEntry);
2427 limEnableHT20Protection(pMac, false, false, pBeaconParams,psessionEntry);
2428 }
2429 }
2430 }
2431 else if(SIR_BAND_2_4_GHZ == rfBand)
2432 {
2433 /* spec 7.3.2.13
2434 * UseProtection will be set when nonERP STA is associated.
2435 * NonERPPresent bit will be set when:
2436 * --nonERP Sta is associated OR
2437 * --nonERP Sta exists in overlapping BSS
2438 * when useProtection is not set then protection from nonERP stations is optional.
2439 */
2440
2441 if (phyMode != WNI_CFG_PHY_MODE_11B)
2442 {
2443 if (pBeaconStruct->erpPresent &&
2444 (pBeaconStruct->erpIEInfo.useProtection ||
2445 pBeaconStruct->erpIEInfo.nonErpPresent))
2446 {
2447 limEnable11gProtection(pMac, true, false, pBeaconParams, psessionEntry);
2448 }
2449 //AP has no 11b station associated.
2450 else
2451 {
2452 //disable protection from 11b station
2453 limEnable11gProtection(pMac, false, false, pBeaconParams, psessionEntry);
2454 }
2455 }
2456
2457 //following code block is only for HT station.
Jeff Johnsone7245742012-09-05 17:12:55 -07002458 if((psessionEntry->htCapability) &&
Jeff Johnson295189b2012-06-20 16:38:30 -07002459 (pBeaconStruct->HTInfo.present))
2460 {
2461
2462 tDot11fIEHTInfo htInfo = pBeaconStruct->HTInfo;
2463 //AP has at least one 11G station associated.
2464 if(((eSIR_HT_OP_MODE_MIXED == htInfo.opMode) ||
2465 (eSIR_HT_OP_MODE_OVERLAP_LEGACY == htInfo.opMode))&&
2466 (!psessionEntry->beaconParams.llbCoexist))
2467 {
2468 limEnableHtProtectionFrom11g(pMac, true, false, pBeaconParams,psessionEntry);
2469
2470 }
2471
2472 //no HT operating mode change ==> no change in protection settings except for MIXED_MODE/Legacy Mode.
2473 //in Mixed mode/legacy Mode even if there is no change in HT operating mode, there might be change in 11bCoexist
2474 //or 11gCoexist. that is why this check is being done after mixed/legacy mode check.
2475 if ( pMac->lim.gHTOperMode != ( tSirMacHTOperatingMode )htInfo.opMode )
2476 {
2477 pMac->lim.gHTOperMode = ( tSirMacHTOperatingMode )htInfo.opMode;
2478
2479 //AP has only HT stations associated and at least one station is HT 20
2480 //disable protection from any non-HT devices.
2481 //decision for disabling protection from 11b has already been taken above.
2482 if(eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT == htInfo.opMode)
2483 {
2484 //Disable protection from 11G station.
2485 limEnableHtProtectionFrom11g(pMac, false, false, pBeaconParams,psessionEntry);
2486
2487 limEnableHT20Protection(pMac, true, false, pBeaconParams,psessionEntry);
2488 }
2489 //Disable protection from non-HT and HT20 devices.
2490 //decision for disabling protection from 11b has already been taken above.
2491 else if(eSIR_HT_OP_MODE_PURE == htInfo.opMode)
2492 {
2493 limEnableHtProtectionFrom11g(pMac, false, false, pBeaconParams,psessionEntry);
2494 limEnableHT20Protection(pMac, false, false, pBeaconParams,psessionEntry);
2495
2496 }
2497 }
2498 }
2499 }
2500
2501 //following code block is only for HT station. ( 2.4 GHZ as well as 5 GHZ)
Jeff Johnsone7245742012-09-05 17:12:55 -07002502 if((psessionEntry->htCapability) &&
Jeff Johnson295189b2012-06-20 16:38:30 -07002503 (pBeaconStruct->HTInfo.present))
2504 {
2505 tDot11fIEHTInfo htInfo = pBeaconStruct->HTInfo;
2506 //Check for changes in protection related factors other than HT operating mode.
2507 //Check for changes in RIFS mode, nonGFDevicesPresent, lsigTXOPProtectionFullSupport.
2508 if ( psessionEntry->beaconParams.fRIFSMode !=
2509 ( tANI_U8 ) htInfo.rifsMode )
2510 {
2511 pBeaconParams->fRIFSMode =
2512 psessionEntry->beaconParams.fRIFSMode =
2513 ( tANI_U8 ) htInfo.rifsMode;
2514 pBeaconParams->paramChangeBitmap |= PARAM_RIFS_MODE_CHANGED;
2515 }
2516
2517 if ( psessionEntry->beaconParams.llnNonGFCoexist !=
2518 htInfo.nonGFDevicesPresent )
2519 {
2520 pBeaconParams->llnNonGFCoexist =
2521 psessionEntry->beaconParams.llnNonGFCoexist =
2522 ( tANI_U8 )htInfo.nonGFDevicesPresent;
2523 pBeaconParams->paramChangeBitmap |=
2524 PARAM_NON_GF_DEVICES_PRESENT_CHANGED;
2525 }
2526
2527 if ( psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport !=
2528 ( tANI_U8 )htInfo.lsigTXOPProtectionFullSupport )
2529 {
2530 pBeaconParams->fLsigTXOPProtectionFullSupport =
2531 psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport =
2532 ( tANI_U8 )htInfo.lsigTXOPProtectionFullSupport;
2533 pBeaconParams->paramChangeBitmap |=
2534 PARAM_LSIG_TXOP_FULL_SUPPORT_CHANGED;
2535 }
2536
2537 // For Station just update the global lim variable, no need to send message to HAL
2538 // Station already taking care of HT OPR Mode=01, meaning AP is seeing legacy
2539 //stations in overlapping BSS.
2540 if ( psessionEntry->beaconParams.gHTObssMode != ( tANI_U8 )htInfo.obssNonHTStaPresent )
2541 psessionEntry->beaconParams.gHTObssMode = ( tANI_U8 )htInfo.obssNonHTStaPresent ;
2542
2543 }
2544}
2545
2546
2547/**
2548 * limProcessChannelSwitchTimeout()
2549 *
2550 *FUNCTION:
2551 * This function is invoked when Channel Switch Timer expires at
2552 * the STA. Now, STA must stop traffic, and then change/disable
2553 * primary or secondary channel.
2554 *
2555 *
2556 *NOTE:
2557 * @param pMac - Pointer to Global MAC structure
2558 * @return None
2559 */
2560void limProcessChannelSwitchTimeout(tpAniSirGlobal pMac)
2561{
2562 tpPESession psessionEntry = NULL;
Jeff Johnsone7245742012-09-05 17:12:55 -07002563 tANI_U8 channel; // This is received and stored from channelSwitch Action frame
Jeff Johnson295189b2012-06-20 16:38:30 -07002564
2565 if((psessionEntry = peFindSessionBySessionId(pMac, pMac->lim.limTimers.gLimChannelSwitchTimer.sessionId))== NULL)
2566 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002567 limLog(pMac, LOGP,FL("Session Does not exist for given sessionID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002568 return;
2569 }
2570
2571 if (psessionEntry->limSystemRole != eLIM_STA_ROLE)
2572 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002573 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 -07002574 return;
2575 }
Jeff Johnsone7245742012-09-05 17:12:55 -07002576 channel = psessionEntry->gLimChannelSwitch.primaryChannel;
Jeff Johnson295189b2012-06-20 16:38:30 -07002577 /*
2578 * This potentially can create issues if the function tries to set
2579 * channel while device is in power-save, hence putting an extra check
2580 * to verify if the device is in power-save or not
2581 */
2582 if(!limIsSystemInActiveState(pMac))
2583 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002584 PELOGW(limLog(pMac, LOGW, FL("Device is not in active state, cannot switch channel"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002585 return;
2586 }
2587
2588 // Restore Channel Switch parameters to default
Jeff Johnsone7245742012-09-05 17:12:55 -07002589 psessionEntry->gLimChannelSwitch.switchTimeoutValue = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07002590
2591 /* Channel-switch timeout has occurred. reset the state */
Jeff Johnsone7245742012-09-05 17:12:55 -07002592 psessionEntry->gLimSpecMgmt.dot11hChanSwState = eLIM_11H_CHANSW_END;
Jeff Johnson295189b2012-06-20 16:38:30 -07002593
2594 /* Check if the AP is switching to a channel that we support.
2595 * Else, just don't bother to switch. Indicate HDD to look for a
2596 * better AP to associate
2597 */
2598 if(!limIsChannelValidForChannelSwitch(pMac, channel))
2599 {
2600 /* We need to restore pre-channelSwitch state on the STA */
2601 if(limRestorePreChannelSwitchState(pMac, psessionEntry) != eSIR_SUCCESS)
2602 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002603 limLog(pMac, LOGP, FL("Could not restore pre-channelSwitch (11h) state, resetting the system"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002604 return;
2605 }
2606
2607 /* If the channel-list that AP is asking us to switch is invalid,
2608 * then we cannot switch the channel. Just disassociate from AP.
2609 * We will find a better AP !!!
2610 */
2611 limTearDownLinkWithAp(pMac,
2612 pMac->lim.limTimers.gLimChannelSwitchTimer.sessionId,
2613 eSIR_MAC_UNSPEC_FAILURE_REASON);
2614 return;
2615 }
Kiran Kumar Lokereb8bb6842013-08-12 16:40:24 -07002616 limCovertChannelScanType(pMac, psessionEntry->currentOperChannel, false);
2617 pMac->lim.dfschannelList.timeStamp[psessionEntry->currentOperChannel] = 0;
Jeff Johnsone7245742012-09-05 17:12:55 -07002618 switch(psessionEntry->gLimChannelSwitch.state)
Jeff Johnson295189b2012-06-20 16:38:30 -07002619 {
2620 case eLIM_CHANNEL_SWITCH_PRIMARY_ONLY:
Kalikinkar dhara085c02f2014-02-28 15:32:12 -08002621 case eLIM_CHANNEL_SWITCH_PRIMARY_AND_SECONDARY:
2622 if ( isLimSessionOffChannel(pMac,
2623 pMac->lim.limTimers.gLimChannelSwitchTimer.sessionId) )
2624 {
2625 limSuspendLink(pMac,
2626 eSIR_DONT_CHECK_LINK_TRAFFIC_BEFORE_SCAN,
2627 limProcessChannelSwitchSuspendLink,
2628 (tANI_U32*)psessionEntry );
2629 }
2630 else
2631 {
2632 limProcessChannelSwitchSuspendLink(pMac,
2633 eHAL_STATUS_SUCCESS,
2634 (tANI_U32*)psessionEntry);
2635 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002636 break;
2637
2638 case eLIM_CHANNEL_SWITCH_SECONDARY_ONLY:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002639 PELOGW(limLog(pMac, LOGW, FL("CHANNEL_SWITCH_SECONDARY_ONLY "));)
Jeff Johnsone7245742012-09-05 17:12:55 -07002640 limSwitchPrimarySecondaryChannel(pMac, psessionEntry,
Jeff Johnson295189b2012-06-20 16:38:30 -07002641 psessionEntry->currentOperChannel,
Jeff Johnsone7245742012-09-05 17:12:55 -07002642 psessionEntry->gLimChannelSwitch.secondarySubBand);
2643 psessionEntry->gLimChannelSwitch.state = eLIM_CHANNEL_SWITCH_IDLE;
Jeff Johnson295189b2012-06-20 16:38:30 -07002644 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07002645 case eLIM_CHANNEL_SWITCH_IDLE:
2646 default:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002647 PELOGE(limLog(pMac, LOGE, FL("incorrect state "));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002648 if(limRestorePreChannelSwitchState(pMac, psessionEntry) != eSIR_SUCCESS)
2649 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002650 limLog(pMac, LOGP, FL("Could not restore pre-channelSwitch (11h) state, resetting the system"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002651 }
2652 return; /* Please note, this is 'return' and not 'break' */
2653 }
Jeff Johnsone7245742012-09-05 17:12:55 -07002654}
Jeff Johnson295189b2012-06-20 16:38:30 -07002655
2656/**
2657 * limUpdateChannelSwitch()
2658 *
2659 *FUNCTION:
2660 * This function is invoked whenever Station receives
2661 * either 802.11h channel switch IE or airgo proprietary
2662 * channel switch IE.
2663 *
2664 *NOTE:
2665 * @param pMac - Pointer to Global MAC structure
2666 * @return tpSirProbeRespBeacon - Pointer to Beacon/Probe Rsp
2667 * @param psessionentry
2668 */
2669void
2670limUpdateChannelSwitch(struct sAniSirGlobal *pMac, tpSirProbeRespBeacon pBeacon, tpPESession psessionEntry)
2671{
2672
2673 tANI_U16 beaconPeriod;
Jeff Johnson295189b2012-06-20 16:38:30 -07002674 tChannelSwitchPropIEStruct *pPropChnlSwitch;
2675 tDot11fIEChanSwitchAnn *pChnlSwitch;
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -07002676#ifdef WLAN_FEATURE_11AC
2677 tDot11fIEWiderBWChanSwitchAnn *pWiderChnlSwitch;
2678#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002679
Jeff Johnsone7245742012-09-05 17:12:55 -07002680 beaconPeriod = psessionEntry->beaconParams.beaconInterval;
Jeff Johnson295189b2012-06-20 16:38:30 -07002681
2682 /* STA either received proprietary channel switch IE or 802.11h
2683 * standard channel switch IE.
2684 */
2685 if (pBeacon->propIEinfo.propChannelSwitchPresent)
2686 {
2687 pPropChnlSwitch = &(pBeacon->propIEinfo.channelSwitch);
2688
2689 /* Add logic to determine which change this is: */
2690 /* primary, secondary, both. For now assume both. */
Jeff Johnsone7245742012-09-05 17:12:55 -07002691 psessionEntry->gLimChannelSwitch.state = eLIM_CHANNEL_SWITCH_PRIMARY_AND_SECONDARY;
2692 psessionEntry->gLimChannelSwitch.primaryChannel = pPropChnlSwitch->primaryChannel;
2693 psessionEntry->gLimChannelSwitch.secondarySubBand = (ePhyChanBondState)pPropChnlSwitch->subBand;
2694 psessionEntry->gLimChannelSwitch.switchCount = pPropChnlSwitch->channelSwitchCount;
2695 psessionEntry->gLimChannelSwitch.switchTimeoutValue =
Jeff Johnson295189b2012-06-20 16:38:30 -07002696 SYS_MS_TO_TICKS(beaconPeriod)* (pPropChnlSwitch->channelSwitchCount);
Jeff Johnsone7245742012-09-05 17:12:55 -07002697 psessionEntry->gLimChannelSwitch.switchMode = pPropChnlSwitch->mode;
Jeff Johnson295189b2012-06-20 16:38:30 -07002698 }
2699 else
2700 {
2701 pChnlSwitch = &(pBeacon->channelSwitchIE);
Jeff Johnsone7245742012-09-05 17:12:55 -07002702 psessionEntry->gLimChannelSwitch.primaryChannel = pChnlSwitch->newChannel;
2703 psessionEntry->gLimChannelSwitch.switchCount = pChnlSwitch->switchCount;
2704 psessionEntry->gLimChannelSwitch.switchTimeoutValue =
Jeff Johnson295189b2012-06-20 16:38:30 -07002705 SYS_MS_TO_TICKS(beaconPeriod)* (pChnlSwitch->switchCount);
Jeff Johnsone7245742012-09-05 17:12:55 -07002706 psessionEntry->gLimChannelSwitch.switchMode = pChnlSwitch->switchMode;
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -07002707#ifdef WLAN_FEATURE_11AC
2708 pWiderChnlSwitch = &(pBeacon->WiderBWChanSwitchAnn);
2709 if(pBeacon->WiderBWChanSwitchAnnPresent)
2710 {
2711 psessionEntry->gLimWiderBWChannelSwitch.newChanWidth = pWiderChnlSwitch->newChanWidth;
2712 psessionEntry->gLimWiderBWChannelSwitch.newCenterChanFreq0 = pWiderChnlSwitch->newCenterChanFreq0;
2713 psessionEntry->gLimWiderBWChannelSwitch.newCenterChanFreq1 = pWiderChnlSwitch->newCenterChanFreq1;
2714 }
2715#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002716
2717 /* Only primary channel switch element is present */
Jeff Johnsone7245742012-09-05 17:12:55 -07002718 psessionEntry->gLimChannelSwitch.state = eLIM_CHANNEL_SWITCH_PRIMARY_ONLY;
2719 psessionEntry->gLimChannelSwitch.secondarySubBand = PHY_SINGLE_CHANNEL_CENTERED;
Jeff Johnson295189b2012-06-20 16:38:30 -07002720
2721 /* Do not bother to look and operate on extended channel switch element
2722 * if our own channel-bonding state is not enabled
2723 */
Jeff Johnsone7245742012-09-05 17:12:55 -07002724 if (psessionEntry->htSupportedChannelWidthSet)
Jeff Johnson295189b2012-06-20 16:38:30 -07002725 {
2726 if (pBeacon->extChannelSwitchPresent)
2727 {
Jeff Johnsone7245742012-09-05 17:12:55 -07002728 if ((pBeacon->extChannelSwitchIE.secondaryChannelOffset == PHY_DOUBLE_CHANNEL_LOW_PRIMARY) ||
2729 (pBeacon->extChannelSwitchIE.secondaryChannelOffset == PHY_DOUBLE_CHANNEL_HIGH_PRIMARY))
Jeff Johnson295189b2012-06-20 16:38:30 -07002730 {
Jeff Johnsone7245742012-09-05 17:12:55 -07002731 psessionEntry->gLimChannelSwitch.state = eLIM_CHANNEL_SWITCH_PRIMARY_AND_SECONDARY;
2732 psessionEntry->gLimChannelSwitch.secondarySubBand = pBeacon->extChannelSwitchIE.secondaryChannelOffset;
Jeff Johnson295189b2012-06-20 16:38:30 -07002733 }
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -07002734#ifdef WLAN_FEATURE_11AC
2735 if(psessionEntry->vhtCapability && pBeacon->WiderBWChanSwitchAnnPresent)
2736 {
2737 if (pWiderChnlSwitch->newChanWidth == WNI_CFG_VHT_CHANNEL_WIDTH_80MHZ)
2738 {
2739 if(pBeacon->extChannelSwitchPresent)
2740 {
2741 if ((pBeacon->extChannelSwitchIE.secondaryChannelOffset == PHY_DOUBLE_CHANNEL_LOW_PRIMARY) ||
2742 (pBeacon->extChannelSwitchIE.secondaryChannelOffset == PHY_DOUBLE_CHANNEL_HIGH_PRIMARY))
2743 {
2744 psessionEntry->gLimChannelSwitch.state = eLIM_CHANNEL_SWITCH_PRIMARY_AND_SECONDARY;
2745 psessionEntry->gLimChannelSwitch.secondarySubBand = limGet11ACPhyCBState(pMac,
2746 psessionEntry->gLimChannelSwitch.primaryChannel,
2747 pBeacon->extChannelSwitchIE.secondaryChannelOffset,
2748 pWiderChnlSwitch->newCenterChanFreq0,
2749 psessionEntry);
2750 }
2751 }
2752 }
2753 }
2754#endif
Jeff Johnsone7245742012-09-05 17:12:55 -07002755 }
2756 }
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -07002757 }
Kalikinkar dhara085c02f2014-02-28 15:32:12 -08002758
2759
Jeff Johnson295189b2012-06-20 16:38:30 -07002760 if (eSIR_SUCCESS != limStartChannelSwitch(pMac, psessionEntry))
2761 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002762 PELOGW(limLog(pMac, LOGW, FL("Could not start Channel Switch"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002763 }
2764
2765 limLog(pMac, LOGW,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002766 FL("session %d primary chl %d, subband %d, count %d (%d ticks) "),
Jeff Johnsone7245742012-09-05 17:12:55 -07002767 psessionEntry->peSessionId,
2768 psessionEntry->gLimChannelSwitch.primaryChannel,
2769 psessionEntry->gLimChannelSwitch.secondarySubBand,
2770 psessionEntry->gLimChannelSwitch.switchCount,
2771 psessionEntry->gLimChannelSwitch.switchTimeoutValue);
Jeff Johnson295189b2012-06-20 16:38:30 -07002772 return;
2773}
2774
2775/**
2776 * limCancelDot11hChannelSwitch
2777 *
2778 *FUNCTION:
2779 * This function is called when STA does not send updated channel-swith IE
2780 * after indicating channel-switch start. This will cancel the channel-swith
2781 * timer which is already running.
2782 *
2783 *LOGIC:
2784 *
2785 *ASSUMPTIONS:
2786 *
2787 *NOTE:
2788 *
2789 * @param pMac - Pointer to Global MAC structure
2790 *
2791 * @return None
2792 */
2793void limCancelDot11hChannelSwitch(tpAniSirGlobal pMac, tpPESession psessionEntry)
2794{
Jeff Johnson295189b2012-06-20 16:38:30 -07002795 if (psessionEntry->limSystemRole != eLIM_STA_ROLE)
2796 return;
2797
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002798 PELOGW(limLog(pMac, LOGW, FL("Received a beacon without channel switch IE"));)
Jeff Johnsone7245742012-09-05 17:12:55 -07002799 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_DEACTIVATE, psessionEntry->peSessionId, eLIM_CHANNEL_SWITCH_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -07002800
2801 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimChannelSwitchTimer) != eSIR_SUCCESS)
2802 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002803 PELOGE(limLog(pMac, LOGE, FL("tx_timer_deactivate failed!"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002804 }
2805
2806 /* We need to restore pre-channelSwitch state on the STA */
2807 if (limRestorePreChannelSwitchState(pMac, psessionEntry) != eSIR_SUCCESS)
2808 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002809 PELOGE(limLog(pMac, LOGE, FL("LIM: Could not restore pre-channelSwitch (11h) state, resetting the system"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002810
2811 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002812}
2813
2814/**----------------------------------------------
2815\fn limCancelDot11hQuiet
2816\brief Cancel the quieting on Station if latest
2817 beacon doesn't contain quiet IE in it.
2818
2819\param pMac
2820\return NONE
2821-----------------------------------------------*/
2822void limCancelDot11hQuiet(tpAniSirGlobal pMac, tpPESession psessionEntry)
2823{
Jeff Johnson295189b2012-06-20 16:38:30 -07002824 if (psessionEntry->limSystemRole != eLIM_STA_ROLE)
2825 return;
2826
Jeff Johnsone7245742012-09-05 17:12:55 -07002827 if (psessionEntry->gLimSpecMgmt.quietState == eLIM_QUIET_BEGIN)
Jeff Johnson295189b2012-06-20 16:38:30 -07002828 {
Jeff Johnsone7245742012-09-05 17:12:55 -07002829 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_DEACTIVATE, psessionEntry->peSessionId, eLIM_QUIET_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -07002830 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimQuietTimer) != TX_SUCCESS)
2831 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002832 PELOGE(limLog(pMac, LOGE, FL("tx_timer_deactivate failed"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002833 }
2834 }
Jeff Johnsone7245742012-09-05 17:12:55 -07002835 else if (psessionEntry->gLimSpecMgmt.quietState == eLIM_QUIET_RUNNING)
Jeff Johnson295189b2012-06-20 16:38:30 -07002836 {
Jeff Johnsone7245742012-09-05 17:12:55 -07002837 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_DEACTIVATE, psessionEntry->peSessionId, eLIM_QUIET_BSS_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -07002838 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimQuietBssTimer) != TX_SUCCESS)
2839 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002840 PELOGE(limLog(pMac, LOGE, FL("tx_timer_deactivate failed"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002841 }
2842 /**
2843 * If the channel switch is already running in silent mode, dont resume the
2844 * transmission. Channel switch timer when timeout, transmission will be resumed.
2845 */
Jeff Johnsone7245742012-09-05 17:12:55 -07002846 if(!((psessionEntry->gLimSpecMgmt.dot11hChanSwState == eLIM_11H_CHANSW_RUNNING) &&
2847 (psessionEntry->gLimChannelSwitch.switchMode == eSIR_CHANSW_MODE_SILENT)))
Jeff Johnson295189b2012-06-20 16:38:30 -07002848 {
2849 limFrameTransmissionControl(pMac, eLIM_TX_ALL, eLIM_RESUME_TX);
Jeff Johnsone7245742012-09-05 17:12:55 -07002850 limRestorePreQuietState(pMac, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07002851 }
2852 }
Jeff Johnsone7245742012-09-05 17:12:55 -07002853 psessionEntry->gLimSpecMgmt.quietState = eLIM_QUIET_INIT;
Jeff Johnson295189b2012-06-20 16:38:30 -07002854}
2855
2856/**
2857 * limProcessQuietTimeout
2858 *
2859 * FUNCTION:
2860 * This function is active only on the STA.
2861 * Handles SIR_LIM_QUIET_TIMEOUT
2862 *
2863 * LOGIC:
2864 * This timeout can occur under only one circumstance:
2865 *
2866 * 1) When gLimQuietState = eLIM_QUIET_BEGIN
2867 * This indicates that the timeout "interval" has
2868 * expired. This is a trigger for the STA to now
2869 * shut-off Tx/Rx for the specified gLimQuietDuration
2870 * -> The TIMER object gLimQuietBssTimer is
2871 * activated
2872 * -> With timeout = gLimQuietDuration
2873 * -> gLimQuietState is set to eLIM_QUIET_RUNNING
2874 *
2875 * ASSUMPTIONS:
2876 * Using two TIMER objects -
2877 * gLimQuietTimer & gLimQuietBssTimer
2878 *
2879 * NOTE:
2880 *
2881 * @param pMac - Pointer to Global MAC structure
2882 *
2883 * @return None
2884 */
2885void limProcessQuietTimeout(tpAniSirGlobal pMac)
2886{
Jeff Johnson295189b2012-06-20 16:38:30 -07002887 //fetch the sessionEntry based on the sessionId
2888 //priority - MEDIUM
Jeff Johnsone7245742012-09-05 17:12:55 -07002889 tpPESession psessionEntry;
Jeff Johnson295189b2012-06-20 16:38:30 -07002890
Jeff Johnsone7245742012-09-05 17:12:55 -07002891 if((psessionEntry = peFindSessionBySessionId(pMac, pMac->lim.limTimers.gLimQuietTimer.sessionId))== NULL)
Jeff Johnson295189b2012-06-20 16:38:30 -07002892 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002893 limLog(pMac, LOGE,FL("Session Does not exist for given sessionID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002894 return;
2895 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002896
Abhishek Singh3cbf6052014-12-15 16:46:42 +05302897 limLog(pMac, LOG1, FL("quietState = %d"), psessionEntry->gLimSpecMgmt.quietState);
Jeff Johnsone7245742012-09-05 17:12:55 -07002898 switch( psessionEntry->gLimSpecMgmt.quietState )
Jeff Johnson295189b2012-06-20 16:38:30 -07002899 {
2900 case eLIM_QUIET_BEGIN:
2901 // Time to Stop data traffic for quietDuration
Jeff Johnsone7245742012-09-05 17:12:55 -07002902 //limDeactivateAndChangeTimer(pMac, eLIM_QUIET_BSS_TIMER);
2903 if (TX_SUCCESS !=
2904 tx_timer_deactivate(&pMac->lim.limTimers.gLimQuietBssTimer))
2905 {
2906 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002907 FL("Unable to de-activate gLimQuietBssTimer! Will attempt to activate anyway..."));
Jeff Johnsone7245742012-09-05 17:12:55 -07002908 }
2909
2910 // gLimQuietDuration appears to be in units of ticks
2911 // Use it as is
2912 if (TX_SUCCESS !=
2913 tx_timer_change( &pMac->lim.limTimers.gLimQuietBssTimer,
2914 psessionEntry->gLimSpecMgmt.quietDuration,
2915 0))
2916 {
2917 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002918 FL("Unable to change gLimQuietBssTimer! Will still attempt to activate anyway..."));
Jeff Johnsone7245742012-09-05 17:12:55 -07002919 }
Leela V Kiran Kumar Reddy Chiralac3b9d382013-01-31 20:49:53 -08002920 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, pMac->lim.limTimers.gLimQuietTimer.sessionId, eLIM_QUIET_BSS_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -07002921#ifdef GEN6_TODO
2922 /* revisit this piece of code to assign the appropriate sessionId below
2923 * priority - HIGH
2924 */
2925 pMac->lim.limTimers.gLimQuietBssTimer.sessionId = sessionId;
2926#endif
2927 if( TX_SUCCESS !=
2928 tx_timer_activate( &pMac->lim.limTimers.gLimQuietBssTimer ))
2929 {
2930 limLog( pMac, LOGW,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002931 FL("Unable to activate gLimQuietBssTimer! The STA will be unable to honor Quiet BSS..."));
Jeff Johnson295189b2012-06-20 16:38:30 -07002932 }
2933 else
2934 {
2935 // Transition to eLIM_QUIET_RUNNING
Jeff Johnsone7245742012-09-05 17:12:55 -07002936 psessionEntry->gLimSpecMgmt.quietState = eLIM_QUIET_RUNNING;
Jeff Johnson295189b2012-06-20 16:38:30 -07002937
2938 /* If we have sta bk scan triggered and trigger bk scan actually started successfully, */
2939 /* print message, otherwise, stop data traffic and stay quiet */
2940 if( pMac->lim.gLimTriggerBackgroundScanDuringQuietBss &&
2941 (eSIR_TRUE == (glimTriggerBackgroundScanDuringQuietBss_Status = limTriggerBackgroundScanDuringQuietBss( pMac ))) )
2942 {
2943 limLog( pMac, LOG2,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002944 FL("Attempting to trigger a background scan..."));
Jeff Johnson295189b2012-06-20 16:38:30 -07002945 }
2946 else
2947 {
2948 // Shut-off Tx/Rx for gLimSpecMgmt.quietDuration
2949 /* freeze the transmission */
2950 limFrameTransmissionControl(pMac, eLIM_TX_ALL, eLIM_STOP_TX);
2951
2952 limLog( pMac, LOG2,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002953 FL("Quiet BSS: STA shutting down for %d ticks"),
Jeff Johnsone7245742012-09-05 17:12:55 -07002954 psessionEntry->gLimSpecMgmt.quietDuration );
Jeff Johnson295189b2012-06-20 16:38:30 -07002955 }
2956 }
2957 break;
2958
2959 case eLIM_QUIET_RUNNING:
2960 case eLIM_QUIET_INIT:
2961 case eLIM_QUIET_END:
2962 default:
2963 //
2964 // As of now, nothing to be done
2965 //
2966 break;
2967 }
2968}
2969
2970/**
2971 * limProcessQuietBssTimeout
2972 *
2973 * FUNCTION:
2974 * This function is active on the AP and STA.
2975 * Handles SIR_LIM_QUIET_BSS_TIMEOUT
2976 *
2977 * LOGIC:
2978 * On the AP -
2979 * When the SIR_LIM_QUIET_BSS_TIMEOUT is triggered, it is
2980 * an indication for the AP to START sending out the
2981 * Quiet BSS IE.
2982 * If 802.11H is enabled, the Quiet BSS IE is sent as per
2983 * the 11H spec
2984 * If 802.11H is not enabled, the Quiet BSS IE is sent as
2985 * a Proprietary IE. This will be understood by all the
2986 * TITAN STA's
2987 * Transitioning gLimQuietState to eLIM_QUIET_BEGIN will
2988 * initiate the SCH to include the Quiet BSS IE in all
2989 * its subsequent Beacons/PR's.
2990 * The Quiet BSS IE will be included in all the Beacons
2991 * & PR's until the next DTIM period
2992 *
2993 * On the STA -
2994 * When gLimQuietState = eLIM_QUIET_RUNNING
2995 * This indicates that the STA was successfully shut-off
2996 * for the specified gLimQuietDuration. This is a trigger
2997 * for the STA to now resume data traffic.
2998 * -> gLimQuietState is set to eLIM_QUIET_INIT
2999 *
3000 * ASSUMPTIONS:
3001 *
3002 * NOTE:
3003 *
3004 * @param pMac - Pointer to Global MAC structure
3005 *
3006 * @return None
3007 */
3008void limProcessQuietBssTimeout( tpAniSirGlobal pMac )
3009{
Jeff Johnsone7245742012-09-05 17:12:55 -07003010 tpPESession psessionEntry;
Jeff Johnson295189b2012-06-20 16:38:30 -07003011
Jeff Johnsone7245742012-09-05 17:12:55 -07003012 if((psessionEntry = peFindSessionBySessionId(pMac, pMac->lim.limTimers.gLimQuietBssTimer.sessionId))== NULL)
Jeff Johnson295189b2012-06-20 16:38:30 -07003013 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003014 limLog(pMac, LOGP,FL("Session Does not exist for given sessionID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003015 return;
3016 }
3017
Abhishek Singh3cbf6052014-12-15 16:46:42 +05303018 limLog(pMac, LOG1, FL("quietState = %d"), psessionEntry->gLimSpecMgmt.quietState);
Jeff Johnsone7245742012-09-05 17:12:55 -07003019 if (eLIM_AP_ROLE == psessionEntry->limSystemRole)
Jeff Johnson295189b2012-06-20 16:38:30 -07003020 {
Jeff Johnson295189b2012-06-20 16:38:30 -07003021 }
3022 else
3023 {
3024 // eLIM_STA_ROLE
Jeff Johnsone7245742012-09-05 17:12:55 -07003025 switch( psessionEntry->gLimSpecMgmt.quietState )
Jeff Johnson295189b2012-06-20 16:38:30 -07003026 {
3027 case eLIM_QUIET_RUNNING:
3028 // Transition to eLIM_QUIET_INIT
Jeff Johnsone7245742012-09-05 17:12:55 -07003029 psessionEntry->gLimSpecMgmt.quietState = eLIM_QUIET_INIT;
Jeff Johnson295189b2012-06-20 16:38:30 -07003030
3031 if( !pMac->lim.gLimTriggerBackgroundScanDuringQuietBss || (glimTriggerBackgroundScanDuringQuietBss_Status == eSIR_FALSE) )
3032 {
3033 // Resume data traffic only if channel switch is not running in silent mode.
Jeff Johnsone7245742012-09-05 17:12:55 -07003034 if (!((psessionEntry->gLimSpecMgmt.dot11hChanSwState == eLIM_11H_CHANSW_RUNNING) &&
3035 (psessionEntry->gLimChannelSwitch.switchMode == eSIR_CHANSW_MODE_SILENT)))
Jeff Johnson295189b2012-06-20 16:38:30 -07003036 {
3037 limFrameTransmissionControl(pMac, eLIM_TX_ALL, eLIM_RESUME_TX);
Jeff Johnsone7245742012-09-05 17:12:55 -07003038 limRestorePreQuietState(pMac, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07003039 }
3040
3041 /* Reset status flag */
3042 if(glimTriggerBackgroundScanDuringQuietBss_Status == eSIR_FALSE)
3043 glimTriggerBackgroundScanDuringQuietBss_Status = eSIR_TRUE;
3044
3045 limLog( pMac, LOG2,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003046 FL("Quiet BSS: Resuming traffic..."));
Jeff Johnson295189b2012-06-20 16:38:30 -07003047 }
3048 else
3049 {
3050 //
3051 // Nothing specific to be done in this case
3052 // A background scan that was triggered during
3053 // SIR_LIM_QUIET_TIMEOUT will complete on its own
3054 //
3055 limLog( pMac, LOG2,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003056 FL("Background scan should be complete now..."));
Jeff Johnson295189b2012-06-20 16:38:30 -07003057 }
3058 break;
3059
3060 case eLIM_QUIET_INIT:
3061 case eLIM_QUIET_BEGIN:
3062 case eLIM_QUIET_END:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003063 PELOG2(limLog(pMac, LOG2, FL("Quiet state not in RUNNING"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003064 /* If the quiet period has ended, then resume the frame transmission */
3065 limFrameTransmissionControl(pMac, eLIM_TX_ALL, eLIM_RESUME_TX);
Jeff Johnsone7245742012-09-05 17:12:55 -07003066 limRestorePreQuietState(pMac, psessionEntry);
3067 psessionEntry->gLimSpecMgmt.quietState = eLIM_QUIET_INIT;
Jeff Johnson295189b2012-06-20 16:38:30 -07003068 break;
3069
3070 default:
3071 //
3072 // As of now, nothing to be done
3073 //
3074 break;
3075 }
3076 }
3077}
Jeff Johnson295189b2012-06-20 16:38:30 -07003078/**
3079 * limProcessWPSOverlapTimeout
3080 *
3081 * FUNCTION: This function call limWPSPBCTimeout() to clean WPS PBC probe request entries
3082 *
3083 * LOGIC:
3084 *
3085 * ASSUMPTIONS:
3086 *
3087 * NOTE:
3088 *
3089 * @param pMac - Pointer to Global MAC structure
3090 *
3091 * @return None
3092 */
3093#if 0
3094void limProcessWPSOverlapTimeout(tpAniSirGlobal pMac)
3095{
3096
3097 tpPESession psessionEntry;
3098 tANI_U32 sessionId;
3099
3100 if (tx_timer_activate(&pMac->lim.limTimers.gLimWPSOverlapTimerObj.gLimWPSOverlapTimer) != TX_SUCCESS)
3101 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003102 limLog(pMac, LOGP, FL("tx_timer_activate failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003103 }
3104
3105 sessionId = pMac->lim.limTimers.gLimWPSOverlapTimerObj.sessionId;
3106
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003107 PELOGE(limLog(pMac, LOGE, FL("WPS overlap timeout, sessionId=%d"), sessionId);)
Jeff Johnson295189b2012-06-20 16:38:30 -07003108
3109 if((psessionEntry = peFindSessionBySessionId(pMac, sessionId)) == NULL)
3110 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003111 PELOGE(limLog(pMac, LOGP,FL("Session Does not exist for given sessionID"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003112 return;
3113 }
3114
3115 limWPSPBCTimeout(pMac, psessionEntry);
3116}
3117#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07003118
Jeff Johnson295189b2012-06-20 16:38:30 -07003119/**----------------------------------------------
3120\fn limStartQuietTimer
3121\brief Starts the quiet timer.
3122
3123\param pMac
3124\return NONE
3125-----------------------------------------------*/
3126void limStartQuietTimer(tpAniSirGlobal pMac, tANI_U8 sessionId)
3127{
3128 tpPESession psessionEntry;
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05303129 psessionEntry = peFindSessionBySessionId(pMac, sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07003130
3131 if(psessionEntry == NULL) {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003132 limLog(pMac, LOGP,FL("Session Does not exist for given sessionID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003133 return;
3134 }
3135
Jeff Johnson295189b2012-06-20 16:38:30 -07003136
3137 if (psessionEntry->limSystemRole != eLIM_STA_ROLE)
3138 return;
3139 // First, de-activate Timer, if its already active
3140 limCancelDot11hQuiet(pMac, psessionEntry);
3141
Jeff Johnsone7245742012-09-05 17:12:55 -07003142 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, sessionId, eLIM_QUIET_TIMER));
3143 if( TX_SUCCESS != tx_timer_deactivate(&pMac->lim.limTimers.gLimQuietTimer))
3144 {
3145 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003146 FL( "Unable to deactivate gLimQuietTimer! Will still attempt to re-activate anyway..." ));
Jeff Johnsone7245742012-09-05 17:12:55 -07003147 }
3148
3149 // Set the NEW timeout value, in ticks
3150 if( TX_SUCCESS != tx_timer_change( &pMac->lim.limTimers.gLimQuietTimer,
3151 SYS_MS_TO_TICKS(psessionEntry->gLimSpecMgmt.quietTimeoutValue), 0))
3152 {
3153 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003154 FL( "Unable to change gLimQuietTimer! Will still attempt to re-activate anyway..." ));
Jeff Johnsone7245742012-09-05 17:12:55 -07003155 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003156
3157 pMac->lim.limTimers.gLimQuietTimer.sessionId = sessionId;
3158 if( TX_SUCCESS != tx_timer_activate(&pMac->lim.limTimers.gLimQuietTimer))
3159 {
3160 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003161 FL("Unable to activate gLimQuietTimer! STA cannot honor Quiet BSS!"));
Jeff Johnsone7245742012-09-05 17:12:55 -07003162 limRestorePreQuietState(pMac, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07003163
Jeff Johnsone7245742012-09-05 17:12:55 -07003164 psessionEntry->gLimSpecMgmt.quietState = eLIM_QUIET_INIT;
Jeff Johnson295189b2012-06-20 16:38:30 -07003165 return;
3166 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003167}
3168
Jeff Johnson295189b2012-06-20 16:38:30 -07003169
3170/** ------------------------------------------------------------------------ **/
3171/**
3172 * keep track of the number of ANI peers associated in the BSS
3173 * For the first and last ANI peer, we have to update EDCA params as needed
3174 *
3175 * When the first ANI peer joins the BSS, we notify SCH
3176 * When the last ANI peer leaves the BSS, we notfiy SCH
3177 */
3178void
3179limUtilCountStaAdd(
3180 tpAniSirGlobal pMac,
3181 tpDphHashNode pSta,
3182 tpPESession psessionEntry)
3183{
3184
3185 if ((! pSta) || (! pSta->valid) || (! pSta->aniPeer) || (pSta->fAniCount))
3186 return;
3187
3188 pSta->fAniCount = 1;
3189
3190 if (pMac->lim.gLimNumOfAniSTAs++ != 0)
3191 return;
3192
3193 // get here only if this is the first ANI peer in the BSS
3194 schEdcaProfileUpdate(pMac, psessionEntry);
3195}
3196
3197void
3198limUtilCountStaDel(
3199 tpAniSirGlobal pMac,
3200 tpDphHashNode pSta,
3201 tpPESession psessionEntry)
3202{
3203
3204 if ((pSta == NULL) || (pSta->aniPeer == eHAL_CLEAR) || (! pSta->fAniCount))
3205 return;
3206
3207 /* Only if sta is invalid and the validInDummyState bit is set to 1,
3208 * then go ahead and update the count and profiles. This ensures
3209 * that the "number of ani station" count is properly incremented/decremented.
3210 */
3211 if (pSta->valid == 1)
3212 return;
3213
3214 pSta->fAniCount = 0;
3215
3216 if (pMac->lim.gLimNumOfAniSTAs <= 0)
3217 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003218 limLog(pMac, LOGE, FL("CountStaDel: ignoring Delete Req when AniPeer count is %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07003219 pMac->lim.gLimNumOfAniSTAs);
3220 return;
3221 }
3222
3223 pMac->lim.gLimNumOfAniSTAs--;
3224
3225 if (pMac->lim.gLimNumOfAniSTAs != 0)
3226 return;
3227
3228 // get here only if this is the last ANI peer in the BSS
3229 schEdcaProfileUpdate(pMac, psessionEntry);
3230}
3231
Jeff Johnson295189b2012-06-20 16:38:30 -07003232/**
3233 * limSwitchChannelCback()
3234 *
3235 *FUNCTION:
3236 * This is the callback function registered while requesting to switch channel
3237 * after AP indicates a channel switch for spectrum management (11h).
3238 *
3239 *NOTE:
3240 * @param pMac Pointer to Global MAC structure
3241 * @param status Status of channel switch request
3242 * @param data User data
3243 * @param psessionEntry Session information
3244 * @return NONE
3245 */
3246void limSwitchChannelCback(tpAniSirGlobal pMac, eHalStatus status,
3247 tANI_U32 *data, tpPESession psessionEntry)
3248{
3249 tSirMsgQ mmhMsg = {0};
3250 tSirSmeSwitchChannelInd *pSirSmeSwitchChInd;
3251
Jeff Johnson295189b2012-06-20 16:38:30 -07003252 psessionEntry->currentOperChannel = psessionEntry->currentReqChannel;
3253
3254 /* We need to restore pre-channelSwitch state on the STA */
3255 if (limRestorePreChannelSwitchState(pMac, psessionEntry) != eSIR_SUCCESS)
3256 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003257 limLog(pMac, LOGP, FL("Could not restore pre-channelSwitch (11h) state, resetting the system"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003258 return;
3259 }
3260
3261 mmhMsg.type = eWNI_SME_SWITCH_CHL_REQ;
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05303262 pSirSmeSwitchChInd = vos_mem_malloc(sizeof(tSirSmeSwitchChannelInd));
3263 if ( NULL == pSirSmeSwitchChInd )
Jeff Johnson295189b2012-06-20 16:38:30 -07003264 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003265 limLog(pMac, LOGP, FL("Failed to allocate buffer for buffer descriptor"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003266 return;
3267 }
3268
3269 pSirSmeSwitchChInd->messageType = eWNI_SME_SWITCH_CHL_REQ;
3270 pSirSmeSwitchChInd->length = sizeof(tSirSmeSwitchChannelInd);
Jeff Johnsone7245742012-09-05 17:12:55 -07003271 pSirSmeSwitchChInd->newChannelId = psessionEntry->gLimChannelSwitch.primaryChannel;
Jeff Johnson295189b2012-06-20 16:38:30 -07003272 pSirSmeSwitchChInd->sessionId = psessionEntry->smeSessionId;
3273 //BSS ID
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05303274 vos_mem_copy( pSirSmeSwitchChInd->bssId, psessionEntry->bssId, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07003275 mmhMsg.bodyptr = pSirSmeSwitchChInd;
3276 mmhMsg.bodyval = 0;
3277
Jeff Johnsone7245742012-09-05 17:12:55 -07003278 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07003279
Jeff Johnson295189b2012-06-20 16:38:30 -07003280 SysProcessMmhMsg(pMac, &mmhMsg);
Jeff Johnson295189b2012-06-20 16:38:30 -07003281}
3282
3283/**
3284 * limSwitchPrimaryChannel()
3285 *
3286 *FUNCTION:
3287 * This function changes the current operating channel
3288 * and sets the new new channel ID in WNI_CFG_CURRENT_CHANNEL.
3289 *
3290 *NOTE:
3291 * @param pMac Pointer to Global MAC structure
3292 * @param newChannel new chnannel ID
3293 * @return NONE
3294 */
3295void limSwitchPrimaryChannel(tpAniSirGlobal pMac, tANI_U8 newChannel,tpPESession psessionEntry)
3296{
3297#if !defined WLAN_FEATURE_VOWIFI
3298 tANI_U32 localPwrConstraint;
3299#endif
3300
Abhishek Singh127a8442014-12-15 17:31:27 +05303301 limLog(pMac, LOG1, FL(" old chnl %d --> new chnl %d "),
3302 psessionEntry->currentOperChannel, newChannel);
Jeff Johnson295189b2012-06-20 16:38:30 -07003303 psessionEntry->currentReqChannel = newChannel;
3304 psessionEntry->limRFBand = limGetRFBand(newChannel);
3305
3306 psessionEntry->channelChangeReasonCode=LIM_SWITCH_CHANNEL_OPERATION;
3307
3308 pMac->lim.gpchangeChannelCallback = limSwitchChannelCback;
3309 pMac->lim.gpchangeChannelData = NULL;
3310
3311#if defined WLAN_FEATURE_VOWIFI
Jeff Johnsone7245742012-09-05 17:12:55 -07003312 limSendSwitchChnlParams(pMac, newChannel, PHY_SINGLE_CHANNEL_CENTERED,
Jeff Johnson295189b2012-06-20 16:38:30 -07003313 psessionEntry->maxTxPower, psessionEntry->peSessionId);
3314#else
3315 if(wlan_cfgGetInt(pMac, WNI_CFG_LOCAL_POWER_CONSTRAINT, &localPwrConstraint) != eSIR_SUCCESS)
3316 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003317 limLog( pMac, LOGP, FL( "Unable to read Local Power Constraint from cfg" ));
Jeff Johnson295189b2012-06-20 16:38:30 -07003318 return;
3319 }
Jeff Johnsone7245742012-09-05 17:12:55 -07003320 limSendSwitchChnlParams(pMac, newChannel, PHY_SINGLE_CHANNEL_CENTERED,
Jeff Johnson295189b2012-06-20 16:38:30 -07003321 (tPowerdBm)localPwrConstraint, psessionEntry->peSessionId);
3322#endif
3323 return;
3324}
3325
3326/**
3327 * limSwitchPrimarySecondaryChannel()
3328 *
3329 *FUNCTION:
3330 * This function changes the primary and secondary channel.
3331 * If 11h is enabled and user provides a "new channel ID"
3332 * that is different from the current operating channel,
3333 * then we must set this new channel in WNI_CFG_CURRENT_CHANNEL,
3334 * assign notify LIM of such change.
3335 *
3336 *NOTE:
3337 * @param pMac Pointer to Global MAC structure
3338 * @param newChannel New chnannel ID (or current channel ID)
3339 * @param subband CB secondary info:
3340 * - eANI_CB_SECONDARY_NONE
3341 * - eANI_CB_SECONDARY_UP
3342 * - eANI_CB_SECONDARY_DOWN
3343 * @return NONE
3344 */
Jeff Johnsone7245742012-09-05 17:12:55 -07003345void limSwitchPrimarySecondaryChannel(tpAniSirGlobal pMac, tpPESession psessionEntry, tANI_U8 newChannel, ePhyChanBondState subband)
Jeff Johnson295189b2012-06-20 16:38:30 -07003346{
3347#if !defined WLAN_FEATURE_VOWIFI
3348 tANI_U32 localPwrConstraint;
3349#endif
3350
Jeff Johnson295189b2012-06-20 16:38:30 -07003351#if !defined WLAN_FEATURE_VOWIFI
3352 if(wlan_cfgGetInt(pMac, WNI_CFG_LOCAL_POWER_CONSTRAINT, &localPwrConstraint) != eSIR_SUCCESS) {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003353 limLog( pMac, LOGP, FL( "Unable to get Local Power Constraint from cfg" ));
Jeff Johnson295189b2012-06-20 16:38:30 -07003354 return;
3355 }
3356#endif
Abhishek Singh27924ba2014-11-18 13:11:11 +05303357 /* Assign the callback to resume TX once channel is changed.
3358 */
3359 psessionEntry->currentReqChannel = newChannel;
3360 psessionEntry->limRFBand = limGetRFBand(newChannel);
3361
3362 psessionEntry->channelChangeReasonCode=LIM_SWITCH_CHANNEL_OPERATION;
3363
3364 pMac->lim.gpchangeChannelCallback = limSwitchChannelCback;
3365 pMac->lim.gpchangeChannelData = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07003366
Jeff Johnson295189b2012-06-20 16:38:30 -07003367#if defined WLAN_FEATURE_VOWIFI
Jeff Johnsone7245742012-09-05 17:12:55 -07003368 limSendSwitchChnlParams(pMac, newChannel, subband, psessionEntry->maxTxPower, psessionEntry->peSessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07003369#else
Jeff Johnsone7245742012-09-05 17:12:55 -07003370 limSendSwitchChnlParams(pMac, newChannel, subband, (tPowerdBm)localPwrConstraint, psessionEntry->peSessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07003371#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07003372
Jeff Johnsone7245742012-09-05 17:12:55 -07003373 // Store the new primary and secondary channel in session entries if different
3374 if (psessionEntry->currentOperChannel != newChannel)
Jeff Johnson295189b2012-06-20 16:38:30 -07003375 {
3376 limLog(pMac, LOGW,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003377 FL("switch old chnl %d --> new chnl %d "),
Jeff Johnson295189b2012-06-20 16:38:30 -07003378 psessionEntry->currentOperChannel, newChannel);
Jeff Johnson295189b2012-06-20 16:38:30 -07003379 psessionEntry->currentOperChannel = newChannel;
3380 }
Jeff Johnsone7245742012-09-05 17:12:55 -07003381 if (psessionEntry->htSecondaryChannelOffset != subband)
3382 {
3383 limLog(pMac, LOGW,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003384 FL("switch old sec chnl %d --> new sec chnl %d "),
Jeff Johnsone7245742012-09-05 17:12:55 -07003385 psessionEntry->htSecondaryChannelOffset, subband);
3386 psessionEntry->htSecondaryChannelOffset = subband;
3387 if (psessionEntry->htSecondaryChannelOffset == PHY_SINGLE_CHANNEL_CENTERED)
3388 {
3389 psessionEntry->htSupportedChannelWidthSet = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE;
3390 }
3391 else
3392 {
3393 psessionEntry->htSupportedChannelWidthSet = WNI_CFG_CHANNEL_BONDING_MODE_ENABLE;
3394 }
3395 psessionEntry->htRecommendedTxWidthSet = psessionEntry->htSupportedChannelWidthSet;
3396 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003397
3398 return;
3399}
3400
3401
3402/**
3403 * limActiveScanAllowed()
3404 *
3405 *FUNCTION:
3406 * Checks if active scans are permitted on the given channel
3407 *
3408 *LOGIC:
3409 * The config variable SCAN_CONTROL_LIST contains pairs of (channelNum, activeScanAllowed)
3410 * Need to check if the channelNum matches, then depending on the corresponding
3411 * scan flag, return true (for activeScanAllowed==1) or false (otherwise).
3412 *
3413 *ASSUMPTIONS:
3414 *
3415 *NOTE:
3416 *
3417 * @param pMac Pointer to Global MAC structure
3418 * @param channelNum channel number
3419 * @return None
3420 */
3421
3422tANI_U8 limActiveScanAllowed(
3423 tpAniSirGlobal pMac,
3424 tANI_U8 channelNum)
3425{
3426 tANI_U32 i;
3427 tANI_U8 channelPair[WNI_CFG_SCAN_CONTROL_LIST_LEN];
3428 tANI_U32 len = WNI_CFG_SCAN_CONTROL_LIST_LEN;
3429 if (wlan_cfgGetStr(pMac, WNI_CFG_SCAN_CONTROL_LIST, channelPair, &len)
3430 != eSIR_SUCCESS)
3431 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003432 PELOGE(limLog(pMac, LOGE, FL("Unable to get scan control list"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003433 return false;
3434 }
3435
3436 if (len > WNI_CFG_SCAN_CONTROL_LIST_LEN)
3437 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003438 limLog(pMac, LOGE, FL("Invalid scan control list length:%d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07003439 len);
3440 return false;
3441 }
3442
3443 for (i=0; (i+1) < len; i+=2)
3444 {
3445 if (channelPair[i] == channelNum)
3446 return ((channelPair[i+1] == eSIR_ACTIVE_SCAN) ? true : false);
3447 }
3448 return false;
3449}
3450
3451/**
3452 * limTriggerBackgroundScanDuringQuietBss()
3453 *
3454 *FUNCTION:
3455 * This function is applicable to the STA only.
3456 * This function is called by limProcessQuietTimeout(),
3457 * when it is time to honor the Quiet BSS IE from the AP.
3458 *
3459 *LOGIC:
3460 * If 11H is enabled:
3461 * We cannot trigger a background scan. The STA needs to
3462 * shut-off Tx/Rx.
3463 * If 11 is not enabled:
3464 * Determine if the next channel that we are going to
3465 * scan is NOT the same channel (or not) on which the
3466 * Quiet BSS was requested.
3467 * If yes, then we cannot trigger a background scan on
3468 * this channel. Return with a false.
3469 * If no, then trigger a background scan. Return with
3470 * a true.
3471 *
3472 *ASSUMPTIONS:
3473 *
3474 *NOTE:
3475 * This API is redundant if the existing API,
3476 * limTriggerBackgroundScan(), were to return a valid
3477 * response instead of returning void.
3478 * If possible, try to revisit this API
3479 *
3480 * @param pMac Pointer to Global MAC structure
3481 * @return eSIR_TRUE, if a background scan was attempted
3482 * eSIR_FALSE, if not
3483 */
3484tAniBool limTriggerBackgroundScanDuringQuietBss( tpAniSirGlobal pMac )
3485{
3486 tAniBool bScanTriggered = eSIR_FALSE;
Jeff Johnson295189b2012-06-20 16:38:30 -07003487
3488
3489
3490 //TBD-RAJESH HOW TO GET sessionEntry?????
3491 tpPESession psessionEntry = &pMac->lim.gpSession[0];
3492
3493 if (psessionEntry->limSystemRole != eLIM_STA_ROLE)
3494 return bScanTriggered;
3495
Jeff Johnsone7245742012-09-05 17:12:55 -07003496 if( !psessionEntry->lim11hEnable )
Jeff Johnson295189b2012-06-20 16:38:30 -07003497 {
3498 tSirMacChanNum bgScanChannelList[WNI_CFG_BG_SCAN_CHANNEL_LIST_LEN];
3499 tANI_U32 len = WNI_CFG_BG_SCAN_CHANNEL_LIST_LEN;
3500
3501 // Determine the next scan channel
3502
3503 // Get background scan channel list from CFG
3504 if( eSIR_SUCCESS == wlan_cfgGetStr( pMac,
3505 WNI_CFG_BG_SCAN_CHANNEL_LIST,
3506 (tANI_U8 *) bgScanChannelList,
3507 (tANI_U32 *) &len ))
3508 {
3509 // Ensure that we do not go off scanning on the same
3510 // channel on which the Quiet BSS was requested
3511 if( psessionEntry->currentOperChannel!=
3512 bgScanChannelList[pMac->lim.gLimBackgroundScanChannelId] )
3513 {
3514 // For now, try and attempt a background scan. It will
3515 // be ideal if this API actually returns a success or
3516 // failure instead of having a void return type
3517 limTriggerBackgroundScan( pMac );
3518
3519 bScanTriggered = eSIR_TRUE;
3520 }
3521 else
3522 {
3523 limLog( pMac, LOGW,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003524 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 -07003525 }
3526 }
3527 else
3528 {
3529 limLog( pMac, LOGW,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003530 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 -07003531 }
3532 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003533 return bScanTriggered;
3534}
3535
3536
3537/**
3538 * limGetHTCapability()
3539 *
3540 *FUNCTION:
3541 * A utility function that returns the "current HT capability state" for the HT
3542 * capability of interest (as requested in the API)
3543 *
3544 *LOGIC:
3545 * This routine will return with the "current" setting of a requested HT
3546 * capability. This state info could be retrieved from -
3547 * a) CFG (for static entries)
3548 * b) Run time info
3549 * - Dynamic state maintained by LIM
3550 * - Configured at radio init time by SME
3551 *
3552 *
3553 *ASSUMPTIONS:
3554 * NA
3555 *
3556 *NOTE:
3557 *
3558 * @param pMac Pointer to Global MAC structure
3559 * @param htCap The HT capability being queried
3560 * @return tANI_U8 The current state of the requested HT capability is returned in a
3561 * tANI_U8 variable
3562 */
3563
Jeff Johnson295189b2012-06-20 16:38:30 -07003564tANI_U8 limGetHTCapability( tpAniSirGlobal pMac,
3565 tANI_U32 htCap, tpPESession psessionEntry)
Jeff Johnson295189b2012-06-20 16:38:30 -07003566{
3567tANI_U8 retVal = 0;
3568tANI_U8 *ptr;
3569tANI_U32 cfgValue;
3570tSirMacHTCapabilityInfo macHTCapabilityInfo = {0};
3571tSirMacExtendedHTCapabilityInfo macExtHTCapabilityInfo = {0};
3572tSirMacTxBFCapabilityInfo macTxBFCapabilityInfo = {0};
3573tSirMacASCapabilityInfo macASCapabilityInfo = {0};
3574
3575 //
3576 // Determine which CFG to read from. Not ALL of the HT
3577 // related CFG's need to be read each time this API is
3578 // accessed
3579 //
3580 if( htCap >= eHT_ANTENNA_SELECTION &&
3581 htCap < eHT_SI_GRANULARITY )
3582 {
3583 // Get Antenna Seletion HT Capabilities
3584 if( eSIR_SUCCESS != wlan_cfgGetInt( pMac, WNI_CFG_AS_CAP, &cfgValue ))
3585 cfgValue = 0;
3586 ptr = (tANI_U8 *) &macASCapabilityInfo;
3587 *((tANI_U8 *)ptr) = (tANI_U8) (cfgValue & 0xff);
3588 }
3589 else
3590 {
3591 if( htCap >= eHT_TX_BEAMFORMING &&
3592 htCap < eHT_ANTENNA_SELECTION )
3593 {
3594 // Get Transmit Beam Forming HT Capabilities
3595 if( eSIR_SUCCESS != wlan_cfgGetInt( pMac, WNI_CFG_TX_BF_CAP, &cfgValue ))
3596 cfgValue = 0;
3597 ptr = (tANI_U8 *) &macTxBFCapabilityInfo;
3598 *((tANI_U32 *)ptr) = (tANI_U32) (cfgValue);
3599 }
3600 else
3601 {
3602 if( htCap >= eHT_PCO &&
3603 htCap < eHT_TX_BEAMFORMING )
3604 {
3605 // Get Extended HT Capabilities
3606 if( eSIR_SUCCESS != wlan_cfgGetInt( pMac, WNI_CFG_EXT_HT_CAP_INFO, &cfgValue ))
3607 cfgValue = 0;
3608 ptr = (tANI_U8 *) &macExtHTCapabilityInfo;
3609 *((tANI_U16 *)ptr) = (tANI_U16) (cfgValue & 0xffff);
3610 }
3611 else
3612 {
3613 if( htCap < eHT_MAX_RX_AMPDU_FACTOR )
3614 {
3615 // Get HT Capabilities
3616 if( eSIR_SUCCESS != wlan_cfgGetInt( pMac, WNI_CFG_HT_CAP_INFO, &cfgValue ))
3617 cfgValue = 0;
3618 ptr = (tANI_U8 *) &macHTCapabilityInfo;
3619 // 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
3620 *ptr++ = cfgValue & 0xff;
3621 *ptr = (cfgValue >> 8) & 0xff;
3622 }
3623 }
3624 }
3625 }
3626
3627 switch( htCap )
3628 {
3629 case eHT_LSIG_TXOP_PROTECTION:
3630 retVal = pMac->lim.gHTLsigTXOPProtection;
3631 break;
3632
3633 case eHT_STBC_CONTROL_FRAME:
3634 retVal = (tANI_U8) macHTCapabilityInfo.stbcControlFrame;
3635 break;
3636
3637 case eHT_PSMP:
3638 retVal = pMac->lim.gHTPSMPSupport;
3639 break;
3640
3641 case eHT_DSSS_CCK_MODE_40MHZ:
3642 retVal = pMac->lim.gHTDsssCckRate40MHzSupport;
3643 break;
3644
3645 case eHT_MAX_AMSDU_LENGTH:
3646 retVal = (tANI_U8) macHTCapabilityInfo.maximalAMSDUsize;
3647 break;
3648
3649 case eHT_DELAYED_BA:
3650 retVal = (tANI_U8) macHTCapabilityInfo.delayedBA;
3651 break;
3652
3653 case eHT_RX_STBC:
3654 retVal = (tANI_U8) macHTCapabilityInfo.rxSTBC;
3655 break;
3656
3657 case eHT_TX_STBC:
3658 retVal = (tANI_U8) macHTCapabilityInfo.txSTBC;
3659 break;
3660
3661 case eHT_SHORT_GI_40MHZ:
3662 retVal = (tANI_U8) macHTCapabilityInfo.shortGI40MHz;
3663 break;
3664
3665 case eHT_SHORT_GI_20MHZ:
3666 retVal = (tANI_U8) macHTCapabilityInfo.shortGI20MHz;
3667 break;
3668
3669 case eHT_GREENFIELD:
3670 retVal = (tANI_U8) macHTCapabilityInfo.greenField;
3671 break;
3672
3673 case eHT_MIMO_POWER_SAVE:
3674 retVal = (tANI_U8) pMac->lim.gHTMIMOPSState;
3675 break;
3676
3677 case eHT_SUPPORTED_CHANNEL_WIDTH_SET:
Jeff Johnsone7245742012-09-05 17:12:55 -07003678 retVal = (tANI_U8) psessionEntry->htSupportedChannelWidthSet;
Jeff Johnson295189b2012-06-20 16:38:30 -07003679 break;
3680
3681 case eHT_ADVANCED_CODING:
3682 retVal = (tANI_U8) macHTCapabilityInfo.advCodingCap;
3683 break;
3684
3685 case eHT_MAX_RX_AMPDU_FACTOR:
3686 retVal = pMac->lim.gHTMaxRxAMpduFactor;
3687 break;
3688
3689 case eHT_MPDU_DENSITY:
3690 retVal = pMac->lim.gHTAMpduDensity;
3691 break;
3692
3693 case eHT_PCO:
3694 retVal = (tANI_U8) macExtHTCapabilityInfo.pco;
3695 break;
3696
3697 case eHT_TRANSITION_TIME:
3698 retVal = (tANI_U8) macExtHTCapabilityInfo.transitionTime;
3699 break;
3700
3701 case eHT_MCS_FEEDBACK:
3702 retVal = (tANI_U8) macExtHTCapabilityInfo.mcsFeedback;
3703 break;
3704
3705 case eHT_TX_BEAMFORMING:
3706 retVal = (tANI_U8) macTxBFCapabilityInfo.txBF;
3707 break;
3708
3709 case eHT_ANTENNA_SELECTION:
3710 retVal = (tANI_U8) macASCapabilityInfo.antennaSelection;
3711 break;
3712
3713 case eHT_SI_GRANULARITY:
3714 retVal = pMac->lim.gHTServiceIntervalGranularity;
3715 break;
3716
3717 case eHT_CONTROLLED_ACCESS:
3718 retVal = pMac->lim.gHTControlledAccessOnly;
3719 break;
3720
3721 case eHT_RIFS_MODE:
3722 retVal = psessionEntry->beaconParams.fRIFSMode;
3723 break;
3724
3725 case eHT_RECOMMENDED_TX_WIDTH_SET:
Jeff Johnsone7245742012-09-05 17:12:55 -07003726 retVal = psessionEntry->htRecommendedTxWidthSet;
Jeff Johnson295189b2012-06-20 16:38:30 -07003727 break;
3728
3729 case eHT_EXTENSION_CHANNEL_OFFSET:
Jeff Johnsone7245742012-09-05 17:12:55 -07003730 retVal = psessionEntry->htSecondaryChannelOffset;
Jeff Johnson295189b2012-06-20 16:38:30 -07003731 break;
3732
3733 case eHT_OP_MODE:
Jeff Johnson295189b2012-06-20 16:38:30 -07003734 if(psessionEntry->limSystemRole == eLIM_AP_ROLE )
3735 retVal = psessionEntry->htOperMode;
3736 else
Jeff Johnson295189b2012-06-20 16:38:30 -07003737 retVal = pMac->lim.gHTOperMode;
3738 break;
3739
3740 case eHT_BASIC_STBC_MCS:
3741 retVal = pMac->lim.gHTSTBCBasicMCS;
3742 break;
3743
3744 case eHT_DUAL_CTS_PROTECTION:
3745 retVal = pMac->lim.gHTDualCTSProtection;
3746 break;
3747
3748 case eHT_LSIG_TXOP_PROTECTION_FULL_SUPPORT:
3749 retVal = psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport;
3750 break;
3751
3752 case eHT_PCO_ACTIVE:
3753 retVal = pMac->lim.gHTPCOActive;
3754 break;
3755
3756 case eHT_PCO_PHASE:
3757 retVal = pMac->lim.gHTPCOPhase;
3758 break;
3759
3760 default:
3761 break;
3762 }
3763
3764 return retVal;
3765}
3766
Jeff Johnson295189b2012-06-20 16:38:30 -07003767void limGetMyMacAddr(tpAniSirGlobal pMac, tANI_U8 *mac)
3768{
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05303769 vos_mem_copy( mac, pMac->lim.gLimMyMacAddr, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07003770 return;
3771}
3772
3773
3774
3775
3776/** -------------------------------------------------------------
3777\fn limEnable11aProtection
3778\brief based on config setting enables\disables 11a protection.
3779\param tANI_U8 enable : 1=> enable protection, 0=> disable protection.
3780\param tANI_U8 overlap: 1=> called from overlap context, 0 => called from assoc context.
3781\param tpUpdateBeaconParams pBeaconParams
3782\return None
3783 -------------------------------------------------------------*/
3784tSirRetStatus
3785limEnable11aProtection(tpAniSirGlobal pMac, tANI_U8 enable,
3786 tANI_U8 overlap, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry)
3787{
Madan Mohan Koyyalamudi33ef6a22012-10-30 17:44:43 -07003788 if(NULL == psessionEntry)
3789 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003790 PELOG3(limLog(pMac, LOG3, FL("psessionEntry is NULL"));)
Madan Mohan Koyyalamudi33ef6a22012-10-30 17:44:43 -07003791 return eSIR_FAILURE;
3792 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003793 //overlapping protection configuration check.
3794 if(overlap)
3795 {
Jeff Johnson295189b2012-06-20 16:38:30 -07003796 }
3797 else
3798 {
3799 //normal protection config check
Madan Mohan Koyyalamudi33ef6a22012-10-30 17:44:43 -07003800 if ((psessionEntry->limSystemRole == eLIM_AP_ROLE) &&
Jeff Johnsone7245742012-09-05 17:12:55 -07003801 (!psessionEntry->cfgProtection.fromlla))
Jeff Johnson295189b2012-06-20 16:38:30 -07003802 {
3803 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003804 PELOG3(limLog(pMac, LOG3, FL("protection from 11a is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003805 return eSIR_SUCCESS;
3806 }
3807 }
3808
3809 if (enable)
3810 {
3811 //If we are AP and HT capable, we need to set the HT OP mode
3812 //appropriately.
3813 if(((eLIM_AP_ROLE == psessionEntry->limSystemRole)||(eLIM_BT_AMP_AP_ROLE == psessionEntry->limSystemRole))&&
Jeff Johnsone7245742012-09-05 17:12:55 -07003814 (true == psessionEntry->htCapability))
Jeff Johnson295189b2012-06-20 16:38:30 -07003815 {
3816 if(overlap)
3817 {
3818 pMac->lim.gLimOverlap11aParams.protectionEnabled = true;
3819 if((eSIR_HT_OP_MODE_OVERLAP_LEGACY != pMac->lim.gHTOperMode) &&
3820 (eSIR_HT_OP_MODE_MIXED != pMac->lim.gHTOperMode))
3821 {
3822 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
3823 psessionEntry->htOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
3824 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
3825 limEnableHtOBSSProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
3826 }
3827 }
3828 else
3829 {
3830 psessionEntry->gLim11aParams.protectionEnabled = true;
3831 if(eSIR_HT_OP_MODE_MIXED != pMac->lim.gHTOperMode)
3832 {
3833 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_MIXED;
Jeff Johnsone7245742012-09-05 17:12:55 -07003834 psessionEntry->htOperMode = eSIR_HT_OP_MODE_MIXED;
Jeff Johnson295189b2012-06-20 16:38:30 -07003835 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
3836 limEnableHtOBSSProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
3837
3838 }
3839 }
3840 }
3841
3842 //This part is common for staiton as well.
3843 if(false == psessionEntry->beaconParams.llaCoexist)
3844 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003845 PELOG1(limLog(pMac, LOG1, FL(" => protection from 11A Enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003846 pBeaconParams->llaCoexist = psessionEntry->beaconParams.llaCoexist = true;
3847 pBeaconParams->paramChangeBitmap |= PARAM_llACOEXIST_CHANGED;
3848 }
3849 }
3850 else if (true == psessionEntry->beaconParams.llaCoexist)
3851 {
3852 //for AP role.
3853 //we need to take care of HT OP mode change if needed.
3854 //We need to take care of Overlap cases.
3855 if(eLIM_AP_ROLE == psessionEntry->limSystemRole)
3856 {
3857 if(overlap)
3858 {
3859 //Overlap Legacy protection disabled.
3860 pMac->lim.gLimOverlap11aParams.protectionEnabled = false;
3861
3862 //We need to take care of HT OP mode iff we are HT AP.
Jeff Johnsone7245742012-09-05 17:12:55 -07003863 if(psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07003864 {
3865 // no HT op mode change if any of the overlap protection enabled.
3866 if(!(pMac->lim.gLimOverlap11aParams.protectionEnabled ||
3867 pMac->lim.gLimOverlapHt20Params.protectionEnabled ||
3868 pMac->lim.gLimOverlapNonGfParams.protectionEnabled))
3869
3870 {
3871 //Check if there is a need to change HT OP mode.
3872 if(eSIR_HT_OP_MODE_OVERLAP_LEGACY == pMac->lim.gHTOperMode)
3873 {
3874 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
3875 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
3876
3877 if(psessionEntry->gLimHt20Params.protectionEnabled)
3878 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
3879 else
3880 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_PURE;
3881 }
3882 }
3883 }
3884 }
3885 else
3886 {
3887 //Disable protection from 11A stations.
3888 psessionEntry->gLim11aParams.protectionEnabled = false;
3889 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
3890
3891 //Check if any other non-HT protection enabled.
3892 //Right now we are in HT OP Mixed mode.
3893 //Change HT op mode appropriately.
3894
3895 //Change HT OP mode to 01 if any overlap protection enabled
3896 if(pMac->lim.gLimOverlap11aParams.protectionEnabled ||
3897 pMac->lim.gLimOverlapHt20Params.protectionEnabled ||
3898 pMac->lim.gLimOverlapNonGfParams.protectionEnabled)
3899
3900 {
3901 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
Jeff Johnsone7245742012-09-05 17:12:55 -07003902 psessionEntry->htOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
Jeff Johnson295189b2012-06-20 16:38:30 -07003903 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
3904 }
3905 else if(psessionEntry->gLimHt20Params.protectionEnabled)
3906 {
3907 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
Jeff Johnsone7245742012-09-05 17:12:55 -07003908 psessionEntry->htOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
Jeff Johnson295189b2012-06-20 16:38:30 -07003909 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
3910 }
3911 else
3912 {
3913 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_PURE;
Jeff Johnsone7245742012-09-05 17:12:55 -07003914 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
Jeff Johnson295189b2012-06-20 16:38:30 -07003915 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
3916 }
3917 }
3918 if(!pMac->lim.gLimOverlap11aParams.protectionEnabled &&
3919 !psessionEntry->gLim11aParams.protectionEnabled)
3920 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003921 PELOG1(limLog(pMac, LOG1, FL("===> Protection from 11A Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003922 pBeaconParams->llaCoexist = psessionEntry->beaconParams.llaCoexist = false;
3923 pBeaconParams->paramChangeBitmap |= PARAM_llACOEXIST_CHANGED;
3924 }
3925 }
3926 //for station role
3927 else
3928 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003929 PELOG1(limLog(pMac, LOG1, FL("===> Protection from 11A Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003930 pBeaconParams->llaCoexist = psessionEntry->beaconParams.llaCoexist = false;
3931 pBeaconParams->paramChangeBitmap |= PARAM_llACOEXIST_CHANGED;
3932 }
3933 }
3934
3935 return eSIR_SUCCESS;
3936}
3937
3938/** -------------------------------------------------------------
3939\fn limEnable11gProtection
3940\brief based on config setting enables\disables 11g protection.
3941\param tANI_U8 enable : 1=> enable protection, 0=> disable protection.
3942\param tANI_U8 overlap: 1=> called from overlap context, 0 => called from assoc context.
3943\param tpUpdateBeaconParams pBeaconParams
3944\return None
3945 -------------------------------------------------------------*/
3946
3947tSirRetStatus
3948limEnable11gProtection(tpAniSirGlobal pMac, tANI_U8 enable,
3949 tANI_U8 overlap, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry)
3950{
3951
3952 //overlapping protection configuration check.
3953 if(overlap)
3954 {
Jeff Johnson295189b2012-06-20 16:38:30 -07003955 }
3956 else
3957 {
3958 //normal protection config check
Jeff Johnson295189b2012-06-20 16:38:30 -07003959 if((psessionEntry->limSystemRole == eLIM_AP_ROLE ) &&
3960 !psessionEntry->cfgProtection.fromllb)
3961 {
3962 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003963 PELOG1(limLog(pMac, LOG1, FL("protection from 11b is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003964 return eSIR_SUCCESS;
3965 }else if(psessionEntry->limSystemRole != eLIM_AP_ROLE)
Jeff Johnson295189b2012-06-20 16:38:30 -07003966 {
3967 if(!pMac->lim.cfgProtection.fromllb)
3968 {
3969 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003970 PELOG1(limLog(pMac, LOG1, FL("protection from 11b is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003971 return eSIR_SUCCESS;
3972 }
3973 }
3974 }
3975
3976 if (enable)
3977 {
3978 //If we are AP and HT capable, we need to set the HT OP mode
3979 //appropriately.
Jeff Johnson295189b2012-06-20 16:38:30 -07003980 if(eLIM_AP_ROLE == psessionEntry->limSystemRole)
3981 {
3982 if(overlap)
3983 {
3984 psessionEntry->gLimOlbcParams.protectionEnabled = true;
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003985 PELOGE(limLog(pMac, LOGE, FL("protection from olbc is enabled"));)
Jeff Johnsone7245742012-09-05 17:12:55 -07003986 if(true == psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07003987 {
3988 if((eSIR_HT_OP_MODE_OVERLAP_LEGACY != psessionEntry->htOperMode) &&
3989 (eSIR_HT_OP_MODE_MIXED != psessionEntry->htOperMode))
3990 {
3991 psessionEntry->htOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
3992 }
3993 //CR-263021: OBSS bit is not switching back to 0 after disabling the overlapping legacy BSS
3994 // This fixes issue of OBSS bit not set after 11b, 11g station leaves
3995 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
3996 //Not processing OBSS bit from other APs, as we are already taking care
3997 //of Protection from overlapping BSS based on erp IE or useProtection bit
3998 limEnableHtOBSSProtection(pMac, true, overlap, pBeaconParams, psessionEntry);
3999 }
4000 }
4001 else
4002 {
4003 psessionEntry->gLim11bParams.protectionEnabled = true;
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004004 PELOGE(limLog(pMac, LOGE, FL("protection from 11b is enabled"));)
Jeff Johnsone7245742012-09-05 17:12:55 -07004005 if(true == psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07004006 {
4007 if(eSIR_HT_OP_MODE_MIXED != psessionEntry->htOperMode)
4008 {
4009 psessionEntry->htOperMode = eSIR_HT_OP_MODE_MIXED;
4010 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4011 limEnableHtOBSSProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4012 }
4013 }
4014 }
4015 }else if ((eLIM_BT_AMP_AP_ROLE == psessionEntry->limSystemRole) &&
Jeff Johnsone7245742012-09-05 17:12:55 -07004016 (true == psessionEntry->htCapability))
Jeff Johnson295189b2012-06-20 16:38:30 -07004017 {
4018 if(overlap)
4019 {
4020 psessionEntry->gLimOlbcParams.protectionEnabled = true;
4021 if((eSIR_HT_OP_MODE_OVERLAP_LEGACY != pMac->lim.gHTOperMode) &&
4022 (eSIR_HT_OP_MODE_MIXED != pMac->lim.gHTOperMode))
4023 {
4024 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
4025 }
4026 //CR-263021: OBSS bit is not switching back to 0 after disabling the overlapping legacy BSS
4027 // This fixes issue of OBSS bit not set after 11b, 11g station leaves
4028 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4029 //Not processing OBSS bit from other APs, as we are already taking care
4030 //of Protection from overlapping BSS based on erp IE or useProtection bit
4031 limEnableHtOBSSProtection(pMac, true, overlap, pBeaconParams, psessionEntry);
4032 }
4033 else
4034 {
4035 psessionEntry->gLim11bParams.protectionEnabled = true;
4036 if(eSIR_HT_OP_MODE_MIXED != pMac->lim.gHTOperMode)
4037 {
4038 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_MIXED;
4039 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4040 limEnableHtOBSSProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4041 }
4042 }
4043 }
4044
4045 //This part is common for staiton as well.
4046 if(false == psessionEntry->beaconParams.llbCoexist)
4047 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004048 PELOG1(limLog(pMac, LOG1, FL("=> 11G Protection Enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004049 pBeaconParams->llbCoexist = psessionEntry->beaconParams.llbCoexist = true;
4050 pBeaconParams->paramChangeBitmap |= PARAM_llBCOEXIST_CHANGED;
4051 }
4052 }
4053 else if (true == psessionEntry->beaconParams.llbCoexist)
4054 {
4055 //for AP role.
4056 //we need to take care of HT OP mode change if needed.
4057 //We need to take care of Overlap cases.
Jeff Johnson295189b2012-06-20 16:38:30 -07004058 if(eLIM_AP_ROLE == psessionEntry->limSystemRole)
4059 {
4060 if(overlap)
4061 {
4062 //Overlap Legacy protection disabled.
4063 psessionEntry->gLimOlbcParams.protectionEnabled = false;
4064
4065 //We need to take care of HT OP mode if we are HT AP.
Jeff Johnsone7245742012-09-05 17:12:55 -07004066 if(psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07004067 {
4068 // no HT op mode change if any of the overlap protection enabled.
4069 if(!(psessionEntry->gLimOverlap11gParams.protectionEnabled ||
4070 psessionEntry->gLimOverlapHt20Params.protectionEnabled ||
4071 psessionEntry->gLimOverlapNonGfParams.protectionEnabled))
4072 {
4073 //Check if there is a need to change HT OP mode.
Jeff Johnson04dd8a82012-06-29 20:41:40 -07004074 if(eSIR_HT_OP_MODE_OVERLAP_LEGACY == psessionEntry->htOperMode)
Jeff Johnson295189b2012-06-20 16:38:30 -07004075 {
4076 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4077 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4078 if(psessionEntry->gLimHt20Params.protectionEnabled){
4079 //Commenting out beacuse of CR 258588 WFA cert
4080 //psessionEntry->htOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4081 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
4082 }
4083 else
4084 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
4085 }
4086 }
4087 }
4088 }
4089 else
4090 {
4091 //Disable protection from 11B stations.
4092 psessionEntry->gLim11bParams.protectionEnabled = false;
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004093 PELOGE(limLog(pMac, LOGE, FL("===> 11B Protection Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004094 //Check if any other non-HT protection enabled.
4095 if(!psessionEntry->gLim11gParams.protectionEnabled)
4096 {
4097 //Right now we are in HT OP Mixed mode.
4098 //Change HT op mode appropriately.
4099 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4100
4101 //Change HT OP mode to 01 if any overlap protection enabled
4102 if(psessionEntry->gLimOlbcParams.protectionEnabled ||
4103 psessionEntry->gLimOverlap11gParams.protectionEnabled ||
4104 psessionEntry->gLimOverlapHt20Params.protectionEnabled ||
4105 psessionEntry->gLimOverlapNonGfParams.protectionEnabled)
4106 {
4107 psessionEntry->htOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004108 PELOGE(limLog(pMac, LOGE, FL("===> 11G Protection Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004109 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4110 }
4111 else if(psessionEntry->gLimHt20Params.protectionEnabled)
4112 {
4113 //Commenting because of CR 258588 WFA cert
4114 //psessionEntry->htOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4115 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004116 PELOGE(limLog(pMac, LOGE, FL("===> 11G Protection Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004117 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4118 }
4119 else
4120 {
4121 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
4122 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4123 }
4124 }
4125 }
4126 if(!psessionEntry->gLimOlbcParams.protectionEnabled &&
4127 !psessionEntry->gLim11bParams.protectionEnabled)
4128 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004129 PELOGE(limLog(pMac, LOGE, FL("===> 11G Protection Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004130 pBeaconParams->llbCoexist = psessionEntry->beaconParams.llbCoexist = false;
4131 pBeaconParams->paramChangeBitmap |= PARAM_llBCOEXIST_CHANGED;
4132 }
4133 }else if(eLIM_BT_AMP_AP_ROLE == psessionEntry->limSystemRole)
Jeff Johnson295189b2012-06-20 16:38:30 -07004134 {
4135 if(overlap)
4136 {
4137 //Overlap Legacy protection disabled.
4138 psessionEntry->gLimOlbcParams.protectionEnabled = false;
4139
4140 //We need to take care of HT OP mode iff we are HT AP.
Jeff Johnsone7245742012-09-05 17:12:55 -07004141 if(psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07004142 {
4143 // no HT op mode change if any of the overlap protection enabled.
4144 if(!(pMac->lim.gLimOverlap11gParams.protectionEnabled ||
4145 pMac->lim.gLimOverlapHt20Params.protectionEnabled ||
4146 pMac->lim.gLimOverlapNonGfParams.protectionEnabled))
4147
4148 {
4149 //Check if there is a need to change HT OP mode.
4150 if(eSIR_HT_OP_MODE_OVERLAP_LEGACY == pMac->lim.gHTOperMode)
4151 {
4152 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4153 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4154 if(psessionEntry->gLimHt20Params.protectionEnabled)
4155 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4156 else
4157 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_PURE;
4158 }
4159 }
4160 }
4161 }
4162 else
4163 {
4164 //Disable protection from 11B stations.
4165 psessionEntry->gLim11bParams.protectionEnabled = false;
4166 //Check if any other non-HT protection enabled.
4167 if(!psessionEntry->gLim11gParams.protectionEnabled)
4168 {
4169 //Right now we are in HT OP Mixed mode.
4170 //Change HT op mode appropriately.
4171 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4172
4173 //Change HT OP mode to 01 if any overlap protection enabled
4174 if(psessionEntry->gLimOlbcParams.protectionEnabled ||
4175 pMac->lim.gLimOverlap11gParams.protectionEnabled ||
4176 pMac->lim.gLimOverlapHt20Params.protectionEnabled ||
4177 pMac->lim.gLimOverlapNonGfParams.protectionEnabled)
4178
4179 {
4180 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
4181 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4182 }
4183 else if(psessionEntry->gLimHt20Params.protectionEnabled)
4184 {
4185 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4186 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4187 }
4188 else
4189 {
4190 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_PURE;
4191 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4192 }
4193 }
4194 }
4195 if(!psessionEntry->gLimOlbcParams.protectionEnabled &&
4196 !psessionEntry->gLim11bParams.protectionEnabled)
4197 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004198 PELOG1(limLog(pMac, LOG1, FL("===> 11G Protection Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004199 pBeaconParams->llbCoexist = psessionEntry->beaconParams.llbCoexist = false;
4200 pBeaconParams->paramChangeBitmap |= PARAM_llBCOEXIST_CHANGED;
4201 }
4202 }
4203 //for station role
4204 else
4205 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004206 PELOG1(limLog(pMac, LOG1, FL("===> 11G Protection Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004207 pBeaconParams->llbCoexist = psessionEntry->beaconParams.llbCoexist = false;
4208 pBeaconParams->paramChangeBitmap |= PARAM_llBCOEXIST_CHANGED;
4209 }
4210 }
4211 return eSIR_SUCCESS;
4212}
4213
4214/** -------------------------------------------------------------
4215\fn limEnableHtProtectionFrom11g
4216\brief based on cofig enables\disables protection from 11g.
4217\param tANI_U8 enable : 1=> enable protection, 0=> disable protection.
4218\param tANI_U8 overlap: 1=> called from overlap context, 0 => called from assoc context.
4219\param tpUpdateBeaconParams pBeaconParams
4220\return None
4221 -------------------------------------------------------------*/
4222tSirRetStatus
4223limEnableHtProtectionFrom11g(tpAniSirGlobal pMac, tANI_U8 enable,
4224 tANI_U8 overlap, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry)
4225{
Jeff Johnsone7245742012-09-05 17:12:55 -07004226 if(!psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07004227 return eSIR_SUCCESS; // protection from 11g is only for HT stations.
4228
4229 //overlapping protection configuration check.
4230 if(overlap)
4231 {
Jeff Johnson295189b2012-06-20 16:38:30 -07004232 if((psessionEntry->limSystemRole == eLIM_AP_ROLE ) && (!psessionEntry->cfgProtection.overlapFromllg))
4233 {
4234 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004235 PELOG3(limLog(pMac, LOG3, FL("overlap protection from 11g is disabled")););
Jeff Johnson295189b2012-06-20 16:38:30 -07004236 return eSIR_SUCCESS;
4237 }else if ((psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE) && (!pMac->lim.cfgProtection.overlapFromllg))
Jeff Johnson295189b2012-06-20 16:38:30 -07004238 {
4239 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004240 PELOG3(limLog(pMac, LOG3, FL("overlap protection from 11g is disabled")););
Jeff Johnson295189b2012-06-20 16:38:30 -07004241 return eSIR_SUCCESS;
4242 }
4243 }
4244 else
4245 {
4246 //normal protection config check
Jeff Johnson295189b2012-06-20 16:38:30 -07004247 if((psessionEntry->limSystemRole == eLIM_AP_ROLE ) &&
4248 !psessionEntry->cfgProtection.fromllg){
4249 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004250 PELOG3(limLog(pMac, LOG3, FL("protection from 11g is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004251 return eSIR_SUCCESS;
4252 }else if(psessionEntry->limSystemRole != eLIM_AP_ROLE )
Jeff Johnson295189b2012-06-20 16:38:30 -07004253 {
4254 if(!pMac->lim.cfgProtection.fromllg)
4255 {
4256 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004257 PELOG3(limLog(pMac, LOG3, FL("protection from 11g is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004258 return eSIR_SUCCESS;
4259 }
4260 }
4261 }
4262 if (enable)
4263 {
4264 //If we are AP and HT capable, we need to set the HT OP mode
4265 //appropriately.
4266
Jeff Johnson295189b2012-06-20 16:38:30 -07004267 if(eLIM_AP_ROLE == psessionEntry->limSystemRole)
4268 {
4269 if(overlap)
4270 {
4271 psessionEntry->gLimOverlap11gParams.protectionEnabled = true;
4272 //11g exists in overlap BSS.
4273 //need not to change the operating mode to overlap_legacy
4274 //if higher or same protection operating mode is enabled right now.
4275 if((eSIR_HT_OP_MODE_OVERLAP_LEGACY != psessionEntry->htOperMode) &&
4276 (eSIR_HT_OP_MODE_MIXED != psessionEntry->htOperMode))
4277 {
4278 psessionEntry->htOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
4279 }
4280 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05304281 limEnableHtOBSSProtection(pMac, true, overlap, pBeaconParams, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07004282 }
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 != psessionEntry->htOperMode)
4289 {
4290 psessionEntry->htOperMode = 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 }else if(eLIM_BT_AMP_AP_ROLE == psessionEntry->limSystemRole)
Jeff Johnson295189b2012-06-20 16:38:30 -07004296 {
4297 if(overlap)
4298 {
4299 pMac->lim.gLimOverlap11gParams.protectionEnabled = true;
4300 //11g exists in overlap BSS.
4301 //need not to change the operating mode to overlap_legacy
4302 //if higher or same protection operating mode is enabled right now.
4303 if((eSIR_HT_OP_MODE_OVERLAP_LEGACY != pMac->lim.gHTOperMode) &&
4304 (eSIR_HT_OP_MODE_MIXED != pMac->lim.gHTOperMode))
4305 {
4306 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
4307 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4308 }
4309 }
4310 else
4311 {
4312 //11g is associated to an AP operating in 11n mode.
4313 //Change the HT operating mode to 'mixed mode'.
4314 psessionEntry->gLim11gParams.protectionEnabled = true;
4315 if(eSIR_HT_OP_MODE_MIXED != pMac->lim.gHTOperMode)
4316 {
4317 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_MIXED;
4318 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05304319 limEnableHtOBSSProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07004320 }
4321 }
4322 }
4323
4324 //This part is common for staiton as well.
4325 if(false == psessionEntry->beaconParams.llgCoexist)
4326 {
4327 pBeaconParams->llgCoexist = psessionEntry->beaconParams.llgCoexist = true;
4328 pBeaconParams->paramChangeBitmap |= PARAM_llGCOEXIST_CHANGED;
4329 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004330 else if (true == psessionEntry->gLimOverlap11gParams.protectionEnabled)
4331 {
4332 // As operating mode changed after G station assoc some way to update beacon
4333 // This addresses the issue of mode not changing to - 11 in beacon when OBSS overlap is enabled
4334 //pMac->sch.schObject.fBeaconChanged = 1;
4335 pBeaconParams->paramChangeBitmap |= PARAM_llGCOEXIST_CHANGED;
4336 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004337 }
4338 else if (true == psessionEntry->beaconParams.llgCoexist)
4339 {
4340 //for AP role.
4341 //we need to take care of HT OP mode change if needed.
4342 //We need to take care of Overlap cases.
4343
Jeff Johnson295189b2012-06-20 16:38:30 -07004344 if(eLIM_AP_ROLE == psessionEntry->limSystemRole)
4345 {
4346 if(overlap)
4347 {
4348 //Overlap Legacy protection disabled.
4349 if (psessionEntry->gLim11gParams.numSta == 0)
4350 psessionEntry->gLimOverlap11gParams.protectionEnabled = false;
4351
4352 // no HT op mode change if any of the overlap protection enabled.
4353 if(!(psessionEntry->gLimOlbcParams.protectionEnabled ||
4354 psessionEntry->gLimOverlapHt20Params.protectionEnabled ||
4355 psessionEntry->gLimOverlapNonGfParams.protectionEnabled))
4356 {
4357 //Check if there is a need to change HT OP mode.
4358 if(eSIR_HT_OP_MODE_OVERLAP_LEGACY == psessionEntry->htOperMode)
4359 {
4360 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4361 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4362
4363 if(psessionEntry->gLimHt20Params.protectionEnabled){
4364 //Commenting because of CR 258588 WFA cert
4365 //psessionEntry->htOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4366 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
4367 }
4368 else
4369 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
4370 }
4371 }
4372 }
4373 else
4374 {
4375 //Disable protection from 11G stations.
4376 psessionEntry->gLim11gParams.protectionEnabled = false;
4377 //Check if any other non-HT protection enabled.
4378 if(!psessionEntry->gLim11bParams.protectionEnabled)
4379 {
4380
4381 //Right now we are in HT OP Mixed mode.
4382 //Change HT op mode appropriately.
4383 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4384
4385 //Change HT OP mode to 01 if any overlap protection enabled
4386 if(psessionEntry->gLimOlbcParams.protectionEnabled ||
4387 psessionEntry->gLimOverlap11gParams.protectionEnabled ||
4388 psessionEntry->gLimOverlapHt20Params.protectionEnabled ||
4389 psessionEntry->gLimOverlapNonGfParams.protectionEnabled)
4390
4391 {
4392 psessionEntry->htOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
4393 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4394 }
4395 else if(psessionEntry->gLimHt20Params.protectionEnabled)
4396 {
4397 //Commenting because of CR 258588 WFA cert
4398 //psessionEntry->htOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4399 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
4400 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4401 }
4402 else
4403 {
4404 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
4405 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4406 }
4407 }
4408 }
4409 if(!psessionEntry->gLimOverlap11gParams.protectionEnabled &&
4410 !psessionEntry->gLim11gParams.protectionEnabled)
4411 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004412 PELOG1(limLog(pMac, LOG1, FL("===> Protection from 11G Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004413 pBeaconParams->llgCoexist = psessionEntry->beaconParams.llgCoexist = false;
4414 pBeaconParams->paramChangeBitmap |= PARAM_llGCOEXIST_CHANGED;
4415 }
4416 }else if(eLIM_BT_AMP_AP_ROLE == psessionEntry->limSystemRole)
Jeff Johnson295189b2012-06-20 16:38:30 -07004417 {
4418 if(overlap)
4419 {
4420 //Overlap Legacy protection disabled.
4421 pMac->lim.gLimOverlap11gParams.protectionEnabled = false;
4422
4423 // no HT op mode change if any of the overlap protection enabled.
4424 if(!(psessionEntry->gLimOlbcParams.protectionEnabled ||
4425 psessionEntry->gLimOverlapHt20Params.protectionEnabled ||
4426 psessionEntry->gLimOverlapNonGfParams.protectionEnabled))
4427 {
4428 //Check if there is a need to change HT OP mode.
4429 if(eSIR_HT_OP_MODE_OVERLAP_LEGACY == pMac->lim.gHTOperMode)
4430 {
4431 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4432 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4433
4434 if(psessionEntry->gLimHt20Params.protectionEnabled)
4435 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4436 else
4437 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_PURE;
4438 }
4439 }
4440 }
4441 else
4442 {
4443 //Disable protection from 11G stations.
4444 psessionEntry->gLim11gParams.protectionEnabled = false;
4445 //Check if any other non-HT protection enabled.
4446 if(!psessionEntry->gLim11bParams.protectionEnabled)
4447 {
4448
4449 //Right now we are in HT OP Mixed mode.
4450 //Change HT op mode appropriately.
4451 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4452
4453 //Change HT OP mode to 01 if any overlap protection enabled
4454 if(psessionEntry->gLimOlbcParams.protectionEnabled ||
4455 pMac->lim.gLimOverlap11gParams.protectionEnabled ||
4456 pMac->lim.gLimOverlapHt20Params.protectionEnabled ||
4457 pMac->lim.gLimOverlapNonGfParams.protectionEnabled)
4458
4459 {
4460 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
4461 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4462 }
4463 else if(psessionEntry->gLimHt20Params.protectionEnabled)
4464 {
4465 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4466 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4467 }
4468 else
4469 {
4470 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_PURE;
4471 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4472 }
4473 }
4474 }
4475 if(!pMac->lim.gLimOverlap11gParams.protectionEnabled &&
4476 !psessionEntry->gLim11gParams.protectionEnabled)
4477 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004478 PELOG1(limLog(pMac, LOG1, FL("===> Protection from 11G Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004479 pBeaconParams->llgCoexist = psessionEntry->beaconParams.llgCoexist = false;
4480 pBeaconParams->paramChangeBitmap |= PARAM_llGCOEXIST_CHANGED;
4481 }
4482 }
4483 //for station role
4484 else
4485 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004486 PELOG1(limLog(pMac, LOG1, FL("===> Protection from 11G Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004487 pBeaconParams->llgCoexist = psessionEntry->beaconParams.llgCoexist = false;
4488 pBeaconParams->paramChangeBitmap |= PARAM_llGCOEXIST_CHANGED;
4489 }
4490 }
4491 return eSIR_SUCCESS;
4492}
4493//FIXME_PROTECTION : need to check for no APSD whenever we want to enable this protection.
4494//This check will be done at the caller.
4495
4496/** -------------------------------------------------------------
4497\fn limEnableHtObssProtection
4498\brief based on cofig enables\disables obss protection.
4499\param tANI_U8 enable : 1=> enable protection, 0=> disable protection.
4500\param tANI_U8 overlap: 1=> called from overlap context, 0 => called from assoc context.
4501\param tpUpdateBeaconParams pBeaconParams
4502\return None
4503 -------------------------------------------------------------*/
4504tSirRetStatus
4505limEnableHtOBSSProtection(tpAniSirGlobal pMac, tANI_U8 enable,
4506 tANI_U8 overlap, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry)
4507{
4508
4509
Jeff Johnsone7245742012-09-05 17:12:55 -07004510 if(!psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07004511 return eSIR_SUCCESS; // this protection is only for HT stations.
4512
4513 //overlapping protection configuration check.
4514 if(overlap)
4515 {
4516 //overlapping protection configuration check.
Jeff Johnson295189b2012-06-20 16:38:30 -07004517 }
4518 else
4519 {
4520 //normal protection config check
Jeff Johnson295189b2012-06-20 16:38:30 -07004521 if((psessionEntry->limSystemRole == eLIM_AP_ROLE) && !psessionEntry->cfgProtection.obss)
4522 { //ToDo Update this field
4523 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004524 PELOG1(limLog(pMac, LOG1, FL("protection from Obss is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004525 return eSIR_SUCCESS;
4526 }else if(psessionEntry->limSystemRole != eLIM_AP_ROLE)
Jeff Johnson295189b2012-06-20 16:38:30 -07004527 {
4528 if(!pMac->lim.cfgProtection.obss)
4529 { //ToDo Update this field
4530 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004531 PELOG1(limLog(pMac, LOG1, FL("protection from Obss is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004532 return eSIR_SUCCESS;
4533 }
4534 }
4535 }
4536
4537
Jeff Johnson295189b2012-06-20 16:38:30 -07004538 if (eLIM_AP_ROLE == psessionEntry->limSystemRole){
4539 if ((enable) && (false == psessionEntry->beaconParams.gHTObssMode) )
4540 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004541 PELOG1(limLog(pMac, LOG1, FL("=>obss protection enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004542 psessionEntry->beaconParams.gHTObssMode = true;
4543 pBeaconParams->paramChangeBitmap |= PARAM_OBSS_MODE_CHANGED; // UPDATE AN ENUM FOR OBSS MODE <todo>
4544
4545 }
4546 else if (!enable && (true == psessionEntry->beaconParams.gHTObssMode))
4547 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004548 PELOG1(limLog(pMac, LOG1, FL("===> obss Protection disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004549 psessionEntry->beaconParams.gHTObssMode = false;
4550 pBeaconParams->paramChangeBitmap |= PARAM_OBSS_MODE_CHANGED;
4551
4552 }
4553//CR-263021: OBSS bit is not switching back to 0 after disabling the overlapping legacy BSS
4554 if (!enable && !overlap)
4555 {
4556 psessionEntry->gLimOverlap11gParams.protectionEnabled = false;
4557 }
4558 } else
Jeff Johnson295189b2012-06-20 16:38:30 -07004559 {
4560 if ((enable) && (false == psessionEntry->beaconParams.gHTObssMode) )
4561 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004562 PELOG1(limLog(pMac, LOG1, FL("=>obss protection enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004563 psessionEntry->beaconParams.gHTObssMode = true;
4564 pBeaconParams->paramChangeBitmap |= PARAM_OBSS_MODE_CHANGED; // UPDATE AN ENUM FOR OBSS MODE <todo>
4565
4566 }
4567 else if (!enable && (true == psessionEntry->beaconParams.gHTObssMode))
4568 {
4569
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004570 PELOG1(limLog(pMac, LOG1, FL("===> obss Protection disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004571 psessionEntry->beaconParams.gHTObssMode = false;
4572 pBeaconParams->paramChangeBitmap |= PARAM_OBSS_MODE_CHANGED;
4573
4574 }
4575 }
4576 return eSIR_SUCCESS;
4577}
4578/** -------------------------------------------------------------
4579\fn limEnableHT20Protection
4580\brief based on cofig enables\disables protection from Ht20.
4581\param tANI_U8 enable : 1=> enable protection, 0=> disable protection.
4582\param tANI_U8 overlap: 1=> called from overlap context, 0 => called from assoc context.
4583\param tpUpdateBeaconParams pBeaconParams
4584\return None
4585 -------------------------------------------------------------*/
4586tSirRetStatus
4587limEnableHT20Protection(tpAniSirGlobal pMac, tANI_U8 enable,
4588 tANI_U8 overlap, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry)
4589{
Jeff Johnsone7245742012-09-05 17:12:55 -07004590 if(!psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07004591 return eSIR_SUCCESS; // this protection is only for HT stations.
4592
4593 //overlapping protection configuration check.
4594 if(overlap)
4595 {
Jeff Johnson295189b2012-06-20 16:38:30 -07004596 }
4597 else
4598 {
4599 //normal protection config check
Jeff Johnson295189b2012-06-20 16:38:30 -07004600 if((psessionEntry->limSystemRole == eLIM_AP_ROLE ) &&
4601 !psessionEntry->cfgProtection.ht20)
4602 {
4603 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004604 PELOG3(limLog(pMac, LOG3, FL("protection from HT20 is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004605 return eSIR_SUCCESS;
4606 }else if(psessionEntry->limSystemRole != eLIM_AP_ROLE )
Jeff Johnson295189b2012-06-20 16:38:30 -07004607 {
4608 if(!pMac->lim.cfgProtection.ht20)
4609 {
4610 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004611 PELOG3(limLog(pMac, LOG3, FL("protection from HT20 is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004612 return eSIR_SUCCESS;
4613 }
4614 }
4615 }
4616
4617 if (enable)
4618 {
4619 //If we are AP and HT capable, we need to set the HT OP mode
4620 //appropriately.
4621
Jeff Johnson295189b2012-06-20 16:38:30 -07004622 if(eLIM_AP_ROLE == psessionEntry->limSystemRole){
4623 if(overlap)
4624 {
4625 psessionEntry->gLimOverlapHt20Params.protectionEnabled = true;
4626 if((eSIR_HT_OP_MODE_OVERLAP_LEGACY != psessionEntry->htOperMode) &&
4627 (eSIR_HT_OP_MODE_MIXED != psessionEntry->htOperMode))
4628 {
4629 psessionEntry->htOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
4630 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4631 }
4632 }
4633 else
4634 {
4635 psessionEntry->gLimHt20Params.protectionEnabled = true;
4636 if(eSIR_HT_OP_MODE_PURE == psessionEntry->htOperMode)
4637 {
4638 //Commenting because of CR 258588 WFA cert
4639 //psessionEntry->htOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4640 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
4641 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4642 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4643 }
4644 }
4645 }else if(eLIM_BT_AMP_AP_ROLE == psessionEntry->limSystemRole)
Jeff Johnson295189b2012-06-20 16:38:30 -07004646 {
4647 if(overlap)
4648 {
4649 pMac->lim.gLimOverlapHt20Params.protectionEnabled = true;
4650 if((eSIR_HT_OP_MODE_OVERLAP_LEGACY != pMac->lim.gHTOperMode) &&
4651 (eSIR_HT_OP_MODE_MIXED != pMac->lim.gHTOperMode))
4652 {
4653 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
4654 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4655 }
4656 }
4657 else
4658 {
4659 psessionEntry->gLimHt20Params.protectionEnabled = true;
4660 if(eSIR_HT_OP_MODE_PURE == pMac->lim.gHTOperMode)
4661 {
4662 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4663 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4664 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4665 }
4666 }
4667 }
4668
4669 //This part is common for staiton as well.
4670 if(false == psessionEntry->beaconParams.ht20Coexist)
4671 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004672 PELOG1(limLog(pMac, LOG1, FL("=> Prtection from HT20 Enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004673 pBeaconParams->ht20MhzCoexist = psessionEntry->beaconParams.ht20Coexist = true;
4674 pBeaconParams->paramChangeBitmap |= PARAM_HT20MHZCOEXIST_CHANGED;
4675 }
4676 }
4677 else if (true == psessionEntry->beaconParams.ht20Coexist)
4678 {
4679 //for AP role.
4680 //we need to take care of HT OP mode change if needed.
4681 //We need to take care of Overlap cases.
Jeff Johnson295189b2012-06-20 16:38:30 -07004682 if(eLIM_AP_ROLE == psessionEntry->limSystemRole){
4683 if(overlap)
4684 {
4685 //Overlap Legacy protection disabled.
4686 psessionEntry->gLimOverlapHt20Params.protectionEnabled = false;
4687
4688 // no HT op mode change if any of the overlap protection enabled.
4689 if(!(psessionEntry->gLimOlbcParams.protectionEnabled ||
4690 psessionEntry->gLimOverlap11gParams.protectionEnabled ||
4691 psessionEntry->gLimOverlapHt20Params.protectionEnabled ||
4692 psessionEntry->gLimOverlapNonGfParams.protectionEnabled))
4693 {
4694
4695 //Check if there is a need to change HT OP mode.
4696 if(eSIR_HT_OP_MODE_OVERLAP_LEGACY == psessionEntry->htOperMode)
4697 {
4698 if(psessionEntry->gLimHt20Params.protectionEnabled)
4699 {
4700 //Commented beacuse of CR 258588 for WFA Cert
4701 //psessionEntry->htOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4702 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
4703 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4704 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4705 }
4706 else
4707 {
4708 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
4709 }
4710 }
4711 }
4712 }
4713 else
4714 {
4715 //Disable protection from 11G stations.
4716 psessionEntry->gLimHt20Params.protectionEnabled = false;
4717
4718 //Change HT op mode appropriately.
4719 if(eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT == psessionEntry->htOperMode)
4720 {
4721 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
4722 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4723 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4724 }
4725 }
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004726 PELOG1(limLog(pMac, LOG1, FL("===> Protection from HT 20 Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004727 pBeaconParams->ht20MhzCoexist = psessionEntry->beaconParams.ht20Coexist = false;
4728 pBeaconParams->paramChangeBitmap |= PARAM_HT20MHZCOEXIST_CHANGED;
4729 }else if(eLIM_BT_AMP_AP_ROLE == psessionEntry->limSystemRole)
Jeff Johnson295189b2012-06-20 16:38:30 -07004730 {
4731 if(overlap)
4732 {
4733 //Overlap Legacy protection disabled.
4734 pMac->lim.gLimOverlapHt20Params.protectionEnabled = false;
4735
4736 // no HT op mode change if any of the overlap protection enabled.
4737 if(!(psessionEntry->gLimOlbcParams.protectionEnabled ||
4738 pMac->lim.gLimOverlap11gParams.protectionEnabled ||
4739 pMac->lim.gLimOverlapHt20Params.protectionEnabled ||
4740 pMac->lim.gLimOverlapNonGfParams.protectionEnabled))
4741 {
4742
4743 //Check if there is a need to change HT OP mode.
4744 if(eSIR_HT_OP_MODE_OVERLAP_LEGACY == pMac->lim.gHTOperMode)
4745 {
4746 if(psessionEntry->gLimHt20Params.protectionEnabled)
4747 {
4748 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4749 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4750 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4751 }
4752 else
4753 {
4754 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_PURE;
4755 }
4756 }
4757 }
4758 }
4759 else
4760 {
4761 //Disable protection from 11G stations.
4762 psessionEntry->gLimHt20Params.protectionEnabled = false;
4763
4764 //Change HT op mode appropriately.
4765 if(eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT == pMac->lim.gHTOperMode)
4766 {
4767 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_PURE;
4768 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4769 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4770 }
4771 }
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004772 PELOG1(limLog(pMac, LOG1, FL("===> Protection from HT 20 Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004773 pBeaconParams->ht20MhzCoexist = psessionEntry->beaconParams.ht20Coexist = false;
4774 pBeaconParams->paramChangeBitmap |= PARAM_HT20MHZCOEXIST_CHANGED;
4775 }
4776 //for station role
4777 else
4778 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004779 PELOG1(limLog(pMac, LOG1, FL("===> Protection from HT20 Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004780 pBeaconParams->ht20MhzCoexist = psessionEntry->beaconParams.ht20Coexist = false;
4781 pBeaconParams->paramChangeBitmap |= PARAM_HT20MHZCOEXIST_CHANGED;
4782 }
4783 }
4784
4785 return eSIR_SUCCESS;
4786}
4787
4788/** -------------------------------------------------------------
4789\fn limEnableHTNonGfProtection
4790\brief based on cofig enables\disables protection from NonGf.
4791\param tANI_U8 enable : 1=> enable protection, 0=> disable protection.
4792\param tANI_U8 overlap: 1=> called from overlap context, 0 => called from assoc context.
4793\param tpUpdateBeaconParams pBeaconParams
4794\return None
4795 -------------------------------------------------------------*/
4796tSirRetStatus
4797limEnableHTNonGfProtection(tpAniSirGlobal pMac, tANI_U8 enable,
4798 tANI_U8 overlap, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry)
4799{
Jeff Johnsone7245742012-09-05 17:12:55 -07004800 if(!psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07004801 return eSIR_SUCCESS; // this protection is only for HT stations.
4802
4803 //overlapping protection configuration check.
4804 if(overlap)
4805 {
Jeff Johnson295189b2012-06-20 16:38:30 -07004806 }
4807 else
4808 {
Jeff Johnson295189b2012-06-20 16:38:30 -07004809 //normal protection config check
4810 if((psessionEntry->limSystemRole == eLIM_AP_ROLE ) &&
4811 !psessionEntry->cfgProtection.nonGf)
4812 {
4813 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004814 PELOG3(limLog(pMac, LOG3, FL("protection from NonGf is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004815 return eSIR_SUCCESS;
4816 }else if(psessionEntry->limSystemRole != eLIM_AP_ROLE)
Jeff Johnson295189b2012-06-20 16:38:30 -07004817 {
4818 //normal protection config check
4819 if(!pMac->lim.cfgProtection.nonGf)
4820 {
4821 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004822 PELOG3(limLog(pMac, LOG3, FL("protection from NonGf is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004823 return eSIR_SUCCESS;
4824 }
4825 }
4826 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004827 if(psessionEntry->limSystemRole == eLIM_AP_ROLE){
4828 if ((enable) && (false == psessionEntry->beaconParams.llnNonGFCoexist))
4829 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004830 PELOG1(limLog(pMac, LOG1, FL(" => Prtection from non GF Enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004831 pBeaconParams->llnNonGFCoexist = psessionEntry->beaconParams.llnNonGFCoexist = true;
4832 pBeaconParams->paramChangeBitmap |= PARAM_NON_GF_DEVICES_PRESENT_CHANGED;
4833 }
4834 else if (!enable && (true == psessionEntry->beaconParams.llnNonGFCoexist))
4835 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004836 PELOG1(limLog(pMac, LOG1, FL("===> Protection from Non GF Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004837 pBeaconParams->llnNonGFCoexist = psessionEntry->beaconParams.llnNonGFCoexist = false;
4838 pBeaconParams->paramChangeBitmap |= PARAM_NON_GF_DEVICES_PRESENT_CHANGED;
4839 }
4840 }else
Jeff Johnson295189b2012-06-20 16:38:30 -07004841 {
4842 if ((enable) && (false == psessionEntry->beaconParams.llnNonGFCoexist))
4843 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004844 PELOG1(limLog(pMac, LOG1, FL(" => Prtection from non GF Enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004845 pBeaconParams->llnNonGFCoexist = psessionEntry->beaconParams.llnNonGFCoexist = true;
4846 pBeaconParams->paramChangeBitmap |= PARAM_NON_GF_DEVICES_PRESENT_CHANGED;
4847 }
4848 else if (!enable && (true == psessionEntry->beaconParams.llnNonGFCoexist))
4849 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004850 PELOG1(limLog(pMac, LOG1, FL("===> Protection from Non GF Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004851 pBeaconParams->llnNonGFCoexist = psessionEntry->beaconParams.llnNonGFCoexist = false;
4852 pBeaconParams->paramChangeBitmap |= PARAM_NON_GF_DEVICES_PRESENT_CHANGED;
4853 }
4854 }
4855
4856 return eSIR_SUCCESS;
4857}
4858
4859/** -------------------------------------------------------------
4860\fn limEnableHTLsigTxopProtection
4861\brief based on cofig enables\disables LsigTxop protection.
4862\param tANI_U8 enable : 1=> enable protection, 0=> disable protection.
4863\param tANI_U8 overlap: 1=> called from overlap context, 0 => called from assoc context.
4864\param tpUpdateBeaconParams pBeaconParams
4865\return None
4866 -------------------------------------------------------------*/
4867tSirRetStatus
4868limEnableHTLsigTxopProtection(tpAniSirGlobal pMac, tANI_U8 enable,
4869 tANI_U8 overlap, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry)
4870{
Jeff Johnsone7245742012-09-05 17:12:55 -07004871 if(!psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07004872 return eSIR_SUCCESS; // this protection is only for HT stations.
4873
4874 //overlapping protection configuration check.
4875 if(overlap)
4876 {
Jeff Johnson295189b2012-06-20 16:38:30 -07004877 }
4878 else
4879 {
Jeff Johnson295189b2012-06-20 16:38:30 -07004880 //normal protection config check
4881 if((psessionEntry->limSystemRole == eLIM_AP_ROLE ) &&
4882 !psessionEntry->cfgProtection.lsigTxop)
4883 {
4884 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004885 PELOG3(limLog(pMac, LOG3, FL(" protection from LsigTxop not supported is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004886 return eSIR_SUCCESS;
4887 }else if(psessionEntry->limSystemRole != eLIM_AP_ROLE)
Jeff Johnson295189b2012-06-20 16:38:30 -07004888 {
4889 //normal protection config check
4890 if(!pMac->lim.cfgProtection.lsigTxop)
4891 {
4892 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004893 PELOG3(limLog(pMac, LOG3, FL(" protection from LsigTxop not supported is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004894 return eSIR_SUCCESS;
4895 }
4896 }
4897 }
4898
4899
Jeff Johnson295189b2012-06-20 16:38:30 -07004900 if(psessionEntry->limSystemRole == eLIM_AP_ROLE){
4901 if ((enable) && (false == psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport))
4902 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004903 PELOG1(limLog(pMac, LOG1, FL(" => Prtection from LsigTxop Enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004904 pBeaconParams->fLsigTXOPProtectionFullSupport = psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport = true;
4905 pBeaconParams->paramChangeBitmap |= PARAM_LSIG_TXOP_FULL_SUPPORT_CHANGED;
4906 }
4907 else if (!enable && (true == psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport))
4908 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004909 PELOG1(limLog(pMac, LOG1, FL("===> Protection from LsigTxop Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004910 pBeaconParams->fLsigTXOPProtectionFullSupport= psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport = false;
4911 pBeaconParams->paramChangeBitmap |= PARAM_LSIG_TXOP_FULL_SUPPORT_CHANGED;
4912 }
4913 }else
Jeff Johnson295189b2012-06-20 16:38:30 -07004914 {
4915 if ((enable) && (false == psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport))
4916 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004917 PELOG1(limLog(pMac, LOG1, FL(" => Prtection from LsigTxop Enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004918 pBeaconParams->fLsigTXOPProtectionFullSupport = psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport = true;
4919 pBeaconParams->paramChangeBitmap |= PARAM_LSIG_TXOP_FULL_SUPPORT_CHANGED;
4920 }
4921 else if (!enable && (true == psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport))
4922 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004923 PELOG1(limLog(pMac, LOG1, FL("===> Protection from LsigTxop Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004924 pBeaconParams->fLsigTXOPProtectionFullSupport= psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport = false;
4925 pBeaconParams->paramChangeBitmap |= PARAM_LSIG_TXOP_FULL_SUPPORT_CHANGED;
4926 }
4927 }
4928 return eSIR_SUCCESS;
4929}
4930//FIXME_PROTECTION : need to check for no APSD whenever we want to enable this protection.
4931//This check will be done at the caller.
4932/** -------------------------------------------------------------
4933\fn limEnableHtRifsProtection
4934\brief based on cofig enables\disables Rifs protection.
4935\param tANI_U8 enable : 1=> enable protection, 0=> disable protection.
4936\param tANI_U8 overlap: 1=> called from overlap context, 0 => called from assoc context.
4937\param tpUpdateBeaconParams pBeaconParams
4938\return None
4939 -------------------------------------------------------------*/
4940tSirRetStatus
4941limEnableHtRifsProtection(tpAniSirGlobal pMac, tANI_U8 enable,
4942 tANI_U8 overlap, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry)
4943{
Jeff Johnsone7245742012-09-05 17:12:55 -07004944 if(!psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07004945 return eSIR_SUCCESS; // this protection is only for HT stations.
4946
4947
4948 //overlapping protection configuration check.
4949 if(overlap)
4950 {
Jeff Johnson295189b2012-06-20 16:38:30 -07004951 }
4952 else
4953 {
Jeff Johnson295189b2012-06-20 16:38:30 -07004954 //normal protection config check
4955 if((psessionEntry->limSystemRole == eLIM_AP_ROLE) &&
4956 !psessionEntry->cfgProtection.rifs)
4957 {
4958 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004959 PELOG3(limLog(pMac, LOG3, FL(" protection from Rifs is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004960 return eSIR_SUCCESS;
4961 }else if(psessionEntry->limSystemRole != eLIM_AP_ROLE )
Jeff Johnson295189b2012-06-20 16:38:30 -07004962 {
4963 //normal protection config check
4964 if(!pMac->lim.cfgProtection.rifs)
4965 {
4966 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004967 PELOG3(limLog(pMac, LOG3, FL(" protection from Rifs is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004968 return eSIR_SUCCESS;
4969 }
4970 }
4971 }
4972
Jeff Johnson295189b2012-06-20 16:38:30 -07004973 if(psessionEntry->limSystemRole == eLIM_AP_ROLE){
4974 // Disabling the RIFS Protection means Enable the RIFS mode of operation in the BSS
4975 if ((!enable) && (false == psessionEntry->beaconParams.fRIFSMode))
4976 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004977 PELOG1(limLog(pMac, LOG1, FL(" => Rifs protection Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004978 pBeaconParams->fRIFSMode = psessionEntry->beaconParams.fRIFSMode = true;
4979 pBeaconParams->paramChangeBitmap |= PARAM_RIFS_MODE_CHANGED;
4980 }
4981 // Enabling the RIFS Protection means Disable the RIFS mode of operation in the BSS
4982 else if (enable && (true == psessionEntry->beaconParams.fRIFSMode))
4983 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004984 PELOG1(limLog(pMac, LOG1, FL("===> Rifs Protection Enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004985 pBeaconParams->fRIFSMode = psessionEntry->beaconParams.fRIFSMode = false;
4986 pBeaconParams->paramChangeBitmap |= PARAM_RIFS_MODE_CHANGED;
4987 }
4988 }else
Jeff Johnson295189b2012-06-20 16:38:30 -07004989 {
4990 // Disabling the RIFS Protection means Enable the RIFS mode of operation in the BSS
4991 if ((!enable) && (false == psessionEntry->beaconParams.fRIFSMode))
4992 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004993 PELOG1(limLog(pMac, LOG1, FL(" => Rifs protection Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004994 pBeaconParams->fRIFSMode = psessionEntry->beaconParams.fRIFSMode = true;
4995 pBeaconParams->paramChangeBitmap |= PARAM_RIFS_MODE_CHANGED;
4996 }
4997 // Enabling the RIFS Protection means Disable the RIFS mode of operation in the BSS
4998 else if (enable && (true == psessionEntry->beaconParams.fRIFSMode))
4999 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005000 PELOG1(limLog(pMac, LOG1, FL("===> Rifs Protection Enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005001 pBeaconParams->fRIFSMode = psessionEntry->beaconParams.fRIFSMode = false;
5002 pBeaconParams->paramChangeBitmap |= PARAM_RIFS_MODE_CHANGED;
5003 }
5004 }
5005 return eSIR_SUCCESS;
5006}
5007
5008// ---------------------------------------------------------------------
5009/**
5010 * limEnableShortPreamble
5011 *
5012 * FUNCTION:
5013 * Enable/Disable short preamble
5014 *
5015 * LOGIC:
5016 *
5017 * ASSUMPTIONS:
5018 *
5019 * NOTE:
5020 *
5021 * @param enable Flag to enable/disable short preamble
5022 * @return None
5023 */
5024
5025tSirRetStatus
5026limEnableShortPreamble(tpAniSirGlobal pMac, tANI_U8 enable, tpUpdateBeaconParams pBeaconParams, tpPESession psessionEntry)
5027{
5028 tANI_U32 val;
5029
5030 if (wlan_cfgGetInt(pMac, WNI_CFG_SHORT_PREAMBLE, &val) != eSIR_SUCCESS)
5031 {
5032 /* Could not get short preamble enabled flag from CFG. Log error. */
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005033 limLog(pMac, LOGP, FL("could not retrieve short preamble flag"));
Jeff Johnson295189b2012-06-20 16:38:30 -07005034 return eSIR_FAILURE;
5035 }
5036
5037 if (!val)
5038 return eSIR_SUCCESS;
5039
5040 if (wlan_cfgGetInt(pMac, WNI_CFG_11G_SHORT_PREAMBLE_ENABLED, &val) != eSIR_SUCCESS)
5041 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005042 limLog(pMac, LOGP, FL("could not retrieve 11G short preamble switching enabled flag"));
Jeff Johnson295189b2012-06-20 16:38:30 -07005043 return eSIR_FAILURE;
5044 }
5045
5046 if (!val) // 11G short preamble switching is disabled.
5047 return eSIR_SUCCESS;
5048
5049 if ( psessionEntry->limSystemRole == eLIM_AP_ROLE )
5050 {
5051 if (enable && (psessionEntry->beaconParams.fShortPreamble == 0))
5052 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005053 PELOG1(limLog(pMac, LOG1, FL("===> Short Preamble Enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005054 psessionEntry->beaconParams.fShortPreamble = true;
5055 pBeaconParams->fShortPreamble = (tANI_U8) psessionEntry->beaconParams.fShortPreamble;
5056 pBeaconParams->paramChangeBitmap |= PARAM_SHORT_PREAMBLE_CHANGED;
5057 }
5058 else if (!enable && (psessionEntry->beaconParams.fShortPreamble == 1))
5059 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005060 PELOG1(limLog(pMac, LOG1, FL("===> Short Preamble Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005061 psessionEntry->beaconParams.fShortPreamble = false;
5062 pBeaconParams->fShortPreamble = (tANI_U8) psessionEntry->beaconParams.fShortPreamble;
5063 pBeaconParams->paramChangeBitmap |= PARAM_SHORT_PREAMBLE_CHANGED;
5064 }
5065 }
5066
5067 return eSIR_SUCCESS;
5068 }
5069
5070/**
5071 * limTxComplete
5072 *
5073 * Function:
5074 * This is LIM's very own "TX MGMT frame complete" completion routine.
5075 *
5076 * Logic:
5077 * LIM wants to send a MGMT frame (broadcast or unicast)
5078 * LIM allocates memory using palPktAlloc( ..., **pData, **pPacket )
5079 * LIM transmits the MGMT frame using the API:
5080 * halTxFrame( ... pPacket, ..., (void *) limTxComplete, pData )
5081 * HDD, via halTxFrame/DXE, "transfers" the packet over to BMU
5082 * HDD, if it determines that a TX completion routine (in this case
5083 * limTxComplete) has been provided, will invoke this callback
5084 * LIM will try to free the TX MGMT packet that was earlier allocated, in order
5085 * to send this MGMT frame, using the PAL API palPktFree( ... pData, pPacket )
5086 *
5087 * Assumptions:
5088 * Presently, this is ONLY being used for MGMT frames/packets
5089 * TODO:
5090 * Would it do good for LIM to have some sort of "signature" validation to
5091 * ensure that the pData argument passed in was a buffer that was actually
5092 * allocated by LIM and/or is not corrupted?
5093 *
5094 * Note: FIXME and TODO
5095 * Looks like palPktFree() is interested in pPacket. But, when this completion
5096 * routine is called, only pData is made available to LIM!!
5097 *
5098 * @param void A pointer to pData. Shouldn't it be pPacket?!
5099 *
5100 * @return none
5101 */
5102void limTxComplete( tHalHandle hHal, void *pData )
5103{
5104 tpAniSirGlobal pMac;
5105 pMac = (tpAniSirGlobal)hHal;
5106
5107#ifdef FIXME_PRIMA
5108 /* the trace logic needs to be fixed for Prima. Refer to CR 306075 */
5109#ifdef TRACE_RECORD
5110 {
5111 tpSirMacMgmtHdr mHdr;
5112 v_U8_t *pRxBd;
5113 vos_pkt_t *pVosPkt;
5114 VOS_STATUS vosStatus;
5115
5116
5117
5118 pVosPkt = (vos_pkt_t *)pData;
5119 vosStatus = vos_pkt_peek_data( pVosPkt, 0, (v_PVOID_t *)&pRxBd, WLANHAL_RX_BD_HEADER_SIZE);
5120
5121 if(VOS_IS_STATUS_SUCCESS(vosStatus))
5122 {
5123 mHdr = WDA_GET_RX_MAC_HEADER(pRxBd);
Jeff Johnson295189b2012-06-20 16:38:30 -07005124
5125 }
5126 }
5127#endif
5128#endif
5129
5130 palPktFree( pMac->hHdd,
5131 HAL_TXRX_FRM_802_11_MGMT,
5132 (void *) NULL, // this is ignored and will likely be removed from this API
5133 (void *) pData ); // lim passed in pPacket in the pData pointer that is given in this completion routine
5134}
5135
5136/**
5137 * \brief This function updates lim global structure, if CB parameters in the BSS
5138 * have changed, and sends an indication to HAL also with the
5139 * updated HT Parameters.
5140 * This function does not detect the change in the primary channel, that is done as part
5141 * of channel Swtich IE processing.
5142 * If STA is configured with '20Mhz only' mode, then this function does not do anything
5143 * This function changes the CB mode, only if the self capability is set to '20 as well as 40Mhz'
5144 *
5145 *
5146 * \param pMac Pointer to global MAC structure
5147 *
5148 * \param pRcvdHTInfo Pointer to HT Info IE obtained from a Beacon or
5149 * Probe Response
5150 *
5151 * \param bssIdx BSS Index of the Bss to which Station is associated.
5152 *
5153 *
5154 */
5155
5156void limUpdateStaRunTimeHTSwitchChnlParams( tpAniSirGlobal pMac,
5157 tDot11fIEHTInfo *pHTInfo,
5158 tANI_U8 bssIdx,
5159 tpPESession psessionEntry)
5160{
Jeff Johnsone7245742012-09-05 17:12:55 -07005161 ePhyChanBondState secondaryChnlOffset = PHY_SINGLE_CHANNEL_CENTERED;
Jeff Johnson295189b2012-06-20 16:38:30 -07005162#if !defined WLAN_FEATURE_VOWIFI
5163 tANI_U32 localPwrConstraint;
5164#endif
5165
5166 //If self capability is set to '20Mhz only', then do not change the CB mode.
Jeff Johnson295189b2012-06-20 16:38:30 -07005167 if( !limGetHTCapability( pMac, eHT_SUPPORTED_CHANNEL_WIDTH_SET, psessionEntry ))
Jeff Johnson295189b2012-06-20 16:38:30 -07005168 return;
5169
5170#if !defined WLAN_FEATURE_VOWIFI
5171 if(wlan_cfgGetInt(pMac, WNI_CFG_LOCAL_POWER_CONSTRAINT, &localPwrConstraint) != eSIR_SUCCESS) {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005172 limLog( pMac, LOGP, FL( "Unable to get Local Power Constraint from cfg" ));
Jeff Johnson295189b2012-06-20 16:38:30 -07005173 return;
5174 }
5175#endif
5176
Mihir Shete8fdc9f12014-08-22 11:25:04 +05305177 if (pMac->ft.ftPEContext.pFTPreAuthReq)
5178 {
5179 limLog( pMac, LOGE, FL( "FT PREAUTH channel change is in progress"));
5180 return;
5181 }
5182
Mihir Shetebc160b72014-08-22 14:10:39 +05305183 /*
5184 * Do not try to switch channel if RoC is in progress. RoC code path uses
5185 * pMac->lim.gpLimRemainOnChanReq to notify the upper layers that the device
5186 * has started listening on the channel requested as part of RoC, if we set
5187 * pMac->lim.gpLimRemainOnChanReq to NULL as we do below then the
5188 * upper layers will think that the channel change is not successful and the
5189 * RoC from the upper layer perspective will never end...
5190 */
5191 if (pMac->lim.gpLimRemainOnChanReq)
5192 {
5193 limLog( pMac, LOGE, FL( "RoC is in progress"));
5194 return;
5195 }
5196
Jeff Johnsone7245742012-09-05 17:12:55 -07005197 if ( psessionEntry->htSecondaryChannelOffset != ( tANI_U8 ) pHTInfo->secondaryChannelOffset ||
5198 psessionEntry->htRecommendedTxWidthSet != ( tANI_U8 ) pHTInfo->recommendedTxWidthSet )
Jeff Johnson295189b2012-06-20 16:38:30 -07005199 {
Jeff Johnsone7245742012-09-05 17:12:55 -07005200 psessionEntry->htSecondaryChannelOffset = ( ePhyChanBondState ) pHTInfo->secondaryChannelOffset;
5201 psessionEntry->htRecommendedTxWidthSet = ( tANI_U8 ) pHTInfo->recommendedTxWidthSet;
5202 if ( eHT_CHANNEL_WIDTH_40MHZ == psessionEntry->htRecommendedTxWidthSet )
5203 secondaryChnlOffset = (ePhyChanBondState)pHTInfo->secondaryChannelOffset;
Jeff Johnson295189b2012-06-20 16:38:30 -07005204
5205 // Notify HAL
5206 limLog( pMac, LOGW, FL( "Channel Information in HT IE change"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005207 "d; sending notification to HAL." ) );
Jeff Johnson295189b2012-06-20 16:38:30 -07005208 limLog( pMac, LOGW, FL( "Primary Channel: %d, Secondary Chan"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005209 "nel Offset: %d, Channel Width: %d" ),
Jeff Johnson295189b2012-06-20 16:38:30 -07005210 pHTInfo->primaryChannel, secondaryChnlOffset,
Jeff Johnsone7245742012-09-05 17:12:55 -07005211 psessionEntry->htRecommendedTxWidthSet );
Madan Mohan Koyyalamudifd322a02012-10-05 12:01:26 -07005212 psessionEntry->channelChangeReasonCode=LIM_SWITCH_CHANNEL_OPERATION;
5213 pMac->lim.gpchangeChannelCallback = NULL;
5214 pMac->lim.gpchangeChannelData = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07005215
5216#if defined WLAN_FEATURE_VOWIFI
5217 limSendSwitchChnlParams( pMac, ( tANI_U8 ) pHTInfo->primaryChannel,
5218 secondaryChnlOffset, psessionEntry->maxTxPower, psessionEntry->peSessionId);
5219#else
5220 limSendSwitchChnlParams( pMac, ( tANI_U8 ) pHTInfo->primaryChannel,
5221 secondaryChnlOffset, (tPowerdBm)localPwrConstraint, psessionEntry->peSessionId);
5222#endif
5223
5224 //In case of IBSS, if STA should update HT Info IE in its beacons.
5225 if (eLIM_STA_IN_IBSS_ROLE == psessionEntry->limSystemRole)
5226 {
5227 schSetFixedBeaconFields(pMac,psessionEntry);
5228 }
5229
5230 }
5231} // End limUpdateStaRunTimeHTParams.
5232
5233/**
5234 * \brief This function updates the lim global structure, if any of the
5235 * HT Capabilities have changed.
5236 *
5237 *
5238 * \param pMac Pointer to Global MAC structure
5239 *
5240 * \param pHTCapability Pointer to HT Capability Information Element
5241 * obtained from a Beacon or Probe Response
5242 *
5243 *
5244 *
5245 */
5246
5247void limUpdateStaRunTimeHTCapability( tpAniSirGlobal pMac,
5248 tDot11fIEHTCaps *pHTCaps )
5249{
5250
5251 if ( pMac->lim.gHTLsigTXOPProtection != ( tANI_U8 ) pHTCaps->lsigTXOPProtection )
5252 {
5253 pMac->lim.gHTLsigTXOPProtection = ( tANI_U8 ) pHTCaps->lsigTXOPProtection;
5254 // Send change notification to HAL
5255 }
5256
5257 if ( pMac->lim.gHTAMpduDensity != ( tANI_U8 ) pHTCaps->mpduDensity )
5258 {
5259 pMac->lim.gHTAMpduDensity = ( tANI_U8 ) pHTCaps->mpduDensity;
5260 // Send change notification to HAL
5261 }
5262
5263 if ( pMac->lim.gHTMaxRxAMpduFactor != ( tANI_U8 ) pHTCaps->maxRxAMPDUFactor )
5264 {
5265 pMac->lim.gHTMaxRxAMpduFactor = ( tANI_U8 ) pHTCaps->maxRxAMPDUFactor;
5266 // Send change notification to HAL
5267 }
5268
5269
5270} // End limUpdateStaRunTimeHTCapability.
5271
5272/**
5273 * \brief This function updates lim global structure, if any of the HT
5274 * Info Parameters have changed.
5275 *
5276 *
5277 * \param pMac Pointer to the global MAC structure
5278 *
5279 * \param pHTInfo Pointer to the HT Info IE obtained from a Beacon or
5280 * Probe Response
5281 *
5282 *
5283 */
5284
5285void limUpdateStaRunTimeHTInfo( tpAniSirGlobal pMac,
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305286 tDot11fIEHTInfo *pHTInfo, tpPESession psessionEntry)
Jeff Johnson295189b2012-06-20 16:38:30 -07005287{
Jeff Johnsone7245742012-09-05 17:12:55 -07005288 if ( psessionEntry->htRecommendedTxWidthSet != ( tANI_U8 )pHTInfo->recommendedTxWidthSet )
Jeff Johnson295189b2012-06-20 16:38:30 -07005289 {
Jeff Johnsone7245742012-09-05 17:12:55 -07005290 psessionEntry->htRecommendedTxWidthSet = ( tANI_U8 )pHTInfo->recommendedTxWidthSet;
Jeff Johnson295189b2012-06-20 16:38:30 -07005291 // Send change notification to HAL
5292 }
5293
5294 if ( psessionEntry->beaconParams.fRIFSMode != ( tANI_U8 )pHTInfo->rifsMode )
5295 {
5296 psessionEntry->beaconParams.fRIFSMode = ( tANI_U8 )pHTInfo->rifsMode;
5297 // Send change notification to HAL
5298 }
5299
5300 if ( pMac->lim.gHTServiceIntervalGranularity != ( tANI_U8 )pHTInfo->serviceIntervalGranularity )
5301 {
5302 pMac->lim.gHTServiceIntervalGranularity = ( tANI_U8 )pHTInfo->serviceIntervalGranularity;
5303 // Send change notification to HAL
5304 }
5305
5306 if ( pMac->lim.gHTOperMode != ( tSirMacHTOperatingMode )pHTInfo->opMode )
5307 {
5308 pMac->lim.gHTOperMode = ( tSirMacHTOperatingMode )pHTInfo->opMode;
5309 // Send change notification to HAL
5310 }
5311
5312 if ( psessionEntry->beaconParams.llnNonGFCoexist != pHTInfo->nonGFDevicesPresent )
5313 {
5314 psessionEntry->beaconParams.llnNonGFCoexist = ( tANI_U8 )pHTInfo->nonGFDevicesPresent;
5315 }
5316
5317 if ( pMac->lim.gHTSTBCBasicMCS != ( tANI_U8 )pHTInfo->basicSTBCMCS )
5318 {
5319 pMac->lim.gHTSTBCBasicMCS = ( tANI_U8 )pHTInfo->basicSTBCMCS;
5320 // Send change notification to HAL
5321 }
5322
5323 if ( pMac->lim.gHTDualCTSProtection != ( tANI_U8 )pHTInfo->dualCTSProtection )
5324 {
5325 pMac->lim.gHTDualCTSProtection = ( tANI_U8 )pHTInfo->dualCTSProtection;
5326 // Send change notification to HAL
5327 }
5328
5329 if ( pMac->lim.gHTSecondaryBeacon != ( tANI_U8 )pHTInfo->secondaryBeacon )
5330 {
5331 pMac->lim.gHTSecondaryBeacon = ( tANI_U8 )pHTInfo->secondaryBeacon;
5332 // Send change notification to HAL
5333 }
5334
5335 if ( psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport != ( tANI_U8 )pHTInfo->lsigTXOPProtectionFullSupport )
5336 {
5337 psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport = ( tANI_U8 )pHTInfo->lsigTXOPProtectionFullSupport;
5338 // Send change notification to HAL
5339 }
5340
5341 if ( pMac->lim.gHTPCOActive != ( tANI_U8 )pHTInfo->pcoActive )
5342 {
5343 pMac->lim.gHTPCOActive = ( tANI_U8 )pHTInfo->pcoActive;
5344 // Send change notification to HAL
5345 }
5346
5347 if ( pMac->lim.gHTPCOPhase != ( tANI_U8 )pHTInfo->pcoPhase )
5348 {
5349 pMac->lim.gHTPCOPhase = ( tANI_U8 )pHTInfo->pcoPhase;
5350 // Send change notification to HAL
5351 }
5352
5353} // End limUpdateStaRunTimeHTInfo.
5354
5355
5356/** -------------------------------------------------------------
5357\fn limProcessHalIndMessages
5358\brief callback function for HAL indication
5359\param tpAniSirGlobal pMac
5360\param tANI_U32 mesgId
5361\param void *mesgParam
5362\return tSirRetStatu - status
5363 -------------------------------------------------------------*/
5364
5365tSirRetStatus limProcessHalIndMessages(tpAniSirGlobal pMac, tANI_U32 msgId, void *msgParam )
5366{
5367 //its PE's responsibility to free msgparam when its done extracting the message parameters.
5368 tSirMsgQ msg;
5369
5370 switch(msgId)
5371 {
5372 case SIR_LIM_DEL_TS_IND:
5373 case SIR_LIM_ADD_BA_IND:
5374 case SIR_LIM_DEL_BA_ALL_IND:
5375 case SIR_LIM_DELETE_STA_CONTEXT_IND:
5376 case SIR_LIM_BEACON_GEN_IND:
Abhishek Singh66c16762014-08-14 19:13:19 +05305377 case SIR_LIM_DEL_BA_IND:
Jeff Johnson295189b2012-06-20 16:38:30 -07005378 msg.type = (tANI_U16) msgId;
5379 msg.bodyptr = msgParam;
5380 msg.bodyval = 0;
5381 break;
5382
5383 default:
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305384 vos_mem_free(msgParam);
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005385 limLog(pMac, LOGP, FL("invalid message id = %d received"), msgId);
Jeff Johnson295189b2012-06-20 16:38:30 -07005386 return eSIR_FAILURE;
5387 }
5388
5389 if (limPostMsgApi(pMac, &msg) != eSIR_SUCCESS)
5390 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305391 vos_mem_free(msgParam);
Jeff Johnson295189b2012-06-20 16:38:30 -07005392 limLog(pMac, LOGP, FL("limPostMsgApi failed for msgid = %d"), msg.type);
5393 return eSIR_FAILURE;
5394 }
5395 return eSIR_SUCCESS;
5396}
5397
5398/** -------------------------------------------------------------
5399\fn limValidateDeltsReq
5400\brief Validates DelTs req originated by SME or by HAL and also sends halMsg_DelTs to HAL
5401\param tpAniSirGlobal pMac
5402\param tpSirDeltsReq pDeltsReq
5403\param tSirMacAddr peerMacAddr
5404\return eSirRetStatus - status
5405 -------------------------------------------------------------*/
5406
5407tSirRetStatus
5408limValidateDeltsReq(tpAniSirGlobal pMac, tpSirDeltsReq pDeltsReq, tSirMacAddr peerMacAddr,tpPESession psessionEntry)
5409{
5410 tpDphHashNode pSta;
5411 tANI_U8 tsStatus;
5412 tSirMacTSInfo *tsinfo;
5413 tANI_U32 i;
5414 tANI_U8 tspecIdx;
5415 /* if sta
5416 * - verify assoc state
5417 * - del tspec locally
5418 * if ap,
5419 * - verify sta is in assoc state
5420 * - del sta tspec locally
5421 */
5422 if(pDeltsReq == NULL)
5423 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005424 PELOGE(limLog(pMac, LOGE, FL("Delete TS request pointer is NULL"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005425 return eSIR_FAILURE;
5426 }
5427
5428 if ((psessionEntry->limSystemRole == eLIM_STA_ROLE)||(psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE))
5429 {
5430 tANI_U32 val;
5431
5432 // station always talks to the AP
5433 pSta = dphGetHashEntry(pMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable);
5434
5435 val = sizeof(tSirMacAddr);
5436 #if 0
5437 if (wlan_cfgGetStr(pMac, WNI_CFG_BSSID, peerMacAddr, &val) != eSIR_SUCCESS)
5438 {
5439 /// Could not get BSSID from CFG. Log error.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005440 limLog(pMac, LOGP, FL("could not retrieve BSSID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07005441 return eSIR_FAILURE;
5442 }
5443 #endif// TO SUPPORT BT-AMP
5444 sirCopyMacAddr(peerMacAddr,psessionEntry->bssId);
5445
5446 }
5447 else
5448 {
5449 tANI_U16 assocId;
5450 tANI_U8 *macaddr = (tANI_U8 *) peerMacAddr;
5451
5452 assocId = pDeltsReq->aid;
5453 if (assocId != 0)
5454 pSta = dphGetHashEntry(pMac, assocId, &psessionEntry->dph.dphHashTable);
5455 else
5456 pSta = dphLookupHashEntry(pMac, pDeltsReq->macAddr, &assocId, &psessionEntry->dph.dphHashTable);
5457
5458 if (pSta != NULL)
5459 // TBD: check sta assoc state as well
5460 for (i =0; i < sizeof(tSirMacAddr); i++)
5461 macaddr[i] = pSta->staAddr[i];
5462 }
5463
5464 if (pSta == NULL)
5465 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005466 PELOGE(limLog(pMac, LOGE, "Cannot find station context for delts req");)
Jeff Johnson295189b2012-06-20 16:38:30 -07005467 return eSIR_FAILURE;
5468 }
5469
5470 if ((! pSta->valid) ||
5471 (pSta->mlmStaContext.mlmState != eLIM_MLM_LINK_ESTABLISHED_STATE))
5472 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005473 PELOGE(limLog(pMac, LOGE, "Invalid Sta (or state) for DelTsReq");)
Jeff Johnson295189b2012-06-20 16:38:30 -07005474 return eSIR_FAILURE;
5475 }
5476
5477 pDeltsReq->req.wsmTspecPresent = 0;
5478 pDeltsReq->req.wmeTspecPresent = 0;
5479 pDeltsReq->req.lleTspecPresent = 0;
5480
5481 if ((pSta->wsmEnabled) &&
5482 (pDeltsReq->req.tspec.tsinfo.traffic.accessPolicy != SIR_MAC_ACCESSPOLICY_EDCA))
5483 pDeltsReq->req.wsmTspecPresent = 1;
5484 else if (pSta->wmeEnabled)
5485 pDeltsReq->req.wmeTspecPresent = 1;
5486 else if (pSta->lleEnabled)
5487 pDeltsReq->req.lleTspecPresent = 1;
5488 else
5489 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005490 PELOGW(limLog(pMac, LOGW, FL("DELTS_REQ ignore - qos is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005491 return eSIR_FAILURE;
5492 }
5493
5494 tsinfo = pDeltsReq->req.wmeTspecPresent ? &pDeltsReq->req.tspec.tsinfo
5495 : &pDeltsReq->req.tsinfo;
Abhishek Singh3cbf6052014-12-15 16:46:42 +05305496 limLog(pMac, LOG1,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005497 FL("received DELTS_REQ message (wmeTspecPresent = %d, lleTspecPresent = %d, wsmTspecPresent = %d, tsid %d, up %d, direction = %d)"),
Jeff Johnson295189b2012-06-20 16:38:30 -07005498 pDeltsReq->req.wmeTspecPresent, pDeltsReq->req.lleTspecPresent, pDeltsReq->req.wsmTspecPresent,
Abhishek Singh3cbf6052014-12-15 16:46:42 +05305499 tsinfo->traffic.tsid, tsinfo->traffic.userPrio, tsinfo->traffic.direction);
Jeff Johnson295189b2012-06-20 16:38:30 -07005500
5501 // if no Access Control, ignore the request
Jeff Johnson295189b2012-06-20 16:38:30 -07005502
5503 if (limAdmitControlDeleteTS(pMac, pSta->assocId, tsinfo, &tsStatus, &tspecIdx)
5504 != eSIR_SUCCESS)
5505 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005506 PELOGE(limLog(pMac, LOGE, "ERROR DELTS request for sta assocId %d (tsid %d, up %d)",
Jeff Johnson295189b2012-06-20 16:38:30 -07005507 pSta->assocId, tsinfo->traffic.tsid, tsinfo->traffic.userPrio);)
5508 return eSIR_FAILURE;
5509 }
5510 else if ((tsinfo->traffic.accessPolicy == SIR_MAC_ACCESSPOLICY_HCCA) ||
5511 (tsinfo->traffic.accessPolicy == SIR_MAC_ACCESSPOLICY_BOTH))
5512 {
5513 //edca only now.
5514 }
5515 else
5516 {
5517 if((tsinfo->traffic.accessPolicy == SIR_MAC_ACCESSPOLICY_EDCA) &&
5518 psessionEntry->gLimEdcaParams[upToAc(tsinfo->traffic.userPrio)].aci.acm)
5519 {
5520 //send message to HAL to delete TS
Madan Mohan Koyyalamudic0a75a42013-10-07 04:20:49 +05305521 if(eSIR_SUCCESS != limSendHalMsgDelTs(pMac,
5522 pSta->staIndex,
5523 tspecIdx,
5524 pDeltsReq->req,
5525 psessionEntry->peSessionId,
5526 psessionEntry->bssId))
Jeff Johnson295189b2012-06-20 16:38:30 -07005527 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005528 limLog(pMac, LOGW, FL("DelTs with UP %d failed in limSendHalMsgDelTs - ignoring request"),
Jeff Johnson295189b2012-06-20 16:38:30 -07005529 tsinfo->traffic.userPrio);
5530 return eSIR_FAILURE;
5531 }
5532 }
5533 }
5534 return eSIR_SUCCESS;
5535}
5536
5537/** -------------------------------------------------------------
5538\fn limRegisterHalIndCallBack
5539\brief registers callback function to HAL for any indication.
5540\param tpAniSirGlobal pMac
5541\return none.
5542 -------------------------------------------------------------*/
5543void
5544limRegisterHalIndCallBack(tpAniSirGlobal pMac)
5545{
5546 tSirMsgQ msg;
5547 tpHalIndCB pHalCB;
5548
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305549 pHalCB = vos_mem_malloc(sizeof(tHalIndCB));
5550 if ( NULL == pHalCB )
Jeff Johnson295189b2012-06-20 16:38:30 -07005551 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305552 limLog(pMac, LOGP, FL("AllocateMemory() failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07005553 return;
5554 }
5555
5556 pHalCB->pHalIndCB = limProcessHalIndMessages;
5557
5558 msg.type = WDA_REGISTER_PE_CALLBACK;
5559 msg.bodyptr = pHalCB;
5560 msg.bodyval = 0;
5561
Jeff Johnsone7245742012-09-05 17:12:55 -07005562 MTRACE(macTraceMsgTx(pMac, NO_SESSION, msg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07005563 if(eSIR_SUCCESS != wdaPostCtrlMsg(pMac, &msg))
5564 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305565 vos_mem_free(pHalCB);
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005566 limLog(pMac, LOGP, FL("wdaPostCtrlMsg() failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07005567 }
5568
5569 return;
5570}
5571
5572
5573/** -------------------------------------------------------------
5574\fn limProcessAddBaInd
5575
5576\brief handles the BA activity check timeout indication coming from HAL.
5577 Validates the request, posts request for sending addBaReq message for every candidate in the list.
5578\param tpAniSirGlobal pMac
5579\param tSirMsgQ limMsg
5580\return None
5581-------------------------------------------------------------*/
5582void
5583limProcessAddBaInd(tpAniSirGlobal pMac, tpSirMsgQ limMsg)
5584{
5585 tANI_U8 i;
5586 tANI_U8 tid;
5587 tANI_U16 assocId;
5588 tpDphHashNode pSta;
5589 tpAddBaCandidate pBaCandidate;
5590 tANI_U32 baCandidateCnt;
5591 tpBaActivityInd pBaActivityInd;
5592 tpPESession psessionEntry;
5593 tANI_U8 sessionId;
Gopichand Nakkala681989c2013-03-06 22:27:48 -08005594#ifdef FEATURE_WLAN_TDLS
5595 boolean htCapable = FALSE;
5596#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07005597
5598
Gopichand Nakkala681989c2013-03-06 22:27:48 -08005599 if (limMsg->bodyptr == NULL)
Jeff Johnson295189b2012-06-20 16:38:30 -07005600 return;
5601
5602 pBaActivityInd = (tpBaActivityInd)limMsg->bodyptr;
5603 baCandidateCnt = pBaActivityInd->baCandidateCnt;
5604
Gopichand Nakkala681989c2013-03-06 22:27:48 -08005605 if ((psessionEntry = peFindSessionByBssid(pMac,pBaActivityInd->bssId,&sessionId))== NULL)
Jeff Johnson295189b2012-06-20 16:38:30 -07005606 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005607 limLog(pMac, LOGE,FL("session does not exist for given BSSId"));
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305608 vos_mem_free(limMsg->bodyptr);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08005609 limMsg->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07005610 return;
5611 }
5612
5613 //if we are not HT capable we don't need to handle BA timeout indication from HAL.
Gopichand Nakkala681989c2013-03-06 22:27:48 -08005614#ifdef FEATURE_WLAN_TDLS
5615 if ((baCandidateCnt > pMac->lim.maxStation))
5616#else
5617 if ((baCandidateCnt > pMac->lim.maxStation) || !psessionEntry->htCapability )
5618#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07005619 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305620 vos_mem_free(limMsg->bodyptr);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08005621 limMsg->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07005622 return;
5623 }
Gopichand Nakkala681989c2013-03-06 22:27:48 -08005624
5625#ifdef FEATURE_WLAN_TDLS
5626 //if we have TDLS peers, we should look at peers HT capability, which can be different than
5627 //AP capability
5628 pBaCandidate = (tpAddBaCandidate) (((tANI_U8*)pBaActivityInd) + sizeof(tBaActivityInd));
5629
5630 for (i=0; i<baCandidateCnt; i++, pBaCandidate++)
5631 {
5632 pSta = dphLookupHashEntry(pMac, pBaCandidate->staAddr, &assocId, &psessionEntry->dph.dphHashTable);
5633 if ((NULL == pSta) || (!pSta->valid))
5634 continue;
5635
5636 if (STA_ENTRY_TDLS_PEER == pSta->staType)
5637 htCapable = pSta->mlmStaContext.htCapability;
5638 else
5639 htCapable = psessionEntry->htCapability;
5640
5641 if (htCapable)
5642 break;
5643 }
5644 if (!htCapable)
5645 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305646 vos_mem_free(limMsg->bodyptr);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08005647 limMsg->bodyptr = NULL;
Gopichand Nakkala681989c2013-03-06 22:27:48 -08005648 return;
5649 }
5650#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07005651
5652 //delete the complete dialoguetoken linked list
5653 limDeleteDialogueTokenList(pMac);
5654 pBaCandidate = (tpAddBaCandidate) (((tANI_U8*)pBaActivityInd) + sizeof(tBaActivityInd));
5655
Gopichand Nakkala681989c2013-03-06 22:27:48 -08005656 for (i=0; i<baCandidateCnt; i++, pBaCandidate++)
Jeff Johnson295189b2012-06-20 16:38:30 -07005657 {
5658 pSta = dphLookupHashEntry(pMac, pBaCandidate->staAddr, &assocId, &psessionEntry->dph.dphHashTable);
Gopichand Nakkala681989c2013-03-06 22:27:48 -08005659 if ((NULL == pSta) || (!pSta->valid))
5660 continue;
Jeff Johnson295189b2012-06-20 16:38:30 -07005661
5662 for (tid=0; tid<STACFG_MAX_TC; tid++)
5663 {
Gopichand Nakkala681989c2013-03-06 22:27:48 -08005664 if((eBA_DISABLE == pSta->tcCfg[tid].fUseBATx) &&
Jeff Johnson295189b2012-06-20 16:38:30 -07005665 (pBaCandidate->baInfo[tid].fBaEnable))
5666 {
Hoonki Lee9af07cf2013-04-24 01:21:58 -07005667 limLog(pMac, LOGE, FL("BA setup for staId = %d, TID: %d, SSN: %d"),
5668 pSta->staIndex, tid, pBaCandidate->baInfo[tid].startingSeqNum);
Jeff Johnson295189b2012-06-20 16:38:30 -07005669 limPostMlmAddBAReq(pMac, pSta, tid, pBaCandidate->baInfo[tid].startingSeqNum,psessionEntry);
5670 }
5671 }
5672 }
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305673 vos_mem_free(limMsg->bodyptr);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08005674 limMsg->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07005675 return;
5676}
5677
5678
5679/** -------------------------------------------------------------
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005680\fn limDeleteBASessions
5681\brief Deletes all the exisitng BA sessions for given session
5682 and BA direction.
Jeff Johnson295189b2012-06-20 16:38:30 -07005683\param tpAniSirGlobal pMac
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005684\param tpPESession pSessionEntry
5685\param tANI_U32 baDirection
5686\return None
Jeff Johnson295189b2012-06-20 16:38:30 -07005687-------------------------------------------------------------*/
5688
5689void
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005690limDeleteBASessions(tpAniSirGlobal pMac, tpPESession pSessionEntry,
Ganesh Kondabattini01f75c92014-07-07 19:27:41 +05305691 tANI_U32 baDirection, tSirMacReasonCodes baReasonCode)
Jeff Johnson295189b2012-06-20 16:38:30 -07005692{
5693 tANI_U32 i;
5694 tANI_U8 tid;
5695 tpDphHashNode pSta;
5696
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005697 if (NULL == pSessionEntry)
Jeff Johnson295189b2012-06-20 16:38:30 -07005698 {
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005699 limLog(pMac, LOGE, FL("Session does not exist"));
5700 }
5701 else
5702 {
5703 for(tid = 0; tid < STACFG_MAX_TC; tid++)
Jeff Johnson295189b2012-06-20 16:38:30 -07005704 {
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005705 if ((eLIM_AP_ROLE == pSessionEntry->limSystemRole) ||
5706 (pSessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE) ||
5707 (eLIM_STA_IN_IBSS_ROLE == pSessionEntry->limSystemRole) ||
5708 (pSessionEntry->limSystemRole == eLIM_P2P_DEVICE_GO))
Jeff Johnson295189b2012-06-20 16:38:30 -07005709 {
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005710 for (i = 0; i < pMac->lim.maxStation; i++)
Jeff Johnson295189b2012-06-20 16:38:30 -07005711 {
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005712 pSta = pSessionEntry->dph.dphHashTable.pDphNodeArray + i;
5713 if (pSta && pSta->added)
Kiran Kumar Lokerec1641f52013-05-29 14:29:43 -07005714 {
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005715 if ((eBA_ENABLE == pSta->tcCfg[tid].fUseBATx) &&
5716 (baDirection & BA_INITIATOR))
5717 {
5718 limPostMlmDelBAReq(pMac, pSta, eBA_INITIATOR, tid,
Ganesh Kondabattini01f75c92014-07-07 19:27:41 +05305719 baReasonCode,
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005720 pSessionEntry);
5721 }
5722 if ((eBA_ENABLE == pSta->tcCfg[tid].fUseBARx) &&
5723 (baDirection & BA_RECIPIENT))
5724 {
5725 limPostMlmDelBAReq(pMac, pSta, eBA_RECIPIENT, tid,
Ganesh Kondabattini01f75c92014-07-07 19:27:41 +05305726 baReasonCode,
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005727 pSessionEntry);
5728 }
Kiran Kumar Lokerec1641f52013-05-29 14:29:43 -07005729 }
Jeff Johnson295189b2012-06-20 16:38:30 -07005730 }
5731 }
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005732 else if ((eLIM_STA_ROLE == pSessionEntry->limSystemRole) ||
5733 (eLIM_BT_AMP_STA_ROLE == pSessionEntry->limSystemRole) ||
5734 (eLIM_P2P_DEVICE_ROLE == pSessionEntry->limSystemRole))
Gopichand Nakkala6a36e142013-06-07 21:23:15 -07005735 {
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005736 pSta = dphGetHashEntry(pMac, DPH_STA_HASH_INDEX_PEER,
5737 &pSessionEntry->dph.dphHashTable);
5738 if (pSta && pSta->added)
Gopichand Nakkala6a36e142013-06-07 21:23:15 -07005739 {
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005740 if ((eBA_ENABLE == pSta->tcCfg[tid].fUseBATx) &&
5741 (baDirection & BA_INITIATOR))
5742 {
5743 limPostMlmDelBAReq(pMac, pSta, eBA_INITIATOR, tid,
Ganesh Kondabattini01f75c92014-07-07 19:27:41 +05305744 baReasonCode,
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005745 pSessionEntry);
5746 }
5747 if ((eBA_ENABLE == pSta->tcCfg[tid].fUseBARx) &&
5748 (baDirection & BA_RECIPIENT))
5749 {
5750 limPostMlmDelBAReq(pMac, pSta, eBA_RECIPIENT, tid,
Ganesh Kondabattini01f75c92014-07-07 19:27:41 +05305751 baReasonCode,
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005752 pSessionEntry);
5753 }
Gopichand Nakkala6a36e142013-06-07 21:23:15 -07005754 }
5755 }
5756 }
Jeff Johnson295189b2012-06-20 16:38:30 -07005757 }
5758}
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005759
5760/** -------------------------------------------------------------
5761\fn limDelAllBASessions
5762\brief Deletes all the exisitng BA sessions.
5763\param tpAniSirGlobal pMac
5764\return None
5765-------------------------------------------------------------*/
5766
5767void limDelAllBASessions(tpAniSirGlobal pMac)
5768{
5769 tANI_U32 i;
5770 tpPESession pSessionEntry;
5771
5772 for (i = 0; i < pMac->lim.maxBssId; i++)
5773 {
5774 pSessionEntry = peFindSessionBySessionId(pMac, i);
5775 if (pSessionEntry)
5776 {
Ganesh Kondabattini01f75c92014-07-07 19:27:41 +05305777 limDeleteBASessions(pMac, pSessionEntry, BA_BOTH_DIRECTIONS,
5778 eSIR_MAC_UNSPEC_FAILURE_REASON);
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005779 }
5780 }
5781}
5782
5783/** -------------------------------------------------------------
5784\fn limDelAllBASessionsBtc
5785\brief Deletes all the exisitng BA receipent sessions in 2.4GHz
5786 band.
5787\param tpAniSirGlobal pMac
5788\return None
5789-------------------------------------------------------------*/
5790
Leela Venkata Kiran Kumar Reddy Chiralab8dadc22013-11-05 12:34:32 -08005791void limDelPerBssBASessionsBtc(tpAniSirGlobal pMac)
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005792{
Leela Venkata Kiran Kumar Reddy Chiralab8dadc22013-11-05 12:34:32 -08005793 tANI_U8 sessionId;
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005794 tpPESession pSessionEntry;
Leela Venkata Kiran Kumar Reddy Chiralab8dadc22013-11-05 12:34:32 -08005795 pSessionEntry = peFindSessionByBssid(pMac,pMac->btc.btcBssfordisableaggr,
5796 &sessionId);
5797 if (pSessionEntry)
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005798 {
Leela Venkata Kiran Kumar Reddy Chiralab8dadc22013-11-05 12:34:32 -08005799 PELOGW(limLog(pMac, LOGW,
5800 "Deleting the BA for session %d as host got BTC event", sessionId);)
c_hpothu3ba2a512014-08-06 14:02:54 +05305801 limDeleteBASessions(pMac, pSessionEntry, BA_BOTH_DIRECTIONS,
Ganesh Kondabattini01f75c92014-07-07 19:27:41 +05305802 eSIR_MAC_PEER_TIMEDOUT_REASON);
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005803 }
5804}
5805
Jeff Johnson295189b2012-06-20 16:38:30 -07005806/** -------------------------------------------------------------
5807\fn limProcessDelTsInd
5808\brief handles the DeleteTS indication coming from HAL or generated by PE itself in some error cases.
5809 Validates the request, sends the DelTs action frame to the Peer and sends DelTs indicatoin to HDD.
5810\param tpAniSirGlobal pMac
5811\param tSirMsgQ limMsg
5812\return None
5813-------------------------------------------------------------*/
5814void
5815limProcessDelTsInd(tpAniSirGlobal pMac, tpSirMsgQ limMsg)
5816{
5817 tpDphHashNode pSta;
5818 tpDelTsParams pDelTsParam = (tpDelTsParams) (limMsg->bodyptr);
5819 tpSirDeltsReq pDelTsReq = NULL;
5820 tSirMacAddr peerMacAddr;
5821 tpSirDeltsReqInfo pDelTsReqInfo;
5822 tpLimTspecInfo pTspecInfo;
5823 tpPESession psessionEntry;
5824 tANI_U8 sessionId;
5825
5826if((psessionEntry = peFindSessionByBssid(pMac,pDelTsParam->bssId,&sessionId))== NULL)
5827 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005828 limLog(pMac, LOGE,FL("session does not exist for given BssId"));
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305829 vos_mem_free(limMsg->bodyptr);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08005830 limMsg->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07005831 return;
5832 }
5833
5834 pTspecInfo = &(pMac->lim.tspecInfo[pDelTsParam->tspecIdx]);
5835 if(pTspecInfo->inuse == false)
5836 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005837 PELOGE(limLog(pMac, LOGE, FL("tspec entry with index %d is not in use"), pDelTsParam->tspecIdx);)
Jeff Johnson295189b2012-06-20 16:38:30 -07005838 goto error1;
5839 }
5840
5841 pSta = dphGetHashEntry(pMac, pTspecInfo->assocId, &psessionEntry->dph.dphHashTable);
5842 if(pSta == NULL)
5843 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005844 limLog(pMac, LOGE, FL("Could not find entry in DPH table for assocId = %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07005845 pTspecInfo->assocId);
5846 goto error1;
5847 }
5848
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305849 pDelTsReq = vos_mem_malloc(sizeof(tSirDeltsReq));
5850 if ( NULL == pDelTsReq )
Jeff Johnson295189b2012-06-20 16:38:30 -07005851 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305852 PELOGE(limLog(pMac, LOGE, FL("AllocateMemory() failed"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005853 goto error1;
5854 }
5855
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305856 vos_mem_set( (tANI_U8 *)pDelTsReq, sizeof(tSirDeltsReq), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07005857
5858 if(pSta->wmeEnabled)
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305859 vos_mem_copy( &(pDelTsReq->req.tspec), &(pTspecInfo->tspec), sizeof(tSirMacTspecIE));
Jeff Johnson295189b2012-06-20 16:38:30 -07005860 else
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305861 vos_mem_copy( &(pDelTsReq->req.tsinfo), &(pTspecInfo->tspec.tsinfo), sizeof(tSirMacTSInfo));
Jeff Johnson295189b2012-06-20 16:38:30 -07005862
5863
5864 //validate the req
5865 if (eSIR_SUCCESS != limValidateDeltsReq(pMac, pDelTsReq, peerMacAddr,psessionEntry))
5866 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005867 PELOGE(limLog(pMac, LOGE, FL("limValidateDeltsReq failed"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005868 goto error2;
5869 }
Abhishek Singh3cbf6052014-12-15 16:46:42 +05305870 limLog(pMac, LOG1, "Sent DELTS request to station with "
5871 "assocId = %d MacAddr = "MAC_ADDRESS_STR,
5872 pDelTsReq->aid, MAC_ADDR_ARRAY(peerMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07005873
5874 limSendDeltsReqActionFrame(pMac, peerMacAddr, pDelTsReq->req.wmeTspecPresent, &pDelTsReq->req.tsinfo, &pDelTsReq->req.tspec,
5875 psessionEntry);
5876
5877 // prepare and send an sme indication to HDD
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305878 pDelTsReqInfo = vos_mem_malloc(sizeof(tSirDeltsReqInfo));
5879 if ( NULL == pDelTsReqInfo )
Jeff Johnson295189b2012-06-20 16:38:30 -07005880 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305881 PELOGE(limLog(pMac, LOGE, FL("AllocateMemory() failed"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005882 goto error3;
5883 }
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305884 vos_mem_set( (tANI_U8 *)pDelTsReqInfo, sizeof(tSirDeltsReqInfo), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07005885
5886 if(pSta->wmeEnabled)
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305887 vos_mem_copy( &(pDelTsReqInfo->tspec), &(pTspecInfo->tspec), sizeof(tSirMacTspecIE));
Jeff Johnson295189b2012-06-20 16:38:30 -07005888 else
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305889 vos_mem_copy( &(pDelTsReqInfo->tsinfo), &(pTspecInfo->tspec.tsinfo), sizeof(tSirMacTSInfo));
Jeff Johnson295189b2012-06-20 16:38:30 -07005890
5891 limSendSmeDeltsInd(pMac, pDelTsReqInfo, pDelTsReq->aid,psessionEntry);
5892
5893error3:
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305894 vos_mem_free(pDelTsReqInfo);
Jeff Johnson295189b2012-06-20 16:38:30 -07005895error2:
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305896 vos_mem_free(pDelTsReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07005897error1:
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305898 vos_mem_free(limMsg->bodyptr);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08005899 limMsg->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07005900 return;
5901}
5902
5903/**
5904 * \brief Setup an A-MPDU/BA session
5905 *
5906 * \sa limPostMlmAddBAReq
5907 *
5908 * \param pMac The global tpAniSirGlobal object
5909 *
5910 * \param pStaDs DPH Hash Node object of peer STA
5911 *
5912 * \param tid TID for which a BA is being setup.
5913 * If this is set to 0xFFFF, then we retrieve
5914 * the default TID from the CFG
5915 *
5916 * \return eSIR_SUCCESS if setup completes successfully
5917 * eSIR_FAILURE is some problem is encountered
5918 */
5919tSirRetStatus limPostMlmAddBAReq( tpAniSirGlobal pMac,
5920 tpDphHashNode pStaDs,
5921 tANI_U8 tid, tANI_U16 startingSeqNum,tpPESession psessionEntry)
5922{
5923 tSirRetStatus status = eSIR_SUCCESS;
Jeff Johnson09fb4cd2013-04-03 15:27:59 -07005924 tpLimMlmAddBAReq pMlmAddBAReq = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07005925 tpDialogueToken dialogueTokenNode;
5926 tANI_U32 val = 0;
Jeff Johnson09fb4cd2013-04-03 15:27:59 -07005927
Jeff Johnson295189b2012-06-20 16:38:30 -07005928 // Check if the peer is a 11n capable STA
5929 // FIXME - Need a 11n peer indication in DPH.
5930 // For now, using the taurusPeer attribute
5931 //if( 0 == pStaDs->taurusPeer == )
5932 //return eSIR_SUCCESS;
5933
5934 // Allocate for LIM_MLM_ADDBA_REQ
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305935 pMlmAddBAReq = vos_mem_malloc(sizeof( tLimMlmAddBAReq ));
5936 if ( NULL == pMlmAddBAReq )
Jeff Johnson295189b2012-06-20 16:38:30 -07005937 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305938 limLog( pMac, LOGP, FL("AllocateMemory failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07005939 status = eSIR_MEM_ALLOC_FAILED;
5940 goto returnFailure;
5941 }
5942
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305943 vos_mem_set( (void *) pMlmAddBAReq, sizeof( tLimMlmAddBAReq ), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07005944
5945 // Copy the peer MAC
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305946 vos_mem_copy(
Jeff Johnson295189b2012-06-20 16:38:30 -07005947 pMlmAddBAReq->peerMacAddr,
5948 pStaDs->staAddr,
5949 sizeof( tSirMacAddr ));
5950
5951 // Update the TID
5952 pMlmAddBAReq->baTID = tid;
5953
5954 // Determine the supported BA policy of local STA
5955 // for the TID of interest
5956 pMlmAddBAReq->baPolicy = (pStaDs->baPolicyFlag >> tid) & 0x1;
5957
5958 // BA Buffer Size
5959 // Requesting the ADDBA recipient to populate the size.
5960 // If ADDBA is accepted, a non-zero buffer size should
5961 // be returned in the ADDBA Rsp
Agarwal Ashish87039eb2014-01-15 14:13:15 +05305962 if ((TRUE == psessionEntry->isCiscoVendorAP) &&
5963 (eHT_CHANNEL_WIDTH_80MHZ != pStaDs->htSupportedChannelWidthSet))
5964 {
5965 /* Cisco AP has issues in receiving more than 25 "mpdu in ampdu"
5966 causing very low throughput in HT40 case */
5967 limLog( pMac, LOGW,
5968 FL( "Requesting ADDBA with Cisco 1225 AP, window size 25"));
5969 pMlmAddBAReq->baBufferSize = MAX_BA_WINDOW_SIZE_FOR_CISCO;
5970 }
5971 else
5972 pMlmAddBAReq->baBufferSize = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07005973
5974 limLog( pMac, LOGW,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005975 FL( "Requesting an ADDBA to setup a %s BA session with STA %d for TID %d" ),
Jeff Johnson295189b2012-06-20 16:38:30 -07005976 (pMlmAddBAReq->baPolicy ? "Immediate": "Delayed"),
5977 pStaDs->staIndex,
5978 tid );
5979
5980 // BA Timeout
Jeff Johnson09fb4cd2013-04-03 15:27:59 -07005981 if (wlan_cfgGetInt(pMac, WNI_CFG_BA_TIMEOUT, &val) != eSIR_SUCCESS)
Jeff Johnson295189b2012-06-20 16:38:30 -07005982 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005983 limLog(pMac, LOGE, FL("could not retrieve BA TIME OUT Param CFG"));
Jeff Johnson295189b2012-06-20 16:38:30 -07005984 status = eSIR_FAILURE;
5985 goto returnFailure;
5986 }
5987 pMlmAddBAReq->baTimeout = val; // In TU's
5988
5989 // ADDBA Failure Timeout
Jeff Johnson09fb4cd2013-04-03 15:27:59 -07005990 // FIXME_AMPDU - Need to retrieve this from CFG.
Jeff Johnson295189b2012-06-20 16:38:30 -07005991 //right now we are not checking for response timeout. so this field is dummy just to be compliant with the spec.
5992 pMlmAddBAReq->addBAFailureTimeout = 2000; // In TU's
5993
5994 // BA Starting Sequence Number
5995 pMlmAddBAReq->baSSN = startingSeqNum;
5996
5997 /* Update PE session Id*/
5998 pMlmAddBAReq->sessionId = psessionEntry->peSessionId;
5999
6000 LIM_SET_STA_BA_STATE(pStaDs, tid, eLIM_BA_STATE_WT_ADD_RSP);
6001
Jeff Johnson09fb4cd2013-04-03 15:27:59 -07006002 dialogueTokenNode = limAssignDialogueToken(pMac);
6003 if (NULL == dialogueTokenNode)
6004 {
6005 limLog(pMac, LOGE, FL("could not assign dialogue token"));
6006 status = eSIR_FAILURE;
6007 goto returnFailure;
6008 }
6009
Jeff Johnson295189b2012-06-20 16:38:30 -07006010 pMlmAddBAReq->baDialogToken = dialogueTokenNode->token;
Jeff Johnson09fb4cd2013-04-03 15:27:59 -07006011 //set assocId and tid information in the lim linked list
Jeff Johnson295189b2012-06-20 16:38:30 -07006012 dialogueTokenNode->assocId = pStaDs->assocId;
6013 dialogueTokenNode->tid = tid;
6014 // Send ADDBA Req to MLME
6015 limPostMlmMessage( pMac,
6016 LIM_MLM_ADDBA_REQ,
6017 (tANI_U32 *) pMlmAddBAReq );
Jeff Johnson09fb4cd2013-04-03 15:27:59 -07006018 return eSIR_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -07006019
6020returnFailure:
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306021 vos_mem_free(pMlmAddBAReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07006022 return status;
6023}
6024
6025/**
6026 * \brief Post LIM_MLM_ADDBA_RSP to MLME. MLME
6027 * will then send an ADDBA Rsp to peer MAC entity
6028 * with the appropriate ADDBA status code
6029 *
6030 * \sa limPostMlmAddBARsp
6031 *
6032 * \param pMac The global tpAniSirGlobal object
6033 *
6034 * \param peerMacAddr MAC address of peer entity that will
6035 * be the recipient of this ADDBA Rsp
6036 *
6037 * \param baStatusCode ADDBA Rsp status code
6038 *
6039 * \param baDialogToken ADDBA Rsp dialog token
6040 *
6041 * \param baTID TID of interest
6042 *
6043 * \param baPolicy The BA policy
6044 *
6045 * \param baBufferSize The BA buffer size
6046 *
6047 * \param baTimeout BA timeout in TU's
6048 *
6049 * \return eSIR_SUCCESS if setup completes successfully
6050 * eSIR_FAILURE is some problem is encountered
6051 */
6052tSirRetStatus limPostMlmAddBARsp( tpAniSirGlobal pMac,
6053 tSirMacAddr peerMacAddr,
6054 tSirMacStatusCodes baStatusCode,
6055 tANI_U8 baDialogToken,
6056 tANI_U8 baTID,
6057 tANI_U8 baPolicy,
6058 tANI_U16 baBufferSize,
6059 tANI_U16 baTimeout,
6060 tpPESession psessionEntry)
6061{
6062tSirRetStatus status = eSIR_SUCCESS;
6063tpLimMlmAddBARsp pMlmAddBARsp;
6064
6065 // Allocate for LIM_MLM_ADDBA_RSP
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306066 pMlmAddBARsp = vos_mem_malloc(sizeof( tLimMlmAddBARsp ));
6067 if ( NULL == pMlmAddBARsp )
Jeff Johnson295189b2012-06-20 16:38:30 -07006068 {
6069 limLog( pMac, LOGE,
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306070 FL("AllocateMemory failed with error code %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07006071 status );
6072
6073 status = eSIR_MEM_ALLOC_FAILED;
6074 goto returnFailure;
6075 }
6076
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306077 vos_mem_set( (void *) pMlmAddBARsp, sizeof( tLimMlmAddBARsp ), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07006078
6079 // Copy the peer MAC
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306080 vos_mem_copy(
Jeff Johnson295189b2012-06-20 16:38:30 -07006081 pMlmAddBARsp->peerMacAddr,
6082 peerMacAddr,
6083 sizeof( tSirMacAddr ));
6084
6085 pMlmAddBARsp->baDialogToken = baDialogToken;
6086 pMlmAddBARsp->addBAResultCode = baStatusCode;
6087 pMlmAddBARsp->baTID = baTID;
6088 pMlmAddBARsp->baPolicy = baPolicy;
6089 pMlmAddBARsp->baBufferSize = baBufferSize;
6090 pMlmAddBARsp->baTimeout = baTimeout;
6091
6092 /* UPdate PE session ID*/
6093 pMlmAddBARsp->sessionId = psessionEntry->peSessionId;
6094
6095 // Send ADDBA Rsp to MLME
6096 limPostMlmMessage( pMac,
6097 LIM_MLM_ADDBA_RSP,
6098 (tANI_U32 *) pMlmAddBARsp );
6099
6100returnFailure:
6101
6102 return status;
6103}
6104
6105/**
6106 * \brief Post LIM_MLM_DELBA_REQ to MLME. MLME
6107 * will then send an DELBA Ind to peer MAC entity
6108 * with the appropriate DELBA status code
6109 *
6110 * \sa limPostMlmDelBAReq
6111 *
6112 * \param pMac The global tpAniSirGlobal object
6113 *
6114 * \param pSta DPH Hash Node object of peer MAC entity
6115 * for which the BA session is being deleted
6116 *
6117 * \param baDirection DELBA direction
6118 *
6119 * \param baTID TID for which the BA session is being deleted
6120 *
6121 * \param baReasonCode DELBA Req reason code
6122 *
6123 * \return eSIR_SUCCESS if setup completes successfully
6124 * eSIR_FAILURE is some problem is encountered
6125 */
6126tSirRetStatus limPostMlmDelBAReq( tpAniSirGlobal pMac,
6127 tpDphHashNode pSta,
6128 tANI_U8 baDirection,
6129 tANI_U8 baTID,
6130 tSirMacReasonCodes baReasonCode,
6131 tpPESession psessionEntry)
6132{
6133tSirRetStatus status = eSIR_SUCCESS;
6134tpLimMlmDelBAReq pMlmDelBAReq;
6135tLimBAState curBaState;
6136
6137if(NULL == pSta)
6138 return eSIR_FAILURE;
6139
6140LIM_GET_STA_BA_STATE(pSta, baTID, &curBaState);
6141
6142 // Need to validate the current BA State.
6143 if( eLIM_BA_STATE_IDLE != curBaState)
6144 {
6145 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006146 FL( "Received unexpected DELBA REQ when STA BA state for tid = %d is %d" ),
Jeff Johnson295189b2012-06-20 16:38:30 -07006147 baTID,
6148 curBaState);
6149
6150 status = eSIR_FAILURE;
6151 goto returnFailure;
6152 }
6153
6154 // Allocate for LIM_MLM_DELBA_REQ
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306155 pMlmDelBAReq = vos_mem_malloc(sizeof( tLimMlmDelBAReq ));
6156 if ( NULL == pMlmDelBAReq )
Jeff Johnson295189b2012-06-20 16:38:30 -07006157 {
6158 limLog( pMac, LOGE,
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306159 FL("AllocateMemory failed with error code %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07006160 status );
6161
6162 status = eSIR_MEM_ALLOC_FAILED;
6163 goto returnFailure;
6164 }
6165
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306166 vos_mem_set( (void *) pMlmDelBAReq, sizeof( tLimMlmDelBAReq ), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07006167
6168 // Copy the peer MAC
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306169 vos_mem_copy(
Jeff Johnson295189b2012-06-20 16:38:30 -07006170 pMlmDelBAReq->peerMacAddr,
6171 pSta->staAddr,
6172 sizeof( tSirMacAddr ));
6173
6174 pMlmDelBAReq->baDirection = baDirection;
6175 pMlmDelBAReq->baTID = baTID;
6176 pMlmDelBAReq->delBAReasonCode = baReasonCode;
6177
6178 /* Update PE session ID*/
6179 pMlmDelBAReq->sessionId = psessionEntry->peSessionId;
6180
6181 //we don't have valid BA session for the given direction.
6182 // HDD wants to get the BA session deleted on PEER in this case.
6183 // in this case we just need to send DelBA to the peer.
6184 if(((eBA_RECIPIENT == baDirection) && (eBA_DISABLE == pSta->tcCfg[baTID].fUseBARx)) ||
6185 ((eBA_INITIATOR == baDirection) && (eBA_DISABLE == pSta->tcCfg[baTID].fUseBATx)))
6186 {
6187 // Send DELBA Ind over the air
6188 if( eSIR_SUCCESS !=
6189 (status = limSendDelBAInd( pMac, pMlmDelBAReq,psessionEntry)))
6190 status = eSIR_FAILURE;
6191
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306192 vos_mem_free(pMlmDelBAReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07006193 return status;
6194 }
6195
6196
6197 // Update the BA state in STA
6198 LIM_SET_STA_BA_STATE(pSta, pMlmDelBAReq->baTID, eLIM_BA_STATE_WT_DEL_RSP);
6199
6200 // Send DELBA Req to MLME
6201 limPostMlmMessage( pMac,
6202 LIM_MLM_DELBA_REQ,
6203 (tANI_U32 *) pMlmDelBAReq );
6204
6205returnFailure:
6206
6207 return status;
6208}
6209
6210/**
6211 * \brief Send WDA_ADDBA_REQ to HAL, in order
6212 * to setup a new BA session with a peer
6213 *
6214 * \sa limPostMsgAddBAReq
6215 *
6216 * \param pMac The global tpAniSirGlobal object
6217 *
6218 * \param pSta Runtime, STA-related configuration cached
6219 * in the HashNode object
6220 *
6221 * \param baDialogToken The Action Frame dialog token
6222 *
6223 * \param baTID TID for which the BA session is being setup
6224 *
6225 * \param baPolicy BA Policy
6226 *
6227 * \param baBufferSize The requested BA buffer size
6228 *
6229 * \param baTimeout BA Timeout. 0 indicates no BA timeout enforced
6230 *
6231 * \param baSSN Starting Sequence Number for this BA session
6232 *
6233 * \param baDirection BA Direction: 1 - Initiator, 0 - Recipient
6234 *
6235 * \return none
6236 *
6237 */
6238tSirRetStatus limPostMsgAddBAReq( tpAniSirGlobal pMac,
6239 tpDphHashNode pSta,
6240 tANI_U8 baDialogToken,
6241 tANI_U8 baTID,
6242 tANI_U8 baPolicy,
6243 tANI_U16 baBufferSize,
6244 tANI_U16 baTimeout,
6245 tANI_U16 baSSN,
6246 tANI_U8 baDirection,
6247 tpPESession psessionEntry)
6248{
6249tpAddBAParams pAddBAParams = NULL;
6250tSirRetStatus retCode = eSIR_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -07006251tSirMsgQ msgQ;
6252
6253#ifdef WLAN_SOFTAP_VSTA_FEATURE
6254 // we can only do BA on "hard" STAs
6255 if (!(IS_HWSTA_IDX(pSta->staIndex)))
6256 {
6257 retCode = eHAL_STATUS_FAILURE;
Masti, Narayanraddi04010dc2014-12-16 20:06:11 +05306258 limLog( pMac, LOGE,
6259 FL( "Sta Id is not HW Sta Id, return code is %d " ), retCode);
Jeff Johnson295189b2012-06-20 16:38:30 -07006260 goto returnFailure;
6261 }
6262#endif //WLAN_SOFTAP_VSTA_FEATURE
6263
6264 // Allocate for WDA_ADDBA_REQ
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306265 pAddBAParams = vos_mem_malloc(sizeof( tAddBAParams ));
6266 if ( NULL == pAddBAParams )
Jeff Johnson295189b2012-06-20 16:38:30 -07006267 {
6268 limLog( pMac, LOGE,
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306269 FL("AllocateMemory failed")
6270 );
Jeff Johnson295189b2012-06-20 16:38:30 -07006271
6272 retCode = eSIR_MEM_ALLOC_FAILED;
6273 goto returnFailure;
6274 }
6275
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306276 vos_mem_set( (void *) pAddBAParams, sizeof( tAddBAParams ), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07006277
6278 // Copy the peer MAC address
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306279 vos_mem_copy(
Jeff Johnson295189b2012-06-20 16:38:30 -07006280 (void *) pAddBAParams->peerMacAddr,
6281 (void *) pSta->staAddr,
6282 sizeof( tSirMacAddr ));
6283
6284 // Populate the REQ parameters
6285 pAddBAParams->staIdx = pSta->staIndex;
6286 pAddBAParams->baDialogToken = baDialogToken;
6287 pAddBAParams->baTID = baTID;
6288 pAddBAParams->baPolicy = baPolicy;
6289 pAddBAParams->baBufferSize = baBufferSize;
6290 pAddBAParams->baTimeout = baTimeout;
6291 pAddBAParams->baSSN = baSSN;
6292 pAddBAParams->baDirection = baDirection;
6293 pAddBAParams->respReqd = 1;
6294
6295 /* UPdate PE session ID */
6296 pAddBAParams->sessionId = psessionEntry->peSessionId;
6297
6298 // Post WDA_ADDBA_REQ to HAL.
6299 msgQ.type = WDA_ADDBA_REQ;
6300 //
6301 // FIXME_AMPDU
6302 // A global counter (dialog token) is required to keep track of
6303 // all PE <-> HAL communication(s)
6304 //
6305 msgQ.reserved = 0;
6306 msgQ.bodyptr = pAddBAParams;
6307 msgQ.bodyval = 0;
6308
6309 limLog( pMac, LOGW,
Kaushik, Sushant335328c2014-07-31 19:15:31 +05306310 FL( "Sending WDA_ADDBA_REQ... Buff size = %d , staId = %d , timeout = %d "
6311 "Tid = %d, Direction = %d , Policy = %d, sessionId = %d , baSSN = %d " ),
6312 pAddBAParams->baBufferSize, pAddBAParams->staIdx,
6313 pAddBAParams->baTimeout, pAddBAParams->baTID,
6314 pAddBAParams->baDirection, pAddBAParams->baPolicy,
6315 pAddBAParams->sessionId, pAddBAParams->baSSN);
Jeff Johnson295189b2012-06-20 16:38:30 -07006316
6317 //defer any other message until we get response back.
6318 SET_LIM_PROCESS_DEFD_MESGS(pMac, false);
6319
Jeff Johnsone7245742012-09-05 17:12:55 -07006320 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07006321#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
6322 limDiagEventReport(pMac, WLAN_PE_DIAG_HAL_ADDBA_REQ_EVENT, psessionEntry, 0, 0);
6323#endif //FEATURE_WLAN_DIAG_SUPPORT
6324
6325 if( eSIR_SUCCESS != (retCode = wdaPostCtrlMsg( pMac, &msgQ )))
6326 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006327 FL("Posting WDA_ADDBA_REQ to HAL failed! Reason = %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07006328 retCode );
6329 else
6330 return retCode;
6331
6332returnFailure:
6333
6334 // Clean-up...
6335 if( NULL != pAddBAParams )
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306336 vos_mem_free( pAddBAParams );
Jeff Johnson295189b2012-06-20 16:38:30 -07006337
6338 return retCode;
6339
6340}
6341
6342/**
6343 * \brief Send WDA_DELBA_IND to HAL, in order
6344 * to delete an existing BA session with peer
6345 *
6346 * \sa limPostMsgDelBAInd
6347 *
6348 * \param pMac The global tpAniSirGlobal object
6349 *
6350 * \param pSta Runtime, STA-related configuration cached
6351 * in the HashNode object
6352 *
6353 * \param baTID TID for which the BA session is being setup
6354 *
6355 * \param baDirection Identifies whether the DELBA Ind was
6356 * sent by the BA initiator or recipient
6357 *
6358 * \return none
6359 *
6360 */
6361tSirRetStatus limPostMsgDelBAInd( tpAniSirGlobal pMac,
6362 tpDphHashNode pSta,
6363 tANI_U8 baTID,
6364 tANI_U8 baDirection,
6365 tpPESession psessionEntry)
6366{
6367tpDelBAParams pDelBAParams = NULL;
6368tSirRetStatus retCode = eSIR_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -07006369tSirMsgQ msgQ;
6370
6371 // Allocate for SIR_HAL_DELBA_IND
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306372 pDelBAParams = vos_mem_malloc(sizeof( tDelBAParams ));
6373 if ( NULL == pDelBAParams )
Jeff Johnson295189b2012-06-20 16:38:30 -07006374 {
6375 limLog( pMac, LOGE,
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306376 FL("AllocateMemory failed")
6377 );
Jeff Johnson295189b2012-06-20 16:38:30 -07006378
6379 retCode = eSIR_MEM_ALLOC_FAILED;
6380 goto returnFailure;
6381 }
6382
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306383 vos_mem_set( (void *) pDelBAParams, sizeof( tDelBAParams ), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07006384
6385 // Populate the REQ parameters
6386 pDelBAParams->staIdx = pSta->staIndex;
6387 pDelBAParams->baTID = baTID;
6388 pDelBAParams->baDirection = baDirection;
6389
6390 /* Update PE session ID */
6391
6392
6393 //TBD-RAJESH Updating of the session ID is requird for SIR_HAL_DELBA_IND?????
6394 //pDelBAParams->sessionId = psessionEntry->peSessionId;
6395
6396 // Post WDA_DELBA_IND to HAL.
6397 msgQ.type = WDA_DELBA_IND;
6398 //
6399 // FIXME:
6400 // A global counter (dialog token) is required to keep track of
6401 // all PE <-> HAL communication(s)
6402 //
6403 msgQ.reserved = 0;
6404 msgQ.bodyptr = pDelBAParams;
6405 msgQ.bodyval = 0;
6406
6407 limLog( pMac, LOGW,
6408 FL( "Sending SIR_HAL_DELBA_IND..." ));
6409
Jeff Johnsone7245742012-09-05 17:12:55 -07006410 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07006411#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
6412 limDiagEventReport(pMac, WLAN_PE_DIAG_HAL_DELBA_IND_EVENT, psessionEntry, 0, 0);
6413#endif //FEATURE_WLAN_DIAG_SUPPORT
6414
6415 if( eSIR_SUCCESS != (retCode = wdaPostCtrlMsg( pMac, &msgQ )))
6416 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006417 FL("Posting WDA_DELBA_IND to HAL failed! Reason = %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07006418 retCode );
6419 else
6420 {
6421 // Update LIM's internal cache...
6422 if( eBA_INITIATOR == baDirection)
6423 {
6424 pSta->tcCfg[baTID].fUseBATx = 0;
6425 pSta->tcCfg[baTID].txBufSize = 0;
6426 }
6427 else
6428 {
6429 pSta->tcCfg[baTID].fUseBARx = 0;
6430 pSta->tcCfg[baTID].rxBufSize = 0;
6431 }
6432
6433 return retCode;
6434 }
6435
6436returnFailure:
6437
6438 // Clean-up...
6439 if( NULL != pDelBAParams )
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306440 vos_mem_free( pDelBAParams );
Jeff Johnson295189b2012-06-20 16:38:30 -07006441
6442 return retCode;
6443
6444}
6445
6446/**
6447 * @function : limPostSMStateUpdate()
6448 *
6449 * @brief : This function Updates the HAL and Softmac about the change in the STA's SMPS state.
6450 *
6451 * LOGIC:
6452 *
6453 * ASSUMPTIONS:
6454 * NA
6455 *
6456 * NOTE:
6457 * NA
6458 *
6459 * @param pMac - Pointer to Global MAC structure
6460 * @param limMsg - Lim Message structure object with the MimoPSparam in body
6461 * @return None
6462 */
6463tSirRetStatus
6464limPostSMStateUpdate(tpAniSirGlobal pMac,
6465 tANI_U16 staIdx, tSirMacHTMIMOPowerSaveState state)
6466{
6467 tSirRetStatus retCode = eSIR_SUCCESS;
6468 tSirMsgQ msgQ;
Jeff Johnson295189b2012-06-20 16:38:30 -07006469 tpSetMIMOPS pMIMO_PSParams;
6470
6471 msgQ.reserved = 0;
6472 msgQ.type = WDA_SET_MIMOPS_REQ;
6473
6474 // Allocate for WDA_SET_MIMOPS_REQ
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306475 pMIMO_PSParams = vos_mem_malloc(sizeof(tSetMIMOPS));
6476 if ( NULL == pMIMO_PSParams )
6477 {
6478 limLog( pMac, LOGP,FL(" AllocateMemory failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07006479 return eSIR_MEM_ALLOC_FAILED;
6480 }
6481
6482 pMIMO_PSParams->htMIMOPSState = state;
6483 pMIMO_PSParams->staIdx = staIdx;
6484 pMIMO_PSParams->fsendRsp = true;
6485 msgQ.bodyptr = pMIMO_PSParams;
6486 msgQ.bodyval = 0;
6487
6488 limLog( pMac, LOG2, FL( "Sending WDA_SET_MIMOPS_REQ..." ));
6489
Jeff Johnsone7245742012-09-05 17:12:55 -07006490 MTRACE(macTraceMsgTx(pMac, NO_SESSION, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07006491 retCode = wdaPostCtrlMsg( pMac, &msgQ );
6492 if (eSIR_SUCCESS != retCode)
6493 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006494 limLog( pMac, LOGP, FL("Posting WDA_SET_MIMOPS_REQ to HAL failed! Reason = %d"), retCode );
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306495 vos_mem_free(pMIMO_PSParams);
Jeff Johnson295189b2012-06-20 16:38:30 -07006496 return retCode;
6497 }
6498
6499 return retCode;
6500}
6501
6502void limPktFree (
6503 tpAniSirGlobal pMac,
6504 eFrameType frmType,
6505 tANI_U8 *pRxPacketInfo,
6506 void *pBody)
6507{
6508 (void) pMac; (void) frmType; (void) pRxPacketInfo; (void) pBody;
Jeff Johnson295189b2012-06-20 16:38:30 -07006509}
6510
6511/**
6512 * limGetBDfromRxPacket()
6513 *
6514 *FUNCTION:
6515 * This function is called to get pointer to Polaris
6516 * Buffer Descriptor containing MAC header & other control
6517 * info from the body of the message posted to LIM.
6518 *
6519 *LOGIC:
6520 * NA
6521 *
6522 *ASSUMPTIONS:
6523 * NA
6524 *
6525 *NOTE:
6526 * NA
6527 *
6528 * @param body - Received message body
6529 * @param pRxPacketInfo - Pointer to received BD
6530 * @return None
6531 */
6532
6533void
6534limGetBDfromRxPacket(tpAniSirGlobal pMac, void *body, tANI_U32 **pRxPacketInfo)
6535{
Jeff Johnson295189b2012-06-20 16:38:30 -07006536 *pRxPacketInfo = (tANI_U32 *) body;
Jeff Johnson295189b2012-06-20 16:38:30 -07006537} /*** end limGetBDfromRxPacket() ***/
6538
6539
6540
6541
6542
6543void limRessetScanChannelInfo(tpAniSirGlobal pMac)
6544{
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306545 vos_mem_set(&pMac->lim.scanChnInfo, sizeof(tLimScanChnInfo), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07006546}
6547
6548
6549void limAddScanChannelInfo(tpAniSirGlobal pMac, tANI_U8 channelId)
6550{
6551 tANI_U8 i;
6552 tANI_BOOLEAN fFound = eANI_BOOLEAN_FALSE;
6553
6554 for(i = 0; i < pMac->lim.scanChnInfo.numChnInfo; i++)
6555 {
6556 if(pMac->lim.scanChnInfo.scanChn[i].channelId == channelId)
6557 {
6558 pMac->lim.scanChnInfo.scanChn[i].numTimeScan++;
6559 fFound = eANI_BOOLEAN_TRUE;
6560 break;
6561 }
6562 }
6563 if(eANI_BOOLEAN_FALSE == fFound)
6564 {
6565 if(pMac->lim.scanChnInfo.numChnInfo < SIR_MAX_SUPPORTED_CHANNEL_LIST)
6566 {
6567 pMac->lim.scanChnInfo.scanChn[pMac->lim.scanChnInfo.numChnInfo].channelId = channelId;
6568 pMac->lim.scanChnInfo.scanChn[pMac->lim.scanChnInfo.numChnInfo++].numTimeScan = 1;
6569 }
6570 else
6571 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006572 PELOGW(limLog(pMac, LOGW, FL(" -- number of channels exceed mac"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07006573 }
6574 }
6575}
6576
6577
6578/**
6579 * @function : limIsChannelValidForChannelSwitch()
6580 *
6581 * @brief : This function checks if the channel to which AP
6582 * is expecting us to switch, is a valid channel for us.
6583 * LOGIC:
6584 *
6585 * ASSUMPTIONS:
6586 * NA
6587 *
6588 * NOTE:
6589 * NA
6590 *
6591 * @param pMac - Pointer to Global MAC structure
6592 * @param channel - New channel to which we are expected to move
6593 * @return None
6594 */
6595tAniBool
6596limIsChannelValidForChannelSwitch(tpAniSirGlobal pMac, tANI_U8 channel)
6597{
6598 tANI_U8 index;
6599 tANI_U32 validChannelListLen = WNI_CFG_VALID_CHANNEL_LIST_LEN;
6600 tSirMacChanNum validChannelList[WNI_CFG_VALID_CHANNEL_LIST_LEN];
6601
6602 if (wlan_cfgGetStr(pMac, WNI_CFG_VALID_CHANNEL_LIST,
6603 (tANI_U8 *)validChannelList,
6604 (tANI_U32 *)&validChannelListLen) != eSIR_SUCCESS)
6605 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006606 PELOGE(limLog(pMac, LOGE, FL("could not retrieve valid channel list"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07006607 return (eSIR_FALSE);
6608 }
6609
6610 for(index = 0; index < validChannelListLen; index++)
6611 {
6612 if(validChannelList[index] == channel)
6613 return (eSIR_TRUE);
6614 }
6615
6616 /* channel does not belong to list of valid channels */
6617 return (eSIR_FALSE);
6618}
6619
6620/**------------------------------------------------------
6621\fn __limFillTxControlParams
6622\brief Fill the message for stopping/resuming tx.
6623
6624\param pMac
6625\param pTxCtrlMsg - Pointer to tx control message.
6626\param type - Which way we want to stop/ resume tx.
6627\param mode - To stop/resume.
6628 -------------------------------------------------------*/
6629static eHalStatus
6630__limFillTxControlParams(tpAniSirGlobal pMac, tpTxControlParams pTxCtrlMsg,
6631 tLimQuietTxMode type, tLimControlTx mode)
6632{
6633
6634 //TBD-RAJESH HOW TO GET sessionEntry?????
6635 tpPESession psessionEntry = &pMac->lim.gpSession[0];
6636
6637 if (mode == eLIM_STOP_TX)
6638 pTxCtrlMsg->stopTx = eANI_BOOLEAN_TRUE;
6639 else
6640 pTxCtrlMsg->stopTx = eANI_BOOLEAN_FALSE;
6641
6642 switch (type)
6643 {
6644 case eLIM_TX_ALL:
6645 /** Stops/resumes transmission completely */
6646 pTxCtrlMsg->fCtrlGlobal = 1;
6647 break;
6648
6649 case eLIM_TX_BSS_BUT_BEACON:
6650 /** Stops/resumes transmission on a particular BSS. Stopping BSS, doesnt
6651 * stop beacon transmission.
6652 */
6653 pTxCtrlMsg->ctrlBss = 1;
6654 pTxCtrlMsg->bssBitmap |= (1 << psessionEntry->bssIdx);
6655 break;
6656
6657 case eLIM_TX_STA:
6658 /** Memory for station bitmap is allocated dynamically in caller of this
6659 * so decode properly here and fill the bitmap. Now not implemented,
6660 * fall through.
6661 */
6662 case eLIM_TX_BSS:
6663 //Fall thru...
6664 default:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006665 PELOGW(limLog(pMac, LOGW, FL("Invalid case: Not Handled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07006666 return eHAL_STATUS_FAILURE;
6667 }
6668
6669 return eHAL_STATUS_SUCCESS;
6670}
6671
6672/**
6673 * @function : limFrameTransmissionControl()
6674 *
6675 * @brief : This API is called by the user to halt/resume any frame
6676 * transmission from the device. If stopped, all frames will be
6677 * queued starting from hardware. Then back-pressure
6678 * is built till the driver.
6679 * LOGIC:
6680 *
6681 * ASSUMPTIONS:
6682 * NA
6683 *
6684 * NOTE:
6685 * NA
6686 *
6687 * @param pMac - Pointer to Global MAC structure
6688 * @return None
6689 */
6690void limFrameTransmissionControl(tpAniSirGlobal pMac, tLimQuietTxMode type, tLimControlTx mode)
6691{
6692
6693 eHalStatus status = eHAL_STATUS_FAILURE;
6694 tpTxControlParams pTxCtrlMsg;
6695 tSirMsgQ msgQ;
6696 tANI_U8 nBytes = 0; // No of bytes required for station bitmap.
6697
6698 /** Allocate only required number of bytes for station bitmap
6699 * Make it to align to 4 byte boundary */
6700 nBytes = (tANI_U8)HALMSG_NUMBYTES_STATION_BITMAP(pMac->lim.maxStation);
6701
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306702 pTxCtrlMsg = vos_mem_malloc(sizeof(*pTxCtrlMsg) + nBytes);
6703 if ( NULL == pTxCtrlMsg )
Jeff Johnson295189b2012-06-20 16:38:30 -07006704 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306705 limLog(pMac, LOGP, FL("AllocateMemory() failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07006706 return;
6707 }
6708
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306709 vos_mem_set((void *) pTxCtrlMsg,
6710 (sizeof(*pTxCtrlMsg) + nBytes), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07006711 status = __limFillTxControlParams(pMac, pTxCtrlMsg, type, mode);
6712 if (status != eHAL_STATUS_SUCCESS)
6713 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306714 vos_mem_free(pTxCtrlMsg);
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006715 limLog(pMac, LOGP, FL("__limFillTxControlParams failed, status = %d"), status);
Jeff Johnson295189b2012-06-20 16:38:30 -07006716 return;
6717 }
6718
6719 msgQ.bodyptr = (void *) pTxCtrlMsg;
6720 msgQ.bodyval = 0;
6721 msgQ.reserved = 0;
6722 msgQ.type = WDA_TRANSMISSION_CONTROL_IND;
6723
Jeff Johnsone7245742012-09-05 17:12:55 -07006724 MTRACE(macTraceMsgTx(pMac, NO_SESSION, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07006725 if(wdaPostCtrlMsg( pMac, &msgQ) != eSIR_SUCCESS)
6726 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306727 vos_mem_free(pTxCtrlMsg);
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006728 limLog( pMac, LOGP, FL("Posting Message to HAL failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07006729 return;
6730 }
6731
6732 if (mode == eLIM_STOP_TX)
6733 {
Abhishek Singh3cbf6052014-12-15 16:46:42 +05306734 limLog(pMac, LOG1, FL("Stopping the transmission of all packets, indicated softmac"));
Jeff Johnson295189b2012-06-20 16:38:30 -07006735 }
6736 else
6737 {
Abhishek Singh3cbf6052014-12-15 16:46:42 +05306738 limLog(pMac, LOG1, FL("Resuming the transmission of all packets, indicated softmac"));
Jeff Johnson295189b2012-06-20 16:38:30 -07006739 }
6740 return;
6741}
6742
6743
6744/**
6745 * @function : limRestorePreChannelSwitchState()
6746 *
6747 * @brief : This API is called by the user to undo any
6748 * specific changes done on the device during
6749 * channel switch.
6750 * LOGIC:
6751 *
6752 * ASSUMPTIONS:
6753 * NA
6754 *
6755 * NOTE:
6756 * NA
6757 *
6758 * @param pMac - Pointer to Global MAC structure
6759 * @return None
6760 */
6761
6762tSirRetStatus
6763limRestorePreChannelSwitchState(tpAniSirGlobal pMac, tpPESession psessionEntry)
6764{
6765
6766 tSirRetStatus retCode = eSIR_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -07006767 tANI_U32 val = 0;
6768
6769 if (psessionEntry->limSystemRole != eLIM_STA_ROLE)
6770 return retCode;
6771
6772 /* Channel switch should be ready for the next time */
Jeff Johnsone7245742012-09-05 17:12:55 -07006773 psessionEntry->gLimSpecMgmt.dot11hChanSwState = eLIM_11H_CHANSW_INIT;
Jeff Johnson295189b2012-06-20 16:38:30 -07006774
6775 /* Restore the frame transmission, all the time. */
6776 limFrameTransmissionControl(pMac, eLIM_TX_ALL, eLIM_RESUME_TX);
6777
6778 /* Free to enter BMPS */
6779 limSendSmePostChannelSwitchInd(pMac);
6780
6781 //Background scan is now enabled by SME
6782 if(pMac->lim.gLimBackgroundScanTerminate == FALSE)
6783 {
6784 /* Enable background scan if already enabled, else don't bother */
6785 if ((retCode = wlan_cfgGetInt(pMac, WNI_CFG_BACKGROUND_SCAN_PERIOD,
6786 &val)) != eSIR_SUCCESS)
6787
6788 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006789 limLog(pMac, LOGP, FL("could not retrieve Background scan period value"));
Jeff Johnson295189b2012-06-20 16:38:30 -07006790 return (retCode);
6791 }
6792
6793 if (val > 0 && TX_TIMER_VALID(pMac->lim.limTimers.gLimBackgroundScanTimer))
6794 {
Ravi Joshid2ca7c42013-07-23 08:37:49 -07006795 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE,
6796 psessionEntry->peSessionId, eLIM_BACKGROUND_SCAN_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -07006797 if(tx_timer_activate(&pMac->lim.limTimers.gLimBackgroundScanTimer) != TX_SUCCESS)
6798 {
6799 limLog(pMac, LOGP, FL("Could not restart background scan timer, doing LOGP"));
6800 return (eSIR_FAILURE);
6801 }
6802
6803 }
6804 }
6805
6806 /* Enable heartbeat timer */
6807 if (TX_TIMER_VALID(pMac->lim.limTimers.gLimHeartBeatTimer))
6808 {
Ravi Joshid2ca7c42013-07-23 08:37:49 -07006809 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE,
6810 psessionEntry->peSessionId, eLIM_HEART_BEAT_TIMER));
6811 if((limActivateHearBeatTimer(pMac, psessionEntry) != TX_SUCCESS) &&
6812 (!IS_ACTIVEMODE_OFFLOAD_FEATURE_ENABLE))
Jeff Johnson295189b2012-06-20 16:38:30 -07006813 {
6814 limLog(pMac, LOGP, FL("Could not restart heartbeat timer, doing LOGP"));
6815 return (eSIR_FAILURE);
6816 }
6817 }
Jeff Johnson295189b2012-06-20 16:38:30 -07006818 return (retCode);
6819}
6820
6821
6822/**--------------------------------------------
6823\fn limRestorePreQuietState
6824\brief Restore the pre quiet state
6825
6826\param pMac
6827\return NONE
6828---------------------------------------------*/
Jeff Johnsone7245742012-09-05 17:12:55 -07006829tSirRetStatus limRestorePreQuietState(tpAniSirGlobal pMac, tpPESession psessionEntry)
Jeff Johnson295189b2012-06-20 16:38:30 -07006830{
6831
6832 tSirRetStatus retCode = eSIR_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -07006833 tANI_U32 val = 0;
6834
6835 if (pMac->lim.gLimSystemRole != eLIM_STA_ROLE)
6836 return retCode;
6837
6838 /* Quiet should be ready for the next time */
Jeff Johnsone7245742012-09-05 17:12:55 -07006839 psessionEntry->gLimSpecMgmt.quietState = eLIM_QUIET_INIT;
Jeff Johnson295189b2012-06-20 16:38:30 -07006840
6841 /* Restore the frame transmission, all the time. */
Jeff Johnsone7245742012-09-05 17:12:55 -07006842 if (psessionEntry->gLimSpecMgmt.quietState == eLIM_QUIET_RUNNING)
Jeff Johnson295189b2012-06-20 16:38:30 -07006843 limFrameTransmissionControl(pMac, eLIM_TX_ALL, eLIM_RESUME_TX);
6844
6845
6846 //Background scan is now enabled by SME
6847 if(pMac->lim.gLimBackgroundScanTerminate == FALSE)
6848 {
6849 /* Enable background scan if already enabled, else don't bother */
6850 if ((retCode = wlan_cfgGetInt(pMac, WNI_CFG_BACKGROUND_SCAN_PERIOD,
6851 &val)) != eSIR_SUCCESS)
6852
6853 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006854 limLog(pMac, LOGP, FL("could not retrieve Background scan period value"));
Jeff Johnson295189b2012-06-20 16:38:30 -07006855 return (retCode);
6856 }
6857
6858 if (val > 0 && TX_TIMER_VALID(pMac->lim.limTimers.gLimBackgroundScanTimer))
6859 {
Leela V Kiran Kumar Reddy Chiralac3b9d382013-01-31 20:49:53 -08006860 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, psessionEntry->peSessionId, eLIM_BACKGROUND_SCAN_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -07006861 if(tx_timer_activate(&pMac->lim.limTimers.gLimBackgroundScanTimer) != TX_SUCCESS)
6862 {
6863 limLog(pMac, LOGP, FL("Could not restart background scan timer, doing LOGP"));
6864 return (eSIR_FAILURE);
6865 }
6866
6867 }
6868 }
6869
6870 /* Enable heartbeat timer */
6871 if (TX_TIMER_VALID(pMac->lim.limTimers.gLimHeartBeatTimer))
6872 {
Leela V Kiran Kumar Reddy Chiralac3b9d382013-01-31 20:49:53 -08006873 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, psessionEntry->peSessionId, eLIM_HEART_BEAT_TIMER));
Ravi Joshid2ca7c42013-07-23 08:37:49 -07006874 if(limActivateHearBeatTimer(pMac, psessionEntry) != TX_SUCCESS)
Jeff Johnson295189b2012-06-20 16:38:30 -07006875 {
6876 limLog(pMac, LOGP, FL("Could not restart heartbeat timer, doing LOGP"));
6877 return (eSIR_FAILURE);
6878 }
6879 }
Jeff Johnson295189b2012-06-20 16:38:30 -07006880 return (retCode);
6881}
6882
6883
6884/**
6885 * @function: limPrepareFor11hChannelSwitch()
6886 *
6887 * @brief : This API is called by the user to prepare for
6888 * 11h channel switch. As of now, the API does
6889 * very minimal work. User can add more into the
6890 * same API if needed.
6891 * LOGIC:
6892 *
6893 * ASSUMPTIONS:
6894 * NA
6895 *
6896 * NOTE:
6897 * NA
6898 *
6899 * @param pMac - Pointer to Global MAC structure
6900 * @param psessionEntry
6901 * @return None
6902 */
6903void
6904limPrepareFor11hChannelSwitch(tpAniSirGlobal pMac, tpPESession psessionEntry)
6905{
Jeff Johnson295189b2012-06-20 16:38:30 -07006906 if (psessionEntry->limSystemRole != eLIM_STA_ROLE)
6907 return;
6908
6909 /* Flag to indicate 11h channel switch in progress */
Jeff Johnsone7245742012-09-05 17:12:55 -07006910 psessionEntry->gLimSpecMgmt.dot11hChanSwState = eLIM_11H_CHANSW_RUNNING;
Jeff Johnson295189b2012-06-20 16:38:30 -07006911
6912 /* Disable, Stop background scan if enabled and running */
6913 limDeactivateAndChangeTimer(pMac, eLIM_BACKGROUND_SCAN_TIMER);
6914
6915 /* Stop heart-beat timer to stop heartbeat disassociation */
6916 limHeartBeatDeactivateAndChangeTimer(pMac, psessionEntry);
6917
6918 if(pMac->lim.gLimSmeState == eLIM_SME_LINK_EST_WT_SCAN_STATE ||
6919 pMac->lim.gLimSmeState == eLIM_SME_CHANNEL_SCAN_STATE)
6920 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006921 PELOGE(limLog(pMac, LOGE, FL("Posting finish scan as we are in scan state"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07006922 /* Stop ongoing scanning if any */
6923 if (GET_LIM_PROCESS_DEFD_MESGS(pMac))
6924 {
6925 //Set the resume channel to Any valid channel (invalid).
6926 //This will instruct HAL to set it to any previous valid channel.
6927 peSetResumeChannel(pMac, 0, 0);
6928 limSendHalFinishScanReq(pMac, eLIM_HAL_FINISH_SCAN_WAIT_STATE);
6929 }
6930 else
6931 {
6932 limRestorePreChannelSwitchState(pMac, psessionEntry);
6933 }
6934 return;
6935 }
6936 else
6937 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006938 PELOGE(limLog(pMac, LOGE, FL("Not in scan state, start channel switch timer"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07006939 /** We are safe to switch channel at this point */
6940 limStopTxAndSwitchChannel(pMac, psessionEntry->peSessionId);
6941 }
Jeff Johnson295189b2012-06-20 16:38:30 -07006942}
6943
6944
6945
6946/**----------------------------------------------------
6947\fn limGetNwType
6948
6949\brief Get type of the network from data packet or beacon
6950\param pMac
6951\param channelNum - Channel number
6952\param type - Type of packet.
6953\param pBeacon - Pointer to beacon or probe response
6954
6955\return Network type a/b/g.
6956-----------------------------------------------------*/
6957tSirNwType limGetNwType(tpAniSirGlobal pMac, tANI_U8 channelNum, tANI_U32 type, tpSchBeaconStruct pBeacon)
6958{
6959 tSirNwType nwType = eSIR_11B_NW_TYPE;
6960
6961 if (type == SIR_MAC_DATA_FRAME)
6962 {
6963 if ((channelNum > 0) && (channelNum < 15))
6964 {
6965 nwType = eSIR_11G_NW_TYPE;
6966 }
6967 else
6968 {
6969 nwType = eSIR_11A_NW_TYPE;
6970 }
6971 }
6972 else
6973 {
6974 if ((channelNum > 0) && (channelNum < 15))
6975 {
6976 int i;
6977 // 11b or 11g packet
6978 // 11g iff extended Rate IE is present or
6979 // if there is an A rate in suppRate IE
6980 for (i = 0; i < pBeacon->supportedRates.numRates; i++)
6981 {
6982 if (sirIsArate(pBeacon->supportedRates.rate[i] & 0x7f))
6983 {
6984 nwType = eSIR_11G_NW_TYPE;
6985 break;
6986 }
6987 }
6988 if (pBeacon->extendedRatesPresent)
6989 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006990 PELOG3(limLog(pMac, LOG3, FL("Beacon, nwtype=G"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07006991 nwType = eSIR_11G_NW_TYPE;
6992 }
6993 }
6994 else
6995 {
6996 // 11a packet
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006997 PELOG3(limLog(pMac, LOG3,FL("Beacon, nwtype=A"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07006998 nwType = eSIR_11A_NW_TYPE;
6999 }
7000 }
7001 return nwType;
7002}
7003
7004
7005/**---------------------------------------------------------
7006\fn limGetChannelFromBeacon
7007\brief To extract channel number from beacon
7008
7009\param pMac
7010\param pBeacon - Pointer to beacon or probe rsp
7011\return channel number
7012-----------------------------------------------------------*/
7013tANI_U8 limGetChannelFromBeacon(tpAniSirGlobal pMac, tpSchBeaconStruct pBeacon)
7014{
7015 tANI_U8 channelNum = 0;
7016
7017 if (pBeacon->dsParamsPresent)
7018 channelNum = pBeacon->channelNumber;
7019 else if(pBeacon->HTInfo.present)
7020 channelNum = pBeacon->HTInfo.primaryChannel;
7021 else
7022 channelNum = pBeacon->channelNumber;
7023
7024 return channelNum;
7025}
7026
7027
7028/** ---------------------------------------------------------
7029\fn limSetTspecUapsdMask
7030\brief This function sets the PE global variable:
7031\ 1) gUapsdPerAcTriggerEnableMask and
7032\ 2) gUapsdPerAcDeliveryEnableMask
7033\ based on the user priority field and direction field
7034\ in the TS Info Fields.
7035\
7036\ An AC is a trigger-enabled AC if the PSB subfield
7037\ is set to 1 in the uplink direction.
7038\ An AC is a delivery-enabled AC if the PSB subfield
7039\ is set to 1 in the down-link direction.
7040\
7041\param tpAniSirGlobal pMac
7042\param tSirMacTSInfo pTsInfo
7043\param tANI_U32 action
7044\return None
7045 ------------------------------------------------------------*/
7046void limSetTspecUapsdMask(tpAniSirGlobal pMac, tSirMacTSInfo *pTsInfo, tANI_U32 action)
7047{
7048 tANI_U8 userPrio = (tANI_U8)pTsInfo->traffic.userPrio;
7049 tANI_U16 direction = pTsInfo->traffic.direction;
7050 tANI_U8 ac = upToAc(userPrio);
7051
Abhishek Singh3cbf6052014-12-15 16:46:42 +05307052 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 -07007053
7054 /* Converting AC to appropriate Uapsd Bit Mask
7055 * AC_BE(0) --> UAPSD_BITOFFSET_ACVO(3)
7056 * AC_BK(1) --> UAPSD_BITOFFSET_ACVO(2)
7057 * AC_VI(2) --> UAPSD_BITOFFSET_ACVO(1)
7058 * AC_VO(3) --> UAPSD_BITOFFSET_ACVO(0)
7059 */
7060 ac = ((~ac) & 0x3);
7061
7062 if (action == CLEAR_UAPSD_MASK)
7063 {
7064 if (direction == SIR_MAC_DIRECTION_UPLINK)
7065 pMac->lim.gUapsdPerAcTriggerEnableMask &= ~(1 << ac);
7066 else if (direction == SIR_MAC_DIRECTION_DNLINK)
7067 pMac->lim.gUapsdPerAcDeliveryEnableMask &= ~(1 << ac);
7068 else if (direction == SIR_MAC_DIRECTION_BIDIR)
7069 {
7070 pMac->lim.gUapsdPerAcTriggerEnableMask &= ~(1 << ac);
7071 pMac->lim.gUapsdPerAcDeliveryEnableMask &= ~(1 << ac);
7072 }
7073 }
7074 else if (action == SET_UAPSD_MASK)
7075 {
7076 if (direction == SIR_MAC_DIRECTION_UPLINK)
7077 pMac->lim.gUapsdPerAcTriggerEnableMask |= (1 << ac);
7078 else if (direction == SIR_MAC_DIRECTION_DNLINK)
7079 pMac->lim.gUapsdPerAcDeliveryEnableMask |= (1 << ac);
7080 else if (direction == SIR_MAC_DIRECTION_BIDIR)
7081 {
7082 pMac->lim.gUapsdPerAcTriggerEnableMask |= (1 << ac);
7083 pMac->lim.gUapsdPerAcDeliveryEnableMask |= (1 << ac);
7084 }
7085 }
7086
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007087 limLog(pMac, LOGE, FL("New pMac->lim.gUapsdPerAcTriggerEnableMask = 0x%x "), pMac->lim.gUapsdPerAcTriggerEnableMask );
7088 limLog(pMac, LOGE, FL("New pMac->lim.gUapsdPerAcDeliveryEnableMask = 0x%x "), pMac->lim.gUapsdPerAcDeliveryEnableMask );
Jeff Johnson295189b2012-06-20 16:38:30 -07007089
7090 return;
7091}
7092
7093
7094
7095void limHandleHeartBeatTimeout(tpAniSirGlobal pMac )
7096{
7097
7098 tANI_U8 i;
7099 for(i =0;i < pMac->lim.maxBssId;i++)
7100 {
7101 if(pMac->lim.gpSession[i].valid == TRUE )
7102 {
7103 if(pMac->lim.gpSession[i].bssType == eSIR_IBSS_MODE)
7104 {
7105 limIbssHeartBeatHandle(pMac,&pMac->lim.gpSession[i]);
7106 break;
7107 }
7108
7109 if((pMac->lim.gpSession[i].bssType == eSIR_INFRASTRUCTURE_MODE) &&
7110 (pMac->lim.gpSession[i].limSystemRole == eLIM_STA_ROLE))
7111 {
7112 limHandleHeartBeatFailure(pMac,&pMac->lim.gpSession[i]);
7113 }
7114 }
7115 }
7116 for(i=0; i< pMac->lim.maxBssId; i++)
7117 {
7118 if(pMac->lim.gpSession[i].valid == TRUE )
7119 {
7120 if((pMac->lim.gpSession[i].bssType == eSIR_INFRASTRUCTURE_MODE) &&
7121 (pMac->lim.gpSession[i].limSystemRole == eLIM_STA_ROLE))
7122 {
7123 if(pMac->lim.gpSession[i].LimHBFailureStatus == eANI_BOOLEAN_TRUE)
7124 {
7125 /* Activate Probe After HeartBeat Timer incase HB Failure detected */
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007126 PELOGW(limLog(pMac, LOGW,FL("Sending Probe for Session: %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07007127 i);)
7128 limDeactivateAndChangeTimer(pMac, eLIM_PROBE_AFTER_HB_TIMER);
7129 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, 0, eLIM_PROBE_AFTER_HB_TIMER));
7130 if (tx_timer_activate(&pMac->lim.limTimers.gLimProbeAfterHBTimer) != TX_SUCCESS)
7131 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007132 limLog(pMac, LOGP, FL("Fail to re-activate Probe-after-heartbeat timer"));
Jeff Johnson295189b2012-06-20 16:38:30 -07007133 limReactivateHeartBeatTimer(pMac, &pMac->lim.gpSession[i]);
7134 }
7135 break;
7136 }
7137 }
7138 }
7139 }
7140}
7141
Leela Venkata Kiran Kumar Reddy Chirala3ca17902013-02-27 19:50:05 -08007142void limHandleHeartBeatTimeoutForSession(tpAniSirGlobal pMac, tpPESession psessionEntry)
7143{
7144 if(psessionEntry->valid == TRUE )
7145 {
7146 if(psessionEntry->bssType == eSIR_IBSS_MODE)
7147 {
7148 limIbssHeartBeatHandle(pMac,psessionEntry);
7149 }
7150 if((psessionEntry->bssType == eSIR_INFRASTRUCTURE_MODE) &&
7151 (psessionEntry->limSystemRole == eLIM_STA_ROLE))
7152 {
7153 limHandleHeartBeatFailure(pMac,psessionEntry);
7154 }
7155 }
7156 /* In the function limHandleHeartBeatFailure things can change so check for the session entry valid
7157 and the other things again */
7158 if(psessionEntry->valid == TRUE )
7159 {
7160 if((psessionEntry->bssType == eSIR_INFRASTRUCTURE_MODE) &&
7161 (psessionEntry->limSystemRole == eLIM_STA_ROLE))
7162 {
7163 if(psessionEntry->LimHBFailureStatus == eANI_BOOLEAN_TRUE)
7164 {
7165 /* Activate Probe After HeartBeat Timer incase HB Failure detected */
7166 PELOGW(limLog(pMac, LOGW,FL("Sending Probe for Session: %d"),
7167 psessionEntry->bssIdx);)
7168 limDeactivateAndChangeTimer(pMac, eLIM_PROBE_AFTER_HB_TIMER);
7169 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, 0, eLIM_PROBE_AFTER_HB_TIMER));
7170 if (tx_timer_activate(&pMac->lim.limTimers.gLimProbeAfterHBTimer) != TX_SUCCESS)
7171 {
7172 limLog(pMac, LOGP, FL("Fail to re-activate Probe-after-heartbeat timer"));
7173 limReactivateHeartBeatTimer(pMac, psessionEntry);
7174 }
7175 }
7176 }
7177 }
7178}
7179
7180
Jeff Johnson295189b2012-06-20 16:38:30 -07007181tANI_U8 limGetCurrentOperatingChannel(tpAniSirGlobal pMac)
7182{
7183 tANI_U8 i;
7184 for(i =0;i < pMac->lim.maxBssId;i++)
7185 {
7186 if(pMac->lim.gpSession[i].valid == TRUE )
7187 {
7188 if((pMac->lim.gpSession[i].bssType == eSIR_INFRASTRUCTURE_MODE) &&
7189 (pMac->lim.gpSession[i].limSystemRole == eLIM_STA_ROLE))
7190 {
7191 return pMac->lim.gpSession[i].currentOperChannel;
7192 }
7193 }
7194 }
7195 return 0;
7196}
7197
7198void limProcessAddStaRsp(tpAniSirGlobal pMac,tpSirMsgQ limMsgQ)
7199{
7200
7201 tpPESession psessionEntry;
7202// tANI_U8 sessionId;
7203 tpAddStaParams pAddStaParams;
7204
7205 pAddStaParams = (tpAddStaParams)limMsgQ->bodyptr;
7206
7207 if((psessionEntry = peFindSessionBySessionId(pMac,pAddStaParams->sessionId))==NULL)
7208 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007209 limLog(pMac, LOGP,FL("Session Does not exist for given sessionID"));
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307210 vos_mem_free(pAddStaParams);
Jeff Johnson295189b2012-06-20 16:38:30 -07007211 return;
7212 }
7213 if (psessionEntry->limSystemRole == eLIM_STA_IN_IBSS_ROLE)
7214 (void) limIbssAddStaRsp(pMac, limMsgQ->bodyptr,psessionEntry);
Mohit Khanna698ba2a2012-12-04 15:08:18 -08007215#ifdef FEATURE_WLAN_TDLS
7216 else if(pMac->lim.gLimAddStaTdls)
7217 {
7218 limProcessTdlsAddStaRsp(pMac, limMsgQ->bodyptr, psessionEntry) ;
7219 pMac->lim.gLimAddStaTdls = FALSE ;
7220 }
7221#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07007222 else
7223 limProcessMlmAddStaRsp(pMac, limMsgQ,psessionEntry);
7224
7225}
7226
7227
7228void limUpdateBeacon(tpAniSirGlobal pMac)
7229{
7230 tANI_U8 i;
7231
7232 for(i =0;i < pMac->lim.maxBssId;i++)
7233 {
7234 if(pMac->lim.gpSession[i].valid == TRUE )
7235 {
7236 if( ( (pMac->lim.gpSession[i].limSystemRole == eLIM_AP_ROLE) ||
7237 (pMac->lim.gpSession[i].limSystemRole == eLIM_STA_IN_IBSS_ROLE) )
7238 && (eLIM_SME_NORMAL_STATE == pMac->lim.gpSession[i].limSmeState)
7239 )
7240 {
7241 schSetFixedBeaconFields(pMac,&pMac->lim.gpSession[i]);
7242 limSendBeaconInd(pMac, &pMac->lim.gpSession[i]);
7243 }
7244 else
7245 {
7246 if( (pMac->lim.gpSession[i].limSystemRole == eLIM_BT_AMP_AP_ROLE)||
7247 (pMac->lim.gpSession[i].limSystemRole == eLIM_BT_AMP_STA_ROLE))
7248 {
7249
7250 if(pMac->lim.gpSession[i].statypeForBss == STA_ENTRY_SELF)
7251 {
7252 schSetFixedBeaconFields(pMac,&pMac->lim.gpSession[i]);
7253 }
7254 }
7255 }
7256 }
7257 }
7258}
7259
7260void limHandleHeartBeatFailureTimeout(tpAniSirGlobal pMac)
7261{
7262 tANI_U8 i;
7263 tpPESession psessionEntry;
7264 /* Probe response is not received after HB failure. This is handled by LMM sub module. */
7265 for(i =0; i < pMac->lim.maxBssId; i++)
7266 {
7267 if(pMac->lim.gpSession[i].valid == TRUE)
7268 {
7269 psessionEntry = &pMac->lim.gpSession[i];
7270 if(psessionEntry->LimHBFailureStatus == eANI_BOOLEAN_TRUE)
7271 {
Abhishek Singh514e0702014-12-05 13:49:37 +05307272 limLog(pMac, LOGE,
7273 FL("Probe_hb_failure: SME %d, MLME %d, HB-Count %d BCN count %d"),
7274 psessionEntry->limSmeState, psessionEntry->limMlmState,
7275 psessionEntry->LimRxedBeaconCntDuringHB,
7276 psessionEntry->currentBssBeaconCnt);
Leela Venkata Kiran Kumar Reddy Chirala2365ee62013-05-09 17:30:12 -07007277#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
7278 limDiagEventReport(pMac, WLAN_PE_DIAG_HB_FAILURE_TIMEOUT, psessionEntry, 0, 0);
7279#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07007280 if (psessionEntry->limMlmState == eLIM_MLM_LINK_ESTABLISHED_STATE)
7281 {
Abhishek Singh514e0702014-12-05 13:49:37 +05307282 /* Disconnect even if we have not received a single beacon
7283 * after connection.
7284 */
7285 if (((!LIM_IS_CONNECTION_ACTIVE(psessionEntry)) ||
7286 (0 == psessionEntry->currentBssBeaconCnt)) &&
Kaushik, Sushant65b19712014-05-13 11:52:24 +05307287 (psessionEntry->limSmeState != eLIM_SME_WT_DISASSOC_STATE)&&
7288 (psessionEntry->limSmeState != eLIM_SME_WT_DEAUTH_STATE))
Jeff Johnson295189b2012-06-20 16:38:30 -07007289 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007290 limLog(pMac, LOGE, FL("Probe_hb_failure: for session:%d " ),psessionEntry->peSessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07007291 /* AP did not respond to Probe Request. Tear down link with it.*/
7292 limTearDownLinkWithAp(pMac,
7293 psessionEntry->peSessionId,
7294 eSIR_BEACON_MISSED);
7295 pMac->lim.gLimProbeFailureAfterHBfailedCnt++ ;
7296 }
7297 else // restart heartbeat timer
7298 {
7299 limReactivateHeartBeatTimer(pMac, psessionEntry);
7300 }
7301 }
7302 else
7303 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007304 limLog(pMac, LOGE, FL("Unexpected wt-probe-timeout in state "));
Jeff Johnson295189b2012-06-20 16:38:30 -07007305 limPrintMlmState(pMac, LOGE, psessionEntry->limMlmState);
7306 limReactivateHeartBeatTimer(pMac, psessionEntry);
7307 }
7308
7309 }
7310 }
7311 }
7312 /* Deactivate Timer ProbeAfterHB Timer -> As its a oneshot timer, need not deactivate the timer */
7313 // tx_timer_deactivate(&pMac->lim.limTimers.gLimProbeAfterHBTimer);
7314}
7315
7316
7317/*
7318* This function assumes there will not be more than one IBSS session active at any time.
7319*/
7320tpPESession limIsIBSSSessionActive(tpAniSirGlobal pMac)
7321{
7322 tANI_U8 i;
7323
7324 for(i =0;i < pMac->lim.maxBssId;i++)
7325 {
7326 if( (pMac->lim.gpSession[i].valid) &&
7327 (pMac->lim.gpSession[i].limSystemRole == eLIM_STA_IN_IBSS_ROLE))
7328 return (&pMac->lim.gpSession[i]);
7329 }
7330
7331 return NULL;
7332}
7333
7334tpPESession limIsApSessionActive(tpAniSirGlobal pMac)
7335{
7336 tANI_U8 i;
7337
7338 for(i =0;i < pMac->lim.maxBssId;i++)
7339 {
7340 if( (pMac->lim.gpSession[i].valid) &&
7341 ( (pMac->lim.gpSession[i].limSystemRole == eLIM_AP_ROLE) ||
7342 (pMac->lim.gpSession[i].limSystemRole == eLIM_BT_AMP_AP_ROLE)))
7343 return (&pMac->lim.gpSession[i]);
7344 }
7345
7346 return NULL;
7347}
7348
7349/**---------------------------------------------------------
7350\fn limHandleDeferMsgError
7351\brief handles error scenario, when the msg can not be deferred.
7352\param pMac
7353\param pLimMsg LIM msg, which could not be deferred.
7354\return void
7355-----------------------------------------------------------*/
7356
7357void limHandleDeferMsgError(tpAniSirGlobal pMac, tpSirMsgQ pLimMsg)
7358{
7359 if(SIR_BB_XPORT_MGMT_MSG == pLimMsg->type)
7360 {
7361 vos_pkt_return_packet((vos_pkt_t*)pLimMsg->bodyptr);
7362 }
7363 else if(pLimMsg->bodyptr != NULL)
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08007364 {
7365 vos_mem_free( pLimMsg->bodyptr);
7366 pLimMsg->bodyptr = NULL;
7367 }
Jeff Johnson295189b2012-06-20 16:38:30 -07007368}
7369
7370
7371#ifdef FEATURE_WLAN_DIAG_SUPPORT
7372/**---------------------------------------------------------
7373\fn limDiagEventReport
7374\brief This function reports Diag event
7375\param pMac
7376\param eventType
7377\param bssid
7378\param status
7379\param reasonCode
7380\return void
7381-----------------------------------------------------------*/
7382void limDiagEventReport(tpAniSirGlobal pMac, tANI_U16 eventType, tpPESession pSessionEntry, tANI_U16 status, tANI_U16 reasonCode)
7383{
7384 tSirMacAddr nullBssid = { 0, 0, 0, 0, 0, 0 };
7385 WLAN_VOS_DIAG_EVENT_DEF(peEvent, vos_event_wlan_pe_payload_type);
7386
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307387 vos_mem_set(&peEvent, sizeof(vos_event_wlan_pe_payload_type), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07007388
7389 if (NULL == pSessionEntry)
7390 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307391 vos_mem_copy( peEvent.bssid, nullBssid, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07007392 peEvent.sme_state = (tANI_U16)pMac->lim.gLimSmeState;
7393 peEvent.mlm_state = (tANI_U16)pMac->lim.gLimMlmState;
7394
7395 }
7396 else
7397 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307398 vos_mem_copy(peEvent.bssid, pSessionEntry->bssId, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07007399 peEvent.sme_state = (tANI_U16)pSessionEntry->limSmeState;
7400 peEvent.mlm_state = (tANI_U16)pSessionEntry->limMlmState;
7401 }
7402 peEvent.event_type = eventType;
7403 peEvent.status = status;
7404 peEvent.reason_code = reasonCode;
7405
7406 WLAN_VOS_DIAG_EVENT_REPORT(&peEvent, EVENT_WLAN_PE);
7407 return;
7408}
7409
7410#endif /* FEATURE_WLAN_DIAG_SUPPORT */
7411
7412void limProcessAddStaSelfRsp(tpAniSirGlobal pMac,tpSirMsgQ limMsgQ)
7413{
7414
7415 tpAddStaSelfParams pAddStaSelfParams;
7416 tSirMsgQ mmhMsg;
7417 tpSirSmeAddStaSelfRsp pRsp;
7418
7419
7420 pAddStaSelfParams = (tpAddStaSelfParams)limMsgQ->bodyptr;
7421
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307422 pRsp = vos_mem_malloc(sizeof(tSirSmeAddStaSelfRsp));
7423 if ( NULL == pRsp )
Jeff Johnson295189b2012-06-20 16:38:30 -07007424 {
7425 /// Buffer not available. Log error
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307426 limLog(pMac, LOGP, FL("call to AllocateMemory failed for Add Sta self RSP"));
7427 vos_mem_free(pAddStaSelfParams);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08007428 limMsgQ->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07007429 return;
7430 }
7431
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307432 vos_mem_set((tANI_U8*)pRsp, sizeof(tSirSmeAddStaSelfRsp), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07007433
7434 pRsp->mesgType = eWNI_SME_ADD_STA_SELF_RSP;
7435 pRsp->mesgLen = (tANI_U16) sizeof(tSirSmeAddStaSelfRsp);
7436 pRsp->status = pAddStaSelfParams->status;
7437
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307438 vos_mem_copy( pRsp->selfMacAddr, pAddStaSelfParams->selfMacAddr, sizeof(tSirMacAddr) );
Jeff Johnson295189b2012-06-20 16:38:30 -07007439
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307440 vos_mem_free(pAddStaSelfParams);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08007441 limMsgQ->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07007442
7443 mmhMsg.type = eWNI_SME_ADD_STA_SELF_RSP;
7444 mmhMsg.bodyptr = pRsp;
7445 mmhMsg.bodyval = 0;
Jeff Johnsone7245742012-09-05 17:12:55 -07007446 MTRACE(macTraceMsgTx(pMac, NO_SESSION, mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07007447 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
7448
7449}
7450
7451void limProcessDelStaSelfRsp(tpAniSirGlobal pMac,tpSirMsgQ limMsgQ)
7452{
7453
7454 tpDelStaSelfParams pDelStaSelfParams;
7455 tSirMsgQ mmhMsg;
7456 tpSirSmeDelStaSelfRsp pRsp;
7457
7458
7459 pDelStaSelfParams = (tpDelStaSelfParams)limMsgQ->bodyptr;
7460
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307461 pRsp = vos_mem_malloc(sizeof(tSirSmeDelStaSelfRsp));
7462 if ( NULL == pRsp )
Jeff Johnson295189b2012-06-20 16:38:30 -07007463 {
7464 /// Buffer not available. Log error
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307465 limLog(pMac, LOGP, FL("call to AllocateMemory failed for Add Sta self RSP"));
7466 vos_mem_free(pDelStaSelfParams);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08007467 limMsgQ->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07007468 return;
7469 }
7470
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307471 vos_mem_set((tANI_U8*)pRsp, sizeof(tSirSmeDelStaSelfRsp), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07007472
7473 pRsp->mesgType = eWNI_SME_DEL_STA_SELF_RSP;
7474 pRsp->mesgLen = (tANI_U16) sizeof(tSirSmeDelStaSelfRsp);
7475 pRsp->status = pDelStaSelfParams->status;
7476
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307477 vos_mem_copy( pRsp->selfMacAddr, pDelStaSelfParams->selfMacAddr, sizeof(tSirMacAddr) );
Jeff Johnson295189b2012-06-20 16:38:30 -07007478
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307479 vos_mem_free(pDelStaSelfParams);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08007480 limMsgQ->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07007481
7482 mmhMsg.type = eWNI_SME_DEL_STA_SELF_RSP;
7483 mmhMsg.bodyptr = pRsp;
7484 mmhMsg.bodyval = 0;
Jeff Johnsone7245742012-09-05 17:12:55 -07007485 MTRACE(macTraceMsgTx(pMac, NO_SESSION, mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07007486 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
7487
7488}
7489
7490/***************************************************************
7491* tANI_U8 limUnmapChannel(tANI_U8 mapChannel)
7492* To unmap the channel to reverse the effect of mapping
7493* a band channel in hal .Mapping was done hal to overcome the
7494* limitation of the rxbd which use only 4 bit for channel number.
7495*****************************************************************/
7496tANI_U8 limUnmapChannel(tANI_U8 mapChannel)
7497{
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07007498#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
Manjunathappa Prakashb8ac0232014-03-06 17:58:20 -08007499 if( mapChannel > 0 && mapChannel <= aUnsortedChannelListSize )
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07007500 if (IS_ROAM_SCAN_OFFLOAD_FEATURE_ENABLE)
7501 return aUnsortedChannelList[mapChannel -1];
7502 else
Manjunathappa Prakasheb5a3a32014-02-13 19:57:55 -08007503#else
Manjunathappa Prakashb8ac0232014-03-06 17:58:20 -08007504 if( mapChannel > 0 && mapChannel <= abChannelSize )
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07007505#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07007506 return abChannel[mapChannel -1];
7507 else
7508 return 0;
7509}
7510
7511
7512v_U8_t* limGetIEPtr(tpAniSirGlobal pMac, v_U8_t *pIes, int length, v_U8_t eid,eSizeOfLenField size_of_len_field)
7513{
7514 int left = length;
7515 v_U8_t *ptr = pIes;
7516 v_U8_t elem_id;
7517 v_U16_t elem_len;
7518
7519 while(left >= (size_of_len_field+1))
7520 {
7521 elem_id = ptr[0];
7522 if (size_of_len_field == TWO_BYTE)
7523 {
7524 elem_len = ((v_U16_t) ptr[1]) | (ptr[2]<<8);
7525 }
7526 else
7527 {
7528 elem_len = ptr[1];
7529 }
7530
7531
7532 left -= (size_of_len_field+1);
7533 if(elem_len > left)
7534 {
7535 limLog(pMac, LOGE,
Madan Mohan Koyyalamudi8bdd3112012-09-24 13:55:14 -07007536 FL("****Invalid IEs eid = %d elem_len=%d left=%d*****"),
Jeff Johnson295189b2012-06-20 16:38:30 -07007537 eid,elem_len,left);
7538 return NULL;
7539 }
7540 if (elem_id == eid)
7541 {
7542 return ptr;
7543 }
7544
7545 left -= elem_len;
7546 ptr += (elem_len + (size_of_len_field+1));
7547 }
7548 return NULL;
7549}
7550
7551/* return NULL if oui is not found in ie
7552 return !NULL pointer to vendor IE (starting from 0xDD) if oui is found
7553 */
7554v_U8_t* limGetVendorIEOuiPtr(tpAniSirGlobal pMac, tANI_U8 *oui, tANI_U8 oui_size, tANI_U8 *ie, tANI_U16 ie_len)
7555{
7556 int left = ie_len;
7557 v_U8_t *ptr = ie;
7558 v_U8_t elem_id, elem_len;
7559
7560 while(left >= 2)
7561 {
7562 elem_id = ptr[0];
7563 elem_len = ptr[1];
7564 left -= 2;
7565 if(elem_len > left)
7566 {
7567 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007568 FL("****Invalid IEs eid = %d elem_len=%d left=%d*****"),
Jeff Johnson295189b2012-06-20 16:38:30 -07007569 elem_id,elem_len,left);
7570 return NULL;
7571 }
7572 if (SIR_MAC_EID_VENDOR == elem_id)
7573 {
7574 if(memcmp(&ptr[2], oui, oui_size)==0)
7575 return ptr;
7576 }
7577
7578 left -= elem_len;
7579 ptr += (elem_len + 2);
7580 }
7581 return NULL;
7582}
7583
Jeff Johnson295189b2012-06-20 16:38:30 -07007584//Returns length of P2P stream and Pointer ie passed to this function is filled with noa stream
7585
7586v_U8_t limBuildP2pIe(tpAniSirGlobal pMac, tANI_U8 *ie, tANI_U8 *data, tANI_U8 ie_len)
7587{
7588 int length = 0;
7589 tANI_U8 *ptr = ie;
7590
7591 ptr[length++] = SIR_MAC_EID_VENDOR;
7592 ptr[length++] = ie_len + SIR_MAC_P2P_OUI_SIZE;
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307593 vos_mem_copy(&ptr[length], SIR_MAC_P2P_OUI, SIR_MAC_P2P_OUI_SIZE);
7594 vos_mem_copy(&ptr[length + SIR_MAC_P2P_OUI_SIZE], data, ie_len);
Jeff Johnson295189b2012-06-20 16:38:30 -07007595 return (ie_len + SIR_P2P_IE_HEADER_LEN);
7596}
7597
7598//Returns length of NoA stream and Pointer pNoaStream passed to this function is filled with noa stream
7599
7600v_U8_t limGetNoaAttrStreamInMultP2pIes(tpAniSirGlobal pMac,v_U8_t* noaStream,v_U8_t noaLen,v_U8_t overFlowLen)
7601{
7602 v_U8_t overFlowP2pStream[SIR_MAX_NOA_ATTR_LEN];
Krunal Sonic768a932013-05-15 19:26:30 -07007603
7604 if ((noaLen <= (SIR_MAX_NOA_ATTR_LEN+SIR_P2P_IE_HEADER_LEN)) &&
7605 (noaLen >= overFlowLen) && (overFlowLen <= SIR_MAX_NOA_ATTR_LEN))
7606 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307607 vos_mem_copy(overFlowP2pStream,
Krunal Sonic768a932013-05-15 19:26:30 -07007608 noaStream + noaLen - overFlowLen, overFlowLen);
7609 noaStream[noaLen - overFlowLen] = SIR_MAC_EID_VENDOR;
7610 noaStream[noaLen - overFlowLen + 1] = overFlowLen + SIR_MAC_P2P_OUI_SIZE;
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307611 vos_mem_copy(noaStream+noaLen-overFlowLen + 2,
Krunal Sonic768a932013-05-15 19:26:30 -07007612 SIR_MAC_P2P_OUI, SIR_MAC_P2P_OUI_SIZE);
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307613 vos_mem_copy(noaStream+noaLen + 2 + SIR_MAC_P2P_OUI_SIZE - overFlowLen,
7614 overFlowP2pStream, overFlowLen);
Krunal Sonic768a932013-05-15 19:26:30 -07007615 }
7616
Jeff Johnson295189b2012-06-20 16:38:30 -07007617 return (noaLen + SIR_P2P_IE_HEADER_LEN);
7618
7619}
7620
7621//Returns length of NoA stream and Pointer pNoaStream passed to this function is filled with noa stream
7622v_U8_t limGetNoaAttrStream(tpAniSirGlobal pMac, v_U8_t*pNoaStream,tpPESession psessionEntry)
7623{
7624 v_U8_t len=0;
7625
7626 v_U8_t *pBody = pNoaStream;
7627
7628
7629 if ( (psessionEntry != NULL) && (psessionEntry->valid) &&
7630 (psessionEntry->pePersona == VOS_P2P_GO_MODE))
7631 {
7632 if ((!(psessionEntry->p2pGoPsUpdate.uNoa1Duration)) && (!(psessionEntry->p2pGoPsUpdate.uNoa2Duration))
7633 && (!psessionEntry->p2pGoPsUpdate.oppPsFlag)
7634 )
7635 return 0; //No NoA Descriptor then return 0
7636
7637
7638 pBody[0] = SIR_P2P_NOA_ATTR;
7639
7640 pBody[3] = psessionEntry->p2pGoPsUpdate.index;
7641 pBody[4] = psessionEntry->p2pGoPsUpdate.ctWin | (psessionEntry->p2pGoPsUpdate.oppPsFlag<<7);
7642 len = 5;
7643 pBody += len;
7644
7645
7646 if (psessionEntry->p2pGoPsUpdate.uNoa1Duration)
7647 {
7648 *pBody = psessionEntry->p2pGoPsUpdate.uNoa1IntervalCnt;
7649 pBody += 1;
7650 len +=1;
7651
7652 *((tANI_U32 *)(pBody)) = sirSwapU32ifNeeded(psessionEntry->p2pGoPsUpdate.uNoa1Duration);
7653 pBody += sizeof(tANI_U32);
7654 len +=4;
7655
7656 *((tANI_U32 *)(pBody)) = sirSwapU32ifNeeded(psessionEntry->p2pGoPsUpdate.uNoa1Interval);
7657 pBody += sizeof(tANI_U32);
7658 len +=4;
7659
7660 *((tANI_U32 *)(pBody)) = sirSwapU32ifNeeded(psessionEntry->p2pGoPsUpdate.uNoa1StartTime);
7661 pBody += sizeof(tANI_U32);
7662 len +=4;
7663
7664 }
7665
7666 if (psessionEntry->p2pGoPsUpdate.uNoa2Duration)
7667 {
7668 *pBody = psessionEntry->p2pGoPsUpdate.uNoa2IntervalCnt;
7669 pBody += 1;
7670 len +=1;
7671
7672 *((tANI_U32 *)(pBody)) = sirSwapU32ifNeeded(psessionEntry->p2pGoPsUpdate.uNoa2Duration);
7673 pBody += sizeof(tANI_U32);
7674 len +=4;
7675
7676 *((tANI_U32 *)(pBody)) = sirSwapU32ifNeeded(psessionEntry->p2pGoPsUpdate.uNoa2Interval);
7677 pBody += sizeof(tANI_U32);
7678 len +=4;
7679
7680 *((tANI_U32 *)(pBody)) = sirSwapU32ifNeeded(psessionEntry->p2pGoPsUpdate.uNoa2StartTime);
7681 pBody += sizeof(tANI_U32);
7682 len +=4;
7683
7684 }
7685
7686
7687 pBody = pNoaStream + 1;
7688 *((tANI_U16 *)(pBody)) = sirSwapU16ifNeeded(len-3);/*one byte for Attr and 2 bytes for length*/
7689
7690 return (len);
7691
7692 }
7693 return 0;
7694
7695}
Jeff Johnsone7245742012-09-05 17:12:55 -07007696
7697void peSetResumeChannel(tpAniSirGlobal pMac, tANI_U16 channel, ePhyChanBondState phyCbState)
Jeff Johnson295189b2012-06-20 16:38:30 -07007698{
7699
7700 pMac->lim.gResumeChannel = channel;
Jeff Johnsone7245742012-09-05 17:12:55 -07007701 pMac->lim.gResumePhyCbState = phyCbState;
Jeff Johnson295189b2012-06-20 16:38:30 -07007702}
Jeff Johnsone7245742012-09-05 17:12:55 -07007703
Jeff Johnson295189b2012-06-20 16:38:30 -07007704/*--------------------------------------------------------------------------
7705
7706 \brief peGetResumeChannel() - Returns the channel number for scanning, from a valid session.
7707
Jeff Johnsone7245742012-09-05 17:12:55 -07007708 This function returns the channel to resume to during link resume. channel id of 0 means HAL will
7709 resume to previous channel before link suspend
Jeff Johnson295189b2012-06-20 16:38:30 -07007710
7711 \param pMac - pointer to global adapter context
7712 \return - channel to scan from valid session else zero.
7713
7714 \sa
7715
7716 --------------------------------------------------------------------------*/
Jeff Johnsone7245742012-09-05 17:12:55 -07007717void peGetResumeChannel(tpAniSirGlobal pMac, tANI_U8* resumeChannel, ePhyChanBondState* resumePhyCbState)
Jeff Johnson295189b2012-06-20 16:38:30 -07007718{
7719
7720 //Rationale - this could be the suspend/resume for assoc and it is essential that
7721 //the new BSS is active for some time. Other BSS was anyway suspended.
7722 //TODO: Comeup with a better alternative. Sending NULL with PM=0 on other BSS means
7723 //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 -07007724 //and hence should be ok. Need to discuss this further
7725 if( !limIsInMCC(pMac) )
Jeff Johnson295189b2012-06-20 16:38:30 -07007726 {
7727 //Get current active session channel
Jeff Johnsone7245742012-09-05 17:12:55 -07007728 peGetActiveSessionChannel(pMac, resumeChannel, resumePhyCbState);
Jeff Johnson295189b2012-06-20 16:38:30 -07007729 }
7730 else
7731 {
Jeff Johnsone7245742012-09-05 17:12:55 -07007732 *resumeChannel = pMac->lim.gResumeChannel;
7733 *resumePhyCbState = pMac->lim.gResumePhyCbState;
Jeff Johnson295189b2012-06-20 16:38:30 -07007734 }
Jeff Johnsone7245742012-09-05 17:12:55 -07007735 return;
Jeff Johnson295189b2012-06-20 16:38:30 -07007736}
7737
Viral Modid86bde22012-12-10 13:09:21 -08007738tANI_BOOLEAN limIsNOAInsertReqd(tpAniSirGlobal pMac)
7739{
7740 tANI_U8 i;
7741 for(i =0; i < pMac->lim.maxBssId; i++)
7742 {
7743 if(pMac->lim.gpSession[i].valid == TRUE)
7744 {
7745 if( (eLIM_AP_ROLE == pMac->lim.gpSession[i].limSystemRole )
7746 && ( VOS_P2P_GO_MODE == pMac->lim.gpSession[i].pePersona )
7747 )
7748 {
7749 return TRUE;
7750 }
7751 }
7752 }
7753 return FALSE;
7754}
Jeff Johnsone7245742012-09-05 17:12:55 -07007755
Jeff Johnson295189b2012-06-20 16:38:30 -07007756
7757tANI_BOOLEAN limIsconnectedOnDFSChannel(tANI_U8 currentChannel)
7758{
7759 if(NV_CHANNEL_DFS == vos_nv_getChannelEnabledState(currentChannel))
7760 {
7761 return eANI_BOOLEAN_TRUE;
7762 }
7763 else
7764 {
7765 return eANI_BOOLEAN_FALSE;
7766 }
7767}
Madan Mohan Koyyalamudi1bed5982012-10-22 14:38:06 -07007768
Sandeep Puligilla60342762014-01-30 21:05:37 +05307769/**
7770 * \brief verify the changes in channel bonding
7771 *
7772 * \param pMac Pointer to the global MAC structure
7773 *
7774 * \param psessionEntry session entry
7775 * beaconSecChanWidth Secondary channel width
7776 * advertized in beacon
7777 * currentSecChanWidth Current configured width
7778 * staId Station Id
7779 * \return eSIR_SUCCESS on success, eSIR_FAILURE else
7780 */
7781tANI_BOOLEAN limCheckHTChanBondModeChange(tpAniSirGlobal pMac,
7782 tpPESession psessionEntry,
7783 tANI_U8 beaconSecChanWidth,
7784 tANI_U8 currentSecChanWidth,
7785 tANI_U8 staId)
7786{
7787 tUpdateVHTOpMode tempParam;
7788 tANI_BOOLEAN fCbMode24G = FALSE;
7789 tANI_BOOLEAN status = eANI_BOOLEAN_FALSE;
7790
7791 /* Moving from HT40 to HT20 operation*/
7792 if (((PHY_DOUBLE_CHANNEL_LOW_PRIMARY == currentSecChanWidth) ||
7793 (PHY_DOUBLE_CHANNEL_HIGH_PRIMARY == currentSecChanWidth))
7794 && (PHY_SINGLE_CHANNEL_CENTERED == beaconSecChanWidth))
7795 {
7796 tempParam.opMode = eHT_CHANNEL_WIDTH_20MHZ;
7797 tempParam.staId = staId;
7798 fCbMode24G = TRUE;
7799 }
7800
7801 /* Moving from HT20 to HT40 operation*/
7802 if ((( PHY_DOUBLE_CHANNEL_LOW_PRIMARY == beaconSecChanWidth) ||
7803 ( PHY_DOUBLE_CHANNEL_HIGH_PRIMARY == beaconSecChanWidth ))
7804 && (PHY_SINGLE_CHANNEL_CENTERED == currentSecChanWidth))
7805 {
7806 tempParam.opMode = eHT_CHANNEL_WIDTH_40MHZ;
7807 tempParam.staId = staId;
7808 fCbMode24G = TRUE;
7809 }
7810
7811 if (TRUE == fCbMode24G)
7812 {
7813 VOS_TRACE( VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,
7814 "Changing CBMODE to = %d staId = %d",
7815 tempParam.opMode, tempParam.staId );
7816 if( eSIR_SUCCESS == limSendModeUpdate(pMac, &tempParam, psessionEntry))
7817 status = eANI_BOOLEAN_TRUE;
7818 }
7819 return status;
7820}
7821
Mohit Khanna4a70d262012-09-11 16:30:12 -07007822#ifdef WLAN_FEATURE_11AC
7823tANI_BOOLEAN limCheckVHTOpModeChange( tpAniSirGlobal pMac, tpPESession psessionEntry, tANI_U8 chanWidth, tANI_U8 staId)
7824{
7825 tUpdateVHTOpMode tempParam;
7826
7827 tempParam.opMode = chanWidth;
7828 tempParam.staId = staId;
7829
7830 limSendModeUpdate( pMac, &tempParam, psessionEntry );
7831
7832 return eANI_BOOLEAN_TRUE;
7833}
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -07007834#endif
7835
krunal soni45b9eb62014-03-26 12:54:25 -07007836void limGetShortSlotFromPhyMode(tpAniSirGlobal pMac, tpPESession psessionEntry,
7837 tANI_U32 phyMode, tANI_U8 *pShortSlotEnabled)
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -07007838{
7839 tANI_U8 val=0;
7840
krunal soni45b9eb62014-03-26 12:54:25 -07007841 //only 2.4G band should have short slot enable, rest it should be default
7842 if (phyMode == WNI_CFG_PHY_MODE_11G)
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -07007843 {
krunal soni45b9eb62014-03-26 12:54:25 -07007844 /* short slot is default in all other modes */
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -07007845 if ((psessionEntry->pePersona == VOS_STA_SAP_MODE) ||
Ravi Joshi27216f12013-10-19 17:04:39 -07007846 (psessionEntry->pePersona == VOS_IBSS_MODE) ||
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -07007847 (psessionEntry->pePersona == VOS_P2P_GO_MODE))
7848 {
7849 val = true;
7850 }
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -07007851 // Program Polaris based on AP capability
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -07007852 if (psessionEntry->limMlmState == eLIM_MLM_WT_JOIN_BEACON_STATE)
krunal soni45b9eb62014-03-26 12:54:25 -07007853 {
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -07007854 // Joining BSS.
7855 val = SIR_MAC_GET_SHORT_SLOT_TIME( psessionEntry->limCurrentBssCaps);
krunal soni45b9eb62014-03-26 12:54:25 -07007856 }
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -07007857 else if (psessionEntry->limMlmState == eLIM_MLM_WT_REASSOC_RSP_STATE)
krunal soni45b9eb62014-03-26 12:54:25 -07007858 {
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -07007859 // Reassociating with AP.
7860 val = SIR_MAC_GET_SHORT_SLOT_TIME( psessionEntry->limReassocBssCaps);
krunal soni45b9eb62014-03-26 12:54:25 -07007861 }
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -07007862 }
krunal soni45b9eb62014-03-26 12:54:25 -07007863 else
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -07007864 {
krunal soni45b9eb62014-03-26 12:54:25 -07007865 /*
7866 * 11B does not short slot and short slot is default
7867 * for 11A mode. Hence, not need to set this bit
7868 */
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -07007869 val = false;
7870 }
krunal soni45b9eb62014-03-26 12:54:25 -07007871
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007872 limLog(pMac, LOG1, FL("phyMode = %u shortslotsupported = %u"), phyMode, val);
krunal soni45b9eb62014-03-26 12:54:25 -07007873 *pShortSlotEnabled = val;
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -07007874}
Sandeep Puligilla11d49a62014-01-30 12:05:16 +05307875
Kalikinkar dhara205da782014-03-21 15:49:32 -07007876void limUtilsframeshtons(tpAniSirGlobal pCtx,
7877 tANI_U8 *pOut,
7878 tANI_U16 pIn,
7879 tANI_U8 fMsb)
7880{
7881 (void)pCtx;
7882#if defined ( DOT11F_LITTLE_ENDIAN_HOST )
7883 if ( !fMsb )
7884 {
7885 DOT11F_MEMCPY(pCtx, pOut, &pIn, 2);
7886 }
7887 else
7888 {
7889 *pOut = ( pIn & 0xff00 ) >> 8;
7890 *( pOut + 1 ) = pIn & 0xff;
7891 }
7892#else
7893 if ( !fMsb )
7894 {
7895 *pOut = pIn & 0xff;
7896 *( pOut + 1 ) = ( pIn & 0xff00 ) >> 8;
7897 }
7898 else
7899 {
7900 DOT11F_MEMCPY(pCtx, pOut, &pIn, 2);
7901 }
7902#endif
7903}
7904
7905void limUtilsframeshtonl(tpAniSirGlobal pCtx,
7906 tANI_U8 *pOut,
7907 tANI_U32 pIn,
7908 tANI_U8 fMsb)
7909{
7910 (void)pCtx;
7911#if defined ( DOT11F_LITTLE_ENDIAN_HOST )
7912 if ( !fMsb )
7913 {
7914 DOT11F_MEMCPY(pCtx, pOut, &pIn, 4);
7915 }
7916 else
7917 {
7918 *pOut = ( pIn & 0xff000000 ) >> 24;
7919 *( pOut + 1 ) = ( pIn & 0x00ff0000 ) >> 16;
7920 *( pOut + 2 ) = ( pIn & 0x0000ff00 ) >> 8;
7921 *( pOut + 3 ) = ( pIn & 0x000000ff );
7922 }
7923#else
7924 if ( !fMsb )
7925 {
7926 *( pOut ) = ( pIn & 0x000000ff );
7927 *( pOut + 1 ) = ( pIn & 0x0000ff00 ) >> 8;
7928 *( pOut + 2 ) = ( pIn & 0x00ff0000 ) >> 16;
7929 *( pOut + 3 ) = ( pIn & 0xff000000 ) >> 24;
7930 }
7931 else
7932 {
7933 DOT11F_MEMCPY(pCtx, pOut, &pIn, 4);
7934 }
7935#endif
7936}
7937
7938
Sandeep Puligilla11d49a62014-01-30 12:05:16 +05307939/**--------------------------------------------
7940\fn limUpdateOBSSScanParams
7941\brief Updates OBSS SCAN IE parameters to session
7942
7943\param psessionEntry - Session Entry
7944\return NONE
7945---------------------------------------------*/
7946void limUpdateOBSSScanParams(tpPESession psessionEntry ,
7947 tDot11fIEOBSSScanParameters *pOBSSScanParameters)
7948{
7949 /*If the recieved value is not in the range specified by the Specification
7950 then it will be the default value configured through cfg */
7951 if (( pOBSSScanParameters->obssScanActiveDwell >
7952 WNI_CFG_OBSS_HT40_SCAN_ACTIVE_DWELL_TIME_STAMIN ) &&
7953 ( pOBSSScanParameters->obssScanActiveDwell <
7954 WNI_CFG_OBSS_HT40_SCAN_ACTIVE_DWELL_TIME_STAMAX))
7955 {
7956 psessionEntry->obssHT40ScanParam.OBSSScanActiveDwellTime=
7957 pOBSSScanParameters->obssScanActiveDwell;
7958 }
7959 if((pOBSSScanParameters->obssScanPassiveDwell >
7960 WNI_CFG_OBSS_HT40_SCAN_PASSIVE_DWELL_TIME_STAMIN ) &&
7961 (pOBSSScanParameters->obssScanPassiveDwell <
7962 WNI_CFG_OBSS_HT40_SCAN_PASSIVE_DWELL_TIME_STAMAX))
7963 {
7964 psessionEntry->obssHT40ScanParam.OBSSScanPassiveDwellTime =
7965 pOBSSScanParameters->obssScanPassiveDwell;
7966 }
7967 if((pOBSSScanParameters->bssWidthChannelTransitionDelayFactor >
7968 WNI_CFG_OBSS_HT40_WIDTH_CHANNEL_TRANSITION_DELAY_FACTOR_STAMIN) &&
7969 (pOBSSScanParameters->bssWidthChannelTransitionDelayFactor <
7970 WNI_CFG_OBSS_HT40_WIDTH_CHANNEL_TRANSITION_DELAY_FACTOR_STAMAX))
7971 {
7972 psessionEntry->obssHT40ScanParam.BSSWidthChannelTransitionDelayFactor =
7973 pOBSSScanParameters->bssWidthChannelTransitionDelayFactor;
7974 }
7975 if((pOBSSScanParameters->obssScanActiveTotalPerChannel >
7976 WNI_CFG_OBSS_HT40_SCAN_ACTIVE_TOTAL_PER_CHANNEL_STAMIN) &&
7977 (pOBSSScanParameters->obssScanActiveTotalPerChannel <
7978 WNI_CFG_OBSS_HT40_SCAN_ACTIVE_TOTAL_PER_CHANNEL_STAMAX))
7979 {
7980 psessionEntry->obssHT40ScanParam.OBSSScanActiveTotalPerChannel =
7981 pOBSSScanParameters->obssScanActiveTotalPerChannel;
7982 }
7983 if((pOBSSScanParameters->obssScanPassiveTotalPerChannel >
7984 WNI_CFG_OBSS_HT40_SCAN_PASSIVE_TOTAL_PER_CHANNEL_STAMIN) &&
7985 (pOBSSScanParameters->obssScanPassiveTotalPerChannel <
7986 WNI_CFG_OBSS_HT40_SCAN_PASSIVE_TOTAL_PER_CHANNEL_STAMAX))
7987 {
7988 psessionEntry->obssHT40ScanParam.OBSSScanPassiveTotalPerChannel =
7989 pOBSSScanParameters->obssScanPassiveTotalPerChannel;
7990 }
7991 if((pOBSSScanParameters->bssChannelWidthTriggerScanInterval >
7992 WNI_CFG_OBSS_HT40_SCAN_WIDTH_TRIGGER_INTERVAL_STAMIN) &&
7993 (pOBSSScanParameters->bssChannelWidthTriggerScanInterval <
7994 WNI_CFG_OBSS_HT40_SCAN_WIDTH_TRIGGER_INTERVAL_STAMAX))
7995 {
7996 psessionEntry->obssHT40ScanParam.BSSChannelWidthTriggerScanInterval =
7997 pOBSSScanParameters->bssChannelWidthTriggerScanInterval;
7998 }
7999 if((pOBSSScanParameters->obssScanActivityThreshold >
8000 WNI_CFG_OBSS_HT40_SCAN_ACTIVITY_THRESHOLD_STAMIN )&&
8001 (pOBSSScanParameters->obssScanActivityThreshold <
8002 WNI_CFG_OBSS_HT40_SCAN_ACTIVITY_THRESHOLD_STAMAX))
8003 {
8004 psessionEntry->obssHT40ScanParam.OBSSScanActivityThreshold =
8005 pOBSSScanParameters->obssScanActivityThreshold;
8006 }
8007}
Chet Lanctot8cecea22014-02-11 19:09:36 -08008008
8009#ifdef WLAN_FEATURE_11W
8010void limPmfSaQueryTimerHandler(void *pMacGlobal, tANI_U32 param)
8011{
8012 tpAniSirGlobal pMac = (tpAniSirGlobal)pMacGlobal;
8013 tPmfSaQueryTimerId timerId;
8014 tpPESession psessionEntry;
8015 tpDphHashNode pSta;
8016 tANI_U32 maxRetries;
8017
8018 limLog(pMac, LOG1, FL("SA Query timer fires"));
8019 timerId.value = param;
8020
8021 // Check that SA Query is in progress
8022 if ((psessionEntry = peFindSessionBySessionId(
8023 pMac, timerId.fields.sessionId)) == NULL)
8024 {
8025 limLog(pMac, LOGE, FL("Session does not exist for given session ID %d"),
8026 timerId.fields.sessionId);
Chet Lanctot8cecea22014-02-11 19:09:36 -08008027 return;
8028 }
8029 if ((pSta = dphGetHashEntry(pMac, timerId.fields.peerIdx,
8030 &psessionEntry->dph.dphHashTable)) == NULL)
8031 {
8032 limLog(pMac, LOGE, FL("Entry does not exist for given peer index %d"),
8033 timerId.fields.peerIdx);
Chet Lanctot8cecea22014-02-11 19:09:36 -08008034 return;
8035 }
8036 if (DPH_SA_QUERY_IN_PROGRESS != pSta->pmfSaQueryState)
8037 return;
8038
8039 // Increment the retry count, check if reached maximum
8040 if (wlan_cfgGetInt(pMac, WNI_CFG_PMF_SA_QUERY_MAX_RETRIES,
8041 &maxRetries) != eSIR_SUCCESS)
8042 {
8043 limLog(pMac, LOGE, FL("Could not retrieve PMF SA Query maximum retries value"));
8044 pSta->pmfSaQueryState = DPH_SA_QUERY_NOT_IN_PROGRESS;
8045 return;
8046 }
8047 pSta->pmfSaQueryRetryCount++;
8048 if (pSta->pmfSaQueryRetryCount >= maxRetries)
8049 {
8050 limLog(pMac, LOG1, FL("SA Query timed out"));
Chet Lanctot8cecea22014-02-11 19:09:36 -08008051 pSta->pmfSaQueryState = DPH_SA_QUERY_TIMED_OUT;
8052 return;
8053 }
8054
8055 // Retry SA Query
8056 limSendSaQueryRequestFrame(pMac, (tANI_U8 *)&(pSta->pmfSaQueryCurrentTransId),
8057 pSta->staAddr, psessionEntry);
8058 pSta->pmfSaQueryCurrentTransId++;
Chet Lanctot8cecea22014-02-11 19:09:36 -08008059 if (tx_timer_activate(&pSta->pmfSaQueryTimer) != TX_SUCCESS)
8060 {
8061 limLog(pMac, LOGE, FL("PMF SA Query timer activation failed!"));
8062 pSta->pmfSaQueryState = DPH_SA_QUERY_NOT_IN_PROGRESS;
8063 }
8064}
8065#endif
8066
Kalikinkar dhara085c02f2014-02-28 15:32:12 -08008067/** ---------------------------------------------------------
8068\fn limProcessChannelSwitchSuspendLink
8069\brief This function call channel switch functions based on
8070 the gLimChannelSwitch.state. After function return it
8071 reset the state to eLIM_CHANNEL_SWITCH_IDLE.
8072 If gLimChannelSwitch.state is non-identified then
8073 print error log as well as restore back the
8074 pre-channelSwitch.
8075\param tpAniSirGlobal pMac
8076\param eHalStatus status
8077\param tANI_U32 *ctx
8078\return None
8079 ------------------------------------------------------------*/
8080static void
8081limProcessChannelSwitchSuspendLink(tpAniSirGlobal pMac,
8082 eHalStatus status,
8083 tANI_U32 *ctx)
8084{
8085 tpPESession pSessionEntry = (tpPESession)ctx;
8086
8087 if ( eHAL_STATUS_SUCCESS != status )
8088 {
8089 limLog(pMac, LOGE,
8090 FL("Suspend link failed. still proceeding "));
8091 }
8092 if (NULL == pSessionEntry )
8093 {
8094 limLog(pMac, LOGE, FL("pSessionEntry is null pointer "));
8095 return;
8096 }
8097
8098 switch(pSessionEntry->gLimChannelSwitch.state)
8099 {
8100 case eLIM_CHANNEL_SWITCH_PRIMARY_ONLY:
8101 PELOGW(limLog(pMac, LOGW,
8102 FL("CHANNEL_SWITCH_PRIMARY_ONLY "));)
8103 limSwitchPrimaryChannel(pMac,
8104 pSessionEntry->gLimChannelSwitch.primaryChannel,
8105 pSessionEntry);
8106 pSessionEntry->gLimChannelSwitch.state =
8107 eLIM_CHANNEL_SWITCH_IDLE;
8108 break;
8109
8110 case eLIM_CHANNEL_SWITCH_PRIMARY_AND_SECONDARY:
8111 PELOGW(limLog(pMac, LOGW,
8112 FL("CHANNEL_SWITCH_PRIMARY_AND_SECONDARY"));)
8113 limSwitchPrimarySecondaryChannel(pMac, pSessionEntry,
8114 pSessionEntry->gLimChannelSwitch.primaryChannel,
8115 pSessionEntry->gLimChannelSwitch.secondarySubBand);
8116 pSessionEntry->gLimChannelSwitch.state =
8117 eLIM_CHANNEL_SWITCH_IDLE;
8118 break;
8119
8120 default:
8121 PELOGE(limLog(pMac, LOGW, FL("incorrect state %d"),
8122 pSessionEntry->gLimChannelSwitch.state);)
8123 if (limRestorePreChannelSwitchState(pMac,
8124 pSessionEntry) != eSIR_SUCCESS)
8125 {
8126 limLog(pMac, LOGE,
8127 FL("Could not restore pre-channelSwitch "
8128 "(11h) state, resetting the system"));
8129 }
8130 }
8131}
Sandeep Puligilla70b6b162014-04-19 02:06:04 +05308132
8133/** ---------------------------------------------------------
8134\fn limInitOBSSScanParams
8135\brief This function Initializes the OBSS Scan Parameters
8136\param tpAniSirGlobal pMac
8137\param tpPESession pSessionEntry
8138\return None
8139 ------------------------------------------------------------*/
8140
8141void limInitOBSSScanParams(tpAniSirGlobal pMac,
8142 tpPESession psessionEntry)
8143{
8144 tANI_U32 cfgValue;
8145
8146 if (wlan_cfgGetInt(pMac, WNI_CFG_OBSS_HT40_SCAN_ACTIVE_DWELL_TIME,
8147 &cfgValue) != eSIR_SUCCESS)
8148 {
8149 limLog(pMac, LOGE, FL("Fail to retrieve "
8150 "WNI_CFG_OBSS_HT40_SCAN_ACTIVE_DWELL_TIME value"));
8151 return ;
8152 }
8153 psessionEntry->obssHT40ScanParam.OBSSScanActiveDwellTime = cfgValue;
8154
8155 if (wlan_cfgGetInt(pMac, WNI_CFG_OBSS_HT40_SCAN_PASSIVE_DWELL_TIME,
8156 &cfgValue) != eSIR_SUCCESS)
8157 {
8158 limLog(pMac, LOGE, FL("Fail to retrieve "
8159 "WNI_CFG_OBSS_HT40_SCAN_PASSIVE_DWELL_TIME value"));
8160 return ;
8161 }
8162 psessionEntry->obssHT40ScanParam.OBSSScanPassiveDwellTime = cfgValue;
8163
8164 if (wlan_cfgGetInt(pMac, WNI_CFG_OBSS_HT40_SCAN_WIDTH_TRIGGER_INTERVAL,
8165 &cfgValue) != eSIR_SUCCESS)
8166 {
8167 limLog(pMac, LOGE, FL("Fail to retrieve "
8168 "WNI_CFG_OBSS_HT40_SCAN_WIDTH_TRIGGER_INTERVAL value"));
8169 return ;
8170 }
8171 psessionEntry->obssHT40ScanParam.BSSChannelWidthTriggerScanInterval
8172 = cfgValue;
8173 if (wlan_cfgGetInt(pMac,
8174 WNI_CFG_OBSS_HT40_SCAN_ACTIVE_TOTAL_PER_CHANNEL,
8175 &cfgValue) != eSIR_SUCCESS)
8176 {
8177 limLog(pMac, LOGE, FL("Fail to retrieve"
8178 "WNI_CFG_OBSS_HT40_SCAN_ACTIVE_TOTAL_PER_CHANNEL value"));
8179 return ;
8180 }
8181 psessionEntry->obssHT40ScanParam.OBSSScanActiveTotalPerChannel =
8182 cfgValue;
8183 if (wlan_cfgGetInt(pMac,
8184 WNI_CFG_OBSS_HT40_SCAN_PASSIVE_TOTAL_PER_CHANNEL, &cfgValue)
8185 != eSIR_SUCCESS)
8186 {
8187 limLog(pMac, LOGE, FL("Fail to retrieve"
8188 "WNI_CFG_OBSS_HT40_SCAN_PASSIVE_TOTAL_PER_CHANNEL value"));
8189 return ;
8190 }
8191 psessionEntry->obssHT40ScanParam.OBSSScanPassiveTotalPerChannel =
8192 cfgValue;
Hardik Kantilal Pateldd107952014-11-20 15:24:52 +05308193
8194 if (wlan_cfgGetInt(pMac,
8195 WNI_CFG_OBSS_HT40_WIDTH_CHANNEL_TRANSITION_DELAY_FACTOR, &cfgValue)
8196 != eSIR_SUCCESS)
8197 {
8198 limLog(pMac, LOGE, FL("Fail to retrieve"
8199 "WNI_CFG_OBSS_HT40_WIDTH_CHANNEL_TRANSITION_DELAY_FACTOR value"));
8200 return ;
8201 }
8202 psessionEntry->obssHT40ScanParam.BSSWidthChannelTransitionDelayFactor =
8203 cfgValue;
8204
8205
Sandeep Puligilla70b6b162014-04-19 02:06:04 +05308206 if (wlan_cfgGetInt(pMac, WNI_CFG_OBSS_HT40_SCAN_ACTIVITY_THRESHOLD ,
8207 &cfgValue) != eSIR_SUCCESS)
8208 {
8209 limLog(pMac, LOGE, FL("Fail to retrieve "
8210 "WNI_CFG_OBSS_HT40_SCAN_ACTIVITY_THRESHOLD value"));
8211 return ;
8212 }
8213 psessionEntry->obssHT40ScanParam.OBSSScanActivityThreshold = cfgValue;
Sushant Kaushike0d2cce2014-04-10 14:36:07 +05308214}
Sandeep Puligilla70b6b162014-04-19 02:06:04 +05308215
Sushant Kaushike0d2cce2014-04-10 14:36:07 +05308216const char * lim_ScanTypetoString(const v_U8_t scanType)
8217{
8218 switch (scanType)
8219 {
8220 CASE_RETURN_STRING( eSIR_PASSIVE_SCAN );
8221 CASE_RETURN_STRING( eSIR_ACTIVE_SCAN );
8222 CASE_RETURN_STRING( eSIR_BEACON_TABLE );
8223 default:
8224 return "Unknown ScanType";
8225 }
8226}
8227
8228const char * lim_BssTypetoString(const v_U8_t bssType)
8229{
8230 switch (bssType)
8231 {
8232 CASE_RETURN_STRING( eSIR_INFRASTRUCTURE_MODE );
8233 CASE_RETURN_STRING( eSIR_INFRA_AP_MODE );
8234 CASE_RETURN_STRING( eSIR_IBSS_MODE );
8235 CASE_RETURN_STRING( eSIR_BTAMP_STA_MODE );
8236 CASE_RETURN_STRING( eSIR_BTAMP_AP_MODE );
8237 CASE_RETURN_STRING( eSIR_AUTO_MODE );
8238 default:
8239 return "Unknown BssType";
8240 }
8241}
8242
8243const char *lim_BackgroundScanModetoString(const v_U8_t mode)
8244{
8245 switch (mode)
8246 {
8247 CASE_RETURN_STRING( eSIR_AGGRESSIVE_BACKGROUND_SCAN );
8248 CASE_RETURN_STRING( eSIR_NORMAL_BACKGROUND_SCAN );
8249 CASE_RETURN_STRING( eSIR_ROAMING_SCAN );
8250 default:
8251 return "Unknown BgScanMode";
8252 }
Sandeep Puligilla70b6b162014-04-19 02:06:04 +05308253}
Abhishek Singh0ebac9c2014-06-25 13:34:12 +05308254
8255#ifdef WLAN_FEATURE_11W
8256/**
8257 *
8258 * \brief This function is called by various LIM modules to correctly set
8259 * the Protected bit in the Frame Control Field of the 802.11 frame MAC header
8260 *
8261 *
8262 * \param pMac Pointer to Global MAC structure
8263 *
8264 * \param psessionEntry Pointer to session corresponding to the connection
8265 *
8266 * \param peer Peer address of the STA to which the frame is to be sent
8267 *
8268 * \param pMacHdr Pointer to the frame MAC header
8269 *
8270 * \return nothing
8271 *
8272 *
8273 */
8274void
8275limSetProtectedBit(tpAniSirGlobal pMac,
8276 tpPESession psessionEntry,
8277 tSirMacAddr peer,
8278 tpSirMacMgmtHdr pMacHdr)
8279{
8280 tANI_U16 aid;
8281 tpDphHashNode pStaDs;
8282
8283 if( (psessionEntry->limSystemRole == eLIM_AP_ROLE) ||
8284 (psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE) )
8285 {
8286
8287 pStaDs = dphLookupHashEntry( pMac, peer, &aid,
8288 &psessionEntry->dph.dphHashTable );
8289 if( pStaDs != NULL )
Abhishek Singh28266f02014-11-05 17:22:19 +05308290 /* rmfenabled will be set at the time of addbss.
8291 * but sometimes EAP auth fails and keys are not
8292 * installed then if we send any management frame
8293 * like deauth/disassoc with this bit set then
8294 * firmware crashes. so check for keys are
8295 * installed or not also before setting the bit
8296 */
Abhishek Singh683d7862014-11-05 17:34:31 +05308297 if (pStaDs->rmfEnabled && pStaDs->isKeyInstalled)
Abhishek Singh0ebac9c2014-06-25 13:34:12 +05308298 pMacHdr->fc.wep = 1;
8299 }
Abhishek Singh28266f02014-11-05 17:22:19 +05308300 else if ( psessionEntry->limRmfEnabled && psessionEntry->isKeyInstalled)
Abhishek Singh0ebac9c2014-06-25 13:34:12 +05308301 pMacHdr->fc.wep = 1;
8302} /*** end limSetProtectedBit() ***/
8303#endif